From 1daee49ca6edc99377b0571266252d03ce1bb25f Mon Sep 17 00:00:00 2001 From: xeolabs Date: Wed, 15 May 2024 13:41:01 +0200 Subject: [PATCH 1/3] Changelog update --- ...ance_createWithMouse_labelsNotOnWires.html | 51 ++++++++++++++++--- .../distance_createWithMouse_nosnapping.html | 24 +++++++-- .../distance_createWithMouse_snapping.html | 24 +++++++-- ...istance_createWithMouse_snapping_Lyon.html | 2 +- ...thMouse_snapping_OpenProject_Hospital.html | 24 +++++++-- ...ateWithMouse_snapping_canvasToPagePos.html | 24 +++++++-- ...createWithMouse_snapping_dtx_batching.html | 24 +++++++-- ...eateWithMouse_snapping_dtx_instancing.html | 24 +++++++-- ...createWithMouse_snapping_offsetCanvas.html | 24 +++++++-- ...createWithMouse_snapping_vbo_batching.html | 16 ++++-- ...eateWithMouse_snapping_vbo_instancing.html | 24 +++++++-- .../DistanceMeasurementsMouseControl.js | 2 + 12 files changed, 218 insertions(+), 45 deletions(-) diff --git a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html index 7b019b6757..90f1424b7d 100644 --- a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html +++ b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html @@ -256,22 +256,57 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] ] }); - // viewer.cameraControl.on("rightClick", function (e) { - // canvasContextMenu.show(e.pagePos[0], e.pagePos[1]); - // e.event.preventDefault(); - // }); + const getCanvasPosFromEvent = function (event) { + const canvasPos = []; + if (!event) { + event = window.event; + canvasPos[0] = event.x; + canvasPos[1] = event.y; + } else { + let element = event.target; + let totalOffsetLeft = 0; + let totalOffsetTop = 0; + let totalScrollX = 0; + let totalScrollY = 0; + while (element.offsetParent) { + totalOffsetLeft += element.offsetLeft; + totalOffsetTop += element.offsetTop; + totalScrollX += element.scrollLeft; + totalScrollY += element.scrollTop; + element = element.offsetParent; + } + canvasPos[0] = event.pageX + totalScrollX - totalOffsetLeft; + canvasPos[1] = event.pageY + totalScrollY - totalOffsetTop; + } + return canvasPos; + }; + + viewer.scene.canvas.canvas.addEventListener('contextmenu', (event) => { + const canvasPos = getCanvasPosFromEvent(event); + canvasContextMenu.show(canvasPos[0], canvasPos[1]); + event.preventDefault(); + event.preventDefault(); + }); //------------------------------------------------------------------------------------------------------------------ // Create an DistanceMeasurementsPlugin, activate its DistanceMeasuremntsControl diff --git a/examples/measurement/distance_createWithMouse_nosnapping.html b/examples/measurement/distance_createWithMouse_nosnapping.html index cf501350b6..79fd40a958 100644 --- a/examples/measurement/distance_createWithMouse_nosnapping.html +++ b/examples/measurement/distance_createWithMouse_nosnapping.html @@ -220,6 +220,14 @@

Assets

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -244,12 +252,20 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurements.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurements.control.active - ? distanceMeasurements.control.deactivate() - : distanceMeasurements.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping.html b/examples/measurement/distance_createWithMouse_snapping.html index c77782970a..5a26b2cfb5 100644 --- a/examples/measurement/distance_createWithMouse_snapping.html +++ b/examples/measurement/distance_createWithMouse_snapping.html @@ -249,6 +249,14 @@

Assets

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -273,12 +281,20 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_Lyon.html b/examples/measurement/distance_createWithMouse_snapping_Lyon.html index 7ac7f45bb1..9b14f81a1d 100644 --- a/examples/measurement/distance_createWithMouse_snapping_Lyon.html +++ b/examples/measurement/distance_createWithMouse_snapping_Lyon.html @@ -376,7 +376,7 @@

Assets

document.getElementById("time").innerHTML = "Loaded 9 models in " + Math.floor((t1 - t0)) / 1000 + " seconds
Objects: " + numEntities; - distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.activate(); }); }); diff --git a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html index ffc71fa97c..8593d2dea9 100644 --- a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html +++ b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html @@ -231,6 +231,14 @@

Assets

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -255,12 +263,20 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html index d6fab829ba..8b330a9080 100644 --- a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html +++ b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html @@ -244,6 +244,14 @@

Assets

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -268,12 +276,20 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html index bf4b9296c4..08749aed0c 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html @@ -421,6 +421,14 @@

Tutorials

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -445,12 +453,20 @@

Tutorials

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html index 747c04158b..004cb69db5 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html @@ -458,6 +458,14 @@

Tutorials

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -482,12 +490,20 @@

Tutorials

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html index 57781527de..5bca580999 100644 --- a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html +++ b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html @@ -230,6 +230,14 @@

Assets

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -254,12 +262,20 @@

Assets

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html index 1ddea91871..8ed1dfac0a 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html @@ -441,12 +441,20 @@

Tutorials

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html index 4d905b5315..c43213a221 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html @@ -426,6 +426,14 @@

Tutorials

doAction: function (context) { context.distanceMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); + } } ] ] @@ -450,12 +458,20 @@

Tutorials

[ { getTitle: (context) => { - return distanceMeasurementsPlugin.control.active ? "Deactivate Control" : "Activate Control"; + return distanceMeasurementsMouseControl.active ? "Deactivate Control" : "Activate Control"; }, doAction: function (context) { - distanceMeasurementsPlugin.control.active - ? distanceMeasurementsPlugin.control.deactivate() - : distanceMeasurementsPlugin.control.activate(); + distanceMeasurementsMouseControl.active + ? distanceMeasurementsMouseControl.deactivate() + : distanceMeasurementsMouseControl.activate(); + } + }, + { + getTitle: () => { + return "Reset Control"; + }, + doAction: function () { + distanceMeasurementsMouseControl.reset(); } } ] diff --git a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js index 772de4c58d..42ff677c1e 100644 --- a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +++ b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js @@ -397,6 +397,8 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + + this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; } /** From a5c272f577bd1057a7484a306241cdea4ff603db Mon Sep 17 00:00:00 2001 From: xeolabs Date: Wed, 15 May 2024 14:49:22 +0200 Subject: [PATCH 2/3] Destroy measurement in progress when resetting measurement controls --- dist/xeokit-sdk.cjs.js | 57 + dist/xeokit-sdk.es.js | 57 + dist/xeokit-sdk.es5.js | 28 +- dist/xeokit-sdk.min.cjs.js | 6 +- dist/xeokit-sdk.min.es.js | 4 +- dist/xeokit-sdk.min.es5.js | 4 +- .../AngleMeasurementsControl.js.json | 513 +- .../AngleMeasurementsMouseControl.js.json | 12576 ++++++------ .../AngleMeasurementsTouchControl.js.json | 778 +- .../DistanceMeasurementsControl.js.json | 513 +- .../DistanceMeasurementsMouseControl.js.json | 11903 +++++++----- .../DistanceMeasurementsTouchControl.js.json | 1055 +- .../lib/handlers/MouseMiscHandler.js.json | 628 +- .../source/viewer/scene/marker/Marker.js.json | 10188 +++++----- .../scene/model/SceneModelTransform.js.json | 8478 ++++---- ...tsControl.js~AngleMeasurementsControl.html | 87 +- ...trol.js~AngleMeasurementsMouseControl.html | 116 +- ...trol.js~AngleMeasurementsTouchControl.html | 116 +- ...ontrol.js~DistanceMeasurementsControl.html | 87 +- ...l.js~DistanceMeasurementsMouseControl.html | 116 +- ...l.js~DistanceMeasurementsTouchControl.html | 116 +- docs/coverage.json | 33 +- .../AngleMeasurementsControl.js.html | 9 + .../AngleMeasurementsMouseControl.js.html | 13 +- .../AngleMeasurementsTouchControl.js.html | 9 + .../DistanceMeasurementsControl.js.html | 9 + .../DistanceMeasurementsMouseControl.js.html | 15 +- .../DistanceMeasurementsTouchControl.js.html | 10 + .../lib/handlers/MouseMiscHandler.js.html | 4 +- .../src/viewer/scene/marker/Marker.js.html | 2 +- .../scene/model/SceneModelTransform.js.html | 2 +- docs/index.json | 16100 ++++++++-------- docs/script/search_index.js | 36 + docs/source.html | 830 +- .../angle_createWithMouse_nosnapping.html | 24 + .../angle_createWithMouse_snapping.html | 26 + ...ateWithMouse_snapping_canvasToPagePos.html | 27 +- ...createWithMouse_snapping_offsetCanvas.html | 16 + ...ance_createWithMouse_labelsNotOnWires.html | 2 +- .../distance_createWithMouse_nosnapping.html | 4 +- .../distance_createWithMouse_snapping.html | 4 +- ...thMouse_snapping_OpenProject_Hospital.html | 4 +- ...ateWithMouse_snapping_canvasToPagePos.html | 4 +- ...createWithMouse_snapping_dtx_batching.html | 4 +- ...eateWithMouse_snapping_dtx_instancing.html | 4 +- ...createWithMouse_snapping_offsetCanvas.html | 4 +- ...createWithMouse_snapping_vbo_batching.html | 2 +- ...eateWithMouse_snapping_vbo_instancing.html | 4 +- package.json | 2 +- .../AngleMeasurementsControl.js | 10 + .../AngleMeasurementsMouseControl.js | 9 + .../AngleMeasurementsTouchControl.js | 9 + .../DistanceMeasurementsControl.js | 11 + .../DistanceMeasurementsMouseControl.js | 9 + .../DistanceMeasurementsTouchControl.js | 10 + .../AngleMeasurementsControl.d.ts | 7 + .../AngleMeasurementsMouseControl.d.ts | 8 + .../AngleMeasurementsTouchControl.d.ts | 8 + .../DistanceMeasurementsControl.d.ts | 7 + .../DistanceMeasurementsMouseControl.d.ts | 8 + .../DistanceMeasurementsTouchControl.d.ts | 8 + 61 files changed, 35242 insertions(+), 29491 deletions(-) diff --git a/dist/xeokit-sdk.cjs.js b/dist/xeokit-sdk.cjs.js index d2c41f2741..87322004ce 100644 --- a/dist/xeokit-sdk.cjs.js +++ b/dist/xeokit-sdk.cjs.js @@ -12130,6 +12130,15 @@ class AngleMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this AngleMeasurementsMouseControl. * @@ -12580,6 +12589,15 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl { this._mouseState = MOUSE_FINDING_ORIGIN; } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsMouseControl. */ @@ -13933,6 +13951,15 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl { } } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsTouchControl. */ @@ -87189,6 +87216,15 @@ class DistanceMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this DistanceMeasurementsControl. * @@ -87595,6 +87631,17 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl { this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + + this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** @@ -88894,6 +88941,16 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl { this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** diff --git a/dist/xeokit-sdk.es.js b/dist/xeokit-sdk.es.js index 0838cba486..7d7bb76c12 100644 --- a/dist/xeokit-sdk.es.js +++ b/dist/xeokit-sdk.es.js @@ -12126,6 +12126,15 @@ class AngleMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this AngleMeasurementsMouseControl. * @@ -12576,6 +12585,15 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl { this._mouseState = MOUSE_FINDING_ORIGIN; } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsMouseControl. */ @@ -13929,6 +13947,15 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl { } } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsTouchControl. */ @@ -87185,6 +87212,15 @@ class DistanceMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this DistanceMeasurementsControl. * @@ -87591,6 +87627,17 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl { this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + + this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** @@ -88890,6 +88937,16 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl { this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** diff --git a/dist/xeokit-sdk.es5.js b/dist/xeokit-sdk.es5.js index 3a683aa750..fef22bcb54 100644 --- a/dist/xeokit-sdk.es5.js +++ b/dist/xeokit-sdk.es5.js @@ -2933,6 +2933,10 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s * * @abstract */},{key:"reset",value:function reset(){}/** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + */},{key:"currentMeasurement",get:function get(){return null;}/** * Destroys this AngleMeasurementsMouseControl. * * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl. @@ -3024,6 +3028,10 @@ _this19._initMarkerDiv();_this19._onMouseHoverSurface=null;_this19._onHoverNothi * * Does nothing if the AngleMeasurementsMouseControl is not active. */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */},{key:"currentMeasurement",get:function get(){return this._currentAngleMeasurement;}/** * Destroys this AngleMeasurementsMouseControl. */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsMouseControl;}(AngleMeasurementsControl);/** * {@link Viewer} plugin for measuring angles. @@ -3402,6 +3410,10 @@ enableCameraNavigation();break;case WAITING_FOR_TARGET_QUICK_TOUCH_END$1:{if(num * * Does nothing if the AngleMeasurementsTouchControl is not active. */},{key:"reset",value:function reset(){if(!this._active){return;}if(this._currentAngleMeasurement){this.angleMeasurementsPlugin.fire("measurementCancel",this._currentAngleMeasurement);this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}}/** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */},{key:"currentMeasurement",get:function get(){return this._currentAngleMeasurement;}/** * Destroys this AngleMeasurementsTouchControl. */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsTouchControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsTouchControl;}(AngleMeasurementsControl);/** * A {@link Marker} with an HTML label attached to it, managed by an {@link AnnotationsPlugin}. @@ -19476,6 +19488,10 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s * * @abstract */},{key:"reset",value:function reset(){}/** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + */},{key:"currentMeasurement",get:function get(){return null;}/** * Destroys this DistanceMeasurementsControl. * * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl. @@ -19561,7 +19577,11 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl. * * Does nothing if the DistanceMeasurementsMouseControl is not active. - */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/** + */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;}/** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */},{key:"currentMeasurement",get:function get(){return this._currentDistanceMeasurement;}/** * Destroys this DistanceMeasurementsMouseControl. * * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl. @@ -19994,7 +20014,11 @@ return;}if(_this90.pointerLens){_this90.pointerLens.canvasPos=touchMoveCanvasPos * Destroys any {@link DistanceMeasurement} under construction. * * Does nothing if the DistanceMeasurementsTouchControl is not active. - */},{key:"reset",value:function reset(){if(!this._active){return;}if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/** + */},{key:"reset",value:function reset(){if(!this._active){return;}if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._mouseState=WAITING_FOR_ORIGIN_TOUCH_START;}/** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */},{key:"currentMeasurement",get:function get(){return this._currentDistanceMeasurement;}/** * Destroys this DistanceMeasurementsTouchControl. */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(DistanceMeasurementsTouchControl.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsTouchControl;}(DistanceMeasurementsControl);/** * {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching diff --git a/dist/xeokit-sdk.min.cjs.js b/dist/xeokit-sdk.min.cjs.js index a7050e4f17..fb3cfbdf62 100644 --- a/dist/xeokit-sdk.min.cjs.js +++ b/dist/xeokit-sdk.min.cjs.js @@ -1,4 +1,4 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{constructor(e,t){this.items=e||[],this._lastUniqueId=(t||0)+1}addItem(){let e;if(2===arguments.length){const t=arguments[0];if(e=arguments[1],this.items[t])throw"ID clash: '"+t+"'";return this.items[t]=e,t}for(e=arguments[0]||{};;){const t=this._lastUniqueId++;if(!this.items[t])return this.items[t]=e,t}}removeItem(e){const t=this.items[e];return delete this.items[e],t}}const t=new e;class i{constructor(e){this.id=e,this.parentItem=null,this.groups=[],this.menuElement=null,this.shown=!1,this.mouseOver=0}}class s{constructor(){this.items=[]}}class r{constructor(e,t,i,s,r){this.id=e,this.getTitle=t,this.doAction=i,this.getEnabled=s,this.getShown=r,this.itemElement=null,this.subMenu=null,this.enabled=!0}}let o=!0,n=o?Float64Array:Float32Array;const a=new n(3),l=new n(16),A=new n(16),h=new n(4),c={setDoublePrecisionEnabled(e){o=e,n=o?Float64Array:Float32Array},getDoublePrecisionEnabled:()=>o,MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId(e,t){const i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:(e,t)=>e+"#"+t,safeInv(e){const t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:e=>new n(e||2),vec3:e=>new n(e||3),vec4:e=>new n(e||4),mat3:e=>new n(e||9),mat3ToMat4:(e,t=new n(16))=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t),mat4:e=>new n(e||16),mat4ToMat3(e,t){},doublesToFloats(e,t,i){const s=new n(2);for(let r=0,o=e.length;r{const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return()=>{const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return`${e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]}-${e[255&i]}${e[i>>8&255]}-${e[i>>16&15|64]}${e[i>>24&255]}-${e[63&s|128]}${e[s>>8&255]}-${e[s>>16&255]}${e[s>>24&255]}${e[255&r]}${e[r>>8&255]}${e[r>>16&255]}${e[r>>24&255]}`}})(),clamp:(e,t,i)=>Math.max(t,Math.min(i,e)),fmod(e,t){if(ee[0]===t[0]&&e[1]===t[1]&&e[2]===t[2],negateVec3:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t),negateVec4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t),addVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i),addVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i),addVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i),addVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i),subVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i),subVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i),subVec2:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i),geometricMeanVec2(...e){const t=new n(e[0]);for(let i=1;i(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i),subScalarVec4:(e,t,i)=>(i||(i=e),i[0]=t-e[0],i[1]=t-e[1],i[2]=t-e[2],i[3]=t-e[3],i),mulVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3],i),mulVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i),mulVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i),mulVec2Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i),divVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i),divVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i[3]=e[3]/t[3],i),divScalarVec3:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i),divVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i),divVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i[3]=e[3]/t,i),divScalarVec4:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i[3]=e/t[3],i),dotVec4:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],cross3Vec4(e,t){const i=e[0],s=e[1],r=e[2],o=t[0],n=t[1],a=t[2];return[s*a-r*n,r*o-i*a,i*n-s*o,0]},cross3Vec3(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return i[0]=r*l-o*a,i[1]=o*n-s*l,i[2]=s*a-r*n,i},sqLenVec4:e=>c.dotVec4(e,e),lenVec4:e=>Math.sqrt(c.sqLenVec4(e)),dotVec3:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],dotVec2:(e,t)=>e[0]*t[0]+e[1]*t[1],sqLenVec3:e=>c.dotVec3(e,e),sqLenVec2:e=>c.dotVec2(e,e),lenVec3:e=>Math.sqrt(c.sqLenVec3(e)),distVec3:(()=>{const e=new n(3);return(t,i)=>c.lenVec3(c.subVec3(t,i,e))})(),lenVec2:e=>Math.sqrt(c.sqLenVec2(e)),distVec2:(()=>{const e=new n(2);return(t,i)=>c.lenVec2(c.subVec2(t,i,e))})(),rcpVec3:(e,t)=>c.divScalarVec3(1,e,t),normalizeVec4(e,t){const i=1/c.lenVec4(e);return c.mulVec4Scalar(e,i,t)},normalizeVec3(e,t){const i=1/c.lenVec3(e);return c.mulVec3Scalar(e,i,t)},normalizeVec2(e,t){const i=1/c.lenVec2(e);return c.mulVec2Scalar(e,i,t)},angleVec3(e,t){let i=c.dotVec3(e,t)/Math.sqrt(c.sqLenVec3(e)*c.sqLenVec3(t));return i=i<-1?-1:i>1?1:i,Math.acos(i)},vec3FromMat4Scale:(()=>{const e=new n(3);return(t,i)=>(e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=c.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=c.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=c.lenVec3(e),i)})(),vecToArray:(()=>{function e(e){return Math.round(1e5*e)/1e5}return t=>{for(let i=0,s=(t=Array.prototype.slice.call(t)).length;i({x:e[0],y:e[1],z:e[2]}),xyzObjectToArray:(e,t)=>((t=t||c.vec3())[0]=e.x,t[1]=e.y,t[2]=e.z,t),dupMat4:e=>e.slice(0,16),mat4To3:e=>[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]],m4s:e=>[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],setMat4ToZeroes:()=>c.m4s(0),setMat4ToOnes:()=>c.m4s(1),diagonalMat4v:e=>new n([e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,0,0,0,e[3]]),diagonalMat4c:(e,t,i,s)=>c.diagonalMat4v([e,t,i,s]),diagonalMat4s:e=>c.diagonalMat4c(e,e,e,e),identityMat4:(e=new n(16))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e),identityMat3:(e=new n(9))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e),isIdentityMat4:e=>1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15],negateMat4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t),addMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i),addMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i),addScalarMat4:(e,t,i)=>c.addMat4Scalar(t,e,i),subMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i),subMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i),subScalarMat4:(e,t,i)=>(i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i),mulMat4(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=e[3],a=e[4],l=e[5],A=e[6],h=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],_=e[15],v=t[0],b=t[1],y=t[2],B=t[3],x=t[4],w=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],I=t[11],D=t[12],S=t[13],T=t[14],R=t[15];return i[0]=v*s+b*a+y*c+B*f,i[1]=v*r+b*l+y*u+B*g,i[2]=v*o+b*A+y*d+B*m,i[3]=v*n+b*h+y*p+B*_,i[4]=x*s+w*a+P*c+C*f,i[5]=x*r+w*l+P*u+C*g,i[6]=x*o+w*A+P*d+C*m,i[7]=x*n+w*h+P*p+C*_,i[8]=M*s+F*a+E*c+I*f,i[9]=M*r+F*l+E*u+I*g,i[10]=M*o+F*A+E*d+I*m,i[11]=M*n+F*h+E*p+I*_,i[12]=D*s+S*a+T*c+R*f,i[13]=D*r+S*l+T*u+R*g,i[14]=D*o+S*A+T*d+R*m,i[15]=D*n+S*h+T*p+R*_,i},mulMat3(e,t,i){i||(i=new n(9));const s=e[0],r=e[3],o=e[6],a=e[1],l=e[4],A=e[7],h=e[2],c=e[5],u=e[8],d=t[0],p=t[3],f=t[6],g=t[1],m=t[4],_=t[7],v=t[2],b=t[5],y=t[8];return i[0]=s*d+r*g+o*v,i[3]=s*p+r*m+o*b,i[6]=s*f+r*_+o*y,i[1]=a*d+l*g+A*v,i[4]=a*p+l*m+A*b,i[7]=a*f+l*_+A*y,i[2]=h*d+c*g+u*v,i[5]=h*p+c*m+u*b,i[8]=h*f+c*_+u*y,i},mulMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i),mulMat4v4(e,t,i=c.vec4()){const s=t[0],r=t[1],o=t[2],n=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12]*n,i[1]=e[1]*s+e[5]*r+e[9]*o+e[13]*n,i[2]=e[2]*s+e[6]*r+e[10]*o+e[14]*n,i[3]=e[3]*s+e[7]*r+e[11]*o+e[15]*n,i},transposeMat4(e,t){const i=e[4],s=e[14],r=e[8],o=e[13],n=e[12],a=e[9];if(!t||e===t){const t=e[1],l=e[2],A=e[3],h=e[6],c=e[7],u=e[11];return e[1]=i,e[2]=r,e[3]=n,e[4]=t,e[6]=a,e[7]=o,e[8]=l,e[9]=h,e[11]=s,e[12]=A,e[13]=c,e[14]=u,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=n,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=o,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3(e,t){if(t===e){const i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4(e){const t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],n=e[5],a=e[6],l=e[7],A=e[8],h=e[9],c=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15];return d*h*a*r-A*p*a*r-d*n*c*r+o*p*c*r+A*n*f*r-o*h*f*r-d*h*s*l+A*p*s*l+d*i*c*l-t*p*c*l-A*i*f*l+t*h*f*l+d*n*s*u-o*p*s*u-d*i*a*u+t*p*a*u+o*i*f*u-t*n*f*u-A*n*s*g+o*h*s*g+A*i*a*g-t*h*a*g-o*i*c*g+t*n*c*g},inverseMat4(e,t){t||(t=e);const i=e[0],s=e[1],r=e[2],o=e[3],n=e[4],a=e[5],l=e[6],A=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],_=i*a-s*n,v=i*l-r*n,b=i*A-o*n,y=s*l-r*a,B=s*A-o*a,x=r*A-o*l,w=h*f-c*p,P=h*g-u*p,C=h*m-d*p,M=c*g-u*f,F=c*m-d*f,E=u*m-d*g,I=1/(_*E-v*F+b*M+y*C-B*P+x*w);return t[0]=(a*E-l*F+A*M)*I,t[1]=(-s*E+r*F-o*M)*I,t[2]=(f*x-g*B+m*y)*I,t[3]=(-c*x+u*B-d*y)*I,t[4]=(-n*E+l*C-A*P)*I,t[5]=(i*E-r*C+o*P)*I,t[6]=(-p*x+g*b-m*v)*I,t[7]=(h*x-u*b+d*v)*I,t[8]=(n*F-a*C+A*w)*I,t[9]=(-i*F+s*C-o*w)*I,t[10]=(p*B-f*b+m*_)*I,t[11]=(-h*B+c*b-d*_)*I,t[12]=(-n*M+a*P-l*w)*I,t[13]=(i*M-s*P+r*w)*I,t[14]=(-p*y+f*v-g*_)*I,t[15]=(h*y-c*v+u*_)*I,t},traceMat4:e=>e[0]+e[5]+e[10]+e[15],translationMat4v(e,t){const i=t||c.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v(e,t){const i=t||c.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(()=>{const e=new n(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,c.translationMat4v(e,r))})(),translationMat4s:(e,t)=>c.translationMat4c(e,e,e,t),translateMat4v:(e,t)=>c.translateMat4c(e[0],e[1],e[2],t),translateMat4c(e,t,i,s){const r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;const o=s[7];s[4]+=o*e,s[5]+=o*t,s[6]+=o*i;const n=s[11];s[8]+=n*e,s[9]+=n*t,s[10]+=n*i;const a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:(e,t,i)=>(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i),rotationMat4v(e,t,i){const s=c.normalizeVec4([t[0],t[1],t[2],0],[]),r=Math.sin(e),o=Math.cos(e),n=1-o,a=s[0],l=s[1],A=s[2];let h,u,d,p,f,g;return h=a*l,u=l*A,d=A*a,p=a*r,f=l*r,g=A*r,(i=i||c.mat4())[0]=n*a*a+o,i[1]=n*h+g,i[2]=n*d-f,i[3]=0,i[4]=n*h-g,i[5]=n*l*l+o,i[6]=n*u+p,i[7]=0,i[8]=n*d+f,i[9]=n*u-p,i[10]=n*A*A+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:(e,t,i,s,r)=>c.rotationMat4v(e,[t,i,s],r),scalingMat4v:(e,t=c.identityMat4())=>(t[0]=e[0],t[5]=e[1],t[10]=e[2],t),scalingMat3v:(e,t=c.identityMat3())=>(t[0]=e[0],t[4]=e[1],t),scalingMat4c:(()=>{const e=new n(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,c.scalingMat4v(e,r))})(),scaleMat4c:(e,t,i,s)=>(s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s),scaleMat4v(e,t){const i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:e=>c.scalingMat4c(e,e,e),rotationTranslationMat4(e,t,i=c.mat4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=s+s,l=r+r,A=o+o,h=s*a,u=s*l,d=s*A,p=r*l,f=r*A,g=o*A,m=n*a,_=n*l,v=n*A;return i[0]=1-(p+g),i[1]=u+v,i[2]=d-_,i[3]=0,i[4]=u-v,i[5]=1-(h+g),i[6]=f+m,i[7]=0,i[8]=d+_,i[9]=f-m,i[10]=1-(h+p),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler(e,t,i=c.vec4()){const s=c.clamp,r=e[0],o=e[4],n=e[8],a=e[1],l=e[5],A=e[9],h=e[2],u=e[6],d=e[10];return"XYZ"===t?(i[1]=Math.asin(s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(-A,d),i[2]=Math.atan2(-o,r)):(i[0]=Math.atan2(u,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[1]=Math.atan2(n,d),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-h,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(u,-1,1)),Math.abs(u)<.99999?(i[1]=Math.atan2(-h,d),i[2]=Math.atan2(-o,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(h,-1,1)),Math.abs(h)<.99999?(i[0]=Math.atan2(u,d),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-o,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-A,l),i[1]=Math.atan2(-h,r)):(i[0]=0,i[1]=Math.atan2(n,d))):"XZY"===t&&(i[2]=Math.asin(-s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(u,l),i[1]=Math.atan2(n,r)):(i[0]=Math.atan2(-A,d),i[1]=0)),i},composeMat4:(e,t,i,s=c.mat4())=>(c.quaternionToRotationMat4(t,s),c.scaleMat4v(i,s),c.translateMat4v(e,s),s),decomposeMat4:(()=>{const e=new n(3),t=new n(16);return function(i,s,r,o){e[0]=i[0],e[1]=i[1],e[2]=i[2];let n=c.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];const a=c.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];const l=c.lenVec3(e);c.determinantMat4(i)<0&&(n=-n),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);const A=1/n,h=1/a,u=1/l;return t[0]*=A,t[1]*=A,t[2]*=A,t[4]*=h,t[5]*=h,t[6]*=h,t[8]*=u,t[9]*=u,t[10]*=u,c.mat4ToQuaternion(t,r),o[0]=n,o[1]=a,o[2]=l,this}})(),getColMat4(e,t){const i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v(e,t,i,s){s||(s=c.mat4());const r=e[0],o=e[1],n=e[2],a=i[0],l=i[1],A=i[2],h=t[0],u=t[1],d=t[2];if(r===h&&o===u&&n===d)return c.identityMat4();let p,f,g,m,_,v,b,y,B,x;return p=r-h,f=o-u,g=n-d,x=1/Math.sqrt(p*p+f*f+g*g),p*=x,f*=x,g*=x,m=l*g-A*f,_=A*p-a*g,v=a*f-l*p,x=Math.sqrt(m*m+_*_+v*v),x?(x=1/x,m*=x,_*=x,v*=x):(m=0,_=0,v=0),b=f*v-g*_,y=g*m-p*v,B=p*_-f*m,x=Math.sqrt(b*b+y*y+B*B),x?(x=1/x,b*=x,y*=x,B*=x):(b=0,y=0,B=0),s[0]=m,s[1]=b,s[2]=p,s[3]=0,s[4]=_,s[5]=y,s[6]=f,s[7]=0,s[8]=v,s[9]=B,s[10]=g,s[11]=0,s[12]=-(m*r+_*o+v*n),s[13]=-(b*r+y*o+B*n),s[14]=-(p*r+f*o+g*n),s[15]=1,s},lookAtMat4c:(e,t,i,s,r,o,n,a,l)=>c.lookAtMat4v([e,t,i],[s,r,o],[n,a,l],[]),orthoMat4c(e,t,i,s,r,o,n){n||(n=c.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2/l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-2/A,n[11]=0,n[12]=-(e+t)/a,n[13]=-(s+i)/l,n[14]=-(o+r)/A,n[15]=1,n},frustumMat4v(e,t,i){i||(i=c.mat4());const s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];c.addVec4(r,s,l),c.subVec4(r,s,A);const o=2*s[2],n=A[0],a=A[1],h=A[2];return i[0]=o/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o/a,i[6]=0,i[7]=0,i[8]=l[0]/n,i[9]=l[1]/a,i[10]=-l[2]/h,i[11]=-1,i[12]=0,i[13]=0,i[14]=-o*r[2]/h,i[15]=0,i},frustumMat4(e,t,i,s,r,o,n){n||(n=c.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2*r/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2*r/l,n[6]=0,n[7]=0,n[8]=(t+e)/a,n[9]=(s+i)/l,n[10]=-(o+r)/A,n[11]=-1,n[12]=0,n[13]=0,n[14]=-o*r*2/A,n[15]=0,n},perspectiveMat4(e,t,i,s,r){const o=[],n=[];return o[2]=i,n[2]=s,n[1]=o[2]*Math.tan(e/2),o[1]=-n[1],n[0]=n[1]*t,o[0]=-n[0],c.frustumMat4v(o,n,r)},compareMat4:(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15],transformPoint3(e,t,i=c.vec3()){const s=t[0],r=t[1],o=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12],i[1]=e[1]*s+e[5]*r+e[9]*o+e[13],i[2]=e[2]*s+e[6]*r+e[10]*o+e[14],i},transformPoint4:(e,t,i=c.vec4())=>(i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i),transformPoints3(e,t,i){const s=i||[],r=t.length;let o,n,a,l;const A=e[0],h=e[1],c=e[2],u=e[3],d=e[4],p=e[5],f=e[6],g=e[7],m=e[8],_=e[9],v=e[10],b=e[11],y=e[12],B=e[13],x=e[14],w=e[15];let P;for(let e=0;e{const e=new n(16),t=new n(16),i=new n(16);return function(s,r,o,n){return this.transformVec3(this.mulMat4(this.inverseMat4(r,e),this.inverseMat4(o,t),i),s,n)}})(),lerpVec3(e,t,i,s,r,o){const n=o||c.vec3(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n},lerpMat4(e,t,i,s,r,o){const n=o||c.mat4(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n[3]=s[3]+a*(r[3]-s[3]),n[4]=s[4]+a*(r[4]-s[4]),n[5]=s[5]+a*(r[5]-s[5]),n[6]=s[6]+a*(r[6]-s[6]),n[7]=s[7]+a*(r[7]-s[7]),n[8]=s[8]+a*(r[8]-s[8]),n[9]=s[9]+a*(r[9]-s[9]),n[10]=s[10]+a*(r[10]-s[10]),n[11]=s[11]+a*(r[11]-s[11]),n[12]=s[12]+a*(r[12]-s[12]),n[13]=s[13]+a*(r[13]-s[13]),n[14]=s[14]+a*(r[14]-s[14]),n[15]=s[15]+a*(r[15]-s[15]),n},flatten(e){const t=[];let i,s,r,o,n;for(i=0,s=e.length;i(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e),eulerToQuaternion(e,t,i=c.vec4()){const s=e[0]*c.DEGTORAD/2,r=e[1]*c.DEGTORAD/2,o=e[2]*c.DEGTORAD/2,n=Math.cos(s),a=Math.cos(r),l=Math.cos(o),A=Math.sin(s),h=Math.sin(r),u=Math.sin(o);return"XYZ"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l-A*h*u):"YXZ"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l+A*h*u):"ZXY"===t?(i[0]=A*a*l-n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l-A*h*u):"ZYX"===t?(i[0]=A*a*l-n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l+A*h*u):"YZX"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l-A*h*u):"XZY"===t&&(i[0]=A*a*l-n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l+A*h*u),i},mat4ToQuaternion(e,t=c.vec4()){const i=e[0],s=e[4],r=e[8],o=e[1],n=e[5],a=e[9],l=e[2],A=e[6],h=e[10];let u;const d=i+n+h;return d>0?(u=.5/Math.sqrt(d+1),t[3]=.25/u,t[0]=(A-a)*u,t[1]=(r-l)*u,t[2]=(o-s)*u):i>n&&i>h?(u=2*Math.sqrt(1+i-n-h),t[3]=(A-a)/u,t[0]=.25*u,t[1]=(s+o)/u,t[2]=(r+l)/u):n>h?(u=2*Math.sqrt(1+n-i-h),t[3]=(r-l)/u,t[0]=(s+o)/u,t[1]=.25*u,t[2]=(a+A)/u):(u=2*Math.sqrt(1+h-i-n),t[3]=(o-s)/u,t[0]=(r+l)/u,t[1]=(a+A)/u,t[2]=.25*u),t},vec3PairToQuaternion(e,t,i=c.vec4()){const s=Math.sqrt(c.dotVec3(e,e)*c.dotVec3(t,t));let r=s+c.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):c.cross3Vec3(e,t,i),i[3]=r,c.normalizeQuaternion(i)},angleAxisToQuaternion(e,t=c.vec4()){const i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:(()=>{const e=new n(16);return(t,i,s)=>(s=s||c.vec3(),c.quaternionToRotationMat4(t,e),c.mat4ToEuler(e,i,s),s)})(),mulQuaternions(e,t,i=c.vec4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=t[0],l=t[1],A=t[2],h=t[3];return i[0]=n*a+s*h+r*A-o*l,i[1]=n*l+r*h+o*a-s*A,i[2]=n*A+o*h+s*l-r*a,i[3]=n*h-s*a-r*l-o*A,i},vec3ApplyQuaternion(e,t,i=c.vec3()){const s=t[0],r=t[1],o=t[2],n=e[0],a=e[1],l=e[2],A=e[3],h=A*s+a*o-l*r,u=A*r+l*s-n*o,d=A*o+n*r-a*s,p=-n*s-a*r-l*o;return i[0]=h*A+p*-n+u*-l-d*-a,i[1]=u*A+p*-a+d*-n-h*-l,i[2]=d*A+p*-l+h*-a-u*-n,i},quaternionToMat4(e,t){t=c.identityMat4(t);const i=e[0],s=e[1],r=e[2],o=e[3],n=2*i,a=2*s,l=2*r,A=n*o,h=a*o,u=l*o,d=n*i,p=a*i,f=l*i,g=a*s,m=l*s,_=l*r;return t[0]=1-(g+_),t[1]=p+u,t[2]=f-h,t[4]=p-u,t[5]=1-(d+_),t[6]=m+A,t[8]=f+h,t[9]=m-A,t[10]=1-(d+g),t},quaternionToRotationMat4(e,t){const i=e[0],s=e[1],r=e[2],o=e[3],n=i+i,a=s+s,l=r+r,A=i*n,h=i*a,c=i*l,u=s*a,d=s*l,p=r*l,f=o*n,g=o*a,m=o*l;return t[0]=1-(u+p),t[4]=h-m,t[8]=c+g,t[1]=h+m,t[5]=1-(A+p),t[9]=d-f,t[2]=c-g,t[6]=d+f,t[10]=1-(A+u),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion(e,t=e){const i=c.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:(e,t=e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t),inverseQuaternion:(e,t)=>c.normalizeQuaternion(c.conjugateQuaternion(e,t)),quaternionToAngleAxis(e,t=c.vec4()){const i=(e=c.normalizeQuaternion(e,h))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:e=>new n(e||6),AABB2:e=>new n(e||4),OBB3:e=>new n(e||32),OBB2:e=>new n(e||16),Sphere3:(e,t,i,s)=>new n([e,t,i,s]),transformOBB3(e,t,i=t){let s;const r=t.length;let o,n,a;const l=e[0],A=e[1],h=e[2],c=e[3],u=e[4],d=e[5],p=e[6],f=e[7],g=e[8],m=e[9],_=e[10],v=e[11],b=e[12],y=e[13],B=e[14],x=e[15];for(s=0;s{const e=new n(3),t=new n(3),i=new n(3);return s=>(e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5],c.subVec3(t,e,i),Math.abs(c.lenVec3(i)))})(),getAABB3DiagPoint:(()=>{const e=new n(3),t=new n(3),i=new n(3);return(s,r)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5];const o=c.subVec3(t,e,i),n=r[0]-s[0],a=s[3]-r[0],l=r[1]-s[1],A=s[4]-r[1],h=r[2]-s[2],u=s[5]-r[2];return o[0]+=n>a?n:a,o[1]+=l>A?l:A,o[2]+=h>u?h:u,Math.abs(c.lenVec3(o))}})(),getAABB3Area:e=>(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2]),getAABB3Center(e,t){const i=t||c.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center(e,t){const i=t||c.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:(e=c.AABB3())=>(e[0]=c.MAX_DOUBLE,e[1]=c.MAX_DOUBLE,e[2]=c.MAX_DOUBLE,e[3]=c.MIN_DOUBLE,e[4]=c.MIN_DOUBLE,e[5]=c.MIN_DOUBLE,e),AABB3ToOBB3:(e,t=c.OBB3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t),positions3ToAABB3:(()=>{const e=new n(3);return(t,i,s)=>{i=i||c.AABB3();let r,o,n,a=c.MAX_DOUBLE,l=c.MAX_DOUBLE,A=c.MAX_DOUBLE,h=c.MIN_DOUBLE,u=c.MIN_DOUBLE,d=c.MIN_DOUBLE;for(let i=0,p=t.length;ih&&(h=r),o>u&&(u=o),n>d&&(d=n);return i[0]=a,i[1]=l,i[2]=A,i[3]=h,i[4]=u,i[5]=d,i}})(),OBB3ToAABB3(e,t=c.AABB3()){let i,s,r,o=c.MAX_DOUBLE,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE,h=c.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToAABB3(e,t=c.AABB3()){let i,s,r,o=c.MAX_DOUBLE,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE,h=c.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToSphere3:(()=>{const e=new n(3);return(t,i)=>{i=i||c.vec4();let s,r=0,o=0,n=0;const a=t.length;for(s=0;sA&&(A=l);return i[3]=A,i}})(),positions3ToSphere3:(()=>{const e=new n(3),t=new n(3);return(i,s)=>{s=s||c.vec4();let r,o=0,n=0,a=0;const l=i.length;let A=0;for(r=0;rA&&(A=u);return s[3]=A,s}})(),OBB3ToSphere3:(()=>{const e=new n(3),t=new n(3);return(i,s)=>{s=s||c.vec4();let r,o=0,n=0,a=0;const l=i.length,A=l/4;for(r=0;ru&&(u=h);return s[3]=u,s}})(),getSphere3Center:(e,t=c.vec3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t),getPositionsCenter(e,t=c.vec3()){let i=0,s=0,r=0;for(var o=0,n=e.length;o(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3](e[0]=c.MAX_DOUBLE,e[1]=c.MAX_DOUBLE,e[2]=c.MIN_DOUBLE,e[3]=c.MIN_DOUBLE,e),point3AABB3Intersect:(e,t)=>e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]);if(s<=-t&&r<=-t)return-1;return s>=-t&&r>=-t?1:0},OBB3ToAABB2(e,t=c.AABB2()){let i,s,r,o,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE;for(let t=0,h=e.length;tl&&(l=i),s>A&&(A=s);return t[0]=n,t[1]=a,t[2]=l,t[3]=A,t},expandAABB2:(e,t)=>(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]2*(1-e)*(i-t)+2*e*(s-i),tangentQuadraticBezier3:(e,t,i,s,r)=>-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r,tangentSpline:e=>6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e),catmullRomInterpolate(e,t,i,s,r){const o=.5*(i-e),n=.5*(s-t),a=r*r;return(2*t-2*i+o+n)*(r*a)+(-3*t+3*i-2*o-n)*a+o*r+t},b2p0(e,t){const i=1-e;return i*i*t},b2p1:(e,t)=>2*(1-e)*e*t,b2p2:(e,t)=>e*e*t,b2(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0(e,t){const i=1-e;return i*i*i*t},b3p1(e,t){const i=1-e;return 3*i*i*e*t},b3p2:(e,t)=>3*(1-e)*e*e*t,b3p3:(e,t)=>e*e*e*t,b3(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal(e,t,i,s=c.vec3()){const r=t[0]-e[0],o=t[1]-e[1],n=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],A=i[2]-e[2],h=o*A-n*l,u=n*a-r*A,d=r*l-o*a,p=Math.sqrt(h*h+u*u+d*d);return 0===p?(s[0]=0,s[1]=0,s[2]=0):(s[0]=h/p,s[1]=u/p,s[2]=d/p),s},rayTriangleIntersect:(()=>{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3);return(o,n,a,l,A,h)=>{h=h||c.vec3();const u=c.subVec3(l,a,e),d=c.subVec3(A,a,t),p=c.cross3Vec3(n,d,i),f=c.dotVec3(u,p);if(f<1e-6)return null;const g=c.subVec3(o,a,s),m=c.dotVec3(g,p);if(m<0||m>f)return null;const _=c.cross3Vec3(g,u,r),v=c.dotVec3(n,_);if(v<0||m+v>f)return null;const b=c.dotVec3(d,_)/f;return h[0]=o[0]+b*n[0],h[1]=o[1]+b*n[1],h[2]=o[2]+b*n[2],h}})(),rayPlaneIntersect:(()=>{const e=new n(3),t=new n(3),i=new n(3),s=new n(3);return(r,o,n,a,l,A)=>{A=A||c.vec3(),o=c.normalizeVec3(o,e);const h=c.subVec3(a,n,t),u=c.subVec3(l,n,i),d=c.cross3Vec3(h,u,s);c.normalizeVec3(d,d);const p=-c.dotVec3(n,d),f=-(c.dotVec3(r,d)+p)/c.dotVec3(o,d);return A[0]=r[0]+f*o[0],A[1]=r[1]+f*o[1],A[2]=r[2]+f*o[2],A}})(),cartesianToBarycentric:(()=>{const e=new n(3),t=new n(3),i=new n(3);return(s,r,o,n,a)=>{const l=c.subVec3(n,r,e),A=c.subVec3(o,r,t),h=c.subVec3(s,r,i),u=c.dotVec3(l,l),d=c.dotVec3(l,A),p=c.dotVec3(l,h),f=c.dotVec3(A,A),g=c.dotVec3(A,h),m=u*f-d*d;if(0===m)return null;const _=1/m,v=(f*p-d*g)*_,b=(u*g-d*p)*_;return a[0]=1-v-b,a[1]=b,a[2]=v,a}})(),barycentricInsideTriangle(e){const t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian(e,t,i,s,r=c.vec3()){const o=e[0],n=e[1],a=e[2];return r[0]=t[0]*o+i[0]*n+s[0]*a,r[1]=t[1]*o+i[1]*n+s[1]*a,r[2]=t[2]*o+i[2]*n+s[2]*a,r},mergeVertices(e,t,i,s){const r={},o=[],n=[],a=t?[]:null,l=i?[]:null,A=[];let h,c,u,d;const p=1e4;let f,g,m=0;for(f=0,g=e.length;f{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3),o=new n(3);return(n,a,l)=>{let A,h;const u=new Array(n.length/3);let d,p,f,g,m,_,v;for(A=0,h=a.length;A{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3),o=new n(3),a=new n(3);return(n,l,A)=>{const h=new Float32Array(n.length);for(let u=0;u>24&255,h=u>>16&255,A=u>>8&255,l=255&u,a=t[i],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+1],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+2],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,u++;return{positions:r,colors:o}},faceToVertexNormals(e,t,i={}){const s=i.smoothNormalsAngleThreshold||20,r={},o=[],n={};let a,l,A,h,u;const d=1e4;let p,f,g,m,_,v;for(f=0,m=e.length;f{const e=new n(4),t=new n(4);return(i,s,r,o,n)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=1,c.transformVec4(i,e,t),o[0]=t[0],o[1]=t[1],o[2]=t[2],e[0]=r[0],e[1]=r[1],e[2]=r[2],c.transformVec3(i,e,t),c.normalizeVec3(t),n[0]=t[0],n[1]=t[1],n[2]=t[2]}})(),canvasPosToWorldRay:(()=>{const e=new n(16),t=new n(16),i=new n(4),s=new n(4),r=new n(4),o=new n(4);return(n,a,l,A,h,u)=>{const d=c.mulMat4(l,a,e),p=c.inverseMat4(d,t),f=n.width,g=n.height,m=(A[0]-f/2)/(f/2),_=-(A[1]-g/2)/(g/2);i[0]=m,i[1]=_,i[2]=-1,i[3]=1,c.transformVec4(p,i,s),c.mulVec4Scalar(s,1/s[3]),r[0]=m,r[1]=_,r[2]=1,r[3]=1,c.transformVec4(p,r,o),c.mulVec4Scalar(o,1/o[3]),h[0]=o[0],h[1]=o[1],h[2]=o[2],c.subVec3(o,s,u),c.normalizeVec3(u)}})(),canvasPosToLocalRay:(()=>{const e=new n(3),t=new n(3);return(i,s,r,o,n,a,l)=>{c.canvasPosToWorldRay(i,s,r,n,e,t),c.worldRayToLocalRay(o,e,t,a,l)}})(),worldRayToLocalRay:(()=>{const e=new n(16),t=new n(4),i=new n(4);return(s,r,o,n,a)=>{const l=c.inverseMat4(s,e);t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,c.transformVec4(l,t,i),n[0]=i[0],n[1]=i[1],n[2]=i[2],c.transformVec3(l,o,a)}})(),buildKDTree:(()=>{const e=new Float32Array;function t(i,s,r,o){const a=new n(6),l={triangles:null,left:null,right:null,leaf:!1,splitDim:0,aabb:a};let A,h;for(a[0]=a[1]=a[2]=Number.POSITIVE_INFINITY,a[3]=a[4]=a[5]=Number.NEGATIVE_INFINITY,A=0,h=i.length;Aa[3]&&(a[3]=r[t]),r[t+1]a[4]&&(a[4]=r[t+1]),r[t+2]a[5]&&(a[5]=r[t+2])}}if(i.length<20||o>10)return l.triangles=i,l.leaf=!0,l;e[0]=a[3]-a[0],e[1]=a[4]-a[1],e[2]=a[5]-a[2];let u=0;e[1]>e[u]&&(u=1),e[2]>e[u]&&(u=2),l.splitDim=u;const d=(a[u]+a[u+3])/2,p=new Array(i.length);let f=0;const g=new Array(i.length);let m=0;for(A=0,h=i.length;A{const s=e.length/3,r=new Array(s);for(let e=0;e=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t},octDecodeVec2s(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t}};c.buildEdgeIndices=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}(),c.planeClipsPositions3=function(e,t,i,s=3){for(let r=0,o=i.length;r=this._headLength){const e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}const e=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,e}push(e){return this._length++,this._tail.push(e),this}unshift(e){return this._head[--this._index]=e,this._length++,this}}const p={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var f=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r{};t=t||s,i=i||s;var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.addEventListener("load",(function(e){var s=e.target.response;if(200===this.status){var r;try{r=JSON.parse(s)}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}t(r)}else if(0===this.status){console.warn("loadFile: HTTP Status 0 received.");try{t(JSON.parse(s))}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}}else i(e)}),!1),r.addEventListener("error",(function(e){i(e)}),!1),r.send(null)},loadArraybuffer:function(e,t,i){var s=e=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{t(e)}))}catch(e){M.scheduleTask((()=>{i(e)}))}}else{const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i("loadArrayBuffer error : "+s.response))},s.send(null)}},queryString:m,isArray:function(e){return e&&!e.propertyIsEnumerable("length")&&"object"==typeof e&&"number"==typeof e.length},isString:function(e){return"string"==typeof e||e instanceof String},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isID:function(e){return _.isString(e)||_.isNumeric(e)},isSameComponent:function(e,t){return!(!e||!t)&&(_.isNumeric(e)||_.isString(e)?`${e}`:e.id)===(_.isNumeric(t)||_.isString(t)?`${t}`:t.id)},isFunction:function(e){return"function"==typeof e},isObject:function(e){const t={}.constructor;return!!e&&e.constructor===t},copy:function(e){return _.apply(e,{})},apply:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},apply2:function(e,t){for(const i in e)e.hasOwnProperty(i)&&void 0!==e[i]&&null!==e[i]&&(t[i]=e[i]);return t},applyIf:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(void 0!==t[i]&&null!==t[i]||(t[i]=e[i]));return t},isEmptyObject:function(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},inQuotes:function(e){return _.isNumeric(e)?`${e}`:`'${e}'`},concat:function(e,t){const i=new e.constructor(e.length+t.length);return i.set(e),i.set(t,e.length),i},flattenParentChildHierarchy:function(e){var t=[];return function e(i){i.id=i.uuid,delete i.oid,t.push(i);var s=i.children;if(s)for(var r=0,o=s.length;r{b.removeItem(e.id),delete M.scenes[e.id],delete v[e.id],p.components.scenes--}))},this.clear=function(){let e;for(const t in M.scenes)M.scenes.hasOwnProperty(t)&&(e=M.scenes[t],"default.scene"===t?e.clear():(e.destroy(),delete M.scenes[e.id]))},this.scheduleTask=function(e,t=null){y.push(e),y.push(t)},this.runTasks=function(e=-1){let t,i,s=(new Date).getTime(),r=0;for(;y.length>0&&(e<0||s0&&w>0){var t=1e3/w;C+=t,x.push(t),x.length>=30&&(C-=x.shift()),p.frame.fps=Math.round(C/x.length)}for(let e in M.scenes)M.scenes[e].compile();I(e),P=e};!function(e,t){let i=Date.now()+t;(function s(){const r=Date.now()-i;e(),i+=t,setTimeout(s,Math.max(0,t-r))})()}((()=>{F()}),100);const E=function(){let e=Date.now();if(w=e-P,P>0&&w>0){var t=1e3/w;C+=t,x.push(t),x.length>=30&&(C-=x.shift()),p.frame.fps=Math.round(C/x.length)}I(e),function(e){for(var t in B.time=e,M.scenes)if(M.scenes.hasOwnProperty(t)){var i=M.scenes[t];B.sceneId=t,B.startTime=i.startTime,B.deltaTime=null!=B.prevTime?B.time-B.prevTime:0,i.fire("tick",B,!0)}B.prevTime=e}(e),function(){const e=M.scenes,t=!1;let i,s,r,o,n;for(n in e)e.hasOwnProperty(n)&&(i=e[n],s=v[n],s||(s=v[n]={}),r=i.ticksPerOcclusionTest,s.ticksPerOcclusionTest!==r&&(s.ticksPerOcclusionTest=r,s.renderCountdown=r),--i.occlusionTestCountdown<=0&&(i.doOcclusionTest(),i.occlusionTestCountdown=r),o=i.ticksPerRender,s.ticksPerRender!==o&&(s.ticksPerRender=o,s.renderCountdown=o),0==--s.renderCountdown&&(i.render(t),s.renderCountdown=o))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(F):requestAnimationFrame(E)};function I(e){const t=M.runTasks(e+10),i=M.getNumTasks();p.frame.tasksRun=t,p.frame.tasksScheduled=i,p.frame.tasksBudget=10}E();class D{get type(){return"Component"}get isComponent(){return!0}constructor(e=null,t={}){if(this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=t.viewer;else{if("Scene"===e.type)this.scene=e;else{if(!(e instanceof D))throw"Invalid param: owner must be a Component";this.scene=e.scene}this._owner=e}this._dontClear=!!t.dontClear,this._renderer=this.scene._renderer,this.meta=t.meta||{},this.id=t.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,e&&e._own(this)}glRedraw(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}glResort(){this._renderer&&this._renderer.needStateSort()}get owner(){return this._owner}isType(e){return this.type===e}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}_message(e){return" ["+this.type+" "+_.inQuotes(this.id)+"]: "+e}warn(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}error(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}_attach(e){const t=e.name;if(!t)return void this.error("Component 'name' expected");let i=e.component;const s=e.sceneDefault,r=e.sceneSingleton,o=e.type,n=e.on,a=!1!==e.recompiles;if(i&&(_.isNumeric(i)||_.isString(i))){const e=i;if(i=this.scene.components[e],!i)return void this.error("Component not found: "+_.inQuotes(e))}if(!i)if(!0===r){const e=this.scene.types[o];for(const t in e)if(e.hasOwnProperty){i=e[t];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&(i=this.scene[t],!i))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+_.inQuotes(i.id));if(o&&!i.isType(o))return void this.error("Expected a "+o+" type or subtype: "+i.type+" "+_.inQuotes(i.id))}this._attachments||(this._attachments={});const l=this._attached[t];let A,h,c;if(l){if(i&&l.id===i.id)return;const e=this._attachments[l.id];for(A=e.subs,h=0,c=A.length;h{delete this._ownedComponents[e.id]}),this)}_needUpdate(e){this._updateScheduled||(this._updateScheduled=!0,0===e?this._doUpdate():M.scheduleTask(this._doUpdate,this))}_doUpdate(){this._updateScheduled&&(this._updateScheduled=!1,this._update&&this._update())}scheduleTask(e){M.scheduleTask(e,null)}_update(){}clear(){if(this._ownedComponents)for(var e in this._ownedComponents)if(this._ownedComponents.hasOwnProperty(e)){this._ownedComponents[e].destroy(),delete this._ownedComponents[e]}}destroy(){if(this.destroyed)return;let e,t,i,s,r,o;if(this.fire("destroyed",this.destroyed=!0),this._attachments)for(e in this._attachments)if(this._attachments.hasOwnProperty(e)){for(t=this._attachments[e],i=t.component,s=t.subs,r=0,o=s.length;r=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}class U{constructor(){this.planes=[new L,new L,new L,new L,new L,new L]}}function k(e,t,i){const s=c.mulMat4(i,t,R),r=s[0],o=s[1],n=s[2],a=s[3],l=s[4],A=s[5],h=s[6],u=s[7],d=s[8],p=s[9],f=s[10],g=s[11],m=s[12],_=s[13],v=s[14],b=s[15];e.planes[0].set(a-r,u-l,g-d,b-m),e.planes[1].set(a+r,u+l,g+d,b+m),e.planes[2].set(a-o,u-A,g-p,b-_),e.planes[3].set(a+o,u+A,g+p,b+_),e.planes[4].set(a-n,u-h,g-f,b-v),e.planes[5].set(a+n,u+h,g+f,b+v)}function O(e,t){let i=U.INSIDE;const s=S,r=T;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];const o=[s,r];for(let t=0;t<6;++t){const s=e.planes[t];if(s.normal[0]*o[s.testVertex[0]][0]+s.normal[1]*o[s.testVertex[1]][1]+s.normal[2]*o[s.testVertex[2]][2]+s.offset<0)return U.OUTSIDE;s.normal[0]*o[1-s.testVertex[0]][0]+s.normal[1]*o[1-s.testVertex[1]][1]+s.normal[2]*o[1-s.testVertex[2]][2]+s.offset<0&&(i=U.INTERSECT)}return i}U.INSIDE=0,U.INTERSECT=1,U.OUTSIDE=2;class N extends D{constructor(e={}){if(!e.viewer)throw"[MarqueePicker] Missing config: viewer";if(!e.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";super(e.viewer.scene,e),this.viewer=e.viewer,this._objectsKdTree3=e.objectsKdTree3,this._canvasMarqueeCorner1=c.vec2(),this._canvasMarqueeCorner2=c.vec2(),this._canvasMarquee=c.AABB2(),this._marqueeFrustum=new U,this._marqueeFrustumProjMat=c.mat4(),this._pickMode=!1,this._marqueeElement=document.createElement("div"),document.body.appendChild(this._marqueeElement),this._marqueeElement.style.position="absolute",this._marqueeElement.style["z-index"]="40000005",this._marqueeElement.style.width="8px",this._marqueeElement.style.height="8px",this._marqueeElement.style.visibility="hidden",this._marqueeElement.style.top="0px",this._marqueeElement.style.left="0px",this._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",this._marqueeElement.style.opacity=1,this._marqueeElement.style["pointer-events"]="none"}setMarqueeCorner1(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarqueeCorner2(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarquee(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}setMarqueeVisible(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}getMarqueeVisible(){return this._marqueVisible}setPickMode(e){if(e!==N.PICK_MODE_INSIDE&&e!==N.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===N.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}getPickMode(){return this._pickMode}clear(){this.fire("clear",{})}pick(){this._updateMarquee(),this._buildMarqueeFrustum();const e=[],t=(i,s=U.INTERSECT)=>{if(s===U.INTERSECT&&(s=O(this._marqueeFrustum,i.aabb)),s!==U.OUTSIDE){if(i.entities){const t=i.entities;for(let i=0,s=t.length;i3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&t(this._objectsKdTree3.root),this.fire("picked",e),e}_updateMarquee(){this._canvasMarquee[0]=Math.min(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[1]=Math.min(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._canvasMarquee[2]=Math.max(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[3]=Math.max(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._marqueeElement.style.width=this._canvasMarquee[2]-this._canvasMarquee[0]+"px",this._marqueeElement.style.height=this._canvasMarquee[3]-this._canvasMarquee[1]+"px",this._marqueeElement.style.left=`${this._canvasMarquee[0]}px`,this._marqueeElement.style.top=`${this._canvasMarquee[1]}px`}_buildMarqueeFrustum(){const e=this.viewer.scene.canvas.canvas,t=e.clientWidth,i=e.clientHeight,s=e.clientLeft,r=e.clientTop,o=2/t,n=2/i,a=e.clientHeight/e.clientWidth,l=(this._canvasMarquee[0]-s)*o-1,A=(this._canvasMarquee[2]-s)*o-1,h=-(this._canvasMarquee[3]-r)*n+1,u=-(this._canvasMarquee[1]-r)*n+1,d=this.viewer.scene.camera.frustum.near*(17*a);c.frustumMat4(l,A,h*a,u*a,d,1e4,this._marqueeFrustumProjMat),k(this._marqueeFrustum,this.viewer.scene.camera.viewMatrix,this._marqueeFrustumProjMat)}destroy(){super.destroy(),this._marqueeElement.parentElement&&(this._marqueeElement.parentElement.removeChild(this._marqueeElement),this._marqueeElement=null,this._objectsKdTree3=null)}}N.PICK_MODE_INTERSECTS=0,N.PICK_MODE_INSIDE=1;class Q{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._circleDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._circleDiv,this.viewer.scene.canvas.canvas),this._circleDiv.style.backgroundColor="transparent",this._circleDiv.style.border="2px solid green",this._circleDiv.style.borderRadius="50px",this._circleDiv.style.width="50px",this._circleDiv.style.height="50px",this._circleDiv.style.margin="-200px -200px",this._circleDiv.style.zIndex="100000",this._circleDiv.style.position="absolute",this._circleDiv.style.pointerEvents="none",this._circlePos=null,this._circleMaxRadius=200,this._circleMinRadius=2,this._active=!1!==t.active,this._visible=!1,this._running=!1,this._destroyed=!1}start(e){if(this._destroyed)return;this._circlePos=e,this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius+"px";const t=this._circleMaxRadius;let i;const s=e=>{if(!this._running)return;i||(i=e);const r=e-i,o=Math.min(r/300,1),n=t+(2-t)*o;this._circleRadius=n,this._circleDiv.style.width=`${this._circleRadius}px`,this._circleDiv.style.height=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius/2+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius/2+"px",o<1&&requestAnimationFrame(s)};this._running=!0,requestAnimationFrame(s),this._circleDiv.style.visibility="visible"}stop(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.visibility="hidden")}set durationMs(e){this.stop(),this._durationMs=e}get durationMs(){return this._durationMs}destroy(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}class V{constructor(e,t,i){this.id=i&&i.id?i.id:e,this.viewer=t,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,t.addPlugin(this)}scheduleTask(e){M.scheduleTask(e,null)}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){console.log(`[xeokit plugin ${this.id}]: ${e}`)}warn(e){console.warn(`[xeokit plugin ${this.id}]: ${e}`)}error(e){console.error(`[xeokit plugin ${this.id}]: ${e}`)}send(e,t){}destroy(){this.viewer.removePlugin(this)}}const H=c.vec3(),j=function(){const e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,o){return o=o||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,c.transformVec4(s,t,i),c.setMat4Translation(s,i,o),o.slice()}}();function G(e,t,i){const s=Float32Array.from([e[0]])[0],r=e[0]-s,o=Float32Array.from([e[1]])[0],n=e[1]-o,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=o,t[2]=a,i[0]=r,i[1]=n,i[2]=l}function z(e,t,i,s=1e3){const r=c.getPositionsCenter(e,H),o=Math.round(r[0]/s)*s,n=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=o,i[1]=n,i[2]=a;const l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(let i=0,s=e.length;i0?this.meshes[0]._colorize[3]/255:1}set opacity(e){if(0===this.meshes.length)return;const t=null!=e,i=this.meshes[0]._colorize[3];let s=255;if(t){if(e<0?e=0:e>1&&(e=1),s=Math.floor(255*e),i===s)return}else if(s=255,i===s)return;for(let e=0,t=this.meshes.length;e{this._viewPosDirty=!0,this._needUpdate()})),this._onCameraProjMatrix=this.scene.camera.on("projMatrix",(()=>{this._canvasPosDirty=!0,this._needUpdate()})),this._onEntityDestroyed=null,this._onEntityModelDestroyed=null,this._renderer.addMarker(this),this.entity=t.entity,this.worldPos=t.worldPos,this.occludable=t.occludable}_update(){if(this._viewPosDirty&&(c.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos),this._viewPosDirty=!1,this._canvasPosDirty=!0,this.fire("viewPos",this._viewPos)),this._canvasPosDirty){oe.set(this._viewPos),oe[3]=1,c.transformPoint4(this.scene.camera.projMatrix,oe,ne);const e=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+ne[0]/ne[3])*e[2]/2),this._canvasPos[1]=Math.floor((1-ne[1]/ne[3])*e[3]/2),this._canvasPosDirty=!1,this.fire("canvasPos",this._canvasPos)}}_setVisible(e){this._visible,this._visible=e,this.fire("visible",this._visible)}set entity(e){if(this._entity){if(this._entity===e)return;null!==this._onEntityDestroyed&&(this._entity.off(this._onEntityDestroyed),this._onEntityDestroyed=null),null!==this._onEntityModelDestroyed&&(this._entity.model.off(this._onEntityModelDestroyed),this._onEntityModelDestroyed=null)}this._entity=e,this._entity&&(this._entity instanceof re?this._onEntityModelDestroyed=this._entity.model.on("destroyed",(()=>{this._entity=null,this._onEntityModelDestroyed=null})):this._onEntityDestroyed=this._entity.on("destroyed",(()=>{this._entity=null,this._onEntityDestroyed=null}))),this.fire("entity",this._entity,!0)}get entity(){return this._entity}set occludable(e){(e=!!e)!==this._occludable&&(this._occludable=e)}get occludable(){return this._occludable}set worldPos(e){this._worldPos.set(e||[0,0,0]),G(this._worldPos,this._origin,this._rtcPos),this._occludable&&this._renderer.markerWorldPosUpdated(this),this._viewPosDirty=!0,this.fire("worldPos",this._worldPos),this._needUpdate()}get worldPos(){return this._worldPos}get origin(){return this._origin}get rtcPos(){return this._rtcPos}get viewPos(){return this._update(),this._viewPos}get canvasPos(){return this._update(),this._canvasPos}get visible(){return!!this._visible}destroy(){this.fire("destroyed",!0),this.scene.camera.off(this._onCameraViewMatrix),this.scene.camera.off(this._onCameraProjMatrix),this._entity&&(null!==this._onEntityDestroyed&&this._entity.off(this._onEntityDestroyed),null!==this._onEntityModelDestroyed&&this._entity.model.off(this._onEntityModelDestroyed)),this._renderer.removeMarker(this),super.destroy()}}class le{constructor(e,t={}){this._color=t.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=t.thickness||1,this._thicknessClickable=t.thicknessClickable||6,this._visible=!0,this._culled=!1;var i=this._wire,s=i.style;s.border="solid "+this._thickness+"px "+this._color,s.position="absolute",s["z-index"]=void 0===t.zIndex?"2000001":t.zIndex,s.width="0px",s.height="0px",s.visibility="visible",s.top="0px",s.left="0px",s["-webkit-transform-origin"]="0 0",s["-moz-transform-origin"]="0 0",s["-ms-transform-origin"]="0 0",s["-o-transform-origin"]="0 0",s["transform-origin"]="0 0",s["-webkit-transform"]="rotate(0deg)",s["-moz-transform"]="rotate(0deg)",s["-ms-transform"]="rotate(0deg)",s["-o-transform"]="rotate(0deg)",s.transform="rotate(0deg)",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._wireClickable,o=r.style;o.border="solid "+this._thicknessClickable+"px "+this._color,o.position="absolute",o["z-index"]=void 0===t.zIndex?"2000002":t.zIndex+1,o.width="0px",o.height="0px",o.visibility="visible",o.top="0px",o.left="0px",o["-webkit-transform-origin"]="0 0",o["-moz-transform-origin"]="0 0",o["-ms-transform-origin"]="0 0",o["-o-transform-origin"]="0 0",o["transform-origin"]="0 0",o["-webkit-transform"]="rotate(0deg)",o["-moz-transform"]="rotate(0deg)",o["-ms-transform"]="rotate(0deg)",o["-o-transform"]="rotate(0deg)",o.transform="rotate(0deg)",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),t.onMouseOver&&r.addEventListener("mouseover",(e=>{t.onMouseOver(e,this)})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}get visible(){return"visible"===this._wire.style.visibility}_update(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}setStartAndEnd(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}setColor(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}setOpacity(e){this._wire.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}destroy(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}class Ae{constructor(e,t={}){this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!t.visible,this._culled=!1;var i=this._dot,s=i.style;s["border-radius"]="25px",s.border="solid 2px white",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"40000005":t.zIndex,s.width="8px",s.height="8px",s.visibility=!1!==t.visible?"visible":"hidden",s.top="0px",s.left="0px",s["box-shadow"]="0 2px 5px 0 #182A3D;",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._dotClickable,o=r.style;o["border-radius"]="35px",o.border="solid 10px white",o.position="absolute",o["z-index"]=void 0===t.zIndex?"40000007":t.zIndex+1,o.width="8px",o.height="8px",o.visibility="visible",o.top="0px",o.left="0px",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),r.addEventListener("click",(t=>{e.dispatchEvent(new MouseEvent("mouseover",t))})),t.onMouseOver&&r.addEventListener("mouseover",(i=>{t.onMouseOver(i,this),e.dispatchEvent(new MouseEvent("mouseover",i))})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.borderColor)}setPos(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}setFillColor(e){this._dot.style.background=e||"lightgreen"}setBorderColor(e){this._dot.style.border="solid 2px"+(e||"black")}setOpacity(e){this._dot.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}destroy(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}class he{constructor(e,t={}){this._highlightClass="viewer-ruler-label-highlighted",this._prefix=t.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var i=this._label,s=i.style;s["border-radius"]="5px",s.color="white",s.padding="4px",s.border="solid 1px",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"5000005":t.zIndex,s.width="auto",s.height="auto",s.visibility="visible",s.top="0px",s.left="0px",s["pointer-events"]="all",s.opacity=1,t.onContextMenu,i.innerText="",e.appendChild(i),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.fillColor),this.setText(t.text),t.onMouseOver&&i.addEventListener("mouseover",(e=>{t.onMouseOver(e,this),e.preventDefault()})),t.onMouseLeave&&i.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this),e.preventDefault()})),t.onMouseWheel&&i.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&i.addEventListener("mousedown",(e=>{t.onMouseDown(e,this),e.stopPropagation()})),t.onMouseUp&&i.addEventListener("mouseup",(e=>{t.onMouseUp(e,this),e.stopPropagation()})),t.onMouseMove&&i.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&i.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}setPos(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}setPosOnWire(e,t,i,s){var r=e+.5*(i-e),o=t+.5*(s-t),n=this._label.style;n.left=Math.round(r)-20+"px",n.top=Math.round(o)-12+"px"}setPosBetweenWires(e,t,i,s,r,o){var n=(e+i+r)/3,a=(t+s+o)/3,l=this._label.style;l.left=Math.round(n)-20+"px",l.top=Math.round(a)-12+"px"}setText(e){this._label.innerHTML=this._prefix+(e||"")}setFillColor(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}setBorderColor(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}setOpacity(e){this._label.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}setClickable(e){this._label.style["pointer-events"]=e?"all":"none"}destroy(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}var ce=c.vec3(),ue=c.vec3();class de extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._color=t.color||e.defaultColor;var i=this.plugin.viewer.scene;this._originMarker=new ae(i,t.origin),this._cornerMarker=new ae(i,t.corner),this._targetMarker=new ae(i,t.target),this._originWorld=c.vec3(),this._cornerWorld=c.vec3(),this._targetWorld=c.vec3(),this._wp=new Float64Array(12),this._vp=new Float64Array(12),this._pp=new Float64Array(12),this._cp=new Int16Array(6);const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},l=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};this._originDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._cornerDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._originWire=new le(this._container,{color:this._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetWire=new le(this._container,{color:this._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._angleLabel=new he(this._container,{fillColor:this._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._visible=!1,this._originVisible=!1,this._cornerVisible=!1,this._targetVisible=!1,this._originWireVisible=!1,this._targetWireVisible=!1,this._angleVisible=!1,this._labelsVisible=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._cornerMarker.on("worldPos",(e=>{this._cornerWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.cornerVisible=t.cornerVisible,this.targetVisible=t.targetVisible,this.originWireVisible=t.originWireVisible,this.targetWireVisible=t.targetWireVisible,this.angleVisible=t.angleVisible,this.labelsVisible=t.labelsVisible}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(c.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){const d=-.3,p=this._originMarker.viewPos[2],f=this._cornerMarker.viewPos[2],g=this._targetMarker.viewPos[2];if(p>d||f>d||g>d)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);c.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var t=this._pp,i=this._cp,s=e.canvas.canvas.getBoundingClientRect();const m=this._container.getBoundingClientRect();for(var r=s.top-m.top,o=s.left-m.left,n=e.canvas.boundary,a=n[2],l=n[3],A=0,h=0,u=t.length;he.offsetTop+(e.offsetParent&&e.offsetParent!==t.parentNode&&h(e.offsetParent)),u=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==t.parentNode&&u(e.offsetParent)),d=c.vec2();this._onMouseHoverSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{e.snappedToVertex||e.snappedToEdge?(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!0),this.markerDiv.style.background="greenyellow",this.markerDiv.style.border="2px solid green"):(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.canvasPos,s.snapped=!1),this.markerDiv.style.background="pink",this.markerDiv.style.border="2px solid red");const i=e.snappedCanvasPos||e.canvasPos;switch(r=!0,o=e.entity,l.set(e.worldPos),A.set(i),this._mouseState){case 0:this._canvasToPagePos?(this._canvasToPagePos(t,i,d),this.markerDiv.style.left=d[0]-5+"px",this.markerDiv.style.top=d[1]-5+"px"):(this.markerDiv.style.left=u(t)+i[0]-5+"px",this.markerDiv.style.top=h(t)+i[1]-5+"px");break;case 1:this._currentAngleMeasurement&&(this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.angleVisible=!1,this._currentAngleMeasurement.corner.worldPos=e.worldPos,this._currentAngleMeasurement.corner.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer";break;case 2:this._currentAngleMeasurement&&(this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.angleVisible=!0,this._currentAngleMeasurement.target.worldPos=e.worldPos,this._currentAngleMeasurement.target.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer"}})),t.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(n=e.clientX,a=e.clientY)}),t.addEventListener("mouseup",this._onMouseUp=e=>{if(1===e.which&&!(e.clientX>n+20||e.clientXa+20||e.clientY{if(r=!1,s&&(s.visible=!0,s.pointerPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!1),this.markerDiv.style.left="-100px",this.markerDiv.style.top="-100px",this._currentAngleMeasurement){switch(this._mouseState){case 0:this._currentAngleMeasurement.originVisible=!1;break;case 1:this._currentAngleMeasurement.cornerVisible=!1,this._currentAngleMeasurement.originWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1;break;case 2:this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1}t.style.cursor="default"}})),this._active=!0}deactivate(){if(!this._active)return;this.pointerLens&&(this.pointerLens.visible=!1),this.markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.angleMeasurementsPlugin.viewer.cameraControl;t.off(this._onMouseHoverSurface),t.off(this._onPickedSurface),t.off(this._onHoverNothing),t.off(this._onPickedNothing),this._currentAngleMeasurement=null,this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),this._mouseState=0)}destroy(){this.deactivate(),super.destroy()}}class ge extends ae{constructor(e,t){if(super(e,t),this.plugin=t.plugin,this._container=t.container,!this._container)throw"config missing: container";if(!t.markerElement&&!t.markerHTML)throw"config missing: need either markerElement or markerHTML";if(!t.labelElement&&!t.labelHTML)throw"config missing: need either labelElement or labelHTML";this._htmlDirty=!1,t.markerElement?(this._marker=t.markerElement,this._marker.addEventListener("click",this._onMouseClickedExternalMarker=()=>{this.plugin.fire("markerClicked",this)}),this._marker.addEventListener("mouseenter",this._onMouseEnterExternalMarker=()=>{this.plugin.fire("markerMouseEnter",this)}),this._marker.addEventListener("mouseleave",this._onMouseLeaveExternalMarker=()=>{this.plugin.fire("markerMouseLeave",this)}),this._markerExternal=!0):(this._markerHTML=t.markerHTML,this._htmlDirty=!0,this._markerExternal=!1),t.labelElement?(this._label=t.labelElement,this._labelExternal=!0):(this._labelHTML=t.labelHTML,this._htmlDirty=!0,this._labelExternal=!1),this._markerShown=!!t.markerShown,this._labelShown=!!t.labelShown,this._values=t.values||{},this._layoutDirty=!0,this._visibilityDirty=!0,this._buildHTML(),this._onTick=this.scene.on("tick",(()=>{this._htmlDirty&&(this._buildHTML(),this._htmlDirty=!1,this._layoutDirty=!0,this._visibilityDirty=!0),(this._layoutDirty||this._visibilityDirty)&&(this._markerShown||this._labelShown)&&(this._updatePosition(),this._layoutDirty=!1),this._visibilityDirty&&(this._marker.style.visibility=this.visible&&this._markerShown?"visible":"hidden",this._label.style.visibility=this.visible&&this._markerShown&&this._labelShown?"visible":"hidden",this._visibilityDirty=!1)})),this.on("canvasPos",(()=>{this._layoutDirty=!0})),this.on("visible",(()=>{this._visibilityDirty=!0})),this.setMarkerShown(!1!==t.markerShown),this.setLabelShown(t.labelShown),this.eye=t.eye?t.eye.slice():null,this.look=t.look?t.look.slice():null,this.up=t.up?t.up.slice():null,this.projection=t.projection}_buildHTML(){if(!this._markerExternal){this._marker&&(this._container.removeChild(this._marker),this._marker=null);let e=this._markerHTML||"

";_.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._marker=t.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(()=>{this.plugin.fire("markerClicked",this)})),this._marker.addEventListener("mouseenter",(()=>{this.plugin.fire("markerMouseEnter",this)})),this._marker.addEventListener("mouseleave",(()=>{this.plugin.fire("markerMouseLeave",this)})),this._marker.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);let e=this._labelHTML||"

";_.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._label=t.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}}_updatePosition(){const e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}_renderTemplate(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){const i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}setMarkerShown(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}getMarkerShown(){return this._markerShown}setLabelShown(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}getLabelShown(){return this._labelShown}setField(e,t){this._values[e]=t||"",this._htmlDirty=!0}getField(e){return this._values[e]}setValues(e){for(var t in e)if(e.hasOwnProperty(t)){const i=e[t];this.setField(t,i)}}getValues(){return this._values}destroy(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),super.destroy()}}const me=c.vec3(),_e=c.vec3(),ve=c.vec3();class be extends D{get type(){return"Spinner"}constructor(e,t={}){super(e,t),this._canvas=t.canvas,this._element=null,this._isCustom=!1,t.elementId&&(this._element=document.getElementById(t.elementId),this._element?this._adjustPosition():this.error("Can't find given Spinner HTML element: '"+t.elementId+"' - will automatically create default element")),this._element||this._createDefaultSpinner(),this.processes=0}_createDefaultSpinner(){this._injectDefaultCSS();const e=document.createElement("div"),t=e.style;t["z-index"]="9000",t.position="absolute",e.innerHTML='
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}_injectDefaultCSS(){const e="xeokit-spinner-css";if(document.getElementById(e))return;const t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}_adjustPosition(){if(this._isCustom)return;const e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}set processes(e){if(e=e||0,this._processes===e)return;if(e<0)return;const t=this._processes;this._processes=e;const i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}get processes(){return this._processes}_destroy(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);const e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}const ye=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];class Be extends D{constructor(e,t={}){super(e,t),this._backgroundColor=c.vec3([t.backgroundColor?t.backgroundColor[0]:1,t.backgroundColor?t.backgroundColor[1]:1,t.backgroundColor?t.backgroundColor[2]:1]),this._backgroundColorFromAmbientLight=!!t.backgroundColorFromAmbientLight,this.canvas=t.canvas,this.gl=null,this.webgl2=!1,this.transparent=!!t.transparent,this.contextAttr=t.contextAttr||{},this.contextAttr.alpha=this.transparent,this.contextAttr.preserveDrawingBuffer=!!this.contextAttr.preserveDrawingBuffer,this.contextAttr.stencil=!1,this.contextAttr.premultipliedAlpha=!!this.contextAttr.premultipliedAlpha,this.contextAttr.antialias=!1!==this.contextAttr.antialias,this.resolutionScale=t.resolutionScale,this.canvas.width=Math.round(this.canvas.clientWidth*this._resolutionScale),this.canvas.height=Math.round(this.canvas.clientHeight*this._resolutionScale),this.boundary=[this.canvas.offsetLeft,this.canvas.offsetTop,this.canvas.clientWidth,this.canvas.clientHeight],this._initWebGL(t);const i=this;this.canvas.addEventListener("webglcontextlost",this._webglcontextlostListener=function(e){console.time("webglcontextrestored"),i.scene._webglContextLost(),i.fire("webglcontextlost"),e.preventDefault()},!1),this.canvas.addEventListener("webglcontextrestored",this._webglcontextrestoredListener=function(e){i._initWebGL(),i.gl&&(i.scene._webglContextRestored(i.gl),i.fire("webglcontextrestored",i.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);let s=!0;new ResizeObserver((e=>{for(const t of e)t.contentBoxSize&&(s=!0)})).observe(this.canvas),this._tick=this.scene.on("tick",(()=>{s&&(s=!1,i.canvas.width=Math.round(i.canvas.clientWidth*i._resolutionScale),i.canvas.height=Math.round(i.canvas.clientHeight*i._resolutionScale),i.boundary[0]=i.canvas.offsetLeft,i.boundary[1]=i.canvas.offsetTop,i.boundary[2]=i.canvas.clientWidth,i.boundary[3]=i.canvas.clientHeight,i.fire("boundary",i.boundary))})),this._spinner=new be(this.scene,{canvas:this.canvas,elementId:t.spinnerElementId})}get type(){return"Canvas"}get backgroundColorFromAmbientLight(){return this._backgroundColorFromAmbientLight}set backgroundColorFromAmbientLight(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}get resolutionScale(){return this._resolutionScale}set resolutionScale(e){if((e=e||1)===this._resolutionScale)return;this._resolutionScale=e;const t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}get spinner(){return this._spinner}_createCanvas(){const e="xeokit-canvas-"+c.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}_getElementXY(e){let t=0,i=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}_initWebGL(){if(!this.gl)for(let e=0;!this.gl&&e0?we.FS_MAX_FLOAT_PRECISION="highp":e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?we.FS_MAX_FLOAT_PRECISION="mediump":we.FS_MAX_FLOAT_PRECISION="lowp":we.FS_MAX_FLOAT_PRECISION="mediump",we.DEPTH_BUFFER_BITS=e.getParameter(e.DEPTH_BITS),we.MAX_TEXTURE_SIZE=e.getParameter(e.MAX_TEXTURE_SIZE),we.MAX_CUBE_MAP_SIZE=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),we.MAX_RENDERBUFFER_SIZE=e.getParameter(e.MAX_RENDERBUFFER_SIZE),we.MAX_TEXTURE_UNITS=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),we.MAX_TEXTURE_IMAGE_UNITS=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),we.MAX_VERTEX_ATTRIBS=e.getParameter(e.MAX_VERTEX_ATTRIBS),we.MAX_VERTEX_UNIFORM_VECTORS=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),we.MAX_FRAGMENT_UNIFORM_VECTORS=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),we.MAX_VARYING_VECTORS=e.getParameter(e.MAX_VARYING_VECTORS),e.getSupportedExtensions().forEach((function(e){we.SUPPORTED_EXTENSIONS[e]=!0})))}class Ce{constructor(){this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}get canvasPos(){return this._gotCanvasPos?this._canvasPos:null}set canvasPos(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}get origin(){return this._gotOrigin?this._origin:null}set origin(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}get direction(){return this._gotDirection?this._direction:null}set direction(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}get indices(){return this.entity&&this._gotIndices?this._indices:null}set indices(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}get localPos(){return this.entity&&this._gotLocalPos?this._localPos:null}set localPos(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}get snappedCanvasPos(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null}set snappedCanvasPos(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}get worldPos(){return this._gotWorldPos?this._worldPos:null}set worldPos(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}get viewPos(){return this.entity&&this._gotViewPos?this._viewPos:null}set viewPos(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}get bary(){return this.entity&&this._gotBary?this._bary:null}set bary(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}get worldNormal(){return this.entity&&this._gotWorldNormal?this._worldNormal:null}set worldNormal(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}get uv(){return this.entity&&this._gotUV?this._uv:null}set uv(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}get snapped(){return this.snappedToEdge||this.snappedToVertex}reset(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}class Me{constructor(e,t,i){if(this.allocated=!1,this.compiled=!1,this.handle=e.createShader(t),this.handle){if(this.allocated=!0,e.shaderSource(this.handle,i),e.compileShader(this.handle),this.compiled=e.getShaderParameter(this.handle,e.COMPILE_STATUS),!this.compiled&&!e.isContextLost()){const t=i.split("\n"),s=[];for(let e=0;e0&&"/"===i.charAt(s+1)&&(i=i.substring(0,s)),t.push(i);return t.join("\n")}function Se(e){console.error(e.join("\n"))}class Te{constructor(e,t){this.id=Ie.addItem({}),this.source=t,this.init(e)}init(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new Me(e,e.VERTEX_SHADER,De(this.source.vertex)),this._fragmentShader=new Me(e,e.FRAGMENT_SHADER,De(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Se(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Se(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Se(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Se(this.errors);let t,i,s,r,o;if(this.compiled=!0,this.handle=e.createProgram(),!this.handle)return void(this.errors=["Failed to allocate program"]);if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Se(this.errors);const n=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}setData(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}bind(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}unbind(){this.allocated&&this._gl.bindBuffer(this.type,null)}destroy(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}class Le{constructor(e,t){this.scene=e,this.aabb=c.AABB3(),this.origin=c.vec3(t),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}addMarker(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}markerWorldPosUpdated(e){if(!this.markers[e.id])return;const t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}removeMarker(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}update(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}_buildMarkerList(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}_buildPositions(){let e=0;for(let t=0;t-t){i._setVisible(!1);continue}const n=i.canvasPos,a=n[0],l=n[1];a+10<0||l+10<0||a-10>s||l-10>r?i._setVisible(!1):!i.entity||i.entity.visible?i.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=i,this.pixels[o++]=a,this.pixels[o++]=l):i._setVisible(!0):i._setVisible(!1)}}_updateActiveSectionPlanes(){const e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(let i=0;i{this._occlusionTestListDirty=!0})),this._onCameraProjMatrix=e.camera.on("projMatrix",(()=>{this._occlusionTestListDirty=!0})),this._onCanvasBoundary=e.canvas.on("boundary",(()=>{this._occlusionTestListDirty=!0}))}addMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i||(i=new Le(this._scene,e.origin),this._occlusionLayers[i.originHash]=i,this._occlusionLayersListDirty=!0),i.addMarker(e),this._markersToOcclusionLayersMap[e.id]=i,this._occlusionTestListDirty=!0}markerWorldPosUpdated(e){const t=this._markersToOcclusionLayersMap[e.id];if(!t)return void e.error("Marker has not been added to OcclusionTester");const i=e.origin.join();if(i!==t.originHash){1===t.numMarkers?(t.destroy(),delete this._occlusionLayers[t.originHash],this._occlusionLayersListDirty=!0):t.removeMarker(e);let s=this._occlusionLayers[i];s||(s=new Le(this._scene,e.origin),this._occlusionLayers[i]=t,this._occlusionLayersListDirty=!0),s.addMarker(e),this._markersToOcclusionLayersMap[e.id]=s}else t.markerWorldPosUpdated(e)}removeMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i&&(1===i.numMarkers?(i.destroy(),delete this._occlusionLayers[i.originHash],this._occlusionLayersListDirty=!0):i.removeMarker(e),delete this._markersToOcclusionLayersMap[e.id])}get needOcclusionTest(){return this._occlusionTestListDirty}bindRenderBuf(){const e=[this._scene.canvas.canvas.id,this._scene._sectionPlanesState.getHash()].join(";");if(e!==this._shaderSourceHash&&(this._shaderSourceHash=e,this._shaderSourceDirty=!0),this._shaderSourceDirty&&(this._buildShaderSource(),this._shaderSourceDirty=!1,this._programDirty=!0),this._programDirty&&(this._buildProgram(),this._programDirty=!1,this._occlusionTestListDirty=!0),this._occlusionLayersListDirty&&(this._buildOcclusionLayersList(),this._occlusionLayersListDirty=!1),this._occlusionTestListDirty){for(let e=0,t=this._occlusionLayersList.length;e0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}_buildFragmentShaderSource(){const e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}_buildProgram(){this._program&&this._program.destroy();const e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new Te(t,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,t=i.sectionPlanes.length;e0){const e=s.sectionPlanes;for(let s=0;s{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=c.mat4();return()=>(e&&c.inverseMat4(s.camera.projMatrix,t),t)})());const t=this._scene.canvas.gl,i=this._program,s=this._scene,r=s.sao,o=t.drawingBufferWidth,n=t.drawingBufferHeight,a=s.camera.project._state,l=a.near,A=a.far,h=a.matrix,u=this._getInverseProjectMat(),d=Math.random(),p="perspective"===s.camera.projection;Ne[0]=o,Ne[1]=n,t.viewport(0,0,o,n),t.clearColor(0,0,0,1),t.disable(t.DEPTH_TEST),t.disable(t.BLEND),t.frontFace(t.CCW),t.clear(t.COLOR_BUFFER_BIT),i.bind(),t.uniform1f(this._uCameraNear,l),t.uniform1f(this._uCameraFar,A),t.uniformMatrix4fv(this._uCameraProjectionMatrix,!1,h),t.uniformMatrix4fv(this._uCameraInverseProjectionMatrix,!1,u),t.uniform1i(this._uPerspective,p),t.uniform1f(this._uScale,r.scale*(A/5)),t.uniform1f(this._uIntensity,r.intensity),t.uniform1f(this._uBias,r.bias),t.uniform1f(this._uKernelRadius,r.kernelRadius),t.uniform1f(this._uMinResolution,r.minResolution),t.uniform2fv(this._uViewport,Ne),t.uniform1f(this._uRandomSeed,d);const f=e.getDepthTexture();i.bindTexture(this._uDepthTexture,f,0),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),t.drawElements(t.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}_build(){let e=!1;const t=this._scene.sao;if(t.numSamples!==this._numSamples&&(this._numSamples=Math.floor(t.numSamples),e=!0),!e)return;const i=this._scene.canvas.gl;if(this._program&&(this._program.destroy(),this._program=null),this._program=new Te(i,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV; \n \n out vec2 vUV;\n \n void main () {\n gl_Position = vec4(aPosition, 1.0);\n vUV = aUV;\n }"],fragment:[`#version 300 es \n precision highp float;\n precision highp int; \n \n #define NORMAL_TEXTURE 0\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n #define NUM_SAMPLES ${this._numSamples}\n #define NUM_RINGS 4 \n \n in vec2 vUV;\n \n uniform sampler2D uDepthTexture;\n \n uniform float uCameraNear;\n uniform float uCameraFar;\n uniform mat4 uProjectMatrix;\n uniform mat4 uInverseProjectMatrix;\n \n uniform bool uPerspective;\n\n uniform float uScale;\n uniform float uIntensity;\n uniform float uBias;\n uniform float uKernelRadius;\n uniform float uMinResolution;\n uniform vec2 uViewport;\n uniform float uRandomSeed;\n\n float pow2( const in float x ) { return x*x; }\n \n highp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n }\n\n vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n }\n\n vec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n }\n\n const float packUpscale = 256. / 255.;\n const float unpackDownScale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. ); \n\n const float shiftRights = 1. / 256.;\n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float unpackRGBAToFloat( const in vec4 v ) { \n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unPackFactors );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n }\n\n float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n }\n \n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n if (uPerspective) {\n return perspectiveDepthToViewZ( depth, uCameraNear, uCameraFar );\n } else {\n return orthographicDepthToViewZ( depth, uCameraNear, uCameraFar );\n }\n }\n\n vec3 getViewPos( const in vec2 screenPos, const in float depth, const in float viewZ ) {\n \tfloat clipW = uProjectMatrix[2][3] * viewZ + uProjectMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPos, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; \n \treturn ( uInverseProjectMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPos ) { \n return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - uBias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \n \tscaleDividedByCameraFar = uScale / uCameraFar;\n \tminResolutionMultipliedByCameraFar = uMinResolution * uCameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUV );\n\n \tfloat angle = rand( vUV + uRandomSeed ) * PI2;\n \tvec2 radius = vec2( uKernelRadius * INV_NUM_SAMPLES ) / uViewport;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUV + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }`]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),o=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new Re(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new Re(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new Re(i,i.ELEMENT_ARRAY_BUFFER,o,o.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}destroy(){this._program&&(this._program.destroy(),this._program=null)}}const Ve=new Float32Array(Ke(17,[0,1])),He=new Float32Array(Ke(17,[1,0])),je=new Float32Array(function(e,t){const i=[];for(let s=0;s<=e;s++)i.push(We(s,t));return i}(17,4)),Ge=new Float32Array(2);class ze{constructor(e){this._scene=e,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}init(){const e=this._scene.canvas.gl;if(this._program=new Te(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS 16\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }"]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new Re(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new Re(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new Re(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}render(e,t,i){if(this._programError)return;this._getInverseProjectMat||(this._getInverseProjectMat=(()=>{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=c.mat4();return()=>(e&&c.inverseMat4(o.camera.projMatrix,t),t)})());const s=this._scene.canvas.gl,r=this._program,o=this._scene,n=s.drawingBufferWidth,a=s.drawingBufferHeight,l=o.camera.project._state,A=l.near,h=l.far;s.viewport(0,0,n,a),s.clearColor(0,0,0,1),s.enable(s.DEPTH_TEST),s.disable(s.BLEND),s.frontFace(s.CCW),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),r.bind(),Ge[0]=n,Ge[1]=a,s.uniform2fv(this._uViewport,Ge),s.uniform1f(this._uCameraNear,A),s.uniform1f(this._uCameraFar,h),s.uniform1f(this._uDepthCutoff,.01),0===i?s.uniform2fv(this._uSampleOffsets,He):s.uniform2fv(this._uSampleOffsets,Ve),s.uniform1fv(this._uSampleWeights,je);const u=e.getDepthTexture(),d=t.getTexture();r.bindTexture(this._uDepthTexture,u,0),r.bindTexture(this._uOcclusionTexture,d,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),s.drawElements(s.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}destroy(){this._program.destroy()}}function We(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function Ke(e,t){const i=[];for(let s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}class Xe{constructor(e,t,i){i=i||{},this.gl=t,this.allocated=!1,this.canvas=e,this.buffer=null,this.bound=!1,this.size=i.size,this._hasDepthTexture=!!i.depthTexture}setSize(e){this.size=e}webglContextRestored(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}bind(...e){if(this._touch(...e),this.bound)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}createTexture(e,t,i=null){const s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}_touch(...e){let t,i;const s=this.gl;if(this.size?(t=this.size[0],i=this.size[1]):(t=s.drawingBufferWidth,i=s.drawingBufferHeight),this.buffer){if(this.buffer.width===t&&this.buffer.height===i)return;this.buffer.textures.forEach((e=>s.deleteTexture(e))),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}const r=[];let o;e.length>0?r.push(...e.map((e=>this.createTexture(t,i,e)))):r.push(this.createTexture(t,i)),this._hasDepthTexture&&(o=s.createTexture(),s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,t,i,0,s.DEPTH_COMPONENT,s.FLOAT,null));const n=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,n),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,t,i);const a=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,a);for(let e=0;e0&&s.drawBuffers(r.map(((e,t)=>s.COLOR_ATTACHMENT0+t))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,n),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,a),!s.isFramebuffer(a))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);const l=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(l){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+l}this.buffer={framebuf:a,renderbuf:n,texture:r[0],textures:r,depthTexture:o,width:t,height:i},this.bound=!1}clear(){if(!this.bound)throw"Render buffer not bound";const e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}read(e,t,i=null,s=null,r=Uint8Array,o=4,n=0){const a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,A=new r(o),h=this.gl;return h.readBuffer(h.COLOR_ATTACHMENT0+n),h.readPixels(a,l,1,1,i||h.RGBA,s||h.UNSIGNED_BYTE,A,0),A}readArray(e=null,t=null,i=Uint8Array,s=4,r=0){const o=new i(this.buffer.width*this.buffer.height*s),n=this.gl;return n.readBuffer(n.COLOR_ATTACHMENT0+r),n.readPixels(0,0,this.buffer.width,this.buffer.height,e||n.RGBA,t||n.UNSIGNED_BYTE,o,0),o}readImageAsCanvas(){const e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,o=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);const n=this.buffer.width,a=this.buffer.height,l=a/2|0,A=4*n,h=new Uint8Array(4*n);for(let e=0;ee.deleteTexture(t))),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}class Je{constructor(e){this.scene=e,this._renderBuffersBasic={},this._renderBuffersScaled={}}getRenderBuffer(e,t){const i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled;let s=i[e];return s||(s=new Xe(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}destroy(){for(let e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(let e in this._renderBuffersScaled)this._renderBuffersScaled[e].destroy()}}function Ye(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];let i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}const Ze=function(t,i){i=i||{};const s=new xe(t),r=t.canvas.canvas,o=t.canvas.gl,n=!!i.transparent,a=i.alphaDepthMask,l=new e({});let A={},h={},u=!0,d=!0,f=!0,g=!0,m=!0,_=!0,v=!0,b=!0;const y=new Je(t);let B=!1;const x=new Qe(t),w=new ze(t);function P(){u&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableMap,s=t.drawableListPreCull;let r=0;for(let e in i)i.hasOwnProperty(e)&&(s[r++]=i[e]);s.length=r}}(),u=!1,d=!0),d&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),d=!1,f=!0),f&&function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableListPreCull,s=t.drawableList;let r=0;for(let e=0,t=i.length;e0)for(s.withSAO=!0,S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||j>0||O>0||N>0){if(o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):(o.blendEquation(o.FUNC_ADD),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA)),s.backfaces=!1,a||o.depthMask(!1),(O>0||N>0)&&o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),N>0)for(S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||z>0){if(s.lastProgramId=null,t.highlightMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),z>0)for(S=0;S0)for(S=0;S0||K>0||G>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.enable(o.CULL_FACE),K>0)for(S=0;S0)for(S=0;S0||J>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),J>0)for(S=0;S0)for(S=0;S0||Z>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),Z>0)for(S=0;S0)for(S=0;S0){const t=Math.floor(e/4),i=d.size[0],s=t%i-Math.floor(i/2),r=Math.floor(t/i)-Math.floor(i/2),o=Math.sqrt(Math.pow(s,2)+Math.pow(r,2));M.push({x:s,y:r,dist:o,isVertex:n&&a?_[e+3]>m.length/2:n,result:[_[e+0],_[e+1],_[e+2],_[e+3]],normal:[v[e+0],v[e+1],v[e+2],v[e+3]],id:[b[e+0],b[e+1],b[e+2],b[e+3]]})}let D=null,S=null,T=null,R=null;if(M.length>0){M.sort(((e,t)=>e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist)),R=M[0].isVertex?"vertex":"edge";const e=M[0].result,t=M[0].normal,i=M[0].id,s=m[e[3]],r=s.origin,o=s.coordinateScale;S=c.normalizeVec3([t[0]/c.MAX_INT,t[1]/c.MAX_INT,t[2]/c.MAX_INT]),D=[e[0]*o[0]+r[0],e[1]*o[1]+r[1],e[2]*o[2]+r[2]],T=l.items[i[0]+(i[1]<<8)+(i[2]<<16)+(i[3]<<24)]}if(null===B&&null==D)return null;let L=null;null!==D&&(L=t.camera.projectWorldPos(D));const U=T&&T.delegatePickedEntity?T.delegatePickedEntity():T;return h.reset(),h.snappedToEdge="edge"===R,h.snappedToVertex="vertex"===R,h.worldPos=D,h.worldNormal=S,h.entity=U,h.canvasPos=i,h.snappedCanvasPos=L||i,h}}(),this.addMarker=function(e){this._occlusionTester=this._occlusionTester||new Oe(t,y),this._occlusionTester.addMarker(e),t.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){P(),this._occlusionTester.bindRenderBuf(),s.reset(),s.backfaces=!0,s.frontface=!0,o.viewport(0,0,o.drawingBufferWidth,o.drawingBufferHeight),o.clearColor(0,0,0,0),o.enable(o.DEPTH_TEST),o.disable(o.CULL_FACE),o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);for(let e in A)if(A.hasOwnProperty(e)){const t=A[e].drawableList;for(let e=0,i=t.length;e{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!0:e.keyCode===this.KEY_ALT?this.altDown=!0:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!0),this.keyDown[e.keyCode]=!0,this.fire("keydown",e.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=e=>{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!1:e.keyCode===this.KEY_ALT?this.altDown=!1:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!1),this.keyDown[e.keyCode]=!1,this.fire("keyup",e.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=e=>{this.enabled&&(this.mouseover=!0,this._getMouseCanvasPos(e),this.fire("mouseenter",this.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=e=>{this.enabled&&(this.mouseover=!1,this._getMouseCanvasPos(e),this.fire("mouseleave",this.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!0;break;case 2:this.mouseDownMiddle=!0;break;case 3:this.mouseDownRight=!0}this._getMouseCanvasPos(e),this.element.focus(),this.fire("mousedown",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!1;break;case 2:this.mouseDownMiddle=!1;break;case 3:this.mouseDownRight=!1}this.fire("mouseup",this.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("click",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("dblclick",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}});const e=this.scene.tickify((()=>this.fire("mousemove",this.mouseCanvasPos,!0)));this.element.addEventListener("mousemove",this._mouseMoveListener=t=>{this.enabled&&(this._getMouseCanvasPos(t),e(),this.mouseover&&t.preventDefault())});const t=this.scene.tickify((e=>{this.fire("mousewheel",e,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=(e,i)=>{if(!this.enabled)return;const s=Math.max(-1,Math.min(1,40*-e.deltaY));t(s)},{passive:!0});{let e,t;const i=2;this.on("mousedown",(i=>{e=i[0],t=i[1]})),this.on("mouseup",(s=>{e>=s[0]-i&&e<=s[0]+i&&t>=s[1]-i&&t<=s[1]+i&&this.fire("mouseclicked",s,!0)}))}this._eventsBound=!0}_unbindEvents(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}_getMouseCanvasPos(e){if(e){let t=e.target,i=0,s=0;for(;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}setEnabled(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}getEnabled(){return this.enabled}setKeyboardEnabled(e){this.keyboardEnabled=e}getKeyboardEnabled(){return this.keyboardEnabled}destroy(){super.destroy(),this._unbindEvents()}}const $e=new e({});class et{constructor(e){this.id=$e.addItem({});for(const t in e)e.hasOwnProperty(t)&&(this[t]=e[t])}destroy(){$e.removeItem(this.id)}}class tt extends D{get type(){return"Viewport"}constructor(e,t={}){super(e,t),this._state=new et({boundary:[0,0,100,100]}),this.boundary=t.boundary,this.autoBoundary=t.autoBoundary}set boundary(e){if(!this._autoBoundary){if(!e){const t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}get boundary(){return this._state.boundary}set autoBoundary(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){const t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}get autoBoundary(){return this._autoBoundary}_getState(){return this._state}destroy(){super.destroy(),this._state.destroy()}}class it extends D{get type(){return"Perspective"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this._fov=60,this._canvasResized=this.scene.canvas.on("boundary",this._needUpdate,this),this.fov=t.fov,this.fovAxis=t.fovAxis,this.near=t.near,this.far=t.far}_update(){const e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis;let s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),c.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}set fov(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}get fov(){return this._fov}set fovAxis(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}get fovAxis(){return this._fovAxis}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}class st extends D{get type(){return"Ortho"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.scale=t.scale,this.near=t.near,this.far=t.far,this._onCanvasBoundary=this.scene.canvas.on("boundary",this._needUpdate,this)}_update(){const e=this.scene,t=.5*this._scale,i=e.canvas.boundary,s=i[2],r=i[3],o=s/r;let n,a,l,A;s>r?(n=-t,a=t,l=t/o,A=-t/o):(n=-t*o,a=t*o,l=t,A=-t),c.orthoMat4c(n,a,A,l,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set scale(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}get scale(){return this._scale}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}class rt extends D{get type(){return"Frustum"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._left=-1,this._right=1,this._bottom=-1,this._top=1,this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.left=t.left,this.right=t.right,this.bottom=t.bottom,this.top=t.top,this.near=t.near,this.far=t.far}_update(){c.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set left(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}get left(){return this._left}set right(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}get right(){return this._right}set top(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}get top(){return this._top}set bottom(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}get bottom(){return this._bottom}set near(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}get near(){return this._state.near}set far(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),super.destroy()}}class ot extends D{get type(){return"CustomProjection"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4()}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!1,this.matrix=t.matrix}set matrix(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}get matrix(){return this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy()}}const nt=c.vec3(),at=c.vec3(),lt=c.vec3(),At=c.vec3(),ht=c.vec3(),ct=c.vec3(),ut=c.vec4(),dt=c.vec4(),pt=c.vec4(),ft=c.mat4(),gt=c.mat4(),mt=c.vec3(),_t=c.vec3(),vt=c.vec3(),bt=c.vec3();class yt extends D{get type(){return"Camera"}constructor(e,t={}){super(e,t),this._state=new et({deviceMatrix:c.mat4(),hasDeviceMatrix:!1,matrix:c.mat4(),normalMatrix:c.mat4(),inverseMatrix:c.mat4()}),this._perspective=new it(this),this._ortho=new st(this),this._frustum=new rt(this),this._customProjection=new ot(this),this._project=this._perspective,this._eye=c.vec3([0,0,10]),this._look=c.vec3([0,0,0]),this._up=c.vec3([0,1,0]),this._worldUp=c.vec3([0,1,0]),this._worldRight=c.vec3([1,0,0]),this._worldForward=c.vec3([0,0,-1]),this.deviceMatrix=t.deviceMatrix,this.eye=t.eye,this.look=t.look,this.up=t.up,this.worldAxis=t.worldAxis,this.gimbalLock=t.gimbalLock,this.constrainPitch=t.constrainPitch,this.projection=t.projection,this._perspective.on("matrix",(()=>{"perspective"===this._projectionType&&this.fire("projMatrix",this._perspective.matrix)})),this._ortho.on("matrix",(()=>{"ortho"===this._projectionType&&this.fire("projMatrix",this._ortho.matrix)})),this._frustum.on("matrix",(()=>{"frustum"===this._projectionType&&this.fire("projMatrix",this._frustum.matrix)})),this._customProjection.on("matrix",(()=>{"customProjection"===this._projectionType&&this.fire("projMatrix",this._customProjection.matrix)}))}_update(){const e=this._state;let t;"ortho"===this.projection?(c.subVec3(this._eye,this._look,mt),c.normalizeVec3(mt,_t),c.mulVec3Scalar(_t,1e3,vt),c.addVec3(this._look,vt,bt),t=bt):t=this._eye,e.hasDeviceMatrix?(c.lookAtMat4v(t,this._look,this._up,gt),c.mulMat4(e.deviceMatrix,gt,e.matrix)):c.lookAtMat4v(t,this._look,this._up,e.matrix),c.inverseMat4(this._state.matrix,this._state.inverseMatrix),c.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}orbitYaw(e){let t=c.subVec3(this._eye,this._look,nt);c.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,ft),t=c.transformPoint3(ft,t,at),this.eye=c.addVec3(this._look,t,lt),this.up=c.transformPoint3(ft,this._up,At)}orbitPitch(e){if(this._constrainPitch&&(e=c.dotVec3(this._up,this._worldUp)/c.DEGTORAD)<1)return;let t=c.subVec3(this._eye,this._look,nt);const i=c.cross3Vec3(c.normalizeVec3(t,at),c.normalizeVec3(this._up,lt));c.rotationMat4v(.0174532925*e,i,ft),t=c.transformPoint3(ft,t,At),this.up=c.transformPoint3(ft,this._up,ht),this.eye=c.addVec3(t,this._look,ct)}yaw(e){let t=c.subVec3(this._look,this._eye,nt);c.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,ft),t=c.transformPoint3(ft,t,at),this.look=c.addVec3(t,this._eye,lt),this._gimbalLock&&(this.up=c.transformPoint3(ft,this._up,At))}pitch(e){if(this._constrainPitch&&(e=c.dotVec3(this._up,this._worldUp)/c.DEGTORAD)<1)return;let t=c.subVec3(this._look,this._eye,nt);const i=c.cross3Vec3(c.normalizeVec3(t,at),c.normalizeVec3(this._up,lt));c.rotationMat4v(.0174532925*e,i,ft),this.up=c.transformPoint3(ft,this._up,ct),t=c.transformPoint3(ft,t,At),this.look=c.addVec3(t,this._eye,ht)}pan(e){const t=c.subVec3(this._eye,this._look,nt),i=[0,0,0];let s;if(0!==e[0]){const r=c.cross3Vec3(c.normalizeVec3(t,[]),c.normalizeVec3(this._up,at));s=c.mulVec3Scalar(r,e[0]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]}0!==e[1]&&(s=c.mulVec3Scalar(c.normalizeVec3(this._up,lt),e[1]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),0!==e[2]&&(s=c.mulVec3Scalar(c.normalizeVec3(t,At),e[2]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),this.eye=c.addVec3(this._eye,i,ht),this.look=c.addVec3(this._look,i,ct)}zoom(e){const t=c.subVec3(this._eye,this._look,nt),i=Math.abs(c.lenVec3(t,at)),s=Math.abs(i+e);if(s<.5)return;const r=c.normalizeVec3(t,lt);this.eye=c.addVec3(this._look,c.mulVec3Scalar(r,s),At)}set eye(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}get eye(){return this._eye}set look(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}get look(){return this._look}set up(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}get up(){return this._up}set deviceMatrix(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}get deviceMatrix(){return this._state.deviceMatrix}set worldAxis(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=c.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}get worldAxis(){return this._worldAxis}get worldUp(){return this._worldUp}get xUp(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}get yUp(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}get zUp(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}get worldRight(){return this._worldRight}get worldForward(){return this._worldForward}set gimbalLock(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}get gimbalLock(){return this._gimbalLock}set constrainPitch(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}get eyeLookDist(){return c.lenVec3(c.subVec3(this._look,this._eye,nt))}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get viewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get normalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get viewNormalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get inverseViewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}get projMatrix(){return this[this.projection].matrix}get perspective(){return this._perspective}get ortho(){return this._ortho}get frustum(){return this._frustum}get customProjection(){return this._customProjection}set projection(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}get projection(){return this._projectionType}get project(){return this._project}projectWorldPos(e){const t=ut,i=dt,s=pt;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,c.mulMat4v4(this.viewMatrix,t,i),c.mulMat4v4(this.projMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;const r=this.scene.canvas.canvas,o=r.offsetWidth/2,n=r.offsetHeight/2;return[s[0]*o+o,s[1]*n+n]}destroy(){super.destroy(),this._state.destroy()}}class Bt extends D{get type(){return"Light"}get isLight(){return!0}constructor(e,t={}){super(e,t)}}class xt extends Bt{get type(){return"DirLight"}constructor(e,t={}){super(e,t),this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const i=this.scene.camera,s=this.scene.canvas;this._onCameraViewMatrix=i.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=i.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=s.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new et({type:"dir",dir:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(this._shadowViewMatrixDirty){this._shadowViewMatrix||(this._shadowViewMatrix=c.identityMat4());const e=this.scene.camera,t=this._state.dir,i=e.look,s=[i[0]-t[0],i[1]-t[1],i[2]-t[2]],r=[0,1,0];c.lookAtMat4v(s,i,r,this._shadowViewMatrix),this._shadowViewMatrixDirty=!1}return this._shadowViewMatrix},getShadowProjMatrix:()=>(this._shadowProjMatrixDirty&&(this._shadowProjMatrix||(this._shadowProjMatrix=c.identityMat4()),c.orthoMat4c(-40,40,-40,40,-40,80,this._shadowProjMatrix),this._shadowProjMatrixDirty=!1),this._shadowProjMatrix),getShadowRenderBuf:()=>(this._shadowRenderBuf||(this._shadowRenderBuf=new Xe(this.scene.canvas.canvas,this.scene.canvas.gl,{size:[1024,1024]})),this._shadowRenderBuf)}),this.dir=t.dir,this.color=t.color,this.intensity=t.intensity,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set dir(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get dir(){return this._state.dir}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}class wt extends Bt{get type(){return"AmbientLight"}constructor(e,t={}){super(e,t),this._state={type:"ambient",color:c.vec3([.7,.7,.7]),intensity:1},this.color=t.color,this.intensity=t.intensity,this.scene._lightCreated(this)}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}get intensity(){return this._state.intensity}destroy(){super.destroy(),this.scene._lightDestroyed(this)}}class Pt extends D{get type(){return"Geometry"}get isGeometry(){return!0}constructor(e,t={}){super(e,t),p.memory.meshes++}destroy(){super.destroy(),p.memory.meshes--}}var Ct=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}();const Mt=function(){const e=c.mat4(),t=c.mat4();return function(i,s){s=s||c.mat4();const r=i[0],o=i[1],n=i[2],a=i[3]-r,l=i[4]-o,A=i[5]-n,h=65535;return c.identityMat4(e),c.translationMat4v(i,e),c.identityMat4(t),c.scalingMat4v([a/h,l/h,A/h],t),c.mulMat4(e,t,s),s}}();var Ft=function(){const e=c.mat4(),t=c.mat4();return function(i,s,r){const o=new Uint16Array(i.length),n=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);let a;for(a=0;a=0?1:-1),t=(1-Math.abs(r))*(o>=0?1:-1);r=e,o=t}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*o+(o<0?-1:0))])}function Dt(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function St(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}const Tt={getPositionsBounds:function(e){const t=new Float32Array(3),i=new Float32Array(3);let s,r;for(s=0;s<3;s++)t[s]=Number.MAX_VALUE,i[s]=-Number.MAX_VALUE;for(s=0;sn&&(r=i,n=o),i=It(e,a,"floor","ceil"),s=Dt(i),o=St(e,a,s),o>n&&(r=i,n=o),i=It(e,a,"ceil","ceil"),s=Dt(i),o=St(e,a,s),o>n&&(r=i,n=o),t[a]=r[0],t[a+1]=r[1];return t},decompressNormals:function(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t},decompressNormal:function(e,t){let i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;const r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t}},Rt=p.memory,Lt=c.AABB3();class Ut extends Pt{get type(){return"ReadableGeometry"}get isReadableGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new et({compressGeometry:!!t.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._edgeIndicesBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._aabbDirty=!0,this._boundingSphere=!0,this._aabb=null,this._aabbDirty=!0,this._obb=null,this._obbDirty=!0;const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(this._state.compressGeometry){const e=Tt.getPositionsBounds(t.positions),s=Tt.compressPositions(t.positions,e.min,e.max);i.positions=s.quantized,i.positionsDecodeMatrix=s.decodeMatrix}else i.positions=t.positions.constructor===Float32Array?t.positions:new Float32Array(t.positions);if(t.colors&&(i.colors=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors)),t.uv)if(this._state.compressGeometry){const e=Tt.getUVBounds(t.uv),s=Tt.compressUVs(t.uv,e.min,e.max);i.uv=s.quantized,i.uvDecodeMatrix=s.decodeMatrix}else i.uv=t.uv.constructor===Float32Array?t.uv:new Float32Array(t.uv);t.normals&&(this._state.compressGeometry?i.normals=Tt.compressNormals(t.normals):i.normals=t.normals.constructor===Float32Array?t.normals:new Float32Array(t.normals)),t.indices&&(i.indices=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)),this._buildHash(),Rt.meshes++,this._buildVBOs()}_buildVBOs(){const e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Rt.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new Re(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Rt.positions+=e.positionsBuf.numItems),e.normals){let i=e.compressGeometry;e.normalsBuf=new Re(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Rt.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new Re(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Rt.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new Re(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Rt.uvs+=e.uvBuf.numItems)}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}_getPickTrianglePositions(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}_getPickTriangleColors(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}_buildEdgeIndices(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=Ct(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Rt.indices+=this._edgeIndicesBuf.numItems}_buildPickTriangleVBOs(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=c.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new Re(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Rt.positions+=this._pickTrianglePositionsBuf.numItems,Rt.colors+=this._pickTriangleColorsBuf.numItems}_buildPickVertexVBOs(){}_webglContextLost(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}_webglContextRestored(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}get primitive(){return this._state.primitiveName}get compressGeometry(){return this._state.compressGeometry}get positions(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),Tt.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null}set positions(e){const t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){const i=Tt.getPositionsBounds(e),s=Tt.compressPositions(e,i.min,i.max);e=s.quantized,t.positionsDecodeMatrix=s.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}get normals(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){const e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),Tt.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}}set normals(e){if(this._state.compressGeometry)return void this.error("can't update geometry normals - quantized geometry is immutable");const t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}get uv(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),Tt.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null}set uv(e){if(this._state.compressGeometry)return void this.error("can't update geometry UVs - quantized geometry is immutable");const t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}get colors(){return this._state.colors}set colors(e){if(this._state.compressGeometry)return void this.error("can't update geometry colors - quantized geometry is immutable");const t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}get indices(){return this._state.indices}get aabb(){return this._aabbDirty&&(this._aabb||(this._aabb=c.AABB3()),c.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}get obb(){return this._obbDirty&&(this._obb||(this._obb=c.OBB3()),c.positions3ToAABB3(this._state.positions,Lt,this._state.positionsDecodeMatrix),c.AABB3ToOBB3(Lt,this._obb),this._obbDirty=!1),this._obb}get numTriangles(){return this._numTriangles}_setAABBDirty(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Rt.meshes--}}function kt(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return _.apply(e,{positions:[c,u,d,l,u,d,l,A,d,c,A,d,c,u,d,c,A,d,c,A,h,c,u,h,c,u,d,c,u,h,l,u,h,l,u,d,l,u,d,l,u,h,l,A,h,l,A,d,l,A,h,c,A,h,c,A,d,l,A,d,c,A,h,l,A,h,l,u,h,c,u,h],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}class Ot extends D{get type(){return"Material"}constructor(e,t={}){super(e,t),p.memory.materials++}destroy(){super.destroy(),p.memory.materials--}}const Nt={opaque:0,mask:1,blend:2},Qt=["opaque","mask","blend"];class Vt extends Ot{get type(){return"PhongMaterial"}constructor(e,t={}){super(e,t),this._state=new et({type:"PhongMaterial",ambient:c.vec3([1,1,1]),diffuse:c.vec3([1,1,1]),specular:c.vec3([1,1,1]),emissive:c.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),this.ambient=t.ambient,this.diffuse=t.diffuse,this.specular=t.specular,this.emissive=t.emissive,this.alpha=t.alpha,this.shininess=t.shininess,this.reflectivity=t.reflectivity,this.lineWidth=t.lineWidth,this.pointSize=t.pointSize,t.ambientMap&&(this._ambientMap=this._checkComponent("Texture",t.ambientMap)),t.diffuseMap&&(this._diffuseMap=this._checkComponent("Texture",t.diffuseMap)),t.specularMap&&(this._specularMap=this._checkComponent("Texture",t.specularMap)),t.emissiveMap&&(this._emissiveMap=this._checkComponent("Texture",t.emissiveMap)),t.alphaMap&&(this._alphaMap=this._checkComponent("Texture",t.alphaMap)),t.reflectivityMap&&(this._reflectivityMap=this._checkComponent("Texture",t.reflectivityMap)),t.normalMap&&(this._normalMap=this._checkComponent("Texture",t.normalMap)),t.occlusionMap&&(this._occlusionMap=this._checkComponent("Texture",t.occlusionMap)),t.diffuseFresnel&&(this._diffuseFresnel=this._checkComponent("Fresnel",t.diffuseFresnel)),t.specularFresnel&&(this._specularFresnel=this._checkComponent("Fresnel",t.specularFresnel)),t.emissiveFresnel&&(this._emissiveFresnel=this._checkComponent("Fresnel",t.emissiveFresnel)),t.alphaFresnel&&(this._alphaFresnel=this._checkComponent("Fresnel",t.alphaFresnel)),t.reflectivityFresnel&&(this._reflectivityFresnel=this._checkComponent("Fresnel",t.reflectivityFresnel)),this.alphaMode=t.alphaMode,this.alphaCutoff=t.alphaCutoff,this.backfaces=t.backfaces,this.frontface=t.frontface,this._makeHash()}_makeHash(){const e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}set ambient(e){let t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get ambient(){return this._state.ambient}set diffuse(e){let t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get diffuse(){return this._state.diffuse}set specular(e){let t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get specular(){return this._state.specular}set emissive(e){let t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}get emissive(){return this._state.emissive}set alpha(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}get alpha(){return this._state.alpha}set shininess(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}get shininess(){return this._state.shininess}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set pointSize(e){this._state.pointSize=e||1,this.glRedraw()}get pointSize(){return this._state.pointSize}set reflectivity(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}get reflectivity(){return this._state.reflectivity}get normalMap(){return this._normalMap}get ambientMap(){return this._ambientMap}get diffuseMap(){return this._diffuseMap}get specularMap(){return this._specularMap}get emissiveMap(){return this._emissiveMap}get alphaMap(){return this._alphaMap}get reflectivityMap(){return this._reflectivityMap}get occlusionMap(){return this._occlusionMap}get diffuseFresnel(){return this._diffuseFresnel}get specularFresnel(){return this._specularFresnel}get emissiveFresnel(){return this._emissiveFresnel}get alphaFresnel(){return this._alphaFresnel}get reflectivityFresnel(){return this._reflectivityFresnel}set alphaMode(e){let t=Nt[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}get alphaMode(){return Qt[this._state.alphaMode]}set alphaCutoff(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}get alphaCutoff(){return this._state.alphaCutoff}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set frontface(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}get frontface(){return this._state.frontface?"ccw":"cw"}destroy(){super.destroy(),this._state.destroy()}}const Ht={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}};class jt extends Ot{get type(){return"EmphasisMaterial"}get presets(){return Ht}constructor(e,t={}){super(e,t),this._state=new et({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),this._preset="default",t.preset?(this.preset=t.preset,void 0!==t.fill&&(this.fill=t.fill),t.fillColor&&(this.fillColor=t.fillColor),void 0!==t.fillAlpha&&(this.fillAlpha=t.fillAlpha),void 0!==t.edges&&(this.edges=t.edges),t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth),void 0!==t.backfaces&&(this.backfaces=t.backfaces),void 0!==t.glowThrough&&(this.glowThrough=t.glowThrough)):(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.backfaces=t.backfaces,this.glowThrough=t.glowThrough)}set fill(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}get fill(){return this._state.fill}set fillColor(e){let t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}get fillColor(){return this._state.fillColor}set fillAlpha(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}get fillAlpha(){return this._state.fillAlpha}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set glowThrough(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}get glowThrough(){return this._state.glowThrough}set preset(e){if(e=e||"default",this._preset===e)return;const t=Ht[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ht).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const Gt={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}};class zt extends Ot{get type(){return"EdgeMaterial"}get presets(){return Gt}constructor(e,t={}){super(e,t),this._state=new et({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),this._preset="default",t.preset?(this.preset=t.preset,t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth)):(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth),this.edges=!1!==t.edges}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=Gt[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Gt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const Wt={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}};class Kt extends D{constructor(e,t={}){super(e,t),this._units="meters",this._scale=1,this._origin=c.vec3([0,0,0]),this.units=t.units,this.scale=t.scale,this.origin=t.origin}get unitsInfo(){return Wt}set units(e){e||(e="meters");Wt[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}get units(){return this._units}set scale(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}get scale(){return this._scale}set origin(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}get origin(){return this._origin}worldToRealPos(e,t=c.vec3(3)){t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}realToWorldPos(e,t=c.vec3(3)){return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}class Xt extends D{constructor(e,t={}){super(e,t),this._supported=we.SUPPORTED_EXTENSIONS.OES_standard_derivatives,this.enabled=t.enabled,this.kernelRadius=t.kernelRadius,this.intensity=t.intensity,this.bias=t.bias,this.scale=t.scale,this.minResolution=t.minResolution,this.numSamples=t.numSamples,this.blur=t.blur,this.blendCutoff=t.blendCutoff,this.blendFactor=t.blendFactor}get supported(){return this._supported}set enabled(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}get enabled(){return this._enabled}get possible(){if(!this._supported)return!1;if(!this._enabled)return!1;const e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}get active(){return this._active}set kernelRadius(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}get kernelRadius(){return this._kernelRadius}set intensity(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}get intensity(){return this._intensity}set bias(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}get bias(){return this._bias}set scale(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}get scale(){return this._scale}set minResolution(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}get minResolution(){return this._minResolution}set numSamples(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}get numSamples(){return this._numSamples}set blur(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}get blur(){return this._blur}set blendCutoff(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}get blendCutoff(){return this._blendCutoff}set blendFactor(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}get blendFactor(){return this._blendFactor}destroy(){super.destroy()}}class Jt extends D{constructor(e,t={}){super(e,t),this.sliceColor=t.sliceColor,this.sliceThickness=t.sliceThickness}set sliceThickness(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}get sliceThickness(){return this._sliceThickness}set sliceColor(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}get sliceColor(){return this._sliceColor}destroy(){super.destroy()}}const Yt={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}};class Zt extends Ot{get type(){return"PointsMaterial"}get presets(){return Yt}constructor(e,t={}){super(e,t),this._state=new et({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),t.preset?(this.preset=t.preset,void 0!==t.pointSize&&(this.pointSize=t.pointSize),void 0!==t.roundPoints&&(this.roundPoints=t.roundPoints),void 0!==t.perspectivePoints&&(this.perspectivePoints=t.perspectivePoints),void 0!==t.minPerspectivePointSize&&(this.minPerspectivePointSize=t.minPerspectivePointSize),void 0!==t.maxPerspectivePointSize&&(this.maxPerspectivePointSize=t.minPerspectivePointSize)):(this._preset="default",this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize),this.filterIntensity=t.filterIntensity,this.minIntensity=t.minIntensity,this.maxIntensity=t.maxIntensity}set pointSize(e){this._state.pointSize=e||2,this.glRedraw()}get pointSize(){return this._state.pointSize}set roundPoints(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}get roundPoints(){return this._state.roundPoints}set perspectivePoints(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}get perspectivePoints(){return this._state.perspectivePoints}set minPerspectivePointSize(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}get minPerspectivePointSize(){return this._state.minPerspectivePointSize}set maxPerspectivePointSize(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}get maxPerspectivePointSize(){return this._state.maxPerspectivePointSize}set filterIntensity(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}get filterIntensity(){return this._state.filterIntensity}set minIntensity(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}get minIntensity(){return this._state.minIntensity}set maxIntensity(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}get maxIntensity(){return this._state.maxIntensity}set preset(e){if(e=e||"default",this._preset===e)return;const t=Yt[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Yt).join(", "))}get preset(){return this._preset}get hash(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}destroy(){super.destroy(),this._state.destroy()}}const qt={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}};class $t extends Ot{get type(){return"LinesMaterial"}get presets(){return qt}constructor(e,t={}){super(e,t),this._state=new et({type:"LinesMaterial",lineWidth:null}),t.preset?(this.preset=t.preset,void 0!==t.lineWidth&&(this.lineWidth=t.lineWidth)):(this._preset="default",this.lineWidth=t.lineWidth)}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=qt[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(qt).join(", "))}get preset(){return this._preset}get hash(){return[""+this.lineWidth].join(";")}destroy(){super.destroy(),this._state.destroy()}}function ei(e,t){const i={};let s,r;for(let o=0,n=t.length;o{this.glRedraw()})),this.canvas.on("webglContextFailed",(()=>{alert("xeokit failed to find WebGL!")})),this._renderer=new Ze(this,{transparent:s,alphaDepthMask:r}),this._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;let e=null;this.getHash=function(){if(e)return e;const t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";const i=[];for(let e=0,s=t;ethis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},this._sectionPlanesState.setNumCachedSectionPlanes(t.numCachedSectionPlanes||0),this._lightsState=new function(){const e=c.vec4([0,0,0,0]),t=c.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];let i=null,s=null;this.getHash=function(){if(i)return i;const e=[],t=this.lights;let s;for(let i=0,r=t.length;i0&&e.push("/lm"),this.reflectionMaps.length>0&&e.push("/rm"),e.push(";"),i=e.join(""),i},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(let t=0,r=this.lights.length;t{this._renderer.imageDirty()}))}_initDefaults(){}_addComponent(e){if(e.id&&this.components[e.id]&&(this.error("Component "+_.inQuotes(e.id)+" already exists in Scene - ignoring ID, will randomly-generate instead"),e.id=null),!e.id)for(void 0===window.nextID&&(window.nextID=0),e.id="__"+window.nextID++;this.components[e.id];)e.id=c.createUUID();this.components[e.id]=e;const t=e.type;let i=this.types[e.type];i||(i=this.types[t]={}),i[e.id]=e,e.compile&&(this._compilables[e.id]=e),e.isDrawable&&(this._renderer.addDrawable(e.id,e),this._collidables[e.id]=e)}_removeComponent(e){var t=e.id,i=e.type;delete this.components[t];const s=this.types[i];s&&(delete s[t],_.isEmptyObject(s)&&delete this.types[i]),e.compile&&delete this._compilables[e.id],e.isDrawable&&(this._renderer.removeDrawable(e.id),delete this._collidables[e.id])}_sectionPlaneCreated(e){this.sectionPlanes[e.id]=e,this.scene._sectionPlanesState.addSectionPlane(e._state),this.scene.fire("sectionPlaneCreated",e,!0),this._needRecompile=!0}_bitmapCreated(e){this.bitmaps[e.id]=e,this.scene.fire("bitmapCreated",e,!0)}_lineSetCreated(e){this.lineSets[e.id]=e,this.scene.fire("lineSetCreated",e,!0)}_lightCreated(e){this.lights[e.id]=e,this.scene._lightsState.addLight(e._state),this._needRecompile=!0}_lightMapCreated(e){this.lightMaps[e.id]=e,this.scene._lightsState.addLightMap(e._state),this._needRecompile=!0}_reflectionMapCreated(e){this.reflectionMaps[e.id]=e,this.scene._lightsState.addReflectionMap(e._state),this._needRecompile=!0}_sectionPlaneDestroyed(e){delete this.sectionPlanes[e.id],this.scene._sectionPlanesState.removeSectionPlane(e._state),this.scene.fire("sectionPlaneDestroyed",e,!0),this._needRecompile=!0}_bitmapDestroyed(e){delete this.bitmaps[e.id],this.scene.fire("bitmapDestroyed",e,!0)}_lineSetDestroyed(e){delete this.lineSets[e.id],this.scene.fire("lineSetDestroyed",e,!0)}_lightDestroyed(e){delete this.lights[e.id],this.scene._lightsState.removeLight(e._state),this._needRecompile=!0}_lightMapDestroyed(e){delete this.lightMaps[e.id],this.scene._lightsState.removeLightMap(e._state),this._needRecompile=!0}_reflectionMapDestroyed(e){delete this.reflectionMaps[e.id],this.scene._lightsState.removeReflectionMap(e._state),this._needRecompile=!0}_registerModel(e){this.models[e.id]=e,this._modelIds=null}_deregisterModel(e){const t=e.id;delete this.models[t],this._modelIds=null,this.fire("modelUnloaded",t)}_registerObject(e){this.objects[e.id]=e,this._numObjects++,this._objectIds=null}_deregisterObject(e){delete this.objects[e.id],this._numObjects--,this._objectIds=null}_objectVisibilityUpdated(e,t=!0){e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}_deRegisterVisibleObject(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}_objectXRayedUpdated(e,t=!0){e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}_deRegisterXRayedObject(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}_objectHighlightedUpdated(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}_deRegisterHighlightedObject(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}_objectSelectedUpdated(e,t=!0){e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}_deRegisterSelectedObject(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}_objectColorizeUpdated(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}_deRegisterColorizedObject(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}_objectOpacityUpdated(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}_deRegisterOpacityObject(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}_objectOffsetUpdated(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}_deRegisterOffsetObject(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}_webglContextLost(){this.canvas.spinner.processes++;for(const e in this.components)if(this.components.hasOwnProperty(e)){const t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}_webglContextRestored(){const e=this.canvas.gl;for(const t in this.components)if(this.components.hasOwnProperty(t)){const i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}get capabilities(){return this._renderer.capabilities}get entityOffsetsEnabled(){return this._entityOffsetsEnabled}get pickSurfacePrecisionEnabled(){return!1}get logarithmicDepthBufferEnabled(){return this._logarithmicDepthBufferEnabled}set numCachedSectionPlanes(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}get numCachedSectionPlanes(){return this._sectionPlanesState.getNumCachedSectionPlanes()}set pbrEnabled(e){this._pbrEnabled=!!e,this.glRedraw()}get pbrEnabled(){return this._pbrEnabled}set dtxEnabled(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}get dtxEnabled(){return this._dtxEnabled}set colorTextureEnabled(e){this._colorTextureEnabled=!!e,this.glRedraw()}get colorTextureEnabled(){return this._colorTextureEnabled}doOcclusionTest(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}render(e){e&&M.runTasks();const t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),!e&&!this._renderer.needsRender())return;t.sceneId=this.id;const i=this._passes,s=this._clearEachPass;let r,o;for(r=0;rr&&(r=e[3]),e[4]>o&&(o=e[4]),e[5]>n&&(n=e[5]),A=!0}A||(t=-100,i=-100,s=-100,r=100,o=100,n=100),this._aabb[0]=t,this._aabb[1]=i,this._aabb[2]=s,this._aabb[3]=r,this._aabb[4]=o,this._aabb[5]=n,this._aabbDirty=!1}return this._aabb}_setAABBDirty(){this._aabbDirty=!0,this.fire("boundary")}pick(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");const i=e.includeEntities||e.include;i&&(e.includeEntityIds=ei(this,i));const s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=ei(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}snapPick(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}clear(){var e;for(const t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}clearLights(){const e=Object.keys(this.lights);for(let t=0,i=e.length;t{if(e.collidable){const l=e.aabb;l[0]o&&(o=l[3]),l[4]>n&&(n=l[4]),l[5]>a&&(a=l[5]),t=!0}})),t){const e=c.AABB3();return e[0]=i,e[1]=s,e[2]=r,e[3]=o,e[4]=n,e[5]=a,e}return this.aabb}setObjectsVisible(e,t){return this.withObjects(e,(e=>{const i=e.visible!==t;return e.visible=t,i}))}setObjectsCollidable(e,t){return this.withObjects(e,(e=>{const i=e.collidable!==t;return e.collidable=t,i}))}setObjectsCulled(e,t){return this.withObjects(e,(e=>{const i=e.culled!==t;return e.culled=t,i}))}setObjectsSelected(e,t){return this.withObjects(e,(e=>{const i=e.selected!==t;return e.selected=t,i}))}setObjectsHighlighted(e,t){return this.withObjects(e,(e=>{const i=e.highlighted!==t;return e.highlighted=t,i}))}setObjectsXRayed(e,t){return this.withObjects(e,(e=>{const i=e.xrayed!==t;return e.xrayed=t,i}))}setObjectsEdges(e,t){return this.withObjects(e,(e=>{const i=e.edges!==t;return e.edges=t,i}))}setObjectsColorized(e,t){return this.withObjects(e,(e=>{e.colorize=t}))}setObjectsOpacity(e,t){return this.withObjects(e,(e=>{const i=e.opacity!==t;return e.opacity=t,i}))}setObjectsPickable(e,t){return this.withObjects(e,(e=>{const i=e.pickable!==t;return e.pickable=t,i}))}setObjectsOffset(e,t){this.withObjects(e,(e=>{e.offset=t}))}withObjects(e,t){_.isString(e)&&(e=[e]);let i=!1;for(let s=0,r=e.length;s{r>s&&(s=r,e(...i))}));return this._tickifiedFunctions[t]={tickSubId:n,wrapperFunc:o},o}destroy(){super.destroy();for(const e in this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}const ii=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,o=e._state.billboard,n=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,A=[];A.push("#version 300 es"),A.push("// Lambertian drawing vertex shader"),A.push("in vec3 position;"),A.push("uniform mat4 modelMatrix;"),A.push("uniform mat4 viewMatrix;"),A.push("uniform mat4 projMatrix;"),A.push("uniform vec4 colorize;"),A.push("uniform vec3 offset;"),l&&A.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(A.push("uniform float logDepthBufFC;"),A.push("out float vFragDepth;"),A.push("bool isPerspectiveMatrix(mat4 m) {"),A.push(" return (m[2][3] == - 1.0);"),A.push("}"),A.push("out float isPerspective;"));a&&A.push("out vec4 vWorldPosition;");if(A.push("uniform vec4 lightAmbient;"),A.push("uniform vec4 materialColor;"),A.push("uniform vec3 materialEmissive;"),r.normalsBuf){A.push("in vec3 normal;"),A.push("uniform mat4 modelNormalMatrix;"),A.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=s.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),A.push(" }"),A.push(" return normalize(v);"),A.push("}"))}A.push("out vec4 vColor;"),"points"===r.primitiveName&&A.push("uniform float pointSize;");"spherical"!==o&&"cylindrical"!==o||(A.push("void billboard(inout mat4 mat) {"),A.push(" mat[0][0] = 1.0;"),A.push(" mat[0][1] = 0.0;"),A.push(" mat[0][2] = 0.0;"),"spherical"===o&&(A.push(" mat[1][0] = 0.0;"),A.push(" mat[1][1] = 1.0;"),A.push(" mat[1][2] = 0.0;")),A.push(" mat[2][0] = 0.0;"),A.push(" mat[2][1] = 0.0;"),A.push(" mat[2][2] =1.0;"),A.push("}"));A.push("void main(void) {"),A.push("vec4 localPosition = vec4(position, 1.0); "),A.push("vec4 worldPosition;"),l&&A.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?A.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):A.push("vec4 localNormal = vec4(normal, 0.0); "),A.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),A.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));A.push("mat4 viewMatrix2 = viewMatrix;"),A.push("mat4 modelMatrix2 = modelMatrix;"),n&&A.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(A.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),A.push("billboard(modelMatrix2);"),A.push("billboard(viewMatrix2);"),A.push("billboard(modelViewMatrix);"),r.normalsBuf&&(A.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),A.push("billboard(modelNormalMatrix2);"),A.push("billboard(viewNormalMatrix2);"),A.push("billboard(modelViewNormalMatrix);")),A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&A.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(A.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),A.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),A.push("float lambertian = 1.0;"),r.normalsBuf)for(let e=0,t=s.lights.length;e0,o=t.gammaOutput,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}"points"===s.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");o?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(e)):(this.vertex=function(e){const t=e.scene;e._material;const i=e._state,s=t._sectionPlanesState,r=e._geometry._state,o=t._lightsState;let n;const a=i.billboard,l=i.background,A=i.stationary,h=function(e){if(!e._geometry._state.uvBuf)return!1;const t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=oi(e),u=s.getNumAllocatedSectionPlanes()>0,d=ri(e),p=!!r.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),u&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(let e=0,t=o.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}h&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));r.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===r.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(let e=0,t=o.lights.length;e0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(let e=0,t=o.lights.length;e0,l=oi(e),A=s.uvBuf,h="PhongMaterial"===n.type,c="MetallicMaterial"===n.type,u="SpecularMaterial"===n.type,d=ri(e);t.gammaInput;const p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var g=0;g0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),o.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),h&&((o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = "+si[o.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||u)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),o.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+si[o.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(o.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));n.ambient&&f.push("uniform vec3 materialAmbient;");n.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==n.alpha&&null!==n.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");n.emissive&&f.push("uniform vec3 materialEmissive;");n.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==n.glossiness&&null!==n.glossiness&&f.push("uniform float materialGlossiness;");void 0!==n.shininess&&null!==n.shininess&&f.push("uniform float materialShininess;");n.specular&&f.push("uniform vec3 materialSpecular;");void 0!==n.metallic&&null!==n.metallic&&f.push("uniform float materialMetallic;");void 0!==n.roughness&&null!==n.roughness&&f.push("uniform float materialRoughness;");void 0!==n.specularF0&&null!==n.specularF0&&f.push("uniform float materialSpecularF0;");A&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));A&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));A&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));A&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&A&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&A&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&A&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));A&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));A&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&A&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&A&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&A&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(let e=0,t=o.lights.length;e 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),n.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");n.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):n.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");n.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");n.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==n.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==n.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==n.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==n.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==n.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));A&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+si[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));A&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+si[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));A&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+si[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));A&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+si[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));A&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));A&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(o.lights.length>0||o.lightMaps.length>0||o.reflectionMaps.length>0)){A&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),A&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),A&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),A&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),A&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),A&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),A&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),h&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),u&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),o.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),h&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(u||c)&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(let e=0,t=o.lights.length;e0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(h=0,c=o.sectionPlanes.length;h0&&r.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,r.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),r.reflectionMaps.length>0&&r.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,r.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),this._uGammaFactor&&s.uniform1f(this._uGammaFactor,i.gammaFactor),this._baseTextureUnit=e.textureUnit};class hi{constructor(e){this.vertex=function(e){const t=e.scene,i=t._lightsState,s=function(e){const t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,o=!!e._geometry._state.compressGeometry,n=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),o&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===n||"cylindrical"===n)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===n&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),o&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(o?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(let e=0,t=i.lights.length;e0,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}"points"===e._geometry._state.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const ci=new e({}),ui=c.vec3(),di=function(e,t){this.id=ci.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new hi(t),this._allocate(t)},pi={};di.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=pi[t];return i||(i=new di(t,e),pi[t]=i,p.memory.programs++),i._useCount++,i},di.prototype.put=function(){0==--this._useCount&&(ci.removeItem(this.id),this._program&&this._program.destroy(),delete pi[this._hash],p.memory.programs--)},di.prototype.webglContextRestored=function(){this._program=null},di.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl,n=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,A=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,A?e.getRTCViewMatrix(a.originHash,A):r.viewMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Edges drawing vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec4 edgeColor;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));i&&n.push("out vec4 vWorldPosition;");n.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));n.push("vColor = edgeColor;"),i&&n.push("vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,o=[];o.push("#version 300 es"),o.push("// Edges drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const gi=new e({}),mi=c.vec3(),_i=function(e,t){this.id=gi.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new fi(t),this._allocate(t)},vi={};_i.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=vi[t];return i||(i=new _i(t,e),vi[t]=i,p.memory.programs++),i._useCount++,i},_i.prototype.put=function(){0==--this._useCount&&(gi.removeItem(this.id),this._program&&this._program.destroy(),delete vi[this._hash],p.memory.programs--)},_i.prototype.webglContextRestored=function(){this._program=null},_i.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl;let n;const a=t._state,l=t._geometry,A=l._state,h=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,h?e.getRTCViewMatrix(a.originHash,h):r.viewMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh picking vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("out vec4 vViewPosition;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("uniform vec2 pickClipPos;"),n.push("vec4 remapClipPos(vec4 clipPos) {"),n.push(" clipPos.xy /= clipPos.w;"),n.push(" clipPos.xy -= pickClipPos;"),n.push(" clipPos.xy *= clipPos.w;"),n.push(" return clipPos;"),n.push("}"),n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"));n.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = remapClipPos(clipPos);"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(e)}}const yi=c.vec3(),Bi=function(e,t){this._hash=e,this._shaderSource=new bi(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},xi={};Bi.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let i=xi[t];if(!i){if(i=new Bi(t,e),i.errors)return console.log(i.errors.join("\n")),null;xi[t]=i,p.memory.programs++}return i._useCount++,i},Bi.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete xi[this._hash],p.memory.programs--)},Bi.prototype.webglContextRestored=function(){this._program=null},Bi.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t>24&255,h=l>>16&255,c=l>>8&255,u=255&l;s.uniform4f(this._uPickColor,u/255,c/255,h/255,A/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),n.indicesBuf?(s.drawElements(n.primitive,n.indicesBuf.numItems,n.indicesBuf.itemType,0),e.drawElements++):n.positions&&s.drawArrays(s.TRIANGLES,0,n.positions.numItems)},Bi.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Te(i,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(e)}}const Pi=c.vec3(),Ci=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new wi(t),this._allocate(t)},Mi={};Ci.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Mi[t];if(!i){if(i=new Ci(t,e),i.errors)return console.log(i.errors.join("\n")),null;Mi[t]=i,p.memory.programs++}return i._useCount++,i},Ci.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Mi[this._hash],p.memory.programs--)},Ci.prototype.webglContextRestored=function(){this._program=null},Ci.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry,a=t._geometry._state,l=t.origin,A=o.backfaces,h=o.frontface,c=i.camera.project,u=n._getPickTrianglePositions(),d=n._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){const e=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,e)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh occlusion vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(e)}}const Ei=c.vec3(),Ii=function(e,t){this._hash=e,this._shaderSource=new Fi(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Di={};Ii.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";");let i=Di[t];if(!i){if(i=new Ii(t,e),i.errors)return console.log(i.errors.join("\n")),null;Di[t]=i,p.memory.programs++}return i._useCount++,i},Ii.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Di[this._hash],p.memory.programs--)},Ii.prototype.webglContextRestored=function(){this._program=null},Ii.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._material._state,o=t._state,n=t._geometry._state,a=t.origin;if(r.alpha<1)return;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){const t=r.backfaces;e.backfaces!==t&&(t?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=t);const i=r.frontface;e.frontface!==i&&(i?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=i),this._lastMaterialId=r.id}const l=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(o.originHash,a):l.viewMatrix),o.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(e),this.fragment=function(e){const t=e.scene;t.canvas.gl;const i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(e)}}const Ti=function(e,t){this._hash=e,this._shaderSource=new Si(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Ri={};Ti.get=function(e){const t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let s=Ri[i];if(!s){if(s=new Ti(i,e),s.errors)return console.log(s.errors.join("\n")),null;Ri[i]=s,p.memory.programs++}return s._useCount++,s},Ti.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Ri[this._hash],p.memory.programs--)},Ti.prototype.webglContextRestored=function(){this._program=null},Ti.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){const t=s.backfaces;e.backfaces!==t&&(t?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=t);const r=s.frontface;e.frontface!==r&&(r?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=r),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){const s=t.vertexBufs;s.id!==this._lastVertexBufsId&&(s.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(s.positionsBuf,s.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=s.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},Ti.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Te(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0){let e,t,r,o,n;for(let a=0,l=this._uSectionPlanes.length;a0)for(let i=0;i0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this.glRedraw()}}const Ki=function(){const e=c.vec3(),t=c.vec3(),i=c.vec3(),s=c.vec3(),r=c.vec3(),o=c.vec3(),n=c.vec4(),a=c.vec3(),l=c.vec3(),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3(),m=c.vec4(),_=c.vec4(),v=c.vec4(),b=c.vec3(),y=c.vec3(),B=c.vec3(),x=c.vec3(),w=c.vec3(),P=c.vec3(),C=c.vec3(),M=c.vec3(),F=c.vec3(),E=c.vec3(),I=c.vec3();return function(D,S,T,R){var L=R.primIndex;if(null!=L&&L>-1){const N=D.geometry._state,Q=D.scene,V=Q.camera,H=Q.canvas;if("triangles"===N.primitiveName){R.primitive="triangle";const Q=L,G=N.indices,z=N.positions;let W,K,X;if(G){var U=G[Q+0],k=G[Q+1],O=G[Q+2];o[0]=U,o[1]=k,o[2]=O,R.indices=o,W=3*U,K=3*k,X=3*O}else W=3*Q,K=W+3,X=K+3;if(i[0]=z[W+0],i[1]=z[W+1],i[2]=z[W+2],s[0]=z[K+0],s[1]=z[K+1],s[2]=z[K+2],r[0]=z[X+0],r[1]=z[X+1],r[2]=z[X+2],N.compressGeometry){const e=N.positionsDecodeMatrix;e&&(Tt.decompressPosition(i,e,i),Tt.decompressPosition(s,e,s),Tt.decompressPosition(r,e,r))}R.canvasPos?c.canvasPosToLocalRay(H.canvas,D.origin?j(S,D.origin):S,T,D.worldMatrix,R.canvasPos,e,t):R.origin&&R.direction&&c.worldRayToLocalRay(D.worldMatrix,R.origin,R.direction,e,t),c.normalizeVec3(t),c.rayPlaneIntersect(e,t,i,s,r,n),R.localPos=n,R.position=n,m[0]=n[0],m[1]=n[1],m[2]=n[2],m[3]=1,c.transformVec4(D.worldMatrix,m,_),a[0]=_[0],a[1]=_[1],a[2]=_[2],R.canvasPos&&D.origin&&(a[0]+=D.origin[0],a[1]+=D.origin[1],a[2]+=D.origin[2]),R.worldPos=a,c.transformVec4(V.matrix,_,v),l[0]=v[0],l[1]=v[1],l[2]=v[2],R.viewPos=l,c.cartesianToBarycentric(n,i,s,r,A),R.bary=A;const J=N.normals;if(J){if(N.compressGeometry){const e=3*U,t=3*k,i=3*O;Tt.decompressNormal(J.subarray(e,e+2),h),Tt.decompressNormal(J.subarray(t,t+2),u),Tt.decompressNormal(J.subarray(i,i+2),d)}else h[0]=J[W],h[1]=J[W+1],h[2]=J[W+2],u[0]=J[K],u[1]=J[K+1],u[2]=J[K+2],d[0]=J[X],d[1]=J[X+1],d[2]=J[X+2];const e=c.addVec3(c.addVec3(c.mulVec3Scalar(h,A[0],b),c.mulVec3Scalar(u,A[1],y),B),c.mulVec3Scalar(d,A[2],x),w);R.worldNormal=c.normalizeVec3(c.transformVec3(D.worldNormalMatrix,e,P))}const Y=N.uv;if(Y){if(p[0]=Y[2*U],p[1]=Y[2*U+1],f[0]=Y[2*k],f[1]=Y[2*k+1],g[0]=Y[2*O],g[1]=Y[2*O+1],N.compressGeometry){const e=N.uvDecodeMatrix;e&&(Tt.decompressUV(p,e,p),Tt.decompressUV(f,e,f),Tt.decompressUV(g,e,g))}R.uv=c.addVec3(c.addVec3(c.mulVec2Scalar(p,A[0],C),c.mulVec2Scalar(f,A[1],M),F),c.mulVec2Scalar(g,A[2],E),I)}}}}}();function Xi(e={}){let t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);let i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);let s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);let r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);let o=e.heightSegments||1;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),o<1&&(o=1);const n=!!e.openEnded;let a=e.center;const l=a?a[0]:0,A=a?a[1]:0,h=a?a[2]:0,c=s/2,u=s/o,d=2*Math.PI/r,p=1/r,f=(t-i)/o,g=[],m=[],v=[],b=[];let y,B,x,w,P,C,M,F,E,I,D;const S=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(y=0;y<=o;y++)for(P=t-y*f,C=c-y*u,B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),m.push(P*x),m.push(S),m.push(P*w),v.push(B*p),v.push(1*y/o),g.push(P*x+l),g.push(C+A),g.push(P*w+h);for(y=0;y0){for(E=g.length/3,m.push(0),m.push(1),m.push(0),v.push(.5),v.push(.5),g.push(0+l),g.push(c+A),g.push(0+h),B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(t*x),m.push(1),m.push(t*w),v.push(I),v.push(D),g.push(t*x+l),g.push(c+A),g.push(t*w+h);for(B=0;B0){for(E=g.length/3,m.push(0),m.push(-1),m.push(0),v.push(.5),v.push(.5),g.push(0+l),g.push(0-c+A),g.push(0+h),B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(i*x),m.push(-1),m.push(i*w),v.push(I),v.push(D),g.push(i*x+l),g.push(0-c+A),g.push(i*w+h);for(B=0;B":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function Zi(e={}){var t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],o=e.size||1,n=[],a=[],l=e.text;_.isNumeric(l)&&(l=""+l);for(var A,h,c,u,d,p,f,g,m,v=(l||"").split("\n"),b=0,y=0,B=.04,x=0;x0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this._children.length){const e=this._children.splice();let t;for(let i=0,s=e.length;i1;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const o=gs(i,this.wrapS);o&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,o);const n=gs(i,this.wrapT);if(n&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,n),this.type===i.TEXTURE_3D||this.type===i.TEXTURE_2D_ARRAY){const e=gs(i,this.wrapR);e&&i.texParameteri(this.target,i.TEXTURE_WRAP_R,e),i.texParameteri(this.type,i.TEXTURE_WRAP_R,e)}r?(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,bs(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,bs(i,this.magFilter))):(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,gs(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,gs(i,this.magFilter)));const a=gs(i,this.format,this.encoding),l=gs(i,this.type),A=vs(i,this.internalFormat,a,l,this.encoding,!1);i.texStorage2D(i.TEXTURE_2D,s,A,e[0].width,e[0].height);for(let t=0,s=e.length;t>t;return e+1}class ws extends D{get type(){return"Texture"}constructor(e,t={}){super(e,t),this._state=new et({texture:new _s({gl:this.scene.canvas.gl}),matrix:c.identityMat4(),hasMatrix:t.translate&&(0!==t.translate[0]||0!==t.translate[1])||!!t.rotate||t.scale&&(0!==t.scale[0]||0!==t.scale[1]),minFilter:this._checkMinFilter(t.minFilter),magFilter:this._checkMagFilter(t.magFilter),wrapS:this._checkWrapS(t.wrapS),wrapT:this._checkWrapT(t.wrapT),flipY:this._checkFlipY(t.flipY),encoding:this._checkEncoding(t.encoding)}),this._src=null,this._image=null,this._translate=c.vec2([0,0]),this._scale=c.vec2([1,1]),this._rotate=c.vec2([0,0]),this._matrixDirty=!1,this.translate=t.translate,this.scale=t.scale,this.rotate=t.rotate,t.src?this.src=t.src:t.image&&(this.image=t.image),p.memory.textures++}_checkMinFilter(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}_checkMagFilter(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}_checkWrapS(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkWrapT(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this._state.texture=new _s({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}_update(){const e=this._state;if(this._matrixDirty){let t,i;0===this._translate[0]&&0===this._translate[1]||(t=c.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(i=c.scalingMat4v([this._scale[0],this._scale[1],1]),t=t?c.mulMat4(t,i):i),0!==this._rotate&&(i=c.rotationMat4v(.0174532925*this._rotate,[0,0,1]),t=t?c.mulMat4(t,i):i),t&&(e.matrix=t),this._matrixDirty=!1}this.glRedraw()}set image(e){this._image=ys(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}get image(){return this._image}set src(e){this.scene.loading++,this.scene.canvas.spinner.processes++;const t=this;let i=new Image;i.onload=function(){i=ys(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}get src(){return this._src}set translate(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}get translate(){return this._translate}set scale(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}get scale(){return this._scale}set rotate(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}get rotate(){return this._rotate}get minFilter(){return this._state.minFilter}get magFilter(){return this._state.magFilter}get wrapS(){return this._state.wrapS}get wrapT(){return this._state.wrapT}get flipY(){return this._state.flipY}get encoding(){return this._state.encoding}destroy(){super.destroy(),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),p.memory.textures--}}const Ps=p.memory,Cs=c.AABB3();class Ms extends Pt{get type(){return"VBOGeometry"}get isVBOGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new et({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._aabb=null,this._obb=c.OBB3();const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(t.indices){var r;if(t.positionsDecodeMatrix);else{const e=Tt.getPositionsBounds(t.positions),o=Tt.compressPositions(t.positions,e.min,e.max);r=o.quantized,i.positionsDecodeMatrix=o.decodeMatrix,i.positionsBuf=new Re(s,s.ARRAY_BUFFER,r,r.length,3,s.STATIC_DRAW),Ps.positions+=i.positionsBuf.numItems,c.positions3ToAABB3(t.positions,this._aabb),c.positions3ToAABB3(r,Cs,i.positionsDecodeMatrix),c.AABB3ToOBB3(Cs,this._obb)}if(t.colors){const e=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors);i.colorsBuf=new Re(s,s.ARRAY_BUFFER,e,e.length,4,s.STATIC_DRAW),Ps.colors+=i.colorsBuf.numItems}if(t.uv){const e=Tt.getUVBounds(t.uv),r=Tt.compressUVs(t.uv,e.min,e.max),o=r.quantized;i.uvDecodeMatrix=r.decodeMatrix,i.uvBuf=new Re(s,s.ARRAY_BUFFER,o,o.length,2,s.STATIC_DRAW),Ps.uvs+=i.uvBuf.numItems}if(t.normals){const e=Tt.compressNormals(t.normals);let r=i.compressGeometry;i.normalsBuf=new Re(s,s.ARRAY_BUFFER,e,e.length,3,s.STATIC_DRAW,r),Ps.normals+=i.normalsBuf.numItems}{const e=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices);i.indicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,e,e.length,1,s.STATIC_DRAW),Ps.indices+=i.indicesBuf.numItems;const o=Ct(r,e,i.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,o,o.length,1,s.STATIC_DRAW),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)}this._buildHash(),Ps.meshes++}else this.error("Config expected: indices");else this.error("Config expected: positions")}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf}get primitive(){return this._state.primitiveName}get aabb(){return this._aabb}get obb(){return this._obb}get numTriangles(){return this._numTriangles}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Ps.meshes--}}var Fs={};function Es(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return _.apply(e,{primitive:"lines",positions:[l,A,h,l,A,d,l,u,h,l,u,d,c,A,h,c,A,d,c,u,h,c,u,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function Is(e={}){let t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);let i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1),t=t||10,i=i||10;const s=t/i,r=t/2,o=[],n=[];let a=0;for(let e=0,t=-r;e<=i;e++,t+=s)o.push(-r),o.push(0),o.push(t),o.push(r),o.push(0),o.push(t),o.push(t),o.push(0),o.push(-r),o.push(t),o.push(0),o.push(r),n.push(a++),n.push(a++),n.push(a++),n.push(a++);return _.apply(e,{primitive:"lines",positions:o,indices:n})}function Ds(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);let s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);let r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);const o=e.center,n=o?o[0]:0,a=o?o[1]:0,l=o?o[2]:0,A=t/2,h=i/2,c=Math.floor(s)||1,u=Math.floor(r)||1,d=c+1,p=u+1,f=t/c,g=i/u,m=new Float32Array(d*p*3),v=new Float32Array(d*p*3),b=new Float32Array(d*p*2);let y,B,x,w,P,C,M,F=0,E=0;for(y=0;y65535?Uint32Array:Uint16Array)(c*u*6);for(y=0;y360&&(o=360);const n=e.center;let a=n?n[0]:0,l=n?n[1]:0;const A=n?n[2]:0,h=[],u=[],d=[],p=[];let f,g,m,v,b,y,B,x,w,P,C,M;for(x=0;x<=r;x++)for(B=0;B<=s;B++)f=B/s*o,g=.785398+x/r*Math.PI*2,a=t*Math.cos(f),l=t*Math.sin(f),m=(t+i*Math.cos(g))*Math.cos(f),v=(t+i*Math.cos(g))*Math.sin(f),b=i*Math.sin(g),h.push(m+a),h.push(v+l),h.push(b+A),d.push(1-B/s),d.push(x/r),y=c.normalizeVec3(c.subVec3([m,v,b],[a,l,A],[]),[]),u.push(y[0]),u.push(y[1]),u.push(y[2]);for(x=1;x<=r;x++)for(B=1;B<=s;B++)w=(s+1)*x+B-1,P=(s+1)*(x-1)+B-1,C=(s+1)*(x-1)+B,M=(s+1)*x+B,p.push(w),p.push(P),p.push(C),p.push(C),p.push(M),p.push(w);return _.apply(e,{positions:h,normals:u,uv:d,indices:p})}function Ts(e={}){if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";let t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";let i=[];for(let e=0;e>8},Fs.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},Fs.parse={},Fs.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),Ao&&(o=A),hn&&(n=h)}return{min:{x:t,y:i,z:s},max:{x:r,y:o,z:n}}};class Rs extends D{constructor(e,t={}){super(e,t),this._type=t.type||(t.src?t.src.split(".").pop():null)||"jpg",this._pos=c.vec3(t.pos||[0,0,0]),this._up=c.vec3(t.up||[0,1,0]),this._normal=c.vec3(t.normal||[0,0,1]),this._height=t.height||1,this._origin=c.vec3(),this._rtcPos=c.vec3(),this._imageSize=c.vec2(),this._texture=new ws(this,{flipY:!0}),this._image=new Image,"jpg"!==this._type&&"png"!==this._type&&(this.error('Unsupported type - defaulting to "jpg"'),this._type="jpg"),this._node=new ls(this,{matrix:c.inverseMat4(c.lookAtMat4v(this._pos,c.subVec3(this._pos,this._normal,c.mat4()),this._up,c.mat4())),children:[this._bitmapMesh=new Wi(this,{scale:[1,1,1],rotation:[-90,0,0],collidable:t.collidable,pickable:t.pickable,opacity:t.opacity,clippable:t.clippable,geometry:new Ut(this,Ds({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0})})]}),t.image?this.image=t.image:t.src?this.src=t.src:t.imageData&&(this.imageData=t.imageData),this.scene._bitmapCreated(this)}set visible(e){this._bitmapMesh.visible=e}get visible(){return this._bitmapMesh.visible}set image(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}get image(){return this._image}set src(e){if(e){this._image.onload=()=>{this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale()},this._image.src=e;switch(e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}}get src(){return this._image.src}set imageData(e){this._image.onload=()=>{this._texture.image=image,this._imageSize[0]=image.width,this._imageSize[1]=image.height,this._updateBitmapMeshScale()},this._image.src=e}get imageData(){const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")}set type(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}get type(){return this._type}get pos(){return this._pos}get normal(){return this._normal}get up(){return this._up}set height(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}get height(){return this._height}set collidable(e){this._bitmapMesh.collidable=!1!==e}get collidable(){return this._bitmapMesh.collidable}set clippable(e){this._bitmapMesh.clippable=!1!==e}get clippable(){return this._bitmapMesh.clippable}set pickable(e){this._bitmapMesh.pickable=!1!==e}get pickable(){return this._bitmapMesh.pickable}set opacity(e){this._bitmapMesh.opacity=e}get opacity(){return this._bitmapMesh.opacity}destroy(){super.destroy(),this.scene._bitmapDestroyed(this)}_updateBitmapMeshScale(){const e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}const Ls=c.OBB3(),Us=c.OBB3(),ks=c.OBB3();class Os{constructor(e,t,i,s,r,o,n=null,a=0){this.model=e,this.object=null,this.parent=null,this.transform=r,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=t,this.obb=null,this._aabbLocal=null,this._aabbWorld=c.AABB3(),this._aabbWorldDirty=!1,this.layer=n,this.portionId=a,this._color=new Uint8Array([i[0],i[1],i[2],s]),this._colorize=new Uint8Array([i[0],i[1],i[2],s]),this._colorizing=!1,this._transparent=s<255,this.numTriangles=0,this.origin=null,this.entity=null,r&&r._addMesh(this)}_sceneModelDirty(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}_transformDirty(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}_updateMatrix(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}_finalize(e){this.layer.initFlags(this.portionId,e,this._transparent)}_finalize2(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}_setVisible(e){this.layer.setVisible(this.portionId,e,this._transparent)}_setColor(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}_setColorize(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}_setOpacity(e,t){const i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}_setOffset(e){this.layer.setOffset(this.portionId,e)}_setHighlighted(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}_setXRayed(e){this.layer.setXRayed(this.portionId,e,this._transparent)}_setSelected(e){this.layer.setSelected(this.portionId,e,this._transparent)}_setEdges(e){this.layer.setEdges(this.portionId,e,this._transparent)}_setClippable(e){this.layer.setClippable(this.portionId,e,this._transparent)}_setCollidable(e){this.layer.setCollidable(this.portionId,e)}_setPickable(e){this.layer.setPickable(this.portionId,e,this._transparent)}_setCulled(e){this.layer.setCulled(this.portionId,e,this._transparent)}canPickTriangle(){return!1}drawPickTriangles(e,t){}pickTriangleSurface(e){}precisionRayPickSurface(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}canPickWorldPos(){return!0}drawPickDepths(e){this.model.drawPickDepths(e)}drawPickNormals(e){this.model.drawPickNormals(e)}delegatePickedEntity(){return this.parent}getEachVertex(e){this.layer.getEachVertex(this.portionId,e)}set aabb(e){this._aabbLocal=e}get aabb(){if(this._aabbWorldDirty){if(c.AABB3ToOBB3(this._aabbLocal,Ls),this.transform?(c.transformOBB3(this.transform.worldMatrix,Ls,Us),c.transformOBB3(this.model.worldMatrix,Us,ks),c.OBB3ToAABB3(ks,this._aabbWorld)):(c.transformOBB3(this.model.worldMatrix,Ls,Us),c.OBB3ToAABB3(Us,this._aabbWorld)),this.origin){const e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld}_destroy(){this.model.scene._renderer.putPickID(this.pickId)}}const Ns=new class{constructor(){this._uint8Arrays={},this._float32Arrays={}}_clear(){this._uint8Arrays={},this._float32Arrays={}}getUInt8Array(e){let t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}getFloat32Array(e){let t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}};let Qs=0;const Vs={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},Hs=new Float32Array([1,1,1,1]),js=new Float32Array([0,0,0,1]),Gs=c.vec4(),zs=c.vec3(),Ws=c.vec3(),Ks=c.mat4();class Xs{constructor(e,t=!1,{instancing:i=!1,edges:s=!1}={}){this._scene=e,this._withSAO=t,this._instancing=i,this._edges=s,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}_getHash(){return this._scene._sectionPlanesState.getHash()}_buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}_buildVertexShader(){return[""]}_buildFragmentShader(){return[""]}_addMatricesUniformBlockLines(e,t=!1){return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}_addRemapClipPosLines(e,t=1){return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(${t}));`),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}getValid(){return this._hash===this._getHash()}setSectionPlanesStateUniforms(e){const t=this._scene,{gl:i}=t.canvas,{model:s,layerIndex:r}=e,o=t._sectionPlanesState.getNumAllocatedSectionPlanes(),n=t._sectionPlanesState.sectionPlanes.length;if(o>0){const a=t._sectionPlanesState.sectionPlanes,l=r*n,A=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(let t=0;t0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(let t=0,i=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0&&p.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,p.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),p.lightMaps.length>0&&p.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,p.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),this._withSAO){const t=n.sao;if(t.possible){const i=a.drawingBufferWidth,s=a.drawingBufferHeight;Gs[0]=i,Gs[1]=s,Gs[2]=t.blendCutoff,Gs[3]=t.blendFactor,a.uniform4fv(this._uSAOParams,Gs),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++}}if(s){const e=this._edges?"edgeColor":"fillColor",t=this._edges?"edgeAlpha":"fillAlpha";if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_XRAYED"]){const i=n.xrayMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_HIGHLIGHTED"]){const i=n.highlightMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_SELECTED"]){const i=n.selectedMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else a.uniform4fv(this._uColor,this._edges?js:Hs)}this._draw({state:l,frameCtx:e,incrementDrawState:r}),a.bindVertexArray(null)}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null,p.memory.programs--}}class Js extends Xs{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!1,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{const e=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,e,i.indicesBuf.itemType,o),r&&s.drawElements++}}}class Ys extends Js{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r;const o=[];o.push("#version 300 es"),o.push("// Triangles batching draw vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;")),o.push("out vec4 vColor;"),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Zs extends Js{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,i=t.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching silhouette fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r){for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = newColor;"),o.push("}"),o}}class $s extends Js{constructor(e){super(e,!1,{instancing:!1,edges:!0})}}class er extends $s{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class tr extends $s{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class ir extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class sr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class rr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class or extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class nr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}class ar extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class lr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}class Ar extends Js{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Triangles batching quality draw vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),o.push("vFragDepth = 1.0 + clipPos.w;")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Triangles batching quality draw fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),n.push("uniform sampler2D uAOMap;"),n.push("in vec4 vViewPosition;"),n.push("in vec3 vViewNormal;"),n.push("in vec4 vColor;"),n.push("in vec2 vUV;"),n.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class cr extends Js{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching color texture fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),o.push("uniform float gammaFactor;"),o.push("vec4 linearToLinear( in vec4 value ) {"),o.push(" return value;"),o.push("}"),o.push("vec4 sRGBToLinear( in vec4 value ) {"),o.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),o.push("}"),o.push("vec4 gammaToLinear( in vec4 value) {"),o.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),o.push("}"),t&&(o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}")),r){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,t=i.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const _r=c.vec3(),vr=c.vec3(),br=c.vec3(),yr=c.vec3(),Br=c.mat4();class xr extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=_r;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=vr;if(l){const e=br;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Br),m=yr,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElements(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class wr{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new qs(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new ir(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new sr(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new mr(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new xr(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Ys(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Ys(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Zs(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Zs(this._scene,!0)),this._flatColorRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new cr(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new cr(this._scene,!0)),this._colorTextureRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Ar(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ar(this._scene,!0)),this._pbrRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new qs(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new nr(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new ar(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new er(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new tr(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new ir(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new rr(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new hr(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new sr(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new or(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new lr(this._scene)),this._shadowRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new xr(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new mr(this._scene)),this._snapInitRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Pr={};let Cr=65536,Mr=5e6;class Fr{constructor(){}set doublePrecisionEnabled(e){c.setDoublePrecisionEnabled(e)}get doublePrecisionEnabled(){return c.getDoublePrecisionEnabled()}set maxDataTextureHeight(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),Cr=e}get maxDataTextureHeight(){return Cr}set maxGeometryBatchSize(e){e<1e5?e=1e5:e>5e6&&(e=5e6),Mr=e}get maxGeometryBatchSize(){return Mr}}const Er=new Fr;class Ir{constructor(){this.maxVerts=Er.maxGeometryBatchSize,this.maxIndices=3*Er.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]}}const Dr=c.mat4(),Sr=c.mat4();function Tr(e,t,i){const s=e.length,r=new Uint16Array(s),o=t[0],n=t[1],a=t[2],l=t[3]-o,A=t[4]-n,h=t[5]-a,u=65525,d=u/l,p=u/A,f=u/h,g=e=>e>=0?e:0;for(let t=0;t=0?1:-1),t=(1-Math.abs(s))*(r>=0?1:-1),s=e,r=t}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function Ur(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}const kr=c.mat4(),Or=c.mat4(),Nr=c.vec4([0,0,0,1]),Qr=c.vec3(),Vr=c.vec3(),Hr=c.vec3(),jr=c.vec3(),Gr=c.vec3(),zr=c.vec3(),Wr=c.vec3();class Kr{constructor(e){console.info("Creating VBOBatchingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesBatchingLayer"+(e.solid?"-solid":"-surface")+(e.autoNormals?"-autonormals":"-normals")+(e.textureSet&&e.textureSet.colorTexture?"-colorTexture":"")+(e.textureSet&&e.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Pr[t];return i||(i=new wr(e),Pr[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Pr[t],i._destroy()}))),i}(e.model.scene),this._buffer=new Ir(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({origin:c.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:e.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=c.mat4(e.positionsDecodeMatrix)),e.uvDecodeMatrix?(this._state.uvDecodeMatrix=c.mat3(e.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,e.origin&&this._state.origin.set(e.origin),this.solid=!!e.solid}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)for(let e=0,t=o.length;e0){const e=kr;m?c.inverseMat4(c.transposeMat4(m,Or),e):c.identityMat4(e,e),function(e,t,i,s,r){function o(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}let n,a,l,A,h,u,d=new Float32Array([0,0,0,0]),p=new Float32Array([0,0,0,0]);for(u=0;uh&&(l=n,h=A),n=Lr(p,"floor","ceil"),a=Ur(n),A=o(p,a),A>h&&(l=n,h=A),n=Lr(p,"ceil","ceil"),a=Ur(n),A=o(p,a),A>h&&(l=n,h=A),s[r+u+0]=l[0],s[r+u+1]=l[1],s[r+u+2]=0}(e,r,r.length,b.normals,b.normals.length)}if(l)for(let e=0,t=l.length;e0)for(let e=0,t=n.length;e0)for(let e=0,t=a.length;e0){const s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):Tr(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=c.mat4());if(e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(let e=0,t=this._portions.length;e0){const s=new Int8Array(i.normals);let r=!0;e.normalsBuf=new Re(t,t.ARRAY_BUFFER,s,i.normals.length,3,t.STATIC_DRAW,r)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.uv.length>0)if(e.uvDecodeMatrix){let s=!1;e.uvBuf=new Re(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,s)}else{const s=Tt.getUVBounds(i.uv),r=Tt.compressUVs(i.uv,s.min,s.max),o=r.quantized;let n=!1;e.uvDecodeMatrix=c.mat3(r.decodeMatrix),e.uvBuf=new Re(t,t.ARRAY_BUFFER,o,o.length,2,t.STATIC_DRAW,n)}if(i.metallicRoughness.length>0){const s=new Uint8Array(i.metallicRoughness);let r=!1;e.metallicRoughnessBuf=new Re(t,t.ARRAY_BUFFER,s,i.metallicRoughness.length,2,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s),o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){const s=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}isEmpty(){return!this._state.indicesBuf}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=e,s=this._portions[i],r=4*s.vertsBaseIndex,o=4*s.numVerts,n=this._scratchMemory.getUInt8Array(o),a=t[0],l=t[1],A=t[2],h=t[3];for(let e=0;e_)&&(_=e,s.set(v),r&&c.triangleNormal(p,f,g,r),m=!0)}}return m&&r&&(c.transformVec3(this.model.worldNormalMatrix,r,r),c.normalizeVec3(r)),m}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}class Xr extends Xs{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!0,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}class Jr extends Xr{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r,o,n;const a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),e.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),e.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),r=0,o=i.lights.length;r= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),s&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),r=0,o=i.lights.length;r0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Yr extends Xr{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState;let s,r;const o=t.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry flat-shading drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),o){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}for(n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),s=0,r=i.lights.length;s0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}class qr extends Xr{constructor(e,t){super(e,t,{instancing:!0,edges:!0})}}class $r extends qr{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class eo extends qr{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class to extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class io extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class so extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class ro extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class oo extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry depth drawing fragment shader"),o.push("precision highp float;"),o.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),o.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),o.push("}"),o}}class no extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class ao extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const lo={3e3:"linearToLinear",3001:"sRGBToLinear"};class Ao extends Xr{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Instancing geometry quality drawing vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),o.push("in vec4 modelMatrixCol0;"),o.push("in vec4 modelMatrixCol1;"),o.push("in vec4 modelMatrixCol2;"),o.push("in vec4 modelNormalMatrixCol0;"),o.push("in vec4 modelNormalMatrixCol1;"),o.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),o.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),o.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Instancing geometry quality drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),n.push("#define PI 3.14159265359"),n.push("#define RECIPROCAL_PI 0.31830988618"),n.push("#define RECIPROCAL_PI2 0.15915494"),n.push("#define EPSILON 1e-6"),n.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),n.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),n.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),n.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),n.push(" return normalize(surf_norm );"),n.push(" }"),n.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),n.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),n.push(" vec2 st0 = dFdx( uv.st );"),n.push(" vec2 st1 = dFdy( uv.st );"),n.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),n.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),n.push(" vec3 N = normalize( surf_norm );"),n.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),n.push(" mat3 tsn = mat3( S, T, N );"),n.push(" return normalize( tsn * mapN );"),n.push("}"),n.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),n.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),n.push("}"),n.push("struct IncidentLight {"),n.push(" vec3 color;"),n.push(" vec3 direction;"),n.push("};"),n.push("struct ReflectedLight {"),n.push(" vec3 diffuse;"),n.push(" vec3 specular;"),n.push("};"),n.push("struct Geometry {"),n.push(" vec3 position;"),n.push(" vec3 viewNormal;"),n.push(" vec3 worldNormal;"),n.push(" vec3 viewEyeDir;"),n.push("};"),n.push("struct Material {"),n.push(" vec3 diffuseColor;"),n.push(" float specularRoughness;"),n.push(" vec3 specularColor;"),n.push(" float shine;"),n.push("};"),n.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),n.push(" float r = ggxRoughness + 0.0001;"),n.push(" return (2.0 / (r * r) - 2.0);"),n.push("}"),n.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),n.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),n.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),n.push("}"),s.reflectionMaps.length>0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = "+lo[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = "+lo[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class co extends Xr{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState;let r,o;const n=i.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),e.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),t&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),n){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),r=0,o=s.lights.length;r0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const vo=c.vec3(),bo=c.vec3(),yo=c.vec3(),Bo=c.vec3(),xo=c.mat4();class wo extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=vo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=bo;if(l){const e=c.transformPoint3(h,l,yo);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,xo),m=Bo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Po{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Zr(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new to(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new io(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new _o(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new wo(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Jr(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Jr(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Yr(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Yr(this._scene,!0)),this._flatColorRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Ao(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ao(this._scene,!0)),this._pbrRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new co(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new co(this._scene,!0)),this._colorTextureRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Zr(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new oo(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new no(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new $r(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new eo(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new to(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new so(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ho(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new io(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new ro(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ao(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new _o(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new wo(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Co={};const Mo=new Uint8Array(4),Fo=new Float32Array(1),Eo=c.vec4([0,0,0,1]),Io=new Float32Array(3),Do=c.vec3(),So=c.vec3(),To=c.vec3(),Ro=c.vec3(),Lo=c.vec3(),Uo=c.vec3(),ko=c.vec3(),Oo=new Float32Array(4);class No{constructor(e){console.info("Creating VBOInstancingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesInstancingLayer"+(e.solid?"-solid":"-surface")+(e.normals?"-normals":"-autoNormals"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Co[t];return i||(i=new Po(e),Co[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Co[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({numInstances:0,obb:c.OBB3(),origin:c.vec3(),geometry:e.geometry,textureSet:e.textureSet,pbrSupported:!1,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,e.origin&&this._state.origin.set(e.origin),this._finalized=!1,this.solid=!!e.solid,this.numIndices=e.geometry.numIndices}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;e.colorsBuf=new Re(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,t),this._colors=[]}if(this._metallicRoughness.length>0){const t=new Uint8Array(this._metallicRoughness);let i=!1;e.metallicRoughnessBuf=new Re(s,s.ARRAY_BUFFER,t,this._metallicRoughness.length,2,s.STATIC_DRAW,i)}if(o>0){let t=!1;e.flagsBuf=new Re(s,s.ARRAY_BUFFER,new Float32Array(o),o,1,s.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;e.offsetsBuf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,t),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){const i=!1;e.positionsBuf=new Re(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,i),e.positionsDecodeMatrix=c.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){const i=new Uint8Array(t.colorsCompressed),r=!1;e.colorsBuf=new Re(s,s.ARRAY_BUFFER,i,i.length,4,s.STATIC_DRAW,r)}if(t.uvCompressed&&t.uvCompressed.length>0){const i=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new Re(s,s.ARRAY_BUFFER,i,i.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){const t=!1;e.modelMatrixCol0Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelMatrixCol1Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelMatrixCol2Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol1Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol2Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){const t=!1;e.pickColorsBuf=new Re(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,t),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Mo[0]=t[0],Mo[1]=t[1],Mo[2]=t[2],Mo[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(Mo,4*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?1:0)<<16,Fo[0]=d,this._state.flagsBuf&&this._state.flagsBuf.setData(Fo,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Io[0]=t[0],Io[1]=t[1],Io[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(Io,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}getEachVertex(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;const i=this._state,s=i.geometry,r=this._portions[e];if(!r)return void this.model.error("portion not found: "+e);const o=s.quantizedPositions,n=i.origin,a=r.offset,l=n[0]+a[0],A=n[1]+a[1],h=n[2]+a[2],u=Eo,d=r.matrix,p=this.model.sceneModelMatrix,f=i.positionsDecodeMatrix;for(let e=0,i=o.length;ev)&&(v=e,s.set(b),r&&c.triangleNormal(f,g,m,r),_=!0)}}return _&&r&&(c.transformVec3(a.normalMatrix,r,r),c.transformVec3(this.model.worldNormalMatrix,r,r),c.normalizeVec3(r)),_}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}class Qo extends Xs{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}class Vo extends Qo{drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Ho extends Qo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const jo=c.vec3(),Go=c.vec3(),zo=c.vec3(),Wo=c.vec3(),Ko=c.mat4();class Xo extends Xs{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=jo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Go;if(l){const e=zo;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Ko),m=Wo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Jo=c.vec3(),Yo=c.vec3(),Zo=c.vec3(),qo=c.vec3(),$o=c.mat4();class en extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Jo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Yo;if(l){const e=Zo;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,$o),m=qo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class tn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Vo(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ho(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Xo(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new en(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const sn={};class rn{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]}}class on{constructor(e){console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=sn[t];return i||(i=new tn(e),sn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete sn[t],i._destroy()}))),i}(e.model.scene),this.model=e.model,this._buffer=new rn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:c.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=c.vec3(e.origin))}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=Tr(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.colors.length>0){const s=i.colors.length/4,r=new Float32Array(s);let o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2],A=t[3];for(let e=0;e0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Lines instancing color fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return this._withSAO?(o.push(" float viewportWidth = uSAOParams[0];"),o.push(" float viewportHeight = uSAOParams[1];"),o.push(" float blendCutoff = uSAOParams[2];"),o.push(" float blendFactor = uSAOParams[3];"),o.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),o.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),o.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):o.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class ln extends nn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const An=c.vec3(),hn=c.vec3(),cn=c.vec3();c.vec3();const un=c.mat4();class dn extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=An;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=hn;if(l){const e=c.transformPoint3(h,l,cn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,un),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const pn=c.vec3(),fn=c.vec3(),gn=c.vec3();c.vec3();const mn=c.mat4();class _n extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=pn;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=fn;if(l){const e=c.transformPoint3(h,l,gn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,mn),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class vn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._snapInitRenderer||(this._snapInitRenderer=new dn(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new _n(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new an(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ln(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new dn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new _n(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const bn={};const yn=new Uint8Array(4),Bn=new Float32Array(1),xn=new Float32Array(3),wn=new Float32Array(4);class Pn{constructor(e){console.info("VBOInstancingLinesLayer"),this.model=e.model,this.material=e.material,this.sortId="LinesInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=bn[t];return i||(i=new vn(e),bn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete bn[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({obb:c.OBB3(),numInstances:0,origin:null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,e.origin&&(this._state.origin=c.vec3(e.origin)),this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;this._state.colorsBuf=new Re(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,t),this._colors=[]}if(r>0){let t=!1;this._state.flagsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;this._state.offsetsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){const s=new Uint8Array(i.colorsCompressed),r=!1;t.colorsBuf=new Re(e,e.ARRAY_BUFFER,s,s.length,4,e.STATIC_DRAW,r)}if(i.positionsCompressed&&i.positionsCompressed.length>0){const s=!1;t.positionsBuf=new Re(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,s),t.positionsDecodeMatrix=c.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new Re(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){const t=!1;this._state.modelMatrixCol0Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol1Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol2Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";yn[0]=t[0],yn[1]=t[1],yn[2]=t[2],yn[3]=t[3],this._state.colorsBuf.setData(yn,4*e,4)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?255:0)<<16,Bn[0]=d,this._state.flagsBuf.setData(Bn,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(xn[0]=t[0],xn[1]=t[1],xn[2]=t[2],this._state.offsetsBuf.setData(xn,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;wn[0]=t[0],wn[1]=t[4],wn[2]=t[8],wn[3]=t[12],this._state.modelMatrixCol0Buf.setData(wn,i),wn[0]=t[1],wn[1]=t[5],wn[2]=t[9],wn[3]=t[13],this._state.modelMatrixCol1Buf.setData(wn,i),wn[0]=t[2],wn[1]=t[6],wn[2]=t[10],wn[3]=t[14],this._state.modelMatrixCol2Buf.setData(wn,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesXRayed(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK)}drawOcclusion(e,t){}drawShadow(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawPickNormals(e,t){}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}class Cn extends Xs{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}class Mn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Fn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points batching silhouette vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = color;"),o.push("}"),o}}class En extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class In extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Dn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}const Sn=c.vec3(),Tn=c.vec3(),Rn=c.vec3(),Ln=c.vec3(),Un=c.mat4();class kn extends Xs{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Sn;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Tn;if(l){const e=Rn;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Un),m=Ln,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const On=c.vec3(),Nn=c.vec3(),Qn=c.vec3(),Vn=c.vec3(),Hn=c.mat4();class jn extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=On;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Nn;if(l){const e=Qn;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Hn),m=Vn,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Gn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Mn(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Fn(this._scene)),this._silhouetteRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new En(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new In(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Dn(this._scene)),this._occlusionRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new kn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new jn(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const zn={};class Wn{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]}}class Kn{constructor(e){console.info("Creating VBOBatchingPointsLayer"),this.model=e.model,this.sortId="PointsBatchingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=zn[t];return i||(i=new Gn(e),zn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete zn[t],i._destroy()}))),i}(e.model.scene),this._buffer=new Wn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:c.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=c.vec3(e.origin))}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=Tr(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s);let o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized"}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2];for(let e=0;e0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Yn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Zn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class qn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class $n extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class ea extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points instancing depth vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return o.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class ta extends Xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const ia=c.vec3(),sa=c.vec3(),ra=c.vec3();c.vec3();const oa=c.mat4();class na extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ia;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=sa;if(l){const e=c.transformPoint3(h,l,ra);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,oa),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const aa=c.vec3(),la=c.vec3(),Aa=c.vec3();c.vec3();const ha=c.mat4();class ca extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=aa;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=la;if(l){const e=c.transformPoint3(h,l,Aa);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,ha),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class ua{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Jn(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Yn(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new ea(this._scene)),this._depthRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Zn(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new qn(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new $n(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ta(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new na(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new ca(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const da={};const pa=new Uint8Array(4),fa=new Float32Array(1),ga=new Float32Array(3),ma=new Float32Array(4);class _a{constructor(e){console.info("VBOInstancingPointsLayer"),this.model=e.model,this.material=e.material,this.sortId="PointsInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=da[t];return i||(i=new ua(e),da[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete da[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({obb:c.OBB3(),numInstances:0,origin:e.origin?c.vec3(e.origin):null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let s=!1;i.flagsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,s)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;i.offsetsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){const t=!1;i.positionsBuf=new Re(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,t),i.positionsDecodeMatrix=c.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){const t=new Uint8Array(s.colorsCompressed),r=!1;i.colorsBuf=new Re(e,e.ARRAY_BUFFER,t,t.length,4,e.STATIC_DRAW,r)}if(this._modelMatrixCol0.length>0){const t=!1;i.modelMatrixCol0Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),i.modelMatrixCol1Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),i.modelMatrixCol2Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){const t=!1;i.pickColorsBuf=new Re(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,t),this._pickColors=[]}i.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";pa[0]=t[0],pa[1]=t[1],pa[2]=t[2],this._state.colorsBuf.setData(pa,3*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?255:0)<<16,fa[0]=d,this._state.flagsBuf.setData(fa,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(ga[0]=t[0],ga[1]=t[1],ga[2]=t[2],this._state.offsetsBuf.setData(ga,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;ma[0]=t[0],ma[1]=t[4],ma[2]=t[8],ma[3]=t[12],this._state.modelMatrixCol0Buf.setData(ma,i),ma[0]=t[1],ma[1]=t[5],ma[2]=t[9],ma[3]=t[13],this._state.modelMatrixCol1Buf.setData(ma,i),ma[0]=t[2],ma[1]=t[6],ma[2]=t[10],ma[3]=t[14],this._state.modelMatrixCol2Buf.setData(ma,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawShadow(e,t){}drawPickMesh(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,Vs.PICK)}drawPickDepths(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,Vs.PICK)}drawPickNormals(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK)}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}const va=c.vec3(),ba=c.vec3(),ya=c.mat4();class Ba{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=va;if(g){const t=c.transformPoint3(u,A,ba);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,ya)}else f=p;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),n.drawArrays(n.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),n.drawArrays(n.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),n.drawArrays(n.LINES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class xa{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}eagerCreateRenders(){}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Ba(this._scene,!1)),this._colorRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy()}}const wa={};class Pa{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]}}class Ca{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindLineIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}class Ma{constructor(e,t,i,s,r=null){this._gl=e,this._texture=t,this._textureWidth=i,this._textureHeight=s,this._textureData=r}bindTexture(e,t,i){return e.bindTexture(t,this,i)}bind(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}unbind(e){}}const Fa={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Fa,null,4));let e=0;Object.keys(Fa).forEach((t=>{t.startsWith("size")&&(e+=Fa[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Fa.totalLines).toFixed(2)}`);let t={};Object.keys(Fa).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Fa[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class Ea{disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}generateTextureForColorsAndFlags(e,t,i,s,r){const o=t.length;this.numPortions=o;const n=4096,a=Math.ceil(o/512);if(0===a)throw"texture height===0";const l=new Uint8Array(16384*a);Fa.sizeDataColorsAndFlags+=l.byteLength,Fa.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),l.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20);const A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,n,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,A,n,a,l)}generateTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Fa.sizeDataTextureOffsets+=r.byteLength,Fa.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,o,i,s,r)}generateTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Fa.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete wa[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new Pa,this._dataTextureState=new Ca,this._dataTextureGenerator=new Ea,this._state=new et({origin:c.vec3(t.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Fa.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/2})),(this._state.numVertices+s>4096*Da||t+r>4096*Da)&&Fa.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*Da&&t+r<=4096*Da}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/2/8)*2;Fa.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}const i=t.positionsCompressed,s=t.indices,r=this._buffer;r.positionsCompressed.push(i);const o=r.lenPositionsCompressed/3,n=i.length/3;let a;r.lenPositionsCompressed+=i.length;let l=0;if(s){let e;l=s.length/2,n<=256?(e=r.indices8Bits,a=r.lenIndices8Bits/2,r.lenIndices8Bits+=s.length):n<=65536?(e=r.indices16Bits,a=r.lenIndices16Bits/2,r.lenIndices16Bits+=s.length):(e=r.indices32Bits,a=r.lenIndices32Bits/2,r.lenIndices32Bits+=s.length),e.push(s)}this._state.numVertices+=n,Fa.numberOfGeometries++;return{vertexBase:o,numVertices:n,numLines:l,indicesBase:a}}_createSubPortion(e,t){const i=e.color,s=e.colors,r=e.opacity,o=e.meshMatrix,n=e.pickColor,a=this._buffer,l=this._state;a.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),a.perObjectInstancePositioningMatrices.push(o||Ua),a.perObjectSolid.push(!!e.solid),s?a.perObjectColors.push([255*s[0],255*s[1],255*s[2],255]):i&&a.perObjectColors.push([i[0],i[1],i[2],r]),a.perObjectPickColors.push(n),a.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?l.numIndices8Bits:t.numVertices<=65536?l.numIndices16Bits:l.numIndices32Bits,a.perObjectIndexBaseOffsets.push(e/2-t.indicesBase)}const A=this._subPortions.length;if(t.numLines>0){let e,i=2*t.numLines;t.numVertices<=256?(e=a.perLineNumberPortionId8Bits,l.numIndices8Bits+=i,Fa.totalLines8Bits+=t.numLines):t.numVertices<=65536?(e=a.perLineNumberPortionId16Bits,l.numIndices16Bits+=i,Fa.totalLines16Bits+=t.numLines):(e=a.perLineNumberPortionId32Bits,l.numIndices32Bits+=i,Fa.totalLines32Bits+=t.numLines),Fa.totalLines+=t.numLines;for(let i=0;i0&&(t.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Ta))}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),c.bindTexture(c.TEXTURE_2D,h.texturePerObjectColorsAndFlags._texture),c.texSubImage2D(c.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,c.RGBA_INTEGER,c.UNSIGNED_BYTE,Ta))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,Ta))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,Ra))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Sa))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){}drawSilhouetteHighlighted(e,t){}drawSilhouetteSelected(e,t){}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){}drawShadow(e,t){}setPickMatrices(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawSnapInit(e,t){}drawSnap(e,t){}drawPickNormals(e,t){}destroy(){if(this._destroyed)return;const e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}const Oa=c.vec3(),Na=c.vec3(),Qa=c.vec3();c.vec3();const Va=c.vec4(),Ha=c.mat4();class ja{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Oa;if(g){const t=c.transformPoint3(u,A,Na);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,Ha),f=Qa,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new Te(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];const r=i.lights;let o;for(let e=0,t=r.length;e0;let r;const o=[];o.push("#version 300 es"),o.push("// TrianglesDataTextureColorRenderer vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("uniform mat4 sceneModelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),o.push("uniform highp sampler2D uTexturePerObjectMatrix;"),o.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),o.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),o.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),o.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),o.push("uniform vec3 uCameraEyeRtc;"),o.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("out float isPerspective;")),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e> 3) & 4095;"),o.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),o.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),o.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),o.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),o.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),o.push("if (int(flags.x) != renderPass) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("} else {"),o.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),o.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),o.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),o.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),o.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),o.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),o.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),o.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),o.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),o.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),o.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),o.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),o.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),o.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),o.push("if (color.a == 0u) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("};"),o.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),o.push("vec3 position;"),o.push("position = positions[gl_VertexID % 3];"),o.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),o.push("if (solid != 1u) {"),o.push("if (isPerspectiveMatrix(projMatrix)) {"),o.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),o.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("} else {"),o.push("if (viewNormal.z < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("}"),o.push("}"),o.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ga=new Float32Array([1,1,1]),za=c.vec3(),Wa=c.vec3(),Ka=c.vec3();c.vec3();const Xa=c.mat4();class Ja{constructor(e,t){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=za;if(A){const t=Wa;c.transformPoint3(u,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,Xa),g=Ka,g[0]=r.eye[0]-e[0],g[1]=r.eye[1]-e[1],g[2]=r.eye[2]-e[2]}else f=p,g=r.eye;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===Vs.SILHOUETTE_XRAYED){const e=s.xrayMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.SILHOUETTE_HIGHLIGHTED){const e=s.highlightMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.SILHOUETTE_SELECTED){const e=s.selectedMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,Ga);if(s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=s._sectionPlanesState.getNumAllocatedSectionPlanes(),_=s._sectionPlanesState.sectionPlanes.length;if(m>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,r=o.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ya=new Float32Array([0,0,0,1]),Za=c.vec3(),qa=c.vec3();c.vec3();const $a=c.mat4();class el{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Za;if(g){const t=c.transformPoint3(u,A,qa);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,$a)}else f=p;if(n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),i===Vs.EDGES_XRAYED){const e=r.xrayMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.EDGES_HIGHLIGHTED){const e=r.highlightMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.EDGES_SELECTED){const e=r.selectedMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,Ya);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const tl=c.vec3(),il=c.vec3(),sl=c.mat4();class rl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=tl;if(g){const t=c.transformPoint3(u,A,il);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,sl)}else f=p;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ol=c.vec3(),nl=c.vec3(),al=c.vec3(),ll=c.mat4();class Al{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s;let p,f;l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=ol;if(g){const t=c.transformPoint3(u,A,nl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(o.viewMatrix,e,ll),f=al,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=o.viewMatrix,f=o.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),r.logarithmicDepthBufferEnabled){const e=2/(Math.log(o.project.far+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,e)}const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const hl=c.vec3(),cl=c.vec3(),ul=c.vec3();c.vec3();const dl=c.mat4();class pl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=e.pickViewMatrix||o.viewMatrix;let f,g;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const t=hl;if(A){const e=cl;c.transformPoint3(u,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],f=j(p,t,dl),g=ul,g[0]=o.eye[0]-t[0],g[1]=o.eye[1]-t[1],g[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else f=p,g=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniform1f(this._uPickZNear,e.pickZNear),n.uniform1f(this._uPickZFar,e.pickZFar),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),r.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const fl=c.vec3(),gl=c.vec3(),ml=c.vec3(),_l=c.vec3();c.vec3();const vl=c.mat4();class bl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=fl;let m,_;g[0]=c.safeInv(p[3]-p[0])*c.MAX_INT,g[1]=c.safeInv(p[4]-p[1])*c.MAX_INT,g[2]=c.safeInv(p[5]-p[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(g[0]),e.snapPickCoordinateScale[1]=c.safeInv(g[1]),e.snapPickCoordinateScale[2]=c.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=gl;if(v){const e=c.transformPoint3(u,A,ml);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=j(f,t,vl),_=_l,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(x,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(x,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(x,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const yl=c.vec3(),Bl=c.vec3(),xl=c.vec3(),wl=c.vec3();c.vec3();const Pl=c.mat4();class Cl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=yl;let m,_;g[0]=c.safeInv(p[3]-p[0])*c.MAX_INT,g[1]=c.safeInv(p[4]-p[1])*c.MAX_INT,g[2]=c.safeInv(p[5]-p[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(g[0]),e.snapPickCoordinateScale[1]=c.safeInv(g[1]),e.snapPickCoordinateScale[2]=c.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=Bl;if(v){const e=xl;c.transformPoint3(u,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=j(f,t,Pl),_=wl,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this._uVectorA,e.snapVectorA),n.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ml=c.vec3(),Fl=c.vec3(),El=c.vec3();c.vec3();const Il=c.mat4();class Dl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=e.pickViewMatrix||o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=Ml;if(A){const t=Fl;c.transformPoint3(u,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,Il),g=El,g[0]=o.eye[0]-e[0],g[1]=o.eye[1]-e[1],g[2]=o.eye[2]-e[2]}else f=p,g=o.eye;n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Sl=c.vec3(),Tl=c.vec3(),Rl=c.vec3();c.vec3();const Ll=c.mat4();class Ul{constructor(e){this._scene=e,this._allocate(),this._hash=this._getHash()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Sl;if(g){const t=c.transformPoint3(u,A,Tl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,Ll),f=Rl,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const kl=c.vec3(),Ol=c.vec3(),Nl=c.vec3();c.vec3();const Ql=c.mat4();class Vl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));const g=0!==l[0]||0!==l[1]||0!==l[2],m=0!==A[0]||0!==A[1]||0!==A[2];if(g||m){const e=kl;if(g){const t=Ol;c.transformPoint3(h,l,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=A[0],e[1]+=A[1],e[2]+=A[2],p=j(d,e,Ql),f=Nl,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=d,f=o.eye;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,o.viewNormalMatrix),n.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(we.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Hl=c.vec3(),jl=c.vec3(),Gl=c.vec3();c.vec3(),c.vec4();const zl=c.mat4();class Wl{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Hl;if(g){const t=c.transformPoint3(u,A,jl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,zl),f=Gl,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Kl{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Ja(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Al(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new pl(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new Wl(this._scene)),this._snapRenderer||(this._snapRenderer=new bl(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Cl(this._scene)),this._snapRenderer||(this._snapRenderer=new bl(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new ja(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new ja(this._scene,!0)),this._colorRendererWithSAO}get colorQualityRendererWithSAO(){return this._colorQualityRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ja(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Ul(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Vl(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new el(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new rl(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Al(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Wl(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Wl(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new pl(this._scene)),this._pickDepthRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new bl(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Cl(this._scene)),this._snapInitRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Dl(this._scene)),this._occlusionRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}const Xl={};class Jl{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]}}class Yl{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindTriangleIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}bindEdgeIndicesTextures(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}const Zl={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Zl,null,4));let e=0;Object.keys(Zl).forEach((t=>{t.startsWith("size")&&(e+=Zl[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Zl.totalPolygons).toFixed(2)}`);let t={};Object.keys(Zl).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Zl[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class ql{constructor(){}disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}createTextureForColorsAndFlags(e,t,i,s,r,o,n){const a=t.length;this.numPortions=a;const l=4096,A=Math.ceil(a/512);if(0===A)throw"texture height===0";const h=new Uint8Array(16384*A);Zl.sizeDataColorsAndFlags+=h.byteLength,Zl.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),h.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20),h.set([o[e]>>24&255,o[e]>>16&255,o[e]>>8&255,255&o[e]],32*e+24),h.set([n[e]?1:0,0,0,0],32*e+28);const c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,A),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,A,e.RGBA_INTEGER,e.UNSIGNED_BYTE,h,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,c,l,A,h)}createTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Zl.sizeDataTextureOffsets+=r.byteLength,Zl.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,o,i,s,r)}createTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Zl.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Xl[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new Jl,this._dtxState=new Yl,this._dtxTextureFactory=new ql,this._state=new et({origin:c.vec3(t.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Zl.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/3})),(this._state.numVertices+s>4096*eA||t+r>4096*eA)&&Zl.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*eA&&t+r<=4096*eA}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/3/8)*3;Zl.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}if(t.edgeIndices){const e=8*Math.ceil(t.edgeIndices.length/2/8)*2;Zl.overheadSizeAlignementEdgeIndices+=2*(e-t.edgeIndices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.edgeIndices),t.edgeIndices=i}const i=t.positionsCompressed,s=t.indices,r=t.edgeIndices,o=this._buffer;o.positionsCompressed.push(i);const n=o.lenPositionsCompressed/3,a=i.length/3;let l;o.lenPositionsCompressed+=i.length;let A,h=0;if(s){let e;h=s.length/3,a<=256?(e=o.indices8Bits,l=o.lenIndices8Bits/3,o.lenIndices8Bits+=s.length):a<=65536?(e=o.indices16Bits,l=o.lenIndices16Bits/3,o.lenIndices16Bits+=s.length):(e=o.indices32Bits,l=o.lenIndices32Bits/3,o.lenIndices32Bits+=s.length),e.push(s)}let c=0;if(r){let e;c=r.length/2,a<=256?(e=o.edgeIndices8Bits,A=o.lenEdgeIndices8Bits/2,o.lenEdgeIndices8Bits+=r.length):a<=65536?(e=o.edgeIndices16Bits,A=o.lenEdgeIndices16Bits/2,o.lenEdgeIndices16Bits+=r.length):(e=o.edgeIndices32Bits,A=o.lenEdgeIndices32Bits/2,o.lenEdgeIndices32Bits+=r.length),e.push(r)}this._state.numVertices+=a,Zl.numberOfGeometries++;return{vertexBase:n,numVertices:a,numTriangles:h,numEdges:c,indicesBase:l,edgeIndicesBase:A}}_createSubPortion(e,t,i,s){const r=e.color;e.metallic,e.roughness;const o=e.colors,n=e.opacity,a=e.meshMatrix,l=e.pickColor,A=this._buffer,h=this._state;A.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),A.perObjectInstancePositioningMatrices.push(a||oA),A.perObjectSolid.push(!!e.solid),o?A.perObjectColors.push([255*o[0],255*o[1],255*o[2],255]):r&&A.perObjectColors.push([r[0],r[1],r[2],n]),A.perObjectPickColors.push(l),A.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,A.perObjectIndexBaseOffsets.push(e/3-t.indicesBase)}{let e;e=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,A.perObjectEdgeIndexBaseOffsets.push(e/2-t.edgeIndicesBase)}const c=this._subPortions.length;if(t.numTriangles>0){let e,i=3*t.numTriangles;t.numVertices<=256?(e=A.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=i,Zl.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(e=A.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=i,Zl.totalPolygons16Bits+=t.numTriangles):(e=A.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=i,Zl.totalPolygons32Bits+=t.numTriangles),Zl.totalPolygons+=t.numTriangles;for(let i=0;i0){let e,i=2*t.numEdges;t.numVertices<=256?(e=A.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=i,Zl.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(e=A.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=i,Zl.totalEdges16Bits+=t.numEdges):(e=A.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=i,Zl.totalEdges32Bits+=t.numEdges),Zl.totalEdges+=t.numEdges;for(let i=0;i0&&(t.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId8Bits)),s.perEdgeNumberPortionId16Bits.length>0&&(t.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId16Bits)),s.perEdgeNumberPortionId32Bits.length>0&&(t.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId32Bits)),s.lenIndices8Bits>0&&(t.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),s.lenEdgeIndices8Bits>0&&(t.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(i,s.edgeIndices8Bits,s.lenEdgeIndices8Bits)),s.lenEdgeIndices16Bits>0&&(t.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(i,s.edgeIndices16Bits,s.lenEdgeIndices16Bits)),s.lenEdgeIndices32Bits>0&&(t.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(i,s.edgeIndices32Bits,s.lenEdgeIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}isEmpty(){return 0===this._numPortions}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,iA)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),g.bindTexture(g.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),g.texSubImage2D(g.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,g.RGBA_INTEGER,g.UNSIGNED_BYTE,iA))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,iA))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,sA))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,tA))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,Vs.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}_updateBackfaceCull(e,t){const i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){const e=t.gl;i?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),t.backfaces=i}}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT))}drawDepth(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED))}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED))}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED))}drawEdgesColorOpaque(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,Vs.EDGES_COLOR_OPAQUE)}drawEdgesColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,Vs.EDGES_COLOR_TRANSPARENT)}drawEdgesHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_HIGHLIGHTED)}drawEdgesSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_SELECTED)}drawEdgesXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_XRAYED)}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawShadow(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}setPickMatrices(e,t){}drawPickMesh(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,Vs.PICK))}drawPickDepths(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,Vs.PICK))}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK))}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK))}drawPickNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,Vs.PICK))}destroy(){if(this._destroyed)return;const e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}class aA{constructor(e){this.id=e.id,this.colorTexture=e.colorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalsTexture=e.normalsTexture,this.emissiveTexture=e.emissiveTexture,this.occlusionTexture=e.occlusionTexture}destroy(){}}class lA{constructor(e){this.id=e.id,this.texture=e.texture}destroy(){this.texture&&(this.texture.destroy(),this.texture=null)}}const AA={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class hA{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(e){void 0!==this.onError&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==dA[e])return void dA[e].push({onLoad:t,onProgress:i,onError:s});dA[e]=[],dA[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),n=this.mimeType,a=this.responseType;fetch(o).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const i=dA[e],s=t.body.getReader(),r=t.headers.get("Content-Length"),o=r?parseInt(r):0,n=0!==o;let a=0;const l=new ReadableStream({start(e){!function t(){s.read().then((({done:s,value:r})=>{if(s)e.close();else{a+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:n,loaded:a,total:o});for(let e=0,t=i.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,n)));case"json":return e.json();default:if(void 0===n)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(n),i=t&&t[1]?t[1].toLowerCase():void 0,s=new TextDecoder(i);return e.arrayBuffer().then((e=>s.decode(e)))}}})).then((t=>{AA.add(e,t);const i=dA[e];delete dA[e];for(let e=0,s=i.length;e{const i=dA[e];if(void 0===i)throw this.manager.itemError(e),t;delete dA[e];for(let e=0,s=i.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class fA{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}let gA=0;class mA{constructor({viewer:e,transcoderPath:t,workerLimit:i}){this._transcoderPath=t||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/",this._transcoderBinary=null,this._transcoderPending=null,this._workerPool=new fA,this._workerSourceURL="",i&&this._workerPool.setWorkerLimit(i);const s=e.capabilities;this._workerConfig={astcSupported:s.astcSupported,etc1Supported:s.etc1Supported,etc2Supported:s.etc2Supported,dxtSupported:s.dxtSupported,bptcSupported:s.bptcSupported,pvrtcSupported:s.pvrtcSupported},this._supportedFileTypes=["xkt2"]}_init(){if(!this._transcoderPending){const e=new pA;e.setPath(this._transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new pA;i.setPath(this._transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=i.loadAsync("basis_transcoder.wasm");this._transcoderPending=Promise.all([t,s]).then((([e,t])=>{const i=mA.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(mA.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(mA.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(mA.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this._workerSourceURL=URL.createObjectURL(new Blob([s])),this._transcoderBinary=t,this._workerPool.setWorkerCreator((()=>{const e=new Worker(this._workerSourceURL),t=this._transcoderBinary.slice(0);return e.postMessage({type:"init",config:this._workerConfig,transcoderBinary:t},[t]),e}))})),gA>0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),gA++}return this._transcoderPending}transcode(e,t,i={}){return new Promise(((s,r)=>{const o=i;this._init().then((()=>this._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e))).then((e=>{const i=e.data,{mipmaps:o,width:n,height:a,format:l,type:A,error:h,dfdTransferFn:c,dfdFlags:u}=i;if("error"===A)return r(h);t.setCompressedData({mipmaps:o,props:{format:l,minFilter:1===o.length?1006:1008,magFilter:1===o.length?1006:1008,encoding:2===c?3001:3e3,premultiplyAlpha:!!(1&u)}}),s()}))}))}destroy(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),gA--}}mA.BasisFormat={ETC1S:0,UASTC_4x4:1},mA.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},mA.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},mA.BasisWorker=function(){let e,t,i;const s=_EngineFormat,r=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(n){const h=n.data;switch(h.type){case"init":e=h.config,c=h.transcoderBinary,t=new Promise((e=>{i={wasmBinary:c,onRuntimeInitialized:e},BASIS(i)})).then((()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{width:t,height:n,hasAlpha:c,mipmaps:u,format:d,dfdTransferFn:p,dfdFlags:f}=function(t){const n=new i.KTX2File(new Uint8Array(t));function h(){n.close(),n.delete()}if(!n.isValid())throw h(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");const c=n.isUASTC()?o.UASTC_4x4:o.ETC1S,u=n.getWidth(),d=n.getHeight(),p=n.getLevels(),f=n.getHasAlpha(),g=n.getDFDTransferFunc(),m=n.getDFDFlags(),{transcoderFormat:_,engineFormat:v}=function(t,i,n,h){let c,u;const d=t===o.ETC1S?a:l;for(let s=0;s{delete _A[t],i.destroy()}))),i} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{constructor(e,t){this.items=e||[],this._lastUniqueId=(t||0)+1}addItem(){let e;if(2===arguments.length){const t=arguments[0];if(e=arguments[1],this.items[t])throw"ID clash: '"+t+"'";return this.items[t]=e,t}for(e=arguments[0]||{};;){const t=this._lastUniqueId++;if(!this.items[t])return this.items[t]=e,t}}removeItem(e){const t=this.items[e];return delete this.items[e],t}}const t=new e;class i{constructor(e){this.id=e,this.parentItem=null,this.groups=[],this.menuElement=null,this.shown=!1,this.mouseOver=0}}class s{constructor(){this.items=[]}}class r{constructor(e,t,i,s,r){this.id=e,this.getTitle=t,this.doAction=i,this.getEnabled=s,this.getShown=r,this.itemElement=null,this.subMenu=null,this.enabled=!0}}let o=!0,n=o?Float64Array:Float32Array;const a=new n(3),l=new n(16),A=new n(16),h=new n(4),c={setDoublePrecisionEnabled(e){o=e,n=o?Float64Array:Float32Array},getDoublePrecisionEnabled:()=>o,MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId(e,t){const i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:(e,t)=>e+"#"+t,safeInv(e){const t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:e=>new n(e||2),vec3:e=>new n(e||3),vec4:e=>new n(e||4),mat3:e=>new n(e||9),mat3ToMat4:(e,t=new n(16))=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t),mat4:e=>new n(e||16),mat4ToMat3(e,t){},doublesToFloats(e,t,i){const s=new n(2);for(let r=0,o=e.length;r{const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return()=>{const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return`${e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]}-${e[255&i]}${e[i>>8&255]}-${e[i>>16&15|64]}${e[i>>24&255]}-${e[63&s|128]}${e[s>>8&255]}-${e[s>>16&255]}${e[s>>24&255]}${e[255&r]}${e[r>>8&255]}${e[r>>16&255]}${e[r>>24&255]}`}})(),clamp:(e,t,i)=>Math.max(t,Math.min(i,e)),fmod(e,t){if(ee[0]===t[0]&&e[1]===t[1]&&e[2]===t[2],negateVec3:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t),negateVec4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t),addVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i),addVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i),addVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i),addVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i),subVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i),subVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i),subVec2:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i),geometricMeanVec2(...e){const t=new n(e[0]);for(let i=1;i(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i),subScalarVec4:(e,t,i)=>(i||(i=e),i[0]=t-e[0],i[1]=t-e[1],i[2]=t-e[2],i[3]=t-e[3],i),mulVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3],i),mulVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i),mulVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i),mulVec2Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i),divVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i),divVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i[3]=e[3]/t[3],i),divScalarVec3:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i),divVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i),divVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i[3]=e[3]/t,i),divScalarVec4:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i[3]=e/t[3],i),dotVec4:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],cross3Vec4(e,t){const i=e[0],s=e[1],r=e[2],o=t[0],n=t[1],a=t[2];return[s*a-r*n,r*o-i*a,i*n-s*o,0]},cross3Vec3(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return i[0]=r*l-o*a,i[1]=o*n-s*l,i[2]=s*a-r*n,i},sqLenVec4:e=>c.dotVec4(e,e),lenVec4:e=>Math.sqrt(c.sqLenVec4(e)),dotVec3:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],dotVec2:(e,t)=>e[0]*t[0]+e[1]*t[1],sqLenVec3:e=>c.dotVec3(e,e),sqLenVec2:e=>c.dotVec2(e,e),lenVec3:e=>Math.sqrt(c.sqLenVec3(e)),distVec3:(()=>{const e=new n(3);return(t,i)=>c.lenVec3(c.subVec3(t,i,e))})(),lenVec2:e=>Math.sqrt(c.sqLenVec2(e)),distVec2:(()=>{const e=new n(2);return(t,i)=>c.lenVec2(c.subVec2(t,i,e))})(),rcpVec3:(e,t)=>c.divScalarVec3(1,e,t),normalizeVec4(e,t){const i=1/c.lenVec4(e);return c.mulVec4Scalar(e,i,t)},normalizeVec3(e,t){const i=1/c.lenVec3(e);return c.mulVec3Scalar(e,i,t)},normalizeVec2(e,t){const i=1/c.lenVec2(e);return c.mulVec2Scalar(e,i,t)},angleVec3(e,t){let i=c.dotVec3(e,t)/Math.sqrt(c.sqLenVec3(e)*c.sqLenVec3(t));return i=i<-1?-1:i>1?1:i,Math.acos(i)},vec3FromMat4Scale:(()=>{const e=new n(3);return(t,i)=>(e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=c.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=c.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=c.lenVec3(e),i)})(),vecToArray:(()=>{function e(e){return Math.round(1e5*e)/1e5}return t=>{for(let i=0,s=(t=Array.prototype.slice.call(t)).length;i({x:e[0],y:e[1],z:e[2]}),xyzObjectToArray:(e,t)=>((t=t||c.vec3())[0]=e.x,t[1]=e.y,t[2]=e.z,t),dupMat4:e=>e.slice(0,16),mat4To3:e=>[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]],m4s:e=>[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],setMat4ToZeroes:()=>c.m4s(0),setMat4ToOnes:()=>c.m4s(1),diagonalMat4v:e=>new n([e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,0,0,0,e[3]]),diagonalMat4c:(e,t,i,s)=>c.diagonalMat4v([e,t,i,s]),diagonalMat4s:e=>c.diagonalMat4c(e,e,e,e),identityMat4:(e=new n(16))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e),identityMat3:(e=new n(9))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e),isIdentityMat4:e=>1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15],negateMat4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t),addMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i),addMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i),addScalarMat4:(e,t,i)=>c.addMat4Scalar(t,e,i),subMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i),subMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i),subScalarMat4:(e,t,i)=>(i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i),mulMat4(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=e[3],a=e[4],l=e[5],A=e[6],h=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],_=e[15],v=t[0],b=t[1],y=t[2],B=t[3],x=t[4],w=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],I=t[11],D=t[12],S=t[13],T=t[14],R=t[15];return i[0]=v*s+b*a+y*c+B*f,i[1]=v*r+b*l+y*u+B*g,i[2]=v*o+b*A+y*d+B*m,i[3]=v*n+b*h+y*p+B*_,i[4]=x*s+w*a+P*c+C*f,i[5]=x*r+w*l+P*u+C*g,i[6]=x*o+w*A+P*d+C*m,i[7]=x*n+w*h+P*p+C*_,i[8]=M*s+F*a+E*c+I*f,i[9]=M*r+F*l+E*u+I*g,i[10]=M*o+F*A+E*d+I*m,i[11]=M*n+F*h+E*p+I*_,i[12]=D*s+S*a+T*c+R*f,i[13]=D*r+S*l+T*u+R*g,i[14]=D*o+S*A+T*d+R*m,i[15]=D*n+S*h+T*p+R*_,i},mulMat3(e,t,i){i||(i=new n(9));const s=e[0],r=e[3],o=e[6],a=e[1],l=e[4],A=e[7],h=e[2],c=e[5],u=e[8],d=t[0],p=t[3],f=t[6],g=t[1],m=t[4],_=t[7],v=t[2],b=t[5],y=t[8];return i[0]=s*d+r*g+o*v,i[3]=s*p+r*m+o*b,i[6]=s*f+r*_+o*y,i[1]=a*d+l*g+A*v,i[4]=a*p+l*m+A*b,i[7]=a*f+l*_+A*y,i[2]=h*d+c*g+u*v,i[5]=h*p+c*m+u*b,i[8]=h*f+c*_+u*y,i},mulMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i),mulMat4v4(e,t,i=c.vec4()){const s=t[0],r=t[1],o=t[2],n=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12]*n,i[1]=e[1]*s+e[5]*r+e[9]*o+e[13]*n,i[2]=e[2]*s+e[6]*r+e[10]*o+e[14]*n,i[3]=e[3]*s+e[7]*r+e[11]*o+e[15]*n,i},transposeMat4(e,t){const i=e[4],s=e[14],r=e[8],o=e[13],n=e[12],a=e[9];if(!t||e===t){const t=e[1],l=e[2],A=e[3],h=e[6],c=e[7],u=e[11];return e[1]=i,e[2]=r,e[3]=n,e[4]=t,e[6]=a,e[7]=o,e[8]=l,e[9]=h,e[11]=s,e[12]=A,e[13]=c,e[14]=u,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=n,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=o,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3(e,t){if(t===e){const i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4(e){const t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],n=e[5],a=e[6],l=e[7],A=e[8],h=e[9],c=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15];return d*h*a*r-A*p*a*r-d*n*c*r+o*p*c*r+A*n*f*r-o*h*f*r-d*h*s*l+A*p*s*l+d*i*c*l-t*p*c*l-A*i*f*l+t*h*f*l+d*n*s*u-o*p*s*u-d*i*a*u+t*p*a*u+o*i*f*u-t*n*f*u-A*n*s*g+o*h*s*g+A*i*a*g-t*h*a*g-o*i*c*g+t*n*c*g},inverseMat4(e,t){t||(t=e);const i=e[0],s=e[1],r=e[2],o=e[3],n=e[4],a=e[5],l=e[6],A=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],_=i*a-s*n,v=i*l-r*n,b=i*A-o*n,y=s*l-r*a,B=s*A-o*a,x=r*A-o*l,w=h*f-c*p,P=h*g-u*p,C=h*m-d*p,M=c*g-u*f,F=c*m-d*f,E=u*m-d*g,I=1/(_*E-v*F+b*M+y*C-B*P+x*w);return t[0]=(a*E-l*F+A*M)*I,t[1]=(-s*E+r*F-o*M)*I,t[2]=(f*x-g*B+m*y)*I,t[3]=(-c*x+u*B-d*y)*I,t[4]=(-n*E+l*C-A*P)*I,t[5]=(i*E-r*C+o*P)*I,t[6]=(-p*x+g*b-m*v)*I,t[7]=(h*x-u*b+d*v)*I,t[8]=(n*F-a*C+A*w)*I,t[9]=(-i*F+s*C-o*w)*I,t[10]=(p*B-f*b+m*_)*I,t[11]=(-h*B+c*b-d*_)*I,t[12]=(-n*M+a*P-l*w)*I,t[13]=(i*M-s*P+r*w)*I,t[14]=(-p*y+f*v-g*_)*I,t[15]=(h*y-c*v+u*_)*I,t},traceMat4:e=>e[0]+e[5]+e[10]+e[15],translationMat4v(e,t){const i=t||c.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v(e,t){const i=t||c.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(()=>{const e=new n(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,c.translationMat4v(e,r))})(),translationMat4s:(e,t)=>c.translationMat4c(e,e,e,t),translateMat4v:(e,t)=>c.translateMat4c(e[0],e[1],e[2],t),translateMat4c(e,t,i,s){const r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;const o=s[7];s[4]+=o*e,s[5]+=o*t,s[6]+=o*i;const n=s[11];s[8]+=n*e,s[9]+=n*t,s[10]+=n*i;const a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:(e,t,i)=>(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i),rotationMat4v(e,t,i){const s=c.normalizeVec4([t[0],t[1],t[2],0],[]),r=Math.sin(e),o=Math.cos(e),n=1-o,a=s[0],l=s[1],A=s[2];let h,u,d,p,f,g;return h=a*l,u=l*A,d=A*a,p=a*r,f=l*r,g=A*r,(i=i||c.mat4())[0]=n*a*a+o,i[1]=n*h+g,i[2]=n*d-f,i[3]=0,i[4]=n*h-g,i[5]=n*l*l+o,i[6]=n*u+p,i[7]=0,i[8]=n*d+f,i[9]=n*u-p,i[10]=n*A*A+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:(e,t,i,s,r)=>c.rotationMat4v(e,[t,i,s],r),scalingMat4v:(e,t=c.identityMat4())=>(t[0]=e[0],t[5]=e[1],t[10]=e[2],t),scalingMat3v:(e,t=c.identityMat3())=>(t[0]=e[0],t[4]=e[1],t),scalingMat4c:(()=>{const e=new n(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,c.scalingMat4v(e,r))})(),scaleMat4c:(e,t,i,s)=>(s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s),scaleMat4v(e,t){const i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:e=>c.scalingMat4c(e,e,e),rotationTranslationMat4(e,t,i=c.mat4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=s+s,l=r+r,A=o+o,h=s*a,u=s*l,d=s*A,p=r*l,f=r*A,g=o*A,m=n*a,_=n*l,v=n*A;return i[0]=1-(p+g),i[1]=u+v,i[2]=d-_,i[3]=0,i[4]=u-v,i[5]=1-(h+g),i[6]=f+m,i[7]=0,i[8]=d+_,i[9]=f-m,i[10]=1-(h+p),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler(e,t,i=c.vec4()){const s=c.clamp,r=e[0],o=e[4],n=e[8],a=e[1],l=e[5],A=e[9],h=e[2],u=e[6],d=e[10];return"XYZ"===t?(i[1]=Math.asin(s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(-A,d),i[2]=Math.atan2(-o,r)):(i[0]=Math.atan2(u,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[1]=Math.atan2(n,d),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-h,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(u,-1,1)),Math.abs(u)<.99999?(i[1]=Math.atan2(-h,d),i[2]=Math.atan2(-o,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(h,-1,1)),Math.abs(h)<.99999?(i[0]=Math.atan2(u,d),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-o,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-A,l),i[1]=Math.atan2(-h,r)):(i[0]=0,i[1]=Math.atan2(n,d))):"XZY"===t&&(i[2]=Math.asin(-s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(u,l),i[1]=Math.atan2(n,r)):(i[0]=Math.atan2(-A,d),i[1]=0)),i},composeMat4:(e,t,i,s=c.mat4())=>(c.quaternionToRotationMat4(t,s),c.scaleMat4v(i,s),c.translateMat4v(e,s),s),decomposeMat4:(()=>{const e=new n(3),t=new n(16);return function(i,s,r,o){e[0]=i[0],e[1]=i[1],e[2]=i[2];let n=c.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];const a=c.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];const l=c.lenVec3(e);c.determinantMat4(i)<0&&(n=-n),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);const A=1/n,h=1/a,u=1/l;return t[0]*=A,t[1]*=A,t[2]*=A,t[4]*=h,t[5]*=h,t[6]*=h,t[8]*=u,t[9]*=u,t[10]*=u,c.mat4ToQuaternion(t,r),o[0]=n,o[1]=a,o[2]=l,this}})(),getColMat4(e,t){const i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v(e,t,i,s){s||(s=c.mat4());const r=e[0],o=e[1],n=e[2],a=i[0],l=i[1],A=i[2],h=t[0],u=t[1],d=t[2];if(r===h&&o===u&&n===d)return c.identityMat4();let p,f,g,m,_,v,b,y,B,x;return p=r-h,f=o-u,g=n-d,x=1/Math.sqrt(p*p+f*f+g*g),p*=x,f*=x,g*=x,m=l*g-A*f,_=A*p-a*g,v=a*f-l*p,x=Math.sqrt(m*m+_*_+v*v),x?(x=1/x,m*=x,_*=x,v*=x):(m=0,_=0,v=0),b=f*v-g*_,y=g*m-p*v,B=p*_-f*m,x=Math.sqrt(b*b+y*y+B*B),x?(x=1/x,b*=x,y*=x,B*=x):(b=0,y=0,B=0),s[0]=m,s[1]=b,s[2]=p,s[3]=0,s[4]=_,s[5]=y,s[6]=f,s[7]=0,s[8]=v,s[9]=B,s[10]=g,s[11]=0,s[12]=-(m*r+_*o+v*n),s[13]=-(b*r+y*o+B*n),s[14]=-(p*r+f*o+g*n),s[15]=1,s},lookAtMat4c:(e,t,i,s,r,o,n,a,l)=>c.lookAtMat4v([e,t,i],[s,r,o],[n,a,l],[]),orthoMat4c(e,t,i,s,r,o,n){n||(n=c.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2/l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-2/A,n[11]=0,n[12]=-(e+t)/a,n[13]=-(s+i)/l,n[14]=-(o+r)/A,n[15]=1,n},frustumMat4v(e,t,i){i||(i=c.mat4());const s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];c.addVec4(r,s,l),c.subVec4(r,s,A);const o=2*s[2],n=A[0],a=A[1],h=A[2];return i[0]=o/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o/a,i[6]=0,i[7]=0,i[8]=l[0]/n,i[9]=l[1]/a,i[10]=-l[2]/h,i[11]=-1,i[12]=0,i[13]=0,i[14]=-o*r[2]/h,i[15]=0,i},frustumMat4(e,t,i,s,r,o,n){n||(n=c.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2*r/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2*r/l,n[6]=0,n[7]=0,n[8]=(t+e)/a,n[9]=(s+i)/l,n[10]=-(o+r)/A,n[11]=-1,n[12]=0,n[13]=0,n[14]=-o*r*2/A,n[15]=0,n},perspectiveMat4(e,t,i,s,r){const o=[],n=[];return o[2]=i,n[2]=s,n[1]=o[2]*Math.tan(e/2),o[1]=-n[1],n[0]=n[1]*t,o[0]=-n[0],c.frustumMat4v(o,n,r)},compareMat4:(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15],transformPoint3(e,t,i=c.vec3()){const s=t[0],r=t[1],o=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12],i[1]=e[1]*s+e[5]*r+e[9]*o+e[13],i[2]=e[2]*s+e[6]*r+e[10]*o+e[14],i},transformPoint4:(e,t,i=c.vec4())=>(i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i),transformPoints3(e,t,i){const s=i||[],r=t.length;let o,n,a,l;const A=e[0],h=e[1],c=e[2],u=e[3],d=e[4],p=e[5],f=e[6],g=e[7],m=e[8],_=e[9],v=e[10],b=e[11],y=e[12],B=e[13],x=e[14],w=e[15];let P;for(let e=0;e{const e=new n(16),t=new n(16),i=new n(16);return function(s,r,o,n){return this.transformVec3(this.mulMat4(this.inverseMat4(r,e),this.inverseMat4(o,t),i),s,n)}})(),lerpVec3(e,t,i,s,r,o){const n=o||c.vec3(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n},lerpMat4(e,t,i,s,r,o){const n=o||c.mat4(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n[3]=s[3]+a*(r[3]-s[3]),n[4]=s[4]+a*(r[4]-s[4]),n[5]=s[5]+a*(r[5]-s[5]),n[6]=s[6]+a*(r[6]-s[6]),n[7]=s[7]+a*(r[7]-s[7]),n[8]=s[8]+a*(r[8]-s[8]),n[9]=s[9]+a*(r[9]-s[9]),n[10]=s[10]+a*(r[10]-s[10]),n[11]=s[11]+a*(r[11]-s[11]),n[12]=s[12]+a*(r[12]-s[12]),n[13]=s[13]+a*(r[13]-s[13]),n[14]=s[14]+a*(r[14]-s[14]),n[15]=s[15]+a*(r[15]-s[15]),n},flatten(e){const t=[];let i,s,r,o,n;for(i=0,s=e.length;i(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e),eulerToQuaternion(e,t,i=c.vec4()){const s=e[0]*c.DEGTORAD/2,r=e[1]*c.DEGTORAD/2,o=e[2]*c.DEGTORAD/2,n=Math.cos(s),a=Math.cos(r),l=Math.cos(o),A=Math.sin(s),h=Math.sin(r),u=Math.sin(o);return"XYZ"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l-A*h*u):"YXZ"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l+A*h*u):"ZXY"===t?(i[0]=A*a*l-n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l-A*h*u):"ZYX"===t?(i[0]=A*a*l-n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l+A*h*u):"YZX"===t?(i[0]=A*a*l+n*h*u,i[1]=n*h*l+A*a*u,i[2]=n*a*u-A*h*l,i[3]=n*a*l-A*h*u):"XZY"===t&&(i[0]=A*a*l-n*h*u,i[1]=n*h*l-A*a*u,i[2]=n*a*u+A*h*l,i[3]=n*a*l+A*h*u),i},mat4ToQuaternion(e,t=c.vec4()){const i=e[0],s=e[4],r=e[8],o=e[1],n=e[5],a=e[9],l=e[2],A=e[6],h=e[10];let u;const d=i+n+h;return d>0?(u=.5/Math.sqrt(d+1),t[3]=.25/u,t[0]=(A-a)*u,t[1]=(r-l)*u,t[2]=(o-s)*u):i>n&&i>h?(u=2*Math.sqrt(1+i-n-h),t[3]=(A-a)/u,t[0]=.25*u,t[1]=(s+o)/u,t[2]=(r+l)/u):n>h?(u=2*Math.sqrt(1+n-i-h),t[3]=(r-l)/u,t[0]=(s+o)/u,t[1]=.25*u,t[2]=(a+A)/u):(u=2*Math.sqrt(1+h-i-n),t[3]=(o-s)/u,t[0]=(r+l)/u,t[1]=(a+A)/u,t[2]=.25*u),t},vec3PairToQuaternion(e,t,i=c.vec4()){const s=Math.sqrt(c.dotVec3(e,e)*c.dotVec3(t,t));let r=s+c.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):c.cross3Vec3(e,t,i),i[3]=r,c.normalizeQuaternion(i)},angleAxisToQuaternion(e,t=c.vec4()){const i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:(()=>{const e=new n(16);return(t,i,s)=>(s=s||c.vec3(),c.quaternionToRotationMat4(t,e),c.mat4ToEuler(e,i,s),s)})(),mulQuaternions(e,t,i=c.vec4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=t[0],l=t[1],A=t[2],h=t[3];return i[0]=n*a+s*h+r*A-o*l,i[1]=n*l+r*h+o*a-s*A,i[2]=n*A+o*h+s*l-r*a,i[3]=n*h-s*a-r*l-o*A,i},vec3ApplyQuaternion(e,t,i=c.vec3()){const s=t[0],r=t[1],o=t[2],n=e[0],a=e[1],l=e[2],A=e[3],h=A*s+a*o-l*r,u=A*r+l*s-n*o,d=A*o+n*r-a*s,p=-n*s-a*r-l*o;return i[0]=h*A+p*-n+u*-l-d*-a,i[1]=u*A+p*-a+d*-n-h*-l,i[2]=d*A+p*-l+h*-a-u*-n,i},quaternionToMat4(e,t){t=c.identityMat4(t);const i=e[0],s=e[1],r=e[2],o=e[3],n=2*i,a=2*s,l=2*r,A=n*o,h=a*o,u=l*o,d=n*i,p=a*i,f=l*i,g=a*s,m=l*s,_=l*r;return t[0]=1-(g+_),t[1]=p+u,t[2]=f-h,t[4]=p-u,t[5]=1-(d+_),t[6]=m+A,t[8]=f+h,t[9]=m-A,t[10]=1-(d+g),t},quaternionToRotationMat4(e,t){const i=e[0],s=e[1],r=e[2],o=e[3],n=i+i,a=s+s,l=r+r,A=i*n,h=i*a,c=i*l,u=s*a,d=s*l,p=r*l,f=o*n,g=o*a,m=o*l;return t[0]=1-(u+p),t[4]=h-m,t[8]=c+g,t[1]=h+m,t[5]=1-(A+p),t[9]=d-f,t[2]=c-g,t[6]=d+f,t[10]=1-(A+u),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion(e,t=e){const i=c.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:(e,t=e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t),inverseQuaternion:(e,t)=>c.normalizeQuaternion(c.conjugateQuaternion(e,t)),quaternionToAngleAxis(e,t=c.vec4()){const i=(e=c.normalizeQuaternion(e,h))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:e=>new n(e||6),AABB2:e=>new n(e||4),OBB3:e=>new n(e||32),OBB2:e=>new n(e||16),Sphere3:(e,t,i,s)=>new n([e,t,i,s]),transformOBB3(e,t,i=t){let s;const r=t.length;let o,n,a;const l=e[0],A=e[1],h=e[2],c=e[3],u=e[4],d=e[5],p=e[6],f=e[7],g=e[8],m=e[9],_=e[10],v=e[11],b=e[12],y=e[13],B=e[14],x=e[15];for(s=0;s{const e=new n(3),t=new n(3),i=new n(3);return s=>(e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5],c.subVec3(t,e,i),Math.abs(c.lenVec3(i)))})(),getAABB3DiagPoint:(()=>{const e=new n(3),t=new n(3),i=new n(3);return(s,r)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5];const o=c.subVec3(t,e,i),n=r[0]-s[0],a=s[3]-r[0],l=r[1]-s[1],A=s[4]-r[1],h=r[2]-s[2],u=s[5]-r[2];return o[0]+=n>a?n:a,o[1]+=l>A?l:A,o[2]+=h>u?h:u,Math.abs(c.lenVec3(o))}})(),getAABB3Area:e=>(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2]),getAABB3Center(e,t){const i=t||c.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center(e,t){const i=t||c.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:(e=c.AABB3())=>(e[0]=c.MAX_DOUBLE,e[1]=c.MAX_DOUBLE,e[2]=c.MAX_DOUBLE,e[3]=c.MIN_DOUBLE,e[4]=c.MIN_DOUBLE,e[5]=c.MIN_DOUBLE,e),AABB3ToOBB3:(e,t=c.OBB3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t),positions3ToAABB3:(()=>{const e=new n(3);return(t,i,s)=>{i=i||c.AABB3();let r,o,n,a=c.MAX_DOUBLE,l=c.MAX_DOUBLE,A=c.MAX_DOUBLE,h=c.MIN_DOUBLE,u=c.MIN_DOUBLE,d=c.MIN_DOUBLE;for(let i=0,p=t.length;ih&&(h=r),o>u&&(u=o),n>d&&(d=n);return i[0]=a,i[1]=l,i[2]=A,i[3]=h,i[4]=u,i[5]=d,i}})(),OBB3ToAABB3(e,t=c.AABB3()){let i,s,r,o=c.MAX_DOUBLE,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE,h=c.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToAABB3(e,t=c.AABB3()){let i,s,r,o=c.MAX_DOUBLE,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE,h=c.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToSphere3:(()=>{const e=new n(3);return(t,i)=>{i=i||c.vec4();let s,r=0,o=0,n=0;const a=t.length;for(s=0;sA&&(A=l);return i[3]=A,i}})(),positions3ToSphere3:(()=>{const e=new n(3),t=new n(3);return(i,s)=>{s=s||c.vec4();let r,o=0,n=0,a=0;const l=i.length;let A=0;for(r=0;rA&&(A=u);return s[3]=A,s}})(),OBB3ToSphere3:(()=>{const e=new n(3),t=new n(3);return(i,s)=>{s=s||c.vec4();let r,o=0,n=0,a=0;const l=i.length,A=l/4;for(r=0;ru&&(u=h);return s[3]=u,s}})(),getSphere3Center:(e,t=c.vec3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t),getPositionsCenter(e,t=c.vec3()){let i=0,s=0,r=0;for(var o=0,n=e.length;o(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3](e[0]=c.MAX_DOUBLE,e[1]=c.MAX_DOUBLE,e[2]=c.MIN_DOUBLE,e[3]=c.MIN_DOUBLE,e),point3AABB3Intersect:(e,t)=>e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]);if(s<=-t&&r<=-t)return-1;return s>=-t&&r>=-t?1:0},OBB3ToAABB2(e,t=c.AABB2()){let i,s,r,o,n=c.MAX_DOUBLE,a=c.MAX_DOUBLE,l=c.MIN_DOUBLE,A=c.MIN_DOUBLE;for(let t=0,h=e.length;tl&&(l=i),s>A&&(A=s);return t[0]=n,t[1]=a,t[2]=l,t[3]=A,t},expandAABB2:(e,t)=>(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]2*(1-e)*(i-t)+2*e*(s-i),tangentQuadraticBezier3:(e,t,i,s,r)=>-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r,tangentSpline:e=>6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e),catmullRomInterpolate(e,t,i,s,r){const o=.5*(i-e),n=.5*(s-t),a=r*r;return(2*t-2*i+o+n)*(r*a)+(-3*t+3*i-2*o-n)*a+o*r+t},b2p0(e,t){const i=1-e;return i*i*t},b2p1:(e,t)=>2*(1-e)*e*t,b2p2:(e,t)=>e*e*t,b2(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0(e,t){const i=1-e;return i*i*i*t},b3p1(e,t){const i=1-e;return 3*i*i*e*t},b3p2:(e,t)=>3*(1-e)*e*e*t,b3p3:(e,t)=>e*e*e*t,b3(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal(e,t,i,s=c.vec3()){const r=t[0]-e[0],o=t[1]-e[1],n=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],A=i[2]-e[2],h=o*A-n*l,u=n*a-r*A,d=r*l-o*a,p=Math.sqrt(h*h+u*u+d*d);return 0===p?(s[0]=0,s[1]=0,s[2]=0):(s[0]=h/p,s[1]=u/p,s[2]=d/p),s},rayTriangleIntersect:(()=>{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3);return(o,n,a,l,A,h)=>{h=h||c.vec3();const u=c.subVec3(l,a,e),d=c.subVec3(A,a,t),p=c.cross3Vec3(n,d,i),f=c.dotVec3(u,p);if(f<1e-6)return null;const g=c.subVec3(o,a,s),m=c.dotVec3(g,p);if(m<0||m>f)return null;const _=c.cross3Vec3(g,u,r),v=c.dotVec3(n,_);if(v<0||m+v>f)return null;const b=c.dotVec3(d,_)/f;return h[0]=o[0]+b*n[0],h[1]=o[1]+b*n[1],h[2]=o[2]+b*n[2],h}})(),rayPlaneIntersect:(()=>{const e=new n(3),t=new n(3),i=new n(3),s=new n(3);return(r,o,n,a,l,A)=>{A=A||c.vec3(),o=c.normalizeVec3(o,e);const h=c.subVec3(a,n,t),u=c.subVec3(l,n,i),d=c.cross3Vec3(h,u,s);c.normalizeVec3(d,d);const p=-c.dotVec3(n,d),f=-(c.dotVec3(r,d)+p)/c.dotVec3(o,d);return A[0]=r[0]+f*o[0],A[1]=r[1]+f*o[1],A[2]=r[2]+f*o[2],A}})(),cartesianToBarycentric:(()=>{const e=new n(3),t=new n(3),i=new n(3);return(s,r,o,n,a)=>{const l=c.subVec3(n,r,e),A=c.subVec3(o,r,t),h=c.subVec3(s,r,i),u=c.dotVec3(l,l),d=c.dotVec3(l,A),p=c.dotVec3(l,h),f=c.dotVec3(A,A),g=c.dotVec3(A,h),m=u*f-d*d;if(0===m)return null;const _=1/m,v=(f*p-d*g)*_,b=(u*g-d*p)*_;return a[0]=1-v-b,a[1]=b,a[2]=v,a}})(),barycentricInsideTriangle(e){const t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian(e,t,i,s,r=c.vec3()){const o=e[0],n=e[1],a=e[2];return r[0]=t[0]*o+i[0]*n+s[0]*a,r[1]=t[1]*o+i[1]*n+s[1]*a,r[2]=t[2]*o+i[2]*n+s[2]*a,r},mergeVertices(e,t,i,s){const r={},o=[],n=[],a=t?[]:null,l=i?[]:null,A=[];let h,c,u,d;const p=1e4;let f,g,m=0;for(f=0,g=e.length;f{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3),o=new n(3);return(n,a,l)=>{let A,h;const u=new Array(n.length/3);let d,p,f,g,m,_,v;for(A=0,h=a.length;A{const e=new n(3),t=new n(3),i=new n(3),s=new n(3),r=new n(3),o=new n(3),a=new n(3);return(n,l,A)=>{const h=new Float32Array(n.length);for(let u=0;u>24&255,h=u>>16&255,A=u>>8&255,l=255&u,a=t[i],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+1],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+2],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,u++;return{positions:r,colors:o}},faceToVertexNormals(e,t,i={}){const s=i.smoothNormalsAngleThreshold||20,r={},o=[],n={};let a,l,A,h,u;const d=1e4;let p,f,g,m,_,v;for(f=0,m=e.length;f{const e=new n(4),t=new n(4);return(i,s,r,o,n)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=1,c.transformVec4(i,e,t),o[0]=t[0],o[1]=t[1],o[2]=t[2],e[0]=r[0],e[1]=r[1],e[2]=r[2],c.transformVec3(i,e,t),c.normalizeVec3(t),n[0]=t[0],n[1]=t[1],n[2]=t[2]}})(),canvasPosToWorldRay:(()=>{const e=new n(16),t=new n(16),i=new n(4),s=new n(4),r=new n(4),o=new n(4);return(n,a,l,A,h,u)=>{const d=c.mulMat4(l,a,e),p=c.inverseMat4(d,t),f=n.width,g=n.height,m=(A[0]-f/2)/(f/2),_=-(A[1]-g/2)/(g/2);i[0]=m,i[1]=_,i[2]=-1,i[3]=1,c.transformVec4(p,i,s),c.mulVec4Scalar(s,1/s[3]),r[0]=m,r[1]=_,r[2]=1,r[3]=1,c.transformVec4(p,r,o),c.mulVec4Scalar(o,1/o[3]),h[0]=o[0],h[1]=o[1],h[2]=o[2],c.subVec3(o,s,u),c.normalizeVec3(u)}})(),canvasPosToLocalRay:(()=>{const e=new n(3),t=new n(3);return(i,s,r,o,n,a,l)=>{c.canvasPosToWorldRay(i,s,r,n,e,t),c.worldRayToLocalRay(o,e,t,a,l)}})(),worldRayToLocalRay:(()=>{const e=new n(16),t=new n(4),i=new n(4);return(s,r,o,n,a)=>{const l=c.inverseMat4(s,e);t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,c.transformVec4(l,t,i),n[0]=i[0],n[1]=i[1],n[2]=i[2],c.transformVec3(l,o,a)}})(),buildKDTree:(()=>{const e=new Float32Array;function t(i,s,r,o){const a=new n(6),l={triangles:null,left:null,right:null,leaf:!1,splitDim:0,aabb:a};let A,h;for(a[0]=a[1]=a[2]=Number.POSITIVE_INFINITY,a[3]=a[4]=a[5]=Number.NEGATIVE_INFINITY,A=0,h=i.length;Aa[3]&&(a[3]=r[t]),r[t+1]a[4]&&(a[4]=r[t+1]),r[t+2]a[5]&&(a[5]=r[t+2])}}if(i.length<20||o>10)return l.triangles=i,l.leaf=!0,l;e[0]=a[3]-a[0],e[1]=a[4]-a[1],e[2]=a[5]-a[2];let u=0;e[1]>e[u]&&(u=1),e[2]>e[u]&&(u=2),l.splitDim=u;const d=(a[u]+a[u+3])/2,p=new Array(i.length);let f=0;const g=new Array(i.length);let m=0;for(A=0,h=i.length;A{const s=e.length/3,r=new Array(s);for(let e=0;e=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t},octDecodeVec2s(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t}};c.buildEdgeIndices=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}(),c.planeClipsPositions3=function(e,t,i,s=3){for(let r=0,o=i.length;r=this._headLength){const e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}const e=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,e}push(e){return this._length++,this._tail.push(e),this}unshift(e){return this._head[--this._index]=e,this._length++,this}}const p={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var f=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r{};t=t||s,i=i||s;var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.addEventListener("load",(function(e){var s=e.target.response;if(200===this.status){var r;try{r=JSON.parse(s)}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}t(r)}else if(0===this.status){console.warn("loadFile: HTTP Status 0 received.");try{t(JSON.parse(s))}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}}else i(e)}),!1),r.addEventListener("error",(function(e){i(e)}),!1),r.send(null)},loadArraybuffer:function(e,t,i){var s=e=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{t(e)}))}catch(e){M.scheduleTask((()=>{i(e)}))}}else{const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i("loadArrayBuffer error : "+s.response))},s.send(null)}},queryString:m,isArray:function(e){return e&&!e.propertyIsEnumerable("length")&&"object"==typeof e&&"number"==typeof e.length},isString:function(e){return"string"==typeof e||e instanceof String},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isID:function(e){return _.isString(e)||_.isNumeric(e)},isSameComponent:function(e,t){return!(!e||!t)&&(_.isNumeric(e)||_.isString(e)?`${e}`:e.id)===(_.isNumeric(t)||_.isString(t)?`${t}`:t.id)},isFunction:function(e){return"function"==typeof e},isObject:function(e){const t={}.constructor;return!!e&&e.constructor===t},copy:function(e){return _.apply(e,{})},apply:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},apply2:function(e,t){for(const i in e)e.hasOwnProperty(i)&&void 0!==e[i]&&null!==e[i]&&(t[i]=e[i]);return t},applyIf:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(void 0!==t[i]&&null!==t[i]||(t[i]=e[i]));return t},isEmptyObject:function(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},inQuotes:function(e){return _.isNumeric(e)?`${e}`:`'${e}'`},concat:function(e,t){const i=new e.constructor(e.length+t.length);return i.set(e),i.set(t,e.length),i},flattenParentChildHierarchy:function(e){var t=[];return function e(i){i.id=i.uuid,delete i.oid,t.push(i);var s=i.children;if(s)for(var r=0,o=s.length;r{b.removeItem(e.id),delete M.scenes[e.id],delete v[e.id],p.components.scenes--}))},this.clear=function(){let e;for(const t in M.scenes)M.scenes.hasOwnProperty(t)&&(e=M.scenes[t],"default.scene"===t?e.clear():(e.destroy(),delete M.scenes[e.id]))},this.scheduleTask=function(e,t=null){y.push(e),y.push(t)},this.runTasks=function(e=-1){let t,i,s=(new Date).getTime(),r=0;for(;y.length>0&&(e<0||s0&&w>0){var t=1e3/w;C+=t,x.push(t),x.length>=30&&(C-=x.shift()),p.frame.fps=Math.round(C/x.length)}for(let e in M.scenes)M.scenes[e].compile();I(e),P=e};!function(e,t){let i=Date.now()+t;(function s(){const r=Date.now()-i;e(),i+=t,setTimeout(s,Math.max(0,t-r))})()}((()=>{F()}),100);const E=function(){let e=Date.now();if(w=e-P,P>0&&w>0){var t=1e3/w;C+=t,x.push(t),x.length>=30&&(C-=x.shift()),p.frame.fps=Math.round(C/x.length)}I(e),function(e){for(var t in B.time=e,M.scenes)if(M.scenes.hasOwnProperty(t)){var i=M.scenes[t];B.sceneId=t,B.startTime=i.startTime,B.deltaTime=null!=B.prevTime?B.time-B.prevTime:0,i.fire("tick",B,!0)}B.prevTime=e}(e),function(){const e=M.scenes,t=!1;let i,s,r,o,n;for(n in e)e.hasOwnProperty(n)&&(i=e[n],s=v[n],s||(s=v[n]={}),r=i.ticksPerOcclusionTest,s.ticksPerOcclusionTest!==r&&(s.ticksPerOcclusionTest=r,s.renderCountdown=r),--i.occlusionTestCountdown<=0&&(i.doOcclusionTest(),i.occlusionTestCountdown=r),o=i.ticksPerRender,s.ticksPerRender!==o&&(s.ticksPerRender=o,s.renderCountdown=o),0==--s.renderCountdown&&(i.render(t),s.renderCountdown=o))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(F):requestAnimationFrame(E)};function I(e){const t=M.runTasks(e+10),i=M.getNumTasks();p.frame.tasksRun=t,p.frame.tasksScheduled=i,p.frame.tasksBudget=10}E();class D{get type(){return"Component"}get isComponent(){return!0}constructor(e=null,t={}){if(this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=t.viewer;else{if("Scene"===e.type)this.scene=e;else{if(!(e instanceof D))throw"Invalid param: owner must be a Component";this.scene=e.scene}this._owner=e}this._dontClear=!!t.dontClear,this._renderer=this.scene._renderer,this.meta=t.meta||{},this.id=t.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,e&&e._own(this)}glRedraw(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}glResort(){this._renderer&&this._renderer.needStateSort()}get owner(){return this._owner}isType(e){return this.type===e}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}_message(e){return" ["+this.type+" "+_.inQuotes(this.id)+"]: "+e}warn(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}error(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}_attach(e){const t=e.name;if(!t)return void this.error("Component 'name' expected");let i=e.component;const s=e.sceneDefault,r=e.sceneSingleton,o=e.type,n=e.on,a=!1!==e.recompiles;if(i&&(_.isNumeric(i)||_.isString(i))){const e=i;if(i=this.scene.components[e],!i)return void this.error("Component not found: "+_.inQuotes(e))}if(!i)if(!0===r){const e=this.scene.types[o];for(const t in e)if(e.hasOwnProperty){i=e[t];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&(i=this.scene[t],!i))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+_.inQuotes(i.id));if(o&&!i.isType(o))return void this.error("Expected a "+o+" type or subtype: "+i.type+" "+_.inQuotes(i.id))}this._attachments||(this._attachments={});const l=this._attached[t];let A,h,c;if(l){if(i&&l.id===i.id)return;const e=this._attachments[l.id];for(A=e.subs,h=0,c=A.length;h{delete this._ownedComponents[e.id]}),this)}_needUpdate(e){this._updateScheduled||(this._updateScheduled=!0,0===e?this._doUpdate():M.scheduleTask(this._doUpdate,this))}_doUpdate(){this._updateScheduled&&(this._updateScheduled=!1,this._update&&this._update())}scheduleTask(e){M.scheduleTask(e,null)}_update(){}clear(){if(this._ownedComponents)for(var e in this._ownedComponents)if(this._ownedComponents.hasOwnProperty(e)){this._ownedComponents[e].destroy(),delete this._ownedComponents[e]}}destroy(){if(this.destroyed)return;let e,t,i,s,r,o;if(this.fire("destroyed",this.destroyed=!0),this._attachments)for(e in this._attachments)if(this._attachments.hasOwnProperty(e)){for(t=this._attachments[e],i=t.component,s=t.subs,r=0,o=s.length;r=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}class U{constructor(){this.planes=[new L,new L,new L,new L,new L,new L]}}function k(e,t,i){const s=c.mulMat4(i,t,R),r=s[0],o=s[1],n=s[2],a=s[3],l=s[4],A=s[5],h=s[6],u=s[7],d=s[8],p=s[9],f=s[10],g=s[11],m=s[12],_=s[13],v=s[14],b=s[15];e.planes[0].set(a-r,u-l,g-d,b-m),e.planes[1].set(a+r,u+l,g+d,b+m),e.planes[2].set(a-o,u-A,g-p,b-_),e.planes[3].set(a+o,u+A,g+p,b+_),e.planes[4].set(a-n,u-h,g-f,b-v),e.planes[5].set(a+n,u+h,g+f,b+v)}function O(e,t){let i=U.INSIDE;const s=S,r=T;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];const o=[s,r];for(let t=0;t<6;++t){const s=e.planes[t];if(s.normal[0]*o[s.testVertex[0]][0]+s.normal[1]*o[s.testVertex[1]][1]+s.normal[2]*o[s.testVertex[2]][2]+s.offset<0)return U.OUTSIDE;s.normal[0]*o[1-s.testVertex[0]][0]+s.normal[1]*o[1-s.testVertex[1]][1]+s.normal[2]*o[1-s.testVertex[2]][2]+s.offset<0&&(i=U.INTERSECT)}return i}U.INSIDE=0,U.INTERSECT=1,U.OUTSIDE=2;class N extends D{constructor(e={}){if(!e.viewer)throw"[MarqueePicker] Missing config: viewer";if(!e.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";super(e.viewer.scene,e),this.viewer=e.viewer,this._objectsKdTree3=e.objectsKdTree3,this._canvasMarqueeCorner1=c.vec2(),this._canvasMarqueeCorner2=c.vec2(),this._canvasMarquee=c.AABB2(),this._marqueeFrustum=new U,this._marqueeFrustumProjMat=c.mat4(),this._pickMode=!1,this._marqueeElement=document.createElement("div"),document.body.appendChild(this._marqueeElement),this._marqueeElement.style.position="absolute",this._marqueeElement.style["z-index"]="40000005",this._marqueeElement.style.width="8px",this._marqueeElement.style.height="8px",this._marqueeElement.style.visibility="hidden",this._marqueeElement.style.top="0px",this._marqueeElement.style.left="0px",this._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",this._marqueeElement.style.opacity=1,this._marqueeElement.style["pointer-events"]="none"}setMarqueeCorner1(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarqueeCorner2(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarquee(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}setMarqueeVisible(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}getMarqueeVisible(){return this._marqueVisible}setPickMode(e){if(e!==N.PICK_MODE_INSIDE&&e!==N.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===N.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}getPickMode(){return this._pickMode}clear(){this.fire("clear",{})}pick(){this._updateMarquee(),this._buildMarqueeFrustum();const e=[],t=(i,s=U.INTERSECT)=>{if(s===U.INTERSECT&&(s=O(this._marqueeFrustum,i.aabb)),s!==U.OUTSIDE){if(i.entities){const t=i.entities;for(let i=0,s=t.length;i3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&t(this._objectsKdTree3.root),this.fire("picked",e),e}_updateMarquee(){this._canvasMarquee[0]=Math.min(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[1]=Math.min(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._canvasMarquee[2]=Math.max(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[3]=Math.max(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._marqueeElement.style.width=this._canvasMarquee[2]-this._canvasMarquee[0]+"px",this._marqueeElement.style.height=this._canvasMarquee[3]-this._canvasMarquee[1]+"px",this._marqueeElement.style.left=`${this._canvasMarquee[0]}px`,this._marqueeElement.style.top=`${this._canvasMarquee[1]}px`}_buildMarqueeFrustum(){const e=this.viewer.scene.canvas.canvas,t=e.clientWidth,i=e.clientHeight,s=e.clientLeft,r=e.clientTop,o=2/t,n=2/i,a=e.clientHeight/e.clientWidth,l=(this._canvasMarquee[0]-s)*o-1,A=(this._canvasMarquee[2]-s)*o-1,h=-(this._canvasMarquee[3]-r)*n+1,u=-(this._canvasMarquee[1]-r)*n+1,d=this.viewer.scene.camera.frustum.near*(17*a);c.frustumMat4(l,A,h*a,u*a,d,1e4,this._marqueeFrustumProjMat),k(this._marqueeFrustum,this.viewer.scene.camera.viewMatrix,this._marqueeFrustumProjMat)}destroy(){super.destroy(),this._marqueeElement.parentElement&&(this._marqueeElement.parentElement.removeChild(this._marqueeElement),this._marqueeElement=null,this._objectsKdTree3=null)}}N.PICK_MODE_INTERSECTS=0,N.PICK_MODE_INSIDE=1;class Q{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._circleDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._circleDiv,this.viewer.scene.canvas.canvas),this._circleDiv.style.backgroundColor="transparent",this._circleDiv.style.border="2px solid green",this._circleDiv.style.borderRadius="50px",this._circleDiv.style.width="50px",this._circleDiv.style.height="50px",this._circleDiv.style.margin="-200px -200px",this._circleDiv.style.zIndex="100000",this._circleDiv.style.position="absolute",this._circleDiv.style.pointerEvents="none",this._circlePos=null,this._circleMaxRadius=200,this._circleMinRadius=2,this._active=!1!==t.active,this._visible=!1,this._running=!1,this._destroyed=!1}start(e){if(this._destroyed)return;this._circlePos=e,this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius+"px";const t=this._circleMaxRadius;let i;const s=e=>{if(!this._running)return;i||(i=e);const r=e-i,o=Math.min(r/300,1),n=t+(2-t)*o;this._circleRadius=n,this._circleDiv.style.width=`${this._circleRadius}px`,this._circleDiv.style.height=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius/2+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius/2+"px",o<1&&requestAnimationFrame(s)};this._running=!0,requestAnimationFrame(s),this._circleDiv.style.visibility="visible"}stop(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.visibility="hidden")}set durationMs(e){this.stop(),this._durationMs=e}get durationMs(){return this._durationMs}destroy(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}class V{constructor(e,t,i){this.id=i&&i.id?i.id:e,this.viewer=t,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,t.addPlugin(this)}scheduleTask(e){M.scheduleTask(e,null)}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){console.log(`[xeokit plugin ${this.id}]: ${e}`)}warn(e){console.warn(`[xeokit plugin ${this.id}]: ${e}`)}error(e){console.error(`[xeokit plugin ${this.id}]: ${e}`)}send(e,t){}destroy(){this.viewer.removePlugin(this)}}const H=c.vec3(),j=function(){const e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,o){return o=o||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,c.transformVec4(s,t,i),c.setMat4Translation(s,i,o),o.slice()}}();function G(e,t,i){const s=Float32Array.from([e[0]])[0],r=e[0]-s,o=Float32Array.from([e[1]])[0],n=e[1]-o,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=o,t[2]=a,i[0]=r,i[1]=n,i[2]=l}function z(e,t,i,s=1e3){const r=c.getPositionsCenter(e,H),o=Math.round(r[0]/s)*s,n=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=o,i[1]=n,i[2]=a;const l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(let i=0,s=e.length;i0?this.meshes[0]._colorize[3]/255:1}set opacity(e){if(0===this.meshes.length)return;const t=null!=e,i=this.meshes[0]._colorize[3];let s=255;if(t){if(e<0?e=0:e>1&&(e=1),s=Math.floor(255*e),i===s)return}else if(s=255,i===s)return;for(let e=0,t=this.meshes.length;e{this._viewPosDirty=!0,this._needUpdate()})),this._onCameraProjMatrix=this.scene.camera.on("projMatrix",(()=>{this._canvasPosDirty=!0,this._needUpdate()})),this._onEntityDestroyed=null,this._onEntityModelDestroyed=null,this._renderer.addMarker(this),this.entity=t.entity,this.worldPos=t.worldPos,this.occludable=t.occludable}_update(){if(this._viewPosDirty&&(c.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos),this._viewPosDirty=!1,this._canvasPosDirty=!0,this.fire("viewPos",this._viewPos)),this._canvasPosDirty){oe.set(this._viewPos),oe[3]=1,c.transformPoint4(this.scene.camera.projMatrix,oe,ne);const e=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+ne[0]/ne[3])*e[2]/2),this._canvasPos[1]=Math.floor((1-ne[1]/ne[3])*e[3]/2),this._canvasPosDirty=!1,this.fire("canvasPos",this._canvasPos)}}_setVisible(e){this._visible,this._visible=e,this.fire("visible",this._visible)}set entity(e){if(this._entity){if(this._entity===e)return;null!==this._onEntityDestroyed&&(this._entity.off(this._onEntityDestroyed),this._onEntityDestroyed=null),null!==this._onEntityModelDestroyed&&(this._entity.model.off(this._onEntityModelDestroyed),this._onEntityModelDestroyed=null)}this._entity=e,this._entity&&(this._entity instanceof re?this._onEntityModelDestroyed=this._entity.model.on("destroyed",(()=>{this._entity=null,this._onEntityModelDestroyed=null})):this._onEntityDestroyed=this._entity.on("destroyed",(()=>{this._entity=null,this._onEntityDestroyed=null}))),this.fire("entity",this._entity,!0)}get entity(){return this._entity}set occludable(e){(e=!!e)!==this._occludable&&(this._occludable=e)}get occludable(){return this._occludable}set worldPos(e){this._worldPos.set(e||[0,0,0]),G(this._worldPos,this._origin,this._rtcPos),this._occludable&&this._renderer.markerWorldPosUpdated(this),this._viewPosDirty=!0,this.fire("worldPos",this._worldPos),this._needUpdate()}get worldPos(){return this._worldPos}get origin(){return this._origin}get rtcPos(){return this._rtcPos}get viewPos(){return this._update(),this._viewPos}get canvasPos(){return this._update(),this._canvasPos}get visible(){return!!this._visible}destroy(){this.fire("destroyed",!0),this.scene.camera.off(this._onCameraViewMatrix),this.scene.camera.off(this._onCameraProjMatrix),this._entity&&(null!==this._onEntityDestroyed&&this._entity.off(this._onEntityDestroyed),null!==this._onEntityModelDestroyed&&this._entity.model.off(this._onEntityModelDestroyed)),this._renderer.removeMarker(this),super.destroy()}}class le{constructor(e,t={}){this._color=t.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=t.thickness||1,this._thicknessClickable=t.thicknessClickable||6,this._visible=!0,this._culled=!1;var i=this._wire,s=i.style;s.border="solid "+this._thickness+"px "+this._color,s.position="absolute",s["z-index"]=void 0===t.zIndex?"2000001":t.zIndex,s.width="0px",s.height="0px",s.visibility="visible",s.top="0px",s.left="0px",s["-webkit-transform-origin"]="0 0",s["-moz-transform-origin"]="0 0",s["-ms-transform-origin"]="0 0",s["-o-transform-origin"]="0 0",s["transform-origin"]="0 0",s["-webkit-transform"]="rotate(0deg)",s["-moz-transform"]="rotate(0deg)",s["-ms-transform"]="rotate(0deg)",s["-o-transform"]="rotate(0deg)",s.transform="rotate(0deg)",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._wireClickable,o=r.style;o.border="solid "+this._thicknessClickable+"px "+this._color,o.position="absolute",o["z-index"]=void 0===t.zIndex?"2000002":t.zIndex+1,o.width="0px",o.height="0px",o.visibility="visible",o.top="0px",o.left="0px",o["-webkit-transform-origin"]="0 0",o["-moz-transform-origin"]="0 0",o["-ms-transform-origin"]="0 0",o["-o-transform-origin"]="0 0",o["transform-origin"]="0 0",o["-webkit-transform"]="rotate(0deg)",o["-moz-transform"]="rotate(0deg)",o["-ms-transform"]="rotate(0deg)",o["-o-transform"]="rotate(0deg)",o.transform="rotate(0deg)",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),t.onMouseOver&&r.addEventListener("mouseover",(e=>{t.onMouseOver(e,this)})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}get visible(){return"visible"===this._wire.style.visibility}_update(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}setStartAndEnd(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}setColor(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}setOpacity(e){this._wire.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}destroy(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}class Ae{constructor(e,t={}){this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!t.visible,this._culled=!1;var i=this._dot,s=i.style;s["border-radius"]="25px",s.border="solid 2px white",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"40000005":t.zIndex,s.width="8px",s.height="8px",s.visibility=!1!==t.visible?"visible":"hidden",s.top="0px",s.left="0px",s["box-shadow"]="0 2px 5px 0 #182A3D;",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._dotClickable,o=r.style;o["border-radius"]="35px",o.border="solid 10px white",o.position="absolute",o["z-index"]=void 0===t.zIndex?"40000007":t.zIndex+1,o.width="8px",o.height="8px",o.visibility="visible",o.top="0px",o.left="0px",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),r.addEventListener("click",(t=>{e.dispatchEvent(new MouseEvent("mouseover",t))})),t.onMouseOver&&r.addEventListener("mouseover",(i=>{t.onMouseOver(i,this),e.dispatchEvent(new MouseEvent("mouseover",i))})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.borderColor)}setPos(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}setFillColor(e){this._dot.style.background=e||"lightgreen"}setBorderColor(e){this._dot.style.border="solid 2px"+(e||"black")}setOpacity(e){this._dot.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}destroy(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}class he{constructor(e,t={}){this._highlightClass="viewer-ruler-label-highlighted",this._prefix=t.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var i=this._label,s=i.style;s["border-radius"]="5px",s.color="white",s.padding="4px",s.border="solid 1px",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"5000005":t.zIndex,s.width="auto",s.height="auto",s.visibility="visible",s.top="0px",s.left="0px",s["pointer-events"]="all",s.opacity=1,t.onContextMenu,i.innerText="",e.appendChild(i),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.fillColor),this.setText(t.text),t.onMouseOver&&i.addEventListener("mouseover",(e=>{t.onMouseOver(e,this),e.preventDefault()})),t.onMouseLeave&&i.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this),e.preventDefault()})),t.onMouseWheel&&i.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&i.addEventListener("mousedown",(e=>{t.onMouseDown(e,this),e.stopPropagation()})),t.onMouseUp&&i.addEventListener("mouseup",(e=>{t.onMouseUp(e,this),e.stopPropagation()})),t.onMouseMove&&i.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&i.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}setPos(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}setPosOnWire(e,t,i,s){var r=e+.5*(i-e),o=t+.5*(s-t),n=this._label.style;n.left=Math.round(r)-20+"px",n.top=Math.round(o)-12+"px"}setPosBetweenWires(e,t,i,s,r,o){var n=(e+i+r)/3,a=(t+s+o)/3,l=this._label.style;l.left=Math.round(n)-20+"px",l.top=Math.round(a)-12+"px"}setText(e){this._label.innerHTML=this._prefix+(e||"")}setFillColor(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}setBorderColor(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}setOpacity(e){this._label.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}setClickable(e){this._label.style["pointer-events"]=e?"all":"none"}destroy(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}var ce=c.vec3(),ue=c.vec3();class de extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._color=t.color||e.defaultColor;var i=this.plugin.viewer.scene;this._originMarker=new ae(i,t.origin),this._cornerMarker=new ae(i,t.corner),this._targetMarker=new ae(i,t.target),this._originWorld=c.vec3(),this._cornerWorld=c.vec3(),this._targetWorld=c.vec3(),this._wp=new Float64Array(12),this._vp=new Float64Array(12),this._pp=new Float64Array(12),this._cp=new Int16Array(6);const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},l=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};this._originDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._cornerDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._originWire=new le(this._container,{color:this._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetWire=new le(this._container,{color:this._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._angleLabel=new he(this._container,{fillColor:this._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._visible=!1,this._originVisible=!1,this._cornerVisible=!1,this._targetVisible=!1,this._originWireVisible=!1,this._targetWireVisible=!1,this._angleVisible=!1,this._labelsVisible=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._cornerMarker.on("worldPos",(e=>{this._cornerWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.cornerVisible=t.cornerVisible,this.targetVisible=t.targetVisible,this.originWireVisible=t.originWireVisible,this.targetWireVisible=t.targetWireVisible,this.angleVisible=t.angleVisible,this.labelsVisible=t.labelsVisible}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(c.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){const d=-.3,p=this._originMarker.viewPos[2],f=this._cornerMarker.viewPos[2],g=this._targetMarker.viewPos[2];if(p>d||f>d||g>d)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);c.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var t=this._pp,i=this._cp,s=e.canvas.canvas.getBoundingClientRect();const m=this._container.getBoundingClientRect();for(var r=s.top-m.top,o=s.left-m.left,n=e.canvas.boundary,a=n[2],l=n[3],A=0,h=0,u=t.length;he.offsetTop+(e.offsetParent&&e.offsetParent!==t.parentNode&&h(e.offsetParent)),u=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==t.parentNode&&u(e.offsetParent)),d=c.vec2();this._onMouseHoverSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{e.snappedToVertex||e.snappedToEdge?(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!0),this.markerDiv.style.background="greenyellow",this.markerDiv.style.border="2px solid green"):(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.canvasPos,s.snapped=!1),this.markerDiv.style.background="pink",this.markerDiv.style.border="2px solid red");const i=e.snappedCanvasPos||e.canvasPos;switch(r=!0,o=e.entity,l.set(e.worldPos),A.set(i),this._mouseState){case 0:this._canvasToPagePos?(this._canvasToPagePos(t,i,d),this.markerDiv.style.left=d[0]-5+"px",this.markerDiv.style.top=d[1]-5+"px"):(this.markerDiv.style.left=u(t)+i[0]-5+"px",this.markerDiv.style.top=h(t)+i[1]-5+"px");break;case 1:this._currentAngleMeasurement&&(this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.angleVisible=!1,this._currentAngleMeasurement.corner.worldPos=e.worldPos,this._currentAngleMeasurement.corner.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer";break;case 2:this._currentAngleMeasurement&&(this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.angleVisible=!0,this._currentAngleMeasurement.target.worldPos=e.worldPos,this._currentAngleMeasurement.target.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer"}})),t.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(n=e.clientX,a=e.clientY)}),t.addEventListener("mouseup",this._onMouseUp=e=>{if(1===e.which&&!(e.clientX>n+20||e.clientXa+20||e.clientY{if(r=!1,s&&(s.visible=!0,s.pointerPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!1),this.markerDiv.style.left="-100px",this.markerDiv.style.top="-100px",this._currentAngleMeasurement){switch(this._mouseState){case 0:this._currentAngleMeasurement.originVisible=!1;break;case 1:this._currentAngleMeasurement.cornerVisible=!1,this._currentAngleMeasurement.originWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1;break;case 2:this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1}t.style.cursor="default"}})),this._active=!0}deactivate(){if(!this._active)return;this.pointerLens&&(this.pointerLens.visible=!1),this.markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.angleMeasurementsPlugin.viewer.cameraControl;t.off(this._onMouseHoverSurface),t.off(this._onPickedSurface),t.off(this._onHoverNothing),t.off(this._onPickedNothing),this._currentAngleMeasurement=null,this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),this._mouseState=0)}get currentMeasurement(){return this._currentAngleMeasurement}destroy(){this.deactivate(),super.destroy()}}class ge extends ae{constructor(e,t){if(super(e,t),this.plugin=t.plugin,this._container=t.container,!this._container)throw"config missing: container";if(!t.markerElement&&!t.markerHTML)throw"config missing: need either markerElement or markerHTML";if(!t.labelElement&&!t.labelHTML)throw"config missing: need either labelElement or labelHTML";this._htmlDirty=!1,t.markerElement?(this._marker=t.markerElement,this._marker.addEventListener("click",this._onMouseClickedExternalMarker=()=>{this.plugin.fire("markerClicked",this)}),this._marker.addEventListener("mouseenter",this._onMouseEnterExternalMarker=()=>{this.plugin.fire("markerMouseEnter",this)}),this._marker.addEventListener("mouseleave",this._onMouseLeaveExternalMarker=()=>{this.plugin.fire("markerMouseLeave",this)}),this._markerExternal=!0):(this._markerHTML=t.markerHTML,this._htmlDirty=!0,this._markerExternal=!1),t.labelElement?(this._label=t.labelElement,this._labelExternal=!0):(this._labelHTML=t.labelHTML,this._htmlDirty=!0,this._labelExternal=!1),this._markerShown=!!t.markerShown,this._labelShown=!!t.labelShown,this._values=t.values||{},this._layoutDirty=!0,this._visibilityDirty=!0,this._buildHTML(),this._onTick=this.scene.on("tick",(()=>{this._htmlDirty&&(this._buildHTML(),this._htmlDirty=!1,this._layoutDirty=!0,this._visibilityDirty=!0),(this._layoutDirty||this._visibilityDirty)&&(this._markerShown||this._labelShown)&&(this._updatePosition(),this._layoutDirty=!1),this._visibilityDirty&&(this._marker.style.visibility=this.visible&&this._markerShown?"visible":"hidden",this._label.style.visibility=this.visible&&this._markerShown&&this._labelShown?"visible":"hidden",this._visibilityDirty=!1)})),this.on("canvasPos",(()=>{this._layoutDirty=!0})),this.on("visible",(()=>{this._visibilityDirty=!0})),this.setMarkerShown(!1!==t.markerShown),this.setLabelShown(t.labelShown),this.eye=t.eye?t.eye.slice():null,this.look=t.look?t.look.slice():null,this.up=t.up?t.up.slice():null,this.projection=t.projection}_buildHTML(){if(!this._markerExternal){this._marker&&(this._container.removeChild(this._marker),this._marker=null);let e=this._markerHTML||"

";_.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._marker=t.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(()=>{this.plugin.fire("markerClicked",this)})),this._marker.addEventListener("mouseenter",(()=>{this.plugin.fire("markerMouseEnter",this)})),this._marker.addEventListener("mouseleave",(()=>{this.plugin.fire("markerMouseLeave",this)})),this._marker.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);let e=this._labelHTML||"

";_.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._label=t.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}}_updatePosition(){const e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}_renderTemplate(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){const i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}setMarkerShown(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}getMarkerShown(){return this._markerShown}setLabelShown(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}getLabelShown(){return this._labelShown}setField(e,t){this._values[e]=t||"",this._htmlDirty=!0}getField(e){return this._values[e]}setValues(e){for(var t in e)if(e.hasOwnProperty(t)){const i=e[t];this.setField(t,i)}}getValues(){return this._values}destroy(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),super.destroy()}}const me=c.vec3(),_e=c.vec3(),ve=c.vec3();class be extends D{get type(){return"Spinner"}constructor(e,t={}){super(e,t),this._canvas=t.canvas,this._element=null,this._isCustom=!1,t.elementId&&(this._element=document.getElementById(t.elementId),this._element?this._adjustPosition():this.error("Can't find given Spinner HTML element: '"+t.elementId+"' - will automatically create default element")),this._element||this._createDefaultSpinner(),this.processes=0}_createDefaultSpinner(){this._injectDefaultCSS();const e=document.createElement("div"),t=e.style;t["z-index"]="9000",t.position="absolute",e.innerHTML='
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}_injectDefaultCSS(){const e="xeokit-spinner-css";if(document.getElementById(e))return;const t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}_adjustPosition(){if(this._isCustom)return;const e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}set processes(e){if(e=e||0,this._processes===e)return;if(e<0)return;const t=this._processes;this._processes=e;const i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}get processes(){return this._processes}_destroy(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);const e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}const ye=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];class Be extends D{constructor(e,t={}){super(e,t),this._backgroundColor=c.vec3([t.backgroundColor?t.backgroundColor[0]:1,t.backgroundColor?t.backgroundColor[1]:1,t.backgroundColor?t.backgroundColor[2]:1]),this._backgroundColorFromAmbientLight=!!t.backgroundColorFromAmbientLight,this.canvas=t.canvas,this.gl=null,this.webgl2=!1,this.transparent=!!t.transparent,this.contextAttr=t.contextAttr||{},this.contextAttr.alpha=this.transparent,this.contextAttr.preserveDrawingBuffer=!!this.contextAttr.preserveDrawingBuffer,this.contextAttr.stencil=!1,this.contextAttr.premultipliedAlpha=!!this.contextAttr.premultipliedAlpha,this.contextAttr.antialias=!1!==this.contextAttr.antialias,this.resolutionScale=t.resolutionScale,this.canvas.width=Math.round(this.canvas.clientWidth*this._resolutionScale),this.canvas.height=Math.round(this.canvas.clientHeight*this._resolutionScale),this.boundary=[this.canvas.offsetLeft,this.canvas.offsetTop,this.canvas.clientWidth,this.canvas.clientHeight],this._initWebGL(t);const i=this;this.canvas.addEventListener("webglcontextlost",this._webglcontextlostListener=function(e){console.time("webglcontextrestored"),i.scene._webglContextLost(),i.fire("webglcontextlost"),e.preventDefault()},!1),this.canvas.addEventListener("webglcontextrestored",this._webglcontextrestoredListener=function(e){i._initWebGL(),i.gl&&(i.scene._webglContextRestored(i.gl),i.fire("webglcontextrestored",i.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);let s=!0;new ResizeObserver((e=>{for(const t of e)t.contentBoxSize&&(s=!0)})).observe(this.canvas),this._tick=this.scene.on("tick",(()=>{s&&(s=!1,i.canvas.width=Math.round(i.canvas.clientWidth*i._resolutionScale),i.canvas.height=Math.round(i.canvas.clientHeight*i._resolutionScale),i.boundary[0]=i.canvas.offsetLeft,i.boundary[1]=i.canvas.offsetTop,i.boundary[2]=i.canvas.clientWidth,i.boundary[3]=i.canvas.clientHeight,i.fire("boundary",i.boundary))})),this._spinner=new be(this.scene,{canvas:this.canvas,elementId:t.spinnerElementId})}get type(){return"Canvas"}get backgroundColorFromAmbientLight(){return this._backgroundColorFromAmbientLight}set backgroundColorFromAmbientLight(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}get resolutionScale(){return this._resolutionScale}set resolutionScale(e){if((e=e||1)===this._resolutionScale)return;this._resolutionScale=e;const t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}get spinner(){return this._spinner}_createCanvas(){const e="xeokit-canvas-"+c.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}_getElementXY(e){let t=0,i=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}_initWebGL(){if(!this.gl)for(let e=0;!this.gl&&e0?we.FS_MAX_FLOAT_PRECISION="highp":e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?we.FS_MAX_FLOAT_PRECISION="mediump":we.FS_MAX_FLOAT_PRECISION="lowp":we.FS_MAX_FLOAT_PRECISION="mediump",we.DEPTH_BUFFER_BITS=e.getParameter(e.DEPTH_BITS),we.MAX_TEXTURE_SIZE=e.getParameter(e.MAX_TEXTURE_SIZE),we.MAX_CUBE_MAP_SIZE=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),we.MAX_RENDERBUFFER_SIZE=e.getParameter(e.MAX_RENDERBUFFER_SIZE),we.MAX_TEXTURE_UNITS=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),we.MAX_TEXTURE_IMAGE_UNITS=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),we.MAX_VERTEX_ATTRIBS=e.getParameter(e.MAX_VERTEX_ATTRIBS),we.MAX_VERTEX_UNIFORM_VECTORS=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),we.MAX_FRAGMENT_UNIFORM_VECTORS=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),we.MAX_VARYING_VECTORS=e.getParameter(e.MAX_VARYING_VECTORS),e.getSupportedExtensions().forEach((function(e){we.SUPPORTED_EXTENSIONS[e]=!0})))}class Ce{constructor(){this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}get canvasPos(){return this._gotCanvasPos?this._canvasPos:null}set canvasPos(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}get origin(){return this._gotOrigin?this._origin:null}set origin(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}get direction(){return this._gotDirection?this._direction:null}set direction(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}get indices(){return this.entity&&this._gotIndices?this._indices:null}set indices(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}get localPos(){return this.entity&&this._gotLocalPos?this._localPos:null}set localPos(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}get snappedCanvasPos(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null}set snappedCanvasPos(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}get worldPos(){return this._gotWorldPos?this._worldPos:null}set worldPos(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}get viewPos(){return this.entity&&this._gotViewPos?this._viewPos:null}set viewPos(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}get bary(){return this.entity&&this._gotBary?this._bary:null}set bary(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}get worldNormal(){return this.entity&&this._gotWorldNormal?this._worldNormal:null}set worldNormal(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}get uv(){return this.entity&&this._gotUV?this._uv:null}set uv(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}get snapped(){return this.snappedToEdge||this.snappedToVertex}reset(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}class Me{constructor(e,t,i){if(this.allocated=!1,this.compiled=!1,this.handle=e.createShader(t),this.handle){if(this.allocated=!0,e.shaderSource(this.handle,i),e.compileShader(this.handle),this.compiled=e.getShaderParameter(this.handle,e.COMPILE_STATUS),!this.compiled&&!e.isContextLost()){const t=i.split("\n"),s=[];for(let e=0;e0&&"/"===i.charAt(s+1)&&(i=i.substring(0,s)),t.push(i);return t.join("\n")}function Se(e){console.error(e.join("\n"))}class Te{constructor(e,t){this.id=Ie.addItem({}),this.source=t,this.init(e)}init(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new Me(e,e.VERTEX_SHADER,De(this.source.vertex)),this._fragmentShader=new Me(e,e.FRAGMENT_SHADER,De(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Se(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Se(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Se(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Se(this.errors);let t,i,s,r,o;if(this.compiled=!0,this.handle=e.createProgram(),!this.handle)return void(this.errors=["Failed to allocate program"]);if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Se(this.errors);const n=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}setData(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}bind(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}unbind(){this.allocated&&this._gl.bindBuffer(this.type,null)}destroy(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}class Le{constructor(e,t){this.scene=e,this.aabb=c.AABB3(),this.origin=c.vec3(t),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}addMarker(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}markerWorldPosUpdated(e){if(!this.markers[e.id])return;const t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}removeMarker(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}update(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}_buildMarkerList(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}_buildPositions(){let e=0;for(let t=0;t-t){i._setVisible(!1);continue}const n=i.canvasPos,a=n[0],l=n[1];a+10<0||l+10<0||a-10>s||l-10>r?i._setVisible(!1):!i.entity||i.entity.visible?i.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=i,this.pixels[o++]=a,this.pixels[o++]=l):i._setVisible(!0):i._setVisible(!1)}}_updateActiveSectionPlanes(){const e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(let i=0;i{this._occlusionTestListDirty=!0})),this._onCameraProjMatrix=e.camera.on("projMatrix",(()=>{this._occlusionTestListDirty=!0})),this._onCanvasBoundary=e.canvas.on("boundary",(()=>{this._occlusionTestListDirty=!0}))}addMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i||(i=new Le(this._scene,e.origin),this._occlusionLayers[i.originHash]=i,this._occlusionLayersListDirty=!0),i.addMarker(e),this._markersToOcclusionLayersMap[e.id]=i,this._occlusionTestListDirty=!0}markerWorldPosUpdated(e){const t=this._markersToOcclusionLayersMap[e.id];if(!t)return void e.error("Marker has not been added to OcclusionTester");const i=e.origin.join();if(i!==t.originHash){1===t.numMarkers?(t.destroy(),delete this._occlusionLayers[t.originHash],this._occlusionLayersListDirty=!0):t.removeMarker(e);let s=this._occlusionLayers[i];s||(s=new Le(this._scene,e.origin),this._occlusionLayers[i]=t,this._occlusionLayersListDirty=!0),s.addMarker(e),this._markersToOcclusionLayersMap[e.id]=s}else t.markerWorldPosUpdated(e)}removeMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i&&(1===i.numMarkers?(i.destroy(),delete this._occlusionLayers[i.originHash],this._occlusionLayersListDirty=!0):i.removeMarker(e),delete this._markersToOcclusionLayersMap[e.id])}get needOcclusionTest(){return this._occlusionTestListDirty}bindRenderBuf(){const e=[this._scene.canvas.canvas.id,this._scene._sectionPlanesState.getHash()].join(";");if(e!==this._shaderSourceHash&&(this._shaderSourceHash=e,this._shaderSourceDirty=!0),this._shaderSourceDirty&&(this._buildShaderSource(),this._shaderSourceDirty=!1,this._programDirty=!0),this._programDirty&&(this._buildProgram(),this._programDirty=!1,this._occlusionTestListDirty=!0),this._occlusionLayersListDirty&&(this._buildOcclusionLayersList(),this._occlusionLayersListDirty=!1),this._occlusionTestListDirty){for(let e=0,t=this._occlusionLayersList.length;e0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}_buildFragmentShaderSource(){const e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}_buildProgram(){this._program&&this._program.destroy();const e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new Te(t,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,t=i.sectionPlanes.length;e0){const e=s.sectionPlanes;for(let s=0;s{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=c.mat4();return()=>(e&&c.inverseMat4(s.camera.projMatrix,t),t)})());const t=this._scene.canvas.gl,i=this._program,s=this._scene,r=s.sao,o=t.drawingBufferWidth,n=t.drawingBufferHeight,a=s.camera.project._state,l=a.near,A=a.far,h=a.matrix,u=this._getInverseProjectMat(),d=Math.random(),p="perspective"===s.camera.projection;Ne[0]=o,Ne[1]=n,t.viewport(0,0,o,n),t.clearColor(0,0,0,1),t.disable(t.DEPTH_TEST),t.disable(t.BLEND),t.frontFace(t.CCW),t.clear(t.COLOR_BUFFER_BIT),i.bind(),t.uniform1f(this._uCameraNear,l),t.uniform1f(this._uCameraFar,A),t.uniformMatrix4fv(this._uCameraProjectionMatrix,!1,h),t.uniformMatrix4fv(this._uCameraInverseProjectionMatrix,!1,u),t.uniform1i(this._uPerspective,p),t.uniform1f(this._uScale,r.scale*(A/5)),t.uniform1f(this._uIntensity,r.intensity),t.uniform1f(this._uBias,r.bias),t.uniform1f(this._uKernelRadius,r.kernelRadius),t.uniform1f(this._uMinResolution,r.minResolution),t.uniform2fv(this._uViewport,Ne),t.uniform1f(this._uRandomSeed,d);const f=e.getDepthTexture();i.bindTexture(this._uDepthTexture,f,0),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),t.drawElements(t.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}_build(){let e=!1;const t=this._scene.sao;if(t.numSamples!==this._numSamples&&(this._numSamples=Math.floor(t.numSamples),e=!0),!e)return;const i=this._scene.canvas.gl;if(this._program&&(this._program.destroy(),this._program=null),this._program=new Te(i,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV; \n \n out vec2 vUV;\n \n void main () {\n gl_Position = vec4(aPosition, 1.0);\n vUV = aUV;\n }"],fragment:[`#version 300 es \n precision highp float;\n precision highp int; \n \n #define NORMAL_TEXTURE 0\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n #define NUM_SAMPLES ${this._numSamples}\n #define NUM_RINGS 4 \n \n in vec2 vUV;\n \n uniform sampler2D uDepthTexture;\n \n uniform float uCameraNear;\n uniform float uCameraFar;\n uniform mat4 uProjectMatrix;\n uniform mat4 uInverseProjectMatrix;\n \n uniform bool uPerspective;\n\n uniform float uScale;\n uniform float uIntensity;\n uniform float uBias;\n uniform float uKernelRadius;\n uniform float uMinResolution;\n uniform vec2 uViewport;\n uniform float uRandomSeed;\n\n float pow2( const in float x ) { return x*x; }\n \n highp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n }\n\n vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n }\n\n vec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n }\n\n const float packUpscale = 256. / 255.;\n const float unpackDownScale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. ); \n\n const float shiftRights = 1. / 256.;\n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float unpackRGBAToFloat( const in vec4 v ) { \n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unPackFactors );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n }\n\n float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n }\n \n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n if (uPerspective) {\n return perspectiveDepthToViewZ( depth, uCameraNear, uCameraFar );\n } else {\n return orthographicDepthToViewZ( depth, uCameraNear, uCameraFar );\n }\n }\n\n vec3 getViewPos( const in vec2 screenPos, const in float depth, const in float viewZ ) {\n \tfloat clipW = uProjectMatrix[2][3] * viewZ + uProjectMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPos, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; \n \treturn ( uInverseProjectMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPos ) { \n return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - uBias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \n \tscaleDividedByCameraFar = uScale / uCameraFar;\n \tminResolutionMultipliedByCameraFar = uMinResolution * uCameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUV );\n\n \tfloat angle = rand( vUV + uRandomSeed ) * PI2;\n \tvec2 radius = vec2( uKernelRadius * INV_NUM_SAMPLES ) / uViewport;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUV + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }`]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),o=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new Re(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new Re(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new Re(i,i.ELEMENT_ARRAY_BUFFER,o,o.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}destroy(){this._program&&(this._program.destroy(),this._program=null)}}const Ve=new Float32Array(Ke(17,[0,1])),He=new Float32Array(Ke(17,[1,0])),je=new Float32Array(function(e,t){const i=[];for(let s=0;s<=e;s++)i.push(We(s,t));return i}(17,4)),Ge=new Float32Array(2);class ze{constructor(e){this._scene=e,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}init(){const e=this._scene.canvas.gl;if(this._program=new Te(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS 16\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }"]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new Re(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new Re(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new Re(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}render(e,t,i){if(this._programError)return;this._getInverseProjectMat||(this._getInverseProjectMat=(()=>{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=c.mat4();return()=>(e&&c.inverseMat4(o.camera.projMatrix,t),t)})());const s=this._scene.canvas.gl,r=this._program,o=this._scene,n=s.drawingBufferWidth,a=s.drawingBufferHeight,l=o.camera.project._state,A=l.near,h=l.far;s.viewport(0,0,n,a),s.clearColor(0,0,0,1),s.enable(s.DEPTH_TEST),s.disable(s.BLEND),s.frontFace(s.CCW),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),r.bind(),Ge[0]=n,Ge[1]=a,s.uniform2fv(this._uViewport,Ge),s.uniform1f(this._uCameraNear,A),s.uniform1f(this._uCameraFar,h),s.uniform1f(this._uDepthCutoff,.01),0===i?s.uniform2fv(this._uSampleOffsets,He):s.uniform2fv(this._uSampleOffsets,Ve),s.uniform1fv(this._uSampleWeights,je);const u=e.getDepthTexture(),d=t.getTexture();r.bindTexture(this._uDepthTexture,u,0),r.bindTexture(this._uOcclusionTexture,d,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),s.drawElements(s.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}destroy(){this._program.destroy()}}function We(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function Ke(e,t){const i=[];for(let s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}class Xe{constructor(e,t,i){i=i||{},this.gl=t,this.allocated=!1,this.canvas=e,this.buffer=null,this.bound=!1,this.size=i.size,this._hasDepthTexture=!!i.depthTexture}setSize(e){this.size=e}webglContextRestored(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}bind(...e){if(this._touch(...e),this.bound)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}createTexture(e,t,i=null){const s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}_touch(...e){let t,i;const s=this.gl;if(this.size?(t=this.size[0],i=this.size[1]):(t=s.drawingBufferWidth,i=s.drawingBufferHeight),this.buffer){if(this.buffer.width===t&&this.buffer.height===i)return;this.buffer.textures.forEach((e=>s.deleteTexture(e))),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}const r=[];let o;e.length>0?r.push(...e.map((e=>this.createTexture(t,i,e)))):r.push(this.createTexture(t,i)),this._hasDepthTexture&&(o=s.createTexture(),s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,t,i,0,s.DEPTH_COMPONENT,s.FLOAT,null));const n=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,n),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,t,i);const a=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,a);for(let e=0;e0&&s.drawBuffers(r.map(((e,t)=>s.COLOR_ATTACHMENT0+t))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,n),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,a),!s.isFramebuffer(a))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);const l=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(l){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+l}this.buffer={framebuf:a,renderbuf:n,texture:r[0],textures:r,depthTexture:o,width:t,height:i},this.bound=!1}clear(){if(!this.bound)throw"Render buffer not bound";const e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}read(e,t,i=null,s=null,r=Uint8Array,o=4,n=0){const a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,A=new r(o),h=this.gl;return h.readBuffer(h.COLOR_ATTACHMENT0+n),h.readPixels(a,l,1,1,i||h.RGBA,s||h.UNSIGNED_BYTE,A,0),A}readArray(e=null,t=null,i=Uint8Array,s=4,r=0){const o=new i(this.buffer.width*this.buffer.height*s),n=this.gl;return n.readBuffer(n.COLOR_ATTACHMENT0+r),n.readPixels(0,0,this.buffer.width,this.buffer.height,e||n.RGBA,t||n.UNSIGNED_BYTE,o,0),o}readImageAsCanvas(){const e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,o=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);const n=this.buffer.width,a=this.buffer.height,l=a/2|0,A=4*n,h=new Uint8Array(4*n);for(let e=0;ee.deleteTexture(t))),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}class Je{constructor(e){this.scene=e,this._renderBuffersBasic={},this._renderBuffersScaled={}}getRenderBuffer(e,t){const i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled;let s=i[e];return s||(s=new Xe(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}destroy(){for(let e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(let e in this._renderBuffersScaled)this._renderBuffersScaled[e].destroy()}}function Ye(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];let i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}const Ze=function(t,i){i=i||{};const s=new xe(t),r=t.canvas.canvas,o=t.canvas.gl,n=!!i.transparent,a=i.alphaDepthMask,l=new e({});let A={},h={},u=!0,d=!0,f=!0,g=!0,m=!0,_=!0,v=!0,b=!0;const y=new Je(t);let B=!1;const x=new Qe(t),w=new ze(t);function P(){u&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableMap,s=t.drawableListPreCull;let r=0;for(let e in i)i.hasOwnProperty(e)&&(s[r++]=i[e]);s.length=r}}(),u=!1,d=!0),d&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),d=!1,f=!0),f&&function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableListPreCull,s=t.drawableList;let r=0;for(let e=0,t=i.length;e0)for(s.withSAO=!0,S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||j>0||O>0||N>0){if(o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):(o.blendEquation(o.FUNC_ADD),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA)),s.backfaces=!1,a||o.depthMask(!1),(O>0||N>0)&&o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),N>0)for(S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||z>0){if(s.lastProgramId=null,t.highlightMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),z>0)for(S=0;S0)for(S=0;S0||K>0||G>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.enable(o.CULL_FACE),K>0)for(S=0;S0)for(S=0;S0||J>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),J>0)for(S=0;S0)for(S=0;S0||Z>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),Z>0)for(S=0;S0)for(S=0;S0){const t=Math.floor(e/4),i=d.size[0],s=t%i-Math.floor(i/2),r=Math.floor(t/i)-Math.floor(i/2),o=Math.sqrt(Math.pow(s,2)+Math.pow(r,2));M.push({x:s,y:r,dist:o,isVertex:n&&a?_[e+3]>m.length/2:n,result:[_[e+0],_[e+1],_[e+2],_[e+3]],normal:[v[e+0],v[e+1],v[e+2],v[e+3]],id:[b[e+0],b[e+1],b[e+2],b[e+3]]})}let D=null,S=null,T=null,R=null;if(M.length>0){M.sort(((e,t)=>e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist)),R=M[0].isVertex?"vertex":"edge";const e=M[0].result,t=M[0].normal,i=M[0].id,s=m[e[3]],r=s.origin,o=s.coordinateScale;S=c.normalizeVec3([t[0]/c.MAX_INT,t[1]/c.MAX_INT,t[2]/c.MAX_INT]),D=[e[0]*o[0]+r[0],e[1]*o[1]+r[1],e[2]*o[2]+r[2]],T=l.items[i[0]+(i[1]<<8)+(i[2]<<16)+(i[3]<<24)]}if(null===B&&null==D)return null;let L=null;null!==D&&(L=t.camera.projectWorldPos(D));const U=T&&T.delegatePickedEntity?T.delegatePickedEntity():T;return h.reset(),h.snappedToEdge="edge"===R,h.snappedToVertex="vertex"===R,h.worldPos=D,h.worldNormal=S,h.entity=U,h.canvasPos=i,h.snappedCanvasPos=L||i,h}}(),this.addMarker=function(e){this._occlusionTester=this._occlusionTester||new Oe(t,y),this._occlusionTester.addMarker(e),t.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){P(),this._occlusionTester.bindRenderBuf(),s.reset(),s.backfaces=!0,s.frontface=!0,o.viewport(0,0,o.drawingBufferWidth,o.drawingBufferHeight),o.clearColor(0,0,0,0),o.enable(o.DEPTH_TEST),o.disable(o.CULL_FACE),o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);for(let e in A)if(A.hasOwnProperty(e)){const t=A[e].drawableList;for(let e=0,i=t.length;e{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!0:e.keyCode===this.KEY_ALT?this.altDown=!0:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!0),this.keyDown[e.keyCode]=!0,this.fire("keydown",e.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=e=>{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!1:e.keyCode===this.KEY_ALT?this.altDown=!1:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!1),this.keyDown[e.keyCode]=!1,this.fire("keyup",e.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=e=>{this.enabled&&(this.mouseover=!0,this._getMouseCanvasPos(e),this.fire("mouseenter",this.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=e=>{this.enabled&&(this.mouseover=!1,this._getMouseCanvasPos(e),this.fire("mouseleave",this.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!0;break;case 2:this.mouseDownMiddle=!0;break;case 3:this.mouseDownRight=!0}this._getMouseCanvasPos(e),this.element.focus(),this.fire("mousedown",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!1;break;case 2:this.mouseDownMiddle=!1;break;case 3:this.mouseDownRight=!1}this.fire("mouseup",this.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("click",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("dblclick",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}});const e=this.scene.tickify((()=>this.fire("mousemove",this.mouseCanvasPos,!0)));this.element.addEventListener("mousemove",this._mouseMoveListener=t=>{this.enabled&&(this._getMouseCanvasPos(t),e(),this.mouseover&&t.preventDefault())});const t=this.scene.tickify((e=>{this.fire("mousewheel",e,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=(e,i)=>{if(!this.enabled)return;const s=Math.max(-1,Math.min(1,40*-e.deltaY));t(s)},{passive:!0});{let e,t;const i=2;this.on("mousedown",(i=>{e=i[0],t=i[1]})),this.on("mouseup",(s=>{e>=s[0]-i&&e<=s[0]+i&&t>=s[1]-i&&t<=s[1]+i&&this.fire("mouseclicked",s,!0)}))}this._eventsBound=!0}_unbindEvents(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}_getMouseCanvasPos(e){if(e){let t=e.target,i=0,s=0;for(;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}setEnabled(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}getEnabled(){return this.enabled}setKeyboardEnabled(e){this.keyboardEnabled=e}getKeyboardEnabled(){return this.keyboardEnabled}destroy(){super.destroy(),this._unbindEvents()}}const $e=new e({});class et{constructor(e){this.id=$e.addItem({});for(const t in e)e.hasOwnProperty(t)&&(this[t]=e[t])}destroy(){$e.removeItem(this.id)}}class tt extends D{get type(){return"Viewport"}constructor(e,t={}){super(e,t),this._state=new et({boundary:[0,0,100,100]}),this.boundary=t.boundary,this.autoBoundary=t.autoBoundary}set boundary(e){if(!this._autoBoundary){if(!e){const t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}get boundary(){return this._state.boundary}set autoBoundary(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){const t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}get autoBoundary(){return this._autoBoundary}_getState(){return this._state}destroy(){super.destroy(),this._state.destroy()}}class it extends D{get type(){return"Perspective"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this._fov=60,this._canvasResized=this.scene.canvas.on("boundary",this._needUpdate,this),this.fov=t.fov,this.fovAxis=t.fovAxis,this.near=t.near,this.far=t.far}_update(){const e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis;let s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),c.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}set fov(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}get fov(){return this._fov}set fovAxis(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}get fovAxis(){return this._fovAxis}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}class st extends D{get type(){return"Ortho"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.scale=t.scale,this.near=t.near,this.far=t.far,this._onCanvasBoundary=this.scene.canvas.on("boundary",this._needUpdate,this)}_update(){const e=this.scene,t=.5*this._scale,i=e.canvas.boundary,s=i[2],r=i[3],o=s/r;let n,a,l,A;s>r?(n=-t,a=t,l=t/o,A=-t/o):(n=-t*o,a=t*o,l=t,A=-t),c.orthoMat4c(n,a,A,l,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set scale(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}get scale(){return this._scale}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}class rt extends D{get type(){return"Frustum"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4(),near:.1,far:1e4}),this._left=-1,this._right=1,this._bottom=-1,this._top=1,this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.left=t.left,this.right=t.right,this.bottom=t.bottom,this.top=t.top,this.near=t.near,this.far=t.far}_update(){c.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set left(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}get left(){return this._left}set right(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}get right(){return this._right}set top(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}get top(){return this._top}set bottom(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}get bottom(){return this._bottom}set near(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}get near(){return this._state.near}set far(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),super.destroy()}}class ot extends D{get type(){return"CustomProjection"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new et({matrix:c.mat4(),inverseMatrix:c.mat4(),transposedMatrix:c.mat4()}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!1,this.matrix=t.matrix}set matrix(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}get matrix(){return this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(c.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(c.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,c.mulMat4v4(this.inverseMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,c.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy()}}const nt=c.vec3(),at=c.vec3(),lt=c.vec3(),At=c.vec3(),ht=c.vec3(),ct=c.vec3(),ut=c.vec4(),dt=c.vec4(),pt=c.vec4(),ft=c.mat4(),gt=c.mat4(),mt=c.vec3(),_t=c.vec3(),vt=c.vec3(),bt=c.vec3();class yt extends D{get type(){return"Camera"}constructor(e,t={}){super(e,t),this._state=new et({deviceMatrix:c.mat4(),hasDeviceMatrix:!1,matrix:c.mat4(),normalMatrix:c.mat4(),inverseMatrix:c.mat4()}),this._perspective=new it(this),this._ortho=new st(this),this._frustum=new rt(this),this._customProjection=new ot(this),this._project=this._perspective,this._eye=c.vec3([0,0,10]),this._look=c.vec3([0,0,0]),this._up=c.vec3([0,1,0]),this._worldUp=c.vec3([0,1,0]),this._worldRight=c.vec3([1,0,0]),this._worldForward=c.vec3([0,0,-1]),this.deviceMatrix=t.deviceMatrix,this.eye=t.eye,this.look=t.look,this.up=t.up,this.worldAxis=t.worldAxis,this.gimbalLock=t.gimbalLock,this.constrainPitch=t.constrainPitch,this.projection=t.projection,this._perspective.on("matrix",(()=>{"perspective"===this._projectionType&&this.fire("projMatrix",this._perspective.matrix)})),this._ortho.on("matrix",(()=>{"ortho"===this._projectionType&&this.fire("projMatrix",this._ortho.matrix)})),this._frustum.on("matrix",(()=>{"frustum"===this._projectionType&&this.fire("projMatrix",this._frustum.matrix)})),this._customProjection.on("matrix",(()=>{"customProjection"===this._projectionType&&this.fire("projMatrix",this._customProjection.matrix)}))}_update(){const e=this._state;let t;"ortho"===this.projection?(c.subVec3(this._eye,this._look,mt),c.normalizeVec3(mt,_t),c.mulVec3Scalar(_t,1e3,vt),c.addVec3(this._look,vt,bt),t=bt):t=this._eye,e.hasDeviceMatrix?(c.lookAtMat4v(t,this._look,this._up,gt),c.mulMat4(e.deviceMatrix,gt,e.matrix)):c.lookAtMat4v(t,this._look,this._up,e.matrix),c.inverseMat4(this._state.matrix,this._state.inverseMatrix),c.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}orbitYaw(e){let t=c.subVec3(this._eye,this._look,nt);c.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,ft),t=c.transformPoint3(ft,t,at),this.eye=c.addVec3(this._look,t,lt),this.up=c.transformPoint3(ft,this._up,At)}orbitPitch(e){if(this._constrainPitch&&(e=c.dotVec3(this._up,this._worldUp)/c.DEGTORAD)<1)return;let t=c.subVec3(this._eye,this._look,nt);const i=c.cross3Vec3(c.normalizeVec3(t,at),c.normalizeVec3(this._up,lt));c.rotationMat4v(.0174532925*e,i,ft),t=c.transformPoint3(ft,t,At),this.up=c.transformPoint3(ft,this._up,ht),this.eye=c.addVec3(t,this._look,ct)}yaw(e){let t=c.subVec3(this._look,this._eye,nt);c.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,ft),t=c.transformPoint3(ft,t,at),this.look=c.addVec3(t,this._eye,lt),this._gimbalLock&&(this.up=c.transformPoint3(ft,this._up,At))}pitch(e){if(this._constrainPitch&&(e=c.dotVec3(this._up,this._worldUp)/c.DEGTORAD)<1)return;let t=c.subVec3(this._look,this._eye,nt);const i=c.cross3Vec3(c.normalizeVec3(t,at),c.normalizeVec3(this._up,lt));c.rotationMat4v(.0174532925*e,i,ft),this.up=c.transformPoint3(ft,this._up,ct),t=c.transformPoint3(ft,t,At),this.look=c.addVec3(t,this._eye,ht)}pan(e){const t=c.subVec3(this._eye,this._look,nt),i=[0,0,0];let s;if(0!==e[0]){const r=c.cross3Vec3(c.normalizeVec3(t,[]),c.normalizeVec3(this._up,at));s=c.mulVec3Scalar(r,e[0]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]}0!==e[1]&&(s=c.mulVec3Scalar(c.normalizeVec3(this._up,lt),e[1]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),0!==e[2]&&(s=c.mulVec3Scalar(c.normalizeVec3(t,At),e[2]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),this.eye=c.addVec3(this._eye,i,ht),this.look=c.addVec3(this._look,i,ct)}zoom(e){const t=c.subVec3(this._eye,this._look,nt),i=Math.abs(c.lenVec3(t,at)),s=Math.abs(i+e);if(s<.5)return;const r=c.normalizeVec3(t,lt);this.eye=c.addVec3(this._look,c.mulVec3Scalar(r,s),At)}set eye(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}get eye(){return this._eye}set look(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}get look(){return this._look}set up(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}get up(){return this._up}set deviceMatrix(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}get deviceMatrix(){return this._state.deviceMatrix}set worldAxis(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=c.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}get worldAxis(){return this._worldAxis}get worldUp(){return this._worldUp}get xUp(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}get yUp(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}get zUp(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}get worldRight(){return this._worldRight}get worldForward(){return this._worldForward}set gimbalLock(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}get gimbalLock(){return this._gimbalLock}set constrainPitch(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}get eyeLookDist(){return c.lenVec3(c.subVec3(this._look,this._eye,nt))}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get viewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get normalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get viewNormalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get inverseViewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}get projMatrix(){return this[this.projection].matrix}get perspective(){return this._perspective}get ortho(){return this._ortho}get frustum(){return this._frustum}get customProjection(){return this._customProjection}set projection(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}get projection(){return this._projectionType}get project(){return this._project}projectWorldPos(e){const t=ut,i=dt,s=pt;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,c.mulMat4v4(this.viewMatrix,t,i),c.mulMat4v4(this.projMatrix,i,s),c.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;const r=this.scene.canvas.canvas,o=r.offsetWidth/2,n=r.offsetHeight/2;return[s[0]*o+o,s[1]*n+n]}destroy(){super.destroy(),this._state.destroy()}}class Bt extends D{get type(){return"Light"}get isLight(){return!0}constructor(e,t={}){super(e,t)}}class xt extends Bt{get type(){return"DirLight"}constructor(e,t={}){super(e,t),this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const i=this.scene.camera,s=this.scene.canvas;this._onCameraViewMatrix=i.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=i.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=s.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new et({type:"dir",dir:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(this._shadowViewMatrixDirty){this._shadowViewMatrix||(this._shadowViewMatrix=c.identityMat4());const e=this.scene.camera,t=this._state.dir,i=e.look,s=[i[0]-t[0],i[1]-t[1],i[2]-t[2]],r=[0,1,0];c.lookAtMat4v(s,i,r,this._shadowViewMatrix),this._shadowViewMatrixDirty=!1}return this._shadowViewMatrix},getShadowProjMatrix:()=>(this._shadowProjMatrixDirty&&(this._shadowProjMatrix||(this._shadowProjMatrix=c.identityMat4()),c.orthoMat4c(-40,40,-40,40,-40,80,this._shadowProjMatrix),this._shadowProjMatrixDirty=!1),this._shadowProjMatrix),getShadowRenderBuf:()=>(this._shadowRenderBuf||(this._shadowRenderBuf=new Xe(this.scene.canvas.canvas,this.scene.canvas.gl,{size:[1024,1024]})),this._shadowRenderBuf)}),this.dir=t.dir,this.color=t.color,this.intensity=t.intensity,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set dir(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get dir(){return this._state.dir}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}class wt extends Bt{get type(){return"AmbientLight"}constructor(e,t={}){super(e,t),this._state={type:"ambient",color:c.vec3([.7,.7,.7]),intensity:1},this.color=t.color,this.intensity=t.intensity,this.scene._lightCreated(this)}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}get intensity(){return this._state.intensity}destroy(){super.destroy(),this.scene._lightDestroyed(this)}}class Pt extends D{get type(){return"Geometry"}get isGeometry(){return!0}constructor(e,t={}){super(e,t),p.memory.meshes++}destroy(){super.destroy(),p.memory.meshes--}}var Ct=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}();const Mt=function(){const e=c.mat4(),t=c.mat4();return function(i,s){s=s||c.mat4();const r=i[0],o=i[1],n=i[2],a=i[3]-r,l=i[4]-o,A=i[5]-n,h=65535;return c.identityMat4(e),c.translationMat4v(i,e),c.identityMat4(t),c.scalingMat4v([a/h,l/h,A/h],t),c.mulMat4(e,t,s),s}}();var Ft=function(){const e=c.mat4(),t=c.mat4();return function(i,s,r){const o=new Uint16Array(i.length),n=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);let a;for(a=0;a=0?1:-1),t=(1-Math.abs(r))*(o>=0?1:-1);r=e,o=t}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*o+(o<0?-1:0))])}function Dt(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function St(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}const Tt={getPositionsBounds:function(e){const t=new Float32Array(3),i=new Float32Array(3);let s,r;for(s=0;s<3;s++)t[s]=Number.MAX_VALUE,i[s]=-Number.MAX_VALUE;for(s=0;sn&&(r=i,n=o),i=It(e,a,"floor","ceil"),s=Dt(i),o=St(e,a,s),o>n&&(r=i,n=o),i=It(e,a,"ceil","ceil"),s=Dt(i),o=St(e,a,s),o>n&&(r=i,n=o),t[a]=r[0],t[a+1]=r[1];return t},decompressNormals:function(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t},decompressNormal:function(e,t){let i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;const r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t}},Rt=p.memory,Lt=c.AABB3();class Ut extends Pt{get type(){return"ReadableGeometry"}get isReadableGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new et({compressGeometry:!!t.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._edgeIndicesBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._aabbDirty=!0,this._boundingSphere=!0,this._aabb=null,this._aabbDirty=!0,this._obb=null,this._obbDirty=!0;const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(this._state.compressGeometry){const e=Tt.getPositionsBounds(t.positions),s=Tt.compressPositions(t.positions,e.min,e.max);i.positions=s.quantized,i.positionsDecodeMatrix=s.decodeMatrix}else i.positions=t.positions.constructor===Float32Array?t.positions:new Float32Array(t.positions);if(t.colors&&(i.colors=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors)),t.uv)if(this._state.compressGeometry){const e=Tt.getUVBounds(t.uv),s=Tt.compressUVs(t.uv,e.min,e.max);i.uv=s.quantized,i.uvDecodeMatrix=s.decodeMatrix}else i.uv=t.uv.constructor===Float32Array?t.uv:new Float32Array(t.uv);t.normals&&(this._state.compressGeometry?i.normals=Tt.compressNormals(t.normals):i.normals=t.normals.constructor===Float32Array?t.normals:new Float32Array(t.normals)),t.indices&&(i.indices=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)),this._buildHash(),Rt.meshes++,this._buildVBOs()}_buildVBOs(){const e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Rt.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new Re(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Rt.positions+=e.positionsBuf.numItems),e.normals){let i=e.compressGeometry;e.normalsBuf=new Re(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Rt.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new Re(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Rt.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new Re(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Rt.uvs+=e.uvBuf.numItems)}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}_getPickTrianglePositions(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}_getPickTriangleColors(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}_buildEdgeIndices(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=Ct(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Rt.indices+=this._edgeIndicesBuf.numItems}_buildPickTriangleVBOs(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=c.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new Re(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Rt.positions+=this._pickTrianglePositionsBuf.numItems,Rt.colors+=this._pickTriangleColorsBuf.numItems}_buildPickVertexVBOs(){}_webglContextLost(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}_webglContextRestored(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}get primitive(){return this._state.primitiveName}get compressGeometry(){return this._state.compressGeometry}get positions(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),Tt.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null}set positions(e){const t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){const i=Tt.getPositionsBounds(e),s=Tt.compressPositions(e,i.min,i.max);e=s.quantized,t.positionsDecodeMatrix=s.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}get normals(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){const e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),Tt.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}}set normals(e){if(this._state.compressGeometry)return void this.error("can't update geometry normals - quantized geometry is immutable");const t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}get uv(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),Tt.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null}set uv(e){if(this._state.compressGeometry)return void this.error("can't update geometry UVs - quantized geometry is immutable");const t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}get colors(){return this._state.colors}set colors(e){if(this._state.compressGeometry)return void this.error("can't update geometry colors - quantized geometry is immutable");const t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}get indices(){return this._state.indices}get aabb(){return this._aabbDirty&&(this._aabb||(this._aabb=c.AABB3()),c.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}get obb(){return this._obbDirty&&(this._obb||(this._obb=c.OBB3()),c.positions3ToAABB3(this._state.positions,Lt,this._state.positionsDecodeMatrix),c.AABB3ToOBB3(Lt,this._obb),this._obbDirty=!1),this._obb}get numTriangles(){return this._numTriangles}_setAABBDirty(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Rt.meshes--}}function kt(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return _.apply(e,{positions:[c,u,d,l,u,d,l,A,d,c,A,d,c,u,d,c,A,d,c,A,h,c,u,h,c,u,d,c,u,h,l,u,h,l,u,d,l,u,d,l,u,h,l,A,h,l,A,d,l,A,h,c,A,h,c,A,d,l,A,d,c,A,h,l,A,h,l,u,h,c,u,h],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}class Ot extends D{get type(){return"Material"}constructor(e,t={}){super(e,t),p.memory.materials++}destroy(){super.destroy(),p.memory.materials--}}const Nt={opaque:0,mask:1,blend:2},Qt=["opaque","mask","blend"];class Vt extends Ot{get type(){return"PhongMaterial"}constructor(e,t={}){super(e,t),this._state=new et({type:"PhongMaterial",ambient:c.vec3([1,1,1]),diffuse:c.vec3([1,1,1]),specular:c.vec3([1,1,1]),emissive:c.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),this.ambient=t.ambient,this.diffuse=t.diffuse,this.specular=t.specular,this.emissive=t.emissive,this.alpha=t.alpha,this.shininess=t.shininess,this.reflectivity=t.reflectivity,this.lineWidth=t.lineWidth,this.pointSize=t.pointSize,t.ambientMap&&(this._ambientMap=this._checkComponent("Texture",t.ambientMap)),t.diffuseMap&&(this._diffuseMap=this._checkComponent("Texture",t.diffuseMap)),t.specularMap&&(this._specularMap=this._checkComponent("Texture",t.specularMap)),t.emissiveMap&&(this._emissiveMap=this._checkComponent("Texture",t.emissiveMap)),t.alphaMap&&(this._alphaMap=this._checkComponent("Texture",t.alphaMap)),t.reflectivityMap&&(this._reflectivityMap=this._checkComponent("Texture",t.reflectivityMap)),t.normalMap&&(this._normalMap=this._checkComponent("Texture",t.normalMap)),t.occlusionMap&&(this._occlusionMap=this._checkComponent("Texture",t.occlusionMap)),t.diffuseFresnel&&(this._diffuseFresnel=this._checkComponent("Fresnel",t.diffuseFresnel)),t.specularFresnel&&(this._specularFresnel=this._checkComponent("Fresnel",t.specularFresnel)),t.emissiveFresnel&&(this._emissiveFresnel=this._checkComponent("Fresnel",t.emissiveFresnel)),t.alphaFresnel&&(this._alphaFresnel=this._checkComponent("Fresnel",t.alphaFresnel)),t.reflectivityFresnel&&(this._reflectivityFresnel=this._checkComponent("Fresnel",t.reflectivityFresnel)),this.alphaMode=t.alphaMode,this.alphaCutoff=t.alphaCutoff,this.backfaces=t.backfaces,this.frontface=t.frontface,this._makeHash()}_makeHash(){const e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}set ambient(e){let t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get ambient(){return this._state.ambient}set diffuse(e){let t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get diffuse(){return this._state.diffuse}set specular(e){let t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get specular(){return this._state.specular}set emissive(e){let t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}get emissive(){return this._state.emissive}set alpha(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}get alpha(){return this._state.alpha}set shininess(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}get shininess(){return this._state.shininess}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set pointSize(e){this._state.pointSize=e||1,this.glRedraw()}get pointSize(){return this._state.pointSize}set reflectivity(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}get reflectivity(){return this._state.reflectivity}get normalMap(){return this._normalMap}get ambientMap(){return this._ambientMap}get diffuseMap(){return this._diffuseMap}get specularMap(){return this._specularMap}get emissiveMap(){return this._emissiveMap}get alphaMap(){return this._alphaMap}get reflectivityMap(){return this._reflectivityMap}get occlusionMap(){return this._occlusionMap}get diffuseFresnel(){return this._diffuseFresnel}get specularFresnel(){return this._specularFresnel}get emissiveFresnel(){return this._emissiveFresnel}get alphaFresnel(){return this._alphaFresnel}get reflectivityFresnel(){return this._reflectivityFresnel}set alphaMode(e){let t=Nt[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}get alphaMode(){return Qt[this._state.alphaMode]}set alphaCutoff(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}get alphaCutoff(){return this._state.alphaCutoff}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set frontface(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}get frontface(){return this._state.frontface?"ccw":"cw"}destroy(){super.destroy(),this._state.destroy()}}const Ht={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}};class jt extends Ot{get type(){return"EmphasisMaterial"}get presets(){return Ht}constructor(e,t={}){super(e,t),this._state=new et({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),this._preset="default",t.preset?(this.preset=t.preset,void 0!==t.fill&&(this.fill=t.fill),t.fillColor&&(this.fillColor=t.fillColor),void 0!==t.fillAlpha&&(this.fillAlpha=t.fillAlpha),void 0!==t.edges&&(this.edges=t.edges),t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth),void 0!==t.backfaces&&(this.backfaces=t.backfaces),void 0!==t.glowThrough&&(this.glowThrough=t.glowThrough)):(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.backfaces=t.backfaces,this.glowThrough=t.glowThrough)}set fill(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}get fill(){return this._state.fill}set fillColor(e){let t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}get fillColor(){return this._state.fillColor}set fillAlpha(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}get fillAlpha(){return this._state.fillAlpha}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set glowThrough(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}get glowThrough(){return this._state.glowThrough}set preset(e){if(e=e||"default",this._preset===e)return;const t=Ht[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ht).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const Gt={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}};class zt extends Ot{get type(){return"EdgeMaterial"}get presets(){return Gt}constructor(e,t={}){super(e,t),this._state=new et({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),this._preset="default",t.preset?(this.preset=t.preset,t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth)):(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth),this.edges=!1!==t.edges}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=Gt[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Gt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const Wt={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}};class Kt extends D{constructor(e,t={}){super(e,t),this._units="meters",this._scale=1,this._origin=c.vec3([0,0,0]),this.units=t.units,this.scale=t.scale,this.origin=t.origin}get unitsInfo(){return Wt}set units(e){e||(e="meters");Wt[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}get units(){return this._units}set scale(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}get scale(){return this._scale}set origin(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}get origin(){return this._origin}worldToRealPos(e,t=c.vec3(3)){t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}realToWorldPos(e,t=c.vec3(3)){return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}class Xt extends D{constructor(e,t={}){super(e,t),this._supported=we.SUPPORTED_EXTENSIONS.OES_standard_derivatives,this.enabled=t.enabled,this.kernelRadius=t.kernelRadius,this.intensity=t.intensity,this.bias=t.bias,this.scale=t.scale,this.minResolution=t.minResolution,this.numSamples=t.numSamples,this.blur=t.blur,this.blendCutoff=t.blendCutoff,this.blendFactor=t.blendFactor}get supported(){return this._supported}set enabled(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}get enabled(){return this._enabled}get possible(){if(!this._supported)return!1;if(!this._enabled)return!1;const e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}get active(){return this._active}set kernelRadius(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}get kernelRadius(){return this._kernelRadius}set intensity(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}get intensity(){return this._intensity}set bias(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}get bias(){return this._bias}set scale(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}get scale(){return this._scale}set minResolution(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}get minResolution(){return this._minResolution}set numSamples(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}get numSamples(){return this._numSamples}set blur(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}get blur(){return this._blur}set blendCutoff(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}get blendCutoff(){return this._blendCutoff}set blendFactor(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}get blendFactor(){return this._blendFactor}destroy(){super.destroy()}}class Jt extends D{constructor(e,t={}){super(e,t),this.sliceColor=t.sliceColor,this.sliceThickness=t.sliceThickness}set sliceThickness(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}get sliceThickness(){return this._sliceThickness}set sliceColor(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}get sliceColor(){return this._sliceColor}destroy(){super.destroy()}}const Yt={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}};class Zt extends Ot{get type(){return"PointsMaterial"}get presets(){return Yt}constructor(e,t={}){super(e,t),this._state=new et({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),t.preset?(this.preset=t.preset,void 0!==t.pointSize&&(this.pointSize=t.pointSize),void 0!==t.roundPoints&&(this.roundPoints=t.roundPoints),void 0!==t.perspectivePoints&&(this.perspectivePoints=t.perspectivePoints),void 0!==t.minPerspectivePointSize&&(this.minPerspectivePointSize=t.minPerspectivePointSize),void 0!==t.maxPerspectivePointSize&&(this.maxPerspectivePointSize=t.minPerspectivePointSize)):(this._preset="default",this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize),this.filterIntensity=t.filterIntensity,this.minIntensity=t.minIntensity,this.maxIntensity=t.maxIntensity}set pointSize(e){this._state.pointSize=e||2,this.glRedraw()}get pointSize(){return this._state.pointSize}set roundPoints(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}get roundPoints(){return this._state.roundPoints}set perspectivePoints(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}get perspectivePoints(){return this._state.perspectivePoints}set minPerspectivePointSize(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}get minPerspectivePointSize(){return this._state.minPerspectivePointSize}set maxPerspectivePointSize(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}get maxPerspectivePointSize(){return this._state.maxPerspectivePointSize}set filterIntensity(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}get filterIntensity(){return this._state.filterIntensity}set minIntensity(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}get minIntensity(){return this._state.minIntensity}set maxIntensity(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}get maxIntensity(){return this._state.maxIntensity}set preset(e){if(e=e||"default",this._preset===e)return;const t=Yt[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Yt).join(", "))}get preset(){return this._preset}get hash(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}destroy(){super.destroy(),this._state.destroy()}}const qt={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}};class $t extends Ot{get type(){return"LinesMaterial"}get presets(){return qt}constructor(e,t={}){super(e,t),this._state=new et({type:"LinesMaterial",lineWidth:null}),t.preset?(this.preset=t.preset,void 0!==t.lineWidth&&(this.lineWidth=t.lineWidth)):(this._preset="default",this.lineWidth=t.lineWidth)}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=qt[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(qt).join(", "))}get preset(){return this._preset}get hash(){return[""+this.lineWidth].join(";")}destroy(){super.destroy(),this._state.destroy()}}function ei(e,t){const i={};let s,r;for(let o=0,n=t.length;o{this.glRedraw()})),this.canvas.on("webglContextFailed",(()=>{alert("xeokit failed to find WebGL!")})),this._renderer=new Ze(this,{transparent:s,alphaDepthMask:r}),this._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;let e=null;this.getHash=function(){if(e)return e;const t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";const i=[];for(let e=0,s=t;ethis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},this._sectionPlanesState.setNumCachedSectionPlanes(t.numCachedSectionPlanes||0),this._lightsState=new function(){const e=c.vec4([0,0,0,0]),t=c.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];let i=null,s=null;this.getHash=function(){if(i)return i;const e=[],t=this.lights;let s;for(let i=0,r=t.length;i0&&e.push("/lm"),this.reflectionMaps.length>0&&e.push("/rm"),e.push(";"),i=e.join(""),i},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(let t=0,r=this.lights.length;t{this._renderer.imageDirty()}))}_initDefaults(){}_addComponent(e){if(e.id&&this.components[e.id]&&(this.error("Component "+_.inQuotes(e.id)+" already exists in Scene - ignoring ID, will randomly-generate instead"),e.id=null),!e.id)for(void 0===window.nextID&&(window.nextID=0),e.id="__"+window.nextID++;this.components[e.id];)e.id=c.createUUID();this.components[e.id]=e;const t=e.type;let i=this.types[e.type];i||(i=this.types[t]={}),i[e.id]=e,e.compile&&(this._compilables[e.id]=e),e.isDrawable&&(this._renderer.addDrawable(e.id,e),this._collidables[e.id]=e)}_removeComponent(e){var t=e.id,i=e.type;delete this.components[t];const s=this.types[i];s&&(delete s[t],_.isEmptyObject(s)&&delete this.types[i]),e.compile&&delete this._compilables[e.id],e.isDrawable&&(this._renderer.removeDrawable(e.id),delete this._collidables[e.id])}_sectionPlaneCreated(e){this.sectionPlanes[e.id]=e,this.scene._sectionPlanesState.addSectionPlane(e._state),this.scene.fire("sectionPlaneCreated",e,!0),this._needRecompile=!0}_bitmapCreated(e){this.bitmaps[e.id]=e,this.scene.fire("bitmapCreated",e,!0)}_lineSetCreated(e){this.lineSets[e.id]=e,this.scene.fire("lineSetCreated",e,!0)}_lightCreated(e){this.lights[e.id]=e,this.scene._lightsState.addLight(e._state),this._needRecompile=!0}_lightMapCreated(e){this.lightMaps[e.id]=e,this.scene._lightsState.addLightMap(e._state),this._needRecompile=!0}_reflectionMapCreated(e){this.reflectionMaps[e.id]=e,this.scene._lightsState.addReflectionMap(e._state),this._needRecompile=!0}_sectionPlaneDestroyed(e){delete this.sectionPlanes[e.id],this.scene._sectionPlanesState.removeSectionPlane(e._state),this.scene.fire("sectionPlaneDestroyed",e,!0),this._needRecompile=!0}_bitmapDestroyed(e){delete this.bitmaps[e.id],this.scene.fire("bitmapDestroyed",e,!0)}_lineSetDestroyed(e){delete this.lineSets[e.id],this.scene.fire("lineSetDestroyed",e,!0)}_lightDestroyed(e){delete this.lights[e.id],this.scene._lightsState.removeLight(e._state),this._needRecompile=!0}_lightMapDestroyed(e){delete this.lightMaps[e.id],this.scene._lightsState.removeLightMap(e._state),this._needRecompile=!0}_reflectionMapDestroyed(e){delete this.reflectionMaps[e.id],this.scene._lightsState.removeReflectionMap(e._state),this._needRecompile=!0}_registerModel(e){this.models[e.id]=e,this._modelIds=null}_deregisterModel(e){const t=e.id;delete this.models[t],this._modelIds=null,this.fire("modelUnloaded",t)}_registerObject(e){this.objects[e.id]=e,this._numObjects++,this._objectIds=null}_deregisterObject(e){delete this.objects[e.id],this._numObjects--,this._objectIds=null}_objectVisibilityUpdated(e,t=!0){e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}_deRegisterVisibleObject(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}_objectXRayedUpdated(e,t=!0){e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}_deRegisterXRayedObject(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}_objectHighlightedUpdated(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}_deRegisterHighlightedObject(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}_objectSelectedUpdated(e,t=!0){e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}_deRegisterSelectedObject(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}_objectColorizeUpdated(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}_deRegisterColorizedObject(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}_objectOpacityUpdated(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}_deRegisterOpacityObject(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}_objectOffsetUpdated(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}_deRegisterOffsetObject(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}_webglContextLost(){this.canvas.spinner.processes++;for(const e in this.components)if(this.components.hasOwnProperty(e)){const t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}_webglContextRestored(){const e=this.canvas.gl;for(const t in this.components)if(this.components.hasOwnProperty(t)){const i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}get capabilities(){return this._renderer.capabilities}get entityOffsetsEnabled(){return this._entityOffsetsEnabled}get pickSurfacePrecisionEnabled(){return!1}get logarithmicDepthBufferEnabled(){return this._logarithmicDepthBufferEnabled}set numCachedSectionPlanes(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}get numCachedSectionPlanes(){return this._sectionPlanesState.getNumCachedSectionPlanes()}set pbrEnabled(e){this._pbrEnabled=!!e,this.glRedraw()}get pbrEnabled(){return this._pbrEnabled}set dtxEnabled(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}get dtxEnabled(){return this._dtxEnabled}set colorTextureEnabled(e){this._colorTextureEnabled=!!e,this.glRedraw()}get colorTextureEnabled(){return this._colorTextureEnabled}doOcclusionTest(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}render(e){e&&M.runTasks();const t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),!e&&!this._renderer.needsRender())return;t.sceneId=this.id;const i=this._passes,s=this._clearEachPass;let r,o;for(r=0;rr&&(r=e[3]),e[4]>o&&(o=e[4]),e[5]>n&&(n=e[5]),A=!0}A||(t=-100,i=-100,s=-100,r=100,o=100,n=100),this._aabb[0]=t,this._aabb[1]=i,this._aabb[2]=s,this._aabb[3]=r,this._aabb[4]=o,this._aabb[5]=n,this._aabbDirty=!1}return this._aabb}_setAABBDirty(){this._aabbDirty=!0,this.fire("boundary")}pick(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");const i=e.includeEntities||e.include;i&&(e.includeEntityIds=ei(this,i));const s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=ei(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}snapPick(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}clear(){var e;for(const t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}clearLights(){const e=Object.keys(this.lights);for(let t=0,i=e.length;t{if(e.collidable){const l=e.aabb;l[0]o&&(o=l[3]),l[4]>n&&(n=l[4]),l[5]>a&&(a=l[5]),t=!0}})),t){const e=c.AABB3();return e[0]=i,e[1]=s,e[2]=r,e[3]=o,e[4]=n,e[5]=a,e}return this.aabb}setObjectsVisible(e,t){return this.withObjects(e,(e=>{const i=e.visible!==t;return e.visible=t,i}))}setObjectsCollidable(e,t){return this.withObjects(e,(e=>{const i=e.collidable!==t;return e.collidable=t,i}))}setObjectsCulled(e,t){return this.withObjects(e,(e=>{const i=e.culled!==t;return e.culled=t,i}))}setObjectsSelected(e,t){return this.withObjects(e,(e=>{const i=e.selected!==t;return e.selected=t,i}))}setObjectsHighlighted(e,t){return this.withObjects(e,(e=>{const i=e.highlighted!==t;return e.highlighted=t,i}))}setObjectsXRayed(e,t){return this.withObjects(e,(e=>{const i=e.xrayed!==t;return e.xrayed=t,i}))}setObjectsEdges(e,t){return this.withObjects(e,(e=>{const i=e.edges!==t;return e.edges=t,i}))}setObjectsColorized(e,t){return this.withObjects(e,(e=>{e.colorize=t}))}setObjectsOpacity(e,t){return this.withObjects(e,(e=>{const i=e.opacity!==t;return e.opacity=t,i}))}setObjectsPickable(e,t){return this.withObjects(e,(e=>{const i=e.pickable!==t;return e.pickable=t,i}))}setObjectsOffset(e,t){this.withObjects(e,(e=>{e.offset=t}))}withObjects(e,t){_.isString(e)&&(e=[e]);let i=!1;for(let s=0,r=e.length;s{r>s&&(s=r,e(...i))}));return this._tickifiedFunctions[t]={tickSubId:n,wrapperFunc:o},o}destroy(){super.destroy();for(const e in this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}const ii=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,o=e._state.billboard,n=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,A=[];A.push("#version 300 es"),A.push("// Lambertian drawing vertex shader"),A.push("in vec3 position;"),A.push("uniform mat4 modelMatrix;"),A.push("uniform mat4 viewMatrix;"),A.push("uniform mat4 projMatrix;"),A.push("uniform vec4 colorize;"),A.push("uniform vec3 offset;"),l&&A.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(A.push("uniform float logDepthBufFC;"),A.push("out float vFragDepth;"),A.push("bool isPerspectiveMatrix(mat4 m) {"),A.push(" return (m[2][3] == - 1.0);"),A.push("}"),A.push("out float isPerspective;"));a&&A.push("out vec4 vWorldPosition;");if(A.push("uniform vec4 lightAmbient;"),A.push("uniform vec4 materialColor;"),A.push("uniform vec3 materialEmissive;"),r.normalsBuf){A.push("in vec3 normal;"),A.push("uniform mat4 modelNormalMatrix;"),A.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=s.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),A.push(" }"),A.push(" return normalize(v);"),A.push("}"))}A.push("out vec4 vColor;"),"points"===r.primitiveName&&A.push("uniform float pointSize;");"spherical"!==o&&"cylindrical"!==o||(A.push("void billboard(inout mat4 mat) {"),A.push(" mat[0][0] = 1.0;"),A.push(" mat[0][1] = 0.0;"),A.push(" mat[0][2] = 0.0;"),"spherical"===o&&(A.push(" mat[1][0] = 0.0;"),A.push(" mat[1][1] = 1.0;"),A.push(" mat[1][2] = 0.0;")),A.push(" mat[2][0] = 0.0;"),A.push(" mat[2][1] = 0.0;"),A.push(" mat[2][2] =1.0;"),A.push("}"));A.push("void main(void) {"),A.push("vec4 localPosition = vec4(position, 1.0); "),A.push("vec4 worldPosition;"),l&&A.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?A.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):A.push("vec4 localNormal = vec4(normal, 0.0); "),A.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),A.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));A.push("mat4 viewMatrix2 = viewMatrix;"),A.push("mat4 modelMatrix2 = modelMatrix;"),n&&A.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(A.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),A.push("billboard(modelMatrix2);"),A.push("billboard(viewMatrix2);"),A.push("billboard(modelViewMatrix);"),r.normalsBuf&&(A.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),A.push("billboard(modelNormalMatrix2);"),A.push("billboard(viewNormalMatrix2);"),A.push("billboard(modelViewNormalMatrix);")),A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&A.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(A.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),A.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),A.push("float lambertian = 1.0;"),r.normalsBuf)for(let e=0,t=s.lights.length;e0,o=t.gammaOutput,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}"points"===s.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");o?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(e)):(this.vertex=function(e){const t=e.scene;e._material;const i=e._state,s=t._sectionPlanesState,r=e._geometry._state,o=t._lightsState;let n;const a=i.billboard,l=i.background,A=i.stationary,h=function(e){if(!e._geometry._state.uvBuf)return!1;const t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=oi(e),u=s.getNumAllocatedSectionPlanes()>0,d=ri(e),p=!!r.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),u&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(let e=0,t=o.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}h&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));r.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===r.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(let e=0,t=o.lights.length;e0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(let e=0,t=o.lights.length;e0,l=oi(e),A=s.uvBuf,h="PhongMaterial"===n.type,c="MetallicMaterial"===n.type,u="SpecularMaterial"===n.type,d=ri(e);t.gammaInput;const p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var g=0;g0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),o.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),h&&((o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = "+si[o.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||u)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),o.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+si[o.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(o.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));n.ambient&&f.push("uniform vec3 materialAmbient;");n.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==n.alpha&&null!==n.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");n.emissive&&f.push("uniform vec3 materialEmissive;");n.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==n.glossiness&&null!==n.glossiness&&f.push("uniform float materialGlossiness;");void 0!==n.shininess&&null!==n.shininess&&f.push("uniform float materialShininess;");n.specular&&f.push("uniform vec3 materialSpecular;");void 0!==n.metallic&&null!==n.metallic&&f.push("uniform float materialMetallic;");void 0!==n.roughness&&null!==n.roughness&&f.push("uniform float materialRoughness;");void 0!==n.specularF0&&null!==n.specularF0&&f.push("uniform float materialSpecularF0;");A&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));A&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));A&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));A&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&A&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&A&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&A&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));A&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));A&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&A&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&A&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&A&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(let e=0,t=o.lights.length;e 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),n.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");n.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):n.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");n.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");n.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==n.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==n.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==n.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==n.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==n.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));A&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+si[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));A&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+si[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));A&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+si[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));A&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+si[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));A&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));A&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(o.lights.length>0||o.lightMaps.length>0||o.reflectionMaps.length>0)){A&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),A&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),A&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),A&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),A&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),A&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),A&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),h&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),u&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),o.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),h&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(u||c)&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(let e=0,t=o.lights.length;e0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(h=0,c=o.sectionPlanes.length;h0&&r.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,r.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),r.reflectionMaps.length>0&&r.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,r.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),this._uGammaFactor&&s.uniform1f(this._uGammaFactor,i.gammaFactor),this._baseTextureUnit=e.textureUnit};class hi{constructor(e){this.vertex=function(e){const t=e.scene,i=t._lightsState,s=function(e){const t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,o=!!e._geometry._state.compressGeometry,n=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),o&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===n||"cylindrical"===n)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===n&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),o&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(o?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(let e=0,t=i.lights.length;e0,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}"points"===e._geometry._state.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const ci=new e({}),ui=c.vec3(),di=function(e,t){this.id=ci.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new hi(t),this._allocate(t)},pi={};di.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=pi[t];return i||(i=new di(t,e),pi[t]=i,p.memory.programs++),i._useCount++,i},di.prototype.put=function(){0==--this._useCount&&(ci.removeItem(this.id),this._program&&this._program.destroy(),delete pi[this._hash],p.memory.programs--)},di.prototype.webglContextRestored=function(){this._program=null},di.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl,n=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,A=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,A?e.getRTCViewMatrix(a.originHash,A):r.viewMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Edges drawing vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec4 edgeColor;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));i&&n.push("out vec4 vWorldPosition;");n.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));n.push("vColor = edgeColor;"),i&&n.push("vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,o=[];o.push("#version 300 es"),o.push("// Edges drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const gi=new e({}),mi=c.vec3(),_i=function(e,t){this.id=gi.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new fi(t),this._allocate(t)},vi={};_i.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=vi[t];return i||(i=new _i(t,e),vi[t]=i,p.memory.programs++),i._useCount++,i},_i.prototype.put=function(){0==--this._useCount&&(gi.removeItem(this.id),this._program&&this._program.destroy(),delete vi[this._hash],p.memory.programs--)},_i.prototype.webglContextRestored=function(){this._program=null},_i.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl;let n;const a=t._state,l=t._geometry,A=l._state,h=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,h?e.getRTCViewMatrix(a.originHash,h):r.viewMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh picking vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("out vec4 vViewPosition;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("uniform vec2 pickClipPos;"),n.push("vec4 remapClipPos(vec4 clipPos) {"),n.push(" clipPos.xy /= clipPos.w;"),n.push(" clipPos.xy -= pickClipPos;"),n.push(" clipPos.xy *= clipPos.w;"),n.push(" return clipPos;"),n.push("}"),n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"));n.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = remapClipPos(clipPos);"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(e)}}const yi=c.vec3(),Bi=function(e,t){this._hash=e,this._shaderSource=new bi(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},xi={};Bi.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let i=xi[t];if(!i){if(i=new Bi(t,e),i.errors)return console.log(i.errors.join("\n")),null;xi[t]=i,p.memory.programs++}return i._useCount++,i},Bi.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete xi[this._hash],p.memory.programs--)},Bi.prototype.webglContextRestored=function(){this._program=null},Bi.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t>24&255,h=l>>16&255,c=l>>8&255,u=255&l;s.uniform4f(this._uPickColor,u/255,c/255,h/255,A/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),n.indicesBuf?(s.drawElements(n.primitive,n.indicesBuf.numItems,n.indicesBuf.itemType,0),e.drawElements++):n.positions&&s.drawArrays(s.TRIANGLES,0,n.positions.numItems)},Bi.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Te(i,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(e)}}const Pi=c.vec3(),Ci=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new wi(t),this._allocate(t)},Mi={};Ci.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Mi[t];if(!i){if(i=new Ci(t,e),i.errors)return console.log(i.errors.join("\n")),null;Mi[t]=i,p.memory.programs++}return i._useCount++,i},Ci.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Mi[this._hash],p.memory.programs--)},Ci.prototype.webglContextRestored=function(){this._program=null},Ci.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry,a=t._geometry._state,l=t.origin,A=o.backfaces,h=o.frontface,c=i.camera.project,u=n._getPickTrianglePositions(),d=n._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){const e=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,e)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh occlusion vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(e)}}const Ei=c.vec3(),Ii=function(e,t){this._hash=e,this._shaderSource=new Fi(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Di={};Ii.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";");let i=Di[t];if(!i){if(i=new Ii(t,e),i.errors)return console.log(i.errors.join("\n")),null;Di[t]=i,p.memory.programs++}return i._useCount++,i},Ii.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Di[this._hash],p.memory.programs--)},Ii.prototype.webglContextRestored=function(){this._program=null},Ii.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._material._state,o=t._state,n=t._geometry._state,a=t.origin;if(r.alpha<1)return;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){const t=r.backfaces;e.backfaces!==t&&(t?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=t);const i=r.frontface;e.frontface!==i&&(i?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=i),this._lastMaterialId=r.id}const l=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(o.originHash,a):l.viewMatrix),o.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(e),this.fragment=function(e){const t=e.scene;t.canvas.gl;const i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(e)}}const Ti=function(e,t){this._hash=e,this._shaderSource=new Si(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Ri={};Ti.get=function(e){const t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let s=Ri[i];if(!s){if(s=new Ti(i,e),s.errors)return console.log(s.errors.join("\n")),null;Ri[i]=s,p.memory.programs++}return s._useCount++,s},Ti.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Ri[this._hash],p.memory.programs--)},Ti.prototype.webglContextRestored=function(){this._program=null},Ti.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){const t=s.backfaces;e.backfaces!==t&&(t?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=t);const r=s.frontface;e.frontface!==r&&(r?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=r),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){const s=t.vertexBufs;s.id!==this._lastVertexBufsId&&(s.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(s.positionsBuf,s.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=s.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},Ti.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Te(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0){let e,t,r,o,n;for(let a=0,l=this._uSectionPlanes.length;a0)for(let i=0;i0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this.glRedraw()}}const Ki=function(){const e=c.vec3(),t=c.vec3(),i=c.vec3(),s=c.vec3(),r=c.vec3(),o=c.vec3(),n=c.vec4(),a=c.vec3(),l=c.vec3(),A=c.vec3(),h=c.vec3(),u=c.vec3(),d=c.vec3(),p=c.vec3(),f=c.vec3(),g=c.vec3(),m=c.vec4(),_=c.vec4(),v=c.vec4(),b=c.vec3(),y=c.vec3(),B=c.vec3(),x=c.vec3(),w=c.vec3(),P=c.vec3(),C=c.vec3(),M=c.vec3(),F=c.vec3(),E=c.vec3(),I=c.vec3();return function(D,S,T,R){var L=R.primIndex;if(null!=L&&L>-1){const N=D.geometry._state,Q=D.scene,V=Q.camera,H=Q.canvas;if("triangles"===N.primitiveName){R.primitive="triangle";const Q=L,G=N.indices,z=N.positions;let W,K,X;if(G){var U=G[Q+0],k=G[Q+1],O=G[Q+2];o[0]=U,o[1]=k,o[2]=O,R.indices=o,W=3*U,K=3*k,X=3*O}else W=3*Q,K=W+3,X=K+3;if(i[0]=z[W+0],i[1]=z[W+1],i[2]=z[W+2],s[0]=z[K+0],s[1]=z[K+1],s[2]=z[K+2],r[0]=z[X+0],r[1]=z[X+1],r[2]=z[X+2],N.compressGeometry){const e=N.positionsDecodeMatrix;e&&(Tt.decompressPosition(i,e,i),Tt.decompressPosition(s,e,s),Tt.decompressPosition(r,e,r))}R.canvasPos?c.canvasPosToLocalRay(H.canvas,D.origin?j(S,D.origin):S,T,D.worldMatrix,R.canvasPos,e,t):R.origin&&R.direction&&c.worldRayToLocalRay(D.worldMatrix,R.origin,R.direction,e,t),c.normalizeVec3(t),c.rayPlaneIntersect(e,t,i,s,r,n),R.localPos=n,R.position=n,m[0]=n[0],m[1]=n[1],m[2]=n[2],m[3]=1,c.transformVec4(D.worldMatrix,m,_),a[0]=_[0],a[1]=_[1],a[2]=_[2],R.canvasPos&&D.origin&&(a[0]+=D.origin[0],a[1]+=D.origin[1],a[2]+=D.origin[2]),R.worldPos=a,c.transformVec4(V.matrix,_,v),l[0]=v[0],l[1]=v[1],l[2]=v[2],R.viewPos=l,c.cartesianToBarycentric(n,i,s,r,A),R.bary=A;const J=N.normals;if(J){if(N.compressGeometry){const e=3*U,t=3*k,i=3*O;Tt.decompressNormal(J.subarray(e,e+2),h),Tt.decompressNormal(J.subarray(t,t+2),u),Tt.decompressNormal(J.subarray(i,i+2),d)}else h[0]=J[W],h[1]=J[W+1],h[2]=J[W+2],u[0]=J[K],u[1]=J[K+1],u[2]=J[K+2],d[0]=J[X],d[1]=J[X+1],d[2]=J[X+2];const e=c.addVec3(c.addVec3(c.mulVec3Scalar(h,A[0],b),c.mulVec3Scalar(u,A[1],y),B),c.mulVec3Scalar(d,A[2],x),w);R.worldNormal=c.normalizeVec3(c.transformVec3(D.worldNormalMatrix,e,P))}const Y=N.uv;if(Y){if(p[0]=Y[2*U],p[1]=Y[2*U+1],f[0]=Y[2*k],f[1]=Y[2*k+1],g[0]=Y[2*O],g[1]=Y[2*O+1],N.compressGeometry){const e=N.uvDecodeMatrix;e&&(Tt.decompressUV(p,e,p),Tt.decompressUV(f,e,f),Tt.decompressUV(g,e,g))}R.uv=c.addVec3(c.addVec3(c.mulVec2Scalar(p,A[0],C),c.mulVec2Scalar(f,A[1],M),F),c.mulVec2Scalar(g,A[2],E),I)}}}}}();function Xi(e={}){let t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);let i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);let s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);let r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);let o=e.heightSegments||1;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),o<1&&(o=1);const n=!!e.openEnded;let a=e.center;const l=a?a[0]:0,A=a?a[1]:0,h=a?a[2]:0,c=s/2,u=s/o,d=2*Math.PI/r,p=1/r,f=(t-i)/o,g=[],m=[],v=[],b=[];let y,B,x,w,P,C,M,F,E,I,D;const S=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(y=0;y<=o;y++)for(P=t-y*f,C=c-y*u,B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),m.push(P*x),m.push(S),m.push(P*w),v.push(B*p),v.push(1*y/o),g.push(P*x+l),g.push(C+A),g.push(P*w+h);for(y=0;y0){for(E=g.length/3,m.push(0),m.push(1),m.push(0),v.push(.5),v.push(.5),g.push(0+l),g.push(c+A),g.push(0+h),B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(t*x),m.push(1),m.push(t*w),v.push(I),v.push(D),g.push(t*x+l),g.push(c+A),g.push(t*w+h);for(B=0;B0){for(E=g.length/3,m.push(0),m.push(-1),m.push(0),v.push(.5),v.push(.5),g.push(0+l),g.push(0-c+A),g.push(0+h),B=0;B<=r;B++)x=Math.sin(B*d),w=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(i*x),m.push(-1),m.push(i*w),v.push(I),v.push(D),g.push(i*x+l),g.push(0-c+A),g.push(i*w+h);for(B=0;B":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function Zi(e={}){var t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],o=e.size||1,n=[],a=[],l=e.text;_.isNumeric(l)&&(l=""+l);for(var A,h,c,u,d,p,f,g,m,v=(l||"").split("\n"),b=0,y=0,B=.04,x=0;x0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this._children.length){const e=this._children.splice();let t;for(let i=0,s=e.length;i1;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const o=gs(i,this.wrapS);o&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,o);const n=gs(i,this.wrapT);if(n&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,n),this.type===i.TEXTURE_3D||this.type===i.TEXTURE_2D_ARRAY){const e=gs(i,this.wrapR);e&&i.texParameteri(this.target,i.TEXTURE_WRAP_R,e),i.texParameteri(this.type,i.TEXTURE_WRAP_R,e)}r?(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,bs(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,bs(i,this.magFilter))):(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,gs(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,gs(i,this.magFilter)));const a=gs(i,this.format,this.encoding),l=gs(i,this.type),A=vs(i,this.internalFormat,a,l,this.encoding,!1);i.texStorage2D(i.TEXTURE_2D,s,A,e[0].width,e[0].height);for(let t=0,s=e.length;t>t;return e+1}class ws extends D{get type(){return"Texture"}constructor(e,t={}){super(e,t),this._state=new et({texture:new _s({gl:this.scene.canvas.gl}),matrix:c.identityMat4(),hasMatrix:t.translate&&(0!==t.translate[0]||0!==t.translate[1])||!!t.rotate||t.scale&&(0!==t.scale[0]||0!==t.scale[1]),minFilter:this._checkMinFilter(t.minFilter),magFilter:this._checkMagFilter(t.magFilter),wrapS:this._checkWrapS(t.wrapS),wrapT:this._checkWrapT(t.wrapT),flipY:this._checkFlipY(t.flipY),encoding:this._checkEncoding(t.encoding)}),this._src=null,this._image=null,this._translate=c.vec2([0,0]),this._scale=c.vec2([1,1]),this._rotate=c.vec2([0,0]),this._matrixDirty=!1,this.translate=t.translate,this.scale=t.scale,this.rotate=t.rotate,t.src?this.src=t.src:t.image&&(this.image=t.image),p.memory.textures++}_checkMinFilter(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}_checkMagFilter(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}_checkWrapS(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkWrapT(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this._state.texture=new _s({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}_update(){const e=this._state;if(this._matrixDirty){let t,i;0===this._translate[0]&&0===this._translate[1]||(t=c.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(i=c.scalingMat4v([this._scale[0],this._scale[1],1]),t=t?c.mulMat4(t,i):i),0!==this._rotate&&(i=c.rotationMat4v(.0174532925*this._rotate,[0,0,1]),t=t?c.mulMat4(t,i):i),t&&(e.matrix=t),this._matrixDirty=!1}this.glRedraw()}set image(e){this._image=ys(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}get image(){return this._image}set src(e){this.scene.loading++,this.scene.canvas.spinner.processes++;const t=this;let i=new Image;i.onload=function(){i=ys(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}get src(){return this._src}set translate(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}get translate(){return this._translate}set scale(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}get scale(){return this._scale}set rotate(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}get rotate(){return this._rotate}get minFilter(){return this._state.minFilter}get magFilter(){return this._state.magFilter}get wrapS(){return this._state.wrapS}get wrapT(){return this._state.wrapT}get flipY(){return this._state.flipY}get encoding(){return this._state.encoding}destroy(){super.destroy(),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),p.memory.textures--}}const Ps=p.memory,Cs=c.AABB3();class Ms extends Pt{get type(){return"VBOGeometry"}get isVBOGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new et({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._aabb=null,this._obb=c.OBB3();const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(t.indices){var r;if(t.positionsDecodeMatrix);else{const e=Tt.getPositionsBounds(t.positions),o=Tt.compressPositions(t.positions,e.min,e.max);r=o.quantized,i.positionsDecodeMatrix=o.decodeMatrix,i.positionsBuf=new Re(s,s.ARRAY_BUFFER,r,r.length,3,s.STATIC_DRAW),Ps.positions+=i.positionsBuf.numItems,c.positions3ToAABB3(t.positions,this._aabb),c.positions3ToAABB3(r,Cs,i.positionsDecodeMatrix),c.AABB3ToOBB3(Cs,this._obb)}if(t.colors){const e=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors);i.colorsBuf=new Re(s,s.ARRAY_BUFFER,e,e.length,4,s.STATIC_DRAW),Ps.colors+=i.colorsBuf.numItems}if(t.uv){const e=Tt.getUVBounds(t.uv),r=Tt.compressUVs(t.uv,e.min,e.max),o=r.quantized;i.uvDecodeMatrix=r.decodeMatrix,i.uvBuf=new Re(s,s.ARRAY_BUFFER,o,o.length,2,s.STATIC_DRAW),Ps.uvs+=i.uvBuf.numItems}if(t.normals){const e=Tt.compressNormals(t.normals);let r=i.compressGeometry;i.normalsBuf=new Re(s,s.ARRAY_BUFFER,e,e.length,3,s.STATIC_DRAW,r),Ps.normals+=i.normalsBuf.numItems}{const e=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices);i.indicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,e,e.length,1,s.STATIC_DRAW),Ps.indices+=i.indicesBuf.numItems;const o=Ct(r,e,i.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,o,o.length,1,s.STATIC_DRAW),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)}this._buildHash(),Ps.meshes++}else this.error("Config expected: indices");else this.error("Config expected: positions")}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf}get primitive(){return this._state.primitiveName}get aabb(){return this._aabb}get obb(){return this._obb}get numTriangles(){return this._numTriangles}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Ps.meshes--}}var Fs={};function Es(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return _.apply(e,{primitive:"lines",positions:[l,A,h,l,A,d,l,u,h,l,u,d,c,A,h,c,A,d,c,u,h,c,u,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function Is(e={}){let t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);let i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1),t=t||10,i=i||10;const s=t/i,r=t/2,o=[],n=[];let a=0;for(let e=0,t=-r;e<=i;e++,t+=s)o.push(-r),o.push(0),o.push(t),o.push(r),o.push(0),o.push(t),o.push(t),o.push(0),o.push(-r),o.push(t),o.push(0),o.push(r),n.push(a++),n.push(a++),n.push(a++),n.push(a++);return _.apply(e,{primitive:"lines",positions:o,indices:n})}function Ds(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);let s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);let r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);const o=e.center,n=o?o[0]:0,a=o?o[1]:0,l=o?o[2]:0,A=t/2,h=i/2,c=Math.floor(s)||1,u=Math.floor(r)||1,d=c+1,p=u+1,f=t/c,g=i/u,m=new Float32Array(d*p*3),v=new Float32Array(d*p*3),b=new Float32Array(d*p*2);let y,B,x,w,P,C,M,F=0,E=0;for(y=0;y65535?Uint32Array:Uint16Array)(c*u*6);for(y=0;y360&&(o=360);const n=e.center;let a=n?n[0]:0,l=n?n[1]:0;const A=n?n[2]:0,h=[],u=[],d=[],p=[];let f,g,m,v,b,y,B,x,w,P,C,M;for(x=0;x<=r;x++)for(B=0;B<=s;B++)f=B/s*o,g=.785398+x/r*Math.PI*2,a=t*Math.cos(f),l=t*Math.sin(f),m=(t+i*Math.cos(g))*Math.cos(f),v=(t+i*Math.cos(g))*Math.sin(f),b=i*Math.sin(g),h.push(m+a),h.push(v+l),h.push(b+A),d.push(1-B/s),d.push(x/r),y=c.normalizeVec3(c.subVec3([m,v,b],[a,l,A],[]),[]),u.push(y[0]),u.push(y[1]),u.push(y[2]);for(x=1;x<=r;x++)for(B=1;B<=s;B++)w=(s+1)*x+B-1,P=(s+1)*(x-1)+B-1,C=(s+1)*(x-1)+B,M=(s+1)*x+B,p.push(w),p.push(P),p.push(C),p.push(C),p.push(M),p.push(w);return _.apply(e,{positions:h,normals:u,uv:d,indices:p})}function Ts(e={}){if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";let t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";let i=[];for(let e=0;e>8},Fs.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},Fs.parse={},Fs.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),Ao&&(o=A),hn&&(n=h)}return{min:{x:t,y:i,z:s},max:{x:r,y:o,z:n}}};class Rs extends D{constructor(e,t={}){super(e,t),this._type=t.type||(t.src?t.src.split(".").pop():null)||"jpg",this._pos=c.vec3(t.pos||[0,0,0]),this._up=c.vec3(t.up||[0,1,0]),this._normal=c.vec3(t.normal||[0,0,1]),this._height=t.height||1,this._origin=c.vec3(),this._rtcPos=c.vec3(),this._imageSize=c.vec2(),this._texture=new ws(this,{flipY:!0}),this._image=new Image,"jpg"!==this._type&&"png"!==this._type&&(this.error('Unsupported type - defaulting to "jpg"'),this._type="jpg"),this._node=new ls(this,{matrix:c.inverseMat4(c.lookAtMat4v(this._pos,c.subVec3(this._pos,this._normal,c.mat4()),this._up,c.mat4())),children:[this._bitmapMesh=new Wi(this,{scale:[1,1,1],rotation:[-90,0,0],collidable:t.collidable,pickable:t.pickable,opacity:t.opacity,clippable:t.clippable,geometry:new Ut(this,Ds({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0})})]}),t.image?this.image=t.image:t.src?this.src=t.src:t.imageData&&(this.imageData=t.imageData),this.scene._bitmapCreated(this)}set visible(e){this._bitmapMesh.visible=e}get visible(){return this._bitmapMesh.visible}set image(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}get image(){return this._image}set src(e){if(e){this._image.onload=()=>{this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale()},this._image.src=e;switch(e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}}get src(){return this._image.src}set imageData(e){this._image.onload=()=>{this._texture.image=image,this._imageSize[0]=image.width,this._imageSize[1]=image.height,this._updateBitmapMeshScale()},this._image.src=e}get imageData(){const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")}set type(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}get type(){return this._type}get pos(){return this._pos}get normal(){return this._normal}get up(){return this._up}set height(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}get height(){return this._height}set collidable(e){this._bitmapMesh.collidable=!1!==e}get collidable(){return this._bitmapMesh.collidable}set clippable(e){this._bitmapMesh.clippable=!1!==e}get clippable(){return this._bitmapMesh.clippable}set pickable(e){this._bitmapMesh.pickable=!1!==e}get pickable(){return this._bitmapMesh.pickable}set opacity(e){this._bitmapMesh.opacity=e}get opacity(){return this._bitmapMesh.opacity}destroy(){super.destroy(),this.scene._bitmapDestroyed(this)}_updateBitmapMeshScale(){const e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}const Ls=c.OBB3(),Us=c.OBB3(),ks=c.OBB3();class Os{constructor(e,t,i,s,r,o,n=null,a=0){this.model=e,this.object=null,this.parent=null,this.transform=r,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=t,this.obb=null,this._aabbLocal=null,this._aabbWorld=c.AABB3(),this._aabbWorldDirty=!1,this.layer=n,this.portionId=a,this._color=new Uint8Array([i[0],i[1],i[2],s]),this._colorize=new Uint8Array([i[0],i[1],i[2],s]),this._colorizing=!1,this._transparent=s<255,this.numTriangles=0,this.origin=null,this.entity=null,r&&r._addMesh(this)}_sceneModelDirty(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}_transformDirty(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}_updateMatrix(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}_finalize(e){this.layer.initFlags(this.portionId,e,this._transparent)}_finalize2(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}_setVisible(e){this.layer.setVisible(this.portionId,e,this._transparent)}_setColor(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}_setColorize(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}_setOpacity(e,t){const i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}_setOffset(e){this.layer.setOffset(this.portionId,e)}_setHighlighted(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}_setXRayed(e){this.layer.setXRayed(this.portionId,e,this._transparent)}_setSelected(e){this.layer.setSelected(this.portionId,e,this._transparent)}_setEdges(e){this.layer.setEdges(this.portionId,e,this._transparent)}_setClippable(e){this.layer.setClippable(this.portionId,e,this._transparent)}_setCollidable(e){this.layer.setCollidable(this.portionId,e)}_setPickable(e){this.layer.setPickable(this.portionId,e,this._transparent)}_setCulled(e){this.layer.setCulled(this.portionId,e,this._transparent)}canPickTriangle(){return!1}drawPickTriangles(e,t){}pickTriangleSurface(e){}precisionRayPickSurface(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}canPickWorldPos(){return!0}drawPickDepths(e){this.model.drawPickDepths(e)}drawPickNormals(e){this.model.drawPickNormals(e)}delegatePickedEntity(){return this.parent}getEachVertex(e){this.layer.getEachVertex(this.portionId,e)}set aabb(e){this._aabbLocal=e}get aabb(){if(this._aabbWorldDirty){if(c.AABB3ToOBB3(this._aabbLocal,Ls),this.transform?(c.transformOBB3(this.transform.worldMatrix,Ls,Us),c.transformOBB3(this.model.worldMatrix,Us,ks),c.OBB3ToAABB3(ks,this._aabbWorld)):(c.transformOBB3(this.model.worldMatrix,Ls,Us),c.OBB3ToAABB3(Us,this._aabbWorld)),this.origin){const e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld}_destroy(){this.model.scene._renderer.putPickID(this.pickId)}}const Ns=new class{constructor(){this._uint8Arrays={},this._float32Arrays={}}_clear(){this._uint8Arrays={},this._float32Arrays={}}getUInt8Array(e){let t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}getFloat32Array(e){let t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}};let Qs=0;const Vs={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},Hs=new Float32Array([1,1,1,1]),js=new Float32Array([0,0,0,1]),Gs=c.vec4(),zs=c.vec3(),Ws=c.vec3(),Ks=c.mat4();class Xs{constructor(e,t=!1,{instancing:i=!1,edges:s=!1}={}){this._scene=e,this._withSAO=t,this._instancing=i,this._edges=s,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}_getHash(){return this._scene._sectionPlanesState.getHash()}_buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}_buildVertexShader(){return[""]}_buildFragmentShader(){return[""]}_addMatricesUniformBlockLines(e,t=!1){return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}_addRemapClipPosLines(e,t=1){return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(${t}));`),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}getValid(){return this._hash===this._getHash()}setSectionPlanesStateUniforms(e){const t=this._scene,{gl:i}=t.canvas,{model:s,layerIndex:r}=e,o=t._sectionPlanesState.getNumAllocatedSectionPlanes(),n=t._sectionPlanesState.sectionPlanes.length;if(o>0){const a=t._sectionPlanesState.sectionPlanes,l=r*n,A=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(let t=0;t0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(let t=0,i=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0&&p.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,p.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),p.lightMaps.length>0&&p.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,p.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),this._withSAO){const t=n.sao;if(t.possible){const i=a.drawingBufferWidth,s=a.drawingBufferHeight;Gs[0]=i,Gs[1]=s,Gs[2]=t.blendCutoff,Gs[3]=t.blendFactor,a.uniform4fv(this._uSAOParams,Gs),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++}}if(s){const e=this._edges?"edgeColor":"fillColor",t=this._edges?"edgeAlpha":"fillAlpha";if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_XRAYED"]){const i=n.xrayMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_HIGHLIGHTED"]){const i=n.highlightMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===Vs[(this._edges?"EDGES":"SILHOUETTE")+"_SELECTED"]){const i=n.selectedMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else a.uniform4fv(this._uColor,this._edges?js:Hs)}this._draw({state:l,frameCtx:e,incrementDrawState:r}),a.bindVertexArray(null)}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null,p.memory.programs--}}class Js extends Xs{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!1,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{const e=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,e,i.indicesBuf.itemType,o),r&&s.drawElements++}}}class Ys extends Js{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r;const o=[];o.push("#version 300 es"),o.push("// Triangles batching draw vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;")),o.push("out vec4 vColor;"),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Zs extends Js{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,i=t.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching silhouette fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r){for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = newColor;"),o.push("}"),o}}class $s extends Js{constructor(e){super(e,!1,{instancing:!1,edges:!0})}}class er extends $s{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class tr extends $s{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class ir extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class sr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class rr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class or extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class nr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}class ar extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class lr extends Js{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}class Ar extends Js{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Triangles batching quality draw vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),o.push("vFragDepth = 1.0 + clipPos.w;")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Triangles batching quality draw fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),n.push("uniform sampler2D uAOMap;"),n.push("in vec4 vViewPosition;"),n.push("in vec3 vViewNormal;"),n.push("in vec4 vColor;"),n.push("in vec2 vUV;"),n.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class cr extends Js{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching color texture fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),o.push("uniform float gammaFactor;"),o.push("vec4 linearToLinear( in vec4 value ) {"),o.push(" return value;"),o.push("}"),o.push("vec4 sRGBToLinear( in vec4 value ) {"),o.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),o.push("}"),o.push("vec4 gammaToLinear( in vec4 value) {"),o.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),o.push("}"),t&&(o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}")),r){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,t=i.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const _r=c.vec3(),vr=c.vec3(),br=c.vec3(),yr=c.vec3(),Br=c.mat4();class xr extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=_r;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=vr;if(l){const e=br;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Br),m=yr,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElements(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class wr{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new qs(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new ir(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new sr(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new mr(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new xr(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Ys(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Ys(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Zs(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Zs(this._scene,!0)),this._flatColorRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new cr(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new cr(this._scene,!0)),this._colorTextureRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Ar(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ar(this._scene,!0)),this._pbrRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new qs(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new nr(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new ar(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new er(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new tr(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new ir(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new rr(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new hr(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new sr(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new or(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new lr(this._scene)),this._shadowRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new xr(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new mr(this._scene)),this._snapInitRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Pr={};let Cr=65536,Mr=5e6;class Fr{constructor(){}set doublePrecisionEnabled(e){c.setDoublePrecisionEnabled(e)}get doublePrecisionEnabled(){return c.getDoublePrecisionEnabled()}set maxDataTextureHeight(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),Cr=e}get maxDataTextureHeight(){return Cr}set maxGeometryBatchSize(e){e<1e5?e=1e5:e>5e6&&(e=5e6),Mr=e}get maxGeometryBatchSize(){return Mr}}const Er=new Fr;class Ir{constructor(){this.maxVerts=Er.maxGeometryBatchSize,this.maxIndices=3*Er.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]}}const Dr=c.mat4(),Sr=c.mat4();function Tr(e,t,i){const s=e.length,r=new Uint16Array(s),o=t[0],n=t[1],a=t[2],l=t[3]-o,A=t[4]-n,h=t[5]-a,u=65525,d=u/l,p=u/A,f=u/h,g=e=>e>=0?e:0;for(let t=0;t=0?1:-1),t=(1-Math.abs(s))*(r>=0?1:-1),s=e,r=t}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function Ur(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}const kr=c.mat4(),Or=c.mat4(),Nr=c.vec4([0,0,0,1]),Qr=c.vec3(),Vr=c.vec3(),Hr=c.vec3(),jr=c.vec3(),Gr=c.vec3(),zr=c.vec3(),Wr=c.vec3();class Kr{constructor(e){console.info("Creating VBOBatchingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesBatchingLayer"+(e.solid?"-solid":"-surface")+(e.autoNormals?"-autonormals":"-normals")+(e.textureSet&&e.textureSet.colorTexture?"-colorTexture":"")+(e.textureSet&&e.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Pr[t];return i||(i=new wr(e),Pr[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Pr[t],i._destroy()}))),i}(e.model.scene),this._buffer=new Ir(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({origin:c.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:e.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=c.mat4(e.positionsDecodeMatrix)),e.uvDecodeMatrix?(this._state.uvDecodeMatrix=c.mat3(e.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,e.origin&&this._state.origin.set(e.origin),this.solid=!!e.solid}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)for(let e=0,t=o.length;e0){const e=kr;m?c.inverseMat4(c.transposeMat4(m,Or),e):c.identityMat4(e,e),function(e,t,i,s,r){function o(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}let n,a,l,A,h,u,d=new Float32Array([0,0,0,0]),p=new Float32Array([0,0,0,0]);for(u=0;uh&&(l=n,h=A),n=Lr(p,"floor","ceil"),a=Ur(n),A=o(p,a),A>h&&(l=n,h=A),n=Lr(p,"ceil","ceil"),a=Ur(n),A=o(p,a),A>h&&(l=n,h=A),s[r+u+0]=l[0],s[r+u+1]=l[1],s[r+u+2]=0}(e,r,r.length,b.normals,b.normals.length)}if(l)for(let e=0,t=l.length;e0)for(let e=0,t=n.length;e0)for(let e=0,t=a.length;e0){const s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):Tr(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=c.mat4());if(e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(let e=0,t=this._portions.length;e0){const s=new Int8Array(i.normals);let r=!0;e.normalsBuf=new Re(t,t.ARRAY_BUFFER,s,i.normals.length,3,t.STATIC_DRAW,r)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.uv.length>0)if(e.uvDecodeMatrix){let s=!1;e.uvBuf=new Re(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,s)}else{const s=Tt.getUVBounds(i.uv),r=Tt.compressUVs(i.uv,s.min,s.max),o=r.quantized;let n=!1;e.uvDecodeMatrix=c.mat3(r.decodeMatrix),e.uvBuf=new Re(t,t.ARRAY_BUFFER,o,o.length,2,t.STATIC_DRAW,n)}if(i.metallicRoughness.length>0){const s=new Uint8Array(i.metallicRoughness);let r=!1;e.metallicRoughnessBuf=new Re(t,t.ARRAY_BUFFER,s,i.metallicRoughness.length,2,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s),o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){const s=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}isEmpty(){return!this._state.indicesBuf}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=e,s=this._portions[i],r=4*s.vertsBaseIndex,o=4*s.numVerts,n=this._scratchMemory.getUInt8Array(o),a=t[0],l=t[1],A=t[2],h=t[3];for(let e=0;e_)&&(_=e,s.set(v),r&&c.triangleNormal(p,f,g,r),m=!0)}}return m&&r&&(c.transformVec3(this.model.worldNormalMatrix,r,r),c.normalizeVec3(r)),m}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}class Xr extends Xs{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!0,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}class Jr extends Xr{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r,o,n;const a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),e.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),e.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),r=0,o=i.lights.length;r= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),s&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),r=0,o=i.lights.length;r0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Yr extends Xr{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState;let s,r;const o=t.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry flat-shading drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),o){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}for(n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),s=0,r=i.lights.length;s0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}class qr extends Xr{constructor(e,t){super(e,t,{instancing:!0,edges:!0})}}class $r extends qr{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class eo extends qr{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class to extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class io extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class so extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class ro extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class oo extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry depth drawing fragment shader"),o.push("precision highp float;"),o.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),o.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),o.push("}"),o}}class no extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class ao extends Xr{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const lo={3e3:"linearToLinear",3001:"sRGBToLinear"};class Ao extends Xr{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Instancing geometry quality drawing vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),o.push("in vec4 modelMatrixCol0;"),o.push("in vec4 modelMatrixCol1;"),o.push("in vec4 modelMatrixCol2;"),o.push("in vec4 modelNormalMatrixCol0;"),o.push("in vec4 modelNormalMatrixCol1;"),o.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),o.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),o.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Instancing geometry quality drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),n.push("#define PI 3.14159265359"),n.push("#define RECIPROCAL_PI 0.31830988618"),n.push("#define RECIPROCAL_PI2 0.15915494"),n.push("#define EPSILON 1e-6"),n.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),n.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),n.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),n.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),n.push(" return normalize(surf_norm );"),n.push(" }"),n.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),n.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),n.push(" vec2 st0 = dFdx( uv.st );"),n.push(" vec2 st1 = dFdy( uv.st );"),n.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),n.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),n.push(" vec3 N = normalize( surf_norm );"),n.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),n.push(" mat3 tsn = mat3( S, T, N );"),n.push(" return normalize( tsn * mapN );"),n.push("}"),n.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),n.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),n.push("}"),n.push("struct IncidentLight {"),n.push(" vec3 color;"),n.push(" vec3 direction;"),n.push("};"),n.push("struct ReflectedLight {"),n.push(" vec3 diffuse;"),n.push(" vec3 specular;"),n.push("};"),n.push("struct Geometry {"),n.push(" vec3 position;"),n.push(" vec3 viewNormal;"),n.push(" vec3 worldNormal;"),n.push(" vec3 viewEyeDir;"),n.push("};"),n.push("struct Material {"),n.push(" vec3 diffuseColor;"),n.push(" float specularRoughness;"),n.push(" vec3 specularColor;"),n.push(" float shine;"),n.push("};"),n.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),n.push(" float r = ggxRoughness + 0.0001;"),n.push(" return (2.0 / (r * r) - 2.0);"),n.push("}"),n.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),n.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),n.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),n.push("}"),s.reflectionMaps.length>0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = "+lo[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = "+lo[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),s.push("}"),s}}class co extends Xr{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState;let r,o;const n=i.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),e.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),t&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),n){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),r=0,o=s.lights.length;r0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const vo=c.vec3(),bo=c.vec3(),yo=c.vec3(),Bo=c.vec3(),xo=c.mat4();class wo extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=vo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=bo;if(l){const e=c.transformPoint3(h,l,yo);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,xo),m=Bo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Po{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Zr(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new to(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new io(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new _o(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new wo(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Jr(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Jr(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Yr(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Yr(this._scene,!0)),this._flatColorRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Ao(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ao(this._scene,!0)),this._pbrRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new co(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new co(this._scene,!0)),this._colorTextureRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Zr(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new oo(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new no(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new $r(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new eo(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new to(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new so(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ho(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new io(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new ro(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ao(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new _o(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new wo(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Co={};const Mo=new Uint8Array(4),Fo=new Float32Array(1),Eo=c.vec4([0,0,0,1]),Io=new Float32Array(3),Do=c.vec3(),So=c.vec3(),To=c.vec3(),Ro=c.vec3(),Lo=c.vec3(),Uo=c.vec3(),ko=c.vec3(),Oo=new Float32Array(4);class No{constructor(e){console.info("Creating VBOInstancingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesInstancingLayer"+(e.solid?"-solid":"-surface")+(e.normals?"-normals":"-autoNormals"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Co[t];return i||(i=new Po(e),Co[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Co[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({numInstances:0,obb:c.OBB3(),origin:c.vec3(),geometry:e.geometry,textureSet:e.textureSet,pbrSupported:!1,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,e.origin&&this._state.origin.set(e.origin),this._finalized=!1,this.solid=!!e.solid,this.numIndices=e.geometry.numIndices}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;e.colorsBuf=new Re(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,t),this._colors=[]}if(this._metallicRoughness.length>0){const t=new Uint8Array(this._metallicRoughness);let i=!1;e.metallicRoughnessBuf=new Re(s,s.ARRAY_BUFFER,t,this._metallicRoughness.length,2,s.STATIC_DRAW,i)}if(o>0){let t=!1;e.flagsBuf=new Re(s,s.ARRAY_BUFFER,new Float32Array(o),o,1,s.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;e.offsetsBuf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,t),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){const i=!1;e.positionsBuf=new Re(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,i),e.positionsDecodeMatrix=c.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){const i=new Uint8Array(t.colorsCompressed),r=!1;e.colorsBuf=new Re(s,s.ARRAY_BUFFER,i,i.length,4,s.STATIC_DRAW,r)}if(t.uvCompressed&&t.uvCompressed.length>0){const i=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new Re(s,s.ARRAY_BUFFER,i,i.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new Re(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){const t=!1;e.modelMatrixCol0Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelMatrixCol1Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelMatrixCol2Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol1Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol2Buf=new Re(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){const t=!1;e.pickColorsBuf=new Re(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,t),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Mo[0]=t[0],Mo[1]=t[1],Mo[2]=t[2],Mo[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(Mo,4*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?1:0)<<16,Fo[0]=d,this._state.flagsBuf&&this._state.flagsBuf.setData(Fo,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Io[0]=t[0],Io[1]=t[1],Io[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(Io,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}getEachVertex(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;const i=this._state,s=i.geometry,r=this._portions[e];if(!r)return void this.model.error("portion not found: "+e);const o=s.quantizedPositions,n=i.origin,a=r.offset,l=n[0]+a[0],A=n[1]+a[1],h=n[2]+a[2],u=Eo,d=r.matrix,p=this.model.sceneModelMatrix,f=i.positionsDecodeMatrix;for(let e=0,i=o.length;ev)&&(v=e,s.set(b),r&&c.triangleNormal(f,g,m,r),_=!0)}}return _&&r&&(c.transformVec3(a.normalMatrix,r,r),c.transformVec3(this.model.worldNormalMatrix,r,r),c.normalizeVec3(r)),_}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}class Qo extends Xs{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}class Vo extends Qo{drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Ho extends Qo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const jo=c.vec3(),Go=c.vec3(),zo=c.vec3(),Wo=c.vec3(),Ko=c.mat4();class Xo extends Xs{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=jo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Go;if(l){const e=zo;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Ko),m=Wo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Jo=c.vec3(),Yo=c.vec3(),Zo=c.vec3(),qo=c.vec3(),$o=c.mat4();class en extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Jo;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Yo;if(l){const e=Zo;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,$o),m=qo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class tn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Vo(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ho(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Xo(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new en(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const sn={};class rn{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]}}class on{constructor(e){console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=sn[t];return i||(i=new tn(e),sn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete sn[t],i._destroy()}))),i}(e.model.scene),this.model=e.model,this._buffer=new rn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:c.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=c.vec3(e.origin))}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=Tr(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.colors.length>0){const s=i.colors.length/4,r=new Float32Array(s);let o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new Re(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2],A=t[3];for(let e=0;e0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Lines instancing color fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return this._withSAO?(o.push(" float viewportWidth = uSAOParams[0];"),o.push(" float viewportHeight = uSAOParams[1];"),o.push(" float blendCutoff = uSAOParams[2];"),o.push(" float blendFactor = uSAOParams[3];"),o.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),o.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),o.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):o.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class ln extends nn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const An=c.vec3(),hn=c.vec3(),cn=c.vec3();c.vec3();const un=c.mat4();class dn extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=An;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=hn;if(l){const e=c.transformPoint3(h,l,cn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,un),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const pn=c.vec3(),fn=c.vec3(),gn=c.vec3();c.vec3();const mn=c.mat4();class _n extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=pn;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=fn;if(l){const e=c.transformPoint3(h,l,gn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,mn),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class vn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._snapInitRenderer||(this._snapInitRenderer=new dn(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new _n(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new an(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ln(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new dn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new _n(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const bn={};const yn=new Uint8Array(4),Bn=new Float32Array(1),xn=new Float32Array(3),wn=new Float32Array(4);class Pn{constructor(e){console.info("VBOInstancingLinesLayer"),this.model=e.model,this.material=e.material,this.sortId="LinesInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=bn[t];return i||(i=new vn(e),bn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete bn[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({obb:c.OBB3(),numInstances:0,origin:null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,e.origin&&(this._state.origin=c.vec3(e.origin)),this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;this._state.colorsBuf=new Re(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,t),this._colors=[]}if(r>0){let t=!1;this._state.flagsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;this._state.offsetsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){const s=new Uint8Array(i.colorsCompressed),r=!1;t.colorsBuf=new Re(e,e.ARRAY_BUFFER,s,s.length,4,e.STATIC_DRAW,r)}if(i.positionsCompressed&&i.positionsCompressed.length>0){const s=!1;t.positionsBuf=new Re(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,s),t.positionsDecodeMatrix=c.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new Re(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){const t=!1;this._state.modelMatrixCol0Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol1Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol2Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";yn[0]=t[0],yn[1]=t[1],yn[2]=t[2],yn[3]=t[3],this._state.colorsBuf.setData(yn,4*e,4)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?255:0)<<16,Bn[0]=d,this._state.flagsBuf.setData(Bn,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(xn[0]=t[0],xn[1]=t[1],xn[2]=t[2],this._state.offsetsBuf.setData(xn,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;wn[0]=t[0],wn[1]=t[4],wn[2]=t[8],wn[3]=t[12],this._state.modelMatrixCol0Buf.setData(wn,i),wn[0]=t[1],wn[1]=t[5],wn[2]=t[9],wn[3]=t[13],this._state.modelMatrixCol1Buf.setData(wn,i),wn[0]=t[2],wn[1]=t[6],wn[2]=t[10],wn[3]=t[14],this._state.modelMatrixCol2Buf.setData(wn,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesXRayed(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK)}drawOcclusion(e,t){}drawShadow(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawPickNormals(e,t){}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}class Cn extends Xs{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}class Mn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Fn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points batching silhouette vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = color;"),o.push("}"),o}}class En extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class In extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Dn extends Cn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}const Sn=c.vec3(),Tn=c.vec3(),Rn=c.vec3(),Ln=c.vec3(),Un=c.mat4();class kn extends Xs{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Sn;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Tn;if(l){const e=Rn;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Un),m=Ln,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const On=c.vec3(),Nn=c.vec3(),Qn=c.vec3(),Vn=c.vec3(),Hn=c.mat4();class jn extends Xs{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=On;let g,m;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Nn;if(l){const e=Qn;c.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,Hn),m=Vn,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Gn{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Mn(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Fn(this._scene)),this._silhouetteRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new En(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new In(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Dn(this._scene)),this._occlusionRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new kn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new jn(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const zn={};class Wn{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]}}class Kn{constructor(e){console.info("Creating VBOBatchingPointsLayer"),this.model=e.model,this.sortId="PointsBatchingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=zn[t];return i||(i=new Gn(e),zn[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete zn[t],i._destroy()}))),i}(e.model.scene),this._buffer=new Wn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new et({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:c.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=c.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=c.vec3(e.origin))}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=Tr(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new Re(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s);let o=!1;e.flagsBuf=new Re(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new Re(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new Re(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized"}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2];for(let e=0;e0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Yn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Zn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class qn extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class $n extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class ea extends Xn{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points instancing depth vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return o.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class ta extends Xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const ia=c.vec3(),sa=c.vec3(),ra=c.vec3();c.vec3();const oa=c.mat4();class na extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ia;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=sa;if(l){const e=c.transformPoint3(h,l,ra);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,oa),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const aa=c.vec3(),la=c.vec3(),Aa=c.vec3();c.vec3();const ha=c.mat4();class ca extends Xs{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=aa;let g;if(f[0]=c.safeInv(d[3]-d[0])*c.MAX_INT,f[1]=c.safeInv(d[4]-d[1])*c.MAX_INT,f[2]=c.safeInv(d[5]-d[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(f[0]),e.snapPickCoordinateScale[1]=c.safeInv(f[1]),e.snapPickCoordinateScale[2]=c.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=la;if(l){const e=c.transformPoint3(h,l,Aa);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=j(p,t,ha),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(u,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class ua{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Jn(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Yn(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new ea(this._scene)),this._depthRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Zn(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new qn(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new $n(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ta(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new na(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new ca(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const da={};const pa=new Uint8Array(4),fa=new Float32Array(1),ga=new Float32Array(3),ma=new Float32Array(4);class _a{constructor(e){console.info("VBOInstancingPointsLayer"),this.model=e.model,this.material=e.material,this.sortId="PointsInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=da[t];return i||(i=new ua(e),da[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete da[t],i._destroy()}))),i}(e.model.scene),this._aabb=c.collapseAABB3(),this._state=new et({obb:c.OBB3(),numInstances:0,origin:e.origin?c.vec3(e.origin):null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let s=!1;i.flagsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,s)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;i.offsetsBuf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){const t=!1;i.positionsBuf=new Re(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,t),i.positionsDecodeMatrix=c.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){const t=new Uint8Array(s.colorsCompressed),r=!1;i.colorsBuf=new Re(e,e.ARRAY_BUFFER,t,t.length,4,e.STATIC_DRAW,r)}if(this._modelMatrixCol0.length>0){const t=!1;i.modelMatrixCol0Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),i.modelMatrixCol1Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),i.modelMatrixCol2Buf=new Re(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){const t=!1;i.pickColorsBuf=new Re(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,t),this._pickColors=[]}i.geometry=null,this._finalized=!0}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";pa[0]=t[0],pa[1]=t[1],pa[2]=t[2],this._state.colorsBuf.setData(pa,3*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&K),r=!!(t&q),o=!!(t&$),n=!!(t&ee),a=!!(t&te),l=!!(t&J),A=!!(t&X);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?Vs.NOT_RENDERED:i?Vs.COLOR_TRANSPARENT:Vs.COLOR_OPAQUE,c=!s||A?Vs.NOT_RENDERED:n?Vs.SILHOUETTE_SELECTED:o?Vs.SILHOUETTE_HIGHLIGHTED:r?Vs.SILHOUETTE_XRAYED:Vs.NOT_RENDERED;let u=0;u=!s||A?Vs.NOT_RENDERED:n?Vs.EDGES_SELECTED:o?Vs.EDGES_HIGHLIGHTED:r?Vs.EDGES_XRAYED:a?i?Vs.EDGES_COLOR_TRANSPARENT:Vs.EDGES_COLOR_OPAQUE:Vs.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?Vs.PICK:Vs.NOT_RENDERED)<<12,d|=(t&Y?255:0)<<16,fa[0]=d,this._state.flagsBuf.setData(fa,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(ga[0]=t[0],ga[1]=t[1],ga[2]=t[2],this._state.offsetsBuf.setData(ga,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;ma[0]=t[0],ma[1]=t[4],ma[2]=t[8],ma[3]=t[12],this._state.modelMatrixCol0Buf.setData(ma,i),ma[0]=t[1],ma[1]=t[5],ma[2]=t[9],ma[3]=t[13],this._state.modelMatrixCol1Buf.setData(ma,i),ma[0]=t[2],ma[1]=t[6],ma[2]=t[10],ma[3]=t[14],this._state.modelMatrixCol2Buf.setData(ma,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawShadow(e,t){}drawPickMesh(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,Vs.PICK)}drawPickDepths(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,Vs.PICK)}drawPickNormals(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK)}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}const va=c.vec3(),ba=c.vec3(),ya=c.mat4();class Ba{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=va;if(g){const t=c.transformPoint3(u,A,ba);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,ya)}else f=p;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),n.drawArrays(n.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),n.drawArrays(n.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),n.drawArrays(n.LINES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class xa{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}eagerCreateRenders(){}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Ba(this._scene,!1)),this._colorRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy()}}const wa={};class Pa{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]}}class Ca{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindLineIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}class Ma{constructor(e,t,i,s,r=null){this._gl=e,this._texture=t,this._textureWidth=i,this._textureHeight=s,this._textureData=r}bindTexture(e,t,i){return e.bindTexture(t,this,i)}bind(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}unbind(e){}}const Fa={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Fa,null,4));let e=0;Object.keys(Fa).forEach((t=>{t.startsWith("size")&&(e+=Fa[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Fa.totalLines).toFixed(2)}`);let t={};Object.keys(Fa).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Fa[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class Ea{disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}generateTextureForColorsAndFlags(e,t,i,s,r){const o=t.length;this.numPortions=o;const n=4096,a=Math.ceil(o/512);if(0===a)throw"texture height===0";const l=new Uint8Array(16384*a);Fa.sizeDataColorsAndFlags+=l.byteLength,Fa.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),l.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20);const A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,n,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,A,n,a,l)}generateTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Fa.sizeDataTextureOffsets+=r.byteLength,Fa.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,o,i,s,r)}generateTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Fa.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete wa[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new Pa,this._dataTextureState=new Ca,this._dataTextureGenerator=new Ea,this._state=new et({origin:c.vec3(t.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Fa.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/2})),(this._state.numVertices+s>4096*Da||t+r>4096*Da)&&Fa.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*Da&&t+r<=4096*Da}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/2/8)*2;Fa.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}const i=t.positionsCompressed,s=t.indices,r=this._buffer;r.positionsCompressed.push(i);const o=r.lenPositionsCompressed/3,n=i.length/3;let a;r.lenPositionsCompressed+=i.length;let l=0;if(s){let e;l=s.length/2,n<=256?(e=r.indices8Bits,a=r.lenIndices8Bits/2,r.lenIndices8Bits+=s.length):n<=65536?(e=r.indices16Bits,a=r.lenIndices16Bits/2,r.lenIndices16Bits+=s.length):(e=r.indices32Bits,a=r.lenIndices32Bits/2,r.lenIndices32Bits+=s.length),e.push(s)}this._state.numVertices+=n,Fa.numberOfGeometries++;return{vertexBase:o,numVertices:n,numLines:l,indicesBase:a}}_createSubPortion(e,t){const i=e.color,s=e.colors,r=e.opacity,o=e.meshMatrix,n=e.pickColor,a=this._buffer,l=this._state;a.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),a.perObjectInstancePositioningMatrices.push(o||Ua),a.perObjectSolid.push(!!e.solid),s?a.perObjectColors.push([255*s[0],255*s[1],255*s[2],255]):i&&a.perObjectColors.push([i[0],i[1],i[2],r]),a.perObjectPickColors.push(n),a.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?l.numIndices8Bits:t.numVertices<=65536?l.numIndices16Bits:l.numIndices32Bits,a.perObjectIndexBaseOffsets.push(e/2-t.indicesBase)}const A=this._subPortions.length;if(t.numLines>0){let e,i=2*t.numLines;t.numVertices<=256?(e=a.perLineNumberPortionId8Bits,l.numIndices8Bits+=i,Fa.totalLines8Bits+=t.numLines):t.numVertices<=65536?(e=a.perLineNumberPortionId16Bits,l.numIndices16Bits+=i,Fa.totalLines16Bits+=t.numLines):(e=a.perLineNumberPortionId32Bits,l.numIndices32Bits+=i,Fa.totalLines32Bits+=t.numLines),Fa.totalLines+=t.numLines;for(let i=0;i0&&(t.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Ta))}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),c.bindTexture(c.TEXTURE_2D,h.texturePerObjectColorsAndFlags._texture),c.texSubImage2D(c.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,c.RGBA_INTEGER,c.UNSIGNED_BYTE,Ta))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,Ta))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,Ra))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Sa))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){}drawSilhouetteHighlighted(e,t){}drawSilhouetteSelected(e,t){}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){}drawShadow(e,t){}setPickMatrices(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawSnapInit(e,t){}drawSnap(e,t){}drawPickNormals(e,t){}destroy(){if(this._destroyed)return;const e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}const Oa=c.vec3(),Na=c.vec3(),Qa=c.vec3();c.vec3();const Va=c.vec4(),Ha=c.mat4();class ja{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Oa;if(g){const t=c.transformPoint3(u,A,Na);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,Ha),f=Qa,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new Te(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];const r=i.lights;let o;for(let e=0,t=r.length;e0;let r;const o=[];o.push("#version 300 es"),o.push("// TrianglesDataTextureColorRenderer vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("uniform mat4 sceneModelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),o.push("uniform highp sampler2D uTexturePerObjectMatrix;"),o.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),o.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),o.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),o.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),o.push("uniform vec3 uCameraEyeRtc;"),o.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("out float isPerspective;")),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e> 3) & 4095;"),o.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),o.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),o.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),o.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),o.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),o.push("if (int(flags.x) != renderPass) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("} else {"),o.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),o.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),o.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),o.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),o.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),o.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),o.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),o.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),o.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),o.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),o.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),o.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),o.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),o.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),o.push("if (color.a == 0u) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("};"),o.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),o.push("vec3 position;"),o.push("position = positions[gl_VertexID % 3];"),o.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),o.push("if (solid != 1u) {"),o.push("if (isPerspectiveMatrix(projMatrix)) {"),o.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),o.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("} else {"),o.push("if (viewNormal.z < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("}"),o.push("}"),o.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ga=new Float32Array([1,1,1]),za=c.vec3(),Wa=c.vec3(),Ka=c.vec3();c.vec3();const Xa=c.mat4();class Ja{constructor(e,t){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=za;if(A){const t=Wa;c.transformPoint3(u,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,Xa),g=Ka,g[0]=r.eye[0]-e[0],g[1]=r.eye[1]-e[1],g[2]=r.eye[2]-e[2]}else f=p,g=r.eye;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===Vs.SILHOUETTE_XRAYED){const e=s.xrayMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.SILHOUETTE_HIGHLIGHTED){const e=s.highlightMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.SILHOUETTE_SELECTED){const e=s.selectedMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,Ga);if(s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=s._sectionPlanesState.getNumAllocatedSectionPlanes(),_=s._sectionPlanesState.sectionPlanes.length;if(m>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,r=o.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ya=new Float32Array([0,0,0,1]),Za=c.vec3(),qa=c.vec3();c.vec3();const $a=c.mat4();class el{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Za;if(g){const t=c.transformPoint3(u,A,qa);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,$a)}else f=p;if(n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),i===Vs.EDGES_XRAYED){const e=r.xrayMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.EDGES_HIGHLIGHTED){const e=r.highlightMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===Vs.EDGES_SELECTED){const e=r.selectedMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,Ya);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const tl=c.vec3(),il=c.vec3(),sl=c.mat4();class rl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=tl;if(g){const t=c.transformPoint3(u,A,il);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,sl)}else f=p;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ol=c.vec3(),nl=c.vec3(),al=c.vec3(),ll=c.mat4();class Al{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s;let p,f;l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=ol;if(g){const t=c.transformPoint3(u,A,nl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(o.viewMatrix,e,ll),f=al,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=o.viewMatrix,f=o.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),r.logarithmicDepthBufferEnabled){const e=2/(Math.log(o.project.far+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,e)}const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const hl=c.vec3(),cl=c.vec3(),ul=c.vec3();c.vec3();const dl=c.mat4();class pl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=e.pickViewMatrix||o.viewMatrix;let f,g;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const t=hl;if(A){const e=cl;c.transformPoint3(u,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],f=j(p,t,dl),g=ul,g[0]=o.eye[0]-t[0],g[1]=o.eye[1]-t[1],g[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else f=p,g=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniform1f(this._uPickZNear,e.pickZNear),n.uniform1f(this._uPickZFar,e.pickZFar),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),r.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const fl=c.vec3(),gl=c.vec3(),ml=c.vec3(),_l=c.vec3();c.vec3();const vl=c.mat4();class bl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=fl;let m,_;g[0]=c.safeInv(p[3]-p[0])*c.MAX_INT,g[1]=c.safeInv(p[4]-p[1])*c.MAX_INT,g[2]=c.safeInv(p[5]-p[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(g[0]),e.snapPickCoordinateScale[1]=c.safeInv(g[1]),e.snapPickCoordinateScale[2]=c.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=gl;if(v){const e=c.transformPoint3(u,A,ml);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=j(f,t,vl),_=_l,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(x,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(x,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(x,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const yl=c.vec3(),Bl=c.vec3(),xl=c.vec3(),wl=c.vec3();c.vec3();const Pl=c.mat4();class Cl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=yl;let m,_;g[0]=c.safeInv(p[3]-p[0])*c.MAX_INT,g[1]=c.safeInv(p[4]-p[1])*c.MAX_INT,g[2]=c.safeInv(p[5]-p[2])*c.MAX_INT,e.snapPickCoordinateScale[0]=c.safeInv(g[0]),e.snapPickCoordinateScale[1]=c.safeInv(g[1]),e.snapPickCoordinateScale[2]=c.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=Bl;if(v){const e=xl;c.transformPoint3(u,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=j(f,t,Pl),_=wl,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this._uVectorA,e.snapVectorA),n.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ml=c.vec3(),Fl=c.vec3(),El=c.vec3();c.vec3();const Il=c.mat4();class Dl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=s,p=e.pickViewMatrix||o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=Ml;if(A){const t=Fl;c.transformPoint3(u,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=j(p,e,Il),g=El,g[0]=o.eye[0]-e[0],g[1]=o.eye[1]-e[1],g[2]=o.eye[2]-e[2]}else f=p,g=o.eye;n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Sl=c.vec3(),Tl=c.vec3(),Rl=c.vec3();c.vec3();const Ll=c.mat4();class Ul{constructor(e){this._scene=e,this._allocate(),this._hash=this._getHash()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Sl;if(g){const t=c.transformPoint3(u,A,Tl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,Ll),f=Rl,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const kl=c.vec3(),Ol=c.vec3(),Nl=c.vec3();c.vec3();const Ql=c.mat4();class Vl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:u}=s,d=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));const g=0!==l[0]||0!==l[1]||0!==l[2],m=0!==A[0]||0!==A[1]||0!==A[2];if(g||m){const e=kl;if(g){const t=Ol;c.transformPoint3(h,l,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=A[0],e[1]+=A[1],e[2]+=A[2],p=j(d,e,Ql),f=Nl,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=d,f=o.eye;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,o.viewNormalMatrix),n.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(we.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&we.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Hl=c.vec3(),jl=c.vec3(),Gl=c.vec3();c.vec3(),c.vec4();const zl=c.mat4();class Wl{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:u,rotationMatrixConjugate:d}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Hl;if(g){const t=c.transformPoint3(u,A,jl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=j(r.viewMatrix,e,zl),f=Gl,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,d),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Te(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(` outNormal = ivec4(worldNormal * float(${c.MAX_INT}), 1.0);`),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Kl{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Ja(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Al(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new pl(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new Wl(this._scene)),this._snapRenderer||(this._snapRenderer=new bl(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Cl(this._scene)),this._snapRenderer||(this._snapRenderer=new bl(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new ja(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new ja(this._scene,!0)),this._colorRendererWithSAO}get colorQualityRendererWithSAO(){return this._colorQualityRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ja(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Ul(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Vl(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new el(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new rl(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Al(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Wl(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Wl(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new pl(this._scene)),this._pickDepthRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new bl(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Cl(this._scene)),this._snapInitRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Dl(this._scene)),this._occlusionRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}const Xl={};class Jl{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]}}class Yl{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindTriangleIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}bindEdgeIndicesTextures(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}const Zl={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Zl,null,4));let e=0;Object.keys(Zl).forEach((t=>{t.startsWith("size")&&(e+=Zl[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Zl.totalPolygons).toFixed(2)}`);let t={};Object.keys(Zl).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Zl[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class ql{constructor(){}disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}createTextureForColorsAndFlags(e,t,i,s,r,o,n){const a=t.length;this.numPortions=a;const l=4096,A=Math.ceil(a/512);if(0===A)throw"texture height===0";const h=new Uint8Array(16384*A);Zl.sizeDataColorsAndFlags+=h.byteLength,Zl.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),h.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20),h.set([o[e]>>24&255,o[e]>>16&255,o[e]>>8&255,255&o[e]],32*e+24),h.set([n[e]?1:0,0,0,0],32*e+28);const c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,A),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,A,e.RGBA_INTEGER,e.UNSIGNED_BYTE,h,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,c,l,A,h)}createTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Zl.sizeDataTextureOffsets+=r.byteLength,Zl.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new Ma(e,o,i,s,r)}createTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Zl.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Xl[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new Jl,this._dtxState=new Yl,this._dtxTextureFactory=new ql,this._state=new et({origin:c.vec3(t.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=c.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){c.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Zl.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/3})),(this._state.numVertices+s>4096*eA||t+r>4096*eA)&&Zl.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*eA&&t+r<=4096*eA}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/3/8)*3;Zl.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}if(t.edgeIndices){const e=8*Math.ceil(t.edgeIndices.length/2/8)*2;Zl.overheadSizeAlignementEdgeIndices+=2*(e-t.edgeIndices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.edgeIndices),t.edgeIndices=i}const i=t.positionsCompressed,s=t.indices,r=t.edgeIndices,o=this._buffer;o.positionsCompressed.push(i);const n=o.lenPositionsCompressed/3,a=i.length/3;let l;o.lenPositionsCompressed+=i.length;let A,h=0;if(s){let e;h=s.length/3,a<=256?(e=o.indices8Bits,l=o.lenIndices8Bits/3,o.lenIndices8Bits+=s.length):a<=65536?(e=o.indices16Bits,l=o.lenIndices16Bits/3,o.lenIndices16Bits+=s.length):(e=o.indices32Bits,l=o.lenIndices32Bits/3,o.lenIndices32Bits+=s.length),e.push(s)}let c=0;if(r){let e;c=r.length/2,a<=256?(e=o.edgeIndices8Bits,A=o.lenEdgeIndices8Bits/2,o.lenEdgeIndices8Bits+=r.length):a<=65536?(e=o.edgeIndices16Bits,A=o.lenEdgeIndices16Bits/2,o.lenEdgeIndices16Bits+=r.length):(e=o.edgeIndices32Bits,A=o.lenEdgeIndices32Bits/2,o.lenEdgeIndices32Bits+=r.length),e.push(r)}this._state.numVertices+=a,Zl.numberOfGeometries++;return{vertexBase:n,numVertices:a,numTriangles:h,numEdges:c,indicesBase:l,edgeIndicesBase:A}}_createSubPortion(e,t,i,s){const r=e.color;e.metallic,e.roughness;const o=e.colors,n=e.opacity,a=e.meshMatrix,l=e.pickColor,A=this._buffer,h=this._state;A.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),A.perObjectInstancePositioningMatrices.push(a||oA),A.perObjectSolid.push(!!e.solid),o?A.perObjectColors.push([255*o[0],255*o[1],255*o[2],255]):r&&A.perObjectColors.push([r[0],r[1],r[2],n]),A.perObjectPickColors.push(l),A.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,A.perObjectIndexBaseOffsets.push(e/3-t.indicesBase)}{let e;e=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,A.perObjectEdgeIndexBaseOffsets.push(e/2-t.edgeIndicesBase)}const c=this._subPortions.length;if(t.numTriangles>0){let e,i=3*t.numTriangles;t.numVertices<=256?(e=A.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=i,Zl.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(e=A.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=i,Zl.totalPolygons16Bits+=t.numTriangles):(e=A.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=i,Zl.totalPolygons32Bits+=t.numTriangles),Zl.totalPolygons+=t.numTriangles;for(let i=0;i0){let e,i=2*t.numEdges;t.numVertices<=256?(e=A.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=i,Zl.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(e=A.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=i,Zl.totalEdges16Bits+=t.numEdges):(e=A.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=i,Zl.totalEdges32Bits+=t.numEdges),Zl.totalEdges+=t.numEdges;for(let i=0;i0&&(t.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId8Bits)),s.perEdgeNumberPortionId16Bits.length>0&&(t.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId16Bits)),s.perEdgeNumberPortionId32Bits.length>0&&(t.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId32Bits)),s.lenIndices8Bits>0&&(t.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),s.lenEdgeIndices8Bits>0&&(t.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(i,s.edgeIndices8Bits,s.lenEdgeIndices8Bits)),s.lenEdgeIndices16Bits>0&&(t.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(i,s.edgeIndices16Bits,s.lenEdgeIndices16Bits)),s.lenEdgeIndices32Bits>0&&(t.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(i,s.edgeIndices32Bits,s.lenEdgeIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}isEmpty(){return 0===this._numPortions}initFlags(e,t,i){t&K&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&$&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&q&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&ee&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&Y&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&te&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&J&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&X&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&K?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&te?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&Y?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&X?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&J?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,iA)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),g.bindTexture(g.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),g.texSubImage2D(g.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,g.RGBA_INTEGER,g.UNSIGNED_BYTE,iA))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,iA))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,sA))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,tA))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,Vs.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}_updateBackfaceCull(e,t){const i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){const e=t.gl;i?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),t.backfaces=i}}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,Vs.COLOR_TRANSPARENT))}drawDepth(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_XRAYED))}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_HIGHLIGHTED))}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,Vs.SILHOUETTE_SELECTED))}drawEdgesColorOpaque(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,Vs.EDGES_COLOR_OPAQUE)}drawEdgesColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,Vs.EDGES_COLOR_TRANSPARENT)}drawEdgesHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_HIGHLIGHTED)}drawEdgesSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_SELECTED)}drawEdgesXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,Vs.EDGES_XRAYED)}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}drawShadow(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,Vs.COLOR_OPAQUE))}setPickMatrices(e,t){}drawPickMesh(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,Vs.PICK))}drawPickDepths(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,Vs.PICK))}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,Vs.PICK))}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,Vs.PICK))}drawPickNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,Vs.PICK))}destroy(){if(this._destroyed)return;const e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}class aA{constructor(e){this.id=e.id,this.colorTexture=e.colorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalsTexture=e.normalsTexture,this.emissiveTexture=e.emissiveTexture,this.occlusionTexture=e.occlusionTexture}destroy(){}}class lA{constructor(e){this.id=e.id,this.texture=e.texture}destroy(){this.texture&&(this.texture.destroy(),this.texture=null)}}const AA={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class hA{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(e){void 0!==this.onError&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==dA[e])return void dA[e].push({onLoad:t,onProgress:i,onError:s});dA[e]=[],dA[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),n=this.mimeType,a=this.responseType;fetch(o).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const i=dA[e],s=t.body.getReader(),r=t.headers.get("Content-Length"),o=r?parseInt(r):0,n=0!==o;let a=0;const l=new ReadableStream({start(e){!function t(){s.read().then((({done:s,value:r})=>{if(s)e.close();else{a+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:n,loaded:a,total:o});for(let e=0,t=i.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,n)));case"json":return e.json();default:if(void 0===n)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(n),i=t&&t[1]?t[1].toLowerCase():void 0,s=new TextDecoder(i);return e.arrayBuffer().then((e=>s.decode(e)))}}})).then((t=>{AA.add(e,t);const i=dA[e];delete dA[e];for(let e=0,s=i.length;e{const i=dA[e];if(void 0===i)throw this.manager.itemError(e),t;delete dA[e];for(let e=0,s=i.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class fA{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}let gA=0;class mA{constructor({viewer:e,transcoderPath:t,workerLimit:i}){this._transcoderPath=t||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/",this._transcoderBinary=null,this._transcoderPending=null,this._workerPool=new fA,this._workerSourceURL="",i&&this._workerPool.setWorkerLimit(i);const s=e.capabilities;this._workerConfig={astcSupported:s.astcSupported,etc1Supported:s.etc1Supported,etc2Supported:s.etc2Supported,dxtSupported:s.dxtSupported,bptcSupported:s.bptcSupported,pvrtcSupported:s.pvrtcSupported},this._supportedFileTypes=["xkt2"]}_init(){if(!this._transcoderPending){const e=new pA;e.setPath(this._transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new pA;i.setPath(this._transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=i.loadAsync("basis_transcoder.wasm");this._transcoderPending=Promise.all([t,s]).then((([e,t])=>{const i=mA.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(mA.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(mA.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(mA.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this._workerSourceURL=URL.createObjectURL(new Blob([s])),this._transcoderBinary=t,this._workerPool.setWorkerCreator((()=>{const e=new Worker(this._workerSourceURL),t=this._transcoderBinary.slice(0);return e.postMessage({type:"init",config:this._workerConfig,transcoderBinary:t},[t]),e}))})),gA>0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),gA++}return this._transcoderPending}transcode(e,t,i={}){return new Promise(((s,r)=>{const o=i;this._init().then((()=>this._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e))).then((e=>{const i=e.data,{mipmaps:o,width:n,height:a,format:l,type:A,error:h,dfdTransferFn:c,dfdFlags:u}=i;if("error"===A)return r(h);t.setCompressedData({mipmaps:o,props:{format:l,minFilter:1===o.length?1006:1008,magFilter:1===o.length?1006:1008,encoding:2===c?3001:3e3,premultiplyAlpha:!!(1&u)}}),s()}))}))}destroy(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),gA--}}mA.BasisFormat={ETC1S:0,UASTC_4x4:1},mA.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},mA.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},mA.BasisWorker=function(){let e,t,i;const s=_EngineFormat,r=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(n){const h=n.data;switch(h.type){case"init":e=h.config,c=h.transcoderBinary,t=new Promise((e=>{i={wasmBinary:c,onRuntimeInitialized:e},BASIS(i)})).then((()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{width:t,height:n,hasAlpha:c,mipmaps:u,format:d,dfdTransferFn:p,dfdFlags:f}=function(t){const n=new i.KTX2File(new Uint8Array(t));function h(){n.close(),n.delete()}if(!n.isValid())throw h(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");const c=n.isUASTC()?o.UASTC_4x4:o.ETC1S,u=n.getWidth(),d=n.getHeight(),p=n.getLevels(),f=n.getHasAlpha(),g=n.getDFDTransferFunc(),m=n.getDFDFlags(),{transcoderFormat:_,engineFormat:v}=function(t,i,n,h){let c,u;const d=t===o.ETC1S?a:l;for(let s=0;s{delete _A[t],i.destroy()}))),i} /** * @author https://github.com/tmarti, with support from https://tribia.com/ * @license MIT @@ -14,7 +14,7 @@ /** * @author https://github.com/tmarti, with support from https://tribia.com/ * @license MIT - **/let wA=null;function PA(e,t){const i=3*e,s=3*t;let r,o,n,a,l,A;const h=Math.min(r=wA[i],o=wA[i+1],n=wA[i+2]),c=Math.min(a=wA[s],l=wA[s+1],A=wA[s+2]);if(h!==c)return h-c;const u=Math.max(r,o,n),d=Math.max(a,l,A);return u!==d?u-d:0}let CA=null;function MA(e,t){let i=CA[2*e]-CA[2*t];return 0!==i?i:CA[2*e+1]-CA[2*t+1]}function FA(e,t,i=!1){const s=e.positionsCompressed||[],r=function(e,t){const i=new Int32Array(e.length/3);for(let e=0,t=i.length;e>t;i.sort(PA);const s=new Int32Array(e.length);for(let t=0,r=i.length;te[t+1]){let i=e[t];e[t]=e[t+1],e[t+1]=i}CA=new Int32Array(e),t.sort(MA);const i=new Int32Array(e.length);for(let s=0,r=t.length;st){let i=e;e=t,t=i}function i(i,s){return i!==e?e-i:s!==t?t-s:0}let s=0,r=(o.length>>1)-1;for(;s<=r;){const e=r+s>>1,t=i(o[2*e],o[2*e+1]);if(t>0)s=e+1;else{if(!(t<0))return e;r=e-1}}return-s-1}const a=new Int32Array(o.length/2);a.fill(0);const l=s.length/3;if(l>8*(1<u.maxNumPositions&&(u=c()),u.bucketNumber>8)return[e];let p;-1===A[l]&&(A[l]=u.numPositions++,u.positionsCompressed.push(s[3*l]),u.positionsCompressed.push(s[3*l+1]),u.positionsCompressed.push(s[3*l+2])),-1===A[h]&&(A[h]=u.numPositions++,u.positionsCompressed.push(s[3*h]),u.positionsCompressed.push(s[3*h+1]),u.positionsCompressed.push(s[3*h+2])),-1===A[d]&&(A[d]=u.numPositions++,u.positionsCompressed.push(s[3*d]),u.positionsCompressed.push(s[3*d+1]),u.positionsCompressed.push(s[3*d+2])),u.indices.push(A[l]),u.indices.push(A[h]),u.indices.push(A[d]),(p=n(l,h))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(l,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(h,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]]))}const d=t/8*2,p=t/8,f=2*s.length+(r.length+o.length)*d;let g=0,m=-s.length/3;return h.forEach((e=>{g+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*p,m+=e.positionsCompressed.length/3})),g>f?[e]:(i&&function(e,t){const i={},s={};let r=0;e.forEach((e=>{const t=e.indices,o=e.edgeIndices,n=e.positionsCompressed;for(let e=0,s=t.length;e0){const e=t._meshes;for(let t=0,i=e.length;t0){const e=this._meshes;for(let t=0,i=e.length;t{this._viewMatrixDirty=!0})),this._meshesWithDirtyMatrices=[],this._numMeshesWithDirtyMatrices=0,this._onTick=this.scene.on("tick",(()=>{for(;this._numMeshesWithDirtyMatrices>0;)this._meshesWithDirtyMatrices[--this._numMeshesWithDirtyMatrices]._updateMatrix()})),this._createDefaultTextureSet(),this.visible=t.visible,this.culled=t.culled,this.pickable=t.pickable,this.clippable=t.clippable,this.collidable=t.collidable,this.castsShadow=t.castsShadow,this.receivesShadow=t.receivesShadow,this.xrayed=t.xrayed,this.highlighted=t.highlighted,this.selected=t.selected,this.edges=t.edges,this.colorize=t.colorize,this.opacity=t.opacity,this.backfaces=t.backfaces}_meshMatrixDirty(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}_createDefaultTextureSet(){const e=new lA({id:"defaultColorTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new lA({id:"defaultMetalRoughTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new lA({id:"defaultNormalsTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new lA({id:"defaultEmissiveTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new lA({id:"defaultOcclusionTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new aA({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}get isPerformanceModel(){return!0}get transforms(){return this._transforms}get textures(){return this._textures}get textureSets(){return this._textureSets}get meshes(){return this._meshes}get objects(){return this._entities}get origin(){return this._origin}set position(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get position(){return this._position}set rotation(e){this._rotation.set(e||[0,0,0]),c.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get rotation(){return this._rotation}set quaternion(e){this._quaternion.set(e||[0,0,0,1]),c.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get quaternion(){return this._quaternion}set scale(e){}get scale(){return this._scale}set matrix(e){this._matrix.set(e||jA),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),c.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),c.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get matrix(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix}get rotationMatrix(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}_rebuildMatrices(){this._matrixDirty&&(c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),c.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),c.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}get rotationMatrixConjugate(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}_setWorldMatrixDirty(){this._matrixDirty=!0,this._aabbDirty=!0}_transformDirty(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}_sceneModelDirty(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(let e=0,t=this._entityList.length;e0}set visible(e){e=!1!==e,this._visible=e;for(let t=0,i=this._entityList.length;t0}set xrayed(e){e=!!e,this._xrayed=e;for(let t=0,i=this._entityList.length;t0}set highlighted(e){e=!!e,this._highlighted=e;for(let t=0,i=this._entityList.length;t0}set selected(e){e=!!e,this._selected=e;for(let t=0,i=this._entityList.length;t0}set edges(e){e=!!e,this._edges=e;for(let t=0,i=this._entityList.length;t0}set pickable(e){e=!1!==e,this._pickable=e;for(let t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){const t=e.colors,i=new Uint8Array(t.length);for(let e=0,s=t.length;e{l.setImage(A,{minFilter:i,magFilter:s,wrapS:r,wrapT:o,wrapR:n,flipY:e.flipY,encoding:a}),this.glRedraw()},A.src=e.src;break;default:this._textureTranscoder?_.loadArraybuffer(e.src,(e=>{e.byteLength?this._textureTranscoder.transcode([e],l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'src': file data is zero length")}),(function(e){this.error(`[createTexture] Can't create texture from 'src': ${e}`)})):this.error(`[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('${t}')`)}}else e.buffers&&(this._textureTranscoder?this._textureTranscoder.transcode(e.buffers,l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option"));this._textures[t]=new lA({id:t,texture:l})}createTextureSet(e){const t=e.id;if(null==t)return void this.error("[createTextureSet] Config missing: id");if(this._textureSets[t])return void this.error(`[createTextureSet] Texture set already created: ${t}`);let i,s,r,o,n;if(void 0!==e.colorTextureId&&null!==e.colorTextureId){if(i=this._textures[e.colorTextureId],!i)return void this.error(`[createTextureSet] Texture not found: ${e.colorTextureId} - ensure that you create it first with createTexture()`)}else i=this._textures.defaultColorTexture;if(void 0!==e.metallicRoughnessTextureId&&null!==e.metallicRoughnessTextureId){if(s=this._textures[e.metallicRoughnessTextureId],!s)return void this.error(`[createTextureSet] Texture not found: ${e.metallicRoughnessTextureId} - ensure that you create it first with createTexture()`)}else s=this._textures.defaultMetalRoughTexture;if(void 0!==e.normalsTextureId&&null!==e.normalsTextureId){if(r=this._textures[e.normalsTextureId],!r)return void this.error(`[createTextureSet] Texture not found: ${e.normalsTextureId} - ensure that you create it first with createTexture()`)}else r=this._textures.defaultNormalsTexture;if(void 0!==e.emissiveTextureId&&null!==e.emissiveTextureId){if(o=this._textures[e.emissiveTextureId],!o)return void this.error(`[createTextureSet] Texture not found: ${e.emissiveTextureId} - ensure that you create it first with createTexture()`)}else o=this._textures.defaultEmissiveTexture;if(void 0!==e.occlusionTextureId&&null!==e.occlusionTextureId){if(n=this._textures[e.occlusionTextureId],!n)return void this.error(`[createTextureSet] Texture not found: ${e.occlusionTextureId} - ensure that you create it first with createTexture()`)}else n=this._textures.defaultOcclusionTexture;const a=new aA({id:t,model:this,colorTexture:i,metallicRoughnessTexture:s,normalsTexture:r,emissiveTexture:o,occlusionTexture:n});return this._textureSets[t]=a,a}createTransform(e){if(void 0===e.id||null===e.id)return void this.error("[createTransform] SceneModel.createTransform() config missing: id");if(this._transforms[e.id])return void this.error(`[createTransform] SceneModel already has a transform with this ID: ${e.id}`);let t;if(e.parentTransformId&&(t=this._transforms[e.parentTransformId],!t))return void this.error("[createTransform] SceneModel.createTransform() config missing: id");const i=new UA({id:e.id,model:this,parent:t,matrix:e.matrix,position:e.position,scale:e.scale,rotation:e.rotation,quaternion:e.quaternion});return this._transforms[i.id]=i,i}createMesh(e){if(void 0===e.id||null===e.id)return this.error("[createMesh] SceneModel.createMesh() config missing: id"),!1;if(this._meshes[e.id])return this.error(`[createMesh] SceneModel already has a mesh with this ID: ${e.id}`),!1;if(!(void 0!==e.geometryId)){if(void 0!==e.primitive&&null!==e.primitive||(e.primitive="triangles"),"points"!==e.primitive&&"lines"!==e.primitive&&"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)return this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`),!1;if(!e.positions&&!e.positionsCompressed&&!e.buckets)return this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)"),!1;if(e.positions&&(e.positionsDecodeMatrix||e.positionsDecodeBoundary))return this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.positionsCompressed&&!e.positionsDecodeMatrix&&!e.positionsDecodeBoundary)return this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.uvCompressed&&!e.uvDecodeMatrix)return this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)"),!1;if(!(e.buckets||e.indices||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)){const t=(e.positions||e.positionsCompressed).length/3;e.indices=this._createDefaultIndices(t)}if(!e.buckets&&!e.indices&&"points"!==e.primitive)return e.indices=this._createDefaultIndices(numIndices),this.error(`Param expected: indices (required for '${e.primitive}' primitive type)`),!1;if((e.matrix||e.position||e.rotation||e.scale)&&(e.positionsCompressed||e.positionsDecodeBoundary))return this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'"),!1;const t=!(!this._dtxEnabled||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive||e.textureSetId);if(e.origin=e.origin?c.addVec3(this._origin,e.origin,c.vec3()):this._origin,e.matrix)e.meshMatrix=e.matrix;else if(e.scale||e.rotation||e.position){const t=e.scale||NA,i=e.position||QA,s=e.rotation||VA;c.eulerToQuaternion(s,"XYZ",HA),e.meshMatrix=c.composeMat4(i,HA,t,c.mat4())}if(e.positionsDecodeBoundary&&(e.positionsDecodeMatrix=Rr(e.positionsDecodeBoundary,c.mat4())),t){if(e.type=2,e.color=e.color?new Uint8Array([Math.floor(255*e.color[0]),Math.floor(255*e.color[1]),Math.floor(255*e.color[2])]):GA,e.opacity=void 0!==e.opacity&&null!==e.opacity?Math.floor(255*e.opacity):255,e.positions){const t=c.vec3(),i=[];z(e.positions,i,t)&&(e.positions=i,e.origin=c.addVec3(e.origin,t,t))}if(e.positions){const t=c.collapseAABB3();e.positionsDecodeMatrix=c.mat4(),c.expandAABB3Points3(t,e.positions),e.positionsCompressed=Tr(e.positions,t,e.positionsDecodeMatrix),e.aabb=t}else if(e.positionsCompressed){const t=c.collapseAABB3();c.expandAABB3Points3(t,e.positionsCompressed),Tt.decompressAABB(t,e.positionsDecodeMatrix),e.aabb=t}if(e.buckets){const t=c.collapseAABB3();for(let i=0,s=e.buckets.length;i>24&255,r=i>>16&255,o=i>>8&255,n=255&i;switch(e.pickColor=new Uint8Array([n,o,r,s]),e.solid="solid"===e.primitive,t.origin=c.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}_getNumPrimitives(e){let t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(let i=0,s=e.buckets.length;i>>0).toString(16)}_getVBOInstancingLayer(e){const t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,o=`${Math.round(i[0])}.${Math.round(i[1])}.${Math.round(i[2])}.${s}.${r}`;let n=this._vboInstancingLayers[o];if(n)return n;let a=e.textureSet;const l=e.geometry;for(;!n;)switch(l.primitive){case"triangles":case"surface":n=new No({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":n=new No({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":n=new Pn({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":n=new _a({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[o]=n,this.layerList.push(n),n}createEntity(e){if(void 0===e.id?e.id=c.createUUID():this.scene.components[e.id]&&(this.error(`Scene already has a Component with this ID: ${e.id} - will assign random ID`),e.id=c.createUUID()),void 0===e.meshIds)return void this.error("Config missing: meshIds");let t=0;this._visible&&!1!==e.visible&&(t|=K),this._pickable&&!1!==e.pickable&&(t|=J),this._culled&&!1!==e.culled&&(t|=X),this._clippable&&!1!==e.clippable&&(t|=Y),this._collidable&&!1!==e.collidable&&(t|=Z),this._edges&&!1!==e.edges&&(t|=te),this._xrayed&&!1!==e.xrayed&&(t|=q),this._highlighted&&!1!==e.highlighted&&(t|=$),this._selected&&!1!==e.selected&&(t|=ee),e.flags=t,this._createEntity(e)}_createEntity(e){let t=[];for(let i=0,s=e.meshIds.length;ie.sortIdt.sortId?1:0));for(let e=0,t=this.layerList.length;e0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}_updateRenderFlagsVisibleLayers(){const e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(let t=0,i=this.layerList.length;t0){const t=`${this.id}-dummyEntityForUnusedMeshes`;this.warn(`Creating dummy SceneModelEntity "${t}" for unused SceneMeshes: [${e.join(",")}]`),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}_getActiveSectionPlanesForLayer(e){const t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(let e=0;e0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){const t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0){this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0))}if(this.numSelectedLayerPortions>0){const t=this.scene.selectedMaterial._state;t.fill&&(t.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){const t=this.scene.highlightMaterial._state;t.fill&&(t.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}drawColorOpaque(e){const t=this.renderFlags;for(let i=0,s=t.visibleLayers.length;i65536?16:8)}else n=[{positionsCompressed:s,indices:r,edgeIndices:o}];return n}class KA extends D{constructor(e,t={}){if(super(e,t),this._positions=t.positions||[],t.indices)this._indices=t.indices;else{this._indices=[];for(let e=0,t=this._positions.length/3-1;e{var r=e-i,o=t-s;return Math.sqrt(r*r+o*o)};class rh extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={};var i=this.plugin.viewer.scene;this._originMarker=new ae(i,t.origin),this._targetMarker=new ae(i,t.target),this._originWorld=c.vec3(),this._targetWorld=c.vec3(),this._wp=new Float64Array(24),this._vp=new Float64Array(24),this._pp=new Float64Array(24),this._cp=new Float64Array(8),this._xAxisLabelCulled=!1,this._yAxisLabelCulled=!1,this._zAxisLabelCulled=!1,this._color=t.color||this.plugin.defaultColor;const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},l=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};this._originDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._targetDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthWire=new le(this._container,{color:this._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisWire=new le(this._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisWire=new le(this._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisWire=new le(this._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthLabel=new he(this._container,{fillColor:this._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisLabel=new he(this._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisLabel=new he(this._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisLabel=new he(this._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._sectionPlanesDirty=!0,this._visible=!1,this._originVisible=!1,this._targetVisible=!1,this._wireVisible=!1,this._axisVisible=!1,this._xAxisVisible=!1,this._yAxisVisible=!1,this._zAxisVisible=!1,this._axisEnabled=!0,this._labelsVisible=!1,this._labelsOnWires=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onMetricsUnits=i.metrics.on("units",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsScale=i.metrics.on("scale",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsOrigin=i.metrics.on("origin",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.targetVisible=t.targetVisible,this.wireVisible=t.wireVisible,this.axisVisible=t.axisVisible,this.xAxisVisible=t.xAxisVisible,this.yAxisVisible=t.yAxisVisible,this.zAxisVisible=t.zAxisVisible,this.labelsVisible=t.labelsVisible,this.labelsOnWires=t.labelsOnWires}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(c.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}const t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){c.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var s=this._pp,r=this._cp,o=e.canvas.canvas.getBoundingClientRect();const t=this._container.getBoundingClientRect();var n=o.top-t.top,a=o.left-t.left,l=e.canvas.boundary,A=l[2],h=l[3],u=0;const i=this.plugin.viewer.scene.metrics,f=i.scale,g=i.units,m=i.unitsInfo[g].abbrev;for(var d=0,p=s.length;de.offsetTop+(e.offsetParent&&e.offsetParent!==s.parentNode&&h(e.offsetParent)),u=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==s.parentNode&&u(e.offsetParent)),d=c.vec2();this._onCameraControlHoverSnapOrSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{const t=e.snappedCanvasPos||e.canvasPos;r=!0,o.set(e.worldPos),n.set(e.canvasPos),0===this._mouseState?(this._canvasToPagePos?(this._canvasToPagePos(s,t,d),this._markerDiv.style.left=d[0]-5+"px",this._markerDiv.style.top=d[1]-5+"px"):(this._markerDiv.style.left=u(s)+t[0]-5+"px",this._markerDiv.style.top=h(s)+t[1]-5+"px"),this._markerDiv.style.background="pink",e.snappedToVertex||e.snappedToEdge?(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,this.pointerLens.snapped=!0),this._markerDiv.style.background="greenyellow",this._markerDiv.style.border="2px solid green"):(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.canvasPos,this.pointerLens.snapped=!1),this._markerDiv.style.background="pink",this._markerDiv.style.border="2px solid red"),A=e.entity):(this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px"),s.style.cursor="pointer",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=this._currentDistanceMeasurementInitState.wireVisible,this._currentDistanceMeasurement.axisVisible=this._currentDistanceMeasurementInitState.axisVisible&&this.distanceMeasurementsPlugin.defaultAxisVisible,this._currentDistanceMeasurement.xAxisVisible=this._currentDistanceMeasurementInitState.xAxisVisible&&this.distanceMeasurementsPlugin.defaultXAxisVisible,this._currentDistanceMeasurement.yAxisVisible=this._currentDistanceMeasurementInitState.yAxisVisible&&this.distanceMeasurementsPlugin.defaultYAxisVisible,this._currentDistanceMeasurement.zAxisVisible=this._currentDistanceMeasurementInitState.zAxisVisible&&this.distanceMeasurementsPlugin.defaultZAxisVisible,this._currentDistanceMeasurement.targetVisible=this._currentDistanceMeasurementInitState.targetVisible,this._currentDistanceMeasurement.target.worldPos=o.slice(),this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px")})),s.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(a=e.clientX,l=e.clientY)}),s.addEventListener("mouseup",this._onMouseUp=t=>{1===t.which&&(t.clientX>a+20||t.clientXl+20||t.clientY{this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos),r=!1,this._markerDiv.style.left="-100px",this._markerDiv.style.top="-100px",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.axisVisible=!1),s.style.cursor="default"})),this._active=!0}deactivate(){if(!this._active)return;this.fire("activated",!1),this.pointerLens&&(this.pointerLens.visible=!1),this._markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.distanceMeasurementsPlugin.viewer.cameraControl;t.off(this._onCameraControlHoverSnapOrSurface),t.off(this._onCameraControlHoverSnapOrSurfaceOff),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null))}destroy(){this.deactivate(),super.destroy()}}class ah{constructor(){}getMetaModel(e,t,i){_.loadJSON(e,(e=>{t(e)}),(function(e){i(e)}))}getGLTF(e,t,i){_.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getGLB(e,t,i){_.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getArrayBuffer(e,t,i,s){!function(e,t,i,s){var r=()=>{};i=i||r,s=s||r;const o=/^data:(.*?)(;base64)?,(.*)$/,n=t.match(o);if(n){const e=!!n[2];var a=n[3];a=window.decodeURIComponent(a),e&&(a=window.atob(a));try{const e=new ArrayBuffer(a.length),t=new Uint8Array(e);for(var l=0;l{i(e)}),(function(e){s(e)}))}}class lh{constructor(e={}){this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=e.messages,this.locale=e.locale}set messages(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}loadMessages(e={}){for(let t in e)this._messages[t]=e[t];this.messages=this._messages}clearMessages(){this.messages={}}get locales(){return this._locales}set locale(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}get locale(){return this._locale}translate(e,t){const i=this._messages[this._locale];if(!i)return null;const s=Ah(e,i);return s?t?hh(s,t):s:null}translatePlurals(e,t,i){const s=this._messages[this._locale];if(!s)return null;let r=Ah(e,s);return r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one,r?(r=hh(r,[t]),i&&(r=hh(r,i)),r):null}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];if(s)for(const e in s)if(s.hasOwnProperty(e)){s[e].callback(t)}}on(t,i){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new e),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});let s=this._eventSubs[t];s||(s={},this._eventSubs[t]=s);const r=this._eventSubIDMap.addItem();s[r]={callback:i},this._eventSubEvents[r]=t;const o=this._events[t];return void 0!==o&&i(o),r}off(e){if(null==e)return;if(!this._eventSubEvents)return;const t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];const i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}function Ah(e,t){if(t[e])return t[e];const i=e.split(".");let s=t;for(let e=0,t=i.length;s&&e1?1:e}get t(){return this._t}get tangent(){return this.getTangent(this._t)}get length(){var e=this._getLengths();return e[e.length-1]}getTangent(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),o=this.getPoint(s),n=c.subVec3(o,r,[]);return c.normalizeVec3(n,[])}getPointAt(e){var t=this.getUToTMapping(e);return this.getPoint(t)}getPoints(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}_getLengths(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),o=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),o+=c.lenVec3(c.subVec3(t,r,[])),s.push(o),r=t;return this.cacheArcLengths=s,s}_updateArcLengths(){this.needsUpdate=!0,this._getLengths()}getUToTMapping(e,t){var i,s=this._getLengths(),r=0,o=s.length;i=t||e*s[o-1];for(var n,a=0,l=o-1;a<=l;)if((n=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(n>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(o-1);var A=s[r];return(r+(i-A)/(s[r+1]-A))/(o-1)}}class uh extends ch{constructor(e,t={}){super(e,t),this.points=t.points,this.t=t.t}set points(e){this._points=e||[]}get points(){return this._points}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,o=t[0===s?s:s-1],n=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],A=c.vec3();return A[0]=c.catmullRomInterpolate(o[0],n[0],a[0],l[0],r),A[1]=c.catmullRomInterpolate(o[1],n[1],a[1],l[1],r),A[2]=c.catmullRomInterpolate(o[2],n[2],a[2],l[2],r),A}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}getJSON(){return{points:points,t:this._t}}}const dh=c.vec3();const ph=c.vec3(),fh=c.vec3(),gh=c.vec3(),mh=c.vec3(),_h=c.vec3();class vh extends D{get type(){return"CameraFlightAnimation"}constructor(e,t={}){super(e,t),this._look1=c.vec3(),this._eye1=c.vec3(),this._up1=c.vec3(),this._look2=c.vec3(),this._eye2=c.vec3(),this._up2=c.vec3(),this._orthoScale1=1,this._orthoScale2=1,this._flying=!1,this._flyEyeLookUp=!1,this._flyingEye=!1,this._flyingLook=!1,this._callback=null,this._callbackScope=null,this._time1=null,this._time2=null,this.easing=!1!==t.easing,this.duration=t.duration,this.fit=t.fit,this.fitFOV=t.fitFOV,this.trail=t.trail}flyTo(e,t,i){e=e||this.scene,this._flying&&this.stop(),this._flying=!1,this._flyingEye=!1,this._flyingLook=!1,this._flyingEyeLookUp=!1,this._callback=t,this._callbackScope=i;const s=this.scene.camera,r=!!e.projection&&e.projection!==s.projection;let o,n,a,l,A;if(this._eye1[0]=s.eye[0],this._eye1[1]=s.eye[1],this._eye1[2]=s.eye[2],this._look1[0]=s.look[0],this._look1[1]=s.look[1],this._look1[2]=s.look[2],this._up1[0]=s.up[0],this._up1[1]=s.up[1],this._up1[2]=s.up[2],this._orthoScale1=s.ortho.scale,this._orthoScale2=e.orthoScale||this._orthoScale1,e.aabb)o=e.aabb;else if(6===e.length)o=e;else if(e.eye&&e.look||e.up)n=e.eye,a=e.look,l=e.up;else if(e.eye)n=e.eye;else if(e.look)a=e.look;else{let s=e;if((_.isNumeric(s)||_.isString(s))&&(A=s,s=this.scene.components[A],!s))return this.error("Component not found: "+_.inQuotes(A)),void(t&&(i?t.call(i):t()));r||(o=s.aabb||this.scene.aabb)}const h=e.poi;if(o){if(o[3]=1;e>1&&(e=1);const i=this.easing?vh._ease(e,0,1,1):e,s=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?(c.subVec3(s.eye,s.look,_h),s.eye=c.lerpVec3(i,0,1,this._eye1,this._eye2,gh),s.look=c.subVec3(gh,_h,fh)):this._flyingLook&&(s.look=c.lerpVec3(i,0,1,this._look1,this._look2,fh),s.up=c.lerpVec3(i,0,1,this._up1,this._up2,mh)):this._flyingEyeLookUp&&(s.eye=c.lerpVec3(i,0,1,this._eye1,this._eye2,gh),s.look=c.lerpVec3(i,0,1,this._look1,this._look2,fh),s.up=c.lerpVec3(i,0,1,this._up1,this._up2,mh)),this._projection2){const t="ortho"===this._projection2?vh._easeOutExpo(e,0,1,1):vh._easeInCubic(e,0,1,1);s.customProjection.matrix=c.lerpMat4(t,0,1,this._projMatrix1,this._projMatrix2)}else s.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return s.ortho.scale=this._orthoScale2,void this.stop();M.scheduleTask(this._update,this)}static _ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}static _easeInCubic(e,t,i,s){return i*(e/=s)*e*e+t}static _easeOutExpo(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}stop(){if(!this._flying)return;this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);const e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}cancel(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}set duration(e){this._duration=e?1e3*e:500,this.stop()}get duration(){return this._duration/1e3}set fit(e){this._fit=!1!==e}get fit(){return this._fit}set fitFOV(e){this._fitFOV=e||45}get fitFOV(){return this._fitFOV}set trail(e){this._trail=!!e}get trail(){return this._trail}destroy(){this.stop(),super.destroy()}}class bh extends D{get type(){return"CameraPathAnimation"}constructor(e,t={}){super(e,t),this._cameraFlightAnimation=new vh(this),this._t=0,this.state=bh.SCRUBBING,this._playingFromT=0,this._playingToT=0,this._playingRate=t.playingRate||1,this._playingDir=1,this._lastTime=null,this.cameraPath=t.cameraPath,this._tick=this.scene.on("tick",this._updateT,this)}_updateT(){const e=this._cameraPath;if(!e)return;let t,i;const s=performance.now(),r=this._lastTime?.001*(s-this._lastTime):0;if(this._lastTime=s,0!==r)switch(this.state){case bh.SCRUBBING:return;case bh.PLAYING:if(this._t+=this._playingRate*r,t=this._cameraPath.frames.length,0===t||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=bh.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case bh.PLAYING_TO:i=this._t+this._playingRate*r*this._playingDir,(this._playingDir<0&&i<=this._playingToT||this._playingDir>0&&i>=this._playingToT)&&(i=this._playingToT,this.state=bh.SCRUBBING,this.fire("stopped")),this._t=i,e.loadFrame(this._t)}}_ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}set cameraPath(e){this._cameraPath=e}get cameraPath(){return this._cameraPath}set rate(e){this._playingRate=e}get rate(){return this._playingRate}play(){this._cameraPath&&(this._lastTime=null,this.state=bh.PLAYING)}playToT(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=bh.PLAYING_TO)}playToFrame(e){const t=this._cameraPath;if(!t)return;const i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}flyToFrame(e,t){const i=this._cameraPath;if(!i)return;const s=i.frames[e];s?(this.state=bh.SCRUBBING,this._cameraFlightAnimation.flyTo(s,t)):this.error("flyToFrame - frame index out of range: "+e)}scrubToT(e){const t=this._cameraPath;if(!t)return;this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=bh.SCRUBBING)}scrubToFrame(e){const t=this._cameraPath;if(!t)return;if(!this.scene.camera)return;t.frames[e]?(t.loadFrame(this._t),this.state=bh.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)}stop(){this.state=bh.SCRUBBING,this.fire("stopped")}destroy(){super.destroy(),this.scene.off(this._tick)}}bh.STOPPED=0,bh.SCRUBBING=1,bh.PLAYING=2,bh.PLAYING_TO=3;const yh=c.vec3(),Bh=c.vec3();c.vec3();const xh=c.vec3([0,-1,0]),wh=c.vec4([0,0,0,1]);function Ph(e){if(!Ch(e.width)||!Ch(e.height)){const t=document.createElement("canvas");t.width=Mh(e.width),t.height=Mh(e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function Ch(e){return 0==(e&e-1)}function Mh(e){--e;for(let t=1;t<32;t<<=1)e|=e>>t;return e+1}class Fh extends D{get type(){return"CubeTexture"}constructor(e,t={}){super(e,t);const i=this.scene.canvas.gl;this._state=new et({texture:new _s({gl:i,target:i.TEXTURE_CUBE_MAP}),flipY:this._checkFlipY(t.minFilter),encoding:this._checkEncoding(t.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),this._src=t.src,this._images=[],this._loadSrc(t.src),p.memory.textures++}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}_loadSrc(e){const t=this,i=this.scene.canvas.gl;this._images=[];let s=!1,r=0;for(let o=0;o{r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}const Ih=c.vec3();const Dh=c.vec3();class Sh{constructor(){this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsHasColorize=[],this.objectsOpacity=[],this.numObjects=0}saveObjects(e,t){this.numObjects=0,this._mask=t?_.apply(t,{}):null;const i=e.objects,s=!t||t.visible,r=!t||t.edges,o=!t||t.xrayed,n=!t||t.highlighted,a=!t||t.selected,l=!t||t.clippable,A=!t||t.pickable,h=!t||t.colorize,c=!t||t.opacity;for(let e in i)if(i.hasOwnProperty(e)){const t=i[e],u=this.numObjects;if(s&&(this.objectsVisible[u]=t.visible),r&&(this.objectsEdges[u]=t.edges),o&&(this.objectsXrayed[u]=t.xrayed),n&&(this.objectsHighlighted[u]=t.highlighted),a&&(this.objectsSelected[u]=t.selected),l&&(this.objectsClippable[u]=t.clippable),A&&(this.objectsPickable[u]=t.pickable),h){const e=t.colorize;e?(this.objectsColorize[3*u+0]=e[0],this.objectsColorize[3*u+1]=e[1],this.objectsColorize[3*u+2]=e[2],this.objectsHasColorize[u]=!0):this.objectsHasColorize[u]=!1}c&&(this.objectsOpacity[u]=t.opacity),this.numObjects++}}restoreObjects(e){const t=this._mask,i=!t||t.visible,s=!t||t.edges,r=!t||t.xrayed,o=!t||t.highlighted,n=!t||t.selected,a=!t||t.clippable,l=!t||t.pickable,A=!t||t.colorize,h=!t||t.opacity;var c=0;const u=e.objects;for(let e in u)if(u.hasOwnProperty(e)){const t=u[e];i&&(t.visible=this.objectsVisible[c]),s&&(t.edges=this.objectsEdges[c]),r&&(t.xrayed=this.objectsXrayed[c]),o&&(t.highlighted=this.objectsHighlighted[c]),n&&(t.selected=this.objectsSelected[c]),a&&(t.clippable=this.objectsClippable[c]),l&&(t.pickable=this.objectsPickable[c]),A&&(this.objectsHasColorize[c]?(Dh[0]=this.objectsColorize[3*c+0],Dh[1]=this.objectsColorize[3*c+1],Dh[2]=this.objectsColorize[3*c+2],t.colorize=Dh):t.colorize=null),h&&(t.opacity=this.objectsOpacity[c]),c++}}}class Th extends D{constructor(e,t={}){super(e,t),this._skyboxMesh=new Wi(this,{geometry:new Ut(this,{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Vt(this,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new ws(this,{src:t.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:t.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),this.size=t.size,this.active=t.active}set size(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}get size(){return this._size}set active(e){this._skyboxMesh.visible=e}get active(){return this._skyboxMesh.visible}}const Rh=c.vec4(),Lh=c.vec4(),Uh=c.vec3(),kh=c.vec3(),Oh=c.vec3(),Nh=c.vec4(),Qh=c.vec4(),Vh=c.vec4();class Hh{constructor(e){this._scene=e}dollyToCanvasPos(e,t,i){let s=!1;const r=this._scene.camera;if(e){const t=c.subVec3(e,r.eye,Uh);s=c.lenVec3(t){this._cameraDirty=!0})),this._onProjMatrix=this._scene.camera.on("projMatrix",(()=>{this._cameraDirty=!0})),this._onTick=this._scene.on("tick",(()=>{this.updatePivotElement(),this.updatePivotSphere()}))}createPivotSphere(){const e=this.getPivotPos(),t=c.vec3();c.decomposeMat4(c.inverseMat4(this._scene.viewer.camera.viewMatrix,c.mat4()),t,c.vec4(),c.vec3());const i=c.distVec3(t,e);let s=Math.tan(Math.PI/500)*i*this._pivotSphereSize;"ortho"==this._scene.camera.projection&&(s/=this._scene.camera.ortho.scale/2),G(e,this._rtcCenter,this._rtcPos),this._pivotSphereGeometry=new Ms(this._scene,Ji({radius:s})),this._pivotSphere=new Wi(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:!1,position:this._rtcPos,rtcCenter:this._rtcCenter})}destroyPivotSphere(){this._pivotSphere&&(this._pivotSphere.destroy(),this._pivotSphere=null),this._pivotSphereGeometry&&(this._pivotSphereGeometry.destroy(),this._pivotSphereGeometry=null)}updatePivotElement(){const e=this._scene.camera,t=this._scene.canvas;if(this._pivoting&&this._cameraDirty){c.transformPoint3(e.viewMatrix,this.getPivotPos(),this._pivotViewPos),this._pivotViewPos[3]=1,c.transformPoint4(e.projMatrix,this._pivotViewPos,this._pivotProjPos);const i=t.boundary,s=i[2],r=i[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*s/2),this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*r/2);let o=t._lastBoundingClientRect;if(!o||t._canvasSizeChanged){const e=t.canvas;o=t._lastBoundingClientRect=e.getBoundingClientRect()}this._pivotElement&&(this._pivotElement.style.left=Math.floor(o.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px",this._pivotElement.style.top=Math.floor(o.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px"),this._cameraDirty=!1}}updatePivotSphere(){this._pivoting&&this._pivotSphere&&(G(this.getPivotPos(),this._rtcCenter,this._rtcPos),c.compareVec3(this._rtcPos,this._pivotSphere.position)||(this.destroyPivotSphere(),this.createPivotSphere()))}setPivotElement(e){this._pivotElement=e}enablePivotSphere(e={}){this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);const t=e.color||[1,0,0];this._pivotSphereMaterial=new Vt(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}disablePivotSphere(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}startPivot(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;const e=this._scene.camera;let t=c.lookAtMat4v(e.eye,e.look,e.worldUp);c.transformPoint3(t,this.getPivotPos(),this._cameraOffset);const i=this.getPivotPos();this._cameraOffset[2]+=c.distVec3(e.eye,i),t=c.inverseMat4(t);const s=c.transformVec3(t,this._cameraOffset),r=c.vec3();if(c.subVec3(e.eye,i,r),c.addVec3(r,s),e.zUp){const e=r[1];r[1]=r[2],r[2]=e}this._radius=c.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}_cameraLookingDownwards(){const e=this._scene.camera,t=c.normalizeVec3(c.subVec3(e.look,e.eye,jh)),i=c.cross3Vec3(t,e.worldUp,Gh);return c.sqLenVec3(i)<=1e-4}getPivoting(){return this._pivoting}setPivotPos(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}setCanvasPivotPos(e){const t=this._scene.camera,i=Math.abs(c.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),o=s.subarray(12),n=[0,0,-1,1],a=c.dotVec4(n,r)/c.dotVec4(n,o),l=Wh;t.project.unproject(e,a,Kh,Xh,l);const A=c.normalizeVec3(c.subVec3(l,t.eye,jh)),h=c.addVec3(t.eye,c.mulVec3Scalar(A,i,Gh),zh);this.setPivotPos(h)}getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}continuePivot(e,t){if(!this._pivoting)return;if(0===e&&0===t)return;const i=this._scene.camera;var s=-e;const r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=c.clamp(this._polar,.001,Math.PI-.001);const o=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){const e=o[1];o[1]=o[2],o[2]=e}const n=c.lenVec3(c.subVec3(i.look,i.eye,c.vec3())),a=this.getPivotPos();c.addVec3(o,a);let l=c.lookAtMat4v(o,a,i.worldUp);l=c.inverseMat4(l);const A=c.transformVec3(l,this._cameraOffset);l[12]-=A[0],l[13]-=A[1],l[14]-=A[2];const h=[l[8],l[9],l[10]];i.eye=[l[12],l[13],l[14]],c.subVec3(i.eye,c.mulVec3Scalar(h,n),i.look),i.up=[l[4],l[5],l[6]],this.showPivot()}showPivot(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}hidePivot(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}endPivot(){this._pivoting=!1}destroy(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}class Yh{constructor(e,t){this._scene=e.scene,this._cameraControl=e,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=t,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=c.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}update(){if(!this._configs.pointerEnabled)return;if(!this.schedulePickEntity&&!this.schedulePickSurface)return;const e=`${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;if(this._lastHash===e)return;this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;const t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){const e=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});e&&(e.snappedToEdge||e.snappedToVertex)?(this.snapPickResult=e,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){const e=this.pickResult.canvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){const e=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}fireEvents(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){const e=new Ce;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){const e=this.pickResult.entity.id;this._lastPickedEntityId!==e&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=e)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}const Zh=c.vec2();class qh{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController;let n,a,l,A=0,h=0,u=0,d=0,p=!1;const f=c.vec3();let g=!0;const m=this._scene.canvas.canvas,_=[];function v(e=!0){m.style.cursor="move",A=s.pointerCanvasPos[0],h=s.pointerCanvasPos[1],u=s.pointerCanvasPos[0],d=s.pointerCanvasPos[1],e&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(p=!0,f.set(o.pickResult.worldPos)):p=!1)}document.addEventListener("keydown",this._documentKeyDownHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!0}),document.addEventListener("keyup",this._documentKeyUpHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!1}),m.addEventListener("mousedown",this._mouseDownHandler=t=>{if(i.active&&i.pointerEnabled)switch(t.which){case 1:_[e.input.KEY_SHIFT]||i.planView?(n=!0,v()):(n=!0,v(!1));break;case 2:a=!0,v();break;case 3:l=!0,i.panRightClick&&v()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(!n&&!a&&!l)return;const o=e.canvas.boundary,u=o[2],d=o[3],g=s.pointerCanvasPos[0],m=s.pointerCanvasPos[1],v=_[e.input.KEY_SHIFT]||i.planView||!i.panRightClick&&a||i.panRightClick&&l,b=document.pointerLockElement?t.movementX:g-A,y=document.pointerLockElement?t.movementY:m-h;if(v){const t=e.camera;if("perspective"===t.projection){const i=Math.abs(p?c.lenVec3(c.subVec3(f,e.camera.eye,[])):e.camera.eyeLookDist)*Math.tan(t.perspective.fov/2*Math.PI/180);r.panDeltaX+=1.5*b*i/d,r.panDeltaY+=1.5*y*i/d}else r.panDeltaX+=.5*t.ortho.scale*(b/d),r.panDeltaY+=.5*t.ortho.scale*(y/d)}else!n||a||l||i.planView||(i.firstPerson?(r.rotateDeltaY-=b/u*i.dragRotationRate/2,r.rotateDeltaX+=y/d*(i.dragRotationRate/4)):(r.rotateDeltaY-=b/u*(1.5*i.dragRotationRate),r.rotateDeltaX+=y/d*(1.5*i.dragRotationRate)));A=g,h=m}),m.addEventListener("mousemove",this._canvasMouseMoveHandler=e=>{i.active&&i.pointerEnabled&&s.mouseover&&(g=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{if(i.active&&i.pointerEnabled)switch(e.which){case 1:case 2:case 3:n=!1,a=!1,l=!1}}),m.addEventListener("mouseup",this._mouseUpHandler=e=>{if(i.active&&i.pointerEnabled){if(3===e.which){!function(e,t){if(e){let i=e.target,s=0,r=0,o=0,n=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,o+=i.scrollLeft,n+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+o-s,t[1]=e.pageY+n-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Zh);const i=Zh[0],s=Zh[1];Math.abs(i-u)<3&&Math.abs(s-d)<3&&t.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Zh,event:e},!0)}m.style.removeProperty("cursor")}}),m.addEventListener("mouseenter",this._mouseEnterHandler=()=>{i.active&&i.pointerEnabled});const b=1/60;let y=null;m.addEventListener("wheel",this._mouseWheelHandler=e=>{if(!i.active||!i.pointerEnabled)return;const t=performance.now()/1e3;var o=null!==y?t-y:0;y=t,o>.05&&(o=.05),o{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const n=r._isKeyDownForAction(r.AXIS_VIEW_RIGHT),a=r._isKeyDownForAction(r.AXIS_VIEW_BACK),l=r._isKeyDownForAction(r.AXIS_VIEW_LEFT),A=r._isKeyDownForAction(r.AXIS_VIEW_FRONT),h=r._isKeyDownForAction(r.AXIS_VIEW_TOP),u=r._isKeyDownForAction(r.AXIS_VIEW_BOTTOM);if(!(n||a||l||A||h||u))return;const d=e.aabb,p=c.getAABB3Diag(d);c.getAABB3Center(d,$h);const f=Math.abs(p/Math.tan(t.cameraFlight.fitFOV*c.DEGTORAD)),g=1.1*p;rc.orthoScale=g,n?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldRight,f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):a?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldForward,f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):l?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldRight,-f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):A?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldForward,-f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):h?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldUp,f,ec),sc)),rc.look.set($h),rc.up.set(c.normalizeVec3(c.mulVec3Scalar(o.worldForward,1,tc),ic))):u&&(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldUp,-f,ec),sc)),rc.look.set($h),rc.up.set(c.normalizeVec3(c.mulVec3Scalar(o.worldForward,-1,tc)))),!i.firstPerson&&i.followPointer&&t.pivotController.setPivotPos($h),t.cameraFlight.duration>0?t.cameraFlight.flyTo(rc,(()=>{t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot()})):(t.cameraFlight.jumpTo(rc),t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot())}))}reset(){}destroy(){this._scene.input.off(this._onSceneKeyDown)}}class nc{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=t.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;let l=!1,A=!1;const h=this._scene.canvas.canvas,u=i=>{let s;i&&i.worldPos&&(s=i.worldPos);const r=i&&i.entity?i.entity.aabb:e.aabb;if(s){const i=e.camera;c.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})},d=e.tickify(this._canvasMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(l||A)return;const r=a.hasSubs("hover"),n=a.hasSubs("hoverEnter"),h=a.hasSubs("hoverOut"),c=a.hasSubs("hoverOff"),u=a.hasSubs("hoverSurface"),d=a.hasSubs("hoverSnapOrSurface");if(r||n||h||c||u||d)if(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=u,o.scheduleSnapOrPick=d,o.update(),o.pickResult){if(o.pickResult.entity){const t=o.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),a.fire("hoverEnter",o.pickResult,!0),this._lastPickedEntityId=t)}a.fire("hover",o.pickResult,!0),(o.pickResult.worldPos||o.pickResult.snappedWorldPos)&&a.fire("hoverSurface",o.pickResult,!0)}else void 0!==this._lastPickedEntityId&&(a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),a.fire("hoverOff",{canvasPos:o.pickCursorPos},!0)});h.addEventListener("mousemove",d),h.addEventListener("mousedown",this._canvasMouseDownHandler=t=>{1===t.which&&(l=!0),3===t.which&&(A=!0);if(1===t.which&&i.active&&i.pointerEnabled&&(s.mouseDownClientX=t.clientX,s.mouseDownClientY=t.clientY,s.mouseDownCursorX=s.pointerCanvasPos[0],s.mouseDownCursorY=s.pointerCanvasPos[1],!i.firstPerson&&i.followPointer&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),1===t.which))){const t=o.pickResult;t&&t.worldPos?(n.setPivotPos(t.worldPos),n.startPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),n.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{1===e.which&&(l=!1),3===e.which&&(A=!1),n.getPivoting()&&n.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=r=>{if(!i.active||!i.pointerEnabled)return;if(!(1===r.which))return;if(n.hidePivot(),Math.abs(r.clientX-s.mouseDownClientX)>3||Math.abs(r.clientY-s.mouseDownClientY)>3)return;const l=a.hasSubs("picked"),A=a.hasSubs("pickedNothing"),h=a.hasSubs("pickedSurface"),d=a.hasSubs("doublePicked"),p=a.hasSubs("doublePickedSurface"),f=a.hasSubs("doublePickedNothing");if(!(i.doublePickFlyTo||d||p||f))return(l||A||h)&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=h,o.update(),o.pickResult?(a.fire("picked",o.pickResult,!0),o.pickedSurface&&a.fire("pickedSurface",o.pickResult,!0)):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0)),void(this._clicks=0);if(this._clicks++,1===this._clicks){o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo,o.schedulePickSurface=h,o.update();const e=o.pickResult,r=o.pickedSurface;this._timeout=setTimeout((()=>{e?(a.fire("picked",e,!0),r&&(a.fire("pickedSurface",e,!0),!i.firstPerson&&i.followPointer&&(t.pivotController.setPivotPos(e.worldPos),t.pivotController.startPivot()&&t.pivotController.showPivot()))):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0),this._clicks=0}),i.doubleClickTimeFrame)}else{if(null!==this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo||d||p,o.schedulePickSurface=o.schedulePickEntity&&p,o.update(),o.pickResult){if(a.fire("doublePicked",o.pickResult,!0),o.pickedSurface&&a.fire("doublePickedSurface",o.pickResult,!0),i.doublePickFlyTo&&(u(o.pickResult),!i.firstPerson&&i.followPointer)){const e=o.pickResult.entity.aabb,i=c.getAABB3Center(e);t.pivotController.setPivotPos(i),t.pivotController.startPivot()&&t.pivotController.showPivot()}}else if(a.fire("doublePickedNothing",{canvasPos:s.pointerCanvasPos},!0),i.doublePickFlyTo&&(u(),!i.firstPerson&&i.followPointer)){const i=e.aabb,s=c.getAABB3Center(i);t.pivotController.setPivotPos(s),t.pivotController.startPivot()&&t.pivotController.showPivot()}this._clicks=0}},!1)}reset(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}destroy(){const e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}class ac{constructor(e,t,i,s,r){this._scene=e;const o=e.input,n=[],a=e.canvas.canvas;let l=!0;this._onSceneMouseMove=o.on("mousemove",(()=>{l=!0})),this._onSceneKeyDown=o.on("keydown",(t=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&s.mouseover&&(n[t]=!0,t===o.KEY_SHIFT&&(a.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(s=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&(n[s]=!1,s===o.KEY_SHIFT&&(a.style.cursor=null),t.pivotController.getPivoting()&&t.pivotController.endPivot())})),this._onTick=e.on("tick",(a=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const A=t.cameraControl,h=a.deltaTime/1e3;if(!i.planView){const e=A._isKeyDownForAction(A.ROTATE_Y_POS,n),s=A._isKeyDownForAction(A.ROTATE_Y_NEG,n),o=A._isKeyDownForAction(A.ROTATE_X_POS,n),a=A._isKeyDownForAction(A.ROTATE_X_NEG,n),l=h*i.keyboardRotationRate;(e||s||o||a)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),e?r.rotateDeltaY+=l:s&&(r.rotateDeltaY-=l),o?r.rotateDeltaX+=l:a&&(r.rotateDeltaX-=l),!i.firstPerson&&i.followPointer&&t.pivotController.startPivot())}if(!n[o.KEY_CTRL]&&!n[o.KEY_ALT]){const e=A._isKeyDownForAction(A.DOLLY_BACKWARDS,n),o=A._isKeyDownForAction(A.DOLLY_FORWARDS,n);if(e||o){const n=h*i.keyboardDollyRate;!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),o?r.dollyDelta-=n:e&&(r.dollyDelta+=n),l&&(s.followPointerDirty=!0,l=!1)}}const c=A._isKeyDownForAction(A.PAN_FORWARDS,n),u=A._isKeyDownForAction(A.PAN_BACKWARDS,n),d=A._isKeyDownForAction(A.PAN_LEFT,n),p=A._isKeyDownForAction(A.PAN_RIGHT,n),f=A._isKeyDownForAction(A.PAN_UP,n),g=A._isKeyDownForAction(A.PAN_DOWN,n),m=(n[o.KEY_ALT]?.3:1)*h*i.keyboardPanRate;(c||u||d||p||f||g)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),g?r.panDeltaY+=m:f&&(r.panDeltaY+=-m),p?r.panDeltaX+=-m:d&&(r.panDeltaX+=m),u?r.panDeltaZ+=m:c&&(r.panDeltaZ+=-m))}))}reset(){}destroy(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}const lc=c.vec3();class Ac{constructor(e,t,i,s,r){this._scene=e;const o=e.camera,n=t.pickController,a=t.pivotController,l=t.panController;let A=1,h=1,u=null;this._onTick=e.on("tick",(()=>{if(!i.active||!i.pointerEnabled)return;let t="default";if(Math.abs(r.dollyDelta)<.001&&(r.dollyDelta=0),Math.abs(r.rotateDeltaX)<.001&&(r.rotateDeltaX=0),Math.abs(r.rotateDeltaY)<.001&&(r.rotateDeltaY=0),0===r.rotateDeltaX&&0===r.rotateDeltaY||(r.dollyDelta=0),i.followPointer){if(--A<=0&&(A=1,0!==r.dollyDelta)){if(0===r.rotateDeltaY&&0===r.rotateDeltaX&&i.followPointer&&s.followPointerDirty&&(n.pickCursorPos=s.pointerCanvasPos,n.schedulePickSurface=!0,n.update(),n.pickResult&&n.pickResult.worldPos?u=n.pickResult.worldPos:(h=1,u=null),s.followPointerDirty=!1),u){const t=Math.abs(c.lenVec3(c.subVec3(u,e.camera.eye,lc)));h=t/i.dollyProximityThreshold}h{s.mouseover=!0}),o.addEventListener("mouseleave",this._mouseLeaveHandler=()=>{s.mouseover=!1,o.style.cursor=null}),document.addEventListener("mousemove",this._mouseMoveHandler=e=>{cc(e,o,s.pointerCanvasPos)}),o.addEventListener("mousedown",this._mouseDownHandler=e=>{i.active&&i.pointerEnabled&&(cc(e,o,s.pointerCanvasPos),s.mouseover=!0)}),o.addEventListener("mouseup",this._mouseUpHandler=e=>{i.active&&i.pointerEnabled})}reset(){}destroy(){const e=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler),e.removeEventListener("mouseenter",this._mouseEnterHandler),e.removeEventListener("mouseleave",this._mouseLeaveHandler),e.removeEventListener("mousedown",this._mouseDownHandler),e.removeEventListener("mouseup",this._mouseUpHandler)}}function cc(e,t,i){if(e){const{left:s,top:r}=t.getBoundingClientRect();i[0]=e.clientX-s,i[1]=e.clientY-r}else e=window.event,i[0]=e.x,i[1]=e.y;return i}const uc=function(e,t){if(e){let i=e.target,s=0,r=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t};class dc{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=c.vec2(),l=c.vec2(),A=c.vec2(),h=c.vec2(),u=[],d=this._scene.canvas.canvas;let p=0,f=!1;this._onTick=e.on("tick",(()=>{f=!1})),d.addEventListener("touchstart",this._canvasTouchStartHandler=t=>{if(!i.active||!i.pointerEnabled)return;t.preventDefault();const r=t.touches,l=t.changedTouches;for(s.touchStartTime=Date.now(),1===r.length&&1===l.length&&(uc(r[0],a),i.followPointer&&(o.pickCursorPos=a,o.schedulePickSurface=!0,o.update(),i.planView||(o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(n.setPivotPos(o.pickResult.worldPos),!i.firstPerson&&n.startPivot()&&n.showPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),!i.firstPerson&&n.startPivot()&&n.showPivot()))));u.length{n.getPivoting()&&n.endPivot()}),d.addEventListener("touchmove",this._canvasTouchMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(t.stopPropagation(),t.preventDefault(),f)return;f=!0;const n=e.canvas.boundary,a=n[2],d=n[3],g=t.touches;if(t.touches.length===p){if(1===p){uc(g[0],l),c.subVec2(l,u[0],h);const t=h[0],o=h[1];if(null!==s.longTouchTimeout&&(Math.abs(t)>i.longTapRadius||Math.abs(o)>i.longTapRadius)&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),i.planView){const s=e.camera;if("perspective"===s.projection){const n=Math.abs(e.camera.eyeLookDist)*Math.tan(s.perspective.fov/2*Math.PI/180);r.panDeltaX+=t*n/d*i.touchPanRate,r.panDeltaY+=o*n/d*i.touchPanRate}else r.panDeltaX+=.5*s.ortho.scale*(t/d)*i.touchPanRate,r.panDeltaY+=.5*s.ortho.scale*(o/d)*i.touchPanRate}else r.rotateDeltaY-=t/a*(1*i.dragRotationRate),r.rotateDeltaX+=o/d*(1.5*i.dragRotationRate)}else if(2===p){const t=g[0],n=g[1];uc(t,l),uc(n,A);const a=c.geometricMeanVec2(u[0],u[1]),h=c.geometricMeanVec2(l,A),p=c.vec2();c.subVec2(a,h,p);const f=p[0],m=p[1],_=e.camera,v=c.distVec2([t.pageX,t.pageY],[n.pageX,n.pageY]),b=(c.distVec2(u[0],u[1])-v)*i.touchDollyRate;if(r.dollyDelta=b,Math.abs(b)<1)if("perspective"===_.projection){const t=o.pickResult?o.pickResult.worldPos:e.center,s=Math.abs(c.lenVec3(c.subVec3(t,e.camera.eye,[])))*Math.tan(_.perspective.fov/2*Math.PI/180);r.panDeltaX-=f*s/d*i.touchPanRate,r.panDeltaY-=m*s/d*i.touchPanRate}else r.panDeltaX-=.5*_.ortho.scale*(f/d)*i.touchPanRate,r.panDeltaY-=.5*_.ortho.scale*(m/d)*i.touchPanRate;s.pointerCanvasPos=h}for(let e=0;e{let s;i&&i.worldPos&&(s=i.worldPos);const r=i?i.entity.aabb:e.aabb;if(s){const i=e.camera;c.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})};d.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{if(!i.active||!i.pointerEnabled)return;null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null);const r=e.touches,o=e.changedTouches;if(a=Date.now(),1===r.length&&1===o.length){h=a,pc(r[0],A);const o=A[0],n=A[1],l=r[0].pageX,c=r[0].pageY;s.longTouchTimeout=setTimeout((()=>{t.cameraControl.fire("rightClick",{pagePos:[Math.round(l),Math.round(c)],canvasPos:[Math.round(o),Math.round(n)],event:e},!0),s.longTouchTimeout=null}),i.longTapTimeout)}else h=-1;for(;l.length{if(!i.active||!i.pointerEnabled)return;const t=Date.now(),r=e.touches,a=e.changedTouches,d=n.hasSubs("pickedSurface");null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),0===r.length&&1===a.length&&h>-1&&t-h<150&&(u>-1&&h-u<325?(pc(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=d,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("doublePicked",o.pickResult),o.pickedSurface&&n.fire("doublePickedSurface",o.pickResult),i.doublePickFlyTo&&p(o.pickResult)):(n.fire("doublePickedNothing"),i.doublePickFlyTo&&p()),u=-1):c.distVec2(l[0],A)<4&&(pc(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=d,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("picked",o.pickResult),o.pickedSurface&&n.fire("pickedSurface",o.pickResult)):n.fire("pickedNothing"),u=t),h=-1),l.length=r.length;for(let e=0,t=r.length;e{e.preventDefault()},this._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},this._states={pointerCanvasPos:c.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:c.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},this._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};const i=this.scene;this._controllers={cameraControl:this,pickController:new Yh(this,this._configs),pivotController:new Jh(i,this._configs),panController:new Hh(i),cameraFlight:new vh(this,{duration:.5})},this._handlers=[new hc(this.scene,this._controllers,this._configs,this._states,this._updates),new dc(this.scene,this._controllers,this._configs,this._states,this._updates),new qh(this.scene,this._controllers,this._configs,this._states,this._updates),new oc(this.scene,this._controllers,this._configs,this._states,this._updates),new nc(this.scene,this._controllers,this._configs,this._states,this._updates),new fc(this.scene,this._controllers,this._configs,this._states,this._updates),new ac(this.scene,this._controllers,this._configs,this._states,this._updates)],this._cameraUpdater=new Ac(this.scene,this._controllers,this._configs,this._states,this._updates),this.navMode=t.navMode,t.planView&&(this.planView=t.planView),this.constrainVertical=t.constrainVertical,t.keyboardLayout?this.keyboardLayout=t.keyboardLayout:this.keyMap=t.keyMap,this.doublePickFlyTo=t.doublePickFlyTo,this.panRightClick=t.panRightClick,this.active=t.active,this.followPointer=t.followPointer,this.rotationInertia=t.rotationInertia,this.keyboardPanRate=t.keyboardPanRate,this.touchPanRate=t.touchPanRate,this.keyboardRotationRate=t.keyboardRotationRate,this.dragRotationRate=t.dragRotationRate,this.touchDollyRate=t.touchDollyRate,this.dollyInertia=t.dollyInertia,this.dollyProximityThreshold=t.dollyProximityThreshold,this.dollyMinSpeed=t.dollyMinSpeed,this.panInertia=t.panInertia,this.pointerEnabled=!0,this.keyboardDollyRate=t.keyboardDollyRate,this.mouseWheelDollyRate=t.mouseWheelDollyRate}set keyMap(e){if(e=e||"qwerty",_.isString(e)){const t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{const t=e;this._keyMap=t}}get keyMap(){return this._keyMap}_isKeyDownForAction(e,t){const i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(let e=0,s=i.length;e0?Bc(t):null,n=i&&i.length>0?Bc(i):null,a=e=>{if(!e)return;var t=!0;(n&&n[e.type]||o&&!o[e.type])&&(t=!1),t&&s.push(e.id);const i=e.children;if(i)for(var r=0,l=i.length;r>t;i.sort(PA);const s=new Int32Array(e.length);for(let t=0,r=i.length;te[t+1]){let i=e[t];e[t]=e[t+1],e[t+1]=i}CA=new Int32Array(e),t.sort(MA);const i=new Int32Array(e.length);for(let s=0,r=t.length;st){let i=e;e=t,t=i}function i(i,s){return i!==e?e-i:s!==t?t-s:0}let s=0,r=(o.length>>1)-1;for(;s<=r;){const e=r+s>>1,t=i(o[2*e],o[2*e+1]);if(t>0)s=e+1;else{if(!(t<0))return e;r=e-1}}return-s-1}const a=new Int32Array(o.length/2);a.fill(0);const l=s.length/3;if(l>8*(1<u.maxNumPositions&&(u=c()),u.bucketNumber>8)return[e];let p;-1===A[l]&&(A[l]=u.numPositions++,u.positionsCompressed.push(s[3*l]),u.positionsCompressed.push(s[3*l+1]),u.positionsCompressed.push(s[3*l+2])),-1===A[h]&&(A[h]=u.numPositions++,u.positionsCompressed.push(s[3*h]),u.positionsCompressed.push(s[3*h+1]),u.positionsCompressed.push(s[3*h+2])),-1===A[d]&&(A[d]=u.numPositions++,u.positionsCompressed.push(s[3*d]),u.positionsCompressed.push(s[3*d+1]),u.positionsCompressed.push(s[3*d+2])),u.indices.push(A[l]),u.indices.push(A[h]),u.indices.push(A[d]),(p=n(l,h))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(l,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(h,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]]))}const d=t/8*2,p=t/8,f=2*s.length+(r.length+o.length)*d;let g=0,m=-s.length/3;return h.forEach((e=>{g+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*p,m+=e.positionsCompressed.length/3})),g>f?[e]:(i&&function(e,t){const i={},s={};let r=0;e.forEach((e=>{const t=e.indices,o=e.edgeIndices,n=e.positionsCompressed;for(let e=0,s=t.length;e0){const e=t._meshes;for(let t=0,i=e.length;t0){const e=this._meshes;for(let t=0,i=e.length;t{this._viewMatrixDirty=!0})),this._meshesWithDirtyMatrices=[],this._numMeshesWithDirtyMatrices=0,this._onTick=this.scene.on("tick",(()=>{for(;this._numMeshesWithDirtyMatrices>0;)this._meshesWithDirtyMatrices[--this._numMeshesWithDirtyMatrices]._updateMatrix()})),this._createDefaultTextureSet(),this.visible=t.visible,this.culled=t.culled,this.pickable=t.pickable,this.clippable=t.clippable,this.collidable=t.collidable,this.castsShadow=t.castsShadow,this.receivesShadow=t.receivesShadow,this.xrayed=t.xrayed,this.highlighted=t.highlighted,this.selected=t.selected,this.edges=t.edges,this.colorize=t.colorize,this.opacity=t.opacity,this.backfaces=t.backfaces}_meshMatrixDirty(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}_createDefaultTextureSet(){const e=new lA({id:"defaultColorTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new lA({id:"defaultMetalRoughTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new lA({id:"defaultNormalsTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new lA({id:"defaultEmissiveTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new lA({id:"defaultOcclusionTexture",texture:new _s({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new aA({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}get isPerformanceModel(){return!0}get transforms(){return this._transforms}get textures(){return this._textures}get textureSets(){return this._textureSets}get meshes(){return this._meshes}get objects(){return this._entities}get origin(){return this._origin}set position(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get position(){return this._position}set rotation(e){this._rotation.set(e||[0,0,0]),c.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get rotation(){return this._rotation}set quaternion(e){this._quaternion.set(e||[0,0,0,1]),c.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get quaternion(){return this._quaternion}set scale(e){}get scale(){return this._scale}set matrix(e){this._matrix.set(e||jA),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),c.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),c.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get matrix(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix}get rotationMatrix(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}_rebuildMatrices(){this._matrixDirty&&(c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),c.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),c.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),c.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}get rotationMatrixConjugate(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}_setWorldMatrixDirty(){this._matrixDirty=!0,this._aabbDirty=!0}_transformDirty(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}_sceneModelDirty(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(let e=0,t=this._entityList.length;e0}set visible(e){e=!1!==e,this._visible=e;for(let t=0,i=this._entityList.length;t0}set xrayed(e){e=!!e,this._xrayed=e;for(let t=0,i=this._entityList.length;t0}set highlighted(e){e=!!e,this._highlighted=e;for(let t=0,i=this._entityList.length;t0}set selected(e){e=!!e,this._selected=e;for(let t=0,i=this._entityList.length;t0}set edges(e){e=!!e,this._edges=e;for(let t=0,i=this._entityList.length;t0}set pickable(e){e=!1!==e,this._pickable=e;for(let t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){const t=e.colors,i=new Uint8Array(t.length);for(let e=0,s=t.length;e{l.setImage(A,{minFilter:i,magFilter:s,wrapS:r,wrapT:o,wrapR:n,flipY:e.flipY,encoding:a}),this.glRedraw()},A.src=e.src;break;default:this._textureTranscoder?_.loadArraybuffer(e.src,(e=>{e.byteLength?this._textureTranscoder.transcode([e],l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'src': file data is zero length")}),(function(e){this.error(`[createTexture] Can't create texture from 'src': ${e}`)})):this.error(`[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('${t}')`)}}else e.buffers&&(this._textureTranscoder?this._textureTranscoder.transcode(e.buffers,l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option"));this._textures[t]=new lA({id:t,texture:l})}createTextureSet(e){const t=e.id;if(null==t)return void this.error("[createTextureSet] Config missing: id");if(this._textureSets[t])return void this.error(`[createTextureSet] Texture set already created: ${t}`);let i,s,r,o,n;if(void 0!==e.colorTextureId&&null!==e.colorTextureId){if(i=this._textures[e.colorTextureId],!i)return void this.error(`[createTextureSet] Texture not found: ${e.colorTextureId} - ensure that you create it first with createTexture()`)}else i=this._textures.defaultColorTexture;if(void 0!==e.metallicRoughnessTextureId&&null!==e.metallicRoughnessTextureId){if(s=this._textures[e.metallicRoughnessTextureId],!s)return void this.error(`[createTextureSet] Texture not found: ${e.metallicRoughnessTextureId} - ensure that you create it first with createTexture()`)}else s=this._textures.defaultMetalRoughTexture;if(void 0!==e.normalsTextureId&&null!==e.normalsTextureId){if(r=this._textures[e.normalsTextureId],!r)return void this.error(`[createTextureSet] Texture not found: ${e.normalsTextureId} - ensure that you create it first with createTexture()`)}else r=this._textures.defaultNormalsTexture;if(void 0!==e.emissiveTextureId&&null!==e.emissiveTextureId){if(o=this._textures[e.emissiveTextureId],!o)return void this.error(`[createTextureSet] Texture not found: ${e.emissiveTextureId} - ensure that you create it first with createTexture()`)}else o=this._textures.defaultEmissiveTexture;if(void 0!==e.occlusionTextureId&&null!==e.occlusionTextureId){if(n=this._textures[e.occlusionTextureId],!n)return void this.error(`[createTextureSet] Texture not found: ${e.occlusionTextureId} - ensure that you create it first with createTexture()`)}else n=this._textures.defaultOcclusionTexture;const a=new aA({id:t,model:this,colorTexture:i,metallicRoughnessTexture:s,normalsTexture:r,emissiveTexture:o,occlusionTexture:n});return this._textureSets[t]=a,a}createTransform(e){if(void 0===e.id||null===e.id)return void this.error("[createTransform] SceneModel.createTransform() config missing: id");if(this._transforms[e.id])return void this.error(`[createTransform] SceneModel already has a transform with this ID: ${e.id}`);let t;if(e.parentTransformId&&(t=this._transforms[e.parentTransformId],!t))return void this.error("[createTransform] SceneModel.createTransform() config missing: id");const i=new UA({id:e.id,model:this,parent:t,matrix:e.matrix,position:e.position,scale:e.scale,rotation:e.rotation,quaternion:e.quaternion});return this._transforms[i.id]=i,i}createMesh(e){if(void 0===e.id||null===e.id)return this.error("[createMesh] SceneModel.createMesh() config missing: id"),!1;if(this._meshes[e.id])return this.error(`[createMesh] SceneModel already has a mesh with this ID: ${e.id}`),!1;if(!(void 0!==e.geometryId)){if(void 0!==e.primitive&&null!==e.primitive||(e.primitive="triangles"),"points"!==e.primitive&&"lines"!==e.primitive&&"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)return this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`),!1;if(!e.positions&&!e.positionsCompressed&&!e.buckets)return this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)"),!1;if(e.positions&&(e.positionsDecodeMatrix||e.positionsDecodeBoundary))return this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.positionsCompressed&&!e.positionsDecodeMatrix&&!e.positionsDecodeBoundary)return this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.uvCompressed&&!e.uvDecodeMatrix)return this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)"),!1;if(!(e.buckets||e.indices||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)){const t=(e.positions||e.positionsCompressed).length/3;e.indices=this._createDefaultIndices(t)}if(!e.buckets&&!e.indices&&"points"!==e.primitive)return e.indices=this._createDefaultIndices(numIndices),this.error(`Param expected: indices (required for '${e.primitive}' primitive type)`),!1;if((e.matrix||e.position||e.rotation||e.scale)&&(e.positionsCompressed||e.positionsDecodeBoundary))return this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'"),!1;const t=!(!this._dtxEnabled||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive||e.textureSetId);if(e.origin=e.origin?c.addVec3(this._origin,e.origin,c.vec3()):this._origin,e.matrix)e.meshMatrix=e.matrix;else if(e.scale||e.rotation||e.position){const t=e.scale||NA,i=e.position||QA,s=e.rotation||VA;c.eulerToQuaternion(s,"XYZ",HA),e.meshMatrix=c.composeMat4(i,HA,t,c.mat4())}if(e.positionsDecodeBoundary&&(e.positionsDecodeMatrix=Rr(e.positionsDecodeBoundary,c.mat4())),t){if(e.type=2,e.color=e.color?new Uint8Array([Math.floor(255*e.color[0]),Math.floor(255*e.color[1]),Math.floor(255*e.color[2])]):GA,e.opacity=void 0!==e.opacity&&null!==e.opacity?Math.floor(255*e.opacity):255,e.positions){const t=c.vec3(),i=[];z(e.positions,i,t)&&(e.positions=i,e.origin=c.addVec3(e.origin,t,t))}if(e.positions){const t=c.collapseAABB3();e.positionsDecodeMatrix=c.mat4(),c.expandAABB3Points3(t,e.positions),e.positionsCompressed=Tr(e.positions,t,e.positionsDecodeMatrix),e.aabb=t}else if(e.positionsCompressed){const t=c.collapseAABB3();c.expandAABB3Points3(t,e.positionsCompressed),Tt.decompressAABB(t,e.positionsDecodeMatrix),e.aabb=t}if(e.buckets){const t=c.collapseAABB3();for(let i=0,s=e.buckets.length;i>24&255,r=i>>16&255,o=i>>8&255,n=255&i;switch(e.pickColor=new Uint8Array([n,o,r,s]),e.solid="solid"===e.primitive,t.origin=c.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}_getNumPrimitives(e){let t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(let i=0,s=e.buckets.length;i>>0).toString(16)}_getVBOInstancingLayer(e){const t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,o=`${Math.round(i[0])}.${Math.round(i[1])}.${Math.round(i[2])}.${s}.${r}`;let n=this._vboInstancingLayers[o];if(n)return n;let a=e.textureSet;const l=e.geometry;for(;!n;)switch(l.primitive){case"triangles":case"surface":n=new No({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":n=new No({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":n=new Pn({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":n=new _a({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[o]=n,this.layerList.push(n),n}createEntity(e){if(void 0===e.id?e.id=c.createUUID():this.scene.components[e.id]&&(this.error(`Scene already has a Component with this ID: ${e.id} - will assign random ID`),e.id=c.createUUID()),void 0===e.meshIds)return void this.error("Config missing: meshIds");let t=0;this._visible&&!1!==e.visible&&(t|=K),this._pickable&&!1!==e.pickable&&(t|=J),this._culled&&!1!==e.culled&&(t|=X),this._clippable&&!1!==e.clippable&&(t|=Y),this._collidable&&!1!==e.collidable&&(t|=Z),this._edges&&!1!==e.edges&&(t|=te),this._xrayed&&!1!==e.xrayed&&(t|=q),this._highlighted&&!1!==e.highlighted&&(t|=$),this._selected&&!1!==e.selected&&(t|=ee),e.flags=t,this._createEntity(e)}_createEntity(e){let t=[];for(let i=0,s=e.meshIds.length;ie.sortIdt.sortId?1:0));for(let e=0,t=this.layerList.length;e0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}_updateRenderFlagsVisibleLayers(){const e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(let t=0,i=this.layerList.length;t0){const t=`${this.id}-dummyEntityForUnusedMeshes`;this.warn(`Creating dummy SceneModelEntity "${t}" for unused SceneMeshes: [${e.join(",")}]`),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}_getActiveSectionPlanesForLayer(e){const t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(let e=0;e0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){const t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0){this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0))}if(this.numSelectedLayerPortions>0){const t=this.scene.selectedMaterial._state;t.fill&&(t.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){const t=this.scene.highlightMaterial._state;t.fill&&(t.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}drawColorOpaque(e){const t=this.renderFlags;for(let i=0,s=t.visibleLayers.length;i65536?16:8)}else n=[{positionsCompressed:s,indices:r,edgeIndices:o}];return n}class KA extends D{constructor(e,t={}){if(super(e,t),this._positions=t.positions||[],t.indices)this._indices=t.indices;else{this._indices=[];for(let e=0,t=this._positions.length/3-1;e{var r=e-i,o=t-s;return Math.sqrt(r*r+o*o)};class rh extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={};var i=this.plugin.viewer.scene;this._originMarker=new ae(i,t.origin),this._targetMarker=new ae(i,t.target),this._originWorld=c.vec3(),this._targetWorld=c.vec3(),this._wp=new Float64Array(24),this._vp=new Float64Array(24),this._pp=new Float64Array(24),this._cp=new Float64Array(8),this._xAxisLabelCulled=!1,this._yAxisLabelCulled=!1,this._zAxisLabelCulled=!1,this._color=t.color||this.plugin.defaultColor;const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},l=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};this._originDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._targetDot=new Ae(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthWire=new le(this._container,{color:this._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisWire=new le(this._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisWire=new le(this._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisWire=new le(this._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthLabel=new he(this._container,{fillColor:this._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisLabel=new he(this._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisLabel=new he(this._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisLabel=new he(this._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._sectionPlanesDirty=!0,this._visible=!1,this._originVisible=!1,this._targetVisible=!1,this._wireVisible=!1,this._axisVisible=!1,this._xAxisVisible=!1,this._yAxisVisible=!1,this._zAxisVisible=!1,this._axisEnabled=!0,this._labelsVisible=!1,this._labelsOnWires=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onMetricsUnits=i.metrics.on("units",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsScale=i.metrics.on("scale",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsOrigin=i.metrics.on("origin",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.targetVisible=t.targetVisible,this.wireVisible=t.wireVisible,this.axisVisible=t.axisVisible,this.xAxisVisible=t.xAxisVisible,this.yAxisVisible=t.yAxisVisible,this.zAxisVisible=t.zAxisVisible,this.labelsVisible=t.labelsVisible,this.labelsOnWires=t.labelsOnWires}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(c.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}const t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){c.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var s=this._pp,r=this._cp,o=e.canvas.canvas.getBoundingClientRect();const t=this._container.getBoundingClientRect();var n=o.top-t.top,a=o.left-t.left,l=e.canvas.boundary,A=l[2],h=l[3],u=0;const i=this.plugin.viewer.scene.metrics,f=i.scale,g=i.units,m=i.unitsInfo[g].abbrev;for(var d=0,p=s.length;de.offsetTop+(e.offsetParent&&e.offsetParent!==s.parentNode&&h(e.offsetParent)),u=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==s.parentNode&&u(e.offsetParent)),d=c.vec2();this._onCameraControlHoverSnapOrSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{const t=e.snappedCanvasPos||e.canvasPos;r=!0,o.set(e.worldPos),n.set(e.canvasPos),0===this._mouseState?(this._canvasToPagePos?(this._canvasToPagePos(s,t,d),this._markerDiv.style.left=d[0]-5+"px",this._markerDiv.style.top=d[1]-5+"px"):(this._markerDiv.style.left=u(s)+t[0]-5+"px",this._markerDiv.style.top=h(s)+t[1]-5+"px"),this._markerDiv.style.background="pink",e.snappedToVertex||e.snappedToEdge?(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,this.pointerLens.snapped=!0),this._markerDiv.style.background="greenyellow",this._markerDiv.style.border="2px solid green"):(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.canvasPos,this.pointerLens.snapped=!1),this._markerDiv.style.background="pink",this._markerDiv.style.border="2px solid red"),A=e.entity):(this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px"),s.style.cursor="pointer",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=this._currentDistanceMeasurementInitState.wireVisible,this._currentDistanceMeasurement.axisVisible=this._currentDistanceMeasurementInitState.axisVisible&&this.distanceMeasurementsPlugin.defaultAxisVisible,this._currentDistanceMeasurement.xAxisVisible=this._currentDistanceMeasurementInitState.xAxisVisible&&this.distanceMeasurementsPlugin.defaultXAxisVisible,this._currentDistanceMeasurement.yAxisVisible=this._currentDistanceMeasurementInitState.yAxisVisible&&this.distanceMeasurementsPlugin.defaultYAxisVisible,this._currentDistanceMeasurement.zAxisVisible=this._currentDistanceMeasurementInitState.zAxisVisible&&this.distanceMeasurementsPlugin.defaultZAxisVisible,this._currentDistanceMeasurement.targetVisible=this._currentDistanceMeasurementInitState.targetVisible,this._currentDistanceMeasurement.target.worldPos=o.slice(),this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px")})),s.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(a=e.clientX,l=e.clientY)}),s.addEventListener("mouseup",this._onMouseUp=t=>{1===t.which&&(t.clientX>a+20||t.clientXl+20||t.clientY{this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos),r=!1,this._markerDiv.style.left="-100px",this._markerDiv.style.top="-100px",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.axisVisible=!1),s.style.cursor="default"})),this._active=!0}deactivate(){if(!this._active)return;this.fire("activated",!1),this.pointerLens&&(this.pointerLens.visible=!1),this._markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.distanceMeasurementsPlugin.viewer.cameraControl;t.off(this._onCameraControlHoverSnapOrSurface),t.off(this._onCameraControlHoverSnapOrSurfaceOff),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._mouseState=0)}get currentMeasurement(){return this._currentDistanceMeasurement}destroy(){this.deactivate(),super.destroy()}}class ah{constructor(){}getMetaModel(e,t,i){_.loadJSON(e,(e=>{t(e)}),(function(e){i(e)}))}getGLTF(e,t,i){_.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getGLB(e,t,i){_.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getArrayBuffer(e,t,i,s){!function(e,t,i,s){var r=()=>{};i=i||r,s=s||r;const o=/^data:(.*?)(;base64)?,(.*)$/,n=t.match(o);if(n){const e=!!n[2];var a=n[3];a=window.decodeURIComponent(a),e&&(a=window.atob(a));try{const e=new ArrayBuffer(a.length),t=new Uint8Array(e);for(var l=0;l{i(e)}),(function(e){s(e)}))}}class lh{constructor(e={}){this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=e.messages,this.locale=e.locale}set messages(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}loadMessages(e={}){for(let t in e)this._messages[t]=e[t];this.messages=this._messages}clearMessages(){this.messages={}}get locales(){return this._locales}set locale(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}get locale(){return this._locale}translate(e,t){const i=this._messages[this._locale];if(!i)return null;const s=Ah(e,i);return s?t?hh(s,t):s:null}translatePlurals(e,t,i){const s=this._messages[this._locale];if(!s)return null;let r=Ah(e,s);return r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one,r?(r=hh(r,[t]),i&&(r=hh(r,i)),r):null}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];if(s)for(const e in s)if(s.hasOwnProperty(e)){s[e].callback(t)}}on(t,i){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new e),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});let s=this._eventSubs[t];s||(s={},this._eventSubs[t]=s);const r=this._eventSubIDMap.addItem();s[r]={callback:i},this._eventSubEvents[r]=t;const o=this._events[t];return void 0!==o&&i(o),r}off(e){if(null==e)return;if(!this._eventSubEvents)return;const t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];const i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}function Ah(e,t){if(t[e])return t[e];const i=e.split(".");let s=t;for(let e=0,t=i.length;s&&e1?1:e}get t(){return this._t}get tangent(){return this.getTangent(this._t)}get length(){var e=this._getLengths();return e[e.length-1]}getTangent(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),o=this.getPoint(s),n=c.subVec3(o,r,[]);return c.normalizeVec3(n,[])}getPointAt(e){var t=this.getUToTMapping(e);return this.getPoint(t)}getPoints(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}_getLengths(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),o=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),o+=c.lenVec3(c.subVec3(t,r,[])),s.push(o),r=t;return this.cacheArcLengths=s,s}_updateArcLengths(){this.needsUpdate=!0,this._getLengths()}getUToTMapping(e,t){var i,s=this._getLengths(),r=0,o=s.length;i=t||e*s[o-1];for(var n,a=0,l=o-1;a<=l;)if((n=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(n>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(o-1);var A=s[r];return(r+(i-A)/(s[r+1]-A))/(o-1)}}class uh extends ch{constructor(e,t={}){super(e,t),this.points=t.points,this.t=t.t}set points(e){this._points=e||[]}get points(){return this._points}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,o=t[0===s?s:s-1],n=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],A=c.vec3();return A[0]=c.catmullRomInterpolate(o[0],n[0],a[0],l[0],r),A[1]=c.catmullRomInterpolate(o[1],n[1],a[1],l[1],r),A[2]=c.catmullRomInterpolate(o[2],n[2],a[2],l[2],r),A}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}getJSON(){return{points:points,t:this._t}}}const dh=c.vec3();const ph=c.vec3(),fh=c.vec3(),gh=c.vec3(),mh=c.vec3(),_h=c.vec3();class vh extends D{get type(){return"CameraFlightAnimation"}constructor(e,t={}){super(e,t),this._look1=c.vec3(),this._eye1=c.vec3(),this._up1=c.vec3(),this._look2=c.vec3(),this._eye2=c.vec3(),this._up2=c.vec3(),this._orthoScale1=1,this._orthoScale2=1,this._flying=!1,this._flyEyeLookUp=!1,this._flyingEye=!1,this._flyingLook=!1,this._callback=null,this._callbackScope=null,this._time1=null,this._time2=null,this.easing=!1!==t.easing,this.duration=t.duration,this.fit=t.fit,this.fitFOV=t.fitFOV,this.trail=t.trail}flyTo(e,t,i){e=e||this.scene,this._flying&&this.stop(),this._flying=!1,this._flyingEye=!1,this._flyingLook=!1,this._flyingEyeLookUp=!1,this._callback=t,this._callbackScope=i;const s=this.scene.camera,r=!!e.projection&&e.projection!==s.projection;let o,n,a,l,A;if(this._eye1[0]=s.eye[0],this._eye1[1]=s.eye[1],this._eye1[2]=s.eye[2],this._look1[0]=s.look[0],this._look1[1]=s.look[1],this._look1[2]=s.look[2],this._up1[0]=s.up[0],this._up1[1]=s.up[1],this._up1[2]=s.up[2],this._orthoScale1=s.ortho.scale,this._orthoScale2=e.orthoScale||this._orthoScale1,e.aabb)o=e.aabb;else if(6===e.length)o=e;else if(e.eye&&e.look||e.up)n=e.eye,a=e.look,l=e.up;else if(e.eye)n=e.eye;else if(e.look)a=e.look;else{let s=e;if((_.isNumeric(s)||_.isString(s))&&(A=s,s=this.scene.components[A],!s))return this.error("Component not found: "+_.inQuotes(A)),void(t&&(i?t.call(i):t()));r||(o=s.aabb||this.scene.aabb)}const h=e.poi;if(o){if(o[3]=1;e>1&&(e=1);const i=this.easing?vh._ease(e,0,1,1):e,s=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?(c.subVec3(s.eye,s.look,_h),s.eye=c.lerpVec3(i,0,1,this._eye1,this._eye2,gh),s.look=c.subVec3(gh,_h,fh)):this._flyingLook&&(s.look=c.lerpVec3(i,0,1,this._look1,this._look2,fh),s.up=c.lerpVec3(i,0,1,this._up1,this._up2,mh)):this._flyingEyeLookUp&&(s.eye=c.lerpVec3(i,0,1,this._eye1,this._eye2,gh),s.look=c.lerpVec3(i,0,1,this._look1,this._look2,fh),s.up=c.lerpVec3(i,0,1,this._up1,this._up2,mh)),this._projection2){const t="ortho"===this._projection2?vh._easeOutExpo(e,0,1,1):vh._easeInCubic(e,0,1,1);s.customProjection.matrix=c.lerpMat4(t,0,1,this._projMatrix1,this._projMatrix2)}else s.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return s.ortho.scale=this._orthoScale2,void this.stop();M.scheduleTask(this._update,this)}static _ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}static _easeInCubic(e,t,i,s){return i*(e/=s)*e*e+t}static _easeOutExpo(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}stop(){if(!this._flying)return;this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);const e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}cancel(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}set duration(e){this._duration=e?1e3*e:500,this.stop()}get duration(){return this._duration/1e3}set fit(e){this._fit=!1!==e}get fit(){return this._fit}set fitFOV(e){this._fitFOV=e||45}get fitFOV(){return this._fitFOV}set trail(e){this._trail=!!e}get trail(){return this._trail}destroy(){this.stop(),super.destroy()}}class bh extends D{get type(){return"CameraPathAnimation"}constructor(e,t={}){super(e,t),this._cameraFlightAnimation=new vh(this),this._t=0,this.state=bh.SCRUBBING,this._playingFromT=0,this._playingToT=0,this._playingRate=t.playingRate||1,this._playingDir=1,this._lastTime=null,this.cameraPath=t.cameraPath,this._tick=this.scene.on("tick",this._updateT,this)}_updateT(){const e=this._cameraPath;if(!e)return;let t,i;const s=performance.now(),r=this._lastTime?.001*(s-this._lastTime):0;if(this._lastTime=s,0!==r)switch(this.state){case bh.SCRUBBING:return;case bh.PLAYING:if(this._t+=this._playingRate*r,t=this._cameraPath.frames.length,0===t||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=bh.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case bh.PLAYING_TO:i=this._t+this._playingRate*r*this._playingDir,(this._playingDir<0&&i<=this._playingToT||this._playingDir>0&&i>=this._playingToT)&&(i=this._playingToT,this.state=bh.SCRUBBING,this.fire("stopped")),this._t=i,e.loadFrame(this._t)}}_ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}set cameraPath(e){this._cameraPath=e}get cameraPath(){return this._cameraPath}set rate(e){this._playingRate=e}get rate(){return this._playingRate}play(){this._cameraPath&&(this._lastTime=null,this.state=bh.PLAYING)}playToT(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=bh.PLAYING_TO)}playToFrame(e){const t=this._cameraPath;if(!t)return;const i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}flyToFrame(e,t){const i=this._cameraPath;if(!i)return;const s=i.frames[e];s?(this.state=bh.SCRUBBING,this._cameraFlightAnimation.flyTo(s,t)):this.error("flyToFrame - frame index out of range: "+e)}scrubToT(e){const t=this._cameraPath;if(!t)return;this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=bh.SCRUBBING)}scrubToFrame(e){const t=this._cameraPath;if(!t)return;if(!this.scene.camera)return;t.frames[e]?(t.loadFrame(this._t),this.state=bh.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)}stop(){this.state=bh.SCRUBBING,this.fire("stopped")}destroy(){super.destroy(),this.scene.off(this._tick)}}bh.STOPPED=0,bh.SCRUBBING=1,bh.PLAYING=2,bh.PLAYING_TO=3;const yh=c.vec3(),Bh=c.vec3();c.vec3();const xh=c.vec3([0,-1,0]),wh=c.vec4([0,0,0,1]);function Ph(e){if(!Ch(e.width)||!Ch(e.height)){const t=document.createElement("canvas");t.width=Mh(e.width),t.height=Mh(e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function Ch(e){return 0==(e&e-1)}function Mh(e){--e;for(let t=1;t<32;t<<=1)e|=e>>t;return e+1}class Fh extends D{get type(){return"CubeTexture"}constructor(e,t={}){super(e,t);const i=this.scene.canvas.gl;this._state=new et({texture:new _s({gl:i,target:i.TEXTURE_CUBE_MAP}),flipY:this._checkFlipY(t.minFilter),encoding:this._checkEncoding(t.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),this._src=t.src,this._images=[],this._loadSrc(t.src),p.memory.textures++}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}_loadSrc(e){const t=this,i=this.scene.canvas.gl;this._images=[];let s=!1,r=0;for(let o=0;o{r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}const Ih=c.vec3();const Dh=c.vec3();class Sh{constructor(){this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsHasColorize=[],this.objectsOpacity=[],this.numObjects=0}saveObjects(e,t){this.numObjects=0,this._mask=t?_.apply(t,{}):null;const i=e.objects,s=!t||t.visible,r=!t||t.edges,o=!t||t.xrayed,n=!t||t.highlighted,a=!t||t.selected,l=!t||t.clippable,A=!t||t.pickable,h=!t||t.colorize,c=!t||t.opacity;for(let e in i)if(i.hasOwnProperty(e)){const t=i[e],u=this.numObjects;if(s&&(this.objectsVisible[u]=t.visible),r&&(this.objectsEdges[u]=t.edges),o&&(this.objectsXrayed[u]=t.xrayed),n&&(this.objectsHighlighted[u]=t.highlighted),a&&(this.objectsSelected[u]=t.selected),l&&(this.objectsClippable[u]=t.clippable),A&&(this.objectsPickable[u]=t.pickable),h){const e=t.colorize;e?(this.objectsColorize[3*u+0]=e[0],this.objectsColorize[3*u+1]=e[1],this.objectsColorize[3*u+2]=e[2],this.objectsHasColorize[u]=!0):this.objectsHasColorize[u]=!1}c&&(this.objectsOpacity[u]=t.opacity),this.numObjects++}}restoreObjects(e){const t=this._mask,i=!t||t.visible,s=!t||t.edges,r=!t||t.xrayed,o=!t||t.highlighted,n=!t||t.selected,a=!t||t.clippable,l=!t||t.pickable,A=!t||t.colorize,h=!t||t.opacity;var c=0;const u=e.objects;for(let e in u)if(u.hasOwnProperty(e)){const t=u[e];i&&(t.visible=this.objectsVisible[c]),s&&(t.edges=this.objectsEdges[c]),r&&(t.xrayed=this.objectsXrayed[c]),o&&(t.highlighted=this.objectsHighlighted[c]),n&&(t.selected=this.objectsSelected[c]),a&&(t.clippable=this.objectsClippable[c]),l&&(t.pickable=this.objectsPickable[c]),A&&(this.objectsHasColorize[c]?(Dh[0]=this.objectsColorize[3*c+0],Dh[1]=this.objectsColorize[3*c+1],Dh[2]=this.objectsColorize[3*c+2],t.colorize=Dh):t.colorize=null),h&&(t.opacity=this.objectsOpacity[c]),c++}}}class Th extends D{constructor(e,t={}){super(e,t),this._skyboxMesh=new Wi(this,{geometry:new Ut(this,{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Vt(this,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new ws(this,{src:t.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:t.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),this.size=t.size,this.active=t.active}set size(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}get size(){return this._size}set active(e){this._skyboxMesh.visible=e}get active(){return this._skyboxMesh.visible}}const Rh=c.vec4(),Lh=c.vec4(),Uh=c.vec3(),kh=c.vec3(),Oh=c.vec3(),Nh=c.vec4(),Qh=c.vec4(),Vh=c.vec4();class Hh{constructor(e){this._scene=e}dollyToCanvasPos(e,t,i){let s=!1;const r=this._scene.camera;if(e){const t=c.subVec3(e,r.eye,Uh);s=c.lenVec3(t){this._cameraDirty=!0})),this._onProjMatrix=this._scene.camera.on("projMatrix",(()=>{this._cameraDirty=!0})),this._onTick=this._scene.on("tick",(()=>{this.updatePivotElement(),this.updatePivotSphere()}))}createPivotSphere(){const e=this.getPivotPos(),t=c.vec3();c.decomposeMat4(c.inverseMat4(this._scene.viewer.camera.viewMatrix,c.mat4()),t,c.vec4(),c.vec3());const i=c.distVec3(t,e);let s=Math.tan(Math.PI/500)*i*this._pivotSphereSize;"ortho"==this._scene.camera.projection&&(s/=this._scene.camera.ortho.scale/2),G(e,this._rtcCenter,this._rtcPos),this._pivotSphereGeometry=new Ms(this._scene,Ji({radius:s})),this._pivotSphere=new Wi(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:!1,position:this._rtcPos,rtcCenter:this._rtcCenter})}destroyPivotSphere(){this._pivotSphere&&(this._pivotSphere.destroy(),this._pivotSphere=null),this._pivotSphereGeometry&&(this._pivotSphereGeometry.destroy(),this._pivotSphereGeometry=null)}updatePivotElement(){const e=this._scene.camera,t=this._scene.canvas;if(this._pivoting&&this._cameraDirty){c.transformPoint3(e.viewMatrix,this.getPivotPos(),this._pivotViewPos),this._pivotViewPos[3]=1,c.transformPoint4(e.projMatrix,this._pivotViewPos,this._pivotProjPos);const i=t.boundary,s=i[2],r=i[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*s/2),this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*r/2);let o=t._lastBoundingClientRect;if(!o||t._canvasSizeChanged){const e=t.canvas;o=t._lastBoundingClientRect=e.getBoundingClientRect()}this._pivotElement&&(this._pivotElement.style.left=Math.floor(o.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px",this._pivotElement.style.top=Math.floor(o.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px"),this._cameraDirty=!1}}updatePivotSphere(){this._pivoting&&this._pivotSphere&&(G(this.getPivotPos(),this._rtcCenter,this._rtcPos),c.compareVec3(this._rtcPos,this._pivotSphere.position)||(this.destroyPivotSphere(),this.createPivotSphere()))}setPivotElement(e){this._pivotElement=e}enablePivotSphere(e={}){this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);const t=e.color||[1,0,0];this._pivotSphereMaterial=new Vt(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}disablePivotSphere(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}startPivot(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;const e=this._scene.camera;let t=c.lookAtMat4v(e.eye,e.look,e.worldUp);c.transformPoint3(t,this.getPivotPos(),this._cameraOffset);const i=this.getPivotPos();this._cameraOffset[2]+=c.distVec3(e.eye,i),t=c.inverseMat4(t);const s=c.transformVec3(t,this._cameraOffset),r=c.vec3();if(c.subVec3(e.eye,i,r),c.addVec3(r,s),e.zUp){const e=r[1];r[1]=r[2],r[2]=e}this._radius=c.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}_cameraLookingDownwards(){const e=this._scene.camera,t=c.normalizeVec3(c.subVec3(e.look,e.eye,jh)),i=c.cross3Vec3(t,e.worldUp,Gh);return c.sqLenVec3(i)<=1e-4}getPivoting(){return this._pivoting}setPivotPos(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}setCanvasPivotPos(e){const t=this._scene.camera,i=Math.abs(c.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),o=s.subarray(12),n=[0,0,-1,1],a=c.dotVec4(n,r)/c.dotVec4(n,o),l=Wh;t.project.unproject(e,a,Kh,Xh,l);const A=c.normalizeVec3(c.subVec3(l,t.eye,jh)),h=c.addVec3(t.eye,c.mulVec3Scalar(A,i,Gh),zh);this.setPivotPos(h)}getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}continuePivot(e,t){if(!this._pivoting)return;if(0===e&&0===t)return;const i=this._scene.camera;var s=-e;const r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=c.clamp(this._polar,.001,Math.PI-.001);const o=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){const e=o[1];o[1]=o[2],o[2]=e}const n=c.lenVec3(c.subVec3(i.look,i.eye,c.vec3())),a=this.getPivotPos();c.addVec3(o,a);let l=c.lookAtMat4v(o,a,i.worldUp);l=c.inverseMat4(l);const A=c.transformVec3(l,this._cameraOffset);l[12]-=A[0],l[13]-=A[1],l[14]-=A[2];const h=[l[8],l[9],l[10]];i.eye=[l[12],l[13],l[14]],c.subVec3(i.eye,c.mulVec3Scalar(h,n),i.look),i.up=[l[4],l[5],l[6]],this.showPivot()}showPivot(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}hidePivot(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}endPivot(){this._pivoting=!1}destroy(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}class Yh{constructor(e,t){this._scene=e.scene,this._cameraControl=e,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=t,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=c.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}update(){if(!this._configs.pointerEnabled)return;if(!this.schedulePickEntity&&!this.schedulePickSurface)return;const e=`${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;if(this._lastHash===e)return;this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;const t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){const e=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});e&&(e.snappedToEdge||e.snappedToVertex)?(this.snapPickResult=e,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){const e=this.pickResult.canvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){const e=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}fireEvents(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){const e=new Ce;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){const e=this.pickResult.entity.id;this._lastPickedEntityId!==e&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=e)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}const Zh=c.vec2();class qh{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController;let n,a,l,A=0,h=0,u=0,d=0,p=!1;const f=c.vec3();let g=!0;const m=this._scene.canvas.canvas,_=[];function v(e=!0){m.style.cursor="move",A=s.pointerCanvasPos[0],h=s.pointerCanvasPos[1],u=s.pointerCanvasPos[0],d=s.pointerCanvasPos[1],e&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(p=!0,f.set(o.pickResult.worldPos)):p=!1)}document.addEventListener("keydown",this._documentKeyDownHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!0}),document.addEventListener("keyup",this._documentKeyUpHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!1}),m.addEventListener("mousedown",this._mouseDownHandler=t=>{if(i.active&&i.pointerEnabled)switch(t.which){case 1:_[e.input.KEY_SHIFT]||i.planView?(n=!0,v()):(n=!0,v(!1));break;case 2:a=!0,v();break;case 3:l=!0,i.panRightClick&&v()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(!n&&!a&&!l)return;const o=e.canvas.boundary,u=o[2],d=o[3],g=s.pointerCanvasPos[0],m=s.pointerCanvasPos[1],v=_[e.input.KEY_SHIFT]||i.planView||!i.panRightClick&&a||i.panRightClick&&l,b=document.pointerLockElement?t.movementX:g-A,y=document.pointerLockElement?t.movementY:m-h;if(v){const t=e.camera;if("perspective"===t.projection){const i=Math.abs(p?c.lenVec3(c.subVec3(f,e.camera.eye,[])):e.camera.eyeLookDist)*Math.tan(t.perspective.fov/2*Math.PI/180);r.panDeltaX+=1.5*b*i/d,r.panDeltaY+=1.5*y*i/d}else r.panDeltaX+=.5*t.ortho.scale*(b/d),r.panDeltaY+=.5*t.ortho.scale*(y/d)}else!n||a||l||i.planView||(i.firstPerson?(r.rotateDeltaY-=b/u*i.dragRotationRate/2,r.rotateDeltaX+=y/d*(i.dragRotationRate/4)):(r.rotateDeltaY-=b/u*(1.5*i.dragRotationRate),r.rotateDeltaX+=y/d*(1.5*i.dragRotationRate)));A=g,h=m}),m.addEventListener("mousemove",this._canvasMouseMoveHandler=e=>{i.active&&i.pointerEnabled&&s.mouseover&&(g=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{if(i.active&&i.pointerEnabled)switch(e.which){case 1:case 2:case 3:n=!1,a=!1,l=!1}}),m.addEventListener("mouseup",this._mouseUpHandler=e=>{if(i.active&&i.pointerEnabled){if(3===e.which){!function(e,t){if(e){let i=e.target,s=0,r=0,o=0,n=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,o+=i.scrollLeft,n+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+o-s,t[1]=e.pageY+n-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Zh);const i=Zh[0],s=Zh[1];Math.abs(i-u)<3&&Math.abs(s-d)<3&&t.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Zh,event:e},!0)}m.style.removeProperty("cursor")}}),m.addEventListener("mouseenter",this._mouseEnterHandler=()=>{i.active&&i.pointerEnabled});const b=1/60;let y=null;m.addEventListener("wheel",this._mouseWheelHandler=e=>{if(!i.active||!i.pointerEnabled)return;const t=performance.now()/1e3;var o=null!==y?t-y:0;y=t,o>.05&&(o=.05),o{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const n=r._isKeyDownForAction(r.AXIS_VIEW_RIGHT),a=r._isKeyDownForAction(r.AXIS_VIEW_BACK),l=r._isKeyDownForAction(r.AXIS_VIEW_LEFT),A=r._isKeyDownForAction(r.AXIS_VIEW_FRONT),h=r._isKeyDownForAction(r.AXIS_VIEW_TOP),u=r._isKeyDownForAction(r.AXIS_VIEW_BOTTOM);if(!(n||a||l||A||h||u))return;const d=e.aabb,p=c.getAABB3Diag(d);c.getAABB3Center(d,$h);const f=Math.abs(p/Math.tan(t.cameraFlight.fitFOV*c.DEGTORAD)),g=1.1*p;rc.orthoScale=g,n?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldRight,f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):a?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldForward,f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):l?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldRight,-f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):A?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldForward,-f,ec),sc)),rc.look.set($h),rc.up.set(o.worldUp)):h?(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldUp,f,ec),sc)),rc.look.set($h),rc.up.set(c.normalizeVec3(c.mulVec3Scalar(o.worldForward,1,tc),ic))):u&&(rc.eye.set(c.addVec3($h,c.mulVec3Scalar(o.worldUp,-f,ec),sc)),rc.look.set($h),rc.up.set(c.normalizeVec3(c.mulVec3Scalar(o.worldForward,-1,tc)))),!i.firstPerson&&i.followPointer&&t.pivotController.setPivotPos($h),t.cameraFlight.duration>0?t.cameraFlight.flyTo(rc,(()=>{t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot()})):(t.cameraFlight.jumpTo(rc),t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot())}))}reset(){}destroy(){this._scene.input.off(this._onSceneKeyDown)}}class nc{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=t.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;let l=!1,A=!1;const h=this._scene.canvas.canvas,u=i=>{let s;i&&i.worldPos&&(s=i.worldPos);const r=i&&i.entity?i.entity.aabb:e.aabb;if(s){const i=e.camera;c.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})},d=e.tickify(this._canvasMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(l||A)return;const r=a.hasSubs("hover"),n=a.hasSubs("hoverEnter"),h=a.hasSubs("hoverOut"),c=a.hasSubs("hoverOff"),u=a.hasSubs("hoverSurface"),d=a.hasSubs("hoverSnapOrSurface");if(r||n||h||c||u||d)if(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=u,o.scheduleSnapOrPick=d,o.update(),o.pickResult){if(o.pickResult.entity){const t=o.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),a.fire("hoverEnter",o.pickResult,!0),this._lastPickedEntityId=t)}a.fire("hover",o.pickResult,!0),(o.pickResult.worldPos||o.pickResult.snappedWorldPos)&&a.fire("hoverSurface",o.pickResult,!0)}else void 0!==this._lastPickedEntityId&&(a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),a.fire("hoverOff",{canvasPos:o.pickCursorPos},!0)});h.addEventListener("mousemove",d),h.addEventListener("mousedown",this._canvasMouseDownHandler=t=>{1===t.which&&(l=!0),3===t.which&&(A=!0);if(1===t.which&&i.active&&i.pointerEnabled&&(s.mouseDownClientX=t.clientX,s.mouseDownClientY=t.clientY,s.mouseDownCursorX=s.pointerCanvasPos[0],s.mouseDownCursorY=s.pointerCanvasPos[1],!i.firstPerson&&i.followPointer&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),1===t.which))){const t=o.pickResult;t&&t.worldPos?(n.setPivotPos(t.worldPos),n.startPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),n.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{1===e.which&&(l=!1),3===e.which&&(A=!1),n.getPivoting()&&n.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=r=>{if(!i.active||!i.pointerEnabled)return;if(!(1===r.which))return;if(n.hidePivot(),Math.abs(r.clientX-s.mouseDownClientX)>3||Math.abs(r.clientY-s.mouseDownClientY)>3)return;const l=a.hasSubs("picked"),A=a.hasSubs("pickedNothing"),h=a.hasSubs("pickedSurface"),d=a.hasSubs("doublePicked"),p=a.hasSubs("doublePickedSurface"),f=a.hasSubs("doublePickedNothing");if(!(i.doublePickFlyTo||d||p||f))return(l||A||h)&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=h,o.update(),o.pickResult?(a.fire("picked",o.pickResult,!0),o.pickedSurface&&a.fire("pickedSurface",o.pickResult,!0)):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0)),void(this._clicks=0);if(this._clicks++,1===this._clicks){o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo,o.schedulePickSurface=h,o.update();const e=o.pickResult,r=o.pickedSurface;this._timeout=setTimeout((()=>{e?(a.fire("picked",e,!0),r&&(a.fire("pickedSurface",e,!0),!i.firstPerson&&i.followPointer&&(t.pivotController.setPivotPos(e.worldPos),t.pivotController.startPivot()&&t.pivotController.showPivot()))):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0),this._clicks=0}),i.doubleClickTimeFrame)}else{if(null!==this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo||d||p,o.schedulePickSurface=o.schedulePickEntity&&p,o.update(),o.pickResult){if(a.fire("doublePicked",o.pickResult,!0),o.pickedSurface&&a.fire("doublePickedSurface",o.pickResult,!0),i.doublePickFlyTo&&(u(o.pickResult),!i.firstPerson&&i.followPointer)){const e=o.pickResult.entity.aabb,i=c.getAABB3Center(e);t.pivotController.setPivotPos(i),t.pivotController.startPivot()&&t.pivotController.showPivot()}}else if(a.fire("doublePickedNothing",{canvasPos:s.pointerCanvasPos},!0),i.doublePickFlyTo&&(u(),!i.firstPerson&&i.followPointer)){const i=e.aabb,s=c.getAABB3Center(i);t.pivotController.setPivotPos(s),t.pivotController.startPivot()&&t.pivotController.showPivot()}this._clicks=0}},!1)}reset(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}destroy(){const e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}class ac{constructor(e,t,i,s,r){this._scene=e;const o=e.input,n=[],a=e.canvas.canvas;let l=!0;this._onSceneMouseMove=o.on("mousemove",(()=>{l=!0})),this._onSceneKeyDown=o.on("keydown",(t=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&s.mouseover&&(n[t]=!0,t===o.KEY_SHIFT&&(a.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(s=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&(n[s]=!1,s===o.KEY_SHIFT&&(a.style.cursor=null),t.pivotController.getPivoting()&&t.pivotController.endPivot())})),this._onTick=e.on("tick",(a=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const A=t.cameraControl,h=a.deltaTime/1e3;if(!i.planView){const e=A._isKeyDownForAction(A.ROTATE_Y_POS,n),s=A._isKeyDownForAction(A.ROTATE_Y_NEG,n),o=A._isKeyDownForAction(A.ROTATE_X_POS,n),a=A._isKeyDownForAction(A.ROTATE_X_NEG,n),l=h*i.keyboardRotationRate;(e||s||o||a)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),e?r.rotateDeltaY+=l:s&&(r.rotateDeltaY-=l),o?r.rotateDeltaX+=l:a&&(r.rotateDeltaX-=l),!i.firstPerson&&i.followPointer&&t.pivotController.startPivot())}if(!n[o.KEY_CTRL]&&!n[o.KEY_ALT]){const e=A._isKeyDownForAction(A.DOLLY_BACKWARDS,n),o=A._isKeyDownForAction(A.DOLLY_FORWARDS,n);if(e||o){const n=h*i.keyboardDollyRate;!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),o?r.dollyDelta-=n:e&&(r.dollyDelta+=n),l&&(s.followPointerDirty=!0,l=!1)}}const c=A._isKeyDownForAction(A.PAN_FORWARDS,n),u=A._isKeyDownForAction(A.PAN_BACKWARDS,n),d=A._isKeyDownForAction(A.PAN_LEFT,n),p=A._isKeyDownForAction(A.PAN_RIGHT,n),f=A._isKeyDownForAction(A.PAN_UP,n),g=A._isKeyDownForAction(A.PAN_DOWN,n),m=(n[o.KEY_ALT]?.3:1)*h*i.keyboardPanRate;(c||u||d||p||f||g)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),g?r.panDeltaY+=m:f&&(r.panDeltaY+=-m),p?r.panDeltaX+=-m:d&&(r.panDeltaX+=m),u?r.panDeltaZ+=m:c&&(r.panDeltaZ+=-m))}))}reset(){}destroy(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}const lc=c.vec3();class Ac{constructor(e,t,i,s,r){this._scene=e;const o=e.camera,n=t.pickController,a=t.pivotController,l=t.panController;let A=1,h=1,u=null;this._onTick=e.on("tick",(()=>{if(!i.active||!i.pointerEnabled)return;let t="default";if(Math.abs(r.dollyDelta)<.001&&(r.dollyDelta=0),Math.abs(r.rotateDeltaX)<.001&&(r.rotateDeltaX=0),Math.abs(r.rotateDeltaY)<.001&&(r.rotateDeltaY=0),0===r.rotateDeltaX&&0===r.rotateDeltaY||(r.dollyDelta=0),i.followPointer){if(--A<=0&&(A=1,0!==r.dollyDelta)){if(0===r.rotateDeltaY&&0===r.rotateDeltaX&&i.followPointer&&s.followPointerDirty&&(n.pickCursorPos=s.pointerCanvasPos,n.schedulePickSurface=!0,n.update(),n.pickResult&&n.pickResult.worldPos?u=n.pickResult.worldPos:(h=1,u=null),s.followPointerDirty=!1),u){const t=Math.abs(c.lenVec3(c.subVec3(u,e.camera.eye,lc)));h=t/i.dollyProximityThreshold}h{s.mouseover=!0}),o.addEventListener("mouseleave",this._mouseLeaveHandler=()=>{s.mouseover=!1,o.style.cursor=null}),document.addEventListener("mousemove",this._mouseMoveHandler=e=>{cc(e,o,s.pointerCanvasPos)}),o.addEventListener("mousedown",this._mouseDownHandler=e=>{i.active&&i.pointerEnabled&&(cc(e,o,s.pointerCanvasPos),s.mouseover=!0)}),o.addEventListener("mouseup",this._mouseUpHandler=e=>{i.active&&i.pointerEnabled})}reset(){}destroy(){const e=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler),e.removeEventListener("mouseenter",this._mouseEnterHandler),e.removeEventListener("mouseleave",this._mouseLeaveHandler),e.removeEventListener("mousedown",this._mouseDownHandler),e.removeEventListener("mouseup",this._mouseUpHandler)}}function cc(e,t,i){if(e){const{left:s,top:r}=t.getBoundingClientRect();i[0]=e.clientX-s,i[1]=e.clientY-r}else e=window.event,i[0]=e.x,i[1]=e.y;return i}const uc=function(e,t){if(e){let i=e.target,s=0,r=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t};class dc{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=c.vec2(),l=c.vec2(),A=c.vec2(),h=c.vec2(),u=[],d=this._scene.canvas.canvas;let p=0,f=!1;this._onTick=e.on("tick",(()=>{f=!1})),d.addEventListener("touchstart",this._canvasTouchStartHandler=t=>{if(!i.active||!i.pointerEnabled)return;t.preventDefault();const r=t.touches,l=t.changedTouches;for(s.touchStartTime=Date.now(),1===r.length&&1===l.length&&(uc(r[0],a),i.followPointer&&(o.pickCursorPos=a,o.schedulePickSurface=!0,o.update(),i.planView||(o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(n.setPivotPos(o.pickResult.worldPos),!i.firstPerson&&n.startPivot()&&n.showPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),!i.firstPerson&&n.startPivot()&&n.showPivot()))));u.length{n.getPivoting()&&n.endPivot()}),d.addEventListener("touchmove",this._canvasTouchMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(t.stopPropagation(),t.preventDefault(),f)return;f=!0;const n=e.canvas.boundary,a=n[2],d=n[3],g=t.touches;if(t.touches.length===p){if(1===p){uc(g[0],l),c.subVec2(l,u[0],h);const t=h[0],o=h[1];if(null!==s.longTouchTimeout&&(Math.abs(t)>i.longTapRadius||Math.abs(o)>i.longTapRadius)&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),i.planView){const s=e.camera;if("perspective"===s.projection){const n=Math.abs(e.camera.eyeLookDist)*Math.tan(s.perspective.fov/2*Math.PI/180);r.panDeltaX+=t*n/d*i.touchPanRate,r.panDeltaY+=o*n/d*i.touchPanRate}else r.panDeltaX+=.5*s.ortho.scale*(t/d)*i.touchPanRate,r.panDeltaY+=.5*s.ortho.scale*(o/d)*i.touchPanRate}else r.rotateDeltaY-=t/a*(1*i.dragRotationRate),r.rotateDeltaX+=o/d*(1.5*i.dragRotationRate)}else if(2===p){const t=g[0],n=g[1];uc(t,l),uc(n,A);const a=c.geometricMeanVec2(u[0],u[1]),h=c.geometricMeanVec2(l,A),p=c.vec2();c.subVec2(a,h,p);const f=p[0],m=p[1],_=e.camera,v=c.distVec2([t.pageX,t.pageY],[n.pageX,n.pageY]),b=(c.distVec2(u[0],u[1])-v)*i.touchDollyRate;if(r.dollyDelta=b,Math.abs(b)<1)if("perspective"===_.projection){const t=o.pickResult?o.pickResult.worldPos:e.center,s=Math.abs(c.lenVec3(c.subVec3(t,e.camera.eye,[])))*Math.tan(_.perspective.fov/2*Math.PI/180);r.panDeltaX-=f*s/d*i.touchPanRate,r.panDeltaY-=m*s/d*i.touchPanRate}else r.panDeltaX-=.5*_.ortho.scale*(f/d)*i.touchPanRate,r.panDeltaY-=.5*_.ortho.scale*(m/d)*i.touchPanRate;s.pointerCanvasPos=h}for(let e=0;e{let s;i&&i.worldPos&&(s=i.worldPos);const r=i?i.entity.aabb:e.aabb;if(s){const i=e.camera;c.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})};d.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{if(!i.active||!i.pointerEnabled)return;null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null);const r=e.touches,o=e.changedTouches;if(a=Date.now(),1===r.length&&1===o.length){h=a,pc(r[0],A);const o=A[0],n=A[1],l=r[0].pageX,c=r[0].pageY;s.longTouchTimeout=setTimeout((()=>{t.cameraControl.fire("rightClick",{pagePos:[Math.round(l),Math.round(c)],canvasPos:[Math.round(o),Math.round(n)],event:e},!0),s.longTouchTimeout=null}),i.longTapTimeout)}else h=-1;for(;l.length{if(!i.active||!i.pointerEnabled)return;const t=Date.now(),r=e.touches,a=e.changedTouches,d=n.hasSubs("pickedSurface");null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),0===r.length&&1===a.length&&h>-1&&t-h<150&&(u>-1&&h-u<325?(pc(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=d,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("doublePicked",o.pickResult),o.pickedSurface&&n.fire("doublePickedSurface",o.pickResult),i.doublePickFlyTo&&p(o.pickResult)):(n.fire("doublePickedNothing"),i.doublePickFlyTo&&p()),u=-1):c.distVec2(l[0],A)<4&&(pc(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=d,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("picked",o.pickResult),o.pickedSurface&&n.fire("pickedSurface",o.pickResult)):n.fire("pickedNothing"),u=t),h=-1),l.length=r.length;for(let e=0,t=r.length;e{e.preventDefault()},this._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},this._states={pointerCanvasPos:c.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:c.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},this._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};const i=this.scene;this._controllers={cameraControl:this,pickController:new Yh(this,this._configs),pivotController:new Jh(i,this._configs),panController:new Hh(i),cameraFlight:new vh(this,{duration:.5})},this._handlers=[new hc(this.scene,this._controllers,this._configs,this._states,this._updates),new dc(this.scene,this._controllers,this._configs,this._states,this._updates),new qh(this.scene,this._controllers,this._configs,this._states,this._updates),new oc(this.scene,this._controllers,this._configs,this._states,this._updates),new nc(this.scene,this._controllers,this._configs,this._states,this._updates),new fc(this.scene,this._controllers,this._configs,this._states,this._updates),new ac(this.scene,this._controllers,this._configs,this._states,this._updates)],this._cameraUpdater=new Ac(this.scene,this._controllers,this._configs,this._states,this._updates),this.navMode=t.navMode,t.planView&&(this.planView=t.planView),this.constrainVertical=t.constrainVertical,t.keyboardLayout?this.keyboardLayout=t.keyboardLayout:this.keyMap=t.keyMap,this.doublePickFlyTo=t.doublePickFlyTo,this.panRightClick=t.panRightClick,this.active=t.active,this.followPointer=t.followPointer,this.rotationInertia=t.rotationInertia,this.keyboardPanRate=t.keyboardPanRate,this.touchPanRate=t.touchPanRate,this.keyboardRotationRate=t.keyboardRotationRate,this.dragRotationRate=t.dragRotationRate,this.touchDollyRate=t.touchDollyRate,this.dollyInertia=t.dollyInertia,this.dollyProximityThreshold=t.dollyProximityThreshold,this.dollyMinSpeed=t.dollyMinSpeed,this.panInertia=t.panInertia,this.pointerEnabled=!0,this.keyboardDollyRate=t.keyboardDollyRate,this.mouseWheelDollyRate=t.mouseWheelDollyRate}set keyMap(e){if(e=e||"qwerty",_.isString(e)){const t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{const t=e;this._keyMap=t}}get keyMap(){return this._keyMap}_isKeyDownForAction(e,t){const i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(let e=0,s=i.length;e0?Bc(t):null,n=i&&i.length>0?Bc(i):null,a=e=>{if(!e)return;var t=!0;(n&&n[e.type]||o&&!o[e.type])&&(t=!1),t&&s.push(e.id);const i=e.children;if(i)for(var r=0,l=i.length;r * Copyright (c) 2022 Niklas von Hertzen @@ -34,4 +34,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var xc=function(e,t){return xc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},xc(e,t)};function wc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}xc(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Pc=function(){return Pc=Object.assign||function(e){for(var t,i=1,s=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=55296&&r<=56319&&i>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},Tc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Lc=0;Lc=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Vc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),jc=0;jc>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s0;){var n=s[--o];if(Array.isArray(e)?-1!==e.indexOf(n):e===n)for(var a=i;a<=s.length;){var l;if((l=s[++a])===t)return!0;if(l!==Gc)break}if(n!==Gc)break}return!1},wu=function(e,t){for(var i=e;i>=0;){var s=t[i];if(s!==Gc)return s;i--}return 0},Pu=function(e,t,i,s,r){if(0===i[s])return"×";var o=s-1;if(Array.isArray(r)&&!0===r[o])return"×";var n=o-1,a=o+1,l=t[o],A=n>=0?t[n]:0,h=t[a];if(2===l&&3===h)return"×";if(-1!==mu.indexOf(l))return"!";if(-1!==mu.indexOf(h))return"×";if(-1!==_u.indexOf(h))return"×";if(8===wu(o,t))return"÷";if(11===fu.get(e[o]))return"×";if((l===ou||l===nu)&&11===fu.get(e[a]))return"×";if(7===l||7===h)return"×";if(9===l)return"×";if(-1===[Gc,zc,Wc].indexOf(l)&&9===h)return"×";if(-1!==[Kc,Xc,Jc,$c,su].indexOf(h))return"×";if(wu(o,t)===qc)return"×";if(xu(23,qc,o,t))return"×";if(xu([Kc,Xc],Zc,o,t))return"×";if(xu(12,12,o,t))return"×";if(l===Gc)return"÷";if(23===l||23===h)return"×";if(16===h||16===l)return"÷";if(-1!==[zc,Wc,Zc].indexOf(h)||14===l)return"×";if(36===A&&-1!==Bu.indexOf(l))return"×";if(l===su&&36===h)return"×";if(h===Yc)return"×";if(-1!==gu.indexOf(h)&&l===eu||-1!==gu.indexOf(l)&&h===eu)return"×";if(l===iu&&-1!==[Au,ou,nu].indexOf(h)||-1!==[Au,ou,nu].indexOf(l)&&h===tu)return"×";if(-1!==gu.indexOf(l)&&-1!==vu.indexOf(h)||-1!==vu.indexOf(l)&&-1!==gu.indexOf(h))return"×";if(-1!==[iu,tu].indexOf(l)&&(h===eu||-1!==[qc,Wc].indexOf(h)&&t[a+1]===eu)||-1!==[qc,Wc].indexOf(l)&&h===eu||l===eu&&-1!==[eu,su,$c].indexOf(h))return"×";if(-1!==[eu,su,$c,Kc,Xc].indexOf(h))for(var c=o;c>=0;){if((u=t[c])===eu)return"×";if(-1===[su,$c].indexOf(u))break;c--}if(-1!==[iu,tu].indexOf(h))for(c=-1!==[Kc,Xc].indexOf(l)?n:o;c>=0;){var u;if((u=t[c])===eu)return"×";if(-1===[su,$c].indexOf(u))break;c--}if(hu===l&&-1!==[hu,cu,au,lu].indexOf(h)||-1!==[cu,au].indexOf(l)&&-1!==[cu,uu].indexOf(h)||-1!==[uu,lu].indexOf(l)&&h===uu)return"×";if(-1!==yu.indexOf(l)&&-1!==[Yc,tu].indexOf(h)||-1!==yu.indexOf(h)&&l===iu)return"×";if(-1!==gu.indexOf(l)&&-1!==gu.indexOf(h))return"×";if(l===$c&&-1!==gu.indexOf(h))return"×";if(-1!==gu.concat(eu).indexOf(l)&&h===qc&&-1===pu.indexOf(e[a])||-1!==gu.concat(eu).indexOf(h)&&l===Xc)return"×";if(41===l&&41===h){for(var d=i[o],p=1;d>0&&41===t[--d];)p++;if(p%2!=0)return"×"}return l===ou&&h===nu?"×":"÷"},Cu=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=function(e,t){void 0===t&&(t="strict");var i=[],s=[],r=[];return e.forEach((function(e,o){var n=fu.get(e);if(n>50?(r.push(!0),n-=50):r.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return s.push(o),i.push(16);if(4===n||11===n){if(0===o)return s.push(o),i.push(ru);var a=i[o-1];return-1===bu.indexOf(a)?(s.push(s[o-1]),i.push(a)):(s.push(o),i.push(ru))}return s.push(o),31===n?i.push("strict"===t?Zc:Au):n===du||29===n?i.push(ru):43===n?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(Au):i.push(ru):void i.push(n)})),[s,i,r]}(e,t.lineBreak),s=i[0],r=i[1],o=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(r=r.map((function(e){return-1!==[eu,ru,du].indexOf(e)?Au:e})));var n="keep-all"===t.wordBreak?o.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[s,r,n]},Mu=function(){function e(e,t,i,s){this.codePoints=e,this.required="!"===t,this.start=i,this.end=s}return e.prototype.slice=function(){return Sc.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Fu=function(e){return e>=48&&e<=57},Eu=function(e){return Fu(e)||e>=65&&e<=70||e>=97&&e<=102},Iu=function(e){return 10===e||9===e||32===e},Du=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},Su=function(e){return Du(e)||Fu(e)||45===e},Tu=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},Ru=function(e,t){return 92===e&&10!==t},Lu=function(e,t,i){return 45===e?Du(t)||Ru(t,i):!!Du(e)||!(92!==e||!Ru(e,t))},Uu=function(e,t,i){return 43===e||45===e?!!Fu(t)||46===t&&Fu(i):Fu(46===e?t:e)},ku=function(e){var t=0,i=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(i=-1),t++);for(var s=[];Fu(e[t]);)s.push(e[t++]);var r=s.length?parseInt(Sc.apply(void 0,s),10):0;46===e[t]&&t++;for(var o=[];Fu(e[t]);)o.push(e[t++]);var n=o.length,a=n?parseInt(Sc.apply(void 0,o),10):0;69!==e[t]&&101!==e[t]||t++;var l=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(l=-1),t++);for(var A=[];Fu(e[t]);)A.push(e[t++]);var h=A.length?parseInt(Sc.apply(void 0,A),10):0;return i*(r+a*Math.pow(10,-n))*Math.pow(10,l*h)},Ou={type:2},Nu={type:3},Qu={type:4},Vu={type:13},Hu={type:8},ju={type:21},Gu={type:9},zu={type:10},Wu={type:11},Ku={type:12},Xu={type:14},Ju={type:23},Yu={type:1},Zu={type:25},qu={type:24},$u={type:26},ed={type:27},td={type:28},id={type:29},sd={type:31},rd={type:32},od=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(Dc(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==rd;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Su(t)||Ru(i,s)){var r=Lu(t,i,s)?2:1;return{type:5,value:this.consumeName(),flags:r}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Vu;break;case 39:return this.consumeStringToken(39);case 40:return Ou;case 41:return Nu;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Xu;break;case 43:if(Uu(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return Qu;case 45:var o=e,n=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Uu(o,n,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Lu(o,n,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(45===n&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),qu;break;case 46:if(Uu(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(42===l&&47===(l=this.consumeCodePoint()))return this.consumeToken();if(-1===l)return this.consumeToken()}break;case 58:return $u;case 59:return ed;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),Zu;break;case 64:var A=this.peekCodePoint(0),h=this.peekCodePoint(1),c=this.peekCodePoint(2);if(Lu(A,h,c))return{type:7,value:this.consumeName()};break;case 91:return td;case 92:if(Ru(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return id;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Hu;break;case 123:return Wu;case 125:return Ku;case 117:case 85:var u=this.peekCodePoint(0),d=this.peekCodePoint(1);return 43!==u||!Eu(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Gu;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),ju;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),zu;break;case-1:return rd}return Iu(e)?(this.consumeWhiteSpace(),sd):Fu(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Du(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Sc(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Eu(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(Sc.apply(void 0,e.map((function(e){return 63===e?48:e}))),16),end:parseInt(Sc.apply(void 0,e.map((function(e){return 63===e?70:e}))),16)};var s=parseInt(Sc.apply(void 0,e),16);if(45===this.peekCodePoint(0)&&Eu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var r=[];Eu(t)&&r.length<6;)r.push(t),t=this.consumeCodePoint();return{type:30,start:s,end:parseInt(Sc.apply(void 0,r),16)}}return{type:30,start:s,end:s}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),Ju)}for(;;){var s=this.consumeCodePoint();if(-1===s||41===s)return{type:22,value:Sc.apply(void 0,e)};if(Iu(s))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Sc.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Ju);if(34===s||39===s||40===s||Tu(s))return this.consumeBadUrlRemnants(),Ju;if(92===s){if(!Ru(s,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Ju;e.push(this.consumeEscapedCodePoint())}else e.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;Iu(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||-1===e)return;Ru(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var i=Math.min(5e4,e);t+=Sc.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var s=this._value[i];if(-1===s||void 0===s||s===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(10===s)return this._value.splice(0,i),Yu;if(92===s){var r=this._value[i+1];-1!==r&&void 0!==r&&(10===r?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):Ru(s,r)&&(t+=this.consumeStringSlice(i),t+=Sc(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=4,i=this.peekCodePoint(0);for(43!==i&&45!==i||e.push(this.consumeCodePoint());Fu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(46===i&&Fu(s))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Fu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),s=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((69===i||101===i)&&((43===s||45===s)&&Fu(r)||Fu(s)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Fu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[ku(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],s=this.peekCodePoint(0),r=this.peekCodePoint(1),o=this.peekCodePoint(2);return Lu(s,r,o)?{type:15,number:t,flags:i,unit:this.consumeName()}:37===s?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Eu(e)){for(var t=Sc(e);Eu(this.peekCodePoint(0))&&t.length<6;)t+=Sc(this.consumeCodePoint());Iu(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||function(e){return e>=55296&&e<=57343}(i)||i>1114111?65533:i}return-1===e?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Su(t))e+=Sc(t);else{if(!Ru(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=Sc(this.consumeEscapedCodePoint())}}},e}(),nd=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new od;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||fd(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?rd:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),ad=function(e){return 15===e.type},ld=function(e){return 17===e.type},Ad=function(e){return 20===e.type},hd=function(e){return 0===e.type},cd=function(e,t){return Ad(e)&&e.value===t},ud=function(e){return 31!==e.type},dd=function(e){return 31!==e.type&&4!==e.type},pd=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},fd=function(e,t){return 11===t&&12===e.type||(28===t&&29===e.type||2===t&&3===e.type)},gd=function(e){return 17===e.type||15===e.type},md=function(e){return 16===e.type||gd(e)},_d=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},vd={type:17,number:0,flags:4},bd={type:16,number:50,flags:4},yd={type:16,number:100,flags:4},Bd=function(e,t,i){var s=e[0],r=e[1];return[xd(s,t),xd(void 0!==r?r:s,i)]},xd=function(e,t){if(16===e.type)return e.number/100*t;if(ad(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},wd=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Pd=function(e){return 15===e.type&&("deg"===e.unit||"grad"===e.unit||"rad"===e.unit||"turn"===e.unit)},Cd=function(e){switch(e.filter(Ad).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[vd,vd];case"to top":case"bottom":return Md(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[vd,yd];case"to right":case"left":return Md(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[yd,yd];case"to bottom":case"top":return Md(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[yd,vd];case"to left":case"right":return Md(270)}return 0},Md=function(e){return Math.PI*e/180},Fd=function(e,t){if(18===t.type){var i=Ud[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);return Dd(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),1)}if(4===t.value.length){s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);var n=t.value.substring(3,4);return Dd(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),parseInt(n+n,16)/255)}if(6===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6);return Dd(parseInt(s,16),parseInt(r,16),parseInt(o,16),1)}if(8===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6),n=t.value.substring(6,8);return Dd(parseInt(s,16),parseInt(r,16),parseInt(o,16),parseInt(n,16)/255)}}if(20===t.type){var a=Od[t.value.toUpperCase()];if(void 0!==a)return a}return Od.TRANSPARENT},Ed=function(e){return 0==(255&e)},Id=function(e){var t=255&e,i=255&e>>8,s=255&e>>16,r=255&e>>24;return t<255?"rgba("+r+","+s+","+i+","+t/255+")":"rgb("+r+","+s+","+i+")"},Dd=function(e,t,i,s){return(e<<24|t<<16|i<<8|Math.round(255*s)<<0)>>>0},Sd=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},Td=function(e,t){var i=t.filter(dd);if(3===i.length){var s=i.map(Sd),r=s[0],o=s[1],n=s[2];return Dd(r,o,n,1)}if(4===i.length){var a=i.map(Sd),l=(r=a[0],o=a[1],n=a[2],a[3]);return Dd(r,o,n,l)}return 0};function Rd(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var Ld=function(e,t){var i=t.filter(dd),s=i[0],r=i[1],o=i[2],n=i[3],a=(17===s.type?Md(s.number):wd(e,s))/(2*Math.PI),l=md(r)?r.number/100:0,A=md(o)?o.number/100:0,h=void 0!==n&&md(n)?xd(n,1):1;if(0===l)return Dd(255*A,255*A,255*A,1);var c=A<=.5?A*(l+1):A+l-A*l,u=2*A-c,d=Rd(u,c,a+1/3),p=Rd(u,c,a),f=Rd(u,c,a-1/3);return Dd(255*d,255*p,255*f,h)},Ud={hsl:Ld,hsla:Ld,rgb:Td,rgba:Td},kd=function(e,t){return Fd(e,nd.create(t).parseComponentValue())},Od={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Nd={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Ad(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Qd={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vd=function(e,t){var i=Fd(e,t[0]),s=t[1];return s&&md(s)?{color:i,stop:s}:{color:i,stop:null}},Hd=function(e,t){var i=e[0],s=e[e.length-1];null===i.stop&&(i.stop=vd),null===s.stop&&(s.stop=yd);for(var r=[],o=0,n=0;no?r.push(l):r.push(o),o=l}else r.push(null)}var A=null;for(n=0;ne.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},Wd=function(e,t){var i=Md(180),s=[];return pd(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(i=Cd(t));if(Pd(o))return void(i=(wd(e,o)+Md(270))%Md(360))}var n=Vd(e,t);s.push(n)})),{angle:i,stops:s,type:1}},Kd=function(e,t){var i=0,s=3,r=[],o=[];return pd(t).forEach((function(t,n){var a=!0;if(0===n?a=t.reduce((function(e,t){if(Ad(t))switch(t.value){case"center":return o.push(bd),!1;case"top":case"left":return o.push(vd),!1;case"right":case"bottom":return o.push(yd),!1}else if(md(t)||gd(t))return o.push(t),!1;return e}),a):1===n&&(a=t.reduce((function(e,t){if(Ad(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"contain":case"closest-side":return s=0,!1;case"farthest-side":return s=1,!1;case"closest-corner":return s=2,!1;case"cover":case"farthest-corner":return s=3,!1}else if(gd(t)||md(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)),a){var l=Vd(e,t);r.push(l)}})),{size:s,shape:i,stops:r,position:o,type:2}},Xd=function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var s=Yd[t.name];if(void 0===s)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return s(e,t.values)}throw new Error("Unsupported image type "+t.type)};var Jd,Yd={"linear-gradient":function(e,t){var i=Md(180),s=[];return pd(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&"to"===o.value)return void(i=Cd(t));if(Pd(o))return void(i=wd(e,o))}var n=Vd(e,t);s.push(n)})),{angle:i,stops:s,type:1}},"-moz-linear-gradient":Wd,"-ms-linear-gradient":Wd,"-o-linear-gradient":Wd,"-webkit-linear-gradient":Wd,"radial-gradient":function(e,t){var i=0,s=3,r=[],o=[];return pd(t).forEach((function(t,n){var a=!0;if(0===n){var l=!1;a=t.reduce((function(e,t){if(l)if(Ad(t))switch(t.value){case"center":return o.push(bd),e;case"top":case"left":return o.push(vd),e;case"right":case"bottom":return o.push(yd),e}else(md(t)||gd(t))&&o.push(t);else if(Ad(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"at":return l=!0,!1;case"closest-side":return s=0,!1;case"cover":case"farthest-side":return s=1,!1;case"contain":case"closest-corner":return s=2,!1;case"farthest-corner":return s=3,!1}else if(gd(t)||md(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)}if(a){var A=Vd(e,t);r.push(A)}})),{size:s,shape:i,stops:r,position:o,type:2}},"-moz-radial-gradient":Kd,"-ms-radial-gradient":Kd,"-o-radial-gradient":Kd,"-webkit-radial-gradient":Kd,"-webkit-gradient":function(e,t){var i=Md(180),s=[],r=1;return pd(t).forEach((function(t,i){var o=t[0];if(0===i){if(Ad(o)&&"linear"===o.value)return void(r=1);if(Ad(o)&&"radial"===o.value)return void(r=2)}if(18===o.type)if("from"===o.name){var n=Fd(e,o.values[0]);s.push({stop:vd,color:n})}else if("to"===o.name){n=Fd(e,o.values[0]);s.push({stop:yd,color:n})}else if("color-stop"===o.name){var a=o.values.filter(dd);if(2===a.length){n=Fd(e,a[1]);var l=a[0];ld(l)&&s.push({stop:{type:16,number:100*l.number,flags:l.flags},color:n})}}})),1===r?{angle:(i+Md(180))%Md(360),stops:s,type:r}:{size:3,shape:0,stops:s,position:[],type:r}}},Zd={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return dd(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Yd[e.name])}(e)})).map((function(t){return Xd(e,t)}))}},qd={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Ad(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},$d={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return pd(t).map((function(e){return e.filter(md)})).map(_d)}},ep={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return pd(t).map((function(e){return e.filter(Ad).map((function(e){return e.value})).join(" ")})).map(tp)}},tp=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Jd||(Jd={}));var ip,sp={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return pd(t).map((function(e){return e.filter(rp)}))}},rp=function(e){return Ad(e)||md(e)},op=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},np=op("top"),ap=op("right"),lp=op("bottom"),Ap=op("left"),hp=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return _d(t.filter(md))}}},cp=hp("top-left"),up=hp("top-right"),dp=hp("bottom-right"),pp=hp("bottom-left"),fp=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},gp=fp("top"),mp=fp("right"),_p=fp("bottom"),vp=fp("left"),bp=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return ad(t)?t.number:0}}},yp=bp("top"),Bp=bp("right"),xp=bp("bottom"),wp=bp("left"),Pp={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Cp={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},Mp={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Ad).reduce((function(e,t){return e|Fp(t.value)}),0)}},Fp=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Ep={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Ip={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(ip||(ip={}));var Dp,Sp={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?ip.STRICT:ip.NORMAL}},Tp={name:"line-height",initialValue:"normal",prefix:!1,type:4},Rp=function(e,t){return Ad(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:md(e)?xd(e,t):t},Lp={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Xd(e,t)}},Up={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},kp={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Op=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Np=Op("top"),Qp=Op("right"),Vp=Op("bottom"),Hp=Op("left"),jp={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Ad).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Gp={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},zp=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Wp=zp("top"),Kp=zp("right"),Xp=zp("bottom"),Jp=zp("left"),Yp={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Zp={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},qp={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&cd(t[0],"none")?[]:pd(t).map((function(t){for(var i={color:Od.TRANSPARENT,offsetX:vd,offsetY:vd,blur:vd},s=0,r=0;r1?1:0],this.overflowWrap=Sf(e,Gp,t.overflowWrap),this.paddingTop=Sf(e,Wp,t.paddingTop),this.paddingRight=Sf(e,Kp,t.paddingRight),this.paddingBottom=Sf(e,Xp,t.paddingBottom),this.paddingLeft=Sf(e,Jp,t.paddingLeft),this.paintOrder=Sf(e,Cf,t.paintOrder),this.position=Sf(e,Zp,t.position),this.textAlign=Sf(e,Yp,t.textAlign),this.textDecorationColor=Sf(e,cf,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=Sf(e,uf,null!==(s=t.textDecorationLine)&&void 0!==s?s:t.textDecoration),this.textShadow=Sf(e,qp,t.textShadow),this.textTransform=Sf(e,$p,t.textTransform),this.transform=Sf(e,ef,t.transform),this.transformOrigin=Sf(e,of,t.transformOrigin),this.visibility=Sf(e,nf,t.visibility),this.webkitTextStrokeColor=Sf(e,Mf,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Sf(e,Ff,t.webkitTextStrokeWidth),this.wordBreak=Sf(e,af,t.wordBreak),this.zIndex=Sf(e,lf,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return Ed(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return _f(this.display,4)||_f(this.display,33554432)||_f(this.display,268435456)||_f(this.display,536870912)||_f(this.display,67108864)||_f(this.display,134217728)},e}(),If=function(e,t){this.content=Sf(e,vf,t.content),this.quotes=Sf(e,xf,t.quotes)},Df=function(e,t){this.counterIncrement=Sf(e,bf,t.counterIncrement),this.counterReset=Sf(e,yf,t.counterReset)},Sf=function(e,t,i){var s=new od,r=null!=i?i.toString():t.initialValue;s.write(r);var o=new nd(s.read());switch(t.type){case 2:var n=o.parseComponentValue();return t.parse(e,Ad(n)?n.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return wd(e,o.parseComponentValue());case"color":return Fd(e,o.parseComponentValue());case"image":return Xd(e,o.parseComponentValue());case"length":var a=o.parseComponentValue();return gd(a)?a:vd;case"length-percentage":var l=o.parseComponentValue();return md(l)?l:vd;case"time":return Af(e,o.parseComponentValue())}}},Tf=function(e,t){var i=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===i||t===i},Rf=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Tf(t,3),this.styles=new Ef(e,window.getComputedStyle(t,null)),Rg(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=Ic(this.context,t),Tf(t,4)&&(this.flags|=16)},Lf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Uf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kf=0;kf=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Qf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hf=0;Hf>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},Jf=function(e,t){var i,s,r,o=function(e){var t,i,s,r,o,n=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(n--,"="===e[e.length-2]&&n--);var A="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(n):new Array(n),h=Array.isArray(A)?A:new Uint8Array(A);for(t=0;t>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s=55296&&r<=56319&&i=i)return{done:!0,value:null};for(var e="×";sn.x||r.y>n.y;return n=r,0===t||a}));return e.body.removeChild(t),a}(document);return Object.defineProperty(ig,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,i=e.createElement("canvas"),s=i.getContext("2d");if(!s)return!1;t.src="data:image/svg+xml,";try{s.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(ig,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var s=t.getContext("2d");if(!s)return Promise.reject(!1);s.fillStyle="rgb(0, 255, 0)",s.fillRect(0,0,i,i);var r=new Image,o=t.toDataURL();r.src=o;var n=eg(i,i,0,0,r);return s.fillStyle="red",s.fillRect(0,0,i,i),tg(n).then((function(t){s.drawImage(t,0,0);var r=s.getImageData(0,0,i,i).data;s.fillStyle="red",s.fillRect(0,0,i,i);var n=e.createElement("div");return n.style.backgroundImage="url("+o+")",n.style.height="100px",$f(r)?tg(eg(i,i,0,0,n)):Promise.reject(!1)})).then((function(e){return s.drawImage(e,0,0),$f(s.getImageData(0,0,i,i).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(ig,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(ig,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(ig,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ig,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(ig,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},sg=function(e,t){this.text=e,this.bounds=t},rg=function(e,t){var i=t.ownerDocument;if(i){var s=i.createElement("html2canvaswrapper");s.appendChild(t.cloneNode(!0));var r=t.parentNode;if(r){r.replaceChild(s,t);var o=Ic(e,s);return s.firstChild&&r.replaceChild(s.firstChild,s),o}}return Ec.EMPTY},og=function(e,t,i){var s=e.ownerDocument;if(!s)throw new Error("Node has no owner document");var r=s.createRange();return r.setStart(e,t),r.setEnd(e,t+i),r},ng=function(e){if(ig.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return function(e){for(var t,i=qf(e),s=[];!(t=i.next()).done;)t.value&&s.push(t.value.slice());return s}(e)},ag=function(e,t){return 0!==t.letterSpacing?ng(e):function(e,t){if(ig.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return Ag(e,t)}(e,t)},lg=[32,160,4961,65792,65793,4153,4241],Ag=function(e,t){for(var i,s=function(e,t){var i=Dc(e),s=Cu(i,t),r=s[0],o=s[1],n=s[2],a=i.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var e="×";A0)if(ig.SUPPORT_RANGE_BOUNDS){var r=og(s,n,t.length).getClientRects();if(r.length>1){var a=ng(t),l=0;a.forEach((function(t){o.push(new sg(t,Ec.fromDOMRectList(e,og(s,l+n,t.length).getClientRects()))),l+=t.length}))}else o.push(new sg(t,Ec.fromDOMRectList(e,r)))}else{var A=s.splitText(t.length);o.push(new sg(t,rg(e,s))),s=A}else ig.SUPPORT_RANGE_BOUNDS||(s=s.splitText(t.length));n+=t.length})),o}(e,this.text,i,t)},cg=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(ug,dg);case 2:return e.toUpperCase();default:return e}},ug=/(^|\s|:|-|\(|\))([a-z])/g,dg=function(e,t,i){return e.length>0?t+i.toUpperCase():e},pg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.src=i.currentSrc||i.src,s.intrinsicWidth=i.naturalWidth,s.intrinsicHeight=i.naturalHeight,s.context.cache.addImage(s.src),s}return wc(t,e),t}(Rf),fg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.canvas=i,s.intrinsicWidth=i.width,s.intrinsicHeight=i.height,s}return wc(t,e),t}(Rf),gg=function(e){function t(t,i){var s=e.call(this,t,i)||this,r=new XMLSerializer,o=Ic(t,i);return i.setAttribute("width",o.width+"px"),i.setAttribute("height",o.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(i)),s.intrinsicWidth=i.width.baseVal.value,s.intrinsicHeight=i.height.baseVal.value,s.context.cache.addImage(s.svg),s}return wc(t,e),t}(Rf),mg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.value=i.value,s}return wc(t,e),t}(Rf),_g=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.start=i.start,s.reversed="boolean"==typeof i.reversed&&!0===i.reversed,s}return wc(t,e),t}(Rf),vg=[{type:15,flags:0,unit:"px",number:3}],bg=[{type:16,flags:0,number:50}],yg="password",Bg=function(e){function t(t,i){var s,r=e.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=function(e){var t=e.type===yg?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}(i),"checkbox"!==r.type&&"radio"!==r.type||(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=(s=r.bounds).width>s.height?new Ec(s.left+(s.width-s.height)/2,s.top,s.height,s.height):s.width0)i.textNodes.push(new hg(e,r,i.styles));else if(Tg(r))if(Xg(r)&&r.assignedNodes)r.assignedNodes().forEach((function(t){return Mg(e,t,i,s)}));else{var n=Fg(e,r);n.styles.isVisible()&&(Ig(r,n,s)?n.flags|=4:Dg(n.styles)&&(n.flags|=2),-1!==Cg.indexOf(r.tagName)&&(n.flags|=8),i.elements.push(n),r.slot,r.shadowRoot?Mg(e,r.shadowRoot,n,s):Wg(r)||Ng(r)||Kg(r)||Mg(e,r,n,s))}},Fg=function(e,t){return jg(t)?new pg(e,t):Vg(t)?new fg(e,t):Ng(t)?new gg(e,t):Ug(t)?new mg(e,t):kg(t)?new _g(e,t):Og(t)?new Bg(e,t):Kg(t)?new xg(e,t):Wg(t)?new wg(e,t):Gg(t)?new Pg(e,t):new Rf(e,t)},Eg=function(e,t){var i=Fg(e,t);return i.flags|=4,Mg(e,t,i,i),i},Ig=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Qg(e)&&i.styles.isTransparent()},Dg=function(e){return e.isPositioned()||e.isFloating()},Sg=function(e){return e.nodeType===Node.TEXT_NODE},Tg=function(e){return e.nodeType===Node.ELEMENT_NODE},Rg=function(e){return Tg(e)&&void 0!==e.style&&!Lg(e)},Lg=function(e){return"object"==typeof e.className},Ug=function(e){return"LI"===e.tagName},kg=function(e){return"OL"===e.tagName},Og=function(e){return"INPUT"===e.tagName},Ng=function(e){return"svg"===e.tagName},Qg=function(e){return"BODY"===e.tagName},Vg=function(e){return"CANVAS"===e.tagName},Hg=function(e){return"VIDEO"===e.tagName},jg=function(e){return"IMG"===e.tagName},Gg=function(e){return"IFRAME"===e.tagName},zg=function(e){return"STYLE"===e.tagName},Wg=function(e){return"TEXTAREA"===e.tagName},Kg=function(e){return"SELECT"===e.tagName},Xg=function(e){return"SLOT"===e.tagName},Jg=function(e){return e.tagName.indexOf("-")>0},Yg=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,s=e.counterReset,r=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(r=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var o=[];return r&&s.forEach((function(e){var i=t.counters[e.counter];o.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),o},e}(),Zg={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},qg={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},$g={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},em={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},tm=function(e,t,i,s,r,o){return ei?nm(e,r,o.length>0):s.integers.reduce((function(t,i,r){for(;e>=i;)e-=i,t+=s.values[r];return t}),"")+o},im=function(e,t,i,s){var r="";do{i||e--,r=s(e)+r,e/=t}while(e*t>=t);return r},sm=function(e,t,i,s,r){var o=i-t+1;return(e<0?"-":"")+(im(Math.abs(e),o,s,(function(e){return Sc(Math.floor(e%o)+t)}))+r)},rm=function(e,t,i){void 0===i&&(i=". ");var s=t.length;return im(Math.abs(e),s,!1,(function(e){return t[Math.floor(e%s)]}))+i},om=function(e,t,i,s,r,o){if(e<-9999||e>9999)return nm(e,4,r.length>0);var n=Math.abs(e),a=r;if(0===n)return t[0]+a;for(var l=0;n>0&&l<=4;l++){var A=n%10;0===A&&_f(o,1)&&""!==a?a=t[A]+a:A>1||1===A&&0===l||1===A&&1===l&&_f(o,2)||1===A&&1===l&&_f(o,4)&&e>100||1===A&&l>1&&_f(o,8)?a=t[A]+(l>0?i[l-1]:"")+a:1===A&&l>0&&(a=i[l-1]+a),n=Math.floor(n/10)}return(e<0?s:"")+a},nm=function(e,t,i){var s=i?". ":"",r=i?"、":"",o=i?", ":"",n=i?" ":"";switch(t){case 0:return"•"+n;case 1:return"◦"+n;case 2:return"◾"+n;case 5:var a=sm(e,48,57,!0,s);return a.length<4?"0"+a:a;case 4:return rm(e,"〇一二三四五六七八九",r);case 6:return tm(e,1,3999,Zg,3,s).toLowerCase();case 7:return tm(e,1,3999,Zg,3,s);case 8:return sm(e,945,969,!1,s);case 9:return sm(e,97,122,!1,s);case 10:return sm(e,65,90,!1,s);case 11:return sm(e,1632,1641,!0,s);case 12:case 49:return tm(e,1,9999,qg,3,s);case 35:return tm(e,1,9999,qg,3,s).toLowerCase();case 13:return sm(e,2534,2543,!0,s);case 14:case 30:return sm(e,6112,6121,!0,s);case 15:return rm(e,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return rm(e,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return om(e,"零一二三四五六七八九","十百千萬","負",r,14);case 47:return om(e,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",r,15);case 42:return om(e,"零一二三四五六七八九","十百千萬","负",r,14);case 41:return om(e,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",r,15);case 26:return om(e,"〇一二三四五六七八九","十百千万","マイナス",r,0);case 25:return om(e,"零壱弐参四伍六七八九","拾百千万","マイナス",r,7);case 31:return om(e,"영일이삼사오육칠팔구","십백천만","마이너스",o,7);case 33:return om(e,"零一二三四五六七八九","十百千萬","마이너스",o,0);case 32:return om(e,"零壹貳參四五六七八九","拾百千","마이너스",o,7);case 18:return sm(e,2406,2415,!0,s);case 20:return tm(e,1,19999,em,3,s);case 21:return sm(e,2790,2799,!0,s);case 22:return sm(e,2662,2671,!0,s);case 22:return tm(e,1,10999,$g,3,s);case 23:return rm(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return rm(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return sm(e,3302,3311,!0,s);case 28:return rm(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return rm(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return sm(e,3792,3801,!0,s);case 37:return sm(e,6160,6169,!0,s);case 38:return sm(e,4160,4169,!0,s);case 39:return sm(e,2918,2927,!0,s);case 40:return sm(e,1776,1785,!0,s);case 43:return sm(e,3046,3055,!0,s);case 44:return sm(e,3174,3183,!0,s);case 45:return sm(e,3664,3673,!0,s);case 46:return sm(e,3872,3881,!0,s);default:return sm(e,48,57,!0,s)}},am=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Yg,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,s=Am(e,t);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,o=e.defaultView.pageYOffset,n=s.contentWindow,a=n.document,l=um(s).then((function(){return Cc(i,void 0,void 0,(function(){var e,i;return Mc(this,(function(r){switch(r.label){case 0:return this.scrolledElements.forEach(mm),n&&(n.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||n.scrollY===t.top&&n.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(n.scrollX-t.left,n.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cm(a)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(a,i)})).then((function(){return s}))]:[2,s]}}))}))}));return a.open(),a.write(fm(document.doctype)+""),gm(this.referenceElement.ownerDocument,r,o),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},e.prototype.createElementClone=function(e){if(Tf(e,2),Vg(e))return this.createCanvasClone(e);if(Hg(e))return this.createVideoClone(e);if(zg(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return jg(t)&&(jg(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),Jg(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return pm(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),s=e.cloneNode(!1);return s.textContent=i,s}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var s=e.cloneNode(!1);try{s.width=e.width,s.height=e.height;var r=e.getContext("2d"),o=s.getContext("2d");if(o)if(!this.options.allowTaint&&r)o.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var n=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(n){var a=n.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return s}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return s},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var s=e.ownerDocument.createElement("canvas");return s.width=e.offsetWidth,s.height=e.offsetHeight,s},e.prototype.appendChildNode=function(e,t,i){Tg(t)&&(function(e){return"SCRIPT"===e.tagName}(t)||t.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&Tg(t)&&zg(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var s=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(Tg(r)&&Xg(r)&&"function"==typeof r.assignedNodes){var o=r.assignedNodes();o.length&&o.forEach((function(e){return s.appendChildNode(t,e,i)}))}else this.appendChildNode(t,r,i)},e.prototype.cloneNode=function(e,t){if(Sg(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&Tg(e)&&(Rg(e)||Lg(e))){var s=this.createElementClone(e);s.style.transitionProperty="none";var r=i.getComputedStyle(e),o=i.getComputedStyle(e,":before"),n=i.getComputedStyle(e,":after");this.referenceElement===e&&Rg(s)&&(this.clonedReferenceElement=s),Qg(s)&&bm(s);var a=this.counters.parse(new Df(this.context,r)),l=this.resolvePseudoContent(e,s,o,jf.BEFORE);Jg(e)&&(t=!0),Hg(e)||this.cloneChildNodes(e,s,t),l&&s.insertBefore(l,s.firstChild);var A=this.resolvePseudoContent(e,s,n,jf.AFTER);return A&&s.appendChild(A),this.counters.pop(a),(r&&(this.options.copyStyles||Lg(e))&&!Gg(e)||t)&&pm(r,s),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([s,e.scrollLeft,e.scrollTop]),(Wg(e)||Kg(e))&&(Wg(s)||Kg(s))&&(s.value=e.value),s}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,s){var r=this;if(i){var o=i.content,n=t.ownerDocument;if(n&&o&&"none"!==o&&"-moz-alt-content"!==o&&"none"!==i.display){this.counters.parse(new Df(this.context,i));var a=new If(this.context,i),l=n.createElement("html2canvaspseudoelement");pm(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(n.createTextNode(t.value));else if(22===t.type){var i=n.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var s=t.values.filter(Ad);s.length&&l.appendChild(n.createTextNode(e.getAttribute(s[0].value)||""))}else if("counter"===t.name){var o=t.values.filter(dd),A=o[0],h=o[1];if(A&&Ad(A)){var c=r.counters.getCounterValue(A.value),u=h&&Ad(h)?kp.parse(r.context,h.value):3;l.appendChild(n.createTextNode(nm(c,u,!1)))}}else if("counters"===t.name){var d=t.values.filter(dd),p=(A=d[0],d[1]);h=d[2];if(A&&Ad(A)){var f=r.counters.getCounterValues(A.value),g=h&&Ad(h)?kp.parse(r.context,h.value):3,m=p&&0===p.type?p.value:"",_=f.map((function(e){return nm(e,g,!1)})).join(m);l.appendChild(n.createTextNode(_))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(n.createTextNode(wf(a.quotes,r.quoteDepth++,!0)));break;case"close-quote":l.appendChild(n.createTextNode(wf(a.quotes,--r.quoteDepth,!1)));break;default:l.appendChild(n.createTextNode(t.value))}})),l.className=_m+" "+vm;var A=s===jf.BEFORE?" "+_m:" "+vm;return Lg(t)?t.className.baseValue+=A:t.className+=A,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(jf||(jf={}));var lm,Am=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute("data-html2canvas-ignore","true"),e.body.appendChild(i),i},hm=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},cm=function(e){return Promise.all([].slice.call(e.images,0).map(hm))},um=function(e){return new Promise((function(t,i){var s=e.contentWindow;if(!s)return i("No window assigned for iframe");var r=s.document;s.onload=e.onload=function(){s.onload=e.onload=null;var i=setInterval((function(){r.body.childNodes.length>0&&"complete"===r.readyState&&(clearInterval(i),t(e))}),50)}}))},dm=["all","d","content"],pm=function(e,t){for(var i=e.length-1;i>=0;i--){var s=e.item(i);-1===dm.indexOf(s)&&t.style.setProperty(s,e.getPropertyValue(s))}return t},fm=function(e){var t="";return e&&(t+=""),t},gm=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},mm=function(e){var t=e[0],i=e[1],s=e[2];t.scrollLeft=i,t.scrollTop=s},_m="___html2canvas___pseudoelement_before",vm="___html2canvas___pseudoelement_after",bm=function(e){ym(e,"."+_m+':before{\n content: "" !important;\n display: none !important;\n}\n .'+vm+':after{\n content: "" !important;\n display: none !important;\n}')},ym=function(e,t){var i=e.ownerDocument;if(i){var s=i.createElement("style");s.textContent=t,e.appendChild(s)}},Bm=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),xm=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Im(e)||Mm(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return Cc(this,void 0,void 0,(function(){var t,i,s,r,o=this;return Mc(this,(function(n){switch(n.label){case 0:return t=Bm.isSameOrigin(e),i=!Fm(e)&&!0===this._options.useCORS&&ig.SUPPORT_CORS_IMAGES&&!t,s=!Fm(e)&&!t&&!Im(e)&&"string"==typeof this._options.proxy&&ig.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||Fm(e)||Im(e)||s||i?(r=e,s?[4,this.proxy(r)]:[3,2]):[2];case 1:r=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var s=new Image;s.onload=function(){return e(s)},s.onerror=t,(Em(r)||i)&&(s.crossOrigin="anonymous"),s.src=r,!0===s.complete&&setTimeout((function(){return e(s)}),500),o._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+o._options.imageTimeout+"ms) loading image")}),o._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var s=e.substring(0,256);return new Promise((function(r,o){var n=ig.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===n)r(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return r(e.result)}),!1),e.addEventListener("error",(function(e){return o(e)}),!1),e.readAsDataURL(a.response)}else o("Failed to proxy resource "+s+" with status code "+a.status)},a.onerror=o;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+n),"text"!==n&&a instanceof XMLHttpRequest&&(a.responseType=n),t._options.imageTimeout){var A=t._options.imageTimeout;a.timeout=A,a.ontimeout=function(){return o("Timed out ("+A+"ms) proxying "+s)}}a.send()}))},e}(),wm=/^data:image\/svg\+xml/i,Pm=/^data:image\/.*;base64,/i,Cm=/^data:image\/.*/i,Mm=function(e){return ig.SUPPORT_SVG_DRAWING||!Dm(e)},Fm=function(e){return Cm.test(e)},Em=function(e){return Pm.test(e)},Im=function(e){return"blob"===e.substr(0,4)},Dm=function(e){return"svg"===e.substr(-3).toLowerCase()||wm.test(e)},Sm=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Tm=function(e,t,i){return new Sm(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Rm=function(){function e(e,t,i,s){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=s}return e.prototype.subdivide=function(t,i){var s=Tm(this.start,this.startControl,t),r=Tm(this.startControl,this.endControl,t),o=Tm(this.endControl,this.end,t),n=Tm(s,r,t),a=Tm(r,o,t),l=Tm(n,a,t);return i?new e(this.start,s,n,l):new e(l,a,o,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Lm=function(e){return 1===e.type},Um=function(e){var t=e.styles,i=e.bounds,s=Bd(t.borderTopLeftRadius,i.width,i.height),r=s[0],o=s[1],n=Bd(t.borderTopRightRadius,i.width,i.height),a=n[0],l=n[1],A=Bd(t.borderBottomRightRadius,i.width,i.height),h=A[0],c=A[1],u=Bd(t.borderBottomLeftRadius,i.width,i.height),d=u[0],p=u[1],f=[];f.push((r+a)/i.width),f.push((d+h)/i.width),f.push((o+p)/i.height),f.push((l+c)/i.height);var g=Math.max.apply(Math,f);g>1&&(r/=g,o/=g,a/=g,l/=g,h/=g,c/=g,d/=g,p/=g);var m=i.width-a,_=i.height-c,v=i.width-h,b=i.height-p,y=t.borderTopWidth,B=t.borderRightWidth,x=t.borderBottomWidth,w=t.borderLeftWidth,P=xd(t.paddingTop,e.bounds.width),C=xd(t.paddingRight,e.bounds.width),M=xd(t.paddingBottom,e.bounds.width),F=xd(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||o>0?km(i.left+w/3,i.top+y/3,r-w/3,o-y/3,lm.TOP_LEFT):new Sm(i.left+w/3,i.top+y/3),this.topRightBorderDoubleOuterBox=r>0||o>0?km(i.left+m,i.top+y/3,a-B/3,l-y/3,lm.TOP_RIGHT):new Sm(i.left+i.width-B/3,i.top+y/3),this.bottomRightBorderDoubleOuterBox=h>0||c>0?km(i.left+v,i.top+_,h-B/3,c-x/3,lm.BOTTOM_RIGHT):new Sm(i.left+i.width-B/3,i.top+i.height-x/3),this.bottomLeftBorderDoubleOuterBox=d>0||p>0?km(i.left+w/3,i.top+b,d-w/3,p-x/3,lm.BOTTOM_LEFT):new Sm(i.left+w/3,i.top+i.height-x/3),this.topLeftBorderDoubleInnerBox=r>0||o>0?km(i.left+2*w/3,i.top+2*y/3,r-2*w/3,o-2*y/3,lm.TOP_LEFT):new Sm(i.left+2*w/3,i.top+2*y/3),this.topRightBorderDoubleInnerBox=r>0||o>0?km(i.left+m,i.top+2*y/3,a-2*B/3,l-2*y/3,lm.TOP_RIGHT):new Sm(i.left+i.width-2*B/3,i.top+2*y/3),this.bottomRightBorderDoubleInnerBox=h>0||c>0?km(i.left+v,i.top+_,h-2*B/3,c-2*x/3,lm.BOTTOM_RIGHT):new Sm(i.left+i.width-2*B/3,i.top+i.height-2*x/3),this.bottomLeftBorderDoubleInnerBox=d>0||p>0?km(i.left+2*w/3,i.top+b,d-2*w/3,p-2*x/3,lm.BOTTOM_LEFT):new Sm(i.left+2*w/3,i.top+i.height-2*x/3),this.topLeftBorderStroke=r>0||o>0?km(i.left+w/2,i.top+y/2,r-w/2,o-y/2,lm.TOP_LEFT):new Sm(i.left+w/2,i.top+y/2),this.topRightBorderStroke=r>0||o>0?km(i.left+m,i.top+y/2,a-B/2,l-y/2,lm.TOP_RIGHT):new Sm(i.left+i.width-B/2,i.top+y/2),this.bottomRightBorderStroke=h>0||c>0?km(i.left+v,i.top+_,h-B/2,c-x/2,lm.BOTTOM_RIGHT):new Sm(i.left+i.width-B/2,i.top+i.height-x/2),this.bottomLeftBorderStroke=d>0||p>0?km(i.left+w/2,i.top+b,d-w/2,p-x/2,lm.BOTTOM_LEFT):new Sm(i.left+w/2,i.top+i.height-x/2),this.topLeftBorderBox=r>0||o>0?km(i.left,i.top,r,o,lm.TOP_LEFT):new Sm(i.left,i.top),this.topRightBorderBox=a>0||l>0?km(i.left+m,i.top,a,l,lm.TOP_RIGHT):new Sm(i.left+i.width,i.top),this.bottomRightBorderBox=h>0||c>0?km(i.left+v,i.top+_,h,c,lm.BOTTOM_RIGHT):new Sm(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=d>0||p>0?km(i.left,i.top+b,d,p,lm.BOTTOM_LEFT):new Sm(i.left,i.top+i.height),this.topLeftPaddingBox=r>0||o>0?km(i.left+w,i.top+y,Math.max(0,r-w),Math.max(0,o-y),lm.TOP_LEFT):new Sm(i.left+w,i.top+y),this.topRightPaddingBox=a>0||l>0?km(i.left+Math.min(m,i.width-B),i.top+y,m>i.width+B?0:Math.max(0,a-B),Math.max(0,l-y),lm.TOP_RIGHT):new Sm(i.left+i.width-B,i.top+y),this.bottomRightPaddingBox=h>0||c>0?km(i.left+Math.min(v,i.width-w),i.top+Math.min(_,i.height-x),Math.max(0,h-B),Math.max(0,c-x),lm.BOTTOM_RIGHT):new Sm(i.left+i.width-B,i.top+i.height-x),this.bottomLeftPaddingBox=d>0||p>0?km(i.left+w,i.top+Math.min(b,i.height-x),Math.max(0,d-w),Math.max(0,p-x),lm.BOTTOM_LEFT):new Sm(i.left+w,i.top+i.height-x),this.topLeftContentBox=r>0||o>0?km(i.left+w+F,i.top+y+P,Math.max(0,r-(w+F)),Math.max(0,o-(y+P)),lm.TOP_LEFT):new Sm(i.left+w+F,i.top+y+P),this.topRightContentBox=a>0||l>0?km(i.left+Math.min(m,i.width+w+F),i.top+y+P,m>i.width+w+F?0:a-w+F,l-(y+P),lm.TOP_RIGHT):new Sm(i.left+i.width-(B+C),i.top+y+P),this.bottomRightContentBox=h>0||c>0?km(i.left+Math.min(v,i.width-(w+F)),i.top+Math.min(_,i.height+y+P),Math.max(0,h-(B+C)),c-(x+M),lm.BOTTOM_RIGHT):new Sm(i.left+i.width-(B+C),i.top+i.height-(x+M)),this.bottomLeftContentBox=d>0||p>0?km(i.left+w+F,i.top+b,Math.max(0,d-(w+F)),p-(x+M),lm.BOTTOM_LEFT):new Sm(i.left+w+F,i.top+i.height-(x+M))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(lm||(lm={}));var km=function(e,t,i,s,r){var o=(Math.sqrt(2)-1)/3*4,n=i*o,a=s*o,l=e+i,A=t+s;switch(r){case lm.TOP_LEFT:return new Rm(new Sm(e,A),new Sm(e,A-a),new Sm(l-n,t),new Sm(l,t));case lm.TOP_RIGHT:return new Rm(new Sm(e,t),new Sm(e+n,t),new Sm(l,A-a),new Sm(l,A));case lm.BOTTOM_RIGHT:return new Rm(new Sm(l,t),new Sm(l,t+a),new Sm(e+n,A),new Sm(e,A));case lm.BOTTOM_LEFT:default:return new Rm(new Sm(l,A),new Sm(l-n,A),new Sm(e,t+a),new Sm(e,t))}},Om=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Nm=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Qm=function(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6},Vm=function(e,t){this.path=e,this.target=t,this.type=1},Hm=function(e){this.opacity=e,this.type=2,this.target=6},jm=function(e){return 1===e.type},Gm=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},zm=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Wm=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Um(this.container),this.container.styles.opacity<1&&this.effects.push(new Hm(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new Qm(i,s,r))}if(0!==this.container.styles.overflowX){var o=Om(this.curves),n=Nm(this.curves);Gm(o,n)?this.effects.push(new Vm(o,6)):(this.effects.push(new Vm(o,2)),this.effects.push(new Vm(n,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,s=this.effects.slice(0);i;){var r=i.effects.filter((function(e){return!jm(e)}));if(t||0!==i.container.styles.position||!i.parent){if(s.unshift.apply(s,r),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var o=Om(i.curves),n=Nm(i.curves);Gm(o,n)||s.unshift(new Vm(n,6))}}else s.unshift.apply(s,r);i=i.parent}return s.filter((function(t){return _f(t.target,e)}))},e}(),Km=function(e,t,i,s){e.container.elements.forEach((function(r){var o=_f(r.flags,4),n=_f(r.flags,2),a=new Wm(r,e);_f(r.styles.display,2048)&&s.push(a);var l=_f(r.flags,8)?[]:s;if(o||n){var A=o||r.styles.isPositioned()?i:t,h=new zm(a);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var c=r.styles.zIndex.order;if(c<0){var u=0;A.negativeZIndex.some((function(e,t){return c>e.element.container.styles.zIndex.order?(u=t,!1):u>0})),A.negativeZIndex.splice(u,0,h)}else if(c>0){var d=0;A.positiveZIndex.some((function(e,t){return c>=e.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),A.positiveZIndex.splice(d,0,h)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?A.nonPositionedFloats.push(h):A.nonPositionedInlineLevel.push(h);Km(a,h,o?h:i,l)}else r.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),Km(a,t,i,l);_f(r.flags,8)&&Xm(r,l)}))},Xm=function(e,t){for(var i=e instanceof _g?e.start:1,s=e instanceof _g&&e.reversed,r=0;r0&&e.intrinsicHeight>0){var s=$m(e),r=Nm(t);this.path(r),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return Cc(this,void 0,void 0,(function(){var i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v;return Mc(this,(function(b){switch(b.label){case 0:this.applyEffects(e.getEffects(4)),i=e.container,s=e.curves,r=i.styles,o=0,n=i.textNodes,b.label=1;case 1:return o0&&x>0&&(m=s.ctx.createPattern(p,"repeat"),s.renderRepeat(v,m,P,C))):function(e){return 2===e.type}(i)&&(_=e_(e,t,[null,null,null]),v=_[0],b=_[1],y=_[2],B=_[3],x=_[4],w=0===i.position.length?[bd]:i.position,P=xd(w[0],B),C=xd(w[w.length-1],x),M=function(e,t,i,s,r){var o=0,n=0;switch(e.size){case 0:0===e.shape?o=n=Math.min(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.min(Math.abs(t),Math.abs(t-s)),n=Math.min(Math.abs(i),Math.abs(i-r)));break;case 2:if(0===e.shape)o=n=Math.min(Gd(t,i),Gd(t,i-r),Gd(t-s,i),Gd(t-s,i-r));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-r))/Math.min(Math.abs(t),Math.abs(t-s)),l=zd(s,r,t,i,!0),A=l[0],h=l[1];n=a*(o=Gd(A-t,(h-i)/a))}break;case 1:0===e.shape?o=n=Math.max(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.max(Math.abs(t),Math.abs(t-s)),n=Math.max(Math.abs(i),Math.abs(i-r)));break;case 3:if(0===e.shape)o=n=Math.max(Gd(t,i),Gd(t,i-r),Gd(t-s,i),Gd(t-s,i-r));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-r))/Math.max(Math.abs(t),Math.abs(t-s));var c=zd(s,r,t,i,!1);A=c[0],h=c[1],n=a*(o=Gd(A-t,(h-i)/a))}}return Array.isArray(e.size)&&(o=xd(e.size[0],s),n=2===e.size.length?xd(e.size[1],r):o),[o,n]}(i,P,C,B,x),F=M[0],E=M[1],F>0&&E>0&&(I=s.ctx.createRadialGradient(b+P,y+C,0,b+P,y+C,F),Hd(i.stops,2*F).forEach((function(e){return I.addColorStop(e.stop,Id(e.color))})),s.path(v),s.ctx.fillStyle=I,F!==E?(D=e.bounds.left+.5*e.bounds.width,S=e.bounds.top+.5*e.bounds.height,R=1/(T=E/F),s.ctx.save(),s.ctx.translate(D,S),s.ctx.transform(1,0,0,T,0,0),s.ctx.translate(-D,-S),s.ctx.fillRect(b,R*(y-S)+S,B,x*R),s.ctx.restore()):s.ctx.fill())),L.label=6;case 6:return t--,[2]}}))},s=this,r=0,o=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return r0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,2)]:[3,11]:[3,13];case 4:return h.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,3)];case 6:return h.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,o,e.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,o,e.curves)];case 10:h.sent(),h.label=11;case 11:o++,h.label=12;case 12:return n++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(e,t,i,s,r){return Cc(this,void 0,void 0,(function(){var o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b;return Mc(this,(function(y){return this.ctx.save(),o=function(e,t){switch(t){case 0:return Ym(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Ym(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Ym(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return Ym(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(s,i),n=Jm(s,i),2===r&&(this.path(n),this.ctx.clip()),Lm(n[0])?(a=n[0].start.x,l=n[0].start.y):(a=n[0].x,l=n[0].y),Lm(n[1])?(A=n[1].end.x,h=n[1].end.y):(A=n[1].x,h=n[1].y),c=0===i||2===i?Math.abs(a-A):Math.abs(l-h),this.ctx.beginPath(),3===r?this.formatPath(o):this.formatPath(n.slice(0,2)),u=t<3?3*t:2*t,d=t<3?2*t:t,3===r&&(u=t,d=t),p=!0,c<=2*u?p=!1:c<=2*u+d?(u*=f=c/(2*u+d),d*=f):(g=Math.floor((c+d)/(u+d)),m=(c-g*u)/(g-1),d=(_=(c-(g+1)*u)/g)<=0||Math.abs(d-m){})),D_(this,"_reject",(()=>{})),this.name=e,this.workerThread=t,this.result=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){w_(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){w_(this.isRunning),this.isRunning=!1,this._reject(e)}}class T_{}const R_=new Map;function L_(e){w_(e.source&&!e.url||!e.source&&e.url);let t=R_.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return U_((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),R_.set(e.url,t)),e.source&&(t=U_(e.source),R_.set(e.source,t))),w_(t),t}function U_(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function k_(e,t=!0,i){const s=i||new Set;if(e){if(O_(e))s.add(e);else if(O_(e.buffer))s.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(const i in e)k_(e[i],t,s)}else;return void 0===i?Array.from(s):[]}function O_(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}const N_=()=>{};class Q_{static isSupported(){return"undefined"!=typeof Worker&&M_||void 0!==typeof T_}constructor(e){D_(this,"name",void 0),D_(this,"source",void 0),D_(this,"url",void 0),D_(this,"terminated",!1),D_(this,"worker",void 0),D_(this,"onMessage",void 0),D_(this,"onError",void 0),D_(this,"_loadableURL","");const{name:t,source:i,url:s}=e;w_(i||s),this.name=t,this.source=i,this.url=s,this.onMessage=N_,this.onError=e=>console.log(e),this.worker=M_?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=N_,this.onError=N_,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||k_(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}_createBrowserWorker(){this._loadableURL=L_({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);e=new T_(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new T_(this.source,{eval:!0})}return e.on("message",(e=>{this.onMessage(e)})),e.on("error",(e=>{this.onError(e)})),e.on("exit",(e=>{})),e}}class V_{static isSupported(){return Q_.isSupported()}constructor(e){D_(this,"name","unnamed"),D_(this,"source",void 0),D_(this,"url",void 0),D_(this,"maxConcurrency",1),D_(this,"maxMobileConcurrency",1),D_(this,"onDebug",(()=>{})),D_(this,"reuseWorkers",!0),D_(this,"props",{}),D_(this,"jobQueue",[]),D_(this,"idleQueue",[]),D_(this,"count",0),D_(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach((e=>e.destroy())),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,i)=>e.done(i)),i=((e,t)=>e.error(t))){const s=new Promise((s=>(this.jobQueue.push({name:e,onMessage:t,onError:i,onStart:s}),this)));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const i=new S_(t.name,e);e.onMessage=e=>t.onMessage(i,e.type,e.payload),e.onError=e=>t.onError(i,e),t.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class j_{static isSupported(){return Q_.isSupported()}static getWorkerFarm(e={}){return j_._workerFarm=j_._workerFarm||new j_({}),j_._workerFarm.setProps(e),j_._workerFarm}constructor(e){D_(this,"props",void 0),D_(this,"workerPools",new Map),this.props={...H_},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:i,url:s}=e;let r=this.workerPools.get(t);return r||(r=new V_({name:t,source:i,url:s}),r.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,r)),r}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}D_(j_,"_workerFarm",void 0);var G_=Object.freeze({__proto__:null,default:{}});const z_={};async function W_(e,t=null,i={}){return t&&(e=function(e,t,i){if(e.startsWith("http"))return e;const s=i.modules||{};if(s[e])return s[e];if(!M_)return"modules/".concat(t,"/dist/libs/").concat(e);if(i.CDN)return w_(i.CDN.startsWith("http")),"".concat(i.CDN,"/").concat(t,"@").concat("3.2.6","/dist/libs/").concat(e);if(F_)return"../src/libs/".concat(e);return"modules/".concat(t,"/src/libs/").concat(e)}(e,t,i)),z_[e]=z_[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!M_)try{return G_&&void 0}catch{return null}if(F_)return importScripts(e);const t=await fetch(e);return function(e,t){if(!M_)return;if(F_)return eval.call(C_,e),null;const i=document.createElement("script");i.id=t;try{i.appendChild(document.createTextNode(e))}catch(t){i.text=e}return document.body.appendChild(i),null}(await t.text(),e)}(e),await z_[e]}async function K_(e,t,i,s,r){const o=e.id,n=function(e,t={}){const i=t[e.id]||{},s="".concat(e.id,"-worker.js");let r=i.workerUrl;if(r||"compression"!==e.id||(r=t.workerUrl),"test"===t._workerType&&(r="modules/".concat(e.module,"/dist/").concat(s)),!r){let t=e.version;"latest"===t&&(t="latest");const i=t?"@".concat(t):"";r="https://unpkg.com/@loaders.gl/".concat(e.module).concat(i,"/dist/").concat(s)}return w_(r),r}(e,i),a=j_.getWorkerFarm(i).getWorkerPool({name:o,url:n});i=JSON.parse(JSON.stringify(i)),s=JSON.parse(JSON.stringify(s||{}));const l=await a.startJob("process-on-worker",X_.bind(null,r));l.postMessage("process",{input:t,options:i,context:s});const A=await l.result;return await A.result}async function X_(e,t,i,s){switch(i){case"done":t.done(s);break;case"error":t.error(new Error(s.error));break;case"process":const{id:r,input:o,options:n}=s;try{const i=await e(o,n);t.postMessage("done",{id:r,result:i})}catch(e){const i=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:r,error:i})}break;default:console.warn("parse-with-worker unknown message ".concat(i))}}function J_(e,t,i){if(e.byteLength<=t+i)return"";const s=new DataView(e);let r="";for(let e=0;e=0),y_(t>0),e+(t-1)&~(t-1)}function tv(e,t,i){let s;if(e instanceof ArrayBuffer)s=new Uint8Array(e);else{const t=e.byteOffset,i=e.byteLength;s=new Uint8Array(e.buffer||e.arrayBuffer,t,i)}return t.set(s,i),i+ev(s.byteLength,4)}async function iv(e){const t=[];for await(const i of e)t.push(i);return function(...e){const t=e.map((e=>e instanceof ArrayBuffer?new Uint8Array(e):e)),i=t.reduce(((e,t)=>e+t.byteLength),0),s=new Uint8Array(i);let r=0;for(const e of t)s.set(e,r),r+=e.byteLength;return s.buffer}(...t)}const sv={};const rv=e=>"function"==typeof e,ov=e=>null!==e&&"object"==typeof e,nv=e=>ov(e)&&e.constructor==={}.constructor,av=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,lv=e=>"undefined"!=typeof Blob&&e instanceof Blob,Av=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||ov(e)&&rv(e.tee)&&rv(e.cancel)&&rv(e.getReader))(e)||(e=>ov(e)&&rv(e.read)&&rv(e.pipe)&&(e=>"boolean"==typeof e)(e.readable))(e),hv=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,cv=/^([-\w.]+\/[-\w.+]+)/;function uv(e){const t=cv.exec(e);return t?t[1]:e}function dv(e){const t=hv.exec(e);return t?t[1]:""}const pv=/\?.*/;function fv(e){if(av(e)){const t=gv(e.url||"");return{url:t,type:uv(e.headers.get("content-type")||"")||dv(t)}}return lv(e)?{url:gv(e.name||""),type:e.type||""}:"string"==typeof e?{url:gv(e),type:dv(e)}:{url:"",type:""}}function gv(e){return e.replace(pv,"")}async function mv(e){if(av(e))return e;const t={},i=function(e){return av(e)?e.headers["content-length"]||-1:lv(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);i>=0&&(t["content-length"]=String(i));const{url:s,type:r}=fv(e);r&&(t["content-type"]=r);const o=await async function(e){const t=5;if("string"==typeof e)return"data:,".concat(e.slice(0,t));if(e instanceof Blob){const t=e.slice(0,5);return await new Promise((e=>{const i=new FileReader;i.onload=t=>{var i;return e(null==t||null===(i=t.target)||void 0===i?void 0:i.result)},i.readAsDataURL(t)}))}if(e instanceof ArrayBuffer){const i=function(e){let t="";const i=new Uint8Array(e);for(let e=0;e=0)}();class wv{constructor(e,t,i="sessionStorage"){this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Pv(e,t,i,s=600){const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}const Cv={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function Mv(e){return"string"==typeof e?Cv[e.toUpperCase()]||Cv.WHITE:e}function Fv(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ev(){let e;if(xv&&bv.performance)e=bv.performance.now();else if(yv.hrtime){const t=yv.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Iv={debug:xv&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Dv={enabled:!0,level:0};function Sv(){}const Tv={},Rv={once:!0};function Lv(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}class Uv{constructor({id:e}={id:""}){this.id=e,this.VERSION=Bv,this._startTs=Ev(),this._deltaTs=Ev(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new wv("__probe-".concat(this.id,"__"),Dv),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ev()-this._startTs).toPrecision(10))}getDelta(){return Number((Ev()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){Fv(e,t)}warn(e){return this._getLogFunction(0,e,Iv.warn,arguments,Rv)}error(e){return this._getLogFunction(0,e,Iv.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Iv.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Iv.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Iv.debug||Iv.info,arguments,Rv)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||Sv,i&&[i],{tag:Lv(t)}):Sv}image({logLevel:e,priority:t,image:i,message:s="",scale:r=1}){return this._shouldLog(e||t)?xv?function({image:e,message:t="",scale:i=1}){if("string"==typeof e){const s=new Image;return s.onload=()=>{const e=Pv(s,t,i);console.log(...e)},s.src=e,Sv}const s=e.nodeName||"";if("img"===s.toLowerCase())return console.log(...Pv(e,t,i)),Sv;if("canvas"===s.toLowerCase()){const s=new Image;return s.onload=()=>console.log(...Pv(s,t,i)),s.src=e.toDataURL(),Sv}return Sv}({image:i,message:s,scale:r}):function({image:e,message:t="",scale:i=1}){let s=null;try{s=module.require("asciify-image")}catch(e){}if(s)return()=>s(e,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((e=>console.log(e)));return Sv}({image:i,message:s,scale:r}):Sv}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Sv)}group(e,t,i={collapsed:!1}){i=Ov({logLevel:e,message:t,opts:i});const{collapsed:s}=i;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Sv)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=kv(e)}_getLogFunction(e,t,i,s=[],r){if(this._shouldLog(e)){r=Ov({logLevel:e,message:t,args:s,opts:r}),Fv(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=Ev();const o=r.tag||r.message;if(r.once){if(Tv[o])return Sv;Tv[o]=Ev()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e,t=8){const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return xv||"string"!=typeof e||(t&&(t=Mv(t),e="[".concat(t,"m").concat(e,"")),i&&(t=Mv(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return Sv}}function kv(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Fv(Number.isFinite(t)&&t>=0),t}function Ov(e){const{logLevel:t,message:i}=e;e.logLevel=kv(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(e.args=s,typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return Fv("string"===r||"object"===r),Object.assign(e,e.opts)}Uv.VERSION=Bv;const Nv=new Uv({id:"loaders.gl"});class Qv{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Vv={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){D_(this,"console",void 0),this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:B_,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Hv={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function jv(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const Gv=()=>{const e=jv();return e.globalOptions=e.globalOptions||{...Vv},e.globalOptions};function zv(e,t,i,s){return i=i||[],function(e,t){Kv(e,null,Vv,Hv,t);for(const i of t){const s=e&&e[i.id]||{},r=i.options&&i.options[i.id]||{},o=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};Kv(s,i.id,r,o,t)}}(e,i=Array.isArray(i)?i:[i]),function(e,t,i){const s={...e.options||{}};(function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)})(s,i),null===s.log&&(s.log=new Qv);return Jv(s,Gv()),Jv(s,t),s}(t,e,s)}function Wv(e,t){const i=Gv(),s=e||i;return"function"==typeof s.fetch?s.fetch:ov(s.fetch)?e=>_v(e,s):null!=t&&t.fetch?null==t?void 0:t.fetch:_v}function Kv(e,t,i,s,r){const o=t||"Top level",n=t?"".concat(t,"."):"";for(const a in e){const l=!t&&ov(e[a]),A="baseUri"===a&&!t,h="workerUrl"===a&&t;if(!(a in i)&&!A&&!h)if(a in s)Nv.warn("".concat(o," loader option '").concat(n).concat(a,"' no longer supported, use '").concat(s[a],"'"))();else if(!l){const e=Xv(a,r);Nv.warn("".concat(o," loader option '").concat(n).concat(a,"' not recognized. ").concat(e))()}}}function Xv(e,t){const i=e.toLowerCase();let s="";for(const r of t)for(const t in r.options){if(e===t)return"Did you mean '".concat(r.id,".").concat(t,"'?");const o=t.toLowerCase();(i.startsWith(o)||o.startsWith(i))&&(s=s||"Did you mean '".concat(r.id,".").concat(t,"'?"))}return s}function Jv(e,t){for(const i in t)if(i in t){const s=t[i];nv(s)&&nv(e[i])?e[i]={...e[i],...t[i]}:e[i]=t[i]}}function Yv(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function Zv(e){var t,i;let s;return y_(e,"null loader"),y_(Yv(e),"invalid loader"),Array.isArray(e)&&(s=e[1],e=e[0],e={...e,options:{...e.options,...s}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(i=e)&&void 0!==i&&i.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}function qv(){return(()=>{const e=jv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry})()}function $v(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,i=e||t;return!!(i&&i.indexOf("Electron")>=0)}()}const eb={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},tb=eb.window||eb.self||eb.global,ib=eb.process||{},sb="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";$v();class rb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";D_(this,"storage",void 0),D_(this,"id",void 0),D_(this,"config",{}),this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function ob(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}let nb;function ab(e){return"string"==typeof e?nb[e.toUpperCase()]||nb.WHITE:e}function lb(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ab(){let e;var t,i;if($v&&"performance"in tb)e=null==tb||null===(t=tb.performance)||void 0===t||null===(i=t.now)||void 0===i?void 0:i.call(t);else if("hrtime"in ib){var s;const t=null==ib||null===(s=ib.hrtime)||void 0===s?void 0:s.call(ib);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(nb||(nb={}));const hb={debug:$v&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},cb={enabled:!0,level:0};function ub(){}const db={},pb={once:!0};class fb{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};D_(this,"id",void 0),D_(this,"VERSION",sb),D_(this,"_startTs",Ab()),D_(this,"_deltaTs",Ab()),D_(this,"_storage",void 0),D_(this,"userData",{}),D_(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new rb("__probe-".concat(this.id,"__"),cb),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ab()-this._startTs).toPrecision(10))}getDelta(){return Number((Ab()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){lb(e,t)}warn(e){return this._getLogFunction(0,e,hb.warn,arguments,pb)}error(e){return this._getLogFunction(0,e,hb.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,hb.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,hb.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r{const t=ob(e,i,s);console.log(...t)},e.src=t,ub}const r=t.nodeName||"";if("img"===r.toLowerCase())return console.log(...ob(t,i,s)),ub;if("canvas"===r.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...ob(e,i,s)),e.src=t.toDataURL(),ub}return ub}({image:s,message:r,scale:o}):function(e){let{image:t,message:i="",scale:s=1}=e,r=null;try{r=module.require("asciify-image")}catch(e){}if(r)return()=>r(t,{fit:"box",width:"".concat(Math.round(80*s),"%")}).then((e=>console.log(e)));return ub}({image:s,message:r,scale:o}):ub}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||ub)}group(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const s=mb({logLevel:e,message:t,opts:i}),{collapsed:r}=i;return s.method=(r?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||ub)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=gb(e)}_getLogFunction(e,t,i,s,r){if(this._shouldLog(e)){r=mb({logLevel:e,message:t,args:s,opts:r}),lb(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=Ab();const o=r.tag||r.message;if(r.once){if(db[o])return ub;db[o]=Ab()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return $v||"string"!=typeof e||(t&&(t=ab(t),e="[".concat(t,"m").concat(e,"")),i&&(t=ab(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return ub}}function gb(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return lb(Number.isFinite(t)&&t>=0),t}function mb(e){const{logLevel:t,message:i}=e;e.logLevel=gb(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return lb("string"===r||"object"===r),Object.assign(e,{args:s},e.opts)}function _b(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}D_(fb,"VERSION",sb);const vb=new fb({id:"loaders.gl"}),bb=/\.([^.]+)$/;function yb(e,t=[],i,s){if(!Bb(e))return null;if(t&&!Array.isArray(t))return Zv(t);let r=[];t&&(r=r.concat(t)),null!=i&&i.ignoreRegisteredLoaders||r.push(...qv()),function(e){for(const t of e)Zv(t)}(r);const o=function(e,t,i,s){const{url:r,type:o}=fv(e),n=r||(null==s?void 0:s.url);let a=null,l="";null!=i&&i.mimeType&&(a=wb(t,null==i?void 0:i.mimeType),l="match forced by supplied MIME type ".concat(null==i?void 0:i.mimeType));var A;a=a||function(e,t){const i=t&&bb.exec(t),s=i&&i[1];return s?function(e,t){t=t.toLowerCase();for(const i of e)for(const e of i.extensions)if(e.toLowerCase()===t)return i;return null}(e,s):null}(t,n),l=l||(a?"matched url ".concat(n):""),a=a||wb(t,o),l=l||(a?"matched MIME type ".concat(o):""),a=a||function(e,t){if(!t)return null;for(const i of e)if("string"==typeof t){if(Pb(t,i))return i}else if(ArrayBuffer.isView(t)){if(Cb(t.buffer,t.byteOffset,i))return i}else if(t instanceof ArrayBuffer){if(Cb(t,0,i))return i}return null}(t,e),l=l||(a?"matched initial data ".concat(Mb(e)):""),a=a||wb(t,null==i?void 0:i.fallbackMimeType),l=l||(a?"matched fallback MIME type ".concat(o):""),l&&vb.log(1,"selectLoader selected ".concat(null===(A=a)||void 0===A?void 0:A.name,": ").concat(l,"."));return a}(e,r,i,s);if(!(o||null!=i&&i.nothrow))throw new Error(xb(e));return o}function Bb(e){return!(e instanceof Response&&204===e.status)}function xb(e){const{url:t,type:i}=fv(e);let s="No valid loader found (";s+=t?"".concat(function(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(t),", "):"no url provided, ",s+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");const r=e?Mb(e):"";return s+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",s+=")",s}function wb(e,t){for(const i of e){if(i.mimeTypes&&i.mimeTypes.includes(t))return i;if(t==="application/x.".concat(i.id))return i}return null}function Pb(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some((t=>e.startsWith(t)))}function Cb(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some((s=>function(e,t,i,s){if(s instanceof ArrayBuffer)return function(e,t,i){if(i=i||e.byteLength,e.byteLength60?"".concat(t.slice(0,60),"..."):t}catch(e){}return t}(e);throw new Error(t)}}(i),t.binary?await i.arrayBuffer():await i.text()}if(Av(e)&&(e=Db(e,i)),(r=e)&&"function"==typeof r[Symbol.iterator]||(e=>e&&"function"==typeof e[Symbol.asyncIterator])(e))return iv(e);var r;throw new Error(Sb)}async function Rb(e,t,i,s){w_(!s||"object"==typeof s),!t||Array.isArray(t)||Yv(t)||(s=void 0,i=t,t=void 0),e=await e,i=i||{};const{url:r}=fv(e),o=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[...i,...e]:e}return i&&i.length?i:null}(t,s),n=await async function(e,t=[],i,s){if(!Bb(e))return null;let r=yb(e,t,{...i,nothrow:!0},s);if(r)return r;if(lv(e)&&(r=yb(e=await e.slice(0,10).arrayBuffer(),t,i,s)),!(r||null!=i&&i.nothrow))throw new Error(xb(e));return r}(e,o,i);return n?(s=function(e,t,i=null){if(i)return i;const s={fetch:Wv(t,e),...e};return Array.isArray(s.loaders)||(s.loaders=null),s}({url:r,parse:Rb,loaders:o},i=zv(i,n,o,r),s),await async function(e,t,i,s){if(function(e,t="3.2.6"){w_(e,"no worker provided");const i=e.version}(e),av(t)){const e=t,{ok:i,redirected:r,status:o,statusText:n,type:a,url:l}=e,A=Object.fromEntries(e.headers.entries());s.response={headers:A,ok:i,redirected:r,status:o,statusText:n,type:a,url:l}}if(t=await Tb(t,e,i),e.parseTextSync&&"string"==typeof t)return i.dataType="text",e.parseTextSync(t,i,s,e);if(function(e,t){return!!j_.isSupported()&&!!(M_||null!=t&&t._nodeWorkers)&&e.worker&&(null==t?void 0:t.worker)}(e,i))return await K_(e,t,i,s,Rb);if(e.parseText&&"string"==typeof t)return await e.parseText(t,i,s,e);if(e.parse)return await e.parse(t,i,s,e);throw w_(!e.parseSync),new Error("".concat(e.id," loader - no parser found and worker is disabled"))}(n,e,i,s)):null}const Lb="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.wasm"),Ub="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.js");let kb,Ob;async function Nb(e){const t=e.modules||{};return t.basis?t.basis:(kb=kb||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await W_("basis_transcoder.js","textures",e),await W_("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,initializeBasis:s}=e;s(),t({BasisFile:i})}))}))}(t,i)}(e),await kb)}async function Qb(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Ob=Ob||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await W_(Ub,"textures",e),await W_(Lb,"textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,KTX2File:s,initializeBasis:r,BasisEncoder:o}=e;r(),t({BasisFile:i,KTX2File:s,BasisEncoder:o})}))}))}(t,i)}(e),await Ob)}const Vb=33776,Hb=33779,jb=35840,Gb=35842,zb=36196,Wb=37808,Kb=["","WEBKIT_","MOZ_"],Xb={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let Jb=null;function Yb(e){if(!Jb){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,Jb=new Set;for(const t of Kb)for(const i in Xb)if(e&&e.getExtension("".concat(t).concat(i))){const e=Xb[i];Jb.add(e)}}return Jb}var Zb,qb,$b,ey,ty,iy,sy,ry,oy;(oy=Zb||(Zb={}))[oy.NONE=0]="NONE",oy[oy.BASISLZ=1]="BASISLZ",oy[oy.ZSTD=2]="ZSTD",oy[oy.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(qb||(qb={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}($b||($b={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(ey||(ey={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(ty||(ty={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(iy||(iy={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(sy||(sy={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(ry||(ry={}));const ny=[171,75,84,88,32,50,48,187,13,10,26,10];const ay={etc1:{basisFormat:0,compressed:!0,format:zb},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Vb},bc3:{basisFormat:3,compressed:!0,format:Hb},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:jb},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Gb},"astc-4x4":{basisFormat:10,compressed:!0,format:Wb},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function ly(e,t,i){const s=new e(new Uint8Array(t));try{if(!s.startTranscoding())throw new Error("Failed to start basis transcoding");const e=s.getNumImages(),t=[];for(let r=0;r{try{i.onload=()=>t(i),i.onerror=t=>s(new Error("Could not load image ".concat(e,": ").concat(t)))}catch(e){s(e)}}))}(o||s,t)}finally{o&&r.revokeObjectURL(o)}}const Cy={};let My=!0;async function Fy(e,t,i){let s;if(xy(i)){s=await Py(e,t,i)}else s=wy(e,i);const r=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Cy)return!1;return!0}(t)&&My||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),My=!1}return await createImageBitmap(e)}(s,r)}function Ey(e){const t=Iy(e);return function(e){const t=Iy(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,false)))return null;return{mimeType:"image/png",width:t.getUint32(16,false),height:t.getUint32(20,false)}}(t)||function(e){const t=Iy(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,false)&&255===t.getUint8(2)))return null;const{tableMarkers:i,sofMarkers:s}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r+9=10&&1195984440===t.getUint32(0,false)))return null;return{mimeType:"image/gif",width:t.getUint16(6,true),height:t.getUint16(8,true)}}(t)||function(e){const t=Iy(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,false)&&t.getUint32(2,true)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,true),height:t.getUint32(22,true)}}(t)}function Iy(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const Dy={id:"image",module:"images",name:"Images",version:"3.2.6",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,i){const s=((t=t||{}).image||{}).type||"auto",{url:r}=i||{};let o;switch(function(e){switch(e){case"auto":case"data":return function(){if(my)return"imagebitmap";if(gy)return"image";if(vy)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return my||gy||vy;case"imagebitmap":return my;case"image":return gy;case"data":return vy;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}(s)){case"imagebitmap":o=await Fy(e,t,r);break;case"image":o=await Py(e,t,r);break;case"data":o=await async function(e,t){const{mimeType:i}=Ey(e)||{},s=globalThis._parseImageNode;return y_(s),await s(e,i)}(e);break;default:y_(!1)}return"data"===s&&(o=function(e){switch(by(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("getImageData");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),i.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}(o)),o},tests:[e=>Boolean(Ey(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Sy=["image/png","image/jpeg","image/gif"],Ty={};function Ry(e){return void 0===Ty[e]&&(Ty[e]=function(e){switch(e){case"image/webp":return function(){if(!B_)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return B_;default:if(!B_){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Sy.includes(e)}return!0}}(e)),Ty[e]}function Ly(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function Uy(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const i=t.baseUri||t.uri;if(!i)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return i.substr(0,i.lastIndexOf("/")+1)+e}const ky=["SCALAR","VEC2","VEC3","VEC4"],Oy=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Ny=new Map(Oy),Qy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Vy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Hy={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function jy(e){return ky[e-1]||ky[0]}function Gy(e){const t=Ny.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function zy(e,t){const i=Hy[e.componentType],s=Qy[e.type],r=Vy[e.componentType],o=e.count*s,n=e.count*s*r;return Ly(n>=0&&n<=t.byteLength),{ArrayType:i,length:o,byteLength:n}}const Wy={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Ky{constructor(e){D_(this,"gltf",void 0),D_(this,"sourceBuffers",void 0),D_(this,"byteLength",void 0),this.gltf=e||{json:{...Wy},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find((t=>t===e)),i=this.json.extensions||{};return t?i[e]||!0:null}getRequiredExtension(e){const t=this.getRequiredExtensions().find((t=>t===e));return t?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];if(!i)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return i}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,i=this.gltf.buffers[t];Ly(i);const s=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,{ArrayType:s,length:r}=zy(e,t);return new s(i,t.byteOffset+e.byteOffset,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,i){return e.extensions=e.extensions||{},e.extensions[t]=i,this.registerUsedExtension(t),this}setObjectExtension(e,t,i){(e.extensions||{})[t]=i}removeObjectExtension(e,t){const i=e.extensions||{},s=i[t];return delete i[t],s}addExtension(e,t={}){return Ly(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return Ly(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((t=>t===e))||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((t=>t===e))||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:i}=e;this.json.nodes=this.json.nodes||[];const s={mesh:t};return i&&(s.matrix=i),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:i,material:s,mode:r=4}=e,o={primitives:[{attributes:this._addAttributes(t),mode:r}]};if(i){const e=this._addIndices(i);o.primitives[0].indices=e}return Number.isFinite(s)&&(o.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const i=Ey(e),s=t||(null==i?void 0:i.mimeType),r={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}addBufferView(e){const t=e.byteLength;Ly(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const i={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=ev(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){const i={bufferView:e,type:jy(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const i=this.addBufferView(e);let s={min:t.min,max:t.max};s.min&&s.max||(s=this._getAccessorMinMax(e,t.size));const r={size:t.size,componentType:Gy(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(i,Object.assign(r,t))}addTexture(e){const{imageIndex:t}=e,i={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const i=this.byteLength,s=new ArrayBuffer(i),r=new Uint8Array(s);let o=0;for(const e of this.sourceBuffers||[])o=tv(e,r,o);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=i:this.json.buffers=[{byteLength:i}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(e,t){let i=!0;for(;i;){const s=e.indexOf(t);s>-1?e.splice(s,1):i=!1}}_addAttributes(e={}){const t={};for(const i in e){const s=e[i],r=this._getGltfAttributeName(i),o=this.addBinaryBuffer(s.value,s);t[r]=o}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){const i={min:null,max:null};if(e.length96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let i=0;for(let s=0;st[e.name]));return new aB(i,this.metadata)}selectAt(...e){const t=e.map((e=>this.fields[e])).filter(Boolean);return new aB(t,this.metadata)}assign(e){let t,i=this.metadata;if(e instanceof aB){const s=e;t=s.fields,i=lB(lB(new Map,this.metadata),s.metadata)}else t=e;const s=Object.create(null);for(const e of this.fields)s[e.name]=e;for(const e of t)s[e.name]=e;const r=Object.values(s);return new aB(r,i)}}function lB(e,t){return new Map([...e||new Map,...t||new Map])}class AB{constructor(e,t,i=!1,s=new Map){D_(this,"name",void 0),D_(this,"type",void 0),D_(this,"nullable",void 0),D_(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=i,this.metadata=s}get typeId(){return this.type&&this.type.typeId}clone(){return new AB(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}let hB,cB,uB,dB;!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(hB||(hB={}));class pB{static isNull(e){return e&&e.typeId===hB.Null}static isInt(e){return e&&e.typeId===hB.Int}static isFloat(e){return e&&e.typeId===hB.Float}static isBinary(e){return e&&e.typeId===hB.Binary}static isUtf8(e){return e&&e.typeId===hB.Utf8}static isBool(e){return e&&e.typeId===hB.Bool}static isDecimal(e){return e&&e.typeId===hB.Decimal}static isDate(e){return e&&e.typeId===hB.Date}static isTime(e){return e&&e.typeId===hB.Time}static isTimestamp(e){return e&&e.typeId===hB.Timestamp}static isInterval(e){return e&&e.typeId===hB.Interval}static isList(e){return e&&e.typeId===hB.List}static isStruct(e){return e&&e.typeId===hB.Struct}static isUnion(e){return e&&e.typeId===hB.Union}static isFixedSizeBinary(e){return e&&e.typeId===hB.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===hB.FixedSizeList}static isMap(e){return e&&e.typeId===hB.Map}static isDictionary(e){return e&&e.typeId===hB.Dictionary}get typeId(){return hB.NONE}compareTo(e){return this===e}}cB=Symbol.toStringTag;class fB extends pB{constructor(e,t){super(),D_(this,"isSigned",void 0),D_(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return hB.Int}get[cB](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class gB extends fB{constructor(){super(!0,8)}}class mB extends fB{constructor(){super(!0,16)}}class _B extends fB{constructor(){super(!0,32)}}class vB extends fB{constructor(){super(!1,8)}}class bB extends fB{constructor(){super(!1,16)}}class yB extends fB{constructor(){super(!1,32)}}const BB=32,xB=64;uB=Symbol.toStringTag;class wB extends pB{constructor(e){super(),D_(this,"precision",void 0),this.precision=e}get typeId(){return hB.Float}get[uB](){return"Float"}toString(){return"Float".concat(this.precision)}}class PB extends wB{constructor(){super(BB)}}class CB extends wB{constructor(){super(xB)}}dB=Symbol.toStringTag;class MB extends pB{constructor(e,t){super(),D_(this,"listSize",void 0),D_(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return hB.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[dB](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}function FB(e,t,i){const s=function(e){switch(e.constructor){case Int8Array:return new gB;case Uint8Array:return new vB;case Int16Array:return new mB;case Uint16Array:return new bB;case Int32Array:return new _B;case Uint32Array:return new yB;case Float32Array:return new PB;case Float64Array:return new CB;default:throw new Error("array type not supported")}}(t.value),r=i||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new AB(e,new MB(t.size,new AB("value",s)),!1,r)}function EB(e,t,i){return FB(e,t,i?IB(i.metadata):void 0)}function IB(e){const t=new Map;for(const i in e)t.set("".concat(i,".string"),JSON.stringify(e[i]));return t}const DB={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},SB={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class TB{constructor(e){D_(this,"draco",void 0),D_(this,"decoder",void 0),D_(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const s=this.decoder.GetEncodedGeometryType(i),r=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(s){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(i,r);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(i,r);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!r.ptr){const t="DRACO decompression failed: ".concat(e.error_msg());throw new Error(t)}const o=this._getDracoLoaderData(r,s,t),n=this._getMeshData(r,o,t),a=function(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,n=-1/0;const a=e.POSITION?e.POSITION.value:[],l=a&&a.length;for(let e=0;er?l:r,o=A>o?A:o,n=h>n?h:n}return[[t,i,s],[r,o,n]]}(n.attributes),l=function(e,t,i){const s=IB(t.metadata),r=[],o=function(e){const t={};for(const i in e){const s=e[i];t[s.name||"undefined"]=s}return t}(t.attributes);for(const t in e){const i=EB(t,e[t],o[t]);r.push(i)}if(i){const e=EB("indices",i);r.push(e)}return new aB(r,s)}(n.attributes,o,n.indices);return{loader:"draco",loaderData:o,header:{vertexCount:r.num_points(),boundingBox:a},...n,schema:l}}finally{this.draco.destroy(i),r&&this.draco.destroy(r)}}_getDracoLoaderData(e,t,i){const s=this._getTopLevelMetadata(e),r=this._getDracoAttributes(e,i);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:r}}_getDracoAttributes(e,t){const i={};for(let s=0;sthis.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map((e=>t.min_value(e)))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:i=[]}=t,s=e.attribute_type();if(i.map((e=>this.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}const RB="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.js"),LB="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_wasm_wrapper.js"),UB="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.wasm");let kB;async function OB(e){const t=e.modules||{};return kB=t.draco3d?kB||t.draco3d.createDecoderModule({}).then((e=>({draco:e}))):kB||async function(e){let t,i;if("js"===(e.draco&&e.draco.decoderType))t=await W_(RB,"draco",e);else[t,i]=await Promise.all([await W_(LB,"draco",e),await W_(UB,"draco",e)]);return t=t||globalThis.DracoDecoderModule,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e({...i,onModuleLoaded:e=>t({draco:e})})}))}(t,i)}(e),await kB}const NB={...nB,parse:async function(e,t){const{draco:i}=await OB(t),s=new TB(i);try{return s.parseSync(e,null==t?void 0:t.draco)}finally{s.destroy()}}};function QB(e){const{buffer:t,size:i,count:s}=function(e){let t=e,i=1,s=0;e&&e.value&&(t=e.value,i=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,i=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(i&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),s=t.length/i);return{buffer:t,size:i,count:s}}(e);return{value:t,size:i,byteOffset:0,count:s,type:jy(i),componentType:Gy(t)}}async function VB(e,t,i,s){const r=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!r)return;const o=e.getTypedArrayForBufferView(r.bufferView),n=$_(o.buffer,o.byteOffset),{parse:a}=s,l={...i};delete l["3d-tiles"];const A=await a(n,NB,l,s),h=function(e){const t={};for(const i in e){const s=e[i];if("indices"!==i){const e=QB(s);t[i]=e}}return t}(A.attributes);for(const[i,s]of Object.entries(h))if(i in t.attributes){const r=t.attributes[i],o=e.getAccessor(r);null!=o&&o.min&&null!=o&&o.max&&(s.min=o.min,s.max=o.max)}t.attributes=h,A.indices&&(t.indices=QB(A.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function HB(e,t,i=4,s,r){var o;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const n=s.DracoWriter.encodeSync({attributes:e}),a=null==r||null===(o=r.parseSync)||void 0===o?void 0:o.call(r,{attributes:e}),l=s._addFauxAttributes(a.attributes);return{primitives:[{attributes:l,mode:i,extensions:{KHR_draco_mesh_compression:{bufferView:s.addBufferView(n),attributes:l}}}]}}function*jB(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}var GB=Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,i){const s=new Ky(e);for(const e of jB(s))s.getObjectExtension(e,"KHR_draco_mesh_compression")},decode:async function(e,t,i){var s;if(null==t||null===(s=t.gltf)||void 0===s||!s.decompressMeshes)return;const r=new Ky(e),o=[];for(const e of jB(r))r.getObjectExtension(e,"KHR_draco_mesh_compression")&&o.push(VB(r,e,t,i));await Promise.all(o),r.removeExtension("KHR_draco_mesh_compression")},encode:function(e,t={}){const i=new Ky(e);for(const e of i.json.meshes||[])HB(e),i.addRequiredExtension("KHR_draco_mesh_compression")}});var zB=Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:async function(e){const t=new Ky(e),{json:i}=t,s=t.getExtension("KHR_lights_punctual");s&&(t.json.lights=s.lights,t.removeExtension("KHR_lights_punctual"));for(const e of i.nodes||[]){const i=t.getObjectExtension(e,"KHR_lights_punctual");i&&(e.light=i.light),t.removeObjectExtension(e,"KHR_lights_punctual")}},encode:async function(e){const t=new Ky(e),{json:i}=t;if(i.lights){const e=t.addExtension("KHR_lights_punctual");Ly(!e.lights),e.lights=i.lights,delete i.lights}if(t.json.lights){for(const e of t.json.lights){const i=e.node;t.addObjectExtension(i,"KHR_lights_punctual",e)}delete t.json.lights}}});function WB(e,t){const i=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((t=>{e.uniforms[t].value&&!(t in i)&&(i[t]=e.uniforms[t].value)})),Object.keys(i).forEach((e=>{"object"==typeof i[e]&&void 0!==i[e].index&&(i[e].texture=t.getTexture(i[e].index))})),i}const KB=[sB,rB,oB,GB,zB,Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:async function(e){const t=new Ky(e),{json:i}=t;t.removeExtension("KHR_materials_unlit");for(const e of i.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}},encode:function(e){const t=new Ky(e),{json:i}=t;if(t.materials)for(const e of i.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:async function(e){const t=new Ky(e),{json:i}=t,s=t.getExtension("KHR_techniques_webgl");if(s){const e=function(e,t){const{programs:i=[],shaders:s=[],techniques:r=[]}=e,o=new TextDecoder;return s.forEach((e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=o.decode(t.getTypedArrayForBufferView(e.bufferView))})),i.forEach((e=>{e.fragmentShader=s[e.fragmentShader],e.vertexShader=s[e.vertexShader]})),r.forEach((e=>{e.program=i[e.program]})),r}(s,t);for(const s of i.materials||[]){const i=t.getObjectExtension(s,"KHR_techniques_webgl");i&&(s.technique=Object.assign({},i,e[i.technique]),s.technique.values=WB(s.technique,t)),t.removeObjectExtension(s,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}},encode:async function(e,t){}})];function XB(e,t){var i;const s=(null==t||null===(i=t.gltf)||void 0===i?void 0:i.excludeExtensions)||{};return!(e in s&&!s[e])}const JB={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},YB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ZB{constructor(){D_(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),D_(this,"json",void 0)}normalize(e,t){this.json=e.json;const i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(i.asset.version))}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(i),this._convertTopLevelObjectsToArrays(i),function(e){const t=new Ky(e),{json:i}=t;for(const e of i.images||[]){const i=t.getObjectExtension(e,"KHR_binary_glTF");i&&Object.assign(e,i),t.removeObjectExtension(e,"KHR_binary_glTF")}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in JB)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const i=e[t];if(i&&!Array.isArray(i)){e[t]=[];for(const s in i){const r=i[s];r.id=r.id||s;const o=e[t].length;e[t].push(r),this.idToIndexMap[t][s]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in JB)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:i,material:s}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map((e=>this._convertIdToIndex(e,"node")))),e.meshes&&(e.meshes=e.meshes.map((e=>this._convertIdToIndex(e,"mesh"))))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map((e=>this._convertIdToIndex(e,"node"))))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);for(const i of e[t])for(const e in i){const t=i[e],s=this._convertIdToIndex(t,e);i[e]=s}}_convertIdToIndex(e,t){const i=YB[t];if(i in this.idToIndexMap){const s=this.idToIndexMap[i][e];if(!Number.isFinite(s))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return s}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const s of e.materials){var t,i;s.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=(null===(t=s.values)||void 0===t?void 0:t.tex)||(null===(i=s.values)||void 0===i?void 0:i.texture2d_0),o=e.textures.findIndex((e=>e.id===r));-1!==o&&(s.pbrMetallicRoughness.baseColorTexture={index:o})}}}const qB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$B={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ex=10240,tx=10241,ix=10242,sx=10243,rx=10497,ox={magFilter:ex,minFilter:tx,wrapS:ix,wrapT:sx},nx={[ex]:9729,[tx]:9986,[ix]:rx,[sx]:rx};class ax{constructor(){D_(this,"baseUri",""),D_(this,"json",{}),D_(this,"buffers",[]),D_(this,"images",[])}postProcess(e,t={}){const{json:i,buffers:s=[],images:r=[],baseUri:o=""}=e;return Ly(i),this.baseUri=o,this.json=i,this.buffers=s,this.images=r,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map(((e,t)=>this._resolveBufferView(e,t)))),e.images&&(e.images=e.images.map(((e,t)=>this._resolveImage(e,t)))),e.samplers&&(e.samplers=e.samplers.map(((e,t)=>this._resolveSampler(e,t)))),e.textures&&(e.textures=e.textures.map(((e,t)=>this._resolveTexture(e,t)))),e.accessors&&(e.accessors=e.accessors.map(((e,t)=>this._resolveAccessor(e,t)))),e.materials&&(e.materials=e.materials.map(((e,t)=>this._resolveMaterial(e,t)))),e.meshes&&(e.meshes=e.meshes.map(((e,t)=>this._resolveMesh(e,t)))),e.nodes&&(e.nodes=e.nodes.map(((e,t)=>this._resolveNode(e,t)))),e.skins&&(e.skins=e.skins.map(((e,t)=>this._resolveSkin(e,t)))),e.scenes&&(e.scenes=e.scenes.map(((e,t)=>this._resolveScene(e,t)))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];return i||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),i}_resolveScene(e,t){return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((e=>this.getNode(e))),e}_resolveNode(e,t){return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((e=>this.getNode(e)))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce(((e,t)=>{const i=this.getMesh(t);return e.id=i.id,e.primitives=e.primitives.concat(i.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((e=>{const t=(e={...e}).attributes;e.attributes={};for(const i in t)e.attributes[i]=this.getAccessor(t[i]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e}))),e}_resolveMaterial(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var i,s;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(i=e.componentType,$B[i]),e.components=(s=e.type,qB[s]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:i,byteLength:s}=zy(e,e.bufferView),r=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let o=t.arrayBuffer.slice(r,r+s);e.bufferView.byteStride&&(o=this._getValueFromInterleavedBuffer(t,r,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new i(o)}return e}_getValueFromInterleavedBuffer(e,t,i,s,r){const o=new Uint8Array(r*s);for(let n=0;n20);const s=t.getUint32(i+0,Ax),r=t.getUint32(i+4,Ax);return i+=8,y_(0===r),cx(e,t,i,s),i+=s,i+=ux(e,t,i,e.header.byteLength)}(e,r,i);case 2:return function(e,t,i,s){return y_(e.header.byteLength>20),function(e,t,i,s){for(;i+8<=e.header.byteLength;){const r=t.getUint32(i+0,Ax),o=t.getUint32(i+4,Ax);switch(i+=8,o){case 1313821514:cx(e,t,i,r);break;case 5130562:ux(e,t,i,r);break;case 0:s.strict||cx(e,t,i,r);break;case 1:s.strict||ux(e,t,i,r)}i+=ev(r,4)}}(e,t,i,s),i+e.header.byteLength}(e,r,i,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}function cx(e,t,i,s){const r=new Uint8Array(t.buffer,i,s),o=new TextDecoder("utf8").decode(r);return e.json=JSON.parse(o),ev(s,4)}function ux(e,t,i,s){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:i,byteLength:s,arrayBuffer:t.buffer}),ev(s,4)}async function dx(e,t,i=0,s,r){var o,n,a,l;!function(e,t,i,s){s.uri&&(e.baseUri=s.uri);if(t instanceof ArrayBuffer&&!function(e,t=0,i={}){const s=new DataView(e),{magic:r=lx}=i,o=s.getUint32(t,!1);return o===r||o===lx}(t,i,s)){t=(new TextDecoder).decode(t)}if("string"==typeof t)e.json=Y_(t);else if(t instanceof ArrayBuffer){const r={};i=hx(r,t,i,s.glb),Ly("glTF"===r.type,"Invalid GLB magic string ".concat(r.type)),e._glb=r,e.json=r.json}else Ly(!1,"GLTF: must be ArrayBuffer or string");const r=e.json.buffers||[];if(e.buffers=new Array(r.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const o=e.json.images||[];e.images=new Array(o.length).fill({})}(e,t,i,s),function(e,t={}){(new ZB).normalize(e,t)}(e,{normalize:null==s||null===(o=s.gltf)||void 0===o?void 0:o.normalize}),function(e,t={},i){const s=KB.filter((e=>XB(e.name,t)));for(const o of s){var r;null===(r=o.preprocess)||void 0===r||r.call(o,e,t,i)}}(e,s,r);const A=[];if(null!=s&&null!==(n=s.gltf)&&void 0!==n&&n.loadBuffers&&e.json.buffers&&await async function(e,t,i){const s=e.json.buffers||[];for(let n=0;nXB(e.name,t)));for(const o of s){var r;await(null===(r=o.decode)||void 0===r?void 0:r.call(o,e,t,i))}}(e,s,r);return A.push(h),await Promise.all(A),null!=s&&null!==(l=s.gltf)&&void 0!==l&&l.postProcess?function(e,t){return(new ax).postProcess(e,t)}(e,s):e}async function px(e,t,i,s,r){const{fetch:o,parse:n}=r;let a;if(t.uri){const e=Uy(t.uri,s),i=await o(e);a=await i.arrayBuffer()}if(Number.isFinite(t.bufferView)){const i=function(e,t,i){const s=e.bufferViews[i];Ly(s);const r=t[s.buffer];Ly(r);const o=(s.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,o,s.byteLength)}(e.json,e.buffers,t.bufferView);a=$_(i.buffer,i.byteOffset,i.byteLength)}Ly(a,"glTF image has no data");let l=await n(a,[Dy,py],{mimeType:t.mimeType,basis:s.basis||{format:dy()}},r);l&&l[0]&&(l={compressed:!0,mipmaps:!1,width:l[0].width,height:l[0].height,data:l[0]}),e.images=e.images||[],e.images[i]=l}const fx={name:"glTF",id:"gltf",module:"gltf",version:"3.2.6",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},i){(t={...fx.options,...t}).gltf={...fx.options.gltf,...t.gltf};const{byteOffset:s=0}=t;return await dx({},e,s,t,i)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};class gx{constructor(e){}load(e,t,i,s,r,o,n){!function(e,t,i,s,r,o,n){const a=e.viewer.scene.canvas.spinner;a.processes++;"glb"===t.split(".").pop()?e.dataSource.getGLB(t,(n=>{s.basePath=_x(t),vx(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)})):e.dataSource.getGLTF(t,(n=>{s.basePath=_x(t),vx(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)}))}(e,t,i,s=s||{},r,(function(){M.scheduleTask((function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1)})),o&&o()}),(function(t){e.error(t),n&&n(t),r.fire("error",t)}))}parse(e,t,i,s,r,o,n){vx(e,"",t,i,s=s||{},r,(function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1),o&&o()}))}}function mx(e){const t={},i={},s=e.metaObjects||[],r={};for(let e=0,t=s.length;e{const l={src:t,metaModelCorrections:s?mx(s):null,loadBuffer:r.loadBuffer,basePath:r.basePath,handlenode:r.handlenode,backfaces:!!r.backfaces,gltfData:i,scene:o.scene,plugin:e,sceneModel:o,numObjects:0,nodes:[],nextId:0,log:t=>{e.log(t)}};!function(e){const t=e.gltfData.textures;if(t)for(let i=0,s=t.length;i0)for(let t=0;t0){null==n&&e.log("Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT");let t=n;if(e.metaModelCorrections){const i=e.metaModelCorrections.eachChildRoot[t];if(i){const t=e.metaModelCorrections.eachRootStats[i.id];t.countChildren++,t.countChildren>=t.numChildren&&(o.createEntity({id:i.id,meshIds:wx}),wx.length=0)}else{e.metaModelCorrections.metaObjectsMap[t]&&(o.createEntity({id:t,meshIds:wx}),wx.length=0)}}else o.createEntity({id:t,meshIds:wx}),wx.length=0}}function Cx(e,t){e.plugin.error(t)}const Mx={DEFAULT:{}};function Fx(e,t,i={}){const s="lightgrey",r=i.hoverColor||"rgba(0,0,0,0.4)",o=i.textColor||"black",n=500,a=n+n/3,l=a/24,A=[{boundary:[6,6,6,6],color:i.frontColor||i.color||"#55FF55"},{boundary:[18,6,6,6],color:i.backColor||i.color||"#55FF55"},{boundary:[12,6,6,6],color:i.rightColor||i.color||"#FF5555"},{boundary:[0,6,6,6],color:i.leftColor||i.color||"#FF5555"},{boundary:[6,0,6,6],color:i.topColor||i.color||"#7777FF"},{boundary:[6,12,6,6],color:i.bottomColor||i.color||"#7777FF"}],h=[{label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,1,0],up:[0,0,1]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,-1,0],up:[0,0,1]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,0,1]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,0,1]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,0,1],up:[0,-1,0]},{boundaries:[[7,5,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,0,-1],up:[1,0,1]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-1,-1],up:[0,-1,1]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,0,-1],up:[-1,0,1]},{boundaries:[[7,11,4,2]],dir:[0,1,1],up:[0,-1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,0,1],up:[-1,0,1]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,-1,1],up:[0,1,1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,0,1],up:[1,0,1]},{boundaries:[[5,7,2,4]],dir:[1,1,0],up:[0,0,1]},{boundaries:[[11,7,2,4]],dir:[-1,1,0],up:[0,0,1]},{boundaries:[[17,7,2,4]],dir:[-1,-1,0],up:[0,0,1]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,-1,0],up:[0,0,1]},{boundaries:[[5,11,2,2]],dir:[1,1,1],up:[-1,-1,1]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[1,-1,1],up:[-1,1,1]},{boundaries:[[5,5,2,2]],dir:[1,1,-1],up:[1,1,1]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-1,-1,1],up:[1,1,1]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-1,-1,-1],up:[-1,-1,1]},{boundaries:[[11,11,2,2]],dir:[-1,1,1],up:[1,-1,1]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[1,-1,-1],up:[1,-1,1]},{boundaries:[[11,5,2,2]],dir:[-1,1,-1],up:[-1,1,1]}];i.frontColor||i.color,i.backColor||i.color,i.rightColor||i.color,i.leftColor||i.color,i.topColor||i.color,i.bottomColor||i.color;const u=[{yUp:"",label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,0,1],up:[0,1,0]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,1,0]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,1,0]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,-1,0],up:[0,0,-1]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,1,0],up:[0,0,1]},{boundaries:[[7,5,4,2]],dir:[0,-.7071,-.7071],up:[0,.7071,-.7071]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,-1,0],up:[1,1,0]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-.7071,.7071],up:[0,.7071,.7071]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,-1,0],up:[-1,1,0]},{boundaries:[[7,11,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,1,0],up:[-1,1,0]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,1,1],up:[0,1,-1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,1,0],up:[1,1,0]},{boundaries:[[5,7,2,4]],dir:[1,0,-1],up:[0,1,0]},{boundaries:[[11,7,2,4]],dir:[-1,0,-1],up:[0,1,0]},{boundaries:[[17,7,2,4]],dir:[-1,0,1],up:[0,1,0]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,0,1],up:[0,1,0]},{boundaries:[[5,11,2,2]],dir:[.5,.7071,-.5],up:[-.5,.7071,.5]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[.5,.7071,.5],up:[-.5,.7071,-.5]},{boundaries:[[5,5,2,2]],dir:[.5,-.7071,-.5],up:[.5,.7071,-.5]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-.5,.7071,.5],up:[.5,.7071,-.5]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-.5,-.7071,.5],up:[-.5,.7071,.5]},{boundaries:[[11,11,2,2]],dir:[-.5,.7071,-.5],up:[.5,.7071,.5]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[.5,-.7071,.5],up:[.5,.7071,.5]},{boundaries:[[11,5,2,2]],dir:[-.5,-.7071,-.5],up:[-.5,.7071,-.5]}];for(let e=0,t=h.length;e=r[0]*l&&t<=(r[0]+r[2])*l&&i>=r[1]*l&&i<=(r[1]+r[3])*l)return s}}return-1},this.setAreaHighlighted=function(e,t){var i=d[e];if(!i)throw"Area not found: "+e;i.highlighted=!!t,g()},this.getAreaDir=function(e){var t=d[e];if(!t)throw"Unknown area: "+e;return t.dir},this.getAreaUp=function(e){var t=d[e];if(!t)throw"Unknown area: "+e;return t.up},this.getImage=function(){return this._textureCanvas},this.destroy=function(){this._textureCanvas&&(this._textureCanvas.parentNode.removeChild(this._textureCanvas),this._textureCanvas=null)}}const Ex=c.vec3(),Ix=c.vec3();c.mat4();const Dx=c.vec3();class Sx{load(e,t,i={}){var s=e.scene.canvas.spinner;s.processes++,Tx(e,t,(function(t){!function(e,t,i){for(var s=t.basePath,r=Object.keys(t.materialLibraries),o=r.length,n=0,a=o;n=0?i-1:i+t/3)}function r(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)}function o(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)}function n(e,t,i,s){var r=e.positions,o=e.object.geometry.positions;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function a(e,t){var i=e.positions,s=e.object.geometry.positions;s.push(i[t+0]),s.push(i[t+1]),s.push(i[t+2])}function l(e,t,i,s){var r=e.normals,o=e.object.geometry.normals;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function A(e,t,i,s){var r=e.uv,o=e.object.geometry.uv;o.push(r[t+0]),o.push(r[t+1]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[s+0]),o.push(r[s+1])}function h(e,t){var i=e.uv,s=e.object.geometry.uv;s.push(i[t+0]),s.push(i[t+1])}function c(e,t,i,a,h,c,u,d,p,f,g,m,_){var v,b=e.positions.length,y=s(t,b),B=s(i,b),x=s(a,b);if(void 0===h?n(e,y,B,x):(n(e,y,B,v=s(h,b)),n(e,B,x,v)),void 0!==c){var w=e.uv.length;y=o(c,w),B=o(u,w),x=o(d,w),void 0===h?A(e,y,B,x):(A(e,y,B,v=o(p,w)),A(e,B,x,v))}if(void 0!==f){var P=e.normals.length;y=r(f,P),B=f===g?y:r(g,P),x=f===m?y:r(m,P),void 0===h?l(e,y,B,x):(l(e,y,B,v=r(_,P)),l(e,B,x,v))}}function u(e,t,i){e.object.geometry.type="Line";for(var r=e.positions.length,n=e.uv.length,l=0,A=t.length;l=0?n.substring(0,a):n).toLowerCase(),A=(A=a>=0?n.substring(a+1):"").trim(),l.toLowerCase()){case"newmtl":i(e,u),u={id:A},d=!0;break;case"ka":u.ambient=s(A);break;case"kd":u.diffuse=s(A);break;case"ks":u.specular=s(A);break;case"map_kd":u.diffuseMap||(u.diffuseMap=t(e,o,A,"sRGB"));break;case"map_ks":u.specularMap||(u.specularMap=t(e,o,A,"linear"));break;case"map_bump":case"bump":u.normalMap||(u.normalMap=t(e,o,A));break;case"ns":u.shininess=parseFloat(A);break;case"d":(h=parseFloat(A))<1&&(u.alpha=h,u.alphaMode="blend");break;case"tr":(h=parseFloat(A))>0&&(u.alpha=1-h,u.alphaMode="blend")}d&&i(e,u)};function t(e,t,i,s){var r={},o=i.split(/\s+/),n=o.indexOf("-bm");return n>=0&&o.splice(n,2),(n=o.indexOf("-s"))>=0&&(r.scale=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),(n=o.indexOf("-o"))>=0&&(r.translate=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),r.src=t+o.join(" ").trim(),r.flipY=!0,r.encoding=s||"linear",new ws(e,r).id}function i(e,t){new Vt(e,t)}function s(t){var i=t.split(e,3);return[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])]}}();function kx(e,t){for(var i=0,s=t.objects.length;i0&&(n.normals=o.normals),o.uv.length>0&&(n.uv=o.uv);for(var a=new Array(n.positions.length/3),l=0;l{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),G(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=c.vec3PairToQuaternion(Nx,e,Qx)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new ls(t,{position:[0,0,0],scale:[5,5,5],isObject:!1});const s=this._rootNode,r={arrowHead:new Ut(s,Xi({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Ut(s,Xi({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),arrowHeadHandle:new Ut(s,Xi({radiusTop:.09,radiusBottom:.09,radialSegments:8,heightSegments:1,height:.37,openEnded:!1})),curve:new Ut(s,Ss({radius:.8,tube:i,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),curveHandle:new Ut(s,Ss({radius:.8,tube:.06,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),hoop:new Ut(s,Ss({radius:.8,tube:i,radialSegments:64,tubeSegments:8,arc:2*Math.PI})),axis:new Ut(s,Xi({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1})),axisHandle:new Ut(s,Xi({radiusTop:.08,radiusBottom:.08,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={pickable:new Vt(s,{diffuse:[1,1,0],alpha:0,alphaMode:"blend"}),red:new Vt(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new jt(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6}),green:new Vt(s,{diffuse:[0,1,0],emissive:[0,1,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new jt(s,{edges:!1,fill:!0,fillColor:[0,1,0],fillAlpha:.6}),blue:new Vt(s,{diffuse:[0,0,1],emissive:[0,0,1],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new jt(s,{edges:!1,fill:!0,fillColor:[0,0,1],fillAlpha:.2}),center:new Vt(s,{diffuse:[0,0,0],emissive:[0,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80}),highlightBall:new jt(s,{edges:!1,fill:!0,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1}),highlightPlane:new jt(s,{edges:!0,edgeWidth:3,fill:!1,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1})};this._displayMeshes={plane:s.addChild(new Wi(s,{geometry:new Ut(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Vt(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,ghostMaterial:new jt(s,{edges:!1,filled:!0,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:.1,backfaces:!0}),pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1],isObject:!1}),e),planeFrame:s.addChild(new Wi(s,{geometry:new Ut(s,Ss({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Vt(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),highlightMaterial:new jt(s,{edges:!1,edgeColor:[0,0,0],filled:!0,fillColor:[.8,.8,.8],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45],isObject:!1}),e),xCurve:s.addChild(new Wi(s,{geometry:r.curve,material:o.red,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveHandle:s.addChild(new Wi(s,{geometry:r.curveHandle,material:o.pickable,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveArrow1:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,-.07,-.8,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(0*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xCurveArrow2:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,-.8,-.07,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurve:s.addChild(new Wi(s,{geometry:r.curve,material:o.green,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveHandle:s.addChild(new Wi(s,{geometry:r.curveHandle,material:o.pickable,rotation:[-90,0,0],pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveArrow1:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(.07,0,-.8,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurveArrow2:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(.8,0,-.07,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurve:s.addChild(new Wi(s,{geometry:r.curve,material:o.blue,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveHandle:s.addChild(new Wi(s,{geometry:r.curveHandle,material:o.pickable,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveCurveArrow1:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(.8,-.07,0,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4());return c.mulMat4(e,t,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveArrow2:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(.05,-.8,0,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),center:s.addChild(new Wi(s,{geometry:new Ut(s,Ji({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrowHandle:s.addChild(new Wi(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxis:s.addChild(new Wi(s,{geometry:r.axis,material:o.red,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisHandle:s.addChild(new Wi(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrowHandle:s.addChild(new Wi(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,opacity:.2,isObject:!1}),e),yShaft:s.addChild(new Wi(s,{geometry:r.axis,material:o.green,position:[0,-.5,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yShaftHandle:s.addChild(new Wi(s,{geometry:r.axisHandle,material:o.pickable,position:[0,-.5,0],pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrowHandle:s.addChild(new Wi(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zShaft:s.addChild(new Wi(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1,isObject:!1}),e),zAxisHandle:s.addChild(new Wi(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!0,collidable:!0,visible:!1,isObject:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new Wi(s,{geometry:new Ut(s,Ss({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Vt(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new jt(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45],isObject:!1}),e),xHoop:s.addChild(new Wi(s,{geometry:r.hoop,material:o.red,highlighted:!0,highlightMaterial:o.highlightRed,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yHoop:s.addChild(new Wi(s,{geometry:r.hoop,material:o.green,highlighted:!0,highlightMaterial:o.highlightGreen,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zHoop:s.addChild(new Wi(s,{geometry:r.hoop,material:o.blue,highlighted:!0,highlightMaterial:o.highlightBlue,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHeadBig,material:o.red,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHeadBig,material:o.green,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e)}}_bindEvents(){const e=this;var t=!1;const i=-1,s=0,r=1,o=2,n=3,a=4,l=5,A=this._rootNode;var h=null,u=null;const d=c.vec2(),p=c.vec3([1,0,0]),f=c.vec3([0,1,0]),g=c.vec3([0,0,1]),m=this._viewer.scene.canvas.canvas,_=this._viewer.camera,v=this._viewer.scene;{const e=c.vec3([0,0,0]);let t=-1;this._onCameraViewMatrix=v.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=v.camera.on("projMatrix",(()=>{})),this._onSceneTick=v.on("tick",(()=>{const i=Math.abs(c.lenVec3(c.subVec3(v.camera.eye,this._pos,e)));if(i!==t&&"perspective"===_.projection){const e=.07*(Math.tan(_.perspective.fov*c.DEGTORAD)*i);A.scale=[e,e,e],t=i}if("ortho"===_.projection){const e=_.ortho.scale/10;A.scale=[e,e,e],t=i}}))}const b=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),y=function(){const t=c.mat4();return function(i,s){return c.quaternionToMat4(e._rootNode.quaternion,t),c.transformVec3(t,i,s),c.normalizeVec3(s),s}}();var B=function(){const e=c.vec3();return function(t){const i=Math.abs(t[0]);return i>Math.abs(t[1])&&i>Math.abs(t[2])?c.cross3Vec3(t,[0,1,0],e):c.cross3Vec3(t,[1,0,0],e),c.cross3Vec3(e,t,e),c.normalizeVec3(e),e}}();const x=function(){const t=c.vec3(),i=c.vec3(),s=c.vec4();return function(r,o,n){y(r,s);const a=B(s,o,n);P(o,a,t),P(n,a,i),c.subVec3(i,t);const l=c.dotVec3(i,s);e._pos[0]+=s[0]*l,e._pos[1]+=s[1]*l,e._pos[2]+=s[2]*l,e._rootNode.position=e._pos,e._sectionPlane&&(e._sectionPlane.pos=e._pos)}}();var w=function(){const t=c.vec4(),i=c.vec4(),s=c.vec4(),r=c.vec4();return function(o,n,a){y(o,r);if(!(P(n,r,t)&&P(a,r,i))){const e=B(r,n,a);P(n,e,t,1),P(a,e,i,1);var l=c.dotVec3(t,r);t[0]-=l*r[0],t[1]-=l*r[1],t[2]-=l*r[2],l=c.dotVec3(i,r),i[0]-=l*r[0],i[1]-=l*r[1],i[2]-=l*r[2]}c.normalizeVec3(t),c.normalizeVec3(i),l=c.dotVec3(t,i),l=c.clamp(l,-1,1);var A=Math.acos(l)*c.RADTODEG;c.cross3Vec3(t,i,s),c.dotVec3(s,r)<0&&(A=-A),e._rootNode.rotate(o,A),C()}}(),P=function(){const t=c.vec4([0,0,0,1]),i=c.mat4();return function(s,r,o,n){n=n||0,t[0]=s[0]/m.width*2-1,t[1]=-(s[1]/m.height*2-1),t[2]=0,t[3]=1,c.mulMat4(_.projMatrix,_.viewMatrix,i),c.inverseMat4(i),c.transformVec4(i,t,t),c.mulVec4Scalar(t,1/t[3]);var a=_.eye;c.subVec4(t,a,t);const l=e._sectionPlane.pos;var A=-c.dotVec3(l,r)-n,h=c.dotVec3(r,t);if(Math.abs(h)>.005){var u=-(c.dotVec3(r,a)+A)/h;return c.mulVec3Scalar(t,u,o),c.addVec3(o,a),c.subVec3(o,l,o),!0}return!1}}();const C=function(){const t=c.vec3(),i=c.mat4();return function(){e.sectionPlane&&(c.quaternionToMat4(A.quaternion,i),c.transformVec3(i,[0,0,1],t),e._setSectionPlaneDir(t))}}();var M,F=!1;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",(e=>{if(!this._visible)return;if(F)return;var A;t=!1,M&&(M.visible=!1);switch(e.entity.id){case this._displayMeshes.xAxisArrowHandle.id:case this._displayMeshes.xAxisHandle.id:A=this._affordanceMeshes.xAxisArrow,h=s;break;case this._displayMeshes.yAxisArrowHandle.id:case this._displayMeshes.yShaftHandle.id:A=this._affordanceMeshes.yAxisArrow,h=r;break;case this._displayMeshes.zAxisArrowHandle.id:case this._displayMeshes.zAxisHandle.id:A=this._affordanceMeshes.zAxisArrow,h=o;break;case this._displayMeshes.xCurveHandle.id:A=this._affordanceMeshes.xHoop,h=n;break;case this._displayMeshes.yCurveHandle.id:A=this._affordanceMeshes.yHoop,h=a;break;case this._displayMeshes.zCurveHandle.id:A=this._affordanceMeshes.zHoop,h=l;break;default:return void(h=i)}A&&(A.visible=!0),M=A,t=!0})),this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",(e=>{this._visible&&(M&&(M.visible=!1),M=null,h=i)})),m.addEventListener("mousedown",this._canvasMouseDownListener=e=>{if(e.preventDefault(),this._visible&&t&&(this._viewer.cameraControl.pointerEnabled=!1,1===e.which)){F=!0;var i=b(e);u=h,d[0]=i[0],d[1]=i[1]}}),m.addEventListener("mousemove",this._canvasMouseMoveListener=e=>{if(!this._visible)return;if(!F)return;var t=b(e);const i=t[0],A=t[1];switch(u){case s:x(p,d,t);break;case r:x(f,d,t);break;case o:x(g,d,t);break;case n:w(p,d,t);break;case a:w(f,d,t);break;case l:w(g,d,t)}d[0]=i,d[1]=A}),m.addEventListener("mouseup",this._canvasMouseUpListener=e=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,F&&(e.which,F=!1,t=!1))}),m.addEventListener("wheel",this._canvasWheelListener=e=>{if(this._visible)Math.max(-1,Math.min(1,40*-e.deltaY))})}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=e.cameraControl;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix),r.off(this._onCameraControlHover),r.off(this._onCameraControlHoverLeave)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class Hx{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new Wi(t,{id:i.id,geometry:new Ut(t,kt({xSize:.5,ySize:.5,zSize:.001})),material:new Vt(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new zt(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new jt(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new jt(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=c.vec3([0,0,0]),t=c.vec3(),i=c.vec3([0,0,1]),s=c.vec4(4),r=c.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];c.subVec3(o,this._sectionPlane.pos,e);const a=-c.dotVec3(n,e);c.normalizeVec3(n),c.mulVec3Scalar(n,a,t);const l=c.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class jx{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new ti(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new xt(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new xt(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new xt(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=c.rotationMat4c(-90*c.DEGTORAD,1,0,0),i=c.vec3(),s=c.vec3(),r=c.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;c.mulVec3Scalar(c.normalizeVec3(c.subVec3(o,n,i)),7),this._zUp?(c.transformVec3(t,i,s),c.transformVec3(t,a,r),e.look=[0,0,0],e.eye=c.transformVec3(t,i,s),e.up=c.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new Hx(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const Gx=c.AABB3(),zx=c.vec3();class Wx{constructor(e,t,i,s,r,o){this.plugin=e,this.storeyId=r,this.modelId=s,this.storeyAABB=i.slice(),this.aabb=this.storeyAABB,this.modelAABB=t.slice(),this.numObjects=o}}class Kx{constructor(e,t,i,s,r,o){this.storeyId=e,this.imageData=t,this.format=i,this.width=s,this.height=r}}const Xx=c.vec3(),Jx=c.mat4();const Yx=new Float64Array([0,0,1]),Zx=new Float64Array(4);class qx{constructor(e){this.id=null,this._viewer=e.viewer,this._plugin=e,this._visible=!1,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._baseDir=c.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}_setSectionPlane(e){this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(()=>{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),G(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=c.vec3PairToQuaternion(Yx,e,Zx)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new ls(t,{position:[0,0,0],scale:[5,5,5]});const s=this._rootNode,r={arrowHead:new Ut(s,Xi({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Ut(s,Xi({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),axis:new Ut(s,Xi({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={red:new Vt(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),green:new Vt(s,{diffuse:[0,1,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),blue:new Vt(s,{diffuse:[0,0,1],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new jt(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6})};this._displayMeshes={plane:s.addChild(new Wi(s,{geometry:new Ut(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Vt(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1]}),e),planeFrame:s.addChild(new Wi(s,{geometry:new Ut(s,Ss({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Vt(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45]}),e),center:s.addChild(new Wi(s,{geometry:new Ut(s,Ji({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zShaft:s.addChild(new Wi(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new Wi(s,{geometry:new Ut(s,Ss({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Vt(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new jt(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45]}),e),zAxisArrow:s.addChild(new Wi(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e)}}_bindEvents(){const e=this._rootNode,t=c.vec2(),i=this._viewer.camera,s=this._viewer.scene;let r=0,o=!1;{const t=c.vec3([0,0,0]);let n=-1;this._onCameraViewMatrix=s.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=s.camera.on("projMatrix",(()=>{})),this._onSceneTick=s.on("tick",(()=>{o=!1;const l=Math.abs(c.lenVec3(c.subVec3(s.camera.eye,this._pos,t)));if(l!==n&&"perspective"===i.projection){const t=.07*(Math.tan(i.perspective.fov*c.DEGTORAD)*l);e.scale=[t,t,t],n=l}if("ortho"===i.projection){const t=i.ortho.scale/10;e.scale=[t,t,t],n=l}0!==r&&(a(r),r=0)}))}const n=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),a=e=>{const t=this._sectionPlane.pos,i=this._sectionPlane.dir;c.addVec3(t,c.mulVec3Scalar(i,.1*e*this._plugin.getDragSensitivity(),c.vec3())),this._sectionPlane.pos=t};{let e=!1;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=i=>{if(i.preventDefault(),this._visible&&(this._viewer.cameraControl.pointerEnabled=!1,1===i.which)){e=!0;var s=n(i);t[0]=s[0],t[1]=s[1]}}),this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=i=>{if(!this._visible)return;if(!e)return;if(o)return;var s=n(i);const r=s[0],l=s[1];a(l-t[1]),t[0]=r,t[1]=l}),this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=t=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,e&&(t.which,e=!1))}),this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=e=>{this._visible&&(r+=Math.max(-1,Math.min(1,40*-e.deltaY)))})}{let e,t,i=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=t=>{t.stopPropagation(),t.preventDefault(),this._visible&&(e=t.touches[0].clientY,i=e,r=0)}),this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=e=>{e.stopPropagation(),e.preventDefault(),this._visible&&(o||(o=!0,t=e.touches[0].clientY,null!==i&&(r+=t-i),i=t))}),this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=i=>{i.stopPropagation(),i.preventDefault(),this._visible&&(e=null,t=null,r=0)})}}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=this._plugin._controlElement;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),r.removeEventListener("touchstart",this._handleTouchStart),r.removeEventListener("touchmove",this._handleTouchMove),r.removeEventListener("touchend",this._handleTouchEnd),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class $x{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new Wi(t,{id:i.id,geometry:new Ut(t,kt({xSize:.5,ySize:.5,zSize:.001})),material:new Vt(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new zt(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new jt(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new jt(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=c.vec3([0,0,0]),t=c.vec3(),i=c.vec3([0,0,1]),s=c.vec4(4),r=c.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];c.subVec3(o,this._sectionPlane.pos,e);const a=-c.dotVec3(n,e);c.normalizeVec3(n),c.mulVec3Scalar(n,a,t);const l=c.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class ew{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new ti(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new xt(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new xt(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new xt(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=c.rotationMat4c(-90*c.DEGTORAD,1,0,0),i=c.vec3(),s=c.vec3(),r=c.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;c.mulVec3Scalar(c.normalizeVec3(c.subVec3(o,n,i)),7),this._zUp?(c.transformVec3(t,i,s),c.transformVec3(t,a,r),e.look=[0,0,0],e.eye=c.transformVec3(t,i,s),e.up=c.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new $x(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const tw=c.AABB3(),iw=c.vec3();class sw{getSTL(e,t,i){const s=new XMLHttpRequest;s.overrideMimeType("application/json"),s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i(s.statusText))},s.send(null)}}const rw=c.vec3();class ow{load(e,t,i,s,r,o){s=s||{};const n=e.viewer.scene.canvas.spinner;n.processes++,e.dataSource.getSTL(i,(function(i){!function(e,t,i,s){try{const r=cw(i);nw(r)?aw(e,r,t,s):lw(e,hw(i),t,s)}catch(e){t.fire("error",e)}}(e,t,i,s);try{const o=cw(i);nw(o)?aw(e,o,t,s):lw(e,hw(i),t,s),n.processes--,M.scheduleTask((function(){t.fire("loaded",!0,!1)})),r&&r()}catch(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}}),(function(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}))}parse(e,t,i,s){const r=e.viewer.scene.canvas.spinner;r.processes++;try{const o=cw(i);nw(o)?aw(e,o,t,s):lw(e,hw(i),t,s),r.processes--,M.scheduleTask((function(){t.fire("loaded",!0,!1)}))}catch(e){r.processes--,t.fire("error",e)}}}function nw(e){const t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;const i=[115,111,108,105,100];for(var s=0;s<5;s++)if(i[s]!==t.getUint8(s,!1))return!0;return!1}function aw(e,t,i,s){const r=new DataView(t),o=r.getUint32(80,!0);let n,a,l,A,h,c,u,d=!1,p=null,f=null,g=null,m=!1;for(let e=0;e<70;e++)1129270351===r.getUint32(e,!1)&&82===r.getUint8(e+4)&&61===r.getUint8(e+5)&&(d=!0,A=[],h=r.getUint8(e+6)/255,c=r.getUint8(e+7)/255,u=r.getUint8(e+8)/255,r.getUint8(e+9));const _=new us(i,{roughness:.5});let v=[],b=[],y=s.splitMeshes;for(let e=0;e>5&31)/31,l=(e>>10&31)/31):(n=h,a=c,l=u),(y&&n!==p||a!==f||l!==g)&&(null!==p&&(m=!0),p=n,f=a,g=l)}for(let e=1;e<=3;e++){let i=t+12*e;v.push(r.getFloat32(i,!0)),v.push(r.getFloat32(i+4,!0)),v.push(r.getFloat32(i+8,!0)),b.push(o,B,x),d&&A.push(n,a,l,1)}y&&m&&(Aw(i,v,b,A,_,s),v=[],b=[],A=A?[]:null,m=!1)}v.length>0&&Aw(i,v,b,A,_,s)}function lw(e,t,i,s){const r=/facet([\s\S]*?)endfacet/g;let o=0;const n=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+n+n+n,"g"),l=new RegExp("normal"+n+n+n,"g"),A=[],h=[];let c,u,d,p,f,g,m;for(;null!==(p=r.exec(t));){for(f=0,g=0,m=p[0];null!==(p=l.exec(m));)c=parseFloat(p[1]),u=parseFloat(p[2]),d=parseFloat(p[3]),g++;for(;null!==(p=a.exec(m));)A.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),h.push(c,u,d),f++;1!==g&&e.error("Error in normal of face "+o),3!==f&&e.error("Error in positions of face "+o),o++}Aw(i,A,h,null,new us(i,{roughness:.5}),s)}function Aw(e,t,i,s,r,o){const n=new Int32Array(t.length/3);for(let e=0,t=n.length;e0?i:null,s=s&&s.length>0?s:null,o.smoothNormals&&c.faceToVertexNormals(t,i,o);const a=rw;z(t,t,a);const l=new Ut(e,{primitive:"triangles",positions:t,normals:i,colors:s,indices:n}),A=new Wi(e,{origin:0!==a[0]||0!==a[1]||0!==a[2]?a:null,geometry:l,material:r,edges:o.edges});e.addChild(A)}function hw(e){return"string"!=typeof e?function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let i=0,s=e.length;i0){const i=document.createElement("a");i.href="#",i.id=`switch-${e.nodeId}`,i.textContent="+",i.classList.add("plus"),t&&i.addEventListener("click",t),o.appendChild(i)}const n=document.createElement("input");n.id=`checkbox-${e.nodeId}`,n.type="checkbox",n.checked=e.checked,n.style["pointer-events"]="all",i&&n.addEventListener("change",i),o.appendChild(n);const a=document.createElement("span");return a.textContent=e.title,o.appendChild(a),s&&(a.oncontextmenu=s),r&&(a.onclick=r),o}createDisabledNodeElement(e){const t=document.createElement("li"),i=document.createElement("a");i.href="#",i.textContent="!",i.classList.add("warn"),i.classList.add("warning"),t.appendChild(i);const s=document.createElement("span");return s.textContent=e,t.appendChild(s),t}addChildren(e,t){const i=document.createElement("ul");t.forEach((e=>{i.appendChild(e)})),e.parentElement.appendChild(i)}expand(e,t,i){e.classList.remove("plus"),e.classList.add("minus"),e.textContent="-",e.removeEventListener("click",t),e.addEventListener("click",i)}collapse(e,t,i){if(!e)return;const s=e.parentElement;if(!s)return;const r=s.querySelector("ul");r&&(s.removeChild(r),e.classList.remove("minus"),e.classList.add("plus"),e.textContent="+",e.removeEventListener("click",i),e.addEventListener("click",t))}isExpanded(e){return void 0!==e.parentElement.getElementsByTagName("li")[0]}getId(e){return e.parentElement.id}getIdFromCheckbox(e){return e.id.replace("checkbox-","")}getSwitchElement(e){return document.getElementById(`switch-${e}`)}isChecked(e){return e.checked}setCheckbox(e,t){const i=document.getElementById(`checkbox-${e}`);i&&t!==i.checked&&(i.checked=t)}setXRayed(e,t){const i=document.getElementById(e);i&&(t?i.classList.add("xrayed-node"):i.classList.remove("xrayed-node"))}setHighlighted(e,t){const i=document.getElementById(e);i&&(t?(i.scrollIntoView({block:"center"}),i.classList.add("highlighted-node")):i.classList.remove("highlighted-node"))}}const dw=[];class pw{constructor(e){this._scene=e,this._objects=[],this._objectsViewCulled=[],this._objectsDetailCulled=[],this._objectsChanged=[],this._objectsChangedList=[],this._modelInfos={},this._numObjects=0,this._lenObjectsChangedList=0,this._dirty=!0,this._onModelLoaded=e.on("modelLoaded",(t=>{const i=e.models[t];i&&this._addModel(i)})),this._onTick=e.on("tick",(()=>{this._dirty&&this._build(),this._applyChanges()}))}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._dirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._dirty=!0)}_build(){if(!this._dirty)return;this._applyChanges();const e=this._scene.objects;for(let e=0;e0){for(let e=0;e{t(e)}),(function(e){i(e)}))}getMetaModel(e,t,i){_.loadJSON(e,(e=>{t(e)}),(function(e){i(e)}))}getXKT(e,t,i){var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n=0;)e[t]=0}const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},B=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},x=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},w=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),B(i,A,e.bl_count)},E=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),w(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),F(e,e.l_desc),F(e,e.d_desc),A=(e=>{let t;for(E(e,e.dyn_ltree,e.l_desc.max_code),E(e,e.dyn_dtree,e.d_desc.max_code),F(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},R=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const L=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=L,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},O={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=R(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},xe=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},we=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=Be(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(Be(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Be(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=xe(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Fe(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Ee=[new Fe(0,0,0,0,Pe),new Fe(4,4,8,4,Ce),new Fe(4,5,16,8,Ce),new Fe(4,6,32,32,Ce),new Fe(4,4,16,16,Me),new Fe(8,16,32,32,Me),new Fe(8,16,128,128,Me),new Fe(8,32,128,256,Me),new Fe(32,128,258,1024,Me),new Fe(32,258,258,4096,Me)];function Ie(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ae,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Ee[i.level].max_lazy,i.good_match=Ee[i.level].good_length,i.nice_match=Ee[i.level].nice_length,i.max_chain_length=Ee[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Re=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(we(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(we(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Ee[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=R(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,we(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,we(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Le(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,x,w,P;const C=e.state;i=e.next_in,w=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=w[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(B=0,x=c,0===h){if(B+=l-v,v2;)P[r++]=x[B++],P[r++]=x[B++],P[r++]=x[B++],b-=3;b&&(P[r++]=x[B++],b>1&&(P[r++]=x[B++]))}else{B=r-y;do{P[r++]=P[B++],P[r++]=P[B++],P[r++]=P[B++],b-=3}while(b>2);b&&(P[r++]=P[B++],b>1&&(P[r++]=P[B++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,B=0,x=0,w=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let F,E,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&x>592)return 1;for(;;){F=f-y,n[g]+1=p?(E=D[n[g]-p],I=P[n[g]-p]):(E=96,I=0),A=1<>y)+h]=F<<24|E<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(w&=A-1,w+=A):w=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(w&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,B=1<852||2===e&&x>592)return 1;c=w&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==w&&(r[d+w]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:Bt,Z_MEM_ERROR:xt,Z_BUF_ERROR:wt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Ft=16191,Et=16192,It=16194,Dt=16199,St=16200,Tt=16206,Rt=16209,Lt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,x,w=0;const P=new Uint8Array(4);let C,M;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Ft&&(i.mode=Et),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,x=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Et;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Rt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Rt;break}if(A>>>=4,h-=4,B=8+(15&A),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=Rt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),B)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{B=s[o+d++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Ft;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Rt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Rt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Ft;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Rt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},x=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,x){e.msg="invalid code lengths set",i.mode=Rt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Rt;break}B=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,B=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,B=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Rt;break}for(;d--;)i.lens[i.have++]=B}}if(i.mode===Rt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Rt;break}if(i.lenbits=9,C={bits:i.lenbits},x=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,x){e.msg="invalid literal/lengths set",i.mode=Rt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},x=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,x){e.msg="invalid distances set",i.mode=Rt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Ft&&(i.back=-1);break}for(i.back=0;w=i.lencode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Ft;break}if(64&m){e.msg="invalid literal/length code",i.mode=Rt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;w=i.distcode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Rt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Rt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Rt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=R(r,t,i,0),r!==s.check)?Bt:(o=Wt(e,t,i,i),o?(s.mode=16210,xt):(s.havedict=1,_t)))},$t=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,Bi=pi,xi=fi,wi=gi,Pi=mi,Ci=_i,Mi=vi,Fi=O,Ei={Deflate:bi,deflate:yi,deflateRaw:Bi,gzip:xi,Inflate:wi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Fi};e.Deflate=bi,e.Inflate=wi,e.constants=Fi,e.default=Ei,e.deflate=yi,e.deflateRaw=Bi,e.gzip=xi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var _w=Object.freeze({__proto__:null});let vw=window.pako||_w;vw.inflate||(vw=vw.default);const bw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const yw={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(vw.inflate(e.positions).buffer),normals:new Int8Array(vw.inflate(e.normals).buffer),indices:new Uint32Array(vw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(vw.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(vw.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(vw.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(vw.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(vw.inflate(e.meshColors).buffer),entityIDs:vw.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(vw.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(vw.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(vw.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,u=i.meshIndices,d=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,v=h.length,b=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(F[i]=e)}}for(let e=0;e1,o=Ew(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,v=a.subarray(d[t],i?a.length:d[t+1]),y=l.subarray(d[t],i?l.length:d[t+1]),B=A.subarray(p[t],i?A.length:p[t+1]),w=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:B,edgeIndices:w,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;b[F[t]];const i={};s.createMesh(_.apply(i,{id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:B,edgeIndices:w,positionsDecodeMatrix:M,color:o,opacity:u}))}}let E=0;for(let e=0;e1){const t={},r=`${n}-instance.${E++}`,o=`${n}-geometry.${i}`,a=16*B[e],A=u.subarray(a,a+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let Dw=window.pako||_w;Dw.inflate||(Dw=Dw.default);const Sw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Tw={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(Dw.inflate(e.positions).buffer),normals:new Int8Array(Dw.inflate(e.normals).buffer),indices:new Uint32Array(Dw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Dw.inflate(e.edgeIndices).buffer),matrices:new Float32Array(Dw.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(Dw.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(Dw.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(Dw.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(Dw.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(Dw.inflate(e.primitiveInstances).buffer),eachEntityId:Dw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(Dw.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(Dw.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),v=i.eachEntityPrimitiveInstancesPortion,b=i.eachEntityMatricesPortion,y=u.length,B=g.length,x=new Uint8Array(y),w=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=Sw(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),v=A.subarray(d[e],t?A.length:d[e+1]),b=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b})}else{const t=e;m[P[e]];const i={};s.createMesh(_.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*b[e],l=c.subarray(n,n+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let Rw=window.pako||_w;Rw.inflate||(Rw=Rw.default);const Lw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Uw={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Rw.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:Rw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,u=i.matrices,d=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,v=i.primitiveInstances,b=JSON.parse(i.eachEntityId),y=i.eachEntityPrimitiveInstancesPortion,B=i.eachEntityMatricesPortion,x=i.eachTileAABB,w=i.eachTileEntitiesPortion,P=p.length,C=v.length,M=b.length,F=w.length,E=new Uint32Array(P);for(let e=0;e1,c=t===P-1,u=a.subarray(p[t],c?a.length:p[t+1]),b=l.subarray(p[t],c?l.length:p[t+1]),y=A.subarray(f[t],c?A.length:f[t+1]),B=h.subarray(g[t],c?h.length:g[t+1]),x=Lw(m.subarray(4*t,4*t+3)),w=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:u,indices:y,edgeIndices:B,positionsDecodeMatrix:d}),U[e]=!0),s.createMesh(_.apply(N,{id:C,geometryId:e,origin:I,matrix:F,color:x,opacity:w})),R.push(C)}else s.createMesh(_.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:u,normalsCompressed:b,indices:y,edgeIndices:B,positionsDecodeMatrix:L,color:x,opacity:w})),R.push(C)}R.length>0&&s.createEntity(_.apply(O,{id:w,isObject:!0,meshIds:R}))}}}(e,t,a,s,0,o)}};let kw=window.pako||_w;kw.inflate||(kw=kw.default);const Ow=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function Nw(e){const t=[];for(let i=0,s=e.length;i1,c=t===E-1,P=Ow(w.subarray(6*e,6*e+3)),C=w[6*e+3]/255,M=w[6*e+4]/255,F=w[6*e+5]/255,I=o.getNextId();if(r){const r=x[e],o=d.slice(r,r+16),B=`${n}-geometry.${i}.${t}`;if(!Q[B]){let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Nw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createGeometry({id:B,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:p}),Q[B]=!0}s.createMesh(_.apply(V,{id:I,geometryId:B,origin:R,matrix:o,color:P,metallic:M,roughness:F,opacity:C})),U.push(I)}else{let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Nw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createMesh(_.apply(V,{id:I,origin:R,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:N,color:P,metallic:M,roughness:F,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(_.apply(O,{id:F,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let Vw=window.pako||_w;Vw.inflate||(Vw=Vw.default);const Hw=c.vec4(),jw=c.vec4();const Gw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function zw(e){const t=[];for(let i=0,s=e.length;i1,l=r===L-1,A=Gw(E.subarray(6*e,6*e+3)),h=E[6*e+3]/255,u=E[6*e+4]/255,I=E[6*e+5]/255,D=o.getNextId();if(a){const o=F[e],a=v.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let E=H[M];if(!E){E={batchThisMesh:!t.reuseGeometries};let e=!1;switch(y[r]){case 0:E.primitiveName="solid",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryNormals=p.subarray(x[r],l?p.length:x[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),E.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 1:E.primitiveName="surface",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryNormals=p.subarray(x[r],l?p.length:x[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),E.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 2:E.primitiveName="points",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryColors=zw(f.subarray(w[r],l?f.length:w[r+1])),e=E.geometryPositions.length>0;break;case 3:E.primitiveName="lines",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;default:continue}if(e||(E=null),E&&(E.geometryPositions.length,E.batchThisMesh)){E.decompressedPositions=new Float32Array(E.geometryPositions.length);const e=E.geometryPositions,t=E.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=d.subarray(B[r],l?d.length:B[r+1]),i=p.subarray(x[r],l?p.length:x[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=d.subarray(B[r],l?d.length:B[r+1]),o=zw(f.subarray(w[r],l?f.length:w[r+1])),c=t.length>0;break;case 3:e="lines",t=d.subarray(B[r],l?d.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:R,color:A,metallic:u,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(_.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let Kw=window.pako||_w;Kw.inflate||(Kw=Kw.default);const Xw=c.vec4(),Jw=c.vec4();const Yw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Zw={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Kw.inflate(e,t).buffer}return{metadata:JSON.parse(Kw.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(Kw.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,u=i.indices,d=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,v=i.eachGeometryNormalsPortion,b=i.eachGeometryColorsPortion,y=i.eachGeometryIndicesPortion,B=i.eachGeometryEdgeIndicesPortion,x=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,F=i.eachTileAABB,E=i.eachTileEntitiesPortion,I=m.length,D=x.length,S=M.length,T=E.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const R=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=Yw(P.subarray(6*e,6*e+3)),F=P[6*e+3]/255,E=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=w[e],a=p.slice(o,o+16),x=`${n}-geometry.${i}.${r}`;let P=k[x];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(B[r],C?d.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(B[r],C?d.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(b[r],C?h.length:b[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(v[r],C?A.length:v[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),a=d.subarray(B[r],C?d.length:B[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(b[r],C?h.length:b[r+1]),c=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(j,{id:S,origin:L,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:E,roughness:D,opacity:F})),O.push(S))}}O.length>0&&s.createEntity(_.apply(H,{id:F,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let qw=window.pako||_w;qw.inflate||(qw=qw.default);const $w=c.vec4(),eP=c.vec4();const tP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function iP(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=tP(S.subarray(6*e,6*e+3)),R=S[6*e+3]/255,L=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=b.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let E=W[A];if(!E){E={batchThisMesh:!t.reuseGeometries};let e=!1;switch(B[r]){case 0:E.primitiveName="solid",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),E.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),E.geometryEdgeIndices=m.subarray(F[r],l?m.length:F[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 1:E.primitiveName="surface",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),E.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),E.geometryEdgeIndices=m.subarray(F[r],l?m.length:F[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 2:E.primitiveName="points",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=E.geometryPositions.length>0;break;case 3:E.primitiveName="lines",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 4:E.primitiveName="lines",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryIndices=iP(E.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;default:continue}if(e||(E=null),E&&(E.geometryPositions.length,E.batchThisMesh)){E.decompressedPositions=new Float32Array(E.geometryPositions.length),E.transformedAndRecompressedPositions=new Uint16Array(E.geometryPositions.length);const e=E.geometryPositions,t=E.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=u.subarray(x[r],l?u.length:x[r+1]),i=d.subarray(w[r],l?d.length:w[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(F[r],l?m.length:F[r+1]),c=t.length>0&&a.length>0;break;case 2:e="points",t=u.subarray(x[r],l?u.length:x[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),c=t.length>0;break;case 3:e="lines",t=u.subarray(x[r],l?u.length:x[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),c=t.length>0&&a.length>0;break;case 4:e="lines",t=u.subarray(x[r],l?u.length:x[r+1]),a=iP(t,g.subarray(M[r],l?g.length:M[r+1])),c=t.length>0&&a.length>0;break;default:continue}c&&(s.createMesh(_.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:v,color:T,metallic:L,roughness:O,opacity:R})),U.push(Q))}}U.length>0&&s.createEntity(_.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},rP={};rP[yw.version]=yw,rP[ww.version]=ww,rP[Mw.version]=Mw,rP[Iw.version]=Iw,rP[Tw.version]=Tw,rP[Uw.version]=Uw,rP[Qw.version]=Qw,rP[Ww.version]=Ww,rP[Zw.version]=Zw,rP[sP.version]=sP;var oP={};!function(e){var t,i="File format is not recognized.",s="Error while reading zip file.",r="Error while reading file data.",o=524288,n="text/plain";try{t=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function a(){this.crc=-1}function l(){}function A(e,t){var i,s;return i=new ArrayBuffer(e),s=new Uint8Array(i),t&&s.set(t,0),{buffer:i,array:s,view:new DataView(i)}}function h(){}function c(e){var t,i=this;i.size=0,i.init=function(s,r){var o=new Blob([e],{type:n});(t=new d(o)).init((function(){i.size=t.size,s()}),r)},i.readUint8Array=function(e,i,s,r){t.readUint8Array(e,i,s,r)}}function u(t){var i,s=this;s.size=0,s.init=function(e){for(var r=t.length;"="==t.charAt(r-1);)r--;i=t.indexOf(",")+1,s.size=Math.floor(.75*(r-i)),e()},s.readUint8Array=function(s,r,o){var n,a=A(r),l=4*Math.floor(s/3),h=4*Math.ceil((s+r)/3),c=e.atob(t.substring(l+i,h+i)),u=s-3*Math.floor(l/4);for(n=u;ne.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function B(e){return decodeURIComponent(escape(e))}function x(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(w(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var E={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=E[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){F(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(oP);const nP=oP.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(nP);const aP=["4.2"];class lP{constructor(e,t={}){this.supportedSchemas=aP,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(nP.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new us(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new fs(t,{diffuse:[1,1,1],specular:c.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Vt(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new As(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,AP(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var AP=function(e,t,i,s,r,o){!function(e,t,i){var s=new mP;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){hP(e,i,s,t,r,o)}),o)},hP=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=CP(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};BP.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};xP.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=PP(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},PP=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};function MP(e,t){if(t>=e.length)return e;let i=[];for(let s=0;s{t(e)}),(function(e){i(e)}))}}function EP(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=IP(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return SP(u,d,i,s,r,A),d}function IP(e,t,i,s,r){var o,n;if(r===eC(e,t,i,s)>0)for(o=t;o=t;o-=s)n=ZP(o,e[o],e[o+1],n);return n&&zP(n,n.next)&&(qP(n),n=n.next),n}function DP(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!zP(s,s.next)&&0!==GP(s.prev,s,s.next))s=s.next;else{if(qP(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function SP(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=QP(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?RP(e,s,r,o):TP(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),qP(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?SP(e=LP(DP(e),t,i),t,i,s,r,o,2):2===n&&UP(e,t,i,s,r,o):SP(DP(e),t,i,s,r,o,1);break}}}function TP(e){var t=e.prev,i=e,s=e.next;if(GP(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(HP(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&GP(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function RP(e,t,i,s){var r=e.prev,o=e,n=e.next;if(GP(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=QP(a,l,t,i,s),u=QP(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&GP(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&GP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&GP(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&GP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function LP(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!zP(r,o)&&WP(r,s,s.next,o)&&JP(r,o)&&JP(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),qP(s),qP(s.next),s=e=o),s=s.next}while(s!==e);return DP(s)}function UP(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&jP(n,a)){var l=YP(n,a);return n=DP(n,n.next),l=DP(l,l.next),SP(n,t,i,s,r,o),void SP(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function kP(e,t){return e.x-t.x}function OP(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&HP(oi.x||s.x===i.x&&NP(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=YP(t,e);DP(t,t.next),DP(i,i.next)}}function NP(e,t){return GP(e.prev,e,t.prev)<0&&GP(t.next,e,e.next)<0}function QP(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function VP(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function jP(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&WP(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(JP(e,t)&&JP(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(GP(e.prev,e,t.prev)||GP(e,t.prev,t))||zP(e,t)&&GP(e.prev,e,e.next)>0&&GP(t.prev,t,t.next)>0)}function GP(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function zP(e,t){return e.x===t.x&&e.y===t.y}function WP(e,t,i,s){var r=XP(GP(e,t,i)),o=XP(GP(e,t,s)),n=XP(GP(i,s,e)),a=XP(GP(i,s,t));return r!==o&&n!==a||(!(0!==r||!KP(e,i,t))||(!(0!==o||!KP(e,s,t))||(!(0!==n||!KP(i,e,s))||!(0!==a||!KP(i,t,s)))))}function KP(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function XP(e){return e>0?1:e<0?-1:0}function JP(e,t){return GP(e.prev,e,e.next)<0?GP(e,t,e.next)>=0&&GP(e,e.prev,t)>=0:GP(e,t,e.prev)<0||GP(e,e.next,t)<0}function YP(e,t){var i=new $P(e.i,e.x,e.y),s=new $P(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function ZP(e,t,i,s){var r=new $P(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function qP(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function $P(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function eC(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const tC=c.vec2(),iC=c.vec3(),sC=c.vec3(),rC=c.vec3();exports.AlphaFormat=1021,exports.AmbientLight=wt,exports.AngleMeasurementsControl=pe,exports.AngleMeasurementsMouseControl=fe,exports.AngleMeasurementsPlugin=class extends V{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new fe(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new de(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){var t,i;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){const s=e.pickResult;if(s.worldPos&&s.worldNormal){const e=c.normalizeVec3(s.worldNormal,me),r=c.mulVec3Scalar(e,this._surfaceOffset,_e);t=c.addVec3(s.worldPos,r,ve),i=s.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var s=null;e.markerElementId&&((s=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var r=null;e.labelElementId&&((r=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const o=new ge(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:s,labelElement:r,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:_.apply(e.values,_.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[o.id]=o,o.on("destroyed",(()=>{delete this.annotations[o.id],this.fire("annotationDestroyed",o.id)})),this.fire("annotationCreated",o.id),o}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;tp.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,B=v.filter((e=>!b[e])),x=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=$A(e.location,XA),i=$A(e.direction,XA);A&&c.negateVec3(i),c.subVec3(t,l),r.yUp&&(t=th(t),i=th(i)),new qi(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new KA(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=$A(e.location,JA),n=$A(e.normal,YA),a=$A(e.up,ZA),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=th(o),n=th(n),a=th(a)),new Rs(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,u;if(e.perspective_camera?(a=$A(e.perspective_camera.camera_view_point,XA),A=$A(e.perspective_camera.camera_direction,XA),h=$A(e.perspective_camera.camera_up_vector,XA),r.perspective.fov=e.perspective_camera.field_of_view,u="perspective"):(a=$A(e.orthogonal_camera.camera_view_point,XA),A=$A(e.orthogonal_camera.camera_direction,XA),h=$A(e.orthogonal_camera.camera_up_vector,XA),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,u="ortho"),c.subVec3(a,l),r.yUp&&(a=th(a),A=th(A),h=th(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:c.addVec3(a,A,XA)}else A=c.addVec3(a,A,XA);n?(r.eye=a,r.look=A,r.up=h,r.projection=u):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:u})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=c.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}},exports.Bitmap=Rs,exports.ByteType=1010,exports.CameraMemento=Eh,exports.CameraPath=class extends D{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new uh(this),this._lookCurve=new uh(this),this._upCurve=new uh(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,dh),t.look=this._lookCurve.getPoint(e,dh),t.up=this._upCurve.getPoint(e,dh)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=c.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:c.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||c.vec3([1,1,1]),o=t.translate||c.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],u,d);A.push(...i)}if(3===A.length)d.indices.push(A[0]),d.indices.push(A[1]),d.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}},exports.CubicBezierCurve=class extends ch{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.v3=t.v3,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set v3(e){this.fire("v3",this._v3=e||c.vec3([0,0,0]))}get v3(){return this._v3}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=c.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=c.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}},exports.Curve=ch,exports.DefaultLoadingManager=cA,exports.DepthFormat=1026,exports.DepthStencilFormat=1027,exports.DirLight=xt,exports.DistanceMeasurementsControl=oh,exports.DistanceMeasurementsMouseControl=nh,exports.DistanceMeasurementsPlugin=class extends V{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new nh(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new rh(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let u,d;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),s.set(d.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=d.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:d.worldPos,entity:d.entity},target:{worldPos:d.worldPos,entity:d.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=d.worldPos,this._currentDistanceMeasurement.target.entity=d.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;tw.set(this.viewer.scene.aabb),c.getAABB3Center(tw,iw),tw[0]+=t[0]-iw[0],tw[1]+=t[1]-iw[1],tw[2]+=t[2]-iw[2],tw[3]+=t[0]-iw[0],tw[4]+=t[1]-iw[1],tw[5]+=t[2]-iw[2],this.viewer.cameraFlight.flyTo({aabb:tw,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}null===t.controlElementId||void 0===t.controlElementId?this.error("Parameter expected: controlElementId"):(this._controlElement=document.getElementById(t.controlElementId),this._controlElement||this.warn("Can't find control element: '"+t.controlElementId+"' - will create plugin without control element")),this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setDragSensitivity(e){this._dragSensitivity=e||1}getDragSensitivity(){return this._dragSensitivity}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new qi(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new qx(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(let e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){let t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(let t=0,i=e.length;t{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}},exports.FloatType=1015,exports.Fresnel=class extends D{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new et({edgeColor:c.vec3([0,0,0]),centerColor:c.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}},exports.Frustum=U,exports.FrustumPlane=L,exports.GIFMediaType=1e4,exports.GLTFDefaultDataSource=ah,exports.GLTFLoaderPlugin=class extends V{constructor(e,t={}){super("GLTFLoader",e,t),this._sceneModelLoader=new gx(this,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new ah}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||Mx}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new zA(this.viewer.scene,_.apply(e,{isModel:!0,dtxEnabled:e.dtxEnabled})),i=t.id;if(!e.src&&!e.gltf)return this.error("load() param expected: src or gltf"),t;if(e.metaModelSrc||e.metaModelJSON){const s=e.objectDefaults||this._objectDefaults||Mx,r=r=>{let o;if(this.viewer.metaScene.createMetaModel(i,r,{includeTypes:e.includeTypes,excludeTypes:e.excludeTypes}),this.viewer.scene.canvas.spinner.processes--,e.includeTypes){o={};for(let t=0,i=e.includeTypes.length;t{const r=t.name;if(!r)return!0;const o=r,n=this.viewer.metaScene.metaObjects[o],a=(n?n.type:"DEFAULT")||"DEFAULT";i.createEntity={id:o,isObject:!0};const l=s[a];return l&&(!1===l.visible&&(i.createEntity.visible=!1),l.colorize&&(i.createEntity.colorize=l.colorize),!1===l.pickable&&(i.createEntity.pickable=!1),void 0!==l.opacity&&null!==l.opacity&&(i.createEntity.opacity=l.opacity)),!0},e.src?this._sceneModelLoader.load(this,e.src,r,e,t):this._sceneModelLoader.parse(this,e.gltf,r,e,t)};if(e.metaModelSrc){const t=e.metaModelSrc;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getMetaModel(t,(e=>{this.viewer.scene.canvas.spinner.processes--,r(e)}),(e=>{this.error(`load(): Failed to load model metadata for model '${i} from '${t}' - ${e}`),this.viewer.scene.canvas.spinner.processes--}))}else e.metaModelJSON&&r(e.metaModelJSON)}else e.handleGLTFNode=(e,t,i)=>{const s=t.name;if(!s)return!0;const r=s;return i.createEntity={id:r,isObject:!0},!0},e.src?this._sceneModelLoader.load(this,e.src,null,e,t):this._sceneModelLoader.parse(this,e.gltf,null,e,t);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.HalfFloatType=1016,exports.ImagePlane=class extends D{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._dir=c.vec3(),this._size=1,this._imageSize=c.vec2(),this._texture=new ws(this),this._plane=new Wi(this,{geometry:new Ut(this,Ds({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new Wi(this,{geometry:new Ut(this,Is({size:1,divisions:10})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new ls(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),G(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];c.subVec3(t,this.position,yh);const s=-c.dotVec3(i,yh);c.normalizeVec3(i),c.mulVec3Scalar(i,s,Bh),c.vec3PairToQuaternion(xh,e,wh),this._node.quaternion=wh}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}},exports.IntType=1013,exports.JPEGMediaType=10001,exports.KTX2TextureTranscoder=mA,exports.LASLoaderPlugin=class extends V{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new bP}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new zA(this.viewer.scene,_.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=wP(e);Rb(e,yP,i).then((e=>{const h=e.attributes,u=e.loaderData,d=void 0!==u.pointsFormatId?u.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(d){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=MP(p,15e5),m=MP(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}},exports.LambertMaterial=As,exports.LightMap=class extends Fh{get type(){return"LightMap"}constructor(e,t={}){super(e,t),this.scene._lightMapCreated(this)}destroy(){super.destroy(),this.scene._lightMapDestroyed(this)}},exports.LineSet=KA,exports.LinearEncoding=3e3,exports.LinearFilter=1006,exports.LinearMipMapLinearFilter=1008,exports.LinearMipMapNearestFilter=1007,exports.LinearMipmapLinearFilter=1008,exports.LinearMipmapNearestFilter=1007,exports.Loader=uA,exports.LoadingManager=hA,exports.LocaleService=lh,exports.LuminanceAlphaFormat=1025,exports.LuminanceFormat=1024,exports.Map=e,exports.Marker=ae,exports.MarqueePicker=N,exports.MarqueePickerMouseControl=class extends D{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{e.camera.zUp?(this._zUp=!0,this._cubeTextureCanvas.setZUp(),this._repaint(),this._synchCamera()):e.camera.yUp&&(this._zUp=!1,this._cubeTextureCanvas.setYUp(),this._repaint(),this._synchCamera())})),this._onCameraFOV=e.camera.perspective.on("fov",(e=>{this._synchProjection&&(this._navCubeCamera.perspective.fov=e)})),this._onCameraProjection=e.camera.on("projection",(e=>{this._synchProjection&&(this._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var o=-1;function n(e){var t=[0,0];if(e){for(var i=e.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var a,l,A=null,h=null,u=!1,d=!1,p=.5;s._navCubeCanvas.addEventListener("mouseenter",s._onMouseEnter=function(e){d=!0}),s._navCubeCanvas.addEventListener("mouseleave",s._onMouseLeave=function(e){d=!1}),s._navCubeCanvas.addEventListener("mousedown",s._onMouseDown=function(e){if(1===e.which){A=e.x,h=e.y,a=e.clientX,l=e.clientY;var t=n(e),s=i.pick({canvasPos:t});u=!!s}}),document.addEventListener("mouseup",s._onMouseUp=function(e){if(1===e.which&&(u=!1,null!==A)){var t=n(e),a=i.pick({canvasPos:t,pickSurface:!0});if(a&&a.uv){var l=s._cubeTextureCanvas.getArea(a.uv);if(l>=0&&(document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0)){if(s._cubeTextureCanvas.setAreaHighlighted(l,!0),o=l,s._repaint(),e.xA+3||e.yh+3)return;var c=s._cubeTextureCanvas.getAreaDir(l);if(c){var d=s._cubeTextureCanvas.getAreaUp(l);s._isProjectNorth&&s._projectNorthOffsetAngle&&(c=r(1,c,Ex),d=r(1,d,Ix)),f(c,d,(function(){o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0&&(s._cubeTextureCanvas.setAreaHighlighted(l,!1),o=-1,s._repaint())}))}}}}}),document.addEventListener("mousemove",s._onMouseMove=function(t){if(o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),1!==t.buttons||u){if(u){var r=t.clientX,A=t.clientY;return document.body.style.cursor="move",void function(t,i){var s=(t-a)*-p,r=(i-l)*-p;e.camera.orbitYaw(s),e.camera.orbitPitch(-r),a=t,l=i}(r,A)}if(d){var h=n(t),c=i.pick({canvasPos:h,pickSurface:!0});if(c){if(c.uv){document.body.style.cursor="pointer";var f=s._cubeTextureCanvas.getArea(c.uv);if(f===o)return;o>=0&&s._cubeTextureCanvas.setAreaHighlighted(o,!1),f>=0&&(s._cubeTextureCanvas.setAreaHighlighted(f,!0),s._repaint(),o=f)}}else document.body.style.cursor="default",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1)}}});var f=function(){var t=c.vec3();return function(i,r,o){var n=s._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,a=c.getAABB3Diag(n);c.getAABB3Center(n,t);var l=Math.abs(a/Math.tan(s._cameraFitFOV*c.DEGTORAD));e.cameraControl.pivotPos=t,s._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV,duration:s._cameraFlyDuration},o):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV},o)}}();this._onUpdated=e.localeService.on("updated",(()=>{this._cubeTextureCanvas.clear(),this._repaint()})),this.setVisible(t.visible),this.setCameraFitFOV(t.cameraFitFOV),this.setCameraFly(t.cameraFly),this.setCameraFlyDuration(t.cameraFlyDuration),this.setFitVisible(t.fitVisible),this.setSynchProjection(t.synchProjection)}send(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}_repaint(){const e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}setVisible(e=!0){this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}getVisible(){return!!this._navCubeCanvas&&this._cubeMesh.visible}setFitVisible(e=!1){this._fitVisible=e}getFitVisible(){return this._fitVisible}setCameraFly(e=!0){this._cameraFly=e}getCameraFly(){return this._cameraFly}setCameraFitFOV(e=45){this._cameraFitFOV=e}getCameraFitFOV(){return this._cameraFitFOV}setCameraFlyDuration(e=.5){this._cameraFlyDuration=e}getCameraFlyDuration(){return this._cameraFlyDuration}setSynchProjection(e=!1){this._synchProjection=e}getSynchProjection(){return this._synchProjection}setIsProjectNorth(e=!1){this._isProjectNorth=e}getIsProjectNorth(){return this._isProjectNorth}setProjectNorthOffsetAngle(e){this._projectNorthOffsetAngle=e}getProjectNorthOffsetAngle(){return this._projectNorthOffsetAngle}destroy(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,super.destroy()}},exports.NearestFilter=1003,exports.NearestMipMapLinearFilter=1005,exports.NearestMipMapNearestFilter=1004,exports.NearestMipmapLinearFilter=1005,exports.NearestMipmapNearestFilter=1004,exports.Node=ls,exports.OBJLoaderPlugin=class extends V{constructor(e,t){super("OBJLoader",e,t),this._sceneGraphLoader=new Sx}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new ls(this.viewer.scene,_.apply(e,{isModel:!0}));const i=t.id,s=e.src;if(!s)return this.error("load() param expected: src"),t;if(e.metaModelSrc){const r=e.metaModelSrc;_.loadJSON(r,(r=>{this.viewer.metaScene.createMetaModel(i,r),this._sceneGraphLoader.load(t,s,e)}),(e=>{this.error(`load(): Failed to load model modelMetadata for model '${i} from '${r}' - ${e}`)}))}else this._sceneGraphLoader.load(t,s,e);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.ObjectsKdTree3=class{constructor(e){if(!e)throw"Parameter expected: cfg";if(!e.viewer)throw"Parameter expected: cfg.viewer";this.viewer=e.viewer,this._maxTreeDepth=e.maxTreeDepth||15,this._root=null,this._needsRebuild=!0,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&c.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&c.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;u[0]=r[3]-r[0],u[1]=r[4]-r[1],u[2]=r[5]-r[2];let o=0;if(u[1]>u[o]&&(o=1),u[2]>u[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}},exports.ObjectsMemento=Sh,exports.PNGMediaType=10002,exports.Path=class extends ch{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new et({type:"point",pos:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=c.identityMat4());const e=i._state.pos,t=s.look,r=s.up;c.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=c.identityMat4());const e=i.scene.canvas.canvas;c.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new Xe(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}},exports.PointerCircle=Q,exports.PointerLens=class{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}},exports.QuadraticBezierCurve=class extends ch{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=c.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=c.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}},exports.Queue=d,exports.RGBAFormat=1023,exports.RGBAIntegerFormat=1033,exports.RGBA_ASTC_10x10_Format=37819,exports.RGBA_ASTC_10x5_Format=37816,exports.RGBA_ASTC_10x6_Format=37817,exports.RGBA_ASTC_10x8_Format=37818,exports.RGBA_ASTC_12x10_Format=37820,exports.RGBA_ASTC_12x12_Format=37821,exports.RGBA_ASTC_4x4_Format=37808,exports.RGBA_ASTC_5x4_Format=37809,exports.RGBA_ASTC_5x5_Format=37810,exports.RGBA_ASTC_6x5_Format=37811,exports.RGBA_ASTC_6x6_Format=37812,exports.RGBA_ASTC_8x5_Format=37813,exports.RGBA_ASTC_8x6_Format=37814,exports.RGBA_ASTC_8x8_Format=37815,exports.RGBA_BPTC_Format=36492,exports.RGBA_ETC2_EAC_Format=37496,exports.RGBA_PVRTC_2BPPV1_Format=35843,exports.RGBA_PVRTC_4BPPV1_Format=35842,exports.RGBA_S3TC_DXT1_Format=33777,exports.RGBA_S3TC_DXT3_Format=33778,exports.RGBA_S3TC_DXT5_Format=33779,exports.RGBFormat=1022,exports.RGB_ETC1_Format=36196,exports.RGB_ETC2_Format=37492,exports.RGB_PVRTC_2BPPV1_Format=35841,exports.RGB_PVRTC_4BPPV1_Format=35840,exports.RGB_S3TC_DXT1_Format=33776,exports.RGFormat=1030,exports.RGIntegerFormat=1031,exports.ReadableGeometry=Ut,exports.RedFormat=1028,exports.RedIntegerFormat=1029,exports.ReflectionMap=class extends Fh{get type(){return"ReflectionMap"}constructor(e,t={}){super(e,t),this.scene._lightsState.addReflectionMap(this._state),this.scene._reflectionMapCreated(this)}destroy(){super.destroy(),this.scene._reflectionMapDestroyed(this)}},exports.RepeatWrapping=1e3,exports.STLDefaultDataSource=sw,exports.STLLoaderPlugin=class extends V{constructor(e,t={}){super("STLLoader",e,t),this._sceneGraphLoader=new ow,this.dataSource=t.dataSource}set dataSource(e){this._dataSource=e||new sw}get dataSource(){return this._dataSource}load(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new ls(this.viewer.scene,_.apply(e,{isModel:!0})),i=e.src,s=e.stl;return i||s?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,s,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}},exports.SceneModel=zA,exports.SceneModelMesh=Os,exports.SceneModelTransform=UA,exports.SectionPlane=qi,exports.SectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("SectionPlanes",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new jx(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;Gx.set(this.viewer.scene.aabb),c.getAABB3Center(Gx,zx),Gx[0]+=t[0]-zx[0],Gx[1]+=t[1]-zx[1],Gx[2]+=t[2]-zx[2],Gx[3]+=t[0]-zx[0],Gx[4]+=t[1]-zx[1],Gx[5]+=t[2]-zx[2],this.viewer.cameraFlight.flyTo({aabb:Gx,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new qi(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new Vx(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(var t=0,i=e.length;t{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}},exports.StoreyViewsPlugin=class extends V{constructor(e,t={}){super("StoreyViews",e),this._objectsMemento=new Sh,this._cameraMemento=new Eh,this.storeys={},this.modelStoreys={},this._fitStoreyMaps=!!t.fitStoreyMaps,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._registerModelStoreys(e),this.fire("storeys",this.storeys)}))}_registerModelStoreys(e){const t=this.viewer,i=t.scene,s=t.metaScene,r=s.metaModels[e],o=i.models[e];if(!r||!r.rootMetaObjects)return;const n=r.rootMetaObjects;for(let t=0,r=n.length;t.5?a.length:0,h=new Wx(this,o.aabb,l,e,n,A);h._onModelDestroyed=o.once("destroyed",(()=>{this._deregisterModelStoreys(e),this.fire("storeys",this.storeys)})),this.storeys[n]=h,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][n]=h}}}_deregisterModelStoreys(e){const t=this.modelStoreys[e];if(t){const i=this.viewer.scene;for(let e in t)if(t.hasOwnProperty(e)){const s=t[e],r=i.models[s.modelId];r&&r.off(s._onModelDestroyed),delete this.storeys[e]}delete this.modelStoreys[e]}}get fitStoreyMaps(){return this._fitStoreyMaps}gotoStoreyCamera(e,t={}){const i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());const s=this.viewer,r=s.scene.camera,o=i.storeyAABB;if(o[3]{t.done()})):(s.cameraFlight.jumpTo(_.apply(t,{eye:h,look:n,up:u,orthoScale:A})),s.camera.ortho.scale=A)}showStoreyObjects(e,t={}){if(!this.storeys[e])return void this.error("IfcBuildingStorey not found with this ID: "+e);const i=this.viewer,s=i.scene;i.metaScene.metaObjects[e]&&(t.hideOthers&&s.setObjectsVisible(i.scene.visibleObjectIds,!1),this.withStoreyObjects(e,((e,t)=>{e&&(e.visible=!0)})))}withStoreyObjects(e,t){const i=this.viewer,s=i.scene,r=i.metaScene,o=r.metaObjects[e];if(!o)return;const n=o.getObjectIDsInSubtree();for(var a=0,l=n.length;au[1]&&u[0]>u[2],p=!d&&u[1]>u[0]&&u[1]>u[2];!d&&!p&&u[2]>u[0]&&(u[2],u[1]);const f=e.width/A,g=p?e.height/c:e.height/h;return i[0]=Math.floor(e.width-(t[0]-n)*f),i[1]=Math.floor(e.height-(t[2]-l)*g),i[0]>=0&&i[0]=0&&i[1]<=e.height}worldDirToStoreyMap(e,t,i){const s=this.viewer.camera,r=s.eye,o=s.look,n=c.subVec3(o,r,Xx),a=s.worldUp,l=a[0]>a[1]&&a[0]>a[2],A=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!A&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=n[1],i[1]=n[2]):A?(i[0]=n[0],i[1]=n[2]):(i[0]=n[0],i[1]=n[1]),c.normalizeVec2(i)}destroy(){this.viewer.scene.off(this._onModelLoaded),super.destroy()}},exports.Texture=ws,exports.TextureTranscoder=class{transcode(e,t,i={}){}destroy(){}},exports.TreeViewPlugin=class extends V{constructor(e,t={}){super("TreeViewPlugin",e),this.errors=[],this.valid=!0;const i=t.containerElement||document.getElementById(t.containerElementId);if(i instanceof HTMLElement){for(let e=0;;e++)if(!dw[e]){dw[e]=this,this._index=e,this._id=`tree-${e}`;break}if(this._containerElement=i,this._metaModels={},this._autoAddModels=!1!==t.autoAddModels,this._autoExpandDepth=t.autoExpandDepth||0,this._sortNodes=!1!==t.sortNodes,this._viewer=e,this._rootElement=null,this._muteSceneEvents=!1,this._muteTreeEvents=!1,this._rootNodes=[],this._objectNodes={},this._nodeNodes={},this._rootNames={},this._sortNodes=t.sortNodes,this._pruneEmptyNodes=t.pruneEmptyNodes,this._showListItemElementId=null,this._renderService=t.renderService||new uw,!this._renderService)throw new Error("TreeViewPlugin: no render service set");if(this._containerElement.oncontextmenu=e=>{e.preventDefault()},this._onObjectVisibility=this._viewer.scene.on("objectVisibility",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;const s=e.visible;if(!(s!==i.checked))return;this._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,this._renderService.setCheckbox(i.nodeId,s);let r=i.parent;for(;r;)r.checked=s,s?r.numVisibleEntities++:r.numVisibleEntities--,this._renderService.setCheckbox(r.nodeId,r.numVisibleEntities>0),r=r.parent;this._muteTreeEvents=!1})),this._onObjectXrayed=this._viewer.scene.on("objectXRayed",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;this._muteTreeEvents=!0;const s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,this._renderService.setXRayed(i.nodeId,s),this._muteTreeEvents=!1)})),this._switchExpandHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._expandSwitchElement(t)},this._switchCollapseHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._collapseSwitchElement(t)},this._checkboxChangeHandler=e=>{if(this._muteTreeEvents)return;this._muteSceneEvents=!0;const t=e.target,i=this._renderService.isChecked(t),s=this._renderService.getIdFromCheckbox(t),r=this._nodeNodes[s],o=this._viewer.scene.objects;let n=0;this._withNodeTree(r,(e=>{const t=e.objectId,s=o[t],r=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,r&&i!==e.checked&&n++,e.checked=i,this._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));let a=r.parent;for(;a;)a.checked=i,i?a.numVisibleEntities+=n:a.numVisibleEntities-=n,this._renderService.setCheckbox(a.nodeId,a.numVisibleEntities>0),a=a.parent;this._muteSceneEvents=!1},this._hierarchy=t.hierarchy||"containment",this._autoExpandDepth=t.autoExpandDepth||0,this._autoAddModels){const e=Object.keys(this.viewer.metaScene.metaModels);for(let t=0,i=e.length;t{this.viewer.metaScene.metaModels[e]&&this.addModel(e)}))}this.hierarchy=t.hierarchy}else this.error("Mandatory config expected: valid containerElementId or containerElement")}set hierarchy(e){"containment"!==(e=e||"containment")&&"storeys"!==e&&"types"!==e&&(this.error("Unsupported value for `hierarchy' - defaulting to 'containment'"),e="containment"),this._hierarchy!==e&&(this._hierarchy=e,this._createNodes())}get hierarchy(){return this._hierarchy}addModel(e,t={}){if(!this._containerElement)return;const i=this.viewer.scene.models[e];if(!i)throw"Model not found: "+e;const s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,t&&t.rootName&&(this._rootNames[e]=t.rootName),i.on("destroyed",(()=>{this.removeModel(i.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}removeModel(e){if(!this._containerElement)return;this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes())}showNode(e){this.unShowNode();const t=this._objectNodes[e];if(!t)return;const i=t.nodeId,s=this._renderService.getSwitchElement(i);if(s)return this._expandSwitchElement(s),s.scrollIntoView(),!0;const r=[];r.unshift(t);let o=t.parent;for(;o;)r.unshift(o),o=o.parent;for(let e=0,t=r.length;e{if(s===e)return;const r=this._renderService.getSwitchElement(i.nodeId);if(r){this._expandSwitchElement(r);const e=i.children;for(var o=0,n=e.length;o0;return this.valid}_validateMetaModelForStoreysHierarchy(e=0,t,i){return!0}_createEnabledNodes(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}_createDisabledNodes(){const e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);const t=this._viewer.metaScene.rootMetaObjects;for(let i in t){const s=t[i],r=s.type,o=s.name,n=o&&""!==o&&"Undefined"!==o&&"Default"!==o?o:r,a=this._renderService.createDisabledNodeElement(n);e.appendChild(a)}}_findEmptyNodes(){const e=this._viewer.metaScene.rootMetaObjects;for(let t in e)this._findEmptyNodes2(e[t])}_findEmptyNodes2(e,t=0){const i=this.viewer.scene,s=e.children,r=e.id,o=i.objects[r];if(e._countEntities=0,o&&e._countEntities++,s)for(let t=0,i=s.length;t{e.aabb&&r.aabb||(e.aabb||(e.aabb=t.getAABB(s.getObjectIDsInSubtree(e.objectId))),r.aabb||(r.aabb=t.getAABB(s.getObjectIDsInSubtree(r.objectId))));let o=0;return o=i.xUp?0:i.yUp?1:2,e.aabb[o]>r.aabb[o]?-1:e.aabb[o]s?1:0}_synchNodesToEntities(){const e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects;for(let s=0,r=e.length;sthis._createNodeElement(e))),t=this._renderService.createRootNode();e.forEach((e=>{t.appendChild(e)})),this._containerElement.appendChild(t),this._rootElement=t}_createNodeElement(e){return this._renderService.createNodeElement(e,this._switchExpandHandler,this._checkboxChangeHandler,(t=>{this.fire("contextmenu",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}),(t=>{this.fire("nodeTitleClicked",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}))}_expandSwitchElement(e){if(this._renderService.isExpanded(e))return;const t=this._renderService.getId(e),i=this._nodeNodes[t].children.map((e=>this._createNodeElement(e)));this._renderService.addChildren(e,i),this._renderService.expand(e,this._switchExpandHandler,this._switchCollapseHandler)}_collapseNode(e){const t=this._renderService.getSwitchElement(e);this._collapseSwitchElement(t)}_collapseSwitchElement(e){this._renderService.collapse(e,this._switchExpandHandler,this._switchCollapseHandler)}},exports.UnsignedByteType=1009,exports.UnsignedInt248Type=1020,exports.UnsignedIntType=1014,exports.UnsignedShort4444Type=1017,exports.UnsignedShort5551Type=1018,exports.UnsignedShortType=1012,exports.VBOGeometry=Ms,exports.ViewCullPlugin=class extends V{constructor(e,t={}){super("ViewCull",e),this._objectCullStates=function(e){const t=e.id;let i=fw[t];return i||(i=new pw(e),fw[t]=i,e.on("destroyed",(()=>{delete fw[t],i._destroy()}))),i}(e.scene),this._maxTreeDepth=t.maxTreeDepth||8,this._modelInfos={},this._frustum=new U,this._kdRoot=null,this._frustumDirty=!1,this._kdTreeDirty=!1,this._onViewMatrix=e.scene.camera.on("viewMatrix",(()=>{this._frustumDirty=!0})),this._onProjMatrix=e.scene.camera.on("projMatMatrix",(()=>{this._frustumDirty=!0})),this._onModelLoaded=e.scene.on("modelLoaded",(e=>{const t=this.viewer.scene.models[e];t&&this._addModel(t)})),this._onSceneTick=e.scene.on("tick",(()=>{this._doCull()}))}set enabled(e){this._enabled=e}get enabled(){return this._enabled}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._kdTreeDirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}_doCull(){const e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){const e=this._kdRoot;e&&this._visitKDNode(e)}}_buildFrustum(){const e=this.viewer.scene.camera;k(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}_buildKDTree(){const e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:U.INTERSECT};for(let e=0,t=this._objectCullStates.numObjects;e=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void c.expandAABB3(e.aabb,r);if(e.left&&c.containsAABB3(e.left.aabb,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1);if(e.right&&c.containsAABB3(e.right.aabb,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1);const o=e.aabb;gw[0]=o[3]-o[0],gw[1]=o[4]-o[1],gw[2]=o[5]-o[2];let n=0;if(gw[1]>gw[n]&&(n=1),gw[2]>gw[n]&&(n=2),!e.left){const a=o.slice();if(a[n+3]=(o[n]+o[n+3])/2,e.left={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1)}if(!e.right){const a=o.slice();if(a[n]=(o[n]+o[n+3])/2,e.right={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1)}e.objects=e.objects||[],e.objects.push(i),c.expandAABB3(e.aabb,r)}_visitKDNode(e,t=U.INTERSECT){if(t!==U.INTERSECT&&e.intersects===t)return;t===U.INTERSECT&&(t=O(this._frustum,e.aabb),e.intersects=t);const i=t===U.OUTSIDE,s=e.objects;if(s&&s.length>0)for(let e=0,t=s.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=c.mat4(),a=c.vec3();for(let t=0,i=s.size();t{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=rP[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(rP));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;e[...e])).flat();return Ts({id:e.id,points:t})},exports.buildSphereGeometry=Ji,exports.buildTorusGeometry=Ss,exports.buildVectorTextGeometry=Zi,exports.createRTCViewMat=j,exports.frustumIntersectsAABB3=O,exports.getKTX2TextureTranscoder=vA,exports.getPlaneRTCPos=W,exports.load3DSGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=Fs.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(_.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))},exports.loadOBJGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=Fs.parse.fromOBJ(e),n=Fs.edit.unwrap(o.i_verts,o.c_verts,3),a=Fs.edit.unwrap(o.i_norms,o.c_norms,3),l=Fs.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))},exports.math=c,exports.rtcToWorldPos=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i},exports.sRGBEncoding=3001,exports.setFrustum=k,exports.stats=p,exports.utils=_,exports.worldToRTCPos=G,exports.worldToRTCPositions=z; +/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(void 0,(function(e){function t(e){let t=e.length;for(;--t>=0;)e[t]=0}const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),s=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},B=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},x=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},w=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),B(i,A,e.bl_count)},E=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),w(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),F(e,e.l_desc),F(e,e.d_desc),A=(e=>{let t;for(E(e,e.dyn_ltree,e.l_desc.max_code),E(e,e.dyn_dtree,e.d_desc.max_code),F(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},R=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const L=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=L,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},O={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=R(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},xe=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},we=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=Be(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(Be(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Be(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=xe(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Fe(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Ee=[new Fe(0,0,0,0,Pe),new Fe(4,4,8,4,Ce),new Fe(4,5,16,8,Ce),new Fe(4,6,32,32,Ce),new Fe(4,4,16,16,Me),new Fe(8,16,32,32,Me),new Fe(8,16,128,128,Me),new Fe(8,32,128,256,Me),new Fe(32,128,258,1024,Me),new Fe(32,258,258,4096,Me)];function Ie(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ae,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Ee[i.level].max_lazy,i.good_match=Ee[i.level].good_length,i.nice_match=Ee[i.level].nice_length,i.max_chain_length=Ee[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Re=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(we(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(we(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Ee[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=R(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,we(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,we(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Le(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,x,w,P;const C=e.state;i=e.next_in,w=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=w[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(B=0,x=c,0===h){if(B+=l-v,v2;)P[r++]=x[B++],P[r++]=x[B++],P[r++]=x[B++],b-=3;b&&(P[r++]=x[B++],b>1&&(P[r++]=x[B++]))}else{B=r-y;do{P[r++]=P[B++],P[r++]=P[B++],P[r++]=P[B++],b-=3}while(b>2);b&&(P[r++]=P[B++],b>1&&(P[r++]=P[B++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,B=0,x=0,w=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let F,E,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&x>592)return 1;for(;;){F=f-y,n[g]+1=p?(E=D[n[g]-p],I=P[n[g]-p]):(E=96,I=0),A=1<>y)+h]=F<<24|E<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(w&=A-1,w+=A):w=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(w&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,B=1<852||2===e&&x>592)return 1;c=w&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==w&&(r[d+w]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:Bt,Z_MEM_ERROR:xt,Z_BUF_ERROR:wt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Ft=16191,Et=16192,It=16194,Dt=16199,St=16200,Tt=16206,Rt=16209,Lt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,x,w=0;const P=new Uint8Array(4);let C,M;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Ft&&(i.mode=Et),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,x=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Et;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Rt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Rt;break}if(A>>>=4,h-=4,B=8+(15&A),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=Rt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),B)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{B=s[o+d++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Ft;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Rt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Rt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Ft;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Rt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},x=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,x){e.msg="invalid code lengths set",i.mode=Rt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Rt;break}B=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,B=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,B=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Rt;break}for(;d--;)i.lens[i.have++]=B}}if(i.mode===Rt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Rt;break}if(i.lenbits=9,C={bits:i.lenbits},x=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,x){e.msg="invalid literal/lengths set",i.mode=Rt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},x=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,x){e.msg="invalid distances set",i.mode=Rt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Ft&&(i.back=-1);break}for(i.back=0;w=i.lencode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Ft;break}if(64&m){e.msg="invalid literal/length code",i.mode=Rt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;w=i.distcode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Rt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Rt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Rt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=R(r,t,i,0),r!==s.check)?Bt:(o=Wt(e,t,i,i),o?(s.mode=16210,xt):(s.havedict=1,_t)))},$t=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,Bi=pi,xi=fi,wi=gi,Pi=mi,Ci=_i,Mi=vi,Fi=O,Ei={Deflate:bi,deflate:yi,deflateRaw:Bi,gzip:xi,Inflate:wi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Fi};e.Deflate=bi,e.Inflate=wi,e.constants=Fi,e.default=Ei,e.deflate=yi,e.deflateRaw=Bi,e.gzip=xi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var _w=Object.freeze({__proto__:null});let vw=window.pako||_w;vw.inflate||(vw=vw.default);const bw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const yw={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(vw.inflate(e.positions).buffer),normals:new Int8Array(vw.inflate(e.normals).buffer),indices:new Uint32Array(vw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(vw.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(vw.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(vw.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(vw.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(vw.inflate(e.meshColors).buffer),entityIDs:vw.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(vw.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(vw.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(vw.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,u=i.meshIndices,d=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,v=h.length,b=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(F[i]=e)}}for(let e=0;e1,o=Ew(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,v=a.subarray(d[t],i?a.length:d[t+1]),y=l.subarray(d[t],i?l.length:d[t+1]),B=A.subarray(p[t],i?A.length:p[t+1]),w=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:B,edgeIndices:w,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;b[F[t]];const i={};s.createMesh(_.apply(i,{id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:B,edgeIndices:w,positionsDecodeMatrix:M,color:o,opacity:u}))}}let E=0;for(let e=0;e1){const t={},r=`${n}-instance.${E++}`,o=`${n}-geometry.${i}`,a=16*B[e],A=u.subarray(a,a+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let Dw=window.pako||_w;Dw.inflate||(Dw=Dw.default);const Sw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Tw={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(Dw.inflate(e.positions).buffer),normals:new Int8Array(Dw.inflate(e.normals).buffer),indices:new Uint32Array(Dw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Dw.inflate(e.edgeIndices).buffer),matrices:new Float32Array(Dw.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(Dw.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(Dw.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(Dw.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(Dw.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(Dw.inflate(e.primitiveInstances).buffer),eachEntityId:Dw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(Dw.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(Dw.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),v=i.eachEntityPrimitiveInstancesPortion,b=i.eachEntityMatricesPortion,y=u.length,B=g.length,x=new Uint8Array(y),w=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=Sw(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),v=A.subarray(d[e],t?A.length:d[e+1]),b=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b})}else{const t=e;m[P[e]];const i={};s.createMesh(_.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*b[e],l=c.subarray(n,n+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let Rw=window.pako||_w;Rw.inflate||(Rw=Rw.default);const Lw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Uw={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Rw.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:Rw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,u=i.matrices,d=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,v=i.primitiveInstances,b=JSON.parse(i.eachEntityId),y=i.eachEntityPrimitiveInstancesPortion,B=i.eachEntityMatricesPortion,x=i.eachTileAABB,w=i.eachTileEntitiesPortion,P=p.length,C=v.length,M=b.length,F=w.length,E=new Uint32Array(P);for(let e=0;e1,c=t===P-1,u=a.subarray(p[t],c?a.length:p[t+1]),b=l.subarray(p[t],c?l.length:p[t+1]),y=A.subarray(f[t],c?A.length:f[t+1]),B=h.subarray(g[t],c?h.length:g[t+1]),x=Lw(m.subarray(4*t,4*t+3)),w=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:u,indices:y,edgeIndices:B,positionsDecodeMatrix:d}),U[e]=!0),s.createMesh(_.apply(N,{id:C,geometryId:e,origin:I,matrix:F,color:x,opacity:w})),R.push(C)}else s.createMesh(_.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:u,normalsCompressed:b,indices:y,edgeIndices:B,positionsDecodeMatrix:L,color:x,opacity:w})),R.push(C)}R.length>0&&s.createEntity(_.apply(O,{id:w,isObject:!0,meshIds:R}))}}}(e,t,a,s,0,o)}};let kw=window.pako||_w;kw.inflate||(kw=kw.default);const Ow=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function Nw(e){const t=[];for(let i=0,s=e.length;i1,c=t===E-1,P=Ow(w.subarray(6*e,6*e+3)),C=w[6*e+3]/255,M=w[6*e+4]/255,F=w[6*e+5]/255,I=o.getNextId();if(r){const r=x[e],o=d.slice(r,r+16),B=`${n}-geometry.${i}.${t}`;if(!Q[B]){let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Nw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createGeometry({id:B,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:p}),Q[B]=!0}s.createMesh(_.apply(V,{id:I,geometryId:B,origin:R,matrix:o,color:P,metallic:M,roughness:F,opacity:C})),U.push(I)}else{let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Nw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createMesh(_.apply(V,{id:I,origin:R,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:N,color:P,metallic:M,roughness:F,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(_.apply(O,{id:F,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let Vw=window.pako||_w;Vw.inflate||(Vw=Vw.default);const Hw=c.vec4(),jw=c.vec4();const Gw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function zw(e){const t=[];for(let i=0,s=e.length;i1,l=r===L-1,A=Gw(E.subarray(6*e,6*e+3)),h=E[6*e+3]/255,u=E[6*e+4]/255,I=E[6*e+5]/255,D=o.getNextId();if(a){const o=F[e],a=v.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let E=H[M];if(!E){E={batchThisMesh:!t.reuseGeometries};let e=!1;switch(y[r]){case 0:E.primitiveName="solid",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryNormals=p.subarray(x[r],l?p.length:x[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),E.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 1:E.primitiveName="surface",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryNormals=p.subarray(x[r],l?p.length:x[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),E.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 2:E.primitiveName="points",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryColors=zw(f.subarray(w[r],l?f.length:w[r+1])),e=E.geometryPositions.length>0;break;case 3:E.primitiveName="lines",E.geometryPositions=d.subarray(B[r],l?d.length:B[r+1]),E.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;default:continue}if(e||(E=null),E&&(E.geometryPositions.length,E.batchThisMesh)){E.decompressedPositions=new Float32Array(E.geometryPositions.length);const e=E.geometryPositions,t=E.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=d.subarray(B[r],l?d.length:B[r+1]),i=p.subarray(x[r],l?p.length:x[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=d.subarray(B[r],l?d.length:B[r+1]),o=zw(f.subarray(w[r],l?f.length:w[r+1])),c=t.length>0;break;case 3:e="lines",t=d.subarray(B[r],l?d.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:R,color:A,metallic:u,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(_.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let Kw=window.pako||_w;Kw.inflate||(Kw=Kw.default);const Xw=c.vec4(),Jw=c.vec4();const Yw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Zw={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Kw.inflate(e,t).buffer}return{metadata:JSON.parse(Kw.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(Kw.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,u=i.indices,d=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,v=i.eachGeometryNormalsPortion,b=i.eachGeometryColorsPortion,y=i.eachGeometryIndicesPortion,B=i.eachGeometryEdgeIndicesPortion,x=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,F=i.eachTileAABB,E=i.eachTileEntitiesPortion,I=m.length,D=x.length,S=M.length,T=E.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const R=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=Yw(P.subarray(6*e,6*e+3)),F=P[6*e+3]/255,E=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=w[e],a=p.slice(o,o+16),x=`${n}-geometry.${i}.${r}`;let P=k[x];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(B[r],C?d.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(B[r],C?d.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(b[r],C?h.length:b[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(v[r],C?A.length:v[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),a=d.subarray(B[r],C?d.length:B[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(b[r],C?h.length:b[r+1]),c=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(j,{id:S,origin:L,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:E,roughness:D,opacity:F})),O.push(S))}}O.length>0&&s.createEntity(_.apply(H,{id:F,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let qw=window.pako||_w;qw.inflate||(qw=qw.default);const $w=c.vec4(),eP=c.vec4();const tP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function iP(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=tP(S.subarray(6*e,6*e+3)),R=S[6*e+3]/255,L=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=b.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let E=W[A];if(!E){E={batchThisMesh:!t.reuseGeometries};let e=!1;switch(B[r]){case 0:E.primitiveName="solid",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),E.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),E.geometryEdgeIndices=m.subarray(F[r],l?m.length:F[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 1:E.primitiveName="surface",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),E.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),E.geometryEdgeIndices=m.subarray(F[r],l?m.length:F[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 2:E.primitiveName="points",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=E.geometryPositions.length>0;break;case 3:E.primitiveName="lines",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;case 4:E.primitiveName="lines",E.geometryPositions=u.subarray(x[r],l?u.length:x[r+1]),E.geometryIndices=iP(E.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=E.geometryPositions.length>0&&E.geometryIndices.length>0;break;default:continue}if(e||(E=null),E&&(E.geometryPositions.length,E.batchThisMesh)){E.decompressedPositions=new Float32Array(E.geometryPositions.length),E.transformedAndRecompressedPositions=new Uint16Array(E.geometryPositions.length);const e=E.geometryPositions,t=E.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=u.subarray(x[r],l?u.length:x[r+1]),i=d.subarray(w[r],l?d.length:w[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(F[r],l?m.length:F[r+1]),c=t.length>0&&a.length>0;break;case 2:e="points",t=u.subarray(x[r],l?u.length:x[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),c=t.length>0;break;case 3:e="lines",t=u.subarray(x[r],l?u.length:x[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),c=t.length>0&&a.length>0;break;case 4:e="lines",t=u.subarray(x[r],l?u.length:x[r+1]),a=iP(t,g.subarray(M[r],l?g.length:M[r+1])),c=t.length>0&&a.length>0;break;default:continue}c&&(s.createMesh(_.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:v,color:T,metallic:L,roughness:O,opacity:R})),U.push(Q))}}U.length>0&&s.createEntity(_.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},rP={};rP[yw.version]=yw,rP[ww.version]=ww,rP[Mw.version]=Mw,rP[Iw.version]=Iw,rP[Tw.version]=Tw,rP[Uw.version]=Uw,rP[Qw.version]=Qw,rP[Ww.version]=Ww,rP[Zw.version]=Zw,rP[sP.version]=sP;var oP={};!function(e){var t,i="File format is not recognized.",s="Error while reading zip file.",r="Error while reading file data.",o=524288,n="text/plain";try{t=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function a(){this.crc=-1}function l(){}function A(e,t){var i,s;return i=new ArrayBuffer(e),s=new Uint8Array(i),t&&s.set(t,0),{buffer:i,array:s,view:new DataView(i)}}function h(){}function c(e){var t,i=this;i.size=0,i.init=function(s,r){var o=new Blob([e],{type:n});(t=new d(o)).init((function(){i.size=t.size,s()}),r)},i.readUint8Array=function(e,i,s,r){t.readUint8Array(e,i,s,r)}}function u(t){var i,s=this;s.size=0,s.init=function(e){for(var r=t.length;"="==t.charAt(r-1);)r--;i=t.indexOf(",")+1,s.size=Math.floor(.75*(r-i)),e()},s.readUint8Array=function(s,r,o){var n,a=A(r),l=4*Math.floor(s/3),h=4*Math.ceil((s+r)/3),c=e.atob(t.substring(l+i,h+i)),u=s-3*Math.floor(l/4);for(n=u;ne.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function B(e){return decodeURIComponent(escape(e))}function x(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(w(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var E={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=E[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){F(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(oP);const nP=oP.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(nP);const aP=["4.2"];class lP{constructor(e,t={}){this.supportedSchemas=aP,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(nP.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new us(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new fs(t,{diffuse:[1,1,1],specular:c.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Vt(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new As(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,AP(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var AP=function(e,t,i,s,r,o){!function(e,t,i){var s=new mP;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){hP(e,i,s,t,r,o)}),o)},hP=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=CP(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};BP.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};xP.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=PP(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},PP=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};function MP(e,t){if(t>=e.length)return e;let i=[];for(let s=0;s{t(e)}),(function(e){i(e)}))}}function EP(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=IP(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return SP(u,d,i,s,r,A),d}function IP(e,t,i,s,r){var o,n;if(r===eC(e,t,i,s)>0)for(o=t;o=t;o-=s)n=ZP(o,e[o],e[o+1],n);return n&&zP(n,n.next)&&(qP(n),n=n.next),n}function DP(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!zP(s,s.next)&&0!==GP(s.prev,s,s.next))s=s.next;else{if(qP(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function SP(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=QP(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?RP(e,s,r,o):TP(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),qP(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?SP(e=LP(DP(e),t,i),t,i,s,r,o,2):2===n&&UP(e,t,i,s,r,o):SP(DP(e),t,i,s,r,o,1);break}}}function TP(e){var t=e.prev,i=e,s=e.next;if(GP(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(HP(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&GP(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function RP(e,t,i,s){var r=e.prev,o=e,n=e.next;if(GP(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=QP(a,l,t,i,s),u=QP(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&GP(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&GP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&GP(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&HP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&GP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function LP(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!zP(r,o)&&WP(r,s,s.next,o)&&JP(r,o)&&JP(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),qP(s),qP(s.next),s=e=o),s=s.next}while(s!==e);return DP(s)}function UP(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&jP(n,a)){var l=YP(n,a);return n=DP(n,n.next),l=DP(l,l.next),SP(n,t,i,s,r,o),void SP(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function kP(e,t){return e.x-t.x}function OP(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&HP(oi.x||s.x===i.x&&NP(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=YP(t,e);DP(t,t.next),DP(i,i.next)}}function NP(e,t){return GP(e.prev,e,t.prev)<0&&GP(t.next,e,e.next)<0}function QP(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function VP(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function jP(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&WP(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(JP(e,t)&&JP(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(GP(e.prev,e,t.prev)||GP(e,t.prev,t))||zP(e,t)&&GP(e.prev,e,e.next)>0&&GP(t.prev,t,t.next)>0)}function GP(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function zP(e,t){return e.x===t.x&&e.y===t.y}function WP(e,t,i,s){var r=XP(GP(e,t,i)),o=XP(GP(e,t,s)),n=XP(GP(i,s,e)),a=XP(GP(i,s,t));return r!==o&&n!==a||(!(0!==r||!KP(e,i,t))||(!(0!==o||!KP(e,s,t))||(!(0!==n||!KP(i,e,s))||!(0!==a||!KP(i,t,s)))))}function KP(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function XP(e){return e>0?1:e<0?-1:0}function JP(e,t){return GP(e.prev,e,e.next)<0?GP(e,t,e.next)>=0&&GP(e,e.prev,t)>=0:GP(e,t,e.prev)<0||GP(e,e.next,t)<0}function YP(e,t){var i=new $P(e.i,e.x,e.y),s=new $P(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function ZP(e,t,i,s){var r=new $P(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function qP(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function $P(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function eC(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const tC=c.vec2(),iC=c.vec3(),sC=c.vec3(),rC=c.vec3();exports.AlphaFormat=1021,exports.AmbientLight=wt,exports.AngleMeasurementsControl=pe,exports.AngleMeasurementsMouseControl=fe,exports.AngleMeasurementsPlugin=class extends V{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new fe(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new de(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){var t,i;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){const s=e.pickResult;if(s.worldPos&&s.worldNormal){const e=c.normalizeVec3(s.worldNormal,me),r=c.mulVec3Scalar(e,this._surfaceOffset,_e);t=c.addVec3(s.worldPos,r,ve),i=s.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var s=null;e.markerElementId&&((s=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var r=null;e.labelElementId&&((r=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const o=new ge(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:s,labelElement:r,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:_.apply(e.values,_.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[o.id]=o,o.on("destroyed",(()=>{delete this.annotations[o.id],this.fire("annotationDestroyed",o.id)})),this.fire("annotationCreated",o.id),o}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;tp.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,B=v.filter((e=>!b[e])),x=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=$A(e.location,XA),i=$A(e.direction,XA);A&&c.negateVec3(i),c.subVec3(t,l),r.yUp&&(t=th(t),i=th(i)),new qi(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new KA(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=$A(e.location,JA),n=$A(e.normal,YA),a=$A(e.up,ZA),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=th(o),n=th(n),a=th(a)),new Rs(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,u;if(e.perspective_camera?(a=$A(e.perspective_camera.camera_view_point,XA),A=$A(e.perspective_camera.camera_direction,XA),h=$A(e.perspective_camera.camera_up_vector,XA),r.perspective.fov=e.perspective_camera.field_of_view,u="perspective"):(a=$A(e.orthogonal_camera.camera_view_point,XA),A=$A(e.orthogonal_camera.camera_direction,XA),h=$A(e.orthogonal_camera.camera_up_vector,XA),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,u="ortho"),c.subVec3(a,l),r.yUp&&(a=th(a),A=th(A),h=th(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:c.addVec3(a,A,XA)}else A=c.addVec3(a,A,XA);n?(r.eye=a,r.look=A,r.up=h,r.projection=u):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:u})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=c.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}},exports.Bitmap=Rs,exports.ByteType=1010,exports.CameraMemento=Eh,exports.CameraPath=class extends D{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new uh(this),this._lookCurve=new uh(this),this._upCurve=new uh(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,dh),t.look=this._lookCurve.getPoint(e,dh),t.up=this._upCurve.getPoint(e,dh)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=c.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:c.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||c.vec3([1,1,1]),o=t.translate||c.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],u,d);A.push(...i)}if(3===A.length)d.indices.push(A[0]),d.indices.push(A[1]),d.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}},exports.CubicBezierCurve=class extends ch{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.v3=t.v3,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set v3(e){this.fire("v3",this._v3=e||c.vec3([0,0,0]))}get v3(){return this._v3}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=c.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=c.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}},exports.Curve=ch,exports.DefaultLoadingManager=cA,exports.DepthFormat=1026,exports.DepthStencilFormat=1027,exports.DirLight=xt,exports.DistanceMeasurementsControl=oh,exports.DistanceMeasurementsMouseControl=nh,exports.DistanceMeasurementsPlugin=class extends V{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new nh(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new rh(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let u,d;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),s.set(d.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=d.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:d.worldPos,entity:d.entity},target:{worldPos:d.worldPos,entity:d.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=d.worldPos,this._currentDistanceMeasurement.target.entity=d.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;tw.set(this.viewer.scene.aabb),c.getAABB3Center(tw,iw),tw[0]+=t[0]-iw[0],tw[1]+=t[1]-iw[1],tw[2]+=t[2]-iw[2],tw[3]+=t[0]-iw[0],tw[4]+=t[1]-iw[1],tw[5]+=t[2]-iw[2],this.viewer.cameraFlight.flyTo({aabb:tw,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}null===t.controlElementId||void 0===t.controlElementId?this.error("Parameter expected: controlElementId"):(this._controlElement=document.getElementById(t.controlElementId),this._controlElement||this.warn("Can't find control element: '"+t.controlElementId+"' - will create plugin without control element")),this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setDragSensitivity(e){this._dragSensitivity=e||1}getDragSensitivity(){return this._dragSensitivity}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new qi(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new qx(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(let e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){let t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(let t=0,i=e.length;t{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}},exports.FloatType=1015,exports.Fresnel=class extends D{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new et({edgeColor:c.vec3([0,0,0]),centerColor:c.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}},exports.Frustum=U,exports.FrustumPlane=L,exports.GIFMediaType=1e4,exports.GLTFDefaultDataSource=ah,exports.GLTFLoaderPlugin=class extends V{constructor(e,t={}){super("GLTFLoader",e,t),this._sceneModelLoader=new gx(this,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new ah}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||Mx}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new zA(this.viewer.scene,_.apply(e,{isModel:!0,dtxEnabled:e.dtxEnabled})),i=t.id;if(!e.src&&!e.gltf)return this.error("load() param expected: src or gltf"),t;if(e.metaModelSrc||e.metaModelJSON){const s=e.objectDefaults||this._objectDefaults||Mx,r=r=>{let o;if(this.viewer.metaScene.createMetaModel(i,r,{includeTypes:e.includeTypes,excludeTypes:e.excludeTypes}),this.viewer.scene.canvas.spinner.processes--,e.includeTypes){o={};for(let t=0,i=e.includeTypes.length;t{const r=t.name;if(!r)return!0;const o=r,n=this.viewer.metaScene.metaObjects[o],a=(n?n.type:"DEFAULT")||"DEFAULT";i.createEntity={id:o,isObject:!0};const l=s[a];return l&&(!1===l.visible&&(i.createEntity.visible=!1),l.colorize&&(i.createEntity.colorize=l.colorize),!1===l.pickable&&(i.createEntity.pickable=!1),void 0!==l.opacity&&null!==l.opacity&&(i.createEntity.opacity=l.opacity)),!0},e.src?this._sceneModelLoader.load(this,e.src,r,e,t):this._sceneModelLoader.parse(this,e.gltf,r,e,t)};if(e.metaModelSrc){const t=e.metaModelSrc;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getMetaModel(t,(e=>{this.viewer.scene.canvas.spinner.processes--,r(e)}),(e=>{this.error(`load(): Failed to load model metadata for model '${i} from '${t}' - ${e}`),this.viewer.scene.canvas.spinner.processes--}))}else e.metaModelJSON&&r(e.metaModelJSON)}else e.handleGLTFNode=(e,t,i)=>{const s=t.name;if(!s)return!0;const r=s;return i.createEntity={id:r,isObject:!0},!0},e.src?this._sceneModelLoader.load(this,e.src,null,e,t):this._sceneModelLoader.parse(this,e.gltf,null,e,t);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.HalfFloatType=1016,exports.ImagePlane=class extends D{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._dir=c.vec3(),this._size=1,this._imageSize=c.vec2(),this._texture=new ws(this),this._plane=new Wi(this,{geometry:new Ut(this,Ds({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new Wi(this,{geometry:new Ut(this,Is({size:1,divisions:10})),material:new Vt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new ls(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),G(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];c.subVec3(t,this.position,yh);const s=-c.dotVec3(i,yh);c.normalizeVec3(i),c.mulVec3Scalar(i,s,Bh),c.vec3PairToQuaternion(xh,e,wh),this._node.quaternion=wh}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}},exports.IntType=1013,exports.JPEGMediaType=10001,exports.KTX2TextureTranscoder=mA,exports.LASLoaderPlugin=class extends V{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new bP}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new zA(this.viewer.scene,_.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=wP(e);Rb(e,yP,i).then((e=>{const h=e.attributes,u=e.loaderData,d=void 0!==u.pointsFormatId?u.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(d){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=MP(p,15e5),m=MP(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}},exports.LambertMaterial=As,exports.LightMap=class extends Fh{get type(){return"LightMap"}constructor(e,t={}){super(e,t),this.scene._lightMapCreated(this)}destroy(){super.destroy(),this.scene._lightMapDestroyed(this)}},exports.LineSet=KA,exports.LinearEncoding=3e3,exports.LinearFilter=1006,exports.LinearMipMapLinearFilter=1008,exports.LinearMipMapNearestFilter=1007,exports.LinearMipmapLinearFilter=1008,exports.LinearMipmapNearestFilter=1007,exports.Loader=uA,exports.LoadingManager=hA,exports.LocaleService=lh,exports.LuminanceAlphaFormat=1025,exports.LuminanceFormat=1024,exports.Map=e,exports.Marker=ae,exports.MarqueePicker=N,exports.MarqueePickerMouseControl=class extends D{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{e.camera.zUp?(this._zUp=!0,this._cubeTextureCanvas.setZUp(),this._repaint(),this._synchCamera()):e.camera.yUp&&(this._zUp=!1,this._cubeTextureCanvas.setYUp(),this._repaint(),this._synchCamera())})),this._onCameraFOV=e.camera.perspective.on("fov",(e=>{this._synchProjection&&(this._navCubeCamera.perspective.fov=e)})),this._onCameraProjection=e.camera.on("projection",(e=>{this._synchProjection&&(this._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var o=-1;function n(e){var t=[0,0];if(e){for(var i=e.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var a,l,A=null,h=null,u=!1,d=!1,p=.5;s._navCubeCanvas.addEventListener("mouseenter",s._onMouseEnter=function(e){d=!0}),s._navCubeCanvas.addEventListener("mouseleave",s._onMouseLeave=function(e){d=!1}),s._navCubeCanvas.addEventListener("mousedown",s._onMouseDown=function(e){if(1===e.which){A=e.x,h=e.y,a=e.clientX,l=e.clientY;var t=n(e),s=i.pick({canvasPos:t});u=!!s}}),document.addEventListener("mouseup",s._onMouseUp=function(e){if(1===e.which&&(u=!1,null!==A)){var t=n(e),a=i.pick({canvasPos:t,pickSurface:!0});if(a&&a.uv){var l=s._cubeTextureCanvas.getArea(a.uv);if(l>=0&&(document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0)){if(s._cubeTextureCanvas.setAreaHighlighted(l,!0),o=l,s._repaint(),e.xA+3||e.yh+3)return;var c=s._cubeTextureCanvas.getAreaDir(l);if(c){var d=s._cubeTextureCanvas.getAreaUp(l);s._isProjectNorth&&s._projectNorthOffsetAngle&&(c=r(1,c,Ex),d=r(1,d,Ix)),f(c,d,(function(){o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0&&(s._cubeTextureCanvas.setAreaHighlighted(l,!1),o=-1,s._repaint())}))}}}}}),document.addEventListener("mousemove",s._onMouseMove=function(t){if(o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),1!==t.buttons||u){if(u){var r=t.clientX,A=t.clientY;return document.body.style.cursor="move",void function(t,i){var s=(t-a)*-p,r=(i-l)*-p;e.camera.orbitYaw(s),e.camera.orbitPitch(-r),a=t,l=i}(r,A)}if(d){var h=n(t),c=i.pick({canvasPos:h,pickSurface:!0});if(c){if(c.uv){document.body.style.cursor="pointer";var f=s._cubeTextureCanvas.getArea(c.uv);if(f===o)return;o>=0&&s._cubeTextureCanvas.setAreaHighlighted(o,!1),f>=0&&(s._cubeTextureCanvas.setAreaHighlighted(f,!0),s._repaint(),o=f)}}else document.body.style.cursor="default",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1)}}});var f=function(){var t=c.vec3();return function(i,r,o){var n=s._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,a=c.getAABB3Diag(n);c.getAABB3Center(n,t);var l=Math.abs(a/Math.tan(s._cameraFitFOV*c.DEGTORAD));e.cameraControl.pivotPos=t,s._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV,duration:s._cameraFlyDuration},o):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV},o)}}();this._onUpdated=e.localeService.on("updated",(()=>{this._cubeTextureCanvas.clear(),this._repaint()})),this.setVisible(t.visible),this.setCameraFitFOV(t.cameraFitFOV),this.setCameraFly(t.cameraFly),this.setCameraFlyDuration(t.cameraFlyDuration),this.setFitVisible(t.fitVisible),this.setSynchProjection(t.synchProjection)}send(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}_repaint(){const e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}setVisible(e=!0){this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}getVisible(){return!!this._navCubeCanvas&&this._cubeMesh.visible}setFitVisible(e=!1){this._fitVisible=e}getFitVisible(){return this._fitVisible}setCameraFly(e=!0){this._cameraFly=e}getCameraFly(){return this._cameraFly}setCameraFitFOV(e=45){this._cameraFitFOV=e}getCameraFitFOV(){return this._cameraFitFOV}setCameraFlyDuration(e=.5){this._cameraFlyDuration=e}getCameraFlyDuration(){return this._cameraFlyDuration}setSynchProjection(e=!1){this._synchProjection=e}getSynchProjection(){return this._synchProjection}setIsProjectNorth(e=!1){this._isProjectNorth=e}getIsProjectNorth(){return this._isProjectNorth}setProjectNorthOffsetAngle(e){this._projectNorthOffsetAngle=e}getProjectNorthOffsetAngle(){return this._projectNorthOffsetAngle}destroy(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,super.destroy()}},exports.NearestFilter=1003,exports.NearestMipMapLinearFilter=1005,exports.NearestMipMapNearestFilter=1004,exports.NearestMipmapLinearFilter=1005,exports.NearestMipmapNearestFilter=1004,exports.Node=ls,exports.OBJLoaderPlugin=class extends V{constructor(e,t){super("OBJLoader",e,t),this._sceneGraphLoader=new Sx}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new ls(this.viewer.scene,_.apply(e,{isModel:!0}));const i=t.id,s=e.src;if(!s)return this.error("load() param expected: src"),t;if(e.metaModelSrc){const r=e.metaModelSrc;_.loadJSON(r,(r=>{this.viewer.metaScene.createMetaModel(i,r),this._sceneGraphLoader.load(t,s,e)}),(e=>{this.error(`load(): Failed to load model modelMetadata for model '${i} from '${r}' - ${e}`)}))}else this._sceneGraphLoader.load(t,s,e);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.ObjectsKdTree3=class{constructor(e){if(!e)throw"Parameter expected: cfg";if(!e.viewer)throw"Parameter expected: cfg.viewer";this.viewer=e.viewer,this._maxTreeDepth=e.maxTreeDepth||15,this._root=null,this._needsRebuild=!0,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&c.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&c.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;u[0]=r[3]-r[0],u[1]=r[4]-r[1],u[2]=r[5]-r[2];let o=0;if(u[1]>u[o]&&(o=1),u[2]>u[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}},exports.ObjectsMemento=Sh,exports.PNGMediaType=10002,exports.Path=class extends ch{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new et({type:"point",pos:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=c.identityMat4());const e=i._state.pos,t=s.look,r=s.up;c.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=c.identityMat4());const e=i.scene.canvas.canvas;c.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new Xe(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}},exports.PointerCircle=Q,exports.PointerLens=class{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}},exports.QuadraticBezierCurve=class extends ch{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=c.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=c.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}},exports.Queue=d,exports.RGBAFormat=1023,exports.RGBAIntegerFormat=1033,exports.RGBA_ASTC_10x10_Format=37819,exports.RGBA_ASTC_10x5_Format=37816,exports.RGBA_ASTC_10x6_Format=37817,exports.RGBA_ASTC_10x8_Format=37818,exports.RGBA_ASTC_12x10_Format=37820,exports.RGBA_ASTC_12x12_Format=37821,exports.RGBA_ASTC_4x4_Format=37808,exports.RGBA_ASTC_5x4_Format=37809,exports.RGBA_ASTC_5x5_Format=37810,exports.RGBA_ASTC_6x5_Format=37811,exports.RGBA_ASTC_6x6_Format=37812,exports.RGBA_ASTC_8x5_Format=37813,exports.RGBA_ASTC_8x6_Format=37814,exports.RGBA_ASTC_8x8_Format=37815,exports.RGBA_BPTC_Format=36492,exports.RGBA_ETC2_EAC_Format=37496,exports.RGBA_PVRTC_2BPPV1_Format=35843,exports.RGBA_PVRTC_4BPPV1_Format=35842,exports.RGBA_S3TC_DXT1_Format=33777,exports.RGBA_S3TC_DXT3_Format=33778,exports.RGBA_S3TC_DXT5_Format=33779,exports.RGBFormat=1022,exports.RGB_ETC1_Format=36196,exports.RGB_ETC2_Format=37492,exports.RGB_PVRTC_2BPPV1_Format=35841,exports.RGB_PVRTC_4BPPV1_Format=35840,exports.RGB_S3TC_DXT1_Format=33776,exports.RGFormat=1030,exports.RGIntegerFormat=1031,exports.ReadableGeometry=Ut,exports.RedFormat=1028,exports.RedIntegerFormat=1029,exports.ReflectionMap=class extends Fh{get type(){return"ReflectionMap"}constructor(e,t={}){super(e,t),this.scene._lightsState.addReflectionMap(this._state),this.scene._reflectionMapCreated(this)}destroy(){super.destroy(),this.scene._reflectionMapDestroyed(this)}},exports.RepeatWrapping=1e3,exports.STLDefaultDataSource=sw,exports.STLLoaderPlugin=class extends V{constructor(e,t={}){super("STLLoader",e,t),this._sceneGraphLoader=new ow,this.dataSource=t.dataSource}set dataSource(e){this._dataSource=e||new sw}get dataSource(){return this._dataSource}load(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new ls(this.viewer.scene,_.apply(e,{isModel:!0})),i=e.src,s=e.stl;return i||s?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,s,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}},exports.SceneModel=zA,exports.SceneModelMesh=Os,exports.SceneModelTransform=UA,exports.SectionPlane=qi,exports.SectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("SectionPlanes",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new jx(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;Gx.set(this.viewer.scene.aabb),c.getAABB3Center(Gx,zx),Gx[0]+=t[0]-zx[0],Gx[1]+=t[1]-zx[1],Gx[2]+=t[2]-zx[2],Gx[3]+=t[0]-zx[0],Gx[4]+=t[1]-zx[1],Gx[5]+=t[2]-zx[2],this.viewer.cameraFlight.flyTo({aabb:Gx,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new qi(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new Vx(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(var t=0,i=e.length;t{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}},exports.StoreyViewsPlugin=class extends V{constructor(e,t={}){super("StoreyViews",e),this._objectsMemento=new Sh,this._cameraMemento=new Eh,this.storeys={},this.modelStoreys={},this._fitStoreyMaps=!!t.fitStoreyMaps,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._registerModelStoreys(e),this.fire("storeys",this.storeys)}))}_registerModelStoreys(e){const t=this.viewer,i=t.scene,s=t.metaScene,r=s.metaModels[e],o=i.models[e];if(!r||!r.rootMetaObjects)return;const n=r.rootMetaObjects;for(let t=0,r=n.length;t.5?a.length:0,h=new Wx(this,o.aabb,l,e,n,A);h._onModelDestroyed=o.once("destroyed",(()=>{this._deregisterModelStoreys(e),this.fire("storeys",this.storeys)})),this.storeys[n]=h,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][n]=h}}}_deregisterModelStoreys(e){const t=this.modelStoreys[e];if(t){const i=this.viewer.scene;for(let e in t)if(t.hasOwnProperty(e)){const s=t[e],r=i.models[s.modelId];r&&r.off(s._onModelDestroyed),delete this.storeys[e]}delete this.modelStoreys[e]}}get fitStoreyMaps(){return this._fitStoreyMaps}gotoStoreyCamera(e,t={}){const i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());const s=this.viewer,r=s.scene.camera,o=i.storeyAABB;if(o[3]{t.done()})):(s.cameraFlight.jumpTo(_.apply(t,{eye:h,look:n,up:u,orthoScale:A})),s.camera.ortho.scale=A)}showStoreyObjects(e,t={}){if(!this.storeys[e])return void this.error("IfcBuildingStorey not found with this ID: "+e);const i=this.viewer,s=i.scene;i.metaScene.metaObjects[e]&&(t.hideOthers&&s.setObjectsVisible(i.scene.visibleObjectIds,!1),this.withStoreyObjects(e,((e,t)=>{e&&(e.visible=!0)})))}withStoreyObjects(e,t){const i=this.viewer,s=i.scene,r=i.metaScene,o=r.metaObjects[e];if(!o)return;const n=o.getObjectIDsInSubtree();for(var a=0,l=n.length;au[1]&&u[0]>u[2],p=!d&&u[1]>u[0]&&u[1]>u[2];!d&&!p&&u[2]>u[0]&&(u[2],u[1]);const f=e.width/A,g=p?e.height/c:e.height/h;return i[0]=Math.floor(e.width-(t[0]-n)*f),i[1]=Math.floor(e.height-(t[2]-l)*g),i[0]>=0&&i[0]=0&&i[1]<=e.height}worldDirToStoreyMap(e,t,i){const s=this.viewer.camera,r=s.eye,o=s.look,n=c.subVec3(o,r,Xx),a=s.worldUp,l=a[0]>a[1]&&a[0]>a[2],A=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!A&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=n[1],i[1]=n[2]):A?(i[0]=n[0],i[1]=n[2]):(i[0]=n[0],i[1]=n[1]),c.normalizeVec2(i)}destroy(){this.viewer.scene.off(this._onModelLoaded),super.destroy()}},exports.Texture=ws,exports.TextureTranscoder=class{transcode(e,t,i={}){}destroy(){}},exports.TreeViewPlugin=class extends V{constructor(e,t={}){super("TreeViewPlugin",e),this.errors=[],this.valid=!0;const i=t.containerElement||document.getElementById(t.containerElementId);if(i instanceof HTMLElement){for(let e=0;;e++)if(!dw[e]){dw[e]=this,this._index=e,this._id=`tree-${e}`;break}if(this._containerElement=i,this._metaModels={},this._autoAddModels=!1!==t.autoAddModels,this._autoExpandDepth=t.autoExpandDepth||0,this._sortNodes=!1!==t.sortNodes,this._viewer=e,this._rootElement=null,this._muteSceneEvents=!1,this._muteTreeEvents=!1,this._rootNodes=[],this._objectNodes={},this._nodeNodes={},this._rootNames={},this._sortNodes=t.sortNodes,this._pruneEmptyNodes=t.pruneEmptyNodes,this._showListItemElementId=null,this._renderService=t.renderService||new uw,!this._renderService)throw new Error("TreeViewPlugin: no render service set");if(this._containerElement.oncontextmenu=e=>{e.preventDefault()},this._onObjectVisibility=this._viewer.scene.on("objectVisibility",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;const s=e.visible;if(!(s!==i.checked))return;this._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,this._renderService.setCheckbox(i.nodeId,s);let r=i.parent;for(;r;)r.checked=s,s?r.numVisibleEntities++:r.numVisibleEntities--,this._renderService.setCheckbox(r.nodeId,r.numVisibleEntities>0),r=r.parent;this._muteTreeEvents=!1})),this._onObjectXrayed=this._viewer.scene.on("objectXRayed",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;this._muteTreeEvents=!0;const s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,this._renderService.setXRayed(i.nodeId,s),this._muteTreeEvents=!1)})),this._switchExpandHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._expandSwitchElement(t)},this._switchCollapseHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._collapseSwitchElement(t)},this._checkboxChangeHandler=e=>{if(this._muteTreeEvents)return;this._muteSceneEvents=!0;const t=e.target,i=this._renderService.isChecked(t),s=this._renderService.getIdFromCheckbox(t),r=this._nodeNodes[s],o=this._viewer.scene.objects;let n=0;this._withNodeTree(r,(e=>{const t=e.objectId,s=o[t],r=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,r&&i!==e.checked&&n++,e.checked=i,this._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));let a=r.parent;for(;a;)a.checked=i,i?a.numVisibleEntities+=n:a.numVisibleEntities-=n,this._renderService.setCheckbox(a.nodeId,a.numVisibleEntities>0),a=a.parent;this._muteSceneEvents=!1},this._hierarchy=t.hierarchy||"containment",this._autoExpandDepth=t.autoExpandDepth||0,this._autoAddModels){const e=Object.keys(this.viewer.metaScene.metaModels);for(let t=0,i=e.length;t{this.viewer.metaScene.metaModels[e]&&this.addModel(e)}))}this.hierarchy=t.hierarchy}else this.error("Mandatory config expected: valid containerElementId or containerElement")}set hierarchy(e){"containment"!==(e=e||"containment")&&"storeys"!==e&&"types"!==e&&(this.error("Unsupported value for `hierarchy' - defaulting to 'containment'"),e="containment"),this._hierarchy!==e&&(this._hierarchy=e,this._createNodes())}get hierarchy(){return this._hierarchy}addModel(e,t={}){if(!this._containerElement)return;const i=this.viewer.scene.models[e];if(!i)throw"Model not found: "+e;const s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,t&&t.rootName&&(this._rootNames[e]=t.rootName),i.on("destroyed",(()=>{this.removeModel(i.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}removeModel(e){if(!this._containerElement)return;this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes())}showNode(e){this.unShowNode();const t=this._objectNodes[e];if(!t)return;const i=t.nodeId,s=this._renderService.getSwitchElement(i);if(s)return this._expandSwitchElement(s),s.scrollIntoView(),!0;const r=[];r.unshift(t);let o=t.parent;for(;o;)r.unshift(o),o=o.parent;for(let e=0,t=r.length;e{if(s===e)return;const r=this._renderService.getSwitchElement(i.nodeId);if(r){this._expandSwitchElement(r);const e=i.children;for(var o=0,n=e.length;o0;return this.valid}_validateMetaModelForStoreysHierarchy(e=0,t,i){return!0}_createEnabledNodes(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}_createDisabledNodes(){const e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);const t=this._viewer.metaScene.rootMetaObjects;for(let i in t){const s=t[i],r=s.type,o=s.name,n=o&&""!==o&&"Undefined"!==o&&"Default"!==o?o:r,a=this._renderService.createDisabledNodeElement(n);e.appendChild(a)}}_findEmptyNodes(){const e=this._viewer.metaScene.rootMetaObjects;for(let t in e)this._findEmptyNodes2(e[t])}_findEmptyNodes2(e,t=0){const i=this.viewer.scene,s=e.children,r=e.id,o=i.objects[r];if(e._countEntities=0,o&&e._countEntities++,s)for(let t=0,i=s.length;t{e.aabb&&r.aabb||(e.aabb||(e.aabb=t.getAABB(s.getObjectIDsInSubtree(e.objectId))),r.aabb||(r.aabb=t.getAABB(s.getObjectIDsInSubtree(r.objectId))));let o=0;return o=i.xUp?0:i.yUp?1:2,e.aabb[o]>r.aabb[o]?-1:e.aabb[o]s?1:0}_synchNodesToEntities(){const e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects;for(let s=0,r=e.length;sthis._createNodeElement(e))),t=this._renderService.createRootNode();e.forEach((e=>{t.appendChild(e)})),this._containerElement.appendChild(t),this._rootElement=t}_createNodeElement(e){return this._renderService.createNodeElement(e,this._switchExpandHandler,this._checkboxChangeHandler,(t=>{this.fire("contextmenu",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}),(t=>{this.fire("nodeTitleClicked",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}))}_expandSwitchElement(e){if(this._renderService.isExpanded(e))return;const t=this._renderService.getId(e),i=this._nodeNodes[t].children.map((e=>this._createNodeElement(e)));this._renderService.addChildren(e,i),this._renderService.expand(e,this._switchExpandHandler,this._switchCollapseHandler)}_collapseNode(e){const t=this._renderService.getSwitchElement(e);this._collapseSwitchElement(t)}_collapseSwitchElement(e){this._renderService.collapse(e,this._switchExpandHandler,this._switchCollapseHandler)}},exports.UnsignedByteType=1009,exports.UnsignedInt248Type=1020,exports.UnsignedIntType=1014,exports.UnsignedShort4444Type=1017,exports.UnsignedShort5551Type=1018,exports.UnsignedShortType=1012,exports.VBOGeometry=Ms,exports.ViewCullPlugin=class extends V{constructor(e,t={}){super("ViewCull",e),this._objectCullStates=function(e){const t=e.id;let i=fw[t];return i||(i=new pw(e),fw[t]=i,e.on("destroyed",(()=>{delete fw[t],i._destroy()}))),i}(e.scene),this._maxTreeDepth=t.maxTreeDepth||8,this._modelInfos={},this._frustum=new U,this._kdRoot=null,this._frustumDirty=!1,this._kdTreeDirty=!1,this._onViewMatrix=e.scene.camera.on("viewMatrix",(()=>{this._frustumDirty=!0})),this._onProjMatrix=e.scene.camera.on("projMatMatrix",(()=>{this._frustumDirty=!0})),this._onModelLoaded=e.scene.on("modelLoaded",(e=>{const t=this.viewer.scene.models[e];t&&this._addModel(t)})),this._onSceneTick=e.scene.on("tick",(()=>{this._doCull()}))}set enabled(e){this._enabled=e}get enabled(){return this._enabled}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._kdTreeDirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}_doCull(){const e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){const e=this._kdRoot;e&&this._visitKDNode(e)}}_buildFrustum(){const e=this.viewer.scene.camera;k(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}_buildKDTree(){const e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:U.INTERSECT};for(let e=0,t=this._objectCullStates.numObjects;e=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void c.expandAABB3(e.aabb,r);if(e.left&&c.containsAABB3(e.left.aabb,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1);if(e.right&&c.containsAABB3(e.right.aabb,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1);const o=e.aabb;gw[0]=o[3]-o[0],gw[1]=o[4]-o[1],gw[2]=o[5]-o[2];let n=0;if(gw[1]>gw[n]&&(n=1),gw[2]>gw[n]&&(n=2),!e.left){const a=o.slice();if(a[n+3]=(o[n]+o[n+3])/2,e.left={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1)}if(!e.right){const a=o.slice();if(a[n]=(o[n]+o[n+3])/2,e.right={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1)}e.objects=e.objects||[],e.objects.push(i),c.expandAABB3(e.aabb,r)}_visitKDNode(e,t=U.INTERSECT){if(t!==U.INTERSECT&&e.intersects===t)return;t===U.INTERSECT&&(t=O(this._frustum,e.aabb),e.intersects=t);const i=t===U.OUTSIDE,s=e.objects;if(s&&s.length>0)for(let e=0,t=s.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=c.mat4(),a=c.vec3();for(let t=0,i=s.size();t{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=rP[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(rP));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;e[...e])).flat();return Ts({id:e.id,points:t})},exports.buildSphereGeometry=Ji,exports.buildTorusGeometry=Ss,exports.buildVectorTextGeometry=Zi,exports.createRTCViewMat=j,exports.frustumIntersectsAABB3=O,exports.getKTX2TextureTranscoder=vA,exports.getPlaneRTCPos=W,exports.load3DSGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=Fs.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(_.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))},exports.loadOBJGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=Fs.parse.fromOBJ(e),n=Fs.edit.unwrap(o.i_verts,o.c_verts,3),a=Fs.edit.unwrap(o.i_norms,o.c_norms,3),l=Fs.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))},exports.math=c,exports.rtcToWorldPos=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i},exports.sRGBEncoding=3001,exports.setFrustum=k,exports.stats=p,exports.utils=_,exports.worldToRTCPos=G,exports.worldToRTCPositions=z; diff --git a/dist/xeokit-sdk.min.es.js b/dist/xeokit-sdk.min.es.js index e4203ce25c..ce24c531ef 100644 --- a/dist/xeokit-sdk.min.es.js +++ b/dist/xeokit-sdk.min.es.js @@ -1,4 +1,4 @@ -class e{constructor(e,t){this.items=e||[],this._lastUniqueId=(t||0)+1}addItem(){let e;if(2===arguments.length){const t=arguments[0];if(e=arguments[1],this.items[t])throw"ID clash: '"+t+"'";return this.items[t]=e,t}for(e=arguments[0]||{};;){const t=this._lastUniqueId++;if(!this.items[t])return this.items[t]=e,t}}removeItem(e){const t=this.items[e];return delete this.items[e],t}}const t=new e;class i{constructor(e){this.id=e,this.parentItem=null,this.groups=[],this.menuElement=null,this.shown=!1,this.mouseOver=0}}class s{constructor(){this.items=[]}}class r{constructor(e,t,i,s,r){this.id=e,this.getTitle=t,this.doAction=i,this.getEnabled=s,this.getShown=r,this.itemElement=null,this.subMenu=null,this.enabled=!0}}class o{constructor(e={}){this._id=t.addItem(),this._context=null,this._enabled=!1,this._itemsCfg=[],this._rootMenu=null,this._menuList=[],this._menuMap={},this._itemList=[],this._itemMap={},this._shown=!1,this._nextId=0,this._eventSubs={},!1!==e.hideOnMouseDown&&(document.addEventListener("mousedown",(e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}}class n{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}}let a=!0,l=a?Float64Array:Float32Array;const A=new l(3),h=new l(16),c=new l(16),u=new l(4),d={setDoublePrecisionEnabled(e){a=e,l=a?Float64Array:Float32Array},getDoublePrecisionEnabled:()=>a,MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId(e,t){const i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:(e,t)=>e+"#"+t,safeInv(e){const t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:e=>new l(e||2),vec3:e=>new l(e||3),vec4:e=>new l(e||4),mat3:e=>new l(e||9),mat3ToMat4:(e,t=new l(16))=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t),mat4:e=>new l(e||16),mat4ToMat3(e,t){},doublesToFloats(e,t,i){const s=new l(2);for(let r=0,o=e.length;r{const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return()=>{const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return`${e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]}-${e[255&i]}${e[i>>8&255]}-${e[i>>16&15|64]}${e[i>>24&255]}-${e[63&s|128]}${e[s>>8&255]}-${e[s>>16&255]}${e[s>>24&255]}${e[255&r]}${e[r>>8&255]}${e[r>>16&255]}${e[r>>24&255]}`}})(),clamp:(e,t,i)=>Math.max(t,Math.min(i,e)),fmod(e,t){if(ee[0]===t[0]&&e[1]===t[1]&&e[2]===t[2],negateVec3:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t),negateVec4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t),addVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i),addVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i),addVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i),addVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i),subVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i),subVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i),subVec2:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i),geometricMeanVec2(...e){const t=new l(e[0]);for(let i=1;i(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i),subScalarVec4:(e,t,i)=>(i||(i=e),i[0]=t-e[0],i[1]=t-e[1],i[2]=t-e[2],i[3]=t-e[3],i),mulVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3],i),mulVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i),mulVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i),mulVec2Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i),divVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i),divVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i[3]=e[3]/t[3],i),divScalarVec3:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i),divVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i),divVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i[3]=e[3]/t,i),divScalarVec4:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i[3]=e/t[3],i),dotVec4:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],cross3Vec4(e,t){const i=e[0],s=e[1],r=e[2],o=t[0],n=t[1],a=t[2];return[s*a-r*n,r*o-i*a,i*n-s*o,0]},cross3Vec3(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return i[0]=r*l-o*a,i[1]=o*n-s*l,i[2]=s*a-r*n,i},sqLenVec4:e=>d.dotVec4(e,e),lenVec4:e=>Math.sqrt(d.sqLenVec4(e)),dotVec3:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],dotVec2:(e,t)=>e[0]*t[0]+e[1]*t[1],sqLenVec3:e=>d.dotVec3(e,e),sqLenVec2:e=>d.dotVec2(e,e),lenVec3:e=>Math.sqrt(d.sqLenVec3(e)),distVec3:(()=>{const e=new l(3);return(t,i)=>d.lenVec3(d.subVec3(t,i,e))})(),lenVec2:e=>Math.sqrt(d.sqLenVec2(e)),distVec2:(()=>{const e=new l(2);return(t,i)=>d.lenVec2(d.subVec2(t,i,e))})(),rcpVec3:(e,t)=>d.divScalarVec3(1,e,t),normalizeVec4(e,t){const i=1/d.lenVec4(e);return d.mulVec4Scalar(e,i,t)},normalizeVec3(e,t){const i=1/d.lenVec3(e);return d.mulVec3Scalar(e,i,t)},normalizeVec2(e,t){const i=1/d.lenVec2(e);return d.mulVec2Scalar(e,i,t)},angleVec3(e,t){let i=d.dotVec3(e,t)/Math.sqrt(d.sqLenVec3(e)*d.sqLenVec3(t));return i=i<-1?-1:i>1?1:i,Math.acos(i)},vec3FromMat4Scale:(()=>{const e=new l(3);return(t,i)=>(e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=d.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=d.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=d.lenVec3(e),i)})(),vecToArray:(()=>{function e(e){return Math.round(1e5*e)/1e5}return t=>{for(let i=0,s=(t=Array.prototype.slice.call(t)).length;i({x:e[0],y:e[1],z:e[2]}),xyzObjectToArray:(e,t)=>((t=t||d.vec3())[0]=e.x,t[1]=e.y,t[2]=e.z,t),dupMat4:e=>e.slice(0,16),mat4To3:e=>[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]],m4s:e=>[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],setMat4ToZeroes:()=>d.m4s(0),setMat4ToOnes:()=>d.m4s(1),diagonalMat4v:e=>new l([e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,0,0,0,e[3]]),diagonalMat4c:(e,t,i,s)=>d.diagonalMat4v([e,t,i,s]),diagonalMat4s:e=>d.diagonalMat4c(e,e,e,e),identityMat4:(e=new l(16))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e),identityMat3:(e=new l(9))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e),isIdentityMat4:e=>1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15],negateMat4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t),addMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i),addMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i),addScalarMat4:(e,t,i)=>d.addMat4Scalar(t,e,i),subMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i),subMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i),subScalarMat4:(e,t,i)=>(i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i),mulMat4(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=e[3],a=e[4],l=e[5],A=e[6],h=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],_=e[15],v=t[0],b=t[1],y=t[2],B=t[3],w=t[4],x=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],I=t[11],D=t[12],S=t[13],T=t[14],R=t[15];return i[0]=v*s+b*a+y*c+B*f,i[1]=v*r+b*l+y*u+B*g,i[2]=v*o+b*A+y*d+B*m,i[3]=v*n+b*h+y*p+B*_,i[4]=w*s+x*a+P*c+C*f,i[5]=w*r+x*l+P*u+C*g,i[6]=w*o+x*A+P*d+C*m,i[7]=w*n+x*h+P*p+C*_,i[8]=M*s+F*a+E*c+I*f,i[9]=M*r+F*l+E*u+I*g,i[10]=M*o+F*A+E*d+I*m,i[11]=M*n+F*h+E*p+I*_,i[12]=D*s+S*a+T*c+R*f,i[13]=D*r+S*l+T*u+R*g,i[14]=D*o+S*A+T*d+R*m,i[15]=D*n+S*h+T*p+R*_,i},mulMat3(e,t,i){i||(i=new l(9));const s=e[0],r=e[3],o=e[6],n=e[1],a=e[4],A=e[7],h=e[2],c=e[5],u=e[8],d=t[0],p=t[3],f=t[6],g=t[1],m=t[4],_=t[7],v=t[2],b=t[5],y=t[8];return i[0]=s*d+r*g+o*v,i[3]=s*p+r*m+o*b,i[6]=s*f+r*_+o*y,i[1]=n*d+a*g+A*v,i[4]=n*p+a*m+A*b,i[7]=n*f+a*_+A*y,i[2]=h*d+c*g+u*v,i[5]=h*p+c*m+u*b,i[8]=h*f+c*_+u*y,i},mulMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i),mulMat4v4(e,t,i=d.vec4()){const s=t[0],r=t[1],o=t[2],n=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12]*n,i[1]=e[1]*s+e[5]*r+e[9]*o+e[13]*n,i[2]=e[2]*s+e[6]*r+e[10]*o+e[14]*n,i[3]=e[3]*s+e[7]*r+e[11]*o+e[15]*n,i},transposeMat4(e,t){const i=e[4],s=e[14],r=e[8],o=e[13],n=e[12],a=e[9];if(!t||e===t){const t=e[1],l=e[2],A=e[3],h=e[6],c=e[7],u=e[11];return e[1]=i,e[2]=r,e[3]=n,e[4]=t,e[6]=a,e[7]=o,e[8]=l,e[9]=h,e[11]=s,e[12]=A,e[13]=c,e[14]=u,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=n,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=o,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3(e,t){if(t===e){const i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4(e){const t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],n=e[5],a=e[6],l=e[7],A=e[8],h=e[9],c=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15];return d*h*a*r-A*p*a*r-d*n*c*r+o*p*c*r+A*n*f*r-o*h*f*r-d*h*s*l+A*p*s*l+d*i*c*l-t*p*c*l-A*i*f*l+t*h*f*l+d*n*s*u-o*p*s*u-d*i*a*u+t*p*a*u+o*i*f*u-t*n*f*u-A*n*s*g+o*h*s*g+A*i*a*g-t*h*a*g-o*i*c*g+t*n*c*g},inverseMat4(e,t){t||(t=e);const i=e[0],s=e[1],r=e[2],o=e[3],n=e[4],a=e[5],l=e[6],A=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],_=i*a-s*n,v=i*l-r*n,b=i*A-o*n,y=s*l-r*a,B=s*A-o*a,w=r*A-o*l,x=h*f-c*p,P=h*g-u*p,C=h*m-d*p,M=c*g-u*f,F=c*m-d*f,E=u*m-d*g,I=1/(_*E-v*F+b*M+y*C-B*P+w*x);return t[0]=(a*E-l*F+A*M)*I,t[1]=(-s*E+r*F-o*M)*I,t[2]=(f*w-g*B+m*y)*I,t[3]=(-c*w+u*B-d*y)*I,t[4]=(-n*E+l*C-A*P)*I,t[5]=(i*E-r*C+o*P)*I,t[6]=(-p*w+g*b-m*v)*I,t[7]=(h*w-u*b+d*v)*I,t[8]=(n*F-a*C+A*x)*I,t[9]=(-i*F+s*C-o*x)*I,t[10]=(p*B-f*b+m*_)*I,t[11]=(-h*B+c*b-d*_)*I,t[12]=(-n*M+a*P-l*x)*I,t[13]=(i*M-s*P+r*x)*I,t[14]=(-p*y+f*v-g*_)*I,t[15]=(h*y-c*v+u*_)*I,t},traceMat4:e=>e[0]+e[5]+e[10]+e[15],translationMat4v(e,t){const i=t||d.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v(e,t){const i=t||d.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(()=>{const e=new l(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,d.translationMat4v(e,r))})(),translationMat4s:(e,t)=>d.translationMat4c(e,e,e,t),translateMat4v:(e,t)=>d.translateMat4c(e[0],e[1],e[2],t),translateMat4c(e,t,i,s){const r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;const o=s[7];s[4]+=o*e,s[5]+=o*t,s[6]+=o*i;const n=s[11];s[8]+=n*e,s[9]+=n*t,s[10]+=n*i;const a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:(e,t,i)=>(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i),rotationMat4v(e,t,i){const s=d.normalizeVec4([t[0],t[1],t[2],0],[]),r=Math.sin(e),o=Math.cos(e),n=1-o,a=s[0],l=s[1],A=s[2];let h,c,u,p,f,g;return h=a*l,c=l*A,u=A*a,p=a*r,f=l*r,g=A*r,(i=i||d.mat4())[0]=n*a*a+o,i[1]=n*h+g,i[2]=n*u-f,i[3]=0,i[4]=n*h-g,i[5]=n*l*l+o,i[6]=n*c+p,i[7]=0,i[8]=n*u+f,i[9]=n*c-p,i[10]=n*A*A+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:(e,t,i,s,r)=>d.rotationMat4v(e,[t,i,s],r),scalingMat4v:(e,t=d.identityMat4())=>(t[0]=e[0],t[5]=e[1],t[10]=e[2],t),scalingMat3v:(e,t=d.identityMat3())=>(t[0]=e[0],t[4]=e[1],t),scalingMat4c:(()=>{const e=new l(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,d.scalingMat4v(e,r))})(),scaleMat4c:(e,t,i,s)=>(s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s),scaleMat4v(e,t){const i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:e=>d.scalingMat4c(e,e,e),rotationTranslationMat4(e,t,i=d.mat4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=s+s,l=r+r,A=o+o,h=s*a,c=s*l,u=s*A,p=r*l,f=r*A,g=o*A,m=n*a,_=n*l,v=n*A;return i[0]=1-(p+g),i[1]=c+v,i[2]=u-_,i[3]=0,i[4]=c-v,i[5]=1-(h+g),i[6]=f+m,i[7]=0,i[8]=u+_,i[9]=f-m,i[10]=1-(h+p),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler(e,t,i=d.vec4()){const s=d.clamp,r=e[0],o=e[4],n=e[8],a=e[1],l=e[5],A=e[9],h=e[2],c=e[6],u=e[10];return"XYZ"===t?(i[1]=Math.asin(s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(-A,u),i[2]=Math.atan2(-o,r)):(i[0]=Math.atan2(c,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[1]=Math.atan2(n,u),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-h,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(c,-1,1)),Math.abs(c)<.99999?(i[1]=Math.atan2(-h,u),i[2]=Math.atan2(-o,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(h,-1,1)),Math.abs(h)<.99999?(i[0]=Math.atan2(c,u),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-o,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-A,l),i[1]=Math.atan2(-h,r)):(i[0]=0,i[1]=Math.atan2(n,u))):"XZY"===t&&(i[2]=Math.asin(-s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(c,l),i[1]=Math.atan2(n,r)):(i[0]=Math.atan2(-A,u),i[1]=0)),i},composeMat4:(e,t,i,s=d.mat4())=>(d.quaternionToRotationMat4(t,s),d.scaleMat4v(i,s),d.translateMat4v(e,s),s),decomposeMat4:(()=>{const e=new l(3),t=new l(16);return function(i,s,r,o){e[0]=i[0],e[1]=i[1],e[2]=i[2];let n=d.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];const a=d.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];const l=d.lenVec3(e);d.determinantMat4(i)<0&&(n=-n),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);const A=1/n,h=1/a,c=1/l;return t[0]*=A,t[1]*=A,t[2]*=A,t[4]*=h,t[5]*=h,t[6]*=h,t[8]*=c,t[9]*=c,t[10]*=c,d.mat4ToQuaternion(t,r),o[0]=n,o[1]=a,o[2]=l,this}})(),getColMat4(e,t){const i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v(e,t,i,s){s||(s=d.mat4());const r=e[0],o=e[1],n=e[2],a=i[0],l=i[1],A=i[2],h=t[0],c=t[1],u=t[2];if(r===h&&o===c&&n===u)return d.identityMat4();let p,f,g,m,_,v,b,y,B,w;return p=r-h,f=o-c,g=n-u,w=1/Math.sqrt(p*p+f*f+g*g),p*=w,f*=w,g*=w,m=l*g-A*f,_=A*p-a*g,v=a*f-l*p,w=Math.sqrt(m*m+_*_+v*v),w?(w=1/w,m*=w,_*=w,v*=w):(m=0,_=0,v=0),b=f*v-g*_,y=g*m-p*v,B=p*_-f*m,w=Math.sqrt(b*b+y*y+B*B),w?(w=1/w,b*=w,y*=w,B*=w):(b=0,y=0,B=0),s[0]=m,s[1]=b,s[2]=p,s[3]=0,s[4]=_,s[5]=y,s[6]=f,s[7]=0,s[8]=v,s[9]=B,s[10]=g,s[11]=0,s[12]=-(m*r+_*o+v*n),s[13]=-(b*r+y*o+B*n),s[14]=-(p*r+f*o+g*n),s[15]=1,s},lookAtMat4c:(e,t,i,s,r,o,n,a,l)=>d.lookAtMat4v([e,t,i],[s,r,o],[n,a,l],[]),orthoMat4c(e,t,i,s,r,o,n){n||(n=d.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2/l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-2/A,n[11]=0,n[12]=-(e+t)/a,n[13]=-(s+i)/l,n[14]=-(o+r)/A,n[15]=1,n},frustumMat4v(e,t,i){i||(i=d.mat4());const s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];d.addVec4(r,s,h),d.subVec4(r,s,c);const o=2*s[2],n=c[0],a=c[1],l=c[2];return i[0]=o/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o/a,i[6]=0,i[7]=0,i[8]=h[0]/n,i[9]=h[1]/a,i[10]=-h[2]/l,i[11]=-1,i[12]=0,i[13]=0,i[14]=-o*r[2]/l,i[15]=0,i},frustumMat4(e,t,i,s,r,o,n){n||(n=d.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2*r/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2*r/l,n[6]=0,n[7]=0,n[8]=(t+e)/a,n[9]=(s+i)/l,n[10]=-(o+r)/A,n[11]=-1,n[12]=0,n[13]=0,n[14]=-o*r*2/A,n[15]=0,n},perspectiveMat4(e,t,i,s,r){const o=[],n=[];return o[2]=i,n[2]=s,n[1]=o[2]*Math.tan(e/2),o[1]=-n[1],n[0]=n[1]*t,o[0]=-n[0],d.frustumMat4v(o,n,r)},compareMat4:(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15],transformPoint3(e,t,i=d.vec3()){const s=t[0],r=t[1],o=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12],i[1]=e[1]*s+e[5]*r+e[9]*o+e[13],i[2]=e[2]*s+e[6]*r+e[10]*o+e[14],i},transformPoint4:(e,t,i=d.vec4())=>(i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i),transformPoints3(e,t,i){const s=i||[],r=t.length;let o,n,a,l;const A=e[0],h=e[1],c=e[2],u=e[3],d=e[4],p=e[5],f=e[6],g=e[7],m=e[8],_=e[9],v=e[10],b=e[11],y=e[12],B=e[13],w=e[14],x=e[15];let P;for(let e=0;e{const e=new l(16),t=new l(16),i=new l(16);return function(s,r,o,n){return this.transformVec3(this.mulMat4(this.inverseMat4(r,e),this.inverseMat4(o,t),i),s,n)}})(),lerpVec3(e,t,i,s,r,o){const n=o||d.vec3(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n},lerpMat4(e,t,i,s,r,o){const n=o||d.mat4(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n[3]=s[3]+a*(r[3]-s[3]),n[4]=s[4]+a*(r[4]-s[4]),n[5]=s[5]+a*(r[5]-s[5]),n[6]=s[6]+a*(r[6]-s[6]),n[7]=s[7]+a*(r[7]-s[7]),n[8]=s[8]+a*(r[8]-s[8]),n[9]=s[9]+a*(r[9]-s[9]),n[10]=s[10]+a*(r[10]-s[10]),n[11]=s[11]+a*(r[11]-s[11]),n[12]=s[12]+a*(r[12]-s[12]),n[13]=s[13]+a*(r[13]-s[13]),n[14]=s[14]+a*(r[14]-s[14]),n[15]=s[15]+a*(r[15]-s[15]),n},flatten(e){const t=[];let i,s,r,o,n;for(i=0,s=e.length;i(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e),eulerToQuaternion(e,t,i=d.vec4()){const s=e[0]*d.DEGTORAD/2,r=e[1]*d.DEGTORAD/2,o=e[2]*d.DEGTORAD/2,n=Math.cos(s),a=Math.cos(r),l=Math.cos(o),A=Math.sin(s),h=Math.sin(r),c=Math.sin(o);return"XYZ"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l-A*h*c):"YXZ"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l+A*h*c):"ZXY"===t?(i[0]=A*a*l-n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l-A*h*c):"ZYX"===t?(i[0]=A*a*l-n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l+A*h*c):"YZX"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l-A*h*c):"XZY"===t&&(i[0]=A*a*l-n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l+A*h*c),i},mat4ToQuaternion(e,t=d.vec4()){const i=e[0],s=e[4],r=e[8],o=e[1],n=e[5],a=e[9],l=e[2],A=e[6],h=e[10];let c;const u=i+n+h;return u>0?(c=.5/Math.sqrt(u+1),t[3]=.25/c,t[0]=(A-a)*c,t[1]=(r-l)*c,t[2]=(o-s)*c):i>n&&i>h?(c=2*Math.sqrt(1+i-n-h),t[3]=(A-a)/c,t[0]=.25*c,t[1]=(s+o)/c,t[2]=(r+l)/c):n>h?(c=2*Math.sqrt(1+n-i-h),t[3]=(r-l)/c,t[0]=(s+o)/c,t[1]=.25*c,t[2]=(a+A)/c):(c=2*Math.sqrt(1+h-i-n),t[3]=(o-s)/c,t[0]=(r+l)/c,t[1]=(a+A)/c,t[2]=.25*c),t},vec3PairToQuaternion(e,t,i=d.vec4()){const s=Math.sqrt(d.dotVec3(e,e)*d.dotVec3(t,t));let r=s+d.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):d.cross3Vec3(e,t,i),i[3]=r,d.normalizeQuaternion(i)},angleAxisToQuaternion(e,t=d.vec4()){const i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:(()=>{const e=new l(16);return(t,i,s)=>(s=s||d.vec3(),d.quaternionToRotationMat4(t,e),d.mat4ToEuler(e,i,s),s)})(),mulQuaternions(e,t,i=d.vec4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=t[0],l=t[1],A=t[2],h=t[3];return i[0]=n*a+s*h+r*A-o*l,i[1]=n*l+r*h+o*a-s*A,i[2]=n*A+o*h+s*l-r*a,i[3]=n*h-s*a-r*l-o*A,i},vec3ApplyQuaternion(e,t,i=d.vec3()){const s=t[0],r=t[1],o=t[2],n=e[0],a=e[1],l=e[2],A=e[3],h=A*s+a*o-l*r,c=A*r+l*s-n*o,u=A*o+n*r-a*s,p=-n*s-a*r-l*o;return i[0]=h*A+p*-n+c*-l-u*-a,i[1]=c*A+p*-a+u*-n-h*-l,i[2]=u*A+p*-l+h*-a-c*-n,i},quaternionToMat4(e,t){t=d.identityMat4(t);const i=e[0],s=e[1],r=e[2],o=e[3],n=2*i,a=2*s,l=2*r,A=n*o,h=a*o,c=l*o,u=n*i,p=a*i,f=l*i,g=a*s,m=l*s,_=l*r;return t[0]=1-(g+_),t[1]=p+c,t[2]=f-h,t[4]=p-c,t[5]=1-(u+_),t[6]=m+A,t[8]=f+h,t[9]=m-A,t[10]=1-(u+g),t},quaternionToRotationMat4(e,t){const i=e[0],s=e[1],r=e[2],o=e[3],n=i+i,a=s+s,l=r+r,A=i*n,h=i*a,c=i*l,u=s*a,d=s*l,p=r*l,f=o*n,g=o*a,m=o*l;return t[0]=1-(u+p),t[4]=h-m,t[8]=c+g,t[1]=h+m,t[5]=1-(A+p),t[9]=d-f,t[2]=c-g,t[6]=d+f,t[10]=1-(A+u),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion(e,t=e){const i=d.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:(e,t=e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t),inverseQuaternion:(e,t)=>d.normalizeQuaternion(d.conjugateQuaternion(e,t)),quaternionToAngleAxis(e,t=d.vec4()){const i=(e=d.normalizeQuaternion(e,u))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:e=>new l(e||6),AABB2:e=>new l(e||4),OBB3:e=>new l(e||32),OBB2:e=>new l(e||16),Sphere3:(e,t,i,s)=>new l([e,t,i,s]),transformOBB3(e,t,i=t){let s;const r=t.length;let o,n,a;const l=e[0],A=e[1],h=e[2],c=e[3],u=e[4],d=e[5],p=e[6],f=e[7],g=e[8],m=e[9],_=e[10],v=e[11],b=e[12],y=e[13],B=e[14],w=e[15];for(s=0;s{const e=new l(3),t=new l(3),i=new l(3);return s=>(e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5],d.subVec3(t,e,i),Math.abs(d.lenVec3(i)))})(),getAABB3DiagPoint:(()=>{const e=new l(3),t=new l(3),i=new l(3);return(s,r)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5];const o=d.subVec3(t,e,i),n=r[0]-s[0],a=s[3]-r[0],l=r[1]-s[1],A=s[4]-r[1],h=r[2]-s[2],c=s[5]-r[2];return o[0]+=n>a?n:a,o[1]+=l>A?l:A,o[2]+=h>c?h:c,Math.abs(d.lenVec3(o))}})(),getAABB3Area:e=>(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2]),getAABB3Center(e,t){const i=t||d.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center(e,t){const i=t||d.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:(e=d.AABB3())=>(e[0]=d.MAX_DOUBLE,e[1]=d.MAX_DOUBLE,e[2]=d.MAX_DOUBLE,e[3]=d.MIN_DOUBLE,e[4]=d.MIN_DOUBLE,e[5]=d.MIN_DOUBLE,e),AABB3ToOBB3:(e,t=d.OBB3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t),positions3ToAABB3:(()=>{const e=new l(3);return(t,i,s)=>{i=i||d.AABB3();let r,o,n,a=d.MAX_DOUBLE,l=d.MAX_DOUBLE,A=d.MAX_DOUBLE,h=d.MIN_DOUBLE,c=d.MIN_DOUBLE,u=d.MIN_DOUBLE;for(let i=0,p=t.length;ih&&(h=r),o>c&&(c=o),n>u&&(u=n);return i[0]=a,i[1]=l,i[2]=A,i[3]=h,i[4]=c,i[5]=u,i}})(),OBB3ToAABB3(e,t=d.AABB3()){let i,s,r,o=d.MAX_DOUBLE,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE,h=d.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToAABB3(e,t=d.AABB3()){let i,s,r,o=d.MAX_DOUBLE,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE,h=d.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToSphere3:(()=>{const e=new l(3);return(t,i)=>{i=i||d.vec4();let s,r=0,o=0,n=0;const a=t.length;for(s=0;sA&&(A=l);return i[3]=A,i}})(),positions3ToSphere3:(()=>{const e=new l(3),t=new l(3);return(i,s)=>{s=s||d.vec4();let r,o=0,n=0,a=0;const l=i.length;let A=0;for(r=0;rA&&(A=c);return s[3]=A,s}})(),OBB3ToSphere3:(()=>{const e=new l(3),t=new l(3);return(i,s)=>{s=s||d.vec4();let r,o=0,n=0,a=0;const l=i.length,A=l/4;for(r=0;rc&&(c=h);return s[3]=c,s}})(),getSphere3Center:(e,t=d.vec3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t),getPositionsCenter(e,t=d.vec3()){let i=0,s=0,r=0;for(var o=0,n=e.length;o(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3](e[0]=d.MAX_DOUBLE,e[1]=d.MAX_DOUBLE,e[2]=d.MIN_DOUBLE,e[3]=d.MIN_DOUBLE,e),point3AABB3Intersect:(e,t)=>e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]);if(s<=-t&&r<=-t)return-1;return s>=-t&&r>=-t?1:0},OBB3ToAABB2(e,t=d.AABB2()){let i,s,r,o,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE;for(let t=0,h=e.length;tl&&(l=i),s>A&&(A=s);return t[0]=n,t[1]=a,t[2]=l,t[3]=A,t},expandAABB2:(e,t)=>(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]2*(1-e)*(i-t)+2*e*(s-i),tangentQuadraticBezier3:(e,t,i,s,r)=>-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r,tangentSpline:e=>6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e),catmullRomInterpolate(e,t,i,s,r){const o=.5*(i-e),n=.5*(s-t),a=r*r;return(2*t-2*i+o+n)*(r*a)+(-3*t+3*i-2*o-n)*a+o*r+t},b2p0(e,t){const i=1-e;return i*i*t},b2p1:(e,t)=>2*(1-e)*e*t,b2p2:(e,t)=>e*e*t,b2(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0(e,t){const i=1-e;return i*i*i*t},b3p1(e,t){const i=1-e;return 3*i*i*e*t},b3p2:(e,t)=>3*(1-e)*e*e*t,b3p3:(e,t)=>e*e*e*t,b3(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal(e,t,i,s=d.vec3()){const r=t[0]-e[0],o=t[1]-e[1],n=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],A=i[2]-e[2],h=o*A-n*l,c=n*a-r*A,u=r*l-o*a,p=Math.sqrt(h*h+c*c+u*u);return 0===p?(s[0]=0,s[1]=0,s[2]=0):(s[0]=h/p,s[1]=c/p,s[2]=u/p),s},rayTriangleIntersect:(()=>{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3);return(o,n,a,l,A,h)=>{h=h||d.vec3();const c=d.subVec3(l,a,e),u=d.subVec3(A,a,t),p=d.cross3Vec3(n,u,i),f=d.dotVec3(c,p);if(f<1e-6)return null;const g=d.subVec3(o,a,s),m=d.dotVec3(g,p);if(m<0||m>f)return null;const _=d.cross3Vec3(g,c,r),v=d.dotVec3(n,_);if(v<0||m+v>f)return null;const b=d.dotVec3(u,_)/f;return h[0]=o[0]+b*n[0],h[1]=o[1]+b*n[1],h[2]=o[2]+b*n[2],h}})(),rayPlaneIntersect:(()=>{const e=new l(3),t=new l(3),i=new l(3),s=new l(3);return(r,o,n,a,l,A)=>{A=A||d.vec3(),o=d.normalizeVec3(o,e);const h=d.subVec3(a,n,t),c=d.subVec3(l,n,i),u=d.cross3Vec3(h,c,s);d.normalizeVec3(u,u);const p=-d.dotVec3(n,u),f=-(d.dotVec3(r,u)+p)/d.dotVec3(o,u);return A[0]=r[0]+f*o[0],A[1]=r[1]+f*o[1],A[2]=r[2]+f*o[2],A}})(),cartesianToBarycentric:(()=>{const e=new l(3),t=new l(3),i=new l(3);return(s,r,o,n,a)=>{const l=d.subVec3(n,r,e),A=d.subVec3(o,r,t),h=d.subVec3(s,r,i),c=d.dotVec3(l,l),u=d.dotVec3(l,A),p=d.dotVec3(l,h),f=d.dotVec3(A,A),g=d.dotVec3(A,h),m=c*f-u*u;if(0===m)return null;const _=1/m,v=(f*p-u*g)*_,b=(c*g-u*p)*_;return a[0]=1-v-b,a[1]=b,a[2]=v,a}})(),barycentricInsideTriangle(e){const t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian(e,t,i,s,r=d.vec3()){const o=e[0],n=e[1],a=e[2];return r[0]=t[0]*o+i[0]*n+s[0]*a,r[1]=t[1]*o+i[1]*n+s[1]*a,r[2]=t[2]*o+i[2]*n+s[2]*a,r},mergeVertices(e,t,i,s){const r={},o=[],n=[],a=t?[]:null,l=i?[]:null,A=[];let h,c,u,d;const p=1e4;let f,g,m=0;for(f=0,g=e.length;f{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3),o=new l(3);return(n,a,l)=>{let A,h;const c=new Array(n.length/3);let u,p,f,g,m,_,v;for(A=0,h=a.length;A{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3),o=new l(3),n=new l(3);return(a,l,A)=>{const h=new Float32Array(a.length);for(let c=0;c>24&255,h=u>>16&255,A=u>>8&255,l=255&u,a=t[i],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+1],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+2],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,u++;return{positions:r,colors:o}},faceToVertexNormals(e,t,i={}){const s=i.smoothNormalsAngleThreshold||20,r={},o=[],n={};let a,l,A,h,c;const u=1e4;let p,f,g,m,_,v;for(f=0,m=e.length;f{const e=new l(4),t=new l(4);return(i,s,r,o,n)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=1,d.transformVec4(i,e,t),o[0]=t[0],o[1]=t[1],o[2]=t[2],e[0]=r[0],e[1]=r[1],e[2]=r[2],d.transformVec3(i,e,t),d.normalizeVec3(t),n[0]=t[0],n[1]=t[1],n[2]=t[2]}})(),canvasPosToWorldRay:(()=>{const e=new l(16),t=new l(16),i=new l(4),s=new l(4),r=new l(4),o=new l(4);return(n,a,l,A,h,c)=>{const u=d.mulMat4(l,a,e),p=d.inverseMat4(u,t),f=n.width,g=n.height,m=(A[0]-f/2)/(f/2),_=-(A[1]-g/2)/(g/2);i[0]=m,i[1]=_,i[2]=-1,i[3]=1,d.transformVec4(p,i,s),d.mulVec4Scalar(s,1/s[3]),r[0]=m,r[1]=_,r[2]=1,r[3]=1,d.transformVec4(p,r,o),d.mulVec4Scalar(o,1/o[3]),h[0]=o[0],h[1]=o[1],h[2]=o[2],d.subVec3(o,s,c),d.normalizeVec3(c)}})(),canvasPosToLocalRay:(()=>{const e=new l(3),t=new l(3);return(i,s,r,o,n,a,l)=>{d.canvasPosToWorldRay(i,s,r,n,e,t),d.worldRayToLocalRay(o,e,t,a,l)}})(),worldRayToLocalRay:(()=>{const e=new l(16),t=new l(4),i=new l(4);return(s,r,o,n,a)=>{const l=d.inverseMat4(s,e);t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,d.transformVec4(l,t,i),n[0]=i[0],n[1]=i[1],n[2]=i[2],d.transformVec3(l,o,a)}})(),buildKDTree:(()=>{const e=new Float32Array;function t(i,s,r,o){const n=new l(6),a={triangles:null,left:null,right:null,leaf:!1,splitDim:0,aabb:n};let A,h;for(n[0]=n[1]=n[2]=Number.POSITIVE_INFINITY,n[3]=n[4]=n[5]=Number.NEGATIVE_INFINITY,A=0,h=i.length;An[3]&&(n[3]=r[t]),r[t+1]n[4]&&(n[4]=r[t+1]),r[t+2]n[5]&&(n[5]=r[t+2])}}if(i.length<20||o>10)return a.triangles=i,a.leaf=!0,a;e[0]=n[3]-n[0],e[1]=n[4]-n[1],e[2]=n[5]-n[2];let u=0;e[1]>e[u]&&(u=1),e[2]>e[u]&&(u=2),a.splitDim=u;const d=(n[u]+n[u+3])/2,p=new Array(i.length);let f=0;const g=new Array(i.length);let m=0;for(A=0,h=i.length;A{const s=e.length/3,r=new Array(s);for(let e=0;e=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t},octDecodeVec2s(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t}};d.buildEdgeIndices=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}(),d.planeClipsPositions3=function(e,t,i,s=3){for(let r=0,o=i.length;r{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&d.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&d.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;p[0]=r[3]-r[0],p[1]=r[4]-r[1],p[2]=r[5]-r[2];let o=0;if(p[1]>p[o]&&(o=1),p[2]>p[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},d.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},d.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}}class g{constructor(){this._head=[],this._headLength=0,this._tail=[],this._index=0,this._length=0}get length(){return this._length}shift(){if(this._index>=this._headLength){const e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}const e=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,e}push(e){return this._length++,this._tail.push(e),this}unshift(e){return this._head[--this._index]=e,this._length++,this}}const m={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var _=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r{};t=t||s,i=i||s;var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.addEventListener("load",(function(e){var s=e.target.response;if(200===this.status){var r;try{r=JSON.parse(s)}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}t(r)}else if(0===this.status){console.warn("loadFile: HTTP Status 0 received.");try{t(JSON.parse(s))}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}}else i(e)}),!1),r.addEventListener("error",(function(e){i(e)}),!1),r.send(null)},loadArraybuffer:function(e,t,i){var s=e=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{t(e)}))}catch(e){I.scheduleTask((()=>{i(e)}))}}else{const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i("loadArrayBuffer error : "+s.response))},s.send(null)}},queryString:b,isArray:function(e){return e&&!e.propertyIsEnumerable("length")&&"object"==typeof e&&"number"==typeof e.length},isString:function(e){return"string"==typeof e||e instanceof String},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isID:function(e){return y.isString(e)||y.isNumeric(e)},isSameComponent:function(e,t){return!(!e||!t)&&(y.isNumeric(e)||y.isString(e)?`${e}`:e.id)===(y.isNumeric(t)||y.isString(t)?`${t}`:t.id)},isFunction:function(e){return"function"==typeof e},isObject:function(e){const t={}.constructor;return!!e&&e.constructor===t},copy:function(e){return y.apply(e,{})},apply:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},apply2:function(e,t){for(const i in e)e.hasOwnProperty(i)&&void 0!==e[i]&&null!==e[i]&&(t[i]=e[i]);return t},applyIf:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(void 0!==t[i]&&null!==t[i]||(t[i]=e[i]));return t},isEmptyObject:function(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},inQuotes:function(e){return y.isNumeric(e)?`${e}`:`'${e}'`},concat:function(e,t){const i=new e.constructor(e.length+t.length);return i.set(e),i.set(t,e.length),i},flattenParentChildHierarchy:function(e){var t=[];return function e(i){i.id=i.uuid,delete i.oid,t.push(i);var s=i.children;if(s)for(var r=0,o=s.length;r{w.removeItem(e.id),delete I.scenes[e.id],delete B[e.id],m.components.scenes--}))},this.clear=function(){let e;for(const t in I.scenes)I.scenes.hasOwnProperty(t)&&(e=I.scenes[t],"default.scene"===t?e.clear():(e.destroy(),delete I.scenes[e.id]))},this.scheduleTask=function(e,t=null){x.push(e),x.push(t)},this.runTasks=function(e=-1){let t,i,s=(new Date).getTime(),r=0;for(;x.length>0&&(e<0||s0&&M>0){var t=1e3/M;E+=t,C.push(t),C.length>=30&&(E-=C.shift()),m.frame.fps=Math.round(E/C.length)}for(let e in I.scenes)I.scenes[e].compile();T(e),F=e};!function(e,t){let i=Date.now()+t;(function s(){const r=Date.now()-i;e(),i+=t,setTimeout(s,Math.max(0,t-r))})()}((()=>{D()}),100);const S=function(){let e=Date.now();if(M=e-F,F>0&&M>0){var t=1e3/M;E+=t,C.push(t),C.length>=30&&(E-=C.shift()),m.frame.fps=Math.round(E/C.length)}T(e),function(e){for(var t in P.time=e,I.scenes)if(I.scenes.hasOwnProperty(t)){var i=I.scenes[t];P.sceneId=t,P.startTime=i.startTime,P.deltaTime=null!=P.prevTime?P.time-P.prevTime:0,i.fire("tick",P,!0)}P.prevTime=e}(e),function(){const e=I.scenes,t=!1;let i,s,r,o,n;for(n in e)e.hasOwnProperty(n)&&(i=e[n],s=B[n],s||(s=B[n]={}),r=i.ticksPerOcclusionTest,s.ticksPerOcclusionTest!==r&&(s.ticksPerOcclusionTest=r,s.renderCountdown=r),--i.occlusionTestCountdown<=0&&(i.doOcclusionTest(),i.occlusionTestCountdown=r),o=i.ticksPerRender,s.ticksPerRender!==o&&(s.ticksPerRender=o,s.renderCountdown=o),0==--s.renderCountdown&&(i.render(t),s.renderCountdown=o))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(D):requestAnimationFrame(S)};function T(e){const t=I.runTasks(e+10),i=I.getNumTasks();m.frame.tasksRun=t,m.frame.tasksScheduled=i,m.frame.tasksBudget=10}S();class R{get type(){return"Component"}get isComponent(){return!0}constructor(e=null,t={}){if(this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=t.viewer;else{if("Scene"===e.type)this.scene=e;else{if(!(e instanceof R))throw"Invalid param: owner must be a Component";this.scene=e.scene}this._owner=e}this._dontClear=!!t.dontClear,this._renderer=this.scene._renderer,this.meta=t.meta||{},this.id=t.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,e&&e._own(this)}glRedraw(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}glResort(){this._renderer&&this._renderer.needStateSort()}get owner(){return this._owner}isType(e){return this.type===e}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}_message(e){return" ["+this.type+" "+y.inQuotes(this.id)+"]: "+e}warn(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}error(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}_attach(e){const t=e.name;if(!t)return void this.error("Component 'name' expected");let i=e.component;const s=e.sceneDefault,r=e.sceneSingleton,o=e.type,n=e.on,a=!1!==e.recompiles;if(i&&(y.isNumeric(i)||y.isString(i))){const e=i;if(i=this.scene.components[e],!i)return void this.error("Component not found: "+y.inQuotes(e))}if(!i)if(!0===r){const e=this.scene.types[o];for(const t in e)if(e.hasOwnProperty){i=e[t];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&(i=this.scene[t],!i))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+y.inQuotes(i.id));if(o&&!i.isType(o))return void this.error("Expected a "+o+" type or subtype: "+i.type+" "+y.inQuotes(i.id))}this._attachments||(this._attachments={});const l=this._attached[t];let A,h,c;if(l){if(i&&l.id===i.id)return;const e=this._attachments[l.id];for(A=e.subs,h=0,c=A.length;h{delete this._ownedComponents[e.id]}),this)}_needUpdate(e){this._updateScheduled||(this._updateScheduled=!0,0===e?this._doUpdate():I.scheduleTask(this._doUpdate,this))}_doUpdate(){this._updateScheduled&&(this._updateScheduled=!1,this._update&&this._update())}scheduleTask(e){I.scheduleTask(e,null)}_update(){}clear(){if(this._ownedComponents)for(var e in this._ownedComponents)if(this._ownedComponents.hasOwnProperty(e)){this._ownedComponents[e].destroy(),delete this._ownedComponents[e]}}destroy(){if(this.destroyed)return;let e,t,i,s,r,o;if(this.fire("destroyed",this.destroyed=!0),this._attachments)for(e in this._attachments)if(this._attachments.hasOwnProperty(e)){for(t=this._attachments[e],i=t.component,s=t.subs,r=0,o=s.length;r=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}class N{constructor(){this.planes=[new O,new O,new O,new O,new O,new O]}}function Q(e,t,i){const s=d.mulMat4(i,t,k),r=s[0],o=s[1],n=s[2],a=s[3],l=s[4],A=s[5],h=s[6],c=s[7],u=s[8],p=s[9],f=s[10],g=s[11],m=s[12],_=s[13],v=s[14],b=s[15];e.planes[0].set(a-r,c-l,g-u,b-m),e.planes[1].set(a+r,c+l,g+u,b+m),e.planes[2].set(a-o,c-A,g-p,b-_),e.planes[3].set(a+o,c+A,g+p,b+_),e.planes[4].set(a-n,c-h,g-f,b-v),e.planes[5].set(a+n,c+h,g+f,b+v)}function V(e,t){let i=N.INSIDE;const s=L,r=U;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];const o=[s,r];for(let t=0;t<6;++t){const s=e.planes[t];if(s.normal[0]*o[s.testVertex[0]][0]+s.normal[1]*o[s.testVertex[1]][1]+s.normal[2]*o[s.testVertex[2]][2]+s.offset<0)return N.OUTSIDE;s.normal[0]*o[1-s.testVertex[0]][0]+s.normal[1]*o[1-s.testVertex[1]][1]+s.normal[2]*o[1-s.testVertex[2]][2]+s.offset<0&&(i=N.INTERSECT)}return i}N.INSIDE=0,N.INTERSECT=1,N.OUTSIDE=2;class H extends R{constructor(e={}){if(!e.viewer)throw"[MarqueePicker] Missing config: viewer";if(!e.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";super(e.viewer.scene,e),this.viewer=e.viewer,this._objectsKdTree3=e.objectsKdTree3,this._canvasMarqueeCorner1=d.vec2(),this._canvasMarqueeCorner2=d.vec2(),this._canvasMarquee=d.AABB2(),this._marqueeFrustum=new N,this._marqueeFrustumProjMat=d.mat4(),this._pickMode=!1,this._marqueeElement=document.createElement("div"),document.body.appendChild(this._marqueeElement),this._marqueeElement.style.position="absolute",this._marqueeElement.style["z-index"]="40000005",this._marqueeElement.style.width="8px",this._marqueeElement.style.height="8px",this._marqueeElement.style.visibility="hidden",this._marqueeElement.style.top="0px",this._marqueeElement.style.left="0px",this._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",this._marqueeElement.style.opacity=1,this._marqueeElement.style["pointer-events"]="none"}setMarqueeCorner1(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarqueeCorner2(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarquee(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}setMarqueeVisible(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}getMarqueeVisible(){return this._marqueVisible}setPickMode(e){if(e!==H.PICK_MODE_INSIDE&&e!==H.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===H.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}getPickMode(){return this._pickMode}clear(){this.fire("clear",{})}pick(){this._updateMarquee(),this._buildMarqueeFrustum();const e=[],t=(i,s=N.INTERSECT)=>{if(s===N.INTERSECT&&(s=V(this._marqueeFrustum,i.aabb)),s!==N.OUTSIDE){if(i.entities){const t=i.entities;for(let i=0,s=t.length;i3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&t(this._objectsKdTree3.root),this.fire("picked",e),e}_updateMarquee(){this._canvasMarquee[0]=Math.min(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[1]=Math.min(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._canvasMarquee[2]=Math.max(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[3]=Math.max(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._marqueeElement.style.width=this._canvasMarquee[2]-this._canvasMarquee[0]+"px",this._marqueeElement.style.height=this._canvasMarquee[3]-this._canvasMarquee[1]+"px",this._marqueeElement.style.left=`${this._canvasMarquee[0]}px`,this._marqueeElement.style.top=`${this._canvasMarquee[1]}px`}_buildMarqueeFrustum(){const e=this.viewer.scene.canvas.canvas,t=e.clientWidth,i=e.clientHeight,s=e.clientLeft,r=e.clientTop,o=2/t,n=2/i,a=e.clientHeight/e.clientWidth,l=(this._canvasMarquee[0]-s)*o-1,A=(this._canvasMarquee[2]-s)*o-1,h=-(this._canvasMarquee[3]-r)*n+1,c=-(this._canvasMarquee[1]-r)*n+1,u=this.viewer.scene.camera.frustum.near*(17*a);d.frustumMat4(l,A,h*a,c*a,u,1e4,this._marqueeFrustumProjMat),Q(this._marqueeFrustum,this.viewer.scene.camera.viewMatrix,this._marqueeFrustumProjMat)}destroy(){super.destroy(),this._marqueeElement.parentElement&&(this._marqueeElement.parentElement.removeChild(this._marqueeElement),this._marqueeElement=null,this._objectsKdTree3=null)}}H.PICK_MODE_INTERSECTS=0,H.PICK_MODE_INSIDE=1;class j extends R{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{if(!this._running)return;i||(i=e);const r=e-i,o=Math.min(r/300,1),n=t+(2-t)*o;this._circleRadius=n,this._circleDiv.style.width=`${this._circleRadius}px`,this._circleDiv.style.height=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius/2+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius/2+"px",o<1&&requestAnimationFrame(s)};this._running=!0,requestAnimationFrame(s),this._circleDiv.style.visibility="visible"}stop(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.visibility="hidden")}set durationMs(e){this.stop(),this._durationMs=e}get durationMs(){return this._durationMs}destroy(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}class z{constructor(e,t,i){this.id=i&&i.id?i.id:e,this.viewer=t,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,t.addPlugin(this)}scheduleTask(e){I.scheduleTask(e,null)}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){console.log(`[xeokit plugin ${this.id}]: ${e}`)}warn(e){console.warn(`[xeokit plugin ${this.id}]: ${e}`)}error(e){console.error(`[xeokit plugin ${this.id}]: ${e}`)}send(e,t){}destroy(){this.viewer.removePlugin(this)}}const W=d.vec3(),K=function(){const e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,o){return o=o||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,d.transformVec4(s,t,i),d.setMat4Translation(s,i,o),o.slice()}}();function X(e,t,i){const s=Float32Array.from([e[0]])[0],r=e[0]-s,o=Float32Array.from([e[1]])[0],n=e[1]-o,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=o,t[2]=a,i[0]=r,i[1]=n,i[2]=l}function J(e,t,i,s=1e3){const r=d.getPositionsCenter(e,W),o=Math.round(r[0]/s)*s,n=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=o,i[1]=n,i[2]=a;const l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(let i=0,s=e.length;i0?this.meshes[0]._colorize[3]/255:1}set opacity(e){if(0===this.meshes.length)return;const t=null!=e,i=this.meshes[0]._colorize[3];let s=255;if(t){if(e<0?e=0:e>1&&(e=1),s=Math.floor(255*e),i===s)return}else if(s=255,i===s)return;for(let e=0,t=this.meshes.length;e{this._viewPosDirty=!0,this._needUpdate()})),this._onCameraProjMatrix=this.scene.camera.on("projMatrix",(()=>{this._canvasPosDirty=!0,this._needUpdate()})),this._onEntityDestroyed=null,this._onEntityModelDestroyed=null,this._renderer.addMarker(this),this.entity=t.entity,this.worldPos=t.worldPos,this.occludable=t.occludable}_update(){if(this._viewPosDirty&&(d.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos),this._viewPosDirty=!1,this._canvasPosDirty=!0,this.fire("viewPos",this._viewPos)),this._canvasPosDirty){he.set(this._viewPos),he[3]=1,d.transformPoint4(this.scene.camera.projMatrix,he,ce);const e=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+ce[0]/ce[3])*e[2]/2),this._canvasPos[1]=Math.floor((1-ce[1]/ce[3])*e[3]/2),this._canvasPosDirty=!1,this.fire("canvasPos",this._canvasPos)}}_setVisible(e){this._visible,this._visible=e,this.fire("visible",this._visible)}set entity(e){if(this._entity){if(this._entity===e)return;null!==this._onEntityDestroyed&&(this._entity.off(this._onEntityDestroyed),this._onEntityDestroyed=null),null!==this._onEntityModelDestroyed&&(this._entity.model.off(this._onEntityModelDestroyed),this._onEntityModelDestroyed=null)}this._entity=e,this._entity&&(this._entity instanceof Ae?this._onEntityModelDestroyed=this._entity.model.on("destroyed",(()=>{this._entity=null,this._onEntityModelDestroyed=null})):this._onEntityDestroyed=this._entity.on("destroyed",(()=>{this._entity=null,this._onEntityDestroyed=null}))),this.fire("entity",this._entity,!0)}get entity(){return this._entity}set occludable(e){(e=!!e)!==this._occludable&&(this._occludable=e)}get occludable(){return this._occludable}set worldPos(e){this._worldPos.set(e||[0,0,0]),X(this._worldPos,this._origin,this._rtcPos),this._occludable&&this._renderer.markerWorldPosUpdated(this),this._viewPosDirty=!0,this.fire("worldPos",this._worldPos),this._needUpdate()}get worldPos(){return this._worldPos}get origin(){return this._origin}get rtcPos(){return this._rtcPos}get viewPos(){return this._update(),this._viewPos}get canvasPos(){return this._update(),this._canvasPos}get visible(){return!!this._visible}destroy(){this.fire("destroyed",!0),this.scene.camera.off(this._onCameraViewMatrix),this.scene.camera.off(this._onCameraProjMatrix),this._entity&&(null!==this._onEntityDestroyed&&this._entity.off(this._onEntityDestroyed),null!==this._onEntityModelDestroyed&&this._entity.model.off(this._onEntityModelDestroyed)),this._renderer.removeMarker(this),super.destroy()}}class de{constructor(e,t={}){this._color=t.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=t.thickness||1,this._thicknessClickable=t.thicknessClickable||6,this._visible=!0,this._culled=!1;var i=this._wire,s=i.style;s.border="solid "+this._thickness+"px "+this._color,s.position="absolute",s["z-index"]=void 0===t.zIndex?"2000001":t.zIndex,s.width="0px",s.height="0px",s.visibility="visible",s.top="0px",s.left="0px",s["-webkit-transform-origin"]="0 0",s["-moz-transform-origin"]="0 0",s["-ms-transform-origin"]="0 0",s["-o-transform-origin"]="0 0",s["transform-origin"]="0 0",s["-webkit-transform"]="rotate(0deg)",s["-moz-transform"]="rotate(0deg)",s["-ms-transform"]="rotate(0deg)",s["-o-transform"]="rotate(0deg)",s.transform="rotate(0deg)",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._wireClickable,o=r.style;o.border="solid "+this._thicknessClickable+"px "+this._color,o.position="absolute",o["z-index"]=void 0===t.zIndex?"2000002":t.zIndex+1,o.width="0px",o.height="0px",o.visibility="visible",o.top="0px",o.left="0px",o["-webkit-transform-origin"]="0 0",o["-moz-transform-origin"]="0 0",o["-ms-transform-origin"]="0 0",o["-o-transform-origin"]="0 0",o["transform-origin"]="0 0",o["-webkit-transform"]="rotate(0deg)",o["-moz-transform"]="rotate(0deg)",o["-ms-transform"]="rotate(0deg)",o["-o-transform"]="rotate(0deg)",o.transform="rotate(0deg)",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),t.onMouseOver&&r.addEventListener("mouseover",(e=>{t.onMouseOver(e,this)})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}get visible(){return"visible"===this._wire.style.visibility}_update(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}setStartAndEnd(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}setColor(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}setOpacity(e){this._wire.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}destroy(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}class pe{constructor(e,t={}){this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!t.visible,this._culled=!1;var i=this._dot,s=i.style;s["border-radius"]="25px",s.border="solid 2px white",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"40000005":t.zIndex,s.width="8px",s.height="8px",s.visibility=!1!==t.visible?"visible":"hidden",s.top="0px",s.left="0px",s["box-shadow"]="0 2px 5px 0 #182A3D;",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._dotClickable,o=r.style;o["border-radius"]="35px",o.border="solid 10px white",o.position="absolute",o["z-index"]=void 0===t.zIndex?"40000007":t.zIndex+1,o.width="8px",o.height="8px",o.visibility="visible",o.top="0px",o.left="0px",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),r.addEventListener("click",(t=>{e.dispatchEvent(new MouseEvent("mouseover",t))})),t.onMouseOver&&r.addEventListener("mouseover",(i=>{t.onMouseOver(i,this),e.dispatchEvent(new MouseEvent("mouseover",i))})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.borderColor)}setPos(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}setFillColor(e){this._dot.style.background=e||"lightgreen"}setBorderColor(e){this._dot.style.border="solid 2px"+(e||"black")}setOpacity(e){this._dot.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}destroy(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}class fe{constructor(e,t={}){this._highlightClass="viewer-ruler-label-highlighted",this._prefix=t.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var i=this._label,s=i.style;s["border-radius"]="5px",s.color="white",s.padding="4px",s.border="solid 1px",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"5000005":t.zIndex,s.width="auto",s.height="auto",s.visibility="visible",s.top="0px",s.left="0px",s["pointer-events"]="all",s.opacity=1,t.onContextMenu,i.innerText="",e.appendChild(i),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.fillColor),this.setText(t.text),t.onMouseOver&&i.addEventListener("mouseover",(e=>{t.onMouseOver(e,this),e.preventDefault()})),t.onMouseLeave&&i.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this),e.preventDefault()})),t.onMouseWheel&&i.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&i.addEventListener("mousedown",(e=>{t.onMouseDown(e,this),e.stopPropagation()})),t.onMouseUp&&i.addEventListener("mouseup",(e=>{t.onMouseUp(e,this),e.stopPropagation()})),t.onMouseMove&&i.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&i.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}setPos(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}setPosOnWire(e,t,i,s){var r=e+.5*(i-e),o=t+.5*(s-t),n=this._label.style;n.left=Math.round(r)-20+"px",n.top=Math.round(o)-12+"px"}setPosBetweenWires(e,t,i,s,r,o){var n=(e+i+r)/3,a=(t+s+o)/3,l=this._label.style;l.left=Math.round(n)-20+"px",l.top=Math.round(a)-12+"px"}setText(e){this._label.innerHTML=this._prefix+(e||"")}setFillColor(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}setBorderColor(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}setOpacity(e){this._label.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}setClickable(e){this._label.style["pointer-events"]=e?"all":"none"}destroy(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}var ge=d.vec3(),me=d.vec3();class _e extends R{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._color=t.color||e.defaultColor;var i=this.plugin.viewer.scene;this._originMarker=new ue(i,t.origin),this._cornerMarker=new ue(i,t.corner),this._targetMarker=new ue(i,t.target),this._originWorld=d.vec3(),this._cornerWorld=d.vec3(),this._targetWorld=d.vec3(),this._wp=new Float64Array(12),this._vp=new Float64Array(12),this._pp=new Float64Array(12),this._cp=new Int16Array(6);const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},l=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};this._originDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._cornerDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._originWire=new de(this._container,{color:this._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetWire=new de(this._container,{color:this._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._angleLabel=new fe(this._container,{fillColor:this._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._visible=!1,this._originVisible=!1,this._cornerVisible=!1,this._targetVisible=!1,this._originWireVisible=!1,this._targetWireVisible=!1,this._angleVisible=!1,this._labelsVisible=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._cornerMarker.on("worldPos",(e=>{this._cornerWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.cornerVisible=t.cornerVisible,this.targetVisible=t.targetVisible,this.originWireVisible=t.originWireVisible,this.targetWireVisible=t.targetWireVisible,this.angleVisible=t.angleVisible,this.labelsVisible=t.labelsVisible}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(d.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){const u=-.3,p=this._originMarker.viewPos[2],f=this._cornerMarker.viewPos[2],g=this._targetMarker.viewPos[2];if(p>u||f>u||g>u)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);d.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var t=this._pp,i=this._cp,s=e.canvas.canvas.getBoundingClientRect();const m=this._container.getBoundingClientRect();for(var r=s.top-m.top,o=s.left-m.left,n=e.canvas.boundary,a=n[2],l=n[3],A=0,h=0,c=t.length;he.offsetTop+(e.offsetParent&&e.offsetParent!==t.parentNode&&h(e.offsetParent)),c=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==t.parentNode&&c(e.offsetParent)),u=d.vec2();this._onMouseHoverSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{e.snappedToVertex||e.snappedToEdge?(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!0),this.markerDiv.style.background="greenyellow",this.markerDiv.style.border="2px solid green"):(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.canvasPos,s.snapped=!1),this.markerDiv.style.background="pink",this.markerDiv.style.border="2px solid red");const i=e.snappedCanvasPos||e.canvasPos;switch(r=!0,o=e.entity,l.set(e.worldPos),A.set(i),this._mouseState){case 0:this._canvasToPagePos?(this._canvasToPagePos(t,i,u),this.markerDiv.style.left=u[0]-5+"px",this.markerDiv.style.top=u[1]-5+"px"):(this.markerDiv.style.left=c(t)+i[0]-5+"px",this.markerDiv.style.top=h(t)+i[1]-5+"px");break;case 1:this._currentAngleMeasurement&&(this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.angleVisible=!1,this._currentAngleMeasurement.corner.worldPos=e.worldPos,this._currentAngleMeasurement.corner.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer";break;case 2:this._currentAngleMeasurement&&(this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.angleVisible=!0,this._currentAngleMeasurement.target.worldPos=e.worldPos,this._currentAngleMeasurement.target.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer"}})),t.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(n=e.clientX,a=e.clientY)}),t.addEventListener("mouseup",this._onMouseUp=e=>{if(1===e.which&&!(e.clientX>n+20||e.clientXa+20||e.clientY{if(r=!1,s&&(s.visible=!0,s.pointerPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!1),this.markerDiv.style.left="-100px",this.markerDiv.style.top="-100px",this._currentAngleMeasurement){switch(this._mouseState){case 0:this._currentAngleMeasurement.originVisible=!1;break;case 1:this._currentAngleMeasurement.cornerVisible=!1,this._currentAngleMeasurement.originWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1;break;case 2:this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1}t.style.cursor="default"}})),this._active=!0}deactivate(){if(!this._active)return;this.pointerLens&&(this.pointerLens.visible=!1),this.markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.angleMeasurementsPlugin.viewer.cameraControl;t.off(this._onMouseHoverSurface),t.off(this._onPickedSurface),t.off(this._onHoverNothing),t.off(this._onPickedNothing),this._currentAngleMeasurement=null,this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),this._mouseState=0)}destroy(){this.deactivate(),super.destroy()}}class ye extends z{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new be(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new _e(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},c=()=>{this.plugin.viewer.cameraControl.active=!0},u=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),c(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const c=i.touches[0],p=c.clientX,f=c.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void u();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],u=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([u,p]),this._touchState){case 1:{if(1!==s||u>n[0]+r||un[1]+r||pn[0]+r||un[1]+r||pn[0]+r||un[1]+r||p{this.plugin.fire("markerClicked",this)}),this._marker.addEventListener("mouseenter",this._onMouseEnterExternalMarker=()=>{this.plugin.fire("markerMouseEnter",this)}),this._marker.addEventListener("mouseleave",this._onMouseLeaveExternalMarker=()=>{this.plugin.fire("markerMouseLeave",this)}),this._markerExternal=!0):(this._markerHTML=t.markerHTML,this._htmlDirty=!0,this._markerExternal=!1),t.labelElement?(this._label=t.labelElement,this._labelExternal=!0):(this._labelHTML=t.labelHTML,this._htmlDirty=!0,this._labelExternal=!1),this._markerShown=!!t.markerShown,this._labelShown=!!t.labelShown,this._values=t.values||{},this._layoutDirty=!0,this._visibilityDirty=!0,this._buildHTML(),this._onTick=this.scene.on("tick",(()=>{this._htmlDirty&&(this._buildHTML(),this._htmlDirty=!1,this._layoutDirty=!0,this._visibilityDirty=!0),(this._layoutDirty||this._visibilityDirty)&&(this._markerShown||this._labelShown)&&(this._updatePosition(),this._layoutDirty=!1),this._visibilityDirty&&(this._marker.style.visibility=this.visible&&this._markerShown?"visible":"hidden",this._label.style.visibility=this.visible&&this._markerShown&&this._labelShown?"visible":"hidden",this._visibilityDirty=!1)})),this.on("canvasPos",(()=>{this._layoutDirty=!0})),this.on("visible",(()=>{this._visibilityDirty=!0})),this.setMarkerShown(!1!==t.markerShown),this.setLabelShown(t.labelShown),this.eye=t.eye?t.eye.slice():null,this.look=t.look?t.look.slice():null,this.up=t.up?t.up.slice():null,this.projection=t.projection}_buildHTML(){if(!this._markerExternal){this._marker&&(this._container.removeChild(this._marker),this._marker=null);let e=this._markerHTML||"

";y.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._marker=t.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(()=>{this.plugin.fire("markerClicked",this)})),this._marker.addEventListener("mouseenter",(()=>{this.plugin.fire("markerMouseEnter",this)})),this._marker.addEventListener("mouseleave",(()=>{this.plugin.fire("markerMouseLeave",this)})),this._marker.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);let e=this._labelHTML||"

";y.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._label=t.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}}_updatePosition(){const e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}_renderTemplate(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){const i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}setMarkerShown(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}getMarkerShown(){return this._markerShown}setLabelShown(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}getLabelShown(){return this._labelShown}setField(e,t){this._values[e]=t||"",this._htmlDirty=!0}getField(e){return this._values[e]}setValues(e){for(var t in e)if(e.hasOwnProperty(t)){const i=e[t];this.setField(t,i)}}getValues(){return this._values}destroy(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),super.destroy()}}const xe=d.vec3(),Pe=d.vec3(),Ce=d.vec3();class Me extends z{constructor(e,t){super("Annotations",e),this._labelHTML=t.labelHTML||"
",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){var t,i;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){const s=e.pickResult;if(s.worldPos&&s.worldNormal){const e=d.normalizeVec3(s.worldNormal,xe),r=d.mulVec3Scalar(e,this._surfaceOffset,Pe);t=d.addVec3(s.worldPos,r,Ce),i=s.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var s=null;e.markerElementId&&((s=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var r=null;e.labelElementId&&((r=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const o=new we(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:s,labelElement:r,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:y.apply(e.values,y.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[o.id]=o,o.on("destroyed",(()=>{delete this.annotations[o.id],this.fire("annotationDestroyed",o.id)})),this.fire("annotationCreated",o.id),o}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;t
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}_injectDefaultCSS(){const e="xeokit-spinner-css";if(document.getElementById(e))return;const t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}_adjustPosition(){if(this._isCustom)return;const e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}set processes(e){if(e=e||0,this._processes===e)return;if(e<0)return;const t=this._processes;this._processes=e;const i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}get processes(){return this._processes}_destroy(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);const e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}const Ee=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];class Ie extends R{constructor(e,t={}){super(e,t),this._backgroundColor=d.vec3([t.backgroundColor?t.backgroundColor[0]:1,t.backgroundColor?t.backgroundColor[1]:1,t.backgroundColor?t.backgroundColor[2]:1]),this._backgroundColorFromAmbientLight=!!t.backgroundColorFromAmbientLight,this.canvas=t.canvas,this.gl=null,this.webgl2=!1,this.transparent=!!t.transparent,this.contextAttr=t.contextAttr||{},this.contextAttr.alpha=this.transparent,this.contextAttr.preserveDrawingBuffer=!!this.contextAttr.preserveDrawingBuffer,this.contextAttr.stencil=!1,this.contextAttr.premultipliedAlpha=!!this.contextAttr.premultipliedAlpha,this.contextAttr.antialias=!1!==this.contextAttr.antialias,this.resolutionScale=t.resolutionScale,this.canvas.width=Math.round(this.canvas.clientWidth*this._resolutionScale),this.canvas.height=Math.round(this.canvas.clientHeight*this._resolutionScale),this.boundary=[this.canvas.offsetLeft,this.canvas.offsetTop,this.canvas.clientWidth,this.canvas.clientHeight],this._initWebGL(t);const i=this;this.canvas.addEventListener("webglcontextlost",this._webglcontextlostListener=function(e){console.time("webglcontextrestored"),i.scene._webglContextLost(),i.fire("webglcontextlost"),e.preventDefault()},!1),this.canvas.addEventListener("webglcontextrestored",this._webglcontextrestoredListener=function(e){i._initWebGL(),i.gl&&(i.scene._webglContextRestored(i.gl),i.fire("webglcontextrestored",i.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);let s=!0;new ResizeObserver((e=>{for(const t of e)t.contentBoxSize&&(s=!0)})).observe(this.canvas),this._tick=this.scene.on("tick",(()=>{s&&(s=!1,i.canvas.width=Math.round(i.canvas.clientWidth*i._resolutionScale),i.canvas.height=Math.round(i.canvas.clientHeight*i._resolutionScale),i.boundary[0]=i.canvas.offsetLeft,i.boundary[1]=i.canvas.offsetTop,i.boundary[2]=i.canvas.clientWidth,i.boundary[3]=i.canvas.clientHeight,i.fire("boundary",i.boundary))})),this._spinner=new Fe(this.scene,{canvas:this.canvas,elementId:t.spinnerElementId})}get type(){return"Canvas"}get backgroundColorFromAmbientLight(){return this._backgroundColorFromAmbientLight}set backgroundColorFromAmbientLight(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}get resolutionScale(){return this._resolutionScale}set resolutionScale(e){if((e=e||1)===this._resolutionScale)return;this._resolutionScale=e;const t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}get spinner(){return this._spinner}_createCanvas(){const e="xeokit-canvas-"+d.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}_getElementXY(e){let t=0,i=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}_initWebGL(){if(!this.gl)for(let e=0;!this.gl&&e0?Se.FS_MAX_FLOAT_PRECISION="highp":e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?Se.FS_MAX_FLOAT_PRECISION="mediump":Se.FS_MAX_FLOAT_PRECISION="lowp":Se.FS_MAX_FLOAT_PRECISION="mediump",Se.DEPTH_BUFFER_BITS=e.getParameter(e.DEPTH_BITS),Se.MAX_TEXTURE_SIZE=e.getParameter(e.MAX_TEXTURE_SIZE),Se.MAX_CUBE_MAP_SIZE=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),Se.MAX_RENDERBUFFER_SIZE=e.getParameter(e.MAX_RENDERBUFFER_SIZE),Se.MAX_TEXTURE_UNITS=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),Se.MAX_TEXTURE_IMAGE_UNITS=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Se.MAX_VERTEX_ATTRIBS=e.getParameter(e.MAX_VERTEX_ATTRIBS),Se.MAX_VERTEX_UNIFORM_VECTORS=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),Se.MAX_FRAGMENT_UNIFORM_VECTORS=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),Se.MAX_VARYING_VECTORS=e.getParameter(e.MAX_VARYING_VECTORS),e.getSupportedExtensions().forEach((function(e){Se.SUPPORTED_EXTENSIONS[e]=!0})))}class Re{constructor(){this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}get canvasPos(){return this._gotCanvasPos?this._canvasPos:null}set canvasPos(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}get origin(){return this._gotOrigin?this._origin:null}set origin(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}get direction(){return this._gotDirection?this._direction:null}set direction(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}get indices(){return this.entity&&this._gotIndices?this._indices:null}set indices(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}get localPos(){return this.entity&&this._gotLocalPos?this._localPos:null}set localPos(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}get snappedCanvasPos(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null}set snappedCanvasPos(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}get worldPos(){return this._gotWorldPos?this._worldPos:null}set worldPos(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}get viewPos(){return this.entity&&this._gotViewPos?this._viewPos:null}set viewPos(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}get bary(){return this.entity&&this._gotBary?this._bary:null}set bary(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}get worldNormal(){return this.entity&&this._gotWorldNormal?this._worldNormal:null}set worldNormal(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}get uv(){return this.entity&&this._gotUV?this._uv:null}set uv(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}get snapped(){return this.snappedToEdge||this.snappedToVertex}reset(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}class Le{constructor(e,t,i){if(this.allocated=!1,this.compiled=!1,this.handle=e.createShader(t),this.handle){if(this.allocated=!0,e.shaderSource(this.handle,i),e.compileShader(this.handle),this.compiled=e.getShaderParameter(this.handle,e.COMPILE_STATUS),!this.compiled&&!e.isContextLost()){const t=i.split("\n"),s=[];for(let e=0;e0&&"/"===i.charAt(s+1)&&(i=i.substring(0,s)),t.push(i);return t.join("\n")}function Qe(e){console.error(e.join("\n"))}class Ve{constructor(e,t){this.id=Oe.addItem({}),this.source=t,this.init(e)}init(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new Le(e,e.VERTEX_SHADER,Ne(this.source.vertex)),this._fragmentShader=new Le(e,e.FRAGMENT_SHADER,Ne(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Qe(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Qe(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Qe(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Qe(this.errors);let t,i,s,r,o;if(this.compiled=!0,this.handle=e.createProgram(),!this.handle)return void(this.errors=["Failed to allocate program"]);if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Qe(this.errors);const n=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}setData(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}bind(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}unbind(){this.allocated&&this._gl.bindBuffer(this.type,null)}destroy(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}class je{constructor(e,t){this.scene=e,this.aabb=d.AABB3(),this.origin=d.vec3(t),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}addMarker(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}markerWorldPosUpdated(e){if(!this.markers[e.id])return;const t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}removeMarker(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}update(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}_buildMarkerList(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}_buildPositions(){let e=0;for(let t=0;t-t){i._setVisible(!1);continue}const n=i.canvasPos,a=n[0],l=n[1];a+10<0||l+10<0||a-10>s||l-10>r?i._setVisible(!1):!i.entity||i.entity.visible?i.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=i,this.pixels[o++]=a,this.pixels[o++]=l):i._setVisible(!0):i._setVisible(!1)}}_updateActiveSectionPlanes(){const e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(let i=0;i{this._occlusionTestListDirty=!0})),this._onCameraProjMatrix=e.camera.on("projMatrix",(()=>{this._occlusionTestListDirty=!0})),this._onCanvasBoundary=e.canvas.on("boundary",(()=>{this._occlusionTestListDirty=!0}))}addMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i||(i=new je(this._scene,e.origin),this._occlusionLayers[i.originHash]=i,this._occlusionLayersListDirty=!0),i.addMarker(e),this._markersToOcclusionLayersMap[e.id]=i,this._occlusionTestListDirty=!0}markerWorldPosUpdated(e){const t=this._markersToOcclusionLayersMap[e.id];if(!t)return void e.error("Marker has not been added to OcclusionTester");const i=e.origin.join();if(i!==t.originHash){1===t.numMarkers?(t.destroy(),delete this._occlusionLayers[t.originHash],this._occlusionLayersListDirty=!0):t.removeMarker(e);let s=this._occlusionLayers[i];s||(s=new je(this._scene,e.origin),this._occlusionLayers[i]=t,this._occlusionLayersListDirty=!0),s.addMarker(e),this._markersToOcclusionLayersMap[e.id]=s}else t.markerWorldPosUpdated(e)}removeMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i&&(1===i.numMarkers?(i.destroy(),delete this._occlusionLayers[i.originHash],this._occlusionLayersListDirty=!0):i.removeMarker(e),delete this._markersToOcclusionLayersMap[e.id])}get needOcclusionTest(){return this._occlusionTestListDirty}bindRenderBuf(){const e=[this._scene.canvas.canvas.id,this._scene._sectionPlanesState.getHash()].join(";");if(e!==this._shaderSourceHash&&(this._shaderSourceHash=e,this._shaderSourceDirty=!0),this._shaderSourceDirty&&(this._buildShaderSource(),this._shaderSourceDirty=!1,this._programDirty=!0),this._programDirty&&(this._buildProgram(),this._programDirty=!1,this._occlusionTestListDirty=!0),this._occlusionLayersListDirty&&(this._buildOcclusionLayersList(),this._occlusionLayersListDirty=!1),this._occlusionTestListDirty){for(let e=0,t=this._occlusionLayersList.length;e0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}_buildFragmentShaderSource(){const e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}_buildProgram(){this._program&&this._program.destroy();const e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new Ve(t,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,t=i.sectionPlanes.length;e0){const e=s.sectionPlanes;for(let s=0;s{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=d.mat4();return()=>(e&&d.inverseMat4(s.camera.projMatrix,t),t)})());const t=this._scene.canvas.gl,i=this._program,s=this._scene,r=s.sao,o=t.drawingBufferWidth,n=t.drawingBufferHeight,a=s.camera.project._state,l=a.near,A=a.far,h=a.matrix,c=this._getInverseProjectMat(),u=Math.random(),p="perspective"===s.camera.projection;Ke[0]=o,Ke[1]=n,t.viewport(0,0,o,n),t.clearColor(0,0,0,1),t.disable(t.DEPTH_TEST),t.disable(t.BLEND),t.frontFace(t.CCW),t.clear(t.COLOR_BUFFER_BIT),i.bind(),t.uniform1f(this._uCameraNear,l),t.uniform1f(this._uCameraFar,A),t.uniformMatrix4fv(this._uCameraProjectionMatrix,!1,h),t.uniformMatrix4fv(this._uCameraInverseProjectionMatrix,!1,c),t.uniform1i(this._uPerspective,p),t.uniform1f(this._uScale,r.scale*(A/5)),t.uniform1f(this._uIntensity,r.intensity),t.uniform1f(this._uBias,r.bias),t.uniform1f(this._uKernelRadius,r.kernelRadius),t.uniform1f(this._uMinResolution,r.minResolution),t.uniform2fv(this._uViewport,Ke),t.uniform1f(this._uRandomSeed,u);const f=e.getDepthTexture();i.bindTexture(this._uDepthTexture,f,0),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),t.drawElements(t.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}_build(){let e=!1;const t=this._scene.sao;if(t.numSamples!==this._numSamples&&(this._numSamples=Math.floor(t.numSamples),e=!0),!e)return;const i=this._scene.canvas.gl;if(this._program&&(this._program.destroy(),this._program=null),this._program=new Ve(i,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV; \n \n out vec2 vUV;\n \n void main () {\n gl_Position = vec4(aPosition, 1.0);\n vUV = aUV;\n }"],fragment:[`#version 300 es \n precision highp float;\n precision highp int; \n \n #define NORMAL_TEXTURE 0\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n #define NUM_SAMPLES ${this._numSamples}\n #define NUM_RINGS 4 \n \n in vec2 vUV;\n \n uniform sampler2D uDepthTexture;\n \n uniform float uCameraNear;\n uniform float uCameraFar;\n uniform mat4 uProjectMatrix;\n uniform mat4 uInverseProjectMatrix;\n \n uniform bool uPerspective;\n\n uniform float uScale;\n uniform float uIntensity;\n uniform float uBias;\n uniform float uKernelRadius;\n uniform float uMinResolution;\n uniform vec2 uViewport;\n uniform float uRandomSeed;\n\n float pow2( const in float x ) { return x*x; }\n \n highp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n }\n\n vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n }\n\n vec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n }\n\n const float packUpscale = 256. / 255.;\n const float unpackDownScale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. ); \n\n const float shiftRights = 1. / 256.;\n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float unpackRGBAToFloat( const in vec4 v ) { \n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unPackFactors );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n }\n\n float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n }\n \n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n if (uPerspective) {\n return perspectiveDepthToViewZ( depth, uCameraNear, uCameraFar );\n } else {\n return orthographicDepthToViewZ( depth, uCameraNear, uCameraFar );\n }\n }\n\n vec3 getViewPos( const in vec2 screenPos, const in float depth, const in float viewZ ) {\n \tfloat clipW = uProjectMatrix[2][3] * viewZ + uProjectMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPos, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; \n \treturn ( uInverseProjectMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPos ) { \n return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - uBias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \n \tscaleDividedByCameraFar = uScale / uCameraFar;\n \tminResolutionMultipliedByCameraFar = uMinResolution * uCameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUV );\n\n \tfloat angle = rand( vUV + uRandomSeed ) * PI2;\n \tvec2 radius = vec2( uKernelRadius * INV_NUM_SAMPLES ) / uViewport;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUV + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }`]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),o=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new He(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new He(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new He(i,i.ELEMENT_ARRAY_BUFFER,o,o.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}destroy(){this._program&&(this._program.destroy(),this._program=null)}}const Je=new Float32Array(tt(17,[0,1])),Ye=new Float32Array(tt(17,[1,0])),Ze=new Float32Array(function(e,t){const i=[];for(let s=0;s<=e;s++)i.push(et(s,t));return i}(17,4)),qe=new Float32Array(2);class $e{constructor(e){this._scene=e,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}init(){const e=this._scene.canvas.gl;if(this._program=new Ve(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS 16\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }"]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new He(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new He(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new He(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}render(e,t,i){if(this._programError)return;this._getInverseProjectMat||(this._getInverseProjectMat=(()=>{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=d.mat4();return()=>(e&&d.inverseMat4(o.camera.projMatrix,t),t)})());const s=this._scene.canvas.gl,r=this._program,o=this._scene,n=s.drawingBufferWidth,a=s.drawingBufferHeight,l=o.camera.project._state,A=l.near,h=l.far;s.viewport(0,0,n,a),s.clearColor(0,0,0,1),s.enable(s.DEPTH_TEST),s.disable(s.BLEND),s.frontFace(s.CCW),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),r.bind(),qe[0]=n,qe[1]=a,s.uniform2fv(this._uViewport,qe),s.uniform1f(this._uCameraNear,A),s.uniform1f(this._uCameraFar,h),s.uniform1f(this._uDepthCutoff,.01),0===i?s.uniform2fv(this._uSampleOffsets,Ye):s.uniform2fv(this._uSampleOffsets,Je),s.uniform1fv(this._uSampleWeights,Ze);const c=e.getDepthTexture(),u=t.getTexture();r.bindTexture(this._uDepthTexture,c,0),r.bindTexture(this._uOcclusionTexture,u,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),s.drawElements(s.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}destroy(){this._program.destroy()}}function et(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function tt(e,t){const i=[];for(let s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}class it{constructor(e,t,i){i=i||{},this.gl=t,this.allocated=!1,this.canvas=e,this.buffer=null,this.bound=!1,this.size=i.size,this._hasDepthTexture=!!i.depthTexture}setSize(e){this.size=e}webglContextRestored(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}bind(...e){if(this._touch(...e),this.bound)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}createTexture(e,t,i=null){const s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}_touch(...e){let t,i;const s=this.gl;if(this.size?(t=this.size[0],i=this.size[1]):(t=s.drawingBufferWidth,i=s.drawingBufferHeight),this.buffer){if(this.buffer.width===t&&this.buffer.height===i)return;this.buffer.textures.forEach((e=>s.deleteTexture(e))),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}const r=[];let o;e.length>0?r.push(...e.map((e=>this.createTexture(t,i,e)))):r.push(this.createTexture(t,i)),this._hasDepthTexture&&(o=s.createTexture(),s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,t,i,0,s.DEPTH_COMPONENT,s.FLOAT,null));const n=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,n),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,t,i);const a=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,a);for(let e=0;e0&&s.drawBuffers(r.map(((e,t)=>s.COLOR_ATTACHMENT0+t))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,n),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,a),!s.isFramebuffer(a))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);const l=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(l){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+l}this.buffer={framebuf:a,renderbuf:n,texture:r[0],textures:r,depthTexture:o,width:t,height:i},this.bound=!1}clear(){if(!this.bound)throw"Render buffer not bound";const e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}read(e,t,i=null,s=null,r=Uint8Array,o=4,n=0){const a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,A=new r(o),h=this.gl;return h.readBuffer(h.COLOR_ATTACHMENT0+n),h.readPixels(a,l,1,1,i||h.RGBA,s||h.UNSIGNED_BYTE,A,0),A}readArray(e=null,t=null,i=Uint8Array,s=4,r=0){const o=new i(this.buffer.width*this.buffer.height*s),n=this.gl;return n.readBuffer(n.COLOR_ATTACHMENT0+r),n.readPixels(0,0,this.buffer.width,this.buffer.height,e||n.RGBA,t||n.UNSIGNED_BYTE,o,0),o}readImageAsCanvas(){const e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,o=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);const n=this.buffer.width,a=this.buffer.height,l=a/2|0,A=4*n,h=new Uint8Array(4*n);for(let e=0;ee.deleteTexture(t))),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}class st{constructor(e){this.scene=e,this._renderBuffersBasic={},this._renderBuffersScaled={}}getRenderBuffer(e,t){const i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled;let s=i[e];return s||(s=new it(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}destroy(){for(let e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(let e in this._renderBuffersScaled)this._renderBuffersScaled[e].destroy()}}function rt(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];let i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}const ot=function(t,i){i=i||{};const s=new De(t),r=t.canvas.canvas,o=t.canvas.gl,n=!!i.transparent,a=i.alphaDepthMask,l=new e({});let A={},h={},c=!0,u=!0,p=!0,f=!0,g=!0,_=!0,v=!0,b=!0;const y=new st(t);let B=!1;const w=new Xe(t),x=new $e(t);function P(){c&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableMap,s=t.drawableListPreCull;let r=0;for(let e in i)i.hasOwnProperty(e)&&(s[r++]=i[e]);s.length=r}}(),c=!1,u=!0),u&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),u=!1,p=!0),p&&function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableListPreCull,s=t.drawableList;let r=0;for(let e=0,t=i.length;e0)for(s.withSAO=!0,S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||j>0||O>0||N>0){if(o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):(o.blendEquation(o.FUNC_ADD),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA)),s.backfaces=!1,a||o.depthMask(!1),(O>0||N>0)&&o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),N>0)for(S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||z>0){if(s.lastProgramId=null,t.highlightMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),z>0)for(S=0;S0)for(S=0;S0||K>0||G>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.enable(o.CULL_FACE),K>0)for(S=0;S0)for(S=0;S0||J>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),J>0)for(S=0;S0)for(S=0;S0||Z>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),Z>0)for(S=0;S0)for(S=0;S0){const t=Math.floor(e/4),i=u.size[0],s=t%i-Math.floor(i/2),r=Math.floor(t/i)-Math.floor(i/2),o=Math.sqrt(Math.pow(s,2)+Math.pow(r,2));M.push({x:s,y:r,dist:o,isVertex:n&&a?_[e+3]>m.length/2:n,result:[_[e+0],_[e+1],_[e+2],_[e+3]],normal:[v[e+0],v[e+1],v[e+2],v[e+3]],id:[b[e+0],b[e+1],b[e+2],b[e+3]]})}let D=null,S=null,T=null,R=null;if(M.length>0){M.sort(((e,t)=>e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist)),R=M[0].isVertex?"vertex":"edge";const e=M[0].result,t=M[0].normal,i=M[0].id,s=m[e[3]],r=s.origin,o=s.coordinateScale;S=d.normalizeVec3([t[0]/d.MAX_INT,t[1]/d.MAX_INT,t[2]/d.MAX_INT]),D=[e[0]*o[0]+r[0],e[1]*o[1]+r[1],e[2]*o[2]+r[2]],T=l.items[i[0]+(i[1]<<8)+(i[2]<<16)+(i[3]<<24)]}if(null===B&&null==D)return null;let L=null;null!==D&&(L=t.camera.projectWorldPos(D));const U=T&&T.delegatePickedEntity?T.delegatePickedEntity():T;return h.reset(),h.snappedToEdge="edge"===R,h.snappedToVertex="vertex"===R,h.worldPos=D,h.worldNormal=S,h.entity=U,h.canvasPos=i,h.snappedCanvasPos=L||i,h}}(),this.addMarker=function(e){this._occlusionTester=this._occlusionTester||new We(t,y),this._occlusionTester.addMarker(e),t.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){P(),this._occlusionTester.bindRenderBuf(),s.reset(),s.backfaces=!0,s.frontface=!0,o.viewport(0,0,o.drawingBufferWidth,o.drawingBufferHeight),o.clearColor(0,0,0,0),o.enable(o.DEPTH_TEST),o.disable(o.CULL_FACE),o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);for(let e in A)if(A.hasOwnProperty(e)){const t=A[e].drawableList;for(let e=0,i=t.length;e{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!0:e.keyCode===this.KEY_ALT?this.altDown=!0:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!0),this.keyDown[e.keyCode]=!0,this.fire("keydown",e.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=e=>{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!1:e.keyCode===this.KEY_ALT?this.altDown=!1:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!1),this.keyDown[e.keyCode]=!1,this.fire("keyup",e.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=e=>{this.enabled&&(this.mouseover=!0,this._getMouseCanvasPos(e),this.fire("mouseenter",this.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=e=>{this.enabled&&(this.mouseover=!1,this._getMouseCanvasPos(e),this.fire("mouseleave",this.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!0;break;case 2:this.mouseDownMiddle=!0;break;case 3:this.mouseDownRight=!0}this._getMouseCanvasPos(e),this.element.focus(),this.fire("mousedown",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!1;break;case 2:this.mouseDownMiddle=!1;break;case 3:this.mouseDownRight=!1}this.fire("mouseup",this.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("click",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("dblclick",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}});const e=this.scene.tickify((()=>this.fire("mousemove",this.mouseCanvasPos,!0)));this.element.addEventListener("mousemove",this._mouseMoveListener=t=>{this.enabled&&(this._getMouseCanvasPos(t),e(),this.mouseover&&t.preventDefault())});const t=this.scene.tickify((e=>{this.fire("mousewheel",e,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=(e,i)=>{if(!this.enabled)return;const s=Math.max(-1,Math.min(1,40*-e.deltaY));t(s)},{passive:!0});{let e,t;const i=2;this.on("mousedown",(i=>{e=i[0],t=i[1]})),this.on("mouseup",(s=>{e>=s[0]-i&&e<=s[0]+i&&t>=s[1]-i&&t<=s[1]+i&&this.fire("mouseclicked",s,!0)}))}this._eventsBound=!0}_unbindEvents(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}_getMouseCanvasPos(e){if(e){let t=e.target,i=0,s=0;for(;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}setEnabled(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}getEnabled(){return this.enabled}setKeyboardEnabled(e){this.keyboardEnabled=e}getKeyboardEnabled(){return this.keyboardEnabled}destroy(){super.destroy(),this._unbindEvents()}}const at=new e({});class lt{constructor(e){this.id=at.addItem({});for(const t in e)e.hasOwnProperty(t)&&(this[t]=e[t])}destroy(){at.removeItem(this.id)}}class At extends R{get type(){return"Viewport"}constructor(e,t={}){super(e,t),this._state=new lt({boundary:[0,0,100,100]}),this.boundary=t.boundary,this.autoBoundary=t.autoBoundary}set boundary(e){if(!this._autoBoundary){if(!e){const t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}get boundary(){return this._state.boundary}set autoBoundary(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){const t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}get autoBoundary(){return this._autoBoundary}_getState(){return this._state}destroy(){super.destroy(),this._state.destroy()}}class ht extends R{get type(){return"Perspective"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this._fov=60,this._canvasResized=this.scene.canvas.on("boundary",this._needUpdate,this),this.fov=t.fov,this.fovAxis=t.fovAxis,this.near=t.near,this.far=t.far}_update(){const e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis;let s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),d.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}set fov(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}get fov(){return this._fov}set fovAxis(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}get fovAxis(){return this._fovAxis}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}class ct extends R{get type(){return"Ortho"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.scale=t.scale,this.near=t.near,this.far=t.far,this._onCanvasBoundary=this.scene.canvas.on("boundary",this._needUpdate,this)}_update(){const e=this.scene,t=.5*this._scale,i=e.canvas.boundary,s=i[2],r=i[3],o=s/r;let n,a,l,A;s>r?(n=-t,a=t,l=t/o,A=-t/o):(n=-t*o,a=t*o,l=t,A=-t),d.orthoMat4c(n,a,A,l,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set scale(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}get scale(){return this._scale}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}class ut extends R{get type(){return"Frustum"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._left=-1,this._right=1,this._bottom=-1,this._top=1,this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.left=t.left,this.right=t.right,this.bottom=t.bottom,this.top=t.top,this.near=t.near,this.far=t.far}_update(){d.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set left(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}get left(){return this._left}set right(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}get right(){return this._right}set top(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}get top(){return this._top}set bottom(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}get bottom(){return this._bottom}set near(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}get near(){return this._state.near}set far(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),super.destroy()}}class dt extends R{get type(){return"CustomProjection"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4()}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!1,this.matrix=t.matrix}set matrix(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}get matrix(){return this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy()}}const pt=d.vec3(),ft=d.vec3(),gt=d.vec3(),mt=d.vec3(),_t=d.vec3(),vt=d.vec3(),bt=d.vec4(),yt=d.vec4(),Bt=d.vec4(),wt=d.mat4(),xt=d.mat4(),Pt=d.vec3(),Ct=d.vec3(),Mt=d.vec3(),Ft=d.vec3();class Et extends R{get type(){return"Camera"}constructor(e,t={}){super(e,t),this._state=new lt({deviceMatrix:d.mat4(),hasDeviceMatrix:!1,matrix:d.mat4(),normalMatrix:d.mat4(),inverseMatrix:d.mat4()}),this._perspective=new ht(this),this._ortho=new ct(this),this._frustum=new ut(this),this._customProjection=new dt(this),this._project=this._perspective,this._eye=d.vec3([0,0,10]),this._look=d.vec3([0,0,0]),this._up=d.vec3([0,1,0]),this._worldUp=d.vec3([0,1,0]),this._worldRight=d.vec3([1,0,0]),this._worldForward=d.vec3([0,0,-1]),this.deviceMatrix=t.deviceMatrix,this.eye=t.eye,this.look=t.look,this.up=t.up,this.worldAxis=t.worldAxis,this.gimbalLock=t.gimbalLock,this.constrainPitch=t.constrainPitch,this.projection=t.projection,this._perspective.on("matrix",(()=>{"perspective"===this._projectionType&&this.fire("projMatrix",this._perspective.matrix)})),this._ortho.on("matrix",(()=>{"ortho"===this._projectionType&&this.fire("projMatrix",this._ortho.matrix)})),this._frustum.on("matrix",(()=>{"frustum"===this._projectionType&&this.fire("projMatrix",this._frustum.matrix)})),this._customProjection.on("matrix",(()=>{"customProjection"===this._projectionType&&this.fire("projMatrix",this._customProjection.matrix)}))}_update(){const e=this._state;let t;"ortho"===this.projection?(d.subVec3(this._eye,this._look,Pt),d.normalizeVec3(Pt,Ct),d.mulVec3Scalar(Ct,1e3,Mt),d.addVec3(this._look,Mt,Ft),t=Ft):t=this._eye,e.hasDeviceMatrix?(d.lookAtMat4v(t,this._look,this._up,xt),d.mulMat4(e.deviceMatrix,xt,e.matrix)):d.lookAtMat4v(t,this._look,this._up,e.matrix),d.inverseMat4(this._state.matrix,this._state.inverseMatrix),d.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}orbitYaw(e){let t=d.subVec3(this._eye,this._look,pt);d.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,wt),t=d.transformPoint3(wt,t,ft),this.eye=d.addVec3(this._look,t,gt),this.up=d.transformPoint3(wt,this._up,mt)}orbitPitch(e){if(this._constrainPitch&&(e=d.dotVec3(this._up,this._worldUp)/d.DEGTORAD)<1)return;let t=d.subVec3(this._eye,this._look,pt);const i=d.cross3Vec3(d.normalizeVec3(t,ft),d.normalizeVec3(this._up,gt));d.rotationMat4v(.0174532925*e,i,wt),t=d.transformPoint3(wt,t,mt),this.up=d.transformPoint3(wt,this._up,_t),this.eye=d.addVec3(t,this._look,vt)}yaw(e){let t=d.subVec3(this._look,this._eye,pt);d.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,wt),t=d.transformPoint3(wt,t,ft),this.look=d.addVec3(t,this._eye,gt),this._gimbalLock&&(this.up=d.transformPoint3(wt,this._up,mt))}pitch(e){if(this._constrainPitch&&(e=d.dotVec3(this._up,this._worldUp)/d.DEGTORAD)<1)return;let t=d.subVec3(this._look,this._eye,pt);const i=d.cross3Vec3(d.normalizeVec3(t,ft),d.normalizeVec3(this._up,gt));d.rotationMat4v(.0174532925*e,i,wt),this.up=d.transformPoint3(wt,this._up,vt),t=d.transformPoint3(wt,t,mt),this.look=d.addVec3(t,this._eye,_t)}pan(e){const t=d.subVec3(this._eye,this._look,pt),i=[0,0,0];let s;if(0!==e[0]){const r=d.cross3Vec3(d.normalizeVec3(t,[]),d.normalizeVec3(this._up,ft));s=d.mulVec3Scalar(r,e[0]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]}0!==e[1]&&(s=d.mulVec3Scalar(d.normalizeVec3(this._up,gt),e[1]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),0!==e[2]&&(s=d.mulVec3Scalar(d.normalizeVec3(t,mt),e[2]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),this.eye=d.addVec3(this._eye,i,_t),this.look=d.addVec3(this._look,i,vt)}zoom(e){const t=d.subVec3(this._eye,this._look,pt),i=Math.abs(d.lenVec3(t,ft)),s=Math.abs(i+e);if(s<.5)return;const r=d.normalizeVec3(t,gt);this.eye=d.addVec3(this._look,d.mulVec3Scalar(r,s),mt)}set eye(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}get eye(){return this._eye}set look(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}get look(){return this._look}set up(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}get up(){return this._up}set deviceMatrix(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}get deviceMatrix(){return this._state.deviceMatrix}set worldAxis(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=d.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}get worldAxis(){return this._worldAxis}get worldUp(){return this._worldUp}get xUp(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}get yUp(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}get zUp(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}get worldRight(){return this._worldRight}get worldForward(){return this._worldForward}set gimbalLock(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}get gimbalLock(){return this._gimbalLock}set constrainPitch(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}get eyeLookDist(){return d.lenVec3(d.subVec3(this._look,this._eye,pt))}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get viewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get normalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get viewNormalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get inverseViewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}get projMatrix(){return this[this.projection].matrix}get perspective(){return this._perspective}get ortho(){return this._ortho}get frustum(){return this._frustum}get customProjection(){return this._customProjection}set projection(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}get projection(){return this._projectionType}get project(){return this._project}projectWorldPos(e){const t=bt,i=yt,s=Bt;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,d.mulMat4v4(this.viewMatrix,t,i),d.mulMat4v4(this.projMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;const r=this.scene.canvas.canvas,o=r.offsetWidth/2,n=r.offsetHeight/2;return[s[0]*o+o,s[1]*n+n]}destroy(){super.destroy(),this._state.destroy()}}class It extends R{get type(){return"Light"}get isLight(){return!0}constructor(e,t={}){super(e,t)}}class Dt extends It{get type(){return"DirLight"}constructor(e,t={}){super(e,t),this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const i=this.scene.camera,s=this.scene.canvas;this._onCameraViewMatrix=i.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=i.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=s.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new lt({type:"dir",dir:d.vec3([1,1,1]),color:d.vec3([.7,.7,.8]),intensity:1,space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(this._shadowViewMatrixDirty){this._shadowViewMatrix||(this._shadowViewMatrix=d.identityMat4());const e=this.scene.camera,t=this._state.dir,i=e.look,s=[i[0]-t[0],i[1]-t[1],i[2]-t[2]],r=[0,1,0];d.lookAtMat4v(s,i,r,this._shadowViewMatrix),this._shadowViewMatrixDirty=!1}return this._shadowViewMatrix},getShadowProjMatrix:()=>(this._shadowProjMatrixDirty&&(this._shadowProjMatrix||(this._shadowProjMatrix=d.identityMat4()),d.orthoMat4c(-40,40,-40,40,-40,80,this._shadowProjMatrix),this._shadowProjMatrixDirty=!1),this._shadowProjMatrix),getShadowRenderBuf:()=>(this._shadowRenderBuf||(this._shadowRenderBuf=new it(this.scene.canvas.canvas,this.scene.canvas.gl,{size:[1024,1024]})),this._shadowRenderBuf)}),this.dir=t.dir,this.color=t.color,this.intensity=t.intensity,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set dir(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get dir(){return this._state.dir}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}class St extends It{get type(){return"AmbientLight"}constructor(e,t={}){super(e,t),this._state={type:"ambient",color:d.vec3([.7,.7,.7]),intensity:1},this.color=t.color,this.intensity=t.intensity,this.scene._lightCreated(this)}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}get intensity(){return this._state.intensity}destroy(){super.destroy(),this.scene._lightDestroyed(this)}}class Tt extends R{get type(){return"Geometry"}get isGeometry(){return!0}constructor(e,t={}){super(e,t),m.memory.meshes++}destroy(){super.destroy(),m.memory.meshes--}}var Rt=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}();const Lt=function(){const e=d.mat4(),t=d.mat4();return function(i,s){s=s||d.mat4();const r=i[0],o=i[1],n=i[2],a=i[3]-r,l=i[4]-o,A=i[5]-n,h=65535;return d.identityMat4(e),d.translationMat4v(i,e),d.identityMat4(t),d.scalingMat4v([a/h,l/h,A/h],t),d.mulMat4(e,t,s),s}}();var Ut=function(){const e=d.mat4(),t=d.mat4();return function(i,s,r){const o=new Uint16Array(i.length),n=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);let a;for(a=0;a=0?1:-1),t=(1-Math.abs(r))*(o>=0?1:-1);r=e,o=t}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*o+(o<0?-1:0))])}function Nt(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function Qt(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}const Vt={getPositionsBounds:function(e){const t=new Float32Array(3),i=new Float32Array(3);let s,r;for(s=0;s<3;s++)t[s]=Number.MAX_VALUE,i[s]=-Number.MAX_VALUE;for(s=0;sn&&(r=i,n=o),i=Ot(e,a,"floor","ceil"),s=Nt(i),o=Qt(e,a,s),o>n&&(r=i,n=o),i=Ot(e,a,"ceil","ceil"),s=Nt(i),o=Qt(e,a,s),o>n&&(r=i,n=o),t[a]=r[0],t[a+1]=r[1];return t},decompressNormals:function(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t},decompressNormal:function(e,t){let i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;const r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t}},Ht=m.memory,jt=d.AABB3();class Gt extends Tt{get type(){return"ReadableGeometry"}get isReadableGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new lt({compressGeometry:!!t.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._edgeIndicesBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._aabbDirty=!0,this._boundingSphere=!0,this._aabb=null,this._aabbDirty=!0,this._obb=null,this._obbDirty=!0;const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(this._state.compressGeometry){const e=Vt.getPositionsBounds(t.positions),s=Vt.compressPositions(t.positions,e.min,e.max);i.positions=s.quantized,i.positionsDecodeMatrix=s.decodeMatrix}else i.positions=t.positions.constructor===Float32Array?t.positions:new Float32Array(t.positions);if(t.colors&&(i.colors=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors)),t.uv)if(this._state.compressGeometry){const e=Vt.getUVBounds(t.uv),s=Vt.compressUVs(t.uv,e.min,e.max);i.uv=s.quantized,i.uvDecodeMatrix=s.decodeMatrix}else i.uv=t.uv.constructor===Float32Array?t.uv:new Float32Array(t.uv);t.normals&&(this._state.compressGeometry?i.normals=Vt.compressNormals(t.normals):i.normals=t.normals.constructor===Float32Array?t.normals:new Float32Array(t.normals)),t.indices&&(i.indices=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)),this._buildHash(),Ht.meshes++,this._buildVBOs()}_buildVBOs(){const e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Ht.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new He(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Ht.positions+=e.positionsBuf.numItems),e.normals){let i=e.compressGeometry;e.normalsBuf=new He(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Ht.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new He(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Ht.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new He(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Ht.uvs+=e.uvBuf.numItems)}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}_getPickTrianglePositions(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}_getPickTriangleColors(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}_buildEdgeIndices(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=Rt(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Ht.indices+=this._edgeIndicesBuf.numItems}_buildPickTriangleVBOs(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=d.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new He(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Ht.positions+=this._pickTrianglePositionsBuf.numItems,Ht.colors+=this._pickTriangleColorsBuf.numItems}_buildPickVertexVBOs(){}_webglContextLost(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}_webglContextRestored(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}get primitive(){return this._state.primitiveName}get compressGeometry(){return this._state.compressGeometry}get positions(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),Vt.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null}set positions(e){const t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){const i=Vt.getPositionsBounds(e),s=Vt.compressPositions(e,i.min,i.max);e=s.quantized,t.positionsDecodeMatrix=s.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}get normals(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){const e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),Vt.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}}set normals(e){if(this._state.compressGeometry)return void this.error("can't update geometry normals - quantized geometry is immutable");const t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}get uv(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),Vt.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null}set uv(e){if(this._state.compressGeometry)return void this.error("can't update geometry UVs - quantized geometry is immutable");const t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}get colors(){return this._state.colors}set colors(e){if(this._state.compressGeometry)return void this.error("can't update geometry colors - quantized geometry is immutable");const t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}get indices(){return this._state.indices}get aabb(){return this._aabbDirty&&(this._aabb||(this._aabb=d.AABB3()),d.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}get obb(){return this._obbDirty&&(this._obb||(this._obb=d.OBB3()),d.positions3ToAABB3(this._state.positions,jt,this._state.positionsDecodeMatrix),d.AABB3ToOBB3(jt,this._obb),this._obbDirty=!1),this._obb}get numTriangles(){return this._numTriangles}_setAABBDirty(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Ht.meshes--}}function zt(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return y.apply(e,{positions:[c,u,d,l,u,d,l,A,d,c,A,d,c,u,d,c,A,d,c,A,h,c,u,h,c,u,d,c,u,h,l,u,h,l,u,d,l,u,d,l,u,h,l,A,h,l,A,d,l,A,h,c,A,h,c,A,d,l,A,d,c,A,h,l,A,h,l,u,h,c,u,h],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}class Wt extends R{get type(){return"Material"}constructor(e,t={}){super(e,t),m.memory.materials++}destroy(){super.destroy(),m.memory.materials--}}const Kt={opaque:0,mask:1,blend:2},Xt=["opaque","mask","blend"];class Jt extends Wt{get type(){return"PhongMaterial"}constructor(e,t={}){super(e,t),this._state=new lt({type:"PhongMaterial",ambient:d.vec3([1,1,1]),diffuse:d.vec3([1,1,1]),specular:d.vec3([1,1,1]),emissive:d.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),this.ambient=t.ambient,this.diffuse=t.diffuse,this.specular=t.specular,this.emissive=t.emissive,this.alpha=t.alpha,this.shininess=t.shininess,this.reflectivity=t.reflectivity,this.lineWidth=t.lineWidth,this.pointSize=t.pointSize,t.ambientMap&&(this._ambientMap=this._checkComponent("Texture",t.ambientMap)),t.diffuseMap&&(this._diffuseMap=this._checkComponent("Texture",t.diffuseMap)),t.specularMap&&(this._specularMap=this._checkComponent("Texture",t.specularMap)),t.emissiveMap&&(this._emissiveMap=this._checkComponent("Texture",t.emissiveMap)),t.alphaMap&&(this._alphaMap=this._checkComponent("Texture",t.alphaMap)),t.reflectivityMap&&(this._reflectivityMap=this._checkComponent("Texture",t.reflectivityMap)),t.normalMap&&(this._normalMap=this._checkComponent("Texture",t.normalMap)),t.occlusionMap&&(this._occlusionMap=this._checkComponent("Texture",t.occlusionMap)),t.diffuseFresnel&&(this._diffuseFresnel=this._checkComponent("Fresnel",t.diffuseFresnel)),t.specularFresnel&&(this._specularFresnel=this._checkComponent("Fresnel",t.specularFresnel)),t.emissiveFresnel&&(this._emissiveFresnel=this._checkComponent("Fresnel",t.emissiveFresnel)),t.alphaFresnel&&(this._alphaFresnel=this._checkComponent("Fresnel",t.alphaFresnel)),t.reflectivityFresnel&&(this._reflectivityFresnel=this._checkComponent("Fresnel",t.reflectivityFresnel)),this.alphaMode=t.alphaMode,this.alphaCutoff=t.alphaCutoff,this.backfaces=t.backfaces,this.frontface=t.frontface,this._makeHash()}_makeHash(){const e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}set ambient(e){let t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get ambient(){return this._state.ambient}set diffuse(e){let t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get diffuse(){return this._state.diffuse}set specular(e){let t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get specular(){return this._state.specular}set emissive(e){let t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}get emissive(){return this._state.emissive}set alpha(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}get alpha(){return this._state.alpha}set shininess(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}get shininess(){return this._state.shininess}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set pointSize(e){this._state.pointSize=e||1,this.glRedraw()}get pointSize(){return this._state.pointSize}set reflectivity(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}get reflectivity(){return this._state.reflectivity}get normalMap(){return this._normalMap}get ambientMap(){return this._ambientMap}get diffuseMap(){return this._diffuseMap}get specularMap(){return this._specularMap}get emissiveMap(){return this._emissiveMap}get alphaMap(){return this._alphaMap}get reflectivityMap(){return this._reflectivityMap}get occlusionMap(){return this._occlusionMap}get diffuseFresnel(){return this._diffuseFresnel}get specularFresnel(){return this._specularFresnel}get emissiveFresnel(){return this._emissiveFresnel}get alphaFresnel(){return this._alphaFresnel}get reflectivityFresnel(){return this._reflectivityFresnel}set alphaMode(e){let t=Kt[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}get alphaMode(){return Xt[this._state.alphaMode]}set alphaCutoff(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}get alphaCutoff(){return this._state.alphaCutoff}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set frontface(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}get frontface(){return this._state.frontface?"ccw":"cw"}destroy(){super.destroy(),this._state.destroy()}}const Yt={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}};class Zt extends Wt{get type(){return"EmphasisMaterial"}get presets(){return Yt}constructor(e,t={}){super(e,t),this._state=new lt({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),this._preset="default",t.preset?(this.preset=t.preset,void 0!==t.fill&&(this.fill=t.fill),t.fillColor&&(this.fillColor=t.fillColor),void 0!==t.fillAlpha&&(this.fillAlpha=t.fillAlpha),void 0!==t.edges&&(this.edges=t.edges),t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth),void 0!==t.backfaces&&(this.backfaces=t.backfaces),void 0!==t.glowThrough&&(this.glowThrough=t.glowThrough)):(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.backfaces=t.backfaces,this.glowThrough=t.glowThrough)}set fill(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}get fill(){return this._state.fill}set fillColor(e){let t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}get fillColor(){return this._state.fillColor}set fillAlpha(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}get fillAlpha(){return this._state.fillAlpha}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set glowThrough(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}get glowThrough(){return this._state.glowThrough}set preset(e){if(e=e||"default",this._preset===e)return;const t=Yt[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Yt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const qt={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}};class $t extends Wt{get type(){return"EdgeMaterial"}get presets(){return qt}constructor(e,t={}){super(e,t),this._state=new lt({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),this._preset="default",t.preset?(this.preset=t.preset,t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth)):(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth),this.edges=!1!==t.edges}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=qt[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(qt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const ei={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}};class ti extends R{constructor(e,t={}){super(e,t),this._units="meters",this._scale=1,this._origin=d.vec3([0,0,0]),this.units=t.units,this.scale=t.scale,this.origin=t.origin}get unitsInfo(){return ei}set units(e){e||(e="meters");ei[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}get units(){return this._units}set scale(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}get scale(){return this._scale}set origin(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}get origin(){return this._origin}worldToRealPos(e,t=d.vec3(3)){t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}realToWorldPos(e,t=d.vec3(3)){return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}class ii extends R{constructor(e,t={}){super(e,t),this._supported=Se.SUPPORTED_EXTENSIONS.OES_standard_derivatives,this.enabled=t.enabled,this.kernelRadius=t.kernelRadius,this.intensity=t.intensity,this.bias=t.bias,this.scale=t.scale,this.minResolution=t.minResolution,this.numSamples=t.numSamples,this.blur=t.blur,this.blendCutoff=t.blendCutoff,this.blendFactor=t.blendFactor}get supported(){return this._supported}set enabled(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}get enabled(){return this._enabled}get possible(){if(!this._supported)return!1;if(!this._enabled)return!1;const e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}get active(){return this._active}set kernelRadius(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}get kernelRadius(){return this._kernelRadius}set intensity(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}get intensity(){return this._intensity}set bias(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}get bias(){return this._bias}set scale(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}get scale(){return this._scale}set minResolution(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}get minResolution(){return this._minResolution}set numSamples(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}get numSamples(){return this._numSamples}set blur(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}get blur(){return this._blur}set blendCutoff(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}get blendCutoff(){return this._blendCutoff}set blendFactor(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}get blendFactor(){return this._blendFactor}destroy(){super.destroy()}}class si extends R{constructor(e,t={}){super(e,t),this.sliceColor=t.sliceColor,this.sliceThickness=t.sliceThickness}set sliceThickness(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}get sliceThickness(){return this._sliceThickness}set sliceColor(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}get sliceColor(){return this._sliceColor}destroy(){super.destroy()}}const ri={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}};class oi extends Wt{get type(){return"PointsMaterial"}get presets(){return ri}constructor(e,t={}){super(e,t),this._state=new lt({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),t.preset?(this.preset=t.preset,void 0!==t.pointSize&&(this.pointSize=t.pointSize),void 0!==t.roundPoints&&(this.roundPoints=t.roundPoints),void 0!==t.perspectivePoints&&(this.perspectivePoints=t.perspectivePoints),void 0!==t.minPerspectivePointSize&&(this.minPerspectivePointSize=t.minPerspectivePointSize),void 0!==t.maxPerspectivePointSize&&(this.maxPerspectivePointSize=t.minPerspectivePointSize)):(this._preset="default",this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize),this.filterIntensity=t.filterIntensity,this.minIntensity=t.minIntensity,this.maxIntensity=t.maxIntensity}set pointSize(e){this._state.pointSize=e||2,this.glRedraw()}get pointSize(){return this._state.pointSize}set roundPoints(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}get roundPoints(){return this._state.roundPoints}set perspectivePoints(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}get perspectivePoints(){return this._state.perspectivePoints}set minPerspectivePointSize(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}get minPerspectivePointSize(){return this._state.minPerspectivePointSize}set maxPerspectivePointSize(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}get maxPerspectivePointSize(){return this._state.maxPerspectivePointSize}set filterIntensity(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}get filterIntensity(){return this._state.filterIntensity}set minIntensity(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}get minIntensity(){return this._state.minIntensity}set maxIntensity(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}get maxIntensity(){return this._state.maxIntensity}set preset(e){if(e=e||"default",this._preset===e)return;const t=ri[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(ri).join(", "))}get preset(){return this._preset}get hash(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}destroy(){super.destroy(),this._state.destroy()}}const ni={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}};class ai extends Wt{get type(){return"LinesMaterial"}get presets(){return ni}constructor(e,t={}){super(e,t),this._state=new lt({type:"LinesMaterial",lineWidth:null}),t.preset?(this.preset=t.preset,void 0!==t.lineWidth&&(this.lineWidth=t.lineWidth)):(this._preset="default",this.lineWidth=t.lineWidth)}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=ni[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(ni).join(", "))}get preset(){return this._preset}get hash(){return[""+this.lineWidth].join(";")}destroy(){super.destroy(),this._state.destroy()}}function li(e,t){const i={};let s,r;for(let o=0,n=t.length;o{this.glRedraw()})),this.canvas.on("webglContextFailed",(()=>{alert("xeokit failed to find WebGL!")})),this._renderer=new ot(this,{transparent:s,alphaDepthMask:r}),this._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;let e=null;this.getHash=function(){if(e)return e;const t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";const i=[];for(let e=0,s=t;ethis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},this._sectionPlanesState.setNumCachedSectionPlanes(t.numCachedSectionPlanes||0),this._lightsState=new function(){const e=d.vec4([0,0,0,0]),t=d.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];let i=null,s=null;this.getHash=function(){if(i)return i;const e=[],t=this.lights;let s;for(let i=0,r=t.length;i0&&e.push("/lm"),this.reflectionMaps.length>0&&e.push("/rm"),e.push(";"),i=e.join(""),i},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(let t=0,r=this.lights.length;t{this._renderer.imageDirty()}))}_initDefaults(){}_addComponent(e){if(e.id&&this.components[e.id]&&(this.error("Component "+y.inQuotes(e.id)+" already exists in Scene - ignoring ID, will randomly-generate instead"),e.id=null),!e.id)for(void 0===window.nextID&&(window.nextID=0),e.id="__"+window.nextID++;this.components[e.id];)e.id=d.createUUID();this.components[e.id]=e;const t=e.type;let i=this.types[e.type];i||(i=this.types[t]={}),i[e.id]=e,e.compile&&(this._compilables[e.id]=e),e.isDrawable&&(this._renderer.addDrawable(e.id,e),this._collidables[e.id]=e)}_removeComponent(e){var t=e.id,i=e.type;delete this.components[t];const s=this.types[i];s&&(delete s[t],y.isEmptyObject(s)&&delete this.types[i]),e.compile&&delete this._compilables[e.id],e.isDrawable&&(this._renderer.removeDrawable(e.id),delete this._collidables[e.id])}_sectionPlaneCreated(e){this.sectionPlanes[e.id]=e,this.scene._sectionPlanesState.addSectionPlane(e._state),this.scene.fire("sectionPlaneCreated",e,!0),this._needRecompile=!0}_bitmapCreated(e){this.bitmaps[e.id]=e,this.scene.fire("bitmapCreated",e,!0)}_lineSetCreated(e){this.lineSets[e.id]=e,this.scene.fire("lineSetCreated",e,!0)}_lightCreated(e){this.lights[e.id]=e,this.scene._lightsState.addLight(e._state),this._needRecompile=!0}_lightMapCreated(e){this.lightMaps[e.id]=e,this.scene._lightsState.addLightMap(e._state),this._needRecompile=!0}_reflectionMapCreated(e){this.reflectionMaps[e.id]=e,this.scene._lightsState.addReflectionMap(e._state),this._needRecompile=!0}_sectionPlaneDestroyed(e){delete this.sectionPlanes[e.id],this.scene._sectionPlanesState.removeSectionPlane(e._state),this.scene.fire("sectionPlaneDestroyed",e,!0),this._needRecompile=!0}_bitmapDestroyed(e){delete this.bitmaps[e.id],this.scene.fire("bitmapDestroyed",e,!0)}_lineSetDestroyed(e){delete this.lineSets[e.id],this.scene.fire("lineSetDestroyed",e,!0)}_lightDestroyed(e){delete this.lights[e.id],this.scene._lightsState.removeLight(e._state),this._needRecompile=!0}_lightMapDestroyed(e){delete this.lightMaps[e.id],this.scene._lightsState.removeLightMap(e._state),this._needRecompile=!0}_reflectionMapDestroyed(e){delete this.reflectionMaps[e.id],this.scene._lightsState.removeReflectionMap(e._state),this._needRecompile=!0}_registerModel(e){this.models[e.id]=e,this._modelIds=null}_deregisterModel(e){const t=e.id;delete this.models[t],this._modelIds=null,this.fire("modelUnloaded",t)}_registerObject(e){this.objects[e.id]=e,this._numObjects++,this._objectIds=null}_deregisterObject(e){delete this.objects[e.id],this._numObjects--,this._objectIds=null}_objectVisibilityUpdated(e,t=!0){e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}_deRegisterVisibleObject(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}_objectXRayedUpdated(e,t=!0){e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}_deRegisterXRayedObject(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}_objectHighlightedUpdated(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}_deRegisterHighlightedObject(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}_objectSelectedUpdated(e,t=!0){e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}_deRegisterSelectedObject(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}_objectColorizeUpdated(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}_deRegisterColorizedObject(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}_objectOpacityUpdated(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}_deRegisterOpacityObject(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}_objectOffsetUpdated(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}_deRegisterOffsetObject(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}_webglContextLost(){this.canvas.spinner.processes++;for(const e in this.components)if(this.components.hasOwnProperty(e)){const t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}_webglContextRestored(){const e=this.canvas.gl;for(const t in this.components)if(this.components.hasOwnProperty(t)){const i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}get capabilities(){return this._renderer.capabilities}get entityOffsetsEnabled(){return this._entityOffsetsEnabled}get pickSurfacePrecisionEnabled(){return!1}get logarithmicDepthBufferEnabled(){return this._logarithmicDepthBufferEnabled}set numCachedSectionPlanes(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}get numCachedSectionPlanes(){return this._sectionPlanesState.getNumCachedSectionPlanes()}set pbrEnabled(e){this._pbrEnabled=!!e,this.glRedraw()}get pbrEnabled(){return this._pbrEnabled}set dtxEnabled(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}get dtxEnabled(){return this._dtxEnabled}set colorTextureEnabled(e){this._colorTextureEnabled=!!e,this.glRedraw()}get colorTextureEnabled(){return this._colorTextureEnabled}doOcclusionTest(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}render(e){e&&I.runTasks();const t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),!e&&!this._renderer.needsRender())return;t.sceneId=this.id;const i=this._passes,s=this._clearEachPass;let r,o;for(r=0;rr&&(r=e[3]),e[4]>o&&(o=e[4]),e[5]>n&&(n=e[5]),A=!0}A||(t=-100,i=-100,s=-100,r=100,o=100,n=100),this._aabb[0]=t,this._aabb[1]=i,this._aabb[2]=s,this._aabb[3]=r,this._aabb[4]=o,this._aabb[5]=n,this._aabbDirty=!1}return this._aabb}_setAABBDirty(){this._aabbDirty=!0,this.fire("boundary")}pick(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");const i=e.includeEntities||e.include;i&&(e.includeEntityIds=li(this,i));const s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=li(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}snapPick(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}clear(){var e;for(const t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}clearLights(){const e=Object.keys(this.lights);for(let t=0,i=e.length;t{if(e.collidable){const l=e.aabb;l[0]o&&(o=l[3]),l[4]>n&&(n=l[4]),l[5]>a&&(a=l[5]),t=!0}})),t){const e=d.AABB3();return e[0]=i,e[1]=s,e[2]=r,e[3]=o,e[4]=n,e[5]=a,e}return this.aabb}setObjectsVisible(e,t){return this.withObjects(e,(e=>{const i=e.visible!==t;return e.visible=t,i}))}setObjectsCollidable(e,t){return this.withObjects(e,(e=>{const i=e.collidable!==t;return e.collidable=t,i}))}setObjectsCulled(e,t){return this.withObjects(e,(e=>{const i=e.culled!==t;return e.culled=t,i}))}setObjectsSelected(e,t){return this.withObjects(e,(e=>{const i=e.selected!==t;return e.selected=t,i}))}setObjectsHighlighted(e,t){return this.withObjects(e,(e=>{const i=e.highlighted!==t;return e.highlighted=t,i}))}setObjectsXRayed(e,t){return this.withObjects(e,(e=>{const i=e.xrayed!==t;return e.xrayed=t,i}))}setObjectsEdges(e,t){return this.withObjects(e,(e=>{const i=e.edges!==t;return e.edges=t,i}))}setObjectsColorized(e,t){return this.withObjects(e,(e=>{e.colorize=t}))}setObjectsOpacity(e,t){return this.withObjects(e,(e=>{const i=e.opacity!==t;return e.opacity=t,i}))}setObjectsPickable(e,t){return this.withObjects(e,(e=>{const i=e.pickable!==t;return e.pickable=t,i}))}setObjectsOffset(e,t){this.withObjects(e,(e=>{e.offset=t}))}withObjects(e,t){y.isString(e)&&(e=[e]);let i=!1;for(let s=0,r=e.length;s{r>s&&(s=r,e(...i))}));return this._tickifiedFunctions[t]={tickSubId:n,wrapperFunc:o},o}destroy(){super.destroy();for(const e in this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}const hi=1e3,ci=1001,ui=1002,di=1003,pi=1004,fi=1004,gi=1005,mi=1005,_i=1006,vi=1007,bi=1007,yi=1008,Bi=1008,wi=1009,xi=1010,Pi=1011,Ci=1012,Mi=1013,Fi=1014,Ei=1015,Ii=1016,Di=1017,Si=1018,Ti=1020,Ri=1021,Li=1022,Ui=1023,ki=1024,Oi=1025,Ni=1026,Qi=1027,Vi=1028,Hi=1029,ji=1030,Gi=1031,zi=1033,Wi=33776,Ki=33777,Xi=33778,Ji=33779,Yi=35840,Zi=35841,qi=35842,$i=35843,es=36196,ts=37492,is=37496,ss=37808,rs=37809,os=37810,ns=37811,as=37812,ls=37813,As=37814,hs=37815,cs=37816,us=37817,ds=37818,ps=37819,fs=37820,gs=37821,ms=36492,_s=3e3,vs=3001,bs=1e4,ys=10001,Bs=10002,ws=10003,xs=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,o=e._state.billboard,n=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,A=[];A.push("#version 300 es"),A.push("// Lambertian drawing vertex shader"),A.push("in vec3 position;"),A.push("uniform mat4 modelMatrix;"),A.push("uniform mat4 viewMatrix;"),A.push("uniform mat4 projMatrix;"),A.push("uniform vec4 colorize;"),A.push("uniform vec3 offset;"),l&&A.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(A.push("uniform float logDepthBufFC;"),A.push("out float vFragDepth;"),A.push("bool isPerspectiveMatrix(mat4 m) {"),A.push(" return (m[2][3] == - 1.0);"),A.push("}"),A.push("out float isPerspective;"));a&&A.push("out vec4 vWorldPosition;");if(A.push("uniform vec4 lightAmbient;"),A.push("uniform vec4 materialColor;"),A.push("uniform vec3 materialEmissive;"),r.normalsBuf){A.push("in vec3 normal;"),A.push("uniform mat4 modelNormalMatrix;"),A.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=s.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),A.push(" }"),A.push(" return normalize(v);"),A.push("}"))}A.push("out vec4 vColor;"),"points"===r.primitiveName&&A.push("uniform float pointSize;");"spherical"!==o&&"cylindrical"!==o||(A.push("void billboard(inout mat4 mat) {"),A.push(" mat[0][0] = 1.0;"),A.push(" mat[0][1] = 0.0;"),A.push(" mat[0][2] = 0.0;"),"spherical"===o&&(A.push(" mat[1][0] = 0.0;"),A.push(" mat[1][1] = 1.0;"),A.push(" mat[1][2] = 0.0;")),A.push(" mat[2][0] = 0.0;"),A.push(" mat[2][1] = 0.0;"),A.push(" mat[2][2] =1.0;"),A.push("}"));A.push("void main(void) {"),A.push("vec4 localPosition = vec4(position, 1.0); "),A.push("vec4 worldPosition;"),l&&A.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?A.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):A.push("vec4 localNormal = vec4(normal, 0.0); "),A.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),A.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));A.push("mat4 viewMatrix2 = viewMatrix;"),A.push("mat4 modelMatrix2 = modelMatrix;"),n&&A.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(A.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),A.push("billboard(modelMatrix2);"),A.push("billboard(viewMatrix2);"),A.push("billboard(modelViewMatrix);"),r.normalsBuf&&(A.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),A.push("billboard(modelNormalMatrix2);"),A.push("billboard(viewNormalMatrix2);"),A.push("billboard(modelViewNormalMatrix);")),A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&A.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(A.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),A.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),A.push("float lambertian = 1.0;"),r.normalsBuf)for(let e=0,t=s.lights.length;e0,o=t.gammaOutput,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}"points"===s.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");o?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(e)):(this.vertex=function(e){const t=e.scene;e._material;const i=e._state,s=t._sectionPlanesState,r=e._geometry._state,o=t._lightsState;let n;const a=i.billboard,l=i.background,A=i.stationary,h=function(e){if(!e._geometry._state.uvBuf)return!1;const t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=Ms(e),u=s.getNumAllocatedSectionPlanes()>0,d=Cs(e),p=!!r.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),u&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(let e=0,t=o.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}h&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));r.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===r.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(let e=0,t=o.lights.length;e0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(let e=0,t=o.lights.length;e0,l=Ms(e),A=s.uvBuf,h="PhongMaterial"===n.type,c="MetallicMaterial"===n.type,u="SpecularMaterial"===n.type,d=Cs(e);t.gammaInput;const p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var g=0;g0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),o.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),h&&((o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = "+Ps[o.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||u)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),o.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+Ps[o.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(o.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));n.ambient&&f.push("uniform vec3 materialAmbient;");n.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==n.alpha&&null!==n.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");n.emissive&&f.push("uniform vec3 materialEmissive;");n.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==n.glossiness&&null!==n.glossiness&&f.push("uniform float materialGlossiness;");void 0!==n.shininess&&null!==n.shininess&&f.push("uniform float materialShininess;");n.specular&&f.push("uniform vec3 materialSpecular;");void 0!==n.metallic&&null!==n.metallic&&f.push("uniform float materialMetallic;");void 0!==n.roughness&&null!==n.roughness&&f.push("uniform float materialRoughness;");void 0!==n.specularF0&&null!==n.specularF0&&f.push("uniform float materialSpecularF0;");A&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));A&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));A&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));A&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&A&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&A&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&A&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));A&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));A&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&A&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&A&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&A&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(let e=0,t=o.lights.length;e 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),n.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");n.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):n.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");n.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");n.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==n.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==n.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==n.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==n.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==n.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));A&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+Ps[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));A&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+Ps[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));A&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+Ps[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));A&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+Ps[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));A&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));A&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(o.lights.length>0||o.lightMaps.length>0||o.reflectionMaps.length>0)){A&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),A&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),A&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),A&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),A&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),A&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),A&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),h&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),u&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),o.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),h&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(u||c)&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(let e=0,t=o.lights.length;e0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(h=0,c=o.sectionPlanes.length;h0&&r.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,r.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),r.reflectionMaps.length>0&&r.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,r.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),this._uGammaFactor&&s.uniform1f(this._uGammaFactor,i.gammaFactor),this._baseTextureUnit=e.textureUnit};class Ss{constructor(e){this.vertex=function(e){const t=e.scene,i=t._lightsState,s=function(e){const t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,o=!!e._geometry._state.compressGeometry,n=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),o&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===n||"cylindrical"===n)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===n&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),o&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(o?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(let e=0,t=i.lights.length;e0,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}"points"===e._geometry._state.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const Ts=new e({}),Rs=d.vec3(),Ls=function(e,t){this.id=Ts.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Ss(t),this._allocate(t)},Us={};Ls.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Us[t];return i||(i=new Ls(t,e),Us[t]=i,m.memory.programs++),i._useCount++,i},Ls.prototype.put=function(){0==--this._useCount&&(Ts.removeItem(this.id),this._program&&this._program.destroy(),delete Us[this._hash],m.memory.programs--)},Ls.prototype.webglContextRestored=function(){this._program=null},Ls.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl,n=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,A=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,A?e.getRTCViewMatrix(a.originHash,A):r.viewMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Edges drawing vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec4 edgeColor;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));i&&n.push("out vec4 vWorldPosition;");n.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));n.push("vColor = edgeColor;"),i&&n.push("vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,o=[];o.push("#version 300 es"),o.push("// Edges drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const Os=new e({}),Ns=d.vec3(),Qs=function(e,t){this.id=Os.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new ks(t),this._allocate(t)},Vs={};Qs.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Vs[t];return i||(i=new Qs(t,e),Vs[t]=i,m.memory.programs++),i._useCount++,i},Qs.prototype.put=function(){0==--this._useCount&&(Os.removeItem(this.id),this._program&&this._program.destroy(),delete Vs[this._hash],m.memory.programs--)},Qs.prototype.webglContextRestored=function(){this._program=null},Qs.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl;let n;const a=t._state,l=t._geometry,A=l._state,h=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,h?e.getRTCViewMatrix(a.originHash,h):r.viewMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh picking vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("out vec4 vViewPosition;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("uniform vec2 pickClipPos;"),n.push("vec4 remapClipPos(vec4 clipPos) {"),n.push(" clipPos.xy /= clipPos.w;"),n.push(" clipPos.xy -= pickClipPos;"),n.push(" clipPos.xy *= clipPos.w;"),n.push(" return clipPos;"),n.push("}"),n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"));n.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = remapClipPos(clipPos);"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(e)}}const js=d.vec3(),Gs=function(e,t){this._hash=e,this._shaderSource=new Hs(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},zs={};Gs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let i=zs[t];if(!i){if(i=new Gs(t,e),i.errors)return console.log(i.errors.join("\n")),null;zs[t]=i,m.memory.programs++}return i._useCount++,i},Gs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete zs[this._hash],m.memory.programs--)},Gs.prototype.webglContextRestored=function(){this._program=null},Gs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t>24&255,h=l>>16&255,c=l>>8&255,u=255&l;s.uniform4f(this._uPickColor,u/255,c/255,h/255,A/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),n.indicesBuf?(s.drawElements(n.primitive,n.indicesBuf.numItems,n.indicesBuf.itemType,0),e.drawElements++):n.positions&&s.drawArrays(s.TRIANGLES,0,n.positions.numItems)},Gs.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Ve(i,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(e)}}const Ks=d.vec3(),Xs=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Ws(t),this._allocate(t)},Js={};Xs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Js[t];if(!i){if(i=new Xs(t,e),i.errors)return console.log(i.errors.join("\n")),null;Js[t]=i,m.memory.programs++}return i._useCount++,i},Xs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Js[this._hash],m.memory.programs--)},Xs.prototype.webglContextRestored=function(){this._program=null},Xs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry,a=t._geometry._state,l=t.origin,A=o.backfaces,h=o.frontface,c=i.camera.project,u=n._getPickTrianglePositions(),d=n._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){const e=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,e)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh occlusion vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(e)}}const Zs=d.vec3(),qs=function(e,t){this._hash=e,this._shaderSource=new Ys(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},$s={};qs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";");let i=$s[t];if(!i){if(i=new qs(t,e),i.errors)return console.log(i.errors.join("\n")),null;$s[t]=i,m.memory.programs++}return i._useCount++,i},qs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete $s[this._hash],m.memory.programs--)},qs.prototype.webglContextRestored=function(){this._program=null},qs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._material._state,o=t._state,n=t._geometry._state,a=t.origin;if(r.alpha<1)return;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){const t=r.backfaces;e.backfaces!==t&&(t?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=t);const i=r.frontface;e.frontface!==i&&(i?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=i),this._lastMaterialId=r.id}const l=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(o.originHash,a):l.viewMatrix),o.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(e),this.fragment=function(e){const t=e.scene;t.canvas.gl;const i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(e)}}const tr=function(e,t){this._hash=e,this._shaderSource=new er(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},ir={};tr.get=function(e){const t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let s=ir[i];if(!s){if(s=new tr(i,e),s.errors)return console.log(s.errors.join("\n")),null;ir[i]=s,m.memory.programs++}return s._useCount++,s},tr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete ir[this._hash],m.memory.programs--)},tr.prototype.webglContextRestored=function(){this._program=null},tr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){const t=s.backfaces;e.backfaces!==t&&(t?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=t);const r=s.frontface;e.frontface!==r&&(r?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=r),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){const s=t.vertexBufs;s.id!==this._lastVertexBufsId&&(s.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(s.positionsBuf,s.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=s.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},tr.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Ve(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0){let e,t,r,o,n;for(let a=0,l=this._uSectionPlanes.length;a0)for(let i=0;i0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this.glRedraw()}}const fr=function(){const e=d.vec3(),t=d.vec3(),i=d.vec3(),s=d.vec3(),r=d.vec3(),o=d.vec3(),n=d.vec4(),a=d.vec3(),l=d.vec3(),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3(),m=d.vec4(),_=d.vec4(),v=d.vec4(),b=d.vec3(),y=d.vec3(),B=d.vec3(),w=d.vec3(),x=d.vec3(),P=d.vec3(),C=d.vec3(),M=d.vec3(),F=d.vec3(),E=d.vec3(),I=d.vec3();return function(D,S,T,R){var L=R.primIndex;if(null!=L&&L>-1){const N=D.geometry._state,Q=D.scene,V=Q.camera,H=Q.canvas;if("triangles"===N.primitiveName){R.primitive="triangle";const Q=L,j=N.indices,G=N.positions;let z,W,X;if(j){var U=j[Q+0],k=j[Q+1],O=j[Q+2];o[0]=U,o[1]=k,o[2]=O,R.indices=o,z=3*U,W=3*k,X=3*O}else z=3*Q,W=z+3,X=W+3;if(i[0]=G[z+0],i[1]=G[z+1],i[2]=G[z+2],s[0]=G[W+0],s[1]=G[W+1],s[2]=G[W+2],r[0]=G[X+0],r[1]=G[X+1],r[2]=G[X+2],N.compressGeometry){const e=N.positionsDecodeMatrix;e&&(Vt.decompressPosition(i,e,i),Vt.decompressPosition(s,e,s),Vt.decompressPosition(r,e,r))}R.canvasPos?d.canvasPosToLocalRay(H.canvas,D.origin?K(S,D.origin):S,T,D.worldMatrix,R.canvasPos,e,t):R.origin&&R.direction&&d.worldRayToLocalRay(D.worldMatrix,R.origin,R.direction,e,t),d.normalizeVec3(t),d.rayPlaneIntersect(e,t,i,s,r,n),R.localPos=n,R.position=n,m[0]=n[0],m[1]=n[1],m[2]=n[2],m[3]=1,d.transformVec4(D.worldMatrix,m,_),a[0]=_[0],a[1]=_[1],a[2]=_[2],R.canvasPos&&D.origin&&(a[0]+=D.origin[0],a[1]+=D.origin[1],a[2]+=D.origin[2]),R.worldPos=a,d.transformVec4(V.matrix,_,v),l[0]=v[0],l[1]=v[1],l[2]=v[2],R.viewPos=l,d.cartesianToBarycentric(n,i,s,r,A),R.bary=A;const J=N.normals;if(J){if(N.compressGeometry){const e=3*U,t=3*k,i=3*O;Vt.decompressNormal(J.subarray(e,e+2),h),Vt.decompressNormal(J.subarray(t,t+2),c),Vt.decompressNormal(J.subarray(i,i+2),u)}else h[0]=J[z],h[1]=J[z+1],h[2]=J[z+2],c[0]=J[W],c[1]=J[W+1],c[2]=J[W+2],u[0]=J[X],u[1]=J[X+1],u[2]=J[X+2];const e=d.addVec3(d.addVec3(d.mulVec3Scalar(h,A[0],b),d.mulVec3Scalar(c,A[1],y),B),d.mulVec3Scalar(u,A[2],w),x);R.worldNormal=d.normalizeVec3(d.transformVec3(D.worldNormalMatrix,e,P))}const Y=N.uv;if(Y){if(p[0]=Y[2*U],p[1]=Y[2*U+1],f[0]=Y[2*k],f[1]=Y[2*k+1],g[0]=Y[2*O],g[1]=Y[2*O+1],N.compressGeometry){const e=N.uvDecodeMatrix;e&&(Vt.decompressUV(p,e,p),Vt.decompressUV(f,e,f),Vt.decompressUV(g,e,g))}R.uv=d.addVec3(d.addVec3(d.mulVec2Scalar(p,A[0],C),d.mulVec2Scalar(f,A[1],M),F),d.mulVec2Scalar(g,A[2],E),I)}}}}}();function gr(e={}){let t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);let i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);let s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);let r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);let o=e.heightSegments||1;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),o<1&&(o=1);const n=!!e.openEnded;let a=e.center;const l=a?a[0]:0,A=a?a[1]:0,h=a?a[2]:0,c=s/2,u=s/o,d=2*Math.PI/r,p=1/r,f=(t-i)/o,g=[],m=[],_=[],v=[];let b,B,w,x,P,C,M,F,E,I,D;const S=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(b=0;b<=o;b++)for(P=t-b*f,C=c-b*u,B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),m.push(P*w),m.push(S),m.push(P*x),_.push(B*p),_.push(1*b/o),g.push(P*w+l),g.push(C+A),g.push(P*x+h);for(b=0;b0){for(E=g.length/3,m.push(0),m.push(1),m.push(0),_.push(.5),_.push(.5),g.push(0+l),g.push(c+A),g.push(0+h),B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(t*w),m.push(1),m.push(t*x),_.push(I),_.push(D),g.push(t*w+l),g.push(c+A),g.push(t*x+h);for(B=0;B0){for(E=g.length/3,m.push(0),m.push(-1),m.push(0),_.push(.5),_.push(.5),g.push(0+l),g.push(0-c+A),g.push(0+h),B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(i*w),m.push(-1),m.push(i*x),_.push(I),_.push(D),g.push(i*w+l),g.push(0-c+A),g.push(i*x+h);for(B=0;B":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function vr(e={}){var t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],o=e.size||1,n=[],a=[],l=e.text;y.isNumeric(l)&&(l=""+l);for(var A,h,c,u,d,p,f,g,m,_=(l||"").split("\n"),v=0,b=0,B=.04,w=0;w<_.length;w++){A=0,c=(h=_[w]).length;for(var x=0;x0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this._children.length){const e=this._children.splice();let t;for(let i=0,s=e.length;i1;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const o=Nr(i,this.wrapS);o&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,o);const n=Nr(i,this.wrapT);if(n&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,n),this.type===i.TEXTURE_3D||this.type===i.TEXTURE_2D_ARRAY){const e=Nr(i,this.wrapR);e&&i.texParameteri(this.target,i.TEXTURE_WRAP_R,e),i.texParameteri(this.type,i.TEXTURE_WRAP_R,e)}r?(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,jr(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,jr(i,this.magFilter))):(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,Nr(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,Nr(i,this.magFilter)));const a=Nr(i,this.format,this.encoding),l=Nr(i,this.type),A=Hr(i,this.internalFormat,a,l,this.encoding,!1);i.texStorage2D(i.TEXTURE_2D,s,A,e[0].width,e[0].height);for(let t=0,s=e.length;t>t;return e+1}class Kr extends R{get type(){return"Texture"}constructor(e,t={}){super(e,t),this._state=new lt({texture:new Vr({gl:this.scene.canvas.gl}),matrix:d.identityMat4(),hasMatrix:t.translate&&(0!==t.translate[0]||0!==t.translate[1])||!!t.rotate||t.scale&&(0!==t.scale[0]||0!==t.scale[1]),minFilter:this._checkMinFilter(t.minFilter),magFilter:this._checkMagFilter(t.magFilter),wrapS:this._checkWrapS(t.wrapS),wrapT:this._checkWrapT(t.wrapT),flipY:this._checkFlipY(t.flipY),encoding:this._checkEncoding(t.encoding)}),this._src=null,this._image=null,this._translate=d.vec2([0,0]),this._scale=d.vec2([1,1]),this._rotate=d.vec2([0,0]),this._matrixDirty=!1,this.translate=t.translate,this.scale=t.scale,this.rotate=t.rotate,t.src?this.src=t.src:t.image&&(this.image=t.image),m.memory.textures++}_checkMinFilter(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}_checkMagFilter(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}_checkWrapS(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkWrapT(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this._state.texture=new Vr({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}_update(){const e=this._state;if(this._matrixDirty){let t,i;0===this._translate[0]&&0===this._translate[1]||(t=d.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(i=d.scalingMat4v([this._scale[0],this._scale[1],1]),t=t?d.mulMat4(t,i):i),0!==this._rotate&&(i=d.rotationMat4v(.0174532925*this._rotate,[0,0,1]),t=t?d.mulMat4(t,i):i),t&&(e.matrix=t),this._matrixDirty=!1}this.glRedraw()}set image(e){this._image=Gr(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}get image(){return this._image}set src(e){this.scene.loading++,this.scene.canvas.spinner.processes++;const t=this;let i=new Image;i.onload=function(){i=Gr(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}get src(){return this._src}set translate(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}get translate(){return this._translate}set scale(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}get scale(){return this._scale}set rotate(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}get rotate(){return this._rotate}get minFilter(){return this._state.minFilter}get magFilter(){return this._state.magFilter}get wrapS(){return this._state.wrapS}get wrapT(){return this._state.wrapT}get flipY(){return this._state.flipY}get encoding(){return this._state.encoding}destroy(){super.destroy(),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),m.memory.textures--}}class Xr extends R{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new lt({edgeColor:d.vec3([0,0,0]),centerColor:d.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}}const Jr=m.memory,Yr=d.AABB3();class Zr extends Tt{get type(){return"VBOGeometry"}get isVBOGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new lt({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._aabb=null,this._obb=d.OBB3();const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(t.indices){var r;if(t.positionsDecodeMatrix);else{const e=Vt.getPositionsBounds(t.positions),o=Vt.compressPositions(t.positions,e.min,e.max);r=o.quantized,i.positionsDecodeMatrix=o.decodeMatrix,i.positionsBuf=new He(s,s.ARRAY_BUFFER,r,r.length,3,s.STATIC_DRAW),Jr.positions+=i.positionsBuf.numItems,d.positions3ToAABB3(t.positions,this._aabb),d.positions3ToAABB3(r,Yr,i.positionsDecodeMatrix),d.AABB3ToOBB3(Yr,this._obb)}if(t.colors){const e=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors);i.colorsBuf=new He(s,s.ARRAY_BUFFER,e,e.length,4,s.STATIC_DRAW),Jr.colors+=i.colorsBuf.numItems}if(t.uv){const e=Vt.getUVBounds(t.uv),r=Vt.compressUVs(t.uv,e.min,e.max),o=r.quantized;i.uvDecodeMatrix=r.decodeMatrix,i.uvBuf=new He(s,s.ARRAY_BUFFER,o,o.length,2,s.STATIC_DRAW),Jr.uvs+=i.uvBuf.numItems}if(t.normals){const e=Vt.compressNormals(t.normals);let r=i.compressGeometry;i.normalsBuf=new He(s,s.ARRAY_BUFFER,e,e.length,3,s.STATIC_DRAW,r),Jr.normals+=i.normalsBuf.numItems}{const e=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices);i.indicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,e,e.length,1,s.STATIC_DRAW),Jr.indices+=i.indicesBuf.numItems;const o=Rt(r,e,i.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,o,o.length,1,s.STATIC_DRAW),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)}this._buildHash(),Jr.meshes++}else this.error("Config expected: indices");else this.error("Config expected: positions")}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf}get primitive(){return this._state.primitiveName}get aabb(){return this._aabb}get obb(){return this._obb}get numTriangles(){return this._numTriangles}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Jr.meshes--}}var qr={};function $r(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,y.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=qr.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(y.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))}function eo(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,y.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=qr.parse.fromOBJ(e),n=qr.edit.unwrap(o.i_verts,o.c_verts,3),a=qr.edit.unwrap(o.i_norms,o.c_norms,3),l=qr.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))}function to(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return y.apply(e,{primitive:"lines",positions:[l,A,h,l,A,d,l,u,h,l,u,d,c,A,h,c,A,d,c,u,h,c,u,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function io(e={}){return to({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})}function so(e={}){let t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);let i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1),t=t||10,i=i||10;const s=t/i,r=t/2,o=[],n=[];let a=0;for(let e=0,t=-r;e<=i;e++,t+=s)o.push(-r),o.push(0),o.push(t),o.push(r),o.push(0),o.push(t),o.push(t),o.push(0),o.push(-r),o.push(t),o.push(0),o.push(r),n.push(a++),n.push(a++),n.push(a++),n.push(a++);return y.apply(e,{primitive:"lines",positions:o,indices:n})}function ro(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);let s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);let r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);const o=e.center,n=o?o[0]:0,a=o?o[1]:0,l=o?o[2]:0,A=t/2,h=i/2,c=Math.floor(s)||1,u=Math.floor(r)||1,d=c+1,p=u+1,f=t/c,g=i/u,m=new Float32Array(d*p*3),_=new Float32Array(d*p*3),v=new Float32Array(d*p*2);let b,B,w,x,P,C,M,F=0,E=0;for(b=0;b65535?Uint32Array:Uint16Array)(c*u*6);for(b=0;b360&&(o=360);const n=e.center;let a=n?n[0]:0,l=n?n[1]:0;const A=n?n[2]:0,h=[],c=[],u=[],p=[];let f,g,m,_,v,b,B,w,x,P,C,M;for(w=0;w<=r;w++)for(B=0;B<=s;B++)f=B/s*o,g=.785398+w/r*Math.PI*2,a=t*Math.cos(f),l=t*Math.sin(f),m=(t+i*Math.cos(g))*Math.cos(f),_=(t+i*Math.cos(g))*Math.sin(f),v=i*Math.sin(g),h.push(m+a),h.push(_+l),h.push(v+A),u.push(1-B/s),u.push(w/r),b=d.normalizeVec3(d.subVec3([m,_,v],[a,l,A],[]),[]),c.push(b[0]),c.push(b[1]),c.push(b[2]);for(w=1;w<=r;w++)for(B=1;B<=s;B++)x=(s+1)*w+B-1,P=(s+1)*(w-1)+B-1,C=(s+1)*(w-1)+B,M=(s+1)*w+B,p.push(x),p.push(P),p.push(C),p.push(C),p.push(M),p.push(x);return y.apply(e,{positions:h,normals:c,uv:u,indices:p})}function no(e={}){if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";let t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";let i=[];for(let e=0;e[...e])).flat();return no({id:e.id,points:t})}qr.load=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){t(e.target.response)},i.send()},qr.save=function(e,t){var i="data:application/octet-stream;base64,"+btoa(qr.parse._buffToStr(e));window.location.href=i},qr.clone=function(e){return JSON.parse(JSON.stringify(e))},qr.bin={},qr.bin.f=new Float32Array(1),qr.bin.fb=new Uint8Array(qr.bin.f.buffer),qr.bin.rf=function(e,t){for(var i=qr.bin.f,s=qr.bin.fb,r=0;r<4;r++)s[r]=e[t+r];return i[0]},qr.bin.rsl=function(e,t){return e[t]|e[t+1]<<8},qr.bin.ril=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},qr.bin.rASCII0=function(e,t){for(var i="";0!=e[t];)i+=String.fromCharCode(e[t++]);return i},qr.bin.wf=function(e,t,i){new Float32Array(e.buffer,t,1)[0]=i},qr.bin.wsl=function(e,t,i){e[t]=i,e[t+1]=i>>8},qr.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},qr.parse={},qr.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),Ao&&(o=A),hn&&(n=h)}return{min:{x:t,y:i,z:s},max:{x:r,y:o,z:n}}};class lo extends R{constructor(e,t={}){super(e,t),this._type=t.type||(t.src?t.src.split(".").pop():null)||"jpg",this._pos=d.vec3(t.pos||[0,0,0]),this._up=d.vec3(t.up||[0,1,0]),this._normal=d.vec3(t.normal||[0,0,1]),this._height=t.height||1,this._origin=d.vec3(),this._rtcPos=d.vec3(),this._imageSize=d.vec2(),this._texture=new Kr(this,{flipY:!0}),this._image=new Image,"jpg"!==this._type&&"png"!==this._type&&(this.error('Unsupported type - defaulting to "jpg"'),this._type="jpg"),this._node=new Dr(this,{matrix:d.inverseMat4(d.lookAtMat4v(this._pos,d.subVec3(this._pos,this._normal,d.mat4()),this._up,d.mat4())),children:[this._bitmapMesh=new pr(this,{scale:[1,1,1],rotation:[-90,0,0],collidable:t.collidable,pickable:t.pickable,opacity:t.opacity,clippable:t.clippable,geometry:new Gt(this,ro({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0})})]}),t.image?this.image=t.image:t.src?this.src=t.src:t.imageData&&(this.imageData=t.imageData),this.scene._bitmapCreated(this)}set visible(e){this._bitmapMesh.visible=e}get visible(){return this._bitmapMesh.visible}set image(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}get image(){return this._image}set src(e){if(e){this._image.onload=()=>{this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale()},this._image.src=e;switch(e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}}get src(){return this._image.src}set imageData(e){this._image.onload=()=>{this._texture.image=image,this._imageSize[0]=image.width,this._imageSize[1]=image.height,this._updateBitmapMeshScale()},this._image.src=e}get imageData(){const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")}set type(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}get type(){return this._type}get pos(){return this._pos}get normal(){return this._normal}get up(){return this._up}set height(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}get height(){return this._height}set collidable(e){this._bitmapMesh.collidable=!1!==e}get collidable(){return this._bitmapMesh.collidable}set clippable(e){this._bitmapMesh.clippable=!1!==e}get clippable(){return this._bitmapMesh.clippable}set pickable(e){this._bitmapMesh.pickable=!1!==e}get pickable(){return this._bitmapMesh.pickable}set opacity(e){this._bitmapMesh.opacity=e}get opacity(){return this._bitmapMesh.opacity}destroy(){super.destroy(),this.scene._bitmapDestroyed(this)}_updateBitmapMeshScale(){const e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}const Ao=d.OBB3(),ho=d.OBB3(),co=d.OBB3();class uo{constructor(e,t,i,s,r,o,n=null,a=0){this.model=e,this.object=null,this.parent=null,this.transform=r,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=t,this.obb=null,this._aabbLocal=null,this._aabbWorld=d.AABB3(),this._aabbWorldDirty=!1,this.layer=n,this.portionId=a,this._color=new Uint8Array([i[0],i[1],i[2],s]),this._colorize=new Uint8Array([i[0],i[1],i[2],s]),this._colorizing=!1,this._transparent=s<255,this.numTriangles=0,this.origin=null,this.entity=null,r&&r._addMesh(this)}_sceneModelDirty(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}_transformDirty(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}_updateMatrix(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}_finalize(e){this.layer.initFlags(this.portionId,e,this._transparent)}_finalize2(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}_setVisible(e){this.layer.setVisible(this.portionId,e,this._transparent)}_setColor(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}_setColorize(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}_setOpacity(e,t){const i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}_setOffset(e){this.layer.setOffset(this.portionId,e)}_setHighlighted(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}_setXRayed(e){this.layer.setXRayed(this.portionId,e,this._transparent)}_setSelected(e){this.layer.setSelected(this.portionId,e,this._transparent)}_setEdges(e){this.layer.setEdges(this.portionId,e,this._transparent)}_setClippable(e){this.layer.setClippable(this.portionId,e,this._transparent)}_setCollidable(e){this.layer.setCollidable(this.portionId,e)}_setPickable(e){this.layer.setPickable(this.portionId,e,this._transparent)}_setCulled(e){this.layer.setCulled(this.portionId,e,this._transparent)}canPickTriangle(){return!1}drawPickTriangles(e,t){}pickTriangleSurface(e){}precisionRayPickSurface(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}canPickWorldPos(){return!0}drawPickDepths(e){this.model.drawPickDepths(e)}drawPickNormals(e){this.model.drawPickNormals(e)}delegatePickedEntity(){return this.parent}getEachVertex(e){this.layer.getEachVertex(this.portionId,e)}set aabb(e){this._aabbLocal=e}get aabb(){if(this._aabbWorldDirty){if(d.AABB3ToOBB3(this._aabbLocal,Ao),this.transform?(d.transformOBB3(this.transform.worldMatrix,Ao,ho),d.transformOBB3(this.model.worldMatrix,ho,co),d.OBB3ToAABB3(co,this._aabbWorld)):(d.transformOBB3(this.model.worldMatrix,Ao,ho),d.OBB3ToAABB3(ho,this._aabbWorld)),this.origin){const e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld}_destroy(){this.model.scene._renderer.putPickID(this.pickId)}}const po=new class{constructor(){this._uint8Arrays={},this._float32Arrays={}}_clear(){this._uint8Arrays={},this._float32Arrays={}}getUInt8Array(e){let t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}getFloat32Array(e){let t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}};let fo=0;const go={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},mo=new Float32Array([1,1,1,1]),_o=new Float32Array([0,0,0,1]),vo=d.vec4(),bo=d.vec3(),yo=d.vec3(),Bo=d.mat4();class wo{constructor(e,t=!1,{instancing:i=!1,edges:s=!1}={}){this._scene=e,this._withSAO=t,this._instancing=i,this._edges=s,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}_getHash(){return this._scene._sectionPlanesState.getHash()}_buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}_buildVertexShader(){return[""]}_buildFragmentShader(){return[""]}_addMatricesUniformBlockLines(e,t=!1){return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}_addRemapClipPosLines(e,t=1){return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(${t}));`),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}getValid(){return this._hash===this._getHash()}setSectionPlanesStateUniforms(e){const t=this._scene,{gl:i}=t.canvas,{model:s,layerIndex:r}=e,o=t._sectionPlanesState.getNumAllocatedSectionPlanes(),n=t._sectionPlanesState.sectionPlanes.length;if(o>0){const a=t._sectionPlanesState.sectionPlanes,l=r*n,A=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(let t=0;t0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(let t=0,i=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0&&p.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,p.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),p.lightMaps.length>0&&p.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,p.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),this._withSAO){const t=n.sao;if(t.possible){const i=a.drawingBufferWidth,s=a.drawingBufferHeight;vo[0]=i,vo[1]=s,vo[2]=t.blendCutoff,vo[3]=t.blendFactor,a.uniform4fv(this._uSAOParams,vo),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++}}if(s){const e=this._edges?"edgeColor":"fillColor",t=this._edges?"edgeAlpha":"fillAlpha";if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_XRAYED"]){const i=n.xrayMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_HIGHLIGHTED"]){const i=n.highlightMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_SELECTED"]){const i=n.selectedMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else a.uniform4fv(this._uColor,this._edges?_o:mo)}this._draw({state:l,frameCtx:e,incrementDrawState:r}),a.bindVertexArray(null)}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null,m.memory.programs--}}class xo extends wo{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!1,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{const e=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,e,i.indicesBuf.itemType,o),r&&s.drawElements++}}}class Po extends xo{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r;const o=[];o.push("#version 300 es"),o.push("// Triangles batching draw vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;")),o.push("out vec4 vColor;"),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Co extends xo{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,i=t.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching silhouette fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r){for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = newColor;"),o.push("}"),o}}class Fo extends xo{constructor(e){super(e,!1,{instancing:!1,edges:!0})}}class Eo extends Fo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Io extends Fo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Do extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class So extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class To extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Ro extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class Lo extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}class Uo extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class ko extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}class Oo extends xo{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Triangles batching quality draw vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),o.push("vFragDepth = 1.0 + clipPos.w;")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Triangles batching quality draw fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),n.push("uniform sampler2D uAOMap;"),n.push("in vec4 vViewPosition;"),n.push("in vec3 vViewNormal;"),n.push("in vec4 vColor;"),n.push("in vec2 vUV;"),n.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Qo extends xo{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching color texture fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),o.push("uniform float gammaFactor;"),o.push("vec4 linearToLinear( in vec4 value ) {"),o.push(" return value;"),o.push("}"),o.push("vec4 sRGBToLinear( in vec4 value ) {"),o.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),o.push("}"),o.push("vec4 gammaToLinear( in vec4 value) {"),o.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),o.push("}"),t&&(o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}")),r){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,t=i.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ko=d.vec3(),Xo=d.vec3(),Jo=d.vec3(),Yo=d.vec3(),Zo=d.mat4();class qo extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ko;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Xo;if(l){const e=Jo;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Zo),m=Yo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElements(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class $o{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Mo(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Do(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new So(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Wo(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new qo(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Po(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Po(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Co(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Co(this._scene,!0)),this._flatColorRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Qo(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Qo(this._scene,!0)),this._colorTextureRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Oo(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Oo(this._scene,!0)),this._pbrRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Mo(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Lo(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Uo(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new Eo(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new Io(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Do(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new To(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new No(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new So(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Ro(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ko(this._scene)),this._shadowRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new qo(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Wo(this._scene)),this._snapInitRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const en={};let tn=65536,sn=5e6;class rn{constructor(){}set doublePrecisionEnabled(e){d.setDoublePrecisionEnabled(e)}get doublePrecisionEnabled(){return d.getDoublePrecisionEnabled()}set maxDataTextureHeight(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),tn=e}get maxDataTextureHeight(){return tn}set maxGeometryBatchSize(e){e<1e5?e=1e5:e>5e6&&(e=5e6),sn=e}get maxGeometryBatchSize(){return sn}}const on=new rn;class nn{constructor(){this.maxVerts=on.maxGeometryBatchSize,this.maxIndices=3*on.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]}}const an=d.mat4(),ln=d.mat4();function An(e,t,i){const s=e.length,r=new Uint16Array(s),o=t[0],n=t[1],a=t[2],l=t[3]-o,A=t[4]-n,h=t[5]-a,c=65525,u=c/l,p=c/A,f=c/h,g=e=>e>=0?e:0;for(let t=0;t=0?1:-1),t=(1-Math.abs(s))*(r>=0?1:-1),s=e,r=t}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function un(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}const dn=d.mat4(),pn=d.mat4(),fn=d.vec4([0,0,0,1]),gn=d.vec3(),mn=d.vec3(),_n=d.vec3(),vn=d.vec3(),bn=d.vec3(),yn=d.vec3(),Bn=d.vec3();class wn{constructor(e){console.info("Creating VBOBatchingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesBatchingLayer"+(e.solid?"-solid":"-surface")+(e.autoNormals?"-autonormals":"-normals")+(e.textureSet&&e.textureSet.colorTexture?"-colorTexture":"")+(e.textureSet&&e.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=en[t];return i||(i=new $o(e),en[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete en[t],i._destroy()}))),i}(e.model.scene),this._buffer=new nn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({origin:d.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:e.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=d.mat4(e.positionsDecodeMatrix)),e.uvDecodeMatrix?(this._state.uvDecodeMatrix=d.mat3(e.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,e.origin&&this._state.origin.set(e.origin),this.solid=!!e.solid}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)for(let e=0,t=o.length;e0){const e=dn;m?d.inverseMat4(d.transposeMat4(m,pn),e):d.identityMat4(e,e),function(e,t,i,s,r){function o(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}let n,a,l,A,h,c,u=new Float32Array([0,0,0,0]),p=new Float32Array([0,0,0,0]);for(c=0;ch&&(l=n,h=A),n=cn(p,"floor","ceil"),a=un(n),A=o(p,a),A>h&&(l=n,h=A),n=cn(p,"ceil","ceil"),a=un(n),A=o(p,a),A>h&&(l=n,h=A),s[r+c+0]=l[0],s[r+c+1]=l[1],s[r+c+2]=0}(e,r,r.length,b.normals,b.normals.length)}if(l)for(let e=0,t=l.length;e0)for(let e=0,t=n.length;e0)for(let e=0,t=a.length;e0){const s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):An(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=d.mat4());if(e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(let e=0,t=this._portions.length;e0){const s=new Int8Array(i.normals);let r=!0;e.normalsBuf=new He(t,t.ARRAY_BUFFER,s,i.normals.length,3,t.STATIC_DRAW,r)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.uv.length>0)if(e.uvDecodeMatrix){let s=!1;e.uvBuf=new He(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,s)}else{const s=Vt.getUVBounds(i.uv),r=Vt.compressUVs(i.uv,s.min,s.max),o=r.quantized;let n=!1;e.uvDecodeMatrix=d.mat3(r.decodeMatrix),e.uvBuf=new He(t,t.ARRAY_BUFFER,o,o.length,2,t.STATIC_DRAW,n)}if(i.metallicRoughness.length>0){const s=new Uint8Array(i.metallicRoughness);let r=!1;e.metallicRoughnessBuf=new He(t,t.ARRAY_BUFFER,s,i.metallicRoughness.length,2,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s),o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new He(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){const s=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}isEmpty(){return!this._state.indicesBuf}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=e,s=this._portions[i],r=4*s.vertsBaseIndex,o=4*s.numVerts,n=this._scratchMemory.getUInt8Array(o),a=t[0],l=t[1],A=t[2],h=t[3];for(let e=0;e_)&&(_=e,s.set(v),r&&d.triangleNormal(p,f,g,r),m=!0)}}return m&&r&&(d.transformVec3(this.model.worldNormalMatrix,r,r),d.normalizeVec3(r)),m}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}class xn extends wo{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!0,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}class Pn extends xn{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r,o,n;const a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),e.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),e.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),r=0,o=i.lights.length;r= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),s&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),r=0,o=i.lights.length;r0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Cn extends xn{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState;let s,r;const o=t.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry flat-shading drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),o){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}for(n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),s=0,r=i.lights.length;s0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}class Fn extends xn{constructor(e,t){super(e,t,{instancing:!0,edges:!0})}}class En extends Fn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class In extends Fn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Dn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class Sn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Tn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Rn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class Ln extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry depth drawing fragment shader"),o.push("precision highp float;"),o.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),o.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),o.push("}"),o}}class Un extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class kn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const On={3e3:"linearToLinear",3001:"sRGBToLinear"};class Nn extends xn{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Instancing geometry quality drawing vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),o.push("in vec4 modelMatrixCol0;"),o.push("in vec4 modelMatrixCol1;"),o.push("in vec4 modelMatrixCol2;"),o.push("in vec4 modelNormalMatrixCol0;"),o.push("in vec4 modelNormalMatrixCol1;"),o.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),o.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),o.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Instancing geometry quality drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),n.push("#define PI 3.14159265359"),n.push("#define RECIPROCAL_PI 0.31830988618"),n.push("#define RECIPROCAL_PI2 0.15915494"),n.push("#define EPSILON 1e-6"),n.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),n.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),n.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),n.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),n.push(" return normalize(surf_norm );"),n.push(" }"),n.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),n.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),n.push(" vec2 st0 = dFdx( uv.st );"),n.push(" vec2 st1 = dFdy( uv.st );"),n.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),n.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),n.push(" vec3 N = normalize( surf_norm );"),n.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),n.push(" mat3 tsn = mat3( S, T, N );"),n.push(" return normalize( tsn * mapN );"),n.push("}"),n.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),n.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),n.push("}"),n.push("struct IncidentLight {"),n.push(" vec3 color;"),n.push(" vec3 direction;"),n.push("};"),n.push("struct ReflectedLight {"),n.push(" vec3 diffuse;"),n.push(" vec3 specular;"),n.push("};"),n.push("struct Geometry {"),n.push(" vec3 position;"),n.push(" vec3 viewNormal;"),n.push(" vec3 worldNormal;"),n.push(" vec3 viewEyeDir;"),n.push("};"),n.push("struct Material {"),n.push(" vec3 diffuseColor;"),n.push(" float specularRoughness;"),n.push(" vec3 specularColor;"),n.push(" float shine;"),n.push("};"),n.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),n.push(" float r = ggxRoughness + 0.0001;"),n.push(" return (2.0 / (r * r) - 2.0);"),n.push("}"),n.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),n.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),n.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),n.push("}"),s.reflectionMaps.length>0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = "+On[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = "+On[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Vn extends xn{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState;let r,o;const n=i.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),e.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),t&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),n){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),r=0,o=s.lights.length;r0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Xn=d.vec3(),Jn=d.vec3(),Yn=d.vec3(),Zn=d.vec3(),qn=d.mat4();class $n extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Xn;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Jn;if(l){const e=d.transformPoint3(h,l,Yn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,qn),m=Zn,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class ea{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Mn(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Dn(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new Sn(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Kn(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new $n(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Pn(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Pn(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Cn(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Cn(this._scene,!0)),this._flatColorRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Nn(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Nn(this._scene,!0)),this._pbrRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Vn(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Vn(this._scene,!0)),this._colorTextureRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Mn(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Ln(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Un(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new En(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new In(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Dn(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Tn(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Qn(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Sn(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Rn(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new kn(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Kn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new $n(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const ta={};const ia=new Uint8Array(4),sa=new Float32Array(1),ra=d.vec4([0,0,0,1]),oa=new Float32Array(3),na=d.vec3(),aa=d.vec3(),la=d.vec3(),Aa=d.vec3(),ha=d.vec3(),ca=d.vec3(),ua=d.vec3(),da=new Float32Array(4);class pa{constructor(e){console.info("Creating VBOInstancingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesInstancingLayer"+(e.solid?"-solid":"-surface")+(e.normals?"-normals":"-autoNormals"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=ta[t];return i||(i=new ea(e),ta[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete ta[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({numInstances:0,obb:d.OBB3(),origin:d.vec3(),geometry:e.geometry,textureSet:e.textureSet,pbrSupported:!1,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,e.origin&&this._state.origin.set(e.origin),this._finalized=!1,this.solid=!!e.solid,this.numIndices=e.geometry.numIndices}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;e.colorsBuf=new He(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,t),this._colors=[]}if(this._metallicRoughness.length>0){const t=new Uint8Array(this._metallicRoughness);let i=!1;e.metallicRoughnessBuf=new He(s,s.ARRAY_BUFFER,t,this._metallicRoughness.length,2,s.STATIC_DRAW,i)}if(o>0){let t=!1;e.flagsBuf=new He(s,s.ARRAY_BUFFER,new Float32Array(o),o,1,s.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;e.offsetsBuf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,t),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){const i=!1;e.positionsBuf=new He(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,i),e.positionsDecodeMatrix=d.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){const i=new Uint8Array(t.colorsCompressed),r=!1;e.colorsBuf=new He(s,s.ARRAY_BUFFER,i,i.length,4,s.STATIC_DRAW,r)}if(t.uvCompressed&&t.uvCompressed.length>0){const i=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new He(s,s.ARRAY_BUFFER,i,i.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){const t=!1;e.modelMatrixCol0Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelMatrixCol1Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelMatrixCol2Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol1Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol2Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){const t=!1;e.pickColorsBuf=new He(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,t),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";ia[0]=t[0],ia[1]=t[1],ia[2]=t[2],ia[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(ia,4*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?1:0)<<16,sa[0]=d,this._state.flagsBuf&&this._state.flagsBuf.setData(sa,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(oa[0]=t[0],oa[1]=t[1],oa[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(oa,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}getEachVertex(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;const i=this._state,s=i.geometry,r=this._portions[e];if(!r)return void this.model.error("portion not found: "+e);const o=s.quantizedPositions,n=i.origin,a=r.offset,l=n[0]+a[0],A=n[1]+a[1],h=n[2]+a[2],c=ra,u=r.matrix,p=this.model.sceneModelMatrix,f=i.positionsDecodeMatrix;for(let e=0,i=o.length;ev)&&(v=e,s.set(b),r&&d.triangleNormal(f,g,m,r),_=!0)}}return _&&r&&(d.transformVec3(a.normalMatrix,r,r),d.transformVec3(this.model.worldNormalMatrix,r,r),d.normalizeVec3(r)),_}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}class fa extends wo{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}class ga extends fa{drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class ma extends fa{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const _a=d.vec3(),va=d.vec3(),ba=d.vec3(),ya=d.vec3(),Ba=d.mat4();class wa extends wo{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=_a;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=va;if(l){const e=ba;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Ba),m=ya,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const xa=d.vec3(),Pa=d.vec3(),Ca=d.vec3(),Ma=d.vec3(),Fa=d.mat4();class Ea extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=xa;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Pa;if(l){const e=Ca;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Fa),m=Ma,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ia{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new ga(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ma(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new wa(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Ea(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Da={};class Sa{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]}}class Ta{constructor(e){console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Da[t];return i||(i=new Ia(e),Da[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Da[t],i._destroy()}))),i}(e.model.scene),this.model=e.model,this._buffer=new Sa(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:d.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=d.vec3(e.origin))}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=An(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.colors.length>0){const s=i.colors.length/4,r=new Float32Array(s);let o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2],A=t[3];for(let e=0;e0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Lines instancing color fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return this._withSAO?(o.push(" float viewportWidth = uSAOParams[0];"),o.push(" float viewportHeight = uSAOParams[1];"),o.push(" float blendCutoff = uSAOParams[2];"),o.push(" float blendFactor = uSAOParams[3];"),o.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),o.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),o.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):o.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class Ua extends Ra{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const ka=d.vec3(),Oa=d.vec3(),Na=d.vec3();d.vec3();const Qa=d.mat4();class Va extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ka;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Oa;if(l){const e=d.transformPoint3(h,l,Na);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Qa),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ha=d.vec3(),ja=d.vec3(),Ga=d.vec3();d.vec3();const za=d.mat4();class Wa extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ha;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=ja;if(l){const e=d.transformPoint3(h,l,Ga);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,za),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ka{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._snapInitRenderer||(this._snapInitRenderer=new Va(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new Wa(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new La(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ua(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Va(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Wa(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Xa={};const Ja=new Uint8Array(4),Ya=new Float32Array(1),Za=new Float32Array(3),qa=new Float32Array(4);class $a{constructor(e){console.info("VBOInstancingLinesLayer"),this.model=e.model,this.material=e.material,this.sortId="LinesInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Xa[t];return i||(i=new Ka(e),Xa[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Xa[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({obb:d.OBB3(),numInstances:0,origin:null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,e.origin&&(this._state.origin=d.vec3(e.origin)),this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;this._state.colorsBuf=new He(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,t),this._colors=[]}if(r>0){let t=!1;this._state.flagsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;this._state.offsetsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){const s=new Uint8Array(i.colorsCompressed),r=!1;t.colorsBuf=new He(e,e.ARRAY_BUFFER,s,s.length,4,e.STATIC_DRAW,r)}if(i.positionsCompressed&&i.positionsCompressed.length>0){const s=!1;t.positionsBuf=new He(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,s),t.positionsDecodeMatrix=d.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new He(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){const t=!1;this._state.modelMatrixCol0Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol1Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol2Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Ja[0]=t[0],Ja[1]=t[1],Ja[2]=t[2],Ja[3]=t[3],this._state.colorsBuf.setData(Ja,4*e,4)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?255:0)<<16,Ya[0]=d,this._state.flagsBuf.setData(Ya,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Za[0]=t[0],Za[1]=t[1],Za[2]=t[2],this._state.offsetsBuf.setData(Za,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;qa[0]=t[0],qa[1]=t[4],qa[2]=t[8],qa[3]=t[12],this._state.modelMatrixCol0Buf.setData(qa,i),qa[0]=t[1],qa[1]=t[5],qa[2]=t[9],qa[3]=t[13],this._state.modelMatrixCol1Buf.setData(qa,i),qa[0]=t[2],qa[1]=t[6],qa[2]=t[10],qa[3]=t[14],this._state.modelMatrixCol2Buf.setData(qa,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesXRayed(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK)}drawOcclusion(e,t){}drawShadow(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawPickNormals(e,t){}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}class el extends wo{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}class tl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class il extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points batching silhouette vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = color;"),o.push("}"),o}}class sl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class rl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class ol extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}const nl=d.vec3(),al=d.vec3(),ll=d.vec3(),Al=d.vec3(),hl=d.mat4();class cl extends wo{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=nl;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=al;if(l){const e=ll;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,hl),m=Al,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ul=d.vec3(),dl=d.vec3(),pl=d.vec3(),fl=d.vec3(),gl=d.mat4();class ml extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ul;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=dl;if(l){const e=pl;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,gl),m=fl,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class _l{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new tl(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new il(this._scene)),this._silhouetteRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new sl(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new rl(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new ol(this._scene)),this._occlusionRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new cl(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new ml(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const vl={};class bl{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]}}class yl{constructor(e){console.info("Creating VBOBatchingPointsLayer"),this.model=e.model,this.sortId="PointsBatchingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=vl[t];return i||(i=new _l(e),vl[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete vl[t],i._destroy()}))),i}(e.model.scene),this._buffer=new bl(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:d.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=d.vec3(e.origin))}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=An(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s);let o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new He(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized"}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2];for(let e=0;e0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class xl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Pl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class Cl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Ml extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Fl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points instancing depth vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return o.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class El extends Bl{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const Il=d.vec3(),Dl=d.vec3(),Sl=d.vec3();d.vec3();const Tl=d.mat4();class Rl extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Il;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Dl;if(l){const e=d.transformPoint3(h,l,Sl);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Tl),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ll=d.vec3(),Ul=d.vec3(),kl=d.vec3();d.vec3();const Ol=d.mat4();class Nl extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ll;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Ul;if(l){const e=d.transformPoint3(h,l,kl);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Ol),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ql{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new wl(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new xl(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Fl(this._scene)),this._depthRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Pl(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Cl(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Ml(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new El(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Rl(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Nl(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Vl={};const Hl=new Uint8Array(4),jl=new Float32Array(1),Gl=new Float32Array(3),zl=new Float32Array(4);class Wl{constructor(e){console.info("VBOInstancingPointsLayer"),this.model=e.model,this.material=e.material,this.sortId="PointsInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Vl[t];return i||(i=new Ql(e),Vl[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Vl[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({obb:d.OBB3(),numInstances:0,origin:e.origin?d.vec3(e.origin):null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let s=!1;i.flagsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,s)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;i.offsetsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){const t=!1;i.positionsBuf=new He(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,t),i.positionsDecodeMatrix=d.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){const t=new Uint8Array(s.colorsCompressed),r=!1;i.colorsBuf=new He(e,e.ARRAY_BUFFER,t,t.length,4,e.STATIC_DRAW,r)}if(this._modelMatrixCol0.length>0){const t=!1;i.modelMatrixCol0Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),i.modelMatrixCol1Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),i.modelMatrixCol2Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){const t=!1;i.pickColorsBuf=new He(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,t),this._pickColors=[]}i.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Hl[0]=t[0],Hl[1]=t[1],Hl[2]=t[2],this._state.colorsBuf.setData(Hl,3*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?255:0)<<16,jl[0]=d,this._state.flagsBuf.setData(jl,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Gl[0]=t[0],Gl[1]=t[1],Gl[2]=t[2],this._state.offsetsBuf.setData(Gl,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;zl[0]=t[0],zl[1]=t[4],zl[2]=t[8],zl[3]=t[12],this._state.modelMatrixCol0Buf.setData(zl,i),zl[0]=t[1],zl[1]=t[5],zl[2]=t[9],zl[3]=t[13],this._state.modelMatrixCol1Buf.setData(zl,i),zl[0]=t[2],zl[1]=t[6],zl[2]=t[10],zl[3]=t[14],this._state.modelMatrixCol2Buf.setData(zl,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawShadow(e,t){}drawPickMesh(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,go.PICK)}drawPickDepths(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,go.PICK)}drawPickNormals(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK)}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}const Kl=d.vec3(),Xl=d.vec3(),Jl=d.mat4();class Yl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Kl;if(g){const t=d.transformPoint3(c,A,Xl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,Jl)}else f=p;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),n.drawArrays(n.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),n.drawArrays(n.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),n.drawArrays(n.LINES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Zl{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}eagerCreateRenders(){}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Yl(this._scene,!1)),this._colorRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy()}}const ql={};class $l{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]}}class eA{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindLineIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}class tA{constructor(e,t,i,s,r=null){this._gl=e,this._texture=t,this._textureWidth=i,this._textureHeight=s,this._textureData=r}bindTexture(e,t,i){return e.bindTexture(t,this,i)}bind(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}unbind(e){}}const iA={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(iA,null,4));let e=0;Object.keys(iA).forEach((t=>{t.startsWith("size")&&(e+=iA[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/iA.totalLines).toFixed(2)}`);let t={};Object.keys(iA).forEach((i=>{i.startsWith("size")&&(t[i]=`${(iA[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class sA{disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}generateTextureForColorsAndFlags(e,t,i,s,r){const o=t.length;this.numPortions=o;const n=4096,a=Math.ceil(o/512);if(0===a)throw"texture height===0";const l=new Uint8Array(16384*a);iA.sizeDataColorsAndFlags+=l.byteLength,iA.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),l.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20);const A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,n,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,A,n,a,l)}generateTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);iA.sizeDataTextureOffsets+=r.byteLength,iA.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,o,i,s,r)}generateTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);iA.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete ql[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new $l,this._dataTextureState=new eA,this._dataTextureGenerator=new sA,this._state=new lt({origin:d.vec3(t.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&iA.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/2})),(this._state.numVertices+s>4096*oA||t+r>4096*oA)&&iA.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*oA&&t+r<=4096*oA}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/2/8)*2;iA.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}const i=t.positionsCompressed,s=t.indices,r=this._buffer;r.positionsCompressed.push(i);const o=r.lenPositionsCompressed/3,n=i.length/3;let a;r.lenPositionsCompressed+=i.length;let l=0;if(s){let e;l=s.length/2,n<=256?(e=r.indices8Bits,a=r.lenIndices8Bits/2,r.lenIndices8Bits+=s.length):n<=65536?(e=r.indices16Bits,a=r.lenIndices16Bits/2,r.lenIndices16Bits+=s.length):(e=r.indices32Bits,a=r.lenIndices32Bits/2,r.lenIndices32Bits+=s.length),e.push(s)}this._state.numVertices+=n,iA.numberOfGeometries++;return{vertexBase:o,numVertices:n,numLines:l,indicesBase:a}}_createSubPortion(e,t){const i=e.color,s=e.colors,r=e.opacity,o=e.meshMatrix,n=e.pickColor,a=this._buffer,l=this._state;a.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),a.perObjectInstancePositioningMatrices.push(o||hA),a.perObjectSolid.push(!!e.solid),s?a.perObjectColors.push([255*s[0],255*s[1],255*s[2],255]):i&&a.perObjectColors.push([i[0],i[1],i[2],r]),a.perObjectPickColors.push(n),a.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?l.numIndices8Bits:t.numVertices<=65536?l.numIndices16Bits:l.numIndices32Bits,a.perObjectIndexBaseOffsets.push(e/2-t.indicesBase)}const A=this._subPortions.length;if(t.numLines>0){let e,i=2*t.numLines;t.numVertices<=256?(e=a.perLineNumberPortionId8Bits,l.numIndices8Bits+=i,iA.totalLines8Bits+=t.numLines):t.numVertices<=65536?(e=a.perLineNumberPortionId16Bits,l.numIndices16Bits+=i,iA.totalLines16Bits+=t.numLines):(e=a.perLineNumberPortionId32Bits,l.numIndices32Bits+=i,iA.totalLines32Bits+=t.numLines),iA.totalLines+=t.numLines;for(let i=0;i0&&(t.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,aA))}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),c.bindTexture(c.TEXTURE_2D,h.texturePerObjectColorsAndFlags._texture),c.texSubImage2D(c.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,c.RGBA_INTEGER,c.UNSIGNED_BYTE,aA))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,aA))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,lA))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,nA))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){}drawSilhouetteHighlighted(e,t){}drawSilhouetteSelected(e,t){}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){}drawShadow(e,t){}setPickMatrices(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawSnapInit(e,t){}drawSnap(e,t){}drawPickNormals(e,t){}destroy(){if(this._destroyed)return;const e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}const uA=d.vec3(),dA=d.vec3(),pA=d.vec3();d.vec3();const fA=d.vec4(),gA=d.mat4();class mA{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=uA;if(g){const t=d.transformPoint3(c,A,dA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,gA),f=pA,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];const r=i.lights;let o;for(let e=0,t=r.length;e0;let r;const o=[];o.push("#version 300 es"),o.push("// TrianglesDataTextureColorRenderer vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("uniform mat4 sceneModelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),o.push("uniform highp sampler2D uTexturePerObjectMatrix;"),o.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),o.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),o.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),o.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),o.push("uniform vec3 uCameraEyeRtc;"),o.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("out float isPerspective;")),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e> 3) & 4095;"),o.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),o.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),o.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),o.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),o.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),o.push("if (int(flags.x) != renderPass) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("} else {"),o.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),o.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),o.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),o.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),o.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),o.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),o.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),o.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),o.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),o.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),o.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),o.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),o.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),o.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),o.push("if (color.a == 0u) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("};"),o.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),o.push("vec3 position;"),o.push("position = positions[gl_VertexID % 3];"),o.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),o.push("if (solid != 1u) {"),o.push("if (isPerspectiveMatrix(projMatrix)) {"),o.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),o.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("} else {"),o.push("if (viewNormal.z < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("}"),o.push("}"),o.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const _A=new Float32Array([1,1,1]),vA=d.vec3(),bA=d.vec3(),yA=d.vec3();d.vec3();const BA=d.mat4();class wA{constructor(e,t){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=vA;if(A){const t=bA;d.transformPoint3(c,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,BA),g=yA,g[0]=r.eye[0]-e[0],g[1]=r.eye[1]-e[1],g[2]=r.eye[2]-e[2]}else f=p,g=r.eye;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===go.SILHOUETTE_XRAYED){const e=s.xrayMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.SILHOUETTE_HIGHLIGHTED){const e=s.highlightMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.SILHOUETTE_SELECTED){const e=s.selectedMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,_A);if(s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=s._sectionPlanesState.getNumAllocatedSectionPlanes(),_=s._sectionPlanesState.sectionPlanes.length;if(m>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,r=o.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const xA=new Float32Array([0,0,0,1]),PA=d.vec3(),CA=d.vec3();d.vec3();const MA=d.mat4();class FA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=PA;if(g){const t=d.transformPoint3(c,A,CA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,MA)}else f=p;if(n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),i===go.EDGES_XRAYED){const e=r.xrayMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.EDGES_HIGHLIGHTED){const e=r.highlightMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.EDGES_SELECTED){const e=r.selectedMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,xA);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const EA=d.vec3(),IA=d.vec3(),DA=d.mat4();class SA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=EA;if(g){const t=d.transformPoint3(c,A,IA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,DA)}else f=p;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const TA=d.vec3(),RA=d.vec3(),LA=d.vec3(),UA=d.mat4();class kA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s;let p,f;l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=TA;if(g){const t=d.transformPoint3(c,A,RA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(o.viewMatrix,e,UA),f=LA,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=o.viewMatrix,f=o.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),r.logarithmicDepthBufferEnabled){const e=2/(Math.log(o.project.far+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,e)}const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const OA=d.vec3(),NA=d.vec3(),QA=d.vec3();d.vec3();const VA=d.mat4();class HA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=e.pickViewMatrix||o.viewMatrix;let f,g;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const t=OA;if(A){const e=NA;d.transformPoint3(c,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],f=K(p,t,VA),g=QA,g[0]=o.eye[0]-t[0],g[1]=o.eye[1]-t[1],g[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else f=p,g=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniform1f(this._uPickZNear,e.pickZNear),n.uniform1f(this._uPickZFar,e.pickZFar),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),r.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const jA=d.vec3(),GA=d.vec3(),zA=d.vec3(),WA=d.vec3();d.vec3();const KA=d.mat4();class XA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=jA;let m,_;g[0]=d.safeInv(p[3]-p[0])*d.MAX_INT,g[1]=d.safeInv(p[4]-p[1])*d.MAX_INT,g[2]=d.safeInv(p[5]-p[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(g[0]),e.snapPickCoordinateScale[1]=d.safeInv(g[1]),e.snapPickCoordinateScale[2]=d.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=GA;if(v){const e=d.transformPoint3(c,A,zA);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=K(f,t,KA),_=WA,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(w,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(w,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(w,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const JA=d.vec3(),YA=d.vec3(),ZA=d.vec3(),qA=d.vec3();d.vec3();const $A=d.mat4();class eh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=JA;let m,_;g[0]=d.safeInv(p[3]-p[0])*d.MAX_INT,g[1]=d.safeInv(p[4]-p[1])*d.MAX_INT,g[2]=d.safeInv(p[5]-p[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(g[0]),e.snapPickCoordinateScale[1]=d.safeInv(g[1]),e.snapPickCoordinateScale[2]=d.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=YA;if(v){const e=ZA;d.transformPoint3(c,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=K(f,t,$A),_=qA,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this._uVectorA,e.snapVectorA),n.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const th=d.vec3(),ih=d.vec3(),sh=d.vec3();d.vec3();const rh=d.mat4();class oh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=e.pickViewMatrix||o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=th;if(A){const t=ih;d.transformPoint3(c,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,rh),g=sh,g[0]=o.eye[0]-e[0],g[1]=o.eye[1]-e[1],g[2]=o.eye[2]-e[2]}else f=p,g=o.eye;n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const nh=d.vec3(),ah=d.vec3(),lh=d.vec3();d.vec3();const Ah=d.mat4();class hh{constructor(e){this._scene=e,this._allocate(),this._hash=this._getHash()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=nh;if(g){const t=d.transformPoint3(c,A,ah);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,Ah),f=lh,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ch=d.vec3(),uh=d.vec3(),dh=d.vec3();d.vec3();const ph=d.mat4();class fh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));const g=0!==l[0]||0!==l[1]||0!==l[2],m=0!==A[0]||0!==A[1]||0!==A[2];if(g||m){const e=ch;if(g){const t=uh;d.transformPoint3(h,l,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=A[0],e[1]+=A[1],e[2]+=A[2],p=K(u,e,ph),f=dh,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=u,f=o.eye;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,c),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,o.viewNormalMatrix),n.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(Se.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const gh=d.vec3(),mh=d.vec3(),_h=d.vec3();d.vec3(),d.vec4();const vh=d.mat4();class bh{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=gh;if(g){const t=d.transformPoint3(c,A,mh);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,vh),f=_h,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class yh{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new wA(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new kA(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new HA(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new bh(this._scene)),this._snapRenderer||(this._snapRenderer=new XA(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new eh(this._scene)),this._snapRenderer||(this._snapRenderer=new XA(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new mA(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new mA(this._scene,!0)),this._colorRendererWithSAO}get colorQualityRendererWithSAO(){return this._colorQualityRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new wA(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new hh(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new fh(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new FA(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new SA(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new kA(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new bh(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new bh(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new HA(this._scene)),this._pickDepthRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new XA(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new eh(this._scene)),this._snapInitRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new oh(this._scene)),this._occlusionRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}const Bh={};class wh{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]}}class xh{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindTriangleIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}bindEdgeIndicesTextures(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}const Ph={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Ph,null,4));let e=0;Object.keys(Ph).forEach((t=>{t.startsWith("size")&&(e+=Ph[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Ph.totalPolygons).toFixed(2)}`);let t={};Object.keys(Ph).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Ph[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class Ch{constructor(){}disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}createTextureForColorsAndFlags(e,t,i,s,r,o,n){const a=t.length;this.numPortions=a;const l=4096,A=Math.ceil(a/512);if(0===A)throw"texture height===0";const h=new Uint8Array(16384*A);Ph.sizeDataColorsAndFlags+=h.byteLength,Ph.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),h.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20),h.set([o[e]>>24&255,o[e]>>16&255,o[e]>>8&255,255&o[e]],32*e+24),h.set([n[e]?1:0,0,0,0],32*e+28);const c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,A),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,A,e.RGBA_INTEGER,e.UNSIGNED_BYTE,h,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,c,l,A,h)}createTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Ph.sizeDataTextureOffsets+=r.byteLength,Ph.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,o,i,s,r)}createTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Ph.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Bh[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new wh,this._dtxState=new xh,this._dtxTextureFactory=new Ch,this._state=new lt({origin:d.vec3(t.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Ph.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/3})),(this._state.numVertices+s>4096*Fh||t+r>4096*Fh)&&Ph.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*Fh&&t+r<=4096*Fh}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/3/8)*3;Ph.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}if(t.edgeIndices){const e=8*Math.ceil(t.edgeIndices.length/2/8)*2;Ph.overheadSizeAlignementEdgeIndices+=2*(e-t.edgeIndices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.edgeIndices),t.edgeIndices=i}const i=t.positionsCompressed,s=t.indices,r=t.edgeIndices,o=this._buffer;o.positionsCompressed.push(i);const n=o.lenPositionsCompressed/3,a=i.length/3;let l;o.lenPositionsCompressed+=i.length;let A,h=0;if(s){let e;h=s.length/3,a<=256?(e=o.indices8Bits,l=o.lenIndices8Bits/3,o.lenIndices8Bits+=s.length):a<=65536?(e=o.indices16Bits,l=o.lenIndices16Bits/3,o.lenIndices16Bits+=s.length):(e=o.indices32Bits,l=o.lenIndices32Bits/3,o.lenIndices32Bits+=s.length),e.push(s)}let c=0;if(r){let e;c=r.length/2,a<=256?(e=o.edgeIndices8Bits,A=o.lenEdgeIndices8Bits/2,o.lenEdgeIndices8Bits+=r.length):a<=65536?(e=o.edgeIndices16Bits,A=o.lenEdgeIndices16Bits/2,o.lenEdgeIndices16Bits+=r.length):(e=o.edgeIndices32Bits,A=o.lenEdgeIndices32Bits/2,o.lenEdgeIndices32Bits+=r.length),e.push(r)}this._state.numVertices+=a,Ph.numberOfGeometries++;return{vertexBase:n,numVertices:a,numTriangles:h,numEdges:c,indicesBase:l,edgeIndicesBase:A}}_createSubPortion(e,t,i,s){const r=e.color;e.metallic,e.roughness;const o=e.colors,n=e.opacity,a=e.meshMatrix,l=e.pickColor,A=this._buffer,h=this._state;A.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),A.perObjectInstancePositioningMatrices.push(a||Th),A.perObjectSolid.push(!!e.solid),o?A.perObjectColors.push([255*o[0],255*o[1],255*o[2],255]):r&&A.perObjectColors.push([r[0],r[1],r[2],n]),A.perObjectPickColors.push(l),A.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,A.perObjectIndexBaseOffsets.push(e/3-t.indicesBase)}{let e;e=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,A.perObjectEdgeIndexBaseOffsets.push(e/2-t.edgeIndicesBase)}const c=this._subPortions.length;if(t.numTriangles>0){let e,i=3*t.numTriangles;t.numVertices<=256?(e=A.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=i,Ph.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(e=A.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=i,Ph.totalPolygons16Bits+=t.numTriangles):(e=A.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=i,Ph.totalPolygons32Bits+=t.numTriangles),Ph.totalPolygons+=t.numTriangles;for(let i=0;i0){let e,i=2*t.numEdges;t.numVertices<=256?(e=A.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=i,Ph.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(e=A.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=i,Ph.totalEdges16Bits+=t.numEdges):(e=A.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=i,Ph.totalEdges32Bits+=t.numEdges),Ph.totalEdges+=t.numEdges;for(let i=0;i0&&(t.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId8Bits)),s.perEdgeNumberPortionId16Bits.length>0&&(t.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId16Bits)),s.perEdgeNumberPortionId32Bits.length>0&&(t.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId32Bits)),s.lenIndices8Bits>0&&(t.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),s.lenEdgeIndices8Bits>0&&(t.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(i,s.edgeIndices8Bits,s.lenEdgeIndices8Bits)),s.lenEdgeIndices16Bits>0&&(t.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(i,s.edgeIndices16Bits,s.lenEdgeIndices16Bits)),s.lenEdgeIndices32Bits>0&&(t.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(i,s.edgeIndices32Bits,s.lenEdgeIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}isEmpty(){return 0===this._numPortions}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Ih)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),g.bindTexture(g.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),g.texSubImage2D(g.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,g.RGBA_INTEGER,g.UNSIGNED_BYTE,Ih))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,Ih))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,Dh))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Eh))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,go.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}_updateBackfaceCull(e,t){const i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){const e=t.gl;i?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),t.backfaces=i}}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT))}drawDepth(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED))}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED))}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED))}drawEdgesColorOpaque(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,go.EDGES_COLOR_OPAQUE)}drawEdgesColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,go.EDGES_COLOR_TRANSPARENT)}drawEdgesHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_HIGHLIGHTED)}drawEdgesSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_SELECTED)}drawEdgesXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_XRAYED)}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawShadow(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}setPickMatrices(e,t){}drawPickMesh(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,go.PICK))}drawPickDepths(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,go.PICK))}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK))}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK))}drawPickNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,go.PICK))}destroy(){if(this._destroyed)return;const e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}class Lh{constructor(e){this.id=e.id,this.colorTexture=e.colorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalsTexture=e.normalsTexture,this.emissiveTexture=e.emissiveTexture,this.occlusionTexture=e.occlusionTexture}destroy(){}}class Uh{constructor(e){this.id=e.id,this.texture=e.texture}destroy(){this.texture&&(this.texture.destroy(),this.texture=null)}}const kh={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class Oh{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(e){void 0!==this.onError&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==Vh[e])return void Vh[e].push({onLoad:t,onProgress:i,onError:s});Vh[e]=[],Vh[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),n=this.mimeType,a=this.responseType;fetch(o).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const i=Vh[e],s=t.body.getReader(),r=t.headers.get("Content-Length"),o=r?parseInt(r):0,n=0!==o;let a=0;const l=new ReadableStream({start(e){!function t(){s.read().then((({done:s,value:r})=>{if(s)e.close();else{a+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:n,loaded:a,total:o});for(let e=0,t=i.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,n)));case"json":return e.json();default:if(void 0===n)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(n),i=t&&t[1]?t[1].toLowerCase():void 0,s=new TextDecoder(i);return e.arrayBuffer().then((e=>s.decode(e)))}}})).then((t=>{kh.add(e,t);const i=Vh[e];delete Vh[e];for(let e=0,s=i.length;e{const i=Vh[e];if(void 0===i)throw this.manager.itemError(e),t;delete Vh[e];for(let e=0,s=i.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class jh{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}let Gh=0;class zh{constructor({viewer:e,transcoderPath:t,workerLimit:i}){this._transcoderPath=t||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/",this._transcoderBinary=null,this._transcoderPending=null,this._workerPool=new jh,this._workerSourceURL="",i&&this._workerPool.setWorkerLimit(i);const s=e.capabilities;this._workerConfig={astcSupported:s.astcSupported,etc1Supported:s.etc1Supported,etc2Supported:s.etc2Supported,dxtSupported:s.dxtSupported,bptcSupported:s.bptcSupported,pvrtcSupported:s.pvrtcSupported},this._supportedFileTypes=["xkt2"]}_init(){if(!this._transcoderPending){const e=new Hh;e.setPath(this._transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new Hh;i.setPath(this._transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=i.loadAsync("basis_transcoder.wasm");this._transcoderPending=Promise.all([t,s]).then((([e,t])=>{const i=zh.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(zh.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(zh.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(zh.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this._workerSourceURL=URL.createObjectURL(new Blob([s])),this._transcoderBinary=t,this._workerPool.setWorkerCreator((()=>{const e=new Worker(this._workerSourceURL),t=this._transcoderBinary.slice(0);return e.postMessage({type:"init",config:this._workerConfig,transcoderBinary:t},[t]),e}))})),Gh>0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),Gh++}return this._transcoderPending}transcode(e,t,i={}){return new Promise(((s,r)=>{const o=i;this._init().then((()=>this._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e))).then((e=>{const i=e.data,{mipmaps:o,width:n,height:a,format:l,type:A,error:h,dfdTransferFn:c,dfdFlags:u}=i;if("error"===A)return r(h);t.setCompressedData({mipmaps:o,props:{format:l,minFilter:1===o.length?1006:1008,magFilter:1===o.length?1006:1008,encoding:2===c?3001:3e3,premultiplyAlpha:!!(1&u)}}),s()}))}))}destroy(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),Gh--}}zh.BasisFormat={ETC1S:0,UASTC_4x4:1},zh.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},zh.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},zh.BasisWorker=function(){let e,t,i;const s=_EngineFormat,r=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(n){const h=n.data;switch(h.type){case"init":e=h.config,c=h.transcoderBinary,t=new Promise((e=>{i={wasmBinary:c,onRuntimeInitialized:e},BASIS(i)})).then((()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{width:t,height:n,hasAlpha:c,mipmaps:u,format:d,dfdTransferFn:p,dfdFlags:f}=function(t){const n=new i.KTX2File(new Uint8Array(t));function h(){n.close(),n.delete()}if(!n.isValid())throw h(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");const c=n.isUASTC()?o.UASTC_4x4:o.ETC1S,u=n.getWidth(),d=n.getHeight(),p=n.getLevels(),f=n.getHasAlpha(),g=n.getDFDTransferFunc(),m=n.getDFDFlags(),{transcoderFormat:_,engineFormat:v}=function(t,i,n,h){let c,u;const d=t===o.ETC1S?a:l;for(let s=0;s{delete Wh[t],i.destroy()}))),i} +class e{constructor(e,t){this.items=e||[],this._lastUniqueId=(t||0)+1}addItem(){let e;if(2===arguments.length){const t=arguments[0];if(e=arguments[1],this.items[t])throw"ID clash: '"+t+"'";return this.items[t]=e,t}for(e=arguments[0]||{};;){const t=this._lastUniqueId++;if(!this.items[t])return this.items[t]=e,t}}removeItem(e){const t=this.items[e];return delete this.items[e],t}}const t=new e;class i{constructor(e){this.id=e,this.parentItem=null,this.groups=[],this.menuElement=null,this.shown=!1,this.mouseOver=0}}class s{constructor(){this.items=[]}}class r{constructor(e,t,i,s,r){this.id=e,this.getTitle=t,this.doAction=i,this.getEnabled=s,this.getShown=r,this.itemElement=null,this.subMenu=null,this.enabled=!0}}class o{constructor(e={}){this._id=t.addItem(),this._context=null,this._enabled=!1,this._itemsCfg=[],this._rootMenu=null,this._menuList=[],this._menuMap={},this._itemList=[],this._itemMap={},this._shown=!1,this._nextId=0,this._eventSubs={},!1!==e.hideOnMouseDown&&(document.addEventListener("mousedown",(e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}}class n{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}}let a=!0,l=a?Float64Array:Float32Array;const A=new l(3),h=new l(16),c=new l(16),u=new l(4),d={setDoublePrecisionEnabled(e){a=e,l=a?Float64Array:Float32Array},getDoublePrecisionEnabled:()=>a,MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId(e,t){const i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:(e,t)=>e+"#"+t,safeInv(e){const t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:e=>new l(e||2),vec3:e=>new l(e||3),vec4:e=>new l(e||4),mat3:e=>new l(e||9),mat3ToMat4:(e,t=new l(16))=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t),mat4:e=>new l(e||16),mat4ToMat3(e,t){},doublesToFloats(e,t,i){const s=new l(2);for(let r=0,o=e.length;r{const e=[];for(let t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return()=>{const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return`${e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]}-${e[255&i]}${e[i>>8&255]}-${e[i>>16&15|64]}${e[i>>24&255]}-${e[63&s|128]}${e[s>>8&255]}-${e[s>>16&255]}${e[s>>24&255]}${e[255&r]}${e[r>>8&255]}${e[r>>16&255]}${e[r>>24&255]}`}})(),clamp:(e,t,i)=>Math.max(t,Math.min(i,e)),fmod(e,t){if(ee[0]===t[0]&&e[1]===t[1]&&e[2]===t[2],negateVec3:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t),negateVec4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t),addVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i),addVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i),addVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i),addVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i),subVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i),subVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i),subVec2:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i),geometricMeanVec2(...e){const t=new l(e[0]);for(let i=1;i(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i),subScalarVec4:(e,t,i)=>(i||(i=e),i[0]=t-e[0],i[1]=t-e[1],i[2]=t-e[2],i[3]=t-e[3],i),mulVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3],i),mulVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i),mulVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i),mulVec2Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i),divVec3:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i),divVec4:(e,t,i)=>(i||(i=e),i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i[3]=e[3]/t[3],i),divScalarVec3:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i),divVec3Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i),divVec4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]/t,i[1]=e[1]/t,i[2]=e[2]/t,i[3]=e[3]/t,i),divScalarVec4:(e,t,i)=>(i||(i=t),i[0]=e/t[0],i[1]=e/t[1],i[2]=e/t[2],i[3]=e/t[3],i),dotVec4:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],cross3Vec4(e,t){const i=e[0],s=e[1],r=e[2],o=t[0],n=t[1],a=t[2];return[s*a-r*n,r*o-i*a,i*n-s*o,0]},cross3Vec3(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=t[0],a=t[1],l=t[2];return i[0]=r*l-o*a,i[1]=o*n-s*l,i[2]=s*a-r*n,i},sqLenVec4:e=>d.dotVec4(e,e),lenVec4:e=>Math.sqrt(d.sqLenVec4(e)),dotVec3:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],dotVec2:(e,t)=>e[0]*t[0]+e[1]*t[1],sqLenVec3:e=>d.dotVec3(e,e),sqLenVec2:e=>d.dotVec2(e,e),lenVec3:e=>Math.sqrt(d.sqLenVec3(e)),distVec3:(()=>{const e=new l(3);return(t,i)=>d.lenVec3(d.subVec3(t,i,e))})(),lenVec2:e=>Math.sqrt(d.sqLenVec2(e)),distVec2:(()=>{const e=new l(2);return(t,i)=>d.lenVec2(d.subVec2(t,i,e))})(),rcpVec3:(e,t)=>d.divScalarVec3(1,e,t),normalizeVec4(e,t){const i=1/d.lenVec4(e);return d.mulVec4Scalar(e,i,t)},normalizeVec3(e,t){const i=1/d.lenVec3(e);return d.mulVec3Scalar(e,i,t)},normalizeVec2(e,t){const i=1/d.lenVec2(e);return d.mulVec2Scalar(e,i,t)},angleVec3(e,t){let i=d.dotVec3(e,t)/Math.sqrt(d.sqLenVec3(e)*d.sqLenVec3(t));return i=i<-1?-1:i>1?1:i,Math.acos(i)},vec3FromMat4Scale:(()=>{const e=new l(3);return(t,i)=>(e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=d.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=d.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=d.lenVec3(e),i)})(),vecToArray:(()=>{function e(e){return Math.round(1e5*e)/1e5}return t=>{for(let i=0,s=(t=Array.prototype.slice.call(t)).length;i({x:e[0],y:e[1],z:e[2]}),xyzObjectToArray:(e,t)=>((t=t||d.vec3())[0]=e.x,t[1]=e.y,t[2]=e.z,t),dupMat4:e=>e.slice(0,16),mat4To3:e=>[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]],m4s:e=>[e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e],setMat4ToZeroes:()=>d.m4s(0),setMat4ToOnes:()=>d.m4s(1),diagonalMat4v:e=>new l([e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,0,0,0,e[3]]),diagonalMat4c:(e,t,i,s)=>d.diagonalMat4v([e,t,i,s]),diagonalMat4s:e=>d.diagonalMat4c(e,e,e,e),identityMat4:(e=new l(16))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e),identityMat3:(e=new l(9))=>(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e),isIdentityMat4:e=>1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15],negateMat4:(e,t)=>(t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t),addMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i),addMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i),addScalarMat4:(e,t,i)=>d.addMat4Scalar(t,e,i),subMat4:(e,t,i)=>(i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i),subMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i),subScalarMat4:(e,t,i)=>(i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i),mulMat4(e,t,i){i||(i=e);const s=e[0],r=e[1],o=e[2],n=e[3],a=e[4],l=e[5],A=e[6],h=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],_=e[15],v=t[0],b=t[1],y=t[2],B=t[3],w=t[4],x=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],I=t[11],D=t[12],S=t[13],T=t[14],R=t[15];return i[0]=v*s+b*a+y*c+B*f,i[1]=v*r+b*l+y*u+B*g,i[2]=v*o+b*A+y*d+B*m,i[3]=v*n+b*h+y*p+B*_,i[4]=w*s+x*a+P*c+C*f,i[5]=w*r+x*l+P*u+C*g,i[6]=w*o+x*A+P*d+C*m,i[7]=w*n+x*h+P*p+C*_,i[8]=M*s+F*a+E*c+I*f,i[9]=M*r+F*l+E*u+I*g,i[10]=M*o+F*A+E*d+I*m,i[11]=M*n+F*h+E*p+I*_,i[12]=D*s+S*a+T*c+R*f,i[13]=D*r+S*l+T*u+R*g,i[14]=D*o+S*A+T*d+R*m,i[15]=D*n+S*h+T*p+R*_,i},mulMat3(e,t,i){i||(i=new l(9));const s=e[0],r=e[3],o=e[6],n=e[1],a=e[4],A=e[7],h=e[2],c=e[5],u=e[8],d=t[0],p=t[3],f=t[6],g=t[1],m=t[4],_=t[7],v=t[2],b=t[5],y=t[8];return i[0]=s*d+r*g+o*v,i[3]=s*p+r*m+o*b,i[6]=s*f+r*_+o*y,i[1]=n*d+a*g+A*v,i[4]=n*p+a*m+A*b,i[7]=n*f+a*_+A*y,i[2]=h*d+c*g+u*v,i[5]=h*p+c*m+u*b,i[8]=h*f+c*_+u*y,i},mulMat4Scalar:(e,t,i)=>(i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i),mulMat4v4(e,t,i=d.vec4()){const s=t[0],r=t[1],o=t[2],n=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12]*n,i[1]=e[1]*s+e[5]*r+e[9]*o+e[13]*n,i[2]=e[2]*s+e[6]*r+e[10]*o+e[14]*n,i[3]=e[3]*s+e[7]*r+e[11]*o+e[15]*n,i},transposeMat4(e,t){const i=e[4],s=e[14],r=e[8],o=e[13],n=e[12],a=e[9];if(!t||e===t){const t=e[1],l=e[2],A=e[3],h=e[6],c=e[7],u=e[11];return e[1]=i,e[2]=r,e[3]=n,e[4]=t,e[6]=a,e[7]=o,e[8]=l,e[9]=h,e[11]=s,e[12]=A,e[13]=c,e[14]=u,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=n,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=o,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3(e,t){if(t===e){const i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4(e){const t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],n=e[5],a=e[6],l=e[7],A=e[8],h=e[9],c=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15];return d*h*a*r-A*p*a*r-d*n*c*r+o*p*c*r+A*n*f*r-o*h*f*r-d*h*s*l+A*p*s*l+d*i*c*l-t*p*c*l-A*i*f*l+t*h*f*l+d*n*s*u-o*p*s*u-d*i*a*u+t*p*a*u+o*i*f*u-t*n*f*u-A*n*s*g+o*h*s*g+A*i*a*g-t*h*a*g-o*i*c*g+t*n*c*g},inverseMat4(e,t){t||(t=e);const i=e[0],s=e[1],r=e[2],o=e[3],n=e[4],a=e[5],l=e[6],A=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],_=i*a-s*n,v=i*l-r*n,b=i*A-o*n,y=s*l-r*a,B=s*A-o*a,w=r*A-o*l,x=h*f-c*p,P=h*g-u*p,C=h*m-d*p,M=c*g-u*f,F=c*m-d*f,E=u*m-d*g,I=1/(_*E-v*F+b*M+y*C-B*P+w*x);return t[0]=(a*E-l*F+A*M)*I,t[1]=(-s*E+r*F-o*M)*I,t[2]=(f*w-g*B+m*y)*I,t[3]=(-c*w+u*B-d*y)*I,t[4]=(-n*E+l*C-A*P)*I,t[5]=(i*E-r*C+o*P)*I,t[6]=(-p*w+g*b-m*v)*I,t[7]=(h*w-u*b+d*v)*I,t[8]=(n*F-a*C+A*x)*I,t[9]=(-i*F+s*C-o*x)*I,t[10]=(p*B-f*b+m*_)*I,t[11]=(-h*B+c*b-d*_)*I,t[12]=(-n*M+a*P-l*x)*I,t[13]=(i*M-s*P+r*x)*I,t[14]=(-p*y+f*v-g*_)*I,t[15]=(h*y-c*v+u*_)*I,t},traceMat4:e=>e[0]+e[5]+e[10]+e[15],translationMat4v(e,t){const i=t||d.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v(e,t){const i=t||d.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(()=>{const e=new l(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,d.translationMat4v(e,r))})(),translationMat4s:(e,t)=>d.translationMat4c(e,e,e,t),translateMat4v:(e,t)=>d.translateMat4c(e[0],e[1],e[2],t),translateMat4c(e,t,i,s){const r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;const o=s[7];s[4]+=o*e,s[5]+=o*t,s[6]+=o*i;const n=s[11];s[8]+=n*e,s[9]+=n*t,s[10]+=n*i;const a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:(e,t,i)=>(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i),rotationMat4v(e,t,i){const s=d.normalizeVec4([t[0],t[1],t[2],0],[]),r=Math.sin(e),o=Math.cos(e),n=1-o,a=s[0],l=s[1],A=s[2];let h,c,u,p,f,g;return h=a*l,c=l*A,u=A*a,p=a*r,f=l*r,g=A*r,(i=i||d.mat4())[0]=n*a*a+o,i[1]=n*h+g,i[2]=n*u-f,i[3]=0,i[4]=n*h-g,i[5]=n*l*l+o,i[6]=n*c+p,i[7]=0,i[8]=n*u+f,i[9]=n*c-p,i[10]=n*A*A+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:(e,t,i,s,r)=>d.rotationMat4v(e,[t,i,s],r),scalingMat4v:(e,t=d.identityMat4())=>(t[0]=e[0],t[5]=e[1],t[10]=e[2],t),scalingMat3v:(e,t=d.identityMat3())=>(t[0]=e[0],t[4]=e[1],t),scalingMat4c:(()=>{const e=new l(3);return(t,i,s,r)=>(e[0]=t,e[1]=i,e[2]=s,d.scalingMat4v(e,r))})(),scaleMat4c:(e,t,i,s)=>(s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s),scaleMat4v(e,t){const i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:e=>d.scalingMat4c(e,e,e),rotationTranslationMat4(e,t,i=d.mat4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=s+s,l=r+r,A=o+o,h=s*a,c=s*l,u=s*A,p=r*l,f=r*A,g=o*A,m=n*a,_=n*l,v=n*A;return i[0]=1-(p+g),i[1]=c+v,i[2]=u-_,i[3]=0,i[4]=c-v,i[5]=1-(h+g),i[6]=f+m,i[7]=0,i[8]=u+_,i[9]=f-m,i[10]=1-(h+p),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler(e,t,i=d.vec4()){const s=d.clamp,r=e[0],o=e[4],n=e[8],a=e[1],l=e[5],A=e[9],h=e[2],c=e[6],u=e[10];return"XYZ"===t?(i[1]=Math.asin(s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(-A,u),i[2]=Math.atan2(-o,r)):(i[0]=Math.atan2(c,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[1]=Math.atan2(n,u),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-h,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(c,-1,1)),Math.abs(c)<.99999?(i[1]=Math.atan2(-h,u),i[2]=Math.atan2(-o,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(h,-1,1)),Math.abs(h)<.99999?(i[0]=Math.atan2(c,u),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-o,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-A,l),i[1]=Math.atan2(-h,r)):(i[0]=0,i[1]=Math.atan2(n,u))):"XZY"===t&&(i[2]=Math.asin(-s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(c,l),i[1]=Math.atan2(n,r)):(i[0]=Math.atan2(-A,u),i[1]=0)),i},composeMat4:(e,t,i,s=d.mat4())=>(d.quaternionToRotationMat4(t,s),d.scaleMat4v(i,s),d.translateMat4v(e,s),s),decomposeMat4:(()=>{const e=new l(3),t=new l(16);return function(i,s,r,o){e[0]=i[0],e[1]=i[1],e[2]=i[2];let n=d.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];const a=d.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];const l=d.lenVec3(e);d.determinantMat4(i)<0&&(n=-n),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);const A=1/n,h=1/a,c=1/l;return t[0]*=A,t[1]*=A,t[2]*=A,t[4]*=h,t[5]*=h,t[6]*=h,t[8]*=c,t[9]*=c,t[10]*=c,d.mat4ToQuaternion(t,r),o[0]=n,o[1]=a,o[2]=l,this}})(),getColMat4(e,t){const i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v(e,t,i,s){s||(s=d.mat4());const r=e[0],o=e[1],n=e[2],a=i[0],l=i[1],A=i[2],h=t[0],c=t[1],u=t[2];if(r===h&&o===c&&n===u)return d.identityMat4();let p,f,g,m,_,v,b,y,B,w;return p=r-h,f=o-c,g=n-u,w=1/Math.sqrt(p*p+f*f+g*g),p*=w,f*=w,g*=w,m=l*g-A*f,_=A*p-a*g,v=a*f-l*p,w=Math.sqrt(m*m+_*_+v*v),w?(w=1/w,m*=w,_*=w,v*=w):(m=0,_=0,v=0),b=f*v-g*_,y=g*m-p*v,B=p*_-f*m,w=Math.sqrt(b*b+y*y+B*B),w?(w=1/w,b*=w,y*=w,B*=w):(b=0,y=0,B=0),s[0]=m,s[1]=b,s[2]=p,s[3]=0,s[4]=_,s[5]=y,s[6]=f,s[7]=0,s[8]=v,s[9]=B,s[10]=g,s[11]=0,s[12]=-(m*r+_*o+v*n),s[13]=-(b*r+y*o+B*n),s[14]=-(p*r+f*o+g*n),s[15]=1,s},lookAtMat4c:(e,t,i,s,r,o,n,a,l)=>d.lookAtMat4v([e,t,i],[s,r,o],[n,a,l],[]),orthoMat4c(e,t,i,s,r,o,n){n||(n=d.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2/l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=-2/A,n[11]=0,n[12]=-(e+t)/a,n[13]=-(s+i)/l,n[14]=-(o+r)/A,n[15]=1,n},frustumMat4v(e,t,i){i||(i=d.mat4());const s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];d.addVec4(r,s,h),d.subVec4(r,s,c);const o=2*s[2],n=c[0],a=c[1],l=c[2];return i[0]=o/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o/a,i[6]=0,i[7]=0,i[8]=h[0]/n,i[9]=h[1]/a,i[10]=-h[2]/l,i[11]=-1,i[12]=0,i[13]=0,i[14]=-o*r[2]/l,i[15]=0,i},frustumMat4(e,t,i,s,r,o,n){n||(n=d.mat4());const a=t-e,l=s-i,A=o-r;return n[0]=2*r/a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=2*r/l,n[6]=0,n[7]=0,n[8]=(t+e)/a,n[9]=(s+i)/l,n[10]=-(o+r)/A,n[11]=-1,n[12]=0,n[13]=0,n[14]=-o*r*2/A,n[15]=0,n},perspectiveMat4(e,t,i,s,r){const o=[],n=[];return o[2]=i,n[2]=s,n[1]=o[2]*Math.tan(e/2),o[1]=-n[1],n[0]=n[1]*t,o[0]=-n[0],d.frustumMat4v(o,n,r)},compareMat4:(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15],transformPoint3(e,t,i=d.vec3()){const s=t[0],r=t[1],o=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*o+e[12],i[1]=e[1]*s+e[5]*r+e[9]*o+e[13],i[2]=e[2]*s+e[6]*r+e[10]*o+e[14],i},transformPoint4:(e,t,i=d.vec4())=>(i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i),transformPoints3(e,t,i){const s=i||[],r=t.length;let o,n,a,l;const A=e[0],h=e[1],c=e[2],u=e[3],d=e[4],p=e[5],f=e[6],g=e[7],m=e[8],_=e[9],v=e[10],b=e[11],y=e[12],B=e[13],w=e[14],x=e[15];let P;for(let e=0;e{const e=new l(16),t=new l(16),i=new l(16);return function(s,r,o,n){return this.transformVec3(this.mulMat4(this.inverseMat4(r,e),this.inverseMat4(o,t),i),s,n)}})(),lerpVec3(e,t,i,s,r,o){const n=o||d.vec3(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n},lerpMat4(e,t,i,s,r,o){const n=o||d.mat4(),a=(e-t)/(i-t);return n[0]=s[0]+a*(r[0]-s[0]),n[1]=s[1]+a*(r[1]-s[1]),n[2]=s[2]+a*(r[2]-s[2]),n[3]=s[3]+a*(r[3]-s[3]),n[4]=s[4]+a*(r[4]-s[4]),n[5]=s[5]+a*(r[5]-s[5]),n[6]=s[6]+a*(r[6]-s[6]),n[7]=s[7]+a*(r[7]-s[7]),n[8]=s[8]+a*(r[8]-s[8]),n[9]=s[9]+a*(r[9]-s[9]),n[10]=s[10]+a*(r[10]-s[10]),n[11]=s[11]+a*(r[11]-s[11]),n[12]=s[12]+a*(r[12]-s[12]),n[13]=s[13]+a*(r[13]-s[13]),n[14]=s[14]+a*(r[14]-s[14]),n[15]=s[15]+a*(r[15]-s[15]),n},flatten(e){const t=[];let i,s,r,o,n;for(i=0,s=e.length;i(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e),eulerToQuaternion(e,t,i=d.vec4()){const s=e[0]*d.DEGTORAD/2,r=e[1]*d.DEGTORAD/2,o=e[2]*d.DEGTORAD/2,n=Math.cos(s),a=Math.cos(r),l=Math.cos(o),A=Math.sin(s),h=Math.sin(r),c=Math.sin(o);return"XYZ"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l-A*h*c):"YXZ"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l+A*h*c):"ZXY"===t?(i[0]=A*a*l-n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l-A*h*c):"ZYX"===t?(i[0]=A*a*l-n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l+A*h*c):"YZX"===t?(i[0]=A*a*l+n*h*c,i[1]=n*h*l+A*a*c,i[2]=n*a*c-A*h*l,i[3]=n*a*l-A*h*c):"XZY"===t&&(i[0]=A*a*l-n*h*c,i[1]=n*h*l-A*a*c,i[2]=n*a*c+A*h*l,i[3]=n*a*l+A*h*c),i},mat4ToQuaternion(e,t=d.vec4()){const i=e[0],s=e[4],r=e[8],o=e[1],n=e[5],a=e[9],l=e[2],A=e[6],h=e[10];let c;const u=i+n+h;return u>0?(c=.5/Math.sqrt(u+1),t[3]=.25/c,t[0]=(A-a)*c,t[1]=(r-l)*c,t[2]=(o-s)*c):i>n&&i>h?(c=2*Math.sqrt(1+i-n-h),t[3]=(A-a)/c,t[0]=.25*c,t[1]=(s+o)/c,t[2]=(r+l)/c):n>h?(c=2*Math.sqrt(1+n-i-h),t[3]=(r-l)/c,t[0]=(s+o)/c,t[1]=.25*c,t[2]=(a+A)/c):(c=2*Math.sqrt(1+h-i-n),t[3]=(o-s)/c,t[0]=(r+l)/c,t[1]=(a+A)/c,t[2]=.25*c),t},vec3PairToQuaternion(e,t,i=d.vec4()){const s=Math.sqrt(d.dotVec3(e,e)*d.dotVec3(t,t));let r=s+d.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):d.cross3Vec3(e,t,i),i[3]=r,d.normalizeQuaternion(i)},angleAxisToQuaternion(e,t=d.vec4()){const i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:(()=>{const e=new l(16);return(t,i,s)=>(s=s||d.vec3(),d.quaternionToRotationMat4(t,e),d.mat4ToEuler(e,i,s),s)})(),mulQuaternions(e,t,i=d.vec4()){const s=e[0],r=e[1],o=e[2],n=e[3],a=t[0],l=t[1],A=t[2],h=t[3];return i[0]=n*a+s*h+r*A-o*l,i[1]=n*l+r*h+o*a-s*A,i[2]=n*A+o*h+s*l-r*a,i[3]=n*h-s*a-r*l-o*A,i},vec3ApplyQuaternion(e,t,i=d.vec3()){const s=t[0],r=t[1],o=t[2],n=e[0],a=e[1],l=e[2],A=e[3],h=A*s+a*o-l*r,c=A*r+l*s-n*o,u=A*o+n*r-a*s,p=-n*s-a*r-l*o;return i[0]=h*A+p*-n+c*-l-u*-a,i[1]=c*A+p*-a+u*-n-h*-l,i[2]=u*A+p*-l+h*-a-c*-n,i},quaternionToMat4(e,t){t=d.identityMat4(t);const i=e[0],s=e[1],r=e[2],o=e[3],n=2*i,a=2*s,l=2*r,A=n*o,h=a*o,c=l*o,u=n*i,p=a*i,f=l*i,g=a*s,m=l*s,_=l*r;return t[0]=1-(g+_),t[1]=p+c,t[2]=f-h,t[4]=p-c,t[5]=1-(u+_),t[6]=m+A,t[8]=f+h,t[9]=m-A,t[10]=1-(u+g),t},quaternionToRotationMat4(e,t){const i=e[0],s=e[1],r=e[2],o=e[3],n=i+i,a=s+s,l=r+r,A=i*n,h=i*a,c=i*l,u=s*a,d=s*l,p=r*l,f=o*n,g=o*a,m=o*l;return t[0]=1-(u+p),t[4]=h-m,t[8]=c+g,t[1]=h+m,t[5]=1-(A+p),t[9]=d-f,t[2]=c-g,t[6]=d+f,t[10]=1-(A+u),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion(e,t=e){const i=d.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:(e,t=e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t),inverseQuaternion:(e,t)=>d.normalizeQuaternion(d.conjugateQuaternion(e,t)),quaternionToAngleAxis(e,t=d.vec4()){const i=(e=d.normalizeQuaternion(e,u))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:e=>new l(e||6),AABB2:e=>new l(e||4),OBB3:e=>new l(e||32),OBB2:e=>new l(e||16),Sphere3:(e,t,i,s)=>new l([e,t,i,s]),transformOBB3(e,t,i=t){let s;const r=t.length;let o,n,a;const l=e[0],A=e[1],h=e[2],c=e[3],u=e[4],d=e[5],p=e[6],f=e[7],g=e[8],m=e[9],_=e[10],v=e[11],b=e[12],y=e[13],B=e[14],w=e[15];for(s=0;s{const e=new l(3),t=new l(3),i=new l(3);return s=>(e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5],d.subVec3(t,e,i),Math.abs(d.lenVec3(i)))})(),getAABB3DiagPoint:(()=>{const e=new l(3),t=new l(3),i=new l(3);return(s,r)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],t[0]=s[3],t[1]=s[4],t[2]=s[5];const o=d.subVec3(t,e,i),n=r[0]-s[0],a=s[3]-r[0],l=r[1]-s[1],A=s[4]-r[1],h=r[2]-s[2],c=s[5]-r[2];return o[0]+=n>a?n:a,o[1]+=l>A?l:A,o[2]+=h>c?h:c,Math.abs(d.lenVec3(o))}})(),getAABB3Area:e=>(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2]),getAABB3Center(e,t){const i=t||d.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center(e,t){const i=t||d.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:(e=d.AABB3())=>(e[0]=d.MAX_DOUBLE,e[1]=d.MAX_DOUBLE,e[2]=d.MAX_DOUBLE,e[3]=d.MIN_DOUBLE,e[4]=d.MIN_DOUBLE,e[5]=d.MIN_DOUBLE,e),AABB3ToOBB3:(e,t=d.OBB3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t),positions3ToAABB3:(()=>{const e=new l(3);return(t,i,s)=>{i=i||d.AABB3();let r,o,n,a=d.MAX_DOUBLE,l=d.MAX_DOUBLE,A=d.MAX_DOUBLE,h=d.MIN_DOUBLE,c=d.MIN_DOUBLE,u=d.MIN_DOUBLE;for(let i=0,p=t.length;ih&&(h=r),o>c&&(c=o),n>u&&(u=n);return i[0]=a,i[1]=l,i[2]=A,i[3]=h,i[4]=c,i[5]=u,i}})(),OBB3ToAABB3(e,t=d.AABB3()){let i,s,r,o=d.MAX_DOUBLE,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE,h=d.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToAABB3(e,t=d.AABB3()){let i,s,r,o=d.MAX_DOUBLE,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE,h=d.MIN_DOUBLE;for(let t=0,c=e.length;tl&&(l=i),s>A&&(A=s),r>h&&(h=r);return t[0]=o,t[1]=n,t[2]=a,t[3]=l,t[4]=A,t[5]=h,t},points3ToSphere3:(()=>{const e=new l(3);return(t,i)=>{i=i||d.vec4();let s,r=0,o=0,n=0;const a=t.length;for(s=0;sA&&(A=l);return i[3]=A,i}})(),positions3ToSphere3:(()=>{const e=new l(3),t=new l(3);return(i,s)=>{s=s||d.vec4();let r,o=0,n=0,a=0;const l=i.length;let A=0;for(r=0;rA&&(A=c);return s[3]=A,s}})(),OBB3ToSphere3:(()=>{const e=new l(3),t=new l(3);return(i,s)=>{s=s||d.vec4();let r,o=0,n=0,a=0;const l=i.length,A=l/4;for(r=0;rc&&(c=h);return s[3]=c,s}})(),getSphere3Center:(e,t=d.vec3())=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t),getPositionsCenter(e,t=d.vec3()){let i=0,s=0,r=0;for(var o=0,n=e.length;o(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3](e[0]=d.MAX_DOUBLE,e[1]=d.MAX_DOUBLE,e[2]=d.MIN_DOUBLE,e[3]=d.MIN_DOUBLE,e),point3AABB3Intersect:(e,t)=>e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]);if(s<=-t&&r<=-t)return-1;return s>=-t&&r>=-t?1:0},OBB3ToAABB2(e,t=d.AABB2()){let i,s,r,o,n=d.MAX_DOUBLE,a=d.MAX_DOUBLE,l=d.MIN_DOUBLE,A=d.MIN_DOUBLE;for(let t=0,h=e.length;tl&&(l=i),s>A&&(A=s);return t[0]=n,t[1]=a,t[2]=l,t[3]=A,t},expandAABB2:(e,t)=>(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2](e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]2*(1-e)*(i-t)+2*e*(s-i),tangentQuadraticBezier3:(e,t,i,s,r)=>-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r,tangentSpline:e=>6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e),catmullRomInterpolate(e,t,i,s,r){const o=.5*(i-e),n=.5*(s-t),a=r*r;return(2*t-2*i+o+n)*(r*a)+(-3*t+3*i-2*o-n)*a+o*r+t},b2p0(e,t){const i=1-e;return i*i*t},b2p1:(e,t)=>2*(1-e)*e*t,b2p2:(e,t)=>e*e*t,b2(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0(e,t){const i=1-e;return i*i*i*t},b3p1(e,t){const i=1-e;return 3*i*i*e*t},b3p2:(e,t)=>3*(1-e)*e*e*t,b3p3:(e,t)=>e*e*e*t,b3(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal(e,t,i,s=d.vec3()){const r=t[0]-e[0],o=t[1]-e[1],n=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],A=i[2]-e[2],h=o*A-n*l,c=n*a-r*A,u=r*l-o*a,p=Math.sqrt(h*h+c*c+u*u);return 0===p?(s[0]=0,s[1]=0,s[2]=0):(s[0]=h/p,s[1]=c/p,s[2]=u/p),s},rayTriangleIntersect:(()=>{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3);return(o,n,a,l,A,h)=>{h=h||d.vec3();const c=d.subVec3(l,a,e),u=d.subVec3(A,a,t),p=d.cross3Vec3(n,u,i),f=d.dotVec3(c,p);if(f<1e-6)return null;const g=d.subVec3(o,a,s),m=d.dotVec3(g,p);if(m<0||m>f)return null;const _=d.cross3Vec3(g,c,r),v=d.dotVec3(n,_);if(v<0||m+v>f)return null;const b=d.dotVec3(u,_)/f;return h[0]=o[0]+b*n[0],h[1]=o[1]+b*n[1],h[2]=o[2]+b*n[2],h}})(),rayPlaneIntersect:(()=>{const e=new l(3),t=new l(3),i=new l(3),s=new l(3);return(r,o,n,a,l,A)=>{A=A||d.vec3(),o=d.normalizeVec3(o,e);const h=d.subVec3(a,n,t),c=d.subVec3(l,n,i),u=d.cross3Vec3(h,c,s);d.normalizeVec3(u,u);const p=-d.dotVec3(n,u),f=-(d.dotVec3(r,u)+p)/d.dotVec3(o,u);return A[0]=r[0]+f*o[0],A[1]=r[1]+f*o[1],A[2]=r[2]+f*o[2],A}})(),cartesianToBarycentric:(()=>{const e=new l(3),t=new l(3),i=new l(3);return(s,r,o,n,a)=>{const l=d.subVec3(n,r,e),A=d.subVec3(o,r,t),h=d.subVec3(s,r,i),c=d.dotVec3(l,l),u=d.dotVec3(l,A),p=d.dotVec3(l,h),f=d.dotVec3(A,A),g=d.dotVec3(A,h),m=c*f-u*u;if(0===m)return null;const _=1/m,v=(f*p-u*g)*_,b=(c*g-u*p)*_;return a[0]=1-v-b,a[1]=b,a[2]=v,a}})(),barycentricInsideTriangle(e){const t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian(e,t,i,s,r=d.vec3()){const o=e[0],n=e[1],a=e[2];return r[0]=t[0]*o+i[0]*n+s[0]*a,r[1]=t[1]*o+i[1]*n+s[1]*a,r[2]=t[2]*o+i[2]*n+s[2]*a,r},mergeVertices(e,t,i,s){const r={},o=[],n=[],a=t?[]:null,l=i?[]:null,A=[];let h,c,u,d;const p=1e4;let f,g,m=0;for(f=0,g=e.length;f{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3),o=new l(3);return(n,a,l)=>{let A,h;const c=new Array(n.length/3);let u,p,f,g,m,_,v;for(A=0,h=a.length;A{const e=new l(3),t=new l(3),i=new l(3),s=new l(3),r=new l(3),o=new l(3),n=new l(3);return(a,l,A)=>{const h=new Float32Array(a.length);for(let c=0;c>24&255,h=u>>16&255,A=u>>8&255,l=255&u,a=t[i],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+1],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,a=t[i+2],n=3*a,r[d++]=e[n],r[d++]=e[n+1],r[d++]=e[n+2],o[p++]=l,o[p++]=A,o[p++]=h,o[p++]=c,u++;return{positions:r,colors:o}},faceToVertexNormals(e,t,i={}){const s=i.smoothNormalsAngleThreshold||20,r={},o=[],n={};let a,l,A,h,c;const u=1e4;let p,f,g,m,_,v;for(f=0,m=e.length;f{const e=new l(4),t=new l(4);return(i,s,r,o,n)=>{e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=1,d.transformVec4(i,e,t),o[0]=t[0],o[1]=t[1],o[2]=t[2],e[0]=r[0],e[1]=r[1],e[2]=r[2],d.transformVec3(i,e,t),d.normalizeVec3(t),n[0]=t[0],n[1]=t[1],n[2]=t[2]}})(),canvasPosToWorldRay:(()=>{const e=new l(16),t=new l(16),i=new l(4),s=new l(4),r=new l(4),o=new l(4);return(n,a,l,A,h,c)=>{const u=d.mulMat4(l,a,e),p=d.inverseMat4(u,t),f=n.width,g=n.height,m=(A[0]-f/2)/(f/2),_=-(A[1]-g/2)/(g/2);i[0]=m,i[1]=_,i[2]=-1,i[3]=1,d.transformVec4(p,i,s),d.mulVec4Scalar(s,1/s[3]),r[0]=m,r[1]=_,r[2]=1,r[3]=1,d.transformVec4(p,r,o),d.mulVec4Scalar(o,1/o[3]),h[0]=o[0],h[1]=o[1],h[2]=o[2],d.subVec3(o,s,c),d.normalizeVec3(c)}})(),canvasPosToLocalRay:(()=>{const e=new l(3),t=new l(3);return(i,s,r,o,n,a,l)=>{d.canvasPosToWorldRay(i,s,r,n,e,t),d.worldRayToLocalRay(o,e,t,a,l)}})(),worldRayToLocalRay:(()=>{const e=new l(16),t=new l(4),i=new l(4);return(s,r,o,n,a)=>{const l=d.inverseMat4(s,e);t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,d.transformVec4(l,t,i),n[0]=i[0],n[1]=i[1],n[2]=i[2],d.transformVec3(l,o,a)}})(),buildKDTree:(()=>{const e=new Float32Array;function t(i,s,r,o){const n=new l(6),a={triangles:null,left:null,right:null,leaf:!1,splitDim:0,aabb:n};let A,h;for(n[0]=n[1]=n[2]=Number.POSITIVE_INFINITY,n[3]=n[4]=n[5]=Number.NEGATIVE_INFINITY,A=0,h=i.length;An[3]&&(n[3]=r[t]),r[t+1]n[4]&&(n[4]=r[t+1]),r[t+2]n[5]&&(n[5]=r[t+2])}}if(i.length<20||o>10)return a.triangles=i,a.leaf=!0,a;e[0]=n[3]-n[0],e[1]=n[4]-n[1],e[2]=n[5]-n[2];let u=0;e[1]>e[u]&&(u=1),e[2]>e[u]&&(u=2),a.splitDim=u;const d=(n[u]+n[u+3])/2,p=new Array(i.length);let f=0;const g=new Array(i.length);let m=0;for(A=0,h=i.length;A{const s=e.length/3,r=new Array(s);for(let e=0;e=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t},octDecodeVec2s(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t}};d.buildEdgeIndices=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}(),d.planeClipsPositions3=function(e,t,i,s=3){for(let r=0,o=i.length;r{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&d.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&d.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;p[0]=r[3]-r[0],p[1]=r[4]-r[1],p[2]=r[5]-r[2];let o=0;if(p[1]>p[o]&&(o=1),p[2]>p[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},d.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},d.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}}class g{constructor(){this._head=[],this._headLength=0,this._tail=[],this._index=0,this._length=0}get length(){return this._length}shift(){if(this._index>=this._headLength){const e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}const e=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,e}push(e){return this._length++,this._tail.push(e),this}unshift(e){return this._head[--this._index]=e,this._length++,this}}const m={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var _=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r{};t=t||s,i=i||s;var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.addEventListener("load",(function(e){var s=e.target.response;if(200===this.status){var r;try{r=JSON.parse(s)}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}t(r)}else if(0===this.status){console.warn("loadFile: HTTP Status 0 received.");try{t(JSON.parse(s))}catch(e){i(`utils.loadJSON(): Failed to parse JSON response - ${e}`)}}else i(e)}),!1),r.addEventListener("error",(function(e){i(e)}),!1),r.send(null)},loadArraybuffer:function(e,t,i){var s=e=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{t(e)}))}catch(e){I.scheduleTask((()=>{i(e)}))}}else{const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i("loadArrayBuffer error : "+s.response))},s.send(null)}},queryString:b,isArray:function(e){return e&&!e.propertyIsEnumerable("length")&&"object"==typeof e&&"number"==typeof e.length},isString:function(e){return"string"==typeof e||e instanceof String},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isID:function(e){return y.isString(e)||y.isNumeric(e)},isSameComponent:function(e,t){return!(!e||!t)&&(y.isNumeric(e)||y.isString(e)?`${e}`:e.id)===(y.isNumeric(t)||y.isString(t)?`${t}`:t.id)},isFunction:function(e){return"function"==typeof e},isObject:function(e){const t={}.constructor;return!!e&&e.constructor===t},copy:function(e){return y.apply(e,{})},apply:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},apply2:function(e,t){for(const i in e)e.hasOwnProperty(i)&&void 0!==e[i]&&null!==e[i]&&(t[i]=e[i]);return t},applyIf:function(e,t){for(const i in e)e.hasOwnProperty(i)&&(void 0!==t[i]&&null!==t[i]||(t[i]=e[i]));return t},isEmptyObject:function(e){for(const t in e)if(e.hasOwnProperty(t))return!1;return!0},inQuotes:function(e){return y.isNumeric(e)?`${e}`:`'${e}'`},concat:function(e,t){const i=new e.constructor(e.length+t.length);return i.set(e),i.set(t,e.length),i},flattenParentChildHierarchy:function(e){var t=[];return function e(i){i.id=i.uuid,delete i.oid,t.push(i);var s=i.children;if(s)for(var r=0,o=s.length;r{w.removeItem(e.id),delete I.scenes[e.id],delete B[e.id],m.components.scenes--}))},this.clear=function(){let e;for(const t in I.scenes)I.scenes.hasOwnProperty(t)&&(e=I.scenes[t],"default.scene"===t?e.clear():(e.destroy(),delete I.scenes[e.id]))},this.scheduleTask=function(e,t=null){x.push(e),x.push(t)},this.runTasks=function(e=-1){let t,i,s=(new Date).getTime(),r=0;for(;x.length>0&&(e<0||s0&&M>0){var t=1e3/M;E+=t,C.push(t),C.length>=30&&(E-=C.shift()),m.frame.fps=Math.round(E/C.length)}for(let e in I.scenes)I.scenes[e].compile();T(e),F=e};!function(e,t){let i=Date.now()+t;(function s(){const r=Date.now()-i;e(),i+=t,setTimeout(s,Math.max(0,t-r))})()}((()=>{D()}),100);const S=function(){let e=Date.now();if(M=e-F,F>0&&M>0){var t=1e3/M;E+=t,C.push(t),C.length>=30&&(E-=C.shift()),m.frame.fps=Math.round(E/C.length)}T(e),function(e){for(var t in P.time=e,I.scenes)if(I.scenes.hasOwnProperty(t)){var i=I.scenes[t];P.sceneId=t,P.startTime=i.startTime,P.deltaTime=null!=P.prevTime?P.time-P.prevTime:0,i.fire("tick",P,!0)}P.prevTime=e}(e),function(){const e=I.scenes,t=!1;let i,s,r,o,n;for(n in e)e.hasOwnProperty(n)&&(i=e[n],s=B[n],s||(s=B[n]={}),r=i.ticksPerOcclusionTest,s.ticksPerOcclusionTest!==r&&(s.ticksPerOcclusionTest=r,s.renderCountdown=r),--i.occlusionTestCountdown<=0&&(i.doOcclusionTest(),i.occlusionTestCountdown=r),o=i.ticksPerRender,s.ticksPerRender!==o&&(s.ticksPerRender=o,s.renderCountdown=o),0==--s.renderCountdown&&(i.render(t),s.renderCountdown=o))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(D):requestAnimationFrame(S)};function T(e){const t=I.runTasks(e+10),i=I.getNumTasks();m.frame.tasksRun=t,m.frame.tasksScheduled=i,m.frame.tasksBudget=10}S();class R{get type(){return"Component"}get isComponent(){return!0}constructor(e=null,t={}){if(this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=t.viewer;else{if("Scene"===e.type)this.scene=e;else{if(!(e instanceof R))throw"Invalid param: owner must be a Component";this.scene=e.scene}this._owner=e}this._dontClear=!!t.dontClear,this._renderer=this.scene._renderer,this.meta=t.meta||{},this.id=t.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,e&&e._own(this)}glRedraw(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}glResort(){this._renderer&&this._renderer.needStateSort()}get owner(){return this._owner}isType(e){return this.type===e}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}_message(e){return" ["+this.type+" "+y.inQuotes(this.id)+"]: "+e}warn(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}error(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}_attach(e){const t=e.name;if(!t)return void this.error("Component 'name' expected");let i=e.component;const s=e.sceneDefault,r=e.sceneSingleton,o=e.type,n=e.on,a=!1!==e.recompiles;if(i&&(y.isNumeric(i)||y.isString(i))){const e=i;if(i=this.scene.components[e],!i)return void this.error("Component not found: "+y.inQuotes(e))}if(!i)if(!0===r){const e=this.scene.types[o];for(const t in e)if(e.hasOwnProperty){i=e[t];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&(i=this.scene[t],!i))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+y.inQuotes(i.id));if(o&&!i.isType(o))return void this.error("Expected a "+o+" type or subtype: "+i.type+" "+y.inQuotes(i.id))}this._attachments||(this._attachments={});const l=this._attached[t];let A,h,c;if(l){if(i&&l.id===i.id)return;const e=this._attachments[l.id];for(A=e.subs,h=0,c=A.length;h{delete this._ownedComponents[e.id]}),this)}_needUpdate(e){this._updateScheduled||(this._updateScheduled=!0,0===e?this._doUpdate():I.scheduleTask(this._doUpdate,this))}_doUpdate(){this._updateScheduled&&(this._updateScheduled=!1,this._update&&this._update())}scheduleTask(e){I.scheduleTask(e,null)}_update(){}clear(){if(this._ownedComponents)for(var e in this._ownedComponents)if(this._ownedComponents.hasOwnProperty(e)){this._ownedComponents[e].destroy(),delete this._ownedComponents[e]}}destroy(){if(this.destroyed)return;let e,t,i,s,r,o;if(this.fire("destroyed",this.destroyed=!0),this._attachments)for(e in this._attachments)if(this._attachments.hasOwnProperty(e)){for(t=this._attachments[e],i=t.component,s=t.subs,r=0,o=s.length;r=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}class N{constructor(){this.planes=[new O,new O,new O,new O,new O,new O]}}function Q(e,t,i){const s=d.mulMat4(i,t,k),r=s[0],o=s[1],n=s[2],a=s[3],l=s[4],A=s[5],h=s[6],c=s[7],u=s[8],p=s[9],f=s[10],g=s[11],m=s[12],_=s[13],v=s[14],b=s[15];e.planes[0].set(a-r,c-l,g-u,b-m),e.planes[1].set(a+r,c+l,g+u,b+m),e.planes[2].set(a-o,c-A,g-p,b-_),e.planes[3].set(a+o,c+A,g+p,b+_),e.planes[4].set(a-n,c-h,g-f,b-v),e.planes[5].set(a+n,c+h,g+f,b+v)}function V(e,t){let i=N.INSIDE;const s=L,r=U;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];const o=[s,r];for(let t=0;t<6;++t){const s=e.planes[t];if(s.normal[0]*o[s.testVertex[0]][0]+s.normal[1]*o[s.testVertex[1]][1]+s.normal[2]*o[s.testVertex[2]][2]+s.offset<0)return N.OUTSIDE;s.normal[0]*o[1-s.testVertex[0]][0]+s.normal[1]*o[1-s.testVertex[1]][1]+s.normal[2]*o[1-s.testVertex[2]][2]+s.offset<0&&(i=N.INTERSECT)}return i}N.INSIDE=0,N.INTERSECT=1,N.OUTSIDE=2;class H extends R{constructor(e={}){if(!e.viewer)throw"[MarqueePicker] Missing config: viewer";if(!e.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";super(e.viewer.scene,e),this.viewer=e.viewer,this._objectsKdTree3=e.objectsKdTree3,this._canvasMarqueeCorner1=d.vec2(),this._canvasMarqueeCorner2=d.vec2(),this._canvasMarquee=d.AABB2(),this._marqueeFrustum=new N,this._marqueeFrustumProjMat=d.mat4(),this._pickMode=!1,this._marqueeElement=document.createElement("div"),document.body.appendChild(this._marqueeElement),this._marqueeElement.style.position="absolute",this._marqueeElement.style["z-index"]="40000005",this._marqueeElement.style.width="8px",this._marqueeElement.style.height="8px",this._marqueeElement.style.visibility="hidden",this._marqueeElement.style.top="0px",this._marqueeElement.style.left="0px",this._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",this._marqueeElement.style.opacity=1,this._marqueeElement.style["pointer-events"]="none"}setMarqueeCorner1(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarqueeCorner2(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}setMarquee(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}setMarqueeVisible(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}getMarqueeVisible(){return this._marqueVisible}setPickMode(e){if(e!==H.PICK_MODE_INSIDE&&e!==H.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===H.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}getPickMode(){return this._pickMode}clear(){this.fire("clear",{})}pick(){this._updateMarquee(),this._buildMarqueeFrustum();const e=[],t=(i,s=N.INTERSECT)=>{if(s===N.INTERSECT&&(s=V(this._marqueeFrustum,i.aabb)),s!==N.OUTSIDE){if(i.entities){const t=i.entities;for(let i=0,s=t.length;i3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&t(this._objectsKdTree3.root),this.fire("picked",e),e}_updateMarquee(){this._canvasMarquee[0]=Math.min(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[1]=Math.min(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._canvasMarquee[2]=Math.max(this._canvasMarqueeCorner1[0],this._canvasMarqueeCorner2[0]),this._canvasMarquee[3]=Math.max(this._canvasMarqueeCorner1[1],this._canvasMarqueeCorner2[1]),this._marqueeElement.style.width=this._canvasMarquee[2]-this._canvasMarquee[0]+"px",this._marqueeElement.style.height=this._canvasMarquee[3]-this._canvasMarquee[1]+"px",this._marqueeElement.style.left=`${this._canvasMarquee[0]}px`,this._marqueeElement.style.top=`${this._canvasMarquee[1]}px`}_buildMarqueeFrustum(){const e=this.viewer.scene.canvas.canvas,t=e.clientWidth,i=e.clientHeight,s=e.clientLeft,r=e.clientTop,o=2/t,n=2/i,a=e.clientHeight/e.clientWidth,l=(this._canvasMarquee[0]-s)*o-1,A=(this._canvasMarquee[2]-s)*o-1,h=-(this._canvasMarquee[3]-r)*n+1,c=-(this._canvasMarquee[1]-r)*n+1,u=this.viewer.scene.camera.frustum.near*(17*a);d.frustumMat4(l,A,h*a,c*a,u,1e4,this._marqueeFrustumProjMat),Q(this._marqueeFrustum,this.viewer.scene.camera.viewMatrix,this._marqueeFrustumProjMat)}destroy(){super.destroy(),this._marqueeElement.parentElement&&(this._marqueeElement.parentElement.removeChild(this._marqueeElement),this._marqueeElement=null,this._objectsKdTree3=null)}}H.PICK_MODE_INTERSECTS=0,H.PICK_MODE_INSIDE=1;class j extends R{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{if(!this._running)return;i||(i=e);const r=e-i,o=Math.min(r/300,1),n=t+(2-t)*o;this._circleRadius=n,this._circleDiv.style.width=`${this._circleRadius}px`,this._circleDiv.style.height=`${this._circleRadius}px`,this._circleDiv.style.marginLeft=this._circlePos[0]-this._circleRadius/2+"px",this._circleDiv.style.marginTop=this._circlePos[1]-this._circleRadius/2+"px",o<1&&requestAnimationFrame(s)};this._running=!0,requestAnimationFrame(s),this._circleDiv.style.visibility="visible"}stop(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius=`${this._circleRadius}px`,this._circleDiv.style.visibility="hidden")}set durationMs(e){this.stop(),this._durationMs=e}get durationMs(){return this._durationMs}destroy(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}class z{constructor(e,t,i){this.id=i&&i.id?i.id:e,this.viewer=t,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,t.addPlugin(this)}scheduleTask(e){I.scheduleTask(e,null)}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];let r;if(s)for(const i in s)s.hasOwnProperty(i)&&(r=s[i],this._eventCallDepth++,this._eventCallDepth<300?r.callback.call(r.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}on(t,i,s){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new e),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});let r=this._eventSubs[t];r?this._eventSubsNum[t]++:(r={},this._eventSubs[t]=r,this._eventSubsNum[t]=1);const o=this._subIdMap.addItem();r[o]={callback:i,scope:s||this},this._subIdEvents[o]=t;const n=this._events[t];return void 0!==n&&i.call(s||this,n),o}off(e){if(null==e)return;if(!this._subIdEvents)return;const t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];const i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}once(e,t,i){const s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}hasSubs(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}log(e){console.log(`[xeokit plugin ${this.id}]: ${e}`)}warn(e){console.warn(`[xeokit plugin ${this.id}]: ${e}`)}error(e){console.error(`[xeokit plugin ${this.id}]: ${e}`)}send(e,t){}destroy(){this.viewer.removePlugin(this)}}const W=d.vec3(),K=function(){const e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,o){return o=o||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,d.transformVec4(s,t,i),d.setMat4Translation(s,i,o),o.slice()}}();function X(e,t,i){const s=Float32Array.from([e[0]])[0],r=e[0]-s,o=Float32Array.from([e[1]])[0],n=e[1]-o,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=o,t[2]=a,i[0]=r,i[1]=n,i[2]=l}function J(e,t,i,s=1e3){const r=d.getPositionsCenter(e,W),o=Math.round(r[0]/s)*s,n=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=o,i[1]=n,i[2]=a;const l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(let i=0,s=e.length;i0?this.meshes[0]._colorize[3]/255:1}set opacity(e){if(0===this.meshes.length)return;const t=null!=e,i=this.meshes[0]._colorize[3];let s=255;if(t){if(e<0?e=0:e>1&&(e=1),s=Math.floor(255*e),i===s)return}else if(s=255,i===s)return;for(let e=0,t=this.meshes.length;e{this._viewPosDirty=!0,this._needUpdate()})),this._onCameraProjMatrix=this.scene.camera.on("projMatrix",(()=>{this._canvasPosDirty=!0,this._needUpdate()})),this._onEntityDestroyed=null,this._onEntityModelDestroyed=null,this._renderer.addMarker(this),this.entity=t.entity,this.worldPos=t.worldPos,this.occludable=t.occludable}_update(){if(this._viewPosDirty&&(d.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos),this._viewPosDirty=!1,this._canvasPosDirty=!0,this.fire("viewPos",this._viewPos)),this._canvasPosDirty){he.set(this._viewPos),he[3]=1,d.transformPoint4(this.scene.camera.projMatrix,he,ce);const e=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+ce[0]/ce[3])*e[2]/2),this._canvasPos[1]=Math.floor((1-ce[1]/ce[3])*e[3]/2),this._canvasPosDirty=!1,this.fire("canvasPos",this._canvasPos)}}_setVisible(e){this._visible,this._visible=e,this.fire("visible",this._visible)}set entity(e){if(this._entity){if(this._entity===e)return;null!==this._onEntityDestroyed&&(this._entity.off(this._onEntityDestroyed),this._onEntityDestroyed=null),null!==this._onEntityModelDestroyed&&(this._entity.model.off(this._onEntityModelDestroyed),this._onEntityModelDestroyed=null)}this._entity=e,this._entity&&(this._entity instanceof Ae?this._onEntityModelDestroyed=this._entity.model.on("destroyed",(()=>{this._entity=null,this._onEntityModelDestroyed=null})):this._onEntityDestroyed=this._entity.on("destroyed",(()=>{this._entity=null,this._onEntityDestroyed=null}))),this.fire("entity",this._entity,!0)}get entity(){return this._entity}set occludable(e){(e=!!e)!==this._occludable&&(this._occludable=e)}get occludable(){return this._occludable}set worldPos(e){this._worldPos.set(e||[0,0,0]),X(this._worldPos,this._origin,this._rtcPos),this._occludable&&this._renderer.markerWorldPosUpdated(this),this._viewPosDirty=!0,this.fire("worldPos",this._worldPos),this._needUpdate()}get worldPos(){return this._worldPos}get origin(){return this._origin}get rtcPos(){return this._rtcPos}get viewPos(){return this._update(),this._viewPos}get canvasPos(){return this._update(),this._canvasPos}get visible(){return!!this._visible}destroy(){this.fire("destroyed",!0),this.scene.camera.off(this._onCameraViewMatrix),this.scene.camera.off(this._onCameraProjMatrix),this._entity&&(null!==this._onEntityDestroyed&&this._entity.off(this._onEntityDestroyed),null!==this._onEntityModelDestroyed&&this._entity.model.off(this._onEntityModelDestroyed)),this._renderer.removeMarker(this),super.destroy()}}class de{constructor(e,t={}){this._color=t.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=t.thickness||1,this._thicknessClickable=t.thicknessClickable||6,this._visible=!0,this._culled=!1;var i=this._wire,s=i.style;s.border="solid "+this._thickness+"px "+this._color,s.position="absolute",s["z-index"]=void 0===t.zIndex?"2000001":t.zIndex,s.width="0px",s.height="0px",s.visibility="visible",s.top="0px",s.left="0px",s["-webkit-transform-origin"]="0 0",s["-moz-transform-origin"]="0 0",s["-ms-transform-origin"]="0 0",s["-o-transform-origin"]="0 0",s["transform-origin"]="0 0",s["-webkit-transform"]="rotate(0deg)",s["-moz-transform"]="rotate(0deg)",s["-ms-transform"]="rotate(0deg)",s["-o-transform"]="rotate(0deg)",s.transform="rotate(0deg)",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._wireClickable,o=r.style;o.border="solid "+this._thicknessClickable+"px "+this._color,o.position="absolute",o["z-index"]=void 0===t.zIndex?"2000002":t.zIndex+1,o.width="0px",o.height="0px",o.visibility="visible",o.top="0px",o.left="0px",o["-webkit-transform-origin"]="0 0",o["-moz-transform-origin"]="0 0",o["-ms-transform-origin"]="0 0",o["-o-transform-origin"]="0 0",o["transform-origin"]="0 0",o["-webkit-transform"]="rotate(0deg)",o["-moz-transform"]="rotate(0deg)",o["-ms-transform"]="rotate(0deg)",o["-o-transform"]="rotate(0deg)",o.transform="rotate(0deg)",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),t.onMouseOver&&r.addEventListener("mouseover",(e=>{t.onMouseOver(e,this)})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}get visible(){return"visible"===this._wire.style.visibility}_update(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}setStartAndEnd(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}setColor(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}setOpacity(e){this._wire.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}destroy(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}class pe{constructor(e,t={}){this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!t.visible,this._culled=!1;var i=this._dot,s=i.style;s["border-radius"]="25px",s.border="solid 2px white",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"40000005":t.zIndex,s.width="8px",s.height="8px",s.visibility=!1!==t.visible?"visible":"hidden",s.top="0px",s.left="0px",s["box-shadow"]="0 2px 5px 0 #182A3D;",s.opacity=1,s["pointer-events"]="none",t.onContextMenu,e.appendChild(i);var r=this._dotClickable,o=r.style;o["border-radius"]="35px",o.border="solid 10px white",o.position="absolute",o["z-index"]=void 0===t.zIndex?"40000007":t.zIndex+1,o.width="8px",o.height="8px",o.visibility="visible",o.top="0px",o.left="0px",o.opacity=0,o["pointer-events"]="none",t.onContextMenu,e.appendChild(r),r.addEventListener("click",(t=>{e.dispatchEvent(new MouseEvent("mouseover",t))})),t.onMouseOver&&r.addEventListener("mouseover",(i=>{t.onMouseOver(i,this),e.dispatchEvent(new MouseEvent("mouseover",i))})),t.onMouseLeave&&r.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this)})),t.onMouseWheel&&r.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&r.addEventListener("mousedown",(e=>{t.onMouseDown(e,this)})),t.onMouseUp&&r.addEventListener("mouseup",(e=>{t.onMouseUp(e,this)})),t.onMouseMove&&r.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&r.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation()})),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.borderColor)}setPos(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}setFillColor(e){this._dot.style.background=e||"lightgreen"}setBorderColor(e){this._dot.style.border="solid 2px"+(e||"black")}setOpacity(e){this._dot.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setClickable(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}destroy(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}class fe{constructor(e,t={}){this._highlightClass="viewer-ruler-label-highlighted",this._prefix=t.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var i=this._label,s=i.style;s["border-radius"]="5px",s.color="white",s.padding="4px",s.border="solid 1px",s.background="lightgreen",s.position="absolute",s["z-index"]=void 0===t.zIndex?"5000005":t.zIndex,s.width="auto",s.height="auto",s.visibility="visible",s.top="0px",s.left="0px",s["pointer-events"]="all",s.opacity=1,t.onContextMenu,i.innerText="",e.appendChild(i),this.setPos(t.x||0,t.y||0),this.setFillColor(t.fillColor),this.setBorderColor(t.fillColor),this.setText(t.text),t.onMouseOver&&i.addEventListener("mouseover",(e=>{t.onMouseOver(e,this),e.preventDefault()})),t.onMouseLeave&&i.addEventListener("mouseleave",(e=>{t.onMouseLeave(e,this),e.preventDefault()})),t.onMouseWheel&&i.addEventListener("wheel",(e=>{t.onMouseWheel(e,this)})),t.onMouseDown&&i.addEventListener("mousedown",(e=>{t.onMouseDown(e,this),e.stopPropagation()})),t.onMouseUp&&i.addEventListener("mouseup",(e=>{t.onMouseUp(e,this),e.stopPropagation()})),t.onMouseMove&&i.addEventListener("mousemove",(e=>{t.onMouseMove(e,this)})),t.onContextMenu&&i.addEventListener("contextmenu",(e=>{t.onContextMenu(e,this),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}setPos(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}setPosOnWire(e,t,i,s){var r=e+.5*(i-e),o=t+.5*(s-t),n=this._label.style;n.left=Math.round(r)-20+"px",n.top=Math.round(o)-12+"px"}setPosBetweenWires(e,t,i,s,r,o){var n=(e+i+r)/3,a=(t+s+o)/3,l=this._label.style;l.left=Math.round(n)-20+"px",l.top=Math.round(a)-12+"px"}setText(e){this._label.innerHTML=this._prefix+(e||"")}setFillColor(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}setBorderColor(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}setOpacity(e){this._label.style.opacity=e}setVisible(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setCulled(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}setHighlighted(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}setClickable(e){this._label.style["pointer-events"]=e?"all":"none"}destroy(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}var ge=d.vec3(),me=d.vec3();class _e extends R{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._color=t.color||e.defaultColor;var i=this.plugin.viewer.scene;this._originMarker=new ue(i,t.origin),this._cornerMarker=new ue(i,t.corner),this._targetMarker=new ue(i,t.target),this._originWorld=d.vec3(),this._cornerWorld=d.vec3(),this._targetWorld=d.vec3(),this._wp=new Float64Array(12),this._vp=new Float64Array(12),this._pp=new Float64Array(12),this._cp=new Int16Array(6);const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},l=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};this._originDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._cornerDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._originWire=new de(this._container,{color:this._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._targetWire=new de(this._container,{color:this._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._angleLabel=new fe(this._container,{fillColor:this._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:s,onMouseLeave:r,onMouseWheel:n,onMouseDown:a,onMouseUp:l,onMouseMove:A,onContextMenu:o}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._visible=!1,this._originVisible=!1,this._cornerVisible=!1,this._targetVisible=!1,this._originWireVisible=!1,this._targetWireVisible=!1,this._angleVisible=!1,this._labelsVisible=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._cornerMarker.on("worldPos",(e=>{this._cornerWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.cornerVisible=t.cornerVisible,this.targetVisible=t.targetVisible,this.originWireVisible=t.originWireVisible,this.targetWireVisible=t.targetWireVisible,this.angleVisible=t.angleVisible,this.labelsVisible=t.labelsVisible}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(d.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){const u=-.3,p=this._originMarker.viewPos[2],f=this._cornerMarker.viewPos[2],g=this._targetMarker.viewPos[2];if(p>u||f>u||g>u)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);d.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var t=this._pp,i=this._cp,s=e.canvas.canvas.getBoundingClientRect();const m=this._container.getBoundingClientRect();for(var r=s.top-m.top,o=s.left-m.left,n=e.canvas.boundary,a=n[2],l=n[3],A=0,h=0,c=t.length;he.offsetTop+(e.offsetParent&&e.offsetParent!==t.parentNode&&h(e.offsetParent)),c=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==t.parentNode&&c(e.offsetParent)),u=d.vec2();this._onMouseHoverSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{e.snappedToVertex||e.snappedToEdge?(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!0),this.markerDiv.style.background="greenyellow",this.markerDiv.style.border="2px solid green"):(s&&(s.visible=!0,s.canvasPos=e.canvasPos,s.snappedCanvasPos=e.canvasPos,s.snapped=!1),this.markerDiv.style.background="pink",this.markerDiv.style.border="2px solid red");const i=e.snappedCanvasPos||e.canvasPos;switch(r=!0,o=e.entity,l.set(e.worldPos),A.set(i),this._mouseState){case 0:this._canvasToPagePos?(this._canvasToPagePos(t,i,u),this.markerDiv.style.left=u[0]-5+"px",this.markerDiv.style.top=u[1]-5+"px"):(this.markerDiv.style.left=c(t)+i[0]-5+"px",this.markerDiv.style.top=h(t)+i[1]-5+"px");break;case 1:this._currentAngleMeasurement&&(this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.angleVisible=!1,this._currentAngleMeasurement.corner.worldPos=e.worldPos,this._currentAngleMeasurement.corner.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer";break;case 2:this._currentAngleMeasurement&&(this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.angleVisible=!0,this._currentAngleMeasurement.target.worldPos=e.worldPos,this._currentAngleMeasurement.target.entity=e.entity),this.markerDiv.style.left="-10000px",this.markerDiv.style.top="-10000px",t.style.cursor="pointer"}})),t.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(n=e.clientX,a=e.clientY)}),t.addEventListener("mouseup",this._onMouseUp=e=>{if(1===e.which&&!(e.clientX>n+20||e.clientXa+20||e.clientY{if(r=!1,s&&(s.visible=!0,s.pointerPos=e.canvasPos,s.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,s.snapped=!1),this.markerDiv.style.left="-100px",this.markerDiv.style.top="-100px",this._currentAngleMeasurement){switch(this._mouseState){case 0:this._currentAngleMeasurement.originVisible=!1;break;case 1:this._currentAngleMeasurement.cornerVisible=!1,this._currentAngleMeasurement.originWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1;break;case 2:this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1}t.style.cursor="default"}})),this._active=!0}deactivate(){if(!this._active)return;this.pointerLens&&(this.pointerLens.visible=!1),this.markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.angleMeasurementsPlugin.viewer.cameraControl;t.off(this._onMouseHoverSurface),t.off(this._onPickedSurface),t.off(this._onHoverNothing),t.off(this._onPickedNothing),this._currentAngleMeasurement=null,this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),this._mouseState=0)}get currentMeasurement(){return this._currentAngleMeasurement}destroy(){this.deactivate(),super.destroy()}}class ye extends z{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new be(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new _e(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},c=()=>{this.plugin.viewer.cameraControl.active=!0},u=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),c(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const c=i.touches[0],p=c.clientX,f=c.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void u();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],u=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([u,p]),this._touchState){case 1:{if(1!==s||u>n[0]+r||un[1]+r||pn[0]+r||un[1]+r||pn[0]+r||un[1]+r||p{this.plugin.fire("markerClicked",this)}),this._marker.addEventListener("mouseenter",this._onMouseEnterExternalMarker=()=>{this.plugin.fire("markerMouseEnter",this)}),this._marker.addEventListener("mouseleave",this._onMouseLeaveExternalMarker=()=>{this.plugin.fire("markerMouseLeave",this)}),this._markerExternal=!0):(this._markerHTML=t.markerHTML,this._htmlDirty=!0,this._markerExternal=!1),t.labelElement?(this._label=t.labelElement,this._labelExternal=!0):(this._labelHTML=t.labelHTML,this._htmlDirty=!0,this._labelExternal=!1),this._markerShown=!!t.markerShown,this._labelShown=!!t.labelShown,this._values=t.values||{},this._layoutDirty=!0,this._visibilityDirty=!0,this._buildHTML(),this._onTick=this.scene.on("tick",(()=>{this._htmlDirty&&(this._buildHTML(),this._htmlDirty=!1,this._layoutDirty=!0,this._visibilityDirty=!0),(this._layoutDirty||this._visibilityDirty)&&(this._markerShown||this._labelShown)&&(this._updatePosition(),this._layoutDirty=!1),this._visibilityDirty&&(this._marker.style.visibility=this.visible&&this._markerShown?"visible":"hidden",this._label.style.visibility=this.visible&&this._markerShown&&this._labelShown?"visible":"hidden",this._visibilityDirty=!1)})),this.on("canvasPos",(()=>{this._layoutDirty=!0})),this.on("visible",(()=>{this._visibilityDirty=!0})),this.setMarkerShown(!1!==t.markerShown),this.setLabelShown(t.labelShown),this.eye=t.eye?t.eye.slice():null,this.look=t.look?t.look.slice():null,this.up=t.up?t.up.slice():null,this.projection=t.projection}_buildHTML(){if(!this._markerExternal){this._marker&&(this._container.removeChild(this._marker),this._marker=null);let e=this._markerHTML||"

";y.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._marker=t.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(()=>{this.plugin.fire("markerClicked",this)})),this._marker.addEventListener("mouseenter",(()=>{this.plugin.fire("markerMouseEnter",this)})),this._marker.addEventListener("mouseleave",(()=>{this.plugin.fire("markerMouseLeave",this)})),this._marker.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);let e=this._labelHTML||"

";y.isArray(e)&&(e=e.join("")),e=this._renderTemplate(e.trim());const t=document.createRange().createContextualFragment(e);this._label=t.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))}))}}_updatePosition(){const e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}_renderTemplate(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){const i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}setMarkerShown(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}getMarkerShown(){return this._markerShown}setLabelShown(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}getLabelShown(){return this._labelShown}setField(e,t){this._values[e]=t||"",this._htmlDirty=!0}getField(e){return this._values[e]}setValues(e){for(var t in e)if(e.hasOwnProperty(t)){const i=e[t];this.setField(t,i)}}getValues(){return this._values}destroy(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),super.destroy()}}const xe=d.vec3(),Pe=d.vec3(),Ce=d.vec3();class Me extends z{constructor(e,t){super("Annotations",e),this._labelHTML=t.labelHTML||"
",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){var t,i;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){const s=e.pickResult;if(s.worldPos&&s.worldNormal){const e=d.normalizeVec3(s.worldNormal,xe),r=d.mulVec3Scalar(e,this._surfaceOffset,Pe);t=d.addVec3(s.worldPos,r,Ce),i=s.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var s=null;e.markerElementId&&((s=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var r=null;e.labelElementId&&((r=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const o=new we(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:s,labelElement:r,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:y.apply(e.values,y.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[o.id]=o,o.on("destroyed",(()=>{delete this.annotations[o.id],this.fire("annotationDestroyed",o.id)})),this.fire("annotationCreated",o.id),o}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;t
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}_injectDefaultCSS(){const e="xeokit-spinner-css";if(document.getElementById(e))return;const t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}_adjustPosition(){if(this._isCustom)return;const e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}set processes(e){if(e=e||0,this._processes===e)return;if(e<0)return;const t=this._processes;this._processes=e;const i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}get processes(){return this._processes}_destroy(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);const e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}const Ee=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"];class Ie extends R{constructor(e,t={}){super(e,t),this._backgroundColor=d.vec3([t.backgroundColor?t.backgroundColor[0]:1,t.backgroundColor?t.backgroundColor[1]:1,t.backgroundColor?t.backgroundColor[2]:1]),this._backgroundColorFromAmbientLight=!!t.backgroundColorFromAmbientLight,this.canvas=t.canvas,this.gl=null,this.webgl2=!1,this.transparent=!!t.transparent,this.contextAttr=t.contextAttr||{},this.contextAttr.alpha=this.transparent,this.contextAttr.preserveDrawingBuffer=!!this.contextAttr.preserveDrawingBuffer,this.contextAttr.stencil=!1,this.contextAttr.premultipliedAlpha=!!this.contextAttr.premultipliedAlpha,this.contextAttr.antialias=!1!==this.contextAttr.antialias,this.resolutionScale=t.resolutionScale,this.canvas.width=Math.round(this.canvas.clientWidth*this._resolutionScale),this.canvas.height=Math.round(this.canvas.clientHeight*this._resolutionScale),this.boundary=[this.canvas.offsetLeft,this.canvas.offsetTop,this.canvas.clientWidth,this.canvas.clientHeight],this._initWebGL(t);const i=this;this.canvas.addEventListener("webglcontextlost",this._webglcontextlostListener=function(e){console.time("webglcontextrestored"),i.scene._webglContextLost(),i.fire("webglcontextlost"),e.preventDefault()},!1),this.canvas.addEventListener("webglcontextrestored",this._webglcontextrestoredListener=function(e){i._initWebGL(),i.gl&&(i.scene._webglContextRestored(i.gl),i.fire("webglcontextrestored",i.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);let s=!0;new ResizeObserver((e=>{for(const t of e)t.contentBoxSize&&(s=!0)})).observe(this.canvas),this._tick=this.scene.on("tick",(()=>{s&&(s=!1,i.canvas.width=Math.round(i.canvas.clientWidth*i._resolutionScale),i.canvas.height=Math.round(i.canvas.clientHeight*i._resolutionScale),i.boundary[0]=i.canvas.offsetLeft,i.boundary[1]=i.canvas.offsetTop,i.boundary[2]=i.canvas.clientWidth,i.boundary[3]=i.canvas.clientHeight,i.fire("boundary",i.boundary))})),this._spinner=new Fe(this.scene,{canvas:this.canvas,elementId:t.spinnerElementId})}get type(){return"Canvas"}get backgroundColorFromAmbientLight(){return this._backgroundColorFromAmbientLight}set backgroundColorFromAmbientLight(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}get resolutionScale(){return this._resolutionScale}set resolutionScale(e){if((e=e||1)===this._resolutionScale)return;this._resolutionScale=e;const t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}get spinner(){return this._spinner}_createCanvas(){const e="xeokit-canvas-"+d.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}_getElementXY(e){let t=0,i=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}_initWebGL(){if(!this.gl)for(let e=0;!this.gl&&e0?Se.FS_MAX_FLOAT_PRECISION="highp":e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?Se.FS_MAX_FLOAT_PRECISION="mediump":Se.FS_MAX_FLOAT_PRECISION="lowp":Se.FS_MAX_FLOAT_PRECISION="mediump",Se.DEPTH_BUFFER_BITS=e.getParameter(e.DEPTH_BITS),Se.MAX_TEXTURE_SIZE=e.getParameter(e.MAX_TEXTURE_SIZE),Se.MAX_CUBE_MAP_SIZE=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),Se.MAX_RENDERBUFFER_SIZE=e.getParameter(e.MAX_RENDERBUFFER_SIZE),Se.MAX_TEXTURE_UNITS=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),Se.MAX_TEXTURE_IMAGE_UNITS=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Se.MAX_VERTEX_ATTRIBS=e.getParameter(e.MAX_VERTEX_ATTRIBS),Se.MAX_VERTEX_UNIFORM_VECTORS=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),Se.MAX_FRAGMENT_UNIFORM_VECTORS=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),Se.MAX_VARYING_VECTORS=e.getParameter(e.MAX_VARYING_VECTORS),e.getSupportedExtensions().forEach((function(e){Se.SUPPORTED_EXTENSIONS[e]=!0})))}class Re{constructor(){this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}get canvasPos(){return this._gotCanvasPos?this._canvasPos:null}set canvasPos(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}get origin(){return this._gotOrigin?this._origin:null}set origin(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}get direction(){return this._gotDirection?this._direction:null}set direction(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}get indices(){return this.entity&&this._gotIndices?this._indices:null}set indices(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}get localPos(){return this.entity&&this._gotLocalPos?this._localPos:null}set localPos(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}get snappedCanvasPos(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null}set snappedCanvasPos(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}get worldPos(){return this._gotWorldPos?this._worldPos:null}set worldPos(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}get viewPos(){return this.entity&&this._gotViewPos?this._viewPos:null}set viewPos(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}get bary(){return this.entity&&this._gotBary?this._bary:null}set bary(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}get worldNormal(){return this.entity&&this._gotWorldNormal?this._worldNormal:null}set worldNormal(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}get uv(){return this.entity&&this._gotUV?this._uv:null}set uv(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}get snapped(){return this.snappedToEdge||this.snappedToVertex}reset(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}class Le{constructor(e,t,i){if(this.allocated=!1,this.compiled=!1,this.handle=e.createShader(t),this.handle){if(this.allocated=!0,e.shaderSource(this.handle,i),e.compileShader(this.handle),this.compiled=e.getShaderParameter(this.handle,e.COMPILE_STATUS),!this.compiled&&!e.isContextLost()){const t=i.split("\n"),s=[];for(let e=0;e0&&"/"===i.charAt(s+1)&&(i=i.substring(0,s)),t.push(i);return t.join("\n")}function Qe(e){console.error(e.join("\n"))}class Ve{constructor(e,t){this.id=Oe.addItem({}),this.source=t,this.init(e)}init(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new Le(e,e.VERTEX_SHADER,Ne(this.source.vertex)),this._fragmentShader=new Le(e,e.FRAGMENT_SHADER,Ne(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Qe(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Qe(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Qe(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Qe(this.errors);let t,i,s,r,o;if(this.compiled=!0,this.handle=e.createProgram(),!this.handle)return void(this.errors=["Failed to allocate program"]);if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Qe(this.errors);const n=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}setData(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}bind(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}unbind(){this.allocated&&this._gl.bindBuffer(this.type,null)}destroy(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}class je{constructor(e,t){this.scene=e,this.aabb=d.AABB3(),this.origin=d.vec3(t),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}addMarker(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}markerWorldPosUpdated(e){if(!this.markers[e.id])return;const t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}removeMarker(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}update(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}_buildMarkerList(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}_buildPositions(){let e=0;for(let t=0;t-t){i._setVisible(!1);continue}const n=i.canvasPos,a=n[0],l=n[1];a+10<0||l+10<0||a-10>s||l-10>r?i._setVisible(!1):!i.entity||i.entity.visible?i.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=i,this.pixels[o++]=a,this.pixels[o++]=l):i._setVisible(!0):i._setVisible(!1)}}_updateActiveSectionPlanes(){const e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(let i=0;i{this._occlusionTestListDirty=!0})),this._onCameraProjMatrix=e.camera.on("projMatrix",(()=>{this._occlusionTestListDirty=!0})),this._onCanvasBoundary=e.canvas.on("boundary",(()=>{this._occlusionTestListDirty=!0}))}addMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i||(i=new je(this._scene,e.origin),this._occlusionLayers[i.originHash]=i,this._occlusionLayersListDirty=!0),i.addMarker(e),this._markersToOcclusionLayersMap[e.id]=i,this._occlusionTestListDirty=!0}markerWorldPosUpdated(e){const t=this._markersToOcclusionLayersMap[e.id];if(!t)return void e.error("Marker has not been added to OcclusionTester");const i=e.origin.join();if(i!==t.originHash){1===t.numMarkers?(t.destroy(),delete this._occlusionLayers[t.originHash],this._occlusionLayersListDirty=!0):t.removeMarker(e);let s=this._occlusionLayers[i];s||(s=new je(this._scene,e.origin),this._occlusionLayers[i]=t,this._occlusionLayersListDirty=!0),s.addMarker(e),this._markersToOcclusionLayersMap[e.id]=s}else t.markerWorldPosUpdated(e)}removeMarker(e){const t=e.origin.join();let i=this._occlusionLayers[t];i&&(1===i.numMarkers?(i.destroy(),delete this._occlusionLayers[i.originHash],this._occlusionLayersListDirty=!0):i.removeMarker(e),delete this._markersToOcclusionLayersMap[e.id])}get needOcclusionTest(){return this._occlusionTestListDirty}bindRenderBuf(){const e=[this._scene.canvas.canvas.id,this._scene._sectionPlanesState.getHash()].join(";");if(e!==this._shaderSourceHash&&(this._shaderSourceHash=e,this._shaderSourceDirty=!0),this._shaderSourceDirty&&(this._buildShaderSource(),this._shaderSourceDirty=!1,this._programDirty=!0),this._programDirty&&(this._buildProgram(),this._programDirty=!1,this._occlusionTestListDirty=!0),this._occlusionLayersListDirty&&(this._buildOcclusionLayersList(),this._occlusionLayersListDirty=!1),this._occlusionTestListDirty){for(let e=0,t=this._occlusionLayersList.length;e0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}_buildFragmentShaderSource(){const e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}_buildProgram(){this._program&&this._program.destroy();const e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new Ve(t,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,t=i.sectionPlanes.length;e0){const e=s.sectionPlanes;for(let s=0;s{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=d.mat4();return()=>(e&&d.inverseMat4(s.camera.projMatrix,t),t)})());const t=this._scene.canvas.gl,i=this._program,s=this._scene,r=s.sao,o=t.drawingBufferWidth,n=t.drawingBufferHeight,a=s.camera.project._state,l=a.near,A=a.far,h=a.matrix,c=this._getInverseProjectMat(),u=Math.random(),p="perspective"===s.camera.projection;Ke[0]=o,Ke[1]=n,t.viewport(0,0,o,n),t.clearColor(0,0,0,1),t.disable(t.DEPTH_TEST),t.disable(t.BLEND),t.frontFace(t.CCW),t.clear(t.COLOR_BUFFER_BIT),i.bind(),t.uniform1f(this._uCameraNear,l),t.uniform1f(this._uCameraFar,A),t.uniformMatrix4fv(this._uCameraProjectionMatrix,!1,h),t.uniformMatrix4fv(this._uCameraInverseProjectionMatrix,!1,c),t.uniform1i(this._uPerspective,p),t.uniform1f(this._uScale,r.scale*(A/5)),t.uniform1f(this._uIntensity,r.intensity),t.uniform1f(this._uBias,r.bias),t.uniform1f(this._uKernelRadius,r.kernelRadius),t.uniform1f(this._uMinResolution,r.minResolution),t.uniform2fv(this._uViewport,Ke),t.uniform1f(this._uRandomSeed,u);const f=e.getDepthTexture();i.bindTexture(this._uDepthTexture,f,0),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),t.drawElements(t.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}_build(){let e=!1;const t=this._scene.sao;if(t.numSamples!==this._numSamples&&(this._numSamples=Math.floor(t.numSamples),e=!0),!e)return;const i=this._scene.canvas.gl;if(this._program&&(this._program.destroy(),this._program=null),this._program=new Ve(i,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV; \n \n out vec2 vUV;\n \n void main () {\n gl_Position = vec4(aPosition, 1.0);\n vUV = aUV;\n }"],fragment:[`#version 300 es \n precision highp float;\n precision highp int; \n \n #define NORMAL_TEXTURE 0\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n #define NUM_SAMPLES ${this._numSamples}\n #define NUM_RINGS 4 \n \n in vec2 vUV;\n \n uniform sampler2D uDepthTexture;\n \n uniform float uCameraNear;\n uniform float uCameraFar;\n uniform mat4 uProjectMatrix;\n uniform mat4 uInverseProjectMatrix;\n \n uniform bool uPerspective;\n\n uniform float uScale;\n uniform float uIntensity;\n uniform float uBias;\n uniform float uKernelRadius;\n uniform float uMinResolution;\n uniform vec2 uViewport;\n uniform float uRandomSeed;\n\n float pow2( const in float x ) { return x*x; }\n \n highp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n }\n\n vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n }\n\n vec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n }\n\n const float packUpscale = 256. / 255.;\n const float unpackDownScale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. ); \n\n const float shiftRights = 1. / 256.;\n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float unpackRGBAToFloat( const in vec4 v ) { \n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unPackFactors );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n }\n\n float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n }\n \n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n if (uPerspective) {\n return perspectiveDepthToViewZ( depth, uCameraNear, uCameraFar );\n } else {\n return orthographicDepthToViewZ( depth, uCameraNear, uCameraFar );\n }\n }\n\n vec3 getViewPos( const in vec2 screenPos, const in float depth, const in float viewZ ) {\n \tfloat clipW = uProjectMatrix[2][3] * viewZ + uProjectMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPos, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; \n \treturn ( uInverseProjectMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPos ) { \n return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - uBias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \n \tscaleDividedByCameraFar = uScale / uCameraFar;\n \tminResolutionMultipliedByCameraFar = uMinResolution * uCameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUV );\n\n \tfloat angle = rand( vUV + uRandomSeed ) * PI2;\n \tvec2 radius = vec2( uKernelRadius * INV_NUM_SAMPLES ) / uViewport;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUV + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }`]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),o=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new He(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new He(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new He(i,i.ELEMENT_ARRAY_BUFFER,o,o.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}destroy(){this._program&&(this._program.destroy(),this._program=null)}}const Je=new Float32Array(tt(17,[0,1])),Ye=new Float32Array(tt(17,[1,0])),Ze=new Float32Array(function(e,t){const i=[];for(let s=0;s<=e;s++)i.push(et(s,t));return i}(17,4)),qe=new Float32Array(2);class $e{constructor(e){this._scene=e,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}init(){const e=this._scene.canvas.gl;if(this._program=new Ve(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS 16\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }"]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);const t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new He(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new He(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new He(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}render(e,t,i){if(this._programError)return;this._getInverseProjectMat||(this._getInverseProjectMat=(()=>{let e=!0;this._scene.camera.on("projMatrix",(function(){e=!0}));const t=d.mat4();return()=>(e&&d.inverseMat4(o.camera.projMatrix,t),t)})());const s=this._scene.canvas.gl,r=this._program,o=this._scene,n=s.drawingBufferWidth,a=s.drawingBufferHeight,l=o.camera.project._state,A=l.near,h=l.far;s.viewport(0,0,n,a),s.clearColor(0,0,0,1),s.enable(s.DEPTH_TEST),s.disable(s.BLEND),s.frontFace(s.CCW),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),r.bind(),qe[0]=n,qe[1]=a,s.uniform2fv(this._uViewport,qe),s.uniform1f(this._uCameraNear,A),s.uniform1f(this._uCameraFar,h),s.uniform1f(this._uDepthCutoff,.01),0===i?s.uniform2fv(this._uSampleOffsets,Ye):s.uniform2fv(this._uSampleOffsets,Je),s.uniform1fv(this._uSampleWeights,Ze);const c=e.getDepthTexture(),u=t.getTexture();r.bindTexture(this._uDepthTexture,c,0),r.bindTexture(this._uOcclusionTexture,u,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),s.drawElements(s.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}destroy(){this._program.destroy()}}function et(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function tt(e,t){const i=[];for(let s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}class it{constructor(e,t,i){i=i||{},this.gl=t,this.allocated=!1,this.canvas=e,this.buffer=null,this.bound=!1,this.size=i.size,this._hasDepthTexture=!!i.depthTexture}setSize(e){this.size=e}webglContextRestored(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}bind(...e){if(this._touch(...e),this.bound)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}createTexture(e,t,i=null){const s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}_touch(...e){let t,i;const s=this.gl;if(this.size?(t=this.size[0],i=this.size[1]):(t=s.drawingBufferWidth,i=s.drawingBufferHeight),this.buffer){if(this.buffer.width===t&&this.buffer.height===i)return;this.buffer.textures.forEach((e=>s.deleteTexture(e))),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}const r=[];let o;e.length>0?r.push(...e.map((e=>this.createTexture(t,i,e)))):r.push(this.createTexture(t,i)),this._hasDepthTexture&&(o=s.createTexture(),s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,t,i,0,s.DEPTH_COMPONENT,s.FLOAT,null));const n=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,n),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,t,i);const a=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,a);for(let e=0;e0&&s.drawBuffers(r.map(((e,t)=>s.COLOR_ATTACHMENT0+t))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,n),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,a),!s.isFramebuffer(a))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);const l=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(l){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+l}this.buffer={framebuf:a,renderbuf:n,texture:r[0],textures:r,depthTexture:o,width:t,height:i},this.bound=!1}clear(){if(!this.bound)throw"Render buffer not bound";const e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}read(e,t,i=null,s=null,r=Uint8Array,o=4,n=0){const a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,A=new r(o),h=this.gl;return h.readBuffer(h.COLOR_ATTACHMENT0+n),h.readPixels(a,l,1,1,i||h.RGBA,s||h.UNSIGNED_BYTE,A,0),A}readArray(e=null,t=null,i=Uint8Array,s=4,r=0){const o=new i(this.buffer.width*this.buffer.height*s),n=this.gl;return n.readBuffer(n.COLOR_ATTACHMENT0+r),n.readPixels(0,0,this.buffer.width,this.buffer.height,e||n.RGBA,t||n.UNSIGNED_BYTE,o,0),o}readImageAsCanvas(){const e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,o=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);const n=this.buffer.width,a=this.buffer.height,l=a/2|0,A=4*n,h=new Uint8Array(4*n);for(let e=0;ee.deleteTexture(t))),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}class st{constructor(e){this.scene=e,this._renderBuffersBasic={},this._renderBuffersScaled={}}getRenderBuffer(e,t){const i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled;let s=i[e];return s||(s=new it(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}destroy(){for(let e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(let e in this._renderBuffersScaled)this._renderBuffersScaled[e].destroy()}}function rt(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];let i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}const ot=function(t,i){i=i||{};const s=new De(t),r=t.canvas.canvas,o=t.canvas.gl,n=!!i.transparent,a=i.alphaDepthMask,l=new e({});let A={},h={},c=!0,u=!0,p=!0,f=!0,g=!0,_=!0,v=!0,b=!0;const y=new st(t);let B=!1;const w=new Xe(t),x=new $e(t);function P(){c&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableMap,s=t.drawableListPreCull;let r=0;for(let e in i)i.hasOwnProperty(e)&&(s[r++]=i[e]);s.length=r}}(),c=!1,u=!0),u&&(!function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),u=!1,p=!0),p&&function(){for(let e in A)if(A.hasOwnProperty(e)){const t=A[e],i=t.drawableListPreCull,s=t.drawableList;let r=0;for(let e=0,t=i.length;e0)for(s.withSAO=!0,S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||j>0||O>0||N>0){if(o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):(o.blendEquation(o.FUNC_ADD),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA)),s.backfaces=!1,a||o.depthMask(!1),(O>0||N>0)&&o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),N>0)for(S=0;S0)for(S=0;S0)for(S=0;S0)for(S=0;S0||z>0){if(s.lastProgramId=null,t.highlightMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),z>0)for(S=0;S0)for(S=0;S0||K>0||G>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.enable(o.CULL_FACE),K>0)for(S=0;S0)for(S=0;S0||J>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),J>0)for(S=0;S0)for(S=0;S0||Z>0){if(s.lastProgramId=null,t.selectedMaterial.glowThrough&&o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.CULL_FACE),o.enable(o.BLEND),n?(o.blendEquation(o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),Z>0)for(S=0;S0)for(S=0;S0){const t=Math.floor(e/4),i=u.size[0],s=t%i-Math.floor(i/2),r=Math.floor(t/i)-Math.floor(i/2),o=Math.sqrt(Math.pow(s,2)+Math.pow(r,2));M.push({x:s,y:r,dist:o,isVertex:n&&a?_[e+3]>m.length/2:n,result:[_[e+0],_[e+1],_[e+2],_[e+3]],normal:[v[e+0],v[e+1],v[e+2],v[e+3]],id:[b[e+0],b[e+1],b[e+2],b[e+3]]})}let D=null,S=null,T=null,R=null;if(M.length>0){M.sort(((e,t)=>e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist)),R=M[0].isVertex?"vertex":"edge";const e=M[0].result,t=M[0].normal,i=M[0].id,s=m[e[3]],r=s.origin,o=s.coordinateScale;S=d.normalizeVec3([t[0]/d.MAX_INT,t[1]/d.MAX_INT,t[2]/d.MAX_INT]),D=[e[0]*o[0]+r[0],e[1]*o[1]+r[1],e[2]*o[2]+r[2]],T=l.items[i[0]+(i[1]<<8)+(i[2]<<16)+(i[3]<<24)]}if(null===B&&null==D)return null;let L=null;null!==D&&(L=t.camera.projectWorldPos(D));const U=T&&T.delegatePickedEntity?T.delegatePickedEntity():T;return h.reset(),h.snappedToEdge="edge"===R,h.snappedToVertex="vertex"===R,h.worldPos=D,h.worldNormal=S,h.entity=U,h.canvasPos=i,h.snappedCanvasPos=L||i,h}}(),this.addMarker=function(e){this._occlusionTester=this._occlusionTester||new We(t,y),this._occlusionTester.addMarker(e),t.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){P(),this._occlusionTester.bindRenderBuf(),s.reset(),s.backfaces=!0,s.frontface=!0,o.viewport(0,0,o.drawingBufferWidth,o.drawingBufferHeight),o.clearColor(0,0,0,0),o.enable(o.DEPTH_TEST),o.disable(o.CULL_FACE),o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);for(let e in A)if(A.hasOwnProperty(e)){const t=A[e].drawableList;for(let e=0,i=t.length;e{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!0:e.keyCode===this.KEY_ALT?this.altDown=!0:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!0),this.keyDown[e.keyCode]=!0,this.fire("keydown",e.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=e=>{this.enabled&&this.keyboardEnabled&&"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&(e.keyCode===this.KEY_CTRL?this.ctrlDown=!1:e.keyCode===this.KEY_ALT?this.altDown=!1:e.keyCode===this.KEY_SHIFT&&(this.shiftDown=!1),this.keyDown[e.keyCode]=!1,this.fire("keyup",e.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=e=>{this.enabled&&(this.mouseover=!0,this._getMouseCanvasPos(e),this.fire("mouseenter",this.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=e=>{this.enabled&&(this.mouseover=!1,this._getMouseCanvasPos(e),this.fire("mouseleave",this.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!0;break;case 2:this.mouseDownMiddle=!0;break;case 3:this.mouseDownRight=!0}this._getMouseCanvasPos(e),this.element.focus(),this.fire("mousedown",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=e=>{if(this.enabled){switch(e.which){case 1:this.mouseDownLeft=!1;break;case 2:this.mouseDownMiddle=!1;break;case 3:this.mouseDownRight=!1}this.fire("mouseup",this.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("click",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=e=>{if(this.enabled){switch(e.which){case 1:case 3:this.mouseDownLeft=!1,this.mouseDownRight=!1;break;case 2:this.mouseDownMiddle=!1}this._getMouseCanvasPos(e),this.fire("dblclick",this.mouseCanvasPos,!0),this.mouseover&&e.preventDefault()}});const e=this.scene.tickify((()=>this.fire("mousemove",this.mouseCanvasPos,!0)));this.element.addEventListener("mousemove",this._mouseMoveListener=t=>{this.enabled&&(this._getMouseCanvasPos(t),e(),this.mouseover&&t.preventDefault())});const t=this.scene.tickify((e=>{this.fire("mousewheel",e,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=(e,i)=>{if(!this.enabled)return;const s=Math.max(-1,Math.min(1,40*-e.deltaY));t(s)},{passive:!0});{let e,t;const i=2;this.on("mousedown",(i=>{e=i[0],t=i[1]})),this.on("mouseup",(s=>{e>=s[0]-i&&e<=s[0]+i&&t>=s[1]-i&&t<=s[1]+i&&this.fire("mouseclicked",s,!0)}))}this._eventsBound=!0}_unbindEvents(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}_getMouseCanvasPos(e){if(e){let t=e.target,i=0,s=0;for(;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}setEnabled(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}getEnabled(){return this.enabled}setKeyboardEnabled(e){this.keyboardEnabled=e}getKeyboardEnabled(){return this.keyboardEnabled}destroy(){super.destroy(),this._unbindEvents()}}const at=new e({});class lt{constructor(e){this.id=at.addItem({});for(const t in e)e.hasOwnProperty(t)&&(this[t]=e[t])}destroy(){at.removeItem(this.id)}}class At extends R{get type(){return"Viewport"}constructor(e,t={}){super(e,t),this._state=new lt({boundary:[0,0,100,100]}),this.boundary=t.boundary,this.autoBoundary=t.autoBoundary}set boundary(e){if(!this._autoBoundary){if(!e){const t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}get boundary(){return this._state.boundary}set autoBoundary(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){const t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}get autoBoundary(){return this._autoBoundary}_getState(){return this._state}destroy(){super.destroy(),this._state.destroy()}}class ht extends R{get type(){return"Perspective"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this._fov=60,this._canvasResized=this.scene.canvas.on("boundary",this._needUpdate,this),this.fov=t.fov,this.fovAxis=t.fovAxis,this.near=t.near,this.far=t.far}_update(){const e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis;let s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),d.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}set fov(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}get fov(){return this._fov}set fovAxis(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}get fovAxis(){return this._fovAxis}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}class ct extends R{get type(){return"Ortho"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.scale=t.scale,this.near=t.near,this.far=t.far,this._onCanvasBoundary=this.scene.canvas.on("boundary",this._needUpdate,this)}_update(){const e=this.scene,t=.5*this._scale,i=e.canvas.boundary,s=i[2],r=i[3],o=s/r;let n,a,l,A;s>r?(n=-t,a=t,l=t/o,A=-t/o):(n=-t*o,a=t*o,l=t,A=-t),d.orthoMat4c(n,a,A,l,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set scale(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}get scale(){return this._scale}set near(e){const t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}get near(){return this._state.near}set far(e){const t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}class ut extends R{get type(){return"Frustum"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4(),near:.1,far:1e4}),this._left=-1,this._right=1,this._bottom=-1,this._top=1,this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.left=t.left,this.right=t.right,this.bottom=t.bottom,this.top=t.top,this.near=t.near,this.far=t.far}_update(){d.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}set left(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}get left(){return this._left}set right(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}get right(){return this._right}set top(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}get top(){return this._top}set bottom(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}get bottom(){return this._bottom}set near(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}get near(){return this._state.near}set far(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}get far(){return this._state.far}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy(),super.destroy()}}class dt extends R{get type(){return"CustomProjection"}constructor(e,t={}){super(e,t),this.camera=e,this._state=new lt({matrix:d.mat4(),inverseMatrix:d.mat4(),transposedMatrix:d.mat4()}),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!1,this.matrix=t.matrix}set matrix(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}get matrix(){return this._state.matrix}get inverseMatrix(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&(d.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}get transposedMatrix(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&(d.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}unproject(e,t,i,s,r){const o=this.scene.canvas.canvas,n=o.offsetWidth/2,a=o.offsetHeight/2;return i[0]=(e[0]-n)/n,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,d.mulMat4v4(this.inverseMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,d.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}destroy(){super.destroy(),this._state.destroy()}}const pt=d.vec3(),ft=d.vec3(),gt=d.vec3(),mt=d.vec3(),_t=d.vec3(),vt=d.vec3(),bt=d.vec4(),yt=d.vec4(),Bt=d.vec4(),wt=d.mat4(),xt=d.mat4(),Pt=d.vec3(),Ct=d.vec3(),Mt=d.vec3(),Ft=d.vec3();class Et extends R{get type(){return"Camera"}constructor(e,t={}){super(e,t),this._state=new lt({deviceMatrix:d.mat4(),hasDeviceMatrix:!1,matrix:d.mat4(),normalMatrix:d.mat4(),inverseMatrix:d.mat4()}),this._perspective=new ht(this),this._ortho=new ct(this),this._frustum=new ut(this),this._customProjection=new dt(this),this._project=this._perspective,this._eye=d.vec3([0,0,10]),this._look=d.vec3([0,0,0]),this._up=d.vec3([0,1,0]),this._worldUp=d.vec3([0,1,0]),this._worldRight=d.vec3([1,0,0]),this._worldForward=d.vec3([0,0,-1]),this.deviceMatrix=t.deviceMatrix,this.eye=t.eye,this.look=t.look,this.up=t.up,this.worldAxis=t.worldAxis,this.gimbalLock=t.gimbalLock,this.constrainPitch=t.constrainPitch,this.projection=t.projection,this._perspective.on("matrix",(()=>{"perspective"===this._projectionType&&this.fire("projMatrix",this._perspective.matrix)})),this._ortho.on("matrix",(()=>{"ortho"===this._projectionType&&this.fire("projMatrix",this._ortho.matrix)})),this._frustum.on("matrix",(()=>{"frustum"===this._projectionType&&this.fire("projMatrix",this._frustum.matrix)})),this._customProjection.on("matrix",(()=>{"customProjection"===this._projectionType&&this.fire("projMatrix",this._customProjection.matrix)}))}_update(){const e=this._state;let t;"ortho"===this.projection?(d.subVec3(this._eye,this._look,Pt),d.normalizeVec3(Pt,Ct),d.mulVec3Scalar(Ct,1e3,Mt),d.addVec3(this._look,Mt,Ft),t=Ft):t=this._eye,e.hasDeviceMatrix?(d.lookAtMat4v(t,this._look,this._up,xt),d.mulMat4(e.deviceMatrix,xt,e.matrix)):d.lookAtMat4v(t,this._look,this._up,e.matrix),d.inverseMat4(this._state.matrix,this._state.inverseMatrix),d.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}orbitYaw(e){let t=d.subVec3(this._eye,this._look,pt);d.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,wt),t=d.transformPoint3(wt,t,ft),this.eye=d.addVec3(this._look,t,gt),this.up=d.transformPoint3(wt,this._up,mt)}orbitPitch(e){if(this._constrainPitch&&(e=d.dotVec3(this._up,this._worldUp)/d.DEGTORAD)<1)return;let t=d.subVec3(this._eye,this._look,pt);const i=d.cross3Vec3(d.normalizeVec3(t,ft),d.normalizeVec3(this._up,gt));d.rotationMat4v(.0174532925*e,i,wt),t=d.transformPoint3(wt,t,mt),this.up=d.transformPoint3(wt,this._up,_t),this.eye=d.addVec3(t,this._look,vt)}yaw(e){let t=d.subVec3(this._look,this._eye,pt);d.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,wt),t=d.transformPoint3(wt,t,ft),this.look=d.addVec3(t,this._eye,gt),this._gimbalLock&&(this.up=d.transformPoint3(wt,this._up,mt))}pitch(e){if(this._constrainPitch&&(e=d.dotVec3(this._up,this._worldUp)/d.DEGTORAD)<1)return;let t=d.subVec3(this._look,this._eye,pt);const i=d.cross3Vec3(d.normalizeVec3(t,ft),d.normalizeVec3(this._up,gt));d.rotationMat4v(.0174532925*e,i,wt),this.up=d.transformPoint3(wt,this._up,vt),t=d.transformPoint3(wt,t,mt),this.look=d.addVec3(t,this._eye,_t)}pan(e){const t=d.subVec3(this._eye,this._look,pt),i=[0,0,0];let s;if(0!==e[0]){const r=d.cross3Vec3(d.normalizeVec3(t,[]),d.normalizeVec3(this._up,ft));s=d.mulVec3Scalar(r,e[0]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]}0!==e[1]&&(s=d.mulVec3Scalar(d.normalizeVec3(this._up,gt),e[1]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),0!==e[2]&&(s=d.mulVec3Scalar(d.normalizeVec3(t,mt),e[2]),i[0]+=s[0],i[1]+=s[1],i[2]+=s[2]),this.eye=d.addVec3(this._eye,i,_t),this.look=d.addVec3(this._look,i,vt)}zoom(e){const t=d.subVec3(this._eye,this._look,pt),i=Math.abs(d.lenVec3(t,ft)),s=Math.abs(i+e);if(s<.5)return;const r=d.normalizeVec3(t,gt);this.eye=d.addVec3(this._look,d.mulVec3Scalar(r,s),mt)}set eye(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}get eye(){return this._eye}set look(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}get look(){return this._look}set up(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}get up(){return this._up}set deviceMatrix(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}get deviceMatrix(){return this._state.deviceMatrix}set worldAxis(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=d.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}get worldAxis(){return this._worldAxis}get worldUp(){return this._worldUp}get xUp(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}get yUp(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}get zUp(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}get worldRight(){return this._worldRight}get worldForward(){return this._worldForward}set gimbalLock(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}get gimbalLock(){return this._gimbalLock}set constrainPitch(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}get eyeLookDist(){return d.lenVec3(d.subVec3(this._look,this._eye,pt))}get matrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get viewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}get normalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get viewNormalMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}get inverseViewMatrix(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}get projMatrix(){return this[this.projection].matrix}get perspective(){return this._perspective}get ortho(){return this._ortho}get frustum(){return this._frustum}get customProjection(){return this._customProjection}set projection(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}get projection(){return this._projectionType}get project(){return this._project}projectWorldPos(e){const t=bt,i=yt,s=Bt;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,d.mulMat4v4(this.viewMatrix,t,i),d.mulMat4v4(this.projMatrix,i,s),d.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;const r=this.scene.canvas.canvas,o=r.offsetWidth/2,n=r.offsetHeight/2;return[s[0]*o+o,s[1]*n+n]}destroy(){super.destroy(),this._state.destroy()}}class It extends R{get type(){return"Light"}get isLight(){return!0}constructor(e,t={}){super(e,t)}}class Dt extends It{get type(){return"DirLight"}constructor(e,t={}){super(e,t),this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const i=this.scene.camera,s=this.scene.canvas;this._onCameraViewMatrix=i.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=i.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=s.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new lt({type:"dir",dir:d.vec3([1,1,1]),color:d.vec3([.7,.7,.8]),intensity:1,space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(this._shadowViewMatrixDirty){this._shadowViewMatrix||(this._shadowViewMatrix=d.identityMat4());const e=this.scene.camera,t=this._state.dir,i=e.look,s=[i[0]-t[0],i[1]-t[1],i[2]-t[2]],r=[0,1,0];d.lookAtMat4v(s,i,r,this._shadowViewMatrix),this._shadowViewMatrixDirty=!1}return this._shadowViewMatrix},getShadowProjMatrix:()=>(this._shadowProjMatrixDirty&&(this._shadowProjMatrix||(this._shadowProjMatrix=d.identityMat4()),d.orthoMat4c(-40,40,-40,40,-40,80,this._shadowProjMatrix),this._shadowProjMatrixDirty=!1),this._shadowProjMatrix),getShadowRenderBuf:()=>(this._shadowRenderBuf||(this._shadowRenderBuf=new it(this.scene.canvas.canvas,this.scene.canvas.gl,{size:[1024,1024]})),this._shadowRenderBuf)}),this.dir=t.dir,this.color=t.color,this.intensity=t.intensity,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set dir(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get dir(){return this._state.dir}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}class St extends It{get type(){return"AmbientLight"}constructor(e,t={}){super(e,t),this._state={type:"ambient",color:d.vec3([.7,.7,.7]),intensity:1},this.color=t.color,this.intensity=t.intensity,this.scene._lightCreated(this)}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}get intensity(){return this._state.intensity}destroy(){super.destroy(),this.scene._lightDestroyed(this)}}class Tt extends R{get type(){return"Geometry"}get isGeometry(){return!0}constructor(e,t={}){super(e,t),m.memory.meshes++}destroy(){super.destroy(),m.memory.meshes--}}var Rt=function(){const e=[],t=[],i=[],s=[],r=[];let o=0;const n=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3();return function(m,_,v,b){!function(r,o){const n={};let a,l,A,h;const c=Math.pow(10,4);let u,d,p=0;for(u=0,d=r.length;uB)||(T=i[E.index1],R=i[E.index2],(!L&&T>65535||R>65535)&&(L=!0),y.push(T),y.push(R));return L?new Uint32Array(y):new Uint16Array(y)}}();const Lt=function(){const e=d.mat4(),t=d.mat4();return function(i,s){s=s||d.mat4();const r=i[0],o=i[1],n=i[2],a=i[3]-r,l=i[4]-o,A=i[5]-n,h=65535;return d.identityMat4(e),d.translationMat4v(i,e),d.identityMat4(t),d.scalingMat4v([a/h,l/h,A/h],t),d.mulMat4(e,t,s),s}}();var Ut=function(){const e=d.mat4(),t=d.mat4();return function(i,s,r){const o=new Uint16Array(i.length),n=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);let a;for(a=0;a=0?1:-1),t=(1-Math.abs(r))*(o>=0?1:-1);r=e,o=t}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*o+(o<0?-1:0))])}function Nt(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function Qt(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}const Vt={getPositionsBounds:function(e){const t=new Float32Array(3),i=new Float32Array(3);let s,r;for(s=0;s<3;s++)t[s]=Number.MAX_VALUE,i[s]=-Number.MAX_VALUE;for(s=0;sn&&(r=i,n=o),i=Ot(e,a,"floor","ceil"),s=Nt(i),o=Qt(e,a,s),o>n&&(r=i,n=o),i=Ot(e,a,"ceil","ceil"),s=Nt(i),o=Qt(e,a,s),o>n&&(r=i,n=o),t[a]=r[0],t[a+1]=r[1];return t},decompressNormals:function(e,t){for(let i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(r))*(o>=0?1:-1));const a=Math.sqrt(r*r+o*o+n*n);t[s+0]=r/a,t[s+1]=o/a,t[s+2]=n/a,s+=3}return t},decompressNormal:function(e,t){let i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;const r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));const o=Math.sqrt(i*i+s*s+r*r);return t[0]=i/o,t[1]=s/o,t[2]=r/o,t}},Ht=m.memory,jt=d.AABB3();class Gt extends Tt{get type(){return"ReadableGeometry"}get isReadableGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new lt({compressGeometry:!!t.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._edgeIndicesBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._aabbDirty=!0,this._boundingSphere=!0,this._aabb=null,this._aabbDirty=!0,this._obb=null,this._obbDirty=!0;const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(this._state.compressGeometry){const e=Vt.getPositionsBounds(t.positions),s=Vt.compressPositions(t.positions,e.min,e.max);i.positions=s.quantized,i.positionsDecodeMatrix=s.decodeMatrix}else i.positions=t.positions.constructor===Float32Array?t.positions:new Float32Array(t.positions);if(t.colors&&(i.colors=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors)),t.uv)if(this._state.compressGeometry){const e=Vt.getUVBounds(t.uv),s=Vt.compressUVs(t.uv,e.min,e.max);i.uv=s.quantized,i.uvDecodeMatrix=s.decodeMatrix}else i.uv=t.uv.constructor===Float32Array?t.uv:new Float32Array(t.uv);t.normals&&(this._state.compressGeometry?i.normals=Vt.compressNormals(t.normals):i.normals=t.normals.constructor===Float32Array?t.normals:new Float32Array(t.normals)),t.indices&&(i.indices=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)),this._buildHash(),Ht.meshes++,this._buildVBOs()}_buildVBOs(){const e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Ht.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new He(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Ht.positions+=e.positionsBuf.numItems),e.normals){let i=e.compressGeometry;e.normalsBuf=new He(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Ht.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new He(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Ht.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new He(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Ht.uvs+=e.uvBuf.numItems)}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}_getPickTrianglePositions(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}_getPickTriangleColors(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}_buildEdgeIndices(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=Rt(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Ht.indices+=this._edgeIndicesBuf.numItems}_buildPickTriangleVBOs(){const e=this._state;if(!e.positions||!e.indices)return;const t=this.scene.canvas.gl,i=d.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new He(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Ht.positions+=this._pickTrianglePositionsBuf.numItems,Ht.colors+=this._pickTriangleColorsBuf.numItems}_buildPickVertexVBOs(){}_webglContextLost(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}_webglContextRestored(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}get primitive(){return this._state.primitiveName}get compressGeometry(){return this._state.compressGeometry}get positions(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),Vt.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null}set positions(e){const t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){const i=Vt.getPositionsBounds(e),s=Vt.compressPositions(e,i.min,i.max);e=s.quantized,t.positionsDecodeMatrix=s.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}get normals(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){const e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),Vt.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}}set normals(e){if(this._state.compressGeometry)return void this.error("can't update geometry normals - quantized geometry is immutable");const t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}get uv(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),Vt.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null}set uv(e){if(this._state.compressGeometry)return void this.error("can't update geometry UVs - quantized geometry is immutable");const t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}get colors(){return this._state.colors}set colors(e){if(this._state.compressGeometry)return void this.error("can't update geometry colors - quantized geometry is immutable");const t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}get indices(){return this._state.indices}get aabb(){return this._aabbDirty&&(this._aabb||(this._aabb=d.AABB3()),d.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}get obb(){return this._obbDirty&&(this._obb||(this._obb=d.OBB3()),d.positions3ToAABB3(this._state.positions,jt,this._state.positionsDecodeMatrix),d.AABB3ToOBB3(jt,this._obb),this._obbDirty=!1),this._obb}get numTriangles(){return this._numTriangles}_setAABBDirty(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Ht.meshes--}}function zt(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return y.apply(e,{positions:[c,u,d,l,u,d,l,A,d,c,A,d,c,u,d,c,A,d,c,A,h,c,u,h,c,u,d,c,u,h,l,u,h,l,u,d,l,u,d,l,u,h,l,A,h,l,A,d,l,A,h,c,A,h,c,A,d,l,A,d,c,A,h,l,A,h,l,u,h,c,u,h],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}class Wt extends R{get type(){return"Material"}constructor(e,t={}){super(e,t),m.memory.materials++}destroy(){super.destroy(),m.memory.materials--}}const Kt={opaque:0,mask:1,blend:2},Xt=["opaque","mask","blend"];class Jt extends Wt{get type(){return"PhongMaterial"}constructor(e,t={}){super(e,t),this._state=new lt({type:"PhongMaterial",ambient:d.vec3([1,1,1]),diffuse:d.vec3([1,1,1]),specular:d.vec3([1,1,1]),emissive:d.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),this.ambient=t.ambient,this.diffuse=t.diffuse,this.specular=t.specular,this.emissive=t.emissive,this.alpha=t.alpha,this.shininess=t.shininess,this.reflectivity=t.reflectivity,this.lineWidth=t.lineWidth,this.pointSize=t.pointSize,t.ambientMap&&(this._ambientMap=this._checkComponent("Texture",t.ambientMap)),t.diffuseMap&&(this._diffuseMap=this._checkComponent("Texture",t.diffuseMap)),t.specularMap&&(this._specularMap=this._checkComponent("Texture",t.specularMap)),t.emissiveMap&&(this._emissiveMap=this._checkComponent("Texture",t.emissiveMap)),t.alphaMap&&(this._alphaMap=this._checkComponent("Texture",t.alphaMap)),t.reflectivityMap&&(this._reflectivityMap=this._checkComponent("Texture",t.reflectivityMap)),t.normalMap&&(this._normalMap=this._checkComponent("Texture",t.normalMap)),t.occlusionMap&&(this._occlusionMap=this._checkComponent("Texture",t.occlusionMap)),t.diffuseFresnel&&(this._diffuseFresnel=this._checkComponent("Fresnel",t.diffuseFresnel)),t.specularFresnel&&(this._specularFresnel=this._checkComponent("Fresnel",t.specularFresnel)),t.emissiveFresnel&&(this._emissiveFresnel=this._checkComponent("Fresnel",t.emissiveFresnel)),t.alphaFresnel&&(this._alphaFresnel=this._checkComponent("Fresnel",t.alphaFresnel)),t.reflectivityFresnel&&(this._reflectivityFresnel=this._checkComponent("Fresnel",t.reflectivityFresnel)),this.alphaMode=t.alphaMode,this.alphaCutoff=t.alphaCutoff,this.backfaces=t.backfaces,this.frontface=t.frontface,this._makeHash()}_makeHash(){const e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}set ambient(e){let t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get ambient(){return this._state.ambient}set diffuse(e){let t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get diffuse(){return this._state.diffuse}set specular(e){let t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}get specular(){return this._state.specular}set emissive(e){let t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}get emissive(){return this._state.emissive}set alpha(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}get alpha(){return this._state.alpha}set shininess(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}get shininess(){return this._state.shininess}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set pointSize(e){this._state.pointSize=e||1,this.glRedraw()}get pointSize(){return this._state.pointSize}set reflectivity(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}get reflectivity(){return this._state.reflectivity}get normalMap(){return this._normalMap}get ambientMap(){return this._ambientMap}get diffuseMap(){return this._diffuseMap}get specularMap(){return this._specularMap}get emissiveMap(){return this._emissiveMap}get alphaMap(){return this._alphaMap}get reflectivityMap(){return this._reflectivityMap}get occlusionMap(){return this._occlusionMap}get diffuseFresnel(){return this._diffuseFresnel}get specularFresnel(){return this._specularFresnel}get emissiveFresnel(){return this._emissiveFresnel}get alphaFresnel(){return this._alphaFresnel}get reflectivityFresnel(){return this._reflectivityFresnel}set alphaMode(e){let t=Kt[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}get alphaMode(){return Xt[this._state.alphaMode]}set alphaCutoff(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}get alphaCutoff(){return this._state.alphaCutoff}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set frontface(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}get frontface(){return this._state.frontface?"ccw":"cw"}destroy(){super.destroy(),this._state.destroy()}}const Yt={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}};class Zt extends Wt{get type(){return"EmphasisMaterial"}get presets(){return Yt}constructor(e,t={}){super(e,t),this._state=new lt({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),this._preset="default",t.preset?(this.preset=t.preset,void 0!==t.fill&&(this.fill=t.fill),t.fillColor&&(this.fillColor=t.fillColor),void 0!==t.fillAlpha&&(this.fillAlpha=t.fillAlpha),void 0!==t.edges&&(this.edges=t.edges),t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth),void 0!==t.backfaces&&(this.backfaces=t.backfaces),void 0!==t.glowThrough&&(this.glowThrough=t.glowThrough)):(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.backfaces=t.backfaces,this.glowThrough=t.glowThrough)}set fill(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}get fill(){return this._state.fill}set fillColor(e){let t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}get fillColor(){return this._state.fillColor}set fillAlpha(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}get fillAlpha(){return this._state.fillAlpha}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set backfaces(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}get backfaces(){return this._state.backfaces}set glowThrough(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}get glowThrough(){return this._state.glowThrough}set preset(e){if(e=e||"default",this._preset===e)return;const t=Yt[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Yt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const qt={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}};class $t extends Wt{get type(){return"EdgeMaterial"}get presets(){return qt}constructor(e,t={}){super(e,t),this._state=new lt({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),this._preset="default",t.preset?(this.preset=t.preset,t.edgeColor&&(this.edgeColor=t.edgeColor),void 0!==t.edgeAlpha&&(this.edgeAlpha=t.edgeAlpha),void 0!==t.edgeWidth&&(this.edgeWidth=t.edgeWidth)):(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth),this.edges=!1!==t.edges}set edges(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}get edges(){return this._state.edges}set edgeColor(e){let t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set edgeAlpha(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}get edgeAlpha(){return this._state.edgeAlpha}set edgeWidth(e){this._state.edgeWidth=e||1,this.glRedraw()}get edgeWidth(){return this._state.edgeWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=qt[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(qt).join(", "))}get preset(){return this._preset}destroy(){super.destroy(),this._state.destroy()}}const ei={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}};class ti extends R{constructor(e,t={}){super(e,t),this._units="meters",this._scale=1,this._origin=d.vec3([0,0,0]),this.units=t.units,this.scale=t.scale,this.origin=t.origin}get unitsInfo(){return ei}set units(e){e||(e="meters");ei[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}get units(){return this._units}set scale(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}get scale(){return this._scale}set origin(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}get origin(){return this._origin}worldToRealPos(e,t=d.vec3(3)){t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}realToWorldPos(e,t=d.vec3(3)){return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}class ii extends R{constructor(e,t={}){super(e,t),this._supported=Se.SUPPORTED_EXTENSIONS.OES_standard_derivatives,this.enabled=t.enabled,this.kernelRadius=t.kernelRadius,this.intensity=t.intensity,this.bias=t.bias,this.scale=t.scale,this.minResolution=t.minResolution,this.numSamples=t.numSamples,this.blur=t.blur,this.blendCutoff=t.blendCutoff,this.blendFactor=t.blendFactor}get supported(){return this._supported}set enabled(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}get enabled(){return this._enabled}get possible(){if(!this._supported)return!1;if(!this._enabled)return!1;const e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}get active(){return this._active}set kernelRadius(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}get kernelRadius(){return this._kernelRadius}set intensity(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}get intensity(){return this._intensity}set bias(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}get bias(){return this._bias}set scale(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}get scale(){return this._scale}set minResolution(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}get minResolution(){return this._minResolution}set numSamples(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}get numSamples(){return this._numSamples}set blur(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}get blur(){return this._blur}set blendCutoff(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}get blendCutoff(){return this._blendCutoff}set blendFactor(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}get blendFactor(){return this._blendFactor}destroy(){super.destroy()}}class si extends R{constructor(e,t={}){super(e,t),this.sliceColor=t.sliceColor,this.sliceThickness=t.sliceThickness}set sliceThickness(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}get sliceThickness(){return this._sliceThickness}set sliceColor(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}get sliceColor(){return this._sliceColor}destroy(){super.destroy()}}const ri={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}};class oi extends Wt{get type(){return"PointsMaterial"}get presets(){return ri}constructor(e,t={}){super(e,t),this._state=new lt({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),t.preset?(this.preset=t.preset,void 0!==t.pointSize&&(this.pointSize=t.pointSize),void 0!==t.roundPoints&&(this.roundPoints=t.roundPoints),void 0!==t.perspectivePoints&&(this.perspectivePoints=t.perspectivePoints),void 0!==t.minPerspectivePointSize&&(this.minPerspectivePointSize=t.minPerspectivePointSize),void 0!==t.maxPerspectivePointSize&&(this.maxPerspectivePointSize=t.minPerspectivePointSize)):(this._preset="default",this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize),this.filterIntensity=t.filterIntensity,this.minIntensity=t.minIntensity,this.maxIntensity=t.maxIntensity}set pointSize(e){this._state.pointSize=e||2,this.glRedraw()}get pointSize(){return this._state.pointSize}set roundPoints(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}get roundPoints(){return this._state.roundPoints}set perspectivePoints(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}get perspectivePoints(){return this._state.perspectivePoints}set minPerspectivePointSize(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}get minPerspectivePointSize(){return this._state.minPerspectivePointSize}set maxPerspectivePointSize(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}get maxPerspectivePointSize(){return this._state.maxPerspectivePointSize}set filterIntensity(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}get filterIntensity(){return this._state.filterIntensity}set minIntensity(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}get minIntensity(){return this._state.minIntensity}set maxIntensity(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}get maxIntensity(){return this._state.maxIntensity}set preset(e){if(e=e||"default",this._preset===e)return;const t=ri[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(ri).join(", "))}get preset(){return this._preset}get hash(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}destroy(){super.destroy(),this._state.destroy()}}const ni={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}};class ai extends Wt{get type(){return"LinesMaterial"}get presets(){return ni}constructor(e,t={}){super(e,t),this._state=new lt({type:"LinesMaterial",lineWidth:null}),t.preset?(this.preset=t.preset,void 0!==t.lineWidth&&(this.lineWidth=t.lineWidth)):(this._preset="default",this.lineWidth=t.lineWidth)}set lineWidth(e){this._state.lineWidth=e||1,this.glRedraw()}get lineWidth(){return this._state.lineWidth}set preset(e){if(e=e||"default",this._preset===e)return;const t=ni[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(ni).join(", "))}get preset(){return this._preset}get hash(){return[""+this.lineWidth].join(";")}destroy(){super.destroy(),this._state.destroy()}}function li(e,t){const i={};let s,r;for(let o=0,n=t.length;o{this.glRedraw()})),this.canvas.on("webglContextFailed",(()=>{alert("xeokit failed to find WebGL!")})),this._renderer=new ot(this,{transparent:s,alphaDepthMask:r}),this._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;let e=null;this.getHash=function(){if(e)return e;const t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";const i=[];for(let e=0,s=t;ethis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},this._sectionPlanesState.setNumCachedSectionPlanes(t.numCachedSectionPlanes||0),this._lightsState=new function(){const e=d.vec4([0,0,0,0]),t=d.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];let i=null,s=null;this.getHash=function(){if(i)return i;const e=[],t=this.lights;let s;for(let i=0,r=t.length;i0&&e.push("/lm"),this.reflectionMaps.length>0&&e.push("/rm"),e.push(";"),i=e.join(""),i},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(let t=0,r=this.lights.length;t{this._renderer.imageDirty()}))}_initDefaults(){}_addComponent(e){if(e.id&&this.components[e.id]&&(this.error("Component "+y.inQuotes(e.id)+" already exists in Scene - ignoring ID, will randomly-generate instead"),e.id=null),!e.id)for(void 0===window.nextID&&(window.nextID=0),e.id="__"+window.nextID++;this.components[e.id];)e.id=d.createUUID();this.components[e.id]=e;const t=e.type;let i=this.types[e.type];i||(i=this.types[t]={}),i[e.id]=e,e.compile&&(this._compilables[e.id]=e),e.isDrawable&&(this._renderer.addDrawable(e.id,e),this._collidables[e.id]=e)}_removeComponent(e){var t=e.id,i=e.type;delete this.components[t];const s=this.types[i];s&&(delete s[t],y.isEmptyObject(s)&&delete this.types[i]),e.compile&&delete this._compilables[e.id],e.isDrawable&&(this._renderer.removeDrawable(e.id),delete this._collidables[e.id])}_sectionPlaneCreated(e){this.sectionPlanes[e.id]=e,this.scene._sectionPlanesState.addSectionPlane(e._state),this.scene.fire("sectionPlaneCreated",e,!0),this._needRecompile=!0}_bitmapCreated(e){this.bitmaps[e.id]=e,this.scene.fire("bitmapCreated",e,!0)}_lineSetCreated(e){this.lineSets[e.id]=e,this.scene.fire("lineSetCreated",e,!0)}_lightCreated(e){this.lights[e.id]=e,this.scene._lightsState.addLight(e._state),this._needRecompile=!0}_lightMapCreated(e){this.lightMaps[e.id]=e,this.scene._lightsState.addLightMap(e._state),this._needRecompile=!0}_reflectionMapCreated(e){this.reflectionMaps[e.id]=e,this.scene._lightsState.addReflectionMap(e._state),this._needRecompile=!0}_sectionPlaneDestroyed(e){delete this.sectionPlanes[e.id],this.scene._sectionPlanesState.removeSectionPlane(e._state),this.scene.fire("sectionPlaneDestroyed",e,!0),this._needRecompile=!0}_bitmapDestroyed(e){delete this.bitmaps[e.id],this.scene.fire("bitmapDestroyed",e,!0)}_lineSetDestroyed(e){delete this.lineSets[e.id],this.scene.fire("lineSetDestroyed",e,!0)}_lightDestroyed(e){delete this.lights[e.id],this.scene._lightsState.removeLight(e._state),this._needRecompile=!0}_lightMapDestroyed(e){delete this.lightMaps[e.id],this.scene._lightsState.removeLightMap(e._state),this._needRecompile=!0}_reflectionMapDestroyed(e){delete this.reflectionMaps[e.id],this.scene._lightsState.removeReflectionMap(e._state),this._needRecompile=!0}_registerModel(e){this.models[e.id]=e,this._modelIds=null}_deregisterModel(e){const t=e.id;delete this.models[t],this._modelIds=null,this.fire("modelUnloaded",t)}_registerObject(e){this.objects[e.id]=e,this._numObjects++,this._objectIds=null}_deregisterObject(e){delete this.objects[e.id],this._numObjects--,this._objectIds=null}_objectVisibilityUpdated(e,t=!0){e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}_deRegisterVisibleObject(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}_objectXRayedUpdated(e,t=!0){e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}_deRegisterXRayedObject(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}_objectHighlightedUpdated(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}_deRegisterHighlightedObject(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}_objectSelectedUpdated(e,t=!0){e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}_deRegisterSelectedObject(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}_objectColorizeUpdated(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}_deRegisterColorizedObject(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}_objectOpacityUpdated(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}_deRegisterOpacityObject(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}_objectOffsetUpdated(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}_deRegisterOffsetObject(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}_webglContextLost(){this.canvas.spinner.processes++;for(const e in this.components)if(this.components.hasOwnProperty(e)){const t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}_webglContextRestored(){const e=this.canvas.gl;for(const t in this.components)if(this.components.hasOwnProperty(t)){const i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}get capabilities(){return this._renderer.capabilities}get entityOffsetsEnabled(){return this._entityOffsetsEnabled}get pickSurfacePrecisionEnabled(){return!1}get logarithmicDepthBufferEnabled(){return this._logarithmicDepthBufferEnabled}set numCachedSectionPlanes(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}get numCachedSectionPlanes(){return this._sectionPlanesState.getNumCachedSectionPlanes()}set pbrEnabled(e){this._pbrEnabled=!!e,this.glRedraw()}get pbrEnabled(){return this._pbrEnabled}set dtxEnabled(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}get dtxEnabled(){return this._dtxEnabled}set colorTextureEnabled(e){this._colorTextureEnabled=!!e,this.glRedraw()}get colorTextureEnabled(){return this._colorTextureEnabled}doOcclusionTest(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}render(e){e&&I.runTasks();const t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),!e&&!this._renderer.needsRender())return;t.sceneId=this.id;const i=this._passes,s=this._clearEachPass;let r,o;for(r=0;rr&&(r=e[3]),e[4]>o&&(o=e[4]),e[5]>n&&(n=e[5]),A=!0}A||(t=-100,i=-100,s=-100,r=100,o=100,n=100),this._aabb[0]=t,this._aabb[1]=i,this._aabb[2]=s,this._aabb[3]=r,this._aabb[4]=o,this._aabb[5]=n,this._aabbDirty=!1}return this._aabb}_setAABBDirty(){this._aabbDirty=!0,this.fire("boundary")}pick(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");const i=e.includeEntities||e.include;i&&(e.includeEntityIds=li(this,i));const s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=li(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}snapPick(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}clear(){var e;for(const t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}clearLights(){const e=Object.keys(this.lights);for(let t=0,i=e.length;t{if(e.collidable){const l=e.aabb;l[0]o&&(o=l[3]),l[4]>n&&(n=l[4]),l[5]>a&&(a=l[5]),t=!0}})),t){const e=d.AABB3();return e[0]=i,e[1]=s,e[2]=r,e[3]=o,e[4]=n,e[5]=a,e}return this.aabb}setObjectsVisible(e,t){return this.withObjects(e,(e=>{const i=e.visible!==t;return e.visible=t,i}))}setObjectsCollidable(e,t){return this.withObjects(e,(e=>{const i=e.collidable!==t;return e.collidable=t,i}))}setObjectsCulled(e,t){return this.withObjects(e,(e=>{const i=e.culled!==t;return e.culled=t,i}))}setObjectsSelected(e,t){return this.withObjects(e,(e=>{const i=e.selected!==t;return e.selected=t,i}))}setObjectsHighlighted(e,t){return this.withObjects(e,(e=>{const i=e.highlighted!==t;return e.highlighted=t,i}))}setObjectsXRayed(e,t){return this.withObjects(e,(e=>{const i=e.xrayed!==t;return e.xrayed=t,i}))}setObjectsEdges(e,t){return this.withObjects(e,(e=>{const i=e.edges!==t;return e.edges=t,i}))}setObjectsColorized(e,t){return this.withObjects(e,(e=>{e.colorize=t}))}setObjectsOpacity(e,t){return this.withObjects(e,(e=>{const i=e.opacity!==t;return e.opacity=t,i}))}setObjectsPickable(e,t){return this.withObjects(e,(e=>{const i=e.pickable!==t;return e.pickable=t,i}))}setObjectsOffset(e,t){this.withObjects(e,(e=>{e.offset=t}))}withObjects(e,t){y.isString(e)&&(e=[e]);let i=!1;for(let s=0,r=e.length;s{r>s&&(s=r,e(...i))}));return this._tickifiedFunctions[t]={tickSubId:n,wrapperFunc:o},o}destroy(){super.destroy();for(const e in this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}const hi=1e3,ci=1001,ui=1002,di=1003,pi=1004,fi=1004,gi=1005,mi=1005,_i=1006,vi=1007,bi=1007,yi=1008,Bi=1008,wi=1009,xi=1010,Pi=1011,Ci=1012,Mi=1013,Fi=1014,Ei=1015,Ii=1016,Di=1017,Si=1018,Ti=1020,Ri=1021,Li=1022,Ui=1023,ki=1024,Oi=1025,Ni=1026,Qi=1027,Vi=1028,Hi=1029,ji=1030,Gi=1031,zi=1033,Wi=33776,Ki=33777,Xi=33778,Ji=33779,Yi=35840,Zi=35841,qi=35842,$i=35843,es=36196,ts=37492,is=37496,ss=37808,rs=37809,os=37810,ns=37811,as=37812,ls=37813,As=37814,hs=37815,cs=37816,us=37817,ds=37818,ps=37819,fs=37820,gs=37821,ms=36492,_s=3e3,vs=3001,bs=1e4,ys=10001,Bs=10002,ws=10003,xs=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,o=e._state.billboard,n=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,A=[];A.push("#version 300 es"),A.push("// Lambertian drawing vertex shader"),A.push("in vec3 position;"),A.push("uniform mat4 modelMatrix;"),A.push("uniform mat4 viewMatrix;"),A.push("uniform mat4 projMatrix;"),A.push("uniform vec4 colorize;"),A.push("uniform vec3 offset;"),l&&A.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(A.push("uniform float logDepthBufFC;"),A.push("out float vFragDepth;"),A.push("bool isPerspectiveMatrix(mat4 m) {"),A.push(" return (m[2][3] == - 1.0);"),A.push("}"),A.push("out float isPerspective;"));a&&A.push("out vec4 vWorldPosition;");if(A.push("uniform vec4 lightAmbient;"),A.push("uniform vec4 materialColor;"),A.push("uniform vec3 materialEmissive;"),r.normalsBuf){A.push("in vec3 normal;"),A.push("uniform mat4 modelNormalMatrix;"),A.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=s.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),A.push(" }"),A.push(" return normalize(v);"),A.push("}"))}A.push("out vec4 vColor;"),"points"===r.primitiveName&&A.push("uniform float pointSize;");"spherical"!==o&&"cylindrical"!==o||(A.push("void billboard(inout mat4 mat) {"),A.push(" mat[0][0] = 1.0;"),A.push(" mat[0][1] = 0.0;"),A.push(" mat[0][2] = 0.0;"),"spherical"===o&&(A.push(" mat[1][0] = 0.0;"),A.push(" mat[1][1] = 1.0;"),A.push(" mat[1][2] = 0.0;")),A.push(" mat[2][0] = 0.0;"),A.push(" mat[2][1] = 0.0;"),A.push(" mat[2][2] =1.0;"),A.push("}"));A.push("void main(void) {"),A.push("vec4 localPosition = vec4(position, 1.0); "),A.push("vec4 worldPosition;"),l&&A.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?A.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):A.push("vec4 localNormal = vec4(normal, 0.0); "),A.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),A.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));A.push("mat4 viewMatrix2 = viewMatrix;"),A.push("mat4 modelMatrix2 = modelMatrix;"),n&&A.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(A.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),A.push("billboard(modelMatrix2);"),A.push("billboard(viewMatrix2);"),A.push("billboard(modelViewMatrix);"),r.normalsBuf&&(A.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),A.push("billboard(modelNormalMatrix2);"),A.push("billboard(viewNormalMatrix2);"),A.push("billboard(modelViewNormalMatrix);")),A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(A.push("worldPosition = modelMatrix2 * localPosition;"),A.push("worldPosition.xyz = worldPosition.xyz + offset;"),A.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&A.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(A.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),A.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),A.push("float lambertian = 1.0;"),r.normalsBuf)for(let e=0,t=s.lights.length;e0,o=t.gammaOutput,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}"points"===s.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");o?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(e)):(this.vertex=function(e){const t=e.scene;e._material;const i=e._state,s=t._sectionPlanesState,r=e._geometry._state,o=t._lightsState;let n;const a=i.billboard,l=i.background,A=i.stationary,h=function(e){if(!e._geometry._state.uvBuf)return!1;const t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=Ms(e),u=s.getNumAllocatedSectionPlanes()>0,d=Cs(e),p=!!r.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),u&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(let e=0,t=o.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}h&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));r.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===r.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(let e=0,t=o.lights.length;e0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(let e=0,t=o.lights.length;e0,l=Ms(e),A=s.uvBuf,h="PhongMaterial"===n.type,c="MetallicMaterial"===n.type,u="SpecularMaterial"===n.type,d=Cs(e);t.gammaInput;const p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var g=0;g0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),o.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),h&&((o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = "+Ps[o.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||u)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),o.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+Ps[o.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(o.lightMaps.length>0||o.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),o.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(o.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));n.ambient&&f.push("uniform vec3 materialAmbient;");n.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==n.alpha&&null!==n.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");n.emissive&&f.push("uniform vec3 materialEmissive;");n.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==n.glossiness&&null!==n.glossiness&&f.push("uniform float materialGlossiness;");void 0!==n.shininess&&null!==n.shininess&&f.push("uniform float materialShininess;");n.specular&&f.push("uniform vec3 materialSpecular;");void 0!==n.metallic&&null!==n.metallic&&f.push("uniform float materialMetallic;");void 0!==n.roughness&&null!==n.roughness&&f.push("uniform float materialRoughness;");void 0!==n.specularF0&&null!==n.specularF0&&f.push("uniform float materialSpecularF0;");A&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));A&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));A&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));A&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&A&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&A&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&A&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));A&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));A&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&A&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&A&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&A&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(let e=0,t=o.lights.length;e 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),n.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");n.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):n.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");n.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");n.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==n.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==n.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==n.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==n.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==n.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");A&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));A&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+Ps[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));A&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+Ps[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));A&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+Ps[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));A&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+Ps[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));A&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));A&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(o.lights.length>0||o.lightMaps.length>0||o.reflectionMaps.length>0)){A&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),A&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),A&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),A&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),A&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),A&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),A&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),h&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),u&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),o.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),h&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(u||c)&&(o.lightMaps.length>0||o.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(let e=0,t=o.lights.length;e0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(h=0,c=o.sectionPlanes.length;h0&&r.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,r.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),r.reflectionMaps.length>0&&r.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,r.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%t,e.bindTexture++),this._uGammaFactor&&s.uniform1f(this._uGammaFactor,i.gammaFactor),this._baseTextureUnit=e.textureUnit};class Ss{constructor(e){this.vertex=function(e){const t=e.scene,i=t._lightsState,s=function(e){const t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,o=!!e._geometry._state.compressGeometry,n=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),o&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===n||"cylindrical"===n)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===n&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),o&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(o?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(let e=0,t=i.lights.length;e0,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}"points"===e._geometry._state.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const Ts=new e({}),Rs=d.vec3(),Ls=function(e,t){this.id=Ts.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Ss(t),this._allocate(t)},Us={};Ls.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Us[t];return i||(i=new Ls(t,e),Us[t]=i,m.memory.programs++),i._useCount++,i},Ls.prototype.put=function(){0==--this._useCount&&(Ts.removeItem(this.id),this._program&&this._program.destroy(),delete Us[this._hash],m.memory.programs--)},Ls.prototype.webglContextRestored=function(){this._program=null},Ls.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl,n=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,A=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,A?e.getRTCViewMatrix(a.originHash,A):r.viewMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Edges drawing vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec4 edgeColor;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));i&&n.push("out vec4 vWorldPosition;");n.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));n.push("vColor = edgeColor;"),i&&n.push("vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,o=[];o.push("#version 300 es"),o.push("// Edges drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));s&&(o.push("uniform float gammaFactor;"),o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),o.push("}")}t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)}}const Os=new e({}),Ns=d.vec3(),Qs=function(e,t){this.id=Os.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new ks(t),this._allocate(t)},Vs={};Qs.get=function(e){const t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Vs[t];return i||(i=new Qs(t,e),Vs[t]=i,m.memory.programs++),i._useCount++,i},Qs.prototype.put=function(){0==--this._useCount&&(Os.removeItem(this.id),this._program&&this._program.destroy(),delete Vs[this._hash],m.memory.programs--)},Qs.prototype.webglContextRestored=function(){this._program=null},Qs.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);const s=this._scene,r=s.camera,o=s.canvas.gl;let n;const a=t._state,l=t._geometry,A=l._state,h=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),o.uniformMatrix4fv(this._uViewMatrix,!1,h?e.getRTCViewMatrix(a.originHash,h):r.viewMatrix),a.clippable){const e=s._sectionPlanesState.getNumAllocatedSectionPlanes(),i=s._sectionPlanesState.sectionPlanes.length;if(e>0){const r=s._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh picking vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("out vec4 vViewPosition;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("uniform vec2 pickClipPos;"),n.push("vec4 remapClipPos(vec4 clipPos) {"),n.push(" clipPos.xy /= clipPos.w;"),n.push(" clipPos.xy -= pickClipPos;"),n.push(" clipPos.xy *= clipPos.w;"),n.push(" return clipPos;"),n.push("}"),n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"));n.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = remapClipPos(clipPos);"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(e)}}const js=d.vec3(),Gs=function(e,t){this._hash=e,this._shaderSource=new Hs(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},zs={};Gs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let i=zs[t];if(!i){if(i=new Gs(t,e),i.errors)return console.log(i.errors.join("\n")),null;zs[t]=i,m.memory.programs++}return i._useCount++,i},Gs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete zs[this._hash],m.memory.programs--)},Gs.prototype.webglContextRestored=function(){this._program=null},Gs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t>24&255,h=l>>16&255,c=l>>8&255,u=255&l;s.uniform4f(this._uPickColor,u/255,c/255,h/255,A/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),n.indicesBuf?(s.drawElements(n.primitive,n.indicesBuf.numItems,n.indicesBuf.itemType,0),e.drawElements++):n.positions&&s.drawArrays(s.TRIANGLES,0,n.positions.numItems)},Gs.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Ve(i,this._shaderSource),this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(let e=0;e 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(e)}}const Ks=d.vec3(),Xs=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Ws(t),this._allocate(t)},Js={};Xs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";");let i=Js[t];if(!i){if(i=new Xs(t,e),i.errors)return console.log(i.errors.join("\n")),null;Js[t]=i,m.memory.programs++}return i._useCount++,i},Xs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Js[this._hash],m.memory.programs--)},Xs.prototype.webglContextRestored=function(){this._program=null},Xs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._state,o=t._material._state,n=t._geometry,a=t._geometry._state,l=t.origin,A=o.backfaces,h=o.frontface,c=i.camera.project,u=n._getPickTrianglePositions(),d=n._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){const e=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,e)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,o=e._state.stationary,n=[];n.push("#version 300 es"),n.push("// Mesh occlusion vertex shader"),n.push("in vec3 position;"),n.push("uniform mat4 modelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform vec3 offset;"),s&&n.push("uniform mat4 positionsDecodeMatrix;");i&&n.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(n.push("void billboard(inout mat4 mat) {"),n.push(" mat[0][0] = 1.0;"),n.push(" mat[0][1] = 0.0;"),n.push(" mat[0][2] = 0.0;"),"spherical"===r&&(n.push(" mat[1][0] = 0.0;"),n.push(" mat[1][1] = 1.0;"),n.push(" mat[1][2] = 0.0;")),n.push(" mat[2][0] = 0.0;"),n.push(" mat[2][1] = 0.0;"),n.push(" mat[2][2] =1.0;"),n.push("}"));n.push("void main(void) {"),n.push("vec4 localPosition = vec4(position, 1.0); "),n.push("vec4 worldPosition;"),s&&n.push("localPosition = positionsDecodeMatrix * localPosition;");n.push("mat4 viewMatrix2 = viewMatrix;"),n.push("mat4 modelMatrix2 = modelMatrix;"),o&&n.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(n.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),n.push("billboard(modelMatrix2);"),n.push("billboard(viewMatrix2);"),n.push("billboard(modelViewMatrix);"),n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(n.push("worldPosition = modelMatrix2 * localPosition;"),n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&n.push(" vWorldPosition = worldPosition;");n.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return n.push("gl_Position = clipPos;"),n.push("}"),n}(e),this.fragment=function(e){const t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(e)}}const Zs=d.vec3(),qs=function(e,t){this._hash=e,this._shaderSource=new Ys(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},$s={};qs.get=function(e){const t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";");let i=$s[t];if(!i){if(i=new qs(t,e),i.errors)return console.log(i.errors.join("\n")),null;$s[t]=i,m.memory.programs++}return i._useCount++,i},qs.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete $s[this._hash],m.memory.programs--)},qs.prototype.webglContextRestored=function(){this._program=null},qs.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene,s=i.canvas.gl,r=t._material._state,o=t._state,n=t._geometry._state,a=t.origin;if(r.alpha<1)return;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){const t=r.backfaces;e.backfaces!==t&&(t?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=t);const i=r.frontface;e.frontface!==i&&(i?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=i),this._lastMaterialId=r.id}const l=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(o.originHash,a):l.viewMatrix),o.clippable){const e=i._sectionPlanesState.getNumAllocatedSectionPlanes(),r=i._sectionPlanesState.sectionPlanes.length;if(e>0){const o=i._sectionPlanesState.sectionPlanes,n=t.renderFlags;for(let t=0;t0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(e),this.fragment=function(e){const t=e.scene;t.canvas.gl;const i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var o=0;o 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(e)}}const tr=function(e,t){this._hash=e,this._shaderSource=new er(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},ir={};tr.get=function(e){const t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";");let s=ir[i];if(!s){if(s=new tr(i,e),s.errors)return console.log(s.errors.join("\n")),null;ir[i]=s,m.memory.programs++}return s._useCount++,s},tr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete ir[this._hash],m.memory.programs--)},tr.prototype.webglContextRestored=function(){this._program=null},tr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);const i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){const t=s.backfaces;e.backfaces!==t&&(t?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=t);const r=s.frontface;e.frontface!==r&&(r?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=r),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){const s=t.vertexBufs;s.id!==this._lastVertexBufsId&&(s.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(s.positionsBuf,s.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=s.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},tr.prototype._allocate=function(e){const t=e.scene,i=t.canvas.gl;if(this._program=new Ve(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)return void(this.errors=this._program.errors);const s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(let e=0,i=t._sectionPlanesState.sectionPlanes.length;e0){let e,t,r,o,n;for(let a=0,l=this._uSectionPlanes.length;a0)for(let i=0;i0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this.glRedraw()}}const fr=function(){const e=d.vec3(),t=d.vec3(),i=d.vec3(),s=d.vec3(),r=d.vec3(),o=d.vec3(),n=d.vec4(),a=d.vec3(),l=d.vec3(),A=d.vec3(),h=d.vec3(),c=d.vec3(),u=d.vec3(),p=d.vec3(),f=d.vec3(),g=d.vec3(),m=d.vec4(),_=d.vec4(),v=d.vec4(),b=d.vec3(),y=d.vec3(),B=d.vec3(),w=d.vec3(),x=d.vec3(),P=d.vec3(),C=d.vec3(),M=d.vec3(),F=d.vec3(),E=d.vec3(),I=d.vec3();return function(D,S,T,R){var L=R.primIndex;if(null!=L&&L>-1){const N=D.geometry._state,Q=D.scene,V=Q.camera,H=Q.canvas;if("triangles"===N.primitiveName){R.primitive="triangle";const Q=L,j=N.indices,G=N.positions;let z,W,X;if(j){var U=j[Q+0],k=j[Q+1],O=j[Q+2];o[0]=U,o[1]=k,o[2]=O,R.indices=o,z=3*U,W=3*k,X=3*O}else z=3*Q,W=z+3,X=W+3;if(i[0]=G[z+0],i[1]=G[z+1],i[2]=G[z+2],s[0]=G[W+0],s[1]=G[W+1],s[2]=G[W+2],r[0]=G[X+0],r[1]=G[X+1],r[2]=G[X+2],N.compressGeometry){const e=N.positionsDecodeMatrix;e&&(Vt.decompressPosition(i,e,i),Vt.decompressPosition(s,e,s),Vt.decompressPosition(r,e,r))}R.canvasPos?d.canvasPosToLocalRay(H.canvas,D.origin?K(S,D.origin):S,T,D.worldMatrix,R.canvasPos,e,t):R.origin&&R.direction&&d.worldRayToLocalRay(D.worldMatrix,R.origin,R.direction,e,t),d.normalizeVec3(t),d.rayPlaneIntersect(e,t,i,s,r,n),R.localPos=n,R.position=n,m[0]=n[0],m[1]=n[1],m[2]=n[2],m[3]=1,d.transformVec4(D.worldMatrix,m,_),a[0]=_[0],a[1]=_[1],a[2]=_[2],R.canvasPos&&D.origin&&(a[0]+=D.origin[0],a[1]+=D.origin[1],a[2]+=D.origin[2]),R.worldPos=a,d.transformVec4(V.matrix,_,v),l[0]=v[0],l[1]=v[1],l[2]=v[2],R.viewPos=l,d.cartesianToBarycentric(n,i,s,r,A),R.bary=A;const J=N.normals;if(J){if(N.compressGeometry){const e=3*U,t=3*k,i=3*O;Vt.decompressNormal(J.subarray(e,e+2),h),Vt.decompressNormal(J.subarray(t,t+2),c),Vt.decompressNormal(J.subarray(i,i+2),u)}else h[0]=J[z],h[1]=J[z+1],h[2]=J[z+2],c[0]=J[W],c[1]=J[W+1],c[2]=J[W+2],u[0]=J[X],u[1]=J[X+1],u[2]=J[X+2];const e=d.addVec3(d.addVec3(d.mulVec3Scalar(h,A[0],b),d.mulVec3Scalar(c,A[1],y),B),d.mulVec3Scalar(u,A[2],w),x);R.worldNormal=d.normalizeVec3(d.transformVec3(D.worldNormalMatrix,e,P))}const Y=N.uv;if(Y){if(p[0]=Y[2*U],p[1]=Y[2*U+1],f[0]=Y[2*k],f[1]=Y[2*k+1],g[0]=Y[2*O],g[1]=Y[2*O+1],N.compressGeometry){const e=N.uvDecodeMatrix;e&&(Vt.decompressUV(p,e,p),Vt.decompressUV(f,e,f),Vt.decompressUV(g,e,g))}R.uv=d.addVec3(d.addVec3(d.mulVec2Scalar(p,A[0],C),d.mulVec2Scalar(f,A[1],M),F),d.mulVec2Scalar(g,A[2],E),I)}}}}}();function gr(e={}){let t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);let i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);let s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);let r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);let o=e.heightSegments||1;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),o<1&&(o=1);const n=!!e.openEnded;let a=e.center;const l=a?a[0]:0,A=a?a[1]:0,h=a?a[2]:0,c=s/2,u=s/o,d=2*Math.PI/r,p=1/r,f=(t-i)/o,g=[],m=[],_=[],v=[];let b,B,w,x,P,C,M,F,E,I,D;const S=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(b=0;b<=o;b++)for(P=t-b*f,C=c-b*u,B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),m.push(P*w),m.push(S),m.push(P*x),_.push(B*p),_.push(1*b/o),g.push(P*w+l),g.push(C+A),g.push(P*x+h);for(b=0;b0){for(E=g.length/3,m.push(0),m.push(1),m.push(0),_.push(.5),_.push(.5),g.push(0+l),g.push(c+A),g.push(0+h),B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(t*w),m.push(1),m.push(t*x),_.push(I),_.push(D),g.push(t*w+l),g.push(c+A),g.push(t*x+h);for(B=0;B0){for(E=g.length/3,m.push(0),m.push(-1),m.push(0),_.push(.5),_.push(.5),g.push(0+l),g.push(0-c+A),g.push(0+h),B=0;B<=r;B++)w=Math.sin(B*d),x=Math.cos(B*d),I=.5*Math.sin(B*d)+.5,D=.5*Math.cos(B*d)+.5,m.push(i*w),m.push(-1),m.push(i*x),_.push(I),_.push(D),g.push(i*w+l),g.push(0-c+A),g.push(i*x+h);for(B=0;B":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function vr(e={}){var t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],o=e.size||1,n=[],a=[],l=e.text;y.isNumeric(l)&&(l=""+l);for(var A,h,c,u,d,p,f,g,m,_=(l||"").split("\n"),v=0,b=0,B=.04,w=0;w<_.length;w++){A=0,c=(h=_[w]).length;for(var x=0;x0!==e))&&this.scene._objectOffsetUpdated(this,!1)),this._isModel&&this.scene._deregisterModel(this),this._children.length){const e=this._children.splice();let t;for(let i=0,s=e.length;i1;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const o=Nr(i,this.wrapS);o&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,o);const n=Nr(i,this.wrapT);if(n&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,n),this.type===i.TEXTURE_3D||this.type===i.TEXTURE_2D_ARRAY){const e=Nr(i,this.wrapR);e&&i.texParameteri(this.target,i.TEXTURE_WRAP_R,e),i.texParameteri(this.type,i.TEXTURE_WRAP_R,e)}r?(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,jr(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,jr(i,this.magFilter))):(i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,Nr(i,this.minFilter)),i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,Nr(i,this.magFilter)));const a=Nr(i,this.format,this.encoding),l=Nr(i,this.type),A=Hr(i,this.internalFormat,a,l,this.encoding,!1);i.texStorage2D(i.TEXTURE_2D,s,A,e[0].width,e[0].height);for(let t=0,s=e.length;t>t;return e+1}class Kr extends R{get type(){return"Texture"}constructor(e,t={}){super(e,t),this._state=new lt({texture:new Vr({gl:this.scene.canvas.gl}),matrix:d.identityMat4(),hasMatrix:t.translate&&(0!==t.translate[0]||0!==t.translate[1])||!!t.rotate||t.scale&&(0!==t.scale[0]||0!==t.scale[1]),minFilter:this._checkMinFilter(t.minFilter),magFilter:this._checkMagFilter(t.magFilter),wrapS:this._checkWrapS(t.wrapS),wrapT:this._checkWrapT(t.wrapT),flipY:this._checkFlipY(t.flipY),encoding:this._checkEncoding(t.encoding)}),this._src=null,this._image=null,this._translate=d.vec2([0,0]),this._scale=d.vec2([1,1]),this._rotate=d.vec2([0,0]),this._matrixDirty=!1,this.translate=t.translate,this.scale=t.scale,this.rotate=t.rotate,t.src?this.src=t.src:t.image&&(this.image=t.image),m.memory.textures++}_checkMinFilter(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}_checkMagFilter(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}_checkWrapS(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkWrapT(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this._state.texture=new Vr({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}_update(){const e=this._state;if(this._matrixDirty){let t,i;0===this._translate[0]&&0===this._translate[1]||(t=d.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(i=d.scalingMat4v([this._scale[0],this._scale[1],1]),t=t?d.mulMat4(t,i):i),0!==this._rotate&&(i=d.rotationMat4v(.0174532925*this._rotate,[0,0,1]),t=t?d.mulMat4(t,i):i),t&&(e.matrix=t),this._matrixDirty=!1}this.glRedraw()}set image(e){this._image=Gr(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}get image(){return this._image}set src(e){this.scene.loading++,this.scene.canvas.spinner.processes++;const t=this;let i=new Image;i.onload=function(){i=Gr(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}get src(){return this._src}set translate(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}get translate(){return this._translate}set scale(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}get scale(){return this._scale}set rotate(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}get rotate(){return this._rotate}get minFilter(){return this._state.minFilter}get magFilter(){return this._state.magFilter}get wrapS(){return this._state.wrapS}get wrapT(){return this._state.wrapT}get flipY(){return this._state.flipY}get encoding(){return this._state.encoding}destroy(){super.destroy(),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),m.memory.textures--}}class Xr extends R{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new lt({edgeColor:d.vec3([0,0,0]),centerColor:d.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}}const Jr=m.memory,Yr=d.AABB3();class Zr extends Tt{get type(){return"VBOGeometry"}get isVBOGeometry(){return!0}constructor(e,t={}){super(e,t),this._state=new lt({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),this._numTriangles=0,this._edgeThreshold=t.edgeThreshold||10,this._aabb=null,this._obb=d.OBB3();const i=this._state,s=this.scene.canvas.gl;switch(t.primitive=t.primitive||"triangles",t.primitive){case"points":i.primitive=s.POINTS,i.primitiveName=t.primitive;break;case"lines":i.primitive=s.LINES,i.primitiveName=t.primitive;break;case"line-loop":i.primitive=s.LINE_LOOP,i.primitiveName=t.primitive;break;case"line-strip":i.primitive=s.LINE_STRIP,i.primitiveName=t.primitive;break;case"triangles":i.primitive=s.TRIANGLES,i.primitiveName=t.primitive;break;case"triangle-strip":i.primitive=s.TRIANGLE_STRIP,i.primitiveName=t.primitive;break;case"triangle-fan":i.primitive=s.TRIANGLE_FAN,i.primitiveName=t.primitive;break;default:this.error("Unsupported value for 'primitive': '"+t.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),i.primitive=s.TRIANGLES,i.primitiveName=t.primitive}if(t.positions)if(t.indices){var r;if(t.positionsDecodeMatrix);else{const e=Vt.getPositionsBounds(t.positions),o=Vt.compressPositions(t.positions,e.min,e.max);r=o.quantized,i.positionsDecodeMatrix=o.decodeMatrix,i.positionsBuf=new He(s,s.ARRAY_BUFFER,r,r.length,3,s.STATIC_DRAW),Jr.positions+=i.positionsBuf.numItems,d.positions3ToAABB3(t.positions,this._aabb),d.positions3ToAABB3(r,Yr,i.positionsDecodeMatrix),d.AABB3ToOBB3(Yr,this._obb)}if(t.colors){const e=t.colors.constructor===Float32Array?t.colors:new Float32Array(t.colors);i.colorsBuf=new He(s,s.ARRAY_BUFFER,e,e.length,4,s.STATIC_DRAW),Jr.colors+=i.colorsBuf.numItems}if(t.uv){const e=Vt.getUVBounds(t.uv),r=Vt.compressUVs(t.uv,e.min,e.max),o=r.quantized;i.uvDecodeMatrix=r.decodeMatrix,i.uvBuf=new He(s,s.ARRAY_BUFFER,o,o.length,2,s.STATIC_DRAW),Jr.uvs+=i.uvBuf.numItems}if(t.normals){const e=Vt.compressNormals(t.normals);let r=i.compressGeometry;i.normalsBuf=new He(s,s.ARRAY_BUFFER,e,e.length,3,s.STATIC_DRAW,r),Jr.normals+=i.normalsBuf.numItems}{const e=t.indices.constructor===Uint32Array||t.indices.constructor===Uint16Array?t.indices:new Uint32Array(t.indices);i.indicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,e,e.length,1,s.STATIC_DRAW),Jr.indices+=i.indicesBuf.numItems;const o=Rt(r,e,i.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,o,o.length,1,s.STATIC_DRAW),"triangles"===this._state.primitiveName&&(this._numTriangles=t.indices.length/3)}this._buildHash(),Jr.meshes++}else this.error("Config expected: indices");else this.error("Config expected: positions")}_buildHash(){const e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}_getEdgeIndices(){return this._edgeIndicesBuf}get primitive(){return this._state.primitiveName}get aabb(){return this._aabb}get obb(){return this._obb}get numTriangles(){return this._numTriangles}_getState(){return this._state}destroy(){super.destroy();const e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Jr.meshes--}}var qr={};function $r(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,y.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=qr.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(y.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))}function eo(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,y.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=qr.parse.fromOBJ(e),n=qr.edit.unwrap(o.i_verts,o.c_verts,3),a=qr.edit.unwrap(o.i_norms,o.c_norms,3),l=qr.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))}function to(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);let s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);const r=e.center,o=r?r[0]:0,n=r?r[1]:0,a=r?r[2]:0,l=-t+o,A=-i+n,h=-s+a,c=t+o,u=i+n,d=s+a;return y.apply(e,{primitive:"lines",positions:[l,A,h,l,A,d,l,u,h,l,u,d,c,A,h,c,A,d,c,u,h,c,u,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function io(e={}){return to({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})}function so(e={}){let t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);let i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1),t=t||10,i=i||10;const s=t/i,r=t/2,o=[],n=[];let a=0;for(let e=0,t=-r;e<=i;e++,t+=s)o.push(-r),o.push(0),o.push(t),o.push(r),o.push(0),o.push(t),o.push(t),o.push(0),o.push(-r),o.push(t),o.push(0),o.push(r),n.push(a++),n.push(a++),n.push(a++),n.push(a++);return y.apply(e,{primitive:"lines",positions:o,indices:n})}function ro(e={}){let t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);let i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);let s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);let r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);const o=e.center,n=o?o[0]:0,a=o?o[1]:0,l=o?o[2]:0,A=t/2,h=i/2,c=Math.floor(s)||1,u=Math.floor(r)||1,d=c+1,p=u+1,f=t/c,g=i/u,m=new Float32Array(d*p*3),_=new Float32Array(d*p*3),v=new Float32Array(d*p*2);let b,B,w,x,P,C,M,F=0,E=0;for(b=0;b65535?Uint32Array:Uint16Array)(c*u*6);for(b=0;b360&&(o=360);const n=e.center;let a=n?n[0]:0,l=n?n[1]:0;const A=n?n[2]:0,h=[],c=[],u=[],p=[];let f,g,m,_,v,b,B,w,x,P,C,M;for(w=0;w<=r;w++)for(B=0;B<=s;B++)f=B/s*o,g=.785398+w/r*Math.PI*2,a=t*Math.cos(f),l=t*Math.sin(f),m=(t+i*Math.cos(g))*Math.cos(f),_=(t+i*Math.cos(g))*Math.sin(f),v=i*Math.sin(g),h.push(m+a),h.push(_+l),h.push(v+A),u.push(1-B/s),u.push(w/r),b=d.normalizeVec3(d.subVec3([m,_,v],[a,l,A],[]),[]),c.push(b[0]),c.push(b[1]),c.push(b[2]);for(w=1;w<=r;w++)for(B=1;B<=s;B++)x=(s+1)*w+B-1,P=(s+1)*(w-1)+B-1,C=(s+1)*(w-1)+B,M=(s+1)*w+B,p.push(x),p.push(P),p.push(C),p.push(C),p.push(M),p.push(x);return y.apply(e,{positions:h,normals:c,uv:u,indices:p})}function no(e={}){if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";let t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";let i=[];for(let e=0;e[...e])).flat();return no({id:e.id,points:t})}qr.load=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){t(e.target.response)},i.send()},qr.save=function(e,t){var i="data:application/octet-stream;base64,"+btoa(qr.parse._buffToStr(e));window.location.href=i},qr.clone=function(e){return JSON.parse(JSON.stringify(e))},qr.bin={},qr.bin.f=new Float32Array(1),qr.bin.fb=new Uint8Array(qr.bin.f.buffer),qr.bin.rf=function(e,t){for(var i=qr.bin.f,s=qr.bin.fb,r=0;r<4;r++)s[r]=e[t+r];return i[0]},qr.bin.rsl=function(e,t){return e[t]|e[t+1]<<8},qr.bin.ril=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},qr.bin.rASCII0=function(e,t){for(var i="";0!=e[t];)i+=String.fromCharCode(e[t++]);return i},qr.bin.wf=function(e,t,i){new Float32Array(e.buffer,t,1)[0]=i},qr.bin.wsl=function(e,t,i){e[t]=i,e[t+1]=i>>8},qr.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},qr.parse={},qr.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),Ao&&(o=A),hn&&(n=h)}return{min:{x:t,y:i,z:s},max:{x:r,y:o,z:n}}};class lo extends R{constructor(e,t={}){super(e,t),this._type=t.type||(t.src?t.src.split(".").pop():null)||"jpg",this._pos=d.vec3(t.pos||[0,0,0]),this._up=d.vec3(t.up||[0,1,0]),this._normal=d.vec3(t.normal||[0,0,1]),this._height=t.height||1,this._origin=d.vec3(),this._rtcPos=d.vec3(),this._imageSize=d.vec2(),this._texture=new Kr(this,{flipY:!0}),this._image=new Image,"jpg"!==this._type&&"png"!==this._type&&(this.error('Unsupported type - defaulting to "jpg"'),this._type="jpg"),this._node=new Dr(this,{matrix:d.inverseMat4(d.lookAtMat4v(this._pos,d.subVec3(this._pos,this._normal,d.mat4()),this._up,d.mat4())),children:[this._bitmapMesh=new pr(this,{scale:[1,1,1],rotation:[-90,0,0],collidable:t.collidable,pickable:t.pickable,opacity:t.opacity,clippable:t.clippable,geometry:new Gt(this,ro({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0})})]}),t.image?this.image=t.image:t.src?this.src=t.src:t.imageData&&(this.imageData=t.imageData),this.scene._bitmapCreated(this)}set visible(e){this._bitmapMesh.visible=e}get visible(){return this._bitmapMesh.visible}set image(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}get image(){return this._image}set src(e){if(e){this._image.onload=()=>{this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale()},this._image.src=e;switch(e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}}get src(){return this._image.src}set imageData(e){this._image.onload=()=>{this._texture.image=image,this._imageSize[0]=image.width,this._imageSize[1]=image.height,this._updateBitmapMeshScale()},this._image.src=e}get imageData(){const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")}set type(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}get type(){return this._type}get pos(){return this._pos}get normal(){return this._normal}get up(){return this._up}set height(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}get height(){return this._height}set collidable(e){this._bitmapMesh.collidable=!1!==e}get collidable(){return this._bitmapMesh.collidable}set clippable(e){this._bitmapMesh.clippable=!1!==e}get clippable(){return this._bitmapMesh.clippable}set pickable(e){this._bitmapMesh.pickable=!1!==e}get pickable(){return this._bitmapMesh.pickable}set opacity(e){this._bitmapMesh.opacity=e}get opacity(){return this._bitmapMesh.opacity}destroy(){super.destroy(),this.scene._bitmapDestroyed(this)}_updateBitmapMeshScale(){const e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}const Ao=d.OBB3(),ho=d.OBB3(),co=d.OBB3();class uo{constructor(e,t,i,s,r,o,n=null,a=0){this.model=e,this.object=null,this.parent=null,this.transform=r,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=t,this.obb=null,this._aabbLocal=null,this._aabbWorld=d.AABB3(),this._aabbWorldDirty=!1,this.layer=n,this.portionId=a,this._color=new Uint8Array([i[0],i[1],i[2],s]),this._colorize=new Uint8Array([i[0],i[1],i[2],s]),this._colorizing=!1,this._transparent=s<255,this.numTriangles=0,this.origin=null,this.entity=null,r&&r._addMesh(this)}_sceneModelDirty(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}_transformDirty(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}_updateMatrix(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}_finalize(e){this.layer.initFlags(this.portionId,e,this._transparent)}_finalize2(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}_setVisible(e){this.layer.setVisible(this.portionId,e,this._transparent)}_setColor(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}_setColorize(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}_setOpacity(e,t){const i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}_setOffset(e){this.layer.setOffset(this.portionId,e)}_setHighlighted(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}_setXRayed(e){this.layer.setXRayed(this.portionId,e,this._transparent)}_setSelected(e){this.layer.setSelected(this.portionId,e,this._transparent)}_setEdges(e){this.layer.setEdges(this.portionId,e,this._transparent)}_setClippable(e){this.layer.setClippable(this.portionId,e,this._transparent)}_setCollidable(e){this.layer.setCollidable(this.portionId,e)}_setPickable(e){this.layer.setPickable(this.portionId,e,this._transparent)}_setCulled(e){this.layer.setCulled(this.portionId,e,this._transparent)}canPickTriangle(){return!1}drawPickTriangles(e,t){}pickTriangleSurface(e){}precisionRayPickSurface(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}canPickWorldPos(){return!0}drawPickDepths(e){this.model.drawPickDepths(e)}drawPickNormals(e){this.model.drawPickNormals(e)}delegatePickedEntity(){return this.parent}getEachVertex(e){this.layer.getEachVertex(this.portionId,e)}set aabb(e){this._aabbLocal=e}get aabb(){if(this._aabbWorldDirty){if(d.AABB3ToOBB3(this._aabbLocal,Ao),this.transform?(d.transformOBB3(this.transform.worldMatrix,Ao,ho),d.transformOBB3(this.model.worldMatrix,ho,co),d.OBB3ToAABB3(co,this._aabbWorld)):(d.transformOBB3(this.model.worldMatrix,Ao,ho),d.OBB3ToAABB3(ho,this._aabbWorld)),this.origin){const e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld}_destroy(){this.model.scene._renderer.putPickID(this.pickId)}}const po=new class{constructor(){this._uint8Arrays={},this._float32Arrays={}}_clear(){this._uint8Arrays={},this._float32Arrays={}}getUInt8Array(e){let t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}getFloat32Array(e){let t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}};let fo=0;const go={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},mo=new Float32Array([1,1,1,1]),_o=new Float32Array([0,0,0,1]),vo=d.vec4(),bo=d.vec3(),yo=d.vec3(),Bo=d.mat4();class wo{constructor(e,t=!1,{instancing:i=!1,edges:s=!1}={}){this._scene=e,this._withSAO=t,this._instancing=i,this._edges=s,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}_getHash(){return this._scene._sectionPlanesState.getHash()}_buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}_buildVertexShader(){return[""]}_buildFragmentShader(){return[""]}_addMatricesUniformBlockLines(e,t=!1){return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}_addRemapClipPosLines(e,t=1){return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(${t}));`),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}getValid(){return this._hash===this._getHash()}setSectionPlanesStateUniforms(e){const t=this._scene,{gl:i}=t.canvas,{model:s,layerIndex:r}=e,o=t._sectionPlanesState.getNumAllocatedSectionPlanes(),n=t._sectionPlanesState.sectionPlanes.length;if(o>0){const a=t._sectionPlanesState.sectionPlanes,l=r*n,A=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(let t=0;t0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(let t=0,i=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0&&p.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,p.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),p.lightMaps.length>0&&p.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,p.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++),this._withSAO){const t=n.sao;if(t.possible){const i=a.drawingBufferWidth,s=a.drawingBufferHeight;vo[0]=i,vo[1]=s,vo[2]=t.blendCutoff,vo[3]=t.blendFactor,a.uniform4fv(this._uSAOParams,vo),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%o,e.bindTexture++}}if(s){const e=this._edges?"edgeColor":"fillColor",t=this._edges?"edgeAlpha":"fillAlpha";if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_XRAYED"]){const i=n.xrayMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_HIGHLIGHTED"]){const i=n.highlightMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else if(i===go[(this._edges?"EDGES":"SILHOUETTE")+"_SELECTED"]){const i=n.selectedMaterial._state,s=i[e],r=i[t];a.uniform4f(this._uColor,s[0],s[1],s[2],r)}else a.uniform4fv(this._uColor,this._edges?_o:mo)}this._draw({state:l,frameCtx:e,incrementDrawState:r}),a.bindVertexArray(null)}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null,m.memory.programs--}}class xo extends wo{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!1,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{const e=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,e,i.indicesBuf.itemType,o),r&&s.drawElements++}}}class Po extends xo{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r;const o=[];o.push("#version 300 es"),o.push("// Triangles batching draw vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;")),o.push("out vec4 vColor;"),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Co extends xo{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,i=t.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching silhouette fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r){for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = newColor;"),o.push("}"),o}}class Fo extends xo{constructor(e){super(e,!1,{instancing:!1,edges:!0})}}class Eo extends Fo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Io extends Fo{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Do extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class So extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class To extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Ro extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class Lo extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}class Uo extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class ko extends xo{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}class Oo extends xo{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Triangles batching quality draw vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),o.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),o.push("vFragDepth = 1.0 + clipPos.w;")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Triangles batching quality draw fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),n.push("uniform sampler2D uAOMap;"),n.push("in vec4 vViewPosition;"),n.push("in vec3 vViewNormal;"),n.push("in vec4 vColor;"),n.push("in vec2 vUV;"),n.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Qo extends xo{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Triangles batching color texture fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),o.push("uniform float gammaFactor;"),o.push("vec4 linearToLinear( in vec4 value ) {"),o.push(" return value;"),o.push("}"),o.push("vec4 sRGBToLinear( in vec4 value ) {"),o.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),o.push("}"),o.push("vec4 gammaToLinear( in vec4 value) {"),o.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),o.push("}"),t&&(o.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),o.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),o.push("}")),r){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(let e=0,t=s.getNumAllocatedSectionPlanes();e sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(let e=0,t=i.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ko=d.vec3(),Xo=d.vec3(),Jo=d.vec3(),Yo=d.vec3(),Zo=d.mat4();class qo extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ko;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Xo;if(l){const e=Jo;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Zo),m=Yo,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElements(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class $o{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Mo(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Do(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new So(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Wo(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new qo(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Po(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Po(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Co(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Co(this._scene,!0)),this._flatColorRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Qo(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Qo(this._scene,!0)),this._colorTextureRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Oo(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Oo(this._scene,!0)),this._pbrRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Mo(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Lo(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Uo(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new Eo(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new Io(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Do(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new To(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new No(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new So(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Ro(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new ko(this._scene)),this._shadowRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new qo(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Wo(this._scene)),this._snapInitRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const en={};let tn=65536,sn=5e6;class rn{constructor(){}set doublePrecisionEnabled(e){d.setDoublePrecisionEnabled(e)}get doublePrecisionEnabled(){return d.getDoublePrecisionEnabled()}set maxDataTextureHeight(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),tn=e}get maxDataTextureHeight(){return tn}set maxGeometryBatchSize(e){e<1e5?e=1e5:e>5e6&&(e=5e6),sn=e}get maxGeometryBatchSize(){return sn}}const on=new rn;class nn{constructor(){this.maxVerts=on.maxGeometryBatchSize,this.maxIndices=3*on.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]}}const an=d.mat4(),ln=d.mat4();function An(e,t,i){const s=e.length,r=new Uint16Array(s),o=t[0],n=t[1],a=t[2],l=t[3]-o,A=t[4]-n,h=t[5]-a,c=65525,u=c/l,p=c/A,f=c/h,g=e=>e>=0?e:0;for(let t=0;t=0?1:-1),t=(1-Math.abs(s))*(r>=0?1:-1),s=e,r=t}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function un(e){let t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;const s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));const r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}const dn=d.mat4(),pn=d.mat4(),fn=d.vec4([0,0,0,1]),gn=d.vec3(),mn=d.vec3(),_n=d.vec3(),vn=d.vec3(),bn=d.vec3(),yn=d.vec3(),Bn=d.vec3();class wn{constructor(e){console.info("Creating VBOBatchingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesBatchingLayer"+(e.solid?"-solid":"-surface")+(e.autoNormals?"-autonormals":"-normals")+(e.textureSet&&e.textureSet.colorTexture?"-colorTexture":"")+(e.textureSet&&e.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=en[t];return i||(i=new $o(e),en[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete en[t],i._destroy()}))),i}(e.model.scene),this._buffer=new nn(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({origin:d.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:e.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=d.mat4(e.positionsDecodeMatrix)),e.uvDecodeMatrix?(this._state.uvDecodeMatrix=d.mat3(e.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,e.origin&&this._state.origin.set(e.origin),this.solid=!!e.solid}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)for(let e=0,t=o.length;e0){const e=dn;m?d.inverseMat4(d.transposeMat4(m,pn),e):d.identityMat4(e,e),function(e,t,i,s,r){function o(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}let n,a,l,A,h,c,u=new Float32Array([0,0,0,0]),p=new Float32Array([0,0,0,0]);for(c=0;ch&&(l=n,h=A),n=cn(p,"floor","ceil"),a=un(n),A=o(p,a),A>h&&(l=n,h=A),n=cn(p,"ceil","ceil"),a=un(n),A=o(p,a),A>h&&(l=n,h=A),s[r+c+0]=l[0],s[r+c+1]=l[1],s[r+c+2]=0}(e,r,r.length,b.normals,b.normals.length)}if(l)for(let e=0,t=l.length;e0)for(let e=0,t=n.length;e0)for(let e=0,t=a.length;e0){const s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):An(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=d.mat4());if(e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(let e=0,t=this._portions.length;e0){const s=new Int8Array(i.normals);let r=!0;e.normalsBuf=new He(t,t.ARRAY_BUFFER,s,i.normals.length,3,t.STATIC_DRAW,r)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.uv.length>0)if(e.uvDecodeMatrix){let s=!1;e.uvBuf=new He(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,s)}else{const s=Vt.getUVBounds(i.uv),r=Vt.compressUVs(i.uv,s.min,s.max),o=r.quantized;let n=!1;e.uvDecodeMatrix=d.mat3(r.decodeMatrix),e.uvBuf=new He(t,t.ARRAY_BUFFER,o,o.length,2,t.STATIC_DRAW,n)}if(i.metallicRoughness.length>0){const s=new Uint8Array(i.metallicRoughness);let r=!1;e.metallicRoughnessBuf=new He(t,t.ARRAY_BUFFER,s,i.metallicRoughness.length,2,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s),o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new He(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){const s=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}isEmpty(){return!this._state.indicesBuf}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=e,s=this._portions[i],r=4*s.vertsBaseIndex,o=4*s.numVerts,n=this._scratchMemory.getUInt8Array(o),a=t[0],l=t[1],A=t[2],h=t[3];for(let e=0;e_)&&(_=e,s.set(v),r&&d.triangleNormal(p,f,g,r),m=!0)}}return m&&r&&(d.transformVec3(this.model.worldNormalMatrix,r,r),d.normalizeVec3(r)),m}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}class xn extends wo{constructor(e,t,{edges:i=!1}={}){super(e,t,{instancing:!0,edges:i})}_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}class Pn extends xn{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0;let r,o,n;const a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),e.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),e.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),r=0,o=i.lights.length;r= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),s&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),r=0,o=i.lights.length;r0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}class Cn extends xn{_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState;let s,r;const o=t.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry flat-shading drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),o){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}for(n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),s=0,r=i.lights.length;s0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}class Fn extends xn{constructor(e,t){super(e,t,{instancing:!0,edges:!0})}}class En extends Fn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class In extends Fn{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!1})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Dn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class Sn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Tn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(` outNormal = ivec4(vWorldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Rn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}class Ln extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry depth drawing fragment shader"),o.push("precision highp float;"),o.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),o.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),o.push("}"),o}}class Un extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}class kn extends xn{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const On={3e3:"linearToLinear",3001:"sRGBToLinear"};class Nn extends xn{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,o=[];return o.push("#version 300 es"),o.push("// Instancing geometry quality drawing vertex shader"),o.push("uniform int renderPass;"),o.push("in vec3 position;"),o.push("in vec3 normal;"),o.push("in vec4 color;"),o.push("in vec2 uv;"),o.push("in vec2 metallicRoughness;"),o.push("in float flags;"),e.entityOffsetsEnabled&&o.push("in vec3 offset;"),o.push("in vec4 modelMatrixCol0;"),o.push("in vec4 modelMatrixCol1;"),o.push("in vec4 modelMatrixCol2;"),o.push("in vec4 modelNormalMatrixCol0;"),o.push("in vec4 modelNormalMatrixCol1;"),o.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(o,!0),o.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;")),o.push("vec3 octDecode(vec2 oct) {"),o.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),o.push(" if (v.z < 0.0) {"),o.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),o.push(" }"),o.push(" return normalize(v);"),o.push("}"),o.push("out vec4 vViewPosition;"),o.push("out vec3 vViewNormal;"),o.push("out vec4 vColor;"),o.push("out vec2 vUV;"),o.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&o.push("out vec3 vWorldNormal;"),s&&(o.push("out vec4 vWorldPosition;"),o.push("out float vFlags;"),r&&o.push("out vec4 vClipPosition;")),o.push("void main(void) {"),o.push("int colorFlag = int(flags) & 0xF;"),o.push("if (colorFlag != renderPass) {"),o.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),o.push("} else {"),o.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),o.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),o.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),o.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),o.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(o.push("vWorldPosition = worldPosition;"),o.push("vFlags = flags;"),r&&o.push("vClipPosition = clipPos;")),o.push("vViewPosition = viewPosition;"),o.push("vViewNormal = viewNormal;"),o.push("vColor = color;"),o.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),o.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&o.push("vWorldNormal = worldNormal.xyz;"),o.push("gl_Position = clipPos;"),o.push("}"),o.push("}"),o}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,o=i.clippingCaps,n=[];n.push("#version 300 es"),n.push("// Instancing geometry quality drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),n.push("uniform sampler2D uMetallicRoughMap;"),n.push("uniform sampler2D uEmissiveMap;"),n.push("uniform sampler2D uNormalMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),s.reflectionMaps.length>0&&n.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&n.push("uniform samplerCube lightMap;"),n.push("uniform vec4 lightAmbient;");for(let e=0,t=s.lights.length;e0&&n.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(n,!0),n.push("#define PI 3.14159265359"),n.push("#define RECIPROCAL_PI 0.31830988618"),n.push("#define RECIPROCAL_PI2 0.15915494"),n.push("#define EPSILON 1e-6"),n.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),n.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),n.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),n.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),n.push(" return normalize(surf_norm );"),n.push(" }"),n.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),n.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),n.push(" vec2 st0 = dFdx( uv.st );"),n.push(" vec2 st1 = dFdy( uv.st );"),n.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),n.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),n.push(" vec3 N = normalize( surf_norm );"),n.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),n.push(" mat3 tsn = mat3( S, T, N );"),n.push(" return normalize( tsn * mapN );"),n.push("}"),n.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),n.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),n.push("}"),n.push("struct IncidentLight {"),n.push(" vec3 color;"),n.push(" vec3 direction;"),n.push("};"),n.push("struct ReflectedLight {"),n.push(" vec3 diffuse;"),n.push(" vec3 specular;"),n.push("};"),n.push("struct Geometry {"),n.push(" vec3 position;"),n.push(" vec3 viewNormal;"),n.push(" vec3 worldNormal;"),n.push(" vec3 viewEyeDir;"),n.push("};"),n.push("struct Material {"),n.push(" vec3 diffuseColor;"),n.push(" float specularRoughness;"),n.push(" vec3 specularColor;"),n.push(" float shine;"),n.push("};"),n.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),n.push(" float r = ggxRoughness + 0.0001;"),n.push(" return (2.0 / (r * r) - 2.0);"),n.push("}"),n.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),n.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),n.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),n.push("}"),s.reflectionMaps.length>0&&(n.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),n.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),n.push(" vec3 envMapColor = "+On[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),n.push(" return envMapColor;"),n.push("}")),n.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),n.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),n.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),n.push("}"),n.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" return 1.0 / ( gl * gv );"),n.push("}"),n.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),n.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),n.push(" return 0.5 / max( gv + gl, EPSILON );"),n.push("}"),n.push("float D_GGX(const in float alpha, const in float dotNH) {"),n.push(" float a2 = ( alpha * alpha );"),n.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),n.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float alpha = ( roughness * roughness );"),n.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),n.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),n.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),n.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),n.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),n.push(" vec3 F = F_Schlick( specularColor, dotLH );"),n.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),n.push(" float D = D_GGX( alpha, dotNH );"),n.push(" return F * (G * D);"),n.push("}"),n.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),n.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),n.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),n.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),n.push(" vec4 r = roughness * c0 + c1;"),n.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),n.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),n.push(" return specularColor * AB.x + AB.y;"),n.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(n.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(n.push(" vec3 irradiance = "+On[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),n.push(" irradiance *= PI;"),n.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(n.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),n.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),n.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),n.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),n.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),n.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),n.push("}")),n.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),n.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),n.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),n.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),n.push("}"),n.push("out vec4 outColor;"),n.push("void main(void) {"),r){n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e (0.002 * vClipPosition.w)) {"),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push(" return;"),n.push("}")):(n.push(" if (dist > 0.0) { "),n.push(" discard;"),n.push(" }")),n.push("}")}n.push("IncidentLight light;"),n.push("Material material;"),n.push("Geometry geometry;"),n.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),n.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),n.push("float opacity = float(vColor.a) / 255.0;"),n.push("vec3 baseColor = rgb;"),n.push("float specularF0 = 1.0;"),n.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),n.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),n.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),n.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),n.push("baseColor *= colorTexel.rgb;"),n.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),n.push("metallic *= metalRoughTexel.b;"),n.push("roughness *= metalRoughTexel.g;"),n.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),n.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),n.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),n.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),n.push("geometry.position = vViewPosition.xyz;"),n.push("geometry.viewNormal = -normalize(viewNormal);"),n.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&n.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&n.push("computePBRLightMapping(geometry, material, reflectedLight);");for(let e=0,t=s.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(let e=0;e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),s.push("}"),s}}class Vn extends xn{_getHash(){const e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState;let r,o;const n=i.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),e.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),t&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),n){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(let e=0,t=i.getNumAllocatedSectionPlanes();e sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),r=0,o=s.lights.length;r0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Xn=d.vec3(),Jn=d.vec3(),Yn=d.vec3(),Zn=d.vec3(),qn=d.mat4();class $n extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Xn;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Jn;if(l){const e=d.transformPoint3(h,l,Yn);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,qn),m=Zn,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class ea{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new Mn(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Dn(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new Sn(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Kn(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new $n(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Pn(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new Pn(this._scene,!0)),this._colorRendererWithSAO}get flatColorRenderer(){return this._flatColorRenderer||(this._flatColorRenderer=new Cn(this._scene,!1)),this._flatColorRenderer}get flatColorRendererWithSAO(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new Cn(this._scene,!0)),this._flatColorRendererWithSAO}get pbrRenderer(){return this._pbrRenderer||(this._pbrRenderer=new Nn(this._scene,!1)),this._pbrRenderer}get pbrRendererWithSAO(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Nn(this._scene,!0)),this._pbrRendererWithSAO}get colorTextureRenderer(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Vn(this._scene,!1)),this._colorTextureRenderer}get colorTextureRendererWithSAO(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Vn(this._scene,!0)),this._colorTextureRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Mn(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Ln(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new Un(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new En(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new In(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Dn(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Tn(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Qn(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Sn(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Rn(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new kn(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Kn(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new $n(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const ta={};const ia=new Uint8Array(4),sa=new Float32Array(1),ra=d.vec4([0,0,0,1]),oa=new Float32Array(3),na=d.vec3(),aa=d.vec3(),la=d.vec3(),Aa=d.vec3(),ha=d.vec3(),ca=d.vec3(),ua=d.vec3(),da=new Float32Array(4);class pa{constructor(e){console.info("Creating VBOInstancingTrianglesLayer"),this.model=e.model,this.sortId="TrianglesInstancingLayer"+(e.solid?"-solid":"-surface")+(e.normals?"-normals":"-autoNormals"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=ta[t];return i||(i=new ea(e),ta[t]=i,i._compile(),i.eagerCreateRenders(),e.on("compile",(()=>{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete ta[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({numInstances:0,obb:d.OBB3(),origin:d.vec3(),geometry:e.geometry,textureSet:e.textureSet,pbrSupported:!1,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,e.origin&&this._state.origin.set(e.origin),this._finalized=!1,this.solid=!!e.solid,this.numIndices=e.geometry.numIndices}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;e.colorsBuf=new He(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,t),this._colors=[]}if(this._metallicRoughness.length>0){const t=new Uint8Array(this._metallicRoughness);let i=!1;e.metallicRoughnessBuf=new He(s,s.ARRAY_BUFFER,t,this._metallicRoughness.length,2,s.STATIC_DRAW,i)}if(o>0){let t=!1;e.flagsBuf=new He(s,s.ARRAY_BUFFER,new Float32Array(o),o,1,s.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;e.offsetsBuf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,t),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){const i=!1;e.positionsBuf=new He(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,i),e.positionsDecodeMatrix=d.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){const i=new Uint8Array(t.colorsCompressed),r=!1;e.colorsBuf=new He(s,s.ARRAY_BUFFER,i,i.length,4,s.STATIC_DRAW,r)}if(t.uvCompressed&&t.uvCompressed.length>0){const i=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new He(s,s.ARRAY_BUFFER,i,i.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new He(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){const t=!1;e.modelMatrixCol0Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelMatrixCol1Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelMatrixCol2Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol1Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,t),e.modelNormalMatrixCol2Buf=new He(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,t),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){const t=!1;e.pickColorsBuf=new He(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,t),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";ia[0]=t[0],ia[1]=t[1],ia[2]=t[2],ia[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(ia,4*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?1:0)<<16,sa[0]=d,this._state.flagsBuf&&this._state.flagsBuf.setData(sa,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(oa[0]=t[0],oa[1]=t[1],oa[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(oa,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}getEachVertex(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;const i=this._state,s=i.geometry,r=this._portions[e];if(!r)return void this.model.error("portion not found: "+e);const o=s.quantizedPositions,n=i.origin,a=r.offset,l=n[0]+a[0],A=n[1]+a[1],h=n[2]+a[2],c=ra,u=r.matrix,p=this.model.sceneModelMatrix,f=i.positionsDecodeMatrix;for(let e=0,i=o.length;ev)&&(v=e,s.set(b),r&&d.triangleNormal(f,g,m,r),_=!0)}}return _&&r&&(d.transformVec3(a.normalMatrix,r,r),d.transformVec3(this.model.worldNormalMatrix,r,r),d.normalizeVec3(r)),_}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}class fa extends wo{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}class ga extends fa{drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class ma extends fa{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const _a=d.vec3(),va=d.vec3(),ba=d.vec3(),ya=d.vec3(),Ba=d.mat4();class wa extends wo{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=_a;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=va;if(l){const e=ba;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Ba),m=ya,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const xa=d.vec3(),Pa=d.vec3(),Ca=d.vec3(),Ma=d.vec3(),Fa=d.mat4();class Ea extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=xa;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Pa;if(l){const e=Ca;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Fa),m=Ma,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElements(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ia{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new ga(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ma(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new wa(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Ea(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Da={};class Sa{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]}}class Ta{constructor(e){console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Da[t];return i||(i=new Ia(e),Da[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Da[t],i._destroy()}))),i}(e.model.scene),this.model=e.model,this._buffer=new Sa(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:d.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=d.vec3(e.origin))}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=An(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.DYNAMIC_DRAW,r)}if(i.colors.length>0){const s=i.colors.length/4,r=new Float32Array(s);let o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){const s=new Uint32Array(i.indices);e.indicesBuf=new He(t,t.ELEMENT_ARRAY_BUFFER,s,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}flushInitFlags(){this._setDeferredFlags()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2],A=t[3];for(let e=0;e0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Lines instancing color fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return this._withSAO?(o.push(" float viewportWidth = uSAOParams[0];"),o.push(" float viewportHeight = uSAOParams[1];"),o.push(" float blendCutoff = uSAOParams[2];"),o.push(" float blendFactor = uSAOParams[3];"),o.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),o.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),o.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):o.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class Ua extends Ra{drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}const ka=d.vec3(),Oa=d.vec3(),Na=d.vec3();d.vec3();const Qa=d.mat4();class Va extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ka;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Oa;if(l){const e=d.transformPoint3(h,l,Na);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Qa),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ha=d.vec3(),ja=d.vec3(),Ga=d.vec3();d.vec3();const za=d.mat4();class Wa extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ha;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=ja;if(l){const e=d.transformPoint3(h,l,Ga);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,za),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ka{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}eagerCreateRenders(){this._snapInitRenderer||(this._snapInitRenderer=new Va(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new Wa(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new La(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Ua(this._scene)),this._silhouetteRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Va(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Wa(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Xa={};const Ja=new Uint8Array(4),Ya=new Float32Array(1),Za=new Float32Array(3),qa=new Float32Array(4);class $a{constructor(e){console.info("VBOInstancingLinesLayer"),this.model=e.model,this.material=e.material,this.sortId="LinesInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Xa[t];return i||(i=new Ka(e),Xa[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Xa[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({obb:d.OBB3(),numInstances:0,origin:null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,e.origin&&(this._state.origin=d.vec3(e.origin)),this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let t=!1;this._state.colorsBuf=new He(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,t),this._colors=[]}if(r>0){let t=!1;this._state.flagsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,t)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;this._state.offsetsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){const s=new Uint8Array(i.colorsCompressed),r=!1;t.colorsBuf=new He(e,e.ARRAY_BUFFER,s,s.length,4,e.STATIC_DRAW,r)}if(i.positionsCompressed&&i.positionsCompressed.length>0){const s=!1;t.positionsBuf=new He(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,s),t.positionsDecodeMatrix=d.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new He(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){const t=!1;this._state.modelMatrixCol0Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol1Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),this._state.modelMatrixCol2Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Ja[0]=t[0],Ja[1]=t[1],Ja[2]=t[2],Ja[3]=t[3],this._state.colorsBuf.setData(Ja,4*e,4)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?255:0)<<16,Ya[0]=d,this._state.flagsBuf.setData(Ya,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Za[0]=t[0],Za[1]=t[1],Za[2]=t[2],this._state.offsetsBuf.setData(Za,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;qa[0]=t[0],qa[1]=t[4],qa[2]=t[8],qa[3]=t[12],this._state.modelMatrixCol0Buf.setData(qa,i),qa[0]=t[1],qa[1]=t[5],qa[2]=t[9],qa[3]=t[13],this._state.modelMatrixCol1Buf.setData(qa,i),qa[0]=t[2],qa[1]=t[6],qa[2]=t[10],qa[3]=t[14],this._state.modelMatrixCol2Buf.setData(qa,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesXRayed(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK)}drawOcclusion(e,t){}drawShadow(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawPickNormals(e,t){}destroy(){const e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}class el extends wo{_draw(e){const{gl:t}=this._scene.canvas,{state:i,frameCtx:s,incrementDrawState:r}=e;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}class tl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{incrementDrawState:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class il extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points batching silhouette vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("outColor = color;"),o.push("}"),o}}class sl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}class rl extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class ol extends el{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}const nl=d.vec3(),al=d.vec3(),ll=d.vec3(),Al=d.vec3(),hl=d.mat4();class cl extends wo{drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=nl;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=al;if(l){const e=ll;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,hl),m=Al,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ul=d.vec3(),dl=d.vec3(),pl=d.vec3(),fl=d.vec3(),gl=d.mat4();class ml extends wo{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=ul;let g,m;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=dl;if(l){const e=pl;d.transformPoint3(h,l,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,gl),m=fl,m[0]=o.eye[0]-t[0],m[1]=o.eye[1]-t[1],m[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,m=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,m),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,_+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),n.drawArrays(n.POINTS,0,a.positionsBuf.numItems)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;const i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class _l{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new tl(this._scene)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new il(this._scene)),this._silhouetteRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new sl(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new rl(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new ol(this._scene)),this._occlusionRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new cl(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new ml(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const vl={};class bl{constructor(e=5e6){e>5e6&&(e=5e6),this.maxVerts=e,this.maxIndices=3*e,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]}}class yl{constructor(e){console.info("Creating VBOBatchingPointsLayer"),this.model=e.model,this.sortId="PointsBatchingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=vl[t];return i||(i=new _l(e),vl[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete vl[t],i._destroy()}))),i}(e.model.scene),this._buffer=new bl(e.maxGeometryBatchSize),this._scratchMemory=e.scratchMemory,this._state=new lt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:d.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=d.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,e.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(e.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,e.origin&&(this._state.origin=d.vec3(e.origin))}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){const s=new Uint16Array(i.positions);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{const s=An(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new He(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){const s=new Uint8Array(i.colors);let r=!1;e.colorsBuf=new He(t,t.ARRAY_BUFFER,s,i.colors.length,4,t.STATIC_DRAW,r)}if(i.positions.length>0){const s=i.positions.length/3,r=new Float32Array(s);let o=!1;e.flagsBuf=new He(t,t.ARRAY_BUFFER,r,r.length,1,t.DYNAMIC_DRAW,o)}if(i.pickColors.length>0){const s=new Uint8Array(i.pickColors);let r=!1;e.pickColorsBuf=new He(t,t.ARRAY_BUFFER,s,i.pickColors.length,4,t.STATIC_DRAW,r)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){const s=new Float32Array(i.offsets);e.offsetsBuf=new He(t,t.ARRAY_BUFFER,s,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized"}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";const i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],o=this._scratchMemory.getUInt8Array(r),n=t[0],a=t[1],l=t[2];for(let e=0;e0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class xl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}drawLayer(e,t,i){super.drawLayer(e,t,i,{colorUniform:!0})}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}class Pl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}class Cl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}class Ml extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0;e 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0;e 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}class Fl extends Bl{_getHash(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState;let i,s;const r=t.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Points instancing depth vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),r)for(o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;"),i=0,s=t.getNumAllocatedSectionPlanes();i 1.0) {"),o.push(" discard;"),o.push(" }")),r){for(o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;"),i=0,s=t.getNumAllocatedSectionPlanes();i 0.0) { discard; }"),o.push("}")}return o.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),e.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push("}"),o}}class El extends Bl{_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}const Il=d.vec3(),Dl=d.vec3(),Sl=d.vec3();d.vec3();const Tl=d.mat4();class Rl extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.canvas.gl,n=r.camera,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Il;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Dl;if(l){const e=d.transformPoint3(h,l,Sl);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Tl),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1)),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const Ll=d.vec3(),Ul=d.vec3(),kl=d.vec3();d.vec3();const Ol=d.mat4();class Nl extends wo{constructor(e){super(e,!1,{instancing:!0})}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=t.aabb,p=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));const f=Ll;let g;if(f[0]=d.safeInv(u[3]-u[0])*d.MAX_INT,f[1]=d.safeInv(u[4]-u[1])*d.MAX_INT,f[2]=d.safeInv(u[5]-u[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(f[0]),e.snapPickCoordinateScale[1]=d.safeInv(f[1]),e.snapPickCoordinateScale[2]=d.safeInv(f[2]),l||0!==A[0]||0!==A[1]||0!==A[2]){const t=Ul;if(l){const e=d.transformPoint3(h,l,kl);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=A[0],t[1]+=A[1],t[2]+=A[2],g=K(p,t,Ol),e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else g=p,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);let m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(g,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}_allocate(){super._allocate();const e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}_bindProgram(){this._program.bind()}_buildVertexShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(let t=0;t> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Ql{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new wl(this._scene,!1)),this._colorRenderer}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new xl(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new Fl(this._scene)),this._depthRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Pl(this._scene)),this._pickMeshRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Cl(this._scene)),this._pickDepthRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new Ml(this._scene)),this._occlusionRenderer}get shadowRenderer(){return this._shadowRenderer||(this._shadowRenderer=new El(this._scene)),this._shadowRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new Rl(this._scene,!1)),this._snapInitRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new Nl(this._scene)),this._snapRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}const Vl={};const Hl=new Uint8Array(4),jl=new Float32Array(1),Gl=new Float32Array(3),zl=new Float32Array(4);class Wl{constructor(e){console.info("VBOInstancingPointsLayer"),this.model=e.model,this.material=e.material,this.sortId="PointsInstancingLayer",this.layerIndex=e.layerIndex,this._renderers=function(e){const t=e.id;let i=Vl[t];return i||(i=new Ql(e),Vl[t]=i,i._compile(),e.on("compile",(()=>{i._compile()})),e.on("destroyed",(()=>{delete Vl[t],i._destroy()}))),i}(e.model.scene),this._aabb=d.collapseAABB3(),this._state=new lt({obb:d.OBB3(),numInstances:0,origin:e.origin?d.vec3(e.origin):null,geometry:e.geometry,positionsDecodeMatrix:e.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=e.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e0){let s=!1;i.flagsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,s)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){const t=!1;i.offsetsBuf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,t),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){const t=!1;i.positionsBuf=new He(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,t),i.positionsDecodeMatrix=d.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){const t=new Uint8Array(s.colorsCompressed),r=!1;i.colorsBuf=new He(e,e.ARRAY_BUFFER,t,t.length,4,e.STATIC_DRAW,r)}if(this._modelMatrixCol0.length>0){const t=!1;i.modelMatrixCol0Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,t),i.modelMatrixCol1Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,t),i.modelMatrixCol2Buf=new He(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,t),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){const t=!1;i.pickColorsBuf=new He(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,t),this._pickColors=[]}i.geometry=null,this._finalized=!0}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){if(!this._finalized)throw"Not finalized";Hl[0]=t[0],Hl[1]=t[1],Hl[2]=t[2],this._state.colorsBuf.setData(Hl,3*e)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i){if(!this._finalized)throw"Not finalized";const s=!!(t&q),r=!!(t&se),o=!!(t&re),n=!!(t&oe),a=!!(t&ne),l=!!(t&ee),A=!!(t&$);let h,c;h=!s||A||r||o&&!this.model.scene.highlightMaterial.glowThrough||n&&!this.model.scene.selectedMaterial.glowThrough?go.NOT_RENDERED:i?go.COLOR_TRANSPARENT:go.COLOR_OPAQUE,c=!s||A?go.NOT_RENDERED:n?go.SILHOUETTE_SELECTED:o?go.SILHOUETTE_HIGHLIGHTED:r?go.SILHOUETTE_XRAYED:go.NOT_RENDERED;let u=0;u=!s||A?go.NOT_RENDERED:n?go.EDGES_SELECTED:o?go.EDGES_HIGHLIGHTED:r?go.EDGES_XRAYED:a?i?go.EDGES_COLOR_TRANSPARENT:go.EDGES_COLOR_OPAQUE:go.NOT_RENDERED;let d=0;d|=h,d|=c<<4,d|=u<<8,d|=(s&&!A&&l?go.PICK:go.NOT_RENDERED)<<12,d|=(t&te?255:0)<<16,jl[0]=d,this._state.flagsBuf.setData(jl,e)}setOffset(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Gl[0]=t[0],Gl[1]=t[1],Gl[2]=t[2],this._state.offsetsBuf.setData(Gl,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}setMatrix(e,t){if(!this._finalized)throw"Not finalized";const i=4*e;zl[0]=t[0],zl[1]=t[4],zl[2]=t[8],zl[3]=t[12],this._state.modelMatrixCol0Buf.setData(zl,i),zl[0]=t[1],zl[1]=t[5],zl[2]=t[9],zl[3]=t[13],this._state.modelMatrixCol1Buf.setData(zl,i),zl[0]=t[2],zl[1]=t[6],zl[2]=t[10],zl[3]=t[14],this._state.modelMatrixCol2Buf.setData(zl,i)}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED)}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED)}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED)}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawShadow(e,t){}drawPickMesh(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,go.PICK)}drawPickDepths(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,go.PICK)}drawPickNormals(e,t){}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK)}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK)}destroy(){const e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}const Kl=d.vec3(),Xl=d.vec3(),Jl=d.mat4();class Yl{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=Kl;if(g){const t=d.transformPoint3(c,A,Xl);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,Jl)}else f=p;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),n.drawArrays(n.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),n.drawArrays(n.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),n.drawArrays(n.LINES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class Zl{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}eagerCreateRenders(){}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new Yl(this._scene,!1)),this._colorRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy()}}const ql={};class $l{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]}}class eA{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindLineIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}class tA{constructor(e,t,i,s,r=null){this._gl=e,this._texture=t,this._textureWidth=i,this._textureHeight=s,this._textureData=r}bindTexture(e,t,i){return e.bindTexture(t,this,i)}bind(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}unbind(e){}}const iA={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(iA,null,4));let e=0;Object.keys(iA).forEach((t=>{t.startsWith("size")&&(e+=iA[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/iA.totalLines).toFixed(2)}`);let t={};Object.keys(iA).forEach((i=>{i.startsWith("size")&&(t[i]=`${(iA[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class sA{disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}generateTextureForColorsAndFlags(e,t,i,s,r){const o=t.length;this.numPortions=o;const n=4096,a=Math.ceil(o/512);if(0===a)throw"texture height===0";const l=new Uint8Array(16384*a);iA.sizeDataColorsAndFlags+=l.byteLength,iA.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),l.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20);const A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,n,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,A,n,a,l)}generateTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);iA.sizeDataTextureOffsets+=r.byteLength,iA.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,o,i,s,r)}generateTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);iA.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete ql[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new $l,this._dataTextureState=new eA,this._dataTextureGenerator=new sA,this._state=new lt({origin:d.vec3(t.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&iA.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/2})),(this._state.numVertices+s>4096*oA||t+r>4096*oA)&&iA.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*oA&&t+r<=4096*oA}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/2/8)*2;iA.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}const i=t.positionsCompressed,s=t.indices,r=this._buffer;r.positionsCompressed.push(i);const o=r.lenPositionsCompressed/3,n=i.length/3;let a;r.lenPositionsCompressed+=i.length;let l=0;if(s){let e;l=s.length/2,n<=256?(e=r.indices8Bits,a=r.lenIndices8Bits/2,r.lenIndices8Bits+=s.length):n<=65536?(e=r.indices16Bits,a=r.lenIndices16Bits/2,r.lenIndices16Bits+=s.length):(e=r.indices32Bits,a=r.lenIndices32Bits/2,r.lenIndices32Bits+=s.length),e.push(s)}this._state.numVertices+=n,iA.numberOfGeometries++;return{vertexBase:o,numVertices:n,numLines:l,indicesBase:a}}_createSubPortion(e,t){const i=e.color,s=e.colors,r=e.opacity,o=e.meshMatrix,n=e.pickColor,a=this._buffer,l=this._state;a.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),a.perObjectInstancePositioningMatrices.push(o||hA),a.perObjectSolid.push(!!e.solid),s?a.perObjectColors.push([255*s[0],255*s[1],255*s[2],255]):i&&a.perObjectColors.push([i[0],i[1],i[2],r]),a.perObjectPickColors.push(n),a.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?l.numIndices8Bits:t.numVertices<=65536?l.numIndices16Bits:l.numIndices32Bits,a.perObjectIndexBaseOffsets.push(e/2-t.indicesBase)}const A=this._subPortions.length;if(t.numLines>0){let e,i=2*t.numLines;t.numVertices<=256?(e=a.perLineNumberPortionId8Bits,l.numIndices8Bits+=i,iA.totalLines8Bits+=t.numLines):t.numVertices<=65536?(e=a.perLineNumberPortionId16Bits,l.numIndices16Bits+=i,iA.totalLines16Bits+=t.numLines):(e=a.perLineNumberPortionId32Bits,l.numIndices32Bits+=i,iA.totalLines32Bits+=t.numLines),iA.totalLines+=t.numLines;for(let i=0;i0&&(t.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,aA))}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),c.bindTexture(c.TEXTURE_2D,h.texturePerObjectColorsAndFlags._texture),c.texSubImage2D(c.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,c.RGBA_INTEGER,c.UNSIGNED_BYTE,aA))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,aA))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,lA))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,nA))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE)}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT)}drawDepth(e,t){}drawNormals(e,t){}drawSilhouetteXRayed(e,t){}drawSilhouetteHighlighted(e,t){}drawSilhouetteSelected(e,t){}drawEdgesColorOpaque(e,t){}drawEdgesColorTransparent(e,t){}drawEdgesHighlighted(e,t){}drawEdgesSelected(e,t){}drawEdgesXRayed(e,t){}drawOcclusion(e,t){}drawShadow(e,t){}setPickMatrices(e,t){}drawPickMesh(e,t){}drawPickDepths(e,t){}drawSnapInit(e,t){}drawSnap(e,t){}drawPickNormals(e,t){}destroy(){if(this._destroyed)return;const e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}const uA=d.vec3(),dA=d.vec3(),pA=d.vec3();d.vec3();const fA=d.vec4(),gA=d.mat4();class mA{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=uA;if(g){const t=d.transformPoint3(c,A,dA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,gA),f=pA,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);const s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];const r=i.lights;let o;for(let e=0,t=r.length;e0;let r;const o=[];o.push("#version 300 es"),o.push("// TrianglesDataTextureColorRenderer vertex shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("precision highp usampler2D;"),o.push("precision highp isampler2D;"),o.push("precision highp sampler2D;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("precision mediump usampler2D;"),o.push("precision mediump isampler2D;"),o.push("precision mediump sampler2D;"),o.push("#endif"),o.push("uniform int renderPass;"),o.push("uniform mat4 sceneModelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),o.push("uniform highp sampler2D uTexturePerObjectMatrix;"),o.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),o.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),o.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),o.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),o.push("uniform vec3 uCameraEyeRtc;"),o.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("out float isPerspective;")),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("uniform vec4 lightAmbient;");for(let e=0,t=i.lights.length;e> 3) & 4095;"),o.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),o.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),o.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),o.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),o.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),o.push("if (int(flags.x) != renderPass) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("} else {"),o.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),o.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),o.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),o.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),o.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),o.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),o.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),o.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),o.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),o.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),o.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),o.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),o.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),o.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),o.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),o.push("if (color.a == 0u) {"),o.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),o.push(" return;"),o.push("};"),o.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),o.push("vec3 position;"),o.push("position = positions[gl_VertexID % 3];"),o.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),o.push("if (solid != 1u) {"),o.push("if (isPerspectiveMatrix(projMatrix)) {"),o.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),o.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("} else {"),o.push("if (viewNormal.z < 0.0) {"),o.push("position = positions[2 - (gl_VertexID % 3)];"),o.push("viewNormal = -viewNormal;"),o.push("}"),o.push("}"),o.push("}"),o.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),o.push("vec4 viewPosition = viewMatrix * worldPosition; "),o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;");for(let e=0,t=i.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(let e=0,i=t.getNumAllocatedSectionPlanes();e 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const _A=new Float32Array([1,1,1]),vA=d.vec3(),bA=d.vec3(),yA=d.vec3();d.vec3();const BA=d.mat4();class wA{constructor(e,t){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o,p=r.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=vA;if(A){const t=bA;d.transformPoint3(c,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,BA),g=yA,g[0]=r.eye[0]-e[0],g[1]=r.eye[1]-e[1],g[2]=r.eye[2]-e[2]}else f=p,g=r.eye;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===go.SILHOUETTE_XRAYED){const e=s.xrayMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.SILHOUETTE_HIGHLIGHTED){const e=s.highlightMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.SILHOUETTE_SELECTED){const e=s.selectedMaterial._state,t=e.fillColor,i=e.fillAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,_A);if(s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=s._sectionPlanesState.getNumAllocatedSectionPlanes(),_=s._sectionPlanesState.sectionPlanes.length;if(m>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,r=o.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const xA=new Float32Array([0,0,0,1]),PA=d.vec3(),CA=d.vec3();d.vec3();const MA=d.mat4();class FA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=PA;if(g){const t=d.transformPoint3(c,A,CA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,MA)}else f=p;if(n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),i===go.EDGES_XRAYED){const e=r.xrayMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.EDGES_HIGHLIGHTED){const e=r.highlightMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else if(i===go.EDGES_SELECTED){const e=r.selectedMaterial._state,t=e.edgeColor,i=e.edgeAlpha;n.uniform4f(this._uColor,t[0],t[1],t[2],i)}else n.uniform4fv(this._uColor,xA);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const EA=d.vec3(),IA=d.vec3(),DA=d.mat4();class SA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=o.viewMatrix;if(!this._program&&(this._allocate(),this.errors))return;let f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=EA;if(g){const t=d.transformPoint3(c,A,IA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,DA)}else f=p;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(n.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(n.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(n.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const TA=d.vec3(),RA=d.vec3(),LA=d.vec3(),UA=d.mat4();class kA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(t),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s;let p,f;l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=TA;if(g){const t=d.transformPoint3(c,A,RA);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(o.viewMatrix,e,UA),f=LA,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=o.viewMatrix,f=o.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),r.logarithmicDepthBufferEnabled){const e=2/(Math.log(o.project.far+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,e)}const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const OA=d.vec3(),NA=d.vec3(),QA=d.vec3();d.vec3();const VA=d.mat4();class HA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=e.pickViewMatrix||o.viewMatrix;let f,g;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const t=OA;if(A){const e=NA;d.transformPoint3(c,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],f=K(p,t,VA),g=QA,g[0]=o.eye[0]-t[0],g[1]=o.eye[1]-t[1],g[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else f=p,g=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniform1f(this._uPickZNear,e.pickZNear),n.uniform1f(this._uPickZFar,e.pickZFar),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),r.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const jA=d.vec3(),GA=d.vec3(),zA=d.vec3(),WA=d.vec3();d.vec3();const KA=d.mat4();class XA{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){if(!this._program&&(this._allocate(),this.errors))return;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=jA;let m,_;g[0]=d.safeInv(p[3]-p[0])*d.MAX_INT,g[1]=d.safeInv(p[4]-p[1])*d.MAX_INT,g[2]=d.safeInv(p[5]-p[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(g[0]),e.snapPickCoordinateScale[1]=d.safeInv(g[1]),e.snapPickCoordinateScale[2]=d.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=GA;if(v){const e=d.transformPoint3(c,A,zA);t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=K(f,t,KA),_=WA,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),n.drawArrays(w,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),n.drawArrays(w,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),n.drawArrays(w,0,a.numEdgeIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const JA=d.vec3(),YA=d.vec3(),ZA=d.vec3(),qA=d.vec3();d.vec3();const $A=d.mat4();class eh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=t.aabb,f=e.pickViewMatrix||o.viewMatrix,g=JA;let m,_;g[0]=d.safeInv(p[3]-p[0])*d.MAX_INT,g[1]=d.safeInv(p[4]-p[1])*d.MAX_INT,g[2]=d.safeInv(p[5]-p[2])*d.MAX_INT,e.snapPickCoordinateScale[0]=d.safeInv(g[0]),e.snapPickCoordinateScale[1]=d.safeInv(g[1]),e.snapPickCoordinateScale[2]=d.safeInv(g[2]),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const v=0!==A[0]||0!==A[1]||0!==A[2],b=0!==h[0]||0!==h[1]||0!==h[2];if(v||b){const t=YA;if(v){const e=ZA;d.transformPoint3(c,A,e),t[0]=e[0],t[1]=e[1],t[2]=e[2]}else t[0]=0,t[1]=0,t[2]=0;t[0]+=h[0],t[1]+=h[1],t[2]+=h[2],m=K(f,t,$A),_=qA,_[0]=o.eye[0]-t[0],_[1]=o.eye[1]-t[1],_[2]=o.eye[2]-t[2],e.snapPickOrigin[0]=t[0],e.snapPickOrigin[1]=t[1],e.snapPickOrigin[2]=t[2]}else m=f,_=o.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform3fv(this._uCameraEyeRtc,_),n.uniform2fv(this._uVectorA,e.snapVectorA),n.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,g),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible),n.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,m),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);{const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const y=r._sectionPlanesState.getNumAllocatedSectionPlanes(),B=r._sectionPlanesState.sectionPlanes.length;if(y>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*B,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(`outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const th=d.vec3(),ih=d.vec3(),sh=d.vec3();d.vec3();const rh=d.mat4();class oh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=s,p=e.pickViewMatrix||o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let f,g;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),A||0!==h[0]||0!==h[1]||0!==h[2]){const e=th;if(A){const t=ih;d.transformPoint3(c,A,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],f=K(p,e,rh),g=sh,g[0]=o.eye[0]-e[0],g[1]=o.eye[1]-e[1],g[2]=o.eye[2]-e[2]}else f=p,g=o.eye;n.uniform3fv(this._uCameraEyeRtc,g),n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,f),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix);const m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*_,o=s.renderFlags;for(let t=0;t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0;t 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const nh=d.vec3(),ah=d.vec3(),lh=d.vec3();d.vec3();const Ah=d.mat4();class hh{constructor(e){this._scene=e,this._allocate(),this._hash=this._getHash()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=nh;if(g){const t=d.transformPoint3(c,A,ah);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,Ah),f=lh,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const ch=d.vec3(),uh=d.vec3(),dh=d.vec3();d.vec3();const ph=d.mat4();class fh{constructor(e){this._scene=e,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){return this._scene._sectionPlanesState.getHash()}drawLayer(e,t,i){const s=t.model,r=s.scene,o=r.camera,n=r.canvas.gl,a=t._state,l=t._state.origin,{position:A,rotationMatrix:h,rotationMatrixConjugate:c}=s,u=o.viewMatrix;if(!this._program&&(this._allocate(t),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));const g=0!==l[0]||0!==l[1]||0!==l[2],m=0!==A[0]||0!==A[1]||0!==A[2];if(g||m){const e=ch;if(g){const t=uh;d.transformPoint3(h,l,t),e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=A[0],e[1]+=A[1],e[2]+=A[2],p=K(u,e,ph),f=dh,f[0]=o.eye[0]-e[0],f[1]=o.eye[1]-e[1],f[2]=o.eye[2]-e[2]}else p=u,f=o.eye;n.uniform1i(this._uRenderPass,i),n.uniformMatrix4fv(this._uWorldMatrix,!1,c),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,o.projMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,o.viewNormalMatrix),n.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);const _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),v=r._sectionPlanesState.sectionPlanes.length;if(_>0){const e=r._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,o=s.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(Se.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(let t=0;t 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&Se.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}const gh=d.vec3(),mh=d.vec3(),_h=d.vec3();d.vec3(),d.vec4();const vh=d.mat4();class bh{constructor(e,t){this._scene=e,this._withSAO=t,this._hash=this._getHash(),this._allocate()}getValid(){return this._hash===this._getHash()}_getHash(){const e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}drawLayer(e,t,i){const s=this._scene,r=s.camera,o=t.model,n=s.canvas.gl,a=t._state,l=a.textureState,A=t._state.origin,{position:h,rotationMatrix:c,rotationMatrixConjugate:u}=o;if(!this._program&&(this._allocate(),this.errors))return;let p,f;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);const g=0!==A[0]||0!==A[1]||0!==A[2],m=0!==h[0]||0!==h[1]||0!==h[2];if(g||m){const e=gh;if(g){const t=d.transformPoint3(c,A,mh);e[0]=t[0],e[1]=t[1],e[2]=t[2]}else e[0]=0,e[1]=0,e[2]=0;e[0]+=h[0],e[1]+=h[1],e[2]+=h[2],p=K(r.viewMatrix,e,vh),f=_h,f[0]=r.eye[0]-e[0],f[1]=r.eye[1]-e[1],f[2]=r.eye[2]-e[2]}else p=r.viewMatrix,f=r.eye;if(n.uniform2fv(this._uPickClipPos,e.pickClipPos),n.uniform2f(this._uDrawingBufferSize,n.drawingBufferWidth,n.drawingBufferHeight),n.uniformMatrix4fv(this._uSceneModelMatrix,!1,u),n.uniformMatrix4fv(this._uViewMatrix,!1,p),n.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),n.uniform3fv(this._uCameraEyeRtc,f),n.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){const t=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,t)}const _=s._sectionPlanesState.getNumAllocatedSectionPlanes(),v=s._sectionPlanesState.sectionPlanes.length;if(_>0){const e=s._sectionPlanesState.sectionPlanes,i=t.layerIndex*v,r=o.renderFlags;for(let t=0;t<_;t++){const s=this._uSectionPlanes[t];if(s)if(t0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),n.drawArrays(n.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),n.drawArrays(n.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),n.drawArrays(n.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}_allocate(){const e=this._scene,t=e.canvas.gl;if(this._program=new Ve(t,this._buildShader()),this._program.errors)return void(this.errors=this._program.errors);const i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}_buildFragmentShader(){const e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(let t=0,s=e._sectionPlanesState.getNumAllocatedSectionPlanes();t 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(` outNormal = ivec4(worldNormal * float(${d.MAX_INT}), 1.0);`),i.push("}"),i}webglContextRestored(){this._program=null}destroy(){this._program&&this._program.destroy(),this._program=null}}class yh{constructor(e){this._scene=e}_compile(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}eagerCreateRenders(){this._silhouetteRenderer||(this._silhouetteRenderer=new wA(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new kA(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new HA(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new bh(this._scene)),this._snapRenderer||(this._snapRenderer=new XA(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new eh(this._scene)),this._snapRenderer||(this._snapRenderer=new XA(this._scene))}get colorRenderer(){return this._colorRenderer||(this._colorRenderer=new mA(this._scene,!1)),this._colorRenderer}get colorRendererWithSAO(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new mA(this._scene,!0)),this._colorRendererWithSAO}get colorQualityRendererWithSAO(){return this._colorQualityRendererWithSAO}get silhouetteRenderer(){return this._silhouetteRenderer||(this._silhouetteRenderer=new wA(this._scene)),this._silhouetteRenderer}get depthRenderer(){return this._depthRenderer||(this._depthRenderer=new hh(this._scene)),this._depthRenderer}get normalsRenderer(){return this._normalsRenderer||(this._normalsRenderer=new fh(this._scene)),this._normalsRenderer}get edgesRenderer(){return this._edgesRenderer||(this._edgesRenderer=new FA(this._scene)),this._edgesRenderer}get edgesColorRenderer(){return this._edgesColorRenderer||(this._edgesColorRenderer=new SA(this._scene)),this._edgesColorRenderer}get pickMeshRenderer(){return this._pickMeshRenderer||(this._pickMeshRenderer=new kA(this._scene)),this._pickMeshRenderer}get pickNormalsRenderer(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new bh(this._scene)),this._pickNormalsRenderer}get pickNormalsFlatRenderer(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new bh(this._scene)),this._pickNormalsFlatRenderer}get pickDepthRenderer(){return this._pickDepthRenderer||(this._pickDepthRenderer=new HA(this._scene)),this._pickDepthRenderer}get snapRenderer(){return this._snapRenderer||(this._snapRenderer=new XA(this._scene)),this._snapRenderer}get snapInitRenderer(){return this._snapInitRenderer||(this._snapInitRenderer=new eh(this._scene)),this._snapInitRenderer}get occlusionRenderer(){return this._occlusionRenderer||(this._occlusionRenderer=new oh(this._scene)),this._occlusionRenderer}_destroy(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}const Bh={};class wh{constructor(){this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]}}class xh{constructor(){this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}finalize(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}bindCommonTextures(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}bindTriangleIndicesTextures(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}bindEdgeIndicesTextures(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}const Ph={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Ph,null,4));let e=0;Object.keys(Ph).forEach((t=>{t.startsWith("size")&&(e+=Ph[t])})),console.log(`Total size ${e} bytes (${(e/1e3/1e3).toFixed(2)} MB)`),console.log(`Avg bytes / triangle: ${(e/Ph.totalPolygons).toFixed(2)}`);let t={};Object.keys(Ph).forEach((i=>{i.startsWith("size")&&(t[i]=`${(Ph[i]/e*100).toFixed(2)} % of total`)})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};class Ch{constructor(){}disableBindedTextureFiltering(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}createTextureForColorsAndFlags(e,t,i,s,r,o,n){const a=t.length;this.numPortions=a;const l=4096,A=Math.ceil(a/512);if(0===A)throw"texture height===0";const h=new Uint8Array(16384*A);Ph.sizeDataColorsAndFlags+=h.byteLength,Ph.numberOfTextures++;for(let e=0;e>24&255,s[e]>>16&255,s[e]>>8&255,255&s[e]],32*e+16),h.set([r[e]>>24&255,r[e]>>16&255,r[e]>>8&255,255&r[e]],32*e+20),h.set([o[e]>>24&255,o[e]>>16&255,o[e]>>8&255,255&o[e]],32*e+24),h.set([n[e]?1:0,0,0,0],32*e+28);const c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,A),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,A,e.RGBA_INTEGER,e.UNSIGNED_BYTE,h,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,c,l,A,h)}createTextureForObjectOffsets(e,t){const i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";const r=new Float32Array(1536*s).fill(0);Ph.sizeDataTextureOffsets+=r.byteLength,Ph.numberOfTextures++;const o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new tA(e,o,i,s,r)}createTextureForInstancingMatrices(e,t){const i=t.length;if(0===i)throw"num instance matrices===0";const s=2048,r=Math.ceil(i/512),o=new Float32Array(8192*r);Ph.numberOfTextures++;for(let e=0;e{i._compile(),i.eagerCreateRenders()})),e.on("destroyed",(()=>{delete Bh[t],i._destroy()}))),i}(e.scene),this.model=e,this._buffer=new wh,this._dtxState=new xh,this._dtxTextureFactory=new Ch,this._state=new lt({origin:d.vec3(t.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._subPortions=[],this._portionToSubPortionsMap=[],this._bucketGeometries={},this._meshes=[],this._aabb=d.collapseAABB3(),this.aabbDirty=!0,this._numUpdatesInFrame=0,this._finalized=!1}get aabb(){if(this.aabbDirty){d.collapseAABB3(this._aabb);for(let e=0,t=this._meshes.length;e65536&&Ph.cannotCreatePortion.because10BitsObjectId++;let i=this._numPortions+t<=65536;const s=void 0!==e.geometryId&&null!==e.geometryId?`${e.geometryId}#0`:`${e.id}#0`;if(!this._bucketGeometries[s]){const t=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);let s=0,r=0;e.buckets.forEach((e=>{s+=e.positionsCompressed.length/3,r+=e.indices.length/3})),(this._state.numVertices+s>4096*Fh||t+r>4096*Fh)&&Ph.cannotCreatePortion.becauseTextureSize++,i&&=this._state.numVertices+s<=4096*Fh&&t+r<=4096*Fh}return i}createPortion(e,t){if(this._finalized)throw"Already finalized";const i=[];t.buckets.forEach(((e,s)=>{const r=void 0!==t.geometryId&&null!==t.geometryId?`${t.geometryId}#${s}`:`${t.id}#${s}`;let o=this._bucketGeometries[r];o||(o=this._createBucketGeometry(t,e),this._bucketGeometries[r]=o);const n=this._createSubPortion(t,o,e);i.push(n)}));const s=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(i),this.model.numPortions++,this._meshes.push(e),s}_createBucketGeometry(e,t){if(t.indices){const e=8*Math.ceil(t.indices.length/3/8)*3;Ph.overheadSizeAlignementIndices+=2*(e-t.indices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.indices),t.indices=i}if(t.edgeIndices){const e=8*Math.ceil(t.edgeIndices.length/2/8)*2;Ph.overheadSizeAlignementEdgeIndices+=2*(e-t.edgeIndices.length);const i=new Uint32Array(e);i.fill(0),i.set(t.edgeIndices),t.edgeIndices=i}const i=t.positionsCompressed,s=t.indices,r=t.edgeIndices,o=this._buffer;o.positionsCompressed.push(i);const n=o.lenPositionsCompressed/3,a=i.length/3;let l;o.lenPositionsCompressed+=i.length;let A,h=0;if(s){let e;h=s.length/3,a<=256?(e=o.indices8Bits,l=o.lenIndices8Bits/3,o.lenIndices8Bits+=s.length):a<=65536?(e=o.indices16Bits,l=o.lenIndices16Bits/3,o.lenIndices16Bits+=s.length):(e=o.indices32Bits,l=o.lenIndices32Bits/3,o.lenIndices32Bits+=s.length),e.push(s)}let c=0;if(r){let e;c=r.length/2,a<=256?(e=o.edgeIndices8Bits,A=o.lenEdgeIndices8Bits/2,o.lenEdgeIndices8Bits+=r.length):a<=65536?(e=o.edgeIndices16Bits,A=o.lenEdgeIndices16Bits/2,o.lenEdgeIndices16Bits+=r.length):(e=o.edgeIndices32Bits,A=o.lenEdgeIndices32Bits/2,o.lenEdgeIndices32Bits+=r.length),e.push(r)}this._state.numVertices+=a,Ph.numberOfGeometries++;return{vertexBase:n,numVertices:a,numTriangles:h,numEdges:c,indicesBase:l,edgeIndicesBase:A}}_createSubPortion(e,t,i,s){const r=e.color;e.metallic,e.roughness;const o=e.colors,n=e.opacity,a=e.meshMatrix,l=e.pickColor,A=this._buffer,h=this._state;A.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),A.perObjectInstancePositioningMatrices.push(a||Th),A.perObjectSolid.push(!!e.solid),o?A.perObjectColors.push([255*o[0],255*o[1],255*o[2],255]):r&&A.perObjectColors.push([r[0],r[1],r[2],n]),A.perObjectPickColors.push(l),A.perObjectVertexBases.push(t.vertexBase);{let e;e=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,A.perObjectIndexBaseOffsets.push(e/3-t.indicesBase)}{let e;e=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,A.perObjectEdgeIndexBaseOffsets.push(e/2-t.edgeIndicesBase)}const c=this._subPortions.length;if(t.numTriangles>0){let e,i=3*t.numTriangles;t.numVertices<=256?(e=A.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=i,Ph.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(e=A.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=i,Ph.totalPolygons16Bits+=t.numTriangles):(e=A.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=i,Ph.totalPolygons32Bits+=t.numTriangles),Ph.totalPolygons+=t.numTriangles;for(let i=0;i0){let e,i=2*t.numEdges;t.numVertices<=256?(e=A.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=i,Ph.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(e=A.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=i,Ph.totalEdges16Bits+=t.numEdges):(e=A.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=i,Ph.totalEdges32Bits+=t.numEdges),Ph.totalEdges+=t.numEdges;for(let i=0;i0&&(t.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId8Bits)),s.perEdgeNumberPortionId16Bits.length>0&&(t.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId16Bits)),s.perEdgeNumberPortionId32Bits.length>0&&(t.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(i,s.perEdgeNumberPortionId32Bits)),s.lenIndices8Bits>0&&(t.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(i,s.indices8Bits,s.lenIndices8Bits)),s.lenIndices16Bits>0&&(t.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(i,s.indices16Bits,s.lenIndices16Bits)),s.lenIndices32Bits>0&&(t.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(i,s.indices32Bits,s.lenIndices32Bits)),s.lenEdgeIndices8Bits>0&&(t.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(i,s.edgeIndices8Bits,s.lenEdgeIndices8Bits)),s.lenEdgeIndices16Bits>0&&(t.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(i,s.edgeIndices16Bits,s.lenEdgeIndices16Bits)),s.lenEdgeIndices32Bits>0&&(t.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(i,s.edgeIndices32Bits,s.lenEdgeIndices32Bits)),t.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(()=>{this._deferredSetFlagsDirty&&this._uploadDeferredFlags(),this._numUpdatesInFrame=0}))}isEmpty(){return 0===this._numPortions}initFlags(e,t,i){t&q&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&re&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&se&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&oe&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&te&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&ne&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&ee&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&$&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}flushInitFlags(){this._setDeferredFlags(),this._setDeferredFlags2()}setVisible(e,t,i){if(!this._finalized)throw"Not finalized";t&q?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}setHighlighted(e,t,i){if(!this._finalized)throw"Not finalized";t&re?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}setXRayed(e,t,i){if(!this._finalized)throw"Not finalized";t&se?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}setSelected(e,t,i){if(!this._finalized)throw"Not finalized";t&oe?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}setEdges(e,t,i){if(!this._finalized)throw"Not finalized";t&ne?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}setClippable(e,t){if(!this._finalized)throw"Not finalized";t&te?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}_beginDeferredFlags(){this._deferredSetFlagsActive=!0}_uploadDeferredFlags(){if(this._deferredSetFlagsActive=!1,!this._deferredSetFlagsDirty)return;this._deferredSetFlagsDirty=!1;const e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}setCulled(e,t,i){if(!this._finalized)throw"Not finalized";t&$?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}setCollidable(e,t){if(!this._finalized)throw"Not finalized"}setPickable(e,t,i){if(!this._finalized)throw"Not finalized";t&ee?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}setColor(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Ih)}setTransparent(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}_setFlags(e,t,i,s=!1){const r=this._portionToSubPortionsMap[e];for(let e=0,o=r.length;e=10&&this._beginDeferredFlags(),g.bindTexture(g.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),g.texSubImage2D(g.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,g.RGBA_INTEGER,g.UNSIGNED_BYTE,Ih))}_setDeferredFlags(){}_setFlags2(e,t,i=!1){const s=this._portionToSubPortionsMap[e];for(let e=0,r=s.length;e=10&&this._beginDeferredFlags(),o.bindTexture(o.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),o.texSubImage2D(o.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,o.RGBA_INTEGER,o.UNSIGNED_BYTE,Ih))}_setDeferredFlags2(){}setOffset(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,Dh))}setMatrix(e,t){const i=this._portionToSubPortionsMap[e];for(let e=0,s=i.length;e=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Eh))}drawColorOpaque(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,go.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}_updateBackfaceCull(e,t){const i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){const e=t.gl;i?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),t.backfaces=i}}drawColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,go.COLOR_TRANSPARENT))}drawDepth(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawSilhouetteXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_XRAYED))}drawSilhouetteHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_HIGHLIGHTED))}drawSilhouetteSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,go.SILHOUETTE_SELECTED))}drawEdgesColorOpaque(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,go.EDGES_COLOR_OPAQUE)}drawEdgesColorTransparent(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,go.EDGES_COLOR_TRANSPARENT)}drawEdgesHighlighted(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_HIGHLIGHTED)}drawEdgesSelected(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_SELECTED)}drawEdgesXRayed(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,go.EDGES_XRAYED)}drawOcclusion(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}drawShadow(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,go.COLOR_OPAQUE))}setPickMatrices(e,t){}drawPickMesh(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,go.PICK))}drawPickDepths(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,go.PICK))}drawSnapInit(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,go.PICK))}drawSnap(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,go.PICK))}drawPickNormals(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,go.PICK))}destroy(){if(this._destroyed)return;const e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}class Lh{constructor(e){this.id=e.id,this.colorTexture=e.colorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalsTexture=e.normalsTexture,this.emissiveTexture=e.emissiveTexture,this.occlusionTexture=e.occlusionTexture}destroy(){}}class Uh{constructor(e){this.id=e.id,this.texture=e.texture}destroy(){this.texture&&(this.texture.destroy(),this.texture=null)}}const kh={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class Oh{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(e){void 0!==this.onError&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==Vh[e])return void Vh[e].push({onLoad:t,onProgress:i,onError:s});Vh[e]=[],Vh[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),n=this.mimeType,a=this.responseType;fetch(o).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const i=Vh[e],s=t.body.getReader(),r=t.headers.get("Content-Length"),o=r?parseInt(r):0,n=0!==o;let a=0;const l=new ReadableStream({start(e){!function t(){s.read().then((({done:s,value:r})=>{if(s)e.close();else{a+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:n,loaded:a,total:o});for(let e=0,t=i.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,n)));case"json":return e.json();default:if(void 0===n)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(n),i=t&&t[1]?t[1].toLowerCase():void 0,s=new TextDecoder(i);return e.arrayBuffer().then((e=>s.decode(e)))}}})).then((t=>{kh.add(e,t);const i=Vh[e];delete Vh[e];for(let e=0,s=i.length;e{const i=Vh[e];if(void 0===i)throw this.manager.itemError(e),t;delete Vh[e];for(let e=0,s=i.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class jh{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}let Gh=0;class zh{constructor({viewer:e,transcoderPath:t,workerLimit:i}){this._transcoderPath=t||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/",this._transcoderBinary=null,this._transcoderPending=null,this._workerPool=new jh,this._workerSourceURL="",i&&this._workerPool.setWorkerLimit(i);const s=e.capabilities;this._workerConfig={astcSupported:s.astcSupported,etc1Supported:s.etc1Supported,etc2Supported:s.etc2Supported,dxtSupported:s.dxtSupported,bptcSupported:s.bptcSupported,pvrtcSupported:s.pvrtcSupported},this._supportedFileTypes=["xkt2"]}_init(){if(!this._transcoderPending){const e=new Hh;e.setPath(this._transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new Hh;i.setPath(this._transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=i.loadAsync("basis_transcoder.wasm");this._transcoderPending=Promise.all([t,s]).then((([e,t])=>{const i=zh.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(zh.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(zh.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(zh.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this._workerSourceURL=URL.createObjectURL(new Blob([s])),this._transcoderBinary=t,this._workerPool.setWorkerCreator((()=>{const e=new Worker(this._workerSourceURL),t=this._transcoderBinary.slice(0);return e.postMessage({type:"init",config:this._workerConfig,transcoderBinary:t},[t]),e}))})),Gh>0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),Gh++}return this._transcoderPending}transcode(e,t,i={}){return new Promise(((s,r)=>{const o=i;this._init().then((()=>this._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e))).then((e=>{const i=e.data,{mipmaps:o,width:n,height:a,format:l,type:A,error:h,dfdTransferFn:c,dfdFlags:u}=i;if("error"===A)return r(h);t.setCompressedData({mipmaps:o,props:{format:l,minFilter:1===o.length?1006:1008,magFilter:1===o.length?1006:1008,encoding:2===c?3001:3e3,premultiplyAlpha:!!(1&u)}}),s()}))}))}destroy(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),Gh--}}zh.BasisFormat={ETC1S:0,UASTC_4x4:1},zh.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},zh.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},zh.BasisWorker=function(){let e,t,i;const s=_EngineFormat,r=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(n){const h=n.data;switch(h.type){case"init":e=h.config,c=h.transcoderBinary,t=new Promise((e=>{i={wasmBinary:c,onRuntimeInitialized:e},BASIS(i)})).then((()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{width:t,height:n,hasAlpha:c,mipmaps:u,format:d,dfdTransferFn:p,dfdFlags:f}=function(t){const n=new i.KTX2File(new Uint8Array(t));function h(){n.close(),n.delete()}if(!n.isValid())throw h(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");const c=n.isUASTC()?o.UASTC_4x4:o.ETC1S,u=n.getWidth(),d=n.getHeight(),p=n.getLevels(),f=n.getHasAlpha(),g=n.getDFDTransferFunc(),m=n.getDFDFlags(),{transcoderFormat:_,engineFormat:v}=function(t,i,n,h){let c,u;const d=t===o.ETC1S?a:l;for(let s=0;s{delete Wh[t],i.destroy()}))),i} /** * @author https://github.com/tmarti, with support from https://tribia.com/ * @license MIT @@ -14,7 +14,7 @@ class e{constructor(e,t){this.items=e||[],this._lastUniqueId=(t||0)+1}addItem(){ /** * @author https://github.com/tmarti, with support from https://tribia.com/ * @license MIT - **/let qh=null;function $h(e,t){const i=3*e,s=3*t;let r,o,n,a,l,A;const h=Math.min(r=qh[i],o=qh[i+1],n=qh[i+2]),c=Math.min(a=qh[s],l=qh[s+1],A=qh[s+2]);if(h!==c)return h-c;const u=Math.max(r,o,n),d=Math.max(a,l,A);return u!==d?u-d:0}let ec=null;function tc(e,t){let i=ec[2*e]-ec[2*t];return 0!==i?i:ec[2*e+1]-ec[2*t+1]}function ic(e,t,i=!1){const s=e.positionsCompressed||[],r=function(e,t){const i=new Int32Array(e.length/3);for(let e=0,t=i.length;e>t;i.sort($h);const s=new Int32Array(e.length);for(let t=0,r=i.length;te[t+1]){let i=e[t];e[t]=e[t+1],e[t+1]=i}ec=new Int32Array(e),t.sort(tc);const i=new Int32Array(e.length);for(let s=0,r=t.length;st){let i=e;e=t,t=i}function i(i,s){return i!==e?e-i:s!==t?t-s:0}let s=0,r=(o.length>>1)-1;for(;s<=r;){const e=r+s>>1,t=i(o[2*e],o[2*e+1]);if(t>0)s=e+1;else{if(!(t<0))return e;r=e-1}}return-s-1}const a=new Int32Array(o.length/2);a.fill(0);const l=s.length/3;if(l>8*(1<u.maxNumPositions&&(u=c()),u.bucketNumber>8)return[e];let p;-1===A[l]&&(A[l]=u.numPositions++,u.positionsCompressed.push(s[3*l]),u.positionsCompressed.push(s[3*l+1]),u.positionsCompressed.push(s[3*l+2])),-1===A[h]&&(A[h]=u.numPositions++,u.positionsCompressed.push(s[3*h]),u.positionsCompressed.push(s[3*h+1]),u.positionsCompressed.push(s[3*h+2])),-1===A[d]&&(A[d]=u.numPositions++,u.positionsCompressed.push(s[3*d]),u.positionsCompressed.push(s[3*d+1]),u.positionsCompressed.push(s[3*d+2])),u.indices.push(A[l]),u.indices.push(A[h]),u.indices.push(A[d]),(p=n(l,h))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(l,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(h,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]]))}const d=t/8*2,p=t/8,f=2*s.length+(r.length+o.length)*d;let g=0,m=-s.length/3;return h.forEach((e=>{g+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*p,m+=e.positionsCompressed.length/3})),g>f?[e]:(i&&function(e,t){const i={},s={};let r=0;e.forEach((e=>{const t=e.indices,o=e.edgeIndices,n=e.positionsCompressed;for(let e=0,s=t.length;e0){const e=t._meshes;for(let t=0,i=e.length;t0){const e=this._meshes;for(let t=0,i=e.length;t{this._viewMatrixDirty=!0})),this._meshesWithDirtyMatrices=[],this._numMeshesWithDirtyMatrices=0,this._onTick=this.scene.on("tick",(()=>{for(;this._numMeshesWithDirtyMatrices>0;)this._meshesWithDirtyMatrices[--this._numMeshesWithDirtyMatrices]._updateMatrix()})),this._createDefaultTextureSet(),this.visible=t.visible,this.culled=t.culled,this.pickable=t.pickable,this.clippable=t.clippable,this.collidable=t.collidable,this.castsShadow=t.castsShadow,this.receivesShadow=t.receivesShadow,this.xrayed=t.xrayed,this.highlighted=t.highlighted,this.selected=t.selected,this.edges=t.edges,this.colorize=t.colorize,this.opacity=t.opacity,this.backfaces=t.backfaces}_meshMatrixDirty(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}_createDefaultTextureSet(){const e=new Uh({id:"defaultColorTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new Uh({id:"defaultMetalRoughTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new Uh({id:"defaultNormalsTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new Uh({id:"defaultEmissiveTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new Uh({id:"defaultOcclusionTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new Lh({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}get isPerformanceModel(){return!0}get transforms(){return this._transforms}get textures(){return this._textures}get textureSets(){return this._textureSets}get meshes(){return this._meshes}get objects(){return this._entities}get origin(){return this._origin}set position(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get position(){return this._position}set rotation(e){this._rotation.set(e||[0,0,0]),d.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get rotation(){return this._rotation}set quaternion(e){this._quaternion.set(e||[0,0,0,1]),d.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get quaternion(){return this._quaternion}set scale(e){}get scale(){return this._scale}set matrix(e){this._matrix.set(e||mc),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),d.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),d.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get matrix(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix}get rotationMatrix(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}_rebuildMatrices(){this._matrixDirty&&(d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),d.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),d.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}get rotationMatrixConjugate(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}_setWorldMatrixDirty(){this._matrixDirty=!0,this._aabbDirty=!0}_transformDirty(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}_sceneModelDirty(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(let e=0,t=this._entityList.length;e0}set visible(e){e=!1!==e,this._visible=e;for(let t=0,i=this._entityList.length;t0}set xrayed(e){e=!!e,this._xrayed=e;for(let t=0,i=this._entityList.length;t0}set highlighted(e){e=!!e,this._highlighted=e;for(let t=0,i=this._entityList.length;t0}set selected(e){e=!!e,this._selected=e;for(let t=0,i=this._entityList.length;t0}set edges(e){e=!!e,this._edges=e;for(let t=0,i=this._entityList.length;t0}set pickable(e){e=!1!==e,this._pickable=e;for(let t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){const t=e.colors,i=new Uint8Array(t.length);for(let e=0,s=t.length;e{l.setImage(A,{minFilter:i,magFilter:s,wrapS:r,wrapT:o,wrapR:n,flipY:e.flipY,encoding:a}),this.glRedraw()},A.src=e.src;break;default:this._textureTranscoder?y.loadArraybuffer(e.src,(e=>{e.byteLength?this._textureTranscoder.transcode([e],l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'src': file data is zero length")}),(function(e){this.error(`[createTexture] Can't create texture from 'src': ${e}`)})):this.error(`[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('${t}')`)}}else e.buffers&&(this._textureTranscoder?this._textureTranscoder.transcode(e.buffers,l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option"));this._textures[t]=new Uh({id:t,texture:l})}createTextureSet(e){const t=e.id;if(null==t)return void this.error("[createTextureSet] Config missing: id");if(this._textureSets[t])return void this.error(`[createTextureSet] Texture set already created: ${t}`);let i,s,r,o,n;if(void 0!==e.colorTextureId&&null!==e.colorTextureId){if(i=this._textures[e.colorTextureId],!i)return void this.error(`[createTextureSet] Texture not found: ${e.colorTextureId} - ensure that you create it first with createTexture()`)}else i=this._textures.defaultColorTexture;if(void 0!==e.metallicRoughnessTextureId&&null!==e.metallicRoughnessTextureId){if(s=this._textures[e.metallicRoughnessTextureId],!s)return void this.error(`[createTextureSet] Texture not found: ${e.metallicRoughnessTextureId} - ensure that you create it first with createTexture()`)}else s=this._textures.defaultMetalRoughTexture;if(void 0!==e.normalsTextureId&&null!==e.normalsTextureId){if(r=this._textures[e.normalsTextureId],!r)return void this.error(`[createTextureSet] Texture not found: ${e.normalsTextureId} - ensure that you create it first with createTexture()`)}else r=this._textures.defaultNormalsTexture;if(void 0!==e.emissiveTextureId&&null!==e.emissiveTextureId){if(o=this._textures[e.emissiveTextureId],!o)return void this.error(`[createTextureSet] Texture not found: ${e.emissiveTextureId} - ensure that you create it first with createTexture()`)}else o=this._textures.defaultEmissiveTexture;if(void 0!==e.occlusionTextureId&&null!==e.occlusionTextureId){if(n=this._textures[e.occlusionTextureId],!n)return void this.error(`[createTextureSet] Texture not found: ${e.occlusionTextureId} - ensure that you create it first with createTexture()`)}else n=this._textures.defaultOcclusionTexture;const a=new Lh({id:t,model:this,colorTexture:i,metallicRoughnessTexture:s,normalsTexture:r,emissiveTexture:o,occlusionTexture:n});return this._textureSets[t]=a,a}createTransform(e){if(void 0===e.id||null===e.id)return void this.error("[createTransform] SceneModel.createTransform() config missing: id");if(this._transforms[e.id])return void this.error(`[createTransform] SceneModel already has a transform with this ID: ${e.id}`);let t;if(e.parentTransformId&&(t=this._transforms[e.parentTransformId],!t))return void this.error("[createTransform] SceneModel.createTransform() config missing: id");const i=new hc({id:e.id,model:this,parent:t,matrix:e.matrix,position:e.position,scale:e.scale,rotation:e.rotation,quaternion:e.quaternion});return this._transforms[i.id]=i,i}createMesh(e){if(void 0===e.id||null===e.id)return this.error("[createMesh] SceneModel.createMesh() config missing: id"),!1;if(this._meshes[e.id])return this.error(`[createMesh] SceneModel already has a mesh with this ID: ${e.id}`),!1;if(!(void 0!==e.geometryId)){if(void 0!==e.primitive&&null!==e.primitive||(e.primitive="triangles"),"points"!==e.primitive&&"lines"!==e.primitive&&"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)return this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`),!1;if(!e.positions&&!e.positionsCompressed&&!e.buckets)return this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)"),!1;if(e.positions&&(e.positionsDecodeMatrix||e.positionsDecodeBoundary))return this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.positionsCompressed&&!e.positionsDecodeMatrix&&!e.positionsDecodeBoundary)return this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.uvCompressed&&!e.uvDecodeMatrix)return this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)"),!1;if(!(e.buckets||e.indices||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)){const t=(e.positions||e.positionsCompressed).length/3;e.indices=this._createDefaultIndices(t)}if(!e.buckets&&!e.indices&&"points"!==e.primitive)return e.indices=this._createDefaultIndices(numIndices),this.error(`Param expected: indices (required for '${e.primitive}' primitive type)`),!1;if((e.matrix||e.position||e.rotation||e.scale)&&(e.positionsCompressed||e.positionsDecodeBoundary))return this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'"),!1;const t=!(!this._dtxEnabled||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive||e.textureSetId);if(e.origin=e.origin?d.addVec3(this._origin,e.origin,d.vec3()):this._origin,e.matrix)e.meshMatrix=e.matrix;else if(e.scale||e.rotation||e.position){const t=e.scale||dc,i=e.position||pc,s=e.rotation||fc;d.eulerToQuaternion(s,"XYZ",gc),e.meshMatrix=d.composeMat4(i,gc,t,d.mat4())}if(e.positionsDecodeBoundary&&(e.positionsDecodeMatrix=hn(e.positionsDecodeBoundary,d.mat4())),t){if(e.type=2,e.color=e.color?new Uint8Array([Math.floor(255*e.color[0]),Math.floor(255*e.color[1]),Math.floor(255*e.color[2])]):_c,e.opacity=void 0!==e.opacity&&null!==e.opacity?Math.floor(255*e.opacity):255,e.positions){const t=d.vec3(),i=[];J(e.positions,i,t)&&(e.positions=i,e.origin=d.addVec3(e.origin,t,t))}if(e.positions){const t=d.collapseAABB3();e.positionsDecodeMatrix=d.mat4(),d.expandAABB3Points3(t,e.positions),e.positionsCompressed=An(e.positions,t,e.positionsDecodeMatrix),e.aabb=t}else if(e.positionsCompressed){const t=d.collapseAABB3();d.expandAABB3Points3(t,e.positionsCompressed),Vt.decompressAABB(t,e.positionsDecodeMatrix),e.aabb=t}if(e.buckets){const t=d.collapseAABB3();for(let i=0,s=e.buckets.length;i>24&255,r=i>>16&255,o=i>>8&255,n=255&i;switch(e.pickColor=new Uint8Array([n,o,r,s]),e.solid="solid"===e.primitive,t.origin=d.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}_getNumPrimitives(e){let t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(let i=0,s=e.buckets.length;i>>0).toString(16)}_getVBOInstancingLayer(e){const t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,o=`${Math.round(i[0])}.${Math.round(i[1])}.${Math.round(i[2])}.${s}.${r}`;let n=this._vboInstancingLayers[o];if(n)return n;let a=e.textureSet;const l=e.geometry;for(;!n;)switch(l.primitive){case"triangles":case"surface":n=new pa({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":n=new pa({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":n=new $a({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":n=new Wl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[o]=n,this.layerList.push(n),n}createEntity(e){if(void 0===e.id?e.id=d.createUUID():this.scene.components[e.id]&&(this.error(`Scene already has a Component with this ID: ${e.id} - will assign random ID`),e.id=d.createUUID()),void 0===e.meshIds)return void this.error("Config missing: meshIds");let t=0;this._visible&&!1!==e.visible&&(t|=q),this._pickable&&!1!==e.pickable&&(t|=ee),this._culled&&!1!==e.culled&&(t|=$),this._clippable&&!1!==e.clippable&&(t|=te),this._collidable&&!1!==e.collidable&&(t|=ie),this._edges&&!1!==e.edges&&(t|=ne),this._xrayed&&!1!==e.xrayed&&(t|=se),this._highlighted&&!1!==e.highlighted&&(t|=re),this._selected&&!1!==e.selected&&(t|=oe),e.flags=t,this._createEntity(e)}_createEntity(e){let t=[];for(let i=0,s=e.meshIds.length;ie.sortIdt.sortId?1:0));for(let e=0,t=this.layerList.length;e0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}_updateRenderFlagsVisibleLayers(){const e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(let t=0,i=this.layerList.length;t0){const t=`${this.id}-dummyEntityForUnusedMeshes`;this.warn(`Creating dummy SceneModelEntity "${t}" for unused SceneMeshes: [${e.join(",")}]`),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}_getActiveSectionPlanesForLayer(e){const t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(let e=0;e0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){const t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0){this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0))}if(this.numSelectedLayerPortions>0){const t=this.scene.selectedMaterial._state;t.fill&&(t.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){const t=this.scene.highlightMaterial._state;t.fill&&(t.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}drawColorOpaque(e){const t=this.renderFlags;for(let i=0,s=t.visibleLayers.length;i65536?16:8)}else n=[{positionsCompressed:s,indices:r,edgeIndices:o}];return n}class yc extends R{constructor(e,t={}){if(super(e,t),this._positions=t.positions||[],t.indices)this._indices=t.indices;else{this._indices=[];for(let e=0,t=this._positions.length/3-1;ep.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,B=v.filter((e=>!b[e])),w=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=Fc(e.location,Bc),i=Fc(e.direction,Bc);A&&d.negateVec3(i),d.subVec3(t,l),r.yUp&&(t=Ic(t),i=Ic(i)),new yr(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new yc(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=Fc(e.location,wc),n=Fc(e.normal,xc),a=Fc(e.up,Pc),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=Ic(o),n=Ic(n),a=Ic(a)),new lo(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,c;if(e.perspective_camera?(a=Fc(e.perspective_camera.camera_view_point,Bc),A=Fc(e.perspective_camera.camera_direction,Bc),h=Fc(e.perspective_camera.camera_up_vector,Bc),r.perspective.fov=e.perspective_camera.field_of_view,c="perspective"):(a=Fc(e.orthogonal_camera.camera_view_point,Bc),A=Fc(e.orthogonal_camera.camera_direction,Bc),h=Fc(e.orthogonal_camera.camera_up_vector,Bc),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,c="ortho"),d.subVec3(a,l),r.yUp&&(a=Ic(a),A=Ic(A),h=Ic(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:d.addVec3(a,A,Bc)}else A=d.addVec3(a,A,Bc);n?(r.eye=a,r.look=A,r.up=h,r.projection=c):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:c})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=d.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}}function Mc(e){return{x:e[0],y:e[1],z:e[2]}}function Fc(e,t){return(t=new Float64Array(3))[0]=e.x,t[1]=e.y,t[2]=e.z,t}function Ec(e){return new Float64Array([e[0],-e[2],e[1]])}function Ic(e){return new Float64Array([e[0],e[2],-e[1]])}const Dc=d.vec3(),Sc=(e,t,i,s)=>{var r=e-i,o=t-s;return Math.sqrt(r*r+o*o)};class Tc extends R{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={};var i=this.plugin.viewer.scene;this._originMarker=new ue(i,t.origin),this._targetMarker=new ue(i,t.target),this._originWorld=d.vec3(),this._targetWorld=d.vec3(),this._wp=new Float64Array(24),this._vp=new Float64Array(24),this._pp=new Float64Array(24),this._cp=new Float64Array(8),this._xAxisLabelCulled=!1,this._yAxisLabelCulled=!1,this._zAxisLabelCulled=!1,this._color=t.color||this.plugin.defaultColor;const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},l=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};this._originDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._targetDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthWire=new de(this._container,{color:this._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisWire=new de(this._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisWire=new de(this._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisWire=new de(this._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthLabel=new fe(this._container,{fillColor:this._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisLabel=new fe(this._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisLabel=new fe(this._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisLabel=new fe(this._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._sectionPlanesDirty=!0,this._visible=!1,this._originVisible=!1,this._targetVisible=!1,this._wireVisible=!1,this._axisVisible=!1,this._xAxisVisible=!1,this._yAxisVisible=!1,this._zAxisVisible=!1,this._axisEnabled=!0,this._labelsVisible=!1,this._labelsOnWires=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onMetricsUnits=i.metrics.on("units",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsScale=i.metrics.on("scale",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsOrigin=i.metrics.on("origin",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.targetVisible=t.targetVisible,this.wireVisible=t.wireVisible,this.axisVisible=t.axisVisible,this.xAxisVisible=t.xAxisVisible,this.yAxisVisible=t.yAxisVisible,this.zAxisVisible=t.zAxisVisible,this.labelsVisible=t.labelsVisible,this.labelsOnWires=t.labelsOnWires}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(d.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}const t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){d.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var s=this._pp,r=this._cp,o=e.canvas.canvas.getBoundingClientRect();const t=this._container.getBoundingClientRect();var n=o.top-t.top,a=o.left-t.left,l=e.canvas.boundary,A=l[2],h=l[3],c=0;const i=this.plugin.viewer.scene.metrics,f=i.scale,g=i.units,m=i.unitsInfo[g].abbrev;for(var u=0,p=s.length;ue.offsetTop+(e.offsetParent&&e.offsetParent!==s.parentNode&&h(e.offsetParent)),c=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==s.parentNode&&c(e.offsetParent)),u=d.vec2();this._onCameraControlHoverSnapOrSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{const t=e.snappedCanvasPos||e.canvasPos;r=!0,o.set(e.worldPos),n.set(e.canvasPos),0===this._mouseState?(this._canvasToPagePos?(this._canvasToPagePos(s,t,u),this._markerDiv.style.left=u[0]-5+"px",this._markerDiv.style.top=u[1]-5+"px"):(this._markerDiv.style.left=c(s)+t[0]-5+"px",this._markerDiv.style.top=h(s)+t[1]-5+"px"),this._markerDiv.style.background="pink",e.snappedToVertex||e.snappedToEdge?(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,this.pointerLens.snapped=!0),this._markerDiv.style.background="greenyellow",this._markerDiv.style.border="2px solid green"):(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.canvasPos,this.pointerLens.snapped=!1),this._markerDiv.style.background="pink",this._markerDiv.style.border="2px solid red"),A=e.entity):(this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px"),s.style.cursor="pointer",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=this._currentDistanceMeasurementInitState.wireVisible,this._currentDistanceMeasurement.axisVisible=this._currentDistanceMeasurementInitState.axisVisible&&this.distanceMeasurementsPlugin.defaultAxisVisible,this._currentDistanceMeasurement.xAxisVisible=this._currentDistanceMeasurementInitState.xAxisVisible&&this.distanceMeasurementsPlugin.defaultXAxisVisible,this._currentDistanceMeasurement.yAxisVisible=this._currentDistanceMeasurementInitState.yAxisVisible&&this.distanceMeasurementsPlugin.defaultYAxisVisible,this._currentDistanceMeasurement.zAxisVisible=this._currentDistanceMeasurementInitState.zAxisVisible&&this.distanceMeasurementsPlugin.defaultZAxisVisible,this._currentDistanceMeasurement.targetVisible=this._currentDistanceMeasurementInitState.targetVisible,this._currentDistanceMeasurement.target.worldPos=o.slice(),this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px")})),s.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(a=e.clientX,l=e.clientY)}),s.addEventListener("mouseup",this._onMouseUp=t=>{1===t.which&&(t.clientX>a+20||t.clientXl+20||t.clientY{this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos),r=!1,this._markerDiv.style.left="-100px",this._markerDiv.style.top="-100px",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.axisVisible=!1),s.style.cursor="default"})),this._active=!0}deactivate(){if(!this._active)return;this.fire("activated",!1),this.pointerLens&&(this.pointerLens.visible=!1),this._markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.distanceMeasurementsPlugin.viewer.cameraControl;t.off(this._onCameraControlHoverSnapOrSurface),t.off(this._onCameraControlHoverSnapOrSurfaceOff),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null))}destroy(){this.deactivate(),super.destroy()}}class Uc extends z{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new Lc(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new Tc(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},c=()=>{this.plugin.viewer.cameraControl.active=!0},u=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),c(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const c=i.touches[0],p=c.clientX,f=c.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void u();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let c,u;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),c=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),c&&c.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=c.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(c.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=c.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:d.createUUID(),origin:{worldPos:c.worldPos,entity:c.entity},target:{worldPos:c.worldPos,entity:c.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(u=t.pick({canvasPos:a,pickSurface:!0}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.canvasPos,this.pointerLens.snapped=!1),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:d.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),c=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=c.worldPos,this._currentDistanceMeasurement.target.entity=c.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(u=t.pick({canvasPos:a,pickSurface:!0}),u&&u.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=u.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],u=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([u,p]),this._touchState){case 1:{if(1!==s||u>n[0]+r||un[1]+r||pn[0]+r||un[1]+r||p{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}}class Nc{constructor(){}getMetaModel(e,t,i){y.loadJSON(e,(e=>{t(e)}),(function(e){i(e)}))}getGLTF(e,t,i){y.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getGLB(e,t,i){y.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getArrayBuffer(e,t,i,s){!function(e,t,i,s){var r=()=>{};i=i||r,s=s||r;const o=/^data:(.*?)(;base64)?,(.*)$/,n=t.match(o);if(n){const e=!!n[2];var a=n[3];a=window.decodeURIComponent(a),e&&(a=window.atob(a));try{const e=new ArrayBuffer(a.length),t=new Uint8Array(e);for(var l=0;l{i(e)}),(function(e){s(e)}))}}class Qc{constructor(e={}){this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=e.messages,this.locale=e.locale}set messages(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}loadMessages(e={}){for(let t in e)this._messages[t]=e[t];this.messages=this._messages}clearMessages(){this.messages={}}get locales(){return this._locales}set locale(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}get locale(){return this._locale}translate(e,t){const i=this._messages[this._locale];if(!i)return null;const s=Vc(e,i);return s?t?Hc(s,t):s:null}translatePlurals(e,t,i){const s=this._messages[this._locale];if(!s)return null;let r=Vc(e,s);return r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one,r?(r=Hc(r,[t]),i&&(r=Hc(r,i)),r):null}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];if(s)for(const e in s)if(s.hasOwnProperty(e)){s[e].callback(t)}}on(t,i){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new e),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});let s=this._eventSubs[t];s||(s={},this._eventSubs[t]=s);const r=this._eventSubIDMap.addItem();s[r]={callback:i},this._eventSubEvents[r]=t;const o=this._events[t];return void 0!==o&&i(o),r}off(e){if(null==e)return;if(!this._eventSubEvents)return;const t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];const i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}function Vc(e,t){if(t[e])return t[e];const i=e.split(".");let s=t;for(let e=0,t=i.length;s&&e1?1:e}get t(){return this._t}get tangent(){return this.getTangent(this._t)}get length(){var e=this._getLengths();return e[e.length-1]}getTangent(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),o=this.getPoint(s),n=d.subVec3(o,r,[]);return d.normalizeVec3(n,[])}getPointAt(e){var t=this.getUToTMapping(e);return this.getPoint(t)}getPoints(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}_getLengths(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),o=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),o+=d.lenVec3(d.subVec3(t,r,[])),s.push(o),r=t;return this.cacheArcLengths=s,s}_updateArcLengths(){this.needsUpdate=!0,this._getLengths()}getUToTMapping(e,t){var i,s=this._getLengths(),r=0,o=s.length;i=t||e*s[o-1];for(var n,a=0,l=o-1;a<=l;)if((n=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(n>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(o-1);var A=s[r];return(r+(i-A)/(s[r+1]-A))/(o-1)}}class Gc extends jc{constructor(e,t={}){super(e,t),this.points=t.points,this.t=t.t}set points(e){this._points=e||[]}get points(){return this._points}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,o=t[0===s?s:s-1],n=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],A=d.vec3();return A[0]=d.catmullRomInterpolate(o[0],n[0],a[0],l[0],r),A[1]=d.catmullRomInterpolate(o[1],n[1],a[1],l[1],r),A[2]=d.catmullRomInterpolate(o[2],n[2],a[2],l[2],r),A}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}getJSON(){return{points:points,t:this._t}}}const zc=d.vec3();class Wc extends R{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new Gc(this),this._lookCurve=new Gc(this),this._upCurve=new Gc(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,zc),t.look=this._lookCurve.getPoint(e,zc),t.up=this._upCurve.getPoint(e,zc)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=d.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e=1;e>1&&(e=1);const i=this.easing?qc._ease(e,0,1,1):e,s=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?(d.subVec3(s.eye,s.look,Zc),s.eye=d.lerpVec3(i,0,1,this._eye1,this._eye2,Jc),s.look=d.subVec3(Jc,Zc,Xc)):this._flyingLook&&(s.look=d.lerpVec3(i,0,1,this._look1,this._look2,Xc),s.up=d.lerpVec3(i,0,1,this._up1,this._up2,Yc)):this._flyingEyeLookUp&&(s.eye=d.lerpVec3(i,0,1,this._eye1,this._eye2,Jc),s.look=d.lerpVec3(i,0,1,this._look1,this._look2,Xc),s.up=d.lerpVec3(i,0,1,this._up1,this._up2,Yc)),this._projection2){const t="ortho"===this._projection2?qc._easeOutExpo(e,0,1,1):qc._easeInCubic(e,0,1,1);s.customProjection.matrix=d.lerpMat4(t,0,1,this._projMatrix1,this._projMatrix2)}else s.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return s.ortho.scale=this._orthoScale2,void this.stop();I.scheduleTask(this._update,this)}static _ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}static _easeInCubic(e,t,i,s){return i*(e/=s)*e*e+t}static _easeOutExpo(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}stop(){if(!this._flying)return;this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);const e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}cancel(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}set duration(e){this._duration=e?1e3*e:500,this.stop()}get duration(){return this._duration/1e3}set fit(e){this._fit=!1!==e}get fit(){return this._fit}set fitFOV(e){this._fitFOV=e||45}get fitFOV(){return this._fitFOV}set trail(e){this._trail=!!e}get trail(){return this._trail}destroy(){this.stop(),super.destroy()}}class $c extends R{get type(){return"CameraPathAnimation"}constructor(e,t={}){super(e,t),this._cameraFlightAnimation=new qc(this),this._t=0,this.state=$c.SCRUBBING,this._playingFromT=0,this._playingToT=0,this._playingRate=t.playingRate||1,this._playingDir=1,this._lastTime=null,this.cameraPath=t.cameraPath,this._tick=this.scene.on("tick",this._updateT,this)}_updateT(){const e=this._cameraPath;if(!e)return;let t,i;const s=performance.now(),r=this._lastTime?.001*(s-this._lastTime):0;if(this._lastTime=s,0!==r)switch(this.state){case $c.SCRUBBING:return;case $c.PLAYING:if(this._t+=this._playingRate*r,t=this._cameraPath.frames.length,0===t||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=$c.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case $c.PLAYING_TO:i=this._t+this._playingRate*r*this._playingDir,(this._playingDir<0&&i<=this._playingToT||this._playingDir>0&&i>=this._playingToT)&&(i=this._playingToT,this.state=$c.SCRUBBING,this.fire("stopped")),this._t=i,e.loadFrame(this._t)}}_ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}set cameraPath(e){this._cameraPath=e}get cameraPath(){return this._cameraPath}set rate(e){this._playingRate=e}get rate(){return this._playingRate}play(){this._cameraPath&&(this._lastTime=null,this.state=$c.PLAYING)}playToT(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=$c.PLAYING_TO)}playToFrame(e){const t=this._cameraPath;if(!t)return;const i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}flyToFrame(e,t){const i=this._cameraPath;if(!i)return;const s=i.frames[e];s?(this.state=$c.SCRUBBING,this._cameraFlightAnimation.flyTo(s,t)):this.error("flyToFrame - frame index out of range: "+e)}scrubToT(e){const t=this._cameraPath;if(!t)return;this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=$c.SCRUBBING)}scrubToFrame(e){const t=this._cameraPath;if(!t)return;if(!this.scene.camera)return;t.frames[e]?(t.loadFrame(this._t),this.state=$c.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)}stop(){this.state=$c.SCRUBBING,this.fire("stopped")}destroy(){super.destroy(),this.scene.off(this._tick)}}$c.STOPPED=0,$c.SCRUBBING=1,$c.PLAYING=2,$c.PLAYING_TO=3;const eu=d.vec3(),tu=d.vec3();d.vec3();const iu=d.vec3([0,-1,0]),su=d.vec4([0,0,0,1]);class ru extends R{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=d.vec3(),this._origin=d.vec3(),this._rtcPos=d.vec3(),this._dir=d.vec3(),this._size=1,this._imageSize=d.vec2(),this._texture=new Kr(this),this._plane=new pr(this,{geometry:new Gt(this,ro({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new pr(this,{geometry:new Gt(this,so({size:1,divisions:10})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new Dr(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),X(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];d.subVec3(t,this.position,eu);const s=-d.dotVec3(i,eu);d.normalizeVec3(i),d.mulVec3Scalar(i,s,tu),d.vec3PairToQuaternion(iu,e,su),this._node.quaternion=su}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}}class ou extends It{get type(){return"PointLight"}constructor(e,t={}){super(e,t);const i=this;this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const s=this.scene.camera,r=this.scene.canvas;this._onCameraViewMatrix=s.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new lt({type:"point",pos:d.vec3([1,1,1]),color:d.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=d.identityMat4());const e=i._state.pos,t=s.look,r=s.up;d.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=d.identityMat4());const e=i.scene.canvas.canvas;d.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new it(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}function nu(e){if(!au(e.width)||!au(e.height)){const t=document.createElement("canvas");t.width=lu(e.width),t.height=lu(e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function au(e){return 0==(e&e-1)}function lu(e){--e;for(let t=1;t<32;t<<=1)e|=e>>t;return e+1}class Au extends R{get type(){return"CubeTexture"}constructor(e,t={}){super(e,t);const i=this.scene.canvas.gl;this._state=new lt({texture:new Vr({gl:i,target:i.TEXTURE_CUBE_MAP}),flipY:this._checkFlipY(t.minFilter),encoding:this._checkEncoding(t.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),this._src=t.src,this._images=[],this._loadSrc(t.src),m.memory.textures++}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}_loadSrc(e){const t=this,i=this.scene.canvas.gl;this._images=[];let s=!1,r=0;for(let o=0;o{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}}class du{constructor(e){this._eye=d.vec3(),this._look=d.vec3(),this._up=d.vec3(),this._projection={},e&&this.saveCamera(e)}saveCamera(e){const t=e.camera,i=t.project;switch(this._eye.set(t.eye),this._look.set(t.look),this._up.set(t.up),t.projection){case"perspective":this._projection={projection:"perspective",fov:i.fov,fovAxis:i.fovAxis,near:i.near,far:i.far};break;case"ortho":this._projection={projection:"ortho",scale:i.scale,near:i.near,far:i.far};break;case"frustum":this._projection={projection:"frustum",left:i.left,right:i.right,top:i.top,bottom:i.bottom,near:i.near,far:i.far};break;case"custom":this._projection={projection:"custom",matrix:i.matrix.slice()}}}restoreCamera(e,t){const i=e.camera,s=this._projection;function r(){switch(s.type){case"perspective":i.perspective.fov=s.fov,i.perspective.fovAxis=s.fovAxis,i.perspective.near=s.near,i.perspective.far=s.far;break;case"ortho":i.ortho.scale=s.scale,i.ortho.near=s.near,i.ortho.far=s.far;break;case"frustum":i.frustum.left=s.left,i.frustum.right=s.right,i.frustum.top=s.top,i.frustum.bottom=s.bottom,i.frustum.near=s.near,i.frustum.far=s.far;break;case"custom":i.customProjection.matrix=s.matrix}}t?e.viewer.cameraFlight.flyTo({eye:this._eye,look:this._look,up:this._up,orthoScale:s.scale,projection:s.projection},(()=>{r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}const pu=d.vec3();class fu{constructor(e){if(this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsOpacity=[],this.numObjects=0,e){const t=e.metaScene.scene;this.saveObjects(t,e)}}saveObjects(e,t,i){this.numObjects=0,this._mask=i?y.apply(i,{}):null;const s=!i||i.visible,r=!i||i.edges,o=!i||i.xrayed,n=!i||i.highlighted,a=!i||i.selected,l=!i||i.clippable,A=!i||i.pickable,h=!i||i.colorize,c=!i||i.opacity,u=t.metaObjects,d=e.objects;for(let e=0,t=u.length;e1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=d.vec3();return t[0]=d.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=d.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=d.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}}class vu extends jc{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=d.vec3();return t[0]=d.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=d.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=d.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}}class yu extends vc{constructor(e,t={}){super(e,t)}}class Bu extends R{constructor(e,t={}){super(e,t),this._skyboxMesh=new pr(this,{geometry:new Gt(this,{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Jt(this,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Kr(this,{src:t.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:t.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),this.size=t.size,this.active=t.active}set size(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}get size(){return this._size}set active(e){this._skyboxMesh.visible=e}get active(){return this._skyboxMesh.visible}}class wu{transcode(e,t,i={}){}destroy(){}}const xu=d.vec4(),Pu=d.vec4(),Cu=d.vec3(),Mu=d.vec3(),Fu=d.vec3(),Eu=d.vec4(),Iu=d.vec4(),Du=d.vec4();class Su{constructor(e){this._scene=e}dollyToCanvasPos(e,t,i){let s=!1;const r=this._scene.camera;if(e){const t=d.subVec3(e,r.eye,Cu);s=d.lenVec3(t){this._cameraDirty=!0})),this._onProjMatrix=this._scene.camera.on("projMatrix",(()=>{this._cameraDirty=!0})),this._onTick=this._scene.on("tick",(()=>{this.updatePivotElement(),this.updatePivotSphere()}))}createPivotSphere(){const e=this.getPivotPos(),t=d.vec3();d.decomposeMat4(d.inverseMat4(this._scene.viewer.camera.viewMatrix,d.mat4()),t,d.vec4(),d.vec3());const i=d.distVec3(t,e);let s=Math.tan(Math.PI/500)*i*this._pivotSphereSize;"ortho"==this._scene.camera.projection&&(s/=this._scene.camera.ortho.scale/2),X(e,this._rtcCenter,this._rtcPos),this._pivotSphereGeometry=new Zr(this._scene,mr({radius:s})),this._pivotSphere=new pr(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:!1,position:this._rtcPos,rtcCenter:this._rtcCenter})}destroyPivotSphere(){this._pivotSphere&&(this._pivotSphere.destroy(),this._pivotSphere=null),this._pivotSphereGeometry&&(this._pivotSphereGeometry.destroy(),this._pivotSphereGeometry=null)}updatePivotElement(){const e=this._scene.camera,t=this._scene.canvas;if(this._pivoting&&this._cameraDirty){d.transformPoint3(e.viewMatrix,this.getPivotPos(),this._pivotViewPos),this._pivotViewPos[3]=1,d.transformPoint4(e.projMatrix,this._pivotViewPos,this._pivotProjPos);const i=t.boundary,s=i[2],r=i[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*s/2),this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*r/2);let o=t._lastBoundingClientRect;if(!o||t._canvasSizeChanged){const e=t.canvas;o=t._lastBoundingClientRect=e.getBoundingClientRect()}this._pivotElement&&(this._pivotElement.style.left=Math.floor(o.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px",this._pivotElement.style.top=Math.floor(o.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px"),this._cameraDirty=!1}}updatePivotSphere(){this._pivoting&&this._pivotSphere&&(X(this.getPivotPos(),this._rtcCenter,this._rtcPos),d.compareVec3(this._rtcPos,this._pivotSphere.position)||(this.destroyPivotSphere(),this.createPivotSphere()))}setPivotElement(e){this._pivotElement=e}enablePivotSphere(e={}){this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);const t=e.color||[1,0,0];this._pivotSphereMaterial=new Jt(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}disablePivotSphere(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}startPivot(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;const e=this._scene.camera;let t=d.lookAtMat4v(e.eye,e.look,e.worldUp);d.transformPoint3(t,this.getPivotPos(),this._cameraOffset);const i=this.getPivotPos();this._cameraOffset[2]+=d.distVec3(e.eye,i),t=d.inverseMat4(t);const s=d.transformVec3(t,this._cameraOffset),r=d.vec3();if(d.subVec3(e.eye,i,r),d.addVec3(r,s),e.zUp){const e=r[1];r[1]=r[2],r[2]=e}this._radius=d.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}_cameraLookingDownwards(){const e=this._scene.camera,t=d.normalizeVec3(d.subVec3(e.look,e.eye,Tu)),i=d.cross3Vec3(t,e.worldUp,Ru);return d.sqLenVec3(i)<=1e-4}getPivoting(){return this._pivoting}setPivotPos(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}setCanvasPivotPos(e){const t=this._scene.camera,i=Math.abs(d.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),o=s.subarray(12),n=[0,0,-1,1],a=d.dotVec4(n,r)/d.dotVec4(n,o),l=Uu;t.project.unproject(e,a,ku,Ou,l);const A=d.normalizeVec3(d.subVec3(l,t.eye,Tu)),h=d.addVec3(t.eye,d.mulVec3Scalar(A,i,Ru),Lu);this.setPivotPos(h)}getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}continuePivot(e,t){if(!this._pivoting)return;if(0===e&&0===t)return;const i=this._scene.camera;var s=-e;const r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=d.clamp(this._polar,.001,Math.PI-.001);const o=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){const e=o[1];o[1]=o[2],o[2]=e}const n=d.lenVec3(d.subVec3(i.look,i.eye,d.vec3())),a=this.getPivotPos();d.addVec3(o,a);let l=d.lookAtMat4v(o,a,i.worldUp);l=d.inverseMat4(l);const A=d.transformVec3(l,this._cameraOffset);l[12]-=A[0],l[13]-=A[1],l[14]-=A[2];const h=[l[8],l[9],l[10]];i.eye=[l[12],l[13],l[14]],d.subVec3(i.eye,d.mulVec3Scalar(h,n),i.look),i.up=[l[4],l[5],l[6]],this.showPivot()}showPivot(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}hidePivot(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}endPivot(){this._pivoting=!1}destroy(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}class Qu{constructor(e,t){this._scene=e.scene,this._cameraControl=e,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=t,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=d.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}update(){if(!this._configs.pointerEnabled)return;if(!this.schedulePickEntity&&!this.schedulePickSurface)return;const e=`${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;if(this._lastHash===e)return;this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;const t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){const e=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});e&&(e.snappedToEdge||e.snappedToVertex)?(this.snapPickResult=e,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){const e=this.pickResult.canvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){const e=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}fireEvents(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){const e=new Re;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){const e=this.pickResult.entity.id;this._lastPickedEntityId!==e&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=e)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}const Vu=d.vec2();class Hu{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController;let n,a,l,A=0,h=0,c=0,u=0,p=!1;const f=d.vec3();let g=!0;const m=this._scene.canvas.canvas,_=[];function v(e=!0){m.style.cursor="move",A=s.pointerCanvasPos[0],h=s.pointerCanvasPos[1],c=s.pointerCanvasPos[0],u=s.pointerCanvasPos[1],e&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(p=!0,f.set(o.pickResult.worldPos)):p=!1)}document.addEventListener("keydown",this._documentKeyDownHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!0}),document.addEventListener("keyup",this._documentKeyUpHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!1}),m.addEventListener("mousedown",this._mouseDownHandler=t=>{if(i.active&&i.pointerEnabled)switch(t.which){case 1:_[e.input.KEY_SHIFT]||i.planView?(n=!0,v()):(n=!0,v(!1));break;case 2:a=!0,v();break;case 3:l=!0,i.panRightClick&&v()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(!n&&!a&&!l)return;const o=e.canvas.boundary,c=o[2],u=o[3],g=s.pointerCanvasPos[0],m=s.pointerCanvasPos[1],v=_[e.input.KEY_SHIFT]||i.planView||!i.panRightClick&&a||i.panRightClick&&l,b=document.pointerLockElement?t.movementX:g-A,y=document.pointerLockElement?t.movementY:m-h;if(v){const t=e.camera;if("perspective"===t.projection){const i=Math.abs(p?d.lenVec3(d.subVec3(f,e.camera.eye,[])):e.camera.eyeLookDist)*Math.tan(t.perspective.fov/2*Math.PI/180);r.panDeltaX+=1.5*b*i/u,r.panDeltaY+=1.5*y*i/u}else r.panDeltaX+=.5*t.ortho.scale*(b/u),r.panDeltaY+=.5*t.ortho.scale*(y/u)}else!n||a||l||i.planView||(i.firstPerson?(r.rotateDeltaY-=b/c*i.dragRotationRate/2,r.rotateDeltaX+=y/u*(i.dragRotationRate/4)):(r.rotateDeltaY-=b/c*(1.5*i.dragRotationRate),r.rotateDeltaX+=y/u*(1.5*i.dragRotationRate)));A=g,h=m}),m.addEventListener("mousemove",this._canvasMouseMoveHandler=e=>{i.active&&i.pointerEnabled&&s.mouseover&&(g=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{if(i.active&&i.pointerEnabled)switch(e.which){case 1:case 2:case 3:n=!1,a=!1,l=!1}}),m.addEventListener("mouseup",this._mouseUpHandler=e=>{if(i.active&&i.pointerEnabled){if(3===e.which){!function(e,t){if(e){let i=e.target,s=0,r=0,o=0,n=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,o+=i.scrollLeft,n+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+o-s,t[1]=e.pageY+n-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Vu);const i=Vu[0],s=Vu[1];Math.abs(i-c)<3&&Math.abs(s-u)<3&&t.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Vu,event:e},!0)}m.style.removeProperty("cursor")}}),m.addEventListener("mouseenter",this._mouseEnterHandler=()=>{i.active&&i.pointerEnabled});const b=1/60;let y=null;m.addEventListener("wheel",this._mouseWheelHandler=e=>{if(!i.active||!i.pointerEnabled)return;const t=performance.now()/1e3;var o=null!==y?t-y:0;y=t,o>.05&&(o=.05),o{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const n=r._isKeyDownForAction(r.AXIS_VIEW_RIGHT),a=r._isKeyDownForAction(r.AXIS_VIEW_BACK),l=r._isKeyDownForAction(r.AXIS_VIEW_LEFT),A=r._isKeyDownForAction(r.AXIS_VIEW_FRONT),h=r._isKeyDownForAction(r.AXIS_VIEW_TOP),c=r._isKeyDownForAction(r.AXIS_VIEW_BOTTOM);if(!(n||a||l||A||h||c))return;const u=e.aabb,p=d.getAABB3Diag(u);d.getAABB3Center(u,ju);const f=Math.abs(p/Math.tan(t.cameraFlight.fitFOV*d.DEGTORAD)),g=1.1*p;Xu.orthoScale=g,n?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldRight,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):a?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldForward,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):l?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldRight,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):A?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldForward,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):h?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldUp,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(d.normalizeVec3(d.mulVec3Scalar(o.worldForward,1,zu),Wu))):c&&(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldUp,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(d.normalizeVec3(d.mulVec3Scalar(o.worldForward,-1,zu)))),!i.firstPerson&&i.followPointer&&t.pivotController.setPivotPos(ju),t.cameraFlight.duration>0?t.cameraFlight.flyTo(Xu,(()=>{t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot()})):(t.cameraFlight.jumpTo(Xu),t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot())}))}reset(){}destroy(){this._scene.input.off(this._onSceneKeyDown)}}class Yu{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=t.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;let l=!1,A=!1;const h=this._scene.canvas.canvas,c=i=>{let s;i&&i.worldPos&&(s=i.worldPos);const r=i&&i.entity?i.entity.aabb:e.aabb;if(s){const i=e.camera;d.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})},u=e.tickify(this._canvasMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(l||A)return;const r=a.hasSubs("hover"),n=a.hasSubs("hoverEnter"),h=a.hasSubs("hoverOut"),c=a.hasSubs("hoverOff"),u=a.hasSubs("hoverSurface"),d=a.hasSubs("hoverSnapOrSurface");if(r||n||h||c||u||d)if(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=u,o.scheduleSnapOrPick=d,o.update(),o.pickResult){if(o.pickResult.entity){const t=o.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),a.fire("hoverEnter",o.pickResult,!0),this._lastPickedEntityId=t)}a.fire("hover",o.pickResult,!0),(o.pickResult.worldPos||o.pickResult.snappedWorldPos)&&a.fire("hoverSurface",o.pickResult,!0)}else void 0!==this._lastPickedEntityId&&(a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),a.fire("hoverOff",{canvasPos:o.pickCursorPos},!0)});h.addEventListener("mousemove",u),h.addEventListener("mousedown",this._canvasMouseDownHandler=t=>{1===t.which&&(l=!0),3===t.which&&(A=!0);if(1===t.which&&i.active&&i.pointerEnabled&&(s.mouseDownClientX=t.clientX,s.mouseDownClientY=t.clientY,s.mouseDownCursorX=s.pointerCanvasPos[0],s.mouseDownCursorY=s.pointerCanvasPos[1],!i.firstPerson&&i.followPointer&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),1===t.which))){const t=o.pickResult;t&&t.worldPos?(n.setPivotPos(t.worldPos),n.startPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),n.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{1===e.which&&(l=!1),3===e.which&&(A=!1),n.getPivoting()&&n.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=r=>{if(!i.active||!i.pointerEnabled)return;if(!(1===r.which))return;if(n.hidePivot(),Math.abs(r.clientX-s.mouseDownClientX)>3||Math.abs(r.clientY-s.mouseDownClientY)>3)return;const l=a.hasSubs("picked"),A=a.hasSubs("pickedNothing"),h=a.hasSubs("pickedSurface"),u=a.hasSubs("doublePicked"),p=a.hasSubs("doublePickedSurface"),f=a.hasSubs("doublePickedNothing");if(!(i.doublePickFlyTo||u||p||f))return(l||A||h)&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=h,o.update(),o.pickResult?(a.fire("picked",o.pickResult,!0),o.pickedSurface&&a.fire("pickedSurface",o.pickResult,!0)):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0)),void(this._clicks=0);if(this._clicks++,1===this._clicks){o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo,o.schedulePickSurface=h,o.update();const e=o.pickResult,r=o.pickedSurface;this._timeout=setTimeout((()=>{e?(a.fire("picked",e,!0),r&&(a.fire("pickedSurface",e,!0),!i.firstPerson&&i.followPointer&&(t.pivotController.setPivotPos(e.worldPos),t.pivotController.startPivot()&&t.pivotController.showPivot()))):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0),this._clicks=0}),i.doubleClickTimeFrame)}else{if(null!==this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo||u||p,o.schedulePickSurface=o.schedulePickEntity&&p,o.update(),o.pickResult){if(a.fire("doublePicked",o.pickResult,!0),o.pickedSurface&&a.fire("doublePickedSurface",o.pickResult,!0),i.doublePickFlyTo&&(c(o.pickResult),!i.firstPerson&&i.followPointer)){const e=o.pickResult.entity.aabb,i=d.getAABB3Center(e);t.pivotController.setPivotPos(i),t.pivotController.startPivot()&&t.pivotController.showPivot()}}else if(a.fire("doublePickedNothing",{canvasPos:s.pointerCanvasPos},!0),i.doublePickFlyTo&&(c(),!i.firstPerson&&i.followPointer)){const i=e.aabb,s=d.getAABB3Center(i);t.pivotController.setPivotPos(s),t.pivotController.startPivot()&&t.pivotController.showPivot()}this._clicks=0}},!1)}reset(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}destroy(){const e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}class Zu{constructor(e,t,i,s,r){this._scene=e;const o=e.input,n=[],a=e.canvas.canvas;let l=!0;this._onSceneMouseMove=o.on("mousemove",(()=>{l=!0})),this._onSceneKeyDown=o.on("keydown",(t=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&s.mouseover&&(n[t]=!0,t===o.KEY_SHIFT&&(a.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(s=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&(n[s]=!1,s===o.KEY_SHIFT&&(a.style.cursor=null),t.pivotController.getPivoting()&&t.pivotController.endPivot())})),this._onTick=e.on("tick",(a=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const A=t.cameraControl,h=a.deltaTime/1e3;if(!i.planView){const e=A._isKeyDownForAction(A.ROTATE_Y_POS,n),s=A._isKeyDownForAction(A.ROTATE_Y_NEG,n),o=A._isKeyDownForAction(A.ROTATE_X_POS,n),a=A._isKeyDownForAction(A.ROTATE_X_NEG,n),l=h*i.keyboardRotationRate;(e||s||o||a)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),e?r.rotateDeltaY+=l:s&&(r.rotateDeltaY-=l),o?r.rotateDeltaX+=l:a&&(r.rotateDeltaX-=l),!i.firstPerson&&i.followPointer&&t.pivotController.startPivot())}if(!n[o.KEY_CTRL]&&!n[o.KEY_ALT]){const e=A._isKeyDownForAction(A.DOLLY_BACKWARDS,n),o=A._isKeyDownForAction(A.DOLLY_FORWARDS,n);if(e||o){const n=h*i.keyboardDollyRate;!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),o?r.dollyDelta-=n:e&&(r.dollyDelta+=n),l&&(s.followPointerDirty=!0,l=!1)}}const c=A._isKeyDownForAction(A.PAN_FORWARDS,n),u=A._isKeyDownForAction(A.PAN_BACKWARDS,n),d=A._isKeyDownForAction(A.PAN_LEFT,n),p=A._isKeyDownForAction(A.PAN_RIGHT,n),f=A._isKeyDownForAction(A.PAN_UP,n),g=A._isKeyDownForAction(A.PAN_DOWN,n),m=(n[o.KEY_ALT]?.3:1)*h*i.keyboardPanRate;(c||u||d||p||f||g)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),g?r.panDeltaY+=m:f&&(r.panDeltaY+=-m),p?r.panDeltaX+=-m:d&&(r.panDeltaX+=m),u?r.panDeltaZ+=m:c&&(r.panDeltaZ+=-m))}))}reset(){}destroy(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}const qu=d.vec3();class $u{constructor(e,t,i,s,r){this._scene=e;const o=e.camera,n=t.pickController,a=t.pivotController,l=t.panController;let A=1,h=1,c=null;this._onTick=e.on("tick",(()=>{if(!i.active||!i.pointerEnabled)return;let t="default";if(Math.abs(r.dollyDelta)<.001&&(r.dollyDelta=0),Math.abs(r.rotateDeltaX)<.001&&(r.rotateDeltaX=0),Math.abs(r.rotateDeltaY)<.001&&(r.rotateDeltaY=0),0===r.rotateDeltaX&&0===r.rotateDeltaY||(r.dollyDelta=0),i.followPointer){if(--A<=0&&(A=1,0!==r.dollyDelta)){if(0===r.rotateDeltaY&&0===r.rotateDeltaX&&i.followPointer&&s.followPointerDirty&&(n.pickCursorPos=s.pointerCanvasPos,n.schedulePickSurface=!0,n.update(),n.pickResult&&n.pickResult.worldPos?c=n.pickResult.worldPos:(h=1,c=null),s.followPointerDirty=!1),c){const t=Math.abs(d.lenVec3(d.subVec3(c,e.camera.eye,qu)));h=t/i.dollyProximityThreshold}h{s.mouseover=!0}),o.addEventListener("mouseleave",this._mouseLeaveHandler=()=>{s.mouseover=!1,o.style.cursor=null}),document.addEventListener("mousemove",this._mouseMoveHandler=e=>{td(e,o,s.pointerCanvasPos)}),o.addEventListener("mousedown",this._mouseDownHandler=e=>{i.active&&i.pointerEnabled&&(td(e,o,s.pointerCanvasPos),s.mouseover=!0)}),o.addEventListener("mouseup",this._mouseUpHandler=e=>{i.active&&i.pointerEnabled})}reset(){}destroy(){const e=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler),e.removeEventListener("mouseenter",this._mouseEnterHandler),e.removeEventListener("mouseleave",this._mouseLeaveHandler),e.removeEventListener("mousedown",this._mouseDownHandler),e.removeEventListener("mouseup",this._mouseUpHandler)}}function td(e,t,i){if(e){const{left:s,top:r}=t.getBoundingClientRect();i[0]=e.clientX-s,i[1]=e.clientY-r}else e=window.event,i[0]=e.x,i[1]=e.y;return i}const id=function(e,t){if(e){let i=e.target,s=0,r=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t};class sd{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=d.vec2(),l=d.vec2(),A=d.vec2(),h=d.vec2(),c=[],u=this._scene.canvas.canvas;let p=0,f=!1;this._onTick=e.on("tick",(()=>{f=!1})),u.addEventListener("touchstart",this._canvasTouchStartHandler=t=>{if(!i.active||!i.pointerEnabled)return;t.preventDefault();const r=t.touches,l=t.changedTouches;for(s.touchStartTime=Date.now(),1===r.length&&1===l.length&&(id(r[0],a),i.followPointer&&(o.pickCursorPos=a,o.schedulePickSurface=!0,o.update(),i.planView||(o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(n.setPivotPos(o.pickResult.worldPos),!i.firstPerson&&n.startPivot()&&n.showPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),!i.firstPerson&&n.startPivot()&&n.showPivot()))));c.length{n.getPivoting()&&n.endPivot()}),u.addEventListener("touchmove",this._canvasTouchMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(t.stopPropagation(),t.preventDefault(),f)return;f=!0;const n=e.canvas.boundary,a=n[2],u=n[3],g=t.touches;if(t.touches.length===p){if(1===p){id(g[0],l),d.subVec2(l,c[0],h);const t=h[0],o=h[1];if(null!==s.longTouchTimeout&&(Math.abs(t)>i.longTapRadius||Math.abs(o)>i.longTapRadius)&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),i.planView){const s=e.camera;if("perspective"===s.projection){const n=Math.abs(e.camera.eyeLookDist)*Math.tan(s.perspective.fov/2*Math.PI/180);r.panDeltaX+=t*n/u*i.touchPanRate,r.panDeltaY+=o*n/u*i.touchPanRate}else r.panDeltaX+=.5*s.ortho.scale*(t/u)*i.touchPanRate,r.panDeltaY+=.5*s.ortho.scale*(o/u)*i.touchPanRate}else r.rotateDeltaY-=t/a*(1*i.dragRotationRate),r.rotateDeltaX+=o/u*(1.5*i.dragRotationRate)}else if(2===p){const t=g[0],n=g[1];id(t,l),id(n,A);const a=d.geometricMeanVec2(c[0],c[1]),h=d.geometricMeanVec2(l,A),p=d.vec2();d.subVec2(a,h,p);const f=p[0],m=p[1],_=e.camera,v=d.distVec2([t.pageX,t.pageY],[n.pageX,n.pageY]),b=(d.distVec2(c[0],c[1])-v)*i.touchDollyRate;if(r.dollyDelta=b,Math.abs(b)<1)if("perspective"===_.projection){const t=o.pickResult?o.pickResult.worldPos:e.center,s=Math.abs(d.lenVec3(d.subVec3(t,e.camera.eye,[])))*Math.tan(_.perspective.fov/2*Math.PI/180);r.panDeltaX-=f*s/u*i.touchPanRate,r.panDeltaY-=m*s/u*i.touchPanRate}else r.panDeltaX-=.5*_.ortho.scale*(f/u)*i.touchPanRate,r.panDeltaY-=.5*_.ortho.scale*(m/u)*i.touchPanRate;s.pointerCanvasPos=h}for(let e=0;e{let s;i&&i.worldPos&&(s=i.worldPos);const r=i?i.entity.aabb:e.aabb;if(s){const i=e.camera;d.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})};u.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{if(!i.active||!i.pointerEnabled)return;null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null);const r=e.touches,o=e.changedTouches;if(a=Date.now(),1===r.length&&1===o.length){h=a,rd(r[0],A);const o=A[0],n=A[1],l=r[0].pageX,c=r[0].pageY;s.longTouchTimeout=setTimeout((()=>{t.cameraControl.fire("rightClick",{pagePos:[Math.round(l),Math.round(c)],canvasPos:[Math.round(o),Math.round(n)],event:e},!0),s.longTouchTimeout=null}),i.longTapTimeout)}else h=-1;for(;l.length{if(!i.active||!i.pointerEnabled)return;const t=Date.now(),r=e.touches,a=e.changedTouches,u=n.hasSubs("pickedSurface");null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),0===r.length&&1===a.length&&h>-1&&t-h<150&&(c>-1&&h-c<325?(rd(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=u,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("doublePicked",o.pickResult),o.pickedSurface&&n.fire("doublePickedSurface",o.pickResult),i.doublePickFlyTo&&p(o.pickResult)):(n.fire("doublePickedNothing"),i.doublePickFlyTo&&p()),c=-1):d.distVec2(l[0],A)<4&&(rd(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=u,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("picked",o.pickResult),o.pickedSurface&&n.fire("pickedSurface",o.pickResult)):n.fire("pickedNothing"),c=t),h=-1),l.length=r.length;for(let e=0,t=r.length;e{e.preventDefault()},this._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},this._states={pointerCanvasPos:d.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:d.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},this._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};const i=this.scene;this._controllers={cameraControl:this,pickController:new Qu(this,this._configs),pivotController:new Nu(i,this._configs),panController:new Su(i),cameraFlight:new qc(this,{duration:.5})},this._handlers=[new ed(this.scene,this._controllers,this._configs,this._states,this._updates),new sd(this.scene,this._controllers,this._configs,this._states,this._updates),new Hu(this.scene,this._controllers,this._configs,this._states,this._updates),new Ju(this.scene,this._controllers,this._configs,this._states,this._updates),new Yu(this.scene,this._controllers,this._configs,this._states,this._updates),new od(this.scene,this._controllers,this._configs,this._states,this._updates),new Zu(this.scene,this._controllers,this._configs,this._states,this._updates)],this._cameraUpdater=new $u(this.scene,this._controllers,this._configs,this._states,this._updates),this.navMode=t.navMode,t.planView&&(this.planView=t.planView),this.constrainVertical=t.constrainVertical,t.keyboardLayout?this.keyboardLayout=t.keyboardLayout:this.keyMap=t.keyMap,this.doublePickFlyTo=t.doublePickFlyTo,this.panRightClick=t.panRightClick,this.active=t.active,this.followPointer=t.followPointer,this.rotationInertia=t.rotationInertia,this.keyboardPanRate=t.keyboardPanRate,this.touchPanRate=t.touchPanRate,this.keyboardRotationRate=t.keyboardRotationRate,this.dragRotationRate=t.dragRotationRate,this.touchDollyRate=t.touchDollyRate,this.dollyInertia=t.dollyInertia,this.dollyProximityThreshold=t.dollyProximityThreshold,this.dollyMinSpeed=t.dollyMinSpeed,this.panInertia=t.panInertia,this.pointerEnabled=!0,this.keyboardDollyRate=t.keyboardDollyRate,this.mouseWheelDollyRate=t.mouseWheelDollyRate}set keyMap(e){if(e=e||"qwerty",y.isString(e)){const t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{const t=e;this._keyMap=t}}get keyMap(){return this._keyMap}_isKeyDownForAction(e,t){const i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(let e=0,s=i.length;e0?ud(t):null,n=i&&i.length>0?ud(i):null,a=e=>{if(!e)return;var t=!0;(n&&n[e.type]||o&&!o[e.type])&&(t=!1),t&&s.push(e.id);const i=e.children;if(i)for(var r=0,l=i.length;r>t;i.sort($h);const s=new Int32Array(e.length);for(let t=0,r=i.length;te[t+1]){let i=e[t];e[t]=e[t+1],e[t+1]=i}ec=new Int32Array(e),t.sort(tc);const i=new Int32Array(e.length);for(let s=0,r=t.length;st){let i=e;e=t,t=i}function i(i,s){return i!==e?e-i:s!==t?t-s:0}let s=0,r=(o.length>>1)-1;for(;s<=r;){const e=r+s>>1,t=i(o[2*e],o[2*e+1]);if(t>0)s=e+1;else{if(!(t<0))return e;r=e-1}}return-s-1}const a=new Int32Array(o.length/2);a.fill(0);const l=s.length/3;if(l>8*(1<u.maxNumPositions&&(u=c()),u.bucketNumber>8)return[e];let p;-1===A[l]&&(A[l]=u.numPositions++,u.positionsCompressed.push(s[3*l]),u.positionsCompressed.push(s[3*l+1]),u.positionsCompressed.push(s[3*l+2])),-1===A[h]&&(A[h]=u.numPositions++,u.positionsCompressed.push(s[3*h]),u.positionsCompressed.push(s[3*h+1]),u.positionsCompressed.push(s[3*h+2])),-1===A[d]&&(A[d]=u.numPositions++,u.positionsCompressed.push(s[3*d]),u.positionsCompressed.push(s[3*d+1]),u.positionsCompressed.push(s[3*d+2])),u.indices.push(A[l]),u.indices.push(A[h]),u.indices.push(A[d]),(p=n(l,h))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(l,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]])),(p=n(h,d))>=0&&0===a[p]&&(a[p]=1,u.edgeIndices.push(A[o[2*p]]),u.edgeIndices.push(A[o[2*p+1]]))}const d=t/8*2,p=t/8,f=2*s.length+(r.length+o.length)*d;let g=0,m=-s.length/3;return h.forEach((e=>{g+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*p,m+=e.positionsCompressed.length/3})),g>f?[e]:(i&&function(e,t){const i={},s={};let r=0;e.forEach((e=>{const t=e.indices,o=e.edgeIndices,n=e.positionsCompressed;for(let e=0,s=t.length;e0){const e=t._meshes;for(let t=0,i=e.length;t0){const e=this._meshes;for(let t=0,i=e.length;t{this._viewMatrixDirty=!0})),this._meshesWithDirtyMatrices=[],this._numMeshesWithDirtyMatrices=0,this._onTick=this.scene.on("tick",(()=>{for(;this._numMeshesWithDirtyMatrices>0;)this._meshesWithDirtyMatrices[--this._numMeshesWithDirtyMatrices]._updateMatrix()})),this._createDefaultTextureSet(),this.visible=t.visible,this.culled=t.culled,this.pickable=t.pickable,this.clippable=t.clippable,this.collidable=t.collidable,this.castsShadow=t.castsShadow,this.receivesShadow=t.receivesShadow,this.xrayed=t.xrayed,this.highlighted=t.highlighted,this.selected=t.selected,this.edges=t.edges,this.colorize=t.colorize,this.opacity=t.opacity,this.backfaces=t.backfaces}_meshMatrixDirty(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}_createDefaultTextureSet(){const e=new Uh({id:"defaultColorTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new Uh({id:"defaultMetalRoughTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new Uh({id:"defaultNormalsTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new Uh({id:"defaultEmissiveTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new Uh({id:"defaultOcclusionTexture",texture:new Vr({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new Lh({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}get isPerformanceModel(){return!0}get transforms(){return this._transforms}get textures(){return this._textures}get textureSets(){return this._textureSets}get meshes(){return this._meshes}get objects(){return this._entities}get origin(){return this._origin}set position(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get position(){return this._position}set rotation(e){this._rotation.set(e||[0,0,0]),d.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get rotation(){return this._rotation}set quaternion(e){this._quaternion.set(e||[0,0,0,1]),d.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get quaternion(){return this._quaternion}set scale(e){}get scale(){return this._scale}set matrix(e){this._matrix.set(e||mc),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),d.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),d.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}get matrix(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix}get rotationMatrix(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}_rebuildMatrices(){this._matrixDirty&&(d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),d.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),d.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),d.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}get rotationMatrixConjugate(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}_setWorldMatrixDirty(){this._matrixDirty=!0,this._aabbDirty=!0}_transformDirty(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}_sceneModelDirty(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(let e=0,t=this._entityList.length;e0}set visible(e){e=!1!==e,this._visible=e;for(let t=0,i=this._entityList.length;t0}set xrayed(e){e=!!e,this._xrayed=e;for(let t=0,i=this._entityList.length;t0}set highlighted(e){e=!!e,this._highlighted=e;for(let t=0,i=this._entityList.length;t0}set selected(e){e=!!e,this._selected=e;for(let t=0,i=this._entityList.length;t0}set edges(e){e=!!e,this._edges=e;for(let t=0,i=this._entityList.length;t0}set pickable(e){e=!1!==e,this._pickable=e;for(let t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){const t=e.colors,i=new Uint8Array(t.length);for(let e=0,s=t.length;e{l.setImage(A,{minFilter:i,magFilter:s,wrapS:r,wrapT:o,wrapR:n,flipY:e.flipY,encoding:a}),this.glRedraw()},A.src=e.src;break;default:this._textureTranscoder?y.loadArraybuffer(e.src,(e=>{e.byteLength?this._textureTranscoder.transcode([e],l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'src': file data is zero length")}),(function(e){this.error(`[createTexture] Can't create texture from 'src': ${e}`)})):this.error(`[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('${t}')`)}}else e.buffers&&(this._textureTranscoder?this._textureTranscoder.transcode(e.buffers,l).then((()=>{this.glRedraw()})):this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option"));this._textures[t]=new Uh({id:t,texture:l})}createTextureSet(e){const t=e.id;if(null==t)return void this.error("[createTextureSet] Config missing: id");if(this._textureSets[t])return void this.error(`[createTextureSet] Texture set already created: ${t}`);let i,s,r,o,n;if(void 0!==e.colorTextureId&&null!==e.colorTextureId){if(i=this._textures[e.colorTextureId],!i)return void this.error(`[createTextureSet] Texture not found: ${e.colorTextureId} - ensure that you create it first with createTexture()`)}else i=this._textures.defaultColorTexture;if(void 0!==e.metallicRoughnessTextureId&&null!==e.metallicRoughnessTextureId){if(s=this._textures[e.metallicRoughnessTextureId],!s)return void this.error(`[createTextureSet] Texture not found: ${e.metallicRoughnessTextureId} - ensure that you create it first with createTexture()`)}else s=this._textures.defaultMetalRoughTexture;if(void 0!==e.normalsTextureId&&null!==e.normalsTextureId){if(r=this._textures[e.normalsTextureId],!r)return void this.error(`[createTextureSet] Texture not found: ${e.normalsTextureId} - ensure that you create it first with createTexture()`)}else r=this._textures.defaultNormalsTexture;if(void 0!==e.emissiveTextureId&&null!==e.emissiveTextureId){if(o=this._textures[e.emissiveTextureId],!o)return void this.error(`[createTextureSet] Texture not found: ${e.emissiveTextureId} - ensure that you create it first with createTexture()`)}else o=this._textures.defaultEmissiveTexture;if(void 0!==e.occlusionTextureId&&null!==e.occlusionTextureId){if(n=this._textures[e.occlusionTextureId],!n)return void this.error(`[createTextureSet] Texture not found: ${e.occlusionTextureId} - ensure that you create it first with createTexture()`)}else n=this._textures.defaultOcclusionTexture;const a=new Lh({id:t,model:this,colorTexture:i,metallicRoughnessTexture:s,normalsTexture:r,emissiveTexture:o,occlusionTexture:n});return this._textureSets[t]=a,a}createTransform(e){if(void 0===e.id||null===e.id)return void this.error("[createTransform] SceneModel.createTransform() config missing: id");if(this._transforms[e.id])return void this.error(`[createTransform] SceneModel already has a transform with this ID: ${e.id}`);let t;if(e.parentTransformId&&(t=this._transforms[e.parentTransformId],!t))return void this.error("[createTransform] SceneModel.createTransform() config missing: id");const i=new hc({id:e.id,model:this,parent:t,matrix:e.matrix,position:e.position,scale:e.scale,rotation:e.rotation,quaternion:e.quaternion});return this._transforms[i.id]=i,i}createMesh(e){if(void 0===e.id||null===e.id)return this.error("[createMesh] SceneModel.createMesh() config missing: id"),!1;if(this._meshes[e.id])return this.error(`[createMesh] SceneModel already has a mesh with this ID: ${e.id}`),!1;if(!(void 0!==e.geometryId)){if(void 0!==e.primitive&&null!==e.primitive||(e.primitive="triangles"),"points"!==e.primitive&&"lines"!==e.primitive&&"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)return this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`),!1;if(!e.positions&&!e.positionsCompressed&&!e.buckets)return this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)"),!1;if(e.positions&&(e.positionsDecodeMatrix||e.positionsDecodeBoundary))return this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.positionsCompressed&&!e.positionsDecodeMatrix&&!e.positionsDecodeBoundary)return this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)"),!1;if(e.uvCompressed&&!e.uvDecodeMatrix)return this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)"),!1;if(!(e.buckets||e.indices||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive)){const t=(e.positions||e.positionsCompressed).length/3;e.indices=this._createDefaultIndices(t)}if(!e.buckets&&!e.indices&&"points"!==e.primitive)return e.indices=this._createDefaultIndices(numIndices),this.error(`Param expected: indices (required for '${e.primitive}' primitive type)`),!1;if((e.matrix||e.position||e.rotation||e.scale)&&(e.positionsCompressed||e.positionsDecodeBoundary))return this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'"),!1;const t=!(!this._dtxEnabled||"triangles"!==e.primitive&&"solid"!==e.primitive&&"surface"!==e.primitive||e.textureSetId);if(e.origin=e.origin?d.addVec3(this._origin,e.origin,d.vec3()):this._origin,e.matrix)e.meshMatrix=e.matrix;else if(e.scale||e.rotation||e.position){const t=e.scale||dc,i=e.position||pc,s=e.rotation||fc;d.eulerToQuaternion(s,"XYZ",gc),e.meshMatrix=d.composeMat4(i,gc,t,d.mat4())}if(e.positionsDecodeBoundary&&(e.positionsDecodeMatrix=hn(e.positionsDecodeBoundary,d.mat4())),t){if(e.type=2,e.color=e.color?new Uint8Array([Math.floor(255*e.color[0]),Math.floor(255*e.color[1]),Math.floor(255*e.color[2])]):_c,e.opacity=void 0!==e.opacity&&null!==e.opacity?Math.floor(255*e.opacity):255,e.positions){const t=d.vec3(),i=[];J(e.positions,i,t)&&(e.positions=i,e.origin=d.addVec3(e.origin,t,t))}if(e.positions){const t=d.collapseAABB3();e.positionsDecodeMatrix=d.mat4(),d.expandAABB3Points3(t,e.positions),e.positionsCompressed=An(e.positions,t,e.positionsDecodeMatrix),e.aabb=t}else if(e.positionsCompressed){const t=d.collapseAABB3();d.expandAABB3Points3(t,e.positionsCompressed),Vt.decompressAABB(t,e.positionsDecodeMatrix),e.aabb=t}if(e.buckets){const t=d.collapseAABB3();for(let i=0,s=e.buckets.length;i>24&255,r=i>>16&255,o=i>>8&255,n=255&i;switch(e.pickColor=new Uint8Array([n,o,r,s]),e.solid="solid"===e.primitive,t.origin=d.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}_getNumPrimitives(e){let t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(let i=0,s=e.buckets.length;i>>0).toString(16)}_getVBOInstancingLayer(e){const t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,o=`${Math.round(i[0])}.${Math.round(i[1])}.${Math.round(i[2])}.${s}.${r}`;let n=this._vboInstancingLayers[o];if(n)return n;let a=e.textureSet;const l=e.geometry;for(;!n;)switch(l.primitive){case"triangles":case"surface":n=new pa({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":n=new pa({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":n=new $a({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":n=new Wl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[o]=n,this.layerList.push(n),n}createEntity(e){if(void 0===e.id?e.id=d.createUUID():this.scene.components[e.id]&&(this.error(`Scene already has a Component with this ID: ${e.id} - will assign random ID`),e.id=d.createUUID()),void 0===e.meshIds)return void this.error("Config missing: meshIds");let t=0;this._visible&&!1!==e.visible&&(t|=q),this._pickable&&!1!==e.pickable&&(t|=ee),this._culled&&!1!==e.culled&&(t|=$),this._clippable&&!1!==e.clippable&&(t|=te),this._collidable&&!1!==e.collidable&&(t|=ie),this._edges&&!1!==e.edges&&(t|=ne),this._xrayed&&!1!==e.xrayed&&(t|=se),this._highlighted&&!1!==e.highlighted&&(t|=re),this._selected&&!1!==e.selected&&(t|=oe),e.flags=t,this._createEntity(e)}_createEntity(e){let t=[];for(let i=0,s=e.meshIds.length;ie.sortIdt.sortId?1:0));for(let e=0,t=this.layerList.length;e0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}_updateRenderFlagsVisibleLayers(){const e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(let t=0,i=this.layerList.length;t0){const t=`${this.id}-dummyEntityForUnusedMeshes`;this.warn(`Creating dummy SceneModelEntity "${t}" for unused SceneMeshes: [${e.join(",")}]`),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}_getActiveSectionPlanesForLayer(e){const t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(let e=0;e0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){const t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0){this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0))}if(this.numSelectedLayerPortions>0){const t=this.scene.selectedMaterial._state;t.fill&&(t.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){const t=this.scene.highlightMaterial._state;t.fill&&(t.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}drawColorOpaque(e){const t=this.renderFlags;for(let i=0,s=t.visibleLayers.length;i65536?16:8)}else n=[{positionsCompressed:s,indices:r,edgeIndices:o}];return n}class yc extends R{constructor(e,t={}){if(super(e,t),this._positions=t.positions||[],t.indices)this._indices=t.indices;else{this._indices=[];for(let e=0,t=this._positions.length/3-1;ep.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,B=v.filter((e=>!b[e])),w=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=Fc(e.location,Bc),i=Fc(e.direction,Bc);A&&d.negateVec3(i),d.subVec3(t,l),r.yUp&&(t=Ic(t),i=Ic(i)),new yr(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new yc(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=Fc(e.location,wc),n=Fc(e.normal,xc),a=Fc(e.up,Pc),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=Ic(o),n=Ic(n),a=Ic(a)),new lo(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,c;if(e.perspective_camera?(a=Fc(e.perspective_camera.camera_view_point,Bc),A=Fc(e.perspective_camera.camera_direction,Bc),h=Fc(e.perspective_camera.camera_up_vector,Bc),r.perspective.fov=e.perspective_camera.field_of_view,c="perspective"):(a=Fc(e.orthogonal_camera.camera_view_point,Bc),A=Fc(e.orthogonal_camera.camera_direction,Bc),h=Fc(e.orthogonal_camera.camera_up_vector,Bc),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,c="ortho"),d.subVec3(a,l),r.yUp&&(a=Ic(a),A=Ic(A),h=Ic(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:d.addVec3(a,A,Bc)}else A=d.addVec3(a,A,Bc);n?(r.eye=a,r.look=A,r.up=h,r.projection=c):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:c})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=d.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}}function Mc(e){return{x:e[0],y:e[1],z:e[2]}}function Fc(e,t){return(t=new Float64Array(3))[0]=e.x,t[1]=e.y,t[2]=e.z,t}function Ec(e){return new Float64Array([e[0],-e[2],e[1]])}function Ic(e){return new Float64Array([e[0],e[2],-e[1]])}const Dc=d.vec3(),Sc=(e,t,i,s)=>{var r=e-i,o=t-s;return Math.sqrt(r*r+o*o)};class Tc extends R{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={};var i=this.plugin.viewer.scene;this._originMarker=new ue(i,t.origin),this._targetMarker=new ue(i,t.target),this._originWorld=d.vec3(),this._targetWorld=d.vec3(),this._wp=new Float64Array(24),this._vp=new Float64Array(24),this._pp=new Float64Array(24),this._cp=new Float64Array(8),this._xAxisLabelCulled=!1,this._yAxisLabelCulled=!1,this._zAxisLabelCulled=!1,this._color=t.color||this.plugin.defaultColor;const s=t.onMouseOver?e=>{t.onMouseOver(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,r=t.onMouseLeave?e=>{t.onMouseLeave(e,this),this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,o=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},n=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},a=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},l=t.onContextMenu?e=>{t.onContextMenu(e,this)}:null,A=e=>{this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};this._originDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._targetDot=new pe(this._container,{fillColor:this._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthWire=new de(this._container,{color:this._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisWire=new de(this._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisWire=new de(this._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisWire=new de(this._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._lengthLabel=new fe(this._container,{fillColor:this._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._xAxisLabel=new fe(this._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._yAxisLabel=new fe(this._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._zAxisLabel=new fe(this._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:s,onMouseLeave:r,onMouseWheel:A,onMouseDown:o,onMouseUp:n,onMouseMove:a,onContextMenu:l}),this._wpDirty=!1,this._vpDirty=!1,this._cpDirty=!1,this._sectionPlanesDirty=!0,this._visible=!1,this._originVisible=!1,this._targetVisible=!1,this._wireVisible=!1,this._axisVisible=!1,this._xAxisVisible=!1,this._yAxisVisible=!1,this._zAxisVisible=!1,this._axisEnabled=!0,this._labelsVisible=!1,this._labelsOnWires=!1,this._clickable=!1,this._originMarker.on("worldPos",(e=>{this._originWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._targetMarker.on("worldPos",(e=>{this._targetWorld.set(e||[0,0,0]),this._wpDirty=!0,this._needUpdate(0)})),this._onViewMatrix=i.camera.on("viewMatrix",(()=>{this._vpDirty=!0,this._needUpdate(0)})),this._onProjMatrix=i.camera.on("projMatrix",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onCanvasBoundary=i.canvas.on("boundary",(()=>{this._cpDirty=!0,this._needUpdate(0)})),this._onMetricsUnits=i.metrics.on("units",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsScale=i.metrics.on("scale",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onMetricsOrigin=i.metrics.on("origin",(()=>{this._cpDirty=!0,this._needUpdate()})),this._onSectionPlaneUpdated=i.on("sectionPlaneUpdated",(()=>{this._sectionPlanesDirty=!0,this._needUpdate()})),this.approximate=t.approximate,this.visible=t.visible,this.originVisible=t.originVisible,this.targetVisible=t.targetVisible,this.wireVisible=t.wireVisible,this.axisVisible=t.axisVisible,this.xAxisVisible=t.xAxisVisible,this.yAxisVisible=t.yAxisVisible,this.zAxisVisible=t.zAxisVisible,this.labelsVisible=t.labelsVisible,this.labelsOnWires=t.labelsOnWires}_update(){if(!this._visible)return;const e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&(d.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}const t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){d.transformPositions4(e.camera.project.matrix,this._vp,this._pp);var s=this._pp,r=this._cp,o=e.canvas.canvas.getBoundingClientRect();const t=this._container.getBoundingClientRect();var n=o.top-t.top,a=o.left-t.left,l=e.canvas.boundary,A=l[2],h=l[3],c=0;const i=this.plugin.viewer.scene.metrics,f=i.scale,g=i.units,m=i.unitsInfo[g].abbrev;for(var u=0,p=s.length;ue.offsetTop+(e.offsetParent&&e.offsetParent!==s.parentNode&&h(e.offsetParent)),c=e=>e.offsetLeft+(e.offsetParent&&e.offsetParent!==s.parentNode&&c(e.offsetParent)),u=d.vec2();this._onCameraControlHoverSnapOrSurface=i.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(e=>{const t=e.snappedCanvasPos||e.canvasPos;r=!0,o.set(e.worldPos),n.set(e.canvasPos),0===this._mouseState?(this._canvasToPagePos?(this._canvasToPagePos(s,t,u),this._markerDiv.style.left=u[0]-5+"px",this._markerDiv.style.top=u[1]-5+"px"):(this._markerDiv.style.left=c(s)+t[0]-5+"px",this._markerDiv.style.top=h(s)+t[1]-5+"px"),this._markerDiv.style.background="pink",e.snappedToVertex||e.snappedToEdge?(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos,this.pointerLens.snapped=!0),this._markerDiv.style.background="greenyellow",this._markerDiv.style.border="2px solid green"):(this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.canvasPos,this.pointerLens.snapped=!1),this._markerDiv.style.background="pink",this._markerDiv.style.border="2px solid red"),A=e.entity):(this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px"),s.style.cursor="pointer",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=this._currentDistanceMeasurementInitState.wireVisible,this._currentDistanceMeasurement.axisVisible=this._currentDistanceMeasurementInitState.axisVisible&&this.distanceMeasurementsPlugin.defaultAxisVisible,this._currentDistanceMeasurement.xAxisVisible=this._currentDistanceMeasurementInitState.xAxisVisible&&this.distanceMeasurementsPlugin.defaultXAxisVisible,this._currentDistanceMeasurement.yAxisVisible=this._currentDistanceMeasurementInitState.yAxisVisible&&this.distanceMeasurementsPlugin.defaultYAxisVisible,this._currentDistanceMeasurement.zAxisVisible=this._currentDistanceMeasurementInitState.zAxisVisible&&this.distanceMeasurementsPlugin.defaultZAxisVisible,this._currentDistanceMeasurement.targetVisible=this._currentDistanceMeasurementInitState.targetVisible,this._currentDistanceMeasurement.target.worldPos=o.slice(),this._markerDiv.style.left="-10000px",this._markerDiv.style.top="-10000px")})),s.addEventListener("mousedown",this._onMouseDown=e=>{1===e.which&&(a=e.clientX,l=e.clientY)}),s.addEventListener("mouseup",this._onMouseUp=t=>{1===t.which&&(t.clientX>a+20||t.clientXl+20||t.clientY{this.pointerLens&&(this.pointerLens.visible=!0,this.pointerLens.canvasPos=e.canvasPos,this.pointerLens.snappedCanvasPos=e.snappedCanvasPos||e.canvasPos),r=!1,this._markerDiv.style.left="-100px",this._markerDiv.style.top="-100px",this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.axisVisible=!1),s.style.cursor="default"})),this._active=!0}deactivate(){if(!this._active)return;this.fire("activated",!1),this.pointerLens&&(this.pointerLens.visible=!1),this._markerDiv&&this._destroyMarkerDiv(),this.reset();const e=this.scene.canvas.canvas;e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp);const t=this.distanceMeasurementsPlugin.viewer.cameraControl;t.off(this._onCameraControlHoverSnapOrSurface),t.off(this._onCameraControlHoverSnapOrSurfaceOff),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._active=!1}reset(){this._active&&(this._destroyMarkerDiv(),this._initMarkerDiv(),this._currentDistanceMeasurement&&(this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement),this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),this._mouseState=0)}get currentMeasurement(){return this._currentDistanceMeasurement}destroy(){this.deactivate(),super.destroy()}}class Uc extends z{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new Lc(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new Tc(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},c=()=>{this.plugin.viewer.cameraControl.active=!0},u=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),c(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const c=i.touches[0],p=c.clientX,f=c.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void u();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let c,u;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),c=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),c&&c.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=c.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(c.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=c.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:d.createUUID(),origin:{worldPos:c.worldPos,entity:c.entity},target:{worldPos:c.worldPos,entity:c.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(u=t.pick({canvasPos:a,pickSurface:!0}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.canvasPos,this.pointerLens.snapped=!1),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:d.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),c=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=c.worldPos,this._currentDistanceMeasurement.target.entity=c.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(u=t.pick({canvasPos:a,pickSurface:!0}),u&&u.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=u.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],u=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([u,p]),this._touchState){case 1:{if(1!==s||u>n[0]+r||un[1]+r||pn[0]+r||un[1]+r||p{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}}class Nc{constructor(){}getMetaModel(e,t,i){y.loadJSON(e,(e=>{t(e)}),(function(e){i(e)}))}getGLTF(e,t,i){y.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getGLB(e,t,i){y.loadArraybuffer(e,(e=>{t(e)}),(function(e){i(e)}))}getArrayBuffer(e,t,i,s){!function(e,t,i,s){var r=()=>{};i=i||r,s=s||r;const o=/^data:(.*?)(;base64)?,(.*)$/,n=t.match(o);if(n){const e=!!n[2];var a=n[3];a=window.decodeURIComponent(a),e&&(a=window.atob(a));try{const e=new ArrayBuffer(a.length),t=new Uint8Array(e);for(var l=0;l{i(e)}),(function(e){s(e)}))}}class Qc{constructor(e={}){this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=e.messages,this.locale=e.locale}set messages(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}loadMessages(e={}){for(let t in e)this._messages[t]=e[t];this.messages=this._messages}clearMessages(){this.messages={}}get locales(){return this._locales}set locale(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}get locale(){return this._locale}translate(e,t){const i=this._messages[this._locale];if(!i)return null;const s=Vc(e,i);return s?t?Hc(s,t):s:null}translatePlurals(e,t,i){const s=this._messages[this._locale];if(!s)return null;let r=Vc(e,s);return r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one,r?(r=Hc(r,[t]),i&&(r=Hc(r,i)),r):null}fire(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);const s=this._eventSubs[e];if(s)for(const e in s)if(s.hasOwnProperty(e)){s[e].callback(t)}}on(t,i){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new e),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});let s=this._eventSubs[t];s||(s={},this._eventSubs[t]=s);const r=this._eventSubIDMap.addItem();s[r]={callback:i},this._eventSubEvents[r]=t;const o=this._events[t];return void 0!==o&&i(o),r}off(e){if(null==e)return;if(!this._eventSubEvents)return;const t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];const i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}function Vc(e,t){if(t[e])return t[e];const i=e.split(".");let s=t;for(let e=0,t=i.length;s&&e1?1:e}get t(){return this._t}get tangent(){return this.getTangent(this._t)}get length(){var e=this._getLengths();return e[e.length-1]}getTangent(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),o=this.getPoint(s),n=d.subVec3(o,r,[]);return d.normalizeVec3(n,[])}getPointAt(e){var t=this.getUToTMapping(e);return this.getPoint(t)}getPoints(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}_getLengths(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),o=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),o+=d.lenVec3(d.subVec3(t,r,[])),s.push(o),r=t;return this.cacheArcLengths=s,s}_updateArcLengths(){this.needsUpdate=!0,this._getLengths()}getUToTMapping(e,t){var i,s=this._getLengths(),r=0,o=s.length;i=t||e*s[o-1];for(var n,a=0,l=o-1;a<=l;)if((n=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(n>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(o-1);var A=s[r];return(r+(i-A)/(s[r+1]-A))/(o-1)}}class Gc extends jc{constructor(e,t={}){super(e,t),this.points=t.points,this.t=t.t}set points(e){this._points=e||[]}get points(){return this._points}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,o=t[0===s?s:s-1],n=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],A=d.vec3();return A[0]=d.catmullRomInterpolate(o[0],n[0],a[0],l[0],r),A[1]=d.catmullRomInterpolate(o[1],n[1],a[1],l[1],r),A[2]=d.catmullRomInterpolate(o[2],n[2],a[2],l[2],r),A}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}getJSON(){return{points:points,t:this._t}}}const zc=d.vec3();class Wc extends R{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new Gc(this),this._lookCurve=new Gc(this),this._upCurve=new Gc(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,zc),t.look=this._lookCurve.getPoint(e,zc),t.up=this._upCurve.getPoint(e,zc)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=d.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e=1;e>1&&(e=1);const i=this.easing?qc._ease(e,0,1,1):e,s=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?(d.subVec3(s.eye,s.look,Zc),s.eye=d.lerpVec3(i,0,1,this._eye1,this._eye2,Jc),s.look=d.subVec3(Jc,Zc,Xc)):this._flyingLook&&(s.look=d.lerpVec3(i,0,1,this._look1,this._look2,Xc),s.up=d.lerpVec3(i,0,1,this._up1,this._up2,Yc)):this._flyingEyeLookUp&&(s.eye=d.lerpVec3(i,0,1,this._eye1,this._eye2,Jc),s.look=d.lerpVec3(i,0,1,this._look1,this._look2,Xc),s.up=d.lerpVec3(i,0,1,this._up1,this._up2,Yc)),this._projection2){const t="ortho"===this._projection2?qc._easeOutExpo(e,0,1,1):qc._easeInCubic(e,0,1,1);s.customProjection.matrix=d.lerpMat4(t,0,1,this._projMatrix1,this._projMatrix2)}else s.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return s.ortho.scale=this._orthoScale2,void this.stop();I.scheduleTask(this._update,this)}static _ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}static _easeInCubic(e,t,i,s){return i*(e/=s)*e*e+t}static _easeOutExpo(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}stop(){if(!this._flying)return;this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);const e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}cancel(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}set duration(e){this._duration=e?1e3*e:500,this.stop()}get duration(){return this._duration/1e3}set fit(e){this._fit=!1!==e}get fit(){return this._fit}set fitFOV(e){this._fitFOV=e||45}get fitFOV(){return this._fitFOV}set trail(e){this._trail=!!e}get trail(){return this._trail}destroy(){this.stop(),super.destroy()}}class $c extends R{get type(){return"CameraPathAnimation"}constructor(e,t={}){super(e,t),this._cameraFlightAnimation=new qc(this),this._t=0,this.state=$c.SCRUBBING,this._playingFromT=0,this._playingToT=0,this._playingRate=t.playingRate||1,this._playingDir=1,this._lastTime=null,this.cameraPath=t.cameraPath,this._tick=this.scene.on("tick",this._updateT,this)}_updateT(){const e=this._cameraPath;if(!e)return;let t,i;const s=performance.now(),r=this._lastTime?.001*(s-this._lastTime):0;if(this._lastTime=s,0!==r)switch(this.state){case $c.SCRUBBING:return;case $c.PLAYING:if(this._t+=this._playingRate*r,t=this._cameraPath.frames.length,0===t||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=$c.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case $c.PLAYING_TO:i=this._t+this._playingRate*r*this._playingDir,(this._playingDir<0&&i<=this._playingToT||this._playingDir>0&&i>=this._playingToT)&&(i=this._playingToT,this.state=$c.SCRUBBING,this.fire("stopped")),this._t=i,e.loadFrame(this._t)}}_ease(e,t,i,s){return-i*(e/=s)*(e-2)+t}set cameraPath(e){this._cameraPath=e}get cameraPath(){return this._cameraPath}set rate(e){this._playingRate=e}get rate(){return this._playingRate}play(){this._cameraPath&&(this._lastTime=null,this.state=$c.PLAYING)}playToT(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=$c.PLAYING_TO)}playToFrame(e){const t=this._cameraPath;if(!t)return;const i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}flyToFrame(e,t){const i=this._cameraPath;if(!i)return;const s=i.frames[e];s?(this.state=$c.SCRUBBING,this._cameraFlightAnimation.flyTo(s,t)):this.error("flyToFrame - frame index out of range: "+e)}scrubToT(e){const t=this._cameraPath;if(!t)return;this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=$c.SCRUBBING)}scrubToFrame(e){const t=this._cameraPath;if(!t)return;if(!this.scene.camera)return;t.frames[e]?(t.loadFrame(this._t),this.state=$c.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)}stop(){this.state=$c.SCRUBBING,this.fire("stopped")}destroy(){super.destroy(),this.scene.off(this._tick)}}$c.STOPPED=0,$c.SCRUBBING=1,$c.PLAYING=2,$c.PLAYING_TO=3;const eu=d.vec3(),tu=d.vec3();d.vec3();const iu=d.vec3([0,-1,0]),su=d.vec4([0,0,0,1]);class ru extends R{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=d.vec3(),this._origin=d.vec3(),this._rtcPos=d.vec3(),this._dir=d.vec3(),this._size=1,this._imageSize=d.vec2(),this._texture=new Kr(this),this._plane=new pr(this,{geometry:new Gt(this,ro({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new pr(this,{geometry:new Gt(this,so({size:1,divisions:10})),material:new Jt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new Dr(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),X(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];d.subVec3(t,this.position,eu);const s=-d.dotVec3(i,eu);d.normalizeVec3(i),d.mulVec3Scalar(i,s,tu),d.vec3PairToQuaternion(iu,e,su),this._node.quaternion=su}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}}class ou extends It{get type(){return"PointLight"}constructor(e,t={}){super(e,t);const i=this;this._shadowRenderBuf=null,this._shadowViewMatrix=null,this._shadowProjMatrix=null,this._shadowViewMatrixDirty=!0,this._shadowProjMatrixDirty=!0;const s=this.scene.camera,r=this.scene.canvas;this._onCameraViewMatrix=s.on("viewMatrix",(()=>{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new lt({type:"point",pos:d.vec3([1,1,1]),color:d.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=d.identityMat4());const e=i._state.pos,t=s.look,r=s.up;d.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=d.identityMat4());const e=i.scene.canvas.canvas;d.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new it(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}function nu(e){if(!au(e.width)||!au(e.height)){const t=document.createElement("canvas");t.width=lu(e.width),t.height=lu(e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function au(e){return 0==(e&e-1)}function lu(e){--e;for(let t=1;t<32;t<<=1)e|=e>>t;return e+1}class Au extends R{get type(){return"CubeTexture"}constructor(e,t={}){super(e,t);const i=this.scene.canvas.gl;this._state=new lt({texture:new Vr({gl:i,target:i.TEXTURE_CUBE_MAP}),flipY:this._checkFlipY(t.minFilter),encoding:this._checkEncoding(t.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),this._src=t.src,this._images=[],this._loadSrc(t.src),m.memory.textures++}_checkFlipY(e){return!!e}_checkEncoding(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}_webglContextRestored(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}_loadSrc(e){const t=this,i=this.scene.canvas.gl;this._images=[];let s=!1,r=0;for(let o=0;o{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}}class du{constructor(e){this._eye=d.vec3(),this._look=d.vec3(),this._up=d.vec3(),this._projection={},e&&this.saveCamera(e)}saveCamera(e){const t=e.camera,i=t.project;switch(this._eye.set(t.eye),this._look.set(t.look),this._up.set(t.up),t.projection){case"perspective":this._projection={projection:"perspective",fov:i.fov,fovAxis:i.fovAxis,near:i.near,far:i.far};break;case"ortho":this._projection={projection:"ortho",scale:i.scale,near:i.near,far:i.far};break;case"frustum":this._projection={projection:"frustum",left:i.left,right:i.right,top:i.top,bottom:i.bottom,near:i.near,far:i.far};break;case"custom":this._projection={projection:"custom",matrix:i.matrix.slice()}}}restoreCamera(e,t){const i=e.camera,s=this._projection;function r(){switch(s.type){case"perspective":i.perspective.fov=s.fov,i.perspective.fovAxis=s.fovAxis,i.perspective.near=s.near,i.perspective.far=s.far;break;case"ortho":i.ortho.scale=s.scale,i.ortho.near=s.near,i.ortho.far=s.far;break;case"frustum":i.frustum.left=s.left,i.frustum.right=s.right,i.frustum.top=s.top,i.frustum.bottom=s.bottom,i.frustum.near=s.near,i.frustum.far=s.far;break;case"custom":i.customProjection.matrix=s.matrix}}t?e.viewer.cameraFlight.flyTo({eye:this._eye,look:this._look,up:this._up,orthoScale:s.scale,projection:s.projection},(()=>{r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}const pu=d.vec3();class fu{constructor(e){if(this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsOpacity=[],this.numObjects=0,e){const t=e.metaScene.scene;this.saveObjects(t,e)}}saveObjects(e,t,i){this.numObjects=0,this._mask=i?y.apply(i,{}):null;const s=!i||i.visible,r=!i||i.edges,o=!i||i.xrayed,n=!i||i.highlighted,a=!i||i.selected,l=!i||i.clippable,A=!i||i.pickable,h=!i||i.colorize,c=!i||i.opacity,u=t.metaObjects,d=e.objects;for(let e=0,t=u.length;e1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=d.vec3();return t[0]=d.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=d.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=d.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}}class vu extends jc{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=d.vec3();return t[0]=d.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=d.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=d.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}}class yu extends vc{constructor(e,t={}){super(e,t)}}class Bu extends R{constructor(e,t={}){super(e,t),this._skyboxMesh=new pr(this,{geometry:new Gt(this,{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Jt(this,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Kr(this,{src:t.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:t.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),this.size=t.size,this.active=t.active}set size(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}get size(){return this._size}set active(e){this._skyboxMesh.visible=e}get active(){return this._skyboxMesh.visible}}class wu{transcode(e,t,i={}){}destroy(){}}const xu=d.vec4(),Pu=d.vec4(),Cu=d.vec3(),Mu=d.vec3(),Fu=d.vec3(),Eu=d.vec4(),Iu=d.vec4(),Du=d.vec4();class Su{constructor(e){this._scene=e}dollyToCanvasPos(e,t,i){let s=!1;const r=this._scene.camera;if(e){const t=d.subVec3(e,r.eye,Cu);s=d.lenVec3(t){this._cameraDirty=!0})),this._onProjMatrix=this._scene.camera.on("projMatrix",(()=>{this._cameraDirty=!0})),this._onTick=this._scene.on("tick",(()=>{this.updatePivotElement(),this.updatePivotSphere()}))}createPivotSphere(){const e=this.getPivotPos(),t=d.vec3();d.decomposeMat4(d.inverseMat4(this._scene.viewer.camera.viewMatrix,d.mat4()),t,d.vec4(),d.vec3());const i=d.distVec3(t,e);let s=Math.tan(Math.PI/500)*i*this._pivotSphereSize;"ortho"==this._scene.camera.projection&&(s/=this._scene.camera.ortho.scale/2),X(e,this._rtcCenter,this._rtcPos),this._pivotSphereGeometry=new Zr(this._scene,mr({radius:s})),this._pivotSphere=new pr(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:!1,position:this._rtcPos,rtcCenter:this._rtcCenter})}destroyPivotSphere(){this._pivotSphere&&(this._pivotSphere.destroy(),this._pivotSphere=null),this._pivotSphereGeometry&&(this._pivotSphereGeometry.destroy(),this._pivotSphereGeometry=null)}updatePivotElement(){const e=this._scene.camera,t=this._scene.canvas;if(this._pivoting&&this._cameraDirty){d.transformPoint3(e.viewMatrix,this.getPivotPos(),this._pivotViewPos),this._pivotViewPos[3]=1,d.transformPoint4(e.projMatrix,this._pivotViewPos,this._pivotProjPos);const i=t.boundary,s=i[2],r=i[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*s/2),this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*r/2);let o=t._lastBoundingClientRect;if(!o||t._canvasSizeChanged){const e=t.canvas;o=t._lastBoundingClientRect=e.getBoundingClientRect()}this._pivotElement&&(this._pivotElement.style.left=Math.floor(o.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px",this._pivotElement.style.top=Math.floor(o.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px"),this._cameraDirty=!1}}updatePivotSphere(){this._pivoting&&this._pivotSphere&&(X(this.getPivotPos(),this._rtcCenter,this._rtcPos),d.compareVec3(this._rtcPos,this._pivotSphere.position)||(this.destroyPivotSphere(),this.createPivotSphere()))}setPivotElement(e){this._pivotElement=e}enablePivotSphere(e={}){this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);const t=e.color||[1,0,0];this._pivotSphereMaterial=new Jt(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}disablePivotSphere(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}startPivot(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;const e=this._scene.camera;let t=d.lookAtMat4v(e.eye,e.look,e.worldUp);d.transformPoint3(t,this.getPivotPos(),this._cameraOffset);const i=this.getPivotPos();this._cameraOffset[2]+=d.distVec3(e.eye,i),t=d.inverseMat4(t);const s=d.transformVec3(t,this._cameraOffset),r=d.vec3();if(d.subVec3(e.eye,i,r),d.addVec3(r,s),e.zUp){const e=r[1];r[1]=r[2],r[2]=e}this._radius=d.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}_cameraLookingDownwards(){const e=this._scene.camera,t=d.normalizeVec3(d.subVec3(e.look,e.eye,Tu)),i=d.cross3Vec3(t,e.worldUp,Ru);return d.sqLenVec3(i)<=1e-4}getPivoting(){return this._pivoting}setPivotPos(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}setCanvasPivotPos(e){const t=this._scene.camera,i=Math.abs(d.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),o=s.subarray(12),n=[0,0,-1,1],a=d.dotVec4(n,r)/d.dotVec4(n,o),l=Uu;t.project.unproject(e,a,ku,Ou,l);const A=d.normalizeVec3(d.subVec3(l,t.eye,Tu)),h=d.addVec3(t.eye,d.mulVec3Scalar(A,i,Ru),Lu);this.setPivotPos(h)}getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}continuePivot(e,t){if(!this._pivoting)return;if(0===e&&0===t)return;const i=this._scene.camera;var s=-e;const r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=d.clamp(this._polar,.001,Math.PI-.001);const o=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){const e=o[1];o[1]=o[2],o[2]=e}const n=d.lenVec3(d.subVec3(i.look,i.eye,d.vec3())),a=this.getPivotPos();d.addVec3(o,a);let l=d.lookAtMat4v(o,a,i.worldUp);l=d.inverseMat4(l);const A=d.transformVec3(l,this._cameraOffset);l[12]-=A[0],l[13]-=A[1],l[14]-=A[2];const h=[l[8],l[9],l[10]];i.eye=[l[12],l[13],l[14]],d.subVec3(i.eye,d.mulVec3Scalar(h,n),i.look),i.up=[l[4],l[5],l[6]],this.showPivot()}showPivot(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}hidePivot(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}endPivot(){this._pivoting=!1}destroy(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}class Qu{constructor(e,t){this._scene=e.scene,this._cameraControl=e,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=t,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=d.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}update(){if(!this._configs.pointerEnabled)return;if(!this.schedulePickEntity&&!this.schedulePickSurface)return;const e=`${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;if(this._lastHash===e)return;this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;const t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){const e=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});e&&(e.snappedToEdge||e.snappedToVertex)?(this.snapPickResult=e,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){const e=this.pickResult.canvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){const e=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(e[0]===this.pickCursorPos[0]&&e[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}fireEvents(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){const e=new Re;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){const e=this.pickResult.entity.id;this._lastPickedEntityId!==e&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=e)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}const Vu=d.vec2();class Hu{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController;let n,a,l,A=0,h=0,c=0,u=0,p=!1;const f=d.vec3();let g=!0;const m=this._scene.canvas.canvas,_=[];function v(e=!0){m.style.cursor="move",A=s.pointerCanvasPos[0],h=s.pointerCanvasPos[1],c=s.pointerCanvasPos[0],u=s.pointerCanvasPos[1],e&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(p=!0,f.set(o.pickResult.worldPos)):p=!1)}document.addEventListener("keydown",this._documentKeyDownHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!0}),document.addEventListener("keyup",this._documentKeyUpHandler=t=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;const s=t.keyCode;_[s]=!1}),m.addEventListener("mousedown",this._mouseDownHandler=t=>{if(i.active&&i.pointerEnabled)switch(t.which){case 1:_[e.input.KEY_SHIFT]||i.planView?(n=!0,v()):(n=!0,v(!1));break;case 2:a=!0,v();break;case 3:l=!0,i.panRightClick&&v()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(!n&&!a&&!l)return;const o=e.canvas.boundary,c=o[2],u=o[3],g=s.pointerCanvasPos[0],m=s.pointerCanvasPos[1],v=_[e.input.KEY_SHIFT]||i.planView||!i.panRightClick&&a||i.panRightClick&&l,b=document.pointerLockElement?t.movementX:g-A,y=document.pointerLockElement?t.movementY:m-h;if(v){const t=e.camera;if("perspective"===t.projection){const i=Math.abs(p?d.lenVec3(d.subVec3(f,e.camera.eye,[])):e.camera.eyeLookDist)*Math.tan(t.perspective.fov/2*Math.PI/180);r.panDeltaX+=1.5*b*i/u,r.panDeltaY+=1.5*y*i/u}else r.panDeltaX+=.5*t.ortho.scale*(b/u),r.panDeltaY+=.5*t.ortho.scale*(y/u)}else!n||a||l||i.planView||(i.firstPerson?(r.rotateDeltaY-=b/c*i.dragRotationRate/2,r.rotateDeltaX+=y/u*(i.dragRotationRate/4)):(r.rotateDeltaY-=b/c*(1.5*i.dragRotationRate),r.rotateDeltaX+=y/u*(1.5*i.dragRotationRate)));A=g,h=m}),m.addEventListener("mousemove",this._canvasMouseMoveHandler=e=>{i.active&&i.pointerEnabled&&s.mouseover&&(g=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{if(i.active&&i.pointerEnabled)switch(e.which){case 1:case 2:case 3:n=!1,a=!1,l=!1}}),m.addEventListener("mouseup",this._mouseUpHandler=e=>{if(i.active&&i.pointerEnabled){if(3===e.which){!function(e,t){if(e){let i=e.target,s=0,r=0,o=0,n=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,o+=i.scrollLeft,n+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+o-s,t[1]=e.pageY+n-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Vu);const i=Vu[0],s=Vu[1];Math.abs(i-c)<3&&Math.abs(s-u)<3&&t.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Vu,event:e},!0)}m.style.removeProperty("cursor")}}),m.addEventListener("mouseenter",this._mouseEnterHandler=()=>{i.active&&i.pointerEnabled});const b=1/60;let y=null;m.addEventListener("wheel",this._mouseWheelHandler=e=>{if(!i.active||!i.pointerEnabled)return;const t=performance.now()/1e3;var o=null!==y?t-y:0;y=t,o>.05&&(o=.05),o{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const n=r._isKeyDownForAction(r.AXIS_VIEW_RIGHT),a=r._isKeyDownForAction(r.AXIS_VIEW_BACK),l=r._isKeyDownForAction(r.AXIS_VIEW_LEFT),A=r._isKeyDownForAction(r.AXIS_VIEW_FRONT),h=r._isKeyDownForAction(r.AXIS_VIEW_TOP),c=r._isKeyDownForAction(r.AXIS_VIEW_BOTTOM);if(!(n||a||l||A||h||c))return;const u=e.aabb,p=d.getAABB3Diag(u);d.getAABB3Center(u,ju);const f=Math.abs(p/Math.tan(t.cameraFlight.fitFOV*d.DEGTORAD)),g=1.1*p;Xu.orthoScale=g,n?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldRight,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):a?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldForward,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):l?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldRight,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):A?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldForward,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(o.worldUp)):h?(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldUp,f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(d.normalizeVec3(d.mulVec3Scalar(o.worldForward,1,zu),Wu))):c&&(Xu.eye.set(d.addVec3(ju,d.mulVec3Scalar(o.worldUp,-f,Gu),Ku)),Xu.look.set(ju),Xu.up.set(d.normalizeVec3(d.mulVec3Scalar(o.worldForward,-1,zu)))),!i.firstPerson&&i.followPointer&&t.pivotController.setPivotPos(ju),t.cameraFlight.duration>0?t.cameraFlight.flyTo(Xu,(()=>{t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot()})):(t.cameraFlight.jumpTo(Xu),t.pivotController.getPivoting()&&i.followPointer&&t.pivotController.showPivot())}))}reset(){}destroy(){this._scene.input.off(this._onSceneKeyDown)}}class Yu{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=t.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;let l=!1,A=!1;const h=this._scene.canvas.canvas,c=i=>{let s;i&&i.worldPos&&(s=i.worldPos);const r=i&&i.entity?i.entity.aabb:e.aabb;if(s){const i=e.camera;d.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})},u=e.tickify(this._canvasMouseMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(l||A)return;const r=a.hasSubs("hover"),n=a.hasSubs("hoverEnter"),h=a.hasSubs("hoverOut"),c=a.hasSubs("hoverOff"),u=a.hasSubs("hoverSurface"),d=a.hasSubs("hoverSnapOrSurface");if(r||n||h||c||u||d)if(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=u,o.scheduleSnapOrPick=d,o.update(),o.pickResult){if(o.pickResult.entity){const t=o.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),a.fire("hoverEnter",o.pickResult,!0),this._lastPickedEntityId=t)}a.fire("hover",o.pickResult,!0),(o.pickResult.worldPos||o.pickResult.snappedWorldPos)&&a.fire("hoverSurface",o.pickResult,!0)}else void 0!==this._lastPickedEntityId&&(a.fire("hoverOut",{entity:e.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),a.fire("hoverOff",{canvasPos:o.pickCursorPos},!0)});h.addEventListener("mousemove",u),h.addEventListener("mousedown",this._canvasMouseDownHandler=t=>{1===t.which&&(l=!0),3===t.which&&(A=!0);if(1===t.which&&i.active&&i.pointerEnabled&&(s.mouseDownClientX=t.clientX,s.mouseDownClientY=t.clientY,s.mouseDownCursorX=s.pointerCanvasPos[0],s.mouseDownCursorY=s.pointerCanvasPos[1],!i.firstPerson&&i.followPointer&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickSurface=!0,o.update(),1===t.which))){const t=o.pickResult;t&&t.worldPos?(n.setPivotPos(t.worldPos),n.startPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),n.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=e=>{1===e.which&&(l=!1),3===e.which&&(A=!1),n.getPivoting()&&n.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=r=>{if(!i.active||!i.pointerEnabled)return;if(!(1===r.which))return;if(n.hidePivot(),Math.abs(r.clientX-s.mouseDownClientX)>3||Math.abs(r.clientY-s.mouseDownClientY)>3)return;const l=a.hasSubs("picked"),A=a.hasSubs("pickedNothing"),h=a.hasSubs("pickedSurface"),u=a.hasSubs("doublePicked"),p=a.hasSubs("doublePickedSurface"),f=a.hasSubs("doublePickedNothing");if(!(i.doublePickFlyTo||u||p||f))return(l||A||h)&&(o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=!0,o.schedulePickSurface=h,o.update(),o.pickResult?(a.fire("picked",o.pickResult,!0),o.pickedSurface&&a.fire("pickedSurface",o.pickResult,!0)):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0)),void(this._clicks=0);if(this._clicks++,1===this._clicks){o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo,o.schedulePickSurface=h,o.update();const e=o.pickResult,r=o.pickedSurface;this._timeout=setTimeout((()=>{e?(a.fire("picked",e,!0),r&&(a.fire("pickedSurface",e,!0),!i.firstPerson&&i.followPointer&&(t.pivotController.setPivotPos(e.worldPos),t.pivotController.startPivot()&&t.pivotController.showPivot()))):a.fire("pickedNothing",{canvasPos:s.pointerCanvasPos},!0),this._clicks=0}),i.doubleClickTimeFrame)}else{if(null!==this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),o.pickCursorPos=s.pointerCanvasPos,o.schedulePickEntity=i.doublePickFlyTo||u||p,o.schedulePickSurface=o.schedulePickEntity&&p,o.update(),o.pickResult){if(a.fire("doublePicked",o.pickResult,!0),o.pickedSurface&&a.fire("doublePickedSurface",o.pickResult,!0),i.doublePickFlyTo&&(c(o.pickResult),!i.firstPerson&&i.followPointer)){const e=o.pickResult.entity.aabb,i=d.getAABB3Center(e);t.pivotController.setPivotPos(i),t.pivotController.startPivot()&&t.pivotController.showPivot()}}else if(a.fire("doublePickedNothing",{canvasPos:s.pointerCanvasPos},!0),i.doublePickFlyTo&&(c(),!i.firstPerson&&i.followPointer)){const i=e.aabb,s=d.getAABB3Center(i);t.pivotController.setPivotPos(s),t.pivotController.startPivot()&&t.pivotController.showPivot()}this._clicks=0}},!1)}reset(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}destroy(){const e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}class Zu{constructor(e,t,i,s,r){this._scene=e;const o=e.input,n=[],a=e.canvas.canvas;let l=!0;this._onSceneMouseMove=o.on("mousemove",(()=>{l=!0})),this._onSceneKeyDown=o.on("keydown",(t=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&s.mouseover&&(n[t]=!0,t===o.KEY_SHIFT&&(a.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(s=>{i.active&&i.pointerEnabled&&e.input.keyboardEnabled&&(n[s]=!1,s===o.KEY_SHIFT&&(a.style.cursor=null),t.pivotController.getPivoting()&&t.pivotController.endPivot())})),this._onTick=e.on("tick",(a=>{if(!i.active||!i.pointerEnabled||!e.input.keyboardEnabled)return;if(!s.mouseover)return;const A=t.cameraControl,h=a.deltaTime/1e3;if(!i.planView){const e=A._isKeyDownForAction(A.ROTATE_Y_POS,n),s=A._isKeyDownForAction(A.ROTATE_Y_NEG,n),o=A._isKeyDownForAction(A.ROTATE_X_POS,n),a=A._isKeyDownForAction(A.ROTATE_X_NEG,n),l=h*i.keyboardRotationRate;(e||s||o||a)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),e?r.rotateDeltaY+=l:s&&(r.rotateDeltaY-=l),o?r.rotateDeltaX+=l:a&&(r.rotateDeltaX-=l),!i.firstPerson&&i.followPointer&&t.pivotController.startPivot())}if(!n[o.KEY_CTRL]&&!n[o.KEY_ALT]){const e=A._isKeyDownForAction(A.DOLLY_BACKWARDS,n),o=A._isKeyDownForAction(A.DOLLY_FORWARDS,n);if(e||o){const n=h*i.keyboardDollyRate;!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),o?r.dollyDelta-=n:e&&(r.dollyDelta+=n),l&&(s.followPointerDirty=!0,l=!1)}}const c=A._isKeyDownForAction(A.PAN_FORWARDS,n),u=A._isKeyDownForAction(A.PAN_BACKWARDS,n),d=A._isKeyDownForAction(A.PAN_LEFT,n),p=A._isKeyDownForAction(A.PAN_RIGHT,n),f=A._isKeyDownForAction(A.PAN_UP,n),g=A._isKeyDownForAction(A.PAN_DOWN,n),m=(n[o.KEY_ALT]?.3:1)*h*i.keyboardPanRate;(c||u||d||p||f||g)&&(!i.firstPerson&&i.followPointer&&t.pivotController.startPivot(),g?r.panDeltaY+=m:f&&(r.panDeltaY+=-m),p?r.panDeltaX+=-m:d&&(r.panDeltaX+=m),u?r.panDeltaZ+=m:c&&(r.panDeltaZ+=-m))}))}reset(){}destroy(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}const qu=d.vec3();class $u{constructor(e,t,i,s,r){this._scene=e;const o=e.camera,n=t.pickController,a=t.pivotController,l=t.panController;let A=1,h=1,c=null;this._onTick=e.on("tick",(()=>{if(!i.active||!i.pointerEnabled)return;let t="default";if(Math.abs(r.dollyDelta)<.001&&(r.dollyDelta=0),Math.abs(r.rotateDeltaX)<.001&&(r.rotateDeltaX=0),Math.abs(r.rotateDeltaY)<.001&&(r.rotateDeltaY=0),0===r.rotateDeltaX&&0===r.rotateDeltaY||(r.dollyDelta=0),i.followPointer){if(--A<=0&&(A=1,0!==r.dollyDelta)){if(0===r.rotateDeltaY&&0===r.rotateDeltaX&&i.followPointer&&s.followPointerDirty&&(n.pickCursorPos=s.pointerCanvasPos,n.schedulePickSurface=!0,n.update(),n.pickResult&&n.pickResult.worldPos?c=n.pickResult.worldPos:(h=1,c=null),s.followPointerDirty=!1),c){const t=Math.abs(d.lenVec3(d.subVec3(c,e.camera.eye,qu)));h=t/i.dollyProximityThreshold}h{s.mouseover=!0}),o.addEventListener("mouseleave",this._mouseLeaveHandler=()=>{s.mouseover=!1,o.style.cursor=null}),document.addEventListener("mousemove",this._mouseMoveHandler=e=>{td(e,o,s.pointerCanvasPos)}),o.addEventListener("mousedown",this._mouseDownHandler=e=>{i.active&&i.pointerEnabled&&(td(e,o,s.pointerCanvasPos),s.mouseover=!0)}),o.addEventListener("mouseup",this._mouseUpHandler=e=>{i.active&&i.pointerEnabled})}reset(){}destroy(){const e=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler),e.removeEventListener("mouseenter",this._mouseEnterHandler),e.removeEventListener("mouseleave",this._mouseLeaveHandler),e.removeEventListener("mousedown",this._mouseDownHandler),e.removeEventListener("mouseup",this._mouseUpHandler)}}function td(e,t,i){if(e){const{left:s,top:r}=t.getBoundingClientRect();i[0]=e.clientX-s,i[1]=e.clientY-r}else e=window.event,i[0]=e.x,i[1]=e.y;return i}const id=function(e,t){if(e){let i=e.target,s=0,r=0;for(;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t};class sd{constructor(e,t,i,s,r){this._scene=e;const o=t.pickController,n=t.pivotController,a=d.vec2(),l=d.vec2(),A=d.vec2(),h=d.vec2(),c=[],u=this._scene.canvas.canvas;let p=0,f=!1;this._onTick=e.on("tick",(()=>{f=!1})),u.addEventListener("touchstart",this._canvasTouchStartHandler=t=>{if(!i.active||!i.pointerEnabled)return;t.preventDefault();const r=t.touches,l=t.changedTouches;for(s.touchStartTime=Date.now(),1===r.length&&1===l.length&&(id(r[0],a),i.followPointer&&(o.pickCursorPos=a,o.schedulePickSurface=!0,o.update(),i.planView||(o.picked&&o.pickedSurface&&o.pickResult&&o.pickResult.worldPos?(n.setPivotPos(o.pickResult.worldPos),!i.firstPerson&&n.startPivot()&&n.showPivot()):(i.smartPivot?n.setCanvasPivotPos(s.pointerCanvasPos):n.setPivotPos(e.camera.look),!i.firstPerson&&n.startPivot()&&n.showPivot()))));c.length{n.getPivoting()&&n.endPivot()}),u.addEventListener("touchmove",this._canvasTouchMoveHandler=t=>{if(!i.active||!i.pointerEnabled)return;if(t.stopPropagation(),t.preventDefault(),f)return;f=!0;const n=e.canvas.boundary,a=n[2],u=n[3],g=t.touches;if(t.touches.length===p){if(1===p){id(g[0],l),d.subVec2(l,c[0],h);const t=h[0],o=h[1];if(null!==s.longTouchTimeout&&(Math.abs(t)>i.longTapRadius||Math.abs(o)>i.longTapRadius)&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),i.planView){const s=e.camera;if("perspective"===s.projection){const n=Math.abs(e.camera.eyeLookDist)*Math.tan(s.perspective.fov/2*Math.PI/180);r.panDeltaX+=t*n/u*i.touchPanRate,r.panDeltaY+=o*n/u*i.touchPanRate}else r.panDeltaX+=.5*s.ortho.scale*(t/u)*i.touchPanRate,r.panDeltaY+=.5*s.ortho.scale*(o/u)*i.touchPanRate}else r.rotateDeltaY-=t/a*(1*i.dragRotationRate),r.rotateDeltaX+=o/u*(1.5*i.dragRotationRate)}else if(2===p){const t=g[0],n=g[1];id(t,l),id(n,A);const a=d.geometricMeanVec2(c[0],c[1]),h=d.geometricMeanVec2(l,A),p=d.vec2();d.subVec2(a,h,p);const f=p[0],m=p[1],_=e.camera,v=d.distVec2([t.pageX,t.pageY],[n.pageX,n.pageY]),b=(d.distVec2(c[0],c[1])-v)*i.touchDollyRate;if(r.dollyDelta=b,Math.abs(b)<1)if("perspective"===_.projection){const t=o.pickResult?o.pickResult.worldPos:e.center,s=Math.abs(d.lenVec3(d.subVec3(t,e.camera.eye,[])))*Math.tan(_.perspective.fov/2*Math.PI/180);r.panDeltaX-=f*s/u*i.touchPanRate,r.panDeltaY-=m*s/u*i.touchPanRate}else r.panDeltaX-=.5*_.ortho.scale*(f/u)*i.touchPanRate,r.panDeltaY-=.5*_.ortho.scale*(m/u)*i.touchPanRate;s.pointerCanvasPos=h}for(let e=0;e{let s;i&&i.worldPos&&(s=i.worldPos);const r=i?i.entity.aabb:e.aabb;if(s){const i=e.camera;d.subVec3(i.eye,i.look,[]),t.cameraFlight.flyTo({aabb:r})}else t.cameraFlight.flyTo({aabb:r})};u.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{if(!i.active||!i.pointerEnabled)return;null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null);const r=e.touches,o=e.changedTouches;if(a=Date.now(),1===r.length&&1===o.length){h=a,rd(r[0],A);const o=A[0],n=A[1],l=r[0].pageX,c=r[0].pageY;s.longTouchTimeout=setTimeout((()=>{t.cameraControl.fire("rightClick",{pagePos:[Math.round(l),Math.round(c)],canvasPos:[Math.round(o),Math.round(n)],event:e},!0),s.longTouchTimeout=null}),i.longTapTimeout)}else h=-1;for(;l.length{if(!i.active||!i.pointerEnabled)return;const t=Date.now(),r=e.touches,a=e.changedTouches,u=n.hasSubs("pickedSurface");null!==s.longTouchTimeout&&(clearTimeout(s.longTouchTimeout),s.longTouchTimeout=null),0===r.length&&1===a.length&&h>-1&&t-h<150&&(c>-1&&h-c<325?(rd(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=u,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("doublePicked",o.pickResult),o.pickedSurface&&n.fire("doublePickedSurface",o.pickResult),i.doublePickFlyTo&&p(o.pickResult)):(n.fire("doublePickedNothing"),i.doublePickFlyTo&&p()),c=-1):d.distVec2(l[0],A)<4&&(rd(a[0],o.pickCursorPos),o.schedulePickEntity=!0,o.schedulePickSurface=u,o.update(),o.pickResult?(o.pickResult.touchInput=!0,n.fire("picked",o.pickResult),o.pickedSurface&&n.fire("pickedSurface",o.pickResult)):n.fire("pickedNothing"),c=t),h=-1),l.length=r.length;for(let e=0,t=r.length;e{e.preventDefault()},this._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},this._states={pointerCanvasPos:d.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:d.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},this._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};const i=this.scene;this._controllers={cameraControl:this,pickController:new Qu(this,this._configs),pivotController:new Nu(i,this._configs),panController:new Su(i),cameraFlight:new qc(this,{duration:.5})},this._handlers=[new ed(this.scene,this._controllers,this._configs,this._states,this._updates),new sd(this.scene,this._controllers,this._configs,this._states,this._updates),new Hu(this.scene,this._controllers,this._configs,this._states,this._updates),new Ju(this.scene,this._controllers,this._configs,this._states,this._updates),new Yu(this.scene,this._controllers,this._configs,this._states,this._updates),new od(this.scene,this._controllers,this._configs,this._states,this._updates),new Zu(this.scene,this._controllers,this._configs,this._states,this._updates)],this._cameraUpdater=new $u(this.scene,this._controllers,this._configs,this._states,this._updates),this.navMode=t.navMode,t.planView&&(this.planView=t.planView),this.constrainVertical=t.constrainVertical,t.keyboardLayout?this.keyboardLayout=t.keyboardLayout:this.keyMap=t.keyMap,this.doublePickFlyTo=t.doublePickFlyTo,this.panRightClick=t.panRightClick,this.active=t.active,this.followPointer=t.followPointer,this.rotationInertia=t.rotationInertia,this.keyboardPanRate=t.keyboardPanRate,this.touchPanRate=t.touchPanRate,this.keyboardRotationRate=t.keyboardRotationRate,this.dragRotationRate=t.dragRotationRate,this.touchDollyRate=t.touchDollyRate,this.dollyInertia=t.dollyInertia,this.dollyProximityThreshold=t.dollyProximityThreshold,this.dollyMinSpeed=t.dollyMinSpeed,this.panInertia=t.panInertia,this.pointerEnabled=!0,this.keyboardDollyRate=t.keyboardDollyRate,this.mouseWheelDollyRate=t.mouseWheelDollyRate}set keyMap(e){if(e=e||"qwerty",y.isString(e)){const t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{const t=e;this._keyMap=t}}get keyMap(){return this._keyMap}_isKeyDownForAction(e,t){const i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(let e=0,s=i.length;e0?ud(t):null,n=i&&i.length>0?ud(i):null,a=e=>{if(!e)return;var t=!0;(n&&n[e.type]||o&&!o[e.type])&&(t=!1),t&&s.push(e.id);const i=e.children;if(i)for(var r=0,l=i.length;r * Copyright (c) 2022 Niklas von Hertzen diff --git a/dist/xeokit-sdk.min.es5.js b/dist/xeokit-sdk.min.es5.js index 7d4b829dd3..facee2837a 100644 --- a/dist/xeokit-sdk.min.es5.js +++ b/dist/xeokit-sdk.min.es5.js @@ -1,4 +1,4 @@ -var e,t=a().mark(Kw),i=a().mark(Xw),s=a().mark(nM);function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function n(e){for(var t=1;t=0;--r){var n=this.tryEntries[r],o=n.completion;if("root"===n.tryLoc)return s("end");if(n.tryLoc<=this.prev){var a=i.call(n,"catchLoc"),l=i.call(n,"finallyLoc");if(a&&l){if(this.prev=0;--s){var r=this.tryEntries[s];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),x(i),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var s=i.completion;if("throw"===s.type){var r=s.arg;x(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:C(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),c}},e}function l(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function u(e){return function(){var t=this,i=arguments;return new Promise((function(s,r){var n=e.apply(t,i);function o(e){l(n,s,r,o,a,"next",e)}function a(e){l(n,s,r,o,a,"throw",e)}o(void 0)}))}}function A(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=d(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,a=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){a=!0,n=e},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw n}}}}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var s,r,n=[],o=!0,a=!1;try{for(i=i.call(e);!(o=(s=i.next()).done)&&(n.push(s.value),!t||n.length!==t);o=!0);}catch(e){a=!0,r=e}finally{try{o||null==i.return||i.return()}finally{if(a)throw r}}return n}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this._id=V.addItem(),this._context=null,this._enabled=!1,this._itemsCfg=[],this._rootMenu=null,this._menuList=[],this._menuMap={},this._itemList=[],this._itemMap={},this._shown=!1,this._nextId=0,this._eventSubs={},!1!==i.hideOnMouseDown&&(document.addEventListener("mousedown",(function(e){e.target.classList.contains("xeokit-context-menu-item")||t.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=function(e){e.target.classList.contains("xeokit-context-menu-item")||t.hide()})),i.items&&(this.items=i.items),this._hideOnAction=!1!==i.hideOnAction,this.context=i.context,this.enabled=!1!==i.enabled,this.hide()}return C(e,[{key:"on",value:function(e,t){var i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}},{key:"fire",value:function(e,t){var i=this._eventSubs[e];if(i)for(var s=0,r=i.length;s0,A=t._getNextId(),c=n.getTitle||function(){return n.title||""},h=n.doAction||n.callback||function(){},d=n.getEnabled||function(){return!0},p=n.getShown||function(){return!0},f=new G(A,c,h,d,p);if(f.parentMenu=r,l.items.push(f),u){var v=e(o);f.subMenu=v,v.parentItem=f}t._itemList.push(f),t._itemMap[f.id]=f},A=0,c=a.length;A'),s.push("
    "),i)for(var r=0,n=i.length;r'+d+" [MORE]"):s.push('
  • '+d+"
  • ")}}s.push("
"),s.push("");var p=s.join("");document.body.insertAdjacentHTML("beforeend",p);var f=document.querySelector("."+e.id);e.menuElement=f,f.style["border-radius"]="4px",f.style.display="none",f.style["z-index"]=3e5,f.style.background="white",f.style.border="1px solid black",f.style["box-shadow"]="0 4px 5px 0 gray",f.oncontextmenu=function(e){e.preventDefault()};var v=this,g=null;if(i)for(var m=0,_=i.length;m<_;m++){var y=i[m].items;if(y)for(var b=function(e,i){var s=y[e],r=s.subMenu;if(s.itemElement=document.getElementById(s.id),!s.itemElement)return console.error("ContextMenu item element not found: "+s.id),"continue";s.itemElement.addEventListener("mouseenter",(function(e){e.preventDefault();var t=s.subMenu;if(t){if(g&&g.id!==t.id&&(v._hideMenu(g.id),g=null),!1!==s.enabled){var i=s.itemElement,r=t.menuElement,n=i.getBoundingClientRect();r.getBoundingClientRect();n.right+200>window.innerWidth?v._showMenu(t.id,n.left-200,n.top-1):v._showMenu(t.id,n.right-5,n.top-1),g=t}}else g&&(v._hideMenu(g.id),g=null)})),r||(s.itemElement.addEventListener("click",(function(e){e.preventDefault(),v._context&&!1!==s.enabled&&(s.doAction&&s.doAction(v._context),t._hideOnAction?v.hide():(v._updateItemsTitles(),v._updateItemsEnabledStatus()))})),s.itemElement.addEventListener("mouseup",(function(e){3===e.which&&(e.preventDefault(),v._context&&!1!==s.enabled&&(s.doAction&&s.doAction(v._context),t._hideOnAction?v.hide():(v._updateItemsTitles(),v._updateItemsEnabledStatus())))})),s.itemElement.addEventListener("mouseenter",(function(e){e.preventDefault(),!1!==s.enabled&&s.doHover&&s.doHover(v._context)})))},B=0,w=y.length;Bwindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}},{key:"_hideMenuElement",value:function(e){e.style.display="none"}}]),e}(),W=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.viewer=t,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=s.zoomLevel||2,this._active=!1!==s.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(function(){i._active&&i._visible&&i.update()}))}return C(e,[{key:"update",value:function(){if(this._active&&this._visible&&this._canvasPos){var e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop="".concat(t.bottom-t.top-this._lensCanvas.height-85,"px"):this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);var s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);var r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){var n=this._snappedCanvasPos[0]-this._canvasPos[0],o=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft="".concat(r[0]+n*this._zoomLevel-10,"px"),this._lensCursorDiv.style.marginTop="".concat(r[1]+o*this._zoomLevel-10,"px")}else this._lensCursorDiv.style.marginLeft="".concat(r[0]-10,"px"),this._lensCursorDiv.style.marginTop="".concat(r[1]-10,"px")}}},{key:"zoomFactor",get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.update()}},{key:"canvasPos",get:function(){return this._canvasPos},set:function(e){this._canvasPos=e,this.update()}},{key:"snappedCanvasPos",get:function(){return this._snappedCanvasPos},set:function(e){this._snappedCanvasPos=e,this.update()}},{key:"snapped",get:function(){return this._snapped},set:function(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}},{key:"active",get:function(){return this._active},set:function(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}},{key:"destroy",value:function(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}}]),e}(),K=!0,X=K?Float64Array:Float32Array,J=new X(3),Y=new X(16),Z=new X(16),q=new X(4),$={setDoublePrecisionEnabled:function(e){X=(K=e)?Float64Array:Float32Array},getDoublePrecisionEnabled:function(){return K},MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId:function(e,t){var i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:function(e,t){return e+"#"+t},safeInv:function(e){var t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:function(e){return new X(e||2)},vec3:function(e){return new X(e||3)},vec4:function(e){return new X(e||4)},mat3:function(e){return new X(e||9)},mat3ToMat4:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new X(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},mat4:function(e){return new X(e||16)},mat4ToMat3:function(e,t){},doublesToFloats:function(e,t,i){for(var s=new X(2),r=0,n=e.length;r>8&255]+e[t>>16&255]+e[t>>24&255],"-").concat(e[255&i]).concat(e[i>>8&255],"-").concat(e[i>>16&15|64]).concat(e[i>>24&255],"-").concat(e[63&s|128]).concat(e[s>>8&255],"-").concat(e[s>>16&255]).concat(e[s>>24&255]).concat(e[255&r]).concat(e[r>>8&255]).concat(e[r>>16&255]).concat(e[r>>24&255])}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},fmod:function(e,t){if(e1?1:i,Math.acos(i)},vec3FromMat4Scale:function(){var e=new X(3);return function(t,i){return e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=$.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=$.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=$.lenVec3(e),i}}(),vecToArray:function(){function e(e){return Math.round(1e5*e)/1e5}return function(t){for(var i=0,s=(t=Array.prototype.slice.call(t)).length;i0&&void 0!==arguments[0]?arguments[0]:new X(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},identityMat3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new X(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},isIdentityMat4:function(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]},negateMat4:function(e,t){return t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},addMat4:function(e,t,i){return i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i},addMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i},addScalarMat4:function(e,t,i){return $.addMat4Scalar(t,e,i)},subMat4:function(e,t,i){return i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i},subMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i},subScalarMat4:function(e,t,i){return i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i},mulMat4:function(e,t,i){i||(i=e);var s=e[0],r=e[1],n=e[2],o=e[3],a=e[4],l=e[5],u=e[6],A=e[7],c=e[8],h=e[9],d=e[10],p=e[11],f=e[12],v=e[13],g=e[14],m=e[15],_=t[0],y=t[1],b=t[2],B=t[3],w=t[4],x=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],k=t[11],I=t[12],D=t[13],S=t[14],T=t[15];return i[0]=_*s+y*a+b*c+B*f,i[1]=_*r+y*l+b*h+B*v,i[2]=_*n+y*u+b*d+B*g,i[3]=_*o+y*A+b*p+B*m,i[4]=w*s+x*a+P*c+C*f,i[5]=w*r+x*l+P*h+C*v,i[6]=w*n+x*u+P*d+C*g,i[7]=w*o+x*A+P*p+C*m,i[8]=M*s+F*a+E*c+k*f,i[9]=M*r+F*l+E*h+k*v,i[10]=M*n+F*u+E*d+k*g,i[11]=M*o+F*A+E*p+k*m,i[12]=I*s+D*a+S*c+T*f,i[13]=I*r+D*l+S*h+T*v,i[14]=I*n+D*u+S*d+T*g,i[15]=I*o+D*A+S*p+T*m,i},mulMat3:function(e,t,i){i||(i=new X(9));var s=e[0],r=e[3],n=e[6],o=e[1],a=e[4],l=e[7],u=e[2],A=e[5],c=e[8],h=t[0],d=t[3],p=t[6],f=t[1],v=t[4],g=t[7],m=t[2],_=t[5],y=t[8];return i[0]=s*h+r*f+n*m,i[3]=s*d+r*v+n*_,i[6]=s*p+r*g+n*y,i[1]=o*h+a*f+l*m,i[4]=o*d+a*v+l*_,i[7]=o*p+a*g+l*y,i[2]=u*h+A*f+c*m,i[5]=u*d+A*v+c*_,i[8]=u*p+A*g+c*y,i},mulMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i},mulMat4v4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=t[0],r=t[1],n=t[2],o=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*n+e[12]*o,i[1]=e[1]*s+e[5]*r+e[9]*n+e[13]*o,i[2]=e[2]*s+e[6]*r+e[10]*n+e[14]*o,i[3]=e[3]*s+e[7]*r+e[11]*n+e[15]*o,i},transposeMat4:function(e,t){var i=e[4],s=e[14],r=e[8],n=e[13],o=e[12],a=e[9];if(!t||e===t){var l=e[1],u=e[2],A=e[3],c=e[6],h=e[7],d=e[11];return e[1]=i,e[2]=r,e[3]=o,e[4]=l,e[6]=a,e[7]=n,e[8]=u,e[9]=c,e[11]=s,e[12]=A,e[13]=h,e[14]=d,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=o,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=n,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3:function(e,t){if(t===e){var i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4:function(e){var t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],o=e[5],a=e[6],l=e[7],u=e[8],A=e[9],c=e[10],h=e[11],d=e[12],p=e[13],f=e[14],v=e[15];return d*A*a*r-u*p*a*r-d*o*c*r+n*p*c*r+u*o*f*r-n*A*f*r-d*A*s*l+u*p*s*l+d*i*c*l-t*p*c*l-u*i*f*l+t*A*f*l+d*o*s*h-n*p*s*h-d*i*a*h+t*p*a*h+n*i*f*h-t*o*f*h-u*o*s*v+n*A*s*v+u*i*a*v-t*A*a*v-n*i*c*v+t*o*c*v},inverseMat4:function(e,t){t||(t=e);var i=e[0],s=e[1],r=e[2],n=e[3],o=e[4],a=e[5],l=e[6],u=e[7],A=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],v=e[14],g=e[15],m=i*a-s*o,_=i*l-r*o,y=i*u-n*o,b=s*l-r*a,B=s*u-n*a,w=r*u-n*l,x=A*f-c*p,P=A*v-h*p,C=A*g-d*p,M=c*v-h*f,F=c*g-d*f,E=h*g-d*v,k=1/(m*E-_*F+y*M+b*C-B*P+w*x);return t[0]=(a*E-l*F+u*M)*k,t[1]=(-s*E+r*F-n*M)*k,t[2]=(f*w-v*B+g*b)*k,t[3]=(-c*w+h*B-d*b)*k,t[4]=(-o*E+l*C-u*P)*k,t[5]=(i*E-r*C+n*P)*k,t[6]=(-p*w+v*y-g*_)*k,t[7]=(A*w-h*y+d*_)*k,t[8]=(o*F-a*C+u*x)*k,t[9]=(-i*F+s*C-n*x)*k,t[10]=(p*B-f*y+g*m)*k,t[11]=(-A*B+c*y-d*m)*k,t[12]=(-o*M+a*P-l*x)*k,t[13]=(i*M-s*P+r*x)*k,t[14]=(-p*b+f*_-v*m)*k,t[15]=(A*b-c*_+h*m)*k,t},traceMat4:function(e){return e[0]+e[5]+e[10]+e[15]},translationMat4v:function(e,t){var i=t||$.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v:function(e,t){var i=t||$.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(O=new X(3),function(e,t,i,s){return O[0]=e,O[1]=t,O[2]=i,$.translationMat4v(O,s)}),translationMat4s:function(e,t){return $.translationMat4c(e,e,e,t)},translateMat4v:function(e,t){return $.translateMat4c(e[0],e[1],e[2],t)},translateMat4c:function(e,t,i,s){var r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;var n=s[7];s[4]+=n*e,s[5]+=n*t,s[6]+=n*i;var o=s[11];s[8]+=o*e,s[9]+=o*t,s[10]+=o*i;var a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:function(e,t,i){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i},rotationMat4v:function(e,t,i){var s,r,n,o,a,l,u=$.normalizeVec4([t[0],t[1],t[2],0],[]),A=Math.sin(e),c=Math.cos(e),h=1-c,d=u[0],p=u[1],f=u[2];return s=d*p,r=p*f,n=f*d,o=d*A,a=p*A,l=f*A,(i=i||$.mat4())[0]=h*d*d+c,i[1]=h*s+l,i[2]=h*n-a,i[3]=0,i[4]=h*s-l,i[5]=h*p*p+c,i[6]=h*r+o,i[7]=0,i[8]=h*n+a,i[9]=h*r-o,i[10]=h*f*f+c,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:function(e,t,i,s,r){return $.rotationMat4v(e,[t,i,s],r)},scalingMat4v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.identityMat4();return t[0]=e[0],t[5]=e[1],t[10]=e[2],t},scalingMat3v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.identityMat3();return t[0]=e[0],t[4]=e[1],t},scalingMat4c:function(){var e=new X(3);return function(t,i,s,r){return e[0]=t,e[1]=i,e[2]=s,$.scalingMat4v(e,r)}}(),scaleMat4c:function(e,t,i,s){return s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s},scaleMat4v:function(e,t){var i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:function(e){return $.scalingMat4c(e,e,e)},rotationTranslationMat4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.mat4(),s=e[0],r=e[1],n=e[2],o=e[3],a=s+s,l=r+r,u=n+n,A=s*a,c=s*l,h=s*u,d=r*l,p=r*u,f=n*u,v=o*a,g=o*l,m=o*u;return i[0]=1-(d+f),i[1]=c+m,i[2]=h-g,i[3]=0,i[4]=c-m,i[5]=1-(A+f),i[6]=p+v,i[7]=0,i[8]=h+g,i[9]=p-v,i[10]=1-(A+d),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=$.clamp,r=e[0],n=e[4],o=e[8],a=e[1],l=e[5],u=e[9],A=e[2],c=e[6],h=e[10];return"XYZ"===t?(i[1]=Math.asin(s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(-u,h),i[2]=Math.atan2(-n,r)):(i[0]=Math.atan2(c,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(u,-1,1)),Math.abs(u)<.99999?(i[1]=Math.atan2(o,h),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-A,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(c,-1,1)),Math.abs(c)<.99999?(i[1]=Math.atan2(-A,h),i[2]=Math.atan2(-n,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[0]=Math.atan2(c,h),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-n,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-u,l),i[1]=Math.atan2(-A,r)):(i[0]=0,i[1]=Math.atan2(o,h))):"XZY"===t&&(i[2]=Math.asin(-s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(c,l),i[1]=Math.atan2(o,r)):(i[0]=Math.atan2(-u,h),i[1]=0)),i},composeMat4:function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$.mat4();return $.quaternionToRotationMat4(t,s),$.scaleMat4v(i,s),$.translateMat4v(e,s),s},decomposeMat4:function(){var e=new X(3),t=new X(16);return function(i,s,r,n){e[0]=i[0],e[1]=i[1],e[2]=i[2];var o=$.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];var a=$.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];var l=$.lenVec3(e);$.determinantMat4(i)<0&&(o=-o),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);var u=1/o,A=1/a,c=1/l;return t[0]*=u,t[1]*=u,t[2]*=u,t[4]*=A,t[5]*=A,t[6]*=A,t[8]*=c,t[9]*=c,t[10]*=c,$.mat4ToQuaternion(t,r),n[0]=o,n[1]=a,n[2]=l,this}}(),getColMat4:function(e,t){var i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4:function(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v:function(e,t,i,s){s||(s=$.mat4());var r,n,o,a,l,u,A,c,h,d,p=e[0],f=e[1],v=e[2],g=i[0],m=i[1],_=i[2],y=t[0],b=t[1],B=t[2];return p===y&&f===b&&v===B?$.identityMat4():(r=p-y,n=f-b,o=v-B,a=m*(o*=d=1/Math.sqrt(r*r+n*n+o*o))-_*(n*=d),l=_*(r*=d)-g*o,u=g*n-m*r,(d=Math.sqrt(a*a+l*l+u*u))?(a*=d=1/d,l*=d,u*=d):(a=0,l=0,u=0),A=n*u-o*l,c=o*a-r*u,h=r*l-n*a,(d=Math.sqrt(A*A+c*c+h*h))?(A*=d=1/d,c*=d,h*=d):(A=0,c=0,h=0),s[0]=a,s[1]=A,s[2]=r,s[3]=0,s[4]=l,s[5]=c,s[6]=n,s[7]=0,s[8]=u,s[9]=h,s[10]=o,s[11]=0,s[12]=-(a*p+l*f+u*v),s[13]=-(A*p+c*f+h*v),s[14]=-(r*p+n*f+o*v),s[15]=1,s)},lookAtMat4c:function(e,t,i,s,r,n,o,a,l){return $.lookAtMat4v([e,t,i],[s,r,n],[o,a,l],[])},orthoMat4c:function(e,t,i,s,r,n,o){o||(o=$.mat4());var a=t-e,l=s-i,u=n-r;return o[0]=2/a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=-2/u,o[11]=0,o[12]=-(e+t)/a,o[13]=-(s+i)/l,o[14]=-(n+r)/u,o[15]=1,o},frustumMat4v:function(e,t,i){i||(i=$.mat4());var s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];$.addVec4(r,s,Y),$.subVec4(r,s,Z);var n=2*s[2],o=Z[0],a=Z[1],l=Z[2];return i[0]=n/o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n/a,i[6]=0,i[7]=0,i[8]=Y[0]/o,i[9]=Y[1]/a,i[10]=-Y[2]/l,i[11]=-1,i[12]=0,i[13]=0,i[14]=-n*r[2]/l,i[15]=0,i},frustumMat4:function(e,t,i,s,r,n,o){o||(o=$.mat4());var a=t-e,l=s-i,u=n-r;return o[0]=2*r/a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*r/l,o[6]=0,o[7]=0,o[8]=(t+e)/a,o[9]=(s+i)/l,o[10]=-(n+r)/u,o[11]=-1,o[12]=0,o[13]=0,o[14]=-n*r*2/u,o[15]=0,o},perspectiveMat4:function(e,t,i,s,r){var n=[],o=[];return n[2]=i,o[2]=s,o[1]=n[2]*Math.tan(e/2),n[1]=-o[1],o[0]=o[1]*t,n[0]=-o[0],$.frustumMat4v(n,o,r)},compareMat4:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},transformPoint3:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec3(),s=t[0],r=t[1],n=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*n+e[12],i[1]=e[1]*s+e[5]*r+e[9]*n+e[13],i[2]=e[2]*s+e[6]*r+e[10]*n+e[14],i},transformPoint4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4();return i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i},transformPoints3:function(e,t,i){for(var s,r,n,o,a,l=i||[],u=t.length,A=e[0],c=e[1],h=e[2],d=e[3],p=e[4],f=e[5],v=e[6],g=e[7],m=e[8],_=e[9],y=e[10],b=e[11],B=e[12],w=e[13],x=e[14],P=e[15],C=0;C2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2];e[3];var c=e[4],h=e[5],d=e[6];e[7];var p=e[8],f=e[9],v=e[10];e[11];var g=e[12],m=e[13],_=e[14];for(e[15],i=0;i2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2],c=e[3],h=e[4],d=e[5],p=e[6],f=e[7],v=e[8],g=e[9],m=e[10],_=e[11],y=e[12],b=e[13],B=e[14],w=e[15];for(i=0;i3&&void 0!==arguments[3]?arguments[3]:e,r=Math.cos(i),n=Math.sin(i),o=e[0]-t[0],a=e[1]-t[1];return s[0]=o*r-a*n+t[0],s[1]=o*n+a*r+t[1],e},rotateVec3X:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[0],n[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),n[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},rotateVec3Y:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),n[1]=r[1],n[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},rotateVec3Z:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),n[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),n[2]=r[2],s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},projectVec4:function(e,t){var i=1/e[3];return(t=t||$.vec2())[0]=e[0]*i,t[1]=e[1]*i,t},unprojectVec3:(R=new X(16),L=new X(16),U=new X(16),function(e,t,i,s){return this.transformVec3(this.mulMat4(this.inverseMat4(t,R),this.inverseMat4(i,L),U),e,s)}),lerpVec3:function(e,t,i,s,r,n){var o=n||$.vec3(),a=(e-t)/(i-t);return o[0]=s[0]+a*(r[0]-s[0]),o[1]=s[1]+a*(r[1]-s[1]),o[2]=s[2]+a*(r[2]-s[2]),o},lerpMat4:function(e,t,i,s,r,n){var o=n||$.mat4(),a=(e-t)/(i-t);return o[0]=s[0]+a*(r[0]-s[0]),o[1]=s[1]+a*(r[1]-s[1]),o[2]=s[2]+a*(r[2]-s[2]),o[3]=s[3]+a*(r[3]-s[3]),o[4]=s[4]+a*(r[4]-s[4]),o[5]=s[5]+a*(r[5]-s[5]),o[6]=s[6]+a*(r[6]-s[6]),o[7]=s[7]+a*(r[7]-s[7]),o[8]=s[8]+a*(r[8]-s[8]),o[9]=s[9]+a*(r[9]-s[9]),o[10]=s[10]+a*(r[10]-s[10]),o[11]=s[11]+a*(r[11]-s[11]),o[12]=s[12]+a*(r[12]-s[12]),o[13]=s[13]+a*(r[13]-s[13]),o[14]=s[14]+a*(r[14]-s[14]),o[15]=s[15]+a*(r[15]-s[15]),o},flatten:function(e){var t,i,s,r,n,o=[];for(t=0,i=e.length;t0&&void 0!==arguments[0]?arguments[0]:$.vec4();return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},eulerToQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=e[0]*$.DEGTORAD/2,r=e[1]*$.DEGTORAD/2,n=e[2]*$.DEGTORAD/2,o=Math.cos(s),a=Math.cos(r),l=Math.cos(n),u=Math.sin(s),A=Math.sin(r),c=Math.sin(n);return"XYZ"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l-u*A*c):"YXZ"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l+u*A*c):"ZXY"===t?(i[0]=u*a*l-o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l-u*A*c):"ZYX"===t?(i[0]=u*a*l-o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l+u*A*c):"YZX"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l-u*A*c):"XZY"===t&&(i[0]=u*a*l-o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l+u*A*c),i},mat4ToQuaternion:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),s=e[0],r=e[4],n=e[8],o=e[1],a=e[5],l=e[9],u=e[2],A=e[6],c=e[10],h=s+a+c;return h>0?(t=.5/Math.sqrt(h+1),i[3]=.25/t,i[0]=(A-l)*t,i[1]=(n-u)*t,i[2]=(o-r)*t):s>a&&s>c?(t=2*Math.sqrt(1+s-a-c),i[3]=(A-l)/t,i[0]=.25*t,i[1]=(r+o)/t,i[2]=(n+u)/t):a>c?(t=2*Math.sqrt(1+a-s-c),i[3]=(n-u)/t,i[0]=(r+o)/t,i[1]=.25*t,i[2]=(l+A)/t):(t=2*Math.sqrt(1+c-s-a),i[3]=(o-r)/t,i[0]=(n+u)/t,i[1]=(l+A)/t,i[2]=.25*t),i},vec3PairToQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=Math.sqrt($.dotVec3(e,e)*$.dotVec3(t,t)),r=s+$.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):$.cross3Vec3(e,t,i),i[3]=r,$.normalizeQuaternion(i)},angleAxisToQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:function(){var e=new X(16);return function(t,i,s){return s=s||$.vec3(),$.quaternionToRotationMat4(t,e),$.mat4ToEuler(e,i,s),s}}(),mulQuaternions:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=e[0],r=e[1],n=e[2],o=e[3],a=t[0],l=t[1],u=t[2],A=t[3];return i[0]=o*a+s*A+r*u-n*l,i[1]=o*l+r*A+n*a-s*u,i[2]=o*u+n*A+s*l-r*a,i[3]=o*A-s*a-r*l-n*u,i},vec3ApplyQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec3(),s=t[0],r=t[1],n=t[2],o=e[0],a=e[1],l=e[2],u=e[3],A=u*s+a*n-l*r,c=u*r+l*s-o*n,h=u*n+o*r-a*s,d=-o*s-a*r-l*n;return i[0]=A*u+d*-o+c*-l-h*-a,i[1]=c*u+d*-a+h*-o-A*-l,i[2]=h*u+d*-l+A*-a-c*-o,i},quaternionToMat4:function(e,t){t=$.identityMat4(t);var i=e[0],s=e[1],r=e[2],n=e[3],o=2*i,a=2*s,l=2*r,u=o*n,A=a*n,c=l*n,h=o*i,d=a*i,p=l*i,f=a*s,v=l*s,g=l*r;return t[0]=1-(f+g),t[1]=d+c,t[2]=p-A,t[4]=d-c,t[5]=1-(h+g),t[6]=v+u,t[8]=p+A,t[9]=v-u,t[10]=1-(h+f),t},quaternionToRotationMat4:function(e,t){var i=e[0],s=e[1],r=e[2],n=e[3],o=i+i,a=s+s,l=r+r,u=i*o,A=i*a,c=i*l,h=s*a,d=s*l,p=r*l,f=n*o,v=n*a,g=n*l;return t[0]=1-(h+p),t[4]=A-g,t[8]=c+v,t[1]=A+g,t[5]=1-(u+p),t[9]=d-f,t[2]=c-v,t[6]=d+f,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,i=$.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},inverseQuaternion:function(e,t){return $.normalizeQuaternion($.conjugateQuaternion(e,t))},quaternionToAngleAxis:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),i=(e=$.normalizeQuaternion(e,q))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:function(e){return new X(e||6)},AABB2:function(e){return new X(e||4)},OBB3:function(e){return new X(e||32)},OBB2:function(e){return new X(e||16)},Sphere3:function(e,t,i,s){return new X([e,t,i,s])},transformOBB3:function(e,t){var i,s,r,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2],c=e[3],h=e[4],d=e[5],p=e[6],f=e[7],v=e[8],g=e[9],m=e[10],_=e[11],y=e[12],b=e[13],B=e[14],w=e[15];for(i=0;ia?o:a,n[1]+=l>u?l:u,n[2]+=A>c?A:c,Math.abs($.lenVec3(n))}}(),getAABB3Area:function(e){return(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2])},getAABB3Center:function(e,t){var i=t||$.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center:function(e,t){var i=t||$.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$.AABB3();return e[0]=$.MAX_DOUBLE,e[1]=$.MAX_DOUBLE,e[2]=$.MAX_DOUBLE,e[3]=$.MIN_DOUBLE,e[4]=$.MIN_DOUBLE,e[5]=$.MIN_DOUBLE,e},AABB3ToOBB3:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.OBB3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t},positions3ToAABB3:function(){var e=new X(3);return function(t,i,s){i=i||$.AABB3();for(var r,n,o,a=$.MAX_DOUBLE,l=$.MAX_DOUBLE,u=$.MAX_DOUBLE,A=$.MIN_DOUBLE,c=$.MIN_DOUBLE,h=$.MIN_DOUBLE,d=0,p=t.length;dA&&(A=r),n>c&&(c=n),o>h&&(h=o);return i[0]=a,i[1]=l,i[2]=u,i[3]=A,i[4]=c,i[5]=h,i}}(),OBB3ToAABB3:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB3(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MAX_DOUBLE,l=$.MIN_DOUBLE,u=$.MIN_DOUBLE,A=$.MIN_DOUBLE,c=0,h=e.length;cl&&(l=t),i>u&&(u=i),s>A&&(A=s);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r[4]=u,r[5]=A,r},points3ToAABB3:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB3(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MAX_DOUBLE,l=$.MIN_DOUBLE,u=$.MIN_DOUBLE,A=$.MIN_DOUBLE,c=0,h=e.length;cl&&(l=t),i>u&&(u=i),s>A&&(A=s);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r[4]=u,r[5]=A,r},points3ToSphere3:function(){var e=new X(3);return function(t,i){i=i||$.vec4();var s,r=0,n=0,o=0,a=t.length;for(s=0;su&&(u=l);return i[3]=u,i}}(),positions3ToSphere3:function(){var e=new X(3),t=new X(3);return function(i,s){s=s||$.vec4();var r,n=0,o=0,a=0,l=i.length,u=0;for(r=0;ru&&(u=A);return s[3]=u,s}}(),OBB3ToSphere3:function(){var e=new X(3),t=new X(3);return function(i,s){s=s||$.vec4();var r,n=0,o=0,a=0,l=i.length,u=l/4;for(r=0;rc&&(c=A);return s[3]=c,s}}(),getSphere3Center:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},getPositionsCenter:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(),i=0,s=0,r=0,n=0,o=e.length;nt[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3]0&&void 0!==arguments[0]?arguments[0]:$.AABB2();return e[0]=$.MAX_DOUBLE,e[1]=$.MAX_DOUBLE,e[2]=$.MIN_DOUBLE,e[3]=$.MIN_DOUBLE,e},point3AABB3Intersect:function(e,t){return e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]),s<=-t&&r<=-t?-1:s>=-t&&r>=-t?1:0},OBB3ToAABB2:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB2(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MIN_DOUBLE,l=$.MIN_DOUBLE,u=0,A=e.length;ua&&(a=t),i>l&&(l=i);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r},expandAABB2:function(e,t){return e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]3&&void 0!==arguments[3]?arguments[3]:e,r=.5*(e[0]+1),n=.5*(e[1]+1),o=.5*(e[2]+1),a=.5*(e[3]+1);return s[0]=Math.floor(r*t),s[1]=i-Math.floor(a*i),s[2]=Math.floor(o*t),s[3]=i-Math.floor(n*i),s},tangentQuadraticBezier:function(e,t,i,s){return 2*(1-e)*(i-t)+2*e*(s-i)},tangentQuadraticBezier3:function(e,t,i,s,r){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r},tangentSpline:function(e){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},catmullRomInterpolate:function(e,t,i,s,r){var n=.5*(i-e),o=.5*(s-t),a=r*r;return(2*t-2*i+n+o)*(r*a)+(-3*t+3*i-2*n-o)*a+n*r+t},b2p0:function(e,t){var i=1-e;return i*i*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0:function(e,t){var i=1-e;return i*i*i*t},b3p1:function(e,t){var i=1-e;return 3*i*i*e*t},b3p2:function(e,t){return 3*(1-e)*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal:function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$.vec3(),r=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],u=i[2]-e[2],A=n*u-o*l,c=o*a-r*u,h=r*l-n*a,d=Math.sqrt(A*A+c*c+h*h);return 0===d?(s[0]=0,s[1]=0,s[2]=0):(s[0]=A/d,s[1]=c/d,s[2]=h/d),s},rayTriangleIntersect:function(){var e=new X(3),t=new X(3),i=new X(3),s=new X(3),r=new X(3);return function(n,o,a,l,u,A){A=A||$.vec3();var c=$.subVec3(l,a,e),h=$.subVec3(u,a,t),d=$.cross3Vec3(o,h,i),p=$.dotVec3(c,d);if(p<1e-6)return null;var f=$.subVec3(n,a,s),v=$.dotVec3(f,d);if(v<0||v>p)return null;var g=$.cross3Vec3(f,c,r),m=$.dotVec3(o,g);if(m<0||v+m>p)return null;var _=$.dotVec3(h,g)/p;return A[0]=n[0]+_*o[0],A[1]=n[1]+_*o[1],A[2]=n[2]+_*o[2],A}}(),rayPlaneIntersect:function(){var e=new X(3),t=new X(3),i=new X(3),s=new X(3);return function(r,n,o,a,l,u){u=u||$.vec3(),n=$.normalizeVec3(n,e);var A=$.subVec3(a,o,t),c=$.subVec3(l,o,i),h=$.cross3Vec3(A,c,s);$.normalizeVec3(h,h);var d=-$.dotVec3(o,h),p=-($.dotVec3(r,h)+d)/$.dotVec3(n,h);return u[0]=r[0]+p*n[0],u[1]=r[1]+p*n[1],u[2]=r[2]+p*n[2],u}}(),cartesianToBarycentric:function(){var e=new X(3),t=new X(3),i=new X(3);return function(s,r,n,o,a){var l=$.subVec3(o,r,e),u=$.subVec3(n,r,t),A=$.subVec3(s,r,i),c=$.dotVec3(l,l),h=$.dotVec3(l,u),d=$.dotVec3(l,A),p=$.dotVec3(u,u),f=$.dotVec3(u,A),v=c*p-h*h;if(0===v)return null;var g=1/v,m=(p*d-h*f)*g,_=(c*f-h*d)*g;return a[0]=1-m-_,a[1]=_,a[2]=m,a}}(),barycentricInsideTriangle:function(e){var t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian:function(e,t,i,s){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:$.vec3(),n=e[0],o=e[1],a=e[2];return r[0]=t[0]*n+i[0]*o+s[0]*a,r[1]=t[1]*n+i[1]*o+s[1]*a,r[2]=t[2]*n+i[2]*o+s[2]*a,r},mergeVertices:function(e,t,i,s){var r,n,o,a,l,u,A={},c=[],h=[],d=t?[]:null,p=i?[]:null,f=[],v=Math.pow(10,4),g=0;for(l=0,u=e.length;l>24&255,o=c>>16&255,n=c>>8&255,r=255&c,s=3*t[p],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,s=3*t[p+1],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,s=3*t[p+2],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,c++;return{positions:u,colors:A}},faceToVertexNormals:function(e,t){var i,s,r,n,o,a,l,u,A,c,h,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=d.smoothNormalsAngleThreshold||20,f={},v=[],g={},m=4,_=Math.pow(10,m);for(l=0,A=e.length;ll[3]&&(l[3]=r[h]),r[h+1]l[4]&&(l[4]=r[h+1]),r[h+2]l[5]&&(l[5]=r[h+2])}if(i.length<20||n>10)return u.triangles=i,u.leaf=!0,u;e[0]=l[3]-l[0],e[1]=l[4]-l[1],e[2]=l[5]-l[2];var d=0;e[1]>e[d]&&(d=1),e[2]>e[d]&&(d=2),u.splitDim=d;var p=(l[d]+l[d+3])/2,f=new Array(i.length),v=0,g=new Array(i.length),m=0;for(o=0,a=i.length;o2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));var n=Math.sqrt(i*i+s*s+r*r);return t[0]=i/n,t[1]=s/n,t[2]=r/n,t},octDecodeVec2s:function(e,t){for(var i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(n))*(o>=0?1:-1));var l=Math.sqrt(n*n+o*o+a*a);t[s+0]=n/l,t[s+1]=o/l,t[s+2]=a/l,s+=3}return t}};$.buildEdgeIndices=function(){var e=[],t=[],i=[],s=[],r=[],n=0,o=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),u=$.vec3(),A=$.vec3(),c=$.vec3(),h=$.vec3(),d=$.vec3(),p=$.vec3(),f=$.vec3();return function(v,g,m,_){!function(r,n){var o,a,l,u,A,c,h={},d=Math.pow(10,4),p=0;for(A=0,c=r.length;AI)||(F=i[P.index1],E=i[P.index2],(!S&&F>65535||E>65535)&&(S=!0),k.push(F),k.push(E));return S?new Uint32Array(k):new Uint16Array(k)}}(),$.planeClipsPositions3=function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,r=0,n=i.length;r=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&$.containsAABB3(e.left.aabb,s))this._insertEntity(e.left,t,i+1);else if(e.right&&$.containsAABB3(e.right.aabb,s))this._insertEntity(e.right,t,i+1);else{var r=e.aabb;ee[0]=r[3]-r[0],ee[1]=r[4]-r[1],ee[2]=r[5]-r[2];var n=0;if(ee[1]>ee[n]&&(n=1),ee[2]>ee[n]&&(n=2),!e.left){var o=r.slice();if(o[n+3]=(r[n]+r[n+3])/2,e.left={aabb:o},$.containsAABB3(o,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){var a=r.slice();if(a[n]=(r[n]+r[n+3])/2,e.right={aabb:a},$.containsAABB3(a,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}}},{key:"destroy",value:function(){var e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}}]),e}(),ie=function(){function e(){x(this,e),this._head=[],this._headLength=0,this._tail=[],this._index=0,this._length=0}return C(e,[{key:"length",get:function(){return this._length}},{key:"shift",value:function(){if(this._index>=this._headLength){var e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}var t=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,t}},{key:"push",value:function(e){return this._length++,this._tail.push(e),this}},{key:"unshift",value:function(e){return this._head[--this._index]=e,this._length++,this}}]),e}(),se={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var re=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r1&&void 0!==arguments[1]?arguments[1]:null;ce.push(e),ce.push(t)},this.runTasks=function(){for(var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,s=(new Date).getTime(),r=0;ce.length>0&&(i<0||s0&&ae>0){var t=1e3/ae;fe+=t,de.push(t),de.length>=30&&(fe-=de.shift()),se.frame.fps=Math.round(fe/de.length)}for(var i in _e.scenes)_e.scenes[i].compile();be(e),pe=e};ve=function(){ye()},ge=100,me=Date.now()+ge,function e(){var t=Date.now()-me;ve(),me+=ge,setTimeout(e,Math.max(0,ge-t))}();function be(e){var t=_e.runTasks(e+10),i=_e.getNumTasks();se.frame.tasksRun=t,se.frame.tasksScheduled=i,se.frame.tasksBudget=10}!function e(){var t=Date.now();if(ae=t-pe,pe>0&&ae>0){var i=1e3/ae;fe+=i,de.push(i),de.length>=30&&(fe-=de.shift()),se.frame.fps=Math.round(fe/de.length)}be(t),function(e){for(var t in he.time=e,_e.scenes)if(_e.scenes.hasOwnProperty(t)){var i=_e.scenes[t];he.sceneId=t,he.startTime=i.startTime,he.deltaTime=null!=he.prevTime?he.time-he.prevTime:0,i.fire("tick",he,!0)}he.prevTime=e}(t),function(){var e,t,i,s,r,n=_e.scenes,o=!1;for(r in n)n.hasOwnProperty(r)&&(e=n[r],(t=ue[r])||(t=ue[r]={}),i=e.ticksPerOcclusionTest,t.ticksPerOcclusionTest!==i&&(t.ticksPerOcclusionTest=i,t.renderCountdown=i),--e.occlusionTestCountdown<=0&&(e.doOcclusionTest(),e.occlusionTestCountdown=i),s=e.ticksPerRender,t.ticksPerRender!==s&&(t.ticksPerRender=s,t.renderCountdown=s),0==--t.renderCountdown&&(e.render(o),t.renderCountdown=s))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(ye):requestAnimationFrame(e)}();var Be=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,e),this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=i.viewer;else{if("Scene"===t.type)this.scene=t;else{if(!(t instanceof e))throw"Invalid param: owner must be a Component";this.scene=t.scene}this._owner=t}this._dontClear=!!i.dontClear,this._renderer=this.scene._renderer,this.meta=i.meta||{},this.id=i.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,t&&t._own(this)}return C(e,[{key:"type",get:function(){return"Component"}},{key:"isComponent",get:function(){return!0}},{key:"glRedraw",value:function(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}},{key:"glResort",value:function(){this._renderer&&this._renderer.needStateSort()}},{key:"owner",get:function(){return this._owner}},{key:"isType",value:function(e){return this.type===e}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);var s,r=this._eventSubs[e];if(r)for(var n in r)r.hasOwnProperty(n)&&(s=r[n],this._eventCallDepth++,this._eventCallDepth<300?s.callback.call(s.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}},{key:"on",value:function(e,t,i){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new Q),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});var s=this._eventSubs[e];s?this._eventSubsNum[e]++:(s={},this._eventSubs[e]=s,this._eventSubsNum[e]=1);var r=this._subIdMap.addItem();s[r]={callback:t,scope:i||this},this._subIdEvents[r]=e;var n=this._events[e];return void 0!==n&&t.call(i||this,n),r}},{key:"off",value:function(e){if(null!=e&&this._subIdEvents){var t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];var i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}}},{key:"once",value:function(e,t,i){var s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}},{key:"hasSubs",value:function(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}},{key:"log",value:function(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}},{key:"_message",value:function(e){return" ["+this.type+" "+le.inQuotes(this.id)+"]: "+e}},{key:"warn",value:function(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}},{key:"error",value:function(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}},{key:"_attach",value:function(e){var t=e.name;if(t){var i=e.component,s=e.sceneDefault,r=e.sceneSingleton,n=e.type,o=e.on,a=!1!==e.recompiles;if(i&&(le.isNumeric(i)||le.isString(i))){var l=i;if(!(i=this.scene.components[l]))return void this.error("Component not found: "+le.inQuotes(l))}if(!i)if(!0===r){var u=this.scene.types[n];for(var A in u)if(u.hasOwnProperty){i=u[A];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&!(i=this.scene[t]))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+le.inQuotes(i.id));if(n&&!i.isType(n))return void this.error("Expected a "+n+" type or subtype: "+i.type+" "+le.inQuotes(i.id))}this._attachments||(this._attachments={});var c,h,d,p=this._attached[t];if(p){if(i&&p.id===i.id)return;var f=this._attachments[p.id];for(h=0,d=(c=f.subs).length;h=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}]),e}(),Me=C((function e(){x(this,e),this.planes=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce]}));function Fe(e,t,i){var s=$.mulMat4(i,t,Pe),r=s[0],n=s[1],o=s[2],a=s[3],l=s[4],u=s[5],A=s[6],c=s[7],h=s[8],d=s[9],p=s[10],f=s[11],v=s[12],g=s[13],m=s[14],_=s[15];e.planes[0].set(a-r,c-l,f-h,_-v),e.planes[1].set(a+r,c+l,f+h,_+v),e.planes[2].set(a-n,c-u,f-d,_-g),e.planes[3].set(a+n,c+u,f+d,_+g),e.planes[4].set(a-o,c-A,f-p,_-m),e.planes[5].set(a+o,c+A,f+p,_+m)}function Ee(e,t){var i=Me.INSIDE,s=we,r=xe;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];for(var n=[s,r],o=0;o<6;++o){var a=e.planes[o];if(a.normal[0]*n[a.testVertex[0]][0]+a.normal[1]*n[a.testVertex[1]][1]+a.normal[2]*n[a.testVertex[2]][2]+a.offset<0)return Me.OUTSIDE;a.normal[0]*n[1-a.testVertex[0]][0]+a.normal[1]*n[1-a.testVertex[1]][1]+a.normal[2]*n[1-a.testVertex[2]][2]+a.offset<0&&(i=Me.INTERSECT)}return i}Me.INSIDE=0,Me.INTERSECT=1,Me.OUTSIDE=2;var ke=function(e){g(i,Be);var t=_(i);function i(){var e,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(x(this,i),!s.viewer)throw"[MarqueePicker] Missing config: viewer";if(!s.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";return(e=t.call(this,s.viewer.scene,s)).viewer=s.viewer,e._objectsKdTree3=s.objectsKdTree3,e._canvasMarqueeCorner1=$.vec2(),e._canvasMarqueeCorner2=$.vec2(),e._canvasMarquee=$.AABB2(),e._marqueeFrustum=new Me,e._marqueeFrustumProjMat=$.mat4(),e._pickMode=!1,e._marqueeElement=document.createElement("div"),document.body.appendChild(e._marqueeElement),e._marqueeElement.style.position="absolute",e._marqueeElement.style["z-index"]="40000005",e._marqueeElement.style.width="8px",e._marqueeElement.style.height="8px",e._marqueeElement.style.visibility="hidden",e._marqueeElement.style.top="0px",e._marqueeElement.style.left="0px",e._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",e._marqueeElement.style.opacity=1,e._marqueeElement.style["pointer-events"]="none",e}return C(i,[{key:"setMarqueeCorner1",value:function(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}},{key:"setMarqueeCorner2",value:function(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}},{key:"setMarquee",value:function(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}},{key:"setMarqueeVisible",value:function(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}},{key:"getMarqueeVisible",value:function(){return this._marqueVisible}},{key:"setPickMode",value:function(e){if(e!==i.PICK_MODE_INSIDE&&e!==i.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===i.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}},{key:"getPickMode",value:function(){return this._pickMode}},{key:"clear",value:function(){this.fire("clear",{})}},{key:"pick",value:function(){var e=this;this._updateMarquee(),this._buildMarqueeFrustum();var t=[];return(this._canvasMarquee[2]-this._canvasMarquee[0]>3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&function s(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Me.INTERSECT;if(n===Me.INTERSECT&&(n=Ee(e._marqueeFrustum,r.aabb)),n!==Me.OUTSIDE){if(r.entities)for(var o=r.entities,a=0,l=o.length;a3||i>3)&&c.pick()}})),document.addEventListener("mouseup",(function(e){s.getActive()&&0===e.button&&(clearTimeout(A),d&&(c.setMarqueeVisible(!1),d=!1,p=!1,f=!0,c.viewer.cameraControl.pointerEnabled=!0))}),!0),h.addEventListener("mousemove",(function(e){s.getActive()&&0===e.button&&p&&(clearTimeout(A),d&&(o=e.pageX,a=e.pageY,u=e.offsetX,c.setMarqueeVisible(!0),c.setMarqueeCorner2([o,a]),c.setPickMode(l1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.viewer=t,this.scene=this.viewer.scene,this._circleDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._circleDiv,this.viewer.scene.canvas.canvas),this._circleDiv.style.backgroundColor="transparent",this._circleDiv.style.border="2px solid green",this._circleDiv.style.borderRadius="50px",this._circleDiv.style.width="50px",this._circleDiv.style.height="50px",this._circleDiv.style.margin="-200px -200px",this._circleDiv.style.zIndex="100000",this._circleDiv.style.position="absolute",this._circleDiv.style.pointerEvents="none",this._circlePos=null,this._circleMaxRadius=200,this._circleMinRadius=2,this._active=!1!==i.active,this._visible=!1,this._running=!1,this._destroyed=!1}return C(e,[{key:"start",value:function(e){var t=this;if(!this._destroyed){this._circlePos=e,this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius="".concat(this._circleRadius,"px"),this._circleDiv.style.marginLeft="".concat(this._circlePos[0]-this._circleRadius,"px"),this._circleDiv.style.marginTop="".concat(this._circlePos[1]-this._circleRadius,"px");var i,s=this._circleMaxRadius;this._running=!0,requestAnimationFrame((function e(r){if(t._running){i||(i=r);var n=r-i,o=Math.min(n/300,1),a=s+(2-s)*o;t._circleRadius=a,t._circleDiv.style.width="".concat(t._circleRadius,"px"),t._circleDiv.style.height="".concat(t._circleRadius,"px"),t._circleDiv.style.marginLeft="".concat(t._circlePos[0]-t._circleRadius/2,"px"),t._circleDiv.style.marginTop="".concat(t._circlePos[1]-t._circleRadius/2,"px"),o<1&&requestAnimationFrame(e)}})),this._circleDiv.style.visibility="visible"}}},{key:"stop",value:function(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius="".concat(this._circleRadius,"px"),this._circleDiv.style.visibility="hidden")}},{key:"durationMs",get:function(){return this._durationMs},set:function(e){this.stop(),this._durationMs=e}},{key:"destroy",value:function(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}]),e}(),Se=function(){function e(t,i,s){x(this,e),this.id=s&&s.id?s.id:t,this.viewer=i,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,i.addPlugin(this)}return C(e,[{key:"scheduleTask",value:function(e){_e.scheduleTask(e,null)}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);var s,r=this._eventSubs[e];if(r)for(var n in r)r.hasOwnProperty(n)&&(s=r[n],this._eventCallDepth++,this._eventCallDepth<300?s.callback.call(s.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}},{key:"on",value:function(e,t,i){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new Q),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});var s=this._eventSubs[e];s?this._eventSubsNum[e]++:(s={},this._eventSubs[e]=s,this._eventSubsNum[e]=1);var r=this._subIdMap.addItem();s[r]={callback:t,scope:i||this},this._subIdEvents[r]=e;var n=this._events[e];return void 0!==n&&t.call(i||this,n),r}},{key:"off",value:function(e){if(null!=e&&this._subIdEvents){var t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];var i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}}},{key:"once",value:function(e,t,i){var s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}},{key:"hasSubs",value:function(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}},{key:"log",value:function(e){console.log("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"warn",value:function(e){console.warn("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"error",value:function(e){console.error("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"send",value:function(e,t){}},{key:"destroy",value:function(){this.viewer.removePlugin(this)}}]),e}(),Te=$.vec3(),Re=function(){var e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,n){return n=n||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,$.transformVec4(s,t,i),$.setMat4Translation(s,i,n),n.slice()}}();function Le(e,t,i){var s=Float32Array.from([e[0]])[0],r=e[0]-s,n=Float32Array.from([e[1]])[0],o=e[1]-n,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=n,t[2]=a,i[0]=r,i[1]=o,i[2]=l}function Ue(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3,r=$.getPositionsCenter(e,Te),n=Math.round(r[0]/s)*s,o=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=n,i[1]=o,i[2]=a;var l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(var u=0,A=e.length;u0?this.meshes[0]._colorize[3]/255:1},set:function(e){if(0!==this.meshes.length){var t=null!=e,i=this.meshes[0]._colorize[3],s=255;if(t){if(e<0?e=0:e>1&&(e=1),i===(s=Math.floor(255*e)))return}else if(i===(s=255))return;for(var r=0,n=this.meshes.length;r1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._color=s.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=s.thickness||1,this._thicknessClickable=s.thicknessClickable||6,this._visible=!0,this._culled=!1;var r=this._wire,n=r.style;n.border="solid "+this._thickness+"px "+this._color,n.position="absolute",n["z-index"]=void 0===s.zIndex?"2000001":s.zIndex,n.width="0px",n.height="0px",n.visibility="visible",n.top="0px",n.left="0px",n["-webkit-transform-origin"]="0 0",n["-moz-transform-origin"]="0 0",n["-ms-transform-origin"]="0 0",n["-o-transform-origin"]="0 0",n["transform-origin"]="0 0",n["-webkit-transform"]="rotate(0deg)",n["-moz-transform"]="rotate(0deg)",n["-ms-transform"]="rotate(0deg)",n["-o-transform"]="rotate(0deg)",n.transform="rotate(0deg)",n.opacity=1,n["pointer-events"]="none",s.onContextMenu,t.appendChild(r);var o=this._wireClickable,a=o.style;a.border="solid "+this._thicknessClickable+"px "+this._color,a.position="absolute",a["z-index"]=void 0===s.zIndex?"2000002":s.zIndex+1,a.width="0px",a.height="0px",a.visibility="visible",a.top="0px",a.left="0px",a["-webkit-transform-origin"]="0 0",a["-moz-transform-origin"]="0 0",a["-ms-transform-origin"]="0 0",a["-o-transform-origin"]="0 0",a["transform-origin"]="0 0",a["-webkit-transform"]="rotate(0deg)",a["-moz-transform"]="rotate(0deg)",a["-ms-transform"]="rotate(0deg)",a["-o-transform"]="rotate(0deg)",a.transform="rotate(0deg)",a.opacity=0,a["pointer-events"]="none",s.onContextMenu,t.appendChild(o),s.onMouseOver&&o.addEventListener("mouseover",(function(e){s.onMouseOver(e,i)})),s.onMouseLeave&&o.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i)})),s.onMouseWheel&&o.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&o.addEventListener("mousedown",(function(e){s.onMouseDown(e,i)})),s.onMouseUp&&o.addEventListener("mouseup",(function(e){s.onMouseUp(e,i)})),s.onMouseMove&&o.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&o.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}return C(e,[{key:"visible",get:function(){return"visible"===this._wire.style.visibility}},{key:"_update",value:function(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}},{key:"setStartAndEnd",value:function(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}},{key:"setColor",value:function(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}},{key:"setOpacity",value:function(e){this._wire.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setClickable",value:function(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}},{key:"destroy",value:function(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}]),e}(),it=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!s.visible,this._culled=!1;var r=this._dot,n=r.style;n["border-radius"]="25px",n.border="solid 2px white",n.background="lightgreen",n.position="absolute",n["z-index"]=void 0===s.zIndex?"40000005":s.zIndex,n.width="8px",n.height="8px",n.visibility=!1!==s.visible?"visible":"hidden",n.top="0px",n.left="0px",n["box-shadow"]="0 2px 5px 0 #182A3D;",n.opacity=1,n["pointer-events"]="none",s.onContextMenu,t.appendChild(r);var o=this._dotClickable,a=o.style;a["border-radius"]="35px",a.border="solid 10px white",a.position="absolute",a["z-index"]=void 0===s.zIndex?"40000007":s.zIndex+1,a.width="8px",a.height="8px",a.visibility="visible",a.top="0px",a.left="0px",a.opacity=0,a["pointer-events"]="none",s.onContextMenu,t.appendChild(o),o.addEventListener("click",(function(e){t.dispatchEvent(new MouseEvent("mouseover",e))})),s.onMouseOver&&o.addEventListener("mouseover",(function(e){s.onMouseOver(e,i),t.dispatchEvent(new MouseEvent("mouseover",e))})),s.onMouseLeave&&o.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i)})),s.onMouseWheel&&o.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&o.addEventListener("mousedown",(function(e){s.onMouseDown(e,i)})),s.onMouseUp&&o.addEventListener("mouseup",(function(e){s.onMouseUp(e,i)})),s.onMouseMove&&o.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&o.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation()})),this.setPos(s.x||0,s.y||0),this.setFillColor(s.fillColor),this.setBorderColor(s.borderColor)}return C(e,[{key:"setPos",value:function(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}},{key:"setFillColor",value:function(e){this._dot.style.background=e||"lightgreen"}},{key:"setBorderColor",value:function(e){this._dot.style.border="solid 2px"+(e||"black")}},{key:"setOpacity",value:function(e){this._dot.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setClickable",value:function(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}},{key:"destroy",value:function(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}]),e}(),st=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._highlightClass="viewer-ruler-label-highlighted",this._prefix=s.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var r=this._label,n=r.style;n["border-radius"]="5px",n.color="white",n.padding="4px",n.border="solid 1px",n.background="lightgreen",n.position="absolute",n["z-index"]=void 0===s.zIndex?"5000005":s.zIndex,n.width="auto",n.height="auto",n.visibility="visible",n.top="0px",n.left="0px",n["pointer-events"]="all",n.opacity=1,s.onContextMenu,r.innerText="",t.appendChild(r),this.setPos(s.x||0,s.y||0),this.setFillColor(s.fillColor),this.setBorderColor(s.fillColor),this.setText(s.text),s.onMouseOver&&r.addEventListener("mouseover",(function(e){s.onMouseOver(e,i),e.preventDefault()})),s.onMouseLeave&&r.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i),e.preventDefault()})),s.onMouseWheel&&r.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&r.addEventListener("mousedown",(function(e){s.onMouseDown(e,i),e.stopPropagation()})),s.onMouseUp&&r.addEventListener("mouseup",(function(e){s.onMouseUp(e,i),e.stopPropagation()})),s.onMouseMove&&r.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&r.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}return C(e,[{key:"setPos",value:function(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}},{key:"setPosOnWire",value:function(e,t,i,s){var r=e+.5*(i-e),n=t+.5*(s-t),o=this._label.style;o.left=Math.round(r)-20+"px",o.top=Math.round(n)-12+"px"}},{key:"setPosBetweenWires",value:function(e,t,i,s,r,n){var o=(e+i+r)/3,a=(t+s+n)/3,l=this._label.style;l.left=Math.round(o)-20+"px",l.top=Math.round(a)-12+"px"}},{key:"setText",value:function(e){this._label.innerHTML=this._prefix+(e||"")}},{key:"setFillColor",value:function(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}},{key:"setBorderColor",value:function(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}},{key:"setOpacity",value:function(e){this._label.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}},{key:"setClickable",value:function(e){this._label.style["pointer-events"]=e?"all":"none"}},{key:"destroy",value:function(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}]),e}(),rt=$.vec3(),nt=$.vec3(),ot=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e.viewer.scene,r)).plugin=e,s._container=r.container,!s._container)throw"config missing: container";s._color=r.color||e.defaultColor;var n=s.plugin.viewer.scene;s._originMarker=new et(n,r.origin),s._cornerMarker=new et(n,r.corner),s._targetMarker=new et(n,r.target),s._originWorld=$.vec3(),s._cornerWorld=$.vec3(),s._targetWorld=$.vec3(),s._wp=new Float64Array(12),s._vp=new Float64Array(12),s._pp=new Float64Array(12),s._cp=new Int16Array(6);var o=r.onMouseOver?function(e){r.onMouseOver(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,a=r.onMouseLeave?function(e){r.onMouseLeave(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,l=r.onContextMenu?function(e){r.onContextMenu(e,b(s))}:null,u=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},A=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},c=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},h=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};return s._originDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._cornerDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._targetDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._originWire=new tt(s._container,{color:s._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._targetWire=new tt(s._container,{color:s._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._angleLabel=new st(s._container,{fillColor:s._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._wpDirty=!1,s._vpDirty=!1,s._cpDirty=!1,s._visible=!1,s._originVisible=!1,s._cornerVisible=!1,s._targetVisible=!1,s._originWireVisible=!1,s._targetWireVisible=!1,s._angleVisible=!1,s._labelsVisible=!1,s._clickable=!1,s._originMarker.on("worldPos",(function(e){s._originWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._cornerMarker.on("worldPos",(function(e){s._cornerWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._targetMarker.on("worldPos",(function(e){s._targetWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._onViewMatrix=n.camera.on("viewMatrix",(function(){s._vpDirty=!0,s._needUpdate(0)})),s._onProjMatrix=n.camera.on("projMatrix",(function(){s._cpDirty=!0,s._needUpdate()})),s._onCanvasBoundary=n.canvas.on("boundary",(function(){s._cpDirty=!0,s._needUpdate(0)})),s._onSectionPlaneUpdated=n.on("sectionPlaneUpdated",(function(){s._sectionPlanesDirty=!0,s._needUpdate()})),s.approximate=r.approximate,s.visible=r.visible,s.originVisible=r.originVisible,s.cornerVisible=r.cornerVisible,s.targetVisible=r.targetVisible,s.originWireVisible=r.originWireVisible,s.targetWireVisible=r.targetWireVisible,s.angleVisible=r.angleVisible,s.labelsVisible=r.labelsVisible,s}return C(i,[{key:"_update",value:function(){if(this._visible){var e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&($.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){var t=-.3,i=this._originMarker.viewPos[2],s=this._cornerMarker.viewPos[2],r=this._targetMarker.viewPos[2];if(i>t||s>t||r>t)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);$.transformPositions4(e.camera.project.matrix,this._vp,this._pp);for(var n=this._pp,o=this._cp,a=e.canvas.canvas.getBoundingClientRect(),l=this._container.getBoundingClientRect(),u=a.top-l.top,A=a.left-l.left,c=e.canvas.boundary,h=c[2],d=c[3],p=0,f=0,v=n.length;f1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e.viewer.scene))._canvasToPagePos=r.canvasToPagePos,s.pointerLens=r.pointerLens,s._active=!1,s._mouseState=0,s._currentAngleMeasurement=null,s._initMarkerDiv(),s._onMouseHoverSurface=null,s._onHoverNothing=null,s._onPickedNothing=null,s._onPickedSurface=null,s._onInputMouseDown=null,s._onInputMouseUp=null,s._snapping=!1!==r.snapping,s._attachPlugin(e,r),s}return C(i,[{key:"_initMarkerDiv",value:function(){var e=document.createElement("div");e.setAttribute("id","myMarkerDiv");var t=this.scene.canvas.canvas;t.parentNode.insertBefore(e,t),e.style.background="black",e.style.border="2px solid blue",e.style.borderRadius="10px",e.style.width="5px",e.style.height="5px",e.style.top="-200px",e.style.left="-200px",e.style.margin="0 0",e.style.zIndex="100",e.style.position="absolute",e.style.pointerEvents="none",this.markerDiv=e}},{key:"_destroyMarkerDiv",value:function(){if(this._markerDiv){var e=document.getElementById("myMarkerDiv");e.parentNode.removeChild(e),this._markerDiv=null}}},{key:"_attachPlugin",value:function(e){this.angleMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){this.markerDiv||this._initMarkerDiv(),this.angleMeasurementsPlugin;var t=this.scene;t.input;var i=t.canvas.canvas,s=this.angleMeasurementsPlugin.viewer.cameraControl,r=this.pointerLens,n=!1,o=null,a=0,l=0,u=$.vec3(),A=$.vec2();this._currentAngleMeasurement=null;var c=function e(t){return t.offsetTop+(t.offsetParent&&t.offsetParent!==i.parentNode&&e(t.offsetParent))},h=function e(t){return t.offsetLeft+(t.offsetParent&&t.offsetParent!==i.parentNode&&e(t.offsetParent))},d=$.vec2();this._onMouseHoverSurface=s.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(function(t){t.snappedToVertex||t.snappedToEdge?(r&&(r.visible=!0,r.canvasPos=t.canvasPos,r.snappedCanvasPos=t.snappedCanvasPos||t.canvasPos,r.snapped=!0),e.markerDiv.style.background="greenyellow",e.markerDiv.style.border="2px solid green"):(r&&(r.visible=!0,r.canvasPos=t.canvasPos,r.snappedCanvasPos=t.canvasPos,r.snapped=!1),e.markerDiv.style.background="pink",e.markerDiv.style.border="2px solid red");var s=t.snappedCanvasPos||t.canvasPos;switch(n=!0,o=t.entity,u.set(t.worldPos),A.set(s),e._mouseState){case 0:e._canvasToPagePos?(e._canvasToPagePos(i,s,d),e.markerDiv.style.left="".concat(d[0]-5,"px"),e.markerDiv.style.top="".concat(d[1]-5,"px")):(e.markerDiv.style.left="".concat(h(i)+s[0]-5,"px"),e.markerDiv.style.top="".concat(c(i)+s[1]-5,"px"));break;case 1:e._currentAngleMeasurement&&(e._currentAngleMeasurement.originWireVisible=!0,e._currentAngleMeasurement.targetWireVisible=!1,e._currentAngleMeasurement.cornerVisible=!0,e._currentAngleMeasurement.angleVisible=!1,e._currentAngleMeasurement.corner.worldPos=t.worldPos,e._currentAngleMeasurement.corner.entity=t.entity),e.markerDiv.style.left="-10000px",e.markerDiv.style.top="-10000px",i.style.cursor="pointer";break;case 2:e._currentAngleMeasurement&&(e._currentAngleMeasurement.targetWireVisible=!0,e._currentAngleMeasurement.targetVisible=!0,e._currentAngleMeasurement.angleVisible=!0,e._currentAngleMeasurement.target.worldPos=t.worldPos,e._currentAngleMeasurement.target.entity=t.entity),e.markerDiv.style.left="-10000px",e.markerDiv.style.top="-10000px",i.style.cursor="pointer"}})),i.addEventListener("mousedown",this._onMouseDown=function(e){1===e.which&&(a=e.clientX,l=e.clientY)}),i.addEventListener("mouseup",this._onMouseUp=function(t){if(1===t.which&&!(t.clientX>a+20||t.clientXl+20||t.clientY1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"AngleMeasurements",e))._container=r.container||document.body,s._defaultControl=null,s._measurements={},s.defaultColor=void 0!==r.defaultColor?r.defaultColor:"#00BBFF",s.defaultLabelsVisible=!1!==r.defaultLabelsVisible,s.zIndex=r.zIndex||1e4,s._onMouseOver=function(e,t){s.fire("mouseOver",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s._onMouseLeave=function(e,t){s.fire("mouseLeave",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s._onContextMenu=function(e,t){s.fire("contextMenu",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){}},{key:"control",get:function(){return this._defaultControl||(this._defaultControl=new lt(this,{})),this._defaultControl}},{key:"measurements",get:function(){return this._measurements}},{key:"createMeasurement",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=t.origin,s=t.corner,r=t.target,n=new ot(this,{id:t.id,plugin:this,container:this._container,origin:{entity:i.entity,worldPos:i.worldPos},corner:{entity:s.entity,worldPos:s.worldPos},target:{entity:r.entity,worldPos:r.worldPos},visible:t.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[n.id]=n,n.on("destroyed",(function(){delete e._measurements[n.id]})),n.clickable=!0,this.fire("measurementCreated",n),n}},{key:"destroyMeasurement",value:function(e){var t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}},{key:"setLabelsShown",value:function(e){for(var t=0,i=Object.entries(this.measurements);t1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e.viewer.scene)).pointerLens=r.pointerLens,s.pointerCircle=new De(e.viewer),s._active=!1;var n=document.createElement("div"),o=s.scene.canvas.canvas;return o.parentNode.insertBefore(n,o),n.style.background="black",n.style.border="2px solid blue",n.style.borderRadius="10px",n.style.width="5px",n.style.height="5px",n.style.margin="-200px -200px",n.style.zIndex="100",n.style.position="absolute",n.style.pointerEvents="none",s.markerDiv=n,s._currentAngleMeasurement=null,s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._longTouchTimeoutMs=300,s._snapping=!1!==r.snapping,s._touchState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_attachPlugin",value:function(e){this.angleMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){var t=this.plugin,i=this.scene,s=i.canvas.canvas;t.pointerLens;var r=$.vec3(),n=20,o=null;this._touchState=0;var a=$.vec2(),l=$.vec2(),u=$.vec2(),A=null,c=function(){e.plugin.viewer.cameraControl.active=!1},h=function(){e.plugin.viewer.cameraControl.active=!0};s.addEventListener("touchstart",this._onCanvasTouchStart=function(s){var u=s.touches.length;if(1===u){var d=s.touches[0],p=d.clientX,f=d.clientY;switch(a.set([p,f]),l.set([p,f]),e._touchState){case 0:if(1!==u&&null!==o)return o&&(clearTimeout(o),o=null),e._currentAngleMeasurement&&(e._currentAngleMeasurement.destroy(),e._currentAngleMeasurement=null),h(),void(e._touchState=0);var v=i.pick({canvasPos:l,snapToVertex:e._snapping,snapToEdge:e._snapping});if(v&&v.snapped)r.set(v.worldPos),e.pointerCircle.start(v.snappedCanvasPos);else{var g=i.pick({canvasPos:l,pickSurface:!0});if(!g||!g.worldPos)return;r.set(g.worldPos),e.pointerCircle.start(g.canvasPos)}o=setTimeout((function(){1!==u||l[0]>a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||da[1]+n||pa[0]+n||da[1]+n||pa[0]+n||da[1]+n||p

";le.isArray(t)&&(t=t.join("")),t=this._renderTemplate(t.trim());var i=document.createRange().createContextualFragment(t);this._marker=i.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(function(){e.plugin.fire("markerClicked",e)})),this._marker.addEventListener("mouseenter",(function(){e.plugin.fire("markerMouseEnter",e)})),this._marker.addEventListener("mouseleave",(function(){e.plugin.fire("markerMouseLeave",e)})),this._marker.addEventListener("wheel",(function(t){e.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",t))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);var s=this._labelHTML||"

";le.isArray(s)&&(s=s.join("")),s=this._renderTemplate(s.trim());var r=document.createRange().createContextualFragment(s);this._label=r.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(function(t){e.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",t))}))}}},{key:"_updatePosition",value:function(){var e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}},{key:"_renderTemplate",value:function(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){var i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}},{key:"setMarkerShown",value:function(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}},{key:"getMarkerShown",value:function(){return this._markerShown}},{key:"setLabelShown",value:function(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}},{key:"getLabelShown",value:function(){return this._labelShown}},{key:"setField",value:function(e,t){this._values[e]=t||"",this._htmlDirty=!0}},{key:"getField",value:function(e){return this._values[e]}},{key:"setValues",value:function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];this.setField(t,i)}}},{key:"getValues",value:function(){return this._values}},{key:"destroy",value:function(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),ht=$.vec3(),dt=$.vec3(),pt=$.vec3(),ft=function(e){g(i,Se);var t=_(i);function i(e,s){var r;return x(this,i),(r=t.call(this,"Annotations",e))._labelHTML=s.labelHTML||"
",r._markerHTML=s.markerHTML||"
",r._container=s.container||document.body,r._values=s.values||{},r.annotations={},r.surfaceOffset=s.surfaceOffset,r}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){if("clearAnnotations"===e)this.clear()}},{key:"surfaceOffset",get:function(){return this._surfaceOffset},set:function(e){null==e&&(e=.3),this._surfaceOffset=e}},{key:"createAnnotation",value:function(e){var t,i,s=this;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){var r=e.pickResult;if(r.worldPos&&r.worldNormal){var n=$.normalizeVec3(r.worldNormal,ht),o=$.mulVec3Scalar(n,this._surfaceOffset,dt);t=$.addVec3(r.worldPos,o,pt),i=r.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var a=null;e.markerElementId&&((a=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var l=null;e.labelElementId&&((l=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));var u=new ct(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:a,labelElement:l,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:le.apply(e.values,le.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[u.id]=u,u.on("destroyed",(function(){delete s.annotations[u.id],s.fire("annotationDestroyed",u.id)})),this.fire("annotationCreated",u.id),u}},{key:"destroyAnnotation",value:function(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}},{key:"clear",value:function(){for(var e=Object.keys(this.annotations),t=0,i=e.length;t1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._canvas=r.canvas,s._element=null,s._isCustom=!1,r.elementId&&(s._element=document.getElementById(r.elementId),s._element?s._adjustPosition():s.error("Can't find given Spinner HTML element: '"+r.elementId+"' - will automatically create default element")),s._element||s._createDefaultSpinner(),s.processes=0,s}return C(i,[{key:"type",get:function(){return"Spinner"}},{key:"_createDefaultSpinner",value:function(){this._injectDefaultCSS();var e=document.createElement("div"),t=e.style;t["z-index"]="9000",t.position="absolute",e.innerHTML='
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}},{key:"_injectDefaultCSS",value:function(){var e="xeokit-spinner-css";if(!document.getElementById(e)){var t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}}},{key:"_adjustPosition",value:function(){if(!this._isCustom){var e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}}},{key:"processes",get:function(){return this._processes},set:function(e){if(e=e||0,this._processes!==e&&!(e<0)){var t=this._processes;this._processes=e;var i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}}},{key:"_destroy",value:function(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);var e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}]),i}(),gt=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"],mt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._backgroundColor=$.vec3([r.backgroundColor?r.backgroundColor[0]:1,r.backgroundColor?r.backgroundColor[1]:1,r.backgroundColor?r.backgroundColor[2]:1]),s._backgroundColorFromAmbientLight=!!r.backgroundColorFromAmbientLight,s.canvas=r.canvas,s.gl=null,s.webgl2=!1,s.transparent=!!r.transparent,s.contextAttr=r.contextAttr||{},s.contextAttr.alpha=s.transparent,s.contextAttr.preserveDrawingBuffer=!!s.contextAttr.preserveDrawingBuffer,s.contextAttr.stencil=!1,s.contextAttr.premultipliedAlpha=!!s.contextAttr.premultipliedAlpha,s.contextAttr.antialias=!1!==s.contextAttr.antialias,s.resolutionScale=r.resolutionScale,s.canvas.width=Math.round(s.canvas.clientWidth*s._resolutionScale),s.canvas.height=Math.round(s.canvas.clientHeight*s._resolutionScale),s.boundary=[s.canvas.offsetLeft,s.canvas.offsetTop,s.canvas.clientWidth,s.canvas.clientHeight],s._initWebGL(r);var n=b(s);s.canvas.addEventListener("webglcontextlost",s._webglcontextlostListener=function(e){console.time("webglcontextrestored"),n.scene._webglContextLost(),n.fire("webglcontextlost"),e.preventDefault()},!1),s.canvas.addEventListener("webglcontextrestored",s._webglcontextrestoredListener=function(e){n._initWebGL(),n.gl&&(n.scene._webglContextRestored(n.gl),n.fire("webglcontextrestored",n.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);var o=!0,a=new ResizeObserver((function(e){var t,i=c(e);try{for(i.s();!(t=i.n()).done;){t.value.contentBoxSize&&(o=!0)}}catch(e){i.e(e)}finally{i.f()}}));return a.observe(s.canvas),s._tick=s.scene.on("tick",(function(){o&&(o=!1,n.canvas.width=Math.round(n.canvas.clientWidth*n._resolutionScale),n.canvas.height=Math.round(n.canvas.clientHeight*n._resolutionScale),n.boundary[0]=n.canvas.offsetLeft,n.boundary[1]=n.canvas.offsetTop,n.boundary[2]=n.canvas.clientWidth,n.boundary[3]=n.canvas.clientHeight,n.fire("boundary",n.boundary))})),s._spinner=new vt(s.scene,{canvas:s.canvas,elementId:r.spinnerElementId}),s}return C(i,[{key:"type",get:function(){return"Canvas"}},{key:"backgroundColorFromAmbientLight",get:function(){return this._backgroundColorFromAmbientLight},set:function(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(e){if((e=e||1)!==this._resolutionScale){this._resolutionScale=e;var t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}}},{key:"spinner",get:function(){return this._spinner}},{key:"_createCanvas",value:function(){var e="xeokit-canvas-"+$.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}},{key:"_getElementXY",value:function(e){for(var t=0,i=0;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}},{key:"_initWebGL",value:function(){if(!this.gl)for(var e=0;!this.gl&&e0?yt.FS_MAX_FLOAT_PRECISION="highp":Bt.getShaderPrecisionFormat(Bt.FRAGMENT_SHADER,Bt.MEDIUM_FLOAT).precision>0?yt.FS_MAX_FLOAT_PRECISION="mediump":yt.FS_MAX_FLOAT_PRECISION="lowp":yt.FS_MAX_FLOAT_PRECISION="mediump",yt.DEPTH_BUFFER_BITS=Bt.getParameter(Bt.DEPTH_BITS),yt.MAX_TEXTURE_SIZE=Bt.getParameter(Bt.MAX_TEXTURE_SIZE),yt.MAX_CUBE_MAP_SIZE=Bt.getParameter(Bt.MAX_CUBE_MAP_TEXTURE_SIZE),yt.MAX_RENDERBUFFER_SIZE=Bt.getParameter(Bt.MAX_RENDERBUFFER_SIZE),yt.MAX_TEXTURE_UNITS=Bt.getParameter(Bt.MAX_COMBINED_TEXTURE_IMAGE_UNITS),yt.MAX_TEXTURE_IMAGE_UNITS=Bt.getParameter(Bt.MAX_TEXTURE_IMAGE_UNITS),yt.MAX_VERTEX_ATTRIBS=Bt.getParameter(Bt.MAX_VERTEX_ATTRIBS),yt.MAX_VERTEX_UNIFORM_VECTORS=Bt.getParameter(Bt.MAX_VERTEX_UNIFORM_VECTORS),yt.MAX_FRAGMENT_UNIFORM_VECTORS=Bt.getParameter(Bt.MAX_FRAGMENT_UNIFORM_VECTORS),yt.MAX_VARYING_VECTORS=Bt.getParameter(Bt.MAX_VARYING_VECTORS),Bt.getSupportedExtensions().forEach((function(e){yt.SUPPORTED_EXTENSIONS[e]=!0})))}var wt=function(){function e(){x(this,e),this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}return C(e,[{key:"canvasPos",get:function(){return this._gotCanvasPos?this._canvasPos:null},set:function(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}},{key:"origin",get:function(){return this._gotOrigin?this._origin:null},set:function(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}},{key:"direction",get:function(){return this._gotDirection?this._direction:null},set:function(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}},{key:"indices",get:function(){return this.entity&&this._gotIndices?this._indices:null},set:function(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}},{key:"localPos",get:function(){return this.entity&&this._gotLocalPos?this._localPos:null},set:function(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}},{key:"snappedCanvasPos",get:function(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null},set:function(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}},{key:"worldPos",get:function(){return this._gotWorldPos?this._worldPos:null},set:function(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}},{key:"viewPos",get:function(){return this.entity&&this._gotViewPos?this._viewPos:null},set:function(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}},{key:"bary",get:function(){return this.entity&&this._gotBary?this._bary:null},set:function(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}},{key:"worldNormal",get:function(){return this.entity&&this._gotWorldNormal?this._worldNormal:null},set:function(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}},{key:"uv",get:function(){return this.entity&&this._gotUV?this._uv:null},set:function(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}},{key:"snapped",get:function(){return this.snappedToEdge||this.snappedToVertex}},{key:"reset",value:function(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}]),e}(),xt=function(){function e(t,i,s){if(x(this,e),this.allocated=!1,this.compiled=!1,this.handle=t.createShader(i),this.handle){if(this.allocated=!0,t.shaderSource(this.handle,s),t.compileShader(this.handle),this.compiled=t.getShaderParameter(this.handle,t.COMPILE_STATUS),!this.compiled&&!t.isContextLost()){for(var r=s.split("\n"),n=[],o=0;o0&&"/"===t.charAt(i+1)&&(t=t.substring(0,i)),s.push(t);return s.join("\n")}function Et(e){console.error(e.join("\n"))}var kt=function(){function e(t,i){x(this,e),this.id=Mt.addItem({}),this.source=i,this.init(t)}return C(e,[{key:"init",value:function(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new xt(e,e.VERTEX_SHADER,Ft(this.source.vertex)),this._fragmentShader=new xt(e,e.FRAGMENT_SHADER,Ft(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Et(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Et(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Et(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Et(this.errors);var t,i,s,r,n;if(this.compiled=!0,this.handle=e.createProgram(),this.handle){if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Et(this.errors);var o=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}},{key:"setData",value:function(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}},{key:"bind",value:function(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}},{key:"unbind",value:function(){this.allocated&&this._gl.bindBuffer(this.type,null)}},{key:"destroy",value:function(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}]),e}(),Dt=function(){function e(t,i){x(this,e),this.scene=t,this.aabb=$.AABB3(),this.origin=$.vec3(i),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}return C(e,[{key:"addMarker",value:function(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}},{key:"markerWorldPosUpdated",value:function(e){if(this.markers[e.id]){var t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}}},{key:"removeMarker",value:function(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}},{key:"update",value:function(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}},{key:"_buildMarkerList",value:function(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}},{key:"_buildPositions",value:function(){for(var e=0,t=0;t-t)a._setVisible(!1);else{var l=a.canvasPos,u=l[0],A=l[1];u+10<0||A+10<0||u-10>s||A-10>r?a._setVisible(!1):!a.entity||a.entity.visible?a.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=a,this.pixels[n++]=u,this.pixels[n++]=A):a._setVisible(!0):a._setVisible(!1)}}}},{key:"_updateActiveSectionPlanes",value:function(){var e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(var i=0;i0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}},{key:"_buildFragmentShaderSource",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(var r=0;r 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}},{key:"_buildProgram",value:function(){this._program&&this._program.destroy();var e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new kt(t,this._shaderSource),this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(var r=0,n=i.sectionPlanes.length;r0)for(var h=s.sectionPlanes,d=0;d= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }")]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);var s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),n=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new It(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new It(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new It(i,i.ELEMENT_ARRAY_BUFFER,n,n.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}}},{key:"destroy",value:function(){this._program&&(this._program.destroy(),this._program=null)}}]),e}(),Ot=new Float32Array(Gt(17,[0,1])),Nt=new Float32Array(Gt(17,[1,0])),Qt=new Float32Array(function(e,t){for(var i=[],s=0;s<=e;s++)i.push(jt(s,t));return i}(17,4)),Vt=new Float32Array(2),Ht=function(){function e(t){x(this,e),this._scene=t,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}return C(e,[{key:"init",value:function(){var e=this._scene.canvas.gl;if(this._program=new kt(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS ".concat(16,"\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }")]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);var t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new It(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new It(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new It(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}},{key:"render",value:function(e,t,i){var s=this;if(!this._programError){this._getInverseProjectMat||(this._getInverseProjectMat=function(){var e=!0;s._scene.camera.on("projMatrix",(function(){e=!0}));var t=$.mat4();return function(){return e&&$.inverseMat4(o.camera.projMatrix,t),t}}());var r=this._scene.canvas.gl,n=this._program,o=this._scene,a=r.drawingBufferWidth,l=r.drawingBufferHeight,u=o.camera.project._state,A=u.near,c=u.far;r.viewport(0,0,a,l),r.clearColor(0,0,0,1),r.enable(r.DEPTH_TEST),r.disable(r.BLEND),r.frontFace(r.CCW),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),n.bind(),Vt[0]=a,Vt[1]=l,r.uniform2fv(this._uViewport,Vt),r.uniform1f(this._uCameraNear,A),r.uniform1f(this._uCameraFar,c),r.uniform1f(this._uDepthCutoff,.01),0===i?r.uniform2fv(this._uSampleOffsets,Nt):r.uniform2fv(this._uSampleOffsets,Ot),r.uniform1fv(this._uSampleWeights,Qt);var h=e.getDepthTexture(),d=t.getTexture();n.bindTexture(this._uDepthTexture,h,0),n.bindTexture(this._uOcclusionTexture,d,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),r.drawElements(r.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}}},{key:"destroy",value:function(){this._program.destroy()}}]),e}();function jt(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function Gt(e,t){for(var i=[],s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}var zt=function(){function e(t,i,s){x(this,e),s=s||{},this.gl=i,this.allocated=!1,this.canvas=t,this.buffer=null,this.bound=!1,this.size=s.size,this._hasDepthTexture=!!s.depthTexture}return C(e,[{key:"setSize",value:function(e){this.size=e}},{key:"webglContextRestored",value:function(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}},{key:"bind",value:function(){if(this._touch.apply(this,arguments),!this.bound){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}}},{key:"createTexture",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}},{key:"_touch",value:function(){var e,t,i=this,s=this.gl;if(this.size?(e=this.size[0],t=this.size[1]):(e=s.drawingBufferWidth,t=s.drawingBufferHeight),this.buffer){if(this.buffer.width===e&&this.buffer.height===t)return;this.buffer.textures.forEach((function(e){return s.deleteTexture(e)})),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}for(var r,n=[],o=arguments.length,a=new Array(o),l=0;l0?n.push.apply(n,A(a.map((function(s){return i.createTexture(e,t,s)})))):n.push(this.createTexture(e,t)),this._hasDepthTexture&&(r=s.createTexture(),s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,e,t,0,s.DEPTH_COMPONENT,s.FLOAT,null));var u=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,u),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,e,t);var c=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,c);for(var h=0;h0&&s.drawBuffers(n.map((function(e,t){return s.COLOR_ATTACHMENT0+t}))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,r,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,u),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,c),!s.isFramebuffer(c))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);var d=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(d){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+d}this.buffer={framebuf:c,renderbuf:u,texture:n[0],textures:n,depthTexture:r,width:e,height:t},this.bound=!1}},{key:"clear",value:function(){if(!this.bound)throw"Render buffer not bound";var e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},{key:"read",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Uint8Array,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:4,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,u=new r(n),A=this.gl;return A.readBuffer(A.COLOR_ATTACHMENT0+o),A.readPixels(a,l,1,1,i||A.RGBA,s||A.UNSIGNED_BYTE,u,0),u}},{key:"readArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Uint8Array,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=new i(this.buffer.width*this.buffer.height*s),o=this.gl;return o.readBuffer(o.COLOR_ATTACHMENT0+r),o.readPixels(0,0,this.buffer.width,this.buffer.height,e||o.RGBA,t||o.UNSIGNED_BYTE,n,0),n}},{key:"readImageAsCanvas",value:function(){var e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,n=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=this.buffer.width,a=this.buffer.height,l=a/2|0,u=4*o,A=new Uint8Array(4*o),c=0;c0&&void 0!==arguments[0]?arguments[0]:Uint8Array,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,i=this.buffer.width,s=this.buffer.height,r=this._imageDataCache;if(r&&(r.width===i&&r.height===s||(this._imageDataCache=null,r=null)),!r){var n=document.createElement("canvas"),o=n.getContext("2d");n.width=i,n.height=s,r={pixelData:new e(i*s*t),canvas:n,context:o,imageData:o.createImageData(i,s),width:i,height:s},this._imageDataCache=r}return r.context.resetTransform(),r}},{key:"unbind",value:function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),this.bound=!1}},{key:"getTexture",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this;return this._texture||(this._texture={renderBuffer:this,bind:function(i){return!(!t.buffer||!t.buffer.textures[e])&&(t.gl.activeTexture(t.gl["TEXTURE"+i]),t.gl.bindTexture(t.gl.TEXTURE_2D,t.buffer.textures[e]),!0)},unbind:function(i){t.buffer&&t.buffer.textures[e]&&(t.gl.activeTexture(t.gl["TEXTURE"+i]),t.gl.bindTexture(t.gl.TEXTURE_2D,null))}})}},{key:"hasDepthTexture",value:function(){return this._hasDepthTexture}},{key:"getDepthTexture",value:function(){if(!this._hasDepthTexture)return null;var e=this;return this._depthTexture||(this._dethTexture={renderBuffer:this,bind:function(t){return!(!e.buffer||!e.buffer.depthTexture)&&(e.gl.activeTexture(e.gl["TEXTURE"+t]),e.gl.bindTexture(e.gl.TEXTURE_2D,e.buffer.depthTexture),!0)},unbind:function(t){e.buffer&&e.buffer.depthTexture&&(e.gl.activeTexture(e.gl["TEXTURE"+t]),e.gl.bindTexture(e.gl.TEXTURE_2D,null))}})}},{key:"destroy",value:function(){if(this.allocated){var e=this.gl;this.buffer.textures.forEach((function(t){return e.deleteTexture(t)})),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}]),e}(),Wt=function(){function e(t){x(this,e),this.scene=t,this._renderBuffersBasic={},this._renderBuffersScaled={}}return C(e,[{key:"getRenderBuffer",value:function(e,t){var i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled,s=i[e];return s||(s=new zt(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}},{key:"destroy",value:function(){for(var e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(var t in this._renderBuffersScaled)this._renderBuffersScaled[t].destroy()}}]),e}();function Kt(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];var i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}var Xt=function(e,t){t=t||{};var i=new _t(e),s=e.canvas.canvas,r=e.canvas.gl,n=!!t.transparent,o=t.alphaDepthMask,a=new Q({}),l={},u={},A=!0,c=!0,h=!0,d=!0,p=!0,f=!0,v=!0,g=!0,m=new Wt(e),_=!1,y=new Ut(e),b=new Ht(e);function B(){A&&(!function(){for(var e in l)if(l.hasOwnProperty(e)){var t=l[e],i=t.drawableMap,s=t.drawableListPreCull,r=0;for(var n in i)i.hasOwnProperty(n)&&(s[r++]=i[n]);s.length=r}}(),A=!1,c=!0),c&&(!function(){for(var e in l)if(l.hasOwnProperty(e)){var t=l[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),c=!1,h=!0),h&&function(){for(var e in l)if(l.hasOwnProperty(e)){for(var t=l[e],i=t.drawableListPreCull,s=t.drawableList,r=0,n=0,o=i.length;n0)for(i.withSAO=!0,I=0;I0)for(I=0;I0)for(I=0;I0)for(I=0;I0||G>0||N>0||Q>0){if(r.enable(r.CULL_FACE),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA)),i.backfaces=!1,o||r.depthMask(!1),(N>0||Q>0)&&r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),Q>0)for(I=0;I0)for(I=0;I0)for(I=0;I0)for(I=0;I0||W>0){if(i.lastProgramId=null,e.highlightMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),W>0)for(I=0;I0)for(I=0;I0||X>0||z>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),r.enable(r.CULL_FACE),X>0)for(I=0;I0)for(I=0;I0||Y>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),Y>0)for(I=0;I0)for(I=0;I0||q>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),r.enable(r.CULL_FACE),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),q>0)for(I=0;I0)for(I=0;I1&&void 0!==arguments[1]?arguments[1]:o;p.reset(),B();var f=null,v=null;for(var g in p.pickSurface=h.pickSurface,h.canvasPos?(u[0]=h.canvasPos[0],u[1]=h.canvasPos[1],f=e.camera.viewMatrix,v=e.camera.projMatrix,p.canvasPos=h.canvasPos):(h.matrix?(f=h.matrix,v=e.camera.projMatrix):(A.set(h.origin||[0,0,0]),c.set(h.direction||[0,0,1]),d=$.addVec3(A,c,t),r[0]=Math.random(),r[1]=Math.random(),r[2]=Math.random(),$.normalizeVec3(r),$.cross3Vec3(c,r,n),f=$.lookAtMat4v(A,d,n,i),v=e.camera.ortho.matrix,p.origin=A,p.direction=c),u[0]=.5*s.clientWidth,u[1]=.5*s.clientHeight),l)if(l.hasOwnProperty(g))for(var _=l[g].drawableList,y=0,b=_.length;y4&&void 0!==arguments[4]?arguments[4]:C;if(!n&&!o)return this.pick({canvasPos:t,pickSurface:!0});var A=e.canvas.resolutionScale;i.reset(),i.backfaces=!0,i.frontface=!0,i.pickZNear=e.camera.project.near,i.pickZFar=e.camera.project.far,s=s||30;var c=m.getRenderBuffer("uniquePickColors-aabs",{depthTexture:!0,size:[2*s+1,2*s+1]});i.snapVectorA=[k(t[0]*A,r.drawingBufferWidth),I(t[1]*A,r.drawingBufferHeight)],i.snapInvVectorAB=[r.drawingBufferWidth/(2*s),r.drawingBufferHeight/(2*s)],c.bind(r.RGBA32I,r.RGBA32I,r.RGBA8UI),r.viewport(0,0,c.size[0],c.size[1]),r.enable(r.DEPTH_TEST),r.frontFace(r.CCW),r.disable(r.CULL_FACE),r.depthMask(!0),r.disable(r.BLEND),r.depthFunc(r.LEQUAL),r.clear(r.DEPTH_BUFFER_BIT),r.clearBufferiv(r.COLOR,0,new Int32Array([0,0,0,0])),r.clearBufferiv(r.COLOR,1,new Int32Array([0,0,0,0])),r.clearBufferuiv(r.COLOR,2,new Uint32Array([0,0,0,0]));var h=e.camera.viewMatrix,d=e.camera.projMatrix;for(var p in l)if(l.hasOwnProperty(p))for(var f=l[p].drawableList,v=0,g=f.length;v0){var j=Math.floor(H/4),G=c.size[0],z=j%G-Math.floor(G/2),W=Math.floor(j/G)-Math.floor(G/2),K=Math.sqrt(Math.pow(z,2)+Math.pow(W,2));V.push({x:z,y:W,dist:K,isVertex:n&&o?B[H+3]>b.length/2:n,result:[B[H+0],B[H+1],B[H+2],B[H+3]],normal:[w[H+0],w[H+1],w[H+2],w[H+3]],id:[x[H+0],x[H+1],x[H+2],x[H+3]]})}var X=null,J=null,Y=null,Z=null;if(V.length>0){V.sort((function(e,t){return e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist})),Z=V[0].isVertex?"vertex":"edge";var q=V[0].result,ee=V[0].normal,te=V[0].id,ie=b[q[3]],se=ie.origin,re=ie.coordinateScale;J=$.normalizeVec3([ee[0]/$.MAX_INT,ee[1]/$.MAX_INT,ee[2]/$.MAX_INT]),X=[q[0]*re[0]+se[0],q[1]*re[1]+se[1],q[2]*re[2]+se[2]],Y=a.items[te[0]+(te[1]<<8)+(te[2]<<16)+(te[3]<<24)]}if(null===P&&null==X)return null;var ne=null;null!==X&&(ne=e.camera.projectWorldPos(X));var oe=Y&&Y.delegatePickedEntity?Y.delegatePickedEntity():Y;return u.reset(),u.snappedToEdge="edge"===Z,u.snappedToVertex="vertex"===Z,u.worldPos=X,u.worldNormal=J,u.entity=oe,u.canvasPos=t,u.snappedCanvasPos=ne||t,u}),this.addMarker=function(t){this._occlusionTester=this._occlusionTester||new Rt(e,m),this._occlusionTester.addMarker(t),e.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){for(var e in B(),this._occlusionTester.bindRenderBuf(),i.reset(),i.backfaces=!0,i.frontface=!0,r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.clearColor(0,0,0,0),r.enable(r.DEPTH_TEST),r.disable(r.CULL_FACE),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),l)if(l.hasOwnProperty(e))for(var t=l[e].drawableList,s=0,n=t.length;s0&&void 0!==arguments[0]?arguments[0]:{},t=m.getRenderBuffer("snapshot");e.width&&e.height&&t.setSize([e.width,e.height]),t.bind(),t.clear(),_=!0},this.renderSnapshot=function(){_&&(m.getRenderBuffer("snapshot").clear(),this.render({force:!0,opaqueOnly:!1}),h=!0)},this.readSnapshot=function(e){return m.getRenderBuffer("snapshot").readImage(e)},this.readSnapshotAsCanvas=function(){return m.getRenderBuffer("snapshot").readImageAsCanvas()},this.endSnapshot=function(){_&&(m.getRenderBuffer("snapshot").unbind(),_=!1)},this.destroy=function(){l={},u={},m.destroy(),y.destroy(),b.destroy(),this._occlusionTester&&this._occlusionTester.destroy()}},Jt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).KEY_BACKSPACE=8,s.KEY_TAB=9,s.KEY_ENTER=13,s.KEY_SHIFT=16,s.KEY_CTRL=17,s.KEY_ALT=18,s.KEY_PAUSE_BREAK=19,s.KEY_CAPS_LOCK=20,s.KEY_ESCAPE=27,s.KEY_PAGE_UP=33,s.KEY_PAGE_DOWN=34,s.KEY_END=35,s.KEY_HOME=36,s.KEY_LEFT_ARROW=37,s.KEY_UP_ARROW=38,s.KEY_RIGHT_ARROW=39,s.KEY_DOWN_ARROW=40,s.KEY_INSERT=45,s.KEY_DELETE=46,s.KEY_NUM_0=48,s.KEY_NUM_1=49,s.KEY_NUM_2=50,s.KEY_NUM_3=51,s.KEY_NUM_4=52,s.KEY_NUM_5=53,s.KEY_NUM_6=54,s.KEY_NUM_7=55,s.KEY_NUM_8=56,s.KEY_NUM_9=57,s.KEY_A=65,s.KEY_B=66,s.KEY_C=67,s.KEY_D=68,s.KEY_E=69,s.KEY_F=70,s.KEY_G=71,s.KEY_H=72,s.KEY_I=73,s.KEY_J=74,s.KEY_K=75,s.KEY_L=76,s.KEY_M=77,s.KEY_N=78,s.KEY_O=79,s.KEY_P=80,s.KEY_Q=81,s.KEY_R=82,s.KEY_S=83,s.KEY_T=84,s.KEY_U=85,s.KEY_V=86,s.KEY_W=87,s.KEY_X=88,s.KEY_Y=89,s.KEY_Z=90,s.KEY_LEFT_WINDOW=91,s.KEY_RIGHT_WINDOW=92,s.KEY_SELECT_KEY=93,s.KEY_NUMPAD_0=96,s.KEY_NUMPAD_1=97,s.KEY_NUMPAD_2=98,s.KEY_NUMPAD_3=99,s.KEY_NUMPAD_4=100,s.KEY_NUMPAD_5=101,s.KEY_NUMPAD_6=102,s.KEY_NUMPAD_7=103,s.KEY_NUMPAD_8=104,s.KEY_NUMPAD_9=105,s.KEY_MULTIPLY=106,s.KEY_ADD=107,s.KEY_SUBTRACT=109,s.KEY_DECIMAL_POINT=110,s.KEY_DIVIDE=111,s.KEY_F1=112,s.KEY_F2=113,s.KEY_F3=114,s.KEY_F4=115,s.KEY_F5=116,s.KEY_F6=117,s.KEY_F7=118,s.KEY_F8=119,s.KEY_F9=120,s.KEY_F10=121,s.KEY_F11=122,s.KEY_F12=123,s.KEY_NUM_LOCK=144,s.KEY_SCROLL_LOCK=145,s.KEY_SEMI_COLON=186,s.KEY_EQUAL_SIGN=187,s.KEY_COMMA=188,s.KEY_DASH=189,s.KEY_PERIOD=190,s.KEY_FORWARD_SLASH=191,s.KEY_GRAVE_ACCENT=192,s.KEY_OPEN_BRACKET=219,s.KEY_BACK_SLASH=220,s.KEY_CLOSE_BRACKET=221,s.KEY_SINGLE_QUOTE=222,s.KEY_SPACE=32,s.element=r.element,s.altDown=!1,s.ctrlDown=!1,s.mouseDownLeft=!1,s.mouseDownMiddle=!1,s.mouseDownRight=!1,s.keyDown=[],s.enabled=!0,s.keyboardEnabled=!0,s.mouseover=!1,s.mouseCanvasPos=$.vec2(),s._keyboardEventsElement=r.keyboardEventsElement||document,s._bindEvents(),s}return C(i,[{key:"_bindEvents",value:function(){var e=this;if(!this._eventsBound){this._keyboardEventsElement.addEventListener("keydown",this._keyDownListener=function(t){e.enabled&&e.keyboardEnabled&&"INPUT"!==t.target.tagName&&"TEXTAREA"!==t.target.tagName&&(t.keyCode===e.KEY_CTRL?e.ctrlDown=!0:t.keyCode===e.KEY_ALT?e.altDown=!0:t.keyCode===e.KEY_SHIFT&&(e.shiftDown=!0),e.keyDown[t.keyCode]=!0,e.fire("keydown",t.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=function(t){e.enabled&&e.keyboardEnabled&&"INPUT"!==t.target.tagName&&"TEXTAREA"!==t.target.tagName&&(t.keyCode===e.KEY_CTRL?e.ctrlDown=!1:t.keyCode===e.KEY_ALT?e.altDown=!1:t.keyCode===e.KEY_SHIFT&&(e.shiftDown=!1),e.keyDown[t.keyCode]=!1,e.fire("keyup",t.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=function(t){e.enabled&&(e.mouseover=!0,e._getMouseCanvasPos(t),e.fire("mouseenter",e.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=function(t){e.enabled&&(e.mouseover=!1,e._getMouseCanvasPos(t),e.fire("mouseleave",e.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=function(t){if(e.enabled){switch(t.which){case 1:e.mouseDownLeft=!0;break;case 2:e.mouseDownMiddle=!0;break;case 3:e.mouseDownRight=!0}e._getMouseCanvasPos(t),e.element.focus(),e.fire("mousedown",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=function(t){if(e.enabled){switch(t.which){case 1:e.mouseDownLeft=!1;break;case 2:e.mouseDownMiddle=!1;break;case 3:e.mouseDownRight=!1}e.fire("mouseup",e.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=function(t){if(e.enabled){switch(t.which){case 1:case 3:e.mouseDownLeft=!1,e.mouseDownRight=!1;break;case 2:e.mouseDownMiddle=!1}e._getMouseCanvasPos(t),e.fire("click",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=function(t){if(e.enabled){switch(t.which){case 1:case 3:e.mouseDownLeft=!1,e.mouseDownRight=!1;break;case 2:e.mouseDownMiddle=!1}e._getMouseCanvasPos(t),e.fire("dblclick",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}});var t=this.scene.tickify((function(){return e.fire("mousemove",e.mouseCanvasPos,!0)}));this.element.addEventListener("mousemove",this._mouseMoveListener=function(i){e.enabled&&(e._getMouseCanvasPos(i),t(),e.mouseover&&i.preventDefault())});var i=this.scene.tickify((function(t){e.fire("mousewheel",t,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=function(t,s){if(e.enabled){var r=Math.max(-1,Math.min(1,40*-t.deltaY));i(r)}},{passive:!0});var s,r;this.on("mousedown",(function(e){s=e[0],r=e[1]})),this.on("mouseup",(function(t){s>=t[0]-2&&s<=t[0]+2&&r>=t[1]-2&&r<=t[1]+2&&e.fire("mouseclicked",t,!0)})),this._eventsBound=!0}}},{key:"_unbindEvents",value:function(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}},{key:"_getMouseCanvasPos",value:function(e){if(e){for(var t=e.target,i=0,s=0;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}},{key:"setEnabled",value:function(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}},{key:"getEnabled",value:function(){return this.enabled}},{key:"setKeyboardEnabled",value:function(e){this.keyboardEnabled=e}},{key:"getKeyboardEnabled",value:function(){return this.keyboardEnabled}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._unbindEvents()}}]),i}(),Yt=new Q({}),Zt=function(){function e(t){for(var i in x(this,e),this.id=Yt.addItem({}),t)t.hasOwnProperty(i)&&(this[i]=t[i])}return C(e,[{key:"destroy",value:function(){Yt.removeItem(this.id)}}]),e}(),qt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({boundary:[0,0,100,100]}),s.boundary=r.boundary,s.autoBoundary=r.autoBoundary,s}return C(i,[{key:"type",get:function(){return"Viewport"}},{key:"boundary",get:function(){return this._state.boundary},set:function(e){if(!this._autoBoundary){if(!e){var t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}},{key:"autoBoundary",get:function(){return this._autoBoundary},set:function(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){var t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),$t=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s._fov=60,s._canvasResized=s.scene.canvas.on("boundary",s._needUpdate,b(s)),s.fov=r.fov,s.fovAxis=r.fovAxis,s.near=r.near,s.far=r.far,s}return C(i,[{key:"type",get:function(){return"Perspective"}},{key:"_update",value:function(){var e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis,s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),$.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}},{key:"fov",get:function(){return this._fov},set:function(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}},{key:"near",get:function(){return this._state.near},set:function(e){var t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}},{key:"far",get:function(){return this._state.far},set:function(e){var t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}]),i}(),ei=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s.scale=r.scale,s.near=r.near,s.far=r.far,s._onCanvasBoundary=s.scene.canvas.on("boundary",s._needUpdate,b(s)),s}return C(i,[{key:"type",get:function(){return"Ortho"}},{key:"_update",value:function(){var e,t,i,s,r=this.scene,n=.5*this._scale,o=r.canvas.boundary,a=o[2],l=o[3],u=a/l;a>l?(e=-n,t=n,i=n/u,s=-n/u):(e=-n*u,t=n*u,i=n,s=-n),$.orthoMat4c(e,t,s,i,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"scale",get:function(){return this._scale},set:function(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}},{key:"near",get:function(){return this._state.near},set:function(e){var t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}},{key:"far",get:function(){return this._state.far},set:function(e){var t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}]),i}(),ti=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._left=-1,s._right=1,s._bottom=-1,s._top=1,s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s.left=r.left,s.right=r.right,s.bottom=r.bottom,s.top=r.top,s.near=r.near,s.far=r.far,s}return C(i,[{key:"type",get:function(){return"Frustum"}},{key:"_update",value:function(){$.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"left",get:function(){return this._left},set:function(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}},{key:"right",get:function(){return this._right},set:function(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}},{key:"top",get:function(){return this._top},set:function(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}},{key:"bottom",get:function(){return this._bottom},set:function(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}},{key:"near",get:function(){return this._state.near},set:function(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}},{key:"far",get:function(){return this._state.far},set:function(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),ii=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4()}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!1,s.matrix=r.matrix,s}return C(i,[{key:"type",get:function(){return"CustomProjection"}},{key:"matrix",get:function(){return this._state.matrix},set:function(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),si=$.vec3(),ri=$.vec3(),ni=$.vec3(),oi=$.vec3(),ai=$.vec3(),li=$.vec3(),ui=$.vec4(),Ai=$.vec4(),ci=$.vec4(),hi=$.mat4(),di=$.mat4(),pi=$.vec3(),fi=$.vec3(),vi=$.vec3(),gi=$.vec3(),mi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({deviceMatrix:$.mat4(),hasDeviceMatrix:!1,matrix:$.mat4(),normalMatrix:$.mat4(),inverseMatrix:$.mat4()}),s._perspective=new $t(b(s)),s._ortho=new ei(b(s)),s._frustum=new ti(b(s)),s._customProjection=new ii(b(s)),s._project=s._perspective,s._eye=$.vec3([0,0,10]),s._look=$.vec3([0,0,0]),s._up=$.vec3([0,1,0]),s._worldUp=$.vec3([0,1,0]),s._worldRight=$.vec3([1,0,0]),s._worldForward=$.vec3([0,0,-1]),s.deviceMatrix=r.deviceMatrix,s.eye=r.eye,s.look=r.look,s.up=r.up,s.worldAxis=r.worldAxis,s.gimbalLock=r.gimbalLock,s.constrainPitch=r.constrainPitch,s.projection=r.projection,s._perspective.on("matrix",(function(){"perspective"===s._projectionType&&s.fire("projMatrix",s._perspective.matrix)})),s._ortho.on("matrix",(function(){"ortho"===s._projectionType&&s.fire("projMatrix",s._ortho.matrix)})),s._frustum.on("matrix",(function(){"frustum"===s._projectionType&&s.fire("projMatrix",s._frustum.matrix)})),s._customProjection.on("matrix",(function(){"customProjection"===s._projectionType&&s.fire("projMatrix",s._customProjection.matrix)})),s}return C(i,[{key:"type",get:function(){return"Camera"}},{key:"_update",value:function(){var e,t=this._state;"ortho"===this.projection?($.subVec3(this._eye,this._look,pi),$.normalizeVec3(pi,fi),$.mulVec3Scalar(fi,1e3,vi),$.addVec3(this._look,vi,gi),e=gi):e=this._eye,t.hasDeviceMatrix?($.lookAtMat4v(e,this._look,this._up,di),$.mulMat4(t.deviceMatrix,di,t.matrix)):$.lookAtMat4v(e,this._look,this._up,t.matrix),$.inverseMat4(this._state.matrix,this._state.inverseMatrix),$.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}},{key:"orbitYaw",value:function(e){var t=$.subVec3(this._eye,this._look,si);$.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,hi),t=$.transformPoint3(hi,t,ri),this.eye=$.addVec3(this._look,t,ni),this.up=$.transformPoint3(hi,this._up,oi)}},{key:"orbitPitch",value:function(e){if(!(this._constrainPitch&&(e=$.dotVec3(this._up,this._worldUp)/$.DEGTORAD)<1)){var t=$.subVec3(this._eye,this._look,si),i=$.cross3Vec3($.normalizeVec3(t,ri),$.normalizeVec3(this._up,ni));$.rotationMat4v(.0174532925*e,i,hi),t=$.transformPoint3(hi,t,oi),this.up=$.transformPoint3(hi,this._up,ai),this.eye=$.addVec3(t,this._look,li)}}},{key:"yaw",value:function(e){var t=$.subVec3(this._look,this._eye,si);$.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,hi),t=$.transformPoint3(hi,t,ri),this.look=$.addVec3(t,this._eye,ni),this._gimbalLock&&(this.up=$.transformPoint3(hi,this._up,oi))}},{key:"pitch",value:function(e){if(!(this._constrainPitch&&(e=$.dotVec3(this._up,this._worldUp)/$.DEGTORAD)<1)){var t=$.subVec3(this._look,this._eye,si),i=$.cross3Vec3($.normalizeVec3(t,ri),$.normalizeVec3(this._up,ni));$.rotationMat4v(.0174532925*e,i,hi),this.up=$.transformPoint3(hi,this._up,li),t=$.transformPoint3(hi,t,oi),this.look=$.addVec3(t,this._eye,ai)}}},{key:"pan",value:function(e){var t,i=$.subVec3(this._eye,this._look,si),s=[0,0,0];if(0!==e[0]){var r=$.cross3Vec3($.normalizeVec3(i,[]),$.normalizeVec3(this._up,ri));t=$.mulVec3Scalar(r,e[0]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]}0!==e[1]&&(t=$.mulVec3Scalar($.normalizeVec3(this._up,ni),e[1]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]),0!==e[2]&&(t=$.mulVec3Scalar($.normalizeVec3(i,oi),e[2]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]),this.eye=$.addVec3(this._eye,s,ai),this.look=$.addVec3(this._look,s,li)}},{key:"zoom",value:function(e){var t=$.subVec3(this._eye,this._look,si),i=Math.abs($.lenVec3(t,ri)),s=Math.abs(i+e);if(!(s<.5)){var r=$.normalizeVec3(t,ni);this.eye=$.addVec3(this._look,$.mulVec3Scalar(r,s),oi)}}},{key:"eye",get:function(){return this._eye},set:function(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}},{key:"look",get:function(){return this._look},set:function(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}},{key:"up",get:function(){return this._up},set:function(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}},{key:"deviceMatrix",get:function(){return this._state.deviceMatrix},set:function(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}},{key:"worldAxis",get:function(){return this._worldAxis},set:function(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=$.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}},{key:"worldUp",get:function(){return this._worldUp}},{key:"xUp",get:function(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}},{key:"yUp",get:function(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}},{key:"zUp",get:function(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}},{key:"worldRight",get:function(){return this._worldRight}},{key:"worldForward",get:function(){return this._worldForward}},{key:"gimbalLock",get:function(){return this._gimbalLock},set:function(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}},{key:"constrainPitch",set:function(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}},{key:"eyeLookDist",get:function(){return $.lenVec3($.subVec3(this._look,this._eye,si))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"viewMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"normalMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}},{key:"viewNormalMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}},{key:"inverseViewMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}},{key:"projMatrix",get:function(){return this[this.projection].matrix}},{key:"perspective",get:function(){return this._perspective}},{key:"ortho",get:function(){return this._ortho}},{key:"frustum",get:function(){return this._frustum}},{key:"customProjection",get:function(){return this._customProjection}},{key:"projection",get:function(){return this._projectionType},set:function(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}},{key:"project",get:function(){return this._project}},{key:"projectWorldPos",value:function(e){var t=ui,i=Ai,s=ci;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,$.mulMat4v4(this.viewMatrix,t,i),$.mulMat4v4(this.projMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;var r=this.scene.canvas.canvas,n=r.offsetWidth/2,o=r.offsetHeight/2;return[s[0]*n+n,s[1]*o+o]}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),_i=function(e){g(i,Be);var t=_(i);function i(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),t.call(this,e,s)}return C(i,[{key:"type",get:function(){return"Light"}},{key:"isLight",get:function(){return!0}}]),i}(),yi=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._shadowRenderBuf=null,s._shadowViewMatrix=null,s._shadowProjMatrix=null,s._shadowViewMatrixDirty=!0,s._shadowProjMatrixDirty=!0;var n=s.scene.camera,o=s.scene.canvas;return s._onCameraViewMatrix=n.on("viewMatrix",(function(){s._shadowViewMatrixDirty=!0})),s._onCameraProjMatrix=n.on("projMatrix",(function(){s._shadowProjMatrixDirty=!0})),s._onCanvasBoundary=o.on("boundary",(function(){s._shadowProjMatrixDirty=!0})),s._state=new Zt({type:"dir",dir:$.vec3([1,1,1]),color:$.vec3([.7,.7,.8]),intensity:1,space:r.space||"view",castsShadow:!1,getShadowViewMatrix:function(){if(s._shadowViewMatrixDirty){s._shadowViewMatrix||(s._shadowViewMatrix=$.identityMat4());var e=s.scene.camera,t=s._state.dir,i=e.look,r=[i[0]-t[0],i[1]-t[1],i[2]-t[2]];$.lookAtMat4v(r,i,[0,1,0],s._shadowViewMatrix),s._shadowViewMatrixDirty=!1}return s._shadowViewMatrix},getShadowProjMatrix:function(){return s._shadowProjMatrixDirty&&(s._shadowProjMatrix||(s._shadowProjMatrix=$.identityMat4()),$.orthoMat4c(-40,40,-40,40,-40,80,s._shadowProjMatrix),s._shadowProjMatrixDirty=!1),s._shadowProjMatrix},getShadowRenderBuf:function(){return s._shadowRenderBuf||(s._shadowRenderBuf=new zt(s.scene.canvas.canvas,s.scene.canvas.gl,{size:[1024,1024]})),s._shadowRenderBuf}}),s.dir=r.dir,s.color=r.color,s.intensity=r.intensity,s.castsShadow=r.castsShadow,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"DirLight"}},{key:"dir",get:function(){return this._state.dir},set:function(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}},{key:"destroy",value:function(){var e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}]),i}(),bi=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state={type:"ambient",color:$.vec3([.7,.7,.7]),intensity:1},s.color=r.color,s.intensity=r.intensity,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"AmbientLight"}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._lightDestroyed(this)}}]),i}(),Bi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),s=t.call(this,e,r),se.memory.meshes++,s}return C(i,[{key:"type",get:function(){return"Geometry"}},{key:"isGeometry",get:function(){return!0}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),se.memory.meshes--}}]),i}(),wi=function(){var e=[],t=[],i=[],s=[],r=[],n=0,o=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),u=$.vec3(),A=$.vec3(),c=$.vec3(),h=$.vec3(),d=$.vec3(),p=$.vec3(),f=$.vec3();return function(v,g,m,_){!function(r,n){var o,a,l,u,A,c,h={},d=Math.pow(10,4),p=0;for(A=0,c=r.length;AI)||(F=i[P.index1],E=i[P.index2],(!S&&F>65535||E>65535)&&(S=!0),k.push(F),k.push(E));return S?new Uint32Array(k):new Uint16Array(k)}}();var xi=function(){var e=$.mat4(),t=$.mat4();return function(i,s){s=s||$.mat4();var r=i[0],n=i[1],o=i[2],a=i[3]-r,l=i[4]-n,u=i[5]-o,A=65535;return $.identityMat4(e),$.translationMat4v(i,e),$.identityMat4(t),$.scalingMat4v([a/A,l/A,u/A],t),$.mulMat4(e,t,s),s}}(),Pi=function(){var e=$.mat4(),t=$.mat4();return function(i,s,r){var n,o=new Uint16Array(i.length),a=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);for(n=0;n=0?1:-1),a=(1-Math.abs(r))*(n>=0?1:-1);r=o,n=a}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*n+(n<0?-1:0))])}function Fi(e){var t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;var s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));var r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function Ei(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}var ki={getPositionsBounds:function(e){var t,i,s=new Float32Array(3),r=new Float32Array(3);for(t=0;t<3;t++)s[t]=Number.MAX_VALUE,r[t]=-Number.MAX_VALUE;for(t=0;t2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s2&&void 0!==arguments[2]?arguments[2]:e;return i[0]=e[0]*t[0]+t[12],i[1]=e[1]*t[5]+t[13],i[2]=e[2]*t[10]+t[14],i[3]=e[3]*t[0]+t[12],i[4]=e[4]*t[5]+t[13],i[5]=e[5]*t[10]+t[14],i},getUVBounds:function(e){var t,i,s=new Float32Array(2),r=new Float32Array(2);for(t=0;t<2;t++)s[t]=Number.MAX_VALUE,r[t]=-Number.MAX_VALUE;for(t=0;t2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;sr&&(i=t,r=s),(s=Ei(e,o,Fi(t=Mi(e,o,"floor","ceil"))))>r&&(i=t,r=s),(s=Ei(e,o,Fi(t=Mi(e,o,"ceil","ceil"))))>r&&(i=t,r=s),n[o]=i[0],n[o+1]=i[1];return n},decompressNormals:function(e,t){for(var i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(n))*(o>=0?1:-1));var l=Math.sqrt(n*n+o*o+a*a);t[s+0]=n/l,t[s+1]=o/l,t[s+2]=a/l,s+=3}return t},decompressNormal:function(e,t){var i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;var r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));var n=Math.sqrt(i*i+s*s+r*r);return t[0]=i/n,t[1]=s/n,t[2]=r/n,t}},Ii=se.memory,Di=$.AABB3(),Si=function(e){g(i,Bi);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._state=new Zt({compressGeometry:!!r.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),s._numTriangles=0,s._edgeThreshold=r.edgeThreshold||10,s._edgeIndicesBuf=null,s._pickTrianglePositionsBuf=null,s._pickTriangleColorsBuf=null,s._aabbDirty=!0,s._boundingSphere=!0,s._aabb=null,s._aabbDirty=!0,s._obb=null,s._obbDirty=!0;var n=s._state,o=s.scene.canvas.gl;switch(r.primitive=r.primitive||"triangles",r.primitive){case"points":n.primitive=o.POINTS,n.primitiveName=r.primitive;break;case"lines":n.primitive=o.LINES,n.primitiveName=r.primitive;break;case"line-loop":n.primitive=o.LINE_LOOP,n.primitiveName=r.primitive;break;case"line-strip":n.primitive=o.LINE_STRIP,n.primitiveName=r.primitive;break;case"triangles":n.primitive=o.TRIANGLES,n.primitiveName=r.primitive;break;case"triangle-strip":n.primitive=o.TRIANGLE_STRIP,n.primitiveName=r.primitive;break;case"triangle-fan":n.primitive=o.TRIANGLE_FAN,n.primitiveName=r.primitive;break;default:s.error("Unsupported value for 'primitive': '"+r.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),n.primitive=o.TRIANGLES,n.primitiveName=r.primitive}if(r.positions)if(s._state.compressGeometry){var a=ki.getPositionsBounds(r.positions),l=ki.compressPositions(r.positions,a.min,a.max);n.positions=l.quantized,n.positionsDecodeMatrix=l.decodeMatrix}else n.positions=r.positions.constructor===Float32Array?r.positions:new Float32Array(r.positions);if(r.colors&&(n.colors=r.colors.constructor===Float32Array?r.colors:new Float32Array(r.colors)),r.uv)if(s._state.compressGeometry){var u=ki.getUVBounds(r.uv),A=ki.compressUVs(r.uv,u.min,u.max);n.uv=A.quantized,n.uvDecodeMatrix=A.decodeMatrix}else n.uv=r.uv.constructor===Float32Array?r.uv:new Float32Array(r.uv);return r.normals&&(s._state.compressGeometry?n.normals=ki.compressNormals(r.normals):n.normals=r.normals.constructor===Float32Array?r.normals:new Float32Array(r.normals)),r.indices&&(n.indices=r.indices.constructor===Uint32Array||r.indices.constructor===Uint16Array?r.indices:new Uint32Array(r.indices),"triangles"===s._state.primitiveName&&(s._numTriangles=r.indices.length/3)),s._buildHash(),Ii.meshes++,s._buildVBOs(),s}return C(i,[{key:"type",get:function(){return"ReadableGeometry"}},{key:"isReadableGeometry",get:function(){return!0}},{key:"_buildVBOs",value:function(){var e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Ii.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new It(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Ii.positions+=e.positionsBuf.numItems),e.normals){var i=e.compressGeometry;e.normalsBuf=new It(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Ii.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new It(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Ii.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new It(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Ii.uvs+=e.uvBuf.numItems)}},{key:"_buildHash",value:function(){var e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}},{key:"_getEdgeIndices",value:function(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}},{key:"_getPickTrianglePositions",value:function(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}},{key:"_getPickTriangleColors",value:function(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}},{key:"_buildEdgeIndices",value:function(){var e=this._state;if(e.positions&&e.indices){var t=this.scene.canvas.gl,i=wi(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Ii.indices+=this._edgeIndicesBuf.numItems}}},{key:"_buildPickTriangleVBOs",value:function(){var e=this._state;if(e.positions&&e.indices){var t=this.scene.canvas.gl,i=$.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new It(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new It(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Ii.positions+=this._pickTrianglePositionsBuf.numItems,Ii.colors+=this._pickTriangleColorsBuf.numItems}}},{key:"_buildPickVertexVBOs",value:function(){}},{key:"_webglContextLost",value:function(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}},{key:"_webglContextRestored",value:function(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}},{key:"primitive",get:function(){return this._state.primitiveName}},{key:"compressGeometry",get:function(){return this._state.compressGeometry}},{key:"positions",get:function(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),ki.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null},set:function(e){var t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){var s=ki.getPositionsBounds(e),r=ki.compressPositions(e,s.min,s.max);e=r.quantized,t.positionsDecodeMatrix=r.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}},{key:"normals",get:function(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){var e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),ki.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry normals - quantized geometry is immutable");else{var t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}}},{key:"uv",get:function(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),ki.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry UVs - quantized geometry is immutable");else{var t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}}},{key:"colors",get:function(){return this._state.colors},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry colors - quantized geometry is immutable");else{var t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}}},{key:"indices",get:function(){return this._state.indices}},{key:"aabb",get:function(){return this._aabbDirty&&(this._aabb||(this._aabb=$.AABB3()),$.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}},{key:"obb",get:function(){return this._obbDirty&&(this._obb||(this._obb=$.OBB3()),$.positions3ToAABB3(this._state.positions,Di,this._state.positionsDecodeMatrix),$.AABB3ToOBB3(Di,this._obb),this._obbDirty=!1),this._obb}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"_setAABBDirty",value:function(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this);var e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Ii.meshes--}}]),i}();function Ti(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);var s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);var r=e.center,n=r?r[0]:0,o=r?r[1]:0,a=r?r[2]:0,l=-t+n,u=-i+o,A=-s+a,c=t+n,h=i+o,d=s+a;return le.apply(e,{positions:[c,h,d,l,h,d,l,u,d,c,u,d,c,h,d,c,u,d,c,u,A,c,h,A,c,h,d,c,h,A,l,h,A,l,h,d,l,h,d,l,h,A,l,u,A,l,u,d,l,u,A,c,u,A,c,u,d,l,u,d,c,u,A,l,u,A,l,h,A,c,h,A],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}var Ri=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),s=t.call(this,e,r),se.memory.materials++,s}return C(i,[{key:"type",get:function(){return"Material"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),se.memory.materials--}}]),i}(),Li={opaque:0,mask:1,blend:2},Ui=["opaque","mask","blend"],Oi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"PhongMaterial",ambient:$.vec3([1,1,1]),diffuse:$.vec3([1,1,1]),specular:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.ambient=r.ambient,s.diffuse=r.diffuse,s.specular=r.specular,s.emissive=r.emissive,s.alpha=r.alpha,s.shininess=r.shininess,s.reflectivity=r.reflectivity,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,r.ambientMap&&(s._ambientMap=s._checkComponent("Texture",r.ambientMap)),r.diffuseMap&&(s._diffuseMap=s._checkComponent("Texture",r.diffuseMap)),r.specularMap&&(s._specularMap=s._checkComponent("Texture",r.specularMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.reflectivityMap&&(s._reflectivityMap=s._checkComponent("Texture",r.reflectivityMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.diffuseFresnel&&(s._diffuseFresnel=s._checkComponent("Fresnel",r.diffuseFresnel)),r.specularFresnel&&(s._specularFresnel=s._checkComponent("Fresnel",r.specularFresnel)),r.emissiveFresnel&&(s._emissiveFresnel=s._checkComponent("Fresnel",r.emissiveFresnel)),r.alphaFresnel&&(s._alphaFresnel=s._checkComponent("Fresnel",r.alphaFresnel)),r.reflectivityFresnel&&(s._reflectivityFresnel=s._checkComponent("Fresnel",r.reflectivityFresnel)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"PhongMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}},{key:"ambient",get:function(){return this._state.ambient},set:function(e){var t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"diffuse",get:function(){return this._state.diffuse},set:function(e){var t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"specular",get:function(){return this._state.specular},set:function(e){var t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"shininess",get:function(){return this._state.shininess},set:function(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"reflectivity",get:function(){return this._state.reflectivity},set:function(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}},{key:"normalMap",get:function(){return this._normalMap}},{key:"ambientMap",get:function(){return this._ambientMap}},{key:"diffuseMap",get:function(){return this._diffuseMap}},{key:"specularMap",get:function(){return this._specularMap}},{key:"emissiveMap",get:function(){return this._emissiveMap}},{key:"alphaMap",get:function(){return this._alphaMap}},{key:"reflectivityMap",get:function(){return this._reflectivityMap}},{key:"occlusionMap",get:function(){return this._occlusionMap}},{key:"diffuseFresnel",get:function(){return this._diffuseFresnel}},{key:"specularFresnel",get:function(){return this._specularFresnel}},{key:"emissiveFresnel",get:function(){return this._emissiveFresnel}},{key:"alphaFresnel",get:function(){return this._alphaFresnel}},{key:"reflectivityFresnel",get:function(){return this._reflectivityFresnel}},{key:"alphaMode",get:function(){return Ui[this._state.alphaMode]},set:function(e){var t=Li[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Ni={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}},Qi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),s._preset="default",r.preset?(s.preset=r.preset,void 0!==r.fill&&(s.fill=r.fill),r.fillColor&&(s.fillColor=r.fillColor),void 0!==r.fillAlpha&&(s.fillAlpha=r.fillAlpha),void 0!==r.edges&&(s.edges=r.edges),r.edgeColor&&(s.edgeColor=r.edgeColor),void 0!==r.edgeAlpha&&(s.edgeAlpha=r.edgeAlpha),void 0!==r.edgeWidth&&(s.edgeWidth=r.edgeWidth),void 0!==r.backfaces&&(s.backfaces=r.backfaces),void 0!==r.glowThrough&&(s.glowThrough=r.glowThrough)):(s.fill=r.fill,s.fillColor=r.fillColor,s.fillAlpha=r.fillAlpha,s.edges=r.edges,s.edgeColor=r.edgeColor,s.edgeAlpha=r.edgeAlpha,s.edgeWidth=r.edgeWidth,s.backfaces=r.backfaces,s.glowThrough=r.glowThrough),s}return C(i,[{key:"type",get:function(){return"EmphasisMaterial"}},{key:"presets",get:function(){return Ni}},{key:"fill",get:function(){return this._state.fill},set:function(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}},{key:"fillColor",get:function(){return this._state.fillColor},set:function(e){var t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}},{key:"fillAlpha",get:function(){return this._state.fillAlpha},set:function(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}},{key:"edges",get:function(){return this._state.edges},set:function(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){var t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"edgeAlpha",get:function(){return this._state.edgeAlpha},set:function(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}},{key:"edgeWidth",get:function(){return this._state.edgeWidth},set:function(e){this._state.edgeWidth=e||1,this.glRedraw()}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"glowThrough",get:function(){return this._state.glowThrough},set:function(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ni[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ni).join(", "))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Vi={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}},Hi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),s._preset="default",r.preset?(s.preset=r.preset,r.edgeColor&&(s.edgeColor=r.edgeColor),void 0!==r.edgeAlpha&&(s.edgeAlpha=r.edgeAlpha),void 0!==r.edgeWidth&&(s.edgeWidth=r.edgeWidth)):(s.edgeColor=r.edgeColor,s.edgeAlpha=r.edgeAlpha,s.edgeWidth=r.edgeWidth),s.edges=!1!==r.edges,s}return C(i,[{key:"type",get:function(){return"EdgeMaterial"}},{key:"presets",get:function(){return Vi}},{key:"edges",get:function(){return this._state.edges},set:function(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){var t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"edgeAlpha",get:function(){return this._state.edgeAlpha},set:function(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}},{key:"edgeWidth",get:function(){return this._state.edgeWidth},set:function(e){this._state.edgeWidth=e||1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Vi[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Vi).join(", "))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),ji={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}},Gi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._units="meters",s._scale=1,s._origin=$.vec3([0,0,0]),s.units=r.units,s.scale=r.scale,s.origin=r.origin,s}return C(i,[{key:"unitsInfo",get:function(){return ji}},{key:"units",get:function(){return this._units},set:function(e){e||(e="meters"),ji[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}},{key:"scale",get:function(){return this._scale},set:function(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}},{key:"origin",get:function(){return this._origin},set:function(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}},{key:"worldToRealPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(3);t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}},{key:"realToWorldPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(3);return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}]),i}(),zi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._supported=yt.SUPPORTED_EXTENSIONS.OES_standard_derivatives,s.enabled=r.enabled,s.kernelRadius=r.kernelRadius,s.intensity=r.intensity,s.bias=r.bias,s.scale=r.scale,s.minResolution=r.minResolution,s.numSamples=r.numSamples,s.blur=r.blur,s.blendCutoff=r.blendCutoff,s.blendFactor=r.blendFactor,s}return C(i,[{key:"supported",get:function(){return this._supported}},{key:"enabled",get:function(){return this._enabled},set:function(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}},{key:"possible",get:function(){if(!this._supported)return!1;if(!this._enabled)return!1;var e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}},{key:"active",get:function(){return this._active}},{key:"kernelRadius",get:function(){return this._kernelRadius},set:function(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}},{key:"intensity",get:function(){return this._intensity},set:function(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}},{key:"bias",get:function(){return this._bias},set:function(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}},{key:"scale",get:function(){return this._scale},set:function(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}},{key:"minResolution",get:function(){return this._minResolution},set:function(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}},{key:"numSamples",get:function(){return this._numSamples},set:function(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}},{key:"blur",get:function(){return this._blur},set:function(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}},{key:"blendCutoff",get:function(){return this._blendCutoff},set:function(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}},{key:"blendFactor",get:function(){return this._blendFactor},set:function(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Wi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).sliceColor=r.sliceColor,s.sliceThickness=r.sliceThickness,s}return C(i,[{key:"sliceThickness",get:function(){return this._sliceThickness},set:function(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}},{key:"sliceColor",get:function(){return this._sliceColor},set:function(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Ki={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}},Xi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),r.preset?(s.preset=r.preset,void 0!==r.pointSize&&(s.pointSize=r.pointSize),void 0!==r.roundPoints&&(s.roundPoints=r.roundPoints),void 0!==r.perspectivePoints&&(s.perspectivePoints=r.perspectivePoints),void 0!==r.minPerspectivePointSize&&(s.minPerspectivePointSize=r.minPerspectivePointSize),void 0!==r.maxPerspectivePointSize&&(s.maxPerspectivePointSize=r.minPerspectivePointSize)):(s._preset="default",s.pointSize=r.pointSize,s.roundPoints=r.roundPoints,s.perspectivePoints=r.perspectivePoints,s.minPerspectivePointSize=r.minPerspectivePointSize,s.maxPerspectivePointSize=r.maxPerspectivePointSize),s.filterIntensity=r.filterIntensity,s.minIntensity=r.minIntensity,s.maxIntensity=r.maxIntensity,s}return C(i,[{key:"type",get:function(){return"PointsMaterial"}},{key:"presets",get:function(){return Ki}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||2,this.glRedraw()}},{key:"roundPoints",get:function(){return this._state.roundPoints},set:function(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"perspectivePoints",get:function(){return this._state.perspectivePoints},set:function(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"minPerspectivePointSize",get:function(){return this._state.minPerspectivePointSize},set:function(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}},{key:"maxPerspectivePointSize",get:function(){return this._state.maxPerspectivePointSize},set:function(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}},{key:"filterIntensity",get:function(){return this._state.filterIntensity},set:function(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"minIntensity",get:function(){return this._state.minIntensity},set:function(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}},{key:"maxIntensity",get:function(){return this._state.maxIntensity},set:function(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ki[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ki).join(", "))}}},{key:"hash",get:function(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Ji={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}},Yi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"LinesMaterial",lineWidth:null}),r.preset?(s.preset=r.preset,void 0!==r.lineWidth&&(s.lineWidth=r.lineWidth)):(s._preset="default",s.lineWidth=r.lineWidth),s}return C(i,[{key:"type",get:function(){return"LinesMaterial"}},{key:"presets",get:function(){return Ji}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ji[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ji).join(", "))}}},{key:"hash",get:function(){return[""+this.lineWidth].join(";")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}();function Zi(e,t){for(var i,s,r={},n=0,o=t.length;n1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),s=t.call(this,null,r);var n=r.canvasElement||document.getElementById(r.canvasId);if(!(n instanceof HTMLCanvasElement))throw"Mandatory config expected: valid canvasId or canvasElement";s._tickifiedFunctions={};var o=!!r.transparent,a=!!r.alphaDepthMask;return s._aabbDirty=!0,s.viewer=e,s.occlusionTestCountdown=0,s.loading=0,s.startTime=(new Date).getTime(),s.models={},s.objects={},s._numObjects=0,s.visibleObjects={},s._numVisibleObjects=0,s.xrayedObjects={},s._numXRayedObjects=0,s.highlightedObjects={},s._numHighlightedObjects=0,s.selectedObjects={},s._numSelectedObjects=0,s.colorizedObjects={},s._numColorizedObjects=0,s.opacityObjects={},s._numOpacityObjects=0,s.offsetObjects={},s._numOffsetObjects=0,s._modelIds=null,s._objectIds=null,s._visibleObjectIds=null,s._xrayedObjectIds=null,s._highlightedObjectIds=null,s._selectedObjectIds=null,s._colorizedObjectIds=null,s._opacityObjectIds=null,s._offsetObjectIds=null,s._collidables={},s._compilables={},s._needRecompile=!1,s.types={},s.components={},s.sectionPlanes={},s.lights={},s.lightMaps={},s.reflectionMaps={},s.bitmaps={},s.lineSets={},s.realWorldOffset=r.realWorldOffset||new Float64Array([0,0,0]),s.canvas=new mt(b(s),{dontClear:!0,canvas:n,spinnerElementId:r.spinnerElementId,transparent:o,webgl2:!1!==r.webgl2,contextAttr:r.contextAttr||{},backgroundColor:r.backgroundColor,backgroundColorFromAmbientLight:r.backgroundColorFromAmbientLight,premultipliedAlpha:r.premultipliedAlpha}),s.canvas.on("boundary",(function(){s.glRedraw()})),s.canvas.on("webglContextFailed",(function(){alert("xeokit failed to find WebGL!")})),s._renderer=new Xt(b(s),{transparent:o,alphaDepthMask:a}),s._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;var e=null;this.getHash=function(){if(e)return e;var t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";for(var i=[],s=0,r=t;sthis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},s._sectionPlanesState.setNumCachedSectionPlanes(r.numCachedSectionPlanes||0),s._lightsState=new function(){var e=$.vec4([0,0,0,0]),t=$.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];var i=null,s=null;this.getHash=function(){if(i)return i;for(var e,t=[],s=this.lights,r=0,n=s.length;r0&&t.push("/lm"),this.reflectionMaps.length>0&&t.push("/rm"),t.push(";"),i=t.join("")},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(var t=0,r=this.lights.length;t1&&void 0!==arguments[1])||arguments[1];e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}},{key:"_deRegisterVisibleObject",value:function(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}},{key:"_objectXRayedUpdated",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}},{key:"_deRegisterXRayedObject",value:function(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}},{key:"_objectHighlightedUpdated",value:function(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}},{key:"_deRegisterHighlightedObject",value:function(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}},{key:"_objectSelectedUpdated",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}},{key:"_deRegisterSelectedObject",value:function(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}},{key:"_objectColorizeUpdated",value:function(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}},{key:"_deRegisterColorizedObject",value:function(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}},{key:"_objectOpacityUpdated",value:function(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}},{key:"_deRegisterOpacityObject",value:function(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}},{key:"_objectOffsetUpdated",value:function(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}},{key:"_deRegisterOffsetObject",value:function(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}},{key:"_webglContextLost",value:function(){for(var e in this.canvas.spinner.processes++,this.components)if(this.components.hasOwnProperty(e)){var t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}},{key:"_webglContextRestored",value:function(){var e=this.canvas.gl;for(var t in this.components)if(this.components.hasOwnProperty(t)){var i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}},{key:"capabilities",get:function(){return this._renderer.capabilities}},{key:"entityOffsetsEnabled",get:function(){return this._entityOffsetsEnabled}},{key:"pickSurfacePrecisionEnabled",get:function(){return!1}},{key:"logarithmicDepthBufferEnabled",get:function(){return this._logarithmicDepthBufferEnabled}},{key:"numCachedSectionPlanes",get:function(){return this._sectionPlanesState.getNumCachedSectionPlanes()},set:function(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}},{key:"pbrEnabled",get:function(){return this._pbrEnabled},set:function(e){this._pbrEnabled=!!e,this.glRedraw()}},{key:"dtxEnabled",get:function(){return this._dtxEnabled},set:function(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}},{key:"colorTextureEnabled",get:function(){return this._colorTextureEnabled},set:function(e){this._colorTextureEnabled=!!e,this.glRedraw()}},{key:"doOcclusionTest",value:function(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}},{key:"render",value:function(e){e&&_e.runTasks();var t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),e||this._renderer.needsRender()){t.sceneId=this.id;var i,s,r=this._passes,n=this._clearEachPass;for(i=0;in&&(n=e[3]),e[4]>o&&(o=e[4]),e[5]>a&&(a=e[5]),u=!0}u||(i=-100,s=-100,r=-100,n=100,o=100,a=100),this._aabb[0]=i,this._aabb[1]=s,this._aabb[2]=r,this._aabb[3]=n,this._aabb[4]=o,this._aabb[5]=a,this._aabbDirty=!1}return this._aabb}},{key:"_setAABBDirty",value:function(){this._aabbDirty=!0,this.fire("boundary")}},{key:"pick",value:function(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");var i=e.includeEntities||e.include;i&&(e.includeEntityIds=Zi(this,i));var s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=Zi(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}},{key:"snapPick",value:function(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}},{key:"clear",value:function(){var e;for(var t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}},{key:"clearLights",value:function(){for(var e=Object.keys(this.lights),t=0,i=e.length;to&&(o=t[3]),t[4]>a&&(a=t[4]),t[5]>l&&(l=t[5]),i=!0}})),i){var u=$.AABB3();return u[0]=s,u[1]=r,u[2]=n,u[3]=o,u[4]=a,u[5]=l,u}return this.aabb}},{key:"setObjectsVisible",value:function(e,t){return this.withObjects(e,(function(e){var i=e.visible!==t;return e.visible=t,i}))}},{key:"setObjectsCollidable",value:function(e,t){return this.withObjects(e,(function(e){var i=e.collidable!==t;return e.collidable=t,i}))}},{key:"setObjectsCulled",value:function(e,t){return this.withObjects(e,(function(e){var i=e.culled!==t;return e.culled=t,i}))}},{key:"setObjectsSelected",value:function(e,t){return this.withObjects(e,(function(e){var i=e.selected!==t;return e.selected=t,i}))}},{key:"setObjectsHighlighted",value:function(e,t){return this.withObjects(e,(function(e){var i=e.highlighted!==t;return e.highlighted=t,i}))}},{key:"setObjectsXRayed",value:function(e,t){return this.withObjects(e,(function(e){var i=e.xrayed!==t;return e.xrayed=t,i}))}},{key:"setObjectsEdges",value:function(e,t){return this.withObjects(e,(function(e){var i=e.edges!==t;return e.edges=t,i}))}},{key:"setObjectsColorized",value:function(e,t){return this.withObjects(e,(function(e){e.colorize=t}))}},{key:"setObjectsOpacity",value:function(e,t){return this.withObjects(e,(function(e){var i=e.opacity!==t;return e.opacity=t,i}))}},{key:"setObjectsPickable",value:function(e,t){return this.withObjects(e,(function(e){var i=e.pickable!==t;return e.pickable=t,i}))}},{key:"setObjectsOffset",value:function(e,t){this.withObjects(e,(function(e){e.offset=t}))}},{key:"withObjects",value:function(e,t){le.isString(e)&&(e=[e]);for(var i=!1,s=0,r=e.length;ss&&(s=r,e.apply(void 0,A(i)))}));return this._tickifiedFunctions[t]={tickSubId:o,wrapperFunc:n},n}},{key:"destroy",value:function(){for(var e in f(B(i.prototype),"destroy",this).call(this),this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}]),i}(),$i=1e3,es=1001,ts=1002,is=1003,ss=1004,rs=1004,ns=1005,os=1005,as=1006,ls=1007,us=1007,As=1008,cs=1008,hs=1009,ds=1010,ps=1011,fs=1012,vs=1013,gs=1014,ms=1015,_s=1016,ys=1017,bs=1018,Bs=1020,ws=1021,xs=1022,Ps=1023,Cs=1024,Ms=1025,Fs=1026,Es=1027,ks=1028,Is=1029,Ds=1030,Ss=1031,Ts=1033,Rs=33776,Ls=33777,Us=33778,Os=33779,Ns=35840,Qs=35841,Vs=35842,Hs=35843,js=36196,Gs=37492,zs=37496,Ws=37808,Ks=37809,Xs=37810,Js=37811,Ys=37812,Zs=37813,qs=37814,$s=37815,er=37816,tr=37817,ir=37818,sr=37819,rr=37820,nr=37821,or=36492,ar=3e3,lr=3001,ur=1e4,Ar=10001,cr=10002,hr=10003,dr=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){var t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,n=e._state.billboard,o=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,u=[];u.push("#version 300 es"),u.push("// Lambertian drawing vertex shader"),u.push("in vec3 position;"),u.push("uniform mat4 modelMatrix;"),u.push("uniform mat4 viewMatrix;"),u.push("uniform mat4 projMatrix;"),u.push("uniform vec4 colorize;"),u.push("uniform vec3 offset;"),l&&u.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(u.push("uniform float logDepthBufFC;"),u.push("out float vFragDepth;"),u.push("bool isPerspectiveMatrix(mat4 m) {"),u.push(" return (m[2][3] == - 1.0);"),u.push("}"),u.push("out float isPerspective;"));a&&u.push("out vec4 vWorldPosition;");if(u.push("uniform vec4 lightAmbient;"),u.push("uniform vec4 materialColor;"),u.push("uniform vec3 materialEmissive;"),r.normalsBuf){u.push("in vec3 normal;"),u.push("uniform mat4 modelNormalMatrix;"),u.push("uniform mat4 viewNormalMatrix;");for(var A=0,c=s.lights.length;A= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),u.push(" }"),u.push(" return normalize(v);"),u.push("}"))}u.push("out vec4 vColor;"),"points"===r.primitiveName&&u.push("uniform float pointSize;");"spherical"!==n&&"cylindrical"!==n||(u.push("void billboard(inout mat4 mat) {"),u.push(" mat[0][0] = 1.0;"),u.push(" mat[0][1] = 0.0;"),u.push(" mat[0][2] = 0.0;"),"spherical"===n&&(u.push(" mat[1][0] = 0.0;"),u.push(" mat[1][1] = 1.0;"),u.push(" mat[1][2] = 0.0;")),u.push(" mat[2][0] = 0.0;"),u.push(" mat[2][1] = 0.0;"),u.push(" mat[2][2] =1.0;"),u.push("}"));u.push("void main(void) {"),u.push("vec4 localPosition = vec4(position, 1.0); "),u.push("vec4 worldPosition;"),l&&u.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?u.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):u.push("vec4 localNormal = vec4(normal, 0.0); "),u.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),u.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));u.push("mat4 viewMatrix2 = viewMatrix;"),u.push("mat4 modelMatrix2 = modelMatrix;"),o&&u.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(u.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),u.push("billboard(modelMatrix2);"),u.push("billboard(viewMatrix2);"),u.push("billboard(modelViewMatrix);"),r.normalsBuf&&(u.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),u.push("billboard(modelNormalMatrix2);"),u.push("billboard(viewNormalMatrix2);"),u.push("billboard(modelViewNormalMatrix);")),u.push("worldPosition = modelMatrix2 * localPosition;"),u.push("worldPosition.xyz = worldPosition.xyz + offset;"),u.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(u.push("worldPosition = modelMatrix2 * localPosition;"),u.push("worldPosition.xyz = worldPosition.xyz + offset;"),u.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&u.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(u.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),u.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),u.push("float lambertian = 1.0;"),r.normalsBuf)for(var d=0,p=s.lights.length;d0,n=t.gammaOutput,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(var a=0,l=i.getNumAllocatedSectionPlanes();a 0.0) { discard; }"),o.push("}")}"points"===s.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");n?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)):(this.vertex=function(e){var t=e.scene;e._material;var i,s=e._state,r=t._sectionPlanesState,n=e._geometry._state,o=t._lightsState,a=s.billboard,l=s.background,u=s.stationary,A=function(e){if(!e._geometry._state.uvBuf)return!1;var t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=vr(e),h=r.getNumAllocatedSectionPlanes()>0,d=fr(e),p=!!n.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),h&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(var v=0,g=o.lights.length;v= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}A&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));n.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===n.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(var m=0,_=o.lights.length;m<_;m++)o.lights[m].castsShadow&&(f.push("uniform mat4 shadowViewMatrix"+m+";"),f.push("uniform mat4 shadowProjMatrix"+m+";"),f.push("out vec4 vShadowPosFromLight"+m+";"))}f.push("void main(void) {"),f.push("vec4 localPosition = vec4(position, 1.0); "),f.push("vec4 worldPosition;"),p&&f.push("localPosition = positionsDecodeMatrix * localPosition;");c&&(p?f.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):f.push("vec4 localNormal = vec4(normal, 0.0); "),f.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),f.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));f.push("mat4 viewMatrix2 = viewMatrix;"),f.push("mat4 modelMatrix2 = modelMatrix;"),u?f.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;"):l&&f.push("viewMatrix2[3] = vec4(0.0, 0.0, 0.0 ,1.0);");"spherical"===a||"cylindrical"===a?(f.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),f.push("billboard(modelMatrix2);"),f.push("billboard(viewMatrix2);"),f.push("billboard(modelViewMatrix);"),c&&(f.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),f.push("billboard(modelNormalMatrix2);"),f.push("billboard(viewNormalMatrix2);"),f.push("billboard(modelViewNormalMatrix);")),f.push("worldPosition = modelMatrix2 * localPosition;"),f.push("worldPosition.xyz = worldPosition.xyz + offset;"),f.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(f.push("worldPosition = modelMatrix2 * localPosition;"),f.push("worldPosition.xyz = worldPosition.xyz + offset;"),f.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));if(c){f.push("vec3 worldNormal = (modelNormalMatrix2 * localNormal).xyz; "),o.lightMaps.length>0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(var y=0,b=o.lights.length;y0,l=vr(e),u=s.uvBuf,A="PhongMaterial"===o.type,c="MetallicMaterial"===o.type,h="SpecularMaterial"===o.type,d=fr(e);t.gammaInput;var p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var v=0;v0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),n.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),A&&((n.lightMaps.length>0||n.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.lightMaps.length>0&&(f.push(" vec3 irradiance = "+pr[n.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),n.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||h)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),n.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+pr[n.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(n.lightMaps.length>0||n.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),n.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");u&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(n.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));o.ambient&&f.push("uniform vec3 materialAmbient;");o.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==o.alpha&&null!==o.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");o.emissive&&f.push("uniform vec3 materialEmissive;");o.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==o.glossiness&&null!==o.glossiness&&f.push("uniform float materialGlossiness;");void 0!==o.shininess&&null!==o.shininess&&f.push("uniform float materialShininess;");o.specular&&f.push("uniform vec3 materialSpecular;");void 0!==o.metallic&&null!==o.metallic&&f.push("uniform float materialMetallic;");void 0!==o.roughness&&null!==o.roughness&&f.push("uniform float materialRoughness;");void 0!==o.specularF0&&null!==o.specularF0&&f.push("uniform float materialSpecularF0;");u&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));u&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));u&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));u&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&u&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&u&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&u&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));u&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));u&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&u&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&u&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&u&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(var g=0,m=n.lights.length;g 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),o.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");o.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):o.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");o.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");o.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==o.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==o.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==o.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==o.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==o.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");u&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));u&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+pr[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));u&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+pr[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));u&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+pr[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));u&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+pr[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));u&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));u&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(n.lights.length>0||n.lightMaps.length>0||n.reflectionMaps.length>0)){u&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),u&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),u&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),u&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),u&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),u&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),u&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),A&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),h&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),n.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),A&&(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(h||c)&&(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(var B=0,w=n.lights.length;B0)for(var f=s._sectionPlanesState.sectionPlanes,v=t.renderFlags,g=0;g0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(A=0,c=n.sectionPlanes.length;A0&&n.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,n.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%i,e.bindTexture++),n.reflectionMaps.length>0&&n.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,n.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%i,e.bindTexture++),this._uGammaFactor&&r.uniform1f(this._uGammaFactor,s.gammaFactor),this._baseTextureUnit=e.textureUnit};var br=C((function e(t){x(this,e),this.vertex=function(e){var t=e.scene,i=t._lightsState,s=function(e){var t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,n=!!e._geometry._state.compressGeometry,o=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),n&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(var u=0,A=i.lights.length;u= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===o||"cylindrical"===o)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===o&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),n&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(n?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(var h=0,d=i.lights.length;h0,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));s&&(n.push("uniform float gammaFactor;"),n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(var o=0,a=i.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),n.push("}")}"points"===e._geometry._state.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(t)}));var Br=new Q({}),wr=$.vec3(),xr=function(e,t){this.id=Br.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new br(t),this._allocate(t)},Pr={};xr.get=function(e){var t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=Pr[t];return i||(i=new xr(t,e),Pr[t]=i,se.memory.programs++),i._useCount++,i},xr.prototype.put=function(){0==--this._useCount&&(Br.removeItem(this.id),this._program&&this._program.destroy(),delete Pr[this._hash],se.memory.programs--)},xr.prototype.webglContextRestored=function(){this._program=null},xr.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);var s=this._scene,r=s.camera,n=s.canvas.gl,o=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,u=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),n.uniformMatrix4fv(this._uViewMatrix,!1,u?e.getRTCViewMatrix(a.originHash,u):r.viewMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){var A=s._sectionPlanesState.getNumAllocatedSectionPlanes(),c=s._sectionPlanesState.sectionPlanes.length;if(A>0)for(var h=s._sectionPlanesState.sectionPlanes,d=t.renderFlags,p=0;p0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Edges drawing vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform vec4 edgeColor;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));i&&o.push("out vec4 vWorldPosition;");o.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),o.push("vec4 worldPosition;"),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"),o.push("billboard(modelViewMatrix);"),o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));o.push("vColor = edgeColor;"),i&&o.push("vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = clipPos;"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,n=[];n.push("#version 300 es"),n.push("// Edges drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));s&&(n.push("uniform float gammaFactor;"),n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(var o=0,a=i.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),n.push("}")}t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(t)}));var Mr=new Q({}),Fr=$.vec3(),Er=function(e,t){this.id=Mr.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Cr(t),this._allocate(t)},kr={};Er.get=function(e){var t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=kr[t];return i||(i=new Er(t,e),kr[t]=i,se.memory.programs++),i._useCount++,i},Er.prototype.put=function(){0==--this._useCount&&(Mr.removeItem(this.id),this._program&&this._program.destroy(),delete kr[this._hash],se.memory.programs--)},Er.prototype.webglContextRestored=function(){this._program=null},Er.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);var s,r,n=this._scene,o=n.camera,a=n.canvas.gl,l=t._state,u=t._geometry,A=u._state,c=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),a.uniformMatrix4fv(this._uViewMatrix,!1,c?e.getRTCViewMatrix(l.originHash,c):o.viewMatrix),l.clippable){var h=n._sectionPlanesState.getNumAllocatedSectionPlanes(),d=n._sectionPlanesState.sectionPlanes.length;if(h>0)for(var p=n._sectionPlanesState.sectionPlanes,f=t.renderFlags,v=0;v0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Mesh picking vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("out vec4 vViewPosition;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");i&&o.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("uniform vec2 pickClipPos;"),o.push("vec4 remapClipPos(vec4 clipPos) {"),o.push(" clipPos.xy /= clipPos.w;"),o.push(" clipPos.xy -= pickClipPos;"),o.push(" clipPos.xy *= clipPos.w;"),o.push(" return clipPos;"),o.push("}"),o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"));o.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&o.push(" vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = remapClipPos(clipPos);"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(t)}));var Dr=$.vec3(),Sr=function(e,t){this._hash=e,this._shaderSource=new Ir(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Tr={};Sr.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";"),i=Tr[t];if(!i){if((i=new Sr(t,e)).errors)return console.log(i.errors.join("\n")),null;Tr[t]=i,se.memory.programs++}return i._useCount++,i},Sr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Tr[this._hash],se.memory.programs--)},Sr.prototype.webglContextRestored=function(){this._program=null},Sr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._state,n=t._material._state,o=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){var l=i._sectionPlanesState.getNumAllocatedSectionPlanes(),u=i._sectionPlanesState.sectionPlanes.length;if(l>0)for(var A=i._sectionPlanesState.sectionPlanes,c=t.renderFlags,h=0;h>24&255,b=_>>16&255,B=_>>8&255,w=255&_;s.uniform4f(this._uPickColor,w/255,B/255,b/255,y/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),o.indicesBuf?(s.drawElements(o.primitive,o.indicesBuf.numItems,o.indicesBuf.itemType,0),e.drawElements++):o.positions&&s.drawArrays(s.TRIANGLES,0,o.positions.numItems)},Sr.prototype._allocate=function(e){var t=e.scene,i=t.canvas.gl;if(this._program=new kt(i,this._shaderSource),this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(var r=0,n=t._sectionPlanesState.sectionPlanes.length;r0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(t)}));var Lr=$.vec3(),Ur=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Rr(t),this._allocate(t)},Or={};Ur.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=Or[t];if(!i){if((i=new Ur(t,e)).errors)return console.log(i.errors.join("\n")),null;Or[t]=i,se.memory.programs++}return i._useCount++,i},Ur.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Or[this._hash],se.memory.programs--)},Ur.prototype.webglContextRestored=function(){this._program=null},Ur.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._state,n=t._material._state,o=t._geometry,a=t._geometry._state,l=t.origin,u=n.backfaces,A=n.frontface,c=i.camera.project,h=o._getPickTrianglePositions(),d=o._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){var p=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,p)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){var f=i._sectionPlanesState.getNumAllocatedSectionPlanes(),v=i._sectionPlanesState.sectionPlanes.length;if(f>0)for(var g=i._sectionPlanesState.sectionPlanes,m=t.renderFlags,_=0;_0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Mesh occlusion vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");i&&o.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),o.push("vec4 worldPosition;"),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"),o.push("billboard(modelViewMatrix);"),o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&o.push(" vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = clipPos;"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(t)}));var Qr=$.vec3(),Vr=function(e,t){this._hash=e,this._shaderSource=new Nr(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Hr={};Vr.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";"),i=Hr[t];if(!i){if((i=new Vr(t,e)).errors)return console.log(i.errors.join("\n")),null;Hr[t]=i,se.memory.programs++}return i._useCount++,i},Vr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Hr[this._hash],se.memory.programs--)},Vr.prototype.webglContextRestored=function(){this._program=null},Vr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._material._state,n=t._state,o=t._geometry._state,a=t.origin;if(!(r.alpha<1)){if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){var l=r.backfaces;e.backfaces!==l&&(l?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=l);var u=r.frontface;e.frontface!==u&&(u?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=u),this._lastMaterialId=r.id}var A=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(n.originHash,a):A.viewMatrix),n.clippable){var c=i._sectionPlanesState.getNumAllocatedSectionPlanes(),h=i._sectionPlanesState.sectionPlanes.length;if(c>0)for(var d=i._sectionPlanesState.sectionPlanes,p=t.renderFlags,f=0;f0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(t),this.fragment=function(e){var t=e.scene;t.canvas.gl;var i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(t)}));var Gr=function(e,t){this._hash=e,this._shaderSource=new jr(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},zr={};Gr.get=function(e){var t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";"),s=zr[i];if(!s){if((s=new Gr(i,e)).errors)return console.log(s.errors.join("\n")),null;zr[i]=s,se.memory.programs++}return s._useCount++,s},Gr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete zr[this._hash],se.memory.programs--)},Gr.prototype.webglContextRestored=function(){this._program=null},Gr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){var n=s.backfaces;e.backfaces!==n&&(n?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=n);var o=s.frontface;e.frontface!==o&&(o?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=o),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){var a=t.vertexBufs;a.id!==this._lastVertexBufsId&&(a.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(a.positionsBuf,a.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=a.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},Gr.prototype._allocate=function(e){var t=e.scene,i=t.canvas.gl;if(this._program=new kt(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(var r=0,n=t._sectionPlanesState.sectionPlanes.length;r0)for(var r,n,o,a=0,l=this._uSectionPlanes.length;a1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r)).originalSystemId=r.originalSystemId||s.id,s.renderFlags=new Wr,s._state=new Zt({visible:!0,culled:!1,pickable:null,clippable:null,collidable:null,occluder:!1!==r.occluder,castsShadow:null,receivesShadow:null,xrayed:!1,highlighted:!1,selected:!1,edges:!1,stationary:!!r.stationary,background:!!r.background,billboard:s._checkBillboard(r.billboard),layer:null,colorize:null,pickID:s.scene._renderer.getPickID(b(s)),drawHash:"",pickHash:"",offset:$.vec3(),origin:null,originHash:null}),s._drawRenderer=null,s._shadowRenderer=null,s._emphasisFillRenderer=null,s._emphasisEdgesRenderer=null,s._pickMeshRenderer=null,s._pickTriangleRenderer=null,s._occlusionRenderer=null,s._geometry=r.geometry?s._checkComponent2(["ReadableGeometry","VBOGeometry"],r.geometry):s.scene.geometry,s._material=r.material?s._checkComponent2(["PhongMaterial","MetallicMaterial","SpecularMaterial","LambertMaterial"],r.material):s.scene.material,s._xrayMaterial=r.xrayMaterial?s._checkComponent("EmphasisMaterial",r.xrayMaterial):s.scene.xrayMaterial,s._highlightMaterial=r.highlightMaterial?s._checkComponent("EmphasisMaterial",r.highlightMaterial):s.scene.highlightMaterial,s._selectedMaterial=r.selectedMaterial?s._checkComponent("EmphasisMaterial",r.selectedMaterial):s.scene.selectedMaterial,s._edgeMaterial=r.edgeMaterial?s._checkComponent("EdgeMaterial",r.edgeMaterial):s.scene.edgeMaterial,s._parentNode=null,s._aabb=null,s._aabbDirty=!0,s._numTriangles=s._geometry?s._geometry.numTriangles:0,s.scene._aabbDirty=!0,s._scale=$.vec3(),s._quaternion=$.identityQuaternion(),s._rotation=$.vec3(),s._position=$.vec3(),s._worldMatrix=$.identityMat4(),s._worldNormalMatrix=$.identityMat4(),s._localMatrixDirty=!0,s._worldMatrixDirty=!0,s._worldNormalMatrixDirty=!0;var n=r.origin||r.rtcCenter;if(n&&(s._state.origin=$.vec3(n),s._state.originHash=n.join()),r.matrix?s.matrix=r.matrix:(s.scale=r.scale,s.position=r.position,r.quaternion||(s.rotation=r.rotation)),s._isObject=r.isObject,s._isObject&&s.scene._registerObject(b(s)),s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.layer=r.layer,s.colorize=r.colorize,s.opacity=r.opacity,s.offset=r.offset,r.parentId){var o=s.scene.components[r.parentId];o?o.isNode?o.addChild(b(s)):s.error("Parent is not a Node: '"+r.parentId+"'"):s.error("Parent not found: '"+r.parentId+"'"),s._parentNode=o}else r.parent&&(r.parent.isNode||s.error("Parent is not a Node"),r.parent.addChild(b(s)),s._parentNode=r.parent);return s.compile(),s}return C(i,[{key:"type",get:function(){return"Mesh"}},{key:"isMesh",get:function(){return!0}},{key:"parent",get:function(){return this._parentNode}},{key:"geometry",get:function(){return this._geometry}},{key:"material",get:function(){return this._material}},{key:"position",get:function(){return this._position},set:function(e){this._position.set(e||[0,0,0]),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"rotation",get:function(){return this._rotation},set:function(e){this._rotation.set(e||[0,0,0]),$.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"quaternion",get:function(){return this._quaternion},set:function(e){this._quaternion.set(e||[0,0,0,1]),$.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"scale",get:function(){return this._scale},set:function(e){this._scale.set(e||[1,1,1]),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"matrix",get:function(){return this._localMatrixDirty&&(this.__localMatrix||(this.__localMatrix=$.identityMat4()),$.composeMat4(this._position,this._quaternion,this._scale,this.__localMatrix),this._localMatrixDirty=!1),this.__localMatrix},set:function(e){this.__localMatrix||(this.__localMatrix=$.identityMat4()),this.__localMatrix.set(e||sn),$.decomposeMat4(this.__localMatrix,this._position,this._quaternion,this._scale),this._localMatrixDirty=!1,this._setWorldMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"worldMatrix",get:function(){return this._worldMatrixDirty&&this._buildWorldMatrix(),this._worldMatrix}},{key:"worldNormalMatrix",get:function(){return this._worldNormalMatrixDirty&&this._buildWorldNormalMatrix(),this._worldNormalMatrix}},{key:"isEntity",get:function(){return!0}},{key:"isModel",get:function(){return this._isModel}},{key:"isObject",get:function(){return this._isObject}},{key:"aabb",get:function(){return this._aabbDirty&&this._updateAABB(),this._aabb}},{key:"origin",get:function(){return this._state.origin},set:function(e){e?(this._state.origin||(this._state.origin=$.vec3()),this._state.origin.set(e),this._state.originHash=e.join(),this._setAABBDirty(),this.scene._aabbDirty=!0):this._state.origin&&(this._state.origin=null,this._state.originHash=null,this._setAABBDirty(),this.scene._aabbDirty=!0)}},{key:"rtcCenter",get:function(){return this.origin},set:function(e){this.origin=e}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"visible",get:function(){return this._state.visible},set:function(e){e=!1!==e,this._state.visible=e,this._isObject&&this.scene._objectVisibilityUpdated(this,e),this.glRedraw()}},{key:"xrayed",get:function(){return this._state.xrayed},set:function(e){e=!!e,this._state.xrayed!==e&&(this._state.xrayed=e,this._isObject&&this.scene._objectXRayedUpdated(this,e),this.glRedraw())}},{key:"highlighted",get:function(){return this._state.highlighted},set:function(e){(e=!!e)!==this._state.highlighted&&(this._state.highlighted=e,this._isObject&&this.scene._objectHighlightedUpdated(this,e),this.glRedraw())}},{key:"selected",get:function(){return this._state.selected},set:function(e){(e=!!e)!==this._state.selected&&(this._state.selected=e,this._isObject&&this.scene._objectSelectedUpdated(this,e),this.glRedraw())}},{key:"edges",get:function(){return this._state.edges},set:function(e){(e=!!e)!==this._state.edges&&(this._state.edges=e,this.glRedraw())}},{key:"culled",get:function(){return this._state.culled},set:function(e){this._state.culled=!!e,this.glRedraw()}},{key:"clippable",get:function(){return this._state.clippable},set:function(e){e=!1!==e,this._state.clippable!==e&&(this._state.clippable=e,this.glRedraw())}},{key:"collidable",get:function(){return this._state.collidable},set:function(e){(e=!1!==e)!==this._state.collidable&&(this._state.collidable=e,this._setAABBDirty(),this.scene._aabbDirty=!0)}},{key:"pickable",get:function(){return this._state.pickable},set:function(e){e=!1!==e,this._state.pickable!==e&&(this._state.pickable=e)}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){(e=!1!==e)!==this._state.castsShadow&&(this._state.castsShadow=e,this.glRedraw())}},{key:"receivesShadow",get:function(){return this._state.receivesShadow},set:function(e){(e=!1!==e)!==this._state.receivesShadow&&(this._state.receivesShadow=e,this._state.hash=e?"/mod/rs;":"/mod;",this.fire("dirty",this))}},{key:"saoEnabled",get:function(){return!1}},{key:"colorize",get:function(){return this._state.colorize},set:function(e){var t=this._state.colorize;t||((t=this._state.colorize=new Float32Array(4))[3]=1),e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1);var i=!!e;this.scene._objectColorizeUpdated(this,i),this.glRedraw()}},{key:"opacity",get:function(){return this._state.colorize[3]},set:function(e){var t=this._state.colorize;t||((t=this._state.colorize=new Float32Array(4))[0]=1,t[1]=1,t[2]=1);var i=null!=e;t[3]=i?e:1,this.scene._objectOpacityUpdated(this,i),this.glRedraw()}},{key:"transparent",get:function(){return 2===this._material.alphaMode||this._state.colorize[3]<1}},{key:"layer",get:function(){return this._state.layer},set:function(e){e=e||0,(e=Math.round(e))!==this._state.layer&&(this._state.layer=e,this._renderer.needStateSort())}},{key:"stationary",get:function(){return this._state.stationary}},{key:"billboard",get:function(){return this._state.billboard}},{key:"offset",get:function(){return this._state.offset},set:function(e){this._state.offset.set(e||[0,0,0]),this._setAABBDirty(),this.glRedraw()}},{key:"isDrawable",get:function(){return!0}},{key:"isStateSortable",get:function(){return!0}},{key:"xrayMaterial",get:function(){return this._xrayMaterial}},{key:"highlightMaterial",get:function(){return this._highlightMaterial}},{key:"selectedMaterial",get:function(){return this._selectedMaterial}},{key:"edgeMaterial",get:function(){return this._edgeMaterial}},{key:"_checkBillboard",value:function(e){return"spherical"!==(e=e||"none")&&"cylindrical"!==e&&"none"!==e&&(this.error("Unsupported value for 'billboard': "+e+" - accepted values are 'spherical', 'cylindrical' and 'none' - defaulting to 'none'."),e="none"),e}},{key:"compile",value:function(){var e=this._makeDrawHash();this._state.drawHash!==e&&(this._state.drawHash=e,this._putDrawRenderers(),this._drawRenderer=_r.get(this),this._emphasisFillRenderer=xr.get(this),this._emphasisEdgesRenderer=Er.get(this));var t=this._makePickHash();if(this._state.pickHash!==t&&(this._state.pickHash=t,this._putPickRenderers(),this._pickMeshRenderer=Sr.get(this)),this._state.occluder){var i=this._makeOcclusionHash();this._state.occlusionHash!==i&&(this._state.occlusionHash=i,this._putOcclusionRenderer(),this._occlusionRenderer=Vr.get(this))}}},{key:"_setLocalMatrixDirty",value:function(){this._localMatrixDirty=!0,this._setWorldMatrixDirty()}},{key:"_setWorldMatrixDirty",value:function(){this._worldMatrixDirty=!0,this._worldNormalMatrixDirty=!0}},{key:"_buildWorldMatrix",value:function(){var e=this.matrix;if(this._parentNode)$.mulMat4(this._parentNode.worldMatrix,e,this._worldMatrix);else for(var t=0,i=e.length;t0)for(var i=0;i-1){var R=k.geometry._state,L=k.scene,U=L.camera,O=L.canvas;if("triangles"===R.primitiveName){S.primitive="triangle";var N,Q,V,H=T,j=R.indices,G=R.positions;if(j){var z=j[H+0],W=j[H+1],K=j[H+2];n[0]=z,n[1]=W,n[2]=K,S.indices=n,N=3*z,Q=3*W,V=3*K}else V=(Q=(N=3*H)+3)+3;if(i[0]=G[N+0],i[1]=G[N+1],i[2]=G[N+2],s[0]=G[Q+0],s[1]=G[Q+1],s[2]=G[Q+2],r[0]=G[V+0],r[1]=G[V+1],r[2]=G[V+2],R.compressGeometry){var X=R.positionsDecodeMatrix;X&&(ki.decompressPosition(i,X,i),ki.decompressPosition(s,X,s),ki.decompressPosition(r,X,r))}S.canvasPos?$.canvasPosToLocalRay(O.canvas,k.origin?Re(I,k.origin):I,D,k.worldMatrix,S.canvasPos,e,t):S.origin&&S.direction&&$.worldRayToLocalRay(k.worldMatrix,S.origin,S.direction,e,t),$.normalizeVec3(t),$.rayPlaneIntersect(e,t,i,s,r,o),S.localPos=o,S.position=o,v[0]=o[0],v[1]=o[1],v[2]=o[2],v[3]=1,$.transformVec4(k.worldMatrix,v,g),a[0]=g[0],a[1]=g[1],a[2]=g[2],S.canvasPos&&k.origin&&(a[0]+=k.origin[0],a[1]+=k.origin[1],a[2]+=k.origin[2]),S.worldPos=a,$.transformVec4(U.matrix,g,m),l[0]=m[0],l[1]=m[1],l[2]=m[2],S.viewPos=l,$.cartesianToBarycentric(o,i,s,r,u),S.bary=u;var J=R.normals;if(J){if(R.compressGeometry){var Y=3*z,Z=3*W,q=3*K;ki.decompressNormal(J.subarray(Y,Y+2),A),ki.decompressNormal(J.subarray(Z,Z+2),c),ki.decompressNormal(J.subarray(q,q+2),h)}else A[0]=J[N],A[1]=J[N+1],A[2]=J[N+2],c[0]=J[Q],c[1]=J[Q+1],c[2]=J[Q+2],h[0]=J[V],h[1]=J[V+1],h[2]=J[V+2];var ee=$.addVec3($.addVec3($.mulVec3Scalar(A,u[0],_),$.mulVec3Scalar(c,u[1],y),b),$.mulVec3Scalar(h,u[2],B),w);S.worldNormal=$.normalizeVec3($.transformVec3(k.worldNormalMatrix,ee,x))}var te=R.uv;if(te){if(d[0]=te[2*z],d[1]=te[2*z+1],p[0]=te[2*W],p[1]=te[2*W+1],f[0]=te[2*K],f[1]=te[2*K+1],R.compressGeometry){var ie=R.uvDecodeMatrix;ie&&(ki.decompressUV(d,ie,d),ki.decompressUV(p,ie,p),ki.decompressUV(f,ie,f))}S.uv=$.addVec3($.addVec3($.mulVec2Scalar(d,u[0],P),$.mulVec2Scalar(p,u[1],C),M),$.mulVec2Scalar(f,u[2],F),E)}}}}}();function on(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);var i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);var s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);var r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);var n=e.heightSegments||1;n<0&&(console.error("negative heightSegments not allowed - will invert"),n*=-1),n<1&&(n=1);var o,a,l,u,A,c,h,d,p,f,v,g=!!e.openEnded,m=e.center,_=m?m[0]:0,y=m?m[1]:0,b=m?m[2]:0,B=s/2,w=s/n,x=2*Math.PI/r,P=1/r,C=(t-i)/n,M=[],F=[],E=[],k=[],I=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(o=0;o<=n;o++)for(A=t-o*C,c=B-o*w,a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),F.push(A*l),F.push(I),F.push(A*u),E.push(a*P),E.push(1*o/n),M.push(A*l+_),M.push(c+y),M.push(A*u+b);for(o=0;o0){for(p=M.length/3,F.push(0),F.push(1),F.push(0),E.push(.5),E.push(.5),M.push(0+_),M.push(B+y),M.push(0+b),a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),f=.5*Math.sin(a*x)+.5,v=.5*Math.cos(a*x)+.5,F.push(t*l),F.push(1),F.push(t*u),E.push(f),E.push(v),M.push(t*l+_),M.push(B+y),M.push(t*u+b);for(a=0;a0){for(p=M.length/3,F.push(0),F.push(-1),F.push(0),E.push(.5),E.push(.5),M.push(0+_),M.push(0-B+y),M.push(0+b),a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),f=.5*Math.sin(a*x)+.5,v=.5*Math.cos(a*x)+.5,F.push(i*l),F.push(-1),F.push(i*u),E.push(f),E.push(v),M.push(i*l+_),M.push(0-B+y),M.push(i*u+b);for(a=0;a0&&void 0!==arguments[0]?arguments[0]:{},t=e.lod||1,i=e.center?e.center[0]:0,s=e.center?e.center[1]:0,r=e.center?e.center[2]:0,n=e.radius||1;n<0&&(console.error("negative radius not allowed - will invert"),n*=-1);var o=e.heightSegments||18;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),(o=Math.floor(t*o))<18&&(o=18);var a=e.widthSegments||18;a<0&&(console.error("negative widthSegments not allowed - will invert"),a*=-1),(a=Math.floor(t*a))<18&&(a=18);var l,u,A,c,h,d,p,f,v,g,m,_,y,b,B=[],w=[],x=[],P=[];for(l=0;l<=o;l++)for(A=l*Math.PI/o,c=Math.sin(A),h=Math.cos(A),u=0;u<=a;u++)d=2*u*Math.PI/a,p=Math.sin(d),f=Math.cos(d)*c,v=h,g=p*c,m=1-u/a,_=l/o,w.push(f),w.push(v),w.push(g),x.push(m),x.push(_),B.push(i+n*f),B.push(s+n*v),B.push(r+n*g);for(l=0;l":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function un(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],n=e.size||1,o=[],a=[],l=e.text;le.isNumeric(l)&&(l=""+l);for(var u,A,c,h,d,p,f,v,g,m=(l||"").split("\n"),_=0,y=0,b=.04,B=0;B1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({active:!0,pos:$.vec3(),dir:$.vec3(),dist:0}),s.active=r.active,s.pos=r.pos,s.dir=r.dir,s.scene._sectionPlaneCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"SectionPlane"}},{key:"active",get:function(){return this._state.active},set:function(e){this._state.active=!1!==e,this.glRedraw(),this.fire("active",this._state.active)}},{key:"pos",get:function(){return this._state.pos},set:function(e){this._state.pos.set(e||[0,0,0]),this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.fire("pos",this._state.pos),this.scene.fire("sectionPlaneUpdated",this)}},{key:"dir",get:function(){return this._state.dir},set:function(e){this._state.dir.set(e||[0,0,-1]),this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.glRedraw(),this.fire("dir",this._state.dir),this.scene.fire("sectionPlaneUpdated",this)}},{key:"dist",get:function(){return this._state.dist}},{key:"flipDir",value:function(){var e=this._state.dir;e[0]*=-1,e[1]*=-1,e[2]*=-1,this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.fire("dir",this._state.dir),this.glRedraw()}},{key:"destroy",value:function(){this._state.destroy(),this.scene._sectionPlaneDestroyed(this),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),hn=$.vec4(4),dn=$.vec4(),pn=$.vec4(),fn=$.vec3([1,0,0]),vn=$.vec3([0,1,0]),gn=$.vec3([0,0,1]),mn=$.vec3(3),_n=$.vec3(3),yn=$.identityMat4(),bn=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e,r))._parentNode=null,s._children=[],s._aabb=null,s._aabbDirty=!0,s.scene._aabbDirty=!0,s._numTriangles=0,s._scale=$.vec3(),s._quaternion=$.identityQuaternion(),s._rotation=$.vec3(),s._position=$.vec3(),s._offset=$.vec3(),s._localMatrix=$.identityMat4(),s._worldMatrix=$.identityMat4(),s._localMatrixDirty=!0,s._worldMatrixDirty=!0,r.matrix?s.matrix=r.matrix:(s.scale=r.scale,s.position=r.position,r.quaternion||(s.rotation=r.rotation)),s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s._isObject=r.isObject,s._isObject&&s.scene._registerObject(b(s)),s.origin=r.origin,s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.colorize=r.colorize,s.opacity=r.opacity,s.offset=r.offset,r.children)for(var n=r.children,o=0,a=n.length;o1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"LambertMaterial",ambient:$.vec3([1,1,1]),color:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),alpha:null,alphaMode:0,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:"/lam;"}),s.ambient=r.ambient,s.color=r.color,s.emissive=r.emissive,s.alpha=r.alpha,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s.backfaces=r.backfaces,s.frontface=r.frontface,s}return C(i,[{key:"type",get:function(){return"LambertMaterial"}},{key:"ambient",get:function(){return this._state.ambient},set:function(e){var t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){var t=this._state.color;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.color=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this._state.alphaMode=e<1?2:0,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),wn={opaque:0,mask:1,blend:2},xn=["opaque","mask","blend"],Pn=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"MetallicMaterial",baseColor:$.vec4([1,1,1]),emissive:$.vec4([0,0,0]),metallic:null,roughness:null,specularF0:null,alpha:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.baseColor=r.baseColor,s.metallic=r.metallic,s.roughness=r.roughness,s.specularF0=r.specularF0,s.emissive=r.emissive,s.alpha=r.alpha,r.baseColorMap&&(s._baseColorMap=s._checkComponent("Texture",r.baseColorMap)),r.metallicMap&&(s._metallicMap=s._checkComponent("Texture",r.metallicMap)),r.roughnessMap&&(s._roughnessMap=s._checkComponent("Texture",r.roughnessMap)),r.metallicRoughnessMap&&(s._metallicRoughnessMap=s._checkComponent("Texture",r.metallicRoughnessMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"MetallicMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/met"];this._baseColorMap&&(t.push("/bm"),this._baseColorMap._state.hasMatrix&&t.push("/mat"),t.push("/"+this._baseColorMap._state.encoding)),this._metallicMap&&(t.push("/mm"),this._metallicMap._state.hasMatrix&&t.push("/mat")),this._roughnessMap&&(t.push("/rm"),this._roughnessMap._state.hasMatrix&&t.push("/mat")),this._metallicRoughnessMap&&(t.push("/mrm"),this._metallicRoughnessMap._state.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap._state.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap._state.hasMatrix&&t.push("/mat")),this._alphaMap&&(t.push("/am"),this._alphaMap._state.hasMatrix&&t.push("/mat")),this._normalMap&&(t.push("/nm"),this._normalMap._state.hasMatrix&&t.push("/mat")),t.push(";"),e.hash=t.join("")}},{key:"baseColor",get:function(){return this._state.baseColor},set:function(e){var t=this._state.baseColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.baseColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"baseColorMap",get:function(){return this._baseColorMap}},{key:"metallic",get:function(){return this._state.metallic},set:function(e){e=null!=e?e:1,this._state.metallic!==e&&(this._state.metallic=e,this.glRedraw())}},{key:"metallicMap",get:function(){return this._attached.metallicMap}},{key:"roughness",get:function(){return this._state.roughness},set:function(e){e=null!=e?e:1,this._state.roughness!==e&&(this._state.roughness=e,this.glRedraw())}},{key:"roughnessMap",get:function(){return this._attached.roughnessMap}},{key:"metallicRoughnessMap",get:function(){return this._attached.metallicRoughnessMap}},{key:"specularF0",get:function(){return this._state.specularF0},set:function(e){e=null!=e?e:0,this._state.specularF0!==e&&(this._state.specularF0=e,this.glRedraw())}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"emissiveMap",get:function(){return this._attached.emissiveMap}},{key:"occlusionMap",get:function(){return this._attached.occlusionMap}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"alphaMap",get:function(){return this._attached.alphaMap}},{key:"normalMap",get:function(){return this._attached.normalMap}},{key:"alphaMode",get:function(){return xn[this._state.alphaMode]},set:function(e){var t=wn[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Cn={opaque:0,mask:1,blend:2},Mn=["opaque","mask","blend"],Fn=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"SpecularMaterial",diffuse:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),specular:$.vec3([1,1,1]),glossiness:null,specularF0:null,alpha:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.diffuse=r.diffuse,s.specular=r.specular,s.glossiness=r.glossiness,s.specularF0=r.specularF0,s.emissive=r.emissive,s.alpha=r.alpha,r.diffuseMap&&(s._diffuseMap=s._checkComponent("Texture",r.diffuseMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.specularMap&&(s._specularMap=s._checkComponent("Texture",r.specularMap)),r.glossinessMap&&(s._glossinessMap=s._checkComponent("Texture",r.glossinessMap)),r.specularGlossinessMap&&(s._specularGlossinessMap=s._checkComponent("Texture",r.specularGlossinessMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"SpecularMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/spe"];this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat")),this._glossinessMap&&(t.push("/gm"),this._glossinessMap.hasMatrix&&t.push("/mat")),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._specularGlossinessMap&&(t.push("/sgm"),this._specularGlossinessMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),t.push(";"),e.hash=t.join("")}},{key:"diffuse",get:function(){return this._state.diffuse},set:function(e){var t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"diffuseMap",get:function(){return this._diffuseMap}},{key:"specular",get:function(){return this._state.specular},set:function(e){var t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"specularMap",get:function(){return this._specularMap}},{key:"specularGlossinessMap",get:function(){return this._specularGlossinessMap}},{key:"glossiness",get:function(){return this._state.glossiness},set:function(e){e=null!=e?e:1,this._state.glossiness!==e&&(this._state.glossiness=e,this.glRedraw())}},{key:"glossinessMap",get:function(){return this._glossinessMap}},{key:"specularF0",get:function(){return this._state.specularF0},set:function(e){e=null!=e?e:0,this._state.specularF0!==e&&(this._state.specularF0=e,this.glRedraw())}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"emissiveMap",get:function(){return this._emissiveMap}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"alphaMap",get:function(){return this._alphaMap}},{key:"normalMap",get:function(){return this._normalMap}},{key:"occlusionMap",get:function(){return this._occlusionMap}},{key:"alphaMode",get:function(){return Mn[this._state.alphaMode]},set:function(e){var t=Cn[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}();function En(e,t){var i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=t;if(1009===r)return e.UNSIGNED_BYTE;if(1017===r)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===r)return e.UNSIGNED_SHORT_5_5_5_1;if(1010===r)return e.BYTE;if(1011===r)return e.SHORT;if(1012===r)return e.UNSIGNED_SHORT;if(1013===r)return e.INT;if(1014===r)return e.UNSIGNED_INT;if(1015===r)return e.FLOAT;if(1016===r)return e.HALF_FLOAT;if(1021===r)return e.ALPHA;if(1023===r)return e.RGBA;if(1024===r)return e.LUMINANCE;if(1025===r)return e.LUMINANCE_ALPHA;if(1026===r)return e.DEPTH_COMPONENT;if(1027===r)return e.DEPTH_STENCIL;if(1028===r)return e.RED;if(1022===r)return e.RGBA;if(1029===r)return e.RED_INTEGER;if(1030===r)return e.RG;if(1031===r)return e.RG_INTEGER;if(1033===r)return e.RGBA_INTEGER;if(33776===r||33777===r||33778===r||33779===r)if(3001===s){var n=Kt(e,"WEBGL_compressed_texture_s3tc_srgb");if(null===n)return null;if(33776===r)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=Kt(e,"WEBGL_compressed_texture_s3tc")))return null;if(33776===r)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===r)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===r)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===r)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===r||35841===r||35842===r||35843===r){var o=Kt(e,"WEBGL_compressed_texture_pvrtc");if(null===o)return null;if(35840===r)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===r)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===r)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===r)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===r){var a=Kt(e,"WEBGL_compressed_texture_etc1");return null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null}if(37492===r||37496===r){var l=Kt(e,"WEBGL_compressed_texture_etc");if(null===l)return null;if(37492===r)return 3001===s?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(37496===r)return 3001===s?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}if(37808===r||37809===r||37810===r||37811===r||37812===r||37813===r||37814===r||37815===r||37816===r||37817===r||37818===r||37819===r||37820===r||37821===r){var u=Kt(e,"WEBGL_compressed_texture_astc");if(null===u)return null;if(37808===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:u.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:u.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:u.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:u.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:u.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:u.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:u.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:u.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:u.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:u.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:u.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:u.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:u.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:u.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===r){var A=Kt(e,"EXT_texture_compression_bptc");if(null===A)return null;if(36492===r)return 3001===s?A.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:A.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===r?e.UNSIGNED_INT_24_8:1e3===r?e.REPEAT:1001===r?e.CLAMP_TO_EDGE:1004===r||1005===r?e.NEAREST_MIPMAP_LINEAR:1007===r?e.LINEAR_MIPMAP_NEAREST:1008===r?e.LINEAR_MIPMAP_LINEAR:1003===r?e.NEAREST:1006===r?e.LINEAR:null}var kn=new Uint8Array([0,0,0,1]),In=function(){function e(t){var i=t.gl,s=t.target,r=t.format,n=t.type,o=t.wrapS,a=t.wrapT,l=t.wrapR,u=t.encoding,A=t.preloadColor,c=t.premultiplyAlpha,h=t.flipY;x(this,e),this.gl=i,this.target=s||i.TEXTURE_2D,this.format=r||1023,this.type=n||1009,this.internalFormat=null,this.premultiplyAlpha=!!c,this.flipY=!!h,this.unpackAlignment=4,this.wrapS=o||1e3,this.wrapT=a||1e3,this.wrapR=l||1e3,this.encoding=u||3001,this.texture=i.createTexture(),A&&this.setPreloadColor(A),this.allocated=!0}return C(e,[{key:"setPreloadColor",value:function(e){e?(kn[0]=Math.floor(255*e[0]),kn[1]=Math.floor(255*e[1]),kn[2]=Math.floor(255*e[2]),kn[3]=Math.floor(255*(void 0!==e[3]?e[3]:1))):(kn[0]=0,kn[1]=0,kn[2]=0,kn[3]=255);var t=this.gl;if(t.bindTexture(this.target,this.texture),this.target===t.TEXTURE_CUBE_MAP)for(var i=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],s=0,r=i.length;s1&&void 0!==arguments[1]?arguments[1]:{},i=this.gl;void 0!==t.format&&(this.format=t.format),void 0!==t.internalFormat&&(this.internalFormat=t.internalFormat),void 0!==t.encoding&&(this.encoding=t.encoding),void 0!==t.type&&(this.type=t.type),void 0!==t.flipY&&(this.flipY=t.flipY),void 0!==t.premultiplyAlpha&&(this.premultiplyAlpha=t.premultiplyAlpha),void 0!==t.unpackAlignment&&(this.unpackAlignment=t.unpackAlignment),void 0!==t.minFilter&&(this.minFilter=t.minFilter),void 0!==t.magFilter&&(this.magFilter=t.magFilter),void 0!==t.wrapS&&(this.wrapS=t.wrapS),void 0!==t.wrapT&&(this.wrapT=t.wrapT),void 0!==t.wrapR&&(this.wrapR=t.wrapR);var s=!1;i.bindTexture(this.target,this.texture);var r=i.getParameter(i.UNPACK_FLIP_Y_WEBGL);i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY);var n=i.getParameter(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var o=i.getParameter(i.UNPACK_ALIGNMENT);i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment);var a=i.getParameter(i.UNPACK_COLORSPACE_CONVERSION_WEBGL);i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);var l=En(i,this.minFilter);i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,l),l!==i.NEAREST_MIPMAP_NEAREST&&l!==i.LINEAR_MIPMAP_NEAREST&&l!==i.NEAREST_MIPMAP_LINEAR&&l!==i.LINEAR_MIPMAP_LINEAR||(s=!0);var u=En(i,this.magFilter);u&&i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,u);var A=En(i,this.wrapS);A&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,A);var c=En(i,this.wrapT);c&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,c);var h=En(i,this.format,this.encoding),d=En(i,this.type),p=Dn(i,this.internalFormat,h,d,this.encoding,!1);if(this.target===i.TEXTURE_CUBE_MAP){if(le.isArray(e))for(var f=e,v=[i.TEXTURE_CUBE_MAP_POSITIVE_X,i.TEXTURE_CUBE_MAP_NEGATIVE_X,i.TEXTURE_CUBE_MAP_POSITIVE_Y,i.TEXTURE_CUBE_MAP_NEGATIVE_Y,i.TEXTURE_CUBE_MAP_POSITIVE_Z,i.TEXTURE_CUBE_MAP_NEGATIVE_Z],g=0,m=v.length;g1;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,this.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE);var a=En(r,this.wrapS);a&&r.texParameteri(this.target,r.TEXTURE_WRAP_S,a);var l=En(r,this.wrapT);if(l&&r.texParameteri(this.target,r.TEXTURE_WRAP_T,l),this.type===r.TEXTURE_3D||this.type===r.TEXTURE_2D_ARRAY){var u=En(r,this.wrapR);u&&r.texParameteri(this.target,r.TEXTURE_WRAP_R,u),r.texParameteri(this.type,r.TEXTURE_WRAP_R,u)}o?(r.texParameteri(this.target,r.TEXTURE_MIN_FILTER,Sn(r,this.minFilter)),r.texParameteri(this.target,r.TEXTURE_MAG_FILTER,Sn(r,this.magFilter))):(r.texParameteri(this.target,r.TEXTURE_MIN_FILTER,En(r,this.minFilter)),r.texParameteri(this.target,r.TEXTURE_MAG_FILTER,En(r,this.magFilter)));var A=En(r,this.format,this.encoding),c=En(r,this.type),h=Dn(r,this.internalFormat,A,c,this.encoding,!1);r.texStorage2D(r.TEXTURE_2D,n,h,t[0].width,t[0].height);for(var d=0,p=t.length;d5&&void 0!==arguments[5]&&arguments[5];if(null!==t){if(void 0!==e[t])return e[t];console.warn("Attempt to use non-existing WebGL internal format '"+t+"'")}var o=i;return i===e.RED&&(s===e.FLOAT&&(o=e.R32F),s===e.HALF_FLOAT&&(o=e.R16F),s===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RG&&(s===e.FLOAT&&(o=e.RG32F),s===e.HALF_FLOAT&&(o=e.RG16F),s===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RGBA&&(s===e.FLOAT&&(o=e.RGBA32F),s===e.HALF_FLOAT&&(o=e.RGBA16F),s===e.UNSIGNED_BYTE&&(o=3001===r&&!1===n?e.SRGB8_ALPHA8:e.RGBA8),s===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),s===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)),o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||Kt(e,"EXT_color_buffer_float"),o}function Sn(e,t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function Tn(e){if(!Rn(e.width)||!Rn(e.height)){var t=document.createElement("canvas");t.width=Ln(e.width),t.height=Ln(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function Rn(e){return 0==(e&e-1)}function Ln(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1}var Un=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({texture:new In({gl:s.scene.canvas.gl}),matrix:$.identityMat4(),hasMatrix:r.translate&&(0!==r.translate[0]||0!==r.translate[1])||!!r.rotate||r.scale&&(0!==r.scale[0]||0!==r.scale[1]),minFilter:s._checkMinFilter(r.minFilter),magFilter:s._checkMagFilter(r.magFilter),wrapS:s._checkWrapS(r.wrapS),wrapT:s._checkWrapT(r.wrapT),flipY:s._checkFlipY(r.flipY),encoding:s._checkEncoding(r.encoding)}),s._src=null,s._image=null,s._translate=$.vec2([0,0]),s._scale=$.vec2([1,1]),s._rotate=$.vec2([0,0]),s._matrixDirty=!1,s.translate=r.translate,s.scale=r.scale,s.rotate=r.rotate,r.src?s.src=r.src:r.image&&(s.image=r.image),se.memory.textures++,s}return C(i,[{key:"type",get:function(){return"Texture"}},{key:"_checkMinFilter",value:function(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}},{key:"_checkMagFilter",value:function(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}},{key:"_checkWrapS",value:function(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}},{key:"_checkWrapT",value:function(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}},{key:"_checkFlipY",value:function(e){return!!e}},{key:"_checkEncoding",value:function(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}},{key:"_webglContextRestored",value:function(){this._state.texture=new In({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}},{key:"_update",value:function(){var e,t,i=this._state;this._matrixDirty&&(0===this._translate[0]&&0===this._translate[1]||(e=$.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(t=$.scalingMat4v([this._scale[0],this._scale[1],1]),e=e?$.mulMat4(e,t):t),0!==this._rotate&&(t=$.rotationMat4v(.0174532925*this._rotate,[0,0,1]),e=e?$.mulMat4(e,t):t),e&&(i.matrix=e),this._matrixDirty=!1);this.glRedraw()}},{key:"image",get:function(){return this._image},set:function(e){this._image=Tn(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}},{key:"src",get:function(){return this._src},set:function(e){this.scene.loading++,this.scene.canvas.spinner.processes++;var t=this,i=new Image;i.onload=function(){i=Tn(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}},{key:"translate",get:function(){return this._translate},set:function(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}},{key:"scale",get:function(){return this._scale},set:function(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}},{key:"rotate",get:function(){return this._rotate},set:function(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}},{key:"minFilter",get:function(){return this._state.minFilter}},{key:"magFilter",get:function(){return this._state.magFilter}},{key:"wrapS",get:function(){return this._state.wrapS}},{key:"wrapT",get:function(){return this._state.wrapT}},{key:"flipY",get:function(){return this._state.flipY}},{key:"encoding",get:function(){return this._state.encoding}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),se.memory.textures--}}]),i}(),On=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({edgeColor:$.vec3([0,0,0]),centerColor:$.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),s.edgeColor=r.edgeColor,s.centerColor=r.centerColor,s.edgeBias=r.edgeBias,s.centerBias=r.centerBias,s.power=r.power,s}return C(i,[{key:"type",get:function(){return"Fresnel"}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}},{key:"centerColor",get:function(){return this._state.centerColor},set:function(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}},{key:"edgeBias",get:function(){return this._state.edgeBias},set:function(e){this._state.edgeBias=e||0,this.glRedraw()}},{key:"centerBias",get:function(){return this._state.centerBias},set:function(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}},{key:"power",get:function(){return this._state.power},set:function(e){this._state.power=null!=e?e:1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Nn=se.memory,Qn=$.AABB3(),Vn=function(e){g(i,Bi);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._state=new Zt({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),s._numTriangles=0,s._edgeThreshold=r.edgeThreshold||10,s._aabb=null,s._obb=$.OBB3();var n,o=s._state,a=s.scene.canvas.gl;switch(r.primitive=r.primitive||"triangles",r.primitive){case"points":o.primitive=a.POINTS,o.primitiveName=r.primitive;break;case"lines":o.primitive=a.LINES,o.primitiveName=r.primitive;break;case"line-loop":o.primitive=a.LINE_LOOP,o.primitiveName=r.primitive;break;case"line-strip":o.primitive=a.LINE_STRIP,o.primitiveName=r.primitive;break;case"triangles":o.primitive=a.TRIANGLES,o.primitiveName=r.primitive;break;case"triangle-strip":o.primitive=a.TRIANGLE_STRIP,o.primitiveName=r.primitive;break;case"triangle-fan":o.primitive=a.TRIANGLE_FAN,o.primitiveName=r.primitive;break;default:s.error("Unsupported value for 'primitive': '"+r.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),o.primitive=a.TRIANGLES,o.primitiveName=r.primitive}if(!r.positions)return s.error("Config expected: positions"),y(s);if(!r.indices)return s.error("Config expected: indices"),y(s);var l=r.positionsDecodeMatrix;if(l);else{var u=ki.getPositionsBounds(r.positions),A=ki.compressPositions(r.positions,u.min,u.max);n=A.quantized,o.positionsDecodeMatrix=A.decodeMatrix,o.positionsBuf=new It(a,a.ARRAY_BUFFER,n,n.length,3,a.STATIC_DRAW),Nn.positions+=o.positionsBuf.numItems,$.positions3ToAABB3(r.positions,s._aabb),$.positions3ToAABB3(n,Qn,o.positionsDecodeMatrix),$.AABB3ToOBB3(Qn,s._obb)}if(r.colors){var c=r.colors.constructor===Float32Array?r.colors:new Float32Array(r.colors);o.colorsBuf=new It(a,a.ARRAY_BUFFER,c,c.length,4,a.STATIC_DRAW),Nn.colors+=o.colorsBuf.numItems}if(r.uv){var h=ki.getUVBounds(r.uv),d=ki.compressUVs(r.uv,h.min,h.max),p=d.quantized;o.uvDecodeMatrix=d.decodeMatrix,o.uvBuf=new It(a,a.ARRAY_BUFFER,p,p.length,2,a.STATIC_DRAW),Nn.uvs+=o.uvBuf.numItems}if(r.normals){var f=ki.compressNormals(r.normals),v=o.compressGeometry;o.normalsBuf=new It(a,a.ARRAY_BUFFER,f,f.length,3,a.STATIC_DRAW,v),Nn.normals+=o.normalsBuf.numItems}var g=r.indices.constructor===Uint32Array||r.indices.constructor===Uint16Array?r.indices:new Uint32Array(r.indices);o.indicesBuf=new It(a,a.ELEMENT_ARRAY_BUFFER,g,g.length,1,a.STATIC_DRAW),Nn.indices+=o.indicesBuf.numItems;var m=wi(n,g,o.positionsDecodeMatrix,s._edgeThreshold);return s._edgeIndicesBuf=new It(a,a.ELEMENT_ARRAY_BUFFER,m,m.length,1,a.STATIC_DRAW),"triangles"===s._state.primitiveName&&(s._numTriangles=r.indices.length/3),s._buildHash(),Nn.meshes++,s}return C(i,[{key:"type",get:function(){return"VBOGeometry"}},{key:"isVBOGeometry",get:function(){return!0}},{key:"_buildHash",value:function(){var e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}},{key:"_getEdgeIndices",value:function(){return this._edgeIndicesBuf}},{key:"primitive",get:function(){return this._state.primitiveName}},{key:"aabb",get:function(){return this._aabb}},{key:"obb",get:function(){return this._obb}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this);var e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Nn.meshes--}}]),i}(),Hn={};function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,le.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var n=Hn.parse.from3DS(e).edit.objects[0].mesh,o=n.vertices,a=n.uvt,l=n.indices;r.processes--,i(le.apply(t,{primitive:"triangles",positions:o,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))}function Gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,le.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var n=Hn.parse.fromOBJ(e),o=Hn.edit.unwrap(n.i_verts,n.c_verts,3),a=Hn.edit.unwrap(n.i_norms,n.c_norms,3),l=Hn.edit.unwrap(n.i_uvt,n.c_uvt,2),u=new Int32Array(n.i_verts.length),A=0;A0?a:null,autoNormals:0===a.length,uv:l,indices:u}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))}function zn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);var s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);var r=e.center,n=r?r[0]:0,o=r?r[1]:0,a=r?r[2]:0,l=-t+n,u=-i+o,A=-s+a,c=t+n,h=i+o,d=s+a;return le.apply(e,{primitive:"lines",positions:[l,u,A,l,u,d,l,h,A,l,h,d,c,u,A,c,u,d,c,h,A,c,h,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function Wn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return zn({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})}function Kn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);var i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1);for(var s=(t=t||10)/(i=i||10),r=t/2,n=[],o=[],a=0,l=0,u=-r;l<=i;l++,u+=s)n.push(-r),n.push(0),n.push(u),n.push(r),n.push(0),n.push(u),n.push(u),n.push(0),n.push(-r),n.push(u),n.push(0),n.push(r),o.push(a++),o.push(a++),o.push(a++),o.push(a++);return le.apply(e,{primitive:"lines",positions:n,indices:o})}function Xn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);var s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);var r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);var n,o,a,l,u,A,c,h=e.center,d=h?h[0]:0,p=h?h[1]:0,f=h?h[2]:0,v=t/2,g=i/2,m=Math.floor(s)||1,_=Math.floor(r)||1,y=m+1,b=_+1,B=t/m,w=i/_,x=new Float32Array(y*b*3),P=new Float32Array(y*b*3),C=new Float32Array(y*b*2),M=0,F=0;for(n=0;n65535?Uint32Array:Uint16Array)(m*_*6);for(n=0;n<_;n++)for(o=0;o0&&void 0!==arguments[0]?arguments[0]:{},t=e.radius||1;t<0&&(console.error("negative radius not allowed - will invert"),t*=-1),t*=.5;var i=e.tube||.3;i<0&&(console.error("negative tube not allowed - will invert"),i*=-1);var s=e.radialSegments||32;s<0&&(console.error("negative radialSegments not allowed - will invert"),s*=-1),s<4&&(s=4);var r=e.tubeSegments||24;r<0&&(console.error("negative tubeSegments not allowed - will invert"),r*=-1),r<4&&(r=4);var n=e.arc||2*Math.PI;n<0&&(console.warn("negative arc not allowed - will invert"),n*=-1),n>360&&(n=360);var o,a,l,u,A,c,h,d,p,f,v,g,m=e.center,_=m?m[0]:0,y=m?m[1]:0,b=m?m[2]:0,B=[],w=[],x=[],P=[];for(d=0;d<=r;d++)for(h=0;h<=s;h++)o=h/s*n,a=.785398+d/r*Math.PI*2,_=t*Math.cos(o),y=t*Math.sin(o),l=(t+i*Math.cos(a))*Math.cos(o),u=(t+i*Math.cos(a))*Math.sin(o),A=i*Math.sin(a),B.push(l+_),B.push(u+y),B.push(A+b),x.push(1-h/s),x.push(d/r),c=$.normalizeVec3($.subVec3([l,u,A],[_,y,b],[]),[]),w.push(c[0]),w.push(c[1]),w.push(c[2]);for(d=1;d<=r;d++)for(h=1;h<=s;h++)p=(s+1)*d+h-1,f=(s+1)*(d-1)+h-1,v=(s+1)*(d-1)+h,g=(s+1)*d+h,P.push(p),P.push(f),P.push(v),P.push(v),P.push(g),P.push(p);return le.apply(e,{positions:B,normals:w,uv:x,indices:P})}function Yn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";var t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";for(var i=[],s=0;s0&&void 0!==arguments[0]?arguments[0]:{},t=e.curve.getPoints(e.divisions).map((function(e){return A(e)})).flat();return Yn({id:e.id,points:t})}Hn.load=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){t(e.target.response)},i.send()},Hn.save=function(e,t){var i="data:application/octet-stream;base64,"+btoa(Hn.parse._buffToStr(e));window.location.href=i},Hn.clone=function(e){return JSON.parse(JSON.stringify(e))},Hn.bin={},Hn.bin.f=new Float32Array(1),Hn.bin.fb=new Uint8Array(Hn.bin.f.buffer),Hn.bin.rf=function(e,t){for(var i=Hn.bin.f,s=Hn.bin.fb,r=0;r<4;r++)s[r]=e[t+r];return i[0]},Hn.bin.rsl=function(e,t){return e[t]|e[t+1]<<8},Hn.bin.ril=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},Hn.bin.rASCII0=function(e,t){for(var i="";0!=e[t];)i+=String.fromCharCode(e[t++]);return i},Hn.bin.wf=function(e,t,i){new Float32Array(e.buffer,t,1)[0]=i},Hn.bin.wsl=function(e,t,i){e[t]=i,e[t+1]=i>>8},Hn.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},Hn.parse={},Hn.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),un&&(n=u),Ao&&(o=A)}return{min:{x:t,y:i,z:s},max:{x:r,y:n,z:o}}};var qn=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._type=r.type||(r.src?r.src.split(".").pop():null)||"jpg",s._pos=$.vec3(r.pos||[0,0,0]),s._up=$.vec3(r.up||[0,1,0]),s._normal=$.vec3(r.normal||[0,0,1]),s._height=r.height||1,s._origin=$.vec3(),s._rtcPos=$.vec3(),s._imageSize=$.vec2(),s._texture=new Un(b(s),{flipY:!0}),s._image=new Image,"jpg"!==s._type&&"png"!==s._type&&(s.error('Unsupported type - defaulting to "jpg"'),s._type="jpg"),s._node=new bn(b(s),{matrix:$.inverseMat4($.lookAtMat4v(s._pos,$.subVec3(s._pos,s._normal,$.mat4()),s._up,$.mat4())),children:[s._bitmapMesh=new rn(b(s),{scale:[1,1,1],rotation:[-90,0,0],collidable:r.collidable,pickable:r.pickable,opacity:r.opacity,clippable:r.clippable,geometry:new Si(b(s),Xn({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:s._texture,emissiveMap:s._texture,backfaces:!0})})]}),r.image?s.image=r.image:r.src?s.src=r.src:r.imageData&&(s.imageData=r.imageData),s.scene._bitmapCreated(b(s)),s}return C(i,[{key:"visible",get:function(){return this._bitmapMesh.visible},set:function(e){this._bitmapMesh.visible=e}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}},{key:"src",get:function(){return this._image.src},set:function(e){var t=this;if(e)switch(this._image.onload=function(){t._texture.image=t._image,t._imageSize[0]=t._image.width,t._imageSize[1]=t._image.height,t._updateBitmapMeshScale()},this._image.src=e,e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}},{key:"imageData",get:function(){var e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")},set:function(e){var t=this;this._image.onload=function(){t._texture.image=image,t._imageSize[0]=image.width,t._imageSize[1]=image.height,t._updateBitmapMeshScale()},this._image.src=e}},{key:"type",get:function(){return this._type},set:function(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}},{key:"pos",get:function(){return this._pos}},{key:"normal",get:function(){return this._normal}},{key:"up",get:function(){return this._up}},{key:"height",get:function(){return this._height},set:function(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}},{key:"collidable",get:function(){return this._bitmapMesh.collidable},set:function(e){this._bitmapMesh.collidable=!1!==e}},{key:"clippable",get:function(){return this._bitmapMesh.clippable},set:function(e){this._bitmapMesh.clippable=!1!==e}},{key:"pickable",get:function(){return this._bitmapMesh.pickable},set:function(e){this._bitmapMesh.pickable=!1!==e}},{key:"opacity",get:function(){return this._bitmapMesh.opacity},set:function(e){this._bitmapMesh.opacity=e}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._bitmapDestroyed(this)}},{key:"_updateBitmapMeshScale",value:function(){var e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}]),i}(),$n=$.OBB3(),eo=$.OBB3(),to=$.OBB3(),io=function(){function e(t,i,s,r,n,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;x(this,e),this.model=t,this.object=null,this.parent=null,this.transform=n,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=i,this.obb=null,this._aabbLocal=null,this._aabbWorld=$.AABB3(),this._aabbWorldDirty=!1,this.layer=a,this.portionId=l,this._color=new Uint8Array([s[0],s[1],s[2],r]),this._colorize=new Uint8Array([s[0],s[1],s[2],r]),this._colorizing=!1,this._transparent=r<255,this.numTriangles=0,this.origin=null,this.entity=null,n&&n._addMesh(this)}return C(e,[{key:"_sceneModelDirty",value:function(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}},{key:"_transformDirty",value:function(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}},{key:"_updateMatrix",value:function(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}},{key:"_finalize",value:function(e){this.layer.initFlags(this.portionId,e,this._transparent)}},{key:"_finalize2",value:function(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}},{key:"_setVisible",value:function(e){this.layer.setVisible(this.portionId,e,this._transparent)}},{key:"_setColor",value:function(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}},{key:"_setColorize",value:function(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}},{key:"_setOpacity",value:function(e,t){var i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}},{key:"_setOffset",value:function(e){this.layer.setOffset(this.portionId,e)}},{key:"_setHighlighted",value:function(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}},{key:"_setXRayed",value:function(e){this.layer.setXRayed(this.portionId,e,this._transparent)}},{key:"_setSelected",value:function(e){this.layer.setSelected(this.portionId,e,this._transparent)}},{key:"_setEdges",value:function(e){this.layer.setEdges(this.portionId,e,this._transparent)}},{key:"_setClippable",value:function(e){this.layer.setClippable(this.portionId,e,this._transparent)}},{key:"_setCollidable",value:function(e){this.layer.setCollidable(this.portionId,e)}},{key:"_setPickable",value:function(e){this.layer.setPickable(this.portionId,e,this._transparent)}},{key:"_setCulled",value:function(e){this.layer.setCulled(this.portionId,e,this._transparent)}},{key:"canPickTriangle",value:function(){return!1}},{key:"drawPickTriangles",value:function(e,t){}},{key:"pickTriangleSurface",value:function(e){}},{key:"precisionRayPickSurface",value:function(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}},{key:"canPickWorldPos",value:function(){return!0}},{key:"drawPickDepths",value:function(e){this.model.drawPickDepths(e)}},{key:"drawPickNormals",value:function(e){this.model.drawPickNormals(e)}},{key:"delegatePickedEntity",value:function(){return this.parent}},{key:"getEachVertex",value:function(e){this.layer.getEachVertex(this.portionId,e)}},{key:"aabb",get:function(){if(this._aabbWorldDirty){if($.AABB3ToOBB3(this._aabbLocal,$n),this.transform?($.transformOBB3(this.transform.worldMatrix,$n,eo),$.transformOBB3(this.model.worldMatrix,eo,to),$.OBB3ToAABB3(to,this._aabbWorld)):($.transformOBB3(this.model.worldMatrix,$n,eo),$.OBB3ToAABB3(eo,this._aabbWorld)),this.origin){var e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld},set:function(e){this._aabbLocal=e}},{key:"_destroy",value:function(){this.model.scene._renderer.putPickID(this.pickId)}}]),e}(),so=new(function(){function e(){x(this,e),this._uint8Arrays={},this._float32Arrays={}}return C(e,[{key:"_clear",value:function(){this._uint8Arrays={},this._float32Arrays={}}},{key:"getUInt8Array",value:function(e){var t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}},{key:"getFloat32Array",value:function(e){var t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}}]),e}()),ro=0;function no(){return ro++,so}var oo={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},ao=new Float32Array([1,1,1,1]),lo=new Float32Array([0,0,0,1]),uo=$.vec4(),Ao=$.vec3(),co=$.vec3(),ho=$.mat4(),po=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=s.instancing,n=void 0!==r&&r,o=s.edges,a=void 0!==o&&o;x(this,e),this._scene=t,this._withSAO=i,this._instancing=n,this._edges=a,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}return C(e,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"_buildShader",value:function(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}},{key:"_buildVertexShader",value:function(){return[""]}},{key:"_buildFragmentShader",value:function(){return[""]}},{key:"_addMatricesUniformBlockLines",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}},{key:"_addRemapClipPosLines",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(".concat(t,"));")),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}},{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"setSectionPlanesStateUniforms",value:function(e){var t=this._scene,i=t.canvas.gl,s=e.model,r=e.layerIndex,n=t._sectionPlanesState.getNumAllocatedSectionPlanes(),o=t._sectionPlanesState.sectionPlanes.length;if(n>0){var a=t._sectionPlanesState.sectionPlanes,l=r*o,u=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(var A=0;A0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(var a=0,l=e._sectionPlanesState.getNumAllocatedSectionPlanes();a3&&void 0!==arguments[3]?arguments[3]:{},r=s.colorUniform,n=void 0!==r&&r,o=s.incrementDrawState,a=void 0!==o&&o,l=yt.MAX_TEXTURE_IMAGE_UNITS,u=this._scene,A=u.canvas.gl,c=t._state,h=t.model,d=c.textureSet,p=c.origin,f=c.positionsDecodeMatrix,v=u._lightsState,g=u.pointsMaterial,m=h.scene.camera,_=m.viewNormalMatrix,y=m.project,b=e.pickViewMatrix||m.viewMatrix,B=h.position,w=h.rotationMatrix,x=h.rotationMatrixConjugate,P=h.worldNormalMatrix;if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),this._vaoCache.has(t)?A.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(c));var C=0,M=16;this._matricesUniformBlockBufferData.set(x,0);var F=0!==p[0]||0!==p[1]||0!==p[2],E=0!==B[0]||0!==B[1]||0!==B[2];if(F||E){var k=Ao;if(F){var I=$.transformPoint3(w,p,co);k[0]=I[0],k[1]=I[1],k[2]=I[2]}else k[0]=0,k[1]=0,k[2]=0;k[0]+=B[0],k[1]+=B[1],k[2]+=B[2],this._matricesUniformBlockBufferData.set(Re(b,k,ho),C+=M)}else this._matricesUniformBlockBufferData.set(b,C+=M);if(this._matricesUniformBlockBufferData.set(e.pickProjMatrix||y.matrix,C+=M),this._matricesUniformBlockBufferData.set(f,C+=M),this._matricesUniformBlockBufferData.set(P,C+=M),this._matricesUniformBlockBufferData.set(_,C+=M),A.bindBuffer(A.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),A.bufferData(A.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,A.DYNAMIC_DRAW),A.bindBufferBase(A.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer),A.uniform1i(this._uRenderPass,i),this.setSectionPlanesStateUniforms(t),u.logarithmicDepthBufferEnabled){if(this._uLogDepthBufFC){var D=2/(Math.log(e.pickZFar+1)/Math.LN2);A.uniform1f(this._uLogDepthBufFC,D)}this._uZFar&&A.uniform1f(this._uZFar,u.camera.project.far)}if(this._uPickInvisible&&A.uniform1i(this._uPickInvisible,e.pickInvisible),this._uPickZNear&&A.uniform1f(this._uPickZNear,e.pickZNear),this._uPickZFar&&A.uniform1f(this._uPickZFar,e.pickZFar),this._uPickClipPos&&A.uniform2fv(this._uPickClipPos,e.pickClipPos),this._uDrawingBufferSize&&A.uniform2f(this._uDrawingBufferSize,A.drawingBufferWidth,A.drawingBufferHeight),this._uUVDecodeMatrix&&A.uniformMatrix3fv(this._uUVDecodeMatrix,!1,c.uvDecodeMatrix),this._uIntensityRange&&g.filterIntensity&&A.uniform2f(this._uIntensityRange,g.minIntensity,g.maxIntensity),this._uPointSize&&A.uniform1f(this._uPointSize,g.pointSize),this._uNearPlaneHeight){var S="ortho"===u.camera.projection?1:A.drawingBufferHeight/(2*Math.tan(.5*u.camera.perspective.fov*Math.PI/180));A.uniform1f(this._uNearPlaneHeight,S)}if(d){var T=d.colorTexture,R=d.metallicRoughnessTexture,L=d.emissiveTexture,U=d.normalsTexture,O=d.occlusionTexture;this._uColorMap&&T&&(this._program.bindTexture(this._uColorMap,T.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uMetallicRoughMap&&R&&(this._program.bindTexture(this._uMetallicRoughMap,R.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uEmissiveMap&&L&&(this._program.bindTexture(this._uEmissiveMap,L.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uNormalMap&&U&&(this._program.bindTexture(this._uNormalMap,U.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uAOMap&&O&&(this._program.bindTexture(this._uAOMap,O.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l)}if(v.reflectionMaps.length>0&&v.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,v.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++),v.lightMaps.length>0&&v.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,v.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++),this._withSAO){var N=u.sao,Q=N.possible;if(Q){var V=A.drawingBufferWidth,H=A.drawingBufferHeight;uo[0]=V,uo[1]=H,uo[2]=N.blendCutoff,uo[3]=N.blendFactor,A.uniform4fv(this._uSAOParams,uo),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++}}if(n){var j=this._edges?"edgeColor":"fillColor",G=this._edges?"edgeAlpha":"fillAlpha";if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_XRAYED")]){var z=u.xrayMaterial._state,W=z[j],K=z[G];A.uniform4f(this._uColor,W[0],W[1],W[2],K)}else if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_HIGHLIGHTED")]){var X=u.highlightMaterial._state,J=X[j],Y=X[G];A.uniform4f(this._uColor,J[0],J[1],J[2],Y)}else if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_SELECTED")]){var Z=u.selectedMaterial._state,q=Z[j],ee=Z[G];A.uniform4f(this._uColor,q[0],q[1],q[2],ee)}else A.uniform4fv(this._uColor,this._edges?lo:ao)}this._draw({state:c,frameCtx:e,incrementDrawState:a}),A.bindVertexArray(null)}}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null,se.memory.programs--}}]),e}(),fo=function(e){g(i,po);var t=_(i);function i(e,s){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.edges,o=void 0!==n&&n;return x(this,i),t.call(this,e,s,{instancing:!1,edges:o})}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{var n=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,n,i.indicesBuf.itemType,o),r&&s.drawElements++}}}]),i}(),vo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e,t=this._scene,i=t._sectionPlanesState,s=t._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=[];n.push("#version 300 es"),n.push("// Triangles batching draw vertex shader"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in float flags;"),t.entityOffsetsEnabled&&n.push("in vec3 offset;"),this._addMatricesUniformBlockLines(n,!0),t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("uniform vec4 lightAmbient;");for(var o=0,a=s.lights.length;o= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),r&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;")),n.push("out vec4 vColor;"),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),t.entityOffsetsEnabled&&n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),n.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;");for(var l=0,u=s.lights.length;l0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}]),i}(),go=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(var n=0,o=i.getNumAllocatedSectionPlanes();n> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(var A=0,c=i.getNumAllocatedSectionPlanes();A sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var h=0,d=t.lights.length;h0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Triangles batching silhouette fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r){for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(var o=0,a=s.getNumAllocatedSectionPlanes();o sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("outColor = newColor;"),n.push("}"),n}}]),i}(),_o=function(e){g(i,fo);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!1,edges:!0})}return C(i)}(),yo=function(e){g(i,_o);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),bo=function(e){g(i,_o);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!1})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),Bo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}]),i}(),wo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),xo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outNormal = ivec4(vWorldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Po=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}]),i}(),Co=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}]),i}(),Mo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Fo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}]),i}(),Eo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,n=[];return n.push("#version 300 es"),n.push("// Triangles batching quality draw vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("precision highp usampler2D;"),n.push("precision highp isampler2D;"),n.push("precision highp sampler2D;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("precision mediump usampler2D;"),n.push("precision mediump isampler2D;"),n.push("precision mediump sampler2D;"),n.push("#endif"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in vec2 uv;"),n.push("in vec2 metallicRoughness;"),n.push("in float flags;"),e.entityOffsetsEnabled&&n.push("in vec3 offset;"),this._addMatricesUniformBlockLines(n,!0),n.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("vec3 octDecode(vec2 oct) {"),n.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),n.push(" if (v.z < 0.0) {"),n.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),n.push("out vec4 vViewPosition;"),n.push("out vec3 vViewNormal;"),n.push("out vec4 vColor;"),n.push("out vec2 vUV;"),n.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&n.push("out vec3 vWorldNormal;"),s&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;"),r&&n.push("out vec4 vClipPosition;")),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),n.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),n.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),n.push("vFragDepth = 1.0 + clipPos.w;")),s&&(n.push("vWorldPosition = worldPosition;"),n.push("vFlags = flags;"),r&&n.push("vClipPosition = clipPos;")),n.push("vViewPosition = viewPosition;"),n.push("vViewNormal = viewNormal;"),n.push("vColor = color;"),n.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),n.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&n.push("vWorldNormal = worldNormal.xyz;"),n.push("gl_Position = clipPos;"),n.push("}"),n.push("}"),n}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=i.clippingCaps,o=[];o.push("#version 300 es"),o.push("// Triangles batching quality draw fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),o.push("uniform sampler2D uMetallicRoughMap;"),o.push("uniform sampler2D uEmissiveMap;"),o.push("uniform sampler2D uNormalMap;"),o.push("uniform sampler2D uAOMap;"),o.push("in vec4 vViewPosition;"),o.push("in vec3 vViewNormal;"),o.push("in vec4 vColor;"),o.push("in vec2 vUV;"),o.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&o.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(o,!0),s.reflectionMaps.length>0&&o.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&o.push("uniform samplerCube lightMap;"),o.push("uniform vec4 lightAmbient;");for(var a=0,l=s.lights.length;a0&&(o.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),o.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),o.push(" return envMapColor;"),o.push("}")),o.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),o.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),o.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),o.push("}"),o.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" return 1.0 / ( gl * gv );"),o.push("}"),o.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" return 0.5 / max( gv + gl, EPSILON );"),o.push("}"),o.push("float D_GGX(const in float alpha, const in float dotNH) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),o.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float alpha = ( roughness * roughness );"),o.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),o.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),o.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),o.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),o.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),o.push(" vec3 F = F_Schlick( specularColor, dotLH );"),o.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),o.push(" float D = D_GGX( alpha, dotNH );"),o.push(" return F * (G * D);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),o.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),o.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),o.push(" vec4 r = roughness * c0 + c1;"),o.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),o.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),o.push(" return specularColor * AB.x + AB.y;"),o.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(o.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(o.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),o.push(" irradiance *= PI;"),o.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(o.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),o.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),o.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),o.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),o.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),o.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),o.push("}")),o.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),o.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),o.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),o.push("}"),o.push("out vec4 outColor;"),o.push("void main(void) {"),r){o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var h=0,d=i.getNumAllocatedSectionPlanes();h (0.002 * vClipPosition.w)) {"),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push(" return;"),o.push("}")):(o.push(" if (dist > 0.0) { "),o.push(" discard;"),o.push(" }")),o.push("}")}o.push("IncidentLight light;"),o.push("Material material;"),o.push("Geometry geometry;"),o.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),o.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),o.push("float opacity = float(vColor.a) / 255.0;"),o.push("vec3 baseColor = rgb;"),o.push("float specularF0 = 1.0;"),o.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),o.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),o.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),o.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),o.push("baseColor *= colorTexel.rgb;"),o.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),o.push("metallic *= metalRoughTexel.b;"),o.push("roughness *= metalRoughTexel.g;"),o.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),o.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),o.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),o.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),o.push("geometry.position = vViewPosition.xyz;"),o.push("geometry.viewNormal = -normalize(viewNormal);"),o.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&o.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&o.push("computePBRLightMapping(geometry, material, reflectedLight);");for(var p=0,f=s.lights.length;p0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Io=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Triangles batching color texture fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),n.push("uniform float gammaFactor;"),n.push("vec4 linearToLinear( in vec4 value ) {"),n.push(" return value;"),n.push("}"),n.push("vec4 sRGBToLinear( in vec4 value ) {"),n.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),n.push("}"),n.push("vec4 gammaToLinear( in vec4 value) {"),n.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),n.push("}"),t&&(n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}")),r){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(var o=0,a=s.getNumAllocatedSectionPlanes();o> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(var c=0,h=s.getNumAllocatedSectionPlanes();c sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var d=0,p=i.lights.length;d0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Oo=$.vec3(),No=$.vec3(),Qo=$.vec3(),Vo=$.vec3(),Ho=$.mat4(),jo=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Oo;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=No;if(l){var m=Qo;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,Ho),(f=Vo)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),o.drawElements(o.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Go=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new mo(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Bo(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new wo(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Uo(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new jo(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new vo(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new vo(this._scene,!0)),this._colorRendererWithSAO}},{key:"flatColorRenderer",get:function(){return this._flatColorRenderer||(this._flatColorRenderer=new go(this._scene,!1)),this._flatColorRenderer}},{key:"flatColorRendererWithSAO",get:function(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new go(this._scene,!0)),this._flatColorRendererWithSAO}},{key:"colorTextureRenderer",get:function(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Io(this._scene,!1)),this._colorTextureRenderer}},{key:"colorTextureRendererWithSAO",get:function(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Io(this._scene,!0)),this._colorTextureRendererWithSAO}},{key:"pbrRenderer",get:function(){return this._pbrRenderer||(this._pbrRenderer=new Eo(this._scene,!1)),this._pbrRenderer}},{key:"pbrRendererWithSAO",get:function(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Eo(this._scene,!0)),this._pbrRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new mo(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new Co(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new Mo(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new yo(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new bo(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Bo(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new xo(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ko(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new wo(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new Po(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new Fo(this._scene)),this._shadowRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new jo(this._scene)),this._snapRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Uo(this._scene)),this._snapInitRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),zo={};var Wo=65536,Ko=5e6,Xo=function(){function e(){x(this,e)}return C(e,[{key:"doublePrecisionEnabled",get:function(){return $.getDoublePrecisionEnabled()},set:function(e){$.setDoublePrecisionEnabled(e)}},{key:"maxDataTextureHeight",get:function(){return Wo},set:function(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),Wo=e}},{key:"maxGeometryBatchSize",get:function(){return Ko},set:function(e){e<1e5?e=1e5:e>5e6&&(e=5e6),Ko=e}}]),e}(),Jo=new Xo,Yo=C((function e(){x(this,e),this.maxVerts=Jo.maxGeometryBatchSize,this.maxIndices=3*Jo.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]})),Zo=$.mat4(),qo=$.mat4();function $o(e,t,i){for(var s=e.length,r=new Uint16Array(s),n=t[0],o=t[1],a=t[2],l=t[3]-n,u=t[4]-o,A=t[5]-a,c=65525,h=c/l,d=c/u,p=c/A,f=function(e){return e>=0?e:0},v=0;v=0?1:-1),o=(1-Math.abs(s))*(r>=0?1:-1),s=n,r=o}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function ia(e){var t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;var s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));var r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}var sa=$.mat4(),ra=$.mat4(),na=$.vec4([0,0,0,1]),oa=$.vec3(),aa=$.vec3(),la=$.vec3(),ua=$.vec3(),Aa=$.vec3(),ca=$.vec3(),ha=$.vec3(),da=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOBatchingTrianglesLayer"),this.model=t.model,this.sortId="TrianglesBatchingLayer"+(t.solid?"-solid":"-surface")+(t.autoNormals?"-autonormals":"-normals")+(t.textureSet&&t.textureSet.colorTexture?"-colorTexture":"")+(t.textureSet&&t.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=zo[s])||(r=new Go(i),zo[s]=r,r._compile(),r.eagerCreateRenders(),i.on("compile",(function(){r._compile(),r.eagerCreateRenders()})),i.on("destroyed",(function(){delete zo[s],r._destroy()}))),r),this._buffer=new Yo(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({origin:$.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:t.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=$.mat4(t.positionsDecodeMatrix)),t.uvDecodeMatrix?(this._state.uvDecodeMatrix=$.mat3(t.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,t.origin&&this._state.origin.set(t.origin),this.solid=!!t.solid}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)for(var C=0,M=o.length;C0){var F=sa;g?$.inverseMat4($.transposeMat4(g,ra),F):$.identityMat4(F,F),function(e,t,i,s,r){function n(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}var o,a,l,u,A,c=new Float32Array([0,0,0,0]),h=new Float32Array([0,0,0,0]);for(A=0;Au&&(a=o,u=l),(l=n(h,ia(o=ta(h,"floor","ceil"))))>u&&(a=o,u=l),(l=n(h,ia(o=ta(h,"ceil","ceil"))))>u&&(a=o,u=l),s[r+A+0]=a[0],s[r+A+1]=a[1],s[r+A+2]=0}(F,n,n.length,y.normals,y.normals.length)}if(u)for(var E=0,k=u.length;E0)for(var V=0,H=a.length;V0)for(var j=0,G=l.length;j0){var s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):$o(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=$.mat4());if(e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(var r=0,n=this._portions.length;r0){var u=new Int8Array(i.normals);e.normalsBuf=new It(t,t.ARRAY_BUFFER,u,i.normals.length,3,t.STATIC_DRAW,!0)}if(i.colors.length>0){var A=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,A,i.colors.length,4,t.DYNAMIC_DRAW,!1)}if(i.uv.length>0)if(e.uvDecodeMatrix){e.uvBuf=new It(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,!1)}else{var c=ki.getUVBounds(i.uv),h=ki.compressUVs(i.uv,c.min,c.max),d=h.quantized;e.uvDecodeMatrix=$.mat3(h.decodeMatrix),e.uvBuf=new It(t,t.ARRAY_BUFFER,d,d.length,2,t.STATIC_DRAW,!1)}if(i.metallicRoughness.length>0){var p=new Uint8Array(i.metallicRoughness);e.metallicRoughnessBuf=new It(t,t.ARRAY_BUFFER,p,i.metallicRoughness.length,2,t.STATIC_DRAW,!1)}if(i.positions.length>0){var f=i.positions.length/3,v=new Float32Array(f);e.flagsBuf=new It(t,t.ARRAY_BUFFER,v,v.length,1,t.DYNAMIC_DRAW,!1)}if(i.pickColors.length>0){var g=new Uint8Array(i.pickColors);e.pickColorsBuf=new It(t,t.ARRAY_BUFFER,g,i.pickColors.length,4,t.STATIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var m=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,m,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){var _=new Uint32Array(i.indices);e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,_,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){var y=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,y,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}}},{key:"isEmpty",value:function(){return!this._state.indicesBuf}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=e,s=this._portions[i],r=4*s.vertsBaseIndex,n=4*s.numVerts,o=this._scratchMemory.getUInt8Array(n),a=t[0],l=t[1],u=t[2],A=t[3],c=0;c3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=e,a=this._portions[o],l=a.vertsBaseIndex,u=a.numVerts,A=l,c=u,h=!!(t&Qe),d=!!(t&ze),p=!!(t&We),f=!!(t&Ke),v=!!(t&Xe),g=!!(t&He),m=!!(t&Ve);r=!h||m||d||p&&!this.model.scene.highlightMaterial.glowThrough||f&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!h||m?oo.NOT_RENDERED:f?oo.SILHOUETTE_SELECTED:p?oo.SILHOUETTE_HIGHLIGHTED:d?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var _=0;_=!h||m?oo.NOT_RENDERED:f?oo.EDGES_SELECTED:p?oo.EDGES_HIGHLIGHTED:d?oo.EDGES_XRAYED:v?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED;var y=h&&!m&&g?oo.PICK:oo.NOT_RENDERED,b=t&je?1:0;if(s){this._deferredFlagValues||(this._deferredFlagValues=new Float32Array(this._numVerts));for(var B=A,w=A+c;Bg)&&(g=x,s.set(m),r&&$.triangleNormal(d,p,f,r),v=!0)}}return v&&r&&($.transformVec3(this.model.worldNormalMatrix,r,r),$.normalizeVec3(r)),v}},{key:"destroy",value:function(){var e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}]),e}(),pa=function(e){g(i,po);var t=_(i);function i(e,s){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.edges,o=void 0!==n&&n;return x(this,i),t.call(this,e,s,{instancing:!0,edges:o})}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}]),i}(),fa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e,t,i,s=this._scene,r=s._sectionPlanesState,n=s._lightsState,o=r.getNumAllocatedSectionPlanes()>0,a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),s.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),s.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),e=0,t=n.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),o&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),s.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),e=0,t=n.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}]),i}(),va=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=i._lightsState,n=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry flat-shading drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),i.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),n){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(var a=0,l=s.getNumAllocatedSectionPlanes();a> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var A=0,c=s.getNumAllocatedSectionPlanes();A sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}for(o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),e=0,t=r.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}]),i}(),ma=function(e){g(i,pa);var t=_(i);function i(e,s){return x(this,i),t.call(this,e,s,{instancing:!0,edges:!0})}return C(i)}(),_a=function(e){g(i,ma);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),ya=function(e){g(i,ma);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!1})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),ba=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}]),i}(),Ba=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),wa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outNormal = ivec4(vWorldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),xa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}]),i}(),Pa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry depth drawing fragment shader"),n.push("precision highp float;"),n.push("precision highp int;"),i.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),n.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),n.push("}"),n}}]),i}(),Ca=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Ma=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Fa={3e3:"linearToLinear",3001:"sRGBToLinear"},Ea=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,n=[];return n.push("#version 300 es"),n.push("// Instancing geometry quality drawing vertex shader"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in vec2 uv;"),n.push("in vec2 metallicRoughness;"),n.push("in float flags;"),e.entityOffsetsEnabled&&n.push("in vec3 offset;"),n.push("in vec4 modelMatrixCol0;"),n.push("in vec4 modelMatrixCol1;"),n.push("in vec4 modelMatrixCol2;"),n.push("in vec4 modelNormalMatrixCol0;"),n.push("in vec4 modelNormalMatrixCol1;"),n.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(n,!0),n.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("vec3 octDecode(vec2 oct) {"),n.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),n.push(" if (v.z < 0.0) {"),n.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),n.push("out vec4 vViewPosition;"),n.push("out vec3 vViewNormal;"),n.push("out vec4 vColor;"),n.push("out vec2 vUV;"),n.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&n.push("out vec3 vWorldNormal;"),s&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;"),r&&n.push("out vec4 vClipPosition;")),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),n.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),n.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),n.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(n.push("vWorldPosition = worldPosition;"),n.push("vFlags = flags;"),r&&n.push("vClipPosition = clipPos;")),n.push("vViewPosition = viewPosition;"),n.push("vViewNormal = viewNormal;"),n.push("vColor = color;"),n.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),n.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&n.push("vWorldNormal = worldNormal.xyz;"),n.push("gl_Position = clipPos;"),n.push("}"),n.push("}"),n}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=i.clippingCaps,o=[];o.push("#version 300 es"),o.push("// Instancing geometry quality drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),o.push("uniform sampler2D uMetallicRoughMap;"),o.push("uniform sampler2D uEmissiveMap;"),o.push("uniform sampler2D uNormalMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),s.reflectionMaps.length>0&&o.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&o.push("uniform samplerCube lightMap;"),o.push("uniform vec4 lightAmbient;");for(var a=0,l=s.lights.length;a0&&o.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(o,!0),o.push("#define PI 3.14159265359"),o.push("#define RECIPROCAL_PI 0.31830988618"),o.push("#define RECIPROCAL_PI2 0.15915494"),o.push("#define EPSILON 1e-6"),o.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),o.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),o.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),o.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),o.push(" return normalize(surf_norm );"),o.push(" }"),o.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),o.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),o.push(" vec2 st0 = dFdx( uv.st );"),o.push(" vec2 st1 = dFdy( uv.st );"),o.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),o.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),o.push(" vec3 N = normalize( surf_norm );"),o.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),o.push(" mat3 tsn = mat3( S, T, N );"),o.push(" return normalize( tsn * mapN );"),o.push("}"),o.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),o.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),o.push("}"),o.push("struct IncidentLight {"),o.push(" vec3 color;"),o.push(" vec3 direction;"),o.push("};"),o.push("struct ReflectedLight {"),o.push(" vec3 diffuse;"),o.push(" vec3 specular;"),o.push("};"),o.push("struct Geometry {"),o.push(" vec3 position;"),o.push(" vec3 viewNormal;"),o.push(" vec3 worldNormal;"),o.push(" vec3 viewEyeDir;"),o.push("};"),o.push("struct Material {"),o.push(" vec3 diffuseColor;"),o.push(" float specularRoughness;"),o.push(" vec3 specularColor;"),o.push(" float shine;"),o.push("};"),o.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),o.push(" float r = ggxRoughness + 0.0001;"),o.push(" return (2.0 / (r * r) - 2.0);"),o.push("}"),o.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),o.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),o.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),o.push("}"),s.reflectionMaps.length>0&&(o.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),o.push(" vec3 envMapColor = "+Fa[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),o.push(" return envMapColor;"),o.push("}")),o.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),o.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),o.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),o.push("}"),o.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" return 1.0 / ( gl * gv );"),o.push("}"),o.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" return 0.5 / max( gv + gl, EPSILON );"),o.push("}"),o.push("float D_GGX(const in float alpha, const in float dotNH) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),o.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float alpha = ( roughness * roughness );"),o.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),o.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),o.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),o.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),o.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),o.push(" vec3 F = F_Schlick( specularColor, dotLH );"),o.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),o.push(" float D = D_GGX( alpha, dotNH );"),o.push(" return F * (G * D);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),o.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),o.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),o.push(" vec4 r = roughness * c0 + c1;"),o.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),o.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),o.push(" return specularColor * AB.x + AB.y;"),o.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(o.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(o.push(" vec3 irradiance = "+Fa[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),o.push(" irradiance *= PI;"),o.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(o.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),o.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),o.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),o.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),o.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),o.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),o.push("}")),o.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),o.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),o.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),o.push("}"),o.push("out vec4 outColor;"),o.push("void main(void) {"),r){o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var h=0,d=i.getNumAllocatedSectionPlanes();h (0.002 * vClipPosition.w)) {"),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push(" return;"),o.push("}")):(o.push(" if (dist > 0.0) { "),o.push(" discard;"),o.push(" }")),o.push("}")}o.push("IncidentLight light;"),o.push("Material material;"),o.push("Geometry geometry;"),o.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),o.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),o.push("float opacity = float(vColor.a) / 255.0;"),o.push("vec3 baseColor = rgb;"),o.push("float specularF0 = 1.0;"),o.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),o.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),o.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),o.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),o.push("baseColor *= colorTexel.rgb;"),o.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),o.push("metallic *= metalRoughTexel.b;"),o.push("roughness *= metalRoughTexel.g;"),o.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),o.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),o.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),o.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),o.push("geometry.position = vViewPosition.xyz;"),o.push("geometry.viewNormal = -normalize(viewNormal);"),o.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&o.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&o.push("computePBRLightMapping(geometry, material, reflectedLight);");for(var p=0,f=s.lights.length;p0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Ia=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i.gammaOutput,r=i._sectionPlanesState,n=i._lightsState,o=r.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),i.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),s&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),o){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(var l=0,u=r.getNumAllocatedSectionPlanes();l> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(var c=0,h=r.getNumAllocatedSectionPlanes();c sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),e=0,t=n.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Oa=$.vec3(),Na=$.vec3(),Qa=$.vec3(),Va=$.vec3(),Ha=$.mat4(),ja=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Oa;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=Na;if(l){var m=$.transformPoint3(A,l,Qa);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,Ha),(f=Va)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Ga=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new ga(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new ba(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new Ba(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Ua(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new ja(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new fa(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new fa(this._scene,!0)),this._colorRendererWithSAO}},{key:"flatColorRenderer",get:function(){return this._flatColorRenderer||(this._flatColorRenderer=new va(this._scene,!1)),this._flatColorRenderer}},{key:"flatColorRendererWithSAO",get:function(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new va(this._scene,!0)),this._flatColorRendererWithSAO}},{key:"pbrRenderer",get:function(){return this._pbrRenderer||(this._pbrRenderer=new Ea(this._scene,!1)),this._pbrRenderer}},{key:"pbrRendererWithSAO",get:function(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ea(this._scene,!0)),this._pbrRendererWithSAO}},{key:"colorTextureRenderer",get:function(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Ia(this._scene,!1)),this._colorTextureRenderer}},{key:"colorTextureRendererWithSAO",get:function(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Ia(this._scene,!0)),this._colorTextureRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ga(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new Pa(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new Ca(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new _a(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new ya(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new ba(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new wa(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ka(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Ba(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new xa(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new Ma(this._scene)),this._shadowRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Ua(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new ja(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),za={};var Wa=new Uint8Array(4),Ka=new Float32Array(1),Xa=$.vec4([0,0,0,1]),Ja=new Float32Array(3),Ya=$.vec3(),Za=$.vec3(),qa=$.vec3(),$a=$.vec3(),el=$.vec3(),tl=$.vec3(),il=$.vec3(),sl=new Float32Array(4),rl=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOInstancingTrianglesLayer"),this.model=t.model,this.sortId="TrianglesInstancingLayer"+(t.solid?"-solid":"-surface")+(t.normals?"-normals":"-autoNormals"),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=za[s])||(r=new Ga(i),za[s]=r,r._compile(),r.eagerCreateRenders(),i.on("compile",(function(){r._compile(),r.eagerCreateRenders()})),i.on("destroyed",(function(){delete za[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({numInstances:0,obb:$.OBB3(),origin:$.vec3(),geometry:t.geometry,textureSet:t.textureSet,pbrSupported:!1,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,t.origin&&this._state.origin.set(t.origin),this._finalized=!1,this.solid=!!t.solid,this.numIndices=t.geometry.numIndices}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){e.colorsBuf=new It(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,!1),this._colors=[]}if(this._metallicRoughness.length>0){var o=new Uint8Array(this._metallicRoughness);e.metallicRoughnessBuf=new It(s,s.ARRAY_BUFFER,o,this._metallicRoughness.length,2,s.STATIC_DRAW,!1)}if(n>0){e.flagsBuf=new It(s,s.ARRAY_BUFFER,new Float32Array(n),n,1,s.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){e.offsetsBuf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,!1),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){e.positionsBuf=new It(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,!1),e.positionsDecodeMatrix=$.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){var a=new Uint8Array(t.colorsCompressed);e.colorsBuf=new It(s,s.ARRAY_BUFFER,a,a.length,4,s.STATIC_DRAW,!1)}if(t.uvCompressed&&t.uvCompressed.length>0){var l=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new It(s,s.ARRAY_BUFFER,l,l.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new It(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new It(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){var u=!1;e.modelMatrixCol0Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,u),e.modelMatrixCol1Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,u),e.modelMatrixCol2Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,u),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,u),e.modelNormalMatrixCol1Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,u),e.modelNormalMatrixCol2Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,u),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){e.pickColorsBuf=new It(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,!1),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Wa[0]=t[0],Wa[1]=t[1],Wa[2]=t[2],Wa[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(Wa,4*e)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?1:0)<<16,Ka[0]=A,this._state.flagsBuf&&this._state.flagsBuf.setData(Ka,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Ja[0]=t[0],Ja[1]=t[1],Ja[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(Ja,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"getEachVertex",value:function(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;var i=this._state,s=i.geometry,r=this._portions[e];if(r)for(var n=s.quantizedPositions,o=i.origin,a=r.offset,l=o[0]+a[0],u=o[1]+a[1],A=o[2]+a[2],c=Xa,h=r.matrix,d=this.model.sceneModelMatrix,p=i.positionsDecodeMatrix,f=0,v=n.length;fm)&&(m=C,s.set(_),r&&$.triangleNormal(p,f,v,r),g=!0)}}return g&&r&&($.transformVec3(a.normalMatrix,r,r),$.transformVec3(this.model.worldNormalMatrix,r,r),$.normalizeVec3(r)),g}},{key:"destroy",value:function(){var e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}]),e}(),nl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}]),i}(),ol=function(e){g(i,nl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),al=function(e){g(i,nl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}]),i}(),ll=$.vec3(),ul=$.vec3(),Al=$.vec3(),cl=$.vec3(),hl=$.mat4(),dl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=ll;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=ul;if(l){var m=Al;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,hl),(f=cl)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),o.drawElements(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),pl=$.vec3(),fl=$.vec3(),vl=$.vec3(),gl=$.vec3(),ml=$.mat4(),_l=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=pl;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=fl;if(l){var m=vl;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,ml),(f=gl)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),o.drawElements(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),yl=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new ol(this._scene,!1)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new al(this._scene)),this._silhouetteRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new dl(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new _l(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),bl={};var Bl=C((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e6;x(this,e),t>5e6&&(t=5e6),this.maxVerts=t,this.maxIndices=3*t,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]})),wl=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=bl[s])||(r=new yl(i),bl[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete bl[s],r._destroy()}))),r),this.model=t.model,this._buffer=new Bl(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:$.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(t.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,t.origin&&(this._state.origin=$.vec3(t.origin))}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){var s=new Uint16Array(i.positions);e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{var r=$o(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new It(t,t.ARRAY_BUFFER,r,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){var n=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,n,i.colors.length,4,t.DYNAMIC_DRAW,!1)}if(i.colors.length>0){var o=i.colors.length/4,a=new Float32Array(o);e.flagsBuf=new It(t,t.ARRAY_BUFFER,a,a.length,1,t.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var l=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,l,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){var u=new Uint32Array(i.indices);e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,u,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],n=this._scratchMemory.getUInt8Array(r),o=t[0],a=t[1],l=t[2],u=t[3],A=0;A3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=2*e,a=this._portions[o],l=this._portions[o+1],u=a,A=l,c=!!(t&Qe),h=!!(t&ze),d=!!(t&We),p=!!(t&Ke),f=!!(t&He),v=!!(t&Ve);r=!c||v||h||d&&!this.model.scene.highlightMaterial.glowThrough||p&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!c||v?oo.NOT_RENDERED:p?oo.SILHOUETTE_SELECTED:d?oo.SILHOUETTE_HIGHLIGHTED:h?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var g=c&&!v&&f?oo.PICK:oo.NOT_RENDERED,m=t&je?1:0;if(s){this._deferredFlagValues||(this._deferredFlagValues=new Float32Array(this._numVerts));for(var _=u,y=u+A;_0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Lines instancing color fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return this._withSAO?(n.push(" float viewportWidth = uSAOParams[0];"),n.push(" float viewportHeight = uSAOParams[1];"),n.push(" float blendCutoff = uSAOParams[2];"),n.push(" float blendFactor = uSAOParams[3];"),n.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),n.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),n.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):n.push(" outColor = vColor;"),i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("}"),n}}]),i}(),Cl=function(e){g(i,xl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}]),i}(),Ml=$.vec3(),Fl=$.vec3(),El=$.vec3();$.vec3();var kl=$.mat4(),Il=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.canvas.gl,o=r.camera,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Ml;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Fl;if(l){var g=$.transformPoint3(A,l,El);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,kl),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Dl=$.vec3(),Sl=$.vec3(),Tl=$.vec3();$.vec3();var Rl=$.mat4(),Ll=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Dl;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Sl;if(l){var g=$.transformPoint3(A,l,Tl);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,Rl),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Ul=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._snapInitRenderer||(this._snapInitRenderer=new Il(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new Ll(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new Pl(this._scene)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Cl(this._scene)),this._silhouetteRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Il(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new Ll(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),Ol={};var Nl=new Uint8Array(4),Ql=new Float32Array(1),Vl=new Float32Array(3),Hl=new Float32Array(4),jl=function(){function e(t){var i,s,r;x(this,e),console.info("VBOInstancingLinesLayer"),this.model=t.model,this.material=t.material,this.sortId="LinesInstancingLayer",this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=Ol[s])||(r=new Ul(i),Ol[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete Ol[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({obb:$.OBB3(),numInstances:0,origin:null,geometry:t.geometry,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,t.origin&&(this._state.origin=$.vec3(t.origin)),this._finalized=!1}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){this._state.colorsBuf=new It(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,!1),this._colors=[]}if(r>0){this._state.flagsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){this._state.offsetsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,!1),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){var n=new Uint8Array(i.colorsCompressed);t.colorsBuf=new It(e,e.ARRAY_BUFFER,n,n.length,4,e.STATIC_DRAW,!1)}if(i.positionsCompressed&&i.positionsCompressed.length>0){t.positionsBuf=new It(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,!1),t.positionsDecodeMatrix=$.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new It(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){var o=!1;this._state.modelMatrixCol0Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,o),this._state.modelMatrixCol1Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,o),this._state.modelMatrixCol2Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,o),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Nl[0]=t[0],Nl[1]=t[1],Nl[2]=t[2],Nl[3]=t[3],this._state.colorsBuf.setData(Nl,4*e,4)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?255:0)<<16,Ql[0]=A,this._state.flagsBuf.setData(Ql,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Vl[0]=t[0],Vl[1]=t[1],Vl[2]=t[2],this._state.offsetsBuf.setData(Vl,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"setMatrix",value:function(e,t){if(!this._finalized)throw"Not finalized";var i=4*e;Hl[0]=t[0],Hl[1]=t[4],Hl[2]=t[8],Hl[3]=t[12],this._state.modelMatrixCol0Buf.setData(Hl,i),Hl[0]=t[1],Hl[1]=t[5],Hl[2]=t[9],Hl[3]=t[13],this._state.modelMatrixCol1Buf.setData(Hl,i),Hl[0]=t[2],Hl[1]=t[6],Hl[2]=t[10],Hl[3]=t[14],this._state.modelMatrixCol2Buf.setData(Hl,i)}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED)}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED)}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED)}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawOcclusion",value:function(e,t){}},{key:"drawShadow",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){}},{key:"drawPickDepths",value:function(e,t){}},{key:"drawPickNormals",value:function(e,t){}},{key:"destroy",value:function(){var e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}]),e}(),Gl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}]),i}(),zl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),Wl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Points batching silhouette vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e 1.0) {"),n.push(" discard;"),n.push(" }")),r){for(n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("outColor = color;"),n.push("}"),n}}]),i}(),Kl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}]),i}(),Xl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),Jl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}]),i}(),Yl=$.vec3(),Zl=$.vec3(),ql=$.vec3(),$l=$.vec3(),eu=$.mat4(),tu=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Yl;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=Zl;if(l){var m=ql;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,eu),(f=$l)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),iu=$.vec3(),su=$.vec3(),ru=$.vec3(),nu=$.vec3(),ou=$.mat4(),au=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=iu;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=su;if(l){var m=ru;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,ou),(f=nu)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),lu=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new zl(this._scene)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Wl(this._scene)),this._silhouetteRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Kl(this._scene)),this._pickMeshRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Xl(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new Jl(this._scene)),this._occlusionRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new tu(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new au(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),uu={};var Au=C((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e6;x(this,e),t>5e6&&(t=5e6),this.maxVerts=t,this.maxIndices=3*t,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]})),cu=function(){function e(t){x(this,e),console.info("Creating VBOBatchingPointsLayer"),this.model=t.model,this.sortId="PointsBatchingLayer",this.layerIndex=t.layerIndex,this._renderers=function(e){var t=e.id,i=uu[t];return i||(i=new lu(e),uu[t]=i,i._compile(),e.on("compile",(function(){i._compile()})),e.on("destroyed",(function(){delete uu[t],i._destroy()}))),i}(t.model.scene),this._buffer=new Au(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:$.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(t.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,t.origin&&(this._state.origin=$.vec3(t.origin))}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){var s=new Uint16Array(i.positions);e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{var r=$o(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new It(t,t.ARRAY_BUFFER,r,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){var n=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,n,i.colors.length,4,t.STATIC_DRAW,!1)}if(i.positions.length>0){var o=i.positions.length/3,a=new Float32Array(o);e.flagsBuf=new It(t,t.ARRAY_BUFFER,a,a.length,1,t.DYNAMIC_DRAW,!1)}if(i.pickColors.length>0){var l=new Uint8Array(i.pickColors);e.pickColorsBuf=new It(t,t.ARRAY_BUFFER,l,i.pickColors.length,4,t.STATIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var u=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,u,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized"}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],n=this._scratchMemory.getUInt8Array(r),o=t[0],a=t[1],l=t[2],u=0;u0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),pu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),fu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}]),i}(),vu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),gu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),mu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Points instancing depth vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e 1.0) {"),n.push(" discard;"),n.push(" }")),r){for(n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return n.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("}"),n}}]),i}(),_u=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),yu=$.vec3(),bu=$.vec3(),Bu=$.vec3();$.vec3();var wu=$.mat4(),xu=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.canvas.gl,o=r.camera,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=yu;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=bu;if(l){var g=$.transformPoint3(A,l,Bu);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,wu),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1)),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Pu=$.vec3(),Cu=$.vec3(),Mu=$.vec3();$.vec3();var Fu=$.mat4(),Eu=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Pu;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Cu;if(l){var g=$.transformPoint3(A,l,Mu);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,Fu),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),ku=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new du(this._scene,!1)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new pu(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new mu(this._scene)),this._depthRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new fu(this._scene)),this._pickMeshRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new vu(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new gu(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new _u(this._scene)),this._shadowRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new xu(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new Eu(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),Iu={};var Du=new Uint8Array(4),Su=new Float32Array(1),Tu=new Float32Array(3),Ru=new Float32Array(4),Lu=function(){function e(t){var i,s,r;x(this,e),console.info("VBOInstancingPointsLayer"),this.model=t.model,this.material=t.material,this.sortId="PointsInstancingLayer",this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=Iu[s])||(r=new ku(i),Iu[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete Iu[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({obb:$.OBB3(),numInstances:0,origin:t.origin?$.vec3(t.origin):null,geometry:t.geometry,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){i.flagsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){i.offsetsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,!1),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){i.positionsBuf=new It(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,!1),i.positionsDecodeMatrix=$.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){var r=new Uint8Array(s.colorsCompressed);i.colorsBuf=new It(e,e.ARRAY_BUFFER,r,r.length,4,e.STATIC_DRAW,!1)}if(this._modelMatrixCol0.length>0){var n=!1;i.modelMatrixCol0Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,n),i.modelMatrixCol1Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,n),i.modelMatrixCol2Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,n),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){i.pickColorsBuf=new It(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,!1),this._pickColors=[]}i.geometry=null,this._finalized=!0}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Du[0]=t[0],Du[1]=t[1],Du[2]=t[2],this._state.colorsBuf.setData(Du,3*e)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?255:0)<<16,Su[0]=A,this._state.flagsBuf.setData(Su,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Tu[0]=t[0],Tu[1]=t[1],Tu[2]=t[2],this._state.offsetsBuf.setData(Tu,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"setMatrix",value:function(e,t){if(!this._finalized)throw"Not finalized";var i=4*e;Ru[0]=t[0],Ru[1]=t[4],Ru[2]=t[8],Ru[3]=t[12],this._state.modelMatrixCol0Buf.setData(Ru,i),Ru[0]=t[1],Ru[1]=t[5],Ru[2]=t[9],Ru[3]=t[13],this._state.modelMatrixCol1Buf.setData(Ru,i),Ru[0]=t[2],Ru[1]=t[6],Ru[2]=t[10],Ru[3]=t[14],this._state.modelMatrixCol2Buf.setData(Ru,i)}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED)}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED)}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED)}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawOcclusion",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawShadow",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawPickDepths",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawPickNormals",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK)}},{key:"destroy",value:function(){var e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}]),e}(),Uu=$.vec3(),Ou=$.vec3(),Nu=$.mat4(),Qu=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate,d=r.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=Uu;if(f){var m=$.transformPoint3(c,u,Ou);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,Nu)}else p=d;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),o.drawArrays(o.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),o.drawArrays(o.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),o.drawArrays(o.LINES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),Vu=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}},{key:"eagerCreateRenders",value:function(){}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new Qu(this._scene,!1)),this._colorRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy()}}]),e}(),Hu={};var ju=C((function e(){x(this,e),this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]})),Gu=function(){function e(){x(this,e),this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}return C(e,[{key:"finalize",value:function(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}},{key:"bindCommonTextures",value:function(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}},{key:"bindLineIndicesTextures",value:function(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}]),e}(),zu=function(){function e(t,i,s,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;x(this,e),this._gl=t,this._texture=i,this._textureWidth=s,this._textureHeight=r,this._textureData=n}return C(e,[{key:"bindTexture",value:function(e,t,i){return e.bindTexture(t,this,i)}},{key:"bind",value:function(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}},{key:"unbind",value:function(e){}}]),e}(),Wu={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Wu,null,4));var e=0;Object.keys(Wu).forEach((function(t){t.startsWith("size")&&(e+=Wu[t])})),console.log("Total size ".concat(e," bytes (").concat((e/1e3/1e3).toFixed(2)," MB)")),console.log("Avg bytes / triangle: ".concat((e/Wu.totalLines).toFixed(2)));var t={};Object.keys(Wu).forEach((function(i){i.startsWith("size")&&(t[i]="".concat((Wu[i]/e*100).toFixed(2)," % of total"))})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};var Ku=function(){function e(){x(this,e)}return C(e,[{key:"disableBindedTextureFiltering",value:function(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}},{key:"generateTextureForColorsAndFlags",value:function(e,t,i,s,r){var n=t.length;this.numPortions=n;var o=4096,a=Math.ceil(n/512);if(0===a)throw"texture height===0";var l=new Uint8Array(16384*a);Wu.sizeDataColorsAndFlags+=l.byteLength,Wu.numberOfTextures++;for(var u=0;u>24&255,s[u]>>16&255,s[u]>>8&255,255&s[u]],32*u+16),l.set([r[u]>>24&255,r[u]>>16&255,r[u]>>8&255,255&r[u]],32*u+20);var A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,o,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,o,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,A,o,a,l)}},{key:"generateTextureForObjectOffsets",value:function(e,t){var i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";var r=new Float32Array(1536*s).fill(0);Wu.sizeDataTextureOffsets+=r.byteLength,Wu.numberOfTextures++;var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,n,i,s,r)}},{key:"generateTextureForInstancingMatrices",value:function(e,t){var i=t.length;if(0===i)throw"num instance matrices===0";var s=2048,r=Math.ceil(i/512),n=new Float32Array(8192*r);Wu.numberOfTextures++;for(var o=0;o65536&&Wu.cannotCreatePortion.because10BitsObjectId++;var i=this._numPortions+t<=65536,s=void 0!==e.geometryId&&null!==e.geometryId?"".concat(e.geometryId,"#").concat(0):"".concat(e.id,"#").concat(0);if(!this._bucketGeometries[s]){var r=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits),n=0,o=0;e.buckets.forEach((function(e){n+=e.positionsCompressed.length/3,o+=e.indices.length/2})),(this._state.numVertices+n>4096*Ju||r+o>4096*Ju)&&Wu.cannotCreatePortion.becauseTextureSize++,i&&(i=this._state.numVertices+n<=4096*Ju&&r+o<=4096*Ju)}return i}},{key:"createPortion",value:function(e,t){var i=this;if(this._finalized)throw"Already finalized";var s=[];t.buckets.forEach((function(e,r){var n=void 0!==t.geometryId&&null!==t.geometryId?"".concat(t.geometryId,"#").concat(r):"".concat(t.id,"#").concat(r),o=i._bucketGeometries[n];o||(o=i._createBucketGeometry(t,e),i._bucketGeometries[n]=o);var a=i._createSubPortion(t,o,e);s.push(a)}));var r=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(s),this.model.numPortions++,this._meshes.push(e),r}},{key:"_createBucketGeometry",value:function(e,t){if(t.indices){var i=8*Math.ceil(t.indices.length/2/8)*2;Wu.overheadSizeAlignementIndices+=2*(i-t.indices.length);var s=new Uint32Array(i);s.fill(0),s.set(t.indices),t.indices=s}var r=t.positionsCompressed,n=t.indices,o=this._buffer;o.positionsCompressed.push(r);var a,l=o.lenPositionsCompressed/3,u=r.length/3;o.lenPositionsCompressed+=r.length;var A,c=0;n&&(c=n.length/2,u<=256?(A=o.indices8Bits,a=o.lenIndices8Bits/2,o.lenIndices8Bits+=n.length):u<=65536?(A=o.indices16Bits,a=o.lenIndices16Bits/2,o.lenIndices16Bits+=n.length):(A=o.indices32Bits,a=o.lenIndices32Bits/2,o.lenIndices32Bits+=n.length),A.push(n));return this._state.numVertices+=u,Wu.numberOfGeometries++,{vertexBase:l,numVertices:u,numLines:c,indicesBase:a}}},{key:"_createSubPortion",value:function(e,t){var i,s=e.color,r=e.colors,n=e.opacity,o=e.meshMatrix,a=e.pickColor,l=this._buffer,u=this._state;l.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),l.perObjectInstancePositioningMatrices.push(o||eA),l.perObjectSolid.push(!!e.solid),r?l.perObjectColors.push([255*r[0],255*r[1],255*r[2],255]):s&&l.perObjectColors.push([s[0],s[1],s[2],n]),l.perObjectPickColors.push(a),l.perObjectVertexBases.push(t.vertexBase),i=t.numVertices<=256?u.numIndices8Bits:t.numVertices<=65536?u.numIndices16Bits:u.numIndices32Bits,l.perObjectIndexBaseOffsets.push(i/2-t.indicesBase);var A=this._subPortions.length;if(t.numLines>0){var c,h=2*t.numLines;t.numVertices<=256?(c=l.perLineNumberPortionId8Bits,u.numIndices8Bits+=h,Wu.totalLines8Bits+=t.numLines):t.numVertices<=65536?(c=l.perLineNumberPortionId16Bits,u.numIndices16Bits+=h,Wu.totalLines16Bits+=t.numLines):(c=l.perLineNumberPortionId32Bits,u.numIndices32Bits+=h,Wu.totalLines32Bits+=t.numLines),Wu.totalLines+=t.numLines;for(var d=0;d0&&(i.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(s,r.indices8Bits,r.lenIndices8Bits)),r.lenIndices16Bits>0&&(i.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(s,r.indices16Bits,r.lenIndices16Bits)),r.lenIndices32Bits>0&&(i.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(s,r.indices32Bits,r.lenIndices32Bits)),i.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(function(){e._deferredSetFlagsDirty&&e._uploadDeferredFlags(),e._numUpdatesInFrame=0}))}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags(),this._setDeferredFlags2()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}},{key:"_beginDeferredFlags",value:function(){this._deferredSetFlagsActive=!0}},{key:"_uploadDeferredFlags",value:function(){if(this._deferredSetFlagsActive=!1,this._deferredSetFlagsDirty){this._deferredSetFlagsDirty=!1;var e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Zu))}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this._portionToSubPortionsMap[e],n=0,o=r.length;n3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=!!(t&Qe),a=!!(t&ze),l=!!(t&We),u=!!(t&Ke),A=!!(t&He),c=!!(t&Ve);r=!o||c||a?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!o||c?oo.NOT_RENDERED:u?oo.SILHOUETTE_SELECTED:l?oo.SILHOUETTE_HIGHLIGHTED:a?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var h=o&&!c&&A?oo.PICK:oo.NOT_RENDERED,d=this._dataTextureState,p=this.model.scene.canvas.gl;Zu[0]=r,Zu[1]=n,Zu[3]=h,d.texturePerObjectColorsAndFlags._textureData.set(Zu,32*e+8),this._deferredSetFlagsActive||s?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),p.bindTexture(p.TEXTURE_2D,d.texturePerObjectColorsAndFlags._texture),p.texSubImage2D(p.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,p.RGBA_INTEGER,p.UNSIGNED_BYTE,Zu))}},{key:"_setDeferredFlags",value:function(){}},{key:"_setFlags2",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=this._portionToSubPortionsMap[e],r=0,n=s.length;r2&&void 0!==arguments[2]&&arguments[2];if(!this._finalized)throw"Not finalized";var s=t&je?255:0,r=this._dataTextureState,n=this.model.scene.canvas.gl;Zu[0]=s,Zu[1]=0,Zu[2]=1,Zu[3]=2,r.texturePerObjectColorsAndFlags._textureData.set(Zu,32*e+12),this._deferredSetFlagsActive||i?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),n.bindTexture(n.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),n.texSubImage2D(n.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,n.RGBA_INTEGER,n.UNSIGNED_BYTE,Zu))}},{key:"_setDeferredFlags2",value:function(){}},{key:"setOffset",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,qu))}},{key:"setMatrix",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Yu))}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){}},{key:"drawSilhouetteHighlighted",value:function(e,t){}},{key:"drawSilhouetteSelected",value:function(e,t){}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawOcclusion",value:function(e,t){}},{key:"drawShadow",value:function(e,t){}},{key:"setPickMatrices",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){}},{key:"drawPickDepths",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){}},{key:"drawSnap",value:function(e,t){}},{key:"drawPickNormals",value:function(e,t){}},{key:"destroy",value:function(){if(!this._destroyed){var e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}}]),e}(),iA=$.vec3(),sA=$.vec3(),rA=$.vec3();$.vec3();var nA=$.vec4(),oA=$.mat4(),aA=function(){function e(t,i){x(this,e),this._scene=t,this._withSAO=i,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=iA;if(f){var m=$.transformPoint3(c,u,sA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,oA),(p=rA)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new kt(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);var s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];for(var r=i.lights,n=0,o=r.length;n0,n=[];n.push("#version 300 es"),n.push("// TrianglesDataTextureColorRenderer vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("precision highp usampler2D;"),n.push("precision highp isampler2D;"),n.push("precision highp sampler2D;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("precision mediump usampler2D;"),n.push("precision mediump isampler2D;"),n.push("precision mediump sampler2D;"),n.push("#endif"),n.push("uniform int renderPass;"),n.push("uniform mat4 sceneModelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),n.push("uniform highp sampler2D uTexturePerObjectMatrix;"),n.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),n.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),n.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),n.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),n.push("uniform vec3 uCameraEyeRtc;"),n.push("vec3 positions[3];"),t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("out float isPerspective;")),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("uniform vec4 lightAmbient;");for(var o=0,a=s.lights.length;o> 3) & 4095;"),n.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),n.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),n.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),n.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),n.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),n.push("if (int(flags.x) != renderPass) {"),n.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),n.push(" return;"),n.push("} else {"),n.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),n.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),n.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),n.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),n.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),n.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),n.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),n.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),n.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),n.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),n.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),n.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),n.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),n.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),n.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),n.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),n.push("if (color.a == 0u) {"),n.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),n.push(" return;"),n.push("};"),n.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),n.push("vec3 position;"),n.push("position = positions[gl_VertexID % 3];"),n.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),n.push("if (solid != 1u) {"),n.push("if (isPerspectiveMatrix(projMatrix)) {"),n.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),n.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),n.push("position = positions[2 - (gl_VertexID % 3)];"),n.push("viewNormal = -viewNormal;"),n.push("}"),n.push("} else {"),n.push("if (viewNormal.z < 0.0) {"),n.push("position = positions[2 - (gl_VertexID % 3)];"),n.push("viewNormal = -viewNormal;"),n.push("}"),n.push("}"),n.push("}"),n.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;");for(var l=0,u=s.lights.length;l0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),lA=new Float32Array([1,1,1]),uA=$.vec3(),AA=$.vec3(),cA=$.vec3();$.vec3();var hA=$.mat4(),dA=function(){function e(t,i){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate,d=r.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p,f;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),u||0!==A[0]||0!==A[1]||0!==A[2]){var v=uA;if(u){var g=AA;$.transformPoint3(c,u,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=A[0],v[1]+=A[1],v[2]+=A[2],p=Re(d,v,hA),(f=cA)[0]=r.eye[0]-v[0],f[1]=r.eye[1]-v[1],f[2]=r.eye[2]-v[2]}else p=d,f=r.eye;if(o.uniform3fv(this._uCameraEyeRtc,f),o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===oo.SILHOUETTE_XRAYED){var m=s.xrayMaterial._state,_=m.fillColor,y=m.fillAlpha;o.uniform4f(this._uColor,_[0],_[1],_[2],y)}else if(i===oo.SILHOUETTE_HIGHLIGHTED){var b=s.highlightMaterial._state,B=b.fillColor,w=b.fillAlpha;o.uniform4f(this._uColor,B[0],B[1],B[2],w)}else if(i===oo.SILHOUETTE_SELECTED){var x=s.selectedMaterial._state,P=x.fillColor,C=x.fillAlpha;o.uniform4f(this._uColor,P[0],P[1],P[2],C)}else o.uniform4fv(this._uColor,lA);if(s.logarithmicDepthBufferEnabled){var M=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,M)}var F=s._sectionPlanesState.getNumAllocatedSectionPlanes(),E=s._sectionPlanesState.sectionPlanes.length;if(F>0)for(var k=s._sectionPlanesState.sectionPlanes,I=t.layerIndex*E,D=n.renderFlags,S=0;S0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),pA=new Float32Array([0,0,0,1]),fA=$.vec3(),vA=$.vec3();$.vec3();var gA=$.mat4(),mA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=fA;if(f){var m=$.transformPoint3(c,u,vA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,gA)}else p=d;if(o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix),i===oo.EDGES_XRAYED){var _=r.xrayMaterial._state,y=_.edgeColor,b=_.edgeAlpha;o.uniform4f(this._uColor,y[0],y[1],y[2],b)}else if(i===oo.EDGES_HIGHLIGHTED){var B=r.highlightMaterial._state,w=B.edgeColor,x=B.edgeAlpha;o.uniform4f(this._uColor,w[0],w[1],w[2],x)}else if(i===oo.EDGES_SELECTED){var P=r.selectedMaterial._state,C=P.edgeColor,M=P.edgeAlpha;o.uniform4f(this._uColor,C[0],C[1],C[2],M)}else o.uniform4fv(this._uColor,pA);var F=r._sectionPlanesState.getNumAllocatedSectionPlanes(),E=r._sectionPlanesState.sectionPlanes.length;if(F>0)for(var k=r._sectionPlanesState.sectionPlanes,I=t.layerIndex*E,D=s.renderFlags,S=0;S0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),o.drawArrays(o.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),o.drawArrays(o.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),o.drawArrays(o.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),_A=$.vec3(),yA=$.vec3(),bA=$.mat4(),BA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=n.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=_A;if(f){var m=$.transformPoint3(c,u,yA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,bA)}else p=d;o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix);var _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),y=r._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=r._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=s.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),o.drawArrays(o.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),o.drawArrays(o.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),o.drawArrays(o.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),wA=$.vec3(),xA=$.vec3(),PA=$.vec3(),CA=$.mat4(),MA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate;A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==c[0]||0!==c[1]||0!==c[2],v=0!==h[0]||0!==h[1]||0!==h[2];if(f||v){var g=wA;if(f){var m=$.transformPoint3(d,c,xA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=h[0],g[1]+=h[1],g[2]+=h[2],s=Re(a.viewMatrix,g,CA),(r=PA)[0]=a.eye[0]-g[0],r[1]=a.eye[1]-g[1],r[2]=a.eye[2]-g[2]}else s=a.viewMatrix,r=a.eye;if(l.uniform2fv(this._uPickClipPos,e.pickClipPos),l.uniform2f(this._uDrawingBufferSize,l.drawingBufferWidth,l.drawingBufferHeight),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix),l.uniform3fv(this._uCameraEyeRtc,r),l.uniform1i(this._uRenderPass,i),o.logarithmicDepthBufferEnabled){var _=2/(Math.log(a.project.far+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,_)}var y=o._sectionPlanesState.getNumAllocatedSectionPlanes(),b=o._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=o._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),FA=$.vec3(),EA=$.vec3(),kA=$.vec3();$.vec3();var IA=$.mat4(),DA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=e.pickViewMatrix||a.viewMatrix;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),c||0!==h[0]||0!==h[1]||0!==h[2]){var v=FA;if(c){var g=EA;$.transformPoint3(d,c,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=h[0],v[1]+=h[1],v[2]+=h[2],s=Re(f,v,IA),(r=kA)[0]=a.eye[0]-v[0],r[1]=a.eye[1]-v[1],r[2]=a.eye[2]-v[2],e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else s=f,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(l.uniform3fv(this._uCameraEyeRtc,r),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniform2fv(this._uPickClipPos,e.pickClipPos),l.uniform2f(this._uDrawingBufferSize,l.drawingBufferWidth,l.drawingBufferHeight),l.uniform1f(this._uPickZNear,e.pickZNear),l.uniform1f(this._uPickZFar,e.pickZFar),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix),o.logarithmicDepthBufferEnabled){var m=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,m)}var _=o._sectionPlanesState.getNumAllocatedSectionPlanes(),y=o._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=o._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=n.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),SA=$.vec3(),TA=$.vec3(),RA=$.vec3(),LA=$.vec3();$.vec3();var UA=$.mat4(),OA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=t.aabb,v=e.pickViewMatrix||a.viewMatrix,g=SA;g[0]=$.safeInv(f[3]-f[0])*$.MAX_INT,g[1]=$.safeInv(f[4]-f[1])*$.MAX_INT,g[2]=$.safeInv(f[5]-f[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(g[0]),e.snapPickCoordinateScale[1]=$.safeInv(g[1]),e.snapPickCoordinateScale[2]=$.safeInv(g[2]),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var m=0!==c[0]||0!==c[1]||0!==c[2],_=0!==h[0]||0!==h[1]||0!==h[2];if(m||_){var y=TA;if(m){var b=$.transformPoint3(d,c,RA);y[0]=b[0],y[1]=b[1],y[2]=b[2]}else y[0]=0,y[1]=0,y[2]=0;y[0]+=h[0],y[1]+=h[1],y[2]+=h[2],s=Re(v,y,UA),(r=LA)[0]=a.eye[0]-y[0],r[1]=a.eye[1]-y[1],r[2]=a.eye[2]-y[2],e.snapPickOrigin[0]=y[0],e.snapPickOrigin[1]=y[1],e.snapPickOrigin[2]=y[2]}else s=v,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;l.uniform3fv(this._uCameraEyeRtc,r),l.uniform2fv(this.uVectorA,e.snapVectorA),l.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),l.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),l.uniform3fv(this._uCoordinateScaler,g),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix);var B=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,B);var w=o._sectionPlanesState.getNumAllocatedSectionPlanes(),x=o._sectionPlanesState.sectionPlanes.length;if(w>0)for(var P=o._sectionPlanesState.sectionPlanes,C=t.layerIndex*x,M=n.renderFlags,F=0;F0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),l.drawArrays(S,0,u.numEdgeIndices8Bits)),u.numEdgeIndices16Bits>0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),l.drawArrays(S,0,u.numEdgeIndices16Bits)),u.numEdgeIndices32Bits>0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),l.drawArrays(S,0,u.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),NA=$.vec3(),QA=$.vec3(),VA=$.vec3(),HA=$.vec3();$.vec3();var jA=$.mat4(),GA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=t.aabb,v=e.pickViewMatrix||a.viewMatrix,g=NA;g[0]=$.safeInv(f[3]-f[0])*$.MAX_INT,g[1]=$.safeInv(f[4]-f[1])*$.MAX_INT,g[2]=$.safeInv(f[5]-f[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(g[0]),e.snapPickCoordinateScale[1]=$.safeInv(g[1]),e.snapPickCoordinateScale[2]=$.safeInv(g[2]),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var m=0!==c[0]||0!==c[1]||0!==c[2],_=0!==h[0]||0!==h[1]||0!==h[2];if(m||_){var y=QA;if(m){var b=VA;$.transformPoint3(d,c,b),y[0]=b[0],y[1]=b[1],y[2]=b[2]}else y[0]=0,y[1]=0,y[2]=0;y[0]+=h[0],y[1]+=h[1],y[2]+=h[2],s=Re(v,y,jA),(r=HA)[0]=a.eye[0]-y[0],r[1]=a.eye[1]-y[1],r[2]=a.eye[2]-y[2],e.snapPickOrigin[0]=y[0],e.snapPickOrigin[1]=y[1],e.snapPickOrigin[2]=y[2]}else s=v,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;l.uniform3fv(this._uCameraEyeRtc,r),l.uniform2fv(this._uVectorA,e.snapVectorA),l.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),l.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),l.uniform3fv(this._uCoordinateScaler,g),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix);var B=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,B);var w=o._sectionPlanesState.getNumAllocatedSectionPlanes(),x=o._sectionPlanesState.sectionPlanes.length;if(w>0)for(var P=o._sectionPlanesState.sectionPlanes,C=t.layerIndex*x,M=n.renderFlags,F=0;F0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),zA=$.vec3(),WA=$.vec3(),KA=$.vec3();$.vec3();var XA=$.mat4(),JA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=e.pickViewMatrix||n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var p,f;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),u||0!==A[0]||0!==A[1]||0!==A[2]){var v=zA;if(u){var g=WA;$.transformPoint3(c,u,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=A[0],v[1]+=A[1],v[2]+=A[2],p=Re(d,v,XA),(f=KA)[0]=n.eye[0]-v[0],f[1]=n.eye[1]-v[1],f[2]=n.eye[2]-v[2]}else p=d,f=n.eye;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix);var m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0)for(var y=r._sectionPlanesState.sectionPlanes,b=t.layerIndex*_,B=s.renderFlags,w=0;w0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),YA=$.vec3(),ZA=$.vec3(),qA=$.vec3();$.vec3();var $A=$.mat4(),ec=function(){function e(t){x(this,e),this._scene=t,this._allocate(),this._hash=this._getHash()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=YA;if(f){var m=$.transformPoint3(c,u,ZA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,$A),(p=qA)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),tc=$.vec3(),ic=$.vec3(),sc=$.vec3();$.vec3();var rc=$.mat4(),nc=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));var f=0!==l[0]||0!==l[1]||0!==l[2],v=0!==u[0]||0!==u[1]||0!==u[2];if(f||v){var g=tc;if(f){var m=ic;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],d=Re(h,g,rc),(p=sc)[0]=n.eye[0]-g[0],p[1]=n.eye[1]-g[1],p[2]=n.eye[2]-g[2]}else d=h,p=n.eye;o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,c),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,n.viewNormalMatrix),o.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);var _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),y=r._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=r._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=s.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(yt.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),oc=$.vec3(),ac=$.vec3(),lc=$.vec3();$.vec3(),$.vec4();var uc=$.mat4(),Ac=function(){function e(t,i){x(this,e),this._scene=t,this._withSAO=i,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=oc;if(f){var m=$.transformPoint3(c,u,ac);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,uc),(p=lc)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniform2fv(this._uPickClipPos,e.pickClipPos),o.uniform2f(this._uDrawingBufferSize,o.drawingBufferWidth,o.drawingBufferHeight),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),cc=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new dA(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new MA(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new DA(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new Ac(this._scene)),this._snapRenderer||(this._snapRenderer=new OA(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new GA(this._scene)),this._snapRenderer||(this._snapRenderer=new OA(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new aA(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new aA(this._scene,!0)),this._colorRendererWithSAO}},{key:"colorQualityRendererWithSAO",get:function(){return this._colorQualityRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new dA(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new ec(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new nc(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new mA(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new BA(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new MA(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Ac(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Ac(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new DA(this._scene)),this._pickDepthRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new OA(this._scene)),this._snapRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new GA(this._scene)),this._snapInitRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new JA(this._scene)),this._occlusionRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}]),e}(),hc={};var dc=C((function e(){x(this,e),this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]})),pc=function(){function e(){x(this,e),this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}return C(e,[{key:"finalize",value:function(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}},{key:"bindCommonTextures",value:function(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}},{key:"bindTriangleIndicesTextures",value:function(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}},{key:"bindEdgeIndicesTextures",value:function(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}]),e}(),fc={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(fc,null,4));var e=0;Object.keys(fc).forEach((function(t){t.startsWith("size")&&(e+=fc[t])})),console.log("Total size ".concat(e," bytes (").concat((e/1e3/1e3).toFixed(2)," MB)")),console.log("Avg bytes / triangle: ".concat((e/fc.totalPolygons).toFixed(2)));var t={};Object.keys(fc).forEach((function(i){i.startsWith("size")&&(t[i]="".concat((fc[i]/e*100).toFixed(2)," % of total"))})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};var vc=function(){function e(){x(this,e)}return C(e,[{key:"disableBindedTextureFiltering",value:function(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}},{key:"createTextureForColorsAndFlags",value:function(e,t,i,s,r,n,o){var a=t.length;this.numPortions=a;var l=4096,u=Math.ceil(a/512);if(0===u)throw"texture height===0";var A=new Uint8Array(16384*u);fc.sizeDataColorsAndFlags+=A.byteLength,fc.numberOfTextures++;for(var c=0;c>24&255,s[c]>>16&255,s[c]>>8&255,255&s[c]],32*c+16),A.set([r[c]>>24&255,r[c]>>16&255,r[c]>>8&255,255&r[c]],32*c+20),A.set([n[c]>>24&255,n[c]>>16&255,n[c]>>8&255,255&n[c]],32*c+24),A.set([o[c]?1:0,0,0,0],32*c+28);var h=e.createTexture();return e.bindTexture(e.TEXTURE_2D,h),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,u),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,u,e.RGBA_INTEGER,e.UNSIGNED_BYTE,A,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,h,l,u,A)}},{key:"createTextureForObjectOffsets",value:function(e,t){var i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";var r=new Float32Array(1536*s).fill(0);fc.sizeDataTextureOffsets+=r.byteLength,fc.numberOfTextures++;var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,n,i,s,r)}},{key:"createTextureForInstancingMatrices",value:function(e,t){var i=t.length;if(0===i)throw"num instance matrices===0";var s=2048,r=Math.ceil(i/512),n=new Float32Array(8192*r);fc.numberOfTextures++;for(var o=0;o65536&&fc.cannotCreatePortion.because10BitsObjectId++;var i=this._numPortions+t<=65536,s=void 0!==e.geometryId&&null!==e.geometryId?"".concat(e.geometryId,"#").concat(0):"".concat(e.id,"#").concat(0);if(!this._bucketGeometries[s]){var r=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits),n=0,o=0;e.buckets.forEach((function(e){n+=e.positionsCompressed.length/3,o+=e.indices.length/3})),(this._state.numVertices+n>4096*mc||r+o>4096*mc)&&fc.cannotCreatePortion.becauseTextureSize++,i&&(i=this._state.numVertices+n<=4096*mc&&r+o<=4096*mc)}return i}},{key:"createPortion",value:function(e,t){var i=this;if(this._finalized)throw"Already finalized";var s=[];t.buckets.forEach((function(e,r){var n=void 0!==t.geometryId&&null!==t.geometryId?"".concat(t.geometryId,"#").concat(r):"".concat(t.id,"#").concat(r),o=i._bucketGeometries[n];o||(o=i._createBucketGeometry(t,e),i._bucketGeometries[n]=o);var a=i._createSubPortion(t,o,e);s.push(a)}));var r=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(s),this.model.numPortions++,this._meshes.push(e),r}},{key:"_createBucketGeometry",value:function(e,t){if(t.indices){var i=8*Math.ceil(t.indices.length/3/8)*3;fc.overheadSizeAlignementIndices+=2*(i-t.indices.length);var s=new Uint32Array(i);s.fill(0),s.set(t.indices),t.indices=s}if(t.edgeIndices){var r=8*Math.ceil(t.edgeIndices.length/2/8)*2;fc.overheadSizeAlignementEdgeIndices+=2*(r-t.edgeIndices.length);var n=new Uint32Array(r);n.fill(0),n.set(t.edgeIndices),t.edgeIndices=n}var o=t.positionsCompressed,a=t.indices,l=t.edgeIndices,u=this._buffer;u.positionsCompressed.push(o);var A,c=u.lenPositionsCompressed/3,h=o.length/3;u.lenPositionsCompressed+=o.length;var d,p,f=0;a&&(f=a.length/3,h<=256?(d=u.indices8Bits,A=u.lenIndices8Bits/3,u.lenIndices8Bits+=a.length):h<=65536?(d=u.indices16Bits,A=u.lenIndices16Bits/3,u.lenIndices16Bits+=a.length):(d=u.indices32Bits,A=u.lenIndices32Bits/3,u.lenIndices32Bits+=a.length),d.push(a));var v,g=0;l&&(g=l.length/2,h<=256?(v=u.edgeIndices8Bits,p=u.lenEdgeIndices8Bits/2,u.lenEdgeIndices8Bits+=l.length):h<=65536?(v=u.edgeIndices16Bits,p=u.lenEdgeIndices16Bits/2,u.lenEdgeIndices16Bits+=l.length):(v=u.edgeIndices32Bits,p=u.lenEdgeIndices32Bits/2,u.lenEdgeIndices32Bits+=l.length),v.push(l));return this._state.numVertices+=h,fc.numberOfGeometries++,{vertexBase:c,numVertices:h,numTriangles:f,numEdges:g,indicesBase:A,edgeIndicesBase:p}}},{key:"_createSubPortion",value:function(e,t,i,s){var r=e.color;e.metallic,e.roughness;var n,o,a=e.colors,l=e.opacity,u=e.meshMatrix,A=e.pickColor,c=this._buffer,h=this._state;c.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),c.perObjectInstancePositioningMatrices.push(u||wc),c.perObjectSolid.push(!!e.solid),a?c.perObjectColors.push([255*a[0],255*a[1],255*a[2],255]):r&&c.perObjectColors.push([r[0],r[1],r[2],l]),c.perObjectPickColors.push(A),c.perObjectVertexBases.push(t.vertexBase),n=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,c.perObjectIndexBaseOffsets.push(n/3-t.indicesBase),o=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,c.perObjectEdgeIndexBaseOffsets.push(o/2-t.edgeIndicesBase);var d=this._subPortions.length;if(t.numTriangles>0){var p,f=3*t.numTriangles;t.numVertices<=256?(p=c.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=f,fc.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(p=c.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=f,fc.totalPolygons16Bits+=t.numTriangles):(p=c.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=f,fc.totalPolygons32Bits+=t.numTriangles),fc.totalPolygons+=t.numTriangles;for(var v=0;v0){var g,m=2*t.numEdges;t.numVertices<=256?(g=c.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=m,fc.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(g=c.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=m,fc.totalEdges16Bits+=t.numEdges):(g=c.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=m,fc.totalEdges32Bits+=t.numEdges),fc.totalEdges+=t.numEdges;for(var _=0;_0&&(i.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId8Bits)),r.perEdgeNumberPortionId16Bits.length>0&&(i.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId16Bits)),r.perEdgeNumberPortionId32Bits.length>0&&(i.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId32Bits)),r.lenIndices8Bits>0&&(i.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(s,r.indices8Bits,r.lenIndices8Bits)),r.lenIndices16Bits>0&&(i.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(s,r.indices16Bits,r.lenIndices16Bits)),r.lenIndices32Bits>0&&(i.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(s,r.indices32Bits,r.lenIndices32Bits)),r.lenEdgeIndices8Bits>0&&(i.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(s,r.edgeIndices8Bits,r.lenEdgeIndices8Bits)),r.lenEdgeIndices16Bits>0&&(i.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(s,r.edgeIndices16Bits,r.lenEdgeIndices16Bits)),r.lenEdgeIndices32Bits>0&&(i.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(s,r.edgeIndices32Bits,r.lenEdgeIndices32Bits)),i.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(function(){e._deferredSetFlagsDirty&&e._uploadDeferredFlags(),e._numUpdatesInFrame=0}))}}},{key:"isEmpty",value:function(){return 0===this._numPortions}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags(),this._setDeferredFlags2()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}},{key:"_beginDeferredFlags",value:function(){this._deferredSetFlagsActive=!0}},{key:"_uploadDeferredFlags",value:function(){if(this._deferredSetFlagsActive=!1,this._deferredSetFlagsDirty){this._deferredSetFlagsDirty=!1;var e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,yc)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this._portionToSubPortionsMap[e],n=0,o=r.length;n3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=!!(t&Qe),a=!!(t&ze),l=!!(t&We),u=!!(t&Ke),A=!!(t&Xe),c=!!(t&He),h=!!(t&Ve);r=!o||h||a||l&&!this.model.scene.highlightMaterial.glowThrough||u&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!o||h?oo.NOT_RENDERED:u?oo.SILHOUETTE_SELECTED:l?oo.SILHOUETTE_HIGHLIGHTED:a?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var d=0;d=!o||h?oo.NOT_RENDERED:u?oo.EDGES_SELECTED:l?oo.EDGES_HIGHLIGHTED:a?oo.EDGES_XRAYED:A?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED;var p=o&&!h&&c?oo.PICK:oo.NOT_RENDERED,f=this._dtxState,v=this.model.scene.canvas.gl;yc[0]=r,yc[1]=n,yc[2]=d,yc[3]=p,f.texturePerObjectColorsAndFlags._textureData.set(yc,32*e+8),this._deferredSetFlagsActive||s?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),v.bindTexture(v.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),v.texSubImage2D(v.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,v.RGBA_INTEGER,v.UNSIGNED_BYTE,yc))}},{key:"_setDeferredFlags",value:function(){}},{key:"_setFlags2",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=this._portionToSubPortionsMap[e],r=0,n=s.length;r2&&void 0!==arguments[2]&&arguments[2];if(!this._finalized)throw"Not finalized";var s=t&je?255:0,r=this._dtxState,n=this.model.scene.canvas.gl;yc[0]=s,yc[1]=0,yc[2]=1,yc[3]=2,r.texturePerObjectColorsAndFlags._textureData.set(yc,32*e+12),this._deferredSetFlagsActive||i?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),n.bindTexture(n.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),n.texSubImage2D(n.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,n.RGBA_INTEGER,n.UNSIGNED_BYTE,yc))}},{key:"_setDeferredFlags2",value:function(){}},{key:"setOffset",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,bc))}},{key:"setMatrix",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,_c))}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,oo.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"_updateBackfaceCull",value:function(e,t){var i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){var s=t.gl;i?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),t.backfaces=i}}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT))}},{key:"drawDepth",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawNormals",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED))}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED))}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED))}},{key:"drawEdgesColorOpaque",value:function(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,oo.EDGES_COLOR_OPAQUE)}},{key:"drawEdgesColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,oo.EDGES_COLOR_TRANSPARENT)}},{key:"drawEdgesHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_HIGHLIGHTED)}},{key:"drawEdgesSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_SELECTED)}},{key:"drawEdgesXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_XRAYED)}},{key:"drawOcclusion",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawShadow",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"setPickMatrices",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawPickDepths",value:function(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawPickNormals",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,oo.PICK))}},{key:"destroy",value:function(){if(!this._destroyed){var e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}}]),e}(),Pc=function(){function e(t){x(this,e),this.id=t.id,this.colorTexture=t.colorTexture,this.metallicRoughnessTexture=t.metallicRoughnessTexture,this.normalsTexture=t.normalsTexture,this.emissiveTexture=t.emissiveTexture,this.occlusionTexture=t.occlusionTexture}return C(e,[{key:"destroy",value:function(){}}]),e}(),Cc=function(){function e(t){x(this,e),this.id=t.id,this.texture=t.texture}return C(e,[{key:"destroy",value:function(){this.texture&&(this.texture.destroy(),this.texture=null)}}]),e}(),Mc={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Fc=function(){function e(t,i,s){x(this,e),this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=s}return C(e,[{key:"itemStart",value:function(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}},{key:"itemEnd",value:function(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}},{key:"itemError",value:function(e){void 0!==this.onError&&this.onError(e)}},{key:"resolveURL",value:function(e){return this.urlModifier?this.urlModifier(e):e}},{key:"setURLModifier",value:function(e){return this.urlModifier=e,this}},{key:"addHandler",value:function(e,t){return this.handlers.push(e,t),this}},{key:"removeHandler",value:function(e){var t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}},{key:"getHandler",value:function(e){for(var t=0,i=this.handlers.length;t0&&void 0!==arguments[0]?arguments[0]:4;x(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return C(e,[{key:"_initWorker",value:function(e){if(!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}},{key:"_getIdleWorker",value:function(){for(var e=0;e0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),Tc++}return this._transcoderPending}},{key:"transcode",value:function(e,t){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(r,n){var o=s;i._init().then((function(){return i._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e)})).then((function(e){var i=e.data,s=i.mipmaps,o=(i.width,i.height,i.format),a=i.type,l=i.error,u=i.dfdTransferFn,A=i.dfdFlags;if("error"===a)return n(l);t.setCompressedData({mipmaps:s,props:{format:o,minFilter:1===s.length?1006:1008,magFilter:1===s.length?1006:1008,encoding:2===u?3001:3e3,premultiplyAlpha:!!(1&A)}}),r()}))}))}},{key:"destroy",value:function(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),Tc--}}]),e}();Rc.BasisFormat={ETC1S:0,UASTC_4x4:1},Rc.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Rc.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},Rc.BasisWorker=function(){var e,t,i,s=_EngineFormat,r=_TranscoderFormat,n=_BasisFormat;self.addEventListener("message",(function(o){var A,c=o.data;switch(c.type){case"init":e=c.config,A=c.transcoderBinary,t=new Promise((function(e){i={wasmBinary:A,onRuntimeInitialized:e},BASIS(i)})).then((function(){i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((function(){try{for(var t=function(t){var o=new i.KTX2File(new Uint8Array(t));function A(){o.close(),o.delete()}if(!o.isValid())throw A(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");var c=o.isUASTC()?n.UASTC_4x4:n.ETC1S,h=o.getWidth(),d=o.getHeight(),p=o.getLevels(),f=o.getHasAlpha(),v=o.getDFDTransferFunc(),g=o.getDFDFlags(),m=function(t,i,o,A){for(var c,h,d=t===n.ETC1S?a:l,p=0;p=0;--r){var n=this.tryEntries[r],o=n.completion;if("root"===n.tryLoc)return s("end");if(n.tryLoc<=this.prev){var a=i.call(n,"catchLoc"),l=i.call(n,"finallyLoc");if(a&&l){if(this.prev=0;--s){var r=this.tryEntries[s];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),x(i),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var s=i.completion;if("throw"===s.type){var r=s.arg;x(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:C(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),c}},e}function l(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function u(e){return function(){var t=this,i=arguments;return new Promise((function(s,r){var n=e.apply(t,i);function o(e){l(n,s,r,o,a,"next",e)}function a(e){l(n,s,r,o,a,"throw",e)}o(void 0)}))}}function A(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=d(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,a=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){a=!0,n=e},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw n}}}}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var s,r,n=[],o=!0,a=!1;try{for(i=i.call(e);!(o=(s=i.next()).done)&&(n.push(s.value),!t||n.length!==t);o=!0);}catch(e){a=!0,r=e}finally{try{o||null==i.return||i.return()}finally{if(a)throw r}}return n}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this._id=V.addItem(),this._context=null,this._enabled=!1,this._itemsCfg=[],this._rootMenu=null,this._menuList=[],this._menuMap={},this._itemList=[],this._itemMap={},this._shown=!1,this._nextId=0,this._eventSubs={},!1!==i.hideOnMouseDown&&(document.addEventListener("mousedown",(function(e){e.target.classList.contains("xeokit-context-menu-item")||t.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=function(e){e.target.classList.contains("xeokit-context-menu-item")||t.hide()})),i.items&&(this.items=i.items),this._hideOnAction=!1!==i.hideOnAction,this.context=i.context,this.enabled=!1!==i.enabled,this.hide()}return C(e,[{key:"on",value:function(e,t){var i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}},{key:"fire",value:function(e,t){var i=this._eventSubs[e];if(i)for(var s=0,r=i.length;s0,A=t._getNextId(),c=n.getTitle||function(){return n.title||""},h=n.doAction||n.callback||function(){},d=n.getEnabled||function(){return!0},p=n.getShown||function(){return!0},f=new G(A,c,h,d,p);if(f.parentMenu=r,l.items.push(f),u){var v=e(o);f.subMenu=v,v.parentItem=f}t._itemList.push(f),t._itemMap[f.id]=f},A=0,c=a.length;A'),s.push("
    "),i)for(var r=0,n=i.length;r'+d+" [MORE]"):s.push('
  • '+d+"
  • ")}}s.push("
"),s.push("");var p=s.join("");document.body.insertAdjacentHTML("beforeend",p);var f=document.querySelector("."+e.id);e.menuElement=f,f.style["border-radius"]="4px",f.style.display="none",f.style["z-index"]=3e5,f.style.background="white",f.style.border="1px solid black",f.style["box-shadow"]="0 4px 5px 0 gray",f.oncontextmenu=function(e){e.preventDefault()};var v=this,g=null;if(i)for(var m=0,_=i.length;m<_;m++){var y=i[m].items;if(y)for(var b=function(e,i){var s=y[e],r=s.subMenu;if(s.itemElement=document.getElementById(s.id),!s.itemElement)return console.error("ContextMenu item element not found: "+s.id),"continue";s.itemElement.addEventListener("mouseenter",(function(e){e.preventDefault();var t=s.subMenu;if(t){if(g&&g.id!==t.id&&(v._hideMenu(g.id),g=null),!1!==s.enabled){var i=s.itemElement,r=t.menuElement,n=i.getBoundingClientRect();r.getBoundingClientRect();n.right+200>window.innerWidth?v._showMenu(t.id,n.left-200,n.top-1):v._showMenu(t.id,n.right-5,n.top-1),g=t}}else g&&(v._hideMenu(g.id),g=null)})),r||(s.itemElement.addEventListener("click",(function(e){e.preventDefault(),v._context&&!1!==s.enabled&&(s.doAction&&s.doAction(v._context),t._hideOnAction?v.hide():(v._updateItemsTitles(),v._updateItemsEnabledStatus()))})),s.itemElement.addEventListener("mouseup",(function(e){3===e.which&&(e.preventDefault(),v._context&&!1!==s.enabled&&(s.doAction&&s.doAction(v._context),t._hideOnAction?v.hide():(v._updateItemsTitles(),v._updateItemsEnabledStatus())))})),s.itemElement.addEventListener("mouseenter",(function(e){e.preventDefault(),!1!==s.enabled&&s.doHover&&s.doHover(v._context)})))},B=0,w=y.length;Bwindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}},{key:"_hideMenuElement",value:function(e){e.style.display="none"}}]),e}(),W=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.viewer=t,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=s.zoomLevel||2,this._active=!1!==s.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(function(){i._active&&i._visible&&i.update()}))}return C(e,[{key:"update",value:function(){if(this._active&&this._visible&&this._canvasPos){var e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop="".concat(t.bottom-t.top-this._lensCanvas.height-85,"px"):this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);var s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);var r=[(e.left+e.right)/2,(e.top+e.bottom)/2];if(this._snappedCanvasPos){var n=this._snappedCanvasPos[0]-this._canvasPos[0],o=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft="".concat(r[0]+n*this._zoomLevel-10,"px"),this._lensCursorDiv.style.marginTop="".concat(r[1]+o*this._zoomLevel-10,"px")}else this._lensCursorDiv.style.marginLeft="".concat(r[0]-10,"px"),this._lensCursorDiv.style.marginTop="".concat(r[1]-10,"px")}}},{key:"zoomFactor",get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.update()}},{key:"canvasPos",get:function(){return this._canvasPos},set:function(e){this._canvasPos=e,this.update()}},{key:"snappedCanvasPos",get:function(){return this._snappedCanvasPos},set:function(e){this._snappedCanvasPos=e,this.update()}},{key:"snapped",get:function(){return this._snapped},set:function(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}},{key:"active",get:function(){return this._active},set:function(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}},{key:"destroy",value:function(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}}]),e}(),K=!0,X=K?Float64Array:Float32Array,J=new X(3),Y=new X(16),Z=new X(16),q=new X(4),$={setDoublePrecisionEnabled:function(e){X=(K=e)?Float64Array:Float32Array},getDoublePrecisionEnabled:function(){return K},MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:1e7,DEGTORAD:.0174532925,RADTODEG:57.295779513,unglobalizeObjectId:function(e,t){var i=t.indexOf("#");return i===e.length&&t.startsWith(e)?t.substring(i+1):t},globalizeObjectId:function(e,t){return e+"#"+t},safeInv:function(e){var t=1/e;return isNaN(t)||!isFinite(t)?1:t},vec2:function(e){return new X(e||2)},vec3:function(e){return new X(e||3)},vec4:function(e){return new X(e||4)},mat3:function(e){return new X(e||9)},mat3ToMat4:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new X(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},mat4:function(e){return new X(e||16)},mat4ToMat3:function(e,t){},doublesToFloats:function(e,t,i){for(var s=new X(2),r=0,n=e.length;r>8&255]+e[t>>16&255]+e[t>>24&255],"-").concat(e[255&i]).concat(e[i>>8&255],"-").concat(e[i>>16&15|64]).concat(e[i>>24&255],"-").concat(e[63&s|128]).concat(e[s>>8&255],"-").concat(e[s>>16&255]).concat(e[s>>24&255]).concat(e[255&r]).concat(e[r>>8&255]).concat(e[r>>16&255]).concat(e[r>>24&255])}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},fmod:function(e,t){if(e1?1:i,Math.acos(i)},vec3FromMat4Scale:function(){var e=new X(3);return function(t,i){return e[0]=t[0],e[1]=t[1],e[2]=t[2],i[0]=$.lenVec3(e),e[0]=t[4],e[1]=t[5],e[2]=t[6],i[1]=$.lenVec3(e),e[0]=t[8],e[1]=t[9],e[2]=t[10],i[2]=$.lenVec3(e),i}}(),vecToArray:function(){function e(e){return Math.round(1e5*e)/1e5}return function(t){for(var i=0,s=(t=Array.prototype.slice.call(t)).length;i0&&void 0!==arguments[0]?arguments[0]:new X(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},identityMat3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new X(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},isIdentityMat4:function(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]},negateMat4:function(e,t){return t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},addMat4:function(e,t,i){return i||(i=e),i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i},addMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t,i[3]=e[3]+t,i[4]=e[4]+t,i[5]=e[5]+t,i[6]=e[6]+t,i[7]=e[7]+t,i[8]=e[8]+t,i[9]=e[9]+t,i[10]=e[10]+t,i[11]=e[11]+t,i[12]=e[12]+t,i[13]=e[13]+t,i[14]=e[14]+t,i[15]=e[15]+t,i},addScalarMat4:function(e,t,i){return $.addMat4Scalar(t,e,i)},subMat4:function(e,t,i){return i||(i=e),i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i},subMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]-t,i[1]=e[1]-t,i[2]=e[2]-t,i[3]=e[3]-t,i[4]=e[4]-t,i[5]=e[5]-t,i[6]=e[6]-t,i[7]=e[7]-t,i[8]=e[8]-t,i[9]=e[9]-t,i[10]=e[10]-t,i[11]=e[11]-t,i[12]=e[12]-t,i[13]=e[13]-t,i[14]=e[14]-t,i[15]=e[15]-t,i},subScalarMat4:function(e,t,i){return i||(i=t),i[0]=e-t[0],i[1]=e-t[1],i[2]=e-t[2],i[3]=e-t[3],i[4]=e-t[4],i[5]=e-t[5],i[6]=e-t[6],i[7]=e-t[7],i[8]=e-t[8],i[9]=e-t[9],i[10]=e-t[10],i[11]=e-t[11],i[12]=e-t[12],i[13]=e-t[13],i[14]=e-t[14],i[15]=e-t[15],i},mulMat4:function(e,t,i){i||(i=e);var s=e[0],r=e[1],n=e[2],o=e[3],a=e[4],l=e[5],u=e[6],A=e[7],c=e[8],h=e[9],d=e[10],p=e[11],f=e[12],v=e[13],g=e[14],m=e[15],_=t[0],y=t[1],b=t[2],B=t[3],w=t[4],x=t[5],P=t[6],C=t[7],M=t[8],F=t[9],E=t[10],k=t[11],I=t[12],D=t[13],S=t[14],T=t[15];return i[0]=_*s+y*a+b*c+B*f,i[1]=_*r+y*l+b*h+B*v,i[2]=_*n+y*u+b*d+B*g,i[3]=_*o+y*A+b*p+B*m,i[4]=w*s+x*a+P*c+C*f,i[5]=w*r+x*l+P*h+C*v,i[6]=w*n+x*u+P*d+C*g,i[7]=w*o+x*A+P*p+C*m,i[8]=M*s+F*a+E*c+k*f,i[9]=M*r+F*l+E*h+k*v,i[10]=M*n+F*u+E*d+k*g,i[11]=M*o+F*A+E*p+k*m,i[12]=I*s+D*a+S*c+T*f,i[13]=I*r+D*l+S*h+T*v,i[14]=I*n+D*u+S*d+T*g,i[15]=I*o+D*A+S*p+T*m,i},mulMat3:function(e,t,i){i||(i=new X(9));var s=e[0],r=e[3],n=e[6],o=e[1],a=e[4],l=e[7],u=e[2],A=e[5],c=e[8],h=t[0],d=t[3],p=t[6],f=t[1],v=t[4],g=t[7],m=t[2],_=t[5],y=t[8];return i[0]=s*h+r*f+n*m,i[3]=s*d+r*v+n*_,i[6]=s*p+r*g+n*y,i[1]=o*h+a*f+l*m,i[4]=o*d+a*v+l*_,i[7]=o*p+a*g+l*y,i[2]=u*h+A*f+c*m,i[5]=u*d+A*v+c*_,i[8]=u*p+A*g+c*y,i},mulMat4Scalar:function(e,t,i){return i||(i=e),i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i},mulMat4v4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=t[0],r=t[1],n=t[2],o=t[3];return i[0]=e[0]*s+e[4]*r+e[8]*n+e[12]*o,i[1]=e[1]*s+e[5]*r+e[9]*n+e[13]*o,i[2]=e[2]*s+e[6]*r+e[10]*n+e[14]*o,i[3]=e[3]*s+e[7]*r+e[11]*n+e[15]*o,i},transposeMat4:function(e,t){var i=e[4],s=e[14],r=e[8],n=e[13],o=e[12],a=e[9];if(!t||e===t){var l=e[1],u=e[2],A=e[3],c=e[6],h=e[7],d=e[11];return e[1]=i,e[2]=r,e[3]=o,e[4]=l,e[6]=a,e[7]=n,e[8]=u,e[9]=c,e[11]=s,e[12]=A,e[13]=h,e[14]=d,e}return t[0]=e[0],t[1]=i,t[2]=r,t[3]=o,t[4]=e[1],t[5]=e[5],t[6]=a,t[7]=n,t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=s,t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},transposeMat3:function(e,t){if(t===e){var i=e[1],s=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=s,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},determinantMat4:function(e){var t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],o=e[5],a=e[6],l=e[7],u=e[8],A=e[9],c=e[10],h=e[11],d=e[12],p=e[13],f=e[14],v=e[15];return d*A*a*r-u*p*a*r-d*o*c*r+n*p*c*r+u*o*f*r-n*A*f*r-d*A*s*l+u*p*s*l+d*i*c*l-t*p*c*l-u*i*f*l+t*A*f*l+d*o*s*h-n*p*s*h-d*i*a*h+t*p*a*h+n*i*f*h-t*o*f*h-u*o*s*v+n*A*s*v+u*i*a*v-t*A*a*v-n*i*c*v+t*o*c*v},inverseMat4:function(e,t){t||(t=e);var i=e[0],s=e[1],r=e[2],n=e[3],o=e[4],a=e[5],l=e[6],u=e[7],A=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],v=e[14],g=e[15],m=i*a-s*o,_=i*l-r*o,y=i*u-n*o,b=s*l-r*a,B=s*u-n*a,w=r*u-n*l,x=A*f-c*p,P=A*v-h*p,C=A*g-d*p,M=c*v-h*f,F=c*g-d*f,E=h*g-d*v,k=1/(m*E-_*F+y*M+b*C-B*P+w*x);return t[0]=(a*E-l*F+u*M)*k,t[1]=(-s*E+r*F-n*M)*k,t[2]=(f*w-v*B+g*b)*k,t[3]=(-c*w+h*B-d*b)*k,t[4]=(-o*E+l*C-u*P)*k,t[5]=(i*E-r*C+n*P)*k,t[6]=(-p*w+v*y-g*_)*k,t[7]=(A*w-h*y+d*_)*k,t[8]=(o*F-a*C+u*x)*k,t[9]=(-i*F+s*C-n*x)*k,t[10]=(p*B-f*y+g*m)*k,t[11]=(-A*B+c*y-d*m)*k,t[12]=(-o*M+a*P-l*x)*k,t[13]=(i*M-s*P+r*x)*k,t[14]=(-p*b+f*_-v*m)*k,t[15]=(A*b-c*_+h*m)*k,t},traceMat4:function(e){return e[0]+e[5]+e[10]+e[15]},translationMat4v:function(e,t){var i=t||$.identityMat4();return i[12]=e[0],i[13]=e[1],i[14]=e[2],i},translationMat3v:function(e,t){var i=t||$.identityMat3();return i[6]=e[0],i[7]=e[1],i},translationMat4c:(O=new X(3),function(e,t,i,s){return O[0]=e,O[1]=t,O[2]=i,$.translationMat4v(O,s)}),translationMat4s:function(e,t){return $.translationMat4c(e,e,e,t)},translateMat4v:function(e,t){return $.translateMat4c(e[0],e[1],e[2],t)},translateMat4c:function(e,t,i,s){var r=s[3];s[0]+=r*e,s[1]+=r*t,s[2]+=r*i;var n=s[7];s[4]+=n*e,s[5]+=n*t,s[6]+=n*i;var o=s[11];s[8]+=o*e,s[9]+=o*t,s[10]+=o*i;var a=s[15];return s[12]+=a*e,s[13]+=a*t,s[14]+=a*i,s},setMat4Translation:function(e,t,i){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=e[15],i},rotationMat4v:function(e,t,i){var s,r,n,o,a,l,u=$.normalizeVec4([t[0],t[1],t[2],0],[]),A=Math.sin(e),c=Math.cos(e),h=1-c,d=u[0],p=u[1],f=u[2];return s=d*p,r=p*f,n=f*d,o=d*A,a=p*A,l=f*A,(i=i||$.mat4())[0]=h*d*d+c,i[1]=h*s+l,i[2]=h*n-a,i[3]=0,i[4]=h*s-l,i[5]=h*p*p+c,i[6]=h*r+o,i[7]=0,i[8]=h*n+a,i[9]=h*r-o,i[10]=h*f*f+c,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},rotationMat4c:function(e,t,i,s,r){return $.rotationMat4v(e,[t,i,s],r)},scalingMat4v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.identityMat4();return t[0]=e[0],t[5]=e[1],t[10]=e[2],t},scalingMat3v:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.identityMat3();return t[0]=e[0],t[4]=e[1],t},scalingMat4c:function(){var e=new X(3);return function(t,i,s,r){return e[0]=t,e[1]=i,e[2]=s,$.scalingMat4v(e,r)}}(),scaleMat4c:function(e,t,i,s){return s[0]*=e,s[4]*=t,s[8]*=i,s[1]*=e,s[5]*=t,s[9]*=i,s[2]*=e,s[6]*=t,s[10]*=i,s[3]*=e,s[7]*=t,s[11]*=i,s},scaleMat4v:function(e,t){var i=e[0],s=e[1],r=e[2];return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,t},scalingMat4s:function(e){return $.scalingMat4c(e,e,e)},rotationTranslationMat4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.mat4(),s=e[0],r=e[1],n=e[2],o=e[3],a=s+s,l=r+r,u=n+n,A=s*a,c=s*l,h=s*u,d=r*l,p=r*u,f=n*u,v=o*a,g=o*l,m=o*u;return i[0]=1-(d+f),i[1]=c+m,i[2]=h-g,i[3]=0,i[4]=c-m,i[5]=1-(A+f),i[6]=p+v,i[7]=0,i[8]=h+g,i[9]=p-v,i[10]=1-(A+d),i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i},mat4ToEuler:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=$.clamp,r=e[0],n=e[4],o=e[8],a=e[1],l=e[5],u=e[9],A=e[2],c=e[6],h=e[10];return"XYZ"===t?(i[1]=Math.asin(s(o,-1,1)),Math.abs(o)<.99999?(i[0]=Math.atan2(-u,h),i[2]=Math.atan2(-n,r)):(i[0]=Math.atan2(c,l),i[2]=0)):"YXZ"===t?(i[0]=Math.asin(-s(u,-1,1)),Math.abs(u)<.99999?(i[1]=Math.atan2(o,h),i[2]=Math.atan2(a,l)):(i[1]=Math.atan2(-A,r),i[2]=0)):"ZXY"===t?(i[0]=Math.asin(s(c,-1,1)),Math.abs(c)<.99999?(i[1]=Math.atan2(-A,h),i[2]=Math.atan2(-n,l)):(i[1]=0,i[2]=Math.atan2(a,r))):"ZYX"===t?(i[1]=Math.asin(-s(A,-1,1)),Math.abs(A)<.99999?(i[0]=Math.atan2(c,h),i[2]=Math.atan2(a,r)):(i[0]=0,i[2]=Math.atan2(-n,l))):"YZX"===t?(i[2]=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(i[0]=Math.atan2(-u,l),i[1]=Math.atan2(-A,r)):(i[0]=0,i[1]=Math.atan2(o,h))):"XZY"===t&&(i[2]=Math.asin(-s(n,-1,1)),Math.abs(n)<.99999?(i[0]=Math.atan2(c,l),i[1]=Math.atan2(o,r)):(i[0]=Math.atan2(-u,h),i[1]=0)),i},composeMat4:function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$.mat4();return $.quaternionToRotationMat4(t,s),$.scaleMat4v(i,s),$.translateMat4v(e,s),s},decomposeMat4:function(){var e=new X(3),t=new X(16);return function(i,s,r,n){e[0]=i[0],e[1]=i[1],e[2]=i[2];var o=$.lenVec3(e);e[0]=i[4],e[1]=i[5],e[2]=i[6];var a=$.lenVec3(e);e[8]=i[8],e[9]=i[9],e[10]=i[10];var l=$.lenVec3(e);$.determinantMat4(i)<0&&(o=-o),s[0]=i[12],s[1]=i[13],s[2]=i[14],t.set(i);var u=1/o,A=1/a,c=1/l;return t[0]*=u,t[1]*=u,t[2]*=u,t[4]*=A,t[5]*=A,t[6]*=A,t[8]*=c,t[9]*=c,t[10]*=c,$.mat4ToQuaternion(t,r),n[0]=o,n[1]=a,n[2]=l,this}}(),getColMat4:function(e,t){var i=4*t;return[e[i],e[i+1],e[i+2],e[i+3]]},setRowMat4:function(e,t,i){e[t]=i[0],e[t+4]=i[1],e[t+8]=i[2],e[t+12]=i[3]},lookAtMat4v:function(e,t,i,s){s||(s=$.mat4());var r,n,o,a,l,u,A,c,h,d,p=e[0],f=e[1],v=e[2],g=i[0],m=i[1],_=i[2],y=t[0],b=t[1],B=t[2];return p===y&&f===b&&v===B?$.identityMat4():(r=p-y,n=f-b,o=v-B,a=m*(o*=d=1/Math.sqrt(r*r+n*n+o*o))-_*(n*=d),l=_*(r*=d)-g*o,u=g*n-m*r,(d=Math.sqrt(a*a+l*l+u*u))?(a*=d=1/d,l*=d,u*=d):(a=0,l=0,u=0),A=n*u-o*l,c=o*a-r*u,h=r*l-n*a,(d=Math.sqrt(A*A+c*c+h*h))?(A*=d=1/d,c*=d,h*=d):(A=0,c=0,h=0),s[0]=a,s[1]=A,s[2]=r,s[3]=0,s[4]=l,s[5]=c,s[6]=n,s[7]=0,s[8]=u,s[9]=h,s[10]=o,s[11]=0,s[12]=-(a*p+l*f+u*v),s[13]=-(A*p+c*f+h*v),s[14]=-(r*p+n*f+o*v),s[15]=1,s)},lookAtMat4c:function(e,t,i,s,r,n,o,a,l){return $.lookAtMat4v([e,t,i],[s,r,n],[o,a,l],[])},orthoMat4c:function(e,t,i,s,r,n,o){o||(o=$.mat4());var a=t-e,l=s-i,u=n-r;return o[0]=2/a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2/l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=-2/u,o[11]=0,o[12]=-(e+t)/a,o[13]=-(s+i)/l,o[14]=-(n+r)/u,o[15]=1,o},frustumMat4v:function(e,t,i){i||(i=$.mat4());var s=[e[0],e[1],e[2],0],r=[t[0],t[1],t[2],0];$.addVec4(r,s,Y),$.subVec4(r,s,Z);var n=2*s[2],o=Z[0],a=Z[1],l=Z[2];return i[0]=n/o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n/a,i[6]=0,i[7]=0,i[8]=Y[0]/o,i[9]=Y[1]/a,i[10]=-Y[2]/l,i[11]=-1,i[12]=0,i[13]=0,i[14]=-n*r[2]/l,i[15]=0,i},frustumMat4:function(e,t,i,s,r,n,o){o||(o=$.mat4());var a=t-e,l=s-i,u=n-r;return o[0]=2*r/a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*r/l,o[6]=0,o[7]=0,o[8]=(t+e)/a,o[9]=(s+i)/l,o[10]=-(n+r)/u,o[11]=-1,o[12]=0,o[13]=0,o[14]=-n*r*2/u,o[15]=0,o},perspectiveMat4:function(e,t,i,s,r){var n=[],o=[];return n[2]=i,o[2]=s,o[1]=n[2]*Math.tan(e/2),n[1]=-o[1],o[0]=o[1]*t,n[0]=-o[0],$.frustumMat4v(n,o,r)},compareMat4:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},transformPoint3:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec3(),s=t[0],r=t[1],n=t[2];return i[0]=e[0]*s+e[4]*r+e[8]*n+e[12],i[1]=e[1]*s+e[5]*r+e[9]*n+e[13],i[2]=e[2]*s+e[6]*r+e[10]*n+e[14],i},transformPoint4:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4();return i[0]=e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],i[1]=e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],i[2]=e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],i[3]=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],i},transformPoints3:function(e,t,i){for(var s,r,n,o,a,l=i||[],u=t.length,A=e[0],c=e[1],h=e[2],d=e[3],p=e[4],f=e[5],v=e[6],g=e[7],m=e[8],_=e[9],y=e[10],b=e[11],B=e[12],w=e[13],x=e[14],P=e[15],C=0;C2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2];e[3];var c=e[4],h=e[5],d=e[6];e[7];var p=e[8],f=e[9],v=e[10];e[11];var g=e[12],m=e[13],_=e[14];for(e[15],i=0;i2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2],c=e[3],h=e[4],d=e[5],p=e[6],f=e[7],v=e[8],g=e[9],m=e[10],_=e[11],y=e[12],b=e[13],B=e[14],w=e[15];for(i=0;i3&&void 0!==arguments[3]?arguments[3]:e,r=Math.cos(i),n=Math.sin(i),o=e[0]-t[0],a=e[1]-t[1];return s[0]=o*r-a*n+t[0],s[1]=o*n+a*r+t[1],e},rotateVec3X:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[0],n[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),n[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},rotateVec3Y:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),n[1]=r[1],n[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},rotateVec3Z:function(e,t,i,s){var r=[],n=[];return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],n[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),n[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),n[2]=r[2],s[0]=n[0]+t[0],s[1]=n[1]+t[1],s[2]=n[2]+t[2],s},projectVec4:function(e,t){var i=1/e[3];return(t=t||$.vec2())[0]=e[0]*i,t[1]=e[1]*i,t},unprojectVec3:(R=new X(16),L=new X(16),U=new X(16),function(e,t,i,s){return this.transformVec3(this.mulMat4(this.inverseMat4(t,R),this.inverseMat4(i,L),U),e,s)}),lerpVec3:function(e,t,i,s,r,n){var o=n||$.vec3(),a=(e-t)/(i-t);return o[0]=s[0]+a*(r[0]-s[0]),o[1]=s[1]+a*(r[1]-s[1]),o[2]=s[2]+a*(r[2]-s[2]),o},lerpMat4:function(e,t,i,s,r,n){var o=n||$.mat4(),a=(e-t)/(i-t);return o[0]=s[0]+a*(r[0]-s[0]),o[1]=s[1]+a*(r[1]-s[1]),o[2]=s[2]+a*(r[2]-s[2]),o[3]=s[3]+a*(r[3]-s[3]),o[4]=s[4]+a*(r[4]-s[4]),o[5]=s[5]+a*(r[5]-s[5]),o[6]=s[6]+a*(r[6]-s[6]),o[7]=s[7]+a*(r[7]-s[7]),o[8]=s[8]+a*(r[8]-s[8]),o[9]=s[9]+a*(r[9]-s[9]),o[10]=s[10]+a*(r[10]-s[10]),o[11]=s[11]+a*(r[11]-s[11]),o[12]=s[12]+a*(r[12]-s[12]),o[13]=s[13]+a*(r[13]-s[13]),o[14]=s[14]+a*(r[14]-s[14]),o[15]=s[15]+a*(r[15]-s[15]),o},flatten:function(e){var t,i,s,r,n,o=[];for(t=0,i=e.length;t0&&void 0!==arguments[0]?arguments[0]:$.vec4();return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},eulerToQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=e[0]*$.DEGTORAD/2,r=e[1]*$.DEGTORAD/2,n=e[2]*$.DEGTORAD/2,o=Math.cos(s),a=Math.cos(r),l=Math.cos(n),u=Math.sin(s),A=Math.sin(r),c=Math.sin(n);return"XYZ"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l-u*A*c):"YXZ"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l+u*A*c):"ZXY"===t?(i[0]=u*a*l-o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l-u*A*c):"ZYX"===t?(i[0]=u*a*l-o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l+u*A*c):"YZX"===t?(i[0]=u*a*l+o*A*c,i[1]=o*A*l+u*a*c,i[2]=o*a*c-u*A*l,i[3]=o*a*l-u*A*c):"XZY"===t&&(i[0]=u*a*l-o*A*c,i[1]=o*A*l-u*a*c,i[2]=o*a*c+u*A*l,i[3]=o*a*l+u*A*c),i},mat4ToQuaternion:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),s=e[0],r=e[4],n=e[8],o=e[1],a=e[5],l=e[9],u=e[2],A=e[6],c=e[10],h=s+a+c;return h>0?(t=.5/Math.sqrt(h+1),i[3]=.25/t,i[0]=(A-l)*t,i[1]=(n-u)*t,i[2]=(o-r)*t):s>a&&s>c?(t=2*Math.sqrt(1+s-a-c),i[3]=(A-l)/t,i[0]=.25*t,i[1]=(r+o)/t,i[2]=(n+u)/t):a>c?(t=2*Math.sqrt(1+a-s-c),i[3]=(n-u)/t,i[0]=(r+o)/t,i[1]=.25*t,i[2]=(l+A)/t):(t=2*Math.sqrt(1+c-s-a),i[3]=(o-r)/t,i[0]=(n+u)/t,i[1]=(l+A)/t,i[2]=.25*t),i},vec3PairToQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=Math.sqrt($.dotVec3(e,e)*$.dotVec3(t,t)),r=s+$.dotVec3(e,t);return r<1e-8*s?(r=0,Math.abs(e[0])>Math.abs(e[2])?(i[0]=-e[1],i[1]=e[0],i[2]=0):(i[0]=0,i[1]=-e[2],i[2]=e[1])):$.cross3Vec3(e,t,i),i[3]=r,$.normalizeQuaternion(i)},angleAxisToQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),i=e[3]/2,s=Math.sin(i);return t[0]=s*e[0],t[1]=s*e[1],t[2]=s*e[2],t[3]=Math.cos(i),t},quaternionToEuler:function(){var e=new X(16);return function(t,i,s){return s=s||$.vec3(),$.quaternionToRotationMat4(t,e),$.mat4ToEuler(e,i,s),s}}(),mulQuaternions:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec4(),s=e[0],r=e[1],n=e[2],o=e[3],a=t[0],l=t[1],u=t[2],A=t[3];return i[0]=o*a+s*A+r*u-n*l,i[1]=o*l+r*A+n*a-s*u,i[2]=o*u+n*A+s*l-r*a,i[3]=o*A-s*a-r*l-n*u,i},vec3ApplyQuaternion:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$.vec3(),s=t[0],r=t[1],n=t[2],o=e[0],a=e[1],l=e[2],u=e[3],A=u*s+a*n-l*r,c=u*r+l*s-o*n,h=u*n+o*r-a*s,d=-o*s-a*r-l*n;return i[0]=A*u+d*-o+c*-l-h*-a,i[1]=c*u+d*-a+h*-o-A*-l,i[2]=h*u+d*-l+A*-a-c*-o,i},quaternionToMat4:function(e,t){t=$.identityMat4(t);var i=e[0],s=e[1],r=e[2],n=e[3],o=2*i,a=2*s,l=2*r,u=o*n,A=a*n,c=l*n,h=o*i,d=a*i,p=l*i,f=a*s,v=l*s,g=l*r;return t[0]=1-(f+g),t[1]=d+c,t[2]=p-A,t[4]=d-c,t[5]=1-(h+g),t[6]=v+u,t[8]=p+A,t[9]=v-u,t[10]=1-(h+f),t},quaternionToRotationMat4:function(e,t){var i=e[0],s=e[1],r=e[2],n=e[3],o=i+i,a=s+s,l=r+r,u=i*o,A=i*a,c=i*l,h=s*a,d=s*l,p=r*l,f=n*o,v=n*a,g=n*l;return t[0]=1-(h+p),t[4]=A-g,t[8]=c+v,t[1]=A+g,t[5]=1-(u+p),t[9]=d-f,t[2]=c-v,t[6]=d+f,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},normalizeQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,i=$.lenVec4([e[0],e[1],e[2],e[3]]);return t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i,t[3]=e[3]/i,t},conjugateQuaternion:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},inverseQuaternion:function(e,t){return $.normalizeQuaternion($.conjugateQuaternion(e,t))},quaternionToAngleAxis:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec4(),i=(e=$.normalizeQuaternion(e,q))[3],s=2*Math.acos(i),r=Math.sqrt(1-i*i);return r<.001?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r),t[3]=s,t},AABB3:function(e){return new X(e||6)},AABB2:function(e){return new X(e||4)},OBB3:function(e){return new X(e||32)},OBB2:function(e){return new X(e||16)},Sphere3:function(e,t,i,s){return new X([e,t,i,s])},transformOBB3:function(e,t){var i,s,r,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,a=t.length,l=e[0],u=e[1],A=e[2],c=e[3],h=e[4],d=e[5],p=e[6],f=e[7],v=e[8],g=e[9],m=e[10],_=e[11],y=e[12],b=e[13],B=e[14],w=e[15];for(i=0;ia?o:a,n[1]+=l>u?l:u,n[2]+=A>c?A:c,Math.abs($.lenVec3(n))}}(),getAABB3Area:function(e){return(e[3]-e[0])*(e[4]-e[1])*(e[5]-e[2])},getAABB3Center:function(e,t){var i=t||$.vec3();return i[0]=(e[0]+e[3])/2,i[1]=(e[1]+e[4])/2,i[2]=(e[2]+e[5])/2,i},getAABB2Center:function(e,t){var i=t||$.vec2();return i[0]=(e[2]+e[0])/2,i[1]=(e[3]+e[1])/2,i},collapseAABB3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$.AABB3();return e[0]=$.MAX_DOUBLE,e[1]=$.MAX_DOUBLE,e[2]=$.MAX_DOUBLE,e[3]=$.MIN_DOUBLE,e[4]=$.MIN_DOUBLE,e[5]=$.MIN_DOUBLE,e},AABB3ToOBB3:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.OBB3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t[4]=e[3],t[5]=e[1],t[6]=e[2],t[7]=1,t[8]=e[3],t[9]=e[4],t[10]=e[2],t[11]=1,t[12]=e[0],t[13]=e[4],t[14]=e[2],t[15]=1,t[16]=e[0],t[17]=e[1],t[18]=e[5],t[19]=1,t[20]=e[3],t[21]=e[1],t[22]=e[5],t[23]=1,t[24]=e[3],t[25]=e[4],t[26]=e[5],t[27]=1,t[28]=e[0],t[29]=e[4],t[30]=e[5],t[31]=1,t},positions3ToAABB3:function(){var e=new X(3);return function(t,i,s){i=i||$.AABB3();for(var r,n,o,a=$.MAX_DOUBLE,l=$.MAX_DOUBLE,u=$.MAX_DOUBLE,A=$.MIN_DOUBLE,c=$.MIN_DOUBLE,h=$.MIN_DOUBLE,d=0,p=t.length;dA&&(A=r),n>c&&(c=n),o>h&&(h=o);return i[0]=a,i[1]=l,i[2]=u,i[3]=A,i[4]=c,i[5]=h,i}}(),OBB3ToAABB3:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB3(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MAX_DOUBLE,l=$.MIN_DOUBLE,u=$.MIN_DOUBLE,A=$.MIN_DOUBLE,c=0,h=e.length;cl&&(l=t),i>u&&(u=i),s>A&&(A=s);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r[4]=u,r[5]=A,r},points3ToAABB3:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB3(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MAX_DOUBLE,l=$.MIN_DOUBLE,u=$.MIN_DOUBLE,A=$.MIN_DOUBLE,c=0,h=e.length;cl&&(l=t),i>u&&(u=i),s>A&&(A=s);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r[4]=u,r[5]=A,r},points3ToSphere3:function(){var e=new X(3);return function(t,i){i=i||$.vec4();var s,r=0,n=0,o=0,a=t.length;for(s=0;su&&(u=l);return i[3]=u,i}}(),positions3ToSphere3:function(){var e=new X(3),t=new X(3);return function(i,s){s=s||$.vec4();var r,n=0,o=0,a=0,l=i.length,u=0;for(r=0;ru&&(u=A);return s[3]=u,s}}(),OBB3ToSphere3:function(){var e=new X(3),t=new X(3);return function(i,s){s=s||$.vec4();var r,n=0,o=0,a=0,l=i.length,u=l/4;for(r=0;rc&&(c=A);return s[3]=c,s}}(),getSphere3Center:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3();return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},getPositionsCenter:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(),i=0,s=0,r=0,n=0,o=e.length;nt[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]i&&(e[0]=i),e[1]>s&&(e[1]=s),e[2]>r&&(e[2]=r),e[3]0&&void 0!==arguments[0]?arguments[0]:$.AABB2();return e[0]=$.MAX_DOUBLE,e[1]=$.MAX_DOUBLE,e[2]=$.MIN_DOUBLE,e[3]=$.MIN_DOUBLE,e},point3AABB3Intersect:function(e,t){return e[0]>t[0]||e[3]t[1]||e[4]t[2]||e[5]0?(s=e[0]*i[0],r=e[0]*i[3]):(s=e[0]*i[3],r=e[0]*i[0]),e[1]>0?(s+=e[1]*i[1],r+=e[1]*i[4]):(s+=e[1]*i[4],r+=e[1]*i[1]),e[2]>0?(s+=e[2]*i[2],r+=e[2]*i[5]):(s+=e[2]*i[5],r+=e[2]*i[2]),s<=-t&&r<=-t?-1:s>=-t&&r>=-t?1:0},OBB3ToAABB2:function(e){for(var t,i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.AABB2(),n=$.MAX_DOUBLE,o=$.MAX_DOUBLE,a=$.MIN_DOUBLE,l=$.MIN_DOUBLE,u=0,A=e.length;ua&&(a=t),i>l&&(l=i);return r[0]=n,r[1]=o,r[2]=a,r[3]=l,r},expandAABB2:function(e,t){return e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]3&&void 0!==arguments[3]?arguments[3]:e,r=.5*(e[0]+1),n=.5*(e[1]+1),o=.5*(e[2]+1),a=.5*(e[3]+1);return s[0]=Math.floor(r*t),s[1]=i-Math.floor(a*i),s[2]=Math.floor(o*t),s[3]=i-Math.floor(n*i),s},tangentQuadraticBezier:function(e,t,i,s){return 2*(1-e)*(i-t)+2*e*(s-i)},tangentQuadraticBezier3:function(e,t,i,s,r){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*s*(1-e)-3*e*e*s+3*e*e*r},tangentSpline:function(e){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},catmullRomInterpolate:function(e,t,i,s,r){var n=.5*(i-e),o=.5*(s-t),a=r*r;return(2*t-2*i+n+o)*(r*a)+(-3*t+3*i-2*n-o)*a+n*r+t},b2p0:function(e,t){var i=1-e;return i*i*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,i,s){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,s)},b3p0:function(e,t){var i=1-e;return i*i*i*t},b3p1:function(e,t){var i=1-e;return 3*i*i*e*t},b3p2:function(e,t){return 3*(1-e)*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,i,s,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,s)+this.b3p3(e,r)},triangleNormal:function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$.vec3(),r=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2],a=i[0]-e[0],l=i[1]-e[1],u=i[2]-e[2],A=n*u-o*l,c=o*a-r*u,h=r*l-n*a,d=Math.sqrt(A*A+c*c+h*h);return 0===d?(s[0]=0,s[1]=0,s[2]=0):(s[0]=A/d,s[1]=c/d,s[2]=h/d),s},rayTriangleIntersect:function(){var e=new X(3),t=new X(3),i=new X(3),s=new X(3),r=new X(3);return function(n,o,a,l,u,A){A=A||$.vec3();var c=$.subVec3(l,a,e),h=$.subVec3(u,a,t),d=$.cross3Vec3(o,h,i),p=$.dotVec3(c,d);if(p<1e-6)return null;var f=$.subVec3(n,a,s),v=$.dotVec3(f,d);if(v<0||v>p)return null;var g=$.cross3Vec3(f,c,r),m=$.dotVec3(o,g);if(m<0||v+m>p)return null;var _=$.dotVec3(h,g)/p;return A[0]=n[0]+_*o[0],A[1]=n[1]+_*o[1],A[2]=n[2]+_*o[2],A}}(),rayPlaneIntersect:function(){var e=new X(3),t=new X(3),i=new X(3),s=new X(3);return function(r,n,o,a,l,u){u=u||$.vec3(),n=$.normalizeVec3(n,e);var A=$.subVec3(a,o,t),c=$.subVec3(l,o,i),h=$.cross3Vec3(A,c,s);$.normalizeVec3(h,h);var d=-$.dotVec3(o,h),p=-($.dotVec3(r,h)+d)/$.dotVec3(n,h);return u[0]=r[0]+p*n[0],u[1]=r[1]+p*n[1],u[2]=r[2]+p*n[2],u}}(),cartesianToBarycentric:function(){var e=new X(3),t=new X(3),i=new X(3);return function(s,r,n,o,a){var l=$.subVec3(o,r,e),u=$.subVec3(n,r,t),A=$.subVec3(s,r,i),c=$.dotVec3(l,l),h=$.dotVec3(l,u),d=$.dotVec3(l,A),p=$.dotVec3(u,u),f=$.dotVec3(u,A),v=c*p-h*h;if(0===v)return null;var g=1/v,m=(p*d-h*f)*g,_=(c*f-h*d)*g;return a[0]=1-m-_,a[1]=_,a[2]=m,a}}(),barycentricInsideTriangle:function(e){var t=e[1],i=e[2];return i>=0&&t>=0&&i+t<1},barycentricToCartesian:function(e,t,i,s){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:$.vec3(),n=e[0],o=e[1],a=e[2];return r[0]=t[0]*n+i[0]*o+s[0]*a,r[1]=t[1]*n+i[1]*o+s[1]*a,r[2]=t[2]*n+i[2]*o+s[2]*a,r},mergeVertices:function(e,t,i,s){var r,n,o,a,l,u,A={},c=[],h=[],d=t?[]:null,p=i?[]:null,f=[],v=Math.pow(10,4),g=0;for(l=0,u=e.length;l>24&255,o=c>>16&255,n=c>>8&255,r=255&c,s=3*t[p],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,s=3*t[p+1],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,s=3*t[p+2],u[h++]=e[s],u[h++]=e[s+1],u[h++]=e[s+2],A[d++]=r,A[d++]=n,A[d++]=o,A[d++]=a,c++;return{positions:u,colors:A}},faceToVertexNormals:function(e,t){var i,s,r,n,o,a,l,u,A,c,h,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=d.smoothNormalsAngleThreshold||20,f={},v=[],g={},m=4,_=Math.pow(10,m);for(l=0,A=e.length;ll[3]&&(l[3]=r[h]),r[h+1]l[4]&&(l[4]=r[h+1]),r[h+2]l[5]&&(l[5]=r[h+2])}if(i.length<20||n>10)return u.triangles=i,u.leaf=!0,u;e[0]=l[3]-l[0],e[1]=l[4]-l[1],e[2]=l[5]-l[2];var d=0;e[1]>e[d]&&(d=1),e[2]>e[d]&&(d=2),u.splitDim=d;var p=(l[d]+l[d+3])/2,f=new Array(i.length),v=0,g=new Array(i.length),m=0;for(o=0,a=i.length;o2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));var n=Math.sqrt(i*i+s*s+r*r);return t[0]=i/n,t[1]=s/n,t[2]=r/n,t},octDecodeVec2s:function(e,t){for(var i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(n))*(o>=0?1:-1));var l=Math.sqrt(n*n+o*o+a*a);t[s+0]=n/l,t[s+1]=o/l,t[s+2]=a/l,s+=3}return t}};$.buildEdgeIndices=function(){var e=[],t=[],i=[],s=[],r=[],n=0,o=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),u=$.vec3(),A=$.vec3(),c=$.vec3(),h=$.vec3(),d=$.vec3(),p=$.vec3(),f=$.vec3();return function(v,g,m,_){!function(r,n){var o,a,l,u,A,c,h={},d=Math.pow(10,4),p=0;for(A=0,c=r.length;AI)||(F=i[P.index1],E=i[P.index2],(!S&&F>65535||E>65535)&&(S=!0),k.push(F),k.push(E));return S?new Uint32Array(k):new Uint16Array(k)}}(),$.planeClipsPositions3=function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,r=0,n=i.length;r=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&$.containsAABB3(e.left.aabb,s))this._insertEntity(e.left,t,i+1);else if(e.right&&$.containsAABB3(e.right.aabb,s))this._insertEntity(e.right,t,i+1);else{var r=e.aabb;ee[0]=r[3]-r[0],ee[1]=r[4]-r[1],ee[2]=r[5]-r[2];var n=0;if(ee[1]>ee[n]&&(n=1),ee[2]>ee[n]&&(n=2),!e.left){var o=r.slice();if(o[n+3]=(r[n]+r[n+3])/2,e.left={aabb:o},$.containsAABB3(o,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){var a=r.slice();if(a[n]=(r[n]+r[n+3])/2,e.right={aabb:a},$.containsAABB3(a,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}}},{key:"destroy",value:function(){var e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}}]),e}(),ie=function(){function e(){x(this,e),this._head=[],this._headLength=0,this._tail=[],this._index=0,this._length=0}return C(e,[{key:"length",get:function(){return this._length}},{key:"shift",value:function(){if(this._index>=this._headLength){var e=this._head;if(e.length=0,this._head=this._tail,this._tail=e,this._index=0,this._headLength=this._head.length,!this._headLength)return}var t=this._head[this._index];return this._index<0?delete this._head[this._index++]:this._head[this._index++]=void 0,this._length--,t}},{key:"push",value:function(e){return this._length++,this._tail.push(e),this}},{key:"unshift",value:function(e){return this._head[--this._index]=e,this._length++,this}}]),e}(),se={build:{version:"0.8"},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{scenes:0,models:0,meshes:0,objects:0},memory:{meshes:0,positions:0,colors:0,normals:0,uvs:0,indices:0,textures:0,transforms:0,materials:0,programs:0},frame:{frameCount:0,fps:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,tasksRun:0,tasksScheduled:0}};var re=[["0",10],["A",26],["a",26],["_",1],["$",1]].map((function(e){for(var t=[],i=e[0].charCodeAt(0),s=i+e[1],r=i;r1&&void 0!==arguments[1]?arguments[1]:null;ce.push(e),ce.push(t)},this.runTasks=function(){for(var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,s=(new Date).getTime(),r=0;ce.length>0&&(i<0||s0&&ae>0){var t=1e3/ae;fe+=t,de.push(t),de.length>=30&&(fe-=de.shift()),se.frame.fps=Math.round(fe/de.length)}for(var i in _e.scenes)_e.scenes[i].compile();be(e),pe=e};ve=function(){ye()},ge=100,me=Date.now()+ge,function e(){var t=Date.now()-me;ve(),me+=ge,setTimeout(e,Math.max(0,ge-t))}();function be(e){var t=_e.runTasks(e+10),i=_e.getNumTasks();se.frame.tasksRun=t,se.frame.tasksScheduled=i,se.frame.tasksBudget=10}!function e(){var t=Date.now();if(ae=t-pe,pe>0&&ae>0){var i=1e3/ae;fe+=i,de.push(i),de.length>=30&&(fe-=de.shift()),se.frame.fps=Math.round(fe/de.length)}be(t),function(e){for(var t in he.time=e,_e.scenes)if(_e.scenes.hasOwnProperty(t)){var i=_e.scenes[t];he.sceneId=t,he.startTime=i.startTime,he.deltaTime=null!=he.prevTime?he.time-he.prevTime:0,i.fire("tick",he,!0)}he.prevTime=e}(t),function(){var e,t,i,s,r,n=_e.scenes,o=!1;for(r in n)n.hasOwnProperty(r)&&(e=n[r],(t=ue[r])||(t=ue[r]={}),i=e.ticksPerOcclusionTest,t.ticksPerOcclusionTest!==i&&(t.ticksPerOcclusionTest=i,t.renderCountdown=i),--e.occlusionTestCountdown<=0&&(e.doOcclusionTest(),e.occlusionTestCountdown=i),s=e.ticksPerRender,t.ticksPerRender!==s&&(t.ticksPerRender=s,t.renderCountdown=s),0==--t.renderCountdown&&(e.render(o),t.renderCountdown=s))}(),void 0!==window.requestPostAnimationFrame?window.requestPostAnimationFrame(ye):requestAnimationFrame(e)}();var Be=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,e),this.scene=null,"Scene"===this.type)this.scene=this,this.viewer=i.viewer;else{if("Scene"===t.type)this.scene=t;else{if(!(t instanceof e))throw"Invalid param: owner must be a Component";this.scene=t.scene}this._owner=t}this._dontClear=!!i.dontClear,this._renderer=this.scene._renderer,this.meta=i.meta||{},this.id=i.id,this.destroyed=!1,this._attached={},this._attachments=null,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,this._ownedComponents=null,this!==this.scene&&this.scene._addComponent(this),this._updateScheduled=!1,t&&t._own(this)}return C(e,[{key:"type",get:function(){return"Component"}},{key:"isComponent",get:function(){return!0}},{key:"glRedraw",value:function(){this._renderer&&(this._renderer.imageDirty(),this.castsShadow&&this._renderer.shadowsDirty())}},{key:"glResort",value:function(){this._renderer&&this._renderer.needStateSort()}},{key:"owner",get:function(){return this._owner}},{key:"isType",value:function(e){return this.type===e}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);var s,r=this._eventSubs[e];if(r)for(var n in r)r.hasOwnProperty(n)&&(s=r[n],this._eventCallDepth++,this._eventCallDepth<300?s.callback.call(s.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}},{key:"on",value:function(e,t,i){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new Q),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});var s=this._eventSubs[e];s?this._eventSubsNum[e]++:(s={},this._eventSubs[e]=s,this._eventSubsNum[e]=1);var r=this._subIdMap.addItem();s[r]={callback:t,scope:i||this},this._subIdEvents[r]=e;var n=this._events[e];return void 0!==n&&t.call(i||this,n),r}},{key:"off",value:function(e){if(null!=e&&this._subIdEvents){var t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];var i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}}},{key:"once",value:function(e,t,i){var s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}},{key:"hasSubs",value:function(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}},{key:"log",value:function(e){e="[LOG]"+this._message(e),window.console.log(e),this.scene.fire("log",e)}},{key:"_message",value:function(e){return" ["+this.type+" "+le.inQuotes(this.id)+"]: "+e}},{key:"warn",value:function(e){e="[WARN]"+this._message(e),window.console.warn(e),this.scene.fire("warn",e)}},{key:"error",value:function(e){e="[ERROR]"+this._message(e),window.console.error(e),this.scene.fire("error",e)}},{key:"_attach",value:function(e){var t=e.name;if(t){var i=e.component,s=e.sceneDefault,r=e.sceneSingleton,n=e.type,o=e.on,a=!1!==e.recompiles;if(i&&(le.isNumeric(i)||le.isString(i))){var l=i;if(!(i=this.scene.components[l]))return void this.error("Component not found: "+le.inQuotes(l))}if(!i)if(!0===r){var u=this.scene.types[n];for(var A in u)if(u.hasOwnProperty){i=u[A];break}if(!i)return this.error("Scene has no default component for '"+t+"'"),null}else if(!0===s&&!(i=this.scene[t]))return this.error("Scene has no default component for '"+t+"'"),null;if(i){if(i.scene.id!==this.scene.id)return void this.error("Not in same scene: "+i.type+" "+le.inQuotes(i.id));if(n&&!i.isType(n))return void this.error("Expected a "+n+" type or subtype: "+i.type+" "+le.inQuotes(i.id))}this._attachments||(this._attachments={});var c,h,d,p=this._attached[t];if(p){if(i&&p.id===i.id)return;var f=this._attachments[p.id];for(h=0,d=(c=f.subs).length;h=0?1:0,this.testVertex[1]=this.normal[1]>=0?1:0,this.testVertex[2]=this.normal[2]>=0?1:0}}]),e}(),Me=C((function e(){x(this,e),this.planes=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce]}));function Fe(e,t,i){var s=$.mulMat4(i,t,Pe),r=s[0],n=s[1],o=s[2],a=s[3],l=s[4],u=s[5],A=s[6],c=s[7],h=s[8],d=s[9],p=s[10],f=s[11],v=s[12],g=s[13],m=s[14],_=s[15];e.planes[0].set(a-r,c-l,f-h,_-v),e.planes[1].set(a+r,c+l,f+h,_+v),e.planes[2].set(a-n,c-u,f-d,_-g),e.planes[3].set(a+n,c+u,f+d,_+g),e.planes[4].set(a-o,c-A,f-p,_-m),e.planes[5].set(a+o,c+A,f+p,_+m)}function Ee(e,t){var i=Me.INSIDE,s=we,r=xe;s[0]=t[0],s[1]=t[1],s[2]=t[2],r[0]=t[3],r[1]=t[4],r[2]=t[5];for(var n=[s,r],o=0;o<6;++o){var a=e.planes[o];if(a.normal[0]*n[a.testVertex[0]][0]+a.normal[1]*n[a.testVertex[1]][1]+a.normal[2]*n[a.testVertex[2]][2]+a.offset<0)return Me.OUTSIDE;a.normal[0]*n[1-a.testVertex[0]][0]+a.normal[1]*n[1-a.testVertex[1]][1]+a.normal[2]*n[1-a.testVertex[2]][2]+a.offset<0&&(i=Me.INTERSECT)}return i}Me.INSIDE=0,Me.INTERSECT=1,Me.OUTSIDE=2;var ke=function(e){g(i,Be);var t=_(i);function i(){var e,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(x(this,i),!s.viewer)throw"[MarqueePicker] Missing config: viewer";if(!s.objectsKdTree3)throw"[MarqueePicker] Missing config: objectsKdTree3";return(e=t.call(this,s.viewer.scene,s)).viewer=s.viewer,e._objectsKdTree3=s.objectsKdTree3,e._canvasMarqueeCorner1=$.vec2(),e._canvasMarqueeCorner2=$.vec2(),e._canvasMarquee=$.AABB2(),e._marqueeFrustum=new Me,e._marqueeFrustumProjMat=$.mat4(),e._pickMode=!1,e._marqueeElement=document.createElement("div"),document.body.appendChild(e._marqueeElement),e._marqueeElement.style.position="absolute",e._marqueeElement.style["z-index"]="40000005",e._marqueeElement.style.width="8px",e._marqueeElement.style.height="8px",e._marqueeElement.style.visibility="hidden",e._marqueeElement.style.top="0px",e._marqueeElement.style.left="0px",e._marqueeElement.style["box-shadow"]="0 2px 5px 0 #182A3D;",e._marqueeElement.style.opacity=1,e._marqueeElement.style["pointer-events"]="none",e}return C(i,[{key:"setMarqueeCorner1",value:function(e){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(e),this._updateMarquee()}},{key:"setMarqueeCorner2",value:function(e){this._canvasMarqueeCorner2.set(e),this._updateMarquee()}},{key:"setMarquee",value:function(e,t){this._canvasMarqueeCorner1.set(e),this._canvasMarqueeCorner2.set(t),this._updateMarquee()}},{key:"setMarqueeVisible",value:function(e){this._marqueVisible=e,this._marqueeElement.style.visibility=e?"visible":"hidden"}},{key:"getMarqueeVisible",value:function(){return this._marqueVisible}},{key:"setPickMode",value:function(e){if(e!==i.PICK_MODE_INSIDE&&e!==i.PICK_MODE_INTERSECTS)throw"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS";e!==this._pickMode&&(this._marqueeElement.style["background-image"]=e===i.PICK_MODE_INSIDE?"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\")":"url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\")",this._pickMode=e)}},{key:"getPickMode",value:function(){return this._pickMode}},{key:"clear",value:function(){this.fire("clear",{})}},{key:"pick",value:function(){var e=this;this._updateMarquee(),this._buildMarqueeFrustum();var t=[];return(this._canvasMarquee[2]-this._canvasMarquee[0]>3||this._canvasMarquee[3]-this._canvasMarquee[1]>3)&&function s(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Me.INTERSECT;if(n===Me.INTERSECT&&(n=Ee(e._marqueeFrustum,r.aabb)),n!==Me.OUTSIDE){if(r.entities)for(var o=r.entities,a=0,l=o.length;a3||i>3)&&c.pick()}})),document.addEventListener("mouseup",(function(e){s.getActive()&&0===e.button&&(clearTimeout(A),d&&(c.setMarqueeVisible(!1),d=!1,p=!1,f=!0,c.viewer.cameraControl.pointerEnabled=!0))}),!0),h.addEventListener("mousemove",(function(e){s.getActive()&&0===e.button&&p&&(clearTimeout(A),d&&(o=e.pageX,a=e.pageY,u=e.offsetX,c.setMarqueeVisible(!0),c.setMarqueeCorner2([o,a]),c.setPickMode(l1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.viewer=t,this.scene=this.viewer.scene,this._circleDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._circleDiv,this.viewer.scene.canvas.canvas),this._circleDiv.style.backgroundColor="transparent",this._circleDiv.style.border="2px solid green",this._circleDiv.style.borderRadius="50px",this._circleDiv.style.width="50px",this._circleDiv.style.height="50px",this._circleDiv.style.margin="-200px -200px",this._circleDiv.style.zIndex="100000",this._circleDiv.style.position="absolute",this._circleDiv.style.pointerEvents="none",this._circlePos=null,this._circleMaxRadius=200,this._circleMinRadius=2,this._active=!1!==i.active,this._visible=!1,this._running=!1,this._destroyed=!1}return C(e,[{key:"start",value:function(e){var t=this;if(!this._destroyed){this._circlePos=e,this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius="".concat(this._circleRadius,"px"),this._circleDiv.style.marginLeft="".concat(this._circlePos[0]-this._circleRadius,"px"),this._circleDiv.style.marginTop="".concat(this._circlePos[1]-this._circleRadius,"px");var i,s=this._circleMaxRadius;this._running=!0,requestAnimationFrame((function e(r){if(t._running){i||(i=r);var n=r-i,o=Math.min(n/300,1),a=s+(2-s)*o;t._circleRadius=a,t._circleDiv.style.width="".concat(t._circleRadius,"px"),t._circleDiv.style.height="".concat(t._circleRadius,"px"),t._circleDiv.style.marginLeft="".concat(t._circlePos[0]-t._circleRadius/2,"px"),t._circleDiv.style.marginTop="".concat(t._circlePos[1]-t._circleRadius/2,"px"),o<1&&requestAnimationFrame(e)}})),this._circleDiv.style.visibility="visible"}}},{key:"stop",value:function(){this._destroyed||(this._running=!1,this._circleRadius=this._circleMaxRadius,this._circleDiv.style.borderRadius="".concat(this._circleRadius,"px"),this._circleDiv.style.visibility="hidden")}},{key:"durationMs",get:function(){return this._durationMs},set:function(e){this.stop(),this._durationMs=e}},{key:"destroy",value:function(){this._destroyed||(this.stop(),document.body.removeChild(this._circleDiv),this._destroyed=!0)}}]),e}(),Se=function(){function e(t,i,s){x(this,e),this.id=s&&s.id?s.id:t,this.viewer=i,this._subIdMap=null,this._subIdEvents=null,this._eventSubs=null,this._eventSubsNum=null,this._events=null,this._eventCallDepth=0,i.addPlugin(this)}return C(e,[{key:"scheduleTask",value:function(e){_e.scheduleTask(e,null)}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={},this._eventSubsNum={}),!0!==i&&(this._events[e]=t||!0);var s,r=this._eventSubs[e];if(r)for(var n in r)r.hasOwnProperty(n)&&(s=r[n],this._eventCallDepth++,this._eventCallDepth<300?s.callback.call(s.scope,t):this.error("fire: potential stack overflow from recursive event '"+e+"' - dropping this event"),this._eventCallDepth--)}},{key:"on",value:function(e,t,i){this._events||(this._events={}),this._subIdMap||(this._subIdMap=new Q),this._subIdEvents||(this._subIdEvents={}),this._eventSubs||(this._eventSubs={}),this._eventSubsNum||(this._eventSubsNum={});var s=this._eventSubs[e];s?this._eventSubsNum[e]++:(s={},this._eventSubs[e]=s,this._eventSubsNum[e]=1);var r=this._subIdMap.addItem();s[r]={callback:t,scope:i||this},this._subIdEvents[r]=e;var n=this._events[e];return void 0!==n&&t.call(i||this,n),r}},{key:"off",value:function(e){if(null!=e&&this._subIdEvents){var t=this._subIdEvents[e];if(t){delete this._subIdEvents[e];var i=this._eventSubs[t];i&&(delete i[e],this._eventSubsNum[t]--),this._subIdMap.removeItem(e)}}}},{key:"once",value:function(e,t,i){var s=this,r=this.on(e,(function(e){s.off(r),t.call(i||this,e)}),i)}},{key:"hasSubs",value:function(e){return this._eventSubsNum&&this._eventSubsNum[e]>0}},{key:"log",value:function(e){console.log("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"warn",value:function(e){console.warn("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"error",value:function(e){console.error("[xeokit plugin ".concat(this.id,"]: ").concat(e))}},{key:"send",value:function(e,t){}},{key:"destroy",value:function(){this.viewer.removePlugin(this)}}]),e}(),Te=$.vec3(),Re=function(){var e=new Float64Array(16),t=new Float64Array(4),i=new Float64Array(4);return function(s,r,n){return n=n||e,t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=1,$.transformVec4(s,t,i),$.setMat4Translation(s,i,n),n.slice()}}();function Le(e,t,i){var s=Float32Array.from([e[0]])[0],r=e[0]-s,n=Float32Array.from([e[1]])[0],o=e[1]-n,a=Float32Array.from([e[2]])[0],l=e[2]-a;t[0]=s,t[1]=n,t[2]=a,i[0]=r,i[1]=o,i[2]=l}function Ue(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3,r=$.getPositionsCenter(e,Te),n=Math.round(r[0]/s)*s,o=Math.round(r[1]/s)*s,a=Math.round(r[2]/s)*s;i[0]=n,i[1]=o,i[2]=a;var l=0!==i[0]||0!==i[1]||0!==i[2];if(l)for(var u=0,A=e.length;u0?this.meshes[0]._colorize[3]/255:1},set:function(e){if(0!==this.meshes.length){var t=null!=e,i=this.meshes[0]._colorize[3],s=255;if(t){if(e<0?e=0:e>1&&(e=1),i===(s=Math.floor(255*e)))return}else if(i===(s=255))return;for(var r=0,n=this.meshes.length;r1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._color=s.color||"black",this._highlightClass="viewer-ruler-wire-highlighted",this._wire=document.createElement("div"),this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire",this._wireClickable=document.createElement("div"),this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable",this._thickness=s.thickness||1,this._thicknessClickable=s.thicknessClickable||6,this._visible=!0,this._culled=!1;var r=this._wire,n=r.style;n.border="solid "+this._thickness+"px "+this._color,n.position="absolute",n["z-index"]=void 0===s.zIndex?"2000001":s.zIndex,n.width="0px",n.height="0px",n.visibility="visible",n.top="0px",n.left="0px",n["-webkit-transform-origin"]="0 0",n["-moz-transform-origin"]="0 0",n["-ms-transform-origin"]="0 0",n["-o-transform-origin"]="0 0",n["transform-origin"]="0 0",n["-webkit-transform"]="rotate(0deg)",n["-moz-transform"]="rotate(0deg)",n["-ms-transform"]="rotate(0deg)",n["-o-transform"]="rotate(0deg)",n.transform="rotate(0deg)",n.opacity=1,n["pointer-events"]="none",s.onContextMenu,t.appendChild(r);var o=this._wireClickable,a=o.style;a.border="solid "+this._thicknessClickable+"px "+this._color,a.position="absolute",a["z-index"]=void 0===s.zIndex?"2000002":s.zIndex+1,a.width="0px",a.height="0px",a.visibility="visible",a.top="0px",a.left="0px",a["-webkit-transform-origin"]="0 0",a["-moz-transform-origin"]="0 0",a["-ms-transform-origin"]="0 0",a["-o-transform-origin"]="0 0",a["transform-origin"]="0 0",a["-webkit-transform"]="rotate(0deg)",a["-moz-transform"]="rotate(0deg)",a["-ms-transform"]="rotate(0deg)",a["-o-transform"]="rotate(0deg)",a.transform="rotate(0deg)",a.opacity=0,a["pointer-events"]="none",s.onContextMenu,t.appendChild(o),s.onMouseOver&&o.addEventListener("mouseover",(function(e){s.onMouseOver(e,i)})),s.onMouseLeave&&o.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i)})),s.onMouseWheel&&o.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&o.addEventListener("mousedown",(function(e){s.onMouseDown(e,i)})),s.onMouseUp&&o.addEventListener("mouseup",(function(e){s.onMouseUp(e,i)})),s.onMouseMove&&o.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&o.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation()})),this._x1=0,this._y1=0,this._x2=0,this._y2=0,this._update()}return C(e,[{key:"visible",get:function(){return"visible"===this._wire.style.visibility}},{key:"_update",value:function(){var e=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2))),t=180*Math.atan2(this._y2-this._y1,this._x2-this._x1)/Math.PI,i=this._wire.style;i.width=Math.round(e)+"px",i.left=Math.round(this._x1)+"px",i.top=Math.round(this._y1)+"px",i["-webkit-transform"]="rotate("+t+"deg)",i["-moz-transform"]="rotate("+t+"deg)",i["-ms-transform"]="rotate("+t+"deg)",i["-o-transform"]="rotate("+t+"deg)",i.transform="rotate("+t+"deg)";var s=this._wireClickable.style;s.width=Math.round(e)+"px",s.left=Math.round(this._x1)+"px",s.top=Math.round(this._y1)+"px",s["-webkit-transform"]="rotate("+t+"deg)",s["-moz-transform"]="rotate("+t+"deg)",s["-ms-transform"]="rotate("+t+"deg)",s["-o-transform"]="rotate("+t+"deg)",s.transform="rotate("+t+"deg)"}},{key:"setStartAndEnd",value:function(e,t,i,s){this._x1=e,this._y1=t,this._x2=i,this._y2=s,this._update()}},{key:"setColor",value:function(e){this._color=e||"black",this._wire.style.border="solid "+this._thickness+"px "+this._color}},{key:"setOpacity",value:function(e){this._wire.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setClickable",value:function(e){this._wireClickable.style["pointer-events"]=e?"all":"none"}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._wire.classList.add(this._highlightClass):this._wire.classList.remove(this._highlightClass))}},{key:"destroy",value:function(e){this._wire.parentElement&&this._wire.parentElement.removeChild(this._wire),this._wireClickable.parentElement&&this._wireClickable.parentElement.removeChild(this._wireClickable)}}]),e}(),it=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._highlightClass="viewer-ruler-dot-highlighted",this._x=0,this._y=0,this._dot=document.createElement("div"),this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot",this._dotClickable=document.createElement("div"),this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable",this._visible=!!s.visible,this._culled=!1;var r=this._dot,n=r.style;n["border-radius"]="25px",n.border="solid 2px white",n.background="lightgreen",n.position="absolute",n["z-index"]=void 0===s.zIndex?"40000005":s.zIndex,n.width="8px",n.height="8px",n.visibility=!1!==s.visible?"visible":"hidden",n.top="0px",n.left="0px",n["box-shadow"]="0 2px 5px 0 #182A3D;",n.opacity=1,n["pointer-events"]="none",s.onContextMenu,t.appendChild(r);var o=this._dotClickable,a=o.style;a["border-radius"]="35px",a.border="solid 10px white",a.position="absolute",a["z-index"]=void 0===s.zIndex?"40000007":s.zIndex+1,a.width="8px",a.height="8px",a.visibility="visible",a.top="0px",a.left="0px",a.opacity=0,a["pointer-events"]="none",s.onContextMenu,t.appendChild(o),o.addEventListener("click",(function(e){t.dispatchEvent(new MouseEvent("mouseover",e))})),s.onMouseOver&&o.addEventListener("mouseover",(function(e){s.onMouseOver(e,i),t.dispatchEvent(new MouseEvent("mouseover",e))})),s.onMouseLeave&&o.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i)})),s.onMouseWheel&&o.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&o.addEventListener("mousedown",(function(e){s.onMouseDown(e,i)})),s.onMouseUp&&o.addEventListener("mouseup",(function(e){s.onMouseUp(e,i)})),s.onMouseMove&&o.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&o.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation()})),this.setPos(s.x||0,s.y||0),this.setFillColor(s.fillColor),this.setBorderColor(s.borderColor)}return C(e,[{key:"setPos",value:function(e,t){this._x=e,this._y=t;var i=this._dot.style;i.left=Math.round(e)-4+"px",i.top=Math.round(t)-4+"px";var s=this._dotClickable.style;s.left=Math.round(e)-9+"px",s.top=Math.round(t)-9+"px"}},{key:"setFillColor",value:function(e){this._dot.style.background=e||"lightgreen"}},{key:"setBorderColor",value:function(e){this._dot.style.border="solid 2px"+(e||"black")}},{key:"setOpacity",value:function(e){this._dot.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setClickable",value:function(e){this._dotClickable.style["pointer-events"]=e?"all":"none"}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._dot.classList.add(this._highlightClass):this._dot.classList.remove(this._highlightClass))}},{key:"destroy",value:function(){this.setVisible(!1),this._dot.parentElement&&this._dot.parentElement.removeChild(this._dot),this._dotClickable.parentElement&&this._dotClickable.parentElement.removeChild(this._dotClickable)}}]),e}(),st=function(){function e(t){var i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this._highlightClass="viewer-ruler-label-highlighted",this._prefix=s.prefix||"",this._x=0,this._y=0,this._visible=!0,this._culled=!1,this._label=document.createElement("div"),this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var r=this._label,n=r.style;n["border-radius"]="5px",n.color="white",n.padding="4px",n.border="solid 1px",n.background="lightgreen",n.position="absolute",n["z-index"]=void 0===s.zIndex?"5000005":s.zIndex,n.width="auto",n.height="auto",n.visibility="visible",n.top="0px",n.left="0px",n["pointer-events"]="all",n.opacity=1,s.onContextMenu,r.innerText="",t.appendChild(r),this.setPos(s.x||0,s.y||0),this.setFillColor(s.fillColor),this.setBorderColor(s.fillColor),this.setText(s.text),s.onMouseOver&&r.addEventListener("mouseover",(function(e){s.onMouseOver(e,i),e.preventDefault()})),s.onMouseLeave&&r.addEventListener("mouseleave",(function(e){s.onMouseLeave(e,i),e.preventDefault()})),s.onMouseWheel&&r.addEventListener("wheel",(function(e){s.onMouseWheel(e,i)})),s.onMouseDown&&r.addEventListener("mousedown",(function(e){s.onMouseDown(e,i),e.stopPropagation()})),s.onMouseUp&&r.addEventListener("mouseup",(function(e){s.onMouseUp(e,i),e.stopPropagation()})),s.onMouseMove&&r.addEventListener("mousemove",(function(e){s.onMouseMove(e,i)})),s.onContextMenu&&r.addEventListener("contextmenu",(function(e){s.onContextMenu(e,i),e.preventDefault(),e.stopPropagation(),console.log("Label context menu")}))}return C(e,[{key:"setPos",value:function(e,t){this._x=e,this._y=t;var i=this._label.style;i.left=Math.round(e)-20+"px",i.top=Math.round(t)-12+"px"}},{key:"setPosOnWire",value:function(e,t,i,s){var r=e+.5*(i-e),n=t+.5*(s-t),o=this._label.style;o.left=Math.round(r)-20+"px",o.top=Math.round(n)-12+"px"}},{key:"setPosBetweenWires",value:function(e,t,i,s,r,n){var o=(e+i+r)/3,a=(t+s+n)/3,l=this._label.style;l.left=Math.round(o)-20+"px",l.top=Math.round(a)-12+"px"}},{key:"setText",value:function(e){this._label.innerHTML=this._prefix+(e||"")}},{key:"setFillColor",value:function(e){this._fillColor=e||"lightgreen",this._label.style.background=this._fillColor}},{key:"setBorderColor",value:function(e){this._borderColor=e||"black",this._label.style.border="solid 1px "+this._borderColor}},{key:"setOpacity",value:function(e){this._label.style.opacity=e}},{key:"setVisible",value:function(e){this._visible!==e&&(this._visible=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setCulled",value:function(e){this._culled!==e&&(this._culled=!!e,this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden")}},{key:"setHighlighted",value:function(e){this._highlighted!==e&&(this._highlighted=!!e,this._highlighted?this._label.classList.add(this._highlightClass):this._label.classList.remove(this._highlightClass))}},{key:"setClickable",value:function(e){this._label.style["pointer-events"]=e?"all":"none"}},{key:"destroy",value:function(){this._label.parentElement&&this._label.parentElement.removeChild(this._label)}}]),e}(),rt=$.vec3(),nt=$.vec3(),ot=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e.viewer.scene,r)).plugin=e,s._container=r.container,!s._container)throw"config missing: container";s._color=r.color||e.defaultColor;var n=s.plugin.viewer.scene;s._originMarker=new et(n,r.origin),s._cornerMarker=new et(n,r.corner),s._targetMarker=new et(n,r.target),s._originWorld=$.vec3(),s._cornerWorld=$.vec3(),s._targetWorld=$.vec3(),s._wp=new Float64Array(12),s._vp=new Float64Array(12),s._pp=new Float64Array(12),s._cp=new Int16Array(6);var o=r.onMouseOver?function(e){r.onMouseOver(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,a=r.onMouseLeave?function(e){r.onMouseLeave(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,l=r.onContextMenu?function(e){r.onContextMenu(e,b(s))}:null,u=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))},A=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},c=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},h=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))};return s._originDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._cornerDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._targetDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._originWire=new tt(s._container,{color:s._color||"blue",thickness:1,zIndex:e.zIndex,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._targetWire=new tt(s._container,{color:s._color||"red",thickness:1,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._angleLabel=new st(s._container,{fillColor:s._color||"#00BBFF",prefix:"",text:"",zIndex:e.zIndex+2,onMouseOver:o,onMouseLeave:a,onMouseWheel:u,onMouseDown:A,onMouseUp:c,onMouseMove:h,onContextMenu:l}),s._wpDirty=!1,s._vpDirty=!1,s._cpDirty=!1,s._visible=!1,s._originVisible=!1,s._cornerVisible=!1,s._targetVisible=!1,s._originWireVisible=!1,s._targetWireVisible=!1,s._angleVisible=!1,s._labelsVisible=!1,s._clickable=!1,s._originMarker.on("worldPos",(function(e){s._originWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._cornerMarker.on("worldPos",(function(e){s._cornerWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._targetMarker.on("worldPos",(function(e){s._targetWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._onViewMatrix=n.camera.on("viewMatrix",(function(){s._vpDirty=!0,s._needUpdate(0)})),s._onProjMatrix=n.camera.on("projMatrix",(function(){s._cpDirty=!0,s._needUpdate()})),s._onCanvasBoundary=n.canvas.on("boundary",(function(){s._cpDirty=!0,s._needUpdate(0)})),s._onSectionPlaneUpdated=n.on("sectionPlaneUpdated",(function(){s._sectionPlanesDirty=!0,s._needUpdate()})),s.approximate=r.approximate,s.visible=r.visible,s.originVisible=r.originVisible,s.cornerVisible=r.cornerVisible,s.targetVisible=r.targetVisible,s.originWireVisible=r.originWireVisible,s.targetWireVisible=r.targetWireVisible,s.angleVisible=r.angleVisible,s.labelsVisible=r.labelsVisible,s}return C(i,[{key:"_update",value:function(){if(this._visible){var e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._cornerWorld[0],this._wp[5]=this._cornerWorld[1],this._wp[6]=this._cornerWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._targetWorld[2],this._wp[11]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&($.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._wp))return this._angleLabel.setCulled(!0),this._originWire.setCulled(!0),this._targetWire.setCulled(!0),this._originDot.setCulled(!0),this._cornerDot.setCulled(!0),void this._targetDot.setCulled(!0);this._angleLabel.setCulled(!1),this._originWire.setCulled(!1),this._targetWire.setCulled(!1),this._originDot.setCulled(!1),this._cornerDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}if(this._cpDirty){var t=-.3,i=this._originMarker.viewPos[2],s=this._cornerMarker.viewPos[2],r=this._targetMarker.viewPos[2];if(i>t||s>t||r>t)return this._originDot.setVisible(!1),this._cornerDot.setVisible(!1),this._targetDot.setVisible(!1),this._originWire.setVisible(!1),this._targetWire.setVisible(!1),void this._angleLabel.setCulled(!0);$.transformPositions4(e.camera.project.matrix,this._vp,this._pp);for(var n=this._pp,o=this._cp,a=e.canvas.canvas.getBoundingClientRect(),l=this._container.getBoundingClientRect(),u=a.top-l.top,A=a.left-l.left,c=e.canvas.boundary,h=c[2],d=c[3],p=0,f=0,v=n.length;f1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e.viewer.scene))._canvasToPagePos=r.canvasToPagePos,s.pointerLens=r.pointerLens,s._active=!1,s._mouseState=0,s._currentAngleMeasurement=null,s._initMarkerDiv(),s._onMouseHoverSurface=null,s._onHoverNothing=null,s._onPickedNothing=null,s._onPickedSurface=null,s._onInputMouseDown=null,s._onInputMouseUp=null,s._snapping=!1!==r.snapping,s._attachPlugin(e,r),s}return C(i,[{key:"_initMarkerDiv",value:function(){var e=document.createElement("div");e.setAttribute("id","myMarkerDiv");var t=this.scene.canvas.canvas;t.parentNode.insertBefore(e,t),e.style.background="black",e.style.border="2px solid blue",e.style.borderRadius="10px",e.style.width="5px",e.style.height="5px",e.style.top="-200px",e.style.left="-200px",e.style.margin="0 0",e.style.zIndex="100",e.style.position="absolute",e.style.pointerEvents="none",this.markerDiv=e}},{key:"_destroyMarkerDiv",value:function(){if(this._markerDiv){var e=document.getElementById("myMarkerDiv");e.parentNode.removeChild(e),this._markerDiv=null}}},{key:"_attachPlugin",value:function(e){this.angleMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){this.markerDiv||this._initMarkerDiv(),this.angleMeasurementsPlugin;var t=this.scene;t.input;var i=t.canvas.canvas,s=this.angleMeasurementsPlugin.viewer.cameraControl,r=this.pointerLens,n=!1,o=null,a=0,l=0,u=$.vec3(),A=$.vec2();this._currentAngleMeasurement=null;var c=function e(t){return t.offsetTop+(t.offsetParent&&t.offsetParent!==i.parentNode&&e(t.offsetParent))},h=function e(t){return t.offsetLeft+(t.offsetParent&&t.offsetParent!==i.parentNode&&e(t.offsetParent))},d=$.vec2();this._onMouseHoverSurface=s.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(function(t){t.snappedToVertex||t.snappedToEdge?(r&&(r.visible=!0,r.canvasPos=t.canvasPos,r.snappedCanvasPos=t.snappedCanvasPos||t.canvasPos,r.snapped=!0),e.markerDiv.style.background="greenyellow",e.markerDiv.style.border="2px solid green"):(r&&(r.visible=!0,r.canvasPos=t.canvasPos,r.snappedCanvasPos=t.canvasPos,r.snapped=!1),e.markerDiv.style.background="pink",e.markerDiv.style.border="2px solid red");var s=t.snappedCanvasPos||t.canvasPos;switch(n=!0,o=t.entity,u.set(t.worldPos),A.set(s),e._mouseState){case 0:e._canvasToPagePos?(e._canvasToPagePos(i,s,d),e.markerDiv.style.left="".concat(d[0]-5,"px"),e.markerDiv.style.top="".concat(d[1]-5,"px")):(e.markerDiv.style.left="".concat(h(i)+s[0]-5,"px"),e.markerDiv.style.top="".concat(c(i)+s[1]-5,"px"));break;case 1:e._currentAngleMeasurement&&(e._currentAngleMeasurement.originWireVisible=!0,e._currentAngleMeasurement.targetWireVisible=!1,e._currentAngleMeasurement.cornerVisible=!0,e._currentAngleMeasurement.angleVisible=!1,e._currentAngleMeasurement.corner.worldPos=t.worldPos,e._currentAngleMeasurement.corner.entity=t.entity),e.markerDiv.style.left="-10000px",e.markerDiv.style.top="-10000px",i.style.cursor="pointer";break;case 2:e._currentAngleMeasurement&&(e._currentAngleMeasurement.targetWireVisible=!0,e._currentAngleMeasurement.targetVisible=!0,e._currentAngleMeasurement.angleVisible=!0,e._currentAngleMeasurement.target.worldPos=t.worldPos,e._currentAngleMeasurement.target.entity=t.entity),e.markerDiv.style.left="-10000px",e.markerDiv.style.top="-10000px",i.style.cursor="pointer"}})),i.addEventListener("mousedown",this._onMouseDown=function(e){1===e.which&&(a=e.clientX,l=e.clientY)}),i.addEventListener("mouseup",this._onMouseUp=function(t){if(1===t.which&&!(t.clientX>a+20||t.clientXl+20||t.clientY1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"AngleMeasurements",e))._container=r.container||document.body,s._defaultControl=null,s._measurements={},s.defaultColor=void 0!==r.defaultColor?r.defaultColor:"#00BBFF",s.defaultLabelsVisible=!1!==r.defaultLabelsVisible,s.zIndex=r.zIndex||1e4,s._onMouseOver=function(e,t){s.fire("mouseOver",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s._onMouseLeave=function(e,t){s.fire("mouseLeave",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s._onContextMenu=function(e,t){s.fire("contextMenu",{plugin:b(s),angleMeasurement:t,measurement:t,event:e})},s}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){}},{key:"control",get:function(){return this._defaultControl||(this._defaultControl=new lt(this,{})),this._defaultControl}},{key:"measurements",get:function(){return this._measurements}},{key:"createMeasurement",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=t.origin,s=t.corner,r=t.target,n=new ot(this,{id:t.id,plugin:this,container:this._container,origin:{entity:i.entity,worldPos:i.worldPos},corner:{entity:s.entity,worldPos:s.worldPos},target:{entity:r.entity,worldPos:r.worldPos},visible:t.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[n.id]=n,n.on("destroyed",(function(){delete e._measurements[n.id]})),n.clickable=!0,this.fire("measurementCreated",n),n}},{key:"destroyMeasurement",value:function(e){var t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}},{key:"setLabelsShown",value:function(e){for(var t=0,i=Object.entries(this.measurements);t1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e.viewer.scene)).pointerLens=r.pointerLens,s.pointerCircle=new De(e.viewer),s._active=!1;var n=document.createElement("div"),o=s.scene.canvas.canvas;return o.parentNode.insertBefore(n,o),n.style.background="black",n.style.border="2px solid blue",n.style.borderRadius="10px",n.style.width="5px",n.style.height="5px",n.style.margin="-200px -200px",n.style.zIndex="100",n.style.position="absolute",n.style.pointerEvents="none",s.markerDiv=n,s._currentAngleMeasurement=null,s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._longTouchTimeoutMs=300,s._snapping=!1!==r.snapping,s._touchState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_attachPlugin",value:function(e){this.angleMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){var t=this.plugin,i=this.scene,s=i.canvas.canvas;t.pointerLens;var r=$.vec3(),n=20,o=null;this._touchState=0;var a=$.vec2(),l=$.vec2(),u=$.vec2(),A=null,c=function(){e.plugin.viewer.cameraControl.active=!1},h=function(){e.plugin.viewer.cameraControl.active=!0};s.addEventListener("touchstart",this._onCanvasTouchStart=function(s){var u=s.touches.length;if(1===u){var d=s.touches[0],p=d.clientX,f=d.clientY;switch(a.set([p,f]),l.set([p,f]),e._touchState){case 0:if(1!==u&&null!==o)return o&&(clearTimeout(o),o=null),e._currentAngleMeasurement&&(e._currentAngleMeasurement.destroy(),e._currentAngleMeasurement=null),h(),void(e._touchState=0);var v=i.pick({canvasPos:l,snapToVertex:e._snapping,snapToEdge:e._snapping});if(v&&v.snapped)r.set(v.worldPos),e.pointerCircle.start(v.snappedCanvasPos);else{var g=i.pick({canvasPos:l,pickSurface:!0});if(!g||!g.worldPos)return;r.set(g.worldPos),e.pointerCircle.start(g.canvasPos)}o=setTimeout((function(){1!==u||l[0]>a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||da[1]+n||pa[0]+n||da[1]+n||pa[0]+n||da[1]+n||p

";le.isArray(t)&&(t=t.join("")),t=this._renderTemplate(t.trim());var i=document.createRange().createContextualFragment(t);this._marker=i.firstChild,this._container.appendChild(this._marker),this._marker.style.visibility=this._markerShown?"visible":"hidden",this._marker.addEventListener("click",(function(){e.plugin.fire("markerClicked",e)})),this._marker.addEventListener("mouseenter",(function(){e.plugin.fire("markerMouseEnter",e)})),this._marker.addEventListener("mouseleave",(function(){e.plugin.fire("markerMouseLeave",e)})),this._marker.addEventListener("wheel",(function(t){e.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",t))}))}if(!this._labelExternal){this._label&&(this._container.removeChild(this._label),this._label=null);var s=this._labelHTML||"

";le.isArray(s)&&(s=s.join("")),s=this._renderTemplate(s.trim());var r=document.createRange().createContextualFragment(s);this._label=r.firstChild,this._container.appendChild(this._label),this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden",this._label.addEventListener("wheel",(function(t){e.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",t))}))}}},{key:"_updatePosition",value:function(){var e=this.scene.canvas.boundary,t=e[0],i=e[1],s=this.canvasPos;this._marker.style.left=Math.floor(t+s[0])-12+"px",this._marker.style.top=Math.floor(i+s[1])-12+"px",this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;this._label.style.left=20+Math.floor(t+s[0]+20)+"px",this._label.style.top=Math.floor(i+s[1]+-17)+"px",this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1}},{key:"_renderTemplate",value:function(e){for(var t in this._values)if(this._values.hasOwnProperty(t)){var i=this._values[t];e=e.replace(new RegExp("{{"+t+"}}","g"),i)}return e}},{key:"setMarkerShown",value:function(e){e=!!e,this._markerShown!==e&&(this._markerShown=e,this._visibilityDirty=!0)}},{key:"getMarkerShown",value:function(){return this._markerShown}},{key:"setLabelShown",value:function(e){e=!!e,this._labelShown!==e&&(this._labelShown=e,this._visibilityDirty=!0)}},{key:"getLabelShown",value:function(){return this._labelShown}},{key:"setField",value:function(e,t){this._values[e]=t||"",this._htmlDirty=!0}},{key:"getField",value:function(e){return this._values[e]}},{key:"setValues",value:function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];this.setField(t,i)}}},{key:"getValues",value:function(){return this._values}},{key:"destroy",value:function(){this._marker&&(this._markerExternal?(this._marker.removeEventListener("click",this._onMouseClickedExternalMarker),this._marker.removeEventListener("mouseenter",this._onMouseEnterExternalMarker),this._marker.removeEventListener("mouseleave",this._onMouseLeaveExternalMarker),this._marker=null):this._marker.parentNode.removeChild(this._marker)),this._label&&(this._labelExternal||this._label.parentNode.removeChild(this._label),this._label=null),this.scene.off(this._onTick),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),ht=$.vec3(),dt=$.vec3(),pt=$.vec3(),ft=function(e){g(i,Se);var t=_(i);function i(e,s){var r;return x(this,i),(r=t.call(this,"Annotations",e))._labelHTML=s.labelHTML||"
",r._markerHTML=s.markerHTML||"
",r._container=s.container||document.body,r._values=s.values||{},r.annotations={},r.surfaceOffset=s.surfaceOffset,r}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){if("clearAnnotations"===e)this.clear()}},{key:"surfaceOffset",get:function(){return this._surfaceOffset},set:function(e){null==e&&(e=.3),this._surfaceOffset=e}},{key:"createAnnotation",value:function(e){var t,i,s=this;if(this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id),e.pickResult=e.pickResult||e.pickRecord,e.pickResult){var r=e.pickResult;if(r.worldPos&&r.worldNormal){var n=$.normalizeVec3(r.worldNormal,ht),o=$.mulVec3Scalar(n,this._surfaceOffset,dt);t=$.addVec3(r.worldPos,o,pt),i=r.entity}else this.error("Param 'pickResult' does not have both worldPos and worldNormal")}else t=e.worldPos,i=e.entity;var a=null;e.markerElementId&&((a=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var l=null;e.labelElementId&&((l=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));var u=new ct(this.viewer.scene,{id:e.id,plugin:this,entity:i,worldPos:t,container:this._container,markerElement:a,labelElement:l,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:le.apply(e.values,le.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return this.annotations[u.id]=u,u.on("destroyed",(function(){delete s.annotations[u.id],s.fire("annotationDestroyed",u.id)})),this.fire("annotationCreated",u.id),u}},{key:"destroyAnnotation",value:function(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}},{key:"clear",value:function(){for(var e=Object.keys(this.annotations),t=0,i=e.length;t1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._canvas=r.canvas,s._element=null,s._isCustom=!1,r.elementId&&(s._element=document.getElementById(r.elementId),s._element?s._adjustPosition():s.error("Can't find given Spinner HTML element: '"+r.elementId+"' - will automatically create default element")),s._element||s._createDefaultSpinner(),s.processes=0,s}return C(i,[{key:"type",get:function(){return"Spinner"}},{key:"_createDefaultSpinner",value:function(){this._injectDefaultCSS();var e=document.createElement("div"),t=e.style;t["z-index"]="9000",t.position="absolute",e.innerHTML='
',this._canvas.parentElement.appendChild(e),this._element=e,this._isCustom=!1,this._adjustPosition()}},{key:"_injectDefaultCSS",value:function(){var e="xeokit-spinner-css";if(!document.getElementById(e)){var t=document.createElement("style");t.innerHTML=".sk-fading-circle { background: transparent; margin: 20px auto; width: 50px; height:50px; position: relative; } .sk-fading-circle .sk-circle { width: 120%; height: 120%; position: absolute; left: 0; top: 0; } .sk-fading-circle .sk-circle:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #ff8800; border-radius: 100%; -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; animation: sk-circleFadeDelay 1.2s infinite ease-in-out both; } .sk-fading-circle .sk-circle2 { -webkit-transform: rotate(30deg); -ms-transform: rotate(30deg); transform: rotate(30deg); } .sk-fading-circle .sk-circle3 { -webkit-transform: rotate(60deg); -ms-transform: rotate(60deg); transform: rotate(60deg); } .sk-fading-circle .sk-circle4 { -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-fading-circle .sk-circle5 { -webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-fading-circle .sk-circle6 { -webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-fading-circle .sk-circle7 { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-fading-circle .sk-circle8 { -webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-fading-circle .sk-circle9 { -webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-fading-circle .sk-circle10 { -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-fading-circle .sk-circle11 { -webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-fading-circle .sk-circle12 { -webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-fading-circle .sk-circle2:before { -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-fading-circle .sk-circle3:before { -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-fading-circle .sk-circle4:before { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-fading-circle .sk-circle5:before { -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-fading-circle .sk-circle6:before { -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-fading-circle .sk-circle7:before { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-fading-circle .sk-circle8:before { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-fading-circle .sk-circle9:before { -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-fading-circle .sk-circle10:before { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-fading-circle .sk-circle11:before { -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-fading-circle .sk-circle12:before { -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } } @keyframes sk-circleFadeDelay { 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } }",t.id=e,document.body.appendChild(t)}}},{key:"_adjustPosition",value:function(){if(!this._isCustom){var e=this._canvas,t=this._element,i=t.style;i.left=e.offsetLeft+.5*e.clientWidth-.5*t.clientWidth+"px",i.top=e.offsetTop+.5*e.clientHeight-.5*t.clientHeight+"px"}}},{key:"processes",get:function(){return this._processes},set:function(e){if(e=e||0,this._processes!==e&&!(e<0)){var t=this._processes;this._processes=e;var i=this._element;i&&(i.style.visibility=this._processes>0?"visible":"hidden"),this.fire("processes",this._processes),0===this._processes&&this._processes!==t&&this.fire("zeroProcesses",this._processes)}}},{key:"_destroy",value:function(){this._element&&!this._isCustom&&(this._element.parentNode.removeChild(this._element),this._element=null);var e=document.getElementById("xeokit-spinner-css");e&&e.parentNode.removeChild(e)}}]),i}(),gt=["webgl2","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"],mt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._backgroundColor=$.vec3([r.backgroundColor?r.backgroundColor[0]:1,r.backgroundColor?r.backgroundColor[1]:1,r.backgroundColor?r.backgroundColor[2]:1]),s._backgroundColorFromAmbientLight=!!r.backgroundColorFromAmbientLight,s.canvas=r.canvas,s.gl=null,s.webgl2=!1,s.transparent=!!r.transparent,s.contextAttr=r.contextAttr||{},s.contextAttr.alpha=s.transparent,s.contextAttr.preserveDrawingBuffer=!!s.contextAttr.preserveDrawingBuffer,s.contextAttr.stencil=!1,s.contextAttr.premultipliedAlpha=!!s.contextAttr.premultipliedAlpha,s.contextAttr.antialias=!1!==s.contextAttr.antialias,s.resolutionScale=r.resolutionScale,s.canvas.width=Math.round(s.canvas.clientWidth*s._resolutionScale),s.canvas.height=Math.round(s.canvas.clientHeight*s._resolutionScale),s.boundary=[s.canvas.offsetLeft,s.canvas.offsetTop,s.canvas.clientWidth,s.canvas.clientHeight],s._initWebGL(r);var n=b(s);s.canvas.addEventListener("webglcontextlost",s._webglcontextlostListener=function(e){console.time("webglcontextrestored"),n.scene._webglContextLost(),n.fire("webglcontextlost"),e.preventDefault()},!1),s.canvas.addEventListener("webglcontextrestored",s._webglcontextrestoredListener=function(e){n._initWebGL(),n.gl&&(n.scene._webglContextRestored(n.gl),n.fire("webglcontextrestored",n.gl),e.preventDefault()),console.timeEnd("webglcontextrestored")},!1);var o=!0,a=new ResizeObserver((function(e){var t,i=c(e);try{for(i.s();!(t=i.n()).done;){t.value.contentBoxSize&&(o=!0)}}catch(e){i.e(e)}finally{i.f()}}));return a.observe(s.canvas),s._tick=s.scene.on("tick",(function(){o&&(o=!1,n.canvas.width=Math.round(n.canvas.clientWidth*n._resolutionScale),n.canvas.height=Math.round(n.canvas.clientHeight*n._resolutionScale),n.boundary[0]=n.canvas.offsetLeft,n.boundary[1]=n.canvas.offsetTop,n.boundary[2]=n.canvas.clientWidth,n.boundary[3]=n.canvas.clientHeight,n.fire("boundary",n.boundary))})),s._spinner=new vt(s.scene,{canvas:s.canvas,elementId:r.spinnerElementId}),s}return C(i,[{key:"type",get:function(){return"Canvas"}},{key:"backgroundColorFromAmbientLight",get:function(){return this._backgroundColorFromAmbientLight},set:function(e){this._backgroundColorFromAmbientLight=!1!==e,this.glRedraw()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(e){e?(this._backgroundColor[0]=e[0],this._backgroundColor[1]=e[1],this._backgroundColor[2]=e[2]):(this._backgroundColor[0]=1,this._backgroundColor[1]=1,this._backgroundColor[2]=1),this.glRedraw()}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(e){if((e=e||1)!==this._resolutionScale){this._resolutionScale=e;var t=this.canvas;t.width=Math.round(t.clientWidth*this._resolutionScale),t.height=Math.round(t.clientHeight*this._resolutionScale),this.glRedraw()}}},{key:"spinner",get:function(){return this._spinner}},{key:"_createCanvas",value:function(){var e="xeokit-canvas-"+$.createUUID(),t=document.getElementsByTagName("body")[0],i=document.createElement("div"),s=i.style;s.height="100%",s.width="100%",s.padding="0",s.margin="0",s.background="rgba(0,0,0,0);",s.float="left",s.left="0",s.top="0",s.position="absolute",s.opacity="1.0",s["z-index"]="-10000",i.innerHTML+='',t.appendChild(i),this.canvas=document.getElementById(e)}},{key:"_getElementXY",value:function(e){for(var t=0,i=0;e;)t+=e.offsetLeft-e.scrollLeft,i+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:i}}},{key:"_initWebGL",value:function(){if(!this.gl)for(var e=0;!this.gl&&e0?yt.FS_MAX_FLOAT_PRECISION="highp":Bt.getShaderPrecisionFormat(Bt.FRAGMENT_SHADER,Bt.MEDIUM_FLOAT).precision>0?yt.FS_MAX_FLOAT_PRECISION="mediump":yt.FS_MAX_FLOAT_PRECISION="lowp":yt.FS_MAX_FLOAT_PRECISION="mediump",yt.DEPTH_BUFFER_BITS=Bt.getParameter(Bt.DEPTH_BITS),yt.MAX_TEXTURE_SIZE=Bt.getParameter(Bt.MAX_TEXTURE_SIZE),yt.MAX_CUBE_MAP_SIZE=Bt.getParameter(Bt.MAX_CUBE_MAP_TEXTURE_SIZE),yt.MAX_RENDERBUFFER_SIZE=Bt.getParameter(Bt.MAX_RENDERBUFFER_SIZE),yt.MAX_TEXTURE_UNITS=Bt.getParameter(Bt.MAX_COMBINED_TEXTURE_IMAGE_UNITS),yt.MAX_TEXTURE_IMAGE_UNITS=Bt.getParameter(Bt.MAX_TEXTURE_IMAGE_UNITS),yt.MAX_VERTEX_ATTRIBS=Bt.getParameter(Bt.MAX_VERTEX_ATTRIBS),yt.MAX_VERTEX_UNIFORM_VECTORS=Bt.getParameter(Bt.MAX_VERTEX_UNIFORM_VECTORS),yt.MAX_FRAGMENT_UNIFORM_VECTORS=Bt.getParameter(Bt.MAX_FRAGMENT_UNIFORM_VECTORS),yt.MAX_VARYING_VECTORS=Bt.getParameter(Bt.MAX_VARYING_VECTORS),Bt.getSupportedExtensions().forEach((function(e){yt.SUPPORTED_EXTENSIONS[e]=!0})))}var wt=function(){function e(){x(this,e),this.entity=null,this.primitive=null,this.primIndex=-1,this.pickSurfacePrecision=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1,this._origin=new Float64Array([0,0,0]),this._direction=new Float64Array([0,0,0]),this._indices=new Int32Array(3),this._localPos=new Float64Array([0,0,0]),this._worldPos=new Float64Array([0,0,0]),this._viewPos=new Float64Array([0,0,0]),this._canvasPos=new Int16Array([0,0]),this._snappedCanvasPos=new Int16Array([0,0]),this._bary=new Float64Array([0,0,0]),this._worldNormal=new Float64Array([0,0,0]),this._uv=new Float64Array([0,0]),this.reset()}return C(e,[{key:"canvasPos",get:function(){return this._gotCanvasPos?this._canvasPos:null},set:function(e){e?(this._canvasPos[0]=e[0],this._canvasPos[1]=e[1],this._gotCanvasPos=!0):this._gotCanvasPos=!1}},{key:"origin",get:function(){return this._gotOrigin?this._origin:null},set:function(e){e?(this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this._gotOrigin=!0):this._gotOrigin=!1}},{key:"direction",get:function(){return this._gotDirection?this._direction:null},set:function(e){e?(this._direction[0]=e[0],this._direction[1]=e[1],this._direction[2]=e[2],this._gotDirection=!0):this._gotDirection=!1}},{key:"indices",get:function(){return this.entity&&this._gotIndices?this._indices:null},set:function(e){e?(this._indices[0]=e[0],this._indices[1]=e[1],this._indices[2]=e[2],this._gotIndices=!0):this._gotIndices=!1}},{key:"localPos",get:function(){return this.entity&&this._gotLocalPos?this._localPos:null},set:function(e){e?(this._localPos[0]=e[0],this._localPos[1]=e[1],this._localPos[2]=e[2],this._gotLocalPos=!0):this._gotLocalPos=!1}},{key:"snappedCanvasPos",get:function(){return this._gotSnappedCanvasPos?this._snappedCanvasPos:null},set:function(e){e?(this._snappedCanvasPos[0]=e[0],this._snappedCanvasPos[1]=e[1],this._gotSnappedCanvasPos=!0):this._gotSnappedCanvasPos=!1}},{key:"worldPos",get:function(){return this._gotWorldPos?this._worldPos:null},set:function(e){e?(this._worldPos[0]=e[0],this._worldPos[1]=e[1],this._worldPos[2]=e[2],this._gotWorldPos=!0):this._gotWorldPos=!1}},{key:"viewPos",get:function(){return this.entity&&this._gotViewPos?this._viewPos:null},set:function(e){e?(this._viewPos[0]=e[0],this._viewPos[1]=e[1],this._viewPos[2]=e[2],this._gotViewPos=!0):this._gotViewPos=!1}},{key:"bary",get:function(){return this.entity&&this._gotBary?this._bary:null},set:function(e){e?(this._bary[0]=e[0],this._bary[1]=e[1],this._bary[2]=e[2],this._gotBary=!0):this._gotBary=!1}},{key:"worldNormal",get:function(){return this.entity&&this._gotWorldNormal?this._worldNormal:null},set:function(e){e?(this._worldNormal[0]=e[0],this._worldNormal[1]=e[1],this._worldNormal[2]=e[2],this._gotWorldNormal=!0):this._gotWorldNormal=!1}},{key:"uv",get:function(){return this.entity&&this._gotUV?this._uv:null},set:function(e){e?(this._uv[0]=e[0],this._uv[1]=e[1],this._gotUV=!0):this._gotUV=!1}},{key:"snapped",get:function(){return this.snappedToEdge||this.snappedToVertex}},{key:"reset",value:function(){this.entity=null,this.primIndex=-1,this.primitive=null,this.pickSurfacePrecision=!1,this._gotCanvasPos=!1,this._gotSnappedCanvasPos=!1,this._gotOrigin=!1,this._gotDirection=!1,this._gotIndices=!1,this._gotLocalPos=!1,this._gotWorldPos=!1,this._gotViewPos=!1,this._gotBary=!1,this._gotWorldNormal=!1,this._gotUV=!1,this.touchInput=!1,this.snappedToEdge=!1,this.snappedToVertex=!1}}]),e}(),xt=function(){function e(t,i,s){if(x(this,e),this.allocated=!1,this.compiled=!1,this.handle=t.createShader(i),this.handle){if(this.allocated=!0,t.shaderSource(this.handle,s),t.compileShader(this.handle),this.compiled=t.getShaderParameter(this.handle,t.COMPILE_STATUS),!this.compiled&&!t.isContextLost()){for(var r=s.split("\n"),n=[],o=0;o0&&"/"===t.charAt(i+1)&&(t=t.substring(0,i)),s.push(t);return s.join("\n")}function Et(e){console.error(e.join("\n"))}var kt=function(){function e(t,i){x(this,e),this.id=Mt.addItem({}),this.source=i,this.init(t)}return C(e,[{key:"init",value:function(e){if(this.gl=e,this.allocated=!1,this.compiled=!1,this.linked=!1,this.validated=!1,this.errors=null,this.uniforms={},this.samplers={},this.attributes={},this._vertexShader=new xt(e,e.VERTEX_SHADER,Ft(this.source.vertex)),this._fragmentShader=new xt(e,e.FRAGMENT_SHADER,Ft(this.source.fragment)),!this._vertexShader.allocated)return this.errors=["Vertex shader failed to allocate"].concat(this._vertexShader.errors),void Et(this.errors);if(!this._fragmentShader.allocated)return this.errors=["Fragment shader failed to allocate"].concat(this._fragmentShader.errors),void Et(this.errors);if(this.allocated=!0,!this._vertexShader.compiled)return this.errors=["Vertex shader failed to compile"].concat(this._vertexShader.errors),void Et(this.errors);if(!this._fragmentShader.compiled)return this.errors=["Fragment shader failed to compile"].concat(this._fragmentShader.errors),void Et(this.errors);var t,i,s,r,n;if(this.compiled=!0,this.handle=e.createProgram(),this.handle){if(e.attachShader(this.handle,this._vertexShader.handle),e.attachShader(this.handle,this._fragmentShader.handle),e.linkProgram(this.handle),this.linked=e.getProgramParameter(this.handle,e.LINK_STATUS),this.validated=!0,!this.linked||!this.validated)return this.errors=[],this.errors.push(""),this.errors.push(e.getProgramInfoLog(this.handle)),this.errors.push("\nVertex shader:\n"),this.errors=this.errors.concat(this.source.vertex),this.errors.push("\nFragment shader:\n"),this.errors=this.errors.concat(this.source.fragment),void Et(this.errors);var o=e.getProgramParameter(this.handle,e.ACTIVE_UNIFORMS);for(i=0;ithis.dataLength?e.slice(0,this.dataLength):e,this.usage),this._gl.bindBuffer(this.type,null),this.length=e.length,this.numItems=this.length/this.itemSize,this.allocated=!0)}},{key:"setData",value:function(e,t){this.allocated&&(e.length+(t||0)>this.length?(this.destroy(),this._allocate(e)):(this._gl.bindBuffer(this.type,this._handle),t||0===t?this._gl.bufferSubData(this.type,t*this.itemByteSize,e):this._gl.bufferData(this.type,e,this.usage),this._gl.bindBuffer(this.type,null)))}},{key:"bind",value:function(){this.allocated&&this._gl.bindBuffer(this.type,this._handle)}},{key:"unbind",value:function(){this.allocated&&this._gl.bindBuffer(this.type,null)}},{key:"destroy",value:function(){this.allocated&&(this._gl.deleteBuffer(this._handle),this._handle=null,this.allocated=!1)}}]),e}(),Dt=function(){function e(t,i){x(this,e),this.scene=t,this.aabb=$.AABB3(),this.origin=$.vec3(i),this.originHash=this.origin.join(),this.numMarkers=0,this.markers={},this.markerList=[],this.markerIndices={},this.positions=[],this.indices=[],this.positionsBuf=null,this.lenPositionsBuf=0,this.indicesBuf=null,this.sectionPlanesActive=[],this.culledBySectionPlanes=!1,this.occlusionTestList=[],this.lenOcclusionTestList=0,this.pixels=[],this.aabbDirty=!1,this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!1}return C(e,[{key:"addMarker",value:function(e){this.markers[e.id]=e,this.markerListDirty=!0,this.numMarkers++}},{key:"markerWorldPosUpdated",value:function(e){if(this.markers[e.id]){var t=this.markerIndices[e.id];this.positions[3*t+0]=e.worldPos[0],this.positions[3*t+1]=e.worldPos[1],this.positions[3*t+2]=e.worldPos[2],this.positionsDirty=!0}}},{key:"removeMarker",value:function(e){delete this.markers[e.id],this.markerListDirty=!0,this.numMarkers--}},{key:"update",value:function(){this.markerListDirty&&(this._buildMarkerList(),this.markerListDirty=!1,this.positionsDirty=!0,this.occlusionTestListDirty=!0),this.positionsDirty&&(this._buildPositions(),this.positionsDirty=!1,this.aabbDirty=!0,this.vbosDirty=!0),this.aabbDirty&&(this._buildAABB(),this.aabbDirty=!1),this.vbosDirty&&(this._buildVBOs(),this.vbosDirty=!1),this.occlusionTestListDirty&&this._buildOcclusionTestList(),this._updateActiveSectionPlanes()}},{key:"_buildMarkerList",value:function(){for(var e in this.numMarkers=0,this.markers)this.markers.hasOwnProperty(e)&&(this.markerList[this.numMarkers]=this.markers[e],this.markerIndices[e]=this.numMarkers,this.numMarkers++);this.markerList.length=this.numMarkers}},{key:"_buildPositions",value:function(){for(var e=0,t=0;t-t)a._setVisible(!1);else{var l=a.canvasPos,u=l[0],A=l[1];u+10<0||A+10<0||u-10>s||A-10>r?a._setVisible(!1):!a.entity||a.entity.visible?a.occludable?(this.occlusionTestList[this.lenOcclusionTestList++]=a,this.pixels[n++]=u,this.pixels[n++]=A):a._setVisible(!0):a._setVisible(!1)}}}},{key:"_updateActiveSectionPlanes",value:function(){var e=this.scene._sectionPlanesState.sectionPlanes,t=e.length;if(t>0)for(var i=0;i0,i=[];return i.push("#version 300 es"),i.push("// OcclusionTester vertex shader"),i.push("in vec3 position;"),i.push("uniform mat4 modelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("vec4 worldPosition = vec4(position, 1.0); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition;"),t&&i.push(" vWorldPosition = worldPosition;"),i.push(" vec4 clipPos = projMatrix * viewPosition;"),i.push(" gl_PointSize = 20.0;"),e.logarithmicDepthBufferEnabled?i.push("vFragDepth = 1.0 + clipPos.w;"):i.push("clipPos.z += -0.001;"),i.push(" gl_Position = clipPos;"),i.push("}"),i}},{key:"_buildFragmentShaderSource",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.sectionPlanes.length>0,s=[];if(s.push("#version 300 es"),s.push("// OcclusionTester fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;");for(var r=0;r 0.0) { discard; }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(1.0, 0.0, 0.0, 1.0); "),s.push("}"),s}},{key:"_buildProgram",value:function(){this._program&&this._program.destroy();var e=this._scene,t=e.canvas.gl,i=e._sectionPlanesState;if(this._program=new kt(t,this._shaderSource),this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(var r=0,n=i.sectionPlanes.length;r0)for(var h=s.sectionPlanes,d=0;d= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }")]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);var s=new Float32Array([1,1,0,1,0,0,1,0]),r=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),n=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new It(i,i.ARRAY_BUFFER,r,r.length,3,i.STATIC_DRAW),this._uvBuf=new It(i,i.ARRAY_BUFFER,s,s.length,2,i.STATIC_DRAW),this._indicesBuf=new It(i,i.ELEMENT_ARRAY_BUFFER,n,n.length,1,i.STATIC_DRAW),this._program.bind(),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uCameraProjectionMatrix=this._program.getLocation("uProjectMatrix"),this._uCameraInverseProjectionMatrix=this._program.getLocation("uInverseProjectMatrix"),this._uPerspective=this._program.getLocation("uPerspective"),this._uScale=this._program.getLocation("uScale"),this._uIntensity=this._program.getLocation("uIntensity"),this._uBias=this._program.getLocation("uBias"),this._uKernelRadius=this._program.getLocation("uKernelRadius"),this._uMinResolution=this._program.getLocation("uMinResolution"),this._uViewport=this._program.getLocation("uViewport"),this._uRandomSeed=this._program.getLocation("uRandomSeed"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV"),this._dirty=!1}}},{key:"destroy",value:function(){this._program&&(this._program.destroy(),this._program=null)}}]),e}(),Ot=new Float32Array(Gt(17,[0,1])),Nt=new Float32Array(Gt(17,[1,0])),Qt=new Float32Array(function(e,t){for(var i=[],s=0;s<=e;s++)i.push(jt(s,t));return i}(17,4)),Vt=new Float32Array(2),Ht=function(){function e(t){x(this,e),this._scene=t,this._program=null,this._programError=!1,this._aPosition=null,this._aUV=null,this._uDepthTexture="uDepthTexture",this._uOcclusionTexture="uOcclusionTexture",this._uViewport=null,this._uCameraNear=null,this._uCameraFar=null,this._uCameraProjectionMatrix=null,this._uCameraInverseProjectionMatrix=null,this._uvBuf=null,this._positionsBuf=null,this._indicesBuf=null,this.init()}return C(e,[{key:"init",value:function(){var e=this._scene.canvas.gl;if(this._program=new kt(e,{vertex:["#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }"],fragment:["#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS ".concat(16,"\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }")]}),this._program.errors)return console.error(this._program.errors.join("\n")),void(this._programError=!0);var t=new Float32Array([1,1,0,1,0,0,1,0]),i=new Float32Array([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),s=new Uint32Array([0,1,2,0,2,3]);this._positionsBuf=new It(e,e.ARRAY_BUFFER,i,i.length,3,e.STATIC_DRAW),this._uvBuf=new It(e,e.ARRAY_BUFFER,t,t.length,2,e.STATIC_DRAW),this._indicesBuf=new It(e,e.ELEMENT_ARRAY_BUFFER,s,s.length,1,e.STATIC_DRAW),this._program.bind(),this._uViewport=this._program.getLocation("uViewport"),this._uCameraNear=this._program.getLocation("uCameraNear"),this._uCameraFar=this._program.getLocation("uCameraFar"),this._uDepthCutoff=this._program.getLocation("uDepthCutoff"),this._uSampleOffsets=e.getUniformLocation(this._program.handle,"uSampleOffsets"),this._uSampleWeights=e.getUniformLocation(this._program.handle,"uSampleWeights"),this._aPosition=this._program.getAttribute("aPosition"),this._aUV=this._program.getAttribute("aUV")}},{key:"render",value:function(e,t,i){var s=this;if(!this._programError){this._getInverseProjectMat||(this._getInverseProjectMat=function(){var e=!0;s._scene.camera.on("projMatrix",(function(){e=!0}));var t=$.mat4();return function(){return e&&$.inverseMat4(o.camera.projMatrix,t),t}}());var r=this._scene.canvas.gl,n=this._program,o=this._scene,a=r.drawingBufferWidth,l=r.drawingBufferHeight,u=o.camera.project._state,A=u.near,c=u.far;r.viewport(0,0,a,l),r.clearColor(0,0,0,1),r.enable(r.DEPTH_TEST),r.disable(r.BLEND),r.frontFace(r.CCW),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),n.bind(),Vt[0]=a,Vt[1]=l,r.uniform2fv(this._uViewport,Vt),r.uniform1f(this._uCameraNear,A),r.uniform1f(this._uCameraFar,c),r.uniform1f(this._uDepthCutoff,.01),0===i?r.uniform2fv(this._uSampleOffsets,Nt):r.uniform2fv(this._uSampleOffsets,Ot),r.uniform1fv(this._uSampleWeights,Qt);var h=e.getDepthTexture(),d=t.getTexture();n.bindTexture(this._uDepthTexture,h,0),n.bindTexture(this._uOcclusionTexture,d,1),this._aUV.bindArrayBuffer(this._uvBuf),this._aPosition.bindArrayBuffer(this._positionsBuf),this._indicesBuf.bind(),r.drawElements(r.TRIANGLES,this._indicesBuf.numItems,this._indicesBuf.itemType,0)}}},{key:"destroy",value:function(){this._program.destroy()}}]),e}();function jt(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}function Gt(e,t){for(var i=[],s=0;s<=e;s++)i.push(t[0]*s),i.push(t[1]*s);return i}var zt=function(){function e(t,i,s){x(this,e),s=s||{},this.gl=i,this.allocated=!1,this.canvas=t,this.buffer=null,this.bound=!1,this.size=s.size,this._hasDepthTexture=!!s.depthTexture}return C(e,[{key:"setSize",value:function(e){this.size=e}},{key:"webglContextRestored",value:function(e){this.gl=e,this.buffer=null,this.allocated=!1,this.bound=!1}},{key:"bind",value:function(){if(this._touch.apply(this,arguments),!this.bound){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.buffer.framebuf),this.bound=!0}}},{key:"createTexture",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=this.gl,r=s.createTexture();return s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i?s.texStorage2D(s.TEXTURE_2D,1,i,e,t):s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),r}},{key:"_touch",value:function(){var e,t,i=this,s=this.gl;if(this.size?(e=this.size[0],t=this.size[1]):(e=s.drawingBufferWidth,t=s.drawingBufferHeight),this.buffer){if(this.buffer.width===e&&this.buffer.height===t)return;this.buffer.textures.forEach((function(e){return s.deleteTexture(e)})),s.deleteFramebuffer(this.buffer.framebuf),s.deleteRenderbuffer(this.buffer.renderbuf)}for(var r,n=[],o=arguments.length,a=new Array(o),l=0;l0?n.push.apply(n,A(a.map((function(s){return i.createTexture(e,t,s)})))):n.push(this.createTexture(e,t)),this._hasDepthTexture&&(r=s.createTexture(),s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.DEPTH_COMPONENT32F,e,t,0,s.DEPTH_COMPONENT,s.FLOAT,null));var u=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,u),s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT32F,e,t);var c=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,c);for(var h=0;h0&&s.drawBuffers(n.map((function(e,t){return s.COLOR_ATTACHMENT0+t}))),this._hasDepthTexture?s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,r,0):s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,u),s.bindTexture(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,c),!s.isFramebuffer(c))throw"Invalid framebuffer";s.bindFramebuffer(s.FRAMEBUFFER,null);var d=s.checkFramebufferStatus(s.FRAMEBUFFER);switch(d){case s.FRAMEBUFFER_COMPLETE:break;case s.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case s.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case s.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+d}this.buffer={framebuf:c,renderbuf:u,texture:n[0],textures:n,depthTexture:r,width:e,height:t},this.bound=!1}},{key:"clear",value:function(){if(!this.bound)throw"Render buffer not bound";var e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},{key:"read",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Uint8Array,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:4,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,a=e,l=this.buffer.height?this.buffer.height-t-1:this.gl.drawingBufferHeight-t,u=new r(n),A=this.gl;return A.readBuffer(A.COLOR_ATTACHMENT0+o),A.readPixels(a,l,1,1,i||A.RGBA,s||A.UNSIGNED_BYTE,u,0),u}},{key:"readArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Uint8Array,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=new i(this.buffer.width*this.buffer.height*s),o=this.gl;return o.readBuffer(o.COLOR_ATTACHMENT0+r),o.readPixels(0,0,this.buffer.width,this.buffer.height,e||o.RGBA,t||o.UNSIGNED_BYTE,n,0),n}},{key:"readImageAsCanvas",value:function(){var e=this.gl,t=this._getImageDataCache(),i=t.pixelData,s=t.canvas,r=t.imageData,n=t.context;e.readPixels(0,0,this.buffer.width,this.buffer.height,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=this.buffer.width,a=this.buffer.height,l=a/2|0,u=4*o,A=new Uint8Array(4*o),c=0;c0&&void 0!==arguments[0]?arguments[0]:Uint8Array,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,i=this.buffer.width,s=this.buffer.height,r=this._imageDataCache;if(r&&(r.width===i&&r.height===s||(this._imageDataCache=null,r=null)),!r){var n=document.createElement("canvas"),o=n.getContext("2d");n.width=i,n.height=s,r={pixelData:new e(i*s*t),canvas:n,context:o,imageData:o.createImageData(i,s),width:i,height:s},this._imageDataCache=r}return r.context.resetTransform(),r}},{key:"unbind",value:function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),this.bound=!1}},{key:"getTexture",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this;return this._texture||(this._texture={renderBuffer:this,bind:function(i){return!(!t.buffer||!t.buffer.textures[e])&&(t.gl.activeTexture(t.gl["TEXTURE"+i]),t.gl.bindTexture(t.gl.TEXTURE_2D,t.buffer.textures[e]),!0)},unbind:function(i){t.buffer&&t.buffer.textures[e]&&(t.gl.activeTexture(t.gl["TEXTURE"+i]),t.gl.bindTexture(t.gl.TEXTURE_2D,null))}})}},{key:"hasDepthTexture",value:function(){return this._hasDepthTexture}},{key:"getDepthTexture",value:function(){if(!this._hasDepthTexture)return null;var e=this;return this._depthTexture||(this._dethTexture={renderBuffer:this,bind:function(t){return!(!e.buffer||!e.buffer.depthTexture)&&(e.gl.activeTexture(e.gl["TEXTURE"+t]),e.gl.bindTexture(e.gl.TEXTURE_2D,e.buffer.depthTexture),!0)},unbind:function(t){e.buffer&&e.buffer.depthTexture&&(e.gl.activeTexture(e.gl["TEXTURE"+t]),e.gl.bindTexture(e.gl.TEXTURE_2D,null))}})}},{key:"destroy",value:function(){if(this.allocated){var e=this.gl;this.buffer.textures.forEach((function(t){return e.deleteTexture(t)})),e.deleteTexture(this.buffer.depthTexture),e.deleteFramebuffer(this.buffer.framebuf),e.deleteRenderbuffer(this.buffer.renderbuf),this.allocated=!1,this.buffer=null,this.bound=!1}this._imageDataCache=null,this._texture=null,this._depthTexture=null}}]),e}(),Wt=function(){function e(t){x(this,e),this.scene=t,this._renderBuffersBasic={},this._renderBuffersScaled={}}return C(e,[{key:"getRenderBuffer",value:function(e,t){var i=1===this.scene.canvas.resolutionScale?this._renderBuffersBasic:this._renderBuffersScaled,s=i[e];return s||(s=new zt(this.scene.canvas.canvas,this.scene.canvas.gl,t),i[e]=s),s}},{key:"destroy",value:function(){for(var e in this._renderBuffersBasic)this._renderBuffersBasic[e].destroy();for(var t in this._renderBuffersScaled)this._renderBuffersScaled[t].destroy()}}]),e}();function Kt(e,t){if(void 0===e._cachedExtensions&&(e._cachedExtensions={}),void 0!==e._cachedExtensions[t])return e._cachedExtensions[t];var i;switch(t){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(t)}return e._cachedExtensions[t]=i,i}var Xt=function(e,t){t=t||{};var i=new _t(e),s=e.canvas.canvas,r=e.canvas.gl,n=!!t.transparent,o=t.alphaDepthMask,a=new Q({}),l={},u={},A=!0,c=!0,h=!0,d=!0,p=!0,f=!0,v=!0,g=!0,m=new Wt(e),_=!1,y=new Ut(e),b=new Ht(e);function B(){A&&(!function(){for(var e in l)if(l.hasOwnProperty(e)){var t=l[e],i=t.drawableMap,s=t.drawableListPreCull,r=0;for(var n in i)i.hasOwnProperty(n)&&(s[r++]=i[n]);s.length=r}}(),A=!1,c=!0),c&&(!function(){for(var e in l)if(l.hasOwnProperty(e)){var t=l[e];t.isStateSortable&&t.drawableListPreCull.sort(t.stateSortCompare)}}(),c=!1,h=!0),h&&function(){for(var e in l)if(l.hasOwnProperty(e)){for(var t=l[e],i=t.drawableListPreCull,s=t.drawableList,r=0,n=0,o=i.length;n0)for(i.withSAO=!0,I=0;I0)for(I=0;I0)for(I=0;I0)for(I=0;I0||G>0||N>0||Q>0){if(r.enable(r.CULL_FACE),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA)),i.backfaces=!1,o||r.depthMask(!1),(N>0||Q>0)&&r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),Q>0)for(I=0;I0)for(I=0;I0)for(I=0;I0)for(I=0;I0||W>0){if(i.lastProgramId=null,e.highlightMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),W>0)for(I=0;I0)for(I=0;I0||X>0||z>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),r.enable(r.CULL_FACE),X>0)for(I=0;I0)for(I=0;I0||Y>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),Y>0)for(I=0;I0)for(I=0;I0||q>0){if(i.lastProgramId=null,e.selectedMaterial.glowThrough&&r.clear(r.DEPTH_BUFFER_BIT),r.enable(r.CULL_FACE),r.enable(r.BLEND),n?(r.blendEquation(r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),q>0)for(I=0;I0)for(I=0;I1&&void 0!==arguments[1]?arguments[1]:o;p.reset(),B();var f=null,v=null;for(var g in p.pickSurface=h.pickSurface,h.canvasPos?(u[0]=h.canvasPos[0],u[1]=h.canvasPos[1],f=e.camera.viewMatrix,v=e.camera.projMatrix,p.canvasPos=h.canvasPos):(h.matrix?(f=h.matrix,v=e.camera.projMatrix):(A.set(h.origin||[0,0,0]),c.set(h.direction||[0,0,1]),d=$.addVec3(A,c,t),r[0]=Math.random(),r[1]=Math.random(),r[2]=Math.random(),$.normalizeVec3(r),$.cross3Vec3(c,r,n),f=$.lookAtMat4v(A,d,n,i),v=e.camera.ortho.matrix,p.origin=A,p.direction=c),u[0]=.5*s.clientWidth,u[1]=.5*s.clientHeight),l)if(l.hasOwnProperty(g))for(var _=l[g].drawableList,y=0,b=_.length;y4&&void 0!==arguments[4]?arguments[4]:C;if(!n&&!o)return this.pick({canvasPos:t,pickSurface:!0});var A=e.canvas.resolutionScale;i.reset(),i.backfaces=!0,i.frontface=!0,i.pickZNear=e.camera.project.near,i.pickZFar=e.camera.project.far,s=s||30;var c=m.getRenderBuffer("uniquePickColors-aabs",{depthTexture:!0,size:[2*s+1,2*s+1]});i.snapVectorA=[k(t[0]*A,r.drawingBufferWidth),I(t[1]*A,r.drawingBufferHeight)],i.snapInvVectorAB=[r.drawingBufferWidth/(2*s),r.drawingBufferHeight/(2*s)],c.bind(r.RGBA32I,r.RGBA32I,r.RGBA8UI),r.viewport(0,0,c.size[0],c.size[1]),r.enable(r.DEPTH_TEST),r.frontFace(r.CCW),r.disable(r.CULL_FACE),r.depthMask(!0),r.disable(r.BLEND),r.depthFunc(r.LEQUAL),r.clear(r.DEPTH_BUFFER_BIT),r.clearBufferiv(r.COLOR,0,new Int32Array([0,0,0,0])),r.clearBufferiv(r.COLOR,1,new Int32Array([0,0,0,0])),r.clearBufferuiv(r.COLOR,2,new Uint32Array([0,0,0,0]));var h=e.camera.viewMatrix,d=e.camera.projMatrix;for(var p in l)if(l.hasOwnProperty(p))for(var f=l[p].drawableList,v=0,g=f.length;v0){var j=Math.floor(H/4),G=c.size[0],z=j%G-Math.floor(G/2),W=Math.floor(j/G)-Math.floor(G/2),K=Math.sqrt(Math.pow(z,2)+Math.pow(W,2));V.push({x:z,y:W,dist:K,isVertex:n&&o?B[H+3]>b.length/2:n,result:[B[H+0],B[H+1],B[H+2],B[H+3]],normal:[w[H+0],w[H+1],w[H+2],w[H+3]],id:[x[H+0],x[H+1],x[H+2],x[H+3]]})}var X=null,J=null,Y=null,Z=null;if(V.length>0){V.sort((function(e,t){return e.isVertex!==t.isVertex?e.isVertex?-1:1:e.dist-t.dist})),Z=V[0].isVertex?"vertex":"edge";var q=V[0].result,ee=V[0].normal,te=V[0].id,ie=b[q[3]],se=ie.origin,re=ie.coordinateScale;J=$.normalizeVec3([ee[0]/$.MAX_INT,ee[1]/$.MAX_INT,ee[2]/$.MAX_INT]),X=[q[0]*re[0]+se[0],q[1]*re[1]+se[1],q[2]*re[2]+se[2]],Y=a.items[te[0]+(te[1]<<8)+(te[2]<<16)+(te[3]<<24)]}if(null===P&&null==X)return null;var ne=null;null!==X&&(ne=e.camera.projectWorldPos(X));var oe=Y&&Y.delegatePickedEntity?Y.delegatePickedEntity():Y;return u.reset(),u.snappedToEdge="edge"===Z,u.snappedToVertex="vertex"===Z,u.worldPos=X,u.worldNormal=J,u.entity=oe,u.canvasPos=t,u.snappedCanvasPos=ne||t,u}),this.addMarker=function(t){this._occlusionTester=this._occlusionTester||new Rt(e,m),this._occlusionTester.addMarker(t),e.occlusionTestCountdown=0},this.markerWorldPosUpdated=function(e){this._occlusionTester.markerWorldPosUpdated(e)},this.removeMarker=function(e){this._occlusionTester.removeMarker(e)},this.doOcclusionTest=function(){if(this._occlusionTester&&this._occlusionTester.needOcclusionTest){for(var e in B(),this._occlusionTester.bindRenderBuf(),i.reset(),i.backfaces=!0,i.frontface=!0,r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.clearColor(0,0,0,0),r.enable(r.DEPTH_TEST),r.disable(r.CULL_FACE),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),l)if(l.hasOwnProperty(e))for(var t=l[e].drawableList,s=0,n=t.length;s0&&void 0!==arguments[0]?arguments[0]:{},t=m.getRenderBuffer("snapshot");e.width&&e.height&&t.setSize([e.width,e.height]),t.bind(),t.clear(),_=!0},this.renderSnapshot=function(){_&&(m.getRenderBuffer("snapshot").clear(),this.render({force:!0,opaqueOnly:!1}),h=!0)},this.readSnapshot=function(e){return m.getRenderBuffer("snapshot").readImage(e)},this.readSnapshotAsCanvas=function(){return m.getRenderBuffer("snapshot").readImageAsCanvas()},this.endSnapshot=function(){_&&(m.getRenderBuffer("snapshot").unbind(),_=!1)},this.destroy=function(){l={},u={},m.destroy(),y.destroy(),b.destroy(),this._occlusionTester&&this._occlusionTester.destroy()}},Jt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).KEY_BACKSPACE=8,s.KEY_TAB=9,s.KEY_ENTER=13,s.KEY_SHIFT=16,s.KEY_CTRL=17,s.KEY_ALT=18,s.KEY_PAUSE_BREAK=19,s.KEY_CAPS_LOCK=20,s.KEY_ESCAPE=27,s.KEY_PAGE_UP=33,s.KEY_PAGE_DOWN=34,s.KEY_END=35,s.KEY_HOME=36,s.KEY_LEFT_ARROW=37,s.KEY_UP_ARROW=38,s.KEY_RIGHT_ARROW=39,s.KEY_DOWN_ARROW=40,s.KEY_INSERT=45,s.KEY_DELETE=46,s.KEY_NUM_0=48,s.KEY_NUM_1=49,s.KEY_NUM_2=50,s.KEY_NUM_3=51,s.KEY_NUM_4=52,s.KEY_NUM_5=53,s.KEY_NUM_6=54,s.KEY_NUM_7=55,s.KEY_NUM_8=56,s.KEY_NUM_9=57,s.KEY_A=65,s.KEY_B=66,s.KEY_C=67,s.KEY_D=68,s.KEY_E=69,s.KEY_F=70,s.KEY_G=71,s.KEY_H=72,s.KEY_I=73,s.KEY_J=74,s.KEY_K=75,s.KEY_L=76,s.KEY_M=77,s.KEY_N=78,s.KEY_O=79,s.KEY_P=80,s.KEY_Q=81,s.KEY_R=82,s.KEY_S=83,s.KEY_T=84,s.KEY_U=85,s.KEY_V=86,s.KEY_W=87,s.KEY_X=88,s.KEY_Y=89,s.KEY_Z=90,s.KEY_LEFT_WINDOW=91,s.KEY_RIGHT_WINDOW=92,s.KEY_SELECT_KEY=93,s.KEY_NUMPAD_0=96,s.KEY_NUMPAD_1=97,s.KEY_NUMPAD_2=98,s.KEY_NUMPAD_3=99,s.KEY_NUMPAD_4=100,s.KEY_NUMPAD_5=101,s.KEY_NUMPAD_6=102,s.KEY_NUMPAD_7=103,s.KEY_NUMPAD_8=104,s.KEY_NUMPAD_9=105,s.KEY_MULTIPLY=106,s.KEY_ADD=107,s.KEY_SUBTRACT=109,s.KEY_DECIMAL_POINT=110,s.KEY_DIVIDE=111,s.KEY_F1=112,s.KEY_F2=113,s.KEY_F3=114,s.KEY_F4=115,s.KEY_F5=116,s.KEY_F6=117,s.KEY_F7=118,s.KEY_F8=119,s.KEY_F9=120,s.KEY_F10=121,s.KEY_F11=122,s.KEY_F12=123,s.KEY_NUM_LOCK=144,s.KEY_SCROLL_LOCK=145,s.KEY_SEMI_COLON=186,s.KEY_EQUAL_SIGN=187,s.KEY_COMMA=188,s.KEY_DASH=189,s.KEY_PERIOD=190,s.KEY_FORWARD_SLASH=191,s.KEY_GRAVE_ACCENT=192,s.KEY_OPEN_BRACKET=219,s.KEY_BACK_SLASH=220,s.KEY_CLOSE_BRACKET=221,s.KEY_SINGLE_QUOTE=222,s.KEY_SPACE=32,s.element=r.element,s.altDown=!1,s.ctrlDown=!1,s.mouseDownLeft=!1,s.mouseDownMiddle=!1,s.mouseDownRight=!1,s.keyDown=[],s.enabled=!0,s.keyboardEnabled=!0,s.mouseover=!1,s.mouseCanvasPos=$.vec2(),s._keyboardEventsElement=r.keyboardEventsElement||document,s._bindEvents(),s}return C(i,[{key:"_bindEvents",value:function(){var e=this;if(!this._eventsBound){this._keyboardEventsElement.addEventListener("keydown",this._keyDownListener=function(t){e.enabled&&e.keyboardEnabled&&"INPUT"!==t.target.tagName&&"TEXTAREA"!==t.target.tagName&&(t.keyCode===e.KEY_CTRL?e.ctrlDown=!0:t.keyCode===e.KEY_ALT?e.altDown=!0:t.keyCode===e.KEY_SHIFT&&(e.shiftDown=!0),e.keyDown[t.keyCode]=!0,e.fire("keydown",t.keyCode,!0))},!1),this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=function(t){e.enabled&&e.keyboardEnabled&&"INPUT"!==t.target.tagName&&"TEXTAREA"!==t.target.tagName&&(t.keyCode===e.KEY_CTRL?e.ctrlDown=!1:t.keyCode===e.KEY_ALT?e.altDown=!1:t.keyCode===e.KEY_SHIFT&&(e.shiftDown=!1),e.keyDown[t.keyCode]=!1,e.fire("keyup",t.keyCode,!0))}),this.element.addEventListener("mouseenter",this._mouseEnterListener=function(t){e.enabled&&(e.mouseover=!0,e._getMouseCanvasPos(t),e.fire("mouseenter",e.mouseCanvasPos,!0))}),this.element.addEventListener("mouseleave",this._mouseLeaveListener=function(t){e.enabled&&(e.mouseover=!1,e._getMouseCanvasPos(t),e.fire("mouseleave",e.mouseCanvasPos,!0))}),this.element.addEventListener("mousedown",this._mouseDownListener=function(t){if(e.enabled){switch(t.which){case 1:e.mouseDownLeft=!0;break;case 2:e.mouseDownMiddle=!0;break;case 3:e.mouseDownRight=!0}e._getMouseCanvasPos(t),e.element.focus(),e.fire("mousedown",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}}),document.addEventListener("mouseup",this._mouseUpListener=function(t){if(e.enabled){switch(t.which){case 1:e.mouseDownLeft=!1;break;case 2:e.mouseDownMiddle=!1;break;case 3:e.mouseDownRight=!1}e.fire("mouseup",e.mouseCanvasPos,!0)}},!0),document.addEventListener("click",this._clickListener=function(t){if(e.enabled){switch(t.which){case 1:case 3:e.mouseDownLeft=!1,e.mouseDownRight=!1;break;case 2:e.mouseDownMiddle=!1}e._getMouseCanvasPos(t),e.fire("click",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}}),document.addEventListener("dblclick",this._dblClickListener=function(t){if(e.enabled){switch(t.which){case 1:case 3:e.mouseDownLeft=!1,e.mouseDownRight=!1;break;case 2:e.mouseDownMiddle=!1}e._getMouseCanvasPos(t),e.fire("dblclick",e.mouseCanvasPos,!0),e.mouseover&&t.preventDefault()}});var t=this.scene.tickify((function(){return e.fire("mousemove",e.mouseCanvasPos,!0)}));this.element.addEventListener("mousemove",this._mouseMoveListener=function(i){e.enabled&&(e._getMouseCanvasPos(i),t(),e.mouseover&&i.preventDefault())});var i=this.scene.tickify((function(t){e.fire("mousewheel",t,!0)}));this.element.addEventListener("wheel",this._mouseWheelListener=function(t,s){if(e.enabled){var r=Math.max(-1,Math.min(1,40*-t.deltaY));i(r)}},{passive:!0});var s,r;this.on("mousedown",(function(e){s=e[0],r=e[1]})),this.on("mouseup",(function(t){s>=t[0]-2&&s<=t[0]+2&&r>=t[1]-2&&r<=t[1]+2&&e.fire("mouseclicked",t,!0)})),this._eventsBound=!0}}},{key:"_unbindEvents",value:function(){this._eventsBound&&(this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener),this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener),this.element.removeEventListener("mouseenter",this._mouseEnterListener),this.element.removeEventListener("mouseleave",this._mouseLeaveListener),this.element.removeEventListener("mousedown",this._mouseDownListener),document.removeEventListener("mouseup",this._mouseDownListener),document.removeEventListener("click",this._clickListener),document.removeEventListener("dblclick",this._dblClickListener),this.element.removeEventListener("mousemove",this._mouseMoveListener),this.element.removeEventListener("wheel",this._mouseWheelListener),window.OrientationChangeEvent&&window.removeEventListener("orientationchange",this._orientationchangedListener),window.DeviceMotionEvent&&window.removeEventListener("devicemotion",this._deviceMotionListener),window.DeviceOrientationEvent&&window.removeEventListener("deviceorientation",this._deviceOrientListener),this._eventsBound=!1)}},{key:"_getMouseCanvasPos",value:function(e){if(e){for(var t=e.target,i=0,s=0;t.offsetParent;)i+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;this.mouseCanvasPos[0]=e.pageX-i,this.mouseCanvasPos[1]=e.pageY-s}else e=window.event,this.mouseCanvasPos[0]=e.x,this.mouseCanvasPos[1]=e.y}},{key:"setEnabled",value:function(e){this.enabled!==e&&this.fire("enabled",this.enabled=e)}},{key:"getEnabled",value:function(){return this.enabled}},{key:"setKeyboardEnabled",value:function(e){this.keyboardEnabled=e}},{key:"getKeyboardEnabled",value:function(){return this.keyboardEnabled}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._unbindEvents()}}]),i}(),Yt=new Q({}),Zt=function(){function e(t){for(var i in x(this,e),this.id=Yt.addItem({}),t)t.hasOwnProperty(i)&&(this[i]=t[i])}return C(e,[{key:"destroy",value:function(){Yt.removeItem(this.id)}}]),e}(),qt=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({boundary:[0,0,100,100]}),s.boundary=r.boundary,s.autoBoundary=r.autoBoundary,s}return C(i,[{key:"type",get:function(){return"Viewport"}},{key:"boundary",get:function(){return this._state.boundary},set:function(e){if(!this._autoBoundary){if(!e){var t=this.scene.canvas.boundary;e=[0,0,t[2],t[3]]}this._state.boundary=e,this.glRedraw(),this.fire("boundary",this._state.boundary)}}},{key:"autoBoundary",get:function(){return this._autoBoundary},set:function(e){(e=!!e)!==this._autoBoundary&&(this._autoBoundary=e,this._autoBoundary?this._onCanvasSize=this.scene.canvas.on("boundary",(function(e){var t=e[2],i=e[3];this._state.boundary=[0,0,t,i],this.glRedraw(),this.fire("boundary",this._state.boundary)}),this):this._onCanvasSize&&(this.scene.canvas.off(this._onCanvasSize),this._onCanvasSize=null),this.fire("autoBoundary",this._autoBoundary))}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),$t=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s._fov=60,s._canvasResized=s.scene.canvas.on("boundary",s._needUpdate,b(s)),s.fov=r.fov,s.fovAxis=r.fovAxis,s.near=r.near,s.far=r.far,s}return C(i,[{key:"type",get:function(){return"Perspective"}},{key:"_update",value:function(){var e=this.scene.canvas.boundary,t=e[2]/e[3],i=this._fovAxis,s=this._fov;("x"===i||"min"===i&&t<1||"max"===i&&t>1)&&(s/=t),s=Math.min(s,120),$.perspectiveMat4(s*(Math.PI/180),t,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.camera._updateScheduled=!0,this.fire("matrix",this._state.matrix)}},{key:"fov",get:function(){return this._fov},set:function(e){(e=null!=e?e:60)!==this._fov&&(this._fov=e,this._needUpdate(0),this.fire("fov",this._fov))}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(e){e=e||"min",this._fovAxis!==e&&("x"!==e&&"y"!==e&&"min"!==e&&(this.error("Unsupported value for 'fovAxis': "+e+" - defaulting to 'min'"),e="min"),this._fovAxis=e,this._needUpdate(0),this.fire("fovAxis",this._fovAxis))}},{key:"near",get:function(){return this._state.near},set:function(e){var t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}},{key:"far",get:function(){return this._state.far},set:function(e){var t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this.scene.canvas.off(this._canvasResized)}}]),i}(),ei=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s.scale=r.scale,s.near=r.near,s.far=r.far,s._onCanvasBoundary=s.scene.canvas.on("boundary",s._needUpdate,b(s)),s}return C(i,[{key:"type",get:function(){return"Ortho"}},{key:"_update",value:function(){var e,t,i,s,r=this.scene,n=.5*this._scale,o=r.canvas.boundary,a=o[2],l=o[3],u=a/l;a>l?(e=-n,t=n,i=n/u,s=-n/u):(e=-n*u,t=n*u,i=n,s=-n),$.orthoMat4c(e,t,s,i,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"scale",get:function(){return this._scale},set:function(e){null==e&&(e=1),e<=0&&(e=.01),this._scale=e,this._needUpdate(0),this.fire("scale",this._scale)}},{key:"near",get:function(){return this._state.near},set:function(e){var t=null!=e?e:.1;this._state.near!==t&&(this._state.near=t,this._needUpdate(0),this.fire("near",this._state.near))}},{key:"far",get:function(){return this._state.far},set:function(e){var t=null!=e?e:1e4;this._state.far!==t&&(this._state.far=t,this._needUpdate(0),this.fire("far",this._state.far))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this.scene.canvas.off(this._onCanvasBoundary)}}]),i}(),ti=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4(),near:.1,far:1e4}),s._left=-1,s._right=1,s._bottom=-1,s._top=1,s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!0,s.left=r.left,s.right=r.right,s.bottom=r.bottom,s.top=r.top,s.near=r.near,s.far=r.far,s}return C(i,[{key:"type",get:function(){return"Frustum"}},{key:"_update",value:function(){$.frustumMat4(this._left,this._right,this._bottom,this._top,this._state.near,this._state.far,this._state.matrix),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"left",get:function(){return this._left},set:function(e){this._left=null!=e?e:-1,this._needUpdate(0),this.fire("left",this._left)}},{key:"right",get:function(){return this._right},set:function(e){this._right=null!=e?e:1,this._needUpdate(0),this.fire("right",this._right)}},{key:"top",get:function(){return this._top},set:function(e){this._top=null!=e?e:1,this._needUpdate(0),this.fire("top",this._top)}},{key:"bottom",get:function(){return this._bottom},set:function(e){this._bottom=null!=e?e:-1,this._needUpdate(0),this.fire("bottom",this._bottom)}},{key:"near",get:function(){return this._state.near},set:function(e){this._state.near=null!=e?e:.1,this._needUpdate(0),this.fire("near",this._state.near)}},{key:"far",get:function(){return this._state.far},set:function(e){this._state.far=null!=e?e:1e4,this._needUpdate(0),this.fire("far",this._state.far)}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),ii=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).camera=e,s._state=new Zt({matrix:$.mat4(),inverseMatrix:$.mat4(),transposedMatrix:$.mat4()}),s._inverseMatrixDirty=!0,s._transposedMatrixDirty=!1,s.matrix=r.matrix,s}return C(i,[{key:"type",get:function(){return"CustomProjection"}},{key:"matrix",get:function(){return this._state.matrix},set:function(e){this._state.matrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._inverseMatrixDirty=!0,this._transposedMatrixDirty=!0,this.glRedraw(),this.fire("matrix",this._state.matrix)}},{key:"inverseMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._inverseMatrixDirty&&($.inverseMat4(this._state.matrix,this._state.inverseMatrix),this._inverseMatrixDirty=!1),this._state.inverseMatrix}},{key:"transposedMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._transposedMatrixDirty&&($.transposeMat4(this._state.matrix,this._state.transposedMatrix),this._transposedMatrixDirty=!1),this._state.transposedMatrix}},{key:"unproject",value:function(e,t,i,s,r){var n=this.scene.canvas.canvas,o=n.offsetWidth/2,a=n.offsetHeight/2;return i[0]=(e[0]-o)/o,i[1]=(e[1]-a)/a,i[2]=t,i[3]=1,$.mulMat4v4(this.inverseMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1,$.mulMat4v4(this.camera.inverseViewMatrix,s,r),r}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),si=$.vec3(),ri=$.vec3(),ni=$.vec3(),oi=$.vec3(),ai=$.vec3(),li=$.vec3(),ui=$.vec4(),Ai=$.vec4(),ci=$.vec4(),hi=$.mat4(),di=$.mat4(),pi=$.vec3(),fi=$.vec3(),vi=$.vec3(),gi=$.vec3(),mi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({deviceMatrix:$.mat4(),hasDeviceMatrix:!1,matrix:$.mat4(),normalMatrix:$.mat4(),inverseMatrix:$.mat4()}),s._perspective=new $t(b(s)),s._ortho=new ei(b(s)),s._frustum=new ti(b(s)),s._customProjection=new ii(b(s)),s._project=s._perspective,s._eye=$.vec3([0,0,10]),s._look=$.vec3([0,0,0]),s._up=$.vec3([0,1,0]),s._worldUp=$.vec3([0,1,0]),s._worldRight=$.vec3([1,0,0]),s._worldForward=$.vec3([0,0,-1]),s.deviceMatrix=r.deviceMatrix,s.eye=r.eye,s.look=r.look,s.up=r.up,s.worldAxis=r.worldAxis,s.gimbalLock=r.gimbalLock,s.constrainPitch=r.constrainPitch,s.projection=r.projection,s._perspective.on("matrix",(function(){"perspective"===s._projectionType&&s.fire("projMatrix",s._perspective.matrix)})),s._ortho.on("matrix",(function(){"ortho"===s._projectionType&&s.fire("projMatrix",s._ortho.matrix)})),s._frustum.on("matrix",(function(){"frustum"===s._projectionType&&s.fire("projMatrix",s._frustum.matrix)})),s._customProjection.on("matrix",(function(){"customProjection"===s._projectionType&&s.fire("projMatrix",s._customProjection.matrix)})),s}return C(i,[{key:"type",get:function(){return"Camera"}},{key:"_update",value:function(){var e,t=this._state;"ortho"===this.projection?($.subVec3(this._eye,this._look,pi),$.normalizeVec3(pi,fi),$.mulVec3Scalar(fi,1e3,vi),$.addVec3(this._look,vi,gi),e=gi):e=this._eye,t.hasDeviceMatrix?($.lookAtMat4v(e,this._look,this._up,di),$.mulMat4(t.deviceMatrix,di,t.matrix)):$.lookAtMat4v(e,this._look,this._up,t.matrix),$.inverseMat4(this._state.matrix,this._state.inverseMatrix),$.transposeMat4(this._state.inverseMatrix,this._state.normalMatrix),this.glRedraw(),this.fire("matrix",this._state.matrix),this.fire("viewMatrix",this._state.matrix)}},{key:"orbitYaw",value:function(e){var t=$.subVec3(this._eye,this._look,si);$.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,hi),t=$.transformPoint3(hi,t,ri),this.eye=$.addVec3(this._look,t,ni),this.up=$.transformPoint3(hi,this._up,oi)}},{key:"orbitPitch",value:function(e){if(!(this._constrainPitch&&(e=$.dotVec3(this._up,this._worldUp)/$.DEGTORAD)<1)){var t=$.subVec3(this._eye,this._look,si),i=$.cross3Vec3($.normalizeVec3(t,ri),$.normalizeVec3(this._up,ni));$.rotationMat4v(.0174532925*e,i,hi),t=$.transformPoint3(hi,t,oi),this.up=$.transformPoint3(hi,this._up,ai),this.eye=$.addVec3(t,this._look,li)}}},{key:"yaw",value:function(e){var t=$.subVec3(this._look,this._eye,si);$.rotationMat4v(.0174532925*e,this._gimbalLock?this._worldUp:this._up,hi),t=$.transformPoint3(hi,t,ri),this.look=$.addVec3(t,this._eye,ni),this._gimbalLock&&(this.up=$.transformPoint3(hi,this._up,oi))}},{key:"pitch",value:function(e){if(!(this._constrainPitch&&(e=$.dotVec3(this._up,this._worldUp)/$.DEGTORAD)<1)){var t=$.subVec3(this._look,this._eye,si),i=$.cross3Vec3($.normalizeVec3(t,ri),$.normalizeVec3(this._up,ni));$.rotationMat4v(.0174532925*e,i,hi),this.up=$.transformPoint3(hi,this._up,li),t=$.transformPoint3(hi,t,oi),this.look=$.addVec3(t,this._eye,ai)}}},{key:"pan",value:function(e){var t,i=$.subVec3(this._eye,this._look,si),s=[0,0,0];if(0!==e[0]){var r=$.cross3Vec3($.normalizeVec3(i,[]),$.normalizeVec3(this._up,ri));t=$.mulVec3Scalar(r,e[0]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]}0!==e[1]&&(t=$.mulVec3Scalar($.normalizeVec3(this._up,ni),e[1]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]),0!==e[2]&&(t=$.mulVec3Scalar($.normalizeVec3(i,oi),e[2]),s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]),this.eye=$.addVec3(this._eye,s,ai),this.look=$.addVec3(this._look,s,li)}},{key:"zoom",value:function(e){var t=$.subVec3(this._eye,this._look,si),i=Math.abs($.lenVec3(t,ri)),s=Math.abs(i+e);if(!(s<.5)){var r=$.normalizeVec3(t,ni);this.eye=$.addVec3(this._look,$.mulVec3Scalar(r,s),oi)}}},{key:"eye",get:function(){return this._eye},set:function(e){this._eye.set(e||[0,0,10]),this._needUpdate(0),this.fire("eye",this._eye)}},{key:"look",get:function(){return this._look},set:function(e){this._look.set(e||[0,0,0]),this._needUpdate(0),this.fire("look",this._look)}},{key:"up",get:function(){return this._up},set:function(e){this._up.set(e||[0,1,0]),this._needUpdate(0),this.fire("up",this._up)}},{key:"deviceMatrix",get:function(){return this._state.deviceMatrix},set:function(e){this._state.deviceMatrix.set(e||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this._state.hasDeviceMatrix=!!e,this._needUpdate(0),this.fire("deviceMatrix",this._state.deviceMatrix)}},{key:"worldAxis",get:function(){return this._worldAxis},set:function(e){e=e||[1,0,0,0,1,0,0,0,1],this._worldAxis?this._worldAxis.set(e):this._worldAxis=$.vec3(e),this._worldRight[0]=this._worldAxis[0],this._worldRight[1]=this._worldAxis[1],this._worldRight[2]=this._worldAxis[2],this._worldUp[0]=this._worldAxis[3],this._worldUp[1]=this._worldAxis[4],this._worldUp[2]=this._worldAxis[5],this._worldForward[0]=this._worldAxis[6],this._worldForward[1]=this._worldAxis[7],this._worldForward[2]=this._worldAxis[8],this.fire("worldAxis",this._worldAxis)}},{key:"worldUp",get:function(){return this._worldUp}},{key:"xUp",get:function(){return this._worldUp[0]>this._worldUp[1]&&this._worldUp[0]>this._worldUp[2]}},{key:"yUp",get:function(){return this._worldUp[1]>this._worldUp[0]&&this._worldUp[1]>this._worldUp[2]}},{key:"zUp",get:function(){return this._worldUp[2]>this._worldUp[0]&&this._worldUp[2]>this._worldUp[1]}},{key:"worldRight",get:function(){return this._worldRight}},{key:"worldForward",get:function(){return this._worldForward}},{key:"gimbalLock",get:function(){return this._gimbalLock},set:function(e){this._gimbalLock=!1!==e,this.fire("gimbalLock",this._gimbalLock)}},{key:"constrainPitch",set:function(e){this._constrainPitch=!!e,this.fire("constrainPitch",this._constrainPitch)}},{key:"eyeLookDist",get:function(){return $.lenVec3($.subVec3(this._look,this._eye,si))}},{key:"matrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"viewMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.matrix}},{key:"normalMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}},{key:"viewNormalMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.normalMatrix}},{key:"inverseViewMatrix",get:function(){return this._updateScheduled&&this._doUpdate(),this._state.inverseMatrix}},{key:"projMatrix",get:function(){return this[this.projection].matrix}},{key:"perspective",get:function(){return this._perspective}},{key:"ortho",get:function(){return this._ortho}},{key:"frustum",get:function(){return this._frustum}},{key:"customProjection",get:function(){return this._customProjection}},{key:"projection",get:function(){return this._projectionType},set:function(e){e=e||"perspective",this._projectionType!==e&&("perspective"===e?this._project=this._perspective:"ortho"===e?this._project=this._ortho:"frustum"===e?this._project=this._frustum:"customProjection"===e?this._project=this._customProjection:(this.error("Unsupported value for 'projection': "+e+" defaulting to 'perspective'"),this._project=this._perspective,e="perspective"),this._project._update(),this._projectionType=e,this.glRedraw(),this._update(),this.fire("dirty"),this.fire("projection",this._projectionType),this.fire("projMatrix",this._project.matrix))}},{key:"project",get:function(){return this._project}},{key:"projectWorldPos",value:function(e){var t=ui,i=Ai,s=ci;t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,$.mulMat4v4(this.viewMatrix,t,i),$.mulMat4v4(this.projMatrix,i,s),$.mulVec3Scalar(s,1/s[3]),s[3]=1,s[1]*=-1;var r=this.scene.canvas.canvas,n=r.offsetWidth/2,o=r.offsetHeight/2;return[s[0]*n+n,s[1]*o+o]}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),_i=function(e){g(i,Be);var t=_(i);function i(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),t.call(this,e,s)}return C(i,[{key:"type",get:function(){return"Light"}},{key:"isLight",get:function(){return!0}}]),i}(),yi=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._shadowRenderBuf=null,s._shadowViewMatrix=null,s._shadowProjMatrix=null,s._shadowViewMatrixDirty=!0,s._shadowProjMatrixDirty=!0;var n=s.scene.camera,o=s.scene.canvas;return s._onCameraViewMatrix=n.on("viewMatrix",(function(){s._shadowViewMatrixDirty=!0})),s._onCameraProjMatrix=n.on("projMatrix",(function(){s._shadowProjMatrixDirty=!0})),s._onCanvasBoundary=o.on("boundary",(function(){s._shadowProjMatrixDirty=!0})),s._state=new Zt({type:"dir",dir:$.vec3([1,1,1]),color:$.vec3([.7,.7,.8]),intensity:1,space:r.space||"view",castsShadow:!1,getShadowViewMatrix:function(){if(s._shadowViewMatrixDirty){s._shadowViewMatrix||(s._shadowViewMatrix=$.identityMat4());var e=s.scene.camera,t=s._state.dir,i=e.look,r=[i[0]-t[0],i[1]-t[1],i[2]-t[2]];$.lookAtMat4v(r,i,[0,1,0],s._shadowViewMatrix),s._shadowViewMatrixDirty=!1}return s._shadowViewMatrix},getShadowProjMatrix:function(){return s._shadowProjMatrixDirty&&(s._shadowProjMatrix||(s._shadowProjMatrix=$.identityMat4()),$.orthoMat4c(-40,40,-40,40,-40,80,s._shadowProjMatrix),s._shadowProjMatrixDirty=!1),s._shadowProjMatrix},getShadowRenderBuf:function(){return s._shadowRenderBuf||(s._shadowRenderBuf=new zt(s.scene.canvas.canvas,s.scene.canvas.gl,{size:[1024,1024]})),s._shadowRenderBuf}}),s.dir=r.dir,s.color=r.color,s.intensity=r.intensity,s.castsShadow=r.castsShadow,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"DirLight"}},{key:"dir",get:function(){return this._state.dir},set:function(e){this._state.dir.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}},{key:"destroy",value:function(){var e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}]),i}(),bi=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state={type:"ambient",color:$.vec3([.7,.7,.7]),intensity:1},s.color=r.color,s.intensity=r.intensity,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"AmbientLight"}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){this._state.intensity=void 0!==e?e:1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._lightDestroyed(this)}}]),i}(),Bi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),s=t.call(this,e,r),se.memory.meshes++,s}return C(i,[{key:"type",get:function(){return"Geometry"}},{key:"isGeometry",get:function(){return!0}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),se.memory.meshes--}}]),i}(),wi=function(){var e=[],t=[],i=[],s=[],r=[],n=0,o=new Uint16Array(3),a=new Uint16Array(3),l=new Uint16Array(3),u=$.vec3(),A=$.vec3(),c=$.vec3(),h=$.vec3(),d=$.vec3(),p=$.vec3(),f=$.vec3();return function(v,g,m,_){!function(r,n){var o,a,l,u,A,c,h={},d=Math.pow(10,4),p=0;for(A=0,c=r.length;AI)||(F=i[P.index1],E=i[P.index2],(!S&&F>65535||E>65535)&&(S=!0),k.push(F),k.push(E));return S?new Uint32Array(k):new Uint16Array(k)}}();var xi=function(){var e=$.mat4(),t=$.mat4();return function(i,s){s=s||$.mat4();var r=i[0],n=i[1],o=i[2],a=i[3]-r,l=i[4]-n,u=i[5]-o,A=65535;return $.identityMat4(e),$.translationMat4v(i,e),$.identityMat4(t),$.scalingMat4v([a/A,l/A,u/A],t),$.mulMat4(e,t,s),s}}(),Pi=function(){var e=$.mat4(),t=$.mat4();return function(i,s,r){var n,o=new Uint16Array(i.length),a=new Float32Array([r[0]!==s[0]?65535/(r[0]-s[0]):0,r[1]!==s[1]?65535/(r[1]-s[1]):0,r[2]!==s[2]?65535/(r[2]-s[2]):0]);for(n=0;n=0?1:-1),a=(1-Math.abs(r))*(n>=0?1:-1);r=o,n=a}return new Int8Array([Math[i](127.5*r+(r<0?-1:0)),Math[s](127.5*n+(n<0?-1:0))])}function Fi(e){var t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;var s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));var r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}function Ei(e,t,i){return e[t]*i[0]+e[t+1]*i[1]+e[t+2]*i[2]}var ki={getPositionsBounds:function(e){var t,i,s=new Float32Array(3),r=new Float32Array(3);for(t=0;t<3;t++)s[t]=Number.MAX_VALUE,r[t]=-Number.MAX_VALUE;for(t=0;t2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;s2&&void 0!==arguments[2]?arguments[2]:e;return i[0]=e[0]*t[0]+t[12],i[1]=e[1]*t[5]+t[13],i[2]=e[2]*t[10]+t[14],i[3]=e[3]*t[0]+t[12],i[4]=e[4]*t[5]+t[13],i[5]=e[5]*t[10]+t[14],i},getUVBounds:function(e){var t,i,s=new Float32Array(2),r=new Float32Array(2);for(t=0;t<2;t++)s[t]=Number.MAX_VALUE,r[t]=-Number.MAX_VALUE;for(t=0;t2&&void 0!==arguments[2]?arguments[2]:new Float32Array(e.length),s=0,r=e.length;sr&&(i=t,r=s),(s=Ei(e,o,Fi(t=Mi(e,o,"floor","ceil"))))>r&&(i=t,r=s),(s=Ei(e,o,Fi(t=Mi(e,o,"ceil","ceil"))))>r&&(i=t,r=s),n[o]=i[0],n[o+1]=i[1];return n},decompressNormals:function(e,t){for(var i=0,s=0,r=e.length;i=0?1:-1),o=(1-Math.abs(n))*(o>=0?1:-1));var l=Math.sqrt(n*n+o*o+a*a);t[s+0]=n/l,t[s+1]=o/l,t[s+2]=a/l,s+=3}return t},decompressNormal:function(e,t){var i=e[0],s=e[1];i=(2*i+1)/255,s=(2*s+1)/255;var r=1-Math.abs(i)-Math.abs(s);r<0&&(i=(1-Math.abs(s))*(i>=0?1:-1),s=(1-Math.abs(i))*(s>=0?1:-1));var n=Math.sqrt(i*i+s*s+r*r);return t[0]=i/n,t[1]=s/n,t[2]=r/n,t}},Ii=se.memory,Di=$.AABB3(),Si=function(e){g(i,Bi);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._state=new Zt({compressGeometry:!!r.compressGeometry,primitive:null,primitiveName:null,positions:null,normals:null,colors:null,uv:null,indices:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),s._numTriangles=0,s._edgeThreshold=r.edgeThreshold||10,s._edgeIndicesBuf=null,s._pickTrianglePositionsBuf=null,s._pickTriangleColorsBuf=null,s._aabbDirty=!0,s._boundingSphere=!0,s._aabb=null,s._aabbDirty=!0,s._obb=null,s._obbDirty=!0;var n=s._state,o=s.scene.canvas.gl;switch(r.primitive=r.primitive||"triangles",r.primitive){case"points":n.primitive=o.POINTS,n.primitiveName=r.primitive;break;case"lines":n.primitive=o.LINES,n.primitiveName=r.primitive;break;case"line-loop":n.primitive=o.LINE_LOOP,n.primitiveName=r.primitive;break;case"line-strip":n.primitive=o.LINE_STRIP,n.primitiveName=r.primitive;break;case"triangles":n.primitive=o.TRIANGLES,n.primitiveName=r.primitive;break;case"triangle-strip":n.primitive=o.TRIANGLE_STRIP,n.primitiveName=r.primitive;break;case"triangle-fan":n.primitive=o.TRIANGLE_FAN,n.primitiveName=r.primitive;break;default:s.error("Unsupported value for 'primitive': '"+r.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),n.primitive=o.TRIANGLES,n.primitiveName=r.primitive}if(r.positions)if(s._state.compressGeometry){var a=ki.getPositionsBounds(r.positions),l=ki.compressPositions(r.positions,a.min,a.max);n.positions=l.quantized,n.positionsDecodeMatrix=l.decodeMatrix}else n.positions=r.positions.constructor===Float32Array?r.positions:new Float32Array(r.positions);if(r.colors&&(n.colors=r.colors.constructor===Float32Array?r.colors:new Float32Array(r.colors)),r.uv)if(s._state.compressGeometry){var u=ki.getUVBounds(r.uv),A=ki.compressUVs(r.uv,u.min,u.max);n.uv=A.quantized,n.uvDecodeMatrix=A.decodeMatrix}else n.uv=r.uv.constructor===Float32Array?r.uv:new Float32Array(r.uv);return r.normals&&(s._state.compressGeometry?n.normals=ki.compressNormals(r.normals):n.normals=r.normals.constructor===Float32Array?r.normals:new Float32Array(r.normals)),r.indices&&(n.indices=r.indices.constructor===Uint32Array||r.indices.constructor===Uint16Array?r.indices:new Uint32Array(r.indices),"triangles"===s._state.primitiveName&&(s._numTriangles=r.indices.length/3)),s._buildHash(),Ii.meshes++,s._buildVBOs(),s}return C(i,[{key:"type",get:function(){return"ReadableGeometry"}},{key:"isReadableGeometry",get:function(){return!0}},{key:"_buildVBOs",value:function(){var e=this._state,t=this.scene.canvas.gl;if(e.indices&&(e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,e.indices,e.indices.length,1,t.STATIC_DRAW),Ii.indices+=e.indicesBuf.numItems),e.positions&&(e.positionsBuf=new It(t,t.ARRAY_BUFFER,e.positions,e.positions.length,3,t.STATIC_DRAW),Ii.positions+=e.positionsBuf.numItems),e.normals){var i=e.compressGeometry;e.normalsBuf=new It(t,t.ARRAY_BUFFER,e.normals,e.normals.length,3,t.STATIC_DRAW,i),Ii.normals+=e.normalsBuf.numItems}e.colors&&(e.colorsBuf=new It(t,t.ARRAY_BUFFER,e.colors,e.colors.length,4,t.STATIC_DRAW),Ii.colors+=e.colorsBuf.numItems),e.uv&&(e.uvBuf=new It(t,t.ARRAY_BUFFER,e.uv,e.uv.length,2,t.STATIC_DRAW),Ii.uvs+=e.uvBuf.numItems)}},{key:"_buildHash",value:function(){var e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positions&&t.push("p"),e.colors&&t.push("c"),(e.normals||e.autoVertexNormals)&&t.push("n"),e.uv&&t.push("u"),e.compressGeometry&&t.push("cp"),t.push(";"),e.hash=t.join("")}},{key:"_getEdgeIndices",value:function(){return this._edgeIndicesBuf||this._buildEdgeIndices(),this._edgeIndicesBuf}},{key:"_getPickTrianglePositions",value:function(){return this._pickTrianglePositionsBuf||this._buildPickTriangleVBOs(),this._pickTrianglePositionsBuf}},{key:"_getPickTriangleColors",value:function(){return this._pickTriangleColorsBuf||this._buildPickTriangleVBOs(),this._pickTriangleColorsBuf}},{key:"_buildEdgeIndices",value:function(){var e=this._state;if(e.positions&&e.indices){var t=this.scene.canvas.gl,i=wi(e.positions,e.indices,e.positionsDecodeMatrix,this._edgeThreshold);this._edgeIndicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,i,i.length,1,t.STATIC_DRAW),Ii.indices+=this._edgeIndicesBuf.numItems}}},{key:"_buildPickTriangleVBOs",value:function(){var e=this._state;if(e.positions&&e.indices){var t=this.scene.canvas.gl,i=$.buildPickTriangles(e.positions,e.indices,e.compressGeometry),s=i.positions,r=i.colors;this._pickTrianglePositionsBuf=new It(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this._pickTriangleColorsBuf=new It(t,t.ARRAY_BUFFER,r,r.length,4,t.STATIC_DRAW,!0),Ii.positions+=this._pickTrianglePositionsBuf.numItems,Ii.colors+=this._pickTriangleColorsBuf.numItems}}},{key:"_buildPickVertexVBOs",value:function(){}},{key:"_webglContextLost",value:function(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextLost()}},{key:"_webglContextRestored",value:function(){this._sceneVertexBufs&&this._sceneVertexBufs.webglContextRestored(),this._buildVBOs(),this._edgeIndicesBuf=null,this._pickVertexPositionsBuf=null,this._pickTrianglePositionsBuf=null,this._pickTriangleColorsBuf=null,this._pickVertexPositionsBuf=null,this._pickVertexColorsBuf=null}},{key:"primitive",get:function(){return this._state.primitiveName}},{key:"compressGeometry",get:function(){return this._state.compressGeometry}},{key:"positions",get:function(){return this._state.positions?this._state.compressGeometry?(this._decompressedPositions||(this._decompressedPositions=new Float32Array(this._state.positions.length),ki.decompressPositions(this._state.positions,this._state.positionsDecodeMatrix,this._decompressedPositions)),this._decompressedPositions):this._state.positions:null},set:function(e){var t=this._state,i=t.positions;if(i)if(i.length===e.length){if(this._state.compressGeometry){var s=ki.getPositionsBounds(e),r=ki.compressPositions(e,s.min,s.max);e=r.quantized,t.positionsDecodeMatrix=r.decodeMatrix}i.set(e),t.positionsBuf&&t.positionsBuf.setData(i),this._setAABBDirty(),this.glRedraw()}else this.error("can't update geometry positions - new positions are wrong length");else this.error("can't update geometry positions - geometry has no positions")}},{key:"normals",get:function(){if(this._state.normals){if(!this._state.compressGeometry)return this._state.normals;if(!this._decompressedNormals){var e=this._state.normals.length,t=e+e/2;this._decompressedNormals=new Float32Array(t),ki.decompressNormals(this._state.normals,this._decompressedNormals)}return this._decompressedNormals}},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry normals - quantized geometry is immutable");else{var t=this._state,i=t.normals;i?i.length===e.length?(i.set(e),t.normalsBuf&&t.normalsBuf.setData(i),this.glRedraw()):this.error("can't update geometry normals - new normals are wrong length"):this.error("can't update geometry normals - geometry has no normals")}}},{key:"uv",get:function(){return this._state.uv?this._state.compressGeometry?(this._decompressedUV||(this._decompressedUV=new Float32Array(this._state.uv.length),ki.decompressUVs(this._state.uv,this._state.uvDecodeMatrix,this._decompressedUV)),this._decompressedUV):this._state.uv:null},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry UVs - quantized geometry is immutable");else{var t=this._state,i=t.uv;i?i.length===e.length?(i.set(e),t.uvBuf&&t.uvBuf.setData(i),this.glRedraw()):this.error("can't update geometry UVs - new UVs are wrong length"):this.error("can't update geometry UVs - geometry has no UVs")}}},{key:"colors",get:function(){return this._state.colors},set:function(e){if(this._state.compressGeometry)this.error("can't update geometry colors - quantized geometry is immutable");else{var t=this._state,i=t.colors;i?i.length===e.length?(i.set(e),t.colorsBuf&&t.colorsBuf.setData(i),this.glRedraw()):this.error("can't update geometry colors - new colors are wrong length"):this.error("can't update geometry colors - geometry has no colors")}}},{key:"indices",get:function(){return this._state.indices}},{key:"aabb",get:function(){return this._aabbDirty&&(this._aabb||(this._aabb=$.AABB3()),$.positions3ToAABB3(this._state.positions,this._aabb,this._state.positionsDecodeMatrix),this._aabbDirty=!1),this._aabb}},{key:"obb",get:function(){return this._obbDirty&&(this._obb||(this._obb=$.OBB3()),$.positions3ToAABB3(this._state.positions,Di,this._state.positionsDecodeMatrix),$.AABB3ToOBB3(Di,this._obb),this._obbDirty=!1),this._obb}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"_setAABBDirty",value:function(){this._aabbDirty||(this._aabbDirty=!0,this._aabbDirty=!0,this._obbDirty=!0)}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this);var e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),this._pickTrianglePositionsBuf&&this._pickTrianglePositionsBuf.destroy(),this._pickTriangleColorsBuf&&this._pickTriangleColorsBuf.destroy(),this._pickVertexPositionsBuf&&this._pickVertexPositionsBuf.destroy(),this._pickVertexColorsBuf&&this._pickVertexColorsBuf.destroy(),e.destroy(),Ii.meshes--}}]),i}();function Ti(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);var s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);var r=e.center,n=r?r[0]:0,o=r?r[1]:0,a=r?r[2]:0,l=-t+n,u=-i+o,A=-s+a,c=t+n,h=i+o,d=s+a;return le.apply(e,{positions:[c,h,d,l,h,d,l,u,d,c,u,d,c,h,d,c,u,d,c,u,A,c,h,A,c,h,d,c,h,A,l,h,A,l,h,d,l,h,d,l,h,A,l,u,A,l,u,d,l,u,A,c,u,A,c,u,d,l,u,d,c,u,A,l,u,A,l,h,A,c,h,A],normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],uv:[1,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]})}var Ri=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),s=t.call(this,e,r),se.memory.materials++,s}return C(i,[{key:"type",get:function(){return"Material"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),se.memory.materials--}}]),i}(),Li={opaque:0,mask:1,blend:2},Ui=["opaque","mask","blend"],Oi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"PhongMaterial",ambient:$.vec3([1,1,1]),diffuse:$.vec3([1,1,1]),specular:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),alpha:null,shininess:null,reflectivity:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.ambient=r.ambient,s.diffuse=r.diffuse,s.specular=r.specular,s.emissive=r.emissive,s.alpha=r.alpha,s.shininess=r.shininess,s.reflectivity=r.reflectivity,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,r.ambientMap&&(s._ambientMap=s._checkComponent("Texture",r.ambientMap)),r.diffuseMap&&(s._diffuseMap=s._checkComponent("Texture",r.diffuseMap)),r.specularMap&&(s._specularMap=s._checkComponent("Texture",r.specularMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.reflectivityMap&&(s._reflectivityMap=s._checkComponent("Texture",r.reflectivityMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.diffuseFresnel&&(s._diffuseFresnel=s._checkComponent("Fresnel",r.diffuseFresnel)),r.specularFresnel&&(s._specularFresnel=s._checkComponent("Fresnel",r.specularFresnel)),r.emissiveFresnel&&(s._emissiveFresnel=s._checkComponent("Fresnel",r.emissiveFresnel)),r.alphaFresnel&&(s._alphaFresnel=s._checkComponent("Fresnel",r.alphaFresnel)),r.reflectivityFresnel&&(s._reflectivityFresnel=s._checkComponent("Fresnel",r.reflectivityFresnel)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"PhongMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/p"];this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._ambientMap&&(t.push("/am"),this._ambientMap.hasMatrix&&t.push("/mat"),t.push("/"+this._ambientMap.encoding)),this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat"),t.push("/"+this._emissiveMap.encoding)),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),this._reflectivityMap&&(t.push("/rm"),this._reflectivityMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._diffuseFresnel&&t.push("/df"),this._specularFresnel&&t.push("/sf"),this._emissiveFresnel&&t.push("/ef"),this._alphaFresnel&&t.push("/of"),this._reflectivityFresnel&&t.push("/rf"),t.push(";"),e.hash=t.join("")}},{key:"ambient",get:function(){return this._state.ambient},set:function(e){var t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"diffuse",get:function(){return this._state.diffuse},set:function(e){var t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"specular",get:function(){return this._state.specular},set:function(e){var t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"shininess",get:function(){return this._state.shininess},set:function(e){this._state.shininess=void 0!==e?e:80,this.glRedraw()}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"reflectivity",get:function(){return this._state.reflectivity},set:function(e){this._state.reflectivity=void 0!==e?e:1,this.glRedraw()}},{key:"normalMap",get:function(){return this._normalMap}},{key:"ambientMap",get:function(){return this._ambientMap}},{key:"diffuseMap",get:function(){return this._diffuseMap}},{key:"specularMap",get:function(){return this._specularMap}},{key:"emissiveMap",get:function(){return this._emissiveMap}},{key:"alphaMap",get:function(){return this._alphaMap}},{key:"reflectivityMap",get:function(){return this._reflectivityMap}},{key:"occlusionMap",get:function(){return this._occlusionMap}},{key:"diffuseFresnel",get:function(){return this._diffuseFresnel}},{key:"specularFresnel",get:function(){return this._specularFresnel}},{key:"emissiveFresnel",get:function(){return this._emissiveFresnel}},{key:"alphaFresnel",get:function(){return this._alphaFresnel}},{key:"reflectivityFresnel",get:function(){return this._reflectivityFresnel}},{key:"alphaMode",get:function(){return Ui[this._state.alphaMode]},set:function(e){var t=Li[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" - defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Ni={default:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultWhiteBG:{fill:!0,fillColor:[1,1,1],fillAlpha:.6,edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.2,.2,.2],edgeAlpha:.5,edgeWidth:1},defaultDarkBG:{fill:!0,fillColor:[.4,.4,.4],fillAlpha:.2,edges:!0,edgeColor:[.5,.5,.5],edgeAlpha:.5,edgeWidth:1},phosphorous:{fill:!0,fillColor:[0,0,0],fillAlpha:.4,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:2},sunset:{fill:!0,fillColor:[.9,.9,.6],fillAlpha:.2,edges:!0,edgeColor:[.9,.9,.9],edgeAlpha:.5,edgeWidth:1},vectorscope:{fill:!0,fillColor:[0,0,0],fillAlpha:.7,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:!0,fillColor:[0,0,0],fillAlpha:1,edges:!0,edgeColor:[.2,1,.2],edgeAlpha:1,edgeWidth:3},sepia:{fill:!0,fillColor:[.970588207244873,.7965892553329468,.6660899519920349],fillAlpha:.4,edges:!0,edgeColor:[.529411792755127,.4577854573726654,.4100345969200134],edgeAlpha:1,edgeWidth:1},yellowHighlight:{fill:!0,fillColor:[1,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},greenSelected:{fill:!0,fillColor:[0,1,0],fillAlpha:.5,edges:!0,edgeColor:[1,1,1],edgeAlpha:1,edgeWidth:1},gamegrid:{fill:!0,fillColor:[.2,.2,.7],fillAlpha:.9,edges:!0,edgeColor:[.4,.4,1.6],edgeAlpha:.8,edgeWidth:3}},Qi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"EmphasisMaterial",fill:null,fillColor:null,fillAlpha:null,edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null,backfaces:!0,glowThrough:!0}),s._preset="default",r.preset?(s.preset=r.preset,void 0!==r.fill&&(s.fill=r.fill),r.fillColor&&(s.fillColor=r.fillColor),void 0!==r.fillAlpha&&(s.fillAlpha=r.fillAlpha),void 0!==r.edges&&(s.edges=r.edges),r.edgeColor&&(s.edgeColor=r.edgeColor),void 0!==r.edgeAlpha&&(s.edgeAlpha=r.edgeAlpha),void 0!==r.edgeWidth&&(s.edgeWidth=r.edgeWidth),void 0!==r.backfaces&&(s.backfaces=r.backfaces),void 0!==r.glowThrough&&(s.glowThrough=r.glowThrough)):(s.fill=r.fill,s.fillColor=r.fillColor,s.fillAlpha=r.fillAlpha,s.edges=r.edges,s.edgeColor=r.edgeColor,s.edgeAlpha=r.edgeAlpha,s.edgeWidth=r.edgeWidth,s.backfaces=r.backfaces,s.glowThrough=r.glowThrough),s}return C(i,[{key:"type",get:function(){return"EmphasisMaterial"}},{key:"presets",get:function(){return Ni}},{key:"fill",get:function(){return this._state.fill},set:function(e){e=!1!==e,this._state.fill!==e&&(this._state.fill=e,this.glRedraw())}},{key:"fillColor",get:function(){return this._state.fillColor},set:function(e){var t=this._state.fillColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.fillColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.4,t[1]=.4,t[2]=.4),this.glRedraw()}},{key:"fillAlpha",get:function(){return this._state.fillAlpha},set:function(e){e=null!=e?e:.2,this._state.fillAlpha!==e&&(this._state.fillAlpha=e,this.glRedraw())}},{key:"edges",get:function(){return this._state.edges},set:function(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){var t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"edgeAlpha",get:function(){return this._state.edgeAlpha},set:function(e){e=null!=e?e:.5,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}},{key:"edgeWidth",get:function(){return this._state.edgeWidth},set:function(e){this._state.edgeWidth=e||1,this.glRedraw()}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"glowThrough",get:function(){return this._state.glowThrough},set:function(e){e=!1!==e,this._state.glowThrough!==e&&(this._state.glowThrough=e,this.glRedraw())}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ni[e];t?(this.fill=t.fill,this.fillColor=t.fillColor,this.fillAlpha=t.fillAlpha,this.edges=t.edges,this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this.glowThrough=t.glowThrough,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ni).join(", "))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Vi={default:{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1},defaultWhiteBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultLightBG:{edgeColor:[.2,.2,.2],edgeAlpha:1,edgeWidth:1},defaultDarkBG:{edgeColor:[.5,.5,.5],edgeAlpha:1,edgeWidth:1}},Hi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"EdgeMaterial",edges:null,edgeColor:null,edgeAlpha:null,edgeWidth:null}),s._preset="default",r.preset?(s.preset=r.preset,r.edgeColor&&(s.edgeColor=r.edgeColor),void 0!==r.edgeAlpha&&(s.edgeAlpha=r.edgeAlpha),void 0!==r.edgeWidth&&(s.edgeWidth=r.edgeWidth)):(s.edgeColor=r.edgeColor,s.edgeAlpha=r.edgeAlpha,s.edgeWidth=r.edgeWidth),s.edges=!1!==r.edges,s}return C(i,[{key:"type",get:function(){return"EdgeMaterial"}},{key:"presets",get:function(){return Vi}},{key:"edges",get:function(){return this._state.edges},set:function(e){e=!1!==e,this._state.edges!==e&&(this._state.edges=e,this.glRedraw())}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){var t=this._state.edgeColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.edgeColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"edgeAlpha",get:function(){return this._state.edgeAlpha},set:function(e){e=null!=e?e:1,this._state.edgeAlpha!==e&&(this._state.edgeAlpha=e,this.glRedraw())}},{key:"edgeWidth",get:function(){return this._state.edgeWidth},set:function(e){this._state.edgeWidth=e||1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Vi[e];t?(this.edgeColor=t.edgeColor,this.edgeAlpha=t.edgeAlpha,this.edgeWidth=t.edgeWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Vi).join(", "))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),ji={meters:{abbrev:"m"},metres:{abbrev:"m"},centimeters:{abbrev:"cm"},centimetres:{abbrev:"cm"},millimeters:{abbrev:"mm"},millimetres:{abbrev:"mm"},yards:{abbrev:"yd"},feet:{abbrev:"ft"},inches:{abbrev:"in"}},Gi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._units="meters",s._scale=1,s._origin=$.vec3([0,0,0]),s.units=r.units,s.scale=r.scale,s.origin=r.origin,s}return C(i,[{key:"unitsInfo",get:function(){return ji}},{key:"units",get:function(){return this._units},set:function(e){e||(e="meters"),ji[e]||(this.error("Unsupported value for 'units': "+e+" defaulting to 'meters'"),e="meters"),this._units=e,this.fire("units",this._units)}},{key:"scale",get:function(){return this._scale},set:function(e){(e=e||1)<=0?this.error("scale value should be larger than zero"):(this._scale=e,this.fire("scale",this._scale))}},{key:"origin",get:function(){return this._origin},set:function(e){if(!e)return this._origin[0]=0,this._origin[1]=0,void(this._origin[2]=0);this._origin[0]=e[0],this._origin[1]=e[1],this._origin[2]=e[2],this.fire("origin",this._origin)}},{key:"worldToRealPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(3);t[0]=this._origin[0]+this._scale*e[0],t[1]=this._origin[1]+this._scale*e[1],t[2]=this._origin[2]+this._scale*e[2]}},{key:"realToWorldPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$.vec3(3);return t[0]=(e[0]-this._origin[0])/this._scale,t[1]=(e[1]-this._origin[1])/this._scale,t[2]=(e[2]-this._origin[2])/this._scale,t}}]),i}(),zi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._supported=yt.SUPPORTED_EXTENSIONS.OES_standard_derivatives,s.enabled=r.enabled,s.kernelRadius=r.kernelRadius,s.intensity=r.intensity,s.bias=r.bias,s.scale=r.scale,s.minResolution=r.minResolution,s.numSamples=r.numSamples,s.blur=r.blur,s.blendCutoff=r.blendCutoff,s.blendFactor=r.blendFactor,s}return C(i,[{key:"supported",get:function(){return this._supported}},{key:"enabled",get:function(){return this._enabled},set:function(e){e=!!e,this._enabled!==e&&(this._enabled=e,this.glRedraw())}},{key:"possible",get:function(){if(!this._supported)return!1;if(!this._enabled)return!1;var e=this.scene.camera.projection;return"customProjection"!==e&&"frustum"!==e}},{key:"active",get:function(){return this._active}},{key:"kernelRadius",get:function(){return this._kernelRadius},set:function(e){null==e&&(e=100),this._kernelRadius!==e&&(this._kernelRadius=e,this.glRedraw())}},{key:"intensity",get:function(){return this._intensity},set:function(e){null==e&&(e=.15),this._intensity!==e&&(this._intensity=e,this.glRedraw())}},{key:"bias",get:function(){return this._bias},set:function(e){null==e&&(e=.5),this._bias!==e&&(this._bias=e,this.glRedraw())}},{key:"scale",get:function(){return this._scale},set:function(e){null==e&&(e=1),this._scale!==e&&(this._scale=e,this.glRedraw())}},{key:"minResolution",get:function(){return this._minResolution},set:function(e){null==e&&(e=0),this._minResolution!==e&&(this._minResolution=e,this.glRedraw())}},{key:"numSamples",get:function(){return this._numSamples},set:function(e){null==e&&(e=10),this._numSamples!==e&&(this._numSamples=e,this.glRedraw())}},{key:"blur",get:function(){return this._blur},set:function(e){e=!1!==e,this._blur!==e&&(this._blur=e,this.glRedraw())}},{key:"blendCutoff",get:function(){return this._blendCutoff},set:function(e){null==e&&(e=.3),this._blendCutoff!==e&&(this._blendCutoff=e,this.glRedraw())}},{key:"blendFactor",get:function(){return this._blendFactor},set:function(e){null==e&&(e=1),this._blendFactor!==e&&(this._blendFactor=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Wi=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).sliceColor=r.sliceColor,s.sliceThickness=r.sliceThickness,s}return C(i,[{key:"sliceThickness",get:function(){return this._sliceThickness},set:function(e){null==e&&(e=0),this._sliceThickness!==e&&(this._sliceThickness=e,this.glRedraw())}},{key:"sliceColor",get:function(){return this._sliceColor},set:function(e){null==e&&(e=[0,0,0,1]),this._sliceColor!==e&&(this._sliceColor=e,this.glRedraw())}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Ki={default:{pointSize:4,roundPoints:!0,perspectivePoints:!0},square:{pointSize:4,roundPoints:!1,perspectivePoints:!0},round:{pointSize:4,roundPoints:!0,perspectivePoints:!0}},Xi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"PointsMaterial",pointSize:null,roundPoints:null,perspectivePoints:null,minPerspectivePointSize:null,maxPerspectivePointSize:null,filterIntensity:null,minIntensity:null,maxIntensity:null}),r.preset?(s.preset=r.preset,void 0!==r.pointSize&&(s.pointSize=r.pointSize),void 0!==r.roundPoints&&(s.roundPoints=r.roundPoints),void 0!==r.perspectivePoints&&(s.perspectivePoints=r.perspectivePoints),void 0!==r.minPerspectivePointSize&&(s.minPerspectivePointSize=r.minPerspectivePointSize),void 0!==r.maxPerspectivePointSize&&(s.maxPerspectivePointSize=r.minPerspectivePointSize)):(s._preset="default",s.pointSize=r.pointSize,s.roundPoints=r.roundPoints,s.perspectivePoints=r.perspectivePoints,s.minPerspectivePointSize=r.minPerspectivePointSize,s.maxPerspectivePointSize=r.maxPerspectivePointSize),s.filterIntensity=r.filterIntensity,s.minIntensity=r.minIntensity,s.maxIntensity=r.maxIntensity,s}return C(i,[{key:"type",get:function(){return"PointsMaterial"}},{key:"presets",get:function(){return Ki}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||2,this.glRedraw()}},{key:"roundPoints",get:function(){return this._state.roundPoints},set:function(e){e=!1!==e,this._state.roundPoints!==e&&(this._state.roundPoints=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"perspectivePoints",get:function(){return this._state.perspectivePoints},set:function(e){e=!1!==e,this._state.perspectivePoints!==e&&(this._state.perspectivePoints=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"minPerspectivePointSize",get:function(){return this._state.minPerspectivePointSize},set:function(e){this._state.minPerspectivePointSize=e||1,this.scene._needRecompile=!0,this.glRedraw()}},{key:"maxPerspectivePointSize",get:function(){return this._state.maxPerspectivePointSize},set:function(e){this._state.maxPerspectivePointSize=e||6,this.scene._needRecompile=!0,this.glRedraw()}},{key:"filterIntensity",get:function(){return this._state.filterIntensity},set:function(e){e=!1!==e,this._state.filterIntensity!==e&&(this._state.filterIntensity=e,this.scene._needRecompile=!0,this.glRedraw())}},{key:"minIntensity",get:function(){return this._state.minIntensity},set:function(e){this._state.minIntensity=null!=e?e:0,this.glRedraw()}},{key:"maxIntensity",get:function(){return this._state.maxIntensity},set:function(e){this._state.maxIntensity=null!=e?e:1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ki[e];t?(this.pointSize=t.pointSize,this.roundPoints=t.roundPoints,this.perspectivePoints=t.perspectivePoints,this.minPerspectivePointSize=t.minPerspectivePointSize,this.maxPerspectivePointSize=t.maxPerspectivePointSize,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ki).join(", "))}}},{key:"hash",get:function(){return[this.pointSize,this.roundPoints,this.perspectivePoints,this.minPerspectivePointSize,this.maxPerspectivePointSize,this.filterIntensity].join(";")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Ji={default:{lineWidth:1},thick:{lineWidth:2},thicker:{lineWidth:4}},Yi=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"LinesMaterial",lineWidth:null}),r.preset?(s.preset=r.preset,void 0!==r.lineWidth&&(s.lineWidth=r.lineWidth)):(s._preset="default",s.lineWidth=r.lineWidth),s}return C(i,[{key:"type",get:function(){return"LinesMaterial"}},{key:"presets",get:function(){return Ji}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"preset",get:function(){return this._preset},set:function(e){if(e=e||"default",this._preset!==e){var t=Ji[e];t?(this.lineWidth=t.lineWidth,this._preset=e):this.error("unsupported preset: '"+e+"' - supported values are "+Object.keys(Ji).join(", "))}}},{key:"hash",get:function(){return[""+this.lineWidth].join(";")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}();function Zi(e,t){for(var i,s,r={},n=0,o=t.length;n1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),s=t.call(this,null,r);var n=r.canvasElement||document.getElementById(r.canvasId);if(!(n instanceof HTMLCanvasElement))throw"Mandatory config expected: valid canvasId or canvasElement";s._tickifiedFunctions={};var o=!!r.transparent,a=!!r.alphaDepthMask;return s._aabbDirty=!0,s.viewer=e,s.occlusionTestCountdown=0,s.loading=0,s.startTime=(new Date).getTime(),s.models={},s.objects={},s._numObjects=0,s.visibleObjects={},s._numVisibleObjects=0,s.xrayedObjects={},s._numXRayedObjects=0,s.highlightedObjects={},s._numHighlightedObjects=0,s.selectedObjects={},s._numSelectedObjects=0,s.colorizedObjects={},s._numColorizedObjects=0,s.opacityObjects={},s._numOpacityObjects=0,s.offsetObjects={},s._numOffsetObjects=0,s._modelIds=null,s._objectIds=null,s._visibleObjectIds=null,s._xrayedObjectIds=null,s._highlightedObjectIds=null,s._selectedObjectIds=null,s._colorizedObjectIds=null,s._opacityObjectIds=null,s._offsetObjectIds=null,s._collidables={},s._compilables={},s._needRecompile=!1,s.types={},s.components={},s.sectionPlanes={},s.lights={},s.lightMaps={},s.reflectionMaps={},s.bitmaps={},s.lineSets={},s.realWorldOffset=r.realWorldOffset||new Float64Array([0,0,0]),s.canvas=new mt(b(s),{dontClear:!0,canvas:n,spinnerElementId:r.spinnerElementId,transparent:o,webgl2:!1!==r.webgl2,contextAttr:r.contextAttr||{},backgroundColor:r.backgroundColor,backgroundColorFromAmbientLight:r.backgroundColorFromAmbientLight,premultipliedAlpha:r.premultipliedAlpha}),s.canvas.on("boundary",(function(){s.glRedraw()})),s.canvas.on("webglContextFailed",(function(){alert("xeokit failed to find WebGL!")})),s._renderer=new Xt(b(s),{transparent:o,alphaDepthMask:a}),s._sectionPlanesState=new function(){this.sectionPlanes=[],this.clippingCaps=!1,this._numCachedSectionPlanes=0;var e=null;this.getHash=function(){if(e)return e;var t=this.getNumAllocatedSectionPlanes();if(this.sectionPlanes,0===t)return this.hash=";";for(var i=[],s=0,r=t;sthis._numCachedSectionPlanes?e:this._numCachedSectionPlanes}},s._sectionPlanesState.setNumCachedSectionPlanes(r.numCachedSectionPlanes||0),s._lightsState=new function(){var e=$.vec4([0,0,0,0]),t=$.vec4();this.lights=[],this.reflectionMaps=[],this.lightMaps=[];var i=null,s=null;this.getHash=function(){if(i)return i;for(var e,t=[],s=this.lights,r=0,n=s.length;r0&&t.push("/lm"),this.reflectionMaps.length>0&&t.push("/rm"),t.push(";"),i=t.join("")},this.addLight=function(e){this.lights.push(e),s=null,i=null},this.removeLight=function(e){for(var t=0,r=this.lights.length;t1&&void 0!==arguments[1])||arguments[1];e.visible?(this.visibleObjects[e.id]=e,this._numVisibleObjects++):(delete this.visibleObjects[e.id],this._numVisibleObjects--),this._visibleObjectIds=null,t&&this.fire("objectVisibility",e,!0)}},{key:"_deRegisterVisibleObject",value:function(e){delete this.visibleObjects[e.id],this._numVisibleObjects--,this._visibleObjectIds=null}},{key:"_objectXRayedUpdated",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.xrayed?(this.xrayedObjects[e.id]=e,this._numXRayedObjects++):(delete this.xrayedObjects[e.id],this._numXRayedObjects--),this._xrayedObjectIds=null,t&&this.fire("objectXRayed",e,!0)}},{key:"_deRegisterXRayedObject",value:function(e){delete this.xrayedObjects[e.id],this._numXRayedObjects--,this._xrayedObjectIds=null}},{key:"_objectHighlightedUpdated",value:function(e){e.highlighted?(this.highlightedObjects[e.id]=e,this._numHighlightedObjects++):(delete this.highlightedObjects[e.id],this._numHighlightedObjects--),this._highlightedObjectIds=null}},{key:"_deRegisterHighlightedObject",value:function(e){delete this.highlightedObjects[e.id],this._numHighlightedObjects--,this._highlightedObjectIds=null}},{key:"_objectSelectedUpdated",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.selected?(this.selectedObjects[e.id]=e,this._numSelectedObjects++):(delete this.selectedObjects[e.id],this._numSelectedObjects--),this._selectedObjectIds=null,t&&this.fire("objectSelected",e,!0)}},{key:"_deRegisterSelectedObject",value:function(e){delete this.selectedObjects[e.id],this._numSelectedObjects--,this._selectedObjectIds=null}},{key:"_objectColorizeUpdated",value:function(e,t){t?(this.colorizedObjects[e.id]=e,this._numColorizedObjects++):(delete this.colorizedObjects[e.id],this._numColorizedObjects--),this._colorizedObjectIds=null}},{key:"_deRegisterColorizedObject",value:function(e){delete this.colorizedObjects[e.id],this._numColorizedObjects--,this._colorizedObjectIds=null}},{key:"_objectOpacityUpdated",value:function(e,t){t?(this.opacityObjects[e.id]=e,this._numOpacityObjects++):(delete this.opacityObjects[e.id],this._numOpacityObjects--),this._opacityObjectIds=null}},{key:"_deRegisterOpacityObject",value:function(e){delete this.opacityObjects[e.id],this._numOpacityObjects--,this._opacityObjectIds=null}},{key:"_objectOffsetUpdated",value:function(e,t){!t||0===t[0]&&0===t[1]&&0===t[2]?(this.offsetObjects[e.id]=e,this._numOffsetObjects++):(delete this.offsetObjects[e.id],this._numOffsetObjects--),this._offsetObjectIds=null}},{key:"_deRegisterOffsetObject",value:function(e){delete this.offsetObjects[e.id],this._numOffsetObjects--,this._offsetObjectIds=null}},{key:"_webglContextLost",value:function(){for(var e in this.canvas.spinner.processes++,this.components)if(this.components.hasOwnProperty(e)){var t=this.components[e];t._webglContextLost&&t._webglContextLost()}this._renderer.webglContextLost()}},{key:"_webglContextRestored",value:function(){var e=this.canvas.gl;for(var t in this.components)if(this.components.hasOwnProperty(t)){var i=this.components[t];i._webglContextRestored&&i._webglContextRestored(e)}this._renderer.webglContextRestored(e),this.canvas.spinner.processes--}},{key:"capabilities",get:function(){return this._renderer.capabilities}},{key:"entityOffsetsEnabled",get:function(){return this._entityOffsetsEnabled}},{key:"pickSurfacePrecisionEnabled",get:function(){return!1}},{key:"logarithmicDepthBufferEnabled",get:function(){return this._logarithmicDepthBufferEnabled}},{key:"numCachedSectionPlanes",get:function(){return this._sectionPlanesState.getNumCachedSectionPlanes()},set:function(e){e=e||0,this._sectionPlanesState.getNumCachedSectionPlanes()!==e&&(this._sectionPlanesState.setNumCachedSectionPlanes(e),this._needRecompile=!0,this.glRedraw())}},{key:"pbrEnabled",get:function(){return this._pbrEnabled},set:function(e){this._pbrEnabled=!!e,this.glRedraw()}},{key:"dtxEnabled",get:function(){return this._dtxEnabled},set:function(e){e=!!e,this._dtxEnabled!==e&&(this._dtxEnabled=e)}},{key:"colorTextureEnabled",get:function(){return this._colorTextureEnabled},set:function(e){this._colorTextureEnabled=!!e,this.glRedraw()}},{key:"doOcclusionTest",value:function(){this._needRecompile&&(this._recompile(),this._needRecompile=!1),this._renderer.doOcclusionTest()}},{key:"render",value:function(e){e&&_e.runTasks();var t={sceneId:null,pass:0};if(this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),e||this._renderer.needsRender()){t.sceneId=this.id;var i,s,r=this._passes,n=this._clearEachPass;for(i=0;in&&(n=e[3]),e[4]>o&&(o=e[4]),e[5]>a&&(a=e[5]),u=!0}u||(i=-100,s=-100,r=-100,n=100,o=100,a=100),this._aabb[0]=i,this._aabb[1]=s,this._aabb[2]=r,this._aabb[3]=n,this._aabb[4]=o,this._aabb[5]=a,this._aabbDirty=!1}return this._aabb}},{key:"_setAABBDirty",value:function(){this._aabbDirty=!0,this.fire("boundary")}},{key:"pick",value:function(e,t){if(0===this.canvas.boundary[2]||0===this.canvas.boundary[3])return this.error("Picking not allowed while canvas has zero width or height"),null;(e=e||{}).pickSurface=e.pickSurface||e.rayPick,e.canvasPos||e.matrix||e.origin&&e.direction||this.warn("picking without canvasPos, matrix, or ray origin and direction");var i=e.includeEntities||e.include;i&&(e.includeEntityIds=Zi(this,i));var s=e.excludeEntities||e.exclude;return s&&(e.excludeEntityIds=Zi(this,s)),this._needRecompile&&(this._recompile(),this._renderer.imageDirty(),this._needRecompile=!1),(t=e.snapToEdge||e.snapToVertex?this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge,t):this._renderer.pick(e,t))&&t.entity&&t.entity.fire&&t.entity.fire("picked",t),t}},{key:"snapPick",value:function(e){return void 0===this._warnSnapPickDeprecated&&(this._warnSnapPickDeprecated=!0,this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead")),this._renderer.snapPick(e.canvasPos,e.snapRadius||30,e.snapToVertex,e.snapToEdge)}},{key:"clear",value:function(){var e;for(var t in this.components)this.components.hasOwnProperty(t)&&((e=this.components[t])._dontClear||e.destroy())}},{key:"clearLights",value:function(){for(var e=Object.keys(this.lights),t=0,i=e.length;to&&(o=t[3]),t[4]>a&&(a=t[4]),t[5]>l&&(l=t[5]),i=!0}})),i){var u=$.AABB3();return u[0]=s,u[1]=r,u[2]=n,u[3]=o,u[4]=a,u[5]=l,u}return this.aabb}},{key:"setObjectsVisible",value:function(e,t){return this.withObjects(e,(function(e){var i=e.visible!==t;return e.visible=t,i}))}},{key:"setObjectsCollidable",value:function(e,t){return this.withObjects(e,(function(e){var i=e.collidable!==t;return e.collidable=t,i}))}},{key:"setObjectsCulled",value:function(e,t){return this.withObjects(e,(function(e){var i=e.culled!==t;return e.culled=t,i}))}},{key:"setObjectsSelected",value:function(e,t){return this.withObjects(e,(function(e){var i=e.selected!==t;return e.selected=t,i}))}},{key:"setObjectsHighlighted",value:function(e,t){return this.withObjects(e,(function(e){var i=e.highlighted!==t;return e.highlighted=t,i}))}},{key:"setObjectsXRayed",value:function(e,t){return this.withObjects(e,(function(e){var i=e.xrayed!==t;return e.xrayed=t,i}))}},{key:"setObjectsEdges",value:function(e,t){return this.withObjects(e,(function(e){var i=e.edges!==t;return e.edges=t,i}))}},{key:"setObjectsColorized",value:function(e,t){return this.withObjects(e,(function(e){e.colorize=t}))}},{key:"setObjectsOpacity",value:function(e,t){return this.withObjects(e,(function(e){var i=e.opacity!==t;return e.opacity=t,i}))}},{key:"setObjectsPickable",value:function(e,t){return this.withObjects(e,(function(e){var i=e.pickable!==t;return e.pickable=t,i}))}},{key:"setObjectsOffset",value:function(e,t){this.withObjects(e,(function(e){e.offset=t}))}},{key:"withObjects",value:function(e,t){le.isString(e)&&(e=[e]);for(var i=!1,s=0,r=e.length;ss&&(s=r,e.apply(void 0,A(i)))}));return this._tickifiedFunctions[t]={tickSubId:o,wrapperFunc:n},n}},{key:"destroy",value:function(){for(var e in f(B(i.prototype),"destroy",this).call(this),this.components)this.components.hasOwnProperty(e)&&this.components[e].destroy();this.canvas.gl=null,this.components=null,this.models=null,this.objects=null,this.visibleObjects=null,this.xrayedObjects=null,this.highlightedObjects=null,this.selectedObjects=null,this.colorizedObjects=null,this.opacityObjects=null,this.sectionPlanes=null,this.lights=null,this.lightMaps=null,this.reflectionMaps=null,this._objectIds=null,this._visibleObjectIds=null,this._xrayedObjectIds=null,this._highlightedObjectIds=null,this._selectedObjectIds=null,this._colorizedObjectIds=null,this.types=null,this.components=null,this.canvas=null,this._renderer=null,this.input=null,this._viewport=null,this._camera=null}}]),i}(),$i=1e3,es=1001,ts=1002,is=1003,ss=1004,rs=1004,ns=1005,os=1005,as=1006,ls=1007,us=1007,As=1008,cs=1008,hs=1009,ds=1010,ps=1011,fs=1012,vs=1013,gs=1014,ms=1015,_s=1016,ys=1017,bs=1018,Bs=1020,ws=1021,xs=1022,Ps=1023,Cs=1024,Ms=1025,Fs=1026,Es=1027,ks=1028,Is=1029,Ds=1030,Ss=1031,Ts=1033,Rs=33776,Ls=33777,Us=33778,Os=33779,Ns=35840,Qs=35841,Vs=35842,Hs=35843,js=36196,Gs=37492,zs=37496,Ws=37808,Ks=37809,Xs=37810,Js=37811,Ys=37812,Zs=37813,qs=37814,$s=37815,er=37816,tr=37817,ir=37818,sr=37819,rr=37820,nr=37821,or=36492,ar=3e3,lr=3001,ur=1e4,Ar=10001,cr=10002,hr=10003,dr=function(e){"LambertMaterial"===e._material._state.type?(this.vertex=function(e){var t=e.scene,i=e.scene._sectionPlanesState,s=e.scene._lightsState,r=e._geometry._state,n=e._state.billboard,o=e._state.stationary,a=i.getNumAllocatedSectionPlanes()>0,l=!!r.compressGeometry,u=[];u.push("#version 300 es"),u.push("// Lambertian drawing vertex shader"),u.push("in vec3 position;"),u.push("uniform mat4 modelMatrix;"),u.push("uniform mat4 viewMatrix;"),u.push("uniform mat4 projMatrix;"),u.push("uniform vec4 colorize;"),u.push("uniform vec3 offset;"),l&&u.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(u.push("uniform float logDepthBufFC;"),u.push("out float vFragDepth;"),u.push("bool isPerspectiveMatrix(mat4 m) {"),u.push(" return (m[2][3] == - 1.0);"),u.push("}"),u.push("out float isPerspective;"));a&&u.push("out vec4 vWorldPosition;");if(u.push("uniform vec4 lightAmbient;"),u.push("uniform vec4 materialColor;"),u.push("uniform vec3 materialEmissive;"),r.normalsBuf){u.push("in vec3 normal;"),u.push("uniform mat4 modelNormalMatrix;"),u.push("uniform mat4 viewNormalMatrix;");for(var A=0,c=s.lights.length;A= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),u.push(" }"),u.push(" return normalize(v);"),u.push("}"))}u.push("out vec4 vColor;"),"points"===r.primitiveName&&u.push("uniform float pointSize;");"spherical"!==n&&"cylindrical"!==n||(u.push("void billboard(inout mat4 mat) {"),u.push(" mat[0][0] = 1.0;"),u.push(" mat[0][1] = 0.0;"),u.push(" mat[0][2] = 0.0;"),"spherical"===n&&(u.push(" mat[1][0] = 0.0;"),u.push(" mat[1][1] = 1.0;"),u.push(" mat[1][2] = 0.0;")),u.push(" mat[2][0] = 0.0;"),u.push(" mat[2][1] = 0.0;"),u.push(" mat[2][2] =1.0;"),u.push("}"));u.push("void main(void) {"),u.push("vec4 localPosition = vec4(position, 1.0); "),u.push("vec4 worldPosition;"),l&&u.push("localPosition = positionsDecodeMatrix * localPosition;");r.normalsBuf&&(l?u.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):u.push("vec4 localNormal = vec4(normal, 0.0); "),u.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),u.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));u.push("mat4 viewMatrix2 = viewMatrix;"),u.push("mat4 modelMatrix2 = modelMatrix;"),o&&u.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===n||"cylindrical"===n?(u.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),u.push("billboard(modelMatrix2);"),u.push("billboard(viewMatrix2);"),u.push("billboard(modelViewMatrix);"),r.normalsBuf&&(u.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),u.push("billboard(modelNormalMatrix2);"),u.push("billboard(viewNormalMatrix2);"),u.push("billboard(modelViewNormalMatrix);")),u.push("worldPosition = modelMatrix2 * localPosition;"),u.push("worldPosition.xyz = worldPosition.xyz + offset;"),u.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(u.push("worldPosition = modelMatrix2 * localPosition;"),u.push("worldPosition.xyz = worldPosition.xyz + offset;"),u.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));r.normalsBuf&&u.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(u.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),u.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),u.push("float lambertian = 1.0;"),r.normalsBuf)for(var d=0,p=s.lights.length;d0,n=t.gammaOutput,o=[];o.push("#version 300 es"),o.push("// Lambertian drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),t.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;"));if(r){o.push("in vec4 vWorldPosition;"),o.push("uniform bool clippable;");for(var a=0,l=i.getNumAllocatedSectionPlanes();a 0.0) { discard; }"),o.push("}")}"points"===s.primitiveName&&(o.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),o.push("float r = dot(cxy, cxy);"),o.push("if (r > 1.0) {"),o.push(" discard;"),o.push("}"));t.logarithmicDepthBufferEnabled&&o.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");n?o.push("outColor = linearToGamma(vColor, gammaFactor);"):o.push("outColor = vColor;");return o.push("}"),o}(e)):(this.vertex=function(e){var t=e.scene;e._material;var i,s=e._state,r=t._sectionPlanesState,n=e._geometry._state,o=t._lightsState,a=s.billboard,l=s.background,u=s.stationary,A=function(e){if(!e._geometry._state.uvBuf)return!1;var t=e._material;return!!(t._ambientMap||t._occlusionMap||t._baseColorMap||t._diffuseMap||t._alphaMap||t._specularMap||t._glossinessMap||t._specularGlossinessMap||t._emissiveMap||t._metallicMap||t._roughnessMap||t._metallicRoughnessMap||t._reflectivityMap||t._normalMap)}(e),c=vr(e),h=r.getNumAllocatedSectionPlanes()>0,d=fr(e),p=!!n.compressGeometry,f=[];f.push("#version 300 es"),f.push("// Drawing vertex shader"),f.push("in vec3 position;"),p&&f.push("uniform mat4 positionsDecodeMatrix;");f.push("uniform mat4 modelMatrix;"),f.push("uniform mat4 viewMatrix;"),f.push("uniform mat4 projMatrix;"),f.push("out vec3 vViewPosition;"),f.push("uniform vec3 offset;"),h&&f.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(f.push("uniform float logDepthBufFC;"),f.push("out float vFragDepth;"),f.push("bool isPerspectiveMatrix(mat4 m) {"),f.push(" return (m[2][3] == - 1.0);"),f.push("}"),f.push("out float isPerspective;"));o.lightMaps.length>0&&f.push("out vec3 vWorldNormal;");if(c){f.push("in vec3 normal;"),f.push("uniform mat4 modelNormalMatrix;"),f.push("uniform mat4 viewNormalMatrix;"),f.push("out vec3 vViewNormal;");for(var v=0,g=o.lights.length;v= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),f.push(" }"),f.push(" return normalize(v);"),f.push("}"))}A&&(f.push("in vec2 uv;"),f.push("out vec2 vUV;"),p&&f.push("uniform mat3 uvDecodeMatrix;"));n.colors&&(f.push("in vec4 color;"),f.push("out vec4 vColor;"));"points"===n.primitiveName&&f.push("uniform float pointSize;");"spherical"!==a&&"cylindrical"!==a||(f.push("void billboard(inout mat4 mat) {"),f.push(" mat[0][0] = 1.0;"),f.push(" mat[0][1] = 0.0;"),f.push(" mat[0][2] = 0.0;"),"spherical"===a&&(f.push(" mat[1][0] = 0.0;"),f.push(" mat[1][1] = 1.0;"),f.push(" mat[1][2] = 0.0;")),f.push(" mat[2][0] = 0.0;"),f.push(" mat[2][1] = 0.0;"),f.push(" mat[2][2] =1.0;"),f.push("}"));if(d){f.push("const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);");for(var m=0,_=o.lights.length;m<_;m++)o.lights[m].castsShadow&&(f.push("uniform mat4 shadowViewMatrix"+m+";"),f.push("uniform mat4 shadowProjMatrix"+m+";"),f.push("out vec4 vShadowPosFromLight"+m+";"))}f.push("void main(void) {"),f.push("vec4 localPosition = vec4(position, 1.0); "),f.push("vec4 worldPosition;"),p&&f.push("localPosition = positionsDecodeMatrix * localPosition;");c&&(p?f.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):f.push("vec4 localNormal = vec4(normal, 0.0); "),f.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),f.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));f.push("mat4 viewMatrix2 = viewMatrix;"),f.push("mat4 modelMatrix2 = modelMatrix;"),u?f.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;"):l&&f.push("viewMatrix2[3] = vec4(0.0, 0.0, 0.0 ,1.0);");"spherical"===a||"cylindrical"===a?(f.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),f.push("billboard(modelMatrix2);"),f.push("billboard(viewMatrix2);"),f.push("billboard(modelViewMatrix);"),c&&(f.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),f.push("billboard(modelNormalMatrix2);"),f.push("billboard(viewNormalMatrix2);"),f.push("billboard(modelViewNormalMatrix);")),f.push("worldPosition = modelMatrix2 * localPosition;"),f.push("worldPosition.xyz = worldPosition.xyz + offset;"),f.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(f.push("worldPosition = modelMatrix2 * localPosition;"),f.push("worldPosition.xyz = worldPosition.xyz + offset;"),f.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));if(c){f.push("vec3 worldNormal = (modelNormalMatrix2 * localNormal).xyz; "),o.lightMaps.length>0&&f.push("vWorldNormal = worldNormal;"),f.push("vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);"),f.push("vec3 tmpVec3;"),f.push("float lightDist;");for(var y=0,b=o.lights.length;y0,l=vr(e),u=s.uvBuf,A="PhongMaterial"===o.type,c="MetallicMaterial"===o.type,h="SpecularMaterial"===o.type,d=fr(e);t.gammaInput;var p=t.gammaOutput,f=[];f.push("#version 300 es"),f.push("// Drawing fragment shader"),f.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),f.push("precision highp float;"),f.push("precision highp int;"),f.push("#else"),f.push("precision mediump float;"),f.push("precision mediump int;"),f.push("#endif"),t.logarithmicDepthBufferEnabled&&(f.push("in float isPerspective;"),f.push("uniform float logDepthBufFC;"),f.push("in float vFragDepth;"));d&&(f.push("float unpackDepth (vec4 color) {"),f.push(" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));"),f.push(" return dot(color, bitShift);"),f.push("}"));f.push("uniform float gammaFactor;"),f.push("vec4 linearToLinear( in vec4 value ) {"),f.push(" return value;"),f.push("}"),f.push("vec4 sRGBToLinear( in vec4 value ) {"),f.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),f.push("}"),f.push("vec4 gammaToLinear( in vec4 value) {"),f.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),f.push("}"),p&&(f.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),f.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),f.push("}"));if(a){f.push("in vec4 vWorldPosition;"),f.push("uniform bool clippable;");for(var v=0;v0&&(f.push("uniform samplerCube lightMap;"),f.push("uniform mat4 viewNormalMatrix;")),n.reflectionMaps.length>0&&f.push("uniform samplerCube reflectionMap;"),(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("uniform mat4 viewMatrix;"),f.push("#define PI 3.14159265359"),f.push("#define RECIPROCAL_PI 0.31830988618"),f.push("#define RECIPROCAL_PI2 0.15915494"),f.push("#define EPSILON 1e-6"),f.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),f.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),f.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),f.push("}"),f.push("struct IncidentLight {"),f.push(" vec3 color;"),f.push(" vec3 direction;"),f.push("};"),f.push("struct ReflectedLight {"),f.push(" vec3 diffuse;"),f.push(" vec3 specular;"),f.push("};"),f.push("struct Geometry {"),f.push(" vec3 position;"),f.push(" vec3 viewNormal;"),f.push(" vec3 worldNormal;"),f.push(" vec3 viewEyeDir;"),f.push("};"),f.push("struct Material {"),f.push(" vec3 diffuseColor;"),f.push(" float specularRoughness;"),f.push(" vec3 specularColor;"),f.push(" float shine;"),f.push("};"),A&&((n.lightMaps.length>0||n.reflectionMaps.length>0)&&(f.push("void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.lightMaps.length>0&&(f.push(" vec3 irradiance = "+pr[n.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),n.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;"),f.push(" radiance *= PI;"),f.push(" reflectedLight.specular += radiance;")),f.push("}")),f.push("void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));"),f.push(" vec3 irradiance = dotNL * directLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);"),f.push("}")),(c||h)&&(f.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),f.push(" float r = ggxRoughness + 0.0001;"),f.push(" return (2.0 / (r * r) - 2.0);"),f.push("}"),f.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),f.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),f.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),f.push("}"),n.reflectionMaps.length>0&&(f.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),f.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),f.push(" vec3 envMapColor = "+pr[n.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),f.push(" return envMapColor;"),f.push("}")),f.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),f.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),f.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),f.push("}"),f.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" return 1.0 / ( gl * gv );"),f.push("}"),f.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),f.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),f.push(" return 0.5 / max( gv + gl, EPSILON );"),f.push("}"),f.push("float D_GGX(const in float alpha, const in float dotNH) {"),f.push(" float a2 = ( alpha * alpha );"),f.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),f.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float alpha = ( roughness * roughness );"),f.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),f.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),f.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),f.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),f.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),f.push(" vec3 F = F_Schlick( specularColor, dotLH );"),f.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),f.push(" float D = D_GGX( alpha, dotNH );"),f.push(" return F * (G * D);"),f.push("}"),f.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),f.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),f.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),f.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),f.push(" vec4 r = roughness * c0 + c1;"),f.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),f.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),f.push(" return specularColor * AB.x + AB.y;"),f.push("}"),(n.lightMaps.length>0||n.reflectionMaps.length>0)&&(f.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),n.lightMaps.length>0&&(f.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),f.push(" irradiance *= PI;"),f.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),n.reflectionMaps.length>0&&(f.push(" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);"),f.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),f.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),f.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),f.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),f.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),f.push("}")),f.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),f.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),f.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),f.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),f.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),f.push("}")));f.push("in vec3 vViewPosition;"),s.colors&&f.push("in vec4 vColor;");u&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._occlusionMap||i._alphaMap)&&f.push("in vec2 vUV;");l&&(n.lightMaps.length>0&&f.push("in vec3 vWorldNormal;"),f.push("in vec3 vViewNormal;"));o.ambient&&f.push("uniform vec3 materialAmbient;");o.baseColor&&f.push("uniform vec3 materialBaseColor;");void 0!==o.alpha&&null!==o.alpha&&f.push("uniform vec4 materialAlphaModeCutoff;");o.emissive&&f.push("uniform vec3 materialEmissive;");o.diffuse&&f.push("uniform vec3 materialDiffuse;");void 0!==o.glossiness&&null!==o.glossiness&&f.push("uniform float materialGlossiness;");void 0!==o.shininess&&null!==o.shininess&&f.push("uniform float materialShininess;");o.specular&&f.push("uniform vec3 materialSpecular;");void 0!==o.metallic&&null!==o.metallic&&f.push("uniform float materialMetallic;");void 0!==o.roughness&&null!==o.roughness&&f.push("uniform float materialRoughness;");void 0!==o.specularF0&&null!==o.specularF0&&f.push("uniform float materialSpecularF0;");u&&i._ambientMap&&(f.push("uniform sampler2D ambientMap;"),i._ambientMap._state.matrix&&f.push("uniform mat4 ambientMapMatrix;"));u&&i._baseColorMap&&(f.push("uniform sampler2D baseColorMap;"),i._baseColorMap._state.matrix&&f.push("uniform mat4 baseColorMapMatrix;"));u&&i._diffuseMap&&(f.push("uniform sampler2D diffuseMap;"),i._diffuseMap._state.matrix&&f.push("uniform mat4 diffuseMapMatrix;"));u&&i._emissiveMap&&(f.push("uniform sampler2D emissiveMap;"),i._emissiveMap._state.matrix&&f.push("uniform mat4 emissiveMapMatrix;"));l&&u&&i._metallicMap&&(f.push("uniform sampler2D metallicMap;"),i._metallicMap._state.matrix&&f.push("uniform mat4 metallicMapMatrix;"));l&&u&&i._roughnessMap&&(f.push("uniform sampler2D roughnessMap;"),i._roughnessMap._state.matrix&&f.push("uniform mat4 roughnessMapMatrix;"));l&&u&&i._metallicRoughnessMap&&(f.push("uniform sampler2D metallicRoughnessMap;"),i._metallicRoughnessMap._state.matrix&&f.push("uniform mat4 metallicRoughnessMapMatrix;"));l&&i._normalMap&&(f.push("uniform sampler2D normalMap;"),i._normalMap._state.matrix&&f.push("uniform mat4 normalMapMatrix;"),f.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),f.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),f.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),f.push(" vec2 st0 = dFdx( uv.st );"),f.push(" vec2 st1 = dFdy( uv.st );"),f.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),f.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),f.push(" vec3 N = normalize( surf_norm );"),f.push(" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;"),f.push(" mat3 tsn = mat3( S, T, N );"),f.push(" return normalize( tsn * mapN );"),f.push("}"));u&&i._occlusionMap&&(f.push("uniform sampler2D occlusionMap;"),i._occlusionMap._state.matrix&&f.push("uniform mat4 occlusionMapMatrix;"));u&&i._alphaMap&&(f.push("uniform sampler2D alphaMap;"),i._alphaMap._state.matrix&&f.push("uniform mat4 alphaMapMatrix;"));l&&u&&i._specularMap&&(f.push("uniform sampler2D specularMap;"),i._specularMap._state.matrix&&f.push("uniform mat4 specularMapMatrix;"));l&&u&&i._glossinessMap&&(f.push("uniform sampler2D glossinessMap;"),i._glossinessMap._state.matrix&&f.push("uniform mat4 glossinessMapMatrix;"));l&&u&&i._specularGlossinessMap&&(f.push("uniform sampler2D materialSpecularGlossinessMap;"),i._specularGlossinessMap._state.matrix&&f.push("uniform mat4 materialSpecularGlossinessMapMatrix;"));l&&(i._diffuseFresnel||i._specularFresnel||i._alphaFresnel||i._emissiveFresnel||i._reflectivityFresnel)&&(f.push("float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"),f.push(" float fr = abs(dot(eyeDir, normal));"),f.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),f.push(" return pow(finalFr, power);"),f.push("}"),i._diffuseFresnel&&(f.push("uniform float diffuseFresnelCenterBias;"),f.push("uniform float diffuseFresnelEdgeBias;"),f.push("uniform float diffuseFresnelPower;"),f.push("uniform vec3 diffuseFresnelCenterColor;"),f.push("uniform vec3 diffuseFresnelEdgeColor;")),i._specularFresnel&&(f.push("uniform float specularFresnelCenterBias;"),f.push("uniform float specularFresnelEdgeBias;"),f.push("uniform float specularFresnelPower;"),f.push("uniform vec3 specularFresnelCenterColor;"),f.push("uniform vec3 specularFresnelEdgeColor;")),i._alphaFresnel&&(f.push("uniform float alphaFresnelCenterBias;"),f.push("uniform float alphaFresnelEdgeBias;"),f.push("uniform float alphaFresnelPower;"),f.push("uniform vec3 alphaFresnelCenterColor;"),f.push("uniform vec3 alphaFresnelEdgeColor;")),i._reflectivityFresnel&&(f.push("uniform float materialSpecularF0FresnelCenterBias;"),f.push("uniform float materialSpecularF0FresnelEdgeBias;"),f.push("uniform float materialSpecularF0FresnelPower;"),f.push("uniform vec3 materialSpecularF0FresnelCenterColor;"),f.push("uniform vec3 materialSpecularF0FresnelEdgeColor;")),i._emissiveFresnel&&(f.push("uniform float emissiveFresnelCenterBias;"),f.push("uniform float emissiveFresnelEdgeBias;"),f.push("uniform float emissiveFresnelPower;"),f.push("uniform vec3 emissiveFresnelCenterColor;"),f.push("uniform vec3 emissiveFresnelEdgeColor;")));if(f.push("uniform vec4 lightAmbient;"),l)for(var g=0,m=n.lights.length;g 0.0) { discard; }"),f.push("}")}"points"===s.primitiveName&&(f.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),f.push("float r = dot(cxy, cxy);"),f.push("if (r > 1.0) {"),f.push(" discard;"),f.push("}"));f.push("float occlusion = 1.0;"),o.ambient?f.push("vec3 ambientColor = materialAmbient;"):f.push("vec3 ambientColor = vec3(1.0, 1.0, 1.0);");o.diffuse?f.push("vec3 diffuseColor = materialDiffuse;"):o.baseColor?f.push("vec3 diffuseColor = materialBaseColor;"):f.push("vec3 diffuseColor = vec3(1.0, 1.0, 1.0);");s.colors&&f.push("diffuseColor *= vColor.rgb;");o.emissive?f.push("vec3 emissiveColor = materialEmissive;"):f.push("vec3 emissiveColor = vec3(0.0, 0.0, 0.0);");o.specular?f.push("vec3 specular = materialSpecular;"):f.push("vec3 specular = vec3(1.0, 1.0, 1.0);");void 0!==o.alpha?f.push("float alpha = materialAlphaModeCutoff[0];"):f.push("float alpha = 1.0;");s.colors&&f.push("alpha *= vColor.a;");void 0!==o.glossiness?f.push("float glossiness = materialGlossiness;"):f.push("float glossiness = 1.0;");void 0!==o.metallic?f.push("float metallic = materialMetallic;"):f.push("float metallic = 1.0;");void 0!==o.roughness?f.push("float roughness = materialRoughness;"):f.push("float roughness = 1.0;");void 0!==o.specularF0?f.push("float specularF0 = materialSpecularF0;"):f.push("float specularF0 = 1.0;");u&&(l&&i._normalMap||i._ambientMap||i._baseColorMap||i._diffuseMap||i._occlusionMap||i._emissiveMap||i._metallicMap||i._roughnessMap||i._metallicRoughnessMap||i._specularMap||i._glossinessMap||i._specularGlossinessMap||i._alphaMap)&&(f.push("vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);"),f.push("vec2 textureCoord;"));u&&i._ambientMap&&(i._ambientMap._state.matrix?f.push("textureCoord = (ambientMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;"),f.push("ambientTexel = "+pr[i._ambientMap._state.encoding]+"(ambientTexel);"),f.push("ambientColor *= ambientTexel.rgb;"));u&&i._diffuseMap&&(i._diffuseMap._state.matrix?f.push("textureCoord = (diffuseMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 diffuseTexel = texture(diffuseMap, textureCoord);"),f.push("diffuseTexel = "+pr[i._diffuseMap._state.encoding]+"(diffuseTexel);"),f.push("diffuseColor *= diffuseTexel.rgb;"),f.push("alpha *= diffuseTexel.a;"));u&&i._baseColorMap&&(i._baseColorMap._state.matrix?f.push("textureCoord = (baseColorMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 baseColorTexel = texture(baseColorMap, textureCoord);"),f.push("baseColorTexel = "+pr[i._baseColorMap._state.encoding]+"(baseColorTexel);"),f.push("diffuseColor *= baseColorTexel.rgb;"),f.push("alpha *= baseColorTexel.a;"));u&&i._emissiveMap&&(i._emissiveMap._state.matrix?f.push("textureCoord = (emissiveMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 emissiveTexel = texture(emissiveMap, textureCoord);"),f.push("emissiveTexel = "+pr[i._emissiveMap._state.encoding]+"(emissiveTexel);"),f.push("emissiveColor = emissiveTexel.rgb;"));u&&i._alphaMap&&(i._alphaMap._state.matrix?f.push("textureCoord = (alphaMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("alpha *= texture(alphaMap, textureCoord).r;"));u&&i._occlusionMap&&(i._occlusionMap._state.matrix?f.push("textureCoord = (occlusionMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("occlusion *= texture(occlusionMap, textureCoord).r;"));if(l&&(n.lights.length>0||n.lightMaps.length>0||n.reflectionMaps.length>0)){u&&i._normalMap?(i._normalMap._state.matrix?f.push("textureCoord = (normalMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );")):f.push("vec3 viewNormal = normalize(vViewNormal);"),u&&i._specularMap&&(i._specularMap._state.matrix?f.push("textureCoord = (specularMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("specular *= texture(specularMap, textureCoord).rgb;")),u&&i._glossinessMap&&(i._glossinessMap._state.matrix?f.push("textureCoord = (glossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("glossiness *= texture(glossinessMap, textureCoord).r;")),u&&i._specularGlossinessMap&&(i._specularGlossinessMap._state.matrix?f.push("textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;"),f.push("specular *= specGlossRGB.rgb;"),f.push("glossiness *= specGlossRGB.a;")),u&&i._metallicMap&&(i._metallicMap._state.matrix?f.push("textureCoord = (metallicMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("metallic *= texture(metallicMap, textureCoord).r;")),u&&i._roughnessMap&&(i._roughnessMap._state.matrix?f.push("textureCoord = (roughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("roughness *= texture(roughnessMap, textureCoord).r;")),u&&i._metallicRoughnessMap&&(i._metallicRoughnessMap._state.matrix?f.push("textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;"):f.push("textureCoord = texturePos.xy;"),f.push("vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;"),f.push("metallic *= metalRoughRGB.b;"),f.push("roughness *= metalRoughRGB.g;")),f.push("vec3 viewEyeDir = normalize(-vViewPosition);"),i._diffuseFresnel&&(f.push("float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);"),f.push("diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);")),i._specularFresnel&&(f.push("float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);"),f.push("specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);")),i._alphaFresnel&&(f.push("float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);"),f.push("alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);")),i._emissiveFresnel&&(f.push("float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);"),f.push("emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);")),f.push("if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {"),f.push(" discard;"),f.push("}"),f.push("IncidentLight light;"),f.push("Material material;"),f.push("Geometry geometry;"),f.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),f.push("vec3 viewLightDir;"),A&&(f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;"),f.push("material.shine = materialShininess;")),h&&(f.push("float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);"),f.push("material.diffuseColor = diffuseColor * oneMinusSpecularStrength;"),f.push("material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );"),f.push("material.specularColor = specular;")),c&&(f.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),f.push("material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),f.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),f.push("material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);")),f.push("geometry.position = vViewPosition;"),n.lightMaps.length>0&&f.push("geometry.worldNormal = normalize(vWorldNormal);"),f.push("geometry.viewNormal = viewNormal;"),f.push("geometry.viewEyeDir = viewEyeDir;"),A&&(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("computePhongLightMapping(geometry, material, reflectedLight);"),(h||c)&&(n.lightMaps.length>0||n.reflectionMaps.length>0)&&f.push("computePBRLightMapping(geometry, material, reflectedLight);"),f.push("float shadow = 1.0;"),f.push("float shadowAcneRemover = 0.007;"),f.push("vec3 fragmentDepth;"),f.push("float texelSize = 1.0 / 1024.0;"),f.push("float amountInLight = 0.0;"),f.push("vec3 shadowCoord;"),f.push("vec4 rgbaDepth;"),f.push("float depth;");for(var B=0,w=n.lights.length;B0)for(var f=s._sectionPlanesState.sectionPlanes,v=t.renderFlags,g=0;g0&&(this._uLightMap="lightMap"),r.reflectionMaps.length>0&&(this._uReflectionMap="reflectionMap"),this._uSectionPlanes=[];for(A=0,c=n.sectionPlanes.length;A0&&n.lightMaps[0].texture&&this._uLightMap&&(a.bindTexture(this._uLightMap,n.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%i,e.bindTexture++),n.reflectionMaps.length>0&&n.reflectionMaps[0].texture&&this._uReflectionMap&&(a.bindTexture(this._uReflectionMap,n.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%i,e.bindTexture++),this._uGammaFactor&&r.uniform1f(this._uGammaFactor,s.gammaFactor),this._baseTextureUnit=e.textureUnit};var br=C((function e(t){x(this,e),this.vertex=function(e){var t=e.scene,i=t._lightsState,s=function(e){var t=e._geometry._state.primitiveName;if((e._geometry._state.autoVertexNormals||e._geometry._state.normalsBuf)&&("triangles"===t||"triangle-strip"===t||"triangle-fan"===t))return!0;return!1}(e),r=t._sectionPlanesState.getNumAllocatedSectionPlanes()>0,n=!!e._geometry._state.compressGeometry,o=e._state.billboard,a=e._state.stationary,l=[];l.push("#version 300 es"),l.push("// EmphasisFillShaderSource vertex shader"),l.push("in vec3 position;"),l.push("uniform mat4 modelMatrix;"),l.push("uniform mat4 viewMatrix;"),l.push("uniform mat4 projMatrix;"),l.push("uniform vec4 colorize;"),l.push("uniform vec3 offset;"),n&&l.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(l.push("uniform float logDepthBufFC;"),l.push("out float vFragDepth;"),l.push("bool isPerspectiveMatrix(mat4 m) {"),l.push(" return (m[2][3] == - 1.0);"),l.push("}"),l.push("out float isPerspective;"));r&&l.push("out vec4 vWorldPosition;");if(l.push("uniform vec4 lightAmbient;"),l.push("uniform vec4 fillColor;"),s){l.push("in vec3 normal;"),l.push("uniform mat4 modelNormalMatrix;"),l.push("uniform mat4 viewNormalMatrix;");for(var u=0,A=i.lights.length;u= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),l.push(" }"),l.push(" return normalize(v);"),l.push("}"))}l.push("out vec4 vColor;"),("spherical"===o||"cylindrical"===o)&&(l.push("void billboard(inout mat4 mat) {"),l.push(" mat[0][0] = 1.0;"),l.push(" mat[0][1] = 0.0;"),l.push(" mat[0][2] = 0.0;"),"spherical"===o&&(l.push(" mat[1][0] = 0.0;"),l.push(" mat[1][1] = 1.0;"),l.push(" mat[1][2] = 0.0;")),l.push(" mat[2][0] = 0.0;"),l.push(" mat[2][1] = 0.0;"),l.push(" mat[2][2] =1.0;"),l.push("}"));l.push("void main(void) {"),l.push("vec4 localPosition = vec4(position, 1.0); "),l.push("vec4 worldPosition;"),n&&l.push("localPosition = positionsDecodeMatrix * localPosition;");s&&(n?l.push("vec4 localNormal = vec4(octDecode(normal.xy), 0.0); "):l.push("vec4 localNormal = vec4(normal, 0.0); "),l.push("mat4 modelNormalMatrix2 = modelNormalMatrix;"),l.push("mat4 viewNormalMatrix2 = viewNormalMatrix;"));l.push("mat4 viewMatrix2 = viewMatrix;"),l.push("mat4 modelMatrix2 = modelMatrix;"),a&&l.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===o||"cylindrical"===o?(l.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),l.push("billboard(modelMatrix2);"),l.push("billboard(viewMatrix2);"),l.push("billboard(modelViewMatrix);"),s&&(l.push("mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;"),l.push("billboard(modelNormalMatrix2);"),l.push("billboard(viewNormalMatrix2);"),l.push("billboard(modelViewNormalMatrix);")),l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(l.push("worldPosition = modelMatrix2 * localPosition;"),l.push("worldPosition.xyz = worldPosition.xyz + offset;"),l.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));s&&l.push("vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);");if(l.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),l.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),l.push("float lambertian = 1.0;"),s)for(var h=0,d=i.lights.length;h0,n=[];n.push("#version 300 es"),n.push("// Lambertian drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));s&&(n.push("uniform float gammaFactor;"),n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(var o=0,a=i.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),n.push("}")}"points"===e._geometry._state.primitiveName&&(n.push("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),n.push("float r = dot(cxy, cxy);"),n.push("if (r > 1.0) {"),n.push(" discard;"),n.push("}"));t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(t)}));var Br=new Q({}),wr=$.vec3(),xr=function(e,t){this.id=Br.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new br(t),this._allocate(t)},Pr={};xr.get=function(e){var t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.normalsBuf?"n":"",e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=Pr[t];return i||(i=new xr(t,e),Pr[t]=i,se.memory.programs++),i._useCount++,i},xr.prototype.put=function(){0==--this._useCount&&(Br.removeItem(this.id),this._program&&this._program.destroy(),delete Pr[this._hash],se.memory.programs--)},xr.prototype.webglContextRestored=function(){this._program=null},xr.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);var s=this._scene,r=s.camera,n=s.canvas.gl,o=0===i?t._xrayMaterial._state:1===i?t._highlightMaterial._state:t._selectedMaterial._state,a=t._state,l=t._geometry._state,u=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),n.uniformMatrix4fv(this._uViewMatrix,!1,u?e.getRTCViewMatrix(a.originHash,u):r.viewMatrix),n.uniformMatrix4fv(this._uViewNormalMatrix,!1,r.viewNormalMatrix),a.clippable){var A=s._sectionPlanesState.getNumAllocatedSectionPlanes(),c=s._sectionPlanesState.sectionPlanes.length;if(A>0)for(var h=s._sectionPlanesState.sectionPlanes,d=t.renderFlags,p=0;p0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Edges drawing vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform vec4 edgeColor;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));i&&o.push("out vec4 vWorldPosition;");o.push("out vec4 vColor;"),("spherical"===r||"cylindrical"===r)&&(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),o.push("vec4 worldPosition;"),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"),o.push("billboard(modelViewMatrix);"),o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));o.push("vColor = edgeColor;"),i&&o.push("vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = clipPos;"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=e.scene._sectionPlanesState,s=e.scene.gammaOutput,r=i.getNumAllocatedSectionPlanes()>0,n=[];n.push("#version 300 es"),n.push("// Edges drawing fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),t.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;"));s&&(n.push("uniform float gammaFactor;"),n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}"));if(r){n.push("in vec4 vWorldPosition;"),n.push("uniform bool clippable;");for(var o=0,a=i.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),n.push("}")}t.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");s?n.push("outColor = linearToGamma(vColor, gammaFactor);"):n.push("outColor = vColor;");return n.push("}"),n}(t)}));var Mr=new Q({}),Fr=$.vec3(),Er=function(e,t){this.id=Mr.addItem({}),this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Cr(t),this._allocate(t)},kr={};Er.get=function(e){var t=[e.scene.id,e.scene.gammaOutput?"go":"",e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=kr[t];return i||(i=new Er(t,e),kr[t]=i,se.memory.programs++),i._useCount++,i},Er.prototype.put=function(){0==--this._useCount&&(Mr.removeItem(this.id),this._program&&this._program.destroy(),delete kr[this._hash],se.memory.programs--)},Er.prototype.webglContextRestored=function(){this._program=null},Er.prototype.drawMesh=function(e,t,i){this._program||this._allocate(t);var s,r,n=this._scene,o=n.camera,a=n.canvas.gl,l=t._state,u=t._geometry,A=u._state,c=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),a.uniformMatrix4fv(this._uViewMatrix,!1,c?e.getRTCViewMatrix(l.originHash,c):o.viewMatrix),l.clippable){var h=n._sectionPlanesState.getNumAllocatedSectionPlanes(),d=n._sectionPlanesState.sectionPlanes.length;if(h>0)for(var p=n._sectionPlanesState.sectionPlanes,f=t.renderFlags,v=0;v0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Mesh picking vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("out vec4 vViewPosition;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");i&&o.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("uniform vec2 pickClipPos;"),o.push("vec4 remapClipPos(vec4 clipPos) {"),o.push(" clipPos.xy /= clipPos.w;"),o.push(" clipPos.xy -= pickClipPos;"),o.push(" clipPos.xy *= clipPos.w;"),o.push(" return clipPos;"),o.push("}"),o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"!==r&&"cylindrical"!==r||(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"));o.push(" vec4 worldPosition = modelMatrix2 * localPosition;"),o.push(" worldPosition.xyz = worldPosition.xyz + offset;"),o.push(" vec4 viewPosition = viewMatrix2 * worldPosition;"),i&&o.push(" vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = remapClipPos(clipPos);"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(r.push("uniform vec4 pickColor;"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = pickColor; "),r.push("}"),r}(t)}));var Dr=$.vec3(),Sr=function(e,t){this._hash=e,this._shaderSource=new Ir(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Tr={};Sr.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";"),i=Tr[t];if(!i){if((i=new Sr(t,e)).errors)return console.log(i.errors.join("\n")),null;Tr[t]=i,se.memory.programs++}return i._useCount++,i},Sr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Tr[this._hash],se.memory.programs--)},Sr.prototype.webglContextRestored=function(){this._program=null},Sr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._state,n=t._material._state,o=t._geometry._state,a=t.origin;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCPickViewMatrix(r.originHash,a):e.pickViewMatrix),r.clippable){var l=i._sectionPlanesState.getNumAllocatedSectionPlanes(),u=i._sectionPlanesState.sectionPlanes.length;if(l>0)for(var A=i._sectionPlanesState.sectionPlanes,c=t.renderFlags,h=0;h>24&255,b=_>>16&255,B=_>>8&255,w=255&_;s.uniform4f(this._uPickColor,w/255,B/255,b/255,y/255),s.uniform2fv(this._uPickClipPos,e.pickClipPos),o.indicesBuf?(s.drawElements(o.primitive,o.indicesBuf.numItems,o.indicesBuf.itemType,0),e.drawElements++):o.positions&&s.drawArrays(s.TRIANGLES,0,o.positions.numItems)},Sr.prototype._allocate=function(e){var t=e.scene,i=t.canvas.gl;if(this._program=new kt(i,this._shaderSource),this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uViewMatrix=s.getLocation("viewMatrix"),this._uProjMatrix=s.getLocation("projMatrix"),this._uSectionPlanes=[];for(var r=0,n=t._sectionPlanesState.sectionPlanes.length;r0,s=!!e._geometry._state.compressGeometry,r=[];r.push("#version 300 es"),r.push("// Surface picking vertex shader"),r.push("in vec3 position;"),r.push("in vec4 color;"),r.push("uniform mat4 modelMatrix;"),r.push("uniform mat4 viewMatrix;"),r.push("uniform mat4 projMatrix;"),r.push("uniform vec3 offset;"),i&&(r.push("uniform bool clippable;"),r.push("out vec4 vWorldPosition;"));t.logarithmicDepthBufferEnabled&&(r.push("uniform float logDepthBufFC;"),r.push("out float vFragDepth;"),r.push("bool isPerspectiveMatrix(mat4 m) {"),r.push(" return (m[2][3] == - 1.0);"),r.push("}"),r.push("out float isPerspective;"));r.push("uniform vec2 pickClipPos;"),r.push("vec4 remapClipPos(vec4 clipPos) {"),r.push(" clipPos.xy /= clipPos.w;"),r.push(" clipPos.xy -= pickClipPos;"),r.push(" clipPos.xy *= clipPos.w;"),r.push(" return clipPos;"),r.push("}"),r.push("out vec4 vColor;"),s&&r.push("uniform mat4 positionsDecodeMatrix;");r.push("void main(void) {"),r.push("vec4 localPosition = vec4(position, 1.0); "),s&&r.push("localPosition = positionsDecodeMatrix * localPosition;");r.push(" vec4 worldPosition = modelMatrix * localPosition; "),r.push(" worldPosition.xyz = worldPosition.xyz + offset;"),r.push(" vec4 viewPosition = viewMatrix * worldPosition;"),i&&r.push(" vWorldPosition = worldPosition;");r.push(" vColor = color;"),r.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(r.push("vFragDepth = 1.0 + clipPos.w;"),r.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return r.push("gl_Position = remapClipPos(clipPos);"),r.push("}"),r}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Surface picking fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),r.push("in vec4 vColor;"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push(" outColor = vColor;"),r.push("}"),r}(t)}));var Lr=$.vec3(),Ur=function(e,t){this._hash=e,this._scene=t.scene,this._useCount=0,this._shaderSource=new Rr(t),this._allocate(t)},Or={};Ur.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.compressGeometry?"cp":"",e._state.hash].join(";"),i=Or[t];if(!i){if((i=new Ur(t,e)).errors)return console.log(i.errors.join("\n")),null;Or[t]=i,se.memory.programs++}return i._useCount++,i},Ur.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Or[this._hash],se.memory.programs--)},Ur.prototype.webglContextRestored=function(){this._program=null},Ur.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._state,n=t._material._state,o=t._geometry,a=t._geometry._state,l=t.origin,u=n.backfaces,A=n.frontface,c=i.camera.project,h=o._getPickTrianglePositions(),d=o._getPickTriangleColors();if(this._program.bind(),e.useProgram++,i.logarithmicDepthBufferEnabled){var p=2/(Math.log(c.far+1)/Math.LN2);s.uniform1f(this._uLogDepthBufFC,p)}if(s.uniformMatrix4fv(this._uViewMatrix,!1,l?e.getRTCPickViewMatrix(r.originHash,l):e.pickViewMatrix),r.clippable){var f=i._sectionPlanesState.getNumAllocatedSectionPlanes(),v=i._sectionPlanesState.sectionPlanes.length;if(f>0)for(var g=i._sectionPlanesState.sectionPlanes,m=t.renderFlags,_=0;_0,s=!!e._geometry._state.compressGeometry,r=e._state.billboard,n=e._state.stationary,o=[];o.push("#version 300 es"),o.push("// Mesh occlusion vertex shader"),o.push("in vec3 position;"),o.push("uniform mat4 modelMatrix;"),o.push("uniform mat4 viewMatrix;"),o.push("uniform mat4 projMatrix;"),o.push("uniform vec3 offset;"),s&&o.push("uniform mat4 positionsDecodeMatrix;");i&&o.push("out vec4 vWorldPosition;");t.logarithmicDepthBufferEnabled&&(o.push("uniform float logDepthBufFC;"),o.push("out float vFragDepth;"),o.push("bool isPerspectiveMatrix(mat4 m) {"),o.push(" return (m[2][3] == - 1.0);"),o.push("}"),o.push("out float isPerspective;"));"spherical"!==r&&"cylindrical"!==r||(o.push("void billboard(inout mat4 mat) {"),o.push(" mat[0][0] = 1.0;"),o.push(" mat[0][1] = 0.0;"),o.push(" mat[0][2] = 0.0;"),"spherical"===r&&(o.push(" mat[1][0] = 0.0;"),o.push(" mat[1][1] = 1.0;"),o.push(" mat[1][2] = 0.0;")),o.push(" mat[2][0] = 0.0;"),o.push(" mat[2][1] = 0.0;"),o.push(" mat[2][2] =1.0;"),o.push("}"));o.push("void main(void) {"),o.push("vec4 localPosition = vec4(position, 1.0); "),o.push("vec4 worldPosition;"),s&&o.push("localPosition = positionsDecodeMatrix * localPosition;");o.push("mat4 viewMatrix2 = viewMatrix;"),o.push("mat4 modelMatrix2 = modelMatrix;"),n&&o.push("viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;");"spherical"===r||"cylindrical"===r?(o.push("mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;"),o.push("billboard(modelMatrix2);"),o.push("billboard(viewMatrix2);"),o.push("billboard(modelViewMatrix);"),o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = modelViewMatrix * localPosition;")):(o.push("worldPosition = modelMatrix2 * localPosition;"),o.push("worldPosition.xyz = worldPosition.xyz + offset;"),o.push("vec4 viewPosition = viewMatrix2 * worldPosition; "));i&&o.push(" vWorldPosition = worldPosition;");o.push("vec4 clipPos = projMatrix * viewPosition;"),t.logarithmicDepthBufferEnabled&&(o.push("vFragDepth = 1.0 + clipPos.w;"),o.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"));return o.push("gl_Position = clipPos;"),o.push("}"),o}(t),this.fragment=function(e){var t=e.scene,i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];r.push("#version 300 es"),r.push("// Mesh occlusion fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),t.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;"));if(s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}r.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),t.logarithmicDepthBufferEnabled&&r.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");return r.push("}"),r}(t)}));var Qr=$.vec3(),Vr=function(e,t){this._hash=e,this._shaderSource=new Nr(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},Hr={};Vr.get=function(e){var t=[e.scene.canvas.canvas.id,e.scene._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.occlusionHash].join(";"),i=Hr[t];if(!i){if((i=new Vr(t,e)).errors)return console.log(i.errors.join("\n")),null;Hr[t]=i,se.memory.programs++}return i._useCount++,i},Vr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete Hr[this._hash],se.memory.programs--)},Vr.prototype.webglContextRestored=function(){this._program=null},Vr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene,s=i.canvas.gl,r=t._material._state,n=t._state,o=t._geometry._state,a=t.origin;if(!(r.alpha<1)){if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),r.id!==this._lastMaterialId){var l=r.backfaces;e.backfaces!==l&&(l?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),e.backfaces=l);var u=r.frontface;e.frontface!==u&&(u?s.frontFace(s.CCW):s.frontFace(s.CW),e.frontface=u),this._lastMaterialId=r.id}var A=i.camera;if(s.uniformMatrix4fv(this._uViewMatrix,!1,a?e.getRTCViewMatrix(n.originHash,a):A.viewMatrix),n.clippable){var c=i._sectionPlanesState.getNumAllocatedSectionPlanes(),h=i._sectionPlanesState.sectionPlanes.length;if(c>0)for(var d=i._sectionPlanesState.sectionPlanes,p=t.renderFlags,f=0;f0,i=!!e._geometry._state.compressGeometry,s=[];s.push("// Mesh shadow vertex shader"),s.push("in vec3 position;"),s.push("uniform mat4 modelMatrix;"),s.push("uniform mat4 shadowViewMatrix;"),s.push("uniform mat4 shadowProjMatrix;"),s.push("uniform vec3 offset;"),i&&s.push("uniform mat4 positionsDecodeMatrix;");t&&s.push("out vec4 vWorldPosition;");s.push("void main(void) {"),s.push("vec4 localPosition = vec4(position, 1.0); "),s.push("vec4 worldPosition;"),i&&s.push("localPosition = positionsDecodeMatrix * localPosition;");s.push("worldPosition = modelMatrix * localPosition;"),s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&s.push("vWorldPosition = worldPosition;");return s.push(" gl_Position = shadowProjMatrix * viewPosition;"),s.push("}"),s}(t),this.fragment=function(e){var t=e.scene;t.canvas.gl;var i=t._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("// Mesh shadow fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),s){r.push("uniform bool clippable;"),r.push("in vec4 vWorldPosition;");for(var n=0;n 0.0) { discard; }"),r.push("}")}return r.push("outColor = encodeFloat(gl_FragCoord.z);"),r.push("}"),r}(t)}));var Gr=function(e,t){this._hash=e,this._shaderSource=new jr(t),this._scene=t.scene,this._useCount=0,this._allocate(t)},zr={};Gr.get=function(e){var t=e.scene,i=[t.canvas.canvas.id,t._sectionPlanesState.getHash(),e._geometry._state.hash,e._state.hash].join(";"),s=zr[i];if(!s){if((s=new Gr(i,e)).errors)return console.log(s.errors.join("\n")),null;zr[i]=s,se.memory.programs++}return s._useCount++,s},Gr.prototype.put=function(){0==--this._useCount&&(this._program&&this._program.destroy(),delete zr[this._hash],se.memory.programs--)},Gr.prototype.webglContextRestored=function(){this._program=null},Gr.prototype.drawMesh=function(e,t){this._program||this._allocate(t);var i=this._scene.canvas.gl,s=t._material._state,r=t._geometry._state;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),s.id!==this._lastMaterialId){var n=s.backfaces;e.backfaces!==n&&(n?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE),e.backfaces=n);var o=s.frontface;e.frontface!==o&&(o?i.frontFace(i.CCW):i.frontFace(i.CW),e.frontface=o),e.lineWidth!==s.lineWidth&&(i.lineWidth(s.lineWidth),e.lineWidth=s.lineWidth),this._uPointSize&&i.uniform1i(this._uPointSize,s.pointSize),this._lastMaterialId=s.id}if(i.uniformMatrix4fv(this._uModelMatrix,i.FALSE,t.worldMatrix),r.combineGeometry){var a=t.vertexBufs;a.id!==this._lastVertexBufsId&&(a.positionsBuf&&this._aPosition&&(this._aPosition.bindArrayBuffer(a.positionsBuf,a.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),this._lastVertexBufsId=a.id)}this._uClippable&&i.uniform1i(this._uClippable,t._state.clippable),i.uniform3fv(this._uOffset,t._state.offset),r.id!==this._lastGeometryId&&(this._uPositionsDecodeMatrix&&i.uniformMatrix4fv(this._uPositionsDecodeMatrix,!1,r.positionsDecodeMatrix),r.combineGeometry?r.indicesBufCombined&&(r.indicesBufCombined.bind(),e.bindArray++):(this._aPosition&&(this._aPosition.bindArrayBuffer(r.positionsBuf,r.compressGeometry?i.UNSIGNED_SHORT:i.FLOAT),e.bindArray++),r.indicesBuf&&(r.indicesBuf.bind(),e.bindArray++)),this._lastGeometryId=r.id),r.combineGeometry?r.indicesBufCombined&&(i.drawElements(r.primitive,r.indicesBufCombined.numItems,r.indicesBufCombined.itemType,0),e.drawElements++):r.indicesBuf?(i.drawElements(r.primitive,r.indicesBuf.numItems,r.indicesBuf.itemType,0),e.drawElements++):r.positions&&(i.drawArrays(i.TRIANGLES,0,r.positions.numItems),e.drawArrays++)},Gr.prototype._allocate=function(e){var t=e.scene,i=t.canvas.gl;if(this._program=new kt(i,this._shaderSource),this._scene=t,this._useCount=0,this._program.errors)this.errors=this._program.errors;else{var s=this._program;this._uPositionsDecodeMatrix=s.getLocation("positionsDecodeMatrix"),this._uModelMatrix=s.getLocation("modelMatrix"),this._uShadowViewMatrix=s.getLocation("shadowViewMatrix"),this._uShadowProjMatrix=s.getLocation("shadowProjMatrix"),this._uSectionPlanes={};for(var r=0,n=t._sectionPlanesState.sectionPlanes.length;r0)for(var r,n,o,a=0,l=this._uSectionPlanes.length;a1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r)).originalSystemId=r.originalSystemId||s.id,s.renderFlags=new Wr,s._state=new Zt({visible:!0,culled:!1,pickable:null,clippable:null,collidable:null,occluder:!1!==r.occluder,castsShadow:null,receivesShadow:null,xrayed:!1,highlighted:!1,selected:!1,edges:!1,stationary:!!r.stationary,background:!!r.background,billboard:s._checkBillboard(r.billboard),layer:null,colorize:null,pickID:s.scene._renderer.getPickID(b(s)),drawHash:"",pickHash:"",offset:$.vec3(),origin:null,originHash:null}),s._drawRenderer=null,s._shadowRenderer=null,s._emphasisFillRenderer=null,s._emphasisEdgesRenderer=null,s._pickMeshRenderer=null,s._pickTriangleRenderer=null,s._occlusionRenderer=null,s._geometry=r.geometry?s._checkComponent2(["ReadableGeometry","VBOGeometry"],r.geometry):s.scene.geometry,s._material=r.material?s._checkComponent2(["PhongMaterial","MetallicMaterial","SpecularMaterial","LambertMaterial"],r.material):s.scene.material,s._xrayMaterial=r.xrayMaterial?s._checkComponent("EmphasisMaterial",r.xrayMaterial):s.scene.xrayMaterial,s._highlightMaterial=r.highlightMaterial?s._checkComponent("EmphasisMaterial",r.highlightMaterial):s.scene.highlightMaterial,s._selectedMaterial=r.selectedMaterial?s._checkComponent("EmphasisMaterial",r.selectedMaterial):s.scene.selectedMaterial,s._edgeMaterial=r.edgeMaterial?s._checkComponent("EdgeMaterial",r.edgeMaterial):s.scene.edgeMaterial,s._parentNode=null,s._aabb=null,s._aabbDirty=!0,s._numTriangles=s._geometry?s._geometry.numTriangles:0,s.scene._aabbDirty=!0,s._scale=$.vec3(),s._quaternion=$.identityQuaternion(),s._rotation=$.vec3(),s._position=$.vec3(),s._worldMatrix=$.identityMat4(),s._worldNormalMatrix=$.identityMat4(),s._localMatrixDirty=!0,s._worldMatrixDirty=!0,s._worldNormalMatrixDirty=!0;var n=r.origin||r.rtcCenter;if(n&&(s._state.origin=$.vec3(n),s._state.originHash=n.join()),r.matrix?s.matrix=r.matrix:(s.scale=r.scale,s.position=r.position,r.quaternion||(s.rotation=r.rotation)),s._isObject=r.isObject,s._isObject&&s.scene._registerObject(b(s)),s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.layer=r.layer,s.colorize=r.colorize,s.opacity=r.opacity,s.offset=r.offset,r.parentId){var o=s.scene.components[r.parentId];o?o.isNode?o.addChild(b(s)):s.error("Parent is not a Node: '"+r.parentId+"'"):s.error("Parent not found: '"+r.parentId+"'"),s._parentNode=o}else r.parent&&(r.parent.isNode||s.error("Parent is not a Node"),r.parent.addChild(b(s)),s._parentNode=r.parent);return s.compile(),s}return C(i,[{key:"type",get:function(){return"Mesh"}},{key:"isMesh",get:function(){return!0}},{key:"parent",get:function(){return this._parentNode}},{key:"geometry",get:function(){return this._geometry}},{key:"material",get:function(){return this._material}},{key:"position",get:function(){return this._position},set:function(e){this._position.set(e||[0,0,0]),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"rotation",get:function(){return this._rotation},set:function(e){this._rotation.set(e||[0,0,0]),$.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"quaternion",get:function(){return this._quaternion},set:function(e){this._quaternion.set(e||[0,0,0,1]),$.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"scale",get:function(){return this._scale},set:function(e){this._scale.set(e||[1,1,1]),this._setLocalMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"matrix",get:function(){return this._localMatrixDirty&&(this.__localMatrix||(this.__localMatrix=$.identityMat4()),$.composeMat4(this._position,this._quaternion,this._scale,this.__localMatrix),this._localMatrixDirty=!1),this.__localMatrix},set:function(e){this.__localMatrix||(this.__localMatrix=$.identityMat4()),this.__localMatrix.set(e||sn),$.decomposeMat4(this.__localMatrix,this._position,this._quaternion,this._scale),this._localMatrixDirty=!1,this._setWorldMatrixDirty(),this._setAABBDirty(),this.glRedraw()}},{key:"worldMatrix",get:function(){return this._worldMatrixDirty&&this._buildWorldMatrix(),this._worldMatrix}},{key:"worldNormalMatrix",get:function(){return this._worldNormalMatrixDirty&&this._buildWorldNormalMatrix(),this._worldNormalMatrix}},{key:"isEntity",get:function(){return!0}},{key:"isModel",get:function(){return this._isModel}},{key:"isObject",get:function(){return this._isObject}},{key:"aabb",get:function(){return this._aabbDirty&&this._updateAABB(),this._aabb}},{key:"origin",get:function(){return this._state.origin},set:function(e){e?(this._state.origin||(this._state.origin=$.vec3()),this._state.origin.set(e),this._state.originHash=e.join(),this._setAABBDirty(),this.scene._aabbDirty=!0):this._state.origin&&(this._state.origin=null,this._state.originHash=null,this._setAABBDirty(),this.scene._aabbDirty=!0)}},{key:"rtcCenter",get:function(){return this.origin},set:function(e){this.origin=e}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"visible",get:function(){return this._state.visible},set:function(e){e=!1!==e,this._state.visible=e,this._isObject&&this.scene._objectVisibilityUpdated(this,e),this.glRedraw()}},{key:"xrayed",get:function(){return this._state.xrayed},set:function(e){e=!!e,this._state.xrayed!==e&&(this._state.xrayed=e,this._isObject&&this.scene._objectXRayedUpdated(this,e),this.glRedraw())}},{key:"highlighted",get:function(){return this._state.highlighted},set:function(e){(e=!!e)!==this._state.highlighted&&(this._state.highlighted=e,this._isObject&&this.scene._objectHighlightedUpdated(this,e),this.glRedraw())}},{key:"selected",get:function(){return this._state.selected},set:function(e){(e=!!e)!==this._state.selected&&(this._state.selected=e,this._isObject&&this.scene._objectSelectedUpdated(this,e),this.glRedraw())}},{key:"edges",get:function(){return this._state.edges},set:function(e){(e=!!e)!==this._state.edges&&(this._state.edges=e,this.glRedraw())}},{key:"culled",get:function(){return this._state.culled},set:function(e){this._state.culled=!!e,this.glRedraw()}},{key:"clippable",get:function(){return this._state.clippable},set:function(e){e=!1!==e,this._state.clippable!==e&&(this._state.clippable=e,this.glRedraw())}},{key:"collidable",get:function(){return this._state.collidable},set:function(e){(e=!1!==e)!==this._state.collidable&&(this._state.collidable=e,this._setAABBDirty(),this.scene._aabbDirty=!0)}},{key:"pickable",get:function(){return this._state.pickable},set:function(e){e=!1!==e,this._state.pickable!==e&&(this._state.pickable=e)}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){(e=!1!==e)!==this._state.castsShadow&&(this._state.castsShadow=e,this.glRedraw())}},{key:"receivesShadow",get:function(){return this._state.receivesShadow},set:function(e){(e=!1!==e)!==this._state.receivesShadow&&(this._state.receivesShadow=e,this._state.hash=e?"/mod/rs;":"/mod;",this.fire("dirty",this))}},{key:"saoEnabled",get:function(){return!1}},{key:"colorize",get:function(){return this._state.colorize},set:function(e){var t=this._state.colorize;t||((t=this._state.colorize=new Float32Array(4))[3]=1),e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1);var i=!!e;this.scene._objectColorizeUpdated(this,i),this.glRedraw()}},{key:"opacity",get:function(){return this._state.colorize[3]},set:function(e){var t=this._state.colorize;t||((t=this._state.colorize=new Float32Array(4))[0]=1,t[1]=1,t[2]=1);var i=null!=e;t[3]=i?e:1,this.scene._objectOpacityUpdated(this,i),this.glRedraw()}},{key:"transparent",get:function(){return 2===this._material.alphaMode||this._state.colorize[3]<1}},{key:"layer",get:function(){return this._state.layer},set:function(e){e=e||0,(e=Math.round(e))!==this._state.layer&&(this._state.layer=e,this._renderer.needStateSort())}},{key:"stationary",get:function(){return this._state.stationary}},{key:"billboard",get:function(){return this._state.billboard}},{key:"offset",get:function(){return this._state.offset},set:function(e){this._state.offset.set(e||[0,0,0]),this._setAABBDirty(),this.glRedraw()}},{key:"isDrawable",get:function(){return!0}},{key:"isStateSortable",get:function(){return!0}},{key:"xrayMaterial",get:function(){return this._xrayMaterial}},{key:"highlightMaterial",get:function(){return this._highlightMaterial}},{key:"selectedMaterial",get:function(){return this._selectedMaterial}},{key:"edgeMaterial",get:function(){return this._edgeMaterial}},{key:"_checkBillboard",value:function(e){return"spherical"!==(e=e||"none")&&"cylindrical"!==e&&"none"!==e&&(this.error("Unsupported value for 'billboard': "+e+" - accepted values are 'spherical', 'cylindrical' and 'none' - defaulting to 'none'."),e="none"),e}},{key:"compile",value:function(){var e=this._makeDrawHash();this._state.drawHash!==e&&(this._state.drawHash=e,this._putDrawRenderers(),this._drawRenderer=_r.get(this),this._emphasisFillRenderer=xr.get(this),this._emphasisEdgesRenderer=Er.get(this));var t=this._makePickHash();if(this._state.pickHash!==t&&(this._state.pickHash=t,this._putPickRenderers(),this._pickMeshRenderer=Sr.get(this)),this._state.occluder){var i=this._makeOcclusionHash();this._state.occlusionHash!==i&&(this._state.occlusionHash=i,this._putOcclusionRenderer(),this._occlusionRenderer=Vr.get(this))}}},{key:"_setLocalMatrixDirty",value:function(){this._localMatrixDirty=!0,this._setWorldMatrixDirty()}},{key:"_setWorldMatrixDirty",value:function(){this._worldMatrixDirty=!0,this._worldNormalMatrixDirty=!0}},{key:"_buildWorldMatrix",value:function(){var e=this.matrix;if(this._parentNode)$.mulMat4(this._parentNode.worldMatrix,e,this._worldMatrix);else for(var t=0,i=e.length;t0)for(var i=0;i-1){var R=k.geometry._state,L=k.scene,U=L.camera,O=L.canvas;if("triangles"===R.primitiveName){S.primitive="triangle";var N,Q,V,H=T,j=R.indices,G=R.positions;if(j){var z=j[H+0],W=j[H+1],K=j[H+2];n[0]=z,n[1]=W,n[2]=K,S.indices=n,N=3*z,Q=3*W,V=3*K}else V=(Q=(N=3*H)+3)+3;if(i[0]=G[N+0],i[1]=G[N+1],i[2]=G[N+2],s[0]=G[Q+0],s[1]=G[Q+1],s[2]=G[Q+2],r[0]=G[V+0],r[1]=G[V+1],r[2]=G[V+2],R.compressGeometry){var X=R.positionsDecodeMatrix;X&&(ki.decompressPosition(i,X,i),ki.decompressPosition(s,X,s),ki.decompressPosition(r,X,r))}S.canvasPos?$.canvasPosToLocalRay(O.canvas,k.origin?Re(I,k.origin):I,D,k.worldMatrix,S.canvasPos,e,t):S.origin&&S.direction&&$.worldRayToLocalRay(k.worldMatrix,S.origin,S.direction,e,t),$.normalizeVec3(t),$.rayPlaneIntersect(e,t,i,s,r,o),S.localPos=o,S.position=o,v[0]=o[0],v[1]=o[1],v[2]=o[2],v[3]=1,$.transformVec4(k.worldMatrix,v,g),a[0]=g[0],a[1]=g[1],a[2]=g[2],S.canvasPos&&k.origin&&(a[0]+=k.origin[0],a[1]+=k.origin[1],a[2]+=k.origin[2]),S.worldPos=a,$.transformVec4(U.matrix,g,m),l[0]=m[0],l[1]=m[1],l[2]=m[2],S.viewPos=l,$.cartesianToBarycentric(o,i,s,r,u),S.bary=u;var J=R.normals;if(J){if(R.compressGeometry){var Y=3*z,Z=3*W,q=3*K;ki.decompressNormal(J.subarray(Y,Y+2),A),ki.decompressNormal(J.subarray(Z,Z+2),c),ki.decompressNormal(J.subarray(q,q+2),h)}else A[0]=J[N],A[1]=J[N+1],A[2]=J[N+2],c[0]=J[Q],c[1]=J[Q+1],c[2]=J[Q+2],h[0]=J[V],h[1]=J[V+1],h[2]=J[V+2];var ee=$.addVec3($.addVec3($.mulVec3Scalar(A,u[0],_),$.mulVec3Scalar(c,u[1],y),b),$.mulVec3Scalar(h,u[2],B),w);S.worldNormal=$.normalizeVec3($.transformVec3(k.worldNormalMatrix,ee,x))}var te=R.uv;if(te){if(d[0]=te[2*z],d[1]=te[2*z+1],p[0]=te[2*W],p[1]=te[2*W+1],f[0]=te[2*K],f[1]=te[2*K+1],R.compressGeometry){var ie=R.uvDecodeMatrix;ie&&(ki.decompressUV(d,ie,d),ki.decompressUV(p,ie,p),ki.decompressUV(f,ie,f))}S.uv=$.addVec3($.addVec3($.mulVec2Scalar(d,u[0],P),$.mulVec2Scalar(p,u[1],C),M),$.mulVec2Scalar(f,u[2],F),E)}}}}}();function on(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.radiusTop||1;t<0&&(console.error("negative radiusTop not allowed - will invert"),t*=-1);var i=e.radiusBottom||1;i<0&&(console.error("negative radiusBottom not allowed - will invert"),i*=-1);var s=e.height||1;s<0&&(console.error("negative height not allowed - will invert"),s*=-1);var r=e.radialSegments||32;r<0&&(console.error("negative radialSegments not allowed - will invert"),r*=-1),r<3&&(r=3);var n=e.heightSegments||1;n<0&&(console.error("negative heightSegments not allowed - will invert"),n*=-1),n<1&&(n=1);var o,a,l,u,A,c,h,d,p,f,v,g=!!e.openEnded,m=e.center,_=m?m[0]:0,y=m?m[1]:0,b=m?m[2]:0,B=s/2,w=s/n,x=2*Math.PI/r,P=1/r,C=(t-i)/n,M=[],F=[],E=[],k=[],I=(90-180*Math.atan(s/(i-t))/Math.PI)/90;for(o=0;o<=n;o++)for(A=t-o*C,c=B-o*w,a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),F.push(A*l),F.push(I),F.push(A*u),E.push(a*P),E.push(1*o/n),M.push(A*l+_),M.push(c+y),M.push(A*u+b);for(o=0;o0){for(p=M.length/3,F.push(0),F.push(1),F.push(0),E.push(.5),E.push(.5),M.push(0+_),M.push(B+y),M.push(0+b),a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),f=.5*Math.sin(a*x)+.5,v=.5*Math.cos(a*x)+.5,F.push(t*l),F.push(1),F.push(t*u),E.push(f),E.push(v),M.push(t*l+_),M.push(B+y),M.push(t*u+b);for(a=0;a0){for(p=M.length/3,F.push(0),F.push(-1),F.push(0),E.push(.5),E.push(.5),M.push(0+_),M.push(0-B+y),M.push(0+b),a=0;a<=r;a++)l=Math.sin(a*x),u=Math.cos(a*x),f=.5*Math.sin(a*x)+.5,v=.5*Math.cos(a*x)+.5,F.push(i*l),F.push(-1),F.push(i*u),E.push(f),E.push(v),M.push(i*l+_),M.push(0-B+y),M.push(i*u+b);for(a=0;a0&&void 0!==arguments[0]?arguments[0]:{},t=e.lod||1,i=e.center?e.center[0]:0,s=e.center?e.center[1]:0,r=e.center?e.center[2]:0,n=e.radius||1;n<0&&(console.error("negative radius not allowed - will invert"),n*=-1);var o=e.heightSegments||18;o<0&&(console.error("negative heightSegments not allowed - will invert"),o*=-1),(o=Math.floor(t*o))<18&&(o=18);var a=e.widthSegments||18;a<0&&(console.error("negative widthSegments not allowed - will invert"),a*=-1),(a=Math.floor(t*a))<18&&(a=18);var l,u,A,c,h,d,p,f,v,g,m,_,y,b,B=[],w=[],x=[],P=[];for(l=0;l<=o;l++)for(A=l*Math.PI/o,c=Math.sin(A),h=Math.cos(A),u=0;u<=a;u++)d=2*u*Math.PI/a,p=Math.sin(d),f=Math.cos(d)*c,v=h,g=p*c,m=1-u/a,_=l/o,w.push(f),w.push(v),w.push(g),x.push(m),x.push(_),B.push(i+n*f),B.push(s+n*v),B.push(r+n*g);for(l=0;l":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};function un(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.origin||[0,0,0],i=t[0],s=t[1],r=t[2],n=e.size||1,o=[],a=[],l=e.text;le.isNumeric(l)&&(l=""+l);for(var u,A,c,h,d,p,f,v,g,m=(l||"").split("\n"),_=0,y=0,b=.04,B=0;B1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({active:!0,pos:$.vec3(),dir:$.vec3(),dist:0}),s.active=r.active,s.pos=r.pos,s.dir=r.dir,s.scene._sectionPlaneCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"SectionPlane"}},{key:"active",get:function(){return this._state.active},set:function(e){this._state.active=!1!==e,this.glRedraw(),this.fire("active",this._state.active)}},{key:"pos",get:function(){return this._state.pos},set:function(e){this._state.pos.set(e||[0,0,0]),this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.fire("pos",this._state.pos),this.scene.fire("sectionPlaneUpdated",this)}},{key:"dir",get:function(){return this._state.dir},set:function(e){this._state.dir.set(e||[0,0,-1]),this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.glRedraw(),this.fire("dir",this._state.dir),this.scene.fire("sectionPlaneUpdated",this)}},{key:"dist",get:function(){return this._state.dist}},{key:"flipDir",value:function(){var e=this._state.dir;e[0]*=-1,e[1]*=-1,e[2]*=-1,this._state.dist=-$.dotVec3(this._state.pos,this._state.dir),this.fire("dir",this._state.dir),this.glRedraw()}},{key:"destroy",value:function(){this._state.destroy(),this.scene._sectionPlaneDestroyed(this),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),hn=$.vec4(4),dn=$.vec4(),pn=$.vec4(),fn=$.vec3([1,0,0]),vn=$.vec3([0,1,0]),gn=$.vec3([0,0,1]),mn=$.vec3(3),_n=$.vec3(3),yn=$.identityMat4(),bn=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e,r))._parentNode=null,s._children=[],s._aabb=null,s._aabbDirty=!0,s.scene._aabbDirty=!0,s._numTriangles=0,s._scale=$.vec3(),s._quaternion=$.identityQuaternion(),s._rotation=$.vec3(),s._position=$.vec3(),s._offset=$.vec3(),s._localMatrix=$.identityMat4(),s._worldMatrix=$.identityMat4(),s._localMatrixDirty=!0,s._worldMatrixDirty=!0,r.matrix?s.matrix=r.matrix:(s.scale=r.scale,s.position=r.position,r.quaternion||(s.rotation=r.rotation)),s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s._isObject=r.isObject,s._isObject&&s.scene._registerObject(b(s)),s.origin=r.origin,s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.colorize=r.colorize,s.opacity=r.opacity,s.offset=r.offset,r.children)for(var n=r.children,o=0,a=n.length;o1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"LambertMaterial",ambient:$.vec3([1,1,1]),color:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),alpha:null,alphaMode:0,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:"/lam;"}),s.ambient=r.ambient,s.color=r.color,s.emissive=r.emissive,s.alpha=r.alpha,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s.backfaces=r.backfaces,s.frontface=r.frontface,s}return C(i,[{key:"type",get:function(){return"LambertMaterial"}},{key:"ambient",get:function(){return this._state.ambient},set:function(e){var t=this._state.ambient;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.ambient=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=.2,t[1]=.2,t[2]=.2),this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){var t=this._state.color;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.color=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this._state.alphaMode=e<1?2:0,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),wn={opaque:0,mask:1,blend:2},xn=["opaque","mask","blend"],Pn=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"MetallicMaterial",baseColor:$.vec4([1,1,1]),emissive:$.vec4([0,0,0]),metallic:null,roughness:null,specularF0:null,alpha:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.baseColor=r.baseColor,s.metallic=r.metallic,s.roughness=r.roughness,s.specularF0=r.specularF0,s.emissive=r.emissive,s.alpha=r.alpha,r.baseColorMap&&(s._baseColorMap=s._checkComponent("Texture",r.baseColorMap)),r.metallicMap&&(s._metallicMap=s._checkComponent("Texture",r.metallicMap)),r.roughnessMap&&(s._roughnessMap=s._checkComponent("Texture",r.roughnessMap)),r.metallicRoughnessMap&&(s._metallicRoughnessMap=s._checkComponent("Texture",r.metallicRoughnessMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"MetallicMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/met"];this._baseColorMap&&(t.push("/bm"),this._baseColorMap._state.hasMatrix&&t.push("/mat"),t.push("/"+this._baseColorMap._state.encoding)),this._metallicMap&&(t.push("/mm"),this._metallicMap._state.hasMatrix&&t.push("/mat")),this._roughnessMap&&(t.push("/rm"),this._roughnessMap._state.hasMatrix&&t.push("/mat")),this._metallicRoughnessMap&&(t.push("/mrm"),this._metallicRoughnessMap._state.hasMatrix&&t.push("/mat")),this._emissiveMap&&(t.push("/em"),this._emissiveMap._state.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap._state.hasMatrix&&t.push("/mat")),this._alphaMap&&(t.push("/am"),this._alphaMap._state.hasMatrix&&t.push("/mat")),this._normalMap&&(t.push("/nm"),this._normalMap._state.hasMatrix&&t.push("/mat")),t.push(";"),e.hash=t.join("")}},{key:"baseColor",get:function(){return this._state.baseColor},set:function(e){var t=this._state.baseColor;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.baseColor=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"baseColorMap",get:function(){return this._baseColorMap}},{key:"metallic",get:function(){return this._state.metallic},set:function(e){e=null!=e?e:1,this._state.metallic!==e&&(this._state.metallic=e,this.glRedraw())}},{key:"metallicMap",get:function(){return this._attached.metallicMap}},{key:"roughness",get:function(){return this._state.roughness},set:function(e){e=null!=e?e:1,this._state.roughness!==e&&(this._state.roughness=e,this.glRedraw())}},{key:"roughnessMap",get:function(){return this._attached.roughnessMap}},{key:"metallicRoughnessMap",get:function(){return this._attached.metallicRoughnessMap}},{key:"specularF0",get:function(){return this._state.specularF0},set:function(e){e=null!=e?e:0,this._state.specularF0!==e&&(this._state.specularF0=e,this.glRedraw())}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"emissiveMap",get:function(){return this._attached.emissiveMap}},{key:"occlusionMap",get:function(){return this._attached.occlusionMap}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"alphaMap",get:function(){return this._attached.alphaMap}},{key:"normalMap",get:function(){return this._attached.normalMap}},{key:"alphaMode",get:function(){return xn[this._state.alphaMode]},set:function(e){var t=wn[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Cn={opaque:0,mask:1,blend:2},Mn=["opaque","mask","blend"],Fn=function(e){g(i,Ri);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({type:"SpecularMaterial",diffuse:$.vec3([1,1,1]),emissive:$.vec3([0,0,0]),specular:$.vec3([1,1,1]),glossiness:null,specularF0:null,alpha:null,alphaMode:null,alphaCutoff:null,lineWidth:null,pointSize:null,backfaces:null,frontface:null,hash:null}),s.diffuse=r.diffuse,s.specular=r.specular,s.glossiness=r.glossiness,s.specularF0=r.specularF0,s.emissive=r.emissive,s.alpha=r.alpha,r.diffuseMap&&(s._diffuseMap=s._checkComponent("Texture",r.diffuseMap)),r.emissiveMap&&(s._emissiveMap=s._checkComponent("Texture",r.emissiveMap)),r.specularMap&&(s._specularMap=s._checkComponent("Texture",r.specularMap)),r.glossinessMap&&(s._glossinessMap=s._checkComponent("Texture",r.glossinessMap)),r.specularGlossinessMap&&(s._specularGlossinessMap=s._checkComponent("Texture",r.specularGlossinessMap)),r.occlusionMap&&(s._occlusionMap=s._checkComponent("Texture",r.occlusionMap)),r.alphaMap&&(s._alphaMap=s._checkComponent("Texture",r.alphaMap)),r.normalMap&&(s._normalMap=s._checkComponent("Texture",r.normalMap)),s.alphaMode=r.alphaMode,s.alphaCutoff=r.alphaCutoff,s.backfaces=r.backfaces,s.frontface=r.frontface,s.lineWidth=r.lineWidth,s.pointSize=r.pointSize,s._makeHash(),s}return C(i,[{key:"type",get:function(){return"SpecularMaterial"}},{key:"_makeHash",value:function(){var e=this._state,t=["/spe"];this._diffuseMap&&(t.push("/dm"),this._diffuseMap.hasMatrix&&t.push("/mat"),t.push("/"+this._diffuseMap.encoding)),this._emissiveMap&&(t.push("/em"),this._emissiveMap.hasMatrix&&t.push("/mat")),this._glossinessMap&&(t.push("/gm"),this._glossinessMap.hasMatrix&&t.push("/mat")),this._specularMap&&(t.push("/sm"),this._specularMap.hasMatrix&&t.push("/mat")),this._specularGlossinessMap&&(t.push("/sgm"),this._specularGlossinessMap.hasMatrix&&t.push("/mat")),this._occlusionMap&&(t.push("/ocm"),this._occlusionMap.hasMatrix&&t.push("/mat")),this._normalMap&&(t.push("/nm"),this._normalMap.hasMatrix&&t.push("/mat")),this._alphaMap&&(t.push("/opm"),this._alphaMap.hasMatrix&&t.push("/mat")),t.push(";"),e.hash=t.join("")}},{key:"diffuse",get:function(){return this._state.diffuse},set:function(e){var t=this._state.diffuse;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.diffuse=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"diffuseMap",get:function(){return this._diffuseMap}},{key:"specular",get:function(){return this._state.specular},set:function(e){var t=this._state.specular;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.specular=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=1,t[1]=1,t[2]=1),this.glRedraw()}},{key:"specularMap",get:function(){return this._specularMap}},{key:"specularGlossinessMap",get:function(){return this._specularGlossinessMap}},{key:"glossiness",get:function(){return this._state.glossiness},set:function(e){e=null!=e?e:1,this._state.glossiness!==e&&(this._state.glossiness=e,this.glRedraw())}},{key:"glossinessMap",get:function(){return this._glossinessMap}},{key:"specularF0",get:function(){return this._state.specularF0},set:function(e){e=null!=e?e:0,this._state.specularF0!==e&&(this._state.specularF0=e,this.glRedraw())}},{key:"emissive",get:function(){return this._state.emissive},set:function(e){var t=this._state.emissive;if(t){if(e&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return}else t=this._state.emissive=new Float32Array(3);e?(t[0]=e[0],t[1]=e[1],t[2]=e[2]):(t[0]=0,t[1]=0,t[2]=0),this.glRedraw()}},{key:"emissiveMap",get:function(){return this._emissiveMap}},{key:"alpha",get:function(){return this._state.alpha},set:function(e){e=null!=e?e:1,this._state.alpha!==e&&(this._state.alpha=e,this.glRedraw())}},{key:"alphaMap",get:function(){return this._alphaMap}},{key:"normalMap",get:function(){return this._normalMap}},{key:"occlusionMap",get:function(){return this._occlusionMap}},{key:"alphaMode",get:function(){return Mn[this._state.alphaMode]},set:function(e){var t=Cn[e=e||"opaque"];void 0===t&&(this.error("Unsupported value for 'alphaMode': "+e+" defaulting to 'opaque'"),t="opaque"),this._state.alphaMode!==t&&(this._state.alphaMode=t,this.glRedraw())}},{key:"alphaCutoff",get:function(){return this._state.alphaCutoff},set:function(e){null==e&&(e=.5),this._state.alphaCutoff!==e&&(this._state.alphaCutoff=e)}},{key:"backfaces",get:function(){return this._state.backfaces},set:function(e){e=!!e,this._state.backfaces!==e&&(this._state.backfaces=e,this.glRedraw())}},{key:"frontface",get:function(){return this._state.frontface?"ccw":"cw"},set:function(e){e="cw"!==e,this._state.frontface!==e&&(this._state.frontface=e,this.glRedraw())}},{key:"lineWidth",get:function(){return this._state.lineWidth},set:function(e){this._state.lineWidth=e||1,this.glRedraw()}},{key:"pointSize",get:function(){return this._state.pointSize},set:function(e){this._state.pointSize=e||1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}();function En(e,t){var i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=t;if(1009===r)return e.UNSIGNED_BYTE;if(1017===r)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===r)return e.UNSIGNED_SHORT_5_5_5_1;if(1010===r)return e.BYTE;if(1011===r)return e.SHORT;if(1012===r)return e.UNSIGNED_SHORT;if(1013===r)return e.INT;if(1014===r)return e.UNSIGNED_INT;if(1015===r)return e.FLOAT;if(1016===r)return e.HALF_FLOAT;if(1021===r)return e.ALPHA;if(1023===r)return e.RGBA;if(1024===r)return e.LUMINANCE;if(1025===r)return e.LUMINANCE_ALPHA;if(1026===r)return e.DEPTH_COMPONENT;if(1027===r)return e.DEPTH_STENCIL;if(1028===r)return e.RED;if(1022===r)return e.RGBA;if(1029===r)return e.RED_INTEGER;if(1030===r)return e.RG;if(1031===r)return e.RG_INTEGER;if(1033===r)return e.RGBA_INTEGER;if(33776===r||33777===r||33778===r||33779===r)if(3001===s){var n=Kt(e,"WEBGL_compressed_texture_s3tc_srgb");if(null===n)return null;if(33776===r)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=Kt(e,"WEBGL_compressed_texture_s3tc")))return null;if(33776===r)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===r)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===r)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===r)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===r||35841===r||35842===r||35843===r){var o=Kt(e,"WEBGL_compressed_texture_pvrtc");if(null===o)return null;if(35840===r)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===r)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===r)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===r)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===r){var a=Kt(e,"WEBGL_compressed_texture_etc1");return null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null}if(37492===r||37496===r){var l=Kt(e,"WEBGL_compressed_texture_etc");if(null===l)return null;if(37492===r)return 3001===s?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(37496===r)return 3001===s?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}if(37808===r||37809===r||37810===r||37811===r||37812===r||37813===r||37814===r||37815===r||37816===r||37817===r||37818===r||37819===r||37820===r||37821===r){var u=Kt(e,"WEBGL_compressed_texture_astc");if(null===u)return null;if(37808===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:u.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:u.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:u.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:u.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:u.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:u.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:u.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:u.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:u.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:u.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:u.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:u.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:u.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===r)return 3001===s?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:u.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===r){var A=Kt(e,"EXT_texture_compression_bptc");if(null===A)return null;if(36492===r)return 3001===s?A.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:A.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===r?e.UNSIGNED_INT_24_8:1e3===r?e.REPEAT:1001===r?e.CLAMP_TO_EDGE:1004===r||1005===r?e.NEAREST_MIPMAP_LINEAR:1007===r?e.LINEAR_MIPMAP_NEAREST:1008===r?e.LINEAR_MIPMAP_LINEAR:1003===r?e.NEAREST:1006===r?e.LINEAR:null}var kn=new Uint8Array([0,0,0,1]),In=function(){function e(t){var i=t.gl,s=t.target,r=t.format,n=t.type,o=t.wrapS,a=t.wrapT,l=t.wrapR,u=t.encoding,A=t.preloadColor,c=t.premultiplyAlpha,h=t.flipY;x(this,e),this.gl=i,this.target=s||i.TEXTURE_2D,this.format=r||1023,this.type=n||1009,this.internalFormat=null,this.premultiplyAlpha=!!c,this.flipY=!!h,this.unpackAlignment=4,this.wrapS=o||1e3,this.wrapT=a||1e3,this.wrapR=l||1e3,this.encoding=u||3001,this.texture=i.createTexture(),A&&this.setPreloadColor(A),this.allocated=!0}return C(e,[{key:"setPreloadColor",value:function(e){e?(kn[0]=Math.floor(255*e[0]),kn[1]=Math.floor(255*e[1]),kn[2]=Math.floor(255*e[2]),kn[3]=Math.floor(255*(void 0!==e[3]?e[3]:1))):(kn[0]=0,kn[1]=0,kn[2]=0,kn[3]=255);var t=this.gl;if(t.bindTexture(this.target,this.texture),this.target===t.TEXTURE_CUBE_MAP)for(var i=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],s=0,r=i.length;s1&&void 0!==arguments[1]?arguments[1]:{},i=this.gl;void 0!==t.format&&(this.format=t.format),void 0!==t.internalFormat&&(this.internalFormat=t.internalFormat),void 0!==t.encoding&&(this.encoding=t.encoding),void 0!==t.type&&(this.type=t.type),void 0!==t.flipY&&(this.flipY=t.flipY),void 0!==t.premultiplyAlpha&&(this.premultiplyAlpha=t.premultiplyAlpha),void 0!==t.unpackAlignment&&(this.unpackAlignment=t.unpackAlignment),void 0!==t.minFilter&&(this.minFilter=t.minFilter),void 0!==t.magFilter&&(this.magFilter=t.magFilter),void 0!==t.wrapS&&(this.wrapS=t.wrapS),void 0!==t.wrapT&&(this.wrapT=t.wrapT),void 0!==t.wrapR&&(this.wrapR=t.wrapR);var s=!1;i.bindTexture(this.target,this.texture);var r=i.getParameter(i.UNPACK_FLIP_Y_WEBGL);i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flipY);var n=i.getParameter(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var o=i.getParameter(i.UNPACK_ALIGNMENT);i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment);var a=i.getParameter(i.UNPACK_COLORSPACE_CONVERSION_WEBGL);i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);var l=En(i,this.minFilter);i.texParameteri(this.target,i.TEXTURE_MIN_FILTER,l),l!==i.NEAREST_MIPMAP_NEAREST&&l!==i.LINEAR_MIPMAP_NEAREST&&l!==i.NEAREST_MIPMAP_LINEAR&&l!==i.LINEAR_MIPMAP_LINEAR||(s=!0);var u=En(i,this.magFilter);u&&i.texParameteri(this.target,i.TEXTURE_MAG_FILTER,u);var A=En(i,this.wrapS);A&&i.texParameteri(this.target,i.TEXTURE_WRAP_S,A);var c=En(i,this.wrapT);c&&i.texParameteri(this.target,i.TEXTURE_WRAP_T,c);var h=En(i,this.format,this.encoding),d=En(i,this.type),p=Dn(i,this.internalFormat,h,d,this.encoding,!1);if(this.target===i.TEXTURE_CUBE_MAP){if(le.isArray(e))for(var f=e,v=[i.TEXTURE_CUBE_MAP_POSITIVE_X,i.TEXTURE_CUBE_MAP_NEGATIVE_X,i.TEXTURE_CUBE_MAP_POSITIVE_Y,i.TEXTURE_CUBE_MAP_NEGATIVE_Y,i.TEXTURE_CUBE_MAP_POSITIVE_Z,i.TEXTURE_CUBE_MAP_NEGATIVE_Z],g=0,m=v.length;g1;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,this.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE);var a=En(r,this.wrapS);a&&r.texParameteri(this.target,r.TEXTURE_WRAP_S,a);var l=En(r,this.wrapT);if(l&&r.texParameteri(this.target,r.TEXTURE_WRAP_T,l),this.type===r.TEXTURE_3D||this.type===r.TEXTURE_2D_ARRAY){var u=En(r,this.wrapR);u&&r.texParameteri(this.target,r.TEXTURE_WRAP_R,u),r.texParameteri(this.type,r.TEXTURE_WRAP_R,u)}o?(r.texParameteri(this.target,r.TEXTURE_MIN_FILTER,Sn(r,this.minFilter)),r.texParameteri(this.target,r.TEXTURE_MAG_FILTER,Sn(r,this.magFilter))):(r.texParameteri(this.target,r.TEXTURE_MIN_FILTER,En(r,this.minFilter)),r.texParameteri(this.target,r.TEXTURE_MAG_FILTER,En(r,this.magFilter)));var A=En(r,this.format,this.encoding),c=En(r,this.type),h=Dn(r,this.internalFormat,A,c,this.encoding,!1);r.texStorage2D(r.TEXTURE_2D,n,h,t[0].width,t[0].height);for(var d=0,p=t.length;d5&&void 0!==arguments[5]&&arguments[5];if(null!==t){if(void 0!==e[t])return e[t];console.warn("Attempt to use non-existing WebGL internal format '"+t+"'")}var o=i;return i===e.RED&&(s===e.FLOAT&&(o=e.R32F),s===e.HALF_FLOAT&&(o=e.R16F),s===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RG&&(s===e.FLOAT&&(o=e.RG32F),s===e.HALF_FLOAT&&(o=e.RG16F),s===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RGBA&&(s===e.FLOAT&&(o=e.RGBA32F),s===e.HALF_FLOAT&&(o=e.RGBA16F),s===e.UNSIGNED_BYTE&&(o=3001===r&&!1===n?e.SRGB8_ALPHA8:e.RGBA8),s===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),s===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)),o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||Kt(e,"EXT_color_buffer_float"),o}function Sn(e,t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function Tn(e){if(!Rn(e.width)||!Rn(e.height)){var t=document.createElement("canvas");t.width=Ln(e.width),t.height=Ln(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}function Rn(e){return 0==(e&e-1)}function Ln(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1}var Un=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({texture:new In({gl:s.scene.canvas.gl}),matrix:$.identityMat4(),hasMatrix:r.translate&&(0!==r.translate[0]||0!==r.translate[1])||!!r.rotate||r.scale&&(0!==r.scale[0]||0!==r.scale[1]),minFilter:s._checkMinFilter(r.minFilter),magFilter:s._checkMagFilter(r.magFilter),wrapS:s._checkWrapS(r.wrapS),wrapT:s._checkWrapT(r.wrapT),flipY:s._checkFlipY(r.flipY),encoding:s._checkEncoding(r.encoding)}),s._src=null,s._image=null,s._translate=$.vec2([0,0]),s._scale=$.vec2([1,1]),s._rotate=$.vec2([0,0]),s._matrixDirty=!1,s.translate=r.translate,s.scale=r.scale,s.rotate=r.rotate,r.src?s.src=r.src:r.image&&(s.image=r.image),se.memory.textures++,s}return C(i,[{key:"type",get:function(){return"Texture"}},{key:"_checkMinFilter",value:function(e){return 1006!==(e=e||1008)&&1007!==e&&1008!==e&&1005!==e&&1004!==e&&(this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter."),e=1008),e}},{key:"_checkMagFilter",value:function(e){return 1006!==(e=e||1006)&&1003!==e&&(this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter."),e=1006),e}},{key:"_checkWrapS",value:function(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}},{key:"_checkWrapT",value:function(e){return 1001!==(e=e||1e3)&&1002!==e&&1e3!==e&&(this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping."),e=1e3),e}},{key:"_checkFlipY",value:function(e){return!!e}},{key:"_checkEncoding",value:function(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}},{key:"_webglContextRestored",value:function(){this._state.texture=new In({gl:this.scene.canvas.gl}),this._image?this.image=this._image:this._src&&(this.src=this._src)}},{key:"_update",value:function(){var e,t,i=this._state;this._matrixDirty&&(0===this._translate[0]&&0===this._translate[1]||(e=$.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix)),1===this._scale[0]&&1===this._scale[1]||(t=$.scalingMat4v([this._scale[0],this._scale[1],1]),e=e?$.mulMat4(e,t):t),0!==this._rotate&&(t=$.rotationMat4v(.0174532925*this._rotate,[0,0,1]),e=e?$.mulMat4(e,t):t),e&&(i.matrix=e),this._matrixDirty=!1);this.glRedraw()}},{key:"image",get:function(){return this._image},set:function(e){this._image=Tn(e),this._image.crossOrigin="Anonymous",this._state.texture.setImage(this._image,this._state),this._src=null,this.glRedraw()}},{key:"src",get:function(){return this._src},set:function(e){this.scene.loading++,this.scene.canvas.spinner.processes++;var t=this,i=new Image;i.onload=function(){i=Tn(i),t._state.texture.setImage(i,t._state),t.scene.loading--,t.glRedraw(),t.scene.canvas.spinner.processes--},i.src=e,this._src=e,this._image=null}},{key:"translate",get:function(){return this._translate},set:function(e){this._translate.set(e||[0,0]),this._matrixDirty=!0,this._needUpdate()}},{key:"scale",get:function(){return this._scale},set:function(e){this._scale.set(e||[1,1]),this._matrixDirty=!0,this._needUpdate()}},{key:"rotate",get:function(){return this._rotate},set:function(e){e=e||0,this._rotate!==e&&(this._rotate=e,this._matrixDirty=!0,this._needUpdate())}},{key:"minFilter",get:function(){return this._state.minFilter}},{key:"magFilter",get:function(){return this._state.magFilter}},{key:"wrapS",get:function(){return this._state.wrapS}},{key:"wrapT",get:function(){return this._state.wrapT}},{key:"flipY",get:function(){return this._state.flipY}},{key:"encoding",get:function(){return this._state.encoding}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.texture&&this._state.texture.destroy(),this._state.destroy(),se.memory.textures--}}]),i}(),On=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._state=new Zt({edgeColor:$.vec3([0,0,0]),centerColor:$.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),s.edgeColor=r.edgeColor,s.centerColor=r.centerColor,s.edgeBias=r.edgeBias,s.centerBias=r.centerBias,s.power=r.power,s}return C(i,[{key:"type",get:function(){return"Fresnel"}},{key:"edgeColor",get:function(){return this._state.edgeColor},set:function(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}},{key:"centerColor",get:function(){return this._state.centerColor},set:function(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}},{key:"edgeBias",get:function(){return this._state.edgeBias},set:function(e){this._state.edgeBias=e||0,this.glRedraw()}},{key:"centerBias",get:function(){return this._state.centerBias},set:function(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}},{key:"power",get:function(){return this._state.power},set:function(e){this._state.power=null!=e?e:1,this.glRedraw()}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this._state.destroy()}}]),i}(),Nn=se.memory,Qn=$.AABB3(),Vn=function(e){g(i,Bi);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r))._state=new Zt({compressGeometry:!0,primitive:null,primitiveName:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""}),s._numTriangles=0,s._edgeThreshold=r.edgeThreshold||10,s._aabb=null,s._obb=$.OBB3();var n,o=s._state,a=s.scene.canvas.gl;switch(r.primitive=r.primitive||"triangles",r.primitive){case"points":o.primitive=a.POINTS,o.primitiveName=r.primitive;break;case"lines":o.primitive=a.LINES,o.primitiveName=r.primitive;break;case"line-loop":o.primitive=a.LINE_LOOP,o.primitiveName=r.primitive;break;case"line-strip":o.primitive=a.LINE_STRIP,o.primitiveName=r.primitive;break;case"triangles":o.primitive=a.TRIANGLES,o.primitiveName=r.primitive;break;case"triangle-strip":o.primitive=a.TRIANGLE_STRIP,o.primitiveName=r.primitive;break;case"triangle-fan":o.primitive=a.TRIANGLE_FAN,o.primitiveName=r.primitive;break;default:s.error("Unsupported value for 'primitive': '"+r.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'."),o.primitive=a.TRIANGLES,o.primitiveName=r.primitive}if(!r.positions)return s.error("Config expected: positions"),y(s);if(!r.indices)return s.error("Config expected: indices"),y(s);var l=r.positionsDecodeMatrix;if(l);else{var u=ki.getPositionsBounds(r.positions),A=ki.compressPositions(r.positions,u.min,u.max);n=A.quantized,o.positionsDecodeMatrix=A.decodeMatrix,o.positionsBuf=new It(a,a.ARRAY_BUFFER,n,n.length,3,a.STATIC_DRAW),Nn.positions+=o.positionsBuf.numItems,$.positions3ToAABB3(r.positions,s._aabb),$.positions3ToAABB3(n,Qn,o.positionsDecodeMatrix),$.AABB3ToOBB3(Qn,s._obb)}if(r.colors){var c=r.colors.constructor===Float32Array?r.colors:new Float32Array(r.colors);o.colorsBuf=new It(a,a.ARRAY_BUFFER,c,c.length,4,a.STATIC_DRAW),Nn.colors+=o.colorsBuf.numItems}if(r.uv){var h=ki.getUVBounds(r.uv),d=ki.compressUVs(r.uv,h.min,h.max),p=d.quantized;o.uvDecodeMatrix=d.decodeMatrix,o.uvBuf=new It(a,a.ARRAY_BUFFER,p,p.length,2,a.STATIC_DRAW),Nn.uvs+=o.uvBuf.numItems}if(r.normals){var f=ki.compressNormals(r.normals),v=o.compressGeometry;o.normalsBuf=new It(a,a.ARRAY_BUFFER,f,f.length,3,a.STATIC_DRAW,v),Nn.normals+=o.normalsBuf.numItems}var g=r.indices.constructor===Uint32Array||r.indices.constructor===Uint16Array?r.indices:new Uint32Array(r.indices);o.indicesBuf=new It(a,a.ELEMENT_ARRAY_BUFFER,g,g.length,1,a.STATIC_DRAW),Nn.indices+=o.indicesBuf.numItems;var m=wi(n,g,o.positionsDecodeMatrix,s._edgeThreshold);return s._edgeIndicesBuf=new It(a,a.ELEMENT_ARRAY_BUFFER,m,m.length,1,a.STATIC_DRAW),"triangles"===s._state.primitiveName&&(s._numTriangles=r.indices.length/3),s._buildHash(),Nn.meshes++,s}return C(i,[{key:"type",get:function(){return"VBOGeometry"}},{key:"isVBOGeometry",get:function(){return!0}},{key:"_buildHash",value:function(){var e=this._state,t=["/g"];t.push("/"+e.primitive+";"),e.positionsBuf&&t.push("p"),e.colorsBuf&&t.push("c"),(e.normalsBuf||e.autoVertexNormals)&&t.push("n"),e.uvBuf&&t.push("u"),t.push("cp"),t.push(";"),e.hash=t.join("")}},{key:"_getEdgeIndices",value:function(){return this._edgeIndicesBuf}},{key:"primitive",get:function(){return this._state.primitiveName}},{key:"aabb",get:function(){return this._aabb}},{key:"obb",get:function(){return this._obb}},{key:"numTriangles",get:function(){return this._numTriangles}},{key:"_getState",value:function(){return this._state}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this);var e=this._state;e.indicesBuf&&e.indicesBuf.destroy(),e.positionsBuf&&e.positionsBuf.destroy(),e.normalsBuf&&e.normalsBuf.destroy(),e.uvBuf&&e.uvBuf.destroy(),e.colorsBuf&&e.colorsBuf.destroy(),this._edgeIndicesBuf&&this._edgeIndicesBuf.destroy(),e.destroy(),Nn.meshes--}}]),i}(),Hn={};function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,le.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var n=Hn.parse.from3DS(e).edit.objects[0].mesh,o=n.vertices,a=n.uvt,l=n.indices;r.processes--,i(le.apply(t,{primitive:"triangles",positions:o,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))}function Gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,le.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var n=Hn.parse.fromOBJ(e),o=Hn.edit.unwrap(n.i_verts,n.c_verts,3),a=Hn.edit.unwrap(n.i_norms,n.c_norms,3),l=Hn.edit.unwrap(n.i_uvt,n.c_uvt,2),u=new Int32Array(n.i_verts.length),A=0;A0?a:null,autoNormals:0===a.length,uv:l,indices:u}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))}function zn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.ySize||1;i<0&&(console.error("negative ySize not allowed - will invert"),i*=-1);var s=e.zSize||1;s<0&&(console.error("negative zSize not allowed - will invert"),s*=-1);var r=e.center,n=r?r[0]:0,o=r?r[1]:0,a=r?r[2]:0,l=-t+n,u=-i+o,A=-s+a,c=t+n,h=i+o,d=s+a;return le.apply(e,{primitive:"lines",positions:[l,u,A,l,u,d,l,h,A,l,h,d,c,u,A,c,u,d,c,h,A,c,h,d],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]})}function Wn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return zn({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})}function Kn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.size||1;t<0&&(console.error("negative size not allowed - will invert"),t*=-1);var i=e.divisions||1;i<0&&(console.error("negative divisions not allowed - will invert"),i*=-1),i<1&&(i=1);for(var s=(t=t||10)/(i=i||10),r=t/2,n=[],o=[],a=0,l=0,u=-r;l<=i;l++,u+=s)n.push(-r),n.push(0),n.push(u),n.push(r),n.push(0),n.push(u),n.push(u),n.push(0),n.push(-r),n.push(u),n.push(0),n.push(r),o.push(a++),o.push(a++),o.push(a++),o.push(a++);return le.apply(e,{primitive:"lines",positions:n,indices:o})}function Xn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.xSize||1;t<0&&(console.error("negative xSize not allowed - will invert"),t*=-1);var i=e.zSize||1;i<0&&(console.error("negative zSize not allowed - will invert"),i*=-1);var s=e.xSegments||1;s<0&&(console.error("negative xSegments not allowed - will invert"),s*=-1),s<1&&(s=1);var r=e.xSegments||1;r<0&&(console.error("negative zSegments not allowed - will invert"),r*=-1),r<1&&(r=1);var n,o,a,l,u,A,c,h=e.center,d=h?h[0]:0,p=h?h[1]:0,f=h?h[2]:0,v=t/2,g=i/2,m=Math.floor(s)||1,_=Math.floor(r)||1,y=m+1,b=_+1,B=t/m,w=i/_,x=new Float32Array(y*b*3),P=new Float32Array(y*b*3),C=new Float32Array(y*b*2),M=0,F=0;for(n=0;n65535?Uint32Array:Uint16Array)(m*_*6);for(n=0;n<_;n++)for(o=0;o0&&void 0!==arguments[0]?arguments[0]:{},t=e.radius||1;t<0&&(console.error("negative radius not allowed - will invert"),t*=-1),t*=.5;var i=e.tube||.3;i<0&&(console.error("negative tube not allowed - will invert"),i*=-1);var s=e.radialSegments||32;s<0&&(console.error("negative radialSegments not allowed - will invert"),s*=-1),s<4&&(s=4);var r=e.tubeSegments||24;r<0&&(console.error("negative tubeSegments not allowed - will invert"),r*=-1),r<4&&(r=4);var n=e.arc||2*Math.PI;n<0&&(console.warn("negative arc not allowed - will invert"),n*=-1),n>360&&(n=360);var o,a,l,u,A,c,h,d,p,f,v,g,m=e.center,_=m?m[0]:0,y=m?m[1]:0,b=m?m[2]:0,B=[],w=[],x=[],P=[];for(d=0;d<=r;d++)for(h=0;h<=s;h++)o=h/s*n,a=.785398+d/r*Math.PI*2,_=t*Math.cos(o),y=t*Math.sin(o),l=(t+i*Math.cos(a))*Math.cos(o),u=(t+i*Math.cos(a))*Math.sin(o),A=i*Math.sin(a),B.push(l+_),B.push(u+y),B.push(A+b),x.push(1-h/s),x.push(d/r),c=$.normalizeVec3($.subVec3([l,u,A],[_,y,b],[]),[]),w.push(c[0]),w.push(c[1]),w.push(c[2]);for(d=1;d<=r;d++)for(h=1;h<=s;h++)p=(s+1)*d+h-1,f=(s+1)*(d-1)+h-1,v=(s+1)*(d-1)+h,g=(s+1)*d+h,P.push(p),P.push(f),P.push(v),P.push(v),P.push(g),P.push(p);return le.apply(e,{positions:B,normals:w,uv:x,indices:P})}function Yn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.points.length%3!=0)throw"Size of points array for given polyline should be divisible by 3";var t=e.points.length/3;if(t<2)throw"There should be at least 2 points to create a polyline";for(var i=[],s=0;s0&&void 0!==arguments[0]?arguments[0]:{},t=e.curve.getPoints(e.divisions).map((function(e){return A(e)})).flat();return Yn({id:e.id,points:t})}Hn.load=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){t(e.target.response)},i.send()},Hn.save=function(e,t){var i="data:application/octet-stream;base64,"+btoa(Hn.parse._buffToStr(e));window.location.href=i},Hn.clone=function(e){return JSON.parse(JSON.stringify(e))},Hn.bin={},Hn.bin.f=new Float32Array(1),Hn.bin.fb=new Uint8Array(Hn.bin.f.buffer),Hn.bin.rf=function(e,t){for(var i=Hn.bin.f,s=Hn.bin.fb,r=0;r<4;r++)s[r]=e[t+r];return i[0]},Hn.bin.rsl=function(e,t){return e[t]|e[t+1]<<8},Hn.bin.ril=function(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24},Hn.bin.rASCII0=function(e,t){for(var i="";0!=e[t];)i+=String.fromCharCode(e[t++]);return i},Hn.bin.wf=function(e,t,i){new Float32Array(e.buffer,t,1)[0]=i},Hn.bin.wsl=function(e,t,i){e[t]=i,e[t+1]=i>>8},Hn.bin.wil=function(e,t,i){e[t]=i,e[t+1]=i>>8,e[t+2]=i>>16,e[t+3]},Hn.parse={},Hn.parse._buffToStr=function(e){for(var t=new Uint8Array(e),i="",s=0;sr&&(r=l),un&&(n=u),Ao&&(o=A)}return{min:{x:t,y:i,z:s},max:{x:r,y:n,z:o}}};var qn=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._type=r.type||(r.src?r.src.split(".").pop():null)||"jpg",s._pos=$.vec3(r.pos||[0,0,0]),s._up=$.vec3(r.up||[0,1,0]),s._normal=$.vec3(r.normal||[0,0,1]),s._height=r.height||1,s._origin=$.vec3(),s._rtcPos=$.vec3(),s._imageSize=$.vec2(),s._texture=new Un(b(s),{flipY:!0}),s._image=new Image,"jpg"!==s._type&&"png"!==s._type&&(s.error('Unsupported type - defaulting to "jpg"'),s._type="jpg"),s._node=new bn(b(s),{matrix:$.inverseMat4($.lookAtMat4v(s._pos,$.subVec3(s._pos,s._normal,$.mat4()),s._up,$.mat4())),children:[s._bitmapMesh=new rn(b(s),{scale:[1,1,1],rotation:[-90,0,0],collidable:r.collidable,pickable:r.pickable,opacity:r.opacity,clippable:r.clippable,geometry:new Si(b(s),Xn({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:s._texture,emissiveMap:s._texture,backfaces:!0})})]}),r.image?s.image=r.image:r.src?s.src=r.src:r.imageData&&(s.imageData=r.imageData),s.scene._bitmapCreated(b(s)),s}return C(i,[{key:"visible",get:function(){return this._bitmapMesh.visible},set:function(e){this._bitmapMesh.visible=e}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._texture.image=this._image,this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updateBitmapMeshScale())}},{key:"src",get:function(){return this._image.src},set:function(e){var t=this;if(e)switch(this._image.onload=function(){t._texture.image=t._image,t._imageSize[0]=t._image.width,t._imageSize[1]=t._image.height,t._updateBitmapMeshScale()},this._image.src=e,e.split(".").pop()){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png"}}},{key:"imageData",get:function(){var e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this._image.width,e.height=this._image.height,t.drawImage(this._image,0,0),e.toDataURL("jpg"===this._type?"image/jpeg":"image/png")},set:function(e){var t=this;this._image.onload=function(){t._texture.image=image,t._imageSize[0]=image.width,t._imageSize[1]=image.height,t._updateBitmapMeshScale()},this._image.src=e}},{key:"type",get:function(){return this._type},set:function(e){"png"===(e=e||"jpg")&&"jpg"===e||(this.error("Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`"),e="jpg"),this._type=e}},{key:"pos",get:function(){return this._pos}},{key:"normal",get:function(){return this._normal}},{key:"up",get:function(){return this._up}},{key:"height",get:function(){return this._height},set:function(e){this._height=null==e?1:e,this._image&&this._updateBitmapMeshScale()}},{key:"collidable",get:function(){return this._bitmapMesh.collidable},set:function(e){this._bitmapMesh.collidable=!1!==e}},{key:"clippable",get:function(){return this._bitmapMesh.clippable},set:function(e){this._bitmapMesh.clippable=!1!==e}},{key:"pickable",get:function(){return this._bitmapMesh.pickable},set:function(e){this._bitmapMesh.pickable=!1!==e}},{key:"opacity",get:function(){return this._bitmapMesh.opacity},set:function(e){this._bitmapMesh.opacity=e}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._bitmapDestroyed(this)}},{key:"_updateBitmapMeshScale",value:function(){var e=this._imageSize[1]/this._imageSize[0];this._bitmapMesh.scale=[this._height/e,1,this._height]}}]),i}(),$n=$.OBB3(),eo=$.OBB3(),to=$.OBB3(),io=function(){function e(t,i,s,r,n,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;x(this,e),this.model=t,this.object=null,this.parent=null,this.transform=n,this.textureSet=o,this._matrixDirty=!1,this._matrixUpdateScheduled=!1,this.id=i,this.obb=null,this._aabbLocal=null,this._aabbWorld=$.AABB3(),this._aabbWorldDirty=!1,this.layer=a,this.portionId=l,this._color=new Uint8Array([s[0],s[1],s[2],r]),this._colorize=new Uint8Array([s[0],s[1],s[2],r]),this._colorizing=!1,this._transparent=r<255,this.numTriangles=0,this.origin=null,this.entity=null,n&&n._addMesh(this)}return C(e,[{key:"_sceneModelDirty",value:function(){this._aabbWorldDirty=!0,this.layer.aabbDirty=!0}},{key:"_transformDirty",value:function(){this._matrixDirty||this._matrixUpdateScheduled||(this.model._meshMatrixDirty(this),this._matrixDirty=!0,this._matrixUpdateScheduled=!0),this._aabbWorldDirty=!0,this.layer.aabbDirty=!0,this.entity&&this.entity._transformDirty()}},{key:"_updateMatrix",value:function(){this.transform&&this._matrixDirty&&this.layer.setMatrix(this.portionId,this.transform.worldMatrix),this._matrixDirty=!1,this._matrixUpdateScheduled=!1}},{key:"_finalize",value:function(e){this.layer.initFlags(this.portionId,e,this._transparent)}},{key:"_finalize2",value:function(){this.layer.flushInitFlags&&this.layer.flushInitFlags()}},{key:"_setVisible",value:function(e){this.layer.setVisible(this.portionId,e,this._transparent)}},{key:"_setColor",value:function(e){this._color[0]=e[0],this._color[1]=e[1],this._color[2]=e[2],this._colorizing||this.layer.setColor(this.portionId,this._color,!1)}},{key:"_setColorize",value:function(e){e?(this._colorize[0]=e[0],this._colorize[1]=e[1],this._colorize[2]=e[2],this.layer.setColor(this.portionId,this._colorize,false),this._colorizing=!0):(this.layer.setColor(this.portionId,this._color,false),this._colorizing=!1)}},{key:"_setOpacity",value:function(e,t){var i=e<255,s=this._transparent!==i;this._color[3]=e,this._colorize[3]=e,this._transparent=i,this._colorizing?this.layer.setColor(this.portionId,this._colorize):this.layer.setColor(this.portionId,this._color),s&&this.layer.setTransparent(this.portionId,t,i)}},{key:"_setOffset",value:function(e){this.layer.setOffset(this.portionId,e)}},{key:"_setHighlighted",value:function(e){this.layer.setHighlighted(this.portionId,e,this._transparent)}},{key:"_setXRayed",value:function(e){this.layer.setXRayed(this.portionId,e,this._transparent)}},{key:"_setSelected",value:function(e){this.layer.setSelected(this.portionId,e,this._transparent)}},{key:"_setEdges",value:function(e){this.layer.setEdges(this.portionId,e,this._transparent)}},{key:"_setClippable",value:function(e){this.layer.setClippable(this.portionId,e,this._transparent)}},{key:"_setCollidable",value:function(e){this.layer.setCollidable(this.portionId,e)}},{key:"_setPickable",value:function(e){this.layer.setPickable(this.portionId,e,this._transparent)}},{key:"_setCulled",value:function(e){this.layer.setCulled(this.portionId,e,this._transparent)}},{key:"canPickTriangle",value:function(){return!1}},{key:"drawPickTriangles",value:function(e,t){}},{key:"pickTriangleSurface",value:function(e){}},{key:"precisionRayPickSurface",value:function(e,t,i,s){return!!this.layer.precisionRayPickSurface&&this.layer.precisionRayPickSurface(this.portionId,e,t,i,s)}},{key:"canPickWorldPos",value:function(){return!0}},{key:"drawPickDepths",value:function(e){this.model.drawPickDepths(e)}},{key:"drawPickNormals",value:function(e){this.model.drawPickNormals(e)}},{key:"delegatePickedEntity",value:function(){return this.parent}},{key:"getEachVertex",value:function(e){this.layer.getEachVertex(this.portionId,e)}},{key:"aabb",get:function(){if(this._aabbWorldDirty){if($.AABB3ToOBB3(this._aabbLocal,$n),this.transform?($.transformOBB3(this.transform.worldMatrix,$n,eo),$.transformOBB3(this.model.worldMatrix,eo,to),$.OBB3ToAABB3(to,this._aabbWorld)):($.transformOBB3(this.model.worldMatrix,$n,eo),$.OBB3ToAABB3(eo,this._aabbWorld)),this.origin){var e=this.origin;this._aabbWorld[0]+=e[0],this._aabbWorld[1]+=e[1],this._aabbWorld[2]+=e[2],this._aabbWorld[3]+=e[0],this._aabbWorld[4]+=e[1],this._aabbWorld[5]+=e[2]}this._aabbWorldDirty=!1}return this._aabbWorld},set:function(e){this._aabbLocal=e}},{key:"_destroy",value:function(){this.model.scene._renderer.putPickID(this.pickId)}}]),e}(),so=new(function(){function e(){x(this,e),this._uint8Arrays={},this._float32Arrays={}}return C(e,[{key:"_clear",value:function(){this._uint8Arrays={},this._float32Arrays={}}},{key:"getUInt8Array",value:function(e){var t=this._uint8Arrays[e];return t||(t=new Uint8Array(e),this._uint8Arrays[e]=t),t}},{key:"getFloat32Array",value:function(e){var t=this._float32Arrays[e];return t||(t=new Float32Array(e),this._float32Arrays[e]=t),t}}]),e}()),ro=0;function no(){return ro++,so}var oo={NOT_RENDERED:0,COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,EDGES_COLOR_OPAQUE:6,EDGES_COLOR_TRANSPARENT:7,EDGES_HIGHLIGHTED:8,EDGES_SELECTED:9,EDGES_XRAYED:10,PICK:11},ao=new Float32Array([1,1,1,1]),lo=new Float32Array([0,0,0,1]),uo=$.vec4(),Ao=$.vec3(),co=$.vec3(),ho=$.mat4(),po=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=s.instancing,n=void 0!==r&&r,o=s.edges,a=void 0!==o&&o;x(this,e),this._scene=t,this._withSAO=i,this._instancing=n,this._edges=a,this._hash=this._getHash(),this._matricesUniformBlockBufferBindingPoint=0,this._matricesUniformBlockBuffer=this._scene.canvas.gl.createBuffer(),this._matricesUniformBlockBufferData=new Float32Array(96),this._vaoCache=new WeakMap,this._allocate()}return C(e,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"_buildShader",value:function(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()}}},{key:"_buildVertexShader",value:function(){return[""]}},{key:"_buildFragmentShader",value:function(){return[""]}},{key:"_addMatricesUniformBlockLines",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.push("uniform Matrices {"),e.push(" mat4 worldMatrix;"),e.push(" mat4 viewMatrix;"),e.push(" mat4 projMatrix;"),e.push(" mat4 positionsDecodeMatrix;"),t&&(e.push(" mat4 worldNormalMatrix;"),e.push(" mat4 viewNormalMatrix;")),e.push("};"),e}},{key:"_addRemapClipPosLines",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.push("uniform vec2 drawingBufferSize;"),e.push("uniform vec2 pickClipPos;"),e.push("vec4 remapClipPos(vec4 clipPos) {"),e.push(" clipPos.xy /= clipPos.w;"),1===t?e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"):e.push(" clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(".concat(t,"));")),e.push(" clipPos.xy *= clipPos.w;"),e.push(" return clipPos;"),e.push("}"),e}},{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"setSectionPlanesStateUniforms",value:function(e){var t=this._scene,i=t.canvas.gl,s=e.model,r=e.layerIndex,n=t._sectionPlanesState.getNumAllocatedSectionPlanes(),o=t._sectionPlanesState.sectionPlanes.length;if(n>0){var a=t._sectionPlanesState.sectionPlanes,l=r*o,u=s.renderFlags;t.crossSections&&(i.uniform4fv(this._uSliceColor,t.crossSections.sliceColor),i.uniform1f(this._uSliceThickness,t.crossSections.sliceThickness));for(var A=0;A0&&(this._uReflectionMap="reflectionMap"),i.lightMaps.length>0&&(this._uLightMap="lightMap"),this._uSectionPlanes=[];for(var a=0,l=e._sectionPlanesState.getNumAllocatedSectionPlanes();a3&&void 0!==arguments[3]?arguments[3]:{},r=s.colorUniform,n=void 0!==r&&r,o=s.incrementDrawState,a=void 0!==o&&o,l=yt.MAX_TEXTURE_IMAGE_UNITS,u=this._scene,A=u.canvas.gl,c=t._state,h=t.model,d=c.textureSet,p=c.origin,f=c.positionsDecodeMatrix,v=u._lightsState,g=u.pointsMaterial,m=h.scene.camera,_=m.viewNormalMatrix,y=m.project,b=e.pickViewMatrix||m.viewMatrix,B=h.position,w=h.rotationMatrix,x=h.rotationMatrixConjugate,P=h.worldNormalMatrix;if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e)),this._vaoCache.has(t)?A.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(c));var C=0,M=16;this._matricesUniformBlockBufferData.set(x,0);var F=0!==p[0]||0!==p[1]||0!==p[2],E=0!==B[0]||0!==B[1]||0!==B[2];if(F||E){var k=Ao;if(F){var I=$.transformPoint3(w,p,co);k[0]=I[0],k[1]=I[1],k[2]=I[2]}else k[0]=0,k[1]=0,k[2]=0;k[0]+=B[0],k[1]+=B[1],k[2]+=B[2],this._matricesUniformBlockBufferData.set(Re(b,k,ho),C+=M)}else this._matricesUniformBlockBufferData.set(b,C+=M);if(this._matricesUniformBlockBufferData.set(e.pickProjMatrix||y.matrix,C+=M),this._matricesUniformBlockBufferData.set(f,C+=M),this._matricesUniformBlockBufferData.set(P,C+=M),this._matricesUniformBlockBufferData.set(_,C+=M),A.bindBuffer(A.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),A.bufferData(A.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,A.DYNAMIC_DRAW),A.bindBufferBase(A.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer),A.uniform1i(this._uRenderPass,i),this.setSectionPlanesStateUniforms(t),u.logarithmicDepthBufferEnabled){if(this._uLogDepthBufFC){var D=2/(Math.log(e.pickZFar+1)/Math.LN2);A.uniform1f(this._uLogDepthBufFC,D)}this._uZFar&&A.uniform1f(this._uZFar,u.camera.project.far)}if(this._uPickInvisible&&A.uniform1i(this._uPickInvisible,e.pickInvisible),this._uPickZNear&&A.uniform1f(this._uPickZNear,e.pickZNear),this._uPickZFar&&A.uniform1f(this._uPickZFar,e.pickZFar),this._uPickClipPos&&A.uniform2fv(this._uPickClipPos,e.pickClipPos),this._uDrawingBufferSize&&A.uniform2f(this._uDrawingBufferSize,A.drawingBufferWidth,A.drawingBufferHeight),this._uUVDecodeMatrix&&A.uniformMatrix3fv(this._uUVDecodeMatrix,!1,c.uvDecodeMatrix),this._uIntensityRange&&g.filterIntensity&&A.uniform2f(this._uIntensityRange,g.minIntensity,g.maxIntensity),this._uPointSize&&A.uniform1f(this._uPointSize,g.pointSize),this._uNearPlaneHeight){var S="ortho"===u.camera.projection?1:A.drawingBufferHeight/(2*Math.tan(.5*u.camera.perspective.fov*Math.PI/180));A.uniform1f(this._uNearPlaneHeight,S)}if(d){var T=d.colorTexture,R=d.metallicRoughnessTexture,L=d.emissiveTexture,U=d.normalsTexture,O=d.occlusionTexture;this._uColorMap&&T&&(this._program.bindTexture(this._uColorMap,T.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uMetallicRoughMap&&R&&(this._program.bindTexture(this._uMetallicRoughMap,R.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uEmissiveMap&&L&&(this._program.bindTexture(this._uEmissiveMap,L.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uNormalMap&&U&&(this._program.bindTexture(this._uNormalMap,U.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l),this._uAOMap&&O&&(this._program.bindTexture(this._uAOMap,O.texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l)}if(v.reflectionMaps.length>0&&v.reflectionMaps[0].texture&&this._uReflectionMap&&(this._program.bindTexture(this._uReflectionMap,v.reflectionMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++),v.lightMaps.length>0&&v.lightMaps[0].texture&&this._uLightMap&&(this._program.bindTexture(this._uLightMap,v.lightMaps[0].texture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++),this._withSAO){var N=u.sao,Q=N.possible;if(Q){var V=A.drawingBufferWidth,H=A.drawingBufferHeight;uo[0]=V,uo[1]=H,uo[2]=N.blendCutoff,uo[3]=N.blendFactor,A.uniform4fv(this._uSAOParams,uo),this._program.bindTexture(this._uOcclusionTexture,e.occlusionTexture,e.textureUnit),e.textureUnit=(e.textureUnit+1)%l,e.bindTexture++}}if(n){var j=this._edges?"edgeColor":"fillColor",G=this._edges?"edgeAlpha":"fillAlpha";if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_XRAYED")]){var z=u.xrayMaterial._state,W=z[j],K=z[G];A.uniform4f(this._uColor,W[0],W[1],W[2],K)}else if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_HIGHLIGHTED")]){var X=u.highlightMaterial._state,J=X[j],Y=X[G];A.uniform4f(this._uColor,J[0],J[1],J[2],Y)}else if(i===oo["".concat(this._edges?"EDGES":"SILHOUETTE","_SELECTED")]){var Z=u.selectedMaterial._state,q=Z[j],ee=Z[G];A.uniform4f(this._uColor,q[0],q[1],q[2],ee)}else A.uniform4fv(this._uColor,this._edges?lo:ao)}this._draw({state:c,frameCtx:e,incrementDrawState:a}),A.bindVertexArray(null)}}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null,se.memory.programs--}}]),e}(),fo=function(e){g(i,po);var t=_(i);function i(e,s){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.edges,o=void 0!==n&&n;return x(this,i),t.call(this,e,s,{instancing:!1,edges:o})}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;if(this._edges)t.drawElements(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0);else{var n=s.pickElementsCount||i.indicesBuf.numItems,o=s.pickElementsOffset?s.pickElementsOffset*i.indicesBuf.itemByteSize:0;t.drawElements(t.TRIANGLES,n,i.indicesBuf.itemType,o),r&&s.drawElements++}}}]),i}(),vo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e,t=this._scene,i=t._sectionPlanesState,s=t._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=[];n.push("#version 300 es"),n.push("// Triangles batching draw vertex shader"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in float flags;"),t.entityOffsetsEnabled&&n.push("in vec3 offset;"),this._addMatricesUniformBlockLines(n,!0),t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("uniform vec4 lightAmbient;");for(var o=0,a=s.lights.length;o= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),r&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;")),n.push("out vec4 vColor;"),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),t.entityOffsetsEnabled&&n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),n.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;");for(var l=0,u=s.lights.length;l0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching draw fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}]),i}(),go=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching flat-shading draw vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._lightsState,i=e._sectionPlanesState,s=i.getNumAllocatedSectionPlanes()>0,r=[];if(r.push("#version 300 es"),r.push("// Triangles batching flat-shading draw fragment shader"),r.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),r.push("precision highp float;"),r.push("precision highp int;"),r.push("#else"),r.push("precision mediump float;"),r.push("precision mediump int;"),r.push("#endif"),e.logarithmicDepthBufferEnabled&&(r.push("in float isPerspective;"),r.push("uniform float logDepthBufFC;"),r.push("in float vFragDepth;")),this._withSAO&&(r.push("uniform sampler2D uOcclusionTexture;"),r.push("uniform vec4 uSAOParams;"),r.push("const float packUpscale = 256. / 255.;"),r.push("const float unpackDownScale = 255. / 256.;"),r.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),r.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),r.push("float unpackRGBToFloat( const in vec4 v ) {"),r.push(" return dot( v, unPackFactors );"),r.push("}")),s){r.push("in vec4 vWorldPosition;"),r.push("in float vFlags;");for(var n=0,o=i.getNumAllocatedSectionPlanes();n> 16 & 0xF) == 1;"),r.push(" if (clippable) {"),r.push(" float dist = 0.0;");for(var A=0,c=i.getNumAllocatedSectionPlanes();A sliceThickness) { "),r.push(" discard;"),r.push(" }"),r.push(" if (dist > 0.0) { "),r.push(" newColor = sliceColor;"),r.push(" }"),r.push("}")}r.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),r.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),r.push("float lambertian = 1.0;"),r.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),r.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),r.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var h=0,d=t.lights.length;h0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Triangles batching silhouette fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r){for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(var o=0,a=s.getNumAllocatedSectionPlanes();o sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("outColor = newColor;"),n.push("}"),n}}]),i}(),_o=function(e){g(i,fo);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!1,edges:!0})}return C(i)}(),yo=function(e){g(i,_o);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),bo=function(e){g(i,_o);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!1})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry edges drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),Bo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}]),i}(),wo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),this._addRemapClipPosLines(i),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),xo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec3 worldNormal = octDecode(normal.xy); "),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outNormal = ivec4(vWorldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Po=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching occlusion vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles batching occlusion fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}]),i}(),Co=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching depth fragment shader"),s.push("precision highp float;"),s.push("precision highp int;"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),s.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),s.push("}"),s}}]),i}(),Mo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Fo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry shadow vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 outColor;"),i.push("void main(void) {"),i.push(" int colorFlag = int(flags) & 0xF;"),i.push(" bool visible = (colorFlag > 0);"),i.push(" bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push(" if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry shadow fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = encodeFloat( gl_FragCoord.z); "),i.push("}"),i}}]),i}(),Eo=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,n=[];return n.push("#version 300 es"),n.push("// Triangles batching quality draw vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("precision highp usampler2D;"),n.push("precision highp isampler2D;"),n.push("precision highp sampler2D;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("precision mediump usampler2D;"),n.push("precision mediump isampler2D;"),n.push("precision mediump sampler2D;"),n.push("#endif"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in vec2 uv;"),n.push("in vec2 metallicRoughness;"),n.push("in float flags;"),e.entityOffsetsEnabled&&n.push("in vec3 offset;"),this._addMatricesUniformBlockLines(n,!0),n.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("vec3 octDecode(vec2 oct) {"),n.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),n.push(" if (v.z < 0.0) {"),n.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),n.push("out vec4 vViewPosition;"),n.push("out vec3 vViewNormal;"),n.push("out vec4 vColor;"),n.push("out vec2 vUV;"),n.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&n.push("out vec3 vWorldNormal;"),s&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;"),r&&n.push("out vec4 vClipPosition;")),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&n.push("worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),n.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),n.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),n.push("vFragDepth = 1.0 + clipPos.w;")),s&&(n.push("vWorldPosition = worldPosition;"),n.push("vFlags = flags;"),r&&n.push("vClipPosition = clipPos;")),n.push("vViewPosition = viewPosition;"),n.push("vViewNormal = viewNormal;"),n.push("vColor = color;"),n.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),n.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&n.push("vWorldNormal = worldNormal.xyz;"),n.push("gl_Position = clipPos;"),n.push("}"),n.push("}"),n}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=i.clippingCaps,o=[];o.push("#version 300 es"),o.push("// Triangles batching quality draw fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),o.push("uniform sampler2D uMetallicRoughMap;"),o.push("uniform sampler2D uEmissiveMap;"),o.push("uniform sampler2D uNormalMap;"),o.push("uniform sampler2D uAOMap;"),o.push("in vec4 vViewPosition;"),o.push("in vec3 vViewNormal;"),o.push("in vec4 vColor;"),o.push("in vec2 vUV;"),o.push("in vec2 vMetallicRoughness;"),s.lightMaps.length>0&&o.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(o,!0),s.reflectionMaps.length>0&&o.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&o.push("uniform samplerCube lightMap;"),o.push("uniform vec4 lightAmbient;");for(var a=0,l=s.lights.length;a0&&(o.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),o.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),o.push(" return envMapColor;"),o.push("}")),o.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),o.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),o.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),o.push("}"),o.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" return 1.0 / ( gl * gv );"),o.push("}"),o.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" return 0.5 / max( gv + gl, EPSILON );"),o.push("}"),o.push("float D_GGX(const in float alpha, const in float dotNH) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),o.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float alpha = ( roughness * roughness );"),o.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),o.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),o.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),o.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),o.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),o.push(" vec3 F = F_Schlick( specularColor, dotLH );"),o.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),o.push(" float D = D_GGX( alpha, dotNH );"),o.push(" return F * (G * D);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),o.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),o.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),o.push(" vec4 r = roughness * c0 + c1;"),o.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),o.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),o.push(" return specularColor * AB.x + AB.y;"),o.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(o.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(o.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;"),o.push(" irradiance *= PI;"),o.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(o.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),o.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),o.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),o.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),o.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),o.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),o.push("}")),o.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),o.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),o.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),o.push("}"),o.push("out vec4 outColor;"),o.push("void main(void) {"),r){o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var h=0,d=i.getNumAllocatedSectionPlanes();h (0.002 * vClipPosition.w)) {"),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push(" return;"),o.push("}")):(o.push(" if (dist > 0.0) { "),o.push(" discard;"),o.push(" }")),o.push("}")}o.push("IncidentLight light;"),o.push("Material material;"),o.push("Geometry geometry;"),o.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),o.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),o.push("float opacity = float(vColor.a) / 255.0;"),o.push("vec3 baseColor = rgb;"),o.push("float specularF0 = 1.0;"),o.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),o.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),o.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),o.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),o.push("baseColor *= colorTexel.rgb;"),o.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),o.push("metallic *= metalRoughTexel.b;"),o.push("roughness *= metalRoughTexel.g;"),o.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );"),o.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),o.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),o.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),o.push("geometry.position = vViewPosition.xyz;"),o.push("geometry.viewNormal = -normalize(viewNormal);"),o.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&o.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&o.push("computePBRLightMapping(geometry, material, reflectedLight);");for(var p=0,f=s.lights.length;p0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching pick flat normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Triangles batching pick flat normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Io=function(e){g(i,fo);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Triangles batching color texture vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._lightsState,s=e._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Triangles batching color texture fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),e.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),n.push("uniform sampler2D uColorMap;"),this._withSAO&&(n.push("uniform sampler2D uOcclusionTexture;"),n.push("uniform vec4 uSAOParams;"),n.push("const float packUpscale = 256. / 255.;"),n.push("const float unpackDownScale = 255. / 256.;"),n.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),n.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),n.push("float unpackRGBToFloat( const in vec4 v ) {"),n.push(" return dot( v, unPackFactors );"),n.push("}")),n.push("uniform float gammaFactor;"),n.push("vec4 linearToLinear( in vec4 value ) {"),n.push(" return value;"),n.push("}"),n.push("vec4 sRGBToLinear( in vec4 value ) {"),n.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),n.push("}"),n.push("vec4 gammaToLinear( in vec4 value) {"),n.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),n.push("}"),t&&(n.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),n.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),n.push("}")),r){n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;");for(var o=0,a=s.getNumAllocatedSectionPlanes();o> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;");for(var c=0,h=s.getNumAllocatedSectionPlanes();c sliceThickness) { "),n.push(" discard;"),n.push(" }"),n.push(" if (dist > 0.0) { "),n.push(" newColor = sliceColor;"),n.push(" }"),n.push("}")}n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;"),n.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),n.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),n.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var d=0,p=i.lights.length;d0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Oo=$.vec3(),No=$.vec3(),Qo=$.vec3(),Vo=$.vec3(),Ho=$.mat4(),jo=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Oo;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=No;if(l){var m=Qo;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,Ho),(f=Vo)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),o.drawElements(o.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0),a.edgeIndicesBuf.unbind()):o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Go=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new mo(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new Bo(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new wo(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Uo(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new jo(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new vo(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new vo(this._scene,!0)),this._colorRendererWithSAO}},{key:"flatColorRenderer",get:function(){return this._flatColorRenderer||(this._flatColorRenderer=new go(this._scene,!1)),this._flatColorRenderer}},{key:"flatColorRendererWithSAO",get:function(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new go(this._scene,!0)),this._flatColorRendererWithSAO}},{key:"colorTextureRenderer",get:function(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Io(this._scene,!1)),this._colorTextureRenderer}},{key:"colorTextureRendererWithSAO",get:function(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Io(this._scene,!0)),this._colorTextureRendererWithSAO}},{key:"pbrRenderer",get:function(){return this._pbrRenderer||(this._pbrRenderer=new Eo(this._scene,!1)),this._pbrRenderer}},{key:"pbrRendererWithSAO",get:function(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Eo(this._scene,!0)),this._pbrRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new mo(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new Co(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new Mo(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new yo(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new bo(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Bo(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new xo(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ko(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new wo(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new Po(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new Fo(this._scene)),this._shadowRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new jo(this._scene)),this._snapRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Uo(this._scene)),this._snapInitRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),zo={};var Wo=65536,Ko=5e6,Xo=function(){function e(){x(this,e)}return C(e,[{key:"doublePrecisionEnabled",get:function(){return $.getDoublePrecisionEnabled()},set:function(e){$.setDoublePrecisionEnabled(e)}},{key:"maxDataTextureHeight",get:function(){return Wo},set:function(e){(e=1024*Math.ceil(e/1024))>4096?e=4096:e<1024&&(e=1024),Wo=e}},{key:"maxGeometryBatchSize",get:function(){return Ko},set:function(e){e<1e5?e=1e5:e>5e6&&(e=5e6),Ko=e}}]),e}(),Jo=new Xo,Yo=C((function e(){x(this,e),this.maxVerts=Jo.maxGeometryBatchSize,this.maxIndices=3*Jo.maxGeometryBatchSize,this.positions=[],this.colors=[],this.uv=[],this.metallicRoughness=[],this.normals=[],this.pickColors=[],this.offsets=[],this.indices=[],this.edgeIndices=[]})),Zo=$.mat4(),qo=$.mat4();function $o(e,t,i){for(var s=e.length,r=new Uint16Array(s),n=t[0],o=t[1],a=t[2],l=t[3]-n,u=t[4]-o,A=t[5]-a,c=65525,h=c/l,d=c/u,p=c/A,f=function(e){return e>=0?e:0},v=0;v=0?1:-1),o=(1-Math.abs(s))*(r>=0?1:-1),s=n,r=o}return new Int8Array([Math[t](127.5*s+(s<0?-1:0)),Math[i](127.5*r+(r<0?-1:0))])}function ia(e){var t=e[0],i=e[1];t/=t<0?127:128,i/=i<0?127:128;var s=1-Math.abs(t)-Math.abs(i);s<0&&(t=(1-Math.abs(i))*(t>=0?1:-1),i=(1-Math.abs(t))*(i>=0?1:-1));var r=Math.sqrt(t*t+i*i+s*s);return[t/r,i/r,s/r]}var sa=$.mat4(),ra=$.mat4(),na=$.vec4([0,0,0,1]),oa=$.vec3(),aa=$.vec3(),la=$.vec3(),ua=$.vec3(),Aa=$.vec3(),ca=$.vec3(),ha=$.vec3(),da=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOBatchingTrianglesLayer"),this.model=t.model,this.sortId="TrianglesBatchingLayer"+(t.solid?"-solid":"-surface")+(t.autoNormals?"-autonormals":"-normals")+(t.textureSet&&t.textureSet.colorTexture?"-colorTexture":"")+(t.textureSet&&t.textureSet.metallicRoughnessTexture?"-metallicRoughnessTexture":""),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=zo[s])||(r=new Go(i),zo[s]=r,r._compile(),r.eagerCreateRenders(),i.on("compile",(function(){r._compile(),r.eagerCreateRenders()})),i.on("destroyed",(function(){delete zo[s],r._destroy()}))),r),this._buffer=new Yo(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({origin:$.vec3(),positionsBuf:null,offsetsBuf:null,normalsBuf:null,colorsBuf:null,uvBuf:null,metallicRoughnessBuf:null,flagsBuf:null,indicesBuf:null,edgeIndicesBuf:null,positionsDecodeMatrix:null,uvDecodeMatrix:null,textureSet:t.textureSet,pbrSupported:!1}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix&&(this._state.positionsDecodeMatrix=$.mat4(t.positionsDecodeMatrix)),t.uvDecodeMatrix?(this._state.uvDecodeMatrix=$.mat3(t.uvDecodeMatrix),this._preCompressedUVsExpected=!0):this._preCompressedUVsExpected=!1,t.origin&&this._state.origin.set(t.origin),this.solid=!!t.solid}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)for(var C=0,M=o.length;C0){var F=sa;g?$.inverseMat4($.transposeMat4(g,ra),F):$.identityMat4(F,F),function(e,t,i,s,r){function n(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}var o,a,l,u,A,c=new Float32Array([0,0,0,0]),h=new Float32Array([0,0,0,0]);for(A=0;Au&&(a=o,u=l),(l=n(h,ia(o=ta(h,"floor","ceil"))))>u&&(a=o,u=l),(l=n(h,ia(o=ta(h,"ceil","ceil"))))>u&&(a=o,u=l),s[r+A+0]=a[0],s[r+A+1]=a[1],s[r+A+2]=0}(F,n,n.length,y.normals,y.normals.length)}if(u)for(var E=0,k=u.length;E0)for(var V=0,H=a.length;V0)for(var j=0,G=l.length;j0){var s=this._state.positionsDecodeMatrix?new Uint16Array(i.positions):$o(i.positions,this._modelAABB,this._state.positionsDecodeMatrix=$.mat4());if(e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,s.length,3,t.STATIC_DRAW),this.model.scene.pickSurfacePrecisionEnabled)for(var r=0,n=this._portions.length;r0){var u=new Int8Array(i.normals);e.normalsBuf=new It(t,t.ARRAY_BUFFER,u,i.normals.length,3,t.STATIC_DRAW,!0)}if(i.colors.length>0){var A=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,A,i.colors.length,4,t.DYNAMIC_DRAW,!1)}if(i.uv.length>0)if(e.uvDecodeMatrix){e.uvBuf=new It(t,t.ARRAY_BUFFER,i.uv,i.uv.length,2,t.STATIC_DRAW,!1)}else{var c=ki.getUVBounds(i.uv),h=ki.compressUVs(i.uv,c.min,c.max),d=h.quantized;e.uvDecodeMatrix=$.mat3(h.decodeMatrix),e.uvBuf=new It(t,t.ARRAY_BUFFER,d,d.length,2,t.STATIC_DRAW,!1)}if(i.metallicRoughness.length>0){var p=new Uint8Array(i.metallicRoughness);e.metallicRoughnessBuf=new It(t,t.ARRAY_BUFFER,p,i.metallicRoughness.length,2,t.STATIC_DRAW,!1)}if(i.positions.length>0){var f=i.positions.length/3,v=new Float32Array(f);e.flagsBuf=new It(t,t.ARRAY_BUFFER,v,v.length,1,t.DYNAMIC_DRAW,!1)}if(i.pickColors.length>0){var g=new Uint8Array(i.pickColors);e.pickColorsBuf=new It(t,t.ARRAY_BUFFER,g,i.pickColors.length,4,t.STATIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var m=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,m,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){var _=new Uint32Array(i.indices);e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,_,i.indices.length,1,t.STATIC_DRAW)}if(i.edgeIndices.length>0){var y=new Uint32Array(i.edgeIndices);e.edgeIndicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,y,i.edgeIndices.length,1,t.STATIC_DRAW)}this._state.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&e.textureSet&&e.textureSet.colorTexture&&e.textureSet.metallicRoughnessTexture),this._state.colorTextureSupported=!!e.uvBuf&&!!e.textureSet&&!!e.textureSet.colorTexture,this._buffer=null,this._finalized=!0}}},{key:"isEmpty",value:function(){return!this._state.indicesBuf}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=e,s=this._portions[i],r=4*s.vertsBaseIndex,n=4*s.numVerts,o=this._scratchMemory.getUInt8Array(n),a=t[0],l=t[1],u=t[2],A=t[3],c=0;c3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=e,a=this._portions[o],l=a.vertsBaseIndex,u=a.numVerts,A=l,c=u,h=!!(t&Qe),d=!!(t&ze),p=!!(t&We),f=!!(t&Ke),v=!!(t&Xe),g=!!(t&He),m=!!(t&Ve);r=!h||m||d||p&&!this.model.scene.highlightMaterial.glowThrough||f&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!h||m?oo.NOT_RENDERED:f?oo.SILHOUETTE_SELECTED:p?oo.SILHOUETTE_HIGHLIGHTED:d?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var _=0;_=!h||m?oo.NOT_RENDERED:f?oo.EDGES_SELECTED:p?oo.EDGES_HIGHLIGHTED:d?oo.EDGES_XRAYED:v?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED;var y=h&&!m&&g?oo.PICK:oo.NOT_RENDERED,b=t&je?1:0;if(s){this._deferredFlagValues||(this._deferredFlagValues=new Float32Array(this._numVerts));for(var B=A,w=A+c;Bg)&&(g=x,s.set(m),r&&$.triangleNormal(d,p,f,r),v=!0)}}return v&&r&&($.transformVec3(this.model.worldNormalMatrix,r,r),$.normalizeVec3(r)),v}},{key:"destroy",value:function(){var e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.normalsBuf&&(e.normalsBuf.destroy(),e.normalsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.indicesBuf&&(e.indicesBuf.destroy(),e.indicessBuf=null),e.edgeIndicesBuf&&(e.edgeIndicesBuf.destroy(),e.edgeIndicessBuf=null),e.destroy()}}]),e}(),pa=function(e){g(i,po);var t=_(i);function i(e,s){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.edges,o=void 0!==n&&n;return x(this,i),t.call(this,e,s,{instancing:!0,edges:o})}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;this._edges?t.drawElementsInstanced(t.LINES,i.edgeIndicesBuf.numItems,i.edgeIndicesBuf.itemType,0,i.numInstances):(t.drawElementsInstanced(t.TRIANGLES,i.indicesBuf.numItems,i.indicesBuf.itemType,0,i.numInstances),r&&s.drawElements++)}}]),i}(),fa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e,t,i,s=this._scene,r=s._sectionPlanesState,n=s._lightsState,o=r.getNumAllocatedSectionPlanes()>0,a=[];for(a.push("#version 300 es"),a.push("// Instancing geometry drawing vertex shader"),a.push("uniform int renderPass;"),a.push("in vec3 position;"),a.push("in vec2 normal;"),a.push("in vec4 color;"),a.push("in float flags;"),s.entityOffsetsEnabled&&a.push("in vec3 offset;"),a.push("in vec4 modelMatrixCol0;"),a.push("in vec4 modelMatrixCol1;"),a.push("in vec4 modelMatrixCol2;"),a.push("in vec4 modelNormalMatrixCol0;"),a.push("in vec4 modelNormalMatrixCol1;"),a.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(a,!0),s.logarithmicDepthBufferEnabled&&(a.push("uniform float logDepthBufFC;"),a.push("out float vFragDepth;"),a.push("bool isPerspectiveMatrix(mat4 m) {"),a.push(" return (m[2][3] == - 1.0);"),a.push("}"),a.push("out float isPerspective;")),a.push("uniform vec4 lightAmbient;"),e=0,t=n.lights.length;e= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),a.push(" }"),a.push(" return normalize(v);"),a.push("}"),o&&(a.push("out vec4 vWorldPosition;"),a.push("out float vFlags;")),a.push("out vec4 vColor;"),a.push("void main(void) {"),a.push("int colorFlag = int(flags) & 0xF;"),a.push("if (colorFlag != renderPass) {"),a.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),a.push("} else {"),a.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),a.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),s.entityOffsetsEnabled&&a.push("worldPosition.xyz = worldPosition.xyz + offset;"),a.push("vec4 viewPosition = viewMatrix * worldPosition; "),a.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),a.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);"),a.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);"),a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),e=0,t=n.lights.length;e0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(newColor.rgb * ambient, 1.0);")):s.push(" outColor = newColor;"),s.push("}"),s}}]),i}(),va=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry flat-shading drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=i._lightsState,n=s.getNumAllocatedSectionPlanes()>0,o=[];if(o.push("#version 300 es"),o.push("// Instancing geometry flat-shading drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),i.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),n){o.push("in vec4 vWorldPosition;"),o.push("in float vFlags;");for(var a=0,l=s.getNumAllocatedSectionPlanes();a> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var A=0,c=s.getNumAllocatedSectionPlanes();A sliceThickness) { "),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" newColor = sliceColor;"),o.push(" }"),o.push("}")}for(o.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),o.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),o.push("float lambertian = 1.0;"),o.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),o.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),o.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),e=0,t=r.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// Instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 color;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 silhouetteColor;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing fill fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o sliceThickness) { "),s.push(" discard;"),s.push(" }"),s.push(" if (dist > 0.0) { "),s.push(" newColor = sliceColor;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = newColor;"),s.push("}"),s}}]),i}(),ma=function(e){g(i,pa);var t=_(i);function i(e,s){return x(this,i),t.call(this,e,s,{instancing:!0,edges:!0})}return C(i)}(),_a=function(e){g(i,ma);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesEmphasisRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("uniform vec4 color;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesEmphasisRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),ya=function(e){g(i,ma);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!1})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// EdgesColorRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeFlag = int(flags) >> 8 & 0xF;"),i.push("if (edgeFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// EdgesColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),ba=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry picking vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 pickColor;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry picking fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}]),i}(),Ba=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push(" vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),wa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec2 normal;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("in vec4 modelNormalMatrixCol0;"),i.push("in vec4 modelNormalMatrixCol1;"),i.push("in vec4 modelNormalMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vWorldNormal;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));"),i.push(" vWorldNormal = worldNormal;"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outNormal = ivec4(vWorldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),xa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesInstancingOcclusionRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}}]),i}(),Pa=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry depth drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec2 vHighPrecisionZW;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Instancing geometry depth drawing fragment shader"),n.push("precision highp float;"),n.push("precision highp int;"),i.logarithmicDepthBufferEnabled&&(n.push("in float isPerspective;"),n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),n.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),n.push("}"),n}}]),i}(),Ca=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec3 normal;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i,!0),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Ma=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),Fa={3e3:"linearToLinear",3001:"sRGBToLinear"},Ea=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=e._lightsState,s=t.getNumAllocatedSectionPlanes()>0,r=t.clippingCaps,n=[];return n.push("#version 300 es"),n.push("// Instancing geometry quality drawing vertex shader"),n.push("uniform int renderPass;"),n.push("in vec3 position;"),n.push("in vec3 normal;"),n.push("in vec4 color;"),n.push("in vec2 uv;"),n.push("in vec2 metallicRoughness;"),n.push("in float flags;"),e.entityOffsetsEnabled&&n.push("in vec3 offset;"),n.push("in vec4 modelMatrixCol0;"),n.push("in vec4 modelMatrixCol1;"),n.push("in vec4 modelMatrixCol2;"),n.push("in vec4 modelNormalMatrixCol0;"),n.push("in vec4 modelNormalMatrixCol1;"),n.push("in vec4 modelNormalMatrixCol2;"),this._addMatricesUniformBlockLines(n,!0),n.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("out float isPerspective;")),n.push("vec3 octDecode(vec2 oct) {"),n.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),n.push(" if (v.z < 0.0) {"),n.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),n.push(" }"),n.push(" return normalize(v);"),n.push("}"),n.push("out vec4 vViewPosition;"),n.push("out vec3 vViewNormal;"),n.push("out vec4 vColor;"),n.push("out vec2 vUV;"),n.push("out vec2 vMetallicRoughness;"),i.lightMaps.length>0&&n.push("out vec3 vWorldNormal;"),s&&(n.push("out vec4 vWorldPosition;"),n.push("out float vFlags;"),r&&n.push("out vec4 vClipPosition;")),n.push("void main(void) {"),n.push("int colorFlag = int(flags) & 0xF;"),n.push("if (colorFlag != renderPass) {"),n.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),n.push("} else {"),n.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),n.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&n.push(" worldPosition.xyz = worldPosition.xyz + offset;"),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); "),n.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);"),n.push("vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;"),n.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(n.push("vFragDepth = 1.0 + clipPos.w;"),n.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),s&&(n.push("vWorldPosition = worldPosition;"),n.push("vFlags = flags;"),r&&n.push("vClipPosition = clipPos;")),n.push("vViewPosition = viewPosition;"),n.push("vViewNormal = viewNormal;"),n.push("vColor = color;"),n.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),n.push("vMetallicRoughness = metallicRoughness;"),i.lightMaps.length>0&&n.push("vWorldNormal = worldNormal.xyz;"),n.push("gl_Position = clipPos;"),n.push("}"),n.push("}"),n}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e.gammaOutput,i=e._sectionPlanesState,s=e._lightsState,r=i.getNumAllocatedSectionPlanes()>0,n=i.clippingCaps,o=[];o.push("#version 300 es"),o.push("// Instancing geometry quality drawing fragment shader"),o.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),o.push("precision highp float;"),o.push("precision highp int;"),o.push("#else"),o.push("precision mediump float;"),o.push("precision mediump int;"),o.push("#endif"),e.logarithmicDepthBufferEnabled&&(o.push("in float isPerspective;"),o.push("uniform float logDepthBufFC;"),o.push("in float vFragDepth;")),o.push("uniform sampler2D uColorMap;"),o.push("uniform sampler2D uMetallicRoughMap;"),o.push("uniform sampler2D uEmissiveMap;"),o.push("uniform sampler2D uNormalMap;"),this._withSAO&&(o.push("uniform sampler2D uOcclusionTexture;"),o.push("uniform vec4 uSAOParams;"),o.push("const float packUpscale = 256. / 255.;"),o.push("const float unpackDownScale = 255. / 256.;"),o.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),o.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),o.push("float unpackRGBToFloat( const in vec4 v ) {"),o.push(" return dot( v, unPackFactors );"),o.push("}")),s.reflectionMaps.length>0&&o.push("uniform samplerCube reflectionMap;"),s.lightMaps.length>0&&o.push("uniform samplerCube lightMap;"),o.push("uniform vec4 lightAmbient;");for(var a=0,l=s.lights.length;a0&&o.push("in vec3 vWorldNormal;"),this._addMatricesUniformBlockLines(o,!0),o.push("#define PI 3.14159265359"),o.push("#define RECIPROCAL_PI 0.31830988618"),o.push("#define RECIPROCAL_PI2 0.15915494"),o.push("#define EPSILON 1e-6"),o.push("#define saturate(a) clamp( a, 0.0, 1.0 )"),o.push("vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {"),o.push(" vec3 texel = texture( uNormalMap, uv ).xyz;"),o.push(" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {"),o.push(" return normalize(surf_norm );"),o.push(" }"),o.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );"),o.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );"),o.push(" vec2 st0 = dFdx( uv.st );"),o.push(" vec2 st1 = dFdy( uv.st );"),o.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );"),o.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );"),o.push(" vec3 N = normalize( surf_norm );"),o.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;"),o.push(" mat3 tsn = mat3( S, T, N );"),o.push(" return normalize( tsn * mapN );"),o.push("}"),o.push("vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {"),o.push(" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );"),o.push("}"),o.push("struct IncidentLight {"),o.push(" vec3 color;"),o.push(" vec3 direction;"),o.push("};"),o.push("struct ReflectedLight {"),o.push(" vec3 diffuse;"),o.push(" vec3 specular;"),o.push("};"),o.push("struct Geometry {"),o.push(" vec3 position;"),o.push(" vec3 viewNormal;"),o.push(" vec3 worldNormal;"),o.push(" vec3 viewEyeDir;"),o.push("};"),o.push("struct Material {"),o.push(" vec3 diffuseColor;"),o.push(" float specularRoughness;"),o.push(" vec3 specularColor;"),o.push(" float shine;"),o.push("};"),o.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {"),o.push(" float r = ggxRoughness + 0.0001;"),o.push(" return (2.0 / (r * r) - 2.0);"),o.push("}"),o.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float maxMIPLevelScalar = float( maxMIPLevel );"),o.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );"),o.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );"),o.push("}"),s.reflectionMaps.length>0&&(o.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {"),o.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);"),o.push(" vec3 envMapColor = "+Fa[s.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;"),o.push(" return envMapColor;"),o.push("}")),o.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {"),o.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );"),o.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;"),o.push("}"),o.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" return 1.0 / ( gl * gv );"),o.push("}"),o.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );"),o.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );"),o.push(" return 0.5 / max( gv + gl, EPSILON );"),o.push("}"),o.push("float D_GGX(const in float alpha, const in float dotNH) {"),o.push(" float a2 = ( alpha * alpha );"),o.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;"),o.push(" return RECIPROCAL_PI * a2 / ( denom * denom);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float alpha = ( roughness * roughness );"),o.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );"),o.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );"),o.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );"),o.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );"),o.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );"),o.push(" vec3 F = F_Schlick( specularColor, dotLH );"),o.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );"),o.push(" float D = D_GGX( alpha, dotNH );"),o.push(" return F * (G * D);"),o.push("}"),o.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {"),o.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));"),o.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);"),o.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);"),o.push(" vec4 r = roughness * c0 + c1;"),o.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;"),o.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;"),o.push(" return specularColor * AB.x + AB.y;"),o.push("}"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&(o.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),s.lightMaps.length>0&&(o.push(" vec3 irradiance = "+Fa[s.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;"),o.push(" irradiance *= PI;"),o.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;")),s.reflectionMaps.length>0&&(o.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);"),o.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);"),o.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);"),o.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);"),o.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);"),o.push(" reflectedLight.specular += radiance * specularBRDFContrib;")),o.push("}")),o.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {"),o.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));"),o.push(" vec3 irradiance = dotNL * incidentLight.color * PI;"),o.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);"),o.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);"),o.push("}"),o.push("out vec4 outColor;"),o.push("void main(void) {"),r){o.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),o.push(" if (clippable) {"),o.push(" float dist = 0.0;");for(var h=0,d=i.getNumAllocatedSectionPlanes();h (0.002 * vClipPosition.w)) {"),o.push(" discard;"),o.push(" }"),o.push(" if (dist > 0.0) { "),o.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);"),e.logarithmicDepthBufferEnabled&&o.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),o.push(" return;"),o.push("}")):(o.push(" if (dist > 0.0) { "),o.push(" discard;"),o.push(" }")),o.push("}")}o.push("IncidentLight light;"),o.push("Material material;"),o.push("Geometry geometry;"),o.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));"),o.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));"),o.push("float opacity = float(vColor.a) / 255.0;"),o.push("vec3 baseColor = rgb;"),o.push("float specularF0 = 1.0;"),o.push("float metallic = float(vMetallicRoughness.r) / 255.0;"),o.push("float roughness = float(vMetallicRoughness.g) / 255.0;"),o.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;"),o.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));"),o.push("baseColor *= colorTexel.rgb;"),o.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;"),o.push("metallic *= metalRoughTexel.b;"),o.push("roughness *= metalRoughTexel.g;"),o.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );"),o.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);"),o.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);"),o.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);"),o.push("geometry.position = vViewPosition.xyz;"),o.push("geometry.viewNormal = -normalize(viewNormal);"),o.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);"),s.lightMaps.length>0&&o.push("geometry.worldNormal = normalize(vWorldNormal);"),(s.lightMaps.length>0||s.reflectionMaps.length>0)&&o.push("computePBRLightMapping(geometry, material, reflectedLight);");for(var p=0,f=s.lights.length;p0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry normals vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),this._addRemapClipPosLines(i,3),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&i.push("out float vFlags;"),i.push("out vec4 vWorldPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&i.push("vFlags = flags;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Batched geometry normals fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("in vec4 vWorldPosition;"),i){s.push("in float vFlags;");for(var r=0;r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),s.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),s.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),s.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),s.push("}"),s}}]),i}(),Ia=function(e){g(i,pa);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){var e=this._scene;return[e.gammaOutput,e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry drawing vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in vec2 uv;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),i.push("uniform mat3 uvDecodeMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vViewPosition;"),i.push("out vec4 vColor;"),i.push("out vec2 vUV;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vViewPosition = viewPosition;"),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),i.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i.gammaOutput,r=i._sectionPlanesState,n=i._lightsState,o=r.getNumAllocatedSectionPlanes()>0,a=[];if(a.push("#version 300 es"),a.push("// Instancing geometry drawing fragment shader"),a.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),a.push("precision highp float;"),a.push("precision highp int;"),a.push("#else"),a.push("precision mediump float;"),a.push("precision mediump int;"),a.push("#endif"),i.logarithmicDepthBufferEnabled&&(a.push("in float isPerspective;"),a.push("uniform float logDepthBufFC;"),a.push("in float vFragDepth;")),a.push("uniform sampler2D uColorMap;"),this._withSAO&&(a.push("uniform sampler2D uOcclusionTexture;"),a.push("uniform vec4 uSAOParams;"),a.push("const float packUpscale = 256. / 255.;"),a.push("const float unpackDownScale = 255. / 256.;"),a.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),a.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),a.push("float unpackRGBToFloat( const in vec4 v ) {"),a.push(" return dot( v, unPackFactors );"),a.push("}")),a.push("uniform float gammaFactor;"),a.push("vec4 linearToLinear( in vec4 value ) {"),a.push(" return value;"),a.push("}"),a.push("vec4 sRGBToLinear( in vec4 value ) {"),a.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );"),a.push("}"),a.push("vec4 gammaToLinear( in vec4 value) {"),a.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );"),a.push("}"),s&&(a.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {"),a.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );"),a.push("}")),o){a.push("in vec4 vWorldPosition;"),a.push("in float vFlags;");for(var l=0,u=r.getNumAllocatedSectionPlanes();l> 16 & 0xF) == 1;"),a.push(" if (clippable) {"),a.push(" float dist = 0.0;");for(var c=0,h=r.getNumAllocatedSectionPlanes();c sliceThickness) { "),a.push(" discard;"),a.push(" }"),a.push(" if (dist > 0.0) { "),a.push(" newColor = sliceColor;"),a.push(" }"),a.push("}")}for(a.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),a.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),a.push("float lambertian = 1.0;"),a.push("vec3 xTangent = dFdx( vViewPosition.xyz );"),a.push("vec3 yTangent = dFdy( vViewPosition.xyz );"),a.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );"),e=0,t=n.lights.length;e0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Oa=$.vec3(),Na=$.vec3(),Qa=$.vec3(),Va=$.vec3(),Ha=$.mat4(),ja=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Oa;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=Na;if(l){var m=$.transformPoint3(A,l,Qa);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,Ha),(f=Va)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.edgeIndicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.edgeIndicesBuf.numItems,a.edgeIndicesBuf.itemType,0,a.numInstances),a.edgeIndicesBuf.unbind()):o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Ga=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._pbrRenderer&&!this._pbrRenderer.getValid()&&(this._pbrRenderer.destroy(),this._pbrRenderer=null),this._pbrRendererWithSAO&&!this._pbrRendererWithSAO.getValid()&&(this._pbrRendererWithSAO.destroy(),this._pbrRendererWithSAO=null),this._colorTextureRenderer&&!this._colorTextureRenderer.getValid()&&(this._colorTextureRenderer.destroy(),this._colorTextureRenderer=null),this._colorTextureRendererWithSAO&&!this._colorTextureRendererWithSAO.getValid()&&(this._colorTextureRendererWithSAO.destroy(),this._colorTextureRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new ga(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new ba(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new Ba(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new Ua(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new ja(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new fa(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new fa(this._scene,!0)),this._colorRendererWithSAO}},{key:"flatColorRenderer",get:function(){return this._flatColorRenderer||(this._flatColorRenderer=new va(this._scene,!1)),this._flatColorRenderer}},{key:"flatColorRendererWithSAO",get:function(){return this._flatColorRendererWithSAO||(this._flatColorRendererWithSAO=new va(this._scene,!0)),this._flatColorRendererWithSAO}},{key:"pbrRenderer",get:function(){return this._pbrRenderer||(this._pbrRenderer=new Ea(this._scene,!1)),this._pbrRenderer}},{key:"pbrRendererWithSAO",get:function(){return this._pbrRendererWithSAO||(this._pbrRendererWithSAO=new Ea(this._scene,!0)),this._pbrRendererWithSAO}},{key:"colorTextureRenderer",get:function(){return this._colorTextureRenderer||(this._colorTextureRenderer=new Ia(this._scene,!1)),this._colorTextureRenderer}},{key:"colorTextureRendererWithSAO",get:function(){return this._colorTextureRendererWithSAO||(this._colorTextureRendererWithSAO=new Ia(this._scene,!0)),this._colorTextureRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new ga(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new Pa(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new Ca(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new _a(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new ya(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new ba(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new wa(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new ka(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Ba(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new xa(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new Ma(this._scene)),this._shadowRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Ua(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new ja(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._pbrRenderer&&this._pbrRenderer.destroy(),this._pbrRendererWithSAO&&this._pbrRendererWithSAO.destroy(),this._colorTextureRenderer&&this._colorTextureRenderer.destroy(),this._colorTextureRendererWithSAO&&this._colorTextureRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),za={};var Wa=new Uint8Array(4),Ka=new Float32Array(1),Xa=$.vec4([0,0,0,1]),Ja=new Float32Array(3),Ya=$.vec3(),Za=$.vec3(),qa=$.vec3(),$a=$.vec3(),el=$.vec3(),tl=$.vec3(),il=$.vec3(),sl=new Float32Array(4),rl=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOInstancingTrianglesLayer"),this.model=t.model,this.sortId="TrianglesInstancingLayer"+(t.solid?"-solid":"-surface")+(t.normals?"-normals":"-autoNormals"),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=za[s])||(r=new Ga(i),za[s]=r,r._compile(),r.eagerCreateRenders(),i.on("compile",(function(){r._compile(),r.eagerCreateRenders()})),i.on("destroyed",(function(){delete za[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({numInstances:0,obb:$.OBB3(),origin:$.vec3(),geometry:t.geometry,textureSet:t.textureSet,pbrSupported:!1,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,colorsBuf:null,metallicRoughnessBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,modelNormalMatrixCol0Buf:null,modelNormalMatrixCol1Buf:null,modelNormalMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._colors=[],this._metallicRoughness=[],this._pickColors=[],this._offsets=[],this._modelMatrix=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,t.origin&&this._state.origin.set(t.origin),this._finalized=!1,this.solid=!!t.solid,this.numIndices=t.geometry.numIndices}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){e.colorsBuf=new It(s,s.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,s.DYNAMIC_DRAW,!1),this._colors=[]}if(this._metallicRoughness.length>0){var o=new Uint8Array(this._metallicRoughness);e.metallicRoughnessBuf=new It(s,s.ARRAY_BUFFER,o,this._metallicRoughness.length,2,s.STATIC_DRAW,!1)}if(n>0){e.flagsBuf=new It(s,s.ARRAY_BUFFER,new Float32Array(n),n,1,s.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){e.offsetsBuf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,s.DYNAMIC_DRAW,!1),this._offsets=[]}if(t.positionsCompressed&&t.positionsCompressed.length>0){e.positionsBuf=new It(s,s.ARRAY_BUFFER,t.positionsCompressed,t.positionsCompressed.length,3,s.STATIC_DRAW,!1),e.positionsDecodeMatrix=$.mat4(t.positionsDecodeMatrix)}if(t.colorsCompressed&&t.colorsCompressed.length>0){var a=new Uint8Array(t.colorsCompressed);e.colorsBuf=new It(s,s.ARRAY_BUFFER,a,a.length,4,s.STATIC_DRAW,!1)}if(t.uvCompressed&&t.uvCompressed.length>0){var l=t.uvCompressed;e.uvDecodeMatrix=t.uvDecodeMatrix,e.uvBuf=new It(s,s.ARRAY_BUFFER,l,l.length,2,s.STATIC_DRAW,!1)}if(t.indices&&t.indices.length>0&&(e.indicesBuf=new It(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.indices),t.indices.length,1,s.STATIC_DRAW),e.numIndices=t.indices.length),"triangles"!==t.primitive&&"solid"!==t.primitive&&"surface"!==t.primitive||(e.edgeIndicesBuf=new It(s,s.ELEMENT_ARRAY_BUFFER,new Uint32Array(t.edgeIndices),t.edgeIndices.length,1,s.STATIC_DRAW)),this._modelMatrixCol0.length>0){var u=!1;e.modelMatrixCol0Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,s.STATIC_DRAW,u),e.modelMatrixCol1Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,s.STATIC_DRAW,u),e.modelMatrixCol2Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,s.STATIC_DRAW,u),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],e.normalsBuf&&(e.modelNormalMatrixCol0Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,s.STATIC_DRAW,u),e.modelNormalMatrixCol1Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,s.STATIC_DRAW,u),e.modelNormalMatrixCol2Buf=new It(s,s.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,s.STATIC_DRAW,u),this._modelNormalMatrixCol0=[],this._modelNormalMatrixCol1=[],this._modelNormalMatrixCol2=[])}if(this._pickColors.length>0){e.pickColorsBuf=new It(s,s.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,s.STATIC_DRAW,!1),this._pickColors=[]}e.pbrSupported=!!(e.metallicRoughnessBuf&&e.uvBuf&&e.normalsBuf&&i&&i.colorTexture&&i.metallicRoughnessTexture),e.colorTextureSupported=!!e.uvBuf&&!!i&&!!i.colorTexture,this._state.geometry=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Wa[0]=t[0],Wa[1]=t[1],Wa[2]=t[2],Wa[3]=t[3],this._state.colorsBuf&&this._state.colorsBuf.setData(Wa,4*e)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?1:0)<<16,Ka[0]=A,this._state.flagsBuf&&this._state.flagsBuf.setData(Ka,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Ja[0]=t[0],Ja[1]=t[1],Ja[2]=t[2],this._state.offsetsBuf&&this._state.offsetsBuf.setData(Ja,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"getEachVertex",value:function(e,t){if(!this.model.scene.pickSurfacePrecisionEnabled)return!1;var i=this._state,s=i.geometry,r=this._portions[e];if(r)for(var n=s.quantizedPositions,o=i.origin,a=r.offset,l=o[0]+a[0],u=o[1]+a[1],A=o[2]+a[2],c=Xa,h=r.matrix,d=this.model.sceneModelMatrix,p=i.positionsDecodeMatrix,f=0,v=n.length;fm)&&(m=C,s.set(_),r&&$.triangleNormal(p,f,v,r),g=!0)}}return g&&r&&($.transformVec3(a.normalMatrix,r,r),$.transformVec3(this.model.worldNormalMatrix,r,r),$.normalizeVec3(r)),g}},{key:"destroy",value:function(){var e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.modelNormalMatrixCol0Buf&&(e.modelNormalMatrixCol0Buf.destroy(),e.modelNormalMatrixCol0Buf=null),e.modelNormalMatrixCol1Buf&&(e.modelNormalMatrixCol1Buf.destroy(),e.modelNormalMatrixCol1Buf=null),e.modelNormalMatrixCol2Buf&&(e.modelNormalMatrixCol2Buf.destroy(),e.modelNormalMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy(),this._state=null}}]),e}(),nl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;t.drawElements(t.LINES,i.indicesBuf.numItems,i.indicesBuf.itemType,0),r&&s.drawElements++}}]),i}(),ol=function(e){g(i,nl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push("worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),al=function(e){g(i,nl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines batching silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines batching silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}]),i}(),ll=$.vec3(),ul=$.vec3(),Al=$.vec3(),cl=$.vec3(),hl=$.mat4(),dl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=ll;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=ul;if(l){var m=Al;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,hl),(f=cl)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),a.indicesBuf.bind(),o.drawElements(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),pl=$.vec3(),fl=$.vec3(),vl=$.vec3(),gl=$.vec3(),ml=$.mat4(),_l=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=pl;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=fl;if(l){var m=vl;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,ml),(f=gl)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),"edge"===e.snapMode?(a.indicesBuf.bind(),o.drawElements(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0),a.indicesBuf.unbind()):o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapBatchingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),yl=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new ol(this._scene,!1)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new al(this._scene)),this._silhouetteRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new dl(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new _l(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),bl={};var Bl=C((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e6;x(this,e),t>5e6&&(t=5e6),this.maxVerts=t,this.maxIndices=3*t,this.positions=[],this.colors=[],this.offsets=[],this.indices=[]})),wl=function(){function e(t){var i,s,r;x(this,e),console.info("Creating VBOBatchingLinesLayer"),this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=bl[s])||(r=new yl(i),bl[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete bl[s],r._destroy()}))),r),this.model=t.model,this._buffer=new Bl(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:$.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._numVerts=0,this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(t.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,t.origin&&(this._state.origin=$.vec3(t.origin))}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){var s=new Uint16Array(i.positions);e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{var r=$o(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new It(t,t.ARRAY_BUFFER,r,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){var n=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,n,i.colors.length,4,t.DYNAMIC_DRAW,!1)}if(i.colors.length>0){var o=i.colors.length/4,a=new Float32Array(o);e.flagsBuf=new It(t,t.ARRAY_BUFFER,a,a.length,1,t.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var l=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,l,i.offsets.length,3,t.DYNAMIC_DRAW)}if(i.indices.length>0){var u=new Uint32Array(i.indices);e.indicesBuf=new It(t,t.ELEMENT_ARRAY_BUFFER,u,i.indices.length,1,t.STATIC_DRAW)}this._buffer=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,!0)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],n=this._scratchMemory.getUInt8Array(r),o=t[0],a=t[1],l=t[2],u=t[3],A=0;A3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=2*e,a=this._portions[o],l=this._portions[o+1],u=a,A=l,c=!!(t&Qe),h=!!(t&ze),d=!!(t&We),p=!!(t&Ke),f=!!(t&He),v=!!(t&Ve);r=!c||v||h||d&&!this.model.scene.highlightMaterial.glowThrough||p&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!c||v?oo.NOT_RENDERED:p?oo.SILHOUETTE_SELECTED:d?oo.SILHOUETTE_HIGHLIGHTED:h?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var g=c&&!v&&f?oo.PICK:oo.NOT_RENDERED,m=t&je?1:0;if(s){this._deferredFlagValues||(this._deferredFlagValues=new Float32Array(this._numVerts));for(var _=u,y=u+A;_0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing color vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),i.push("in vec4 color;"),i.push("in float flags;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 lightAmbient;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("if (colorFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Lines instancing color fragment shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return this._withSAO?(n.push(" float viewportWidth = uSAOParams[0];"),n.push(" float viewportHeight = uSAOParams[1];"),n.push(" float blendCutoff = uSAOParams[2];"),n.push(" float blendFactor = uSAOParams[3];"),n.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),n.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;"),n.push(" outColor = vec4(vColor.rgb * ambient, vColor.a);")):n.push(" outColor = vColor;"),i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("}"),n}}]),i}(),Cl=function(e){g(i,xl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Lines instancing silhouette vertex shader"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(i),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;")),i.push("uniform vec4 color;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),i.push("if (silhouetteFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Lines instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = color;"),s.push("}"),s}}]),i}(),Ml=$.vec3(),Fl=$.vec3(),El=$.vec3();$.vec3();var kl=$.mat4(),Il=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.canvas.gl,o=r.camera,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Ml;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Fl;if(l){var g=$.transformPoint3(A,l,El);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,kl),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1)),a.indicesBuf.bind(),n.drawElementsInstanced(n.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind(),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Dl=$.vec3(),Sl=$.vec3(),Tl=$.vec3();$.vec3();var Rl=$.mat4(),Ll=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Dl;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Sl;if(l){var g=$.transformPoint3(A,l,Tl);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,Rl),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),"edge"===e.snapMode?(a.indicesBuf.bind(),o.drawElementsInstanced(o.LINES,a.indicesBuf.numItems,a.indicesBuf.itemType,0,a.numInstances),a.indicesBuf.unbind()):o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Ul=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._snapInitRenderer||(this._snapInitRenderer=new Il(this._scene,!1)),this._snapRenderer||(this._snapRenderer=new Ll(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new Pl(this._scene)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Cl(this._scene)),this._silhouetteRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new Il(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new Ll(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),Ol={};var Nl=new Uint8Array(4),Ql=new Float32Array(1),Vl=new Float32Array(3),Hl=new Float32Array(4),jl=function(){function e(t){var i,s,r;x(this,e),console.info("VBOInstancingLinesLayer"),this.model=t.model,this.material=t.material,this.sortId="LinesInstancingLayer",this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=Ol[s])||(r=new Ul(i),Ol[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete Ol[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({obb:$.OBB3(),numInstances:0,origin:null,geometry:t.geometry,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._colors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,t.origin&&(this._state.origin=$.vec3(t.origin)),this._finalized=!1}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){this._state.colorsBuf=new It(e,e.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,e.DYNAMIC_DRAW,!1),this._colors=[]}if(r>0){this._state.flagsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(r),r,1,e.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){this._state.offsetsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,!1),this._offsets=[]}if(i.colorsCompressed&&i.colorsCompressed.length>0){var n=new Uint8Array(i.colorsCompressed);t.colorsBuf=new It(e,e.ARRAY_BUFFER,n,n.length,4,e.STATIC_DRAW,!1)}if(i.positionsCompressed&&i.positionsCompressed.length>0){t.positionsBuf=new It(e,e.ARRAY_BUFFER,i.positionsCompressed,i.positionsCompressed.length,3,e.STATIC_DRAW,!1),t.positionsDecodeMatrix=$.mat4(i.positionsDecodeMatrix)}if(i.indices&&i.indices.length>0&&(t.indicesBuf=new It(e,e.ELEMENT_ARRAY_BUFFER,new Uint32Array(i.indices),i.indices.length,1,e.STATIC_DRAW),t.numIndices=i.indices.length),this._modelMatrixCol0.length>0){var o=!1;this._state.modelMatrixCol0Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,o),this._state.modelMatrixCol1Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,o),this._state.modelMatrixCol2Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,o),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}this._state.geometry=null,this._finalized=!0}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Nl[0]=t[0],Nl[1]=t[1],Nl[2]=t[2],Nl[3]=t[3],this._state.colorsBuf.setData(Nl,4*e,4)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?255:0)<<16,Ql[0]=A,this._state.flagsBuf.setData(Ql,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Vl[0]=t[0],Vl[1]=t[1],Vl[2]=t[2],this._state.offsetsBuf.setData(Vl,3*e,3)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"setMatrix",value:function(e,t){if(!this._finalized)throw"Not finalized";var i=4*e;Hl[0]=t[0],Hl[1]=t[4],Hl[2]=t[8],Hl[3]=t[12],this._state.modelMatrixCol0Buf.setData(Hl,i),Hl[0]=t[1],Hl[1]=t[5],Hl[2]=t[9],Hl[3]=t[13],this._state.modelMatrixCol1Buf.setData(Hl,i),Hl[0]=t[2],Hl[1]=t[6],Hl[2]=t[10],Hl[3]=t[14],this._state.modelMatrixCol2Buf.setData(Hl,i)}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED)}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED)}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED)}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawOcclusion",value:function(e,t){}},{key:"drawShadow",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){}},{key:"drawPickDepths",value:function(e,t){}},{key:"drawPickNormals",value:function(e,t){}},{key:"destroy",value:function(){var e=this._state;e.positionsBuf&&(e.positionsBuf.destroy(),e.positionsBuf=null),e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.destroy()}}]),e}(),Gl=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_draw",value:function(e){var t=this._scene.canvas.gl,i=e.state,s=e.frameCtx,r=e.incrementDrawState;t.drawArrays(t.POINTS,0,i.positionsBuf.numItems),r&&s.drawArrays++}}]),i}(),zl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{incrementDrawState:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial,s=[];return s.push("#version 300 es"),s.push("// Points batching color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push("worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),Wl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform vec4 color;"),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Points batching silhouette vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e 1.0) {"),n.push(" discard;"),n.push(" }")),r){for(n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("outColor = color;"),n.push("}"),n}}]),i}(),Kl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching pick mesh vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vPickColor; "),s.push("}"),s}}]),i}(),Xl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batched pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("gl_PointSize += 10.0;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batched pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),Jl=function(e){g(i,Gl);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points batching occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push(" } else {"),s.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push(" gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push(" }"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points batching occlusion fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push(" }")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),s.push("}"),s}}]),i}(),Yl=$.vec3(),Zl=$.vec3(),ql=$.vec3(),$l=$.vec3(),eu=$.mat4(),tu=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=Yl;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=Zl;if(l){var m=ql;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,eu),(f=$l)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),iu=$.vec3(),su=$.vec3(),ru=$.vec3(),nu=$.vec3(),ou=$.mat4(),au=function(e){g(i,po);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f,v=iu;if(v[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,v[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,v[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(v[0]),e.snapPickCoordinateScale[1]=$.safeInv(v[1]),e.snapPickCoordinateScale[2]=$.safeInv(v[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var g=su;if(l){var m=ru;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],p=Re(d,g,ou),(f=nu)[0]=n.eye[0]-g[0],f[1]=n.eye[1]-g[1],f[2]=n.eye[2]-g[2],e.snapPickOrigin[0]=g[0],e.snapPickOrigin[1]=g[1],e.snapPickOrigin[2]=g[2]}else p=d,f=n.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,v),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var _=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,_+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,_+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,_+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var y=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,y),this.setSectionPlanesStateUniforms(t),o.drawArrays(o.POINTS,0,a.positionsBuf.numItems)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this._uCameraEyeRtc=e.getLocation("uCameraEyeRtc"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0;e.pointsMaterial._state;var i=[];return i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// VBOBatchingPointsSnapRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),lu=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new zl(this._scene)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new Wl(this._scene)),this._silhouetteRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new Kl(this._scene)),this._pickMeshRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new Xl(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new Jl(this._scene)),this._occlusionRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new tu(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new au(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),uu={};var Au=C((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e6;x(this,e),t>5e6&&(t=5e6),this.maxVerts=t,this.maxIndices=3*t,this.positions=[],this.colors=[],this.intensities=[],this.pickColors=[],this.offsets=[]})),cu=function(){function e(t){x(this,e),console.info("Creating VBOBatchingPointsLayer"),this.model=t.model,this.sortId="PointsBatchingLayer",this.layerIndex=t.layerIndex,this._renderers=function(e){var t=e.id,i=uu[t];return i||(i=new lu(e),uu[t]=i,i._compile(),e.on("compile",(function(){i._compile()})),e.on("destroyed",(function(){delete uu[t],i._destroy()}))),i}(t.model.scene),this._buffer=new Au(t.maxGeometryBatchSize),this._scratchMemory=t.scratchMemory,this._state=new Zt({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,positionsDecodeMatrix:$.mat4(),origin:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numSelectedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numClippableLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this._modelAABB=$.collapseAABB3(),this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1,t.positionsDecodeMatrix?(this._state.positionsDecodeMatrix.set(t.positionsDecodeMatrix),this._preCompressedPositionsExpected=!0):this._preCompressedPositionsExpected=!1,t.origin&&(this._state.origin=$.vec3(t.origin))}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0)if(this._preCompressedPositionsExpected){var s=new Uint16Array(i.positions);e.positionsBuf=new It(t,t.ARRAY_BUFFER,s,i.positions.length,3,t.STATIC_DRAW)}else{var r=$o(new Float32Array(i.positions),this._modelAABB,e.positionsDecodeMatrix);e.positionsBuf=new It(t,t.ARRAY_BUFFER,r,i.positions.length,3,t.STATIC_DRAW)}if(i.colors.length>0){var n=new Uint8Array(i.colors);e.colorsBuf=new It(t,t.ARRAY_BUFFER,n,i.colors.length,4,t.STATIC_DRAW,!1)}if(i.positions.length>0){var o=i.positions.length/3,a=new Float32Array(o);e.flagsBuf=new It(t,t.ARRAY_BUFFER,a,a.length,1,t.DYNAMIC_DRAW,!1)}if(i.pickColors.length>0){var l=new Uint8Array(i.pickColors);e.pickColorsBuf=new It(t,t.ARRAY_BUFFER,l,i.pickColors.length,4,t.STATIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&i.offsets.length>0){var u=new Float32Array(i.offsets);e.offsetsBuf=new It(t,t.ARRAY_BUFFER,u,i.offsets.length,3,t.DYNAMIC_DRAW)}this._buffer=null,this._finalized=!0}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized"}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";for(var i=2*e,s=4*this._portions[i],r=4*this._portions[i+1],n=this._scratchMemory.getUInt8Array(r),o=t[0],a=t[1],l=t[2],u=0;u0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing color vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),s.push("in vec4 color;"),s.push("in float flags;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),i.filterIntensity&&s.push("uniform vec2 intensityRange;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),i.filterIntensity&&(s.push("float intensity = float(color.a) / 255.0;"),s.push("if (intensity < intensityRange[0] || intensity > intensityRange[1]) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {")),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),s.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);"),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),i.filterIntensity&&s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing color fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vColor;"),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),pu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"drawLayer",value:function(e,t,s){f(B(i.prototype),"drawLayer",this).call(this,e,t,s,{colorUniform:!0})}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing silhouette vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 color;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),s.push("uniform vec4 silhouetteColor;"),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vColor;"),s.push("void main(void) {"),s.push("int silhouetteFlag = int(flags) >> 4 & 0xF;"),s.push("if (silhouetteFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing silhouette fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vColor;"),s.push("}"),s}}]),i}(),fu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick mesh vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 pickColor;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vPickColor;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),s.push(" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);"),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick mesh fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("outColor = vPickColor; "),s.push("}"),s}}]),i}(),vu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing pick depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),s.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(s),this._addRemapClipPosLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("out vec4 vViewPosition;"),s.push("void main(void) {"),s.push("int pickFlag = int(flags) >> 12 & 0xF;"),s.push("if (pickFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push(" vFlags = flags;")),s.push(" vViewPosition = viewPosition;"),s.push("vec4 clipPos = projMatrix * viewPosition;"),s.push("gl_Position = remapClipPos(clipPos);"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = remapClipPos(clipPos);"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing pick depth fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),s.push("uniform float pickZNear;"),s.push("uniform float pickZFar;"),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),s.push(" outColor = packDepth(zNormalizedDepth); "),s.push("}"),s}}]),i}(),gu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in vec4 color;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push(" vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Points instancing occlusion vertex shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0;r 1.0) {"),s.push(" discard;"),s.push(" }")),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),s.push("}")}return s.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push("}"),s}}]),i}(),mu=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()+this._scene.pointsMaterial.hash}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=e.pointsMaterial._state,s=[];return s.push("#version 300 es"),s.push("// Points instancing depth vertex shader"),s.push("uniform int renderPass;"),s.push("in vec3 position;"),e.entityOffsetsEnabled&&s.push("in vec3 offset;"),s.push("in float flags;"),s.push("in vec4 modelMatrixCol0;"),s.push("in vec4 modelMatrixCol1;"),s.push("in vec4 modelMatrixCol2;"),this._addMatricesUniformBlockLines(s),s.push("uniform float pointSize;"),i.perspectivePoints&&s.push("uniform float nearPlaneHeight;"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("out float vFragDepth;")),t&&(s.push("out vec4 vWorldPosition;"),s.push("out float vFlags;")),s.push("void main(void) {"),s.push("int colorFlag = int(flags) & 0xF;"),s.push("if (colorFlag != renderPass) {"),s.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),s.push("} else {"),s.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),s.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&s.push(" worldPosition.xyz = worldPosition.xyz + offset;"),s.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(s.push("vWorldPosition = worldPosition;"),s.push("vFlags = flags;")),s.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&s.push("vFragDepth = 1.0 + clipPos.w;"),s.push("gl_Position = clipPos;"),i.perspectivePoints?(s.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;"),s.push("gl_PointSize = max(gl_PointSize, "+Math.floor(i.minPerspectivePointSize)+".0);"),s.push("gl_PointSize = min(gl_PointSize, "+Math.floor(i.maxPerspectivePointSize)+".0);")):s.push("gl_PointSize = pointSize;"),s.push("}"),s.push("}"),s}},{key:"_buildFragmentShader",value:function(){var e,t,i=this._scene,s=i._sectionPlanesState,r=s.getNumAllocatedSectionPlanes()>0,n=[];if(n.push("#version 300 es"),n.push("// Points instancing depth vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("#endif"),i.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("in float vFragDepth;")),r)for(n.push("in vec4 vWorldPosition;"),n.push("in float vFlags;"),e=0,t=s.getNumAllocatedSectionPlanes();e 1.0) {"),n.push(" discard;"),n.push(" }")),r){for(n.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),n.push(" if (clippable) {"),n.push(" float dist = 0.0;"),e=0,t=s.getNumAllocatedSectionPlanes();e 0.0) { discard; }"),n.push("}")}return n.push(" outColor = packDepthToRGBA( gl_FragCoord.z); "),i.logarithmicDepthBufferEnabled&&n.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),n.push("}"),n}}]),i}(),_u=function(e){g(i,hu);var t=_(i);function i(){return x(this,i),t.apply(this,arguments)}return C(i,[{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// Instancing geometry shadow drawing vertex shader"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in vec4 color;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform mat4 shadowViewMatrix;"),i.push("uniform mat4 shadowProjMatrix;"),this._addMatricesUniformBlockLines(i),i.push("uniform float pointSize;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("void main(void) {"),i.push("int colorFlag = int(flags) & 0xF;"),i.push("bool visible = (colorFlag > 0);"),i.push("bool transparent = ((float(color.a) / 255.0) < 1.0);"),i.push("if (!visible || transparent) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; "),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags = flags;")),i.push(" gl_Position = shadowProjMatrix * viewPosition;"),i.push("}"),i.push("gl_PointSize = pointSize;"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// Instancing geometry depth drawing fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("in float vFlags;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 1.0) {"),s.push(" discard;"),s.push(" }"),i){s.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { discard; }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),s.push("}"),s}}]),i}(),yu=$.vec3(),bu=$.vec3(),Bu=$.vec3();$.vec3();var wu=$.mat4(),xu=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.canvas.gl,o=r.camera,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||o.viewMatrix;this._vaoCache.has(t)?n.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=yu;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=bu;if(l){var g=$.transformPoint3(A,l,Bu);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,wu),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;n.uniform2fv(this.uVectorA,e.snapVectorA),n.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),n.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),n.uniform3fv(this._uCoordinateScaler,f),n.uniform1i(this._uRenderPass,i),n.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(o.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),n.bindBuffer(n.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),n.bufferData(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);n.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),n.vertexAttribDivisor(this._aModelMatrixCol0.location,1),n.vertexAttribDivisor(this._aModelMatrixCol1.location,1),n.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags&&(this._aFlags.bindArrayBuffer(a.flagsBuf),n.vertexAttribDivisor(this._aFlags.location,1)),n.drawArraysInstanced(n.POINTS,0,a.positionsBuf.numItems,a.numInstances),n.vertexAttribDivisor(this._aModelMatrixCol0.location,0),n.vertexAttribDivisor(this._aModelMatrixCol1.location,0),n.vertexAttribDivisor(this._aModelMatrixCol2.location,0),this._aFlags&&n.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&n.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthBufInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec4 pickColor;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("out float vFlags;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vWorldPosition = worldPosition;"),t&&i.push(" vFlags = flags;"),i.push("vPickColor = pickColor;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Points instancing pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);"),i.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);"),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),Pu=$.vec3(),Cu=$.vec3(),Mu=$.vec3();$.vec3();var Fu=$.mat4(),Eu=function(e){g(i,po);var t=_(i);function i(e){return x(this,i),t.call(this,e,!1,{instancing:!0})}return C(i,[{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=t.aabb,d=e.pickViewMatrix||n.viewMatrix;this._vaoCache.has(t)?o.bindVertexArray(this._vaoCache.get(t)):this._vaoCache.set(t,this._makeVAO(a));var p,f=Pu;if(f[0]=$.safeInv(h[3]-h[0])*$.MAX_INT,f[1]=$.safeInv(h[4]-h[1])*$.MAX_INT,f[2]=$.safeInv(h[5]-h[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(f[0]),e.snapPickCoordinateScale[1]=$.safeInv(f[1]),e.snapPickCoordinateScale[2]=$.safeInv(f[2]),l||0!==u[0]||0!==u[1]||0!==u[2]){var v=Cu;if(l){var g=$.transformPoint3(A,l,Mu);v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=u[0],v[1]+=u[1],v[2]+=u[2],p=Re(d,v,Fu),e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else p=d,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;o.uniform2fv(this.uVectorA,e.snapVectorA),o.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),o.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),o.uniform3fv(this._uCoordinateScaler,f),o.uniform1i(this._uRenderPass,i),o.uniform1i(this._uPickInvisible,e.pickInvisible);var m=0;this._matricesUniformBlockBufferData.set(c,0),this._matricesUniformBlockBufferData.set(p,m+=16),this._matricesUniformBlockBufferData.set(n.projMatrix,m+=16),this._matricesUniformBlockBufferData.set(a.positionsDecodeMatrix,m+=16),o.bindBuffer(o.UNIFORM_BUFFER,this._matricesUniformBlockBuffer),o.bufferData(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,o.DYNAMIC_DRAW),o.bindBufferBase(o.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_),this.setSectionPlanesStateUniforms(t),this._aModelMatrixCol0.bindArrayBuffer(a.modelMatrixCol0Buf),this._aModelMatrixCol1.bindArrayBuffer(a.modelMatrixCol1Buf),this._aModelMatrixCol2.bindArrayBuffer(a.modelMatrixCol2Buf),o.vertexAttribDivisor(this._aModelMatrixCol0.location,1),o.vertexAttribDivisor(this._aModelMatrixCol1.location,1),o.vertexAttribDivisor(this._aModelMatrixCol2.location,1),this._aFlags.bindArrayBuffer(a.flagsBuf),o.vertexAttribDivisor(this._aFlags.location,1),o.drawArraysInstanced(o.POINTS,0,a.positionsBuf.numItems,a.numInstances),o.vertexAttribDivisor(this._aModelMatrixCol0.location,0),o.vertexAttribDivisor(this._aModelMatrixCol1.location,0),o.vertexAttribDivisor(this._aModelMatrixCol2.location,0),o.vertexAttribDivisor(this._aFlags.location,0),this._aOffset&&o.vertexAttribDivisor(this._aOffset.location,0)}}},{key:"_allocate",value:function(){f(B(i.prototype),"_allocate",this).call(this);var e=this._program;this._uLogDepthBufFC=e.getLocation("logDepthBufFC"),this.uVectorA=e.getLocation("snapVectorA"),this.uInverseVectorAB=e.getLocation("snapInvVectorAB"),this._uLayerNumber=e.getLocation("layerNumber"),this._uCoordinateScaler=e.getLocation("coordinateScaler")}},{key:"_bindProgram",value:function(){this._program.bind()}},{key:"_buildVertexShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];return i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("in vec3 position;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("in float flags;"),i.push("in vec4 modelMatrixCol0;"),i.push("in vec4 modelMatrixCol1;"),i.push("in vec4 modelMatrixCol2;"),i.push("uniform bool pickInvisible;"),this._addMatricesUniformBlockLines(i),i.push("uniform vec2 snapVectorA;"),i.push("uniform vec2 snapInvVectorAB;"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;"),i.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out float vFlags;")),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int pickFlag = int(flags) >> 12 & 0xF;"),i.push("if (pickFlag != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push("} else {"),i.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); "),i.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);"),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags = flags;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// SnapInstancingDepthRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int layerNumber;"),i.push("uniform vec3 coordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("in float vFlags;");for(var s=0;s> 16 & 0xF) == 1;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push("}")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),i}(),ku=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null),this._shadowRenderer&&!this._shadowRenderer.getValid()&&(this._shadowRenderer.destroy(),this._shadowRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null)}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new du(this._scene,!1)),this._colorRenderer}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new pu(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new mu(this._scene)),this._depthRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new fu(this._scene)),this._pickMeshRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new vu(this._scene)),this._pickDepthRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new gu(this._scene)),this._occlusionRenderer}},{key:"shadowRenderer",get:function(){return this._shadowRenderer||(this._shadowRenderer=new _u(this._scene)),this._shadowRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new xu(this._scene,!1)),this._snapInitRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new Eu(this._scene)),this._snapRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy(),this._shadowRenderer&&this._shadowRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy()}}]),e}(),Iu={};var Du=new Uint8Array(4),Su=new Float32Array(1),Tu=new Float32Array(3),Ru=new Float32Array(4),Lu=function(){function e(t){var i,s,r;x(this,e),console.info("VBOInstancingPointsLayer"),this.model=t.model,this.material=t.material,this.sortId="PointsInstancingLayer",this.layerIndex=t.layerIndex,this._renderers=(i=t.model.scene,s=i.id,(r=Iu[s])||(r=new ku(i),Iu[s]=r,r._compile(),i.on("compile",(function(){r._compile()})),i.on("destroyed",(function(){delete Iu[s],r._destroy()}))),r),this._aabb=$.collapseAABB3(),this._state=new Zt({obb:$.OBB3(),numInstances:0,origin:t.origin?$.vec3(t.origin):null,geometry:t.geometry,positionsDecodeMatrix:t.geometry.positionsDecodeMatrix,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null}),this._numPortions=0,this._numVisibleLayerPortions=0,this._numTransparentLayerPortions=0,this._numXRayedLayerPortions=0,this._numHighlightedLayerPortions=0,this._numSelectedLayerPortions=0,this._numClippableLayerPortions=0,this._numEdgesLayerPortions=0,this._numPickableLayerPortions=0,this._numCulledLayerPortions=0,this.numIndices=t.geometry.numIndices,this._pickColors=[],this._offsets=[],this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[],this._portions=[],this._meshes=[],this._aabb=$.collapseAABB3(),this.aabbDirty=!0,this._finalized=!1}return C(e,[{key:"aabb",get:function(){if(this.aabbDirty){$.collapseAABB3(this._aabb);for(var e=0,t=this._meshes.length;e0){i.flagsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(t),t,1,e.DYNAMIC_DRAW,!1)}if(this.model.scene.entityOffsetsEnabled&&this._offsets.length>0){i.offsetsBuf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,e.DYNAMIC_DRAW,!1),this._offsets=[]}if(s.positionsCompressed&&s.positionsCompressed.length>0){i.positionsBuf=new It(e,e.ARRAY_BUFFER,s.positionsCompressed,s.positionsCompressed.length,3,e.STATIC_DRAW,!1),i.positionsDecodeMatrix=$.mat4(s.positionsDecodeMatrix)}if(s.colorsCompressed&&s.colorsCompressed.length>0){var r=new Uint8Array(s.colorsCompressed);i.colorsBuf=new It(e,e.ARRAY_BUFFER,r,r.length,4,e.STATIC_DRAW,!1)}if(this._modelMatrixCol0.length>0){var n=!1;i.modelMatrixCol0Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,e.STATIC_DRAW,n),i.modelMatrixCol1Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,e.STATIC_DRAW,n),i.modelMatrixCol2Buf=new It(e,e.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,e.STATIC_DRAW,n),this._modelMatrixCol0=[],this._modelMatrixCol1=[],this._modelMatrixCol2=[]}if(this._pickColors.length>0){i.pickColorsBuf=new It(e,e.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,e.STATIC_DRAW,!1),this._pickColors=[]}i.geometry=null,this._finalized=!0}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++),this._setFlags(e,t,i)}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags(e,t)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions--,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){if(!this._finalized)throw"Not finalized";Du[0]=t[0],Du[1]=t[1],Du[2]=t[2],this._state.colorsBuf.setData(Du,3*e)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){if(!this._finalized)throw"Not finalized";var s=!!(t&Qe),r=!!(t&ze),n=!!(t&We),o=!!(t&Ke),a=!!(t&Xe),l=!!(t&He),u=!!(t&Ve),A=0;A|=!s||u||r||n&&!this.model.scene.highlightMaterial.glowThrough||o&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,A|=(!s||u?oo.NOT_RENDERED:o?oo.SILHOUETTE_SELECTED:n?oo.SILHOUETTE_HIGHLIGHTED:r?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED)<<4,A|=(!s||u?oo.NOT_RENDERED:o?oo.EDGES_SELECTED:n?oo.EDGES_HIGHLIGHTED:r?oo.EDGES_XRAYED:a?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED)<<8,A|=(s&&!u&&l?oo.PICK:oo.NOT_RENDERED)<<12,A|=(t&je?255:0)<<16,Su[0]=A,this._state.flagsBuf.setData(Su,e)}},{key:"setOffset",value:function(e,t){if(!this._finalized)throw"Not finalized";this.model.scene.entityOffsetsEnabled?(Tu[0]=t[0],Tu[1]=t[1],Tu[2]=t[2],this._state.offsetsBuf.setData(Tu,3*e)):this.model.error("Entity#offset not enabled for this Viewer")}},{key:"setMatrix",value:function(e,t){if(!this._finalized)throw"Not finalized";var i=4*e;Ru[0]=t[0],Ru[1]=t[4],Ru[2]=t[8],Ru[3]=t[12],this._state.modelMatrixCol0Buf.setData(Ru,i),Ru[0]=t[1],Ru[1]=t[5],Ru[2]=t[9],Ru[3]=t[13],this._state.modelMatrixCol1Buf.setData(Ru,i),Ru[0]=t[2],Ru[1]=t[6],Ru[2]=t[10],Ru[3]=t[14],this._state.modelMatrixCol2Buf.setData(Ru,i)}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED)}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED)}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED)}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawOcclusion",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawShadow",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawPickDepths",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawPickNormals",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK)}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK)}},{key:"destroy",value:function(){var e=this._state;e.colorsBuf&&(e.colorsBuf.destroy(),e.colorsBuf=null),e.flagsBuf&&(e.flagsBuf.destroy(),e.flagsBuf=null),e.offsetsBuf&&(e.offsetsBuf.destroy(),e.offsetsBuf=null),e.modelMatrixCol0Buf&&(e.modelMatrixCol0Buf.destroy(),e.modelMatrixCol0Buf=null),e.modelMatrixCol1Buf&&(e.modelMatrixCol1Buf.destroy(),e.modelMatrixCol1Buf=null),e.modelMatrixCol2Buf&&(e.modelMatrixCol2Buf.destroy(),e.modelMatrixCol2Buf=null),e.pickColorsBuf&&(e.pickColorsBuf.destroy(),e.pickColorsBuf=null),e.destroy()}}]),e}(),Uu=$.vec3(),Ou=$.vec3(),Nu=$.mat4(),Qu=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate,d=r.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uPerObjectDecodeMatrix,this._uPerVertexPosition,this.uPerObjectColorAndFlags,this._uPerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=Uu;if(f){var m=$.transformPoint3(c,u,Ou);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,Nu)}else p=d;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,8),o.drawArrays(o.LINES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,16),o.drawArrays(o.LINES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindLineIndicesTextures(this._program,this._uPerLineObject,this._uPerLineIndices,32),o.drawArrays(o.LINES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// LinesDataTextureColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uPerObjectDecodeMatrix;"),i.push("uniform highp sampler2D uPerObjectMatrix;"),i.push("uniform lowp usampler2D uPerObjectColorAndFlags;"),i.push("uniform mediump usampler2D uPerVertexPosition;"),i.push("uniform highp usampler2D uPerLineIndices;"),i.push("uniform mediump usampler2D uPerLineObject;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push(" int lineIndex = gl_VertexID / 2;"),i.push(" int h_packed_object_id_index = (lineIndex >> 3) & 4095;"),i.push(" int v_packed_object_id_index = (lineIndex >> 3) >> 12;"),i.push(" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push(" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" } else {"),i.push(" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push(" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push(" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;"),i.push(" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;"),i.push(" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;"),i.push(" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));"),i.push(" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push(" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push(" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push(" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push(" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push(" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push(" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));"),i.push(" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push(" if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push(" };"),i.push(" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push(" vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push(" vFragDepth = 1.0 + clipPos.w;"),i.push(" isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push(" gl_Position = clipPos;"),i.push(" vec4 rgb = vec4(color.rgba);"),i.push(" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState,i=t.getNumAllocatedSectionPlanes()>0,s=[];if(s.push("#version 300 es"),s.push("// LinesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),s.push(" outColor = vColor;"),s.push("}"),s}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),Vu=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null)}},{key:"eagerCreateRenders",value:function(){}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new Qu(this._scene,!1)),this._colorRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy()}}]),e}(),Hu={};var ju=C((function e(){x(this,e),this.positionsCompressed=[],this.lenPositionsCompressed=0,this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perLineNumberPortionId8Bits=[],this.perLineNumberPortionId16Bits=[],this.perLineNumberPortionId32Bits=[]})),Gu=function(){function e(){x(this,e),this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerLineIdPortionIds8Bits=null,this.texturePerLineIdPortionIds16Bits=null,this.texturePerLineIdPortionIds32Bits=null,this.texturePerLineIdIndices8Bits=null,this.texturePerLineIdIndices16Bits=null,this.texturePerLineIdIndices32Bits=null,this.textureModelMatrices=null}return C(e,[{key:"finalize",value:function(){this.indicesPerBitnessTextures={8:this.texturePerLineIdIndices8Bits,16:this.texturePerLineIdIndices16Bits,32:this.texturePerLineIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerLineIdPortionIds8Bits,16:this.texturePerLineIdPortionIds16Bits,32:this.texturePerLineIdPortionIds32Bits}}},{key:"bindCommonTextures",value:function(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}},{key:"bindLineIndicesTextures",value:function(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}}]),e}(),zu=function(){function e(t,i,s,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;x(this,e),this._gl=t,this._texture=i,this._textureWidth=s,this._textureHeight=r,this._textureData=n}return C(e,[{key:"bindTexture",value:function(e,t,i){return e.bindTexture(t,this,i)}},{key:"bind",value:function(e){return this._gl.activeTexture(this._gl["TEXTURE"+e]),this._gl.bindTexture(this._gl.TEXTURE_2D,this._texture),!0}},{key:"unbind",value:function(e){}}]),e}(),Wu={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalLines:0,totalLines8Bits:0,totalLines16Bits:0,totalLines32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(Wu,null,4));var e=0;Object.keys(Wu).forEach((function(t){t.startsWith("size")&&(e+=Wu[t])})),console.log("Total size ".concat(e," bytes (").concat((e/1e3/1e3).toFixed(2)," MB)")),console.log("Avg bytes / triangle: ".concat((e/Wu.totalLines).toFixed(2)));var t={};Object.keys(Wu).forEach((function(i){i.startsWith("size")&&(t[i]="".concat((Wu[i]/e*100).toFixed(2)," % of total"))})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};var Ku=function(){function e(){x(this,e)}return C(e,[{key:"disableBindedTextureFiltering",value:function(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}},{key:"generateTextureForColorsAndFlags",value:function(e,t,i,s,r){var n=t.length;this.numPortions=n;var o=4096,a=Math.ceil(n/512);if(0===a)throw"texture height===0";var l=new Uint8Array(16384*a);Wu.sizeDataColorsAndFlags+=l.byteLength,Wu.numberOfTextures++;for(var u=0;u>24&255,s[u]>>16&255,s[u]>>8&255,255&s[u]],32*u+16),l.set([r[u]>>24&255,r[u]>>16&255,r[u]>>8&255,255&r[u]],32*u+20);var A=e.createTexture();return e.bindTexture(e.TEXTURE_2D,A),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,o,a),e.texSubImage2D(e.TEXTURE_2D,0,0,0,o,a,e.RGBA_INTEGER,e.UNSIGNED_BYTE,l,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,A,o,a,l)}},{key:"generateTextureForObjectOffsets",value:function(e,t){var i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";var r=new Float32Array(1536*s).fill(0);Wu.sizeDataTextureOffsets+=r.byteLength,Wu.numberOfTextures++;var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,n,i,s,r)}},{key:"generateTextureForInstancingMatrices",value:function(e,t){var i=t.length;if(0===i)throw"num instance matrices===0";var s=2048,r=Math.ceil(i/512),n=new Float32Array(8192*r);Wu.numberOfTextures++;for(var o=0;o65536&&Wu.cannotCreatePortion.because10BitsObjectId++;var i=this._numPortions+t<=65536,s=void 0!==e.geometryId&&null!==e.geometryId?"".concat(e.geometryId,"#").concat(0):"".concat(e.id,"#").concat(0);if(!this._bucketGeometries[s]){var r=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits),n=0,o=0;e.buckets.forEach((function(e){n+=e.positionsCompressed.length/3,o+=e.indices.length/2})),(this._state.numVertices+n>4096*Ju||r+o>4096*Ju)&&Wu.cannotCreatePortion.becauseTextureSize++,i&&(i=this._state.numVertices+n<=4096*Ju&&r+o<=4096*Ju)}return i}},{key:"createPortion",value:function(e,t){var i=this;if(this._finalized)throw"Already finalized";var s=[];t.buckets.forEach((function(e,r){var n=void 0!==t.geometryId&&null!==t.geometryId?"".concat(t.geometryId,"#").concat(r):"".concat(t.id,"#").concat(r),o=i._bucketGeometries[n];o||(o=i._createBucketGeometry(t,e),i._bucketGeometries[n]=o);var a=i._createSubPortion(t,o,e);s.push(a)}));var r=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(s),this.model.numPortions++,this._meshes.push(e),r}},{key:"_createBucketGeometry",value:function(e,t){if(t.indices){var i=8*Math.ceil(t.indices.length/2/8)*2;Wu.overheadSizeAlignementIndices+=2*(i-t.indices.length);var s=new Uint32Array(i);s.fill(0),s.set(t.indices),t.indices=s}var r=t.positionsCompressed,n=t.indices,o=this._buffer;o.positionsCompressed.push(r);var a,l=o.lenPositionsCompressed/3,u=r.length/3;o.lenPositionsCompressed+=r.length;var A,c=0;n&&(c=n.length/2,u<=256?(A=o.indices8Bits,a=o.lenIndices8Bits/2,o.lenIndices8Bits+=n.length):u<=65536?(A=o.indices16Bits,a=o.lenIndices16Bits/2,o.lenIndices16Bits+=n.length):(A=o.indices32Bits,a=o.lenIndices32Bits/2,o.lenIndices32Bits+=n.length),A.push(n));return this._state.numVertices+=u,Wu.numberOfGeometries++,{vertexBase:l,numVertices:u,numLines:c,indicesBase:a}}},{key:"_createSubPortion",value:function(e,t){var i,s=e.color,r=e.colors,n=e.opacity,o=e.meshMatrix,a=e.pickColor,l=this._buffer,u=this._state;l.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),l.perObjectInstancePositioningMatrices.push(o||eA),l.perObjectSolid.push(!!e.solid),r?l.perObjectColors.push([255*r[0],255*r[1],255*r[2],255]):s&&l.perObjectColors.push([s[0],s[1],s[2],n]),l.perObjectPickColors.push(a),l.perObjectVertexBases.push(t.vertexBase),i=t.numVertices<=256?u.numIndices8Bits:t.numVertices<=65536?u.numIndices16Bits:u.numIndices32Bits,l.perObjectIndexBaseOffsets.push(i/2-t.indicesBase);var A=this._subPortions.length;if(t.numLines>0){var c,h=2*t.numLines;t.numVertices<=256?(c=l.perLineNumberPortionId8Bits,u.numIndices8Bits+=h,Wu.totalLines8Bits+=t.numLines):t.numVertices<=65536?(c=l.perLineNumberPortionId16Bits,u.numIndices16Bits+=h,Wu.totalLines16Bits+=t.numLines):(c=l.perLineNumberPortionId32Bits,u.numIndices32Bits+=h,Wu.totalLines32Bits+=t.numLines),Wu.totalLines+=t.numLines;for(var d=0;d0&&(i.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(s,r.indices8Bits,r.lenIndices8Bits)),r.lenIndices16Bits>0&&(i.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(s,r.indices16Bits,r.lenIndices16Bits)),r.lenIndices32Bits>0&&(i.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(s,r.indices32Bits,r.lenIndices32Bits)),i.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(function(){e._deferredSetFlagsDirty&&e._uploadDeferredFlags(),e._numUpdatesInFrame=0}))}}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags(),this._setDeferredFlags2()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}},{key:"_beginDeferredFlags",value:function(){this._deferredSetFlagsActive=!0}},{key:"_uploadDeferredFlags",value:function(){if(this._deferredSetFlagsActive=!1,this._deferredSetFlagsDirty){this._deferredSetFlagsDirty=!1;var e=this.model.scene.canvas.gl,t=this._dataTextureState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,Zu))}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this._portionToSubPortionsMap[e],n=0,o=r.length;n3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=!!(t&Qe),a=!!(t&ze),l=!!(t&We),u=!!(t&Ke),A=!!(t&He),c=!!(t&Ve);r=!o||c||a?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!o||c?oo.NOT_RENDERED:u?oo.SILHOUETTE_SELECTED:l?oo.SILHOUETTE_HIGHLIGHTED:a?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var h=o&&!c&&A?oo.PICK:oo.NOT_RENDERED,d=this._dataTextureState,p=this.model.scene.canvas.gl;Zu[0]=r,Zu[1]=n,Zu[3]=h,d.texturePerObjectColorsAndFlags._textureData.set(Zu,32*e+8),this._deferredSetFlagsActive||s?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),p.bindTexture(p.TEXTURE_2D,d.texturePerObjectColorsAndFlags._texture),p.texSubImage2D(p.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,p.RGBA_INTEGER,p.UNSIGNED_BYTE,Zu))}},{key:"_setDeferredFlags",value:function(){}},{key:"_setFlags2",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=this._portionToSubPortionsMap[e],r=0,n=s.length;r2&&void 0!==arguments[2]&&arguments[2];if(!this._finalized)throw"Not finalized";var s=t&je?255:0,r=this._dataTextureState,n=this.model.scene.canvas.gl;Zu[0]=s,Zu[1]=0,Zu[2]=1,Zu[3]=2,r.texturePerObjectColorsAndFlags._textureData.set(Zu,32*e+12),this._deferredSetFlagsActive||i?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),n.bindTexture(n.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),n.texSubImage2D(n.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,n.RGBA_INTEGER,n.UNSIGNED_BYTE,Zu))}},{key:"_setDeferredFlags2",value:function(){}},{key:"setOffset",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,qu))}},{key:"setMatrix",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,Yu))}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE)}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT)}},{key:"drawDepth",value:function(e,t){}},{key:"drawNormals",value:function(e,t){}},{key:"drawSilhouetteXRayed",value:function(e,t){}},{key:"drawSilhouetteHighlighted",value:function(e,t){}},{key:"drawSilhouetteSelected",value:function(e,t){}},{key:"drawEdgesColorOpaque",value:function(e,t){}},{key:"drawEdgesColorTransparent",value:function(e,t){}},{key:"drawEdgesHighlighted",value:function(e,t){}},{key:"drawEdgesSelected",value:function(e,t){}},{key:"drawEdgesXRayed",value:function(e,t){}},{key:"drawOcclusion",value:function(e,t){}},{key:"drawShadow",value:function(e,t){}},{key:"setPickMatrices",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){}},{key:"drawPickDepths",value:function(e,t){}},{key:"drawSnapInit",value:function(e,t){}},{key:"drawSnap",value:function(e,t){}},{key:"drawPickNormals",value:function(e,t){}},{key:"destroy",value:function(){if(!this._destroyed){var e=this._state;this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}}]),e}(),iA=$.vec3(),sA=$.vec3(),rA=$.vec3();$.vec3();var nA=$.vec4(),oA=$.mat4(),aA=function(){function e(t,i){x(this,e),this._scene=t,this._withSAO=i,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=iA;if(f){var m=$.transformPoint3(c,u,sA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,oA),(p=rA)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl,i=e._lightsState;if(this._program=new kt(t,this._buildShader()),this._program.errors)return this.errors=this._program.errors,void console.error(this.errors);var s=this._program;this._uRenderPass=s.getLocation("renderPass"),this._uLightAmbient=s.getLocation("lightAmbient"),this._uLightColor=[],this._uLightDir=[],this._uLightPos=[],this._uLightAttenuation=[];for(var r=i.lights,n=0,o=r.length;n0,n=[];n.push("#version 300 es"),n.push("// TrianglesDataTextureColorRenderer vertex shader"),n.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),n.push("precision highp float;"),n.push("precision highp int;"),n.push("precision highp usampler2D;"),n.push("precision highp isampler2D;"),n.push("precision highp sampler2D;"),n.push("#else"),n.push("precision mediump float;"),n.push("precision mediump int;"),n.push("precision mediump usampler2D;"),n.push("precision mediump isampler2D;"),n.push("precision mediump sampler2D;"),n.push("#endif"),n.push("uniform int renderPass;"),n.push("uniform mat4 sceneModelMatrix;"),n.push("uniform mat4 viewMatrix;"),n.push("uniform mat4 projMatrix;"),n.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),n.push("uniform highp sampler2D uTexturePerObjectMatrix;"),n.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),n.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),n.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),n.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),n.push("uniform vec3 uCameraEyeRtc;"),n.push("vec3 positions[3];"),t.logarithmicDepthBufferEnabled&&(n.push("uniform float logDepthBufFC;"),n.push("out float vFragDepth;"),n.push("out float isPerspective;")),n.push("bool isPerspectiveMatrix(mat4 m) {"),n.push(" return (m[2][3] == - 1.0);"),n.push("}"),n.push("uniform vec4 lightAmbient;");for(var o=0,a=s.lights.length;o> 3) & 4095;"),n.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),n.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),n.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),n.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),n.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),n.push("if (int(flags.x) != renderPass) {"),n.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),n.push(" return;"),n.push("} else {"),n.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),n.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),n.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),n.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),n.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),n.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),n.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),n.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),n.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),n.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),n.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),n.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),n.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),n.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),n.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),n.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),n.push("if (color.a == 0u) {"),n.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),n.push(" return;"),n.push("};"),n.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),n.push("vec3 position;"),n.push("position = positions[gl_VertexID % 3];"),n.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),n.push("if (solid != 1u) {"),n.push("if (isPerspectiveMatrix(projMatrix)) {"),n.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),n.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),n.push("position = positions[2 - (gl_VertexID % 3)];"),n.push("viewNormal = -viewNormal;"),n.push("}"),n.push("} else {"),n.push("if (viewNormal.z < 0.0) {"),n.push("position = positions[2 - (gl_VertexID % 3)];"),n.push("viewNormal = -viewNormal;"),n.push("}"),n.push("}"),n.push("}"),n.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); "),n.push("vec4 viewPosition = viewMatrix * worldPosition; "),n.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);"),n.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);"),n.push("float lambertian = 1.0;");for(var l=0,u=s.lights.length;l0,s=[];if(s.push("#version 300 es"),s.push("// TrianglesDataTextureColorRenderer fragment shader"),s.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),s.push("precision highp float;"),s.push("precision highp int;"),s.push("#else"),s.push("precision mediump float;"),s.push("precision mediump int;"),s.push("#endif"),e.logarithmicDepthBufferEnabled&&(s.push("in float isPerspective;"),s.push("uniform float logDepthBufFC;"),s.push("in float vFragDepth;")),this._withSAO&&(s.push("uniform sampler2D uOcclusionTexture;"),s.push("uniform vec4 uSAOParams;"),s.push("const float packUpscale = 256. / 255.;"),s.push("const float unpackDownScale = 255. / 256.;"),s.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );"),s.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );"),s.push("float unpackRGBToFloat( const in vec4 v ) {"),s.push(" return dot( v, unPackFactors );"),s.push("}")),i){s.push("in vec4 vWorldPosition;"),s.push("flat in uint vFlags2;");for(var r=0,n=t.getNumAllocatedSectionPlanes();r 0u;"),s.push(" if (clippable) {"),s.push(" float dist = 0.0;");for(var o=0,a=t.getNumAllocatedSectionPlanes();o 0.0) { "),s.push(" discard;"),s.push(" }"),s.push("}")}return e.logarithmicDepthBufferEnabled&&s.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),this._withSAO?(s.push(" float viewportWidth = uSAOParams[0];"),s.push(" float viewportHeight = uSAOParams[1];"),s.push(" float blendCutoff = uSAOParams[2];"),s.push(" float blendFactor = uSAOParams[3];"),s.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);"),s.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;"),s.push(" outColor = vec4(vColor.rgb * ambient, 1.0);")):s.push(" outColor = vColor;"),s.push("}"),s}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),lA=new Float32Array([1,1,1]),uA=$.vec3(),AA=$.vec3(),cA=$.vec3();$.vec3();var hA=$.mat4(),dA=function(){function e(t,i){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate,d=r.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p,f;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),u||0!==A[0]||0!==A[1]||0!==A[2]){var v=uA;if(u){var g=AA;$.transformPoint3(c,u,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=A[0],v[1]+=A[1],v[2]+=A[2],p=Re(d,v,hA),(f=cA)[0]=r.eye[0]-v[0],f[1]=r.eye[1]-v[1],f[2]=r.eye[2]-v[2]}else p=d,f=r.eye;if(o.uniform3fv(this._uCameraEyeRtc,f),o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),i===oo.SILHOUETTE_XRAYED){var m=s.xrayMaterial._state,_=m.fillColor,y=m.fillAlpha;o.uniform4f(this._uColor,_[0],_[1],_[2],y)}else if(i===oo.SILHOUETTE_HIGHLIGHTED){var b=s.highlightMaterial._state,B=b.fillColor,w=b.fillAlpha;o.uniform4f(this._uColor,B[0],B[1],B[2],w)}else if(i===oo.SILHOUETTE_SELECTED){var x=s.selectedMaterial._state,P=x.fillColor,C=x.fillAlpha;o.uniform4f(this._uColor,P[0],P[1],P[2],C)}else o.uniform4fv(this._uColor,lA);if(s.logarithmicDepthBufferEnabled){var M=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,M)}var F=s._sectionPlanesState.getNumAllocatedSectionPlanes(),E=s._sectionPlanesState.sectionPlanes.length;if(F>0)for(var k=s._sectionPlanesState.sectionPlanes,I=t.layerIndex*E,D=n.renderFlags,S=0;S0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture silhouette vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.y) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = color;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),pA=new Float32Array([0,0,0,1]),fA=$.vec3(),vA=$.vec3();$.vec3();var gA=$.mat4(),mA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=fA;if(f){var m=$.transformPoint3(c,u,vA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,gA)}else p=d;if(o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix),i===oo.EDGES_XRAYED){var _=r.xrayMaterial._state,y=_.edgeColor,b=_.edgeAlpha;o.uniform4f(this._uColor,y[0],y[1],y[2],b)}else if(i===oo.EDGES_HIGHLIGHTED){var B=r.highlightMaterial._state,w=B.edgeColor,x=B.edgeAlpha;o.uniform4f(this._uColor,w[0],w[1],w[2],x)}else if(i===oo.EDGES_SELECTED){var P=r.selectedMaterial._state,C=P.edgeColor,M=P.edgeAlpha;o.uniform4f(this._uColor,C[0],C[1],C[2],M)}else o.uniform4fv(this._uColor,pA);var F=r._sectionPlanesState.getNumAllocatedSectionPlanes(),E=r._sectionPlanesState.sectionPlanes.length;if(F>0)for(var k=r._sectionPlanesState.sectionPlanes,I=t.layerIndex*E,D=s.renderFlags,S=0;S0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),o.drawArrays(o.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),o.drawArrays(o.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),o.drawArrays(o.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uColor=i.getLocation("color"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uWorldMatrix=i.getLocation("worldMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec4 color;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vColor = vec4(color.r, color.g, color.b, color.a);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesEdgesRenderer fragment shader"),e.logarithmicDepthBufferEnabled&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),_A=$.vec3(),yA=$.vec3(),bA=$.mat4(),BA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=n.viewMatrix;if(this._program||(this._allocate(),!this.errors)){var p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=_A;if(f){var m=$.transformPoint3(c,u,yA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],p=Re(d,g,bA)}else p=d;o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix);var _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),y=r._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=r._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=s.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),o.drawArrays(o.LINES,0,a.numEdgeIndices8Bits)),a.numEdgeIndices16Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),o.drawArrays(o.LINES,0,a.numEdgeIndices16Bits)),a.numEdgeIndices32Bits>0&&(l.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),o.drawArrays(o.LINES,0,a.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled,i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uObjectPerObjectOffsets;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;")),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vColor;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.z) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push("vec4 rgb = vec4(color.rgba);"),i.push("vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureEdgesColorRenderer"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { discard; }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outColor = vColor;"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),wA=$.vec3(),xA=$.vec3(),PA=$.vec3(),CA=$.mat4(),MA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(t),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e));var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate;A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==c[0]||0!==c[1]||0!==c[2],v=0!==h[0]||0!==h[1]||0!==h[2];if(f||v){var g=wA;if(f){var m=$.transformPoint3(d,c,xA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=h[0],g[1]+=h[1],g[2]+=h[2],s=Re(a.viewMatrix,g,CA),(r=PA)[0]=a.eye[0]-g[0],r[1]=a.eye[1]-g[1],r[2]=a.eye[2]-g[2]}else s=a.viewMatrix,r=a.eye;if(l.uniform2fv(this._uPickClipPos,e.pickClipPos),l.uniform2f(this._uDrawingBufferSize,l.drawingBufferWidth,l.drawingBufferHeight),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix),l.uniform3fv(this._uCameraEyeRtc,r),l.uniform1i(this._uRenderPass,i),o.logarithmicDepthBufferEnabled){var _=2/(Math.log(a.project.far+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,_)}var y=o._sectionPlanesState.getNumAllocatedSectionPlanes(),b=o._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=o._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry picking vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("smooth out vec4 vWorldPosition;"),i.push("flat out uvec4 vFlags2;")),i.push("out vec4 vPickColor;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry picking fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uvec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" outPickColor = vPickColor; "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),FA=$.vec3(),EA=$.vec3(),kA=$.vec3();$.vec3();var IA=$.mat4(),DA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=e.pickViewMatrix||a.viewMatrix;if(this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),c||0!==h[0]||0!==h[1]||0!==h[2]){var v=FA;if(c){var g=EA;$.transformPoint3(d,c,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=h[0],v[1]+=h[1],v[2]+=h[2],s=Re(f,v,IA),(r=kA)[0]=a.eye[0]-v[0],r[1]=a.eye[1]-v[1],r[2]=a.eye[2]-v[2],e.snapPickOrigin[0]=v[0],e.snapPickOrigin[1]=v[1],e.snapPickOrigin[2]=v[2]}else s=f,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;if(l.uniform3fv(this._uCameraEyeRtc,r),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniform2fv(this._uPickClipPos,e.pickClipPos),l.uniform2f(this._uDrawingBufferSize,l.drawingBufferWidth,l.drawingBufferHeight),l.uniform1f(this._uPickZNear,e.pickZNear),l.uniform1f(this._uPickZFar,e.pickZFar),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix),o.logarithmicDepthBufferEnabled){var m=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,m)}var _=o._sectionPlanesState.getNumAllocatedSectionPlanes(),y=o._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=o._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=n.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform bool pickInvisible;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = remapClipPos(clipPos);"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("uniform float pickZNear;"),i.push("uniform float pickZFar;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(s=0;s 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));"),i.push(" outPackedDepth = packDepth(zNormalizedDepth); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),SA=$.vec3(),TA=$.vec3(),RA=$.vec3(),LA=$.vec3();$.vec3();var UA=$.mat4(),OA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){if(this._program||(this._allocate(),!this.errors)){e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=t.aabb,v=e.pickViewMatrix||a.viewMatrix,g=SA;g[0]=$.safeInv(f[3]-f[0])*$.MAX_INT,g[1]=$.safeInv(f[4]-f[1])*$.MAX_INT,g[2]=$.safeInv(f[5]-f[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(g[0]),e.snapPickCoordinateScale[1]=$.safeInv(g[1]),e.snapPickCoordinateScale[2]=$.safeInv(g[2]),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var m=0!==c[0]||0!==c[1]||0!==c[2],_=0!==h[0]||0!==h[1]||0!==h[2];if(m||_){var y=TA;if(m){var b=$.transformPoint3(d,c,RA);y[0]=b[0],y[1]=b[1],y[2]=b[2]}else y[0]=0,y[1]=0,y[2]=0;y[0]+=h[0],y[1]+=h[1],y[2]+=h[2],s=Re(v,y,UA),(r=LA)[0]=a.eye[0]-y[0],r[1]=a.eye[1]-y[1],r[2]=a.eye[2]-y[2],e.snapPickOrigin[0]=y[0],e.snapPickOrigin[1]=y[1],e.snapPickOrigin[2]=y[2]}else s=v,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;l.uniform3fv(this._uCameraEyeRtc,r),l.uniform2fv(this.uVectorA,e.snapVectorA),l.uniform2fv(this.uInverseVectorAB,e.snapInvVectorAB),l.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),l.uniform3fv(this._uCoordinateScaler,g),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniformMatrix4fv(this._uSceneModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix);var B=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,B);var w=o._sectionPlanesState.getNumAllocatedSectionPlanes(),x=o._sectionPlanesState.sectionPlanes.length;if(w>0)for(var P=o._sectionPlanesState.sectionPlanes,C=t.layerIndex*x,M=n.renderFlags,F=0;F0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8),l.drawArrays(S,0,u.numEdgeIndices8Bits)),u.numEdgeIndices16Bits>0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16),l.drawArrays(S,0,u.numEdgeIndices16Bits)),u.numEdgeIndices32Bits>0&&(A.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,32),l.drawArrays(S,0,u.numEdgeIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Batched geometry edges drawing vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;"),i.push("uniform mediump usampler2D uTexturePerEdgeIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uSnapVectorA;"),i.push("uniform vec2 uSnapInvVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out float isPerspective;"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;"),i.push(" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("out vec4 vViewPosition;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int edgeIndex = gl_VertexID / 2;"),i.push("int h_packed_object_id_index = (edgeIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (edgeIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));"),i.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;"),i.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;"),i.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;"),i.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2.r;")),i.push("vViewPosition = viewPosition;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vViewPosition = clipPos;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push("gl_PointSize = 1.0;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture pick depth fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),i.push(" }")}return i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),NA=$.vec3(),QA=$.vec3(),VA=$.vec3(),HA=$.vec3();$.vec3();var jA=$.mat4(),GA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){this._program||this._allocate(),e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram());var s,r,n=t.model,o=n.scene,a=o.camera,l=o.canvas.gl,u=t._state,A=u.textureState,c=t._state.origin,h=n.position,d=n.rotationMatrix,p=n.rotationMatrixConjugate,f=t.aabb,v=e.pickViewMatrix||a.viewMatrix,g=NA;g[0]=$.safeInv(f[3]-f[0])*$.MAX_INT,g[1]=$.safeInv(f[4]-f[1])*$.MAX_INT,g[2]=$.safeInv(f[5]-f[2])*$.MAX_INT,e.snapPickCoordinateScale[0]=$.safeInv(g[0]),e.snapPickCoordinateScale[1]=$.safeInv(g[1]),e.snapPickCoordinateScale[2]=$.safeInv(g[2]),A.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var m=0!==c[0]||0!==c[1]||0!==c[2],_=0!==h[0]||0!==h[1]||0!==h[2];if(m||_){var y=QA;if(m){var b=VA;$.transformPoint3(d,c,b),y[0]=b[0],y[1]=b[1],y[2]=b[2]}else y[0]=0,y[1]=0,y[2]=0;y[0]+=h[0],y[1]+=h[1],y[2]+=h[2],s=Re(v,y,jA),(r=HA)[0]=a.eye[0]-y[0],r[1]=a.eye[1]-y[1],r[2]=a.eye[2]-y[2],e.snapPickOrigin[0]=y[0],e.snapPickOrigin[1]=y[1],e.snapPickOrigin[2]=y[2]}else s=v,r=a.eye,e.snapPickOrigin[0]=0,e.snapPickOrigin[1]=0,e.snapPickOrigin[2]=0;l.uniform3fv(this._uCameraEyeRtc,r),l.uniform2fv(this._uVectorA,e.snapVectorA),l.uniform2fv(this._uInverseVectorAB,e.snapInvVectorAB),l.uniform1i(this._uLayerNumber,e.snapPickLayerNumber),l.uniform3fv(this._uCoordinateScaler,g),l.uniform1i(this._uRenderPass,i),l.uniform1i(this._uPickInvisible,e.pickInvisible),l.uniformMatrix4fv(this._uSceneWorldModelMatrix,!1,p),l.uniformMatrix4fv(this._uViewMatrix,!1,s),l.uniformMatrix4fv(this._uProjMatrix,!1,a.projMatrix);var B=2/(Math.log(e.pickZFar+1)/Math.LN2);l.uniform1f(this._uLogDepthBufFC,B);var w=o._sectionPlanesState.getNumAllocatedSectionPlanes(),x=o._sectionPlanesState.sectionPlanes.length;if(w>0)for(var P=o._sectionPlanesState.sectionPlanes,C=t.layerIndex*x,M=n.renderFlags,F=0;F0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),l.drawArrays(l.TRIANGLES,0,u.numIndices8Bits)),u.numIndices16Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),l.drawArrays(l.TRIANGLES,0,u.numIndices16Bits)),u.numIndices32Bits>0&&(A.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),l.drawArrays(l.TRIANGLES,0,u.numIndices32Bits)),e.drawElements++}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uSceneWorldModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("uniform vec2 uVectorAB;"),i.push("uniform vec2 uInverseVectorAB;"),i.push("vec3 positions[3];"),i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("vec2 remapClipPos(vec2 clipPos) {"),i.push(" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;"),i.push(" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;"),i.push(" return vec2(x, y);"),i.push("}"),i.push("flat out vec4 vPickColor;"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("out highp vec3 relativeToOriginPosition;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("{"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" } else {"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" viewNormal = -viewNormal;"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("relativeToOriginPosition = worldPosition.xyz;"),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));"),i.push("vec4 clipPos = projMatrix * viewPosition;"),i.push("float tmp = clipPos.w;"),i.push("clipPos.xyzw /= tmp;"),i.push("clipPos.xy = remapClipPos(clipPos.xy);"),i.push("clipPos.xyzw *= tmp;"),i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));"),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// DTXTrianglesSnapInitRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;"),i.push("uniform int uLayerNumber;"),i.push("uniform vec3 uCoordinateScaler;"),i.push("in vec4 vWorldPosition;"),i.push("flat in vec4 vPickColor;"),t){i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0;n 0.0) { discard; }"),i.push(" }")}return i.push(" float dx = dFdx(vFragDepth);"),i.push(" float dy = dFdy(vFragDepth);"),i.push(" float diff = sqrt(dx*dx+dy*dy);"),i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;"),i.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);"),i.push("vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push("vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push("outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("outPickColor = uvec4(vPickColor);"),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),zA=$.vec3(),WA=$.vec3(),KA=$.vec3();$.vec3();var XA=$.mat4(),JA=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=s.position,c=s.rotationMatrix,h=s.rotationMatrixConjugate,d=e.pickViewMatrix||n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var p,f;if(e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram()),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix),u||0!==A[0]||0!==A[1]||0!==A[2]){var v=zA;if(u){var g=WA;$.transformPoint3(c,u,g),v[0]=g[0],v[1]=g[1],v[2]=g[2]}else v[0]=0,v[1]=0,v[2]=0;v[0]+=A[0],v[1]+=A[1],v[2]+=A[2],p=Re(d,v,XA),(f=KA)[0]=n.eye[0]-v[0],f[1]=n.eye[1]-v[1],f[2]=n.eye[2]-v[2]}else p=d,f=n.eye;o.uniform3fv(this._uCameraEyeRtc,f),o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,p),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix);var m=r._sectionPlanesState.getNumAllocatedSectionPlanes(),_=r._sectionPlanesState.sectionPlanes.length;if(m>0)for(var y=r._sectionPlanesState.sectionPlanes,b=t.layerIndex*_,B=s.renderFlags,w=0;w0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uWorldMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// TrianglesDataTextureOcclusionRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("if (solid != 1u) {"),i.push(" if (isPerspectiveMatrix(projMatrix)) {"),i.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" } else {"),i.push(" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push(" if (viewNormal.z < 0.0) {"),i.push(" position = positions[2 - (gl_VertexID % 3)];"),i.push(" }"),i.push(" }"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene._sectionPlanesState,t=e.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTextureColorRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return i.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),YA=$.vec3(),ZA=$.vec3(),qA=$.vec3();$.vec3();var $A=$.mat4(),ec=function(){function e(t){x(this,e),this._scene=t,this._allocate(),this._hash=this._getHash()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=YA;if(f){var m=$.transformPoint3(c,u,ZA);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,$A),(p=qA)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPositionsDecodeMatrix=i.getLocation("objectDecodeAndInstanceMatrix"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// Triangles dataTexture draw vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out highp vec2 vHighPrecisionZW;"),t&&(i.push("out vec4 vWorldPosition;"),i.push("flat out uint vFlags2;")),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),t&&(i.push("vWorldPosition = worldPosition;"),i.push("vFlags2 = flags2.r;")),i.push("gl_Position = clipPos;"),i.push("vHighPrecisionZW = gl_Position.zw;"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Triangles dataTexture draw fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),i.push("in highp vec2 vHighPrecisionZW;"),i.push("out vec4 outColor;"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;"),i.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),tc=$.vec3(),ic=$.vec3(),sc=$.vec3();$.vec3();var rc=$.mat4(),nc=function(){function e(t){x(this,e),this._scene=t,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){return this._scene._sectionPlanesState.getHash()}},{key:"drawLayer",value:function(e,t,i){var s=t.model,r=s.scene,n=r.camera,o=r.canvas.gl,a=t._state,l=t._state.origin,u=s.position,A=s.rotationMatrix,c=s.rotationMatrixConjugate,h=n.viewMatrix;if(this._program||(this._allocate(t),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(t));var f=0!==l[0]||0!==l[1]||0!==l[2],v=0!==u[0]||0!==u[1]||0!==u[2];if(f||v){var g=tc;if(f){var m=ic;$.transformPoint3(A,l,m),g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=u[0],g[1]+=u[1],g[2]+=u[2],d=Re(h,g,rc),(p=sc)[0]=n.eye[0]-g[0],p[1]=n.eye[1]-g[1],p[2]=n.eye[2]-g[2]}else d=h,p=n.eye;o.uniform1i(this._uRenderPass,i),o.uniformMatrix4fv(this._uWorldMatrix,!1,c),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,n.projMatrix),o.uniformMatrix4fv(this._uViewNormalMatrix,!1,n.viewNormalMatrix),o.uniformMatrix4fv(this._uWorldNormalMatrix,!1,s.worldNormalMatrix);var _=r._sectionPlanesState.getNumAllocatedSectionPlanes(),y=r._sectionPlanesState.sectionPlanes.length;if(_>0)for(var b=r._sectionPlanesState.sectionPlanes,B=t.layerIndex*y,w=s.renderFlags,x=0;x<_;x++){var P=this._uSectionPlanes[x];if(P)if(x0,i=[];return i.push("// Batched geometry normals vertex shader"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("uniform int renderPass;"),i.push("attribute vec3 position;"),e.entityOffsetsEnabled&&i.push("attribute vec3 offset;"),i.push("attribute vec3 normal;"),i.push("attribute vec4 color;"),i.push("attribute vec4 flags;"),i.push("attribute vec4 flags2;"),i.push("uniform mat4 worldMatrix;"),i.push("uniform mat4 worldNormalMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform mat4 viewNormalMatrix;"),i.push("uniform mat4 objectDecodeAndInstanceMatrix;"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("out float vFragDepth;"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("varying float isPerspective;")),i.push("vec3 octDecode(vec2 oct) {"),i.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),i.push(" if (v.z < 0.0) {"),i.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),i.push(" }"),i.push(" return normalize(v);"),i.push("}"),t&&(i.push("out vec4 vWorldPosition;"),i.push("out vec4 vFlags2;")),i.push("out vec3 vViewNormal;"),i.push("void main(void) {"),i.push("if (int(flags.x) != renderPass) {"),i.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"),i.push(" } else {"),i.push(" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),e.entityOffsetsEnabled&&i.push(" worldPosition.xyz = worldPosition.xyz + offset;"),i.push(" vec4 viewPosition = viewMatrix * worldPosition; "),i.push(" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); "),i.push(" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);"),t&&(i.push(" vWorldPosition = worldPosition;"),i.push(" vFlags2 = flags2;")),i.push(" vViewNormal = viewNormal;"),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(yt.SUPPORTED_EXTENSIONS.EXT_frag_depth?i.push("vFragDepth = 1.0 + clipPos.w;"):(i.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;"),i.push("clipPos.z *= clipPos.w;")),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("gl_Position = clipPos;"),i.push(" }"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// Batched geometry normals fragment shader"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push("#extension GL_EXT_frag_depth : enable"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),t){i.push("in vec4 vWorldPosition;"),i.push("in vec4 vFlags2;");for(var s=0;s 0.0);"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var r=0;r 0.0) { discard; }"),i.push(" }")}return e.logarithmicDepthBufferEnabled&&yt.SUPPORTED_EXTENSIONS.EXT_frag_depth&&i.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); "),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),oc=$.vec3(),ac=$.vec3(),lc=$.vec3();$.vec3(),$.vec4();var uc=$.mat4(),Ac=function(){function e(t,i){x(this,e),this._scene=t,this._withSAO=i,this._hash=this._getHash(),this._allocate()}return C(e,[{key:"getValid",value:function(){return this._hash===this._getHash()}},{key:"_getHash",value:function(){var e=this._scene;return[e._lightsState.getHash(),e._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";")}},{key:"drawLayer",value:function(e,t,i){var s=this._scene,r=s.camera,n=t.model,o=s.canvas.gl,a=t._state,l=a.textureState,u=t._state.origin,A=n.position,c=n.rotationMatrix,h=n.rotationMatrixConjugate;if(this._program||(this._allocate(),!this.errors)){var d,p;e.lastProgramId!==this._program.id&&(e.lastProgramId=this._program.id,this._bindProgram(e,a)),l.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var f=0!==u[0]||0!==u[1]||0!==u[2],v=0!==A[0]||0!==A[1]||0!==A[2];if(f||v){var g=oc;if(f){var m=$.transformPoint3(c,u,ac);g[0]=m[0],g[1]=m[1],g[2]=m[2]}else g[0]=0,g[1]=0,g[2]=0;g[0]+=A[0],g[1]+=A[1],g[2]+=A[2],d=Re(r.viewMatrix,g,uc),(p=lc)[0]=r.eye[0]-g[0],p[1]=r.eye[1]-g[1],p[2]=r.eye[2]-g[2]}else d=r.viewMatrix,p=r.eye;if(o.uniform2fv(this._uPickClipPos,e.pickClipPos),o.uniform2f(this._uDrawingBufferSize,o.drawingBufferWidth,o.drawingBufferHeight),o.uniformMatrix4fv(this._uSceneModelMatrix,!1,h),o.uniformMatrix4fv(this._uViewMatrix,!1,d),o.uniformMatrix4fv(this._uProjMatrix,!1,r.projMatrix),o.uniform3fv(this._uCameraEyeRtc,p),o.uniform1i(this._uRenderPass,i),s.logarithmicDepthBufferEnabled){var _=2/(Math.log(e.pickZFar+1)/Math.LN2);o.uniform1f(this._uLogDepthBufFC,_)}var y=s._sectionPlanesState.getNumAllocatedSectionPlanes(),b=s._sectionPlanesState.sectionPlanes.length;if(y>0)for(var B=s._sectionPlanesState.sectionPlanes,w=t.layerIndex*b,x=n.renderFlags,P=0;P0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8),o.drawArrays(o.TRIANGLES,0,a.numIndices8Bits)),a.numIndices16Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16),o.drawArrays(o.TRIANGLES,0,a.numIndices16Bits)),a.numIndices32Bits>0&&(l.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32),o.drawArrays(o.TRIANGLES,0,a.numIndices32Bits)),e.drawElements++}}},{key:"_allocate",value:function(){var e=this._scene,t=e.canvas.gl;if(this._program=new kt(t,this._buildShader()),this._program.errors)this.errors=this._program.errors;else{var i=this._program;this._uRenderPass=i.getLocation("renderPass"),this._uPickInvisible=i.getLocation("pickInvisible"),this._uPickClipPos=i.getLocation("pickClipPos"),this._uDrawingBufferSize=i.getLocation("drawingBufferSize"),this._uSceneModelMatrix=i.getLocation("sceneModelMatrix"),this._uViewMatrix=i.getLocation("viewMatrix"),this._uProjMatrix=i.getLocation("projMatrix"),this._uSectionPlanes=[];for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s0,i=[];return i.push("#version 300 es"),i.push("// trianglesDatatextureNormalsRenderer vertex shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("precision highp usampler2D;"),i.push("precision highp isampler2D;"),i.push("precision highp sampler2D;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("precision mediump usampler2D;"),i.push("precision mediump isampler2D;"),i.push("precision mediump sampler2D;"),i.push("#endif"),i.push("uniform int renderPass;"),e.entityOffsetsEnabled&&i.push("in vec3 offset;"),i.push("uniform mat4 sceneModelMatrix;"),i.push("uniform mat4 viewMatrix;"),i.push("uniform mat4 projMatrix;"),i.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;"),i.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;"),i.push("uniform highp sampler2D uTexturePerObjectMatrix;"),i.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"),i.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"),i.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"),i.push("uniform vec3 uCameraEyeRtc;"),i.push("vec3 positions[3];"),e.logarithmicDepthBufferEnabled&&(i.push("uniform float logDepthBufFC;"),i.push("out float vFragDepth;"),i.push("out float isPerspective;")),i.push("uniform vec2 pickClipPos;"),i.push("uniform vec2 drawingBufferSize;"),i.push("vec4 remapClipPos(vec4 clipPos) {"),i.push(" clipPos.xy /= clipPos.w;"),i.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;"),i.push(" clipPos.xy *= clipPos.w;"),i.push(" return clipPos;"),i.push("}"),i.push("bool isPerspectiveMatrix(mat4 m) {"),i.push(" return (m[2][3] == - 1.0);"),i.push("}"),i.push("out vec4 vWorldPosition;"),t&&i.push("flat out uint vFlags2;"),i.push("void main(void) {"),i.push("int polygonIndex = gl_VertexID / 3;"),i.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;"),i.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;"),i.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);"),i.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);"),i.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"),i.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"),i.push("if (int(flags.w) != renderPass) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("} else {"),i.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"),i.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"),i.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;"),i.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;"),i.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;"),i.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));"),i.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;"),i.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;"),i.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;"),i.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));"),i.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"),i.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));"),i.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));"),i.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));"),i.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"),i.push("if (color.a == 0u) {"),i.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"),i.push(" return;"),i.push("};"),i.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));"),i.push("vec3 position;"),i.push("position = positions[gl_VertexID % 3];"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (solid != 1u) {"),i.push("if (isPerspectiveMatrix(projMatrix)) {"),i.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;"),i.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("viewNormal = -viewNormal;"),i.push("}"),i.push("} else {"),i.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);"),i.push("if (viewNormal.z < 0.0) {"),i.push("position = positions[2 - (gl_VertexID % 3)];"),i.push("}"),i.push("}"),i.push("}"),i.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); "),i.push("vec4 viewPosition = viewMatrix * worldPosition; "),i.push("vec4 clipPos = projMatrix * viewPosition;"),e.logarithmicDepthBufferEnabled&&(i.push("vFragDepth = 1.0 + clipPos.w;"),i.push("isPerspective = float (isPerspectiveMatrix(projMatrix));")),i.push("vWorldPosition = worldPosition;"),t&&i.push("vFlags2 = flags2.r;"),i.push("gl_Position = remapClipPos(clipPos);"),i.push("}"),i.push("}"),i}},{key:"_buildFragmentShader",value:function(){var e=this._scene,t=e._sectionPlanesState.getNumAllocatedSectionPlanes()>0,i=[];if(i.push("#version 300 es"),i.push("// TrianglesDataTexturePickNormalsRenderer fragment shader"),i.push("#ifdef GL_FRAGMENT_PRECISION_HIGH"),i.push("precision highp float;"),i.push("precision highp int;"),i.push("#else"),i.push("precision mediump float;"),i.push("precision mediump int;"),i.push("#endif"),e.logarithmicDepthBufferEnabled&&(i.push("in float isPerspective;"),i.push("uniform float logDepthBufFC;"),i.push("in float vFragDepth;")),i.push("in vec4 vWorldPosition;"),t){i.push("flat in uint vFlags2;");for(var s=0,r=e._sectionPlanesState.getNumAllocatedSectionPlanes();s 0u;"),i.push(" if (clippable) {"),i.push(" float dist = 0.0;");for(var n=0,o=e._sectionPlanesState.getNumAllocatedSectionPlanes();n 0.0) { "),i.push(" discard;"),i.push(" }"),i.push("}")}return e.logarithmicDepthBufferEnabled&&i.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;"),i.push(" vec3 xTangent = dFdx( vWorldPosition.xyz );"),i.push(" vec3 yTangent = dFdy( vWorldPosition.xyz );"),i.push(" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );"),i.push(" outNormal = ivec4(worldNormal * float(".concat($.MAX_INT,"), 1.0);")),i.push("}"),i}},{key:"webglContextRestored",value:function(){this._program=null}},{key:"destroy",value:function(){this._program&&this._program.destroy(),this._program=null}}]),e}(),cc=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"_compile",value:function(){this._colorRenderer&&!this._colorRenderer.getValid()&&(this._colorRenderer.destroy(),this._colorRenderer=null),this._colorRendererWithSAO&&!this._colorRendererWithSAO.getValid()&&(this._colorRendererWithSAO.destroy(),this._colorRendererWithSAO=null),this._flatColorRenderer&&!this._flatColorRenderer.getValid()&&(this._flatColorRenderer.destroy(),this._flatColorRenderer=null),this._flatColorRendererWithSAO&&!this._flatColorRendererWithSAO.getValid()&&(this._flatColorRendererWithSAO.destroy(),this._flatColorRendererWithSAO=null),this._colorQualityRendererWithSAO&&!this._colorQualityRendererWithSAO.getValid()&&(this._colorQualityRendererWithSAO.destroy(),this._colorQualityRendererWithSAO=null),this._depthRenderer&&!this._depthRenderer.getValid()&&(this._depthRenderer.destroy(),this._depthRenderer=null),this._normalsRenderer&&!this._normalsRenderer.getValid()&&(this._normalsRenderer.destroy(),this._normalsRenderer=null),this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()&&(this._silhouetteRenderer.destroy(),this._silhouetteRenderer=null),this._edgesRenderer&&!this._edgesRenderer.getValid()&&(this._edgesRenderer.destroy(),this._edgesRenderer=null),this._edgesColorRenderer&&!this._edgesColorRenderer.getValid()&&(this._edgesColorRenderer.destroy(),this._edgesColorRenderer=null),this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()&&(this._pickMeshRenderer.destroy(),this._pickMeshRenderer=null),this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()&&(this._pickDepthRenderer.destroy(),this._pickDepthRenderer=null),this._snapRenderer&&!this._snapRenderer.getValid()&&(this._snapRenderer.destroy(),this._snapRenderer=null),this._snapInitRenderer&&!this._snapInitRenderer.getValid()&&(this._snapInitRenderer.destroy(),this._snapInitRenderer=null),this._pickNormalsRenderer&&!1===this._pickNormalsRenderer.getValid()&&(this._pickNormalsRenderer.destroy(),this._pickNormalsRenderer=null),this._pickNormalsFlatRenderer&&!1===this._pickNormalsFlatRenderer.getValid()&&(this._pickNormalsFlatRenderer.destroy(),this._pickNormalsFlatRenderer=null),this._occlusionRenderer&&!1===this._occlusionRenderer.getValid()&&(this._occlusionRenderer.destroy(),this._occlusionRenderer=null)}},{key:"eagerCreateRenders",value:function(){this._silhouetteRenderer||(this._silhouetteRenderer=new dA(this._scene)),this._pickMeshRenderer||(this._pickMeshRenderer=new MA(this._scene)),this._pickDepthRenderer||(this._pickDepthRenderer=new DA(this._scene)),this._pickNormalsRenderer||(this._pickNormalsRenderer=new Ac(this._scene)),this._snapRenderer||(this._snapRenderer=new OA(this._scene)),this._snapInitRenderer||(this._snapInitRenderer=new GA(this._scene)),this._snapRenderer||(this._snapRenderer=new OA(this._scene))}},{key:"colorRenderer",get:function(){return this._colorRenderer||(this._colorRenderer=new aA(this._scene,!1)),this._colorRenderer}},{key:"colorRendererWithSAO",get:function(){return this._colorRendererWithSAO||(this._colorRendererWithSAO=new aA(this._scene,!0)),this._colorRendererWithSAO}},{key:"colorQualityRendererWithSAO",get:function(){return this._colorQualityRendererWithSAO}},{key:"silhouetteRenderer",get:function(){return this._silhouetteRenderer||(this._silhouetteRenderer=new dA(this._scene)),this._silhouetteRenderer}},{key:"depthRenderer",get:function(){return this._depthRenderer||(this._depthRenderer=new ec(this._scene)),this._depthRenderer}},{key:"normalsRenderer",get:function(){return this._normalsRenderer||(this._normalsRenderer=new nc(this._scene)),this._normalsRenderer}},{key:"edgesRenderer",get:function(){return this._edgesRenderer||(this._edgesRenderer=new mA(this._scene)),this._edgesRenderer}},{key:"edgesColorRenderer",get:function(){return this._edgesColorRenderer||(this._edgesColorRenderer=new BA(this._scene)),this._edgesColorRenderer}},{key:"pickMeshRenderer",get:function(){return this._pickMeshRenderer||(this._pickMeshRenderer=new MA(this._scene)),this._pickMeshRenderer}},{key:"pickNormalsRenderer",get:function(){return this._pickNormalsRenderer||(this._pickNormalsRenderer=new Ac(this._scene)),this._pickNormalsRenderer}},{key:"pickNormalsFlatRenderer",get:function(){return this._pickNormalsFlatRenderer||(this._pickNormalsFlatRenderer=new Ac(this._scene)),this._pickNormalsFlatRenderer}},{key:"pickDepthRenderer",get:function(){return this._pickDepthRenderer||(this._pickDepthRenderer=new DA(this._scene)),this._pickDepthRenderer}},{key:"snapRenderer",get:function(){return this._snapRenderer||(this._snapRenderer=new OA(this._scene)),this._snapRenderer}},{key:"snapInitRenderer",get:function(){return this._snapInitRenderer||(this._snapInitRenderer=new GA(this._scene)),this._snapInitRenderer}},{key:"occlusionRenderer",get:function(){return this._occlusionRenderer||(this._occlusionRenderer=new JA(this._scene)),this._occlusionRenderer}},{key:"_destroy",value:function(){this._colorRenderer&&this._colorRenderer.destroy(),this._colorRendererWithSAO&&this._colorRendererWithSAO.destroy(),this._flatColorRenderer&&this._flatColorRenderer.destroy(),this._flatColorRendererWithSAO&&this._flatColorRendererWithSAO.destroy(),this._colorQualityRendererWithSAO&&this._colorQualityRendererWithSAO.destroy(),this._depthRenderer&&this._depthRenderer.destroy(),this._normalsRenderer&&this._normalsRenderer.destroy(),this._silhouetteRenderer&&this._silhouetteRenderer.destroy(),this._edgesRenderer&&this._edgesRenderer.destroy(),this._edgesColorRenderer&&this._edgesColorRenderer.destroy(),this._pickMeshRenderer&&this._pickMeshRenderer.destroy(),this._pickDepthRenderer&&this._pickDepthRenderer.destroy(),this._snapRenderer&&this._snapRenderer.destroy(),this._snapInitRenderer&&this._snapInitRenderer.destroy(),this._pickNormalsRenderer&&this._pickNormalsRenderer.destroy(),this._pickNormalsFlatRenderer&&this._pickNormalsFlatRenderer.destroy(),this._occlusionRenderer&&this._occlusionRenderer.destroy()}}]),e}(),hc={};var dc=C((function e(){x(this,e),this.positionsCompressed=[],this.lenPositionsCompressed=0,this.metallicRoughness=[],this.indices8Bits=[],this.lenIndices8Bits=0,this.indices16Bits=[],this.lenIndices16Bits=0,this.indices32Bits=[],this.lenIndices32Bits=0,this.edgeIndices8Bits=[],this.lenEdgeIndices8Bits=0,this.edgeIndices16Bits=[],this.lenEdgeIndices16Bits=0,this.edgeIndices32Bits=[],this.lenEdgeIndices32Bits=0,this.perObjectColors=[],this.perObjectPickColors=[],this.perObjectSolid=[],this.perObjectOffsets=[],this.perObjectPositionsDecodeMatrices=[],this.perObjectInstancePositioningMatrices=[],this.perObjectVertexBases=[],this.perObjectIndexBaseOffsets=[],this.perObjectEdgeIndexBaseOffsets=[],this.perTriangleNumberPortionId8Bits=[],this.perTriangleNumberPortionId16Bits=[],this.perTriangleNumberPortionId32Bits=[],this.perEdgeNumberPortionId8Bits=[],this.perEdgeNumberPortionId16Bits=[],this.perEdgeNumberPortionId32Bits=[]})),pc=function(){function e(){x(this,e),this.texturePerObjectColorsAndFlags=null,this.texturePerObjectOffsets=null,this.texturePerObjectInstanceMatrices=null,this.texturePerObjectPositionsDecodeMatrix=null,this.texturePerVertexIdCoordinates=null,this.texturePerPolygonIdPortionIds8Bits=null,this.texturePerPolygonIdPortionIds16Bits=null,this.texturePerPolygonIdPortionIds32Bits=null,this.texturePerEdgeIdPortionIds8Bits=null,this.texturePerEdgeIdPortionIds16Bits=null,this.texturePerEdgeIdPortionIds32Bits=null,this.texturePerPolygonIdIndices8Bits=null,this.texturePerPolygonIdIndices16Bits=null,this.texturePerPolygonIdIndices32Bits=null,this.texturePerPolygonIdEdgeIndices8Bits=null,this.texturePerPolygonIdEdgeIndices16Bits=null,this.texturePerPolygonIdEdgeIndices32Bits=null,this.textureModelMatrices=null}return C(e,[{key:"finalize",value:function(){this.indicesPerBitnessTextures={8:this.texturePerPolygonIdIndices8Bits,16:this.texturePerPolygonIdIndices16Bits,32:this.texturePerPolygonIdIndices32Bits},this.indicesPortionIdsPerBitnessTextures={8:this.texturePerPolygonIdPortionIds8Bits,16:this.texturePerPolygonIdPortionIds16Bits,32:this.texturePerPolygonIdPortionIds32Bits},this.edgeIndicesPerBitnessTextures={8:this.texturePerPolygonIdEdgeIndices8Bits,16:this.texturePerPolygonIdEdgeIndices16Bits,32:this.texturePerPolygonIdEdgeIndices32Bits},this.edgeIndicesPortionIdsPerBitnessTextures={8:this.texturePerEdgeIdPortionIds8Bits,16:this.texturePerEdgeIdPortionIds16Bits,32:this.texturePerEdgeIdPortionIds32Bits}}},{key:"bindCommonTextures",value:function(e,t,i,s,r){this.texturePerObjectPositionsDecodeMatrix.bindTexture(e,t,1),this.texturePerVertexIdCoordinates.bindTexture(e,i,2),this.texturePerObjectColorsAndFlags.bindTexture(e,s,3),this.texturePerObjectInstanceMatrices.bindTexture(e,r,4)}},{key:"bindTriangleIndicesTextures",value:function(e,t,i,s){this.indicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.indicesPerBitnessTextures[s].bindTexture(e,i,6)}},{key:"bindEdgeIndicesTextures",value:function(e,t,i,s){this.edgeIndicesPortionIdsPerBitnessTextures[s].bindTexture(e,t,5),this.edgeIndicesPerBitnessTextures[s].bindTexture(e,i,6)}}]),e}(),fc={sizeDataColorsAndFlags:0,sizeDataPositionDecodeMatrices:0,sizeDataTextureOffsets:0,sizeDataTexturePositions:0,sizeDataTextureIndices:0,sizeDataTextureEdgeIndices:0,sizeDataTexturePortionIds:0,numberOfGeometries:0,numberOfPortions:0,numberOfLayers:0,numberOfTextures:0,totalPolygons:0,totalPolygons8Bits:0,totalPolygons16Bits:0,totalPolygons32Bits:0,totalEdges:0,totalEdges8Bits:0,totalEdges16Bits:0,totalEdges32Bits:0,cannotCreatePortion:{because10BitsObjectId:0,becauseTextureSize:0},overheadSizeAlignementIndices:0,overheadSizeAlignementEdgeIndices:0};window.printDataTextureRamStats=function(){console.log(JSON.stringify(fc,null,4));var e=0;Object.keys(fc).forEach((function(t){t.startsWith("size")&&(e+=fc[t])})),console.log("Total size ".concat(e," bytes (").concat((e/1e3/1e3).toFixed(2)," MB)")),console.log("Avg bytes / triangle: ".concat((e/fc.totalPolygons).toFixed(2)));var t={};Object.keys(fc).forEach((function(i){i.startsWith("size")&&(t[i]="".concat((fc[i]/e*100).toFixed(2)," % of total"))})),console.log(JSON.stringify({percentualRamUsage:t},null,4))};var vc=function(){function e(){x(this,e)}return C(e,[{key:"disableBindedTextureFiltering",value:function(e){e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}},{key:"createTextureForColorsAndFlags",value:function(e,t,i,s,r,n,o){var a=t.length;this.numPortions=a;var l=4096,u=Math.ceil(a/512);if(0===u)throw"texture height===0";var A=new Uint8Array(16384*u);fc.sizeDataColorsAndFlags+=A.byteLength,fc.numberOfTextures++;for(var c=0;c>24&255,s[c]>>16&255,s[c]>>8&255,255&s[c]],32*c+16),A.set([r[c]>>24&255,r[c]>>16&255,r[c]>>8&255,255&r[c]],32*c+20),A.set([n[c]>>24&255,n[c]>>16&255,n[c]>>8&255,255&n[c]],32*c+24),A.set([o[c]?1:0,0,0,0],32*c+28);var h=e.createTexture();return e.bindTexture(e.TEXTURE_2D,h),e.texStorage2D(e.TEXTURE_2D,1,e.RGBA8UI,l,u),e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,u,e.RGBA_INTEGER,e.UNSIGNED_BYTE,A,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,h,l,u,A)}},{key:"createTextureForObjectOffsets",value:function(e,t){var i=512,s=Math.ceil(t/i);if(0===s)throw"texture height===0";var r=new Float32Array(1536*s).fill(0);fc.sizeDataTextureOffsets+=r.byteLength,fc.numberOfTextures++;var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texStorage2D(e.TEXTURE_2D,1,e.RGB32F,i,s),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i,s,e.RGB,e.FLOAT,r,0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),new zu(e,n,i,s,r)}},{key:"createTextureForInstancingMatrices",value:function(e,t){var i=t.length;if(0===i)throw"num instance matrices===0";var s=2048,r=Math.ceil(i/512),n=new Float32Array(8192*r);fc.numberOfTextures++;for(var o=0;o65536&&fc.cannotCreatePortion.because10BitsObjectId++;var i=this._numPortions+t<=65536,s=void 0!==e.geometryId&&null!==e.geometryId?"".concat(e.geometryId,"#").concat(0):"".concat(e.id,"#").concat(0);if(!this._bucketGeometries[s]){var r=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits),n=0,o=0;e.buckets.forEach((function(e){n+=e.positionsCompressed.length/3,o+=e.indices.length/3})),(this._state.numVertices+n>4096*mc||r+o>4096*mc)&&fc.cannotCreatePortion.becauseTextureSize++,i&&(i=this._state.numVertices+n<=4096*mc&&r+o<=4096*mc)}return i}},{key:"createPortion",value:function(e,t){var i=this;if(this._finalized)throw"Already finalized";var s=[];t.buckets.forEach((function(e,r){var n=void 0!==t.geometryId&&null!==t.geometryId?"".concat(t.geometryId,"#").concat(r):"".concat(t.id,"#").concat(r),o=i._bucketGeometries[n];o||(o=i._createBucketGeometry(t,e),i._bucketGeometries[n]=o);var a=i._createSubPortion(t,o,e);s.push(a)}));var r=this._portionToSubPortionsMap.length;return this._portionToSubPortionsMap.push(s),this.model.numPortions++,this._meshes.push(e),r}},{key:"_createBucketGeometry",value:function(e,t){if(t.indices){var i=8*Math.ceil(t.indices.length/3/8)*3;fc.overheadSizeAlignementIndices+=2*(i-t.indices.length);var s=new Uint32Array(i);s.fill(0),s.set(t.indices),t.indices=s}if(t.edgeIndices){var r=8*Math.ceil(t.edgeIndices.length/2/8)*2;fc.overheadSizeAlignementEdgeIndices+=2*(r-t.edgeIndices.length);var n=new Uint32Array(r);n.fill(0),n.set(t.edgeIndices),t.edgeIndices=n}var o=t.positionsCompressed,a=t.indices,l=t.edgeIndices,u=this._buffer;u.positionsCompressed.push(o);var A,c=u.lenPositionsCompressed/3,h=o.length/3;u.lenPositionsCompressed+=o.length;var d,p,f=0;a&&(f=a.length/3,h<=256?(d=u.indices8Bits,A=u.lenIndices8Bits/3,u.lenIndices8Bits+=a.length):h<=65536?(d=u.indices16Bits,A=u.lenIndices16Bits/3,u.lenIndices16Bits+=a.length):(d=u.indices32Bits,A=u.lenIndices32Bits/3,u.lenIndices32Bits+=a.length),d.push(a));var v,g=0;l&&(g=l.length/2,h<=256?(v=u.edgeIndices8Bits,p=u.lenEdgeIndices8Bits/2,u.lenEdgeIndices8Bits+=l.length):h<=65536?(v=u.edgeIndices16Bits,p=u.lenEdgeIndices16Bits/2,u.lenEdgeIndices16Bits+=l.length):(v=u.edgeIndices32Bits,p=u.lenEdgeIndices32Bits/2,u.lenEdgeIndices32Bits+=l.length),v.push(l));return this._state.numVertices+=h,fc.numberOfGeometries++,{vertexBase:c,numVertices:h,numTriangles:f,numEdges:g,indicesBase:A,edgeIndicesBase:p}}},{key:"_createSubPortion",value:function(e,t,i,s){var r=e.color;e.metallic,e.roughness;var n,o,a=e.colors,l=e.opacity,u=e.meshMatrix,A=e.pickColor,c=this._buffer,h=this._state;c.perObjectPositionsDecodeMatrices.push(e.positionsDecodeMatrix),c.perObjectInstancePositioningMatrices.push(u||wc),c.perObjectSolid.push(!!e.solid),a?c.perObjectColors.push([255*a[0],255*a[1],255*a[2],255]):r&&c.perObjectColors.push([r[0],r[1],r[2],l]),c.perObjectPickColors.push(A),c.perObjectVertexBases.push(t.vertexBase),n=t.numVertices<=256?h.numIndices8Bits:t.numVertices<=65536?h.numIndices16Bits:h.numIndices32Bits,c.perObjectIndexBaseOffsets.push(n/3-t.indicesBase),o=t.numVertices<=256?h.numEdgeIndices8Bits:t.numVertices<=65536?h.numEdgeIndices16Bits:h.numEdgeIndices32Bits,c.perObjectEdgeIndexBaseOffsets.push(o/2-t.edgeIndicesBase);var d=this._subPortions.length;if(t.numTriangles>0){var p,f=3*t.numTriangles;t.numVertices<=256?(p=c.perTriangleNumberPortionId8Bits,h.numIndices8Bits+=f,fc.totalPolygons8Bits+=t.numTriangles):t.numVertices<=65536?(p=c.perTriangleNumberPortionId16Bits,h.numIndices16Bits+=f,fc.totalPolygons16Bits+=t.numTriangles):(p=c.perTriangleNumberPortionId32Bits,h.numIndices32Bits+=f,fc.totalPolygons32Bits+=t.numTriangles),fc.totalPolygons+=t.numTriangles;for(var v=0;v0){var g,m=2*t.numEdges;t.numVertices<=256?(g=c.perEdgeNumberPortionId8Bits,h.numEdgeIndices8Bits+=m,fc.totalEdges8Bits+=t.numEdges):t.numVertices<=65536?(g=c.perEdgeNumberPortionId16Bits,h.numEdgeIndices16Bits+=m,fc.totalEdges16Bits+=t.numEdges):(g=c.perEdgeNumberPortionId32Bits,h.numEdgeIndices32Bits+=m,fc.totalEdges32Bits+=t.numEdges),fc.totalEdges+=t.numEdges;for(var _=0;_0&&(i.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId8Bits)),r.perEdgeNumberPortionId16Bits.length>0&&(i.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId16Bits)),r.perEdgeNumberPortionId32Bits.length>0&&(i.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(s,r.perEdgeNumberPortionId32Bits)),r.lenIndices8Bits>0&&(i.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(s,r.indices8Bits,r.lenIndices8Bits)),r.lenIndices16Bits>0&&(i.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(s,r.indices16Bits,r.lenIndices16Bits)),r.lenIndices32Bits>0&&(i.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(s,r.indices32Bits,r.lenIndices32Bits)),r.lenEdgeIndices8Bits>0&&(i.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(s,r.edgeIndices8Bits,r.lenEdgeIndices8Bits)),r.lenEdgeIndices16Bits>0&&(i.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(s,r.edgeIndices16Bits,r.lenEdgeIndices16Bits)),r.lenEdgeIndices32Bits>0&&(i.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(s,r.edgeIndices32Bits,r.lenEdgeIndices32Bits)),i.finalize(),this._buffer=null,this._bucketGeometries={},this._finalized=!0,this._deferredSetFlagsDirty=!1,this._onSceneRendering=this.model.scene.on("rendering",(function(){e._deferredSetFlagsDirty&&e._uploadDeferredFlags(),e._numUpdatesInFrame=0}))}}},{key:"isEmpty",value:function(){return 0===this._numPortions}},{key:"initFlags",value:function(e,t,i){t&Qe&&(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++),t&We&&(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++),t&ze&&(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++),t&Ke&&(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++),t&je&&(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++),t&Xe&&(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++),t&He&&(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++),t&Ve&&(this._numCulledLayerPortions++,this.model.numCulledLayerPortions++),i&&(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++);this._setFlags(e,t,i,true),this._setFlags2(e,t,true)}},{key:"flushInitFlags",value:function(){this._setDeferredFlags(),this._setDeferredFlags2()}},{key:"setVisible",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Qe?(this._numVisibleLayerPortions++,this.model.numVisibleLayerPortions++):(this._numVisibleLayerPortions--,this.model.numVisibleLayerPortions--),this._setFlags(e,t,i)}},{key:"setHighlighted",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&We?(this._numHighlightedLayerPortions++,this.model.numHighlightedLayerPortions++):(this._numHighlightedLayerPortions--,this.model.numHighlightedLayerPortions--),this._setFlags(e,t,i)}},{key:"setXRayed",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&ze?(this._numXRayedLayerPortions++,this.model.numXRayedLayerPortions++):(this._numXRayedLayerPortions--,this.model.numXRayedLayerPortions--),this._setFlags(e,t,i)}},{key:"setSelected",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ke?(this._numSelectedLayerPortions++,this.model.numSelectedLayerPortions++):(this._numSelectedLayerPortions--,this.model.numSelectedLayerPortions--),this._setFlags(e,t,i)}},{key:"setEdges",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Xe?(this._numEdgesLayerPortions++,this.model.numEdgesLayerPortions++):(this._numEdgesLayerPortions--,this.model.numEdgesLayerPortions--),this._setFlags(e,t,i)}},{key:"setClippable",value:function(e,t){if(!this._finalized)throw"Not finalized";t&je?(this._numClippableLayerPortions++,this.model.numClippableLayerPortions++):(this._numClippableLayerPortions--,this.model.numClippableLayerPortions--),this._setFlags2(e,t)}},{key:"_beginDeferredFlags",value:function(){this._deferredSetFlagsActive=!0}},{key:"_uploadDeferredFlags",value:function(){if(this._deferredSetFlagsActive=!1,this._deferredSetFlagsDirty){this._deferredSetFlagsDirty=!1;var e=this.model.scene.canvas.gl,t=this._dtxState;e.bindTexture(e.TEXTURE_2D,t.texturePerObjectColorsAndFlags._texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.texturePerObjectColorsAndFlags._textureWidth,t.texturePerObjectColorsAndFlags._textureHeight,e.RGBA_INTEGER,e.UNSIGNED_BYTE,t.texturePerObjectColorsAndFlags._textureData)}}},{key:"setCulled",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&Ve?(this._numCulledLayerPortions+=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions++):(this._numCulledLayerPortions-=this._portionToSubPortionsMap[e].length,this.model.numCulledLayerPortions--),this._setFlags(e,t,i)}},{key:"setCollidable",value:function(e,t){if(!this._finalized)throw"Not finalized"}},{key:"setPickable",value:function(e,t,i){if(!this._finalized)throw"Not finalized";t&He?(this._numPickableLayerPortions++,this.model.numPickableLayerPortions++):(this._numPickableLayerPortions--,this.model.numPickableLayerPortions--),this._setFlags(e,t,i)}},{key:"setColor",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),console.info("_subPortionSetColor write through"),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectColorsAndFlags._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*8,Math.floor(e/512),1,1,s.RGBA_INTEGER,s.UNSIGNED_BYTE,yc)}},{key:"setTransparent",value:function(e,t,i){i?(this._numTransparentLayerPortions++,this.model.numTransparentLayerPortions++):(this._numTransparentLayerPortions--,this.model.numTransparentLayerPortions--),this._setFlags(e,t,i)}},{key:"_setFlags",value:function(e,t,i){for(var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this._portionToSubPortionsMap[e],n=0,o=r.length;n3&&void 0!==arguments[3]&&arguments[3];if(!this._finalized)throw"Not finalized";var r,n,o=!!(t&Qe),a=!!(t&ze),l=!!(t&We),u=!!(t&Ke),A=!!(t&Xe),c=!!(t&He),h=!!(t&Ve);r=!o||h||a||l&&!this.model.scene.highlightMaterial.glowThrough||u&&!this.model.scene.selectedMaterial.glowThrough?oo.NOT_RENDERED:i?oo.COLOR_TRANSPARENT:oo.COLOR_OPAQUE,n=!o||h?oo.NOT_RENDERED:u?oo.SILHOUETTE_SELECTED:l?oo.SILHOUETTE_HIGHLIGHTED:a?oo.SILHOUETTE_XRAYED:oo.NOT_RENDERED;var d=0;d=!o||h?oo.NOT_RENDERED:u?oo.EDGES_SELECTED:l?oo.EDGES_HIGHLIGHTED:a?oo.EDGES_XRAYED:A?i?oo.EDGES_COLOR_TRANSPARENT:oo.EDGES_COLOR_OPAQUE:oo.NOT_RENDERED;var p=o&&!h&&c?oo.PICK:oo.NOT_RENDERED,f=this._dtxState,v=this.model.scene.canvas.gl;yc[0]=r,yc[1]=n,yc[2]=d,yc[3]=p,f.texturePerObjectColorsAndFlags._textureData.set(yc,32*e+8),this._deferredSetFlagsActive||s?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),v.bindTexture(v.TEXTURE_2D,f.texturePerObjectColorsAndFlags._texture),v.texSubImage2D(v.TEXTURE_2D,0,e%512*8+2,Math.floor(e/512),1,1,v.RGBA_INTEGER,v.UNSIGNED_BYTE,yc))}},{key:"_setDeferredFlags",value:function(){}},{key:"_setFlags2",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=this._portionToSubPortionsMap[e],r=0,n=s.length;r2&&void 0!==arguments[2]&&arguments[2];if(!this._finalized)throw"Not finalized";var s=t&je?255:0,r=this._dtxState,n=this.model.scene.canvas.gl;yc[0]=s,yc[1]=0,yc[2]=1,yc[3]=2,r.texturePerObjectColorsAndFlags._textureData.set(yc,32*e+12),this._deferredSetFlagsActive||i?this._deferredSetFlagsDirty=!0:(++this._numUpdatesInFrame>=10&&this._beginDeferredFlags(),n.bindTexture(n.TEXTURE_2D,r.texturePerObjectColorsAndFlags._texture),n.texSubImage2D(n.TEXTURE_2D,0,e%512*8+3,Math.floor(e/512),1,1,n.RGBA_INTEGER,n.UNSIGNED_BYTE,yc))}},{key:"_setDeferredFlags2",value:function(){}},{key:"setOffset",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectOffsets._texture),s.texSubImage2D(s.TEXTURE_2D,0,0,e,1,1,s.RGB,s.FLOAT,bc))}},{key:"setMatrix",value:function(e,t){for(var i=this._portionToSubPortionsMap[e],s=0,r=i.length;s=10&&this._beginDeferredFlags(),s.bindTexture(s.TEXTURE_2D,i.texturePerObjectInstanceMatrices._texture),s.texSubImage2D(s.TEXTURE_2D,0,e%512*4,Math.floor(e/512),4,1,s.RGBA,s.FLOAT,_c))}},{key:"drawColorOpaque",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),t.withSAO&&this.model.saoEnabled?this._renderers.colorRendererWithSAO&&this._renderers.colorRendererWithSAO.drawLayer(t,this,oo.COLOR_OPAQUE):this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"_updateBackfaceCull",value:function(e,t){var i=this.model.backfaces||e.sectioned;if(t.backfaces!==i){var s=t.gl;i?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),t.backfaces=i}}},{key:"drawColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numTransparentLayerPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.colorRenderer&&this._renderers.colorRenderer.drawLayer(t,this,oo.COLOR_TRANSPARENT))}},{key:"drawDepth",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.depthRenderer&&this._renderers.depthRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawNormals",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&this._numTransparentLayerPortions!==this._numPortions&&this._numXRayedLayerPortions!==this._numPortions&&(this._updateBackfaceCull(e,t),this._renderers.normalsRenderer&&this._renderers.normalsRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawSilhouetteXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_XRAYED))}},{key:"drawSilhouetteHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_HIGHLIGHTED))}},{key:"drawSilhouetteSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.silhouetteRenderer&&this._renderers.silhouetteRenderer.drawLayer(t,this,oo.SILHOUETTE_SELECTED))}},{key:"drawEdgesColorOpaque",value:function(e,t){this.model.scene.logarithmicDepthBufferEnabled?this.model.scene._loggedWarning||(console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer"),this.model.scene._loggedWarning=!0):this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,oo.EDGES_COLOR_OPAQUE)}},{key:"drawEdgesColorTransparent",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numEdgesLayerPortions&&0!==this._numTransparentLayerPortions&&this._renderers.edgesColorRenderer&&this._renderers.edgesColorRenderer.drawLayer(t,this,oo.EDGES_COLOR_TRANSPARENT)}},{key:"drawEdgesHighlighted",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numHighlightedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_HIGHLIGHTED)}},{key:"drawEdgesSelected",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numSelectedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_SELECTED)}},{key:"drawEdgesXRayed",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&0!==this._numXRayedLayerPortions&&this._renderers.edgesRenderer&&this._renderers.edgesRenderer.drawLayer(t,this,oo.EDGES_XRAYED)}},{key:"drawOcclusion",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.occlusionRenderer&&this._renderers.occlusionRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"drawShadow",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.shadowRenderer&&this._renderers.shadowRenderer.drawLayer(t,this,oo.COLOR_OPAQUE))}},{key:"setPickMatrices",value:function(e,t){}},{key:"drawPickMesh",value:function(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickMeshRenderer&&this._renderers.pickMeshRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawPickDepths",value:function(e,t){0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickDepthRenderer&&this._renderers.pickDepthRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawSnapInit",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapInitRenderer&&this._renderers.snapInitRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawSnap",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.snapRenderer&&this._renderers.snapRenderer.drawLayer(t,this,oo.PICK))}},{key:"drawPickNormals",value:function(e,t){this._numCulledLayerPortions!==this._numPortions&&0!==this._numVisibleLayerPortions&&(this._updateBackfaceCull(e,t),this._renderers.pickNormalsRenderer&&this._renderers.pickNormalsRenderer.drawLayer(t,this,oo.PICK))}},{key:"destroy",value:function(){if(!this._destroyed){var e=this._state;e.metallicRoughnessBuf&&(e.metallicRoughnessBuf.destroy(),e.metallicRoughnessBuf=null),this.model.scene.off(this._onSceneRendering),e.destroy(),this._destroyed=!0}}}]),e}(),Pc=function(){function e(t){x(this,e),this.id=t.id,this.colorTexture=t.colorTexture,this.metallicRoughnessTexture=t.metallicRoughnessTexture,this.normalsTexture=t.normalsTexture,this.emissiveTexture=t.emissiveTexture,this.occlusionTexture=t.occlusionTexture}return C(e,[{key:"destroy",value:function(){}}]),e}(),Cc=function(){function e(t){x(this,e),this.id=t.id,this.texture=t.texture}return C(e,[{key:"destroy",value:function(){this.texture&&(this.texture.destroy(),this.texture=null)}}]),e}(),Mc={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Fc=function(){function e(t,i,s){x(this,e),this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=s}return C(e,[{key:"itemStart",value:function(e){this.itemsTotal++,!1===this.isLoading&&void 0!==this.onStart&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}},{key:"itemEnd",value:function(e){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}},{key:"itemError",value:function(e){void 0!==this.onError&&this.onError(e)}},{key:"resolveURL",value:function(e){return this.urlModifier?this.urlModifier(e):e}},{key:"setURLModifier",value:function(e){return this.urlModifier=e,this}},{key:"addHandler",value:function(e,t){return this.handlers.push(e,t),this}},{key:"removeHandler",value:function(e){var t=this.handlers.indexOf(e);return-1!==t&&this.handlers.splice(t,2),this}},{key:"getHandler",value:function(e){for(var t=0,i=this.handlers.length;t0&&void 0!==arguments[0]?arguments[0]:4;x(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return C(e,[{key:"_initWorker",value:function(e){if(!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}},{key:"_getIdleWorker",value:function(){for(var e=0;e0&&console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues. Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances."),Tc++}return this._transcoderPending}},{key:"transcode",value:function(e,t){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(r,n){var o=s;i._init().then((function(){return i._workerPool.postMessage({type:"transcode",buffers:e,taskConfig:o},e)})).then((function(e){var i=e.data,s=i.mipmaps,o=(i.width,i.height,i.format),a=i.type,l=i.error,u=i.dfdTransferFn,A=i.dfdFlags;if("error"===a)return n(l);t.setCompressedData({mipmaps:s,props:{format:o,minFilter:1===s.length?1006:1008,magFilter:1===s.length?1006:1008,encoding:2===u?3001:3e3,premultiplyAlpha:!!(1&A)}}),r()}))}))}},{key:"destroy",value:function(){URL.revokeObjectURL(this._workerSourceURL),this._workerPool.destroy(),Tc--}}]),e}();Rc.BasisFormat={ETC1S:0,UASTC_4x4:1},Rc.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Rc.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},Rc.BasisWorker=function(){var e,t,i,s=_EngineFormat,r=_TranscoderFormat,n=_BasisFormat;self.addEventListener("message",(function(o){var A,c=o.data;switch(c.type){case"init":e=c.config,A=c.transcoderBinary,t=new Promise((function(e){i={wasmBinary:A,onRuntimeInitialized:e},BASIS(i)})).then((function(){i.initializeBasis(),void 0===i.KTX2File&&console.warn("KTX2TextureTranscoder: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((function(){try{for(var t=function(t){var o=new i.KTX2File(new Uint8Array(t));function A(){o.close(),o.delete()}if(!o.isValid())throw A(),new Error("KTX2TextureTranscoder: Invalid or unsupported .ktx2 file");var c=o.isUASTC()?n.UASTC_4x4:n.ETC1S,h=o.getWidth(),d=o.getHeight(),p=o.getLevels(),f=o.getHasAlpha(),v=o.getDFDTransferFunc(),g=o.getDFDFlags(),m=function(t,i,o,A){for(var c,h,d=t===n.ETC1S?a:l,p=0;p>t;i.sort(jc);for(var a=new Int32Array(e.length),l=0,u=i.length;le[r+1]){var o=e[r];e[r]=e[r+1],e[r+1]=o}zc=new Int32Array(e),t.sort(Wc);for(var a=new Int32Array(e.length),l=0,u=t.length;l0)for(var s=i._meshes,r=0,n=s.length;r0)for(var o=this._meshes,a=0,l=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._dtxEnabled=s.scene.dtxEnabled&&!1!==r.dtxEnabled,s._enableVertexWelding=!1,s._enableIndexBucketing=!1,s._vboBatchingLayerScratchMemory=no(),s._textureTranscoder=r.textureTranscoder||Uc(s.scene.viewer),s._maxGeometryBatchSize=r.maxGeometryBatchSize,s._aabb=$.collapseAABB3(),s._aabbDirty=!0,s._quantizationRanges={},s._vboInstancingLayers={},s._vboBatchingLayers={},s._dtxLayers={},s._meshList=[],s.layerList=[],s._entityList=[],s._geometries={},s._dtxBuckets={},s._textures={},s._textureSets={},s._transforms={},s._meshes={},s._unusedMeshes={},s._entities={},s.renderFlags=new Wr,s.numGeometries=0,s.numPortions=0,s.numVisibleLayerPortions=0,s.numTransparentLayerPortions=0,s.numXRayedLayerPortions=0,s.numHighlightedLayerPortions=0,s.numSelectedLayerPortions=0,s.numEdgesLayerPortions=0,s.numPickableLayerPortions=0,s.numClippableLayerPortions=0,s.numCulledLayerPortions=0,s.numEntities=0,s._numTriangles=0,s._numLines=0,s._numPoints=0,s._edgeThreshold=r.edgeThreshold||10,s._origin=$.vec3(r.origin||[0,0,0]),s._position=$.vec3(r.position||[0,0,0]),s._rotation=$.vec3(r.rotation||[0,0,0]),s._quaternion=$.vec4(r.quaternion||[0,0,0,1]),s._conjugateQuaternion=$.vec4(r.quaternion||[0,0,0,1]),r.rotation&&$.eulerToQuaternion(s._rotation,"XYZ",s._quaternion),s._scale=$.vec3(r.scale||[1,1,1]),s._worldRotationMatrix=$.mat4(),s._worldRotationMatrixConjugate=$.mat4(),s._matrix=$.mat4(),s._matrixDirty=!0,s._rebuildMatrices(),s._worldNormalMatrix=$.mat4(),$.inverseMat4(s._matrix,s._worldNormalMatrix),$.transposeMat4(s._worldNormalMatrix),(r.matrix||r.position||r.rotation||r.scale||r.quaternion)&&(s._viewMatrix=$.mat4(),s._viewNormalMatrix=$.mat4(),s._viewMatrixDirty=!0,s._matrixNonIdentity=!0),s._opacity=1,s._colorize=[1,1,1],s._saoEnabled=!1!==r.saoEnabled,s._pbrEnabled=!1!==r.pbrEnabled,s._colorTextureEnabled=!1!==r.colorTextureEnabled,s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s._onCameraViewMatrix=s.scene.camera.on("matrix",(function(){s._viewMatrixDirty=!0})),s._meshesWithDirtyMatrices=[],s._numMeshesWithDirtyMatrices=0,s._onTick=s.scene.on("tick",(function(){for(;s._numMeshesWithDirtyMatrices>0;)s._meshesWithDirtyMatrices[--s._numMeshesWithDirtyMatrices]._updateMatrix()})),s._createDefaultTextureSet(),s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.colorize=r.colorize,s.opacity=r.opacity,s.backfaces=r.backfaces,s}return C(i,[{key:"_meshMatrixDirty",value:function(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}},{key:"_createDefaultTextureSet",value:function(){var e=new Cc({id:"defaultColorTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new Cc({id:"defaultMetalRoughTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new Cc({id:"defaultNormalsTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new Cc({id:"defaultEmissiveTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new Cc({id:"defaultOcclusionTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new Pc({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}},{key:"isPerformanceModel",get:function(){return!0}},{key:"transforms",get:function(){return this._transforms}},{key:"textures",get:function(){return this._textures}},{key:"textureSets",get:function(){return this._textureSets}},{key:"meshes",get:function(){return this._meshes}},{key:"objects",get:function(){return this._entities}},{key:"origin",get:function(){return this._origin}},{key:"position",get:function(){return this._position},set:function(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"rotation",get:function(){return this._rotation},set:function(e){this._rotation.set(e||[0,0,0]),$.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"quaternion",get:function(){return this._quaternion},set:function(e){this._quaternion.set(e||[0,0,0,1]),$.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"scale",get:function(){return this._scale},set:function(e){}},{key:"matrix",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix},set:function(e){this._matrix.set(e||uh),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),$.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),$.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"rotationMatrix",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}},{key:"_rebuildMatrices",value:function(){this._matrixDirty&&($.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),$.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),$.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}},{key:"rotationMatrixConjugate",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}},{key:"_setWorldMatrixDirty",value:function(){this._matrixDirty=!0,this._aabbDirty=!0}},{key:"_transformDirty",value:function(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}},{key:"_sceneModelDirty",value:function(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(var e=0,t=this._entityList.length;e0},set:function(e){e=!1!==e,this._visible=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._xrayed=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._highlighted=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._selected=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._edges=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!1!==e,this._pickable=e;for(var t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){for(var l=e.colors,u=new Uint8Array(l.length),A=0,c=l.length;A>24&255,r=i>>16&255,n=i>>8&255,o=255&i;switch(e.pickColor=new Uint8Array([o,n,r,s]),e.solid="solid"===e.primitive,t.origin=$.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}},{key:"_getNumPrimitives",value:function(e){var t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(var i=0,s=e.buckets.length;i>>0).toString(16)}},{key:"_getVBOInstancingLayer",value:function(e){var t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,n="".concat(Math.round(i[0]),".").concat(Math.round(i[1]),".").concat(Math.round(i[2]),".").concat(s,".").concat(r),o=this._vboInstancingLayers[n];if(o)return o;for(var a=e.textureSet,l=e.geometry;!o;)switch(l.primitive){case"triangles":case"surface":o=new rl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":o=new rl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":o=new jl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":o=new Lu({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[n]=o,this.layerList.push(o),o}},{key:"createEntity",value:function(e){if(void 0===e.id?e.id=$.createUUID():this.scene.components[e.id]&&(this.error("Scene already has a Component with this ID: ".concat(e.id," - will assign random ID")),e.id=$.createUUID()),void 0!==e.meshIds){var t=0;this._visible&&!1!==e.visible&&(t|=Qe),this._pickable&&!1!==e.pickable&&(t|=He),this._culled&&!1!==e.culled&&(t|=Ve),this._clippable&&!1!==e.clippable&&(t|=je),this._collidable&&!1!==e.collidable&&(t|=Ge),this._edges&&!1!==e.edges&&(t|=Xe),this._xrayed&&!1!==e.xrayed&&(t|=ze),this._highlighted&&!1!==e.highlighted&&(t|=We),this._selected&&!1!==e.selected&&(t|=Ke),e.flags=t,this._createEntity(e)}else this.error("Config missing: meshIds")}},{key:"_createEntity",value:function(e){for(var t=[],i=0,s=e.meshIds.length;it.sortId?1:0}));for(var o=0,a=this.layerList.length;o0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}},{key:"_updateRenderFlagsVisibleLayers",value:function(){var e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(var t=0,i=this.layerList.length;t0){var t="".concat(this.id,"-dummyEntityForUnusedMeshes");this.warn('Creating dummy SceneModelEntity "'.concat(t,'" for unused SceneMeshes: [').concat(e.join(","),"]")),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}},{key:"_getActiveSectionPlanesForLayer",value:function(e){var t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(var n=0;n0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){var t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0)this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0));if(this.numSelectedLayerPortions>0){var i=this.scene.selectedMaterial._state;i.fill&&(i.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),i.edges&&(i.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){var s=this.scene.highlightMaterial._state;s.fill&&(s.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),s.edges&&(s.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}}},{key:"drawColorOpaque",value:function(e){for(var t=this.renderFlags,i=0,s=t.visibleLayers.length;i2&&void 0!==arguments[2]&&arguments[2],s=e.positionsCompressed||[],r=Gc(e.indices||[],t),n=Kc(e.edgeIndices||[]);function o(e,t){if(e>t){var i=e;e=t,t=i}function s(i,s){return i!==e?e-i:s!==t?t-s:0}for(var r=0,o=(n.length>>1)-1;r<=o;){var a=o+r>>1,l=s(n[2*a],n[2*a+1]);if(l>0)r=a+1;else{if(!(l<0))return a;o=a-1}}return-r-1}var a=new Int32Array(n.length/2);a.fill(0);var l=s.length/3;if(l>8*(1<h.maxNumPositions&&(h=c()),h.bucketNumber>8)return[e];-1===u[v]&&(u[v]=h.numPositions++,h.positionsCompressed.push(s[3*v]),h.positionsCompressed.push(s[3*v+1]),h.positionsCompressed.push(s[3*v+2])),-1===u[g]&&(u[g]=h.numPositions++,h.positionsCompressed.push(s[3*g]),h.positionsCompressed.push(s[3*g+1]),h.positionsCompressed.push(s[3*g+2])),-1===u[m]&&(u[m]=h.numPositions++,h.positionsCompressed.push(s[3*m]),h.positionsCompressed.push(s[3*m+1]),h.positionsCompressed.push(s[3*m+2])),h.indices.push(u[v]),h.indices.push(u[g]),h.indices.push(u[m]);var _=void 0;(_=o(v,g))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]])),(_=o(v,m))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]])),(_=o(g,m))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]]))}var y=t/8*2,b=t/8,B=2*s.length+(r.length+n.length)*y,w=0;return s.length,A.forEach((function(e){w+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*b,e.positionsCompressed.length})),w>B?[e]:(i&&Xc(A,e),A)}({positionsCompressed:s,indices:r,edgeIndices:n},s.length/3>65536?16:8):o=[{positionsCompressed:s,indices:r,edgeIndices:n}];return o}var dh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e,r))._positions=r.positions||[],r.indices)s._indices=r.indices;else{s._indices=[];for(var n=0,o=s._positions.length/3-1;n1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"BCFViewpoints",e,r)).originatingSystem=r.originatingSystem||"xeokit.io",s.authoringTool=r.authoringTool||"xeokit.io",s}return C(i,[{key:"getViewpoint",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.viewer.scene,s=i.camera,r=i.realWorldOffset,n=!0===t.reverseClippingPlanes,o={},a=$.normalizeVec3($.subVec3(s.look,s.eye,$.vec3())),l=s.eye,u=s.up;s.yUp&&(a=bh(a),l=bh(l),u=bh(u));var A=_h($.addVec3(l,r));"ortho"===s.projection?o.orthogonal_camera={camera_view_point:A,camera_direction:_h(a),camera_up_vector:_h(u),view_to_world_scale:s.ortho.scale}:o.perspective_camera={camera_view_point:A,camera_direction:_h(a),camera_up_vector:_h(u),field_of_view:s.perspective.fov};var c=i.sectionPlanes;for(var d in c)if(c.hasOwnProperty(d)){var p=c[d];if(!p.active)continue;var f=p.pos,v=void 0;v=n?$.negateVec3(p.dir,$.vec3()):p.dir,s.yUp&&(f=bh(f),v=bh(v)),$.addVec3(f,r),f=_h(f),v=_h(v),o.clipping_planes||(o.clipping_planes=[]),o.clipping_planes.push({location:f,direction:v})}var g=i.lineSets;for(var m in g)if(g.hasOwnProperty(m)){var _=g[m];o.lines||(o.lines=[]);for(var y=_.positions,b=_.indices,B=0,w=b.length/2;B1&&void 0!==arguments[1]?arguments[1]:{};if(e){var s=this.viewer,r=s.scene,n=r.camera,o=!1!==i.rayCast,a=!1!==i.immediate,l=!1!==i.reset,u=r.realWorldOffset,A=!0===i.reverseClippingPlanes;if(r.clearSectionPlanes(),e.clipping_planes&&e.clipping_planes.length>0&&e.clipping_planes.forEach((function(e){var t=yh(e.location,ph),i=yh(e.direction,ph);A&&$.negateVec3(i),$.subVec3(t,u),n.yUp&&(t=Bh(t),i=Bh(i)),new cn(r,{pos:t,dir:i})})),r.clearLines(),e.lines&&e.lines.length>0){var c=[],h=[],d=0;e.lines.forEach((function(e){e.start_point&&e.end_point&&(c.push(e.start_point.x),c.push(e.start_point.y),c.push(e.start_point.z),c.push(e.end_point.x),c.push(e.end_point.y),c.push(e.end_point.z),h.push(d++),h.push(d++))})),new dh(r,{positions:c,indices:h,clippable:!1,collidable:!0})}if(r.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){var t=e.bitmap_type||"jpg",i=e.bitmap_data,s=yh(e.location,fh),o=yh(e.normal,vh),a=yh(e.up,gh),l=e.height||1;t&&i&&s&&o&&a&&(n.yUp&&(s=Bh(s),o=Bh(o),a=Bh(a)),new qn(r,{src:i,type:t,pos:s,normal:o,up:a,clippable:!1,collidable:!0,height:l}))})),l&&(r.setObjectsXRayed(r.xrayedObjectIds,!1),r.setObjectsHighlighted(r.highlightedObjectIds,!1),r.setObjectsSelected(r.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(r.setObjectsVisible(r.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.visible=!1}))}))):(r.setObjectsVisible(r.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.visible=!0}))})));var p=e.components.visibility.view_setup_hints;p&&(!1===p.spaces_visible&&r.setObjectsVisible(s.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==p.spaces_translucent&&r.setObjectsXRayed(s.metaScene.getObjectIDsByType("IfcSpace"),!0),p.space_boundaries_visible,!1===p.openings_visible&&r.setObjectsVisible(s.metaScene.getObjectIDsByType("IfcOpening"),!0),p.space_boundaries_translucent,void 0!==p.openings_translucent&&r.setObjectsXRayed(s.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(r.setObjectsSelected(r.selectedObjectIds,!1),e.components.selection.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.selected=!0}))}))),e.components.translucency&&(r.setObjectsXRayed(r.xrayedObjectIds,!1),e.components.translucency.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.xrayed=!0}))}))),e.components.coloring&&e.components.coloring.forEach((function(e){var s=e.color,r=0,n=!1;8===s.length&&((r=parseInt(s.substring(0,2),16)/256)<=1&&r>=.95&&(r=1),s=s.substring(2),n=!0);var o=[parseInt(s.substring(0,2),16)/256,parseInt(s.substring(2,4),16)/256,parseInt(s.substring(4,6),16)/256];e.components.map((function(e){return t._withBCFComponent(i,e,(function(e){e.colorize=o,n&&(e.opacity=r)}))}))}))}if(e.perspective_camera||e.orthogonal_camera){var f,v,g,m;if(e.perspective_camera?(f=yh(e.perspective_camera.camera_view_point,ph),v=yh(e.perspective_camera.camera_direction,ph),g=yh(e.perspective_camera.camera_up_vector,ph),n.perspective.fov=e.perspective_camera.field_of_view,m="perspective"):(f=yh(e.orthogonal_camera.camera_view_point,ph),v=yh(e.orthogonal_camera.camera_direction,ph),g=yh(e.orthogonal_camera.camera_up_vector,ph),n.ortho.scale=e.orthogonal_camera.view_to_world_scale,m="ortho"),$.subVec3(f,u),n.yUp&&(f=Bh(f),v=Bh(v),g=Bh(g)),o){var _=r.pick({pickSurface:!0,origin:f,direction:v});v=_?_.worldPos:$.addVec3(f,v,ph)}else v=$.addVec3(f,v,ph);a?(n.eye=f,n.look=v,n.up=g,n.projection=m):s.cameraFlight.flyTo({eye:f,look:v,up:g,duration:i.duration,projection:m})}}}},{key:"_withBCFComponent",value:function(e,t,i){var s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){var n=t.authoring_tool_id,o=r.objects[n];if(o)return void i(o);if(e.updateCompositeObjects)if(s.metaScene.metaObjects[n])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}if(t.ifc_guid){var a=t.ifc_guid,l=r.objects[a];if(l)return void i(l);if(e.updateCompositeObjects)if(s.metaScene.metaObjects[a])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(a),i);Object.keys(r.models).forEach((function(t){var n=$.globalizeObjectId(t,a),o=r.objects[n];o?i(o):e.updateCompositeObjects&&s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}();function _h(e){return{x:e[0],y:e[1],z:e[2]}}function yh(e,t){return(t=new Float64Array(3))[0]=e.x,t[1]=e.y,t[2]=e.z,t}function bh(e){return new Float64Array([e[0],-e[2],e[1]])}function Bh(e){return new Float64Array([e[0],e[2],-e[1]])}function wh(e){var t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0")}var xh=$.vec3(),Ph=function(e,t,i,s){var r=e-i,n=t-s;return Math.sqrt(r*r+n*n)},Ch=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e.viewer.scene,r)).plugin=e,s._container=r.container,!s._container)throw"config missing: container";s._eventSubs={};var n=s.plugin.viewer.scene;s._originMarker=new et(n,r.origin),s._targetMarker=new et(n,r.target),s._originWorld=$.vec3(),s._targetWorld=$.vec3(),s._wp=new Float64Array(24),s._vp=new Float64Array(24),s._pp=new Float64Array(24),s._cp=new Float64Array(8),s._xAxisLabelCulled=!1,s._yAxisLabelCulled=!1,s._zAxisLabelCulled=!1,s._color=r.color||s.plugin.defaultColor;var o=r.onMouseOver?function(e){r.onMouseOver(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,a=r.onMouseLeave?function(e){r.onMouseLeave(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,l=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},u=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},c=r.onContextMenu?function(e){r.onContextMenu(e,b(s))}:null,h=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};return s._originDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._targetDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._lengthWire=new tt(s._container,{color:s._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._xAxisWire=new tt(s._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._yAxisWire=new tt(s._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._zAxisWire=new tt(s._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._lengthLabel=new st(s._container,{fillColor:s._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._xAxisLabel=new st(s._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._yAxisLabel=new st(s._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._zAxisLabel=new st(s._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._wpDirty=!1,s._vpDirty=!1,s._cpDirty=!1,s._sectionPlanesDirty=!0,s._visible=!1,s._originVisible=!1,s._targetVisible=!1,s._wireVisible=!1,s._axisVisible=!1,s._xAxisVisible=!1,s._yAxisVisible=!1,s._zAxisVisible=!1,s._axisEnabled=!0,s._labelsVisible=!1,s._labelsOnWires=!1,s._clickable=!1,s._originMarker.on("worldPos",(function(e){s._originWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._targetMarker.on("worldPos",(function(e){s._targetWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._onViewMatrix=n.camera.on("viewMatrix",(function(){s._vpDirty=!0,s._needUpdate(0)})),s._onProjMatrix=n.camera.on("projMatrix",(function(){s._cpDirty=!0,s._needUpdate()})),s._onCanvasBoundary=n.canvas.on("boundary",(function(){s._cpDirty=!0,s._needUpdate(0)})),s._onMetricsUnits=n.metrics.on("units",(function(){s._cpDirty=!0,s._needUpdate()})),s._onMetricsScale=n.metrics.on("scale",(function(){s._cpDirty=!0,s._needUpdate()})),s._onMetricsOrigin=n.metrics.on("origin",(function(){s._cpDirty=!0,s._needUpdate()})),s._onSectionPlaneUpdated=n.on("sectionPlaneUpdated",(function(){s._sectionPlanesDirty=!0,s._needUpdate()})),s.approximate=r.approximate,s.visible=r.visible,s.originVisible=r.originVisible,s.targetVisible=r.targetVisible,s.wireVisible=r.wireVisible,s.axisVisible=r.axisVisible,s.xAxisVisible=r.xAxisVisible,s.yAxisVisible=r.yAxisVisible,s.zAxisVisible=r.zAxisVisible,s.labelsVisible=r.labelsVisible,s.labelsOnWires=r.labelsOnWires,s}return C(i,[{key:"_update",value:function(){if(this._visible){var e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&($.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}var t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){$.transformPositions4(e.camera.project.matrix,this._vp,this._pp);for(var s=this._pp,r=this._cp,n=e.canvas.canvas.getBoundingClientRect(),o=this._container.getBoundingClientRect(),a=n.top-o.top,l=n.left-o.left,u=e.canvas.boundary,A=u[2],c=u[3],h=0,d=this.plugin.viewer.scene.metrics,p=d.scale,f=d.units,v=d.unitsInfo[f].abbrev,g=0,m=s.length;g1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e.viewer.scene))._canvasToPagePos=r.canvasToPagePos,s.pointerLens=r.pointerLens,s._active=!1,s._currentDistanceMeasurement=null,s._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null},s._initMarkerDiv(),s._onCameraControlHoverSnapOrSurface=null,s._onCameraControlHoverSnapOrSurfaceOff=null,s._onMouseDown=null,s._onMouseUp=null,s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._snapping=!1!==r.snapping,s._mouseState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_initMarkerDiv",value:function(){var e=document.createElement("div");e.setAttribute("id","myMarkerDiv");var t=this.scene.canvas.canvas;t.parentNode.insertBefore(e,t),e.style.background="black",e.style.border="2px solid blue",e.style.borderRadius="10px",e.style.width="5px",e.style.height="5px",e.style.top="-200px",e.style.left="-200px",e.style.margin="0 0",e.style.zIndex="100",e.style.position="absolute",e.style.pointerEvents="none",this._markerDiv=e}},{key:"_destroyMarkerDiv",value:function(){if(this._markerDiv){var e=document.getElementById("myMarkerDiv");e.parentNode.removeChild(e),this._markerDiv=null}}},{key:"_attachPlugin",value:function(e){this.distanceMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){this._markerDiv||this._initMarkerDiv(),this.fire("activated",!0);var t=this.distanceMeasurementsPlugin,i=this.scene,s=t.viewer.cameraControl,r=i.canvas.canvas;i.input;var n,o,a=!1,l=$.vec3(),u=$.vec2(),A=null;this._mouseState=0;var c=function e(t){return t.offsetTop+(t.offsetParent&&t.offsetParent!==r.parentNode&&e(t.offsetParent))},h=function e(t){return t.offsetLeft+(t.offsetParent&&t.offsetParent!==r.parentNode&&e(t.offsetParent))},d=$.vec2();this._onCameraControlHoverSnapOrSurface=s.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(function(t){var i=t.snappedCanvasPos||t.canvasPos;a=!0,l.set(t.worldPos),u.set(t.canvasPos),0===e._mouseState?(e._canvasToPagePos?(e._canvasToPagePos(r,i,d),e._markerDiv.style.left="".concat(d[0]-5,"px"),e._markerDiv.style.top="".concat(d[1]-5,"px")):(e._markerDiv.style.left="".concat(h(r)+i[0]-5,"px"),e._markerDiv.style.top="".concat(c(r)+i[1]-5,"px")),e._markerDiv.style.background="pink",t.snappedToVertex||t.snappedToEdge?(e.pointerLens&&(e.pointerLens.visible=!0,e.pointerLens.canvasPos=t.canvasPos,e.pointerLens.snappedCanvasPos=t.snappedCanvasPos||t.canvasPos,e.pointerLens.snapped=!0),e._markerDiv.style.background="greenyellow",e._markerDiv.style.border="2px solid green"):(e.pointerLens&&(e.pointerLens.visible=!0,e.pointerLens.canvasPos=t.canvasPos,e.pointerLens.snappedCanvasPos=t.canvasPos,e.pointerLens.snapped=!1),e._markerDiv.style.background="pink",e._markerDiv.style.border="2px solid red"),A=t.entity):(e._markerDiv.style.left="-10000px",e._markerDiv.style.top="-10000px"),r.style.cursor="pointer",e._currentDistanceMeasurement&&(e._currentDistanceMeasurement.wireVisible=e._currentDistanceMeasurementInitState.wireVisible,e._currentDistanceMeasurement.axisVisible=e._currentDistanceMeasurementInitState.axisVisible&&e.distanceMeasurementsPlugin.defaultAxisVisible,e._currentDistanceMeasurement.xAxisVisible=e._currentDistanceMeasurementInitState.xAxisVisible&&e.distanceMeasurementsPlugin.defaultXAxisVisible,e._currentDistanceMeasurement.yAxisVisible=e._currentDistanceMeasurementInitState.yAxisVisible&&e.distanceMeasurementsPlugin.defaultYAxisVisible,e._currentDistanceMeasurement.zAxisVisible=e._currentDistanceMeasurementInitState.zAxisVisible&&e.distanceMeasurementsPlugin.defaultZAxisVisible,e._currentDistanceMeasurement.targetVisible=e._currentDistanceMeasurementInitState.targetVisible,e._currentDistanceMeasurement.target.worldPos=l.slice(),e._markerDiv.style.left="-10000px",e._markerDiv.style.top="-10000px")})),r.addEventListener("mousedown",this._onMouseDown=function(e){1===e.which&&(n=e.clientX,o=e.clientY)}),r.addEventListener("mouseup",this._onMouseUp=function(i){1===i.which&&(i.clientX>n+20||i.clientXo+20||i.clientY1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"DistanceMeasurements",e))._pointerLens=r.pointerLens,s._container=r.container||document.body,s._defaultControl=null,s._measurements={},s.labelMinAxisLength=r.labelMinAxisLength,s.defaultVisible=!1!==r.defaultVisible,s.defaultOriginVisible=!1!==r.defaultOriginVisible,s.defaultTargetVisible=!1!==r.defaultTargetVisible,s.defaultWireVisible=!1!==r.defaultWireVisible,s.defaultLabelsVisible=!1!==r.defaultLabelsVisible,s.defaultAxisVisible=!1!==r.defaultAxisVisible,s.defaultXAxisVisible=!1!==r.defaultXAxisVisible,s.defaultYAxisVisible=!1!==r.defaultYAxisVisible,s.defaultZAxisVisible=!1!==r.defaultZAxisVisible,s.defaultColor=void 0!==r.defaultColor?r.defaultColor:"#00BBFF",s.zIndex=r.zIndex||1e4,s.defaultLabelsOnWires=!1!==r.defaultLabelsOnWires,s._onMouseOver=function(e,t){s.fire("mouseOver",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s._onMouseLeave=function(e,t){s.fire("mouseLeave",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s._onContextMenu=function(e,t){s.fire("contextMenu",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){}},{key:"pointerLens",get:function(){return this._pointerLens}},{key:"control",get:function(){return this._defaultControl||(this._defaultControl=new Fh(this,{})),this._defaultControl}},{key:"measurements",get:function(){return this._measurements}},{key:"labelMinAxisLength",get:function(){return this._labelMinAxisLength},set:function(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}},{key:"createMeasurement",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=t.origin,s=t.target,r=new Ch(this,{id:t.id,plugin:this,container:this._container,origin:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:t.visible,wireVisible:t.wireVisible,axisVisible:!1!==t.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==t.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==t.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==t.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==t.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:t.originVisible,targetVisible:t.targetVisible,color:t.color,labelsOnWires:!1!==t.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(function(){delete e._measurements[r.id]})),this.fire("measurementCreated",r),r}},{key:"destroyMeasurement",value:function(e){var t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}},{key:"setLabelsShown",value:function(e){for(var t=0,i=Object.entries(this.measurements);t1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e.viewer.scene)).pointerLens=r.pointerLens,s.pointerCircle=new De(e.viewer),s._active=!1;var n=document.createElement("div"),o=s.scene.canvas.canvas;return o.parentNode.insertBefore(n,o),n.style.background="black",n.style.border="2px solid blue",n.style.borderRadius="10px",n.style.width="5px",n.style.height="5px",n.style.margin="-200px -200px",n.style.zIndex="100",n.style.position="absolute",n.style.pointerEvents="none",s.markerDiv=n,s._currentDistanceMeasurement=null,s._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null},s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._longTouchTimeoutMs=300,s._snapping=!1!==r.snapping,s._touchState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_attachPlugin",value:function(e){this.distanceMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){var t=this.plugin,i=this.scene,s=i.canvas.canvas;t.pointerLens;var r=$.vec3(),n=20,o=null;this._touchState=0;var a=$.vec2(),l=$.vec2(),u=$.vec2(),A=null,c=function(){e.plugin.viewer.cameraControl.active=!1},h=function(){e.plugin.viewer.cameraControl.active=!0};s.addEventListener("touchstart",this._onCanvasTouchStart=function(s){var u=s.touches.length;if(1===u){var d=s.touches[0],p=d.clientX,f=d.clientY;switch(a.set([p,f]),l.set([p,f]),e._touchState){case 0:if(1!==u&&null!==o)return o&&(clearTimeout(o),o=null),e._currentDistanceMeasurement&&(e._currentDistanceMeasurement.destroy(),e._currentDistanceMeasurement=null),h(),void(e._touchState=0);var v=i.pick({canvasPos:l,snapping:e._snapping,snapToEdge:e._snapping});if(v&&v.snapped)r.set(v.worldPos),e.pointerCircle.start(v.snappedCanvasPos);else{var g=i.pick({canvasPos:l,pickSurface:!0});if(!g||!g.worldPos)return;r.set(g.worldPos),e.pointerCircle.start(g.canvasPos)}o=setTimeout((function(){1!==u||l[0]>a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||da[1]+n||pa[0]+n||da[1]+n||p1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,"FastNav",e))._hideColorTexture=!1!==r.hideColorTexture,s._hidePBR=!1!==r.hidePBR,s._hideSAO=!1!==r.hideSAO,s._hideEdges=!1!==r.hideEdges,s._hideTransparentObjects=!!r.hideTransparentObjects,s._scaleCanvasResolution=!!r.scaleCanvasResolution,s._defaultScaleCanvasResolutionFactor=r.defaultScaleCanvasResolutionFactor||1,s._scaleCanvasResolutionFactor=r.scaleCanvasResolutionFactor||.6,s._delayBeforeRestore=!1!==r.delayBeforeRestore,s._delayBeforeRestoreSeconds=r.delayBeforeRestoreSeconds||.5;var n=1e3*s._delayBeforeRestoreSeconds,o=!1,a=function(){n=1e3*s._delayBeforeRestoreSeconds,o||(e.scene._renderer.setColorTextureEnabled(!s._hideColorTexture),e.scene._renderer.setPBREnabled(!s._hidePBR),e.scene._renderer.setSAOEnabled(!s._hideSAO),e.scene._renderer.setTransparentEnabled(!s._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!s._hideEdges),s._scaleCanvasResolution?e.scene.canvas.resolutionScale=s._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=s._defaultScaleCanvasResolutionFactor,o=!0)},l=function(){e.scene.canvas.resolutionScale=s._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),o=!1};s._onCanvasBoundary=e.scene.canvas.on("boundary",a),s._onCameraMatrix=e.scene.camera.on("matrix",a),s._onSceneTick=e.scene.on("tick",(function(e){o&&(n-=e.deltaTime,(!s._delayBeforeRestore||n<=0)&&l())}));var u=!1;return s._onSceneMouseDown=e.scene.input.on("mousedown",(function(){u=!0})),s._onSceneMouseUp=e.scene.input.on("mouseup",(function(){u=!1})),s._onSceneMouseMove=e.scene.input.on("mousemove",(function(){u&&a()})),s}return C(i,[{key:"hideColorTexture",get:function(){return this._hideColorTexture},set:function(e){this._hideColorTexture=e}},{key:"hidePBR",get:function(){return this._hidePBR},set:function(e){this._hidePBR=e}},{key:"hideSAO",get:function(){return this._hideSAO},set:function(e){this._hideSAO=e}},{key:"hideEdges",get:function(){return this._hideEdges},set:function(e){this._hideEdges=e}},{key:"hideTransparentObjects",get:function(){return this._hideTransparentObjects},set:function(e){this._hideTransparentObjects=!1!==e}},{key:"scaleCanvasResolution",get:function(){return this._scaleCanvasResolution},set:function(e){this._scaleCanvasResolution=e}},{key:"defaultScaleCanvasResolutionFactor",get:function(){return this._defaultScaleCanvasResolutionFactor},set:function(e){this._defaultScaleCanvasResolutionFactor=e||1}},{key:"scaleCanvasResolutionFactor",get:function(){return this._scaleCanvasResolutionFactor},set:function(e){this._scaleCanvasResolutionFactor=e||.6}},{key:"delayBeforeRestore",get:function(){return this._delayBeforeRestore},set:function(e){this._delayBeforeRestore=e}},{key:"delayBeforeRestoreSeconds",get:function(){return this._delayBeforeRestoreSeconds},set:function(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}},{key:"send",value:function(e,t){}},{key:"destroy",value:function(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Dh=function(){function e(){x(this,e)}return C(e,[{key:"getMetaModel",value:function(e,t,i){le.loadJSON(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getGLTF",value:function(e,t,i){le.loadArraybuffer(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getGLB",value:function(e,t,i){le.loadArraybuffer(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getArrayBuffer",value:function(e,t,i,s){!function(e,t,i,s){var r=function(){};i=i||r,s=s||r;var n=/^data:(.*?)(;base64)?,(.*)$/,o=t.match(n);if(o){var a=!!o[2],l=o[3];l=window.decodeURIComponent(l),a&&(l=window.atob(l));try{for(var u=new ArrayBuffer(l.length),A=new Uint8Array(u),c=0;c0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=t.messages,this.locale=t.locale}return C(e,[{key:"messages",set:function(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}},{key:"loadMessages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e)this._messages[t]=e[t];this.messages=this._messages}},{key:"clearMessages",value:function(){this.messages={}}},{key:"locales",get:function(){return this._locales}},{key:"locale",get:function(){return this._locale},set:function(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}},{key:"translate",value:function(e,t){var i=this._messages[this._locale];if(!i)return null;var s=Th(e,i);return s?t?Rh(s,t):s:null}},{key:"translatePlurals",value:function(e,t,i){var s=this._messages[this._locale];if(!s)return null;var r=Th(e,s);return(r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one)?(r=Rh(r,[t]),i&&(r=Rh(r,i)),r):null}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);var s=this._eventSubs[e];if(s)for(var r in s){if(s.hasOwnProperty(r))s[r].callback(t)}}},{key:"on",value:function(e,t){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new Q),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});var i=this._eventSubs[e];i||(i={},this._eventSubs[e]=i);var s=this._eventSubIDMap.addItem();i[s]={callback:t},this._eventSubEvents[s]=e;var r=this._events[e];return void 0!==r&&t(r),s}},{key:"off",value:function(e){if(null!=e&&this._eventSubEvents){var t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];var i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}}]),e}();function Th(e,t){if(t[e])return t[e];for(var i=e.split("."),s=t,r=0,n=i.length;s&&r1&&void 0!==arguments[1]?arguments[1]:[];return e.replace(/\{\{|\}\}|\{(\d+)\}/g,(function(e,i){return"{{"===e?"{":"}}"===e?"}":t[i]}))}var Lh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).t=r.t,s}return C(i,[{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"tangent",get:function(){return this.getTangent(this._t)}},{key:"length",get:function(){var e=this._getLengths();return e[e.length-1]}},{key:"getTangent",value:function(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),n=this.getPoint(s),o=$.subVec3(n,r,[]);return $.normalizeVec3(o,[])}},{key:"getPointAt",value:function(e){var t=this.getUToTMapping(e);return this.getPoint(t)}},{key:"getPoints",value:function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}},{key:"_getLengths",value:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),n=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),n+=$.lenVec3($.subVec3(t,r,[])),s.push(n),r=t;return this.cacheArcLengths=s,s}},{key:"_updateArcLengths",value:function(){this.needsUpdate=!0,this._getLengths()}},{key:"getUToTMapping",value:function(e,t){var i,s=this._getLengths(),r=0,n=s.length;i=t||e*s[n-1];for(var o,a=0,l=n-1;a<=l;)if((o=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(n-1);var u=s[r];return(r+(i-u)/(s[r+1]-u))/(n-1)}}]),i}(),Uh=function(e){g(i,Lh);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).points=r.points,s.t=r.t,s}return C(i,[{key:"points",get:function(){return this._points},set:function(e){this._points=e||[]}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,n=t[0===s?s:s-1],o=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],u=$.vec3();return u[0]=$.catmullRomInterpolate(n[0],o[0],a[0],l[0],r),u[1]=$.catmullRomInterpolate(n[1],o[1],a[1],l[1],r),u[2]=$.catmullRomInterpolate(n[2],o[2],a[2],l[2],r),u}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}},{key:"getJSON",value:function(){return{points:points,t:this._t}}}]),i}(),Oh=$.vec3(),Nh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._frames=[],s._eyeCurve=new Uh(b(s)),s._lookCurve=new Uh(b(s)),s._upCurve=new Uh(b(s)),r.frames&&(s.addFrames(r.frames),s.smoothFrameTimes(1)),s}return C(i,[{key:"type",get:function(){return"CameraPath"}},{key:"frames",get:function(){return this._frames}},{key:"eyeCurve",get:function(){return this._eyeCurve}},{key:"lookCurve",get:function(){return this._lookCurve}},{key:"upCurve",get:function(){return this._upCurve}},{key:"saveFrame",value:function(e){var t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}},{key:"addFrame",value:function(e,t,i,s){var r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}},{key:"addFrames",value:function(e){for(var t,i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,Oh),t.look=this._lookCurve.getPoint(e,Oh),t.up=this._upCurve.getPoint(e,Oh)}},{key:"sampleFrame",value:function(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}},{key:"smoothFrameTimes",value:function(e){if(0!==this._frames.length){var t=$.vec3(),i=0;this._frames[0].t=0;for(var s=[],r=1,n=this._frames.length;r1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._look1=$.vec3(),s._eye1=$.vec3(),s._up1=$.vec3(),s._look2=$.vec3(),s._eye2=$.vec3(),s._up2=$.vec3(),s._orthoScale1=1,s._orthoScale2=1,s._flying=!1,s._flyEyeLookUp=!1,s._flyingEye=!1,s._flyingLook=!1,s._callback=null,s._callbackScope=null,s._time1=null,s._time2=null,s.easing=!1!==r.easing,s.duration=r.duration,s.fit=r.fit,s.fitFOV=r.fitFOV,s.trail=r.trail,s}return C(i,[{key:"type",get:function(){return"CameraFlightAnimation"}},{key:"flyTo",value:function(e,t,i){e=e||this.scene,this._flying&&this.stop(),this._flying=!1,this._flyingEye=!1,this._flyingLook=!1,this._flyingEyeLookUp=!1,this._callback=t,this._callbackScope=i;var s,r,n,o,a,l=this.scene.camera,u=!!e.projection&&e.projection!==l.projection;if(this._eye1[0]=l.eye[0],this._eye1[1]=l.eye[1],this._eye1[2]=l.eye[2],this._look1[0]=l.look[0],this._look1[1]=l.look[1],this._look1[2]=l.look[2],this._up1[0]=l.up[0],this._up1[1]=l.up[1],this._up1[2]=l.up[2],this._orthoScale1=l.ortho.scale,this._orthoScale2=e.orthoScale||this._orthoScale1,e.aabb)s=e.aabb;else if(6===e.length)s=e;else if(e.eye&&e.look||e.up)r=e.eye,n=e.look,o=e.up;else if(e.eye)r=e.eye;else if(e.look)n=e.look;else{var A=e;if((le.isNumeric(A)||le.isString(A))&&(a=A,!(A=this.scene.components[a])))return this.error("Component not found: "+le.inQuotes(a)),void(t&&(i?t.call(i):t()));u||(s=A.aabb||this.scene.aabb)}var c=e.poi;if(s){if(s[3]=1;e>1&&(e=1);var s=this.easing?i._ease(e,0,1,1):e,r=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?($.subVec3(r.eye,r.look,Gh),r.eye=$.lerpVec3(s,0,1,this._eye1,this._eye2,Hh),r.look=$.subVec3(Hh,Gh,Vh)):this._flyingLook&&(r.look=$.lerpVec3(s,0,1,this._look1,this._look2,Vh),r.up=$.lerpVec3(s,0,1,this._up1,this._up2,jh)):this._flyingEyeLookUp&&(r.eye=$.lerpVec3(s,0,1,this._eye1,this._eye2,Hh),r.look=$.lerpVec3(s,0,1,this._look1,this._look2,Vh),r.up=$.lerpVec3(s,0,1,this._up1,this._up2,jh)),this._projection2){var n="ortho"===this._projection2?i._easeOutExpo(e,0,1,1):i._easeInCubic(e,0,1,1);r.customProjection.matrix=$.lerpMat4(n,0,1,this._projMatrix1,this._projMatrix2)}else r.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return r.ortho.scale=this._orthoScale2,void this.stop();_e.scheduleTask(this._update,this)}}},{key:"stop",value:function(){if(this._flying){this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);var e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}}},{key:"cancel",value:function(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}},{key:"duration",get:function(){return this._duration/1e3},set:function(e){this._duration=e?1e3*e:500,this.stop()}},{key:"fit",get:function(){return this._fit},set:function(e){this._fit=!1!==e}},{key:"fitFOV",get:function(){return this._fitFOV},set:function(e){this._fitFOV=e||45}},{key:"trail",get:function(){return this._trail},set:function(e){this._trail=!!e}},{key:"destroy",value:function(){this.stop(),f(B(i.prototype),"destroy",this).call(this)}}],[{key:"_ease",value:function(e,t,i,s){return-i*(e/=s)*(e-2)+t}},{key:"_easeInCubic",value:function(e,t,i,s){return i*(e/=s)*e*e+t}},{key:"_easeOutExpo",value:function(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}}]),i}(),Wh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._cameraFlightAnimation=new zh(b(s)),s._t=0,s.state=i.SCRUBBING,s._playingFromT=0,s._playingToT=0,s._playingRate=r.playingRate||1,s._playingDir=1,s._lastTime=null,s.cameraPath=r.cameraPath,s._tick=s.scene.on("tick",s._updateT,b(s)),s}return C(i,[{key:"type",get:function(){return"CameraPathAnimation"}},{key:"_updateT",value:function(){var e=this._cameraPath;if(e){var t,s,r=performance.now(),n=this._lastTime?.001*(r-this._lastTime):0;if(this._lastTime=r,0!==n)switch(this.state){case i.SCRUBBING:return;case i.PLAYING:if(this._t+=this._playingRate*n,0===(t=this._cameraPath.frames.length)||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=i.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case i.PLAYING_TO:s=this._t+this._playingRate*n*this._playingDir,(this._playingDir<0&&s<=this._playingToT||this._playingDir>0&&s>=this._playingToT)&&(s=this._playingToT,this.state=i.SCRUBBING,this.fire("stopped")),this._t=s,e.loadFrame(this._t)}}}},{key:"_ease",value:function(e,t,i,s){return-i*(e/=s)*(e-2)+t}},{key:"cameraPath",get:function(){return this._cameraPath},set:function(e){this._cameraPath=e}},{key:"rate",get:function(){return this._playingRate},set:function(e){this._playingRate=e}},{key:"play",value:function(){this._cameraPath&&(this._lastTime=null,this.state=i.PLAYING)}},{key:"playToT",value:function(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=i.PLAYING_TO)}},{key:"playToFrame",value:function(e){var t=this._cameraPath;if(t){var i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}}},{key:"flyToFrame",value:function(e,t){var s=this._cameraPath;if(s){var r=s.frames[e];r?(this.state=i.SCRUBBING,this._cameraFlightAnimation.flyTo(r,t)):this.error("flyToFrame - frame index out of range: "+e)}}},{key:"scrubToT",value:function(e){var t=this._cameraPath;t&&(this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=i.SCRUBBING))}},{key:"scrubToFrame",value:function(e){var t=this._cameraPath;t&&(this.scene.camera&&(t.frames[e]?(t.loadFrame(this._t),this.state=i.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)))}},{key:"stop",value:function(){this.state=i.SCRUBBING,this.fire("stopped")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene.off(this._tick)}}]),i}();Wh.STOPPED=0,Wh.SCRUBBING=1,Wh.PLAYING=2,Wh.PLAYING_TO=3;var Kh=$.vec3(),Xh=$.vec3();$.vec3();var Jh=$.vec3([0,-1,0]),Yh=$.vec4([0,0,0,1]),Zh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._src=null,s._image=null,s._pos=$.vec3(),s._origin=$.vec3(),s._rtcPos=$.vec3(),s._dir=$.vec3(),s._size=1,s._imageSize=$.vec2(),s._texture=new Un(b(s)),s._plane=new rn(b(s),{geometry:new Si(b(s),Xn({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:s._texture,emissiveMap:s._texture,backfaces:!0}),clippable:r.clippable}),s._grid=new rn(b(s),{geometry:new Si(b(s),Kn({size:1,divisions:10})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:r.clippable}),s._node=new bn(b(s),{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[s._plane,s._grid]}),s._gridVisible=!1,s.visible=!0,s.gridVisible=r.gridVisible,s.position=r.position,s.rotation=r.rotation,s.dir=r.dir,s.size=r.size,s.collidable=r.collidable,s.clippable=r.clippable,s.pickable=r.pickable,s.opacity=r.opacity,r.image?s.image=r.image:s.src=r.src,s}return C(i,[{key:"visible",get:function(){return this._plane.visible},set:function(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}},{key:"gridVisible",get:function(){return this._gridVisible},set:function(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}},{key:"src",get:function(){return this._src},set:function(e){var t=this;if(this._src=e,this._src){this._image=null;var i=new Image;i.onload=function(){t._texture.image=i,t._imageSize[0]=i.width,t._imageSize[1]=i.height,t._updatePlaneSizeFromImage()},i.src=this._src}}},{key:"position",get:function(){return this._pos},set:function(e){this._pos.set(e||[0,0,0]),Le(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}},{key:"rotation",get:function(){return this._node.rotation},set:function(e){this._node.rotation=e}},{key:"size",get:function(){return this._size},set:function(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}},{key:"dir",get:function(){return this._dir},set:function(e){if(this._dir.set(e||[0,0,-1]),e){var t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];$.subVec3(t,this.position,Kh);var s=-$.dotVec3(i,Kh);$.normalizeVec3(i),$.mulVec3Scalar(i,s,Xh),$.vec3PairToQuaternion(Jh,e,Yh),this._node.quaternion=Yh}}},{key:"collidable",get:function(){return this._node.collidable},set:function(e){this._node.collidable=!1!==e}},{key:"clippable",get:function(){return this._node.clippable},set:function(e){this._node.clippable=!1!==e}},{key:"pickable",get:function(){return this._node.pickable},set:function(e){this._node.pickable=!1!==e}},{key:"opacity",get:function(){return this._node.opacity},set:function(e){this._node.opacity=e}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}},{key:"_updatePlaneSizeFromImage",value:function(){var e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){var s=i/t;this._node.scale=[e,1,e*s]}else{var r=t/i;this._node.scale=[e*r,1,e]}}}]),i}(),qh=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i);var n=b(s=t.call(this,e,r));s._shadowRenderBuf=null,s._shadowViewMatrix=null,s._shadowProjMatrix=null,s._shadowViewMatrixDirty=!0,s._shadowProjMatrixDirty=!0;var o=s.scene.camera,a=s.scene.canvas;return s._onCameraViewMatrix=o.on("viewMatrix",(function(){s._shadowViewMatrixDirty=!0})),s._onCameraProjMatrix=o.on("projMatrix",(function(){s._shadowProjMatrixDirty=!0})),s._onCanvasBoundary=a.on("boundary",(function(){s._shadowProjMatrixDirty=!0})),s._state=new Zt({type:"point",pos:$.vec3([1,1,1]),color:$.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:r.space||"view",castsShadow:!1,getShadowViewMatrix:function(){if(n._shadowViewMatrixDirty){n._shadowViewMatrix||(n._shadowViewMatrix=$.identityMat4());var e=n._state.pos,t=o.look,i=o.up;$.lookAtMat4v(e,t,i,n._shadowViewMatrix),n._shadowViewMatrixDirty=!1}return n._shadowViewMatrix},getShadowProjMatrix:function(){if(n._shadowProjMatrixDirty){n._shadowProjMatrix||(n._shadowProjMatrix=$.identityMat4());var e=n.scene.canvas.canvas;$.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,n._shadowProjMatrix),n._shadowProjMatrixDirty=!1}return n._shadowProjMatrix},getShadowRenderBuf:function(){return n._shadowRenderBuf||(n._shadowRenderBuf=new zt(n.scene.canvas.canvas,n.scene.canvas.gl,{size:[1024,1024]})),n._shadowRenderBuf}}),s.pos=r.pos,s.color=r.color,s.intensity=r.intensity,s.constantAttenuation=r.constantAttenuation,s.linearAttenuation=r.linearAttenuation,s.quadraticAttenuation=r.quadraticAttenuation,s.castsShadow=r.castsShadow,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"PointLight"}},{key:"pos",get:function(){return this._state.pos},set:function(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}},{key:"constantAttenuation",get:function(){return this._state.attenuation[0]},set:function(e){this._state.attenuation[0]=e||0,this.glRedraw()}},{key:"linearAttenuation",get:function(){return this._state.attenuation[1]},set:function(e){this._state.attenuation[1]=e||0,this.glRedraw()}},{key:"quadraticAttenuation",get:function(){return this._state.attenuation[2]},set:function(e){this._state.attenuation[2]=e||0,this.glRedraw()}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}},{key:"destroy",value:function(){var e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}]),i}();function $h(e){return 0==(e&e-1)}function ed(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1}var td=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i);var n=(s=t.call(this,e,r)).scene.canvas.gl;return s._state=new Zt({texture:new In({gl:n,target:n.TEXTURE_CUBE_MAP}),flipY:s._checkFlipY(r.minFilter),encoding:s._checkEncoding(r.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),s._src=r.src,s._images=[],s._loadSrc(r.src),se.memory.textures++,s}return C(i,[{key:"type",get:function(){return"CubeTexture"}},{key:"_checkFlipY",value:function(e){return!!e}},{key:"_checkEncoding",value:function(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}},{key:"_webglContextRestored",value:function(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}},{key:"_loadSrc",value:function(e){var t=this,i=this.scene.canvas.gl;this._images=[];for(var s=!1,r=0,n=function(n){var o,a,l=new Image;l.onload=(o=l,a=n,function(){if(!s&&(o=function(e){if(!$h(e.width)||!$h(e.height)){var t=document.createElement("canvas");t.width=ed(e.width),t.height=ed(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}(o),t._images[a]=o,6==++r)){var e=t._state.texture;e||(e=new In({gl:i,target:i.TEXTURE_CUBE_MAP}),t._state.texture=e),e.setImage(t._images,t._state),t.fire("loaded",t._src,!1),t.glRedraw()}}),l.onerror=function(){s=!0},l.src=e[n]},o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).scene._lightsState.addReflectionMap(s._state),s.scene._reflectionMapCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"ReflectionMap"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._reflectionMapDestroyed(this)}}]),i}(),sd=function(e){g(i,td);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).scene._lightMapCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"LightMap"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._lightMapDestroyed(this)}}]),i}(),rd=function(e){g(i,et);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,{entity:r.entity,occludable:r.occludable,worldPos:r.worldPos}))._occluded=!1,s._visible=!0,s._src=null,s._image=null,s._pos=$.vec3(),s._origin=$.vec3(),s._rtcPos=$.vec3(),s._dir=$.vec3(),s._size=1,s._imageSize=$.vec2(),s._texture=new Un(b(s),{src:r.src}),s._geometry=new Si(b(s),{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]}),s._mesh=new rn(b(s),{geometry:s._geometry,material:new Oi(b(s),{ambient:[.9,.3,.9],shininess:30,diffuseMap:s._texture,backfaces:!0}),scale:[1,1,1],position:r.worldPos,rotation:[90,0,0],billboard:"spherical",occluder:!1}),s.visible=!0,s.collidable=r.collidable,s.clippable=r.clippable,s.pickable=r.pickable,s.opacity=r.opacity,s.size=r.size,r.image?s.image=r.image:s.src=r.src,s}return C(i,[{key:"_setVisible",value:function(e){this._occluded=!e,this._mesh.visible=this._visible&&!this._occluded,f(B(i.prototype),"_setVisible",this).call(this,e)}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=null==e||e,this._mesh.visible=this._visible&&!this._occluded}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}},{key:"src",get:function(){return this._src},set:function(e){var t=this;if(this._src=e,this._src){this._image=null;var i=new Image;i.onload=function(){t._texture.image=i,t._imageSize[0]=i.width,t._imageSize[1]=i.height,t._updatePlaneSizeFromImage()},i.src=this._src}}},{key:"size",get:function(){return this._size},set:function(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}},{key:"collidable",get:function(){return this._mesh.collidable},set:function(e){this._mesh.collidable=!1!==e}},{key:"clippable",get:function(){return this._mesh.clippable},set:function(e){this._mesh.clippable=!1!==e}},{key:"pickable",get:function(){return this._mesh.pickable},set:function(e){this._mesh.pickable=!1!==e}},{key:"opacity",get:function(){return this._mesh.opacity},set:function(e){this._mesh.opacity=e}},{key:"_updatePlaneSizeFromImage",value:function(){var e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}}]),i}(),nd=function(){function e(t){x(this,e),this._eye=$.vec3(),this._look=$.vec3(),this._up=$.vec3(),this._projection={},t&&this.saveCamera(t)}return C(e,[{key:"saveCamera",value:function(e){var t=e.camera,i=t.project;switch(this._eye.set(t.eye),this._look.set(t.look),this._up.set(t.up),t.projection){case"perspective":this._projection={projection:"perspective",fov:i.fov,fovAxis:i.fovAxis,near:i.near,far:i.far};break;case"ortho":this._projection={projection:"ortho",scale:i.scale,near:i.near,far:i.far};break;case"frustum":this._projection={projection:"frustum",left:i.left,right:i.right,top:i.top,bottom:i.bottom,near:i.near,far:i.far};break;case"custom":this._projection={projection:"custom",matrix:i.matrix.slice()}}}},{key:"restoreCamera",value:function(e,t){var i=e.camera,s=this._projection;function r(){switch(s.type){case"perspective":i.perspective.fov=s.fov,i.perspective.fovAxis=s.fovAxis,i.perspective.near=s.near,i.perspective.far=s.far;break;case"ortho":i.ortho.scale=s.scale,i.ortho.near=s.near,i.ortho.far=s.far;break;case"frustum":i.frustum.left=s.left,i.frustum.right=s.right,i.frustum.top=s.top,i.frustum.bottom=s.bottom,i.frustum.near=s.near,i.frustum.far=s.far;break;case"custom":i.customProjection.matrix=s.matrix}}t?e.viewer.cameraFlight.flyTo({eye:this._eye,look:this._look,up:this._up,orthoScale:s.scale,projection:s.projection},(function(){r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}]),e}(),od=$.vec3(),ad=function(){function e(t){if(x(this,e),this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsOpacity=[],this.numObjects=0,t){var i=t.metaScene.scene;this.saveObjects(i,t)}}return C(e,[{key:"saveObjects",value:function(e,t,i){this.numObjects=0,this._mask=i?le.apply(i,{}):null;for(var s=!i||i.visible,r=!i||i.edges,n=!i||i.xrayed,o=!i||i.highlighted,a=!i||i.selected,l=!i||i.clippable,u=!i||i.pickable,A=!i||i.colorize,c=!i||i.opacity,h=t.metaObjects,d=e.objects,p=0,f=h.length;p1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).v0=r.v0,s.v1=r.v1,s.v2=r.v2,s.v3=r.v3,s.t=r.t,s}return C(i,[{key:"v0",get:function(){return this._v0},set:function(e){this._v0=e||$.vec3([0,0,0])}},{key:"v1",get:function(){return this._v1},set:function(e){this._v1=e||$.vec3([0,0,0])}},{key:"v2",get:function(){return this._v2},set:function(e){this._v2=e||$.vec3([0,0,0])}},{key:"v3",get:function(){return this._v3},set:function(e){this.fire("v3",this._v3=e||$.vec3([0,0,0]))}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=$.vec3();return t[0]=$.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=$.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=$.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}},{key:"getJSON",value:function(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}}]),i}(),cd=function(e){g(i,Lh);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._cachedLengths=[],s._dirty=!0,s._curves=[],s._t=0,s._dirtySubs=[],s._destroyedSubs=[],s.curves=r.curves||[],s.t=r.t,s}return C(i,[{key:"addCurve",value:function(e){this._curves.push(e),this._dirty=!0}},{key:"curves",get:function(){return this._curves},set:function(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"length",get:function(){var e=this._getCurveLengths();return e[e.length-1]}},{key:"getPoint",value:function(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var n=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(n)}r++}return null}},{key:"_getCurveLengths",value:function(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).v0=r.v0,s.v1=r.v1,s.v2=r.v2,s.t=r.t,s}return C(i,[{key:"v0",get:function(){return this._v0},set:function(e){this._v0=e||$.vec3([0,0,0])}},{key:"v1",get:function(){return this._v1},set:function(e){this._v1=e||$.vec3([0,0,0])}},{key:"v2",get:function(){return this._v2},set:function(e){this._v2=e||$.vec3([0,0,0])}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=$.vec3();return t[0]=$.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=$.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=$.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}},{key:"getJSON",value:function(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}}]),i}(),dd=function(e){g(i,ch);var t=_(i);function i(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),t.call(this,e,s)}return C(i)}(),pd=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._skyboxMesh=new rn(b(s),{geometry:new Si(b(s),{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Oi(b(s),{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Un(b(s),{src:r.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:r.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),s.size=r.size,s.active=r.active,s}return C(i,[{key:"size",get:function(){return this._size},set:function(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}},{key:"active",get:function(){return this._skyboxMesh.visible},set:function(e){this._skyboxMesh.visible=e}}]),i}(),fd=function(){function e(){x(this,e)}return C(e,[{key:"transcode",value:function(e,t){}},{key:"destroy",value:function(){}}]),e}(),vd=$.vec4(),gd=$.vec4(),md=$.vec3(),_d=$.vec3(),yd=$.vec3(),bd=$.vec4(),Bd=$.vec4(),wd=$.vec4(),xd=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"dollyToCanvasPos",value:function(e,t,i){var s=!1,r=this._scene.camera;if(e){var n=$.subVec3(e,r.eye,md);s=$.lenVec3(n)0&&void 0!==arguments[0]?arguments[0]:{};this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);var t=e.color||[1,0,0];this._pivotSphereMaterial=new Oi(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}},{key:"disablePivotSphere",value:function(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}},{key:"startPivot",value:function(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;var e=this._scene.camera,t=$.lookAtMat4v(e.eye,e.look,e.worldUp);$.transformPoint3(t,this.getPivotPos(),this._cameraOffset);var i=this.getPivotPos();this._cameraOffset[2]+=$.distVec3(e.eye,i),t=$.inverseMat4(t);var s=$.transformVec3(t,this._cameraOffset),r=$.vec3();if($.subVec3(e.eye,i,r),$.addVec3(r,s),e.zUp){var n=r[1];r[1]=r[2],r[2]=n}this._radius=$.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}},{key:"_cameraLookingDownwards",value:function(){var e=this._scene.camera,t=$.normalizeVec3($.subVec3(e.look,e.eye,Pd)),i=$.cross3Vec3(t,e.worldUp,Cd);return $.sqLenVec3(i)<=1e-4}},{key:"getPivoting",value:function(){return this._pivoting}},{key:"setPivotPos",value:function(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}},{key:"setCanvasPivotPos",value:function(e){var t=this._scene.camera,i=Math.abs($.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),n=s.subarray(12),o=[0,0,-1,1],a=$.dotVec4(o,r)/$.dotVec4(o,n),l=Fd;t.project.unproject(e,a,Ed,kd,l);var u=$.normalizeVec3($.subVec3(l,t.eye,Pd)),A=$.addVec3(t.eye,$.mulVec3Scalar(u,i,Cd),Md);this.setPivotPos(A)}},{key:"getPivotPos",value:function(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}},{key:"continuePivot",value:function(e,t){if(this._pivoting&&(0!==e||0!==t)){var i=this._scene.camera,s=-e,r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=$.clamp(this._polar,.001,Math.PI-.001);var n=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){var o=n[1];n[1]=n[2],n[2]=o}var a=$.lenVec3($.subVec3(i.look,i.eye,$.vec3())),l=this.getPivotPos();$.addVec3(n,l);var u=$.lookAtMat4v(n,l,i.worldUp);u=$.inverseMat4(u);var A=$.transformVec3(u,this._cameraOffset);u[12]-=A[0],u[13]-=A[1],u[14]-=A[2];var c=[u[8],u[9],u[10]];i.eye=[u[12],u[13],u[14]],$.subVec3(i.eye,$.mulVec3Scalar(c,a),i.look),i.up=[u[4],u[5],u[6]],this.showPivot()}}},{key:"showPivot",value:function(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}},{key:"hidePivot",value:function(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}},{key:"endPivot",value:function(){this._pivoting=!1}},{key:"destroy",value:function(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}]),e}(),Dd=function(){function e(t,i){x(this,e),this._scene=t.scene,this._cameraControl=t,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=i,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=$.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}return C(e,[{key:"update",value:function(){if(this._configs.pointerEnabled&&(this.schedulePickEntity||this.schedulePickSurface)){var e="".concat(~~this.pickCursorPos[0],"-").concat(~~this.pickCursorPos[1],"-").concat(this.scheduleSnapOrPick,"-").concat(this.schedulePickSurface,"-").concat(this.schedulePickEntity);if(this._lastHash!==e){this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;var t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){var i=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});i&&(i.snappedToEdge||i.snappedToVertex)?(this.snapPickResult=i,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){var s=this.pickResult.canvasPos;if(s[0]===this.pickCursorPos[0]&&s[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){var r=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(r[0]===this.pickCursorPos[0]&&r[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}}}},{key:"fireEvents",value:function(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){var e=new wt;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){var t=this.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=t)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}]),e}(),Sd=$.vec2(),Td=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o,a,l,u=i.pickController,A=0,c=0,h=0,d=0,p=!1,f=$.vec3(),v=!0,g=this._scene.canvas.canvas,m=[];function _(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];g.style.cursor="move",y(),e&&b()}function y(){A=r.pointerCanvasPos[0],c=r.pointerCanvasPos[1],h=r.pointerCanvasPos[0],d=r.pointerCanvasPos[1]}function b(){u.pickCursorPos=r.pointerCanvasPos,u.schedulePickSurface=!0,u.update(),u.picked&&u.pickedSurface&&u.pickResult&&u.pickResult.worldPos?(p=!0,f.set(u.pickResult.worldPos)):p=!1}document.addEventListener("keydown",this._documentKeyDownHandler=function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled){var i=e.keyCode;m[i]=!0}}),document.addEventListener("keyup",this._documentKeyUpHandler=function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled){var i=e.keyCode;m[i]=!1}}),g.addEventListener("mousedown",this._mouseDownHandler=function(e){if(s.active&&s.pointerEnabled)switch(e.which){case 1:m[t.input.KEY_SHIFT]||s.planView?(o=!0,_()):(o=!0,_(!1));break;case 2:a=!0,_();break;case 3:l=!0,s.panRightClick&&_()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=function(e){if(s.active&&s.pointerEnabled&&(o||a||l)){var i=t.canvas.boundary,u=i[2],h=i[3],d=r.pointerCanvasPos[0],v=r.pointerCanvasPos[1],g=m[t.input.KEY_SHIFT]||s.planView||!s.panRightClick&&a||s.panRightClick&&l,_=document.pointerLockElement?e.movementX:d-A,y=document.pointerLockElement?e.movementY:v-c;if(g){var b=t.camera;if("perspective"===b.projection){var B=Math.abs(p?$.lenVec3($.subVec3(f,t.camera.eye,[])):t.camera.eyeLookDist)*Math.tan(b.perspective.fov/2*Math.PI/180);n.panDeltaX+=1.5*_*B/h,n.panDeltaY+=1.5*y*B/h}else n.panDeltaX+=.5*b.ortho.scale*(_/h),n.panDeltaY+=.5*b.ortho.scale*(y/h)}else!o||a||l||s.planView||(s.firstPerson?(n.rotateDeltaY-=_/u*s.dragRotationRate/2,n.rotateDeltaX+=y/h*(s.dragRotationRate/4)):(n.rotateDeltaY-=_/u*(1.5*s.dragRotationRate),n.rotateDeltaX+=y/h*(1.5*s.dragRotationRate)));A=d,c=v}}),g.addEventListener("mousemove",this._canvasMouseMoveHandler=function(e){s.active&&s.pointerEnabled&&r.mouseover&&(v=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(s.active&&s.pointerEnabled)switch(e.which){case 1:case 2:case 3:o=!1,a=!1,l=!1}}),g.addEventListener("mouseup",this._mouseUpHandler=function(e){if(s.active&&s.pointerEnabled){if(3===e.which){!function(e,t){if(e){for(var i=e.target,s=0,r=0,n=0,o=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,n+=i.scrollLeft,o+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+n-s,t[1]=e.pageY+o-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Sd);var t=Sd[0],r=Sd[1];Math.abs(t-h)<3&&Math.abs(r-d)<3&&i.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Sd,event:e},!0)}g.style.removeProperty("cursor")}}),g.addEventListener("mouseenter",this._mouseEnterHandler=function(){s.active&&s.pointerEnabled});var B=1/60,w=null;g.addEventListener("wheel",this._mouseWheelHandler=function(e){if(s.active&&s.pointerEnabled){var t=performance.now()/1e3,i=null!==w?t-w:0;w=t,i>.05&&(i=.05),i0?i.cameraFlight.flyTo(Qd,(function(){i.pivotController.getPivoting()&&s.followPointer&&i.pivotController.showPivot()})):(i.cameraFlight.jumpTo(Qd),i.pivotController.getPivoting()&&s.followPointer&&i.pivotController.showPivot())}}}))}return C(e,[{key:"reset",value:function(){}},{key:"destroy",value:function(){this._scene.input.off(this._onSceneKeyDown)}}]),e}(),Hd=function(){function e(t,i,s,r,n){var o=this;x(this,e),this._scene=t;var a=i.pickController,l=i.pivotController,u=i.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;var A=!1,c=!1,h=this._scene.canvas.canvas,d=function(e){var s;e&&e.worldPos&&(s=e.worldPos);var r=e&&e.entity?e.entity.aabb:t.aabb;if(s){var n=t.camera;$.subVec3(n.eye,n.look,[]),i.cameraFlight.flyTo({aabb:r})}else i.cameraFlight.flyTo({aabb:r})},p=t.tickify(this._canvasMouseMoveHandler=function(e){if(s.active&&s.pointerEnabled&&!A&&!c){var i=u.hasSubs("hover"),n=u.hasSubs("hoverEnter"),l=u.hasSubs("hoverOut"),h=u.hasSubs("hoverOff"),d=u.hasSubs("hoverSurface"),p=u.hasSubs("hoverSnapOrSurface");if(i||n||l||h||d||p)if(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=!0,a.schedulePickSurface=d,a.scheduleSnapOrPick=p,a.update(),a.pickResult){if(a.pickResult.entity){var f=a.pickResult.entity.id;o._lastPickedEntityId!==f&&(void 0!==o._lastPickedEntityId&&u.fire("hoverOut",{entity:t.objects[o._lastPickedEntityId]},!0),u.fire("hoverEnter",a.pickResult,!0),o._lastPickedEntityId=f)}u.fire("hover",a.pickResult,!0),(a.pickResult.worldPos||a.pickResult.snappedWorldPos)&&u.fire("hoverSurface",a.pickResult,!0)}else void 0!==o._lastPickedEntityId&&(u.fire("hoverOut",{entity:t.objects[o._lastPickedEntityId]},!0),o._lastPickedEntityId=void 0),u.fire("hoverOff",{canvasPos:a.pickCursorPos},!0)}});h.addEventListener("mousemove",p),h.addEventListener("mousedown",this._canvasMouseDownHandler=function(e){if(1===e.which&&(A=!0),3===e.which&&(c=!0),1===e.which&&s.active&&s.pointerEnabled&&(r.mouseDownClientX=e.clientX,r.mouseDownClientY=e.clientY,r.mouseDownCursorX=r.pointerCanvasPos[0],r.mouseDownCursorY=r.pointerCanvasPos[1],!s.firstPerson&&s.followPointer&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickSurface=!0,a.update(),1===e.which))){var i=a.pickResult;i&&i.worldPos?(l.setPivotPos(i.worldPos),l.startPivot()):(s.smartPivot?l.setCanvasPivotPos(r.pointerCanvasPos):l.setPivotPos(t.camera.look),l.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){1===e.which&&(A=!1),3===e.which&&(c=!1),l.getPivoting()&&l.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(s.active&&s.pointerEnabled&&(1===e.which&&(l.hidePivot(),!(Math.abs(e.clientX-r.mouseDownClientX)>3||Math.abs(e.clientY-r.mouseDownClientY)>3)))){var n=u.hasSubs("picked"),A=u.hasSubs("pickedNothing"),c=u.hasSubs("pickedSurface"),h=u.hasSubs("doublePicked"),p=u.hasSubs("doublePickedSurface"),f=u.hasSubs("doublePickedNothing");if(!(s.doublePickFlyTo||h||p||f))return(n||A||c)&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=!0,a.schedulePickSurface=c,a.update(),a.pickResult?(u.fire("picked",a.pickResult,!0),a.pickedSurface&&u.fire("pickedSurface",a.pickResult,!0)):u.fire("pickedNothing",{canvasPos:r.pointerCanvasPos},!0)),void(o._clicks=0);if(o._clicks++,1===o._clicks){a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=s.doublePickFlyTo,a.schedulePickSurface=c,a.update();var v=a.pickResult,g=a.pickedSurface;o._timeout=setTimeout((function(){v?(u.fire("picked",v,!0),g&&(u.fire("pickedSurface",v,!0),!s.firstPerson&&s.followPointer&&(i.pivotController.setPivotPos(v.worldPos),i.pivotController.startPivot()&&i.pivotController.showPivot()))):u.fire("pickedNothing",{canvasPos:r.pointerCanvasPos},!0),o._clicks=0}),s.doubleClickTimeFrame)}else{if(null!==o._timeout&&(window.clearTimeout(o._timeout),o._timeout=null),a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=s.doublePickFlyTo||h||p,a.schedulePickSurface=a.schedulePickEntity&&p,a.update(),a.pickResult){if(u.fire("doublePicked",a.pickResult,!0),a.pickedSurface&&u.fire("doublePickedSurface",a.pickResult,!0),s.doublePickFlyTo&&(d(a.pickResult),!s.firstPerson&&s.followPointer)){var m=a.pickResult.entity.aabb,_=$.getAABB3Center(m);i.pivotController.setPivotPos(_),i.pivotController.startPivot()&&i.pivotController.showPivot()}}else if(u.fire("doublePickedNothing",{canvasPos:r.pointerCanvasPos},!0),s.doublePickFlyTo&&(d(),!s.firstPerson&&s.followPointer)){var y=t.aabb,b=$.getAABB3Center(y);i.pivotController.setPivotPos(b),i.pivotController.startPivot()&&i.pivotController.showPivot()}o._clicks=0}}},!1)}return C(e,[{key:"reset",value:function(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}},{key:"destroy",value:function(){var e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}]),e}(),jd=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o=t.input,a=[],l=t.canvas.canvas,u=!0;this._onSceneMouseMove=o.on("mousemove",(function(){u=!0})),this._onSceneKeyDown=o.on("keydown",(function(e){s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&r.mouseover&&(a[e]=!0,e===o.KEY_SHIFT&&(l.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(function(e){s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&(a[e]=!1,e===o.KEY_SHIFT&&(l.style.cursor=null),i.pivotController.getPivoting()&&i.pivotController.endPivot())})),this._onTick=t.on("tick",(function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&r.mouseover){var l=i.cameraControl,A=e.deltaTime/1e3;if(!s.planView){var c=l._isKeyDownForAction(l.ROTATE_Y_POS,a),h=l._isKeyDownForAction(l.ROTATE_Y_NEG,a),d=l._isKeyDownForAction(l.ROTATE_X_POS,a),p=l._isKeyDownForAction(l.ROTATE_X_NEG,a),f=A*s.keyboardRotationRate;(c||h||d||p)&&(!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),c?n.rotateDeltaY+=f:h&&(n.rotateDeltaY-=f),d?n.rotateDeltaX+=f:p&&(n.rotateDeltaX-=f),!s.firstPerson&&s.followPointer&&i.pivotController.startPivot())}if(!a[o.KEY_CTRL]&&!a[o.KEY_ALT]){var v=l._isKeyDownForAction(l.DOLLY_BACKWARDS,a),g=l._isKeyDownForAction(l.DOLLY_FORWARDS,a);if(v||g){var m=A*s.keyboardDollyRate;!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),g?n.dollyDelta-=m:v&&(n.dollyDelta+=m),u&&(r.followPointerDirty=!0,u=!1)}}var _=l._isKeyDownForAction(l.PAN_FORWARDS,a),y=l._isKeyDownForAction(l.PAN_BACKWARDS,a),b=l._isKeyDownForAction(l.PAN_LEFT,a),B=l._isKeyDownForAction(l.PAN_RIGHT,a),w=l._isKeyDownForAction(l.PAN_UP,a),x=l._isKeyDownForAction(l.PAN_DOWN,a),P=(a[o.KEY_ALT]?.3:1)*A*s.keyboardPanRate;(_||y||b||B||w||x)&&(!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),x?n.panDeltaY+=P:w&&(n.panDeltaY+=-P),B?n.panDeltaX+=-P:b&&(n.panDeltaX+=P),y?n.panDeltaZ+=P:_&&(n.panDeltaZ+=-P))}}))}return C(e,[{key:"reset",value:function(){}},{key:"destroy",value:function(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}]),e}(),Gd=$.vec3(),zd=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o=t.camera,a=i.pickController,l=i.pivotController,u=i.panController,A=1,c=1,h=null;this._onTick=t.on("tick",(function(){if(s.active&&s.pointerEnabled){var e="default";if(Math.abs(n.dollyDelta)<.001&&(n.dollyDelta=0),Math.abs(n.rotateDeltaX)<.001&&(n.rotateDeltaX=0),Math.abs(n.rotateDeltaY)<.001&&(n.rotateDeltaY=0),0===n.rotateDeltaX&&0===n.rotateDeltaY||(n.dollyDelta=0),s.followPointer){if(--A<=0&&(A=1,0!==n.dollyDelta)){if(0===n.rotateDeltaY&&0===n.rotateDeltaX&&s.followPointer&&r.followPointerDirty&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickSurface=!0,a.update(),a.pickResult&&a.pickResult.worldPos?h=a.pickResult.worldPos:(c=1,h=null),r.followPointerDirty=!1),h){var i=Math.abs($.lenVec3($.subVec3(h,t.camera.eye,Gd)));c=i/s.dollyProximityThreshold}cs.longTapRadius||Math.abs(g)>s.longTapRadius)&&(clearTimeout(r.longTouchTimeout),r.longTouchTimeout=null),s.planView){var m=t.camera;if("perspective"===m.projection){var _=Math.abs(t.camera.eyeLookDist)*Math.tan(m.perspective.fov/2*Math.PI/180);n.panDeltaX+=v*_/l*s.touchPanRate,n.panDeltaY+=g*_/l*s.touchPanRate}else n.panDeltaX+=.5*m.ortho.scale*(v/l)*s.touchPanRate,n.panDeltaY+=.5*m.ortho.scale*(g/l)*s.touchPanRate}else n.rotateDeltaY-=v/a*(1*s.dragRotationRate),n.rotateDeltaX+=g/l*(1.5*s.dragRotationRate)}else if(2===p){var y=d[0],b=d[1];Xd(y,u),Xd(b,A);var B=$.geometricMeanVec2(h[0],h[1]),w=$.geometricMeanVec2(u,A),x=$.vec2();$.subVec2(B,w,x);var P=x[0],C=x[1],M=t.camera,F=$.distVec2([y.pageX,y.pageY],[b.pageX,b.pageY]),E=($.distVec2(h[0],h[1])-F)*s.touchDollyRate;if(n.dollyDelta=E,Math.abs(E)<1)if("perspective"===M.projection){var k=o.pickResult?o.pickResult.worldPos:t.center,I=Math.abs($.lenVec3($.subVec3(k,t.camera.eye,[])))*Math.tan(M.perspective.fov/2*Math.PI/180);n.panDeltaX-=P*I/l*s.touchPanRate,n.panDeltaY-=C*I/l*s.touchPanRate}else n.panDeltaX-=.5*M.ortho.scale*(P/l)*s.touchPanRate,n.panDeltaY-=.5*M.ortho.scale*(C/l)*s.touchPanRate;r.pointerCanvasPos=w}for(var D=0;D-1&&t-c<150&&(h>-1&&c-h<325?(Yd(n[0],a.pickCursorPos),a.schedulePickEntity=!0,a.schedulePickSurface=o,a.update(),a.pickResult?(a.pickResult.touchInput=!0,l.fire("doublePicked",a.pickResult),a.pickedSurface&&l.fire("doublePickedSurface",a.pickResult),s.doublePickFlyTo&&p(a.pickResult)):(l.fire("doublePickedNothing"),s.doublePickFlyTo&&p()),h=-1):$.distVec2(u[0],A)<4&&(Yd(n[0],a.pickCursorPos),a.schedulePickEntity=!0,a.schedulePickSurface=o,a.update(),a.pickResult?(a.pickResult.touchInput=!0,l.fire("picked",a.pickResult),a.pickedSurface&&l.fire("pickedSurface",a.pickResult)):l.fire("pickedNothing"),h=t),c=-1),u.length=i.length;for(var d=0,f=i.length;d1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r)).PAN_LEFT=0,s.PAN_RIGHT=1,s.PAN_UP=2,s.PAN_DOWN=3,s.PAN_FORWARDS=4,s.PAN_BACKWARDS=5,s.ROTATE_X_POS=6,s.ROTATE_X_NEG=7,s.ROTATE_Y_POS=8,s.ROTATE_Y_NEG=9,s.DOLLY_FORWARDS=10,s.DOLLY_BACKWARDS=11,s.AXIS_VIEW_RIGHT=12,s.AXIS_VIEW_BACK=13,s.AXIS_VIEW_LEFT=14,s.AXIS_VIEW_FRONT=15,s.AXIS_VIEW_TOP=16,s.AXIS_VIEW_BOTTOM=17,s._keyMap={},s.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},s._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},s._states={pointerCanvasPos:$.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:$.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},s._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};var n=s.scene;return s._controllers={cameraControl:b(s),pickController:new Dd(b(s),s._configs),pivotController:new Id(n,s._configs),panController:new xd(n),cameraFlight:new zh(b(s),{duration:.5})},s._handlers=[new Wd(s.scene,s._controllers,s._configs,s._states,s._updates),new Jd(s.scene,s._controllers,s._configs,s._states,s._updates),new Td(s.scene,s._controllers,s._configs,s._states,s._updates),new Vd(s.scene,s._controllers,s._configs,s._states,s._updates),new Hd(s.scene,s._controllers,s._configs,s._states,s._updates),new Zd(s.scene,s._controllers,s._configs,s._states,s._updates),new jd(s.scene,s._controllers,s._configs,s._states,s._updates)],s._cameraUpdater=new zd(s.scene,s._controllers,s._configs,s._states,s._updates),s.navMode=r.navMode,r.planView&&(s.planView=r.planView),s.constrainVertical=r.constrainVertical,r.keyboardLayout?s.keyboardLayout=r.keyboardLayout:s.keyMap=r.keyMap,s.doublePickFlyTo=r.doublePickFlyTo,s.panRightClick=r.panRightClick,s.active=r.active,s.followPointer=r.followPointer,s.rotationInertia=r.rotationInertia,s.keyboardPanRate=r.keyboardPanRate,s.touchPanRate=r.touchPanRate,s.keyboardRotationRate=r.keyboardRotationRate,s.dragRotationRate=r.dragRotationRate,s.touchDollyRate=r.touchDollyRate,s.dollyInertia=r.dollyInertia,s.dollyProximityThreshold=r.dollyProximityThreshold,s.dollyMinSpeed=r.dollyMinSpeed,s.panInertia=r.panInertia,s.pointerEnabled=!0,s.keyboardDollyRate=r.keyboardDollyRate,s.mouseWheelDollyRate=r.mouseWheelDollyRate,s}return C(i,[{key:"keyMap",get:function(){return this._keyMap},set:function(e){if(e=e||"qwerty",le.isString(e)){var t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{var s=e;this._keyMap=s}}},{key:"_isKeyDownForAction",value:function(e,t){var i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(var s=0,r=i.length;s0&&void 0!==arguments[0]?arguments[0]:{};this._controllers.pivotController.enablePivotSphere(e)}},{key:"disablePivotSphere",value:function(){this._controllers.pivotController.disablePivotSphere()}},{key:"smartPivot",get:function(){return this._configs.smartPivot},set:function(e){this._configs.smartPivot=!1!==e}},{key:"doubleClickTimeFrame",get:function(){return this._configs.doubleClickTimeFrame},set:function(e){this._configs.doubleClickTimeFrame=null!=e?e:250}},{key:"destroy",value:function(){this._destroyHandlers(),this._destroyControllers(),this._cameraUpdater.destroy(),f(B(i.prototype),"destroy",this).call(this)}},{key:"_destroyHandlers",value:function(){for(var e=0,t=this._handlers.length;e1&&void 0!==arguments[1]?arguments[1]:{};if(this.finalized)throw"MetaScene already finalized - can't add more data";this._globalizeIDs(e,t);var i=this.metaScene,s=e.properties;if(e.propertySets)for(var r=0,n=e.propertySets.length;r0?rp(t):null,o=i&&i.length>0?rp(i):null;return function e(t){if(t){var i=!0;(o&&o[t.type]||n&&!n[t.type])&&(i=!1),i&&s.push(t.id);var r=t.children;if(r)for(var a=0,l=r.length;a>t;i.sort(jc);for(var a=new Int32Array(e.length),l=0,u=i.length;le[r+1]){var o=e[r];e[r]=e[r+1],e[r+1]=o}zc=new Int32Array(e),t.sort(Wc);for(var a=new Int32Array(e.length),l=0,u=t.length;l0)for(var s=i._meshes,r=0,n=s.length;r0)for(var o=this._meshes,a=0,l=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._dtxEnabled=s.scene.dtxEnabled&&!1!==r.dtxEnabled,s._enableVertexWelding=!1,s._enableIndexBucketing=!1,s._vboBatchingLayerScratchMemory=no(),s._textureTranscoder=r.textureTranscoder||Uc(s.scene.viewer),s._maxGeometryBatchSize=r.maxGeometryBatchSize,s._aabb=$.collapseAABB3(),s._aabbDirty=!0,s._quantizationRanges={},s._vboInstancingLayers={},s._vboBatchingLayers={},s._dtxLayers={},s._meshList=[],s.layerList=[],s._entityList=[],s._geometries={},s._dtxBuckets={},s._textures={},s._textureSets={},s._transforms={},s._meshes={},s._unusedMeshes={},s._entities={},s.renderFlags=new Wr,s.numGeometries=0,s.numPortions=0,s.numVisibleLayerPortions=0,s.numTransparentLayerPortions=0,s.numXRayedLayerPortions=0,s.numHighlightedLayerPortions=0,s.numSelectedLayerPortions=0,s.numEdgesLayerPortions=0,s.numPickableLayerPortions=0,s.numClippableLayerPortions=0,s.numCulledLayerPortions=0,s.numEntities=0,s._numTriangles=0,s._numLines=0,s._numPoints=0,s._edgeThreshold=r.edgeThreshold||10,s._origin=$.vec3(r.origin||[0,0,0]),s._position=$.vec3(r.position||[0,0,0]),s._rotation=$.vec3(r.rotation||[0,0,0]),s._quaternion=$.vec4(r.quaternion||[0,0,0,1]),s._conjugateQuaternion=$.vec4(r.quaternion||[0,0,0,1]),r.rotation&&$.eulerToQuaternion(s._rotation,"XYZ",s._quaternion),s._scale=$.vec3(r.scale||[1,1,1]),s._worldRotationMatrix=$.mat4(),s._worldRotationMatrixConjugate=$.mat4(),s._matrix=$.mat4(),s._matrixDirty=!0,s._rebuildMatrices(),s._worldNormalMatrix=$.mat4(),$.inverseMat4(s._matrix,s._worldNormalMatrix),$.transposeMat4(s._worldNormalMatrix),(r.matrix||r.position||r.rotation||r.scale||r.quaternion)&&(s._viewMatrix=$.mat4(),s._viewNormalMatrix=$.mat4(),s._viewMatrixDirty=!0,s._matrixNonIdentity=!0),s._opacity=1,s._colorize=[1,1,1],s._saoEnabled=!1!==r.saoEnabled,s._pbrEnabled=!1!==r.pbrEnabled,s._colorTextureEnabled=!1!==r.colorTextureEnabled,s._isModel=r.isModel,s._isModel&&s.scene._registerModel(b(s)),s._onCameraViewMatrix=s.scene.camera.on("matrix",(function(){s._viewMatrixDirty=!0})),s._meshesWithDirtyMatrices=[],s._numMeshesWithDirtyMatrices=0,s._onTick=s.scene.on("tick",(function(){for(;s._numMeshesWithDirtyMatrices>0;)s._meshesWithDirtyMatrices[--s._numMeshesWithDirtyMatrices]._updateMatrix()})),s._createDefaultTextureSet(),s.visible=r.visible,s.culled=r.culled,s.pickable=r.pickable,s.clippable=r.clippable,s.collidable=r.collidable,s.castsShadow=r.castsShadow,s.receivesShadow=r.receivesShadow,s.xrayed=r.xrayed,s.highlighted=r.highlighted,s.selected=r.selected,s.edges=r.edges,s.colorize=r.colorize,s.opacity=r.opacity,s.backfaces=r.backfaces,s}return C(i,[{key:"_meshMatrixDirty",value:function(e){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=e}},{key:"_createDefaultTextureSet",value:function(){var e=new Cc({id:"defaultColorTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})}),t=new Cc({id:"defaultMetalRoughTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]})}),i=new Cc({id:"defaultNormalsTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,0,0,0]})}),s=new Cc({id:"defaultEmissiveTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[0,0,0,1]})}),r=new Cc({id:"defaultOcclusionTexture",texture:new In({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]})});this._textures.defaultColorTexture=e,this._textures.defaultMetalRoughTexture=t,this._textures.defaultNormalsTexture=i,this._textures.defaultEmissiveTexture=s,this._textures.defaultOcclusionTexture=r,this._textureSets.defaultTextureSet=new Pc({id:"defaultTextureSet",model:this,colorTexture:e,metallicRoughnessTexture:t,normalsTexture:i,emissiveTexture:s,occlusionTexture:r})}},{key:"isPerformanceModel",get:function(){return!0}},{key:"transforms",get:function(){return this._transforms}},{key:"textures",get:function(){return this._textures}},{key:"textureSets",get:function(){return this._textureSets}},{key:"meshes",get:function(){return this._meshes}},{key:"objects",get:function(){return this._entities}},{key:"origin",get:function(){return this._origin}},{key:"position",get:function(){return this._position},set:function(e){this._position.set(e||[0,0,0]),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"rotation",get:function(){return this._rotation},set:function(e){this._rotation.set(e||[0,0,0]),$.eulerToQuaternion(this._rotation,"XYZ",this._quaternion),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"quaternion",get:function(){return this._quaternion},set:function(e){this._quaternion.set(e||[0,0,0,1]),$.quaternionToEuler(this._quaternion,"XYZ",this._rotation),this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"scale",get:function(){return this._scale},set:function(e){}},{key:"matrix",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._matrix},set:function(e){this._matrix.set(e||uh),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),$.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),$.translateMat4v(this._position,this._matrix),this._matrixDirty=!1,this._setWorldMatrixDirty(),this._sceneModelDirty(),this.glRedraw()}},{key:"rotationMatrix",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrix}},{key:"_rebuildMatrices",value:function(){this._matrixDirty&&($.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix),$.conjugateQuaternion(this._quaternion,this._conjugateQuaternion),$.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate),this._matrix.set(this._worldRotationMatrix),$.translateMat4v(this._position,this._matrix),this._matrixDirty=!1)}},{key:"rotationMatrixConjugate",get:function(){return this._matrixDirty&&this._rebuildMatrices(),this._worldRotationMatrixConjugate}},{key:"_setWorldMatrixDirty",value:function(){this._matrixDirty=!0,this._aabbDirty=!0}},{key:"_transformDirty",value:function(){this._matrixDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0}},{key:"_sceneModelDirty",value:function(){this.scene._aabbDirty=!0,this._aabbDirty=!0,this.scene._aabbDirty=!0,this._matrixDirty=!0;for(var e=0,t=this._entityList.length;e0},set:function(e){e=!1!==e,this._visible=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._xrayed=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._highlighted=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._selected=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!!e,this._edges=e;for(var t=0,i=this._entityList.length;t0},set:function(e){e=!1!==e,this._pickable=e;for(var t=0,i=this._entityList.length;t0)e.colorsCompressed=new Uint8Array(e.colorsCompressed);else if(e.colors&&e.colors.length>0){for(var l=e.colors,u=new Uint8Array(l.length),A=0,c=l.length;A>24&255,r=i>>16&255,n=i>>8&255,o=255&i;switch(e.pickColor=new Uint8Array([o,n,r,s]),e.solid="solid"===e.primitive,t.origin=$.vec3(e.origin),e.type){case 2:t.layer=this._getDTXLayer(e),t.aabb=e.aabb;break;case 1:t.layer=this._getVBOBatchingLayer(e),t.aabb=e.aabb;break;case 0:t.layer=this._getVBOInstancingLayer(e),t.aabb=e.aabb}return e.transform&&(e.meshMatrix=e.transform.worldMatrix),t.portionId=t.layer.createPortion(t,e),this._meshes[e.id]=t,this._unusedMeshes[e.id]=t,this._meshList.push(t),t}},{key:"_getNumPrimitives",value:function(e){var t=0;switch(e.geometry?e.geometry.primitive:e.primitive){case"triangles":case"solid":case"surface":switch(e.type){case 2:for(var i=0,s=e.buckets.length;i>>0).toString(16)}},{key:"_getVBOInstancingLayer",value:function(e){var t=this,i=e.origin,s=e.textureSetId||"-",r=e.geometryId,n="".concat(Math.round(i[0]),".").concat(Math.round(i[1]),".").concat(Math.round(i[2]),".").concat(s,".").concat(r),o=this._vboInstancingLayers[n];if(o)return o;for(var a=e.textureSet,l=e.geometry;!o;)switch(l.primitive){case"triangles":case"surface":o=new rl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!1});break;case"solid":o=new rl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0,solid:!0});break;case"lines":o=new jl({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0});break;case"points":o=new Lu({model:t,textureSet:a,geometry:l,origin:i,layerIndex:0})}return this._vboInstancingLayers[n]=o,this.layerList.push(o),o}},{key:"createEntity",value:function(e){if(void 0===e.id?e.id=$.createUUID():this.scene.components[e.id]&&(this.error("Scene already has a Component with this ID: ".concat(e.id," - will assign random ID")),e.id=$.createUUID()),void 0!==e.meshIds){var t=0;this._visible&&!1!==e.visible&&(t|=Qe),this._pickable&&!1!==e.pickable&&(t|=He),this._culled&&!1!==e.culled&&(t|=Ve),this._clippable&&!1!==e.clippable&&(t|=je),this._collidable&&!1!==e.collidable&&(t|=Ge),this._edges&&!1!==e.edges&&(t|=Xe),this._xrayed&&!1!==e.xrayed&&(t|=ze),this._highlighted&&!1!==e.highlighted&&(t|=We),this._selected&&!1!==e.selected&&(t|=Ke),e.flags=t,this._createEntity(e)}else this.error("Config missing: meshIds")}},{key:"_createEntity",value:function(e){for(var t=[],i=0,s=e.meshIds.length;it.sortId?1:0}));for(var o=0,a=this.layerList.length;o0&&0===this.renderFlags.numVisibleLayers?this.renderFlags.culled=!0:this._updateRenderFlags()}},{key:"_updateRenderFlagsVisibleLayers",value:function(){var e=this.renderFlags;e.numLayers=this.layerList.length,e.numVisibleLayers=0;for(var t=0,i=this.layerList.length;t0){var t="".concat(this.id,"-dummyEntityForUnusedMeshes");this.warn('Creating dummy SceneModelEntity "'.concat(t,'" for unused SceneMeshes: [').concat(e.join(","),"]")),this.createEntity({id:t,meshIds:e,isObject:!0})}this._unusedMeshes={}}},{key:"_getActiveSectionPlanesForLayer",value:function(e){var t=this.renderFlags,i=this.scene._sectionPlanesState.sectionPlanes,s=i.length,r=e.layerIndex*s;if(s>0)for(var n=0;n0&&(e.colorTransparent=!0),this.numXRayedLayerPortions>0){var t=this.scene.xrayMaterial._state;t.fill&&(t.fillAlpha<1?e.xrayedSilhouetteTransparent=!0:e.xrayedSilhouetteOpaque=!0),t.edges&&(t.edgeAlpha<1?e.xrayedEdgesTransparent=!0:e.xrayedEdgesOpaque=!0)}if(this.numEdgesLayerPortions>0)this.scene.edgeMaterial._state.edges&&(e.edgesOpaque=this.numTransparentLayerPortions0&&(e.edgesTransparent=!0));if(this.numSelectedLayerPortions>0){var i=this.scene.selectedMaterial._state;i.fill&&(i.fillAlpha<1?e.selectedSilhouetteTransparent=!0:e.selectedSilhouetteOpaque=!0),i.edges&&(i.edgeAlpha<1?e.selectedEdgesTransparent=!0:e.selectedEdgesOpaque=!0)}if(this.numHighlightedLayerPortions>0){var s=this.scene.highlightMaterial._state;s.fill&&(s.fillAlpha<1?e.highlightedSilhouetteTransparent=!0:e.highlightedSilhouetteOpaque=!0),s.edges&&(s.edgeAlpha<1?e.highlightedEdgesTransparent=!0:e.highlightedEdgesOpaque=!0)}}}},{key:"drawColorOpaque",value:function(e){for(var t=this.renderFlags,i=0,s=t.visibleLayers.length;i2&&void 0!==arguments[2]&&arguments[2],s=e.positionsCompressed||[],r=Gc(e.indices||[],t),n=Kc(e.edgeIndices||[]);function o(e,t){if(e>t){var i=e;e=t,t=i}function s(i,s){return i!==e?e-i:s!==t?t-s:0}for(var r=0,o=(n.length>>1)-1;r<=o;){var a=o+r>>1,l=s(n[2*a],n[2*a+1]);if(l>0)r=a+1;else{if(!(l<0))return a;o=a-1}}return-r-1}var a=new Int32Array(n.length/2);a.fill(0);var l=s.length/3;if(l>8*(1<h.maxNumPositions&&(h=c()),h.bucketNumber>8)return[e];-1===u[v]&&(u[v]=h.numPositions++,h.positionsCompressed.push(s[3*v]),h.positionsCompressed.push(s[3*v+1]),h.positionsCompressed.push(s[3*v+2])),-1===u[g]&&(u[g]=h.numPositions++,h.positionsCompressed.push(s[3*g]),h.positionsCompressed.push(s[3*g+1]),h.positionsCompressed.push(s[3*g+2])),-1===u[m]&&(u[m]=h.numPositions++,h.positionsCompressed.push(s[3*m]),h.positionsCompressed.push(s[3*m+1]),h.positionsCompressed.push(s[3*m+2])),h.indices.push(u[v]),h.indices.push(u[g]),h.indices.push(u[m]);var _=void 0;(_=o(v,g))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]])),(_=o(v,m))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]])),(_=o(g,m))>=0&&0===a[_]&&(a[_]=1,h.edgeIndices.push(u[n[2*_]]),h.edgeIndices.push(u[n[2*_+1]]))}var y=t/8*2,b=t/8,B=2*s.length+(r.length+n.length)*y,w=0;return s.length,A.forEach((function(e){w+=2*e.positionsCompressed.length+(e.indices.length+e.edgeIndices.length)*b,e.positionsCompressed.length})),w>B?[e]:(i&&Xc(A,e),A)}({positionsCompressed:s,indices:r,edgeIndices:n},s.length/3>65536?16:8):o=[{positionsCompressed:s,indices:r,edgeIndices:n}];return o}var dh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e,r))._positions=r.positions||[],r.indices)s._indices=r.indices;else{s._indices=[];for(var n=0,o=s._positions.length/3-1;n1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"BCFViewpoints",e,r)).originatingSystem=r.originatingSystem||"xeokit.io",s.authoringTool=r.authoringTool||"xeokit.io",s}return C(i,[{key:"getViewpoint",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.viewer.scene,s=i.camera,r=i.realWorldOffset,n=!0===t.reverseClippingPlanes,o={},a=$.normalizeVec3($.subVec3(s.look,s.eye,$.vec3())),l=s.eye,u=s.up;s.yUp&&(a=bh(a),l=bh(l),u=bh(u));var A=_h($.addVec3(l,r));"ortho"===s.projection?o.orthogonal_camera={camera_view_point:A,camera_direction:_h(a),camera_up_vector:_h(u),view_to_world_scale:s.ortho.scale}:o.perspective_camera={camera_view_point:A,camera_direction:_h(a),camera_up_vector:_h(u),field_of_view:s.perspective.fov};var c=i.sectionPlanes;for(var d in c)if(c.hasOwnProperty(d)){var p=c[d];if(!p.active)continue;var f=p.pos,v=void 0;v=n?$.negateVec3(p.dir,$.vec3()):p.dir,s.yUp&&(f=bh(f),v=bh(v)),$.addVec3(f,r),f=_h(f),v=_h(v),o.clipping_planes||(o.clipping_planes=[]),o.clipping_planes.push({location:f,direction:v})}var g=i.lineSets;for(var m in g)if(g.hasOwnProperty(m)){var _=g[m];o.lines||(o.lines=[]);for(var y=_.positions,b=_.indices,B=0,w=b.length/2;B1&&void 0!==arguments[1]?arguments[1]:{};if(e){var s=this.viewer,r=s.scene,n=r.camera,o=!1!==i.rayCast,a=!1!==i.immediate,l=!1!==i.reset,u=r.realWorldOffset,A=!0===i.reverseClippingPlanes;if(r.clearSectionPlanes(),e.clipping_planes&&e.clipping_planes.length>0&&e.clipping_planes.forEach((function(e){var t=yh(e.location,ph),i=yh(e.direction,ph);A&&$.negateVec3(i),$.subVec3(t,u),n.yUp&&(t=Bh(t),i=Bh(i)),new cn(r,{pos:t,dir:i})})),r.clearLines(),e.lines&&e.lines.length>0){var c=[],h=[],d=0;e.lines.forEach((function(e){e.start_point&&e.end_point&&(c.push(e.start_point.x),c.push(e.start_point.y),c.push(e.start_point.z),c.push(e.end_point.x),c.push(e.end_point.y),c.push(e.end_point.z),h.push(d++),h.push(d++))})),new dh(r,{positions:c,indices:h,clippable:!1,collidable:!0})}if(r.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){var t=e.bitmap_type||"jpg",i=e.bitmap_data,s=yh(e.location,fh),o=yh(e.normal,vh),a=yh(e.up,gh),l=e.height||1;t&&i&&s&&o&&a&&(n.yUp&&(s=Bh(s),o=Bh(o),a=Bh(a)),new qn(r,{src:i,type:t,pos:s,normal:o,up:a,clippable:!1,collidable:!0,height:l}))})),l&&(r.setObjectsXRayed(r.xrayedObjectIds,!1),r.setObjectsHighlighted(r.highlightedObjectIds,!1),r.setObjectsSelected(r.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(r.setObjectsVisible(r.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.visible=!1}))}))):(r.setObjectsVisible(r.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.visible=!0}))})));var p=e.components.visibility.view_setup_hints;p&&(!1===p.spaces_visible&&r.setObjectsVisible(s.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==p.spaces_translucent&&r.setObjectsXRayed(s.metaScene.getObjectIDsByType("IfcSpace"),!0),p.space_boundaries_visible,!1===p.openings_visible&&r.setObjectsVisible(s.metaScene.getObjectIDsByType("IfcOpening"),!0),p.space_boundaries_translucent,void 0!==p.openings_translucent&&r.setObjectsXRayed(s.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(r.setObjectsSelected(r.selectedObjectIds,!1),e.components.selection.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.selected=!0}))}))),e.components.translucency&&(r.setObjectsXRayed(r.xrayedObjectIds,!1),e.components.translucency.forEach((function(e){return t._withBCFComponent(i,e,(function(e){return e.xrayed=!0}))}))),e.components.coloring&&e.components.coloring.forEach((function(e){var s=e.color,r=0,n=!1;8===s.length&&((r=parseInt(s.substring(0,2),16)/256)<=1&&r>=.95&&(r=1),s=s.substring(2),n=!0);var o=[parseInt(s.substring(0,2),16)/256,parseInt(s.substring(2,4),16)/256,parseInt(s.substring(4,6),16)/256];e.components.map((function(e){return t._withBCFComponent(i,e,(function(e){e.colorize=o,n&&(e.opacity=r)}))}))}))}if(e.perspective_camera||e.orthogonal_camera){var f,v,g,m;if(e.perspective_camera?(f=yh(e.perspective_camera.camera_view_point,ph),v=yh(e.perspective_camera.camera_direction,ph),g=yh(e.perspective_camera.camera_up_vector,ph),n.perspective.fov=e.perspective_camera.field_of_view,m="perspective"):(f=yh(e.orthogonal_camera.camera_view_point,ph),v=yh(e.orthogonal_camera.camera_direction,ph),g=yh(e.orthogonal_camera.camera_up_vector,ph),n.ortho.scale=e.orthogonal_camera.view_to_world_scale,m="ortho"),$.subVec3(f,u),n.yUp&&(f=Bh(f),v=Bh(v),g=Bh(g)),o){var _=r.pick({pickSurface:!0,origin:f,direction:v});v=_?_.worldPos:$.addVec3(f,v,ph)}else v=$.addVec3(f,v,ph);a?(n.eye=f,n.look=v,n.up=g,n.projection=m):s.cameraFlight.flyTo({eye:f,look:v,up:g,duration:i.duration,projection:m})}}}},{key:"_withBCFComponent",value:function(e,t,i){var s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){var n=t.authoring_tool_id,o=r.objects[n];if(o)return void i(o);if(e.updateCompositeObjects)if(s.metaScene.metaObjects[n])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}if(t.ifc_guid){var a=t.ifc_guid,l=r.objects[a];if(l)return void i(l);if(e.updateCompositeObjects)if(s.metaScene.metaObjects[a])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(a),i);Object.keys(r.models).forEach((function(t){var n=$.globalizeObjectId(t,a),o=r.objects[n];o?i(o):e.updateCompositeObjects&&s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}))}}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}}]),i}();function _h(e){return{x:e[0],y:e[1],z:e[2]}}function yh(e,t){return(t=new Float64Array(3))[0]=e.x,t[1]=e.y,t[2]=e.z,t}function bh(e){return new Float64Array([e[0],-e[2],e[1]])}function Bh(e){return new Float64Array([e[0],e[2],-e[1]])}function wh(e){var t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0")}var xh=$.vec3(),Ph=function(e,t,i,s){var r=e-i,n=t-s;return Math.sqrt(r*r+n*n)},Ch=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(s=t.call(this,e.viewer.scene,r)).plugin=e,s._container=r.container,!s._container)throw"config missing: container";s._eventSubs={};var n=s.plugin.viewer.scene;s._originMarker=new et(n,r.origin),s._targetMarker=new et(n,r.target),s._originWorld=$.vec3(),s._targetWorld=$.vec3(),s._wp=new Float64Array(24),s._vp=new Float64Array(24),s._pp=new Float64Array(24),s._cp=new Float64Array(8),s._xAxisLabelCulled=!1,s._yAxisLabelCulled=!1,s._zAxisLabelCulled=!1,s._color=r.color||s.plugin.defaultColor;var o=r.onMouseOver?function(e){r.onMouseOver(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",e))}:null,a=r.onMouseLeave?function(e){r.onMouseLeave(e,b(s)),s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",e))}:null,l=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",e))},u=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",e))},A=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",e))},c=r.onContextMenu?function(e){r.onContextMenu(e,b(s))}:null,h=function(e){s.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",e))};return s._originDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._targetDot=new it(s._container,{fillColor:s._color,zIndex:void 0!==e.zIndex?e.zIndex+2:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._lengthWire=new tt(s._container,{color:s._color,thickness:2,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._xAxisWire=new tt(s._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._yAxisWire=new tt(s._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._zAxisWire=new tt(s._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:void 0!==e.zIndex?e.zIndex+1:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._lengthLabel=new st(s._container,{fillColor:s._color,prefix:"",text:"",zIndex:void 0!==e.zIndex?e.zIndex+4:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._xAxisLabel=new st(s._container,{fillColor:"red",prefix:"X",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._yAxisLabel=new st(s._container,{fillColor:"green",prefix:"Y",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._zAxisLabel=new st(s._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:void 0!==e.zIndex?e.zIndex+3:void 0,onMouseOver:o,onMouseLeave:a,onMouseWheel:h,onMouseDown:l,onMouseUp:u,onMouseMove:A,onContextMenu:c}),s._wpDirty=!1,s._vpDirty=!1,s._cpDirty=!1,s._sectionPlanesDirty=!0,s._visible=!1,s._originVisible=!1,s._targetVisible=!1,s._wireVisible=!1,s._axisVisible=!1,s._xAxisVisible=!1,s._yAxisVisible=!1,s._zAxisVisible=!1,s._axisEnabled=!0,s._labelsVisible=!1,s._labelsOnWires=!1,s._clickable=!1,s._originMarker.on("worldPos",(function(e){s._originWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._targetMarker.on("worldPos",(function(e){s._targetWorld.set(e||[0,0,0]),s._wpDirty=!0,s._needUpdate(0)})),s._onViewMatrix=n.camera.on("viewMatrix",(function(){s._vpDirty=!0,s._needUpdate(0)})),s._onProjMatrix=n.camera.on("projMatrix",(function(){s._cpDirty=!0,s._needUpdate()})),s._onCanvasBoundary=n.canvas.on("boundary",(function(){s._cpDirty=!0,s._needUpdate(0)})),s._onMetricsUnits=n.metrics.on("units",(function(){s._cpDirty=!0,s._needUpdate()})),s._onMetricsScale=n.metrics.on("scale",(function(){s._cpDirty=!0,s._needUpdate()})),s._onMetricsOrigin=n.metrics.on("origin",(function(){s._cpDirty=!0,s._needUpdate()})),s._onSectionPlaneUpdated=n.on("sectionPlaneUpdated",(function(){s._sectionPlanesDirty=!0,s._needUpdate()})),s.approximate=r.approximate,s.visible=r.visible,s.originVisible=r.originVisible,s.targetVisible=r.targetVisible,s.wireVisible=r.wireVisible,s.axisVisible=r.axisVisible,s.xAxisVisible=r.xAxisVisible,s.yAxisVisible=r.yAxisVisible,s.zAxisVisible=r.zAxisVisible,s.labelsVisible=r.labelsVisible,s.labelsOnWires=r.labelsOnWires,s}return C(i,[{key:"_update",value:function(){if(this._visible){var e=this.plugin.viewer.scene;if(this._wpDirty&&(this._wp[0]=this._originWorld[0],this._wp[1]=this._originWorld[1],this._wp[2]=this._originWorld[2],this._wp[3]=1,this._wp[4]=this._targetWorld[0],this._wp[5]=this._originWorld[1],this._wp[6]=this._originWorld[2],this._wp[7]=1,this._wp[8]=this._targetWorld[0],this._wp[9]=this._targetWorld[1],this._wp[10]=this._originWorld[2],this._wp[11]=1,this._wp[12]=this._targetWorld[0],this._wp[13]=this._targetWorld[1],this._wp[14]=this._targetWorld[2],this._wp[15]=1,this._wpDirty=!1,this._vpDirty=!0),this._vpDirty&&($.transformPositions4(e.camera.viewMatrix,this._wp,this._vp),this._vp[3]=1,this._vp[7]=1,this._vp[11]=1,this._vp[15]=1,this._vpDirty=!1,this._cpDirty=!0),this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld))return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setCulled(!0),this._yAxisWire.setCulled(!0),this._zAxisWire.setCulled(!0),this._lengthWire.setCulled(!0),this._originDot.setCulled(!0),void this._targetDot.setCulled(!0);this._xAxisLabel.setCulled(!1),this._yAxisLabel.setCulled(!1),this._zAxisLabel.setCulled(!1),this._lengthLabel.setCulled(!1),this._xAxisWire.setCulled(!1),this._yAxisWire.setCulled(!1),this._zAxisWire.setCulled(!1),this._lengthWire.setCulled(!1),this._originDot.setCulled(!1),this._targetDot.setCulled(!1),this._sectionPlanesDirty=!0}var t=this._originMarker.viewPos[2],i=this._targetMarker.viewPos[2];if(t>-.3||i>-.3)return this._xAxisLabel.setCulled(!0),this._yAxisLabel.setCulled(!0),this._zAxisLabel.setCulled(!0),this._lengthLabel.setCulled(!0),this._xAxisWire.setVisible(!1),this._yAxisWire.setVisible(!1),this._zAxisWire.setVisible(!1),this._lengthWire.setVisible(!1),this._originDot.setVisible(!1),void this._targetDot.setVisible(!1);if(this._cpDirty){$.transformPositions4(e.camera.project.matrix,this._vp,this._pp);for(var s=this._pp,r=this._cp,n=e.canvas.canvas.getBoundingClientRect(),o=this._container.getBoundingClientRect(),a=n.top-o.top,l=n.left-o.left,u=e.canvas.boundary,A=u[2],c=u[3],h=0,d=this.plugin.viewer.scene.metrics,p=d.scale,f=d.units,v=d.unitsInfo[f].abbrev,g=0,m=s.length;g1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e.viewer.scene))._canvasToPagePos=r.canvasToPagePos,s.pointerLens=r.pointerLens,s._active=!1,s._currentDistanceMeasurement=null,s._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null},s._initMarkerDiv(),s._onCameraControlHoverSnapOrSurface=null,s._onCameraControlHoverSnapOrSurfaceOff=null,s._onMouseDown=null,s._onMouseUp=null,s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._snapping=!1!==r.snapping,s._mouseState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_initMarkerDiv",value:function(){var e=document.createElement("div");e.setAttribute("id","myMarkerDiv");var t=this.scene.canvas.canvas;t.parentNode.insertBefore(e,t),e.style.background="black",e.style.border="2px solid blue",e.style.borderRadius="10px",e.style.width="5px",e.style.height="5px",e.style.top="-200px",e.style.left="-200px",e.style.margin="0 0",e.style.zIndex="100",e.style.position="absolute",e.style.pointerEvents="none",this._markerDiv=e}},{key:"_destroyMarkerDiv",value:function(){if(this._markerDiv){var e=document.getElementById("myMarkerDiv");e.parentNode.removeChild(e),this._markerDiv=null}}},{key:"_attachPlugin",value:function(e){this.distanceMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){this._markerDiv||this._initMarkerDiv(),this.fire("activated",!0);var t=this.distanceMeasurementsPlugin,i=this.scene,s=t.viewer.cameraControl,r=i.canvas.canvas;i.input;var n,o,a=!1,l=$.vec3(),u=$.vec2(),A=null;this._mouseState=0;var c=function e(t){return t.offsetTop+(t.offsetParent&&t.offsetParent!==r.parentNode&&e(t.offsetParent))},h=function e(t){return t.offsetLeft+(t.offsetParent&&t.offsetParent!==r.parentNode&&e(t.offsetParent))},d=$.vec2();this._onCameraControlHoverSnapOrSurface=s.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",(function(t){var i=t.snappedCanvasPos||t.canvasPos;a=!0,l.set(t.worldPos),u.set(t.canvasPos),0===e._mouseState?(e._canvasToPagePos?(e._canvasToPagePos(r,i,d),e._markerDiv.style.left="".concat(d[0]-5,"px"),e._markerDiv.style.top="".concat(d[1]-5,"px")):(e._markerDiv.style.left="".concat(h(r)+i[0]-5,"px"),e._markerDiv.style.top="".concat(c(r)+i[1]-5,"px")),e._markerDiv.style.background="pink",t.snappedToVertex||t.snappedToEdge?(e.pointerLens&&(e.pointerLens.visible=!0,e.pointerLens.canvasPos=t.canvasPos,e.pointerLens.snappedCanvasPos=t.snappedCanvasPos||t.canvasPos,e.pointerLens.snapped=!0),e._markerDiv.style.background="greenyellow",e._markerDiv.style.border="2px solid green"):(e.pointerLens&&(e.pointerLens.visible=!0,e.pointerLens.canvasPos=t.canvasPos,e.pointerLens.snappedCanvasPos=t.canvasPos,e.pointerLens.snapped=!1),e._markerDiv.style.background="pink",e._markerDiv.style.border="2px solid red"),A=t.entity):(e._markerDiv.style.left="-10000px",e._markerDiv.style.top="-10000px"),r.style.cursor="pointer",e._currentDistanceMeasurement&&(e._currentDistanceMeasurement.wireVisible=e._currentDistanceMeasurementInitState.wireVisible,e._currentDistanceMeasurement.axisVisible=e._currentDistanceMeasurementInitState.axisVisible&&e.distanceMeasurementsPlugin.defaultAxisVisible,e._currentDistanceMeasurement.xAxisVisible=e._currentDistanceMeasurementInitState.xAxisVisible&&e.distanceMeasurementsPlugin.defaultXAxisVisible,e._currentDistanceMeasurement.yAxisVisible=e._currentDistanceMeasurementInitState.yAxisVisible&&e.distanceMeasurementsPlugin.defaultYAxisVisible,e._currentDistanceMeasurement.zAxisVisible=e._currentDistanceMeasurementInitState.zAxisVisible&&e.distanceMeasurementsPlugin.defaultZAxisVisible,e._currentDistanceMeasurement.targetVisible=e._currentDistanceMeasurementInitState.targetVisible,e._currentDistanceMeasurement.target.worldPos=l.slice(),e._markerDiv.style.left="-10000px",e._markerDiv.style.top="-10000px")})),r.addEventListener("mousedown",this._onMouseDown=function(e){1===e.which&&(n=e.clientX,o=e.clientY)}),r.addEventListener("mouseup",this._onMouseUp=function(i){1===i.which&&(i.clientX>n+20||i.clientXo+20||i.clientY1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,"DistanceMeasurements",e))._pointerLens=r.pointerLens,s._container=r.container||document.body,s._defaultControl=null,s._measurements={},s.labelMinAxisLength=r.labelMinAxisLength,s.defaultVisible=!1!==r.defaultVisible,s.defaultOriginVisible=!1!==r.defaultOriginVisible,s.defaultTargetVisible=!1!==r.defaultTargetVisible,s.defaultWireVisible=!1!==r.defaultWireVisible,s.defaultLabelsVisible=!1!==r.defaultLabelsVisible,s.defaultAxisVisible=!1!==r.defaultAxisVisible,s.defaultXAxisVisible=!1!==r.defaultXAxisVisible,s.defaultYAxisVisible=!1!==r.defaultYAxisVisible,s.defaultZAxisVisible=!1!==r.defaultZAxisVisible,s.defaultColor=void 0!==r.defaultColor?r.defaultColor:"#00BBFF",s.zIndex=r.zIndex||1e4,s.defaultLabelsOnWires=!1!==r.defaultLabelsOnWires,s._onMouseOver=function(e,t){s.fire("mouseOver",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s._onMouseLeave=function(e,t){s.fire("mouseLeave",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s._onContextMenu=function(e,t){s.fire("contextMenu",{plugin:b(s),distanceMeasurement:t,measurement:t,event:e})},s}return C(i,[{key:"getContainerElement",value:function(){return this._container}},{key:"send",value:function(e,t){}},{key:"pointerLens",get:function(){return this._pointerLens}},{key:"control",get:function(){return this._defaultControl||(this._defaultControl=new Fh(this,{})),this._defaultControl}},{key:"measurements",get:function(){return this._measurements}},{key:"labelMinAxisLength",get:function(){return this._labelMinAxisLength},set:function(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}},{key:"createMeasurement",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=t.origin,s=t.target,r=new Ch(this,{id:t.id,plugin:this,container:this._container,origin:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:t.visible,wireVisible:t.wireVisible,axisVisible:!1!==t.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==t.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==t.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==t.zAxisVisible&&!1!==this.defaultZAxisVisible,labelsVisible:!1!==t.labelsVisible&&!1!==this.defaultLabelsVisible,originVisible:t.originVisible,targetVisible:t.targetVisible,color:t.color,labelsOnWires:!1!==t.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(function(){delete e._measurements[r.id]})),this.fire("measurementCreated",r),r}},{key:"destroyMeasurement",value:function(e){var t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}},{key:"setLabelsShown",value:function(e){for(var t=0,i=Object.entries(this.measurements);t1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e.viewer.scene)).pointerLens=r.pointerLens,s.pointerCircle=new De(e.viewer),s._active=!1;var n=document.createElement("div"),o=s.scene.canvas.canvas;return o.parentNode.insertBefore(n,o),n.style.background="black",n.style.border="2px solid blue",n.style.borderRadius="10px",n.style.width="5px",n.style.height="5px",n.style.margin="-200px -200px",n.style.zIndex="100",n.style.position="absolute",n.style.pointerEvents="none",s.markerDiv=n,s._currentDistanceMeasurement=null,s._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null},s._onCanvasTouchStart=null,s._onCanvasTouchEnd=null,s._longTouchTimeoutMs=300,s._snapping=!1!==r.snapping,s._touchState=0,s._attachPlugin(e,r),s}return C(i,[{key:"_attachPlugin",value:function(e){this.distanceMeasurementsPlugin=e,this.plugin=e}},{key:"active",get:function(){return this._active}},{key:"snapping",get:function(){return this._snapping},set:function(e){e!==this._snapping?(this._snapping=e,this.deactivate(),this.activate()):this._snapping=e}},{key:"activate",value:function(){var e=this;if(!this._active){var t=this.plugin,i=this.scene,s=i.canvas.canvas;t.pointerLens;var r=$.vec3(),n=20,o=null;this._touchState=0;var a=$.vec2(),l=$.vec2(),u=$.vec2(),A=null,c=function(){e.plugin.viewer.cameraControl.active=!1},h=function(){e.plugin.viewer.cameraControl.active=!0};s.addEventListener("touchstart",this._onCanvasTouchStart=function(s){var u=s.touches.length;if(1===u){var d=s.touches[0],p=d.clientX,f=d.clientY;switch(a.set([p,f]),l.set([p,f]),e._touchState){case 0:if(1!==u&&null!==o)return o&&(clearTimeout(o),o=null),e._currentDistanceMeasurement&&(e._currentDistanceMeasurement.destroy(),e._currentDistanceMeasurement=null),h(),void(e._touchState=0);var v=i.pick({canvasPos:l,snapping:e._snapping,snapToEdge:e._snapping});if(v&&v.snapped)r.set(v.worldPos),e.pointerCircle.start(v.snappedCanvasPos);else{var g=i.pick({canvasPos:l,pickSurface:!0});if(!g||!g.worldPos)return;r.set(g.worldPos),e.pointerCircle.start(g.canvasPos)}o=setTimeout((function(){1!==u||l[0]>a[0]+n||l[0]a[1]+n||l[1]a[0]+n||l[0]a[1]+n||l[1]a[0]+n||da[1]+n||pa[0]+n||da[1]+n||p1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,"FastNav",e))._hideColorTexture=!1!==r.hideColorTexture,s._hidePBR=!1!==r.hidePBR,s._hideSAO=!1!==r.hideSAO,s._hideEdges=!1!==r.hideEdges,s._hideTransparentObjects=!!r.hideTransparentObjects,s._scaleCanvasResolution=!!r.scaleCanvasResolution,s._defaultScaleCanvasResolutionFactor=r.defaultScaleCanvasResolutionFactor||1,s._scaleCanvasResolutionFactor=r.scaleCanvasResolutionFactor||.6,s._delayBeforeRestore=!1!==r.delayBeforeRestore,s._delayBeforeRestoreSeconds=r.delayBeforeRestoreSeconds||.5;var n=1e3*s._delayBeforeRestoreSeconds,o=!1,a=function(){n=1e3*s._delayBeforeRestoreSeconds,o||(e.scene._renderer.setColorTextureEnabled(!s._hideColorTexture),e.scene._renderer.setPBREnabled(!s._hidePBR),e.scene._renderer.setSAOEnabled(!s._hideSAO),e.scene._renderer.setTransparentEnabled(!s._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!s._hideEdges),s._scaleCanvasResolution?e.scene.canvas.resolutionScale=s._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=s._defaultScaleCanvasResolutionFactor,o=!0)},l=function(){e.scene.canvas.resolutionScale=s._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),o=!1};s._onCanvasBoundary=e.scene.canvas.on("boundary",a),s._onCameraMatrix=e.scene.camera.on("matrix",a),s._onSceneTick=e.scene.on("tick",(function(e){o&&(n-=e.deltaTime,(!s._delayBeforeRestore||n<=0)&&l())}));var u=!1;return s._onSceneMouseDown=e.scene.input.on("mousedown",(function(){u=!0})),s._onSceneMouseUp=e.scene.input.on("mouseup",(function(){u=!1})),s._onSceneMouseMove=e.scene.input.on("mousemove",(function(){u&&a()})),s}return C(i,[{key:"hideColorTexture",get:function(){return this._hideColorTexture},set:function(e){this._hideColorTexture=e}},{key:"hidePBR",get:function(){return this._hidePBR},set:function(e){this._hidePBR=e}},{key:"hideSAO",get:function(){return this._hideSAO},set:function(e){this._hideSAO=e}},{key:"hideEdges",get:function(){return this._hideEdges},set:function(e){this._hideEdges=e}},{key:"hideTransparentObjects",get:function(){return this._hideTransparentObjects},set:function(e){this._hideTransparentObjects=!1!==e}},{key:"scaleCanvasResolution",get:function(){return this._scaleCanvasResolution},set:function(e){this._scaleCanvasResolution=e}},{key:"defaultScaleCanvasResolutionFactor",get:function(){return this._defaultScaleCanvasResolutionFactor},set:function(e){this._defaultScaleCanvasResolutionFactor=e||1}},{key:"scaleCanvasResolutionFactor",get:function(){return this._scaleCanvasResolutionFactor},set:function(e){this._scaleCanvasResolutionFactor=e||.6}},{key:"delayBeforeRestore",get:function(){return this._delayBeforeRestore},set:function(e){this._delayBeforeRestore=e}},{key:"delayBeforeRestoreSeconds",get:function(){return this._delayBeforeRestoreSeconds},set:function(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}},{key:"send",value:function(e,t){}},{key:"destroy",value:function(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),f(B(i.prototype),"destroy",this).call(this)}}]),i}(),Dh=function(){function e(){x(this,e)}return C(e,[{key:"getMetaModel",value:function(e,t,i){le.loadJSON(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getGLTF",value:function(e,t,i){le.loadArraybuffer(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getGLB",value:function(e,t,i){le.loadArraybuffer(e,(function(e){t(e)}),(function(e){i(e)}))}},{key:"getArrayBuffer",value:function(e,t,i,s){!function(e,t,i,s){var r=function(){};i=i||r,s=s||r;var n=/^data:(.*?)(;base64)?,(.*)$/,o=t.match(n);if(o){var a=!!o[2],l=o[3];l=window.decodeURIComponent(l),a&&(l=window.atob(l));try{for(var u=new ArrayBuffer(l.length),A=new Uint8Array(u),c=0;c0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this._eventSubIDMap=null,this._eventSubEvents=null,this._eventSubs=null,this._events=null,this._locale="en",this._messages={},this._locales=[],this._locale="en",this.messages=t.messages,this.locale=t.locale}return C(e,[{key:"messages",set:function(e){this._messages=e||{},this._locales=Object.keys(this._messages),this.fire("updated",this)}},{key:"loadMessages",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e)this._messages[t]=e[t];this.messages=this._messages}},{key:"clearMessages",value:function(){this.messages={}}},{key:"locales",get:function(){return this._locales}},{key:"locale",get:function(){return this._locale},set:function(e){e=e||"de",this._locale!==e&&(this._locale=e,this.fire("updated",e))}},{key:"translate",value:function(e,t){var i=this._messages[this._locale];if(!i)return null;var s=Th(e,i);return s?t?Rh(s,t):s:null}},{key:"translatePlurals",value:function(e,t,i){var s=this._messages[this._locale];if(!s)return null;var r=Th(e,s);return(r=0===(t=parseInt(""+t,10))?r.zero:t>1?r.other:r.one)?(r=Rh(r,[t]),i&&(r=Rh(r,i)),r):null}},{key:"fire",value:function(e,t,i){this._events||(this._events={}),this._eventSubs||(this._eventSubs={}),!0!==i&&(this._events[e]=t||!0);var s=this._eventSubs[e];if(s)for(var r in s){if(s.hasOwnProperty(r))s[r].callback(t)}}},{key:"on",value:function(e,t){this._events||(this._events={}),this._eventSubIDMap||(this._eventSubIDMap=new Q),this._eventSubEvents||(this._eventSubEvents={}),this._eventSubs||(this._eventSubs={});var i=this._eventSubs[e];i||(i={},this._eventSubs[e]=i);var s=this._eventSubIDMap.addItem();i[s]={callback:t},this._eventSubEvents[s]=e;var r=this._events[e];return void 0!==r&&t(r),s}},{key:"off",value:function(e){if(null!=e&&this._eventSubEvents){var t=this._eventSubEvents[e];if(t){delete this._eventSubEvents[e];var i=this._eventSubs[t];i&&delete i[e],this._eventSubIDMap.removeItem(e)}}}}]),e}();function Th(e,t){if(t[e])return t[e];for(var i=e.split("."),s=t,r=0,n=i.length;s&&r1&&void 0!==arguments[1]?arguments[1]:[];return e.replace(/\{\{|\}\}|\{(\d+)\}/g,(function(e,i){return"{{"===e?"{":"}}"===e?"}":t[i]}))}var Lh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).t=r.t,s}return C(i,[{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"tangent",get:function(){return this.getTangent(this._t)}},{key:"length",get:function(){var e=this._getLengths();return e[e.length-1]}},{key:"getTangent",value:function(e){var t=1e-4;void 0===e&&(e=this._t);var i=e-t,s=e+t;i<0&&(i=0),s>1&&(s=1);var r=this.getPoint(i),n=this.getPoint(s),o=$.subVec3(n,r,[]);return $.normalizeVec3(o,[])}},{key:"getPointAt",value:function(e){var t=this.getUToTMapping(e);return this.getPoint(t)}},{key:"getPoints",value:function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i}},{key:"_getLengths",value:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,s=[],r=this.getPoint(0),n=0;for(s.push(0),i=1;i<=e;i++)t=this.getPoint(i/e),n+=$.lenVec3($.subVec3(t,r,[])),s.push(n),r=t;return this.cacheArcLengths=s,s}},{key:"_updateArcLengths",value:function(){this.needsUpdate=!0,this._getLengths()}},{key:"getUToTMapping",value:function(e,t){var i,s=this._getLengths(),r=0,n=s.length;i=t||e*s[n-1];for(var o,a=0,l=n-1;a<=l;)if((o=s[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(s[r=l]===i)return r/(n-1);var u=s[r];return(r+(i-u)/(s[r+1]-u))/(n-1)}}]),i}(),Uh=function(e){g(i,Lh);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).points=r.points,s.t=r.t,s}return C(i,[{key:"points",get:function(){return this._points},set:function(e){this._points=e||[]}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=this.points;if(!(t.length<3)){var i=(t.length-1)*e,s=Math.floor(i),r=i-s,n=t[0===s?s:s-1],o=t[s],a=t[s>t.length-2?t.length-1:s+1],l=t[s>t.length-3?t.length-1:s+2],u=$.vec3();return u[0]=$.catmullRomInterpolate(n[0],o[0],a[0],l[0],r),u[1]=$.catmullRomInterpolate(n[1],o[1],a[1],l[1],r),u[2]=$.catmullRomInterpolate(n[2],o[2],a[2],l[2],r),u}this.error("Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].")}},{key:"getJSON",value:function(){return{points:points,t:this._t}}}]),i}(),Oh=$.vec3(),Nh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._frames=[],s._eyeCurve=new Uh(b(s)),s._lookCurve=new Uh(b(s)),s._upCurve=new Uh(b(s)),r.frames&&(s.addFrames(r.frames),s.smoothFrameTimes(1)),s}return C(i,[{key:"type",get:function(){return"CameraPath"}},{key:"frames",get:function(){return this._frames}},{key:"eyeCurve",get:function(){return this._eyeCurve}},{key:"lookCurve",get:function(){return this._lookCurve}},{key:"upCurve",get:function(){return this._upCurve}},{key:"saveFrame",value:function(e){var t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}},{key:"addFrame",value:function(e,t,i,s){var r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}},{key:"addFrames",value:function(e){for(var t,i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,Oh),t.look=this._lookCurve.getPoint(e,Oh),t.up=this._upCurve.getPoint(e,Oh)}},{key:"sampleFrame",value:function(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}},{key:"smoothFrameTimes",value:function(e){if(0!==this._frames.length){var t=$.vec3(),i=0;this._frames[0].t=0;for(var s=[],r=1,n=this._frames.length;r1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._look1=$.vec3(),s._eye1=$.vec3(),s._up1=$.vec3(),s._look2=$.vec3(),s._eye2=$.vec3(),s._up2=$.vec3(),s._orthoScale1=1,s._orthoScale2=1,s._flying=!1,s._flyEyeLookUp=!1,s._flyingEye=!1,s._flyingLook=!1,s._callback=null,s._callbackScope=null,s._time1=null,s._time2=null,s.easing=!1!==r.easing,s.duration=r.duration,s.fit=r.fit,s.fitFOV=r.fitFOV,s.trail=r.trail,s}return C(i,[{key:"type",get:function(){return"CameraFlightAnimation"}},{key:"flyTo",value:function(e,t,i){e=e||this.scene,this._flying&&this.stop(),this._flying=!1,this._flyingEye=!1,this._flyingLook=!1,this._flyingEyeLookUp=!1,this._callback=t,this._callbackScope=i;var s,r,n,o,a,l=this.scene.camera,u=!!e.projection&&e.projection!==l.projection;if(this._eye1[0]=l.eye[0],this._eye1[1]=l.eye[1],this._eye1[2]=l.eye[2],this._look1[0]=l.look[0],this._look1[1]=l.look[1],this._look1[2]=l.look[2],this._up1[0]=l.up[0],this._up1[1]=l.up[1],this._up1[2]=l.up[2],this._orthoScale1=l.ortho.scale,this._orthoScale2=e.orthoScale||this._orthoScale1,e.aabb)s=e.aabb;else if(6===e.length)s=e;else if(e.eye&&e.look||e.up)r=e.eye,n=e.look,o=e.up;else if(e.eye)r=e.eye;else if(e.look)n=e.look;else{var A=e;if((le.isNumeric(A)||le.isString(A))&&(a=A,!(A=this.scene.components[a])))return this.error("Component not found: "+le.inQuotes(a)),void(t&&(i?t.call(i):t()));u||(s=A.aabb||this.scene.aabb)}var c=e.poi;if(s){if(s[3]=1;e>1&&(e=1);var s=this.easing?i._ease(e,0,1,1):e,r=this.scene.camera;if(this._flyingEye||this._flyingLook?this._flyingEye?($.subVec3(r.eye,r.look,Gh),r.eye=$.lerpVec3(s,0,1,this._eye1,this._eye2,Hh),r.look=$.subVec3(Hh,Gh,Vh)):this._flyingLook&&(r.look=$.lerpVec3(s,0,1,this._look1,this._look2,Vh),r.up=$.lerpVec3(s,0,1,this._up1,this._up2,jh)):this._flyingEyeLookUp&&(r.eye=$.lerpVec3(s,0,1,this._eye1,this._eye2,Hh),r.look=$.lerpVec3(s,0,1,this._look1,this._look2,Vh),r.up=$.lerpVec3(s,0,1,this._up1,this._up2,jh)),this._projection2){var n="ortho"===this._projection2?i._easeOutExpo(e,0,1,1):i._easeInCubic(e,0,1,1);r.customProjection.matrix=$.lerpMat4(n,0,1,this._projMatrix1,this._projMatrix2)}else r.ortho.scale=this._orthoScale1+e*(this._orthoScale2-this._orthoScale1);if(t)return r.ortho.scale=this._orthoScale2,void this.stop();_e.scheduleTask(this._update,this)}}},{key:"stop",value:function(){if(this._flying){this._flying=!1,this._time1=null,this._time2=null,this._projection2&&(this.scene.camera.projection=this._projection2);var e=this._callback;e&&(this._callback=null,this._callbackScope?e.call(this._callbackScope):e()),this.fire("stopped",!0,!0)}}},{key:"cancel",value:function(){this._flying&&(this._flying=!1,this._time1=null,this._time2=null,this._callback&&(this._callback=null),this.fire("canceled",!0,!0))}},{key:"duration",get:function(){return this._duration/1e3},set:function(e){this._duration=e?1e3*e:500,this.stop()}},{key:"fit",get:function(){return this._fit},set:function(e){this._fit=!1!==e}},{key:"fitFOV",get:function(){return this._fitFOV},set:function(e){this._fitFOV=e||45}},{key:"trail",get:function(){return this._trail},set:function(e){this._trail=!!e}},{key:"destroy",value:function(){this.stop(),f(B(i.prototype),"destroy",this).call(this)}}],[{key:"_ease",value:function(e,t,i,s){return-i*(e/=s)*(e-2)+t}},{key:"_easeInCubic",value:function(e,t,i,s){return i*(e/=s)*e*e+t}},{key:"_easeOutExpo",value:function(e,t,i,s){return i*(1-Math.pow(2,-10*e/s))+t}}]),i}(),Wh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._cameraFlightAnimation=new zh(b(s)),s._t=0,s.state=i.SCRUBBING,s._playingFromT=0,s._playingToT=0,s._playingRate=r.playingRate||1,s._playingDir=1,s._lastTime=null,s.cameraPath=r.cameraPath,s._tick=s.scene.on("tick",s._updateT,b(s)),s}return C(i,[{key:"type",get:function(){return"CameraPathAnimation"}},{key:"_updateT",value:function(){var e=this._cameraPath;if(e){var t,s,r=performance.now(),n=this._lastTime?.001*(r-this._lastTime):0;if(this._lastTime=r,0!==n)switch(this.state){case i.SCRUBBING:return;case i.PLAYING:if(this._t+=this._playingRate*n,0===(t=this._cameraPath.frames.length)||this._playingDir<0&&this._t<=0||this._playingDir>0&&this._t>=this._cameraPath.frames[t-1].t)return this.state=i.SCRUBBING,this._t=this._cameraPath.frames[t-1].t,void this.fire("stopped");e.loadFrame(this._t);break;case i.PLAYING_TO:s=this._t+this._playingRate*n*this._playingDir,(this._playingDir<0&&s<=this._playingToT||this._playingDir>0&&s>=this._playingToT)&&(s=this._playingToT,this.state=i.SCRUBBING,this.fire("stopped")),this._t=s,e.loadFrame(this._t)}}}},{key:"_ease",value:function(e,t,i,s){return-i*(e/=s)*(e-2)+t}},{key:"cameraPath",get:function(){return this._cameraPath},set:function(e){this._cameraPath=e}},{key:"rate",get:function(){return this._playingRate},set:function(e){this._playingRate=e}},{key:"play",value:function(){this._cameraPath&&(this._lastTime=null,this.state=i.PLAYING)}},{key:"playToT",value:function(e){this._cameraPath&&(this._playingFromT=this._t,this._playingToT=e,this._playingDir=this._playingToT-this._playingFromT<0?-1:1,this._lastTime=null,this.state=i.PLAYING_TO)}},{key:"playToFrame",value:function(e){var t=this._cameraPath;if(t){var i=t.frames[e];i?this.playToT(i.t):this.error("playToFrame - frame index out of range: "+e)}}},{key:"flyToFrame",value:function(e,t){var s=this._cameraPath;if(s){var r=s.frames[e];r?(this.state=i.SCRUBBING,this._cameraFlightAnimation.flyTo(r,t)):this.error("flyToFrame - frame index out of range: "+e)}}},{key:"scrubToT",value:function(e){var t=this._cameraPath;t&&(this.scene.camera&&(this._t=e,t.loadFrame(this._t),this.state=i.SCRUBBING))}},{key:"scrubToFrame",value:function(e){var t=this._cameraPath;t&&(this.scene.camera&&(t.frames[e]?(t.loadFrame(this._t),this.state=i.SCRUBBING):this.error("playToFrame - frame index out of range: "+e)))}},{key:"stop",value:function(){this.state=i.SCRUBBING,this.fire("stopped")}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene.off(this._tick)}}]),i}();Wh.STOPPED=0,Wh.SCRUBBING=1,Wh.PLAYING=2,Wh.PLAYING_TO=3;var Kh=$.vec3(),Xh=$.vec3();$.vec3();var Jh=$.vec3([0,-1,0]),Yh=$.vec4([0,0,0,1]),Zh=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._src=null,s._image=null,s._pos=$.vec3(),s._origin=$.vec3(),s._rtcPos=$.vec3(),s._dir=$.vec3(),s._size=1,s._imageSize=$.vec2(),s._texture=new Un(b(s)),s._plane=new rn(b(s),{geometry:new Si(b(s),Xn({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:s._texture,emissiveMap:s._texture,backfaces:!0}),clippable:r.clippable}),s._grid=new rn(b(s),{geometry:new Si(b(s),Kn({size:1,divisions:10})),material:new Oi(b(s),{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:r.clippable}),s._node=new bn(b(s),{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[s._plane,s._grid]}),s._gridVisible=!1,s.visible=!0,s.gridVisible=r.gridVisible,s.position=r.position,s.rotation=r.rotation,s.dir=r.dir,s.size=r.size,s.collidable=r.collidable,s.clippable=r.clippable,s.pickable=r.pickable,s.opacity=r.opacity,r.image?s.image=r.image:s.src=r.src,s}return C(i,[{key:"visible",get:function(){return this._plane.visible},set:function(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}},{key:"gridVisible",get:function(){return this._gridVisible},set:function(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}},{key:"src",get:function(){return this._src},set:function(e){var t=this;if(this._src=e,this._src){this._image=null;var i=new Image;i.onload=function(){t._texture.image=i,t._imageSize[0]=i.width,t._imageSize[1]=i.height,t._updatePlaneSizeFromImage()},i.src=this._src}}},{key:"position",get:function(){return this._pos},set:function(e){this._pos.set(e||[0,0,0]),Le(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}},{key:"rotation",get:function(){return this._node.rotation},set:function(e){this._node.rotation=e}},{key:"size",get:function(){return this._size},set:function(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}},{key:"dir",get:function(){return this._dir},set:function(e){if(this._dir.set(e||[0,0,-1]),e){var t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];$.subVec3(t,this.position,Kh);var s=-$.dotVec3(i,Kh);$.normalizeVec3(i),$.mulVec3Scalar(i,s,Xh),$.vec3PairToQuaternion(Jh,e,Yh),this._node.quaternion=Yh}}},{key:"collidable",get:function(){return this._node.collidable},set:function(e){this._node.collidable=!1!==e}},{key:"clippable",get:function(){return this._node.clippable},set:function(e){this._node.clippable=!1!==e}},{key:"pickable",get:function(){return this._node.pickable},set:function(e){this._node.pickable=!1!==e}},{key:"opacity",get:function(){return this._node.opacity},set:function(e){this._node.opacity=e}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this)}},{key:"_updatePlaneSizeFromImage",value:function(){var e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){var s=i/t;this._node.scale=[e,1,e*s]}else{var r=t/i;this._node.scale=[e*r,1,e]}}}]),i}(),qh=function(e){g(i,_i);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i);var n=b(s=t.call(this,e,r));s._shadowRenderBuf=null,s._shadowViewMatrix=null,s._shadowProjMatrix=null,s._shadowViewMatrixDirty=!0,s._shadowProjMatrixDirty=!0;var o=s.scene.camera,a=s.scene.canvas;return s._onCameraViewMatrix=o.on("viewMatrix",(function(){s._shadowViewMatrixDirty=!0})),s._onCameraProjMatrix=o.on("projMatrix",(function(){s._shadowProjMatrixDirty=!0})),s._onCanvasBoundary=a.on("boundary",(function(){s._shadowProjMatrixDirty=!0})),s._state=new Zt({type:"point",pos:$.vec3([1,1,1]),color:$.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:r.space||"view",castsShadow:!1,getShadowViewMatrix:function(){if(n._shadowViewMatrixDirty){n._shadowViewMatrix||(n._shadowViewMatrix=$.identityMat4());var e=n._state.pos,t=o.look,i=o.up;$.lookAtMat4v(e,t,i,n._shadowViewMatrix),n._shadowViewMatrixDirty=!1}return n._shadowViewMatrix},getShadowProjMatrix:function(){if(n._shadowProjMatrixDirty){n._shadowProjMatrix||(n._shadowProjMatrix=$.identityMat4());var e=n.scene.canvas.canvas;$.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,n._shadowProjMatrix),n._shadowProjMatrixDirty=!1}return n._shadowProjMatrix},getShadowRenderBuf:function(){return n._shadowRenderBuf||(n._shadowRenderBuf=new zt(n.scene.canvas.canvas,n.scene.canvas.gl,{size:[1024,1024]})),n._shadowRenderBuf}}),s.pos=r.pos,s.color=r.color,s.intensity=r.intensity,s.constantAttenuation=r.constantAttenuation,s.linearAttenuation=r.linearAttenuation,s.quadraticAttenuation=r.quadraticAttenuation,s.castsShadow=r.castsShadow,s.scene._lightCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"PointLight"}},{key:"pos",get:function(){return this._state.pos},set:function(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}},{key:"color",get:function(){return this._state.color},set:function(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}},{key:"intensity",get:function(){return this._state.intensity},set:function(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}},{key:"constantAttenuation",get:function(){return this._state.attenuation[0]},set:function(e){this._state.attenuation[0]=e||0,this.glRedraw()}},{key:"linearAttenuation",get:function(){return this._state.attenuation[1]},set:function(e){this._state.attenuation[1]=e||0,this.glRedraw()}},{key:"quadraticAttenuation",get:function(){return this._state.attenuation[2]},set:function(e){this._state.attenuation[2]=e||0,this.glRedraw()}},{key:"castsShadow",get:function(){return this._state.castsShadow},set:function(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}},{key:"destroy",value:function(){var e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),f(B(i.prototype),"destroy",this).call(this),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}}]),i}();function $h(e){return 0==(e&e-1)}function ed(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1}var td=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i);var n=(s=t.call(this,e,r)).scene.canvas.gl;return s._state=new Zt({texture:new In({gl:n,target:n.TEXTURE_CUBE_MAP}),flipY:s._checkFlipY(r.minFilter),encoding:s._checkEncoding(r.encoding),minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,mipmaps:!0}),s._src=r.src,s._images=[],s._loadSrc(r.src),se.memory.textures++,s}return C(i,[{key:"type",get:function(){return"CubeTexture"}},{key:"_checkFlipY",value:function(e){return!!e}},{key:"_checkEncoding",value:function(e){return 3e3!==(e=e||3e3)&&3001!==e&&(this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding."),e=3e3),e}},{key:"_webglContextRestored",value:function(){this.scene.canvas.gl,this._state.texture=null,this._src&&this._loadSrc(this._src)}},{key:"_loadSrc",value:function(e){var t=this,i=this.scene.canvas.gl;this._images=[];for(var s=!1,r=0,n=function(n){var o,a,l=new Image;l.onload=(o=l,a=n,function(){if(!s&&(o=function(e){if(!$h(e.width)||!$h(e.height)){var t=document.createElement("canvas");t.width=ed(e.width),t.height=ed(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e}(o),t._images[a]=o,6==++r)){var e=t._state.texture;e||(e=new In({gl:i,target:i.TEXTURE_CUBE_MAP}),t._state.texture=e),e.setImage(t._images,t._state),t.fire("loaded",t._src,!1),t.glRedraw()}}),l.onerror=function(){s=!0},l.src=e[n]},o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).scene._lightsState.addReflectionMap(s._state),s.scene._reflectionMapCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"ReflectionMap"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._reflectionMapDestroyed(this)}}]),i}(),sd=function(e){g(i,td);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).scene._lightMapCreated(b(s)),s}return C(i,[{key:"type",get:function(){return"LightMap"}},{key:"destroy",value:function(){f(B(i.prototype),"destroy",this).call(this),this.scene._lightMapDestroyed(this)}}]),i}(),rd=function(e){g(i,et);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,{entity:r.entity,occludable:r.occludable,worldPos:r.worldPos}))._occluded=!1,s._visible=!0,s._src=null,s._image=null,s._pos=$.vec3(),s._origin=$.vec3(),s._rtcPos=$.vec3(),s._dir=$.vec3(),s._size=1,s._imageSize=$.vec2(),s._texture=new Un(b(s),{src:r.src}),s._geometry=new Si(b(s),{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]}),s._mesh=new rn(b(s),{geometry:s._geometry,material:new Oi(b(s),{ambient:[.9,.3,.9],shininess:30,diffuseMap:s._texture,backfaces:!0}),scale:[1,1,1],position:r.worldPos,rotation:[90,0,0],billboard:"spherical",occluder:!1}),s.visible=!0,s.collidable=r.collidable,s.clippable=r.clippable,s.pickable=r.pickable,s.opacity=r.opacity,s.size=r.size,r.image?s.image=r.image:s.src=r.src,s}return C(i,[{key:"_setVisible",value:function(e){this._occluded=!e,this._mesh.visible=this._visible&&!this._occluded,f(B(i.prototype),"_setVisible",this).call(this,e)}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=null==e||e,this._mesh.visible=this._visible&&!this._occluded}},{key:"image",get:function(){return this._image},set:function(e){this._image=e,this._image&&(this._imageSize[0]=this._image.width,this._imageSize[1]=this._image.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}},{key:"src",get:function(){return this._src},set:function(e){var t=this;if(this._src=e,this._src){this._image=null;var i=new Image;i.onload=function(){t._texture.image=i,t._imageSize[0]=i.width,t._imageSize[1]=i.height,t._updatePlaneSizeFromImage()},i.src=this._src}}},{key:"size",get:function(){return this._size},set:function(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}},{key:"collidable",get:function(){return this._mesh.collidable},set:function(e){this._mesh.collidable=!1!==e}},{key:"clippable",get:function(){return this._mesh.clippable},set:function(e){this._mesh.clippable=!1!==e}},{key:"pickable",get:function(){return this._mesh.pickable},set:function(e){this._mesh.pickable=!1!==e}},{key:"opacity",get:function(){return this._mesh.opacity},set:function(e){this._mesh.opacity=e}},{key:"_updatePlaneSizeFromImage",value:function(){var e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}}]),i}(),nd=function(){function e(t){x(this,e),this._eye=$.vec3(),this._look=$.vec3(),this._up=$.vec3(),this._projection={},t&&this.saveCamera(t)}return C(e,[{key:"saveCamera",value:function(e){var t=e.camera,i=t.project;switch(this._eye.set(t.eye),this._look.set(t.look),this._up.set(t.up),t.projection){case"perspective":this._projection={projection:"perspective",fov:i.fov,fovAxis:i.fovAxis,near:i.near,far:i.far};break;case"ortho":this._projection={projection:"ortho",scale:i.scale,near:i.near,far:i.far};break;case"frustum":this._projection={projection:"frustum",left:i.left,right:i.right,top:i.top,bottom:i.bottom,near:i.near,far:i.far};break;case"custom":this._projection={projection:"custom",matrix:i.matrix.slice()}}}},{key:"restoreCamera",value:function(e,t){var i=e.camera,s=this._projection;function r(){switch(s.type){case"perspective":i.perspective.fov=s.fov,i.perspective.fovAxis=s.fovAxis,i.perspective.near=s.near,i.perspective.far=s.far;break;case"ortho":i.ortho.scale=s.scale,i.ortho.near=s.near,i.ortho.far=s.far;break;case"frustum":i.frustum.left=s.left,i.frustum.right=s.right,i.frustum.top=s.top,i.frustum.bottom=s.bottom,i.frustum.near=s.near,i.frustum.far=s.far;break;case"custom":i.customProjection.matrix=s.matrix}}t?e.viewer.cameraFlight.flyTo({eye:this._eye,look:this._look,up:this._up,orthoScale:s.scale,projection:s.projection},(function(){r(),t()})):(i.eye=this._eye,i.look=this._look,i.up=this._up,r(),i.projection=s.projection)}}]),e}(),od=$.vec3(),ad=function(){function e(t){if(x(this,e),this.objectsVisible=[],this.objectsEdges=[],this.objectsXrayed=[],this.objectsHighlighted=[],this.objectsSelected=[],this.objectsClippable=[],this.objectsPickable=[],this.objectsColorize=[],this.objectsOpacity=[],this.numObjects=0,t){var i=t.metaScene.scene;this.saveObjects(i,t)}}return C(e,[{key:"saveObjects",value:function(e,t,i){this.numObjects=0,this._mask=i?le.apply(i,{}):null;for(var s=!i||i.visible,r=!i||i.edges,n=!i||i.xrayed,o=!i||i.highlighted,a=!i||i.selected,l=!i||i.clippable,u=!i||i.pickable,A=!i||i.colorize,c=!i||i.opacity,h=t.metaObjects,d=e.objects,p=0,f=h.length;p1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).v0=r.v0,s.v1=r.v1,s.v2=r.v2,s.v3=r.v3,s.t=r.t,s}return C(i,[{key:"v0",get:function(){return this._v0},set:function(e){this._v0=e||$.vec3([0,0,0])}},{key:"v1",get:function(){return this._v1},set:function(e){this._v1=e||$.vec3([0,0,0])}},{key:"v2",get:function(){return this._v2},set:function(e){this._v2=e||$.vec3([0,0,0])}},{key:"v3",get:function(){return this._v3},set:function(e){this.fire("v3",this._v3=e||$.vec3([0,0,0]))}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=$.vec3();return t[0]=$.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=$.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=$.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}},{key:"getJSON",value:function(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}}]),i}(),cd=function(e){g(i,Lh);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._cachedLengths=[],s._dirty=!0,s._curves=[],s._t=0,s._dirtySubs=[],s._destroyedSubs=[],s.curves=r.curves||[],s.t=r.t,s}return C(i,[{key:"addCurve",value:function(e){this._curves.push(e),this._dirty=!0}},{key:"curves",get:function(){return this._curves},set:function(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"length",get:function(){var e=this._getCurveLengths();return e[e.length-1]}},{key:"getPoint",value:function(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var n=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(n)}r++}return null}},{key:"_getCurveLengths",value:function(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r)).v0=r.v0,s.v1=r.v1,s.v2=r.v2,s.t=r.t,s}return C(i,[{key:"v0",get:function(){return this._v0},set:function(e){this._v0=e||$.vec3([0,0,0])}},{key:"v1",get:function(){return this._v1},set:function(e){this._v1=e||$.vec3([0,0,0])}},{key:"v2",get:function(){return this._v2},set:function(e){this._v2=e||$.vec3([0,0,0])}},{key:"t",get:function(){return this._t},set:function(e){e=e||0,this._t=e<0?0:e>1?1:e}},{key:"point",get:function(){return this.getPoint(this._t)}},{key:"getPoint",value:function(e){var t=$.vec3();return t[0]=$.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=$.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=$.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}},{key:"getJSON",value:function(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}}]),i}(),dd=function(e){g(i,ch);var t=_(i);function i(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),t.call(this,e,s)}return C(i)}(),pd=function(e){g(i,Be);var t=_(i);function i(e){var s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(s=t.call(this,e,r))._skyboxMesh=new rn(b(s),{geometry:new Si(b(s),{primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:!0,scale:[2e3,2e3,2e3],rotation:[0,-90,0],material:new Oi(b(s),{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Un(b(s),{src:r.src,flipY:!0,wrapS:"clampToEdge",wrapT:"clampToEdge",encoding:r.encoding||"sRGB"}),backfaces:!0}),visible:!1,pickable:!1,clippable:!1,collidable:!1}),s.size=r.size,s.active=r.active,s}return C(i,[{key:"size",get:function(){return this._size},set:function(e){this._size=e||1e3,this._skyboxMesh.scale=[this._size,this._size,this._size]}},{key:"active",get:function(){return this._skyboxMesh.visible},set:function(e){this._skyboxMesh.visible=e}}]),i}(),fd=function(){function e(){x(this,e)}return C(e,[{key:"transcode",value:function(e,t){}},{key:"destroy",value:function(){}}]),e}(),vd=$.vec4(),gd=$.vec4(),md=$.vec3(),_d=$.vec3(),yd=$.vec3(),bd=$.vec4(),Bd=$.vec4(),wd=$.vec4(),xd=function(){function e(t){x(this,e),this._scene=t}return C(e,[{key:"dollyToCanvasPos",value:function(e,t,i){var s=!1,r=this._scene.camera;if(e){var n=$.subVec3(e,r.eye,md);s=$.lenVec3(n)0&&void 0!==arguments[0]?arguments[0]:{};this.destroyPivotSphere(),this._pivotSphereEnabled=!0,e.size&&(this._pivotSphereSize=e.size);var t=e.color||[1,0,0];this._pivotSphereMaterial=new Oi(this._scene,{emissive:t,ambient:t,specular:[0,0,0],diffuse:[0,0,0]})}},{key:"disablePivotSphere",value:function(){this.destroyPivotSphere(),this._pivotSphereEnabled=!1}},{key:"startPivot",value:function(){if(this._cameraLookingDownwards())return this._pivoting=!1,!1;var e=this._scene.camera,t=$.lookAtMat4v(e.eye,e.look,e.worldUp);$.transformPoint3(t,this.getPivotPos(),this._cameraOffset);var i=this.getPivotPos();this._cameraOffset[2]+=$.distVec3(e.eye,i),t=$.inverseMat4(t);var s=$.transformVec3(t,this._cameraOffset),r=$.vec3();if($.subVec3(e.eye,i,r),$.addVec3(r,s),e.zUp){var n=r[1];r[1]=r[2],r[2]=n}this._radius=$.lenVec3(r),this._polar=Math.acos(r[1]/this._radius),this._azimuth=Math.atan2(r[0],r[2]),this._pivoting=!0}},{key:"_cameraLookingDownwards",value:function(){var e=this._scene.camera,t=$.normalizeVec3($.subVec3(e.look,e.eye,Pd)),i=$.cross3Vec3(t,e.worldUp,Cd);return $.sqLenVec3(i)<=1e-4}},{key:"getPivoting",value:function(){return this._pivoting}},{key:"setPivotPos",value:function(e){this._pivotWorldPos.set(e),this._pivotPosSet=!0}},{key:"setCanvasPivotPos",value:function(e){var t=this._scene.camera,i=Math.abs($.distVec3(this._scene.center,t.eye)),s=t.project.transposedMatrix,r=s.subarray(8,12),n=s.subarray(12),o=[0,0,-1,1],a=$.dotVec4(o,r)/$.dotVec4(o,n),l=Fd;t.project.unproject(e,a,Ed,kd,l);var u=$.normalizeVec3($.subVec3(l,t.eye,Pd)),A=$.addVec3(t.eye,$.mulVec3Scalar(u,i,Cd),Md);this.setPivotPos(A)}},{key:"getPivotPos",value:function(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look}},{key:"continuePivot",value:function(e,t){if(this._pivoting&&(0!==e||0!==t)){var i=this._scene.camera,s=-e,r=-t;1===i.worldUp[2]&&(s=-s),this._azimuth+=.01*-s,this._polar+=.01*r,this._polar=$.clamp(this._polar,.001,Math.PI-.001);var n=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(1===i.worldUp[2]){var o=n[1];n[1]=n[2],n[2]=o}var a=$.lenVec3($.subVec3(i.look,i.eye,$.vec3())),l=this.getPivotPos();$.addVec3(n,l);var u=$.lookAtMat4v(n,l,i.worldUp);u=$.inverseMat4(u);var A=$.transformVec3(u,this._cameraOffset);u[12]-=A[0],u[13]-=A[1],u[14]-=A[2];var c=[u[8],u[9],u[10]];i.eye=[u[12],u[13],u[14]],$.subVec3(i.eye,$.mulVec3Scalar(c,a),i.look),i.up=[u[4],u[5],u[6]],this.showPivot()}}},{key:"showPivot",value:function(){this._shown||(this._pivotElement&&(this.updatePivotElement(),this._pivotElement.style.visibility="visible"),this._pivotSphereEnabled&&(this.destroyPivotSphere(),this.createPivotSphere()),this._shown=!0)}},{key:"hidePivot",value:function(){this._shown&&(this._pivotElement&&(this._pivotElement.style.visibility="hidden"),this._pivotSphereEnabled&&this.destroyPivotSphere(),this._shown=!1)}},{key:"endPivot",value:function(){this._pivoting=!1}},{key:"destroy",value:function(){this.destroyPivotSphere(),this._scene.camera.off(this._onViewMatrix),this._scene.camera.off(this._onProjMatrix),this._scene.off(this._onTick)}}]),e}(),Dd=function(){function e(t,i){x(this,e),this._scene=t.scene,this._cameraControl=t,this._scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},this._configs=i,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick=!1,this.pickCursorPos=$.vec2(),this.picked=!1,this.pickedSurface=!1,this.pickResult=null,this._lastPickedEntityId=null,this._lastHash=null,this._needFireEvents=0}return C(e,[{key:"update",value:function(){if(this._configs.pointerEnabled&&(this.schedulePickEntity||this.schedulePickSurface)){var e="".concat(~~this.pickCursorPos[0],"-").concat(~~this.pickCursorPos[1],"-").concat(this.scheduleSnapOrPick,"-").concat(this.schedulePickSurface,"-").concat(this.schedulePickEntity);if(this._lastHash!==e){this.picked=!1,this.pickedSurface=!1,this.snappedOrPicked=!1,this.hoveredSnappedOrSurfaceOff=!1;var t=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){var i=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});i&&(i.snappedToEdge||i.snappedToVertex)?(this.snapPickResult=i,this.snappedOrPicked=!0,this._needFireEvents++):(this.schedulePickSurface=!0,this.snapPickResult=null)}if(this.schedulePickSurface&&this.pickResult&&this.pickResult.worldPos){var s=this.pickResult.canvasPos;if(s[0]===this.pickCursorPos[0]&&s[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!0,this._needFireEvents+=t?1:0,this.schedulePickEntity=!1,this.schedulePickSurface=!1,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.hoveredSnappedOrSurfaceOff=!0,void(this.scheduleSnapOrPick=!1)}if(this.schedulePickEntity&&this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){var r=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(r[0]===this.pickCursorPos[0]&&r[1]===this.pickCursorPos[1])return this.picked=!0,this.pickedSurface=!1,this.schedulePickEntity=!1,void(this.schedulePickSurface=!1)}this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult?(this.pickResult=this._scene.pick({pickSurface:!0,pickSurfaceNormal:!1,canvasPos:this.pickCursorPos}),this.pickResult?(this.picked=!0,this.scheduleSnapOrPick?this.snappedOrPicked=!0:this.pickedSurface=!0,this._needFireEvents++):this.scheduleSnapOrPick&&(this.hoveredSnappedOrSurfaceOff=!0,this._needFireEvents++)):(this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos}),this.pickResult&&(this.picked=!0,this.pickedSurface=!1,this._needFireEvents++)),this.scheduleSnapOrPick=!1,this.schedulePickEntity=!1,this.schedulePickSurface=!1}}}},{key:"fireEvents",value:function(){if(0!==this._needFireEvents){if(this.hoveredSnappedOrSurfaceOff&&this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},!0),this.snappedOrPicked)if(this.snapPickResult){var e=new wt;e.entity=this.snapPickResult.entity,e.snappedToVertex=this.snapPickResult.snappedToVertex,e.snappedToEdge=this.snapPickResult.snappedToEdge,e.worldPos=this.snapPickResult.worldPos,e.canvasPos=this.pickCursorPos,e.snappedCanvasPos=this.snapPickResult.snappedCanvasPos,this._cameraControl.fire("hoverSnapOrSurface",e,!0),this.snapPickResult=null}else this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,!0);if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){var t=this.pickResult.entity.id;this._lastPickedEntityId!==t&&(void 0!==this._lastPickedEntityId&&this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._cameraControl.fire("hoverEnter",this.pickResult,!0),this._lastPickedEntityId=t)}this._cameraControl.fire("hover",this.pickResult,!0),this.pickResult.worldPos&&(this.pickedSurface=!0,this._cameraControl.fire("hoverSurface",this.pickResult,!0))}else void 0!==this._lastPickedEntityId&&(this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},!0),this._lastPickedEntityId=void 0),this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},!0);this.pickResult=null,this._needFireEvents=0}}}]),e}(),Sd=$.vec2(),Td=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o,a,l,u=i.pickController,A=0,c=0,h=0,d=0,p=!1,f=$.vec3(),v=!0,g=this._scene.canvas.canvas,m=[];function _(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];g.style.cursor="move",y(),e&&b()}function y(){A=r.pointerCanvasPos[0],c=r.pointerCanvasPos[1],h=r.pointerCanvasPos[0],d=r.pointerCanvasPos[1]}function b(){u.pickCursorPos=r.pointerCanvasPos,u.schedulePickSurface=!0,u.update(),u.picked&&u.pickedSurface&&u.pickResult&&u.pickResult.worldPos?(p=!0,f.set(u.pickResult.worldPos)):p=!1}document.addEventListener("keydown",this._documentKeyDownHandler=function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled){var i=e.keyCode;m[i]=!0}}),document.addEventListener("keyup",this._documentKeyUpHandler=function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled){var i=e.keyCode;m[i]=!1}}),g.addEventListener("mousedown",this._mouseDownHandler=function(e){if(s.active&&s.pointerEnabled)switch(e.which){case 1:m[t.input.KEY_SHIFT]||s.planView?(o=!0,_()):(o=!0,_(!1));break;case 2:a=!0,_();break;case 3:l=!0,s.panRightClick&&_()}}),document.addEventListener("mousemove",this._documentMouseMoveHandler=function(e){if(s.active&&s.pointerEnabled&&(o||a||l)){var i=t.canvas.boundary,u=i[2],h=i[3],d=r.pointerCanvasPos[0],v=r.pointerCanvasPos[1],g=m[t.input.KEY_SHIFT]||s.planView||!s.panRightClick&&a||s.panRightClick&&l,_=document.pointerLockElement?e.movementX:d-A,y=document.pointerLockElement?e.movementY:v-c;if(g){var b=t.camera;if("perspective"===b.projection){var B=Math.abs(p?$.lenVec3($.subVec3(f,t.camera.eye,[])):t.camera.eyeLookDist)*Math.tan(b.perspective.fov/2*Math.PI/180);n.panDeltaX+=1.5*_*B/h,n.panDeltaY+=1.5*y*B/h}else n.panDeltaX+=.5*b.ortho.scale*(_/h),n.panDeltaY+=.5*b.ortho.scale*(y/h)}else!o||a||l||s.planView||(s.firstPerson?(n.rotateDeltaY-=_/u*s.dragRotationRate/2,n.rotateDeltaX+=y/h*(s.dragRotationRate/4)):(n.rotateDeltaY-=_/u*(1.5*s.dragRotationRate),n.rotateDeltaX+=y/h*(1.5*s.dragRotationRate)));A=d,c=v}}),g.addEventListener("mousemove",this._canvasMouseMoveHandler=function(e){s.active&&s.pointerEnabled&&r.mouseover&&(v=!0)}),document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(s.active&&s.pointerEnabled)switch(e.which){case 1:case 2:case 3:o=!1,a=!1,l=!1}}),g.addEventListener("mouseup",this._mouseUpHandler=function(e){if(s.active&&s.pointerEnabled){if(3===e.which){!function(e,t){if(e){for(var i=e.target,s=0,r=0,n=0,o=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,n+=i.scrollLeft,o+=i.scrollTop,i=i.offsetParent;t[0]=e.pageX+n-s,t[1]=e.pageY+o-r}else e=window.event,t[0]=e.x,t[1]=e.y}(e,Sd);var t=Sd[0],r=Sd[1];Math.abs(t-h)<3&&Math.abs(r-d)<3&&i.cameraControl.fire("rightClick",{pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:Sd,event:e},!0)}g.style.removeProperty("cursor")}}),g.addEventListener("mouseenter",this._mouseEnterHandler=function(){s.active&&s.pointerEnabled});var B=1/60,w=null;g.addEventListener("wheel",this._mouseWheelHandler=function(e){if(s.active&&s.pointerEnabled){var t=performance.now()/1e3,i=null!==w?t-w:0;w=t,i>.05&&(i=.05),i0?i.cameraFlight.flyTo(Qd,(function(){i.pivotController.getPivoting()&&s.followPointer&&i.pivotController.showPivot()})):(i.cameraFlight.jumpTo(Qd),i.pivotController.getPivoting()&&s.followPointer&&i.pivotController.showPivot())}}}))}return C(e,[{key:"reset",value:function(){}},{key:"destroy",value:function(){this._scene.input.off(this._onSceneKeyDown)}}]),e}(),Hd=function(){function e(t,i,s,r,n){var o=this;x(this,e),this._scene=t;var a=i.pickController,l=i.pivotController,u=i.cameraControl;this._clicks=0,this._timeout=null,this._lastPickedEntityId=null;var A=!1,c=!1,h=this._scene.canvas.canvas,d=function(e){var s;e&&e.worldPos&&(s=e.worldPos);var r=e&&e.entity?e.entity.aabb:t.aabb;if(s){var n=t.camera;$.subVec3(n.eye,n.look,[]),i.cameraFlight.flyTo({aabb:r})}else i.cameraFlight.flyTo({aabb:r})},p=t.tickify(this._canvasMouseMoveHandler=function(e){if(s.active&&s.pointerEnabled&&!A&&!c){var i=u.hasSubs("hover"),n=u.hasSubs("hoverEnter"),l=u.hasSubs("hoverOut"),h=u.hasSubs("hoverOff"),d=u.hasSubs("hoverSurface"),p=u.hasSubs("hoverSnapOrSurface");if(i||n||l||h||d||p)if(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=!0,a.schedulePickSurface=d,a.scheduleSnapOrPick=p,a.update(),a.pickResult){if(a.pickResult.entity){var f=a.pickResult.entity.id;o._lastPickedEntityId!==f&&(void 0!==o._lastPickedEntityId&&u.fire("hoverOut",{entity:t.objects[o._lastPickedEntityId]},!0),u.fire("hoverEnter",a.pickResult,!0),o._lastPickedEntityId=f)}u.fire("hover",a.pickResult,!0),(a.pickResult.worldPos||a.pickResult.snappedWorldPos)&&u.fire("hoverSurface",a.pickResult,!0)}else void 0!==o._lastPickedEntityId&&(u.fire("hoverOut",{entity:t.objects[o._lastPickedEntityId]},!0),o._lastPickedEntityId=void 0),u.fire("hoverOff",{canvasPos:a.pickCursorPos},!0)}});h.addEventListener("mousemove",p),h.addEventListener("mousedown",this._canvasMouseDownHandler=function(e){if(1===e.which&&(A=!0),3===e.which&&(c=!0),1===e.which&&s.active&&s.pointerEnabled&&(r.mouseDownClientX=e.clientX,r.mouseDownClientY=e.clientY,r.mouseDownCursorX=r.pointerCanvasPos[0],r.mouseDownCursorY=r.pointerCanvasPos[1],!s.firstPerson&&s.followPointer&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickSurface=!0,a.update(),1===e.which))){var i=a.pickResult;i&&i.worldPos?(l.setPivotPos(i.worldPos),l.startPivot()):(s.smartPivot?l.setCanvasPivotPos(r.pointerCanvasPos):l.setPivotPos(t.camera.look),l.startPivot())}}),document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){1===e.which&&(A=!1),3===e.which&&(c=!1),l.getPivoting()&&l.endPivot()}),h.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(s.active&&s.pointerEnabled&&(1===e.which&&(l.hidePivot(),!(Math.abs(e.clientX-r.mouseDownClientX)>3||Math.abs(e.clientY-r.mouseDownClientY)>3)))){var n=u.hasSubs("picked"),A=u.hasSubs("pickedNothing"),c=u.hasSubs("pickedSurface"),h=u.hasSubs("doublePicked"),p=u.hasSubs("doublePickedSurface"),f=u.hasSubs("doublePickedNothing");if(!(s.doublePickFlyTo||h||p||f))return(n||A||c)&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=!0,a.schedulePickSurface=c,a.update(),a.pickResult?(u.fire("picked",a.pickResult,!0),a.pickedSurface&&u.fire("pickedSurface",a.pickResult,!0)):u.fire("pickedNothing",{canvasPos:r.pointerCanvasPos},!0)),void(o._clicks=0);if(o._clicks++,1===o._clicks){a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=s.doublePickFlyTo,a.schedulePickSurface=c,a.update();var v=a.pickResult,g=a.pickedSurface;o._timeout=setTimeout((function(){v?(u.fire("picked",v,!0),g&&(u.fire("pickedSurface",v,!0),!s.firstPerson&&s.followPointer&&(i.pivotController.setPivotPos(v.worldPos),i.pivotController.startPivot()&&i.pivotController.showPivot()))):u.fire("pickedNothing",{canvasPos:r.pointerCanvasPos},!0),o._clicks=0}),s.doubleClickTimeFrame)}else{if(null!==o._timeout&&(window.clearTimeout(o._timeout),o._timeout=null),a.pickCursorPos=r.pointerCanvasPos,a.schedulePickEntity=s.doublePickFlyTo||h||p,a.schedulePickSurface=a.schedulePickEntity&&p,a.update(),a.pickResult){if(u.fire("doublePicked",a.pickResult,!0),a.pickedSurface&&u.fire("doublePickedSurface",a.pickResult,!0),s.doublePickFlyTo&&(d(a.pickResult),!s.firstPerson&&s.followPointer)){var m=a.pickResult.entity.aabb,_=$.getAABB3Center(m);i.pivotController.setPivotPos(_),i.pivotController.startPivot()&&i.pivotController.showPivot()}}else if(u.fire("doublePickedNothing",{canvasPos:r.pointerCanvasPos},!0),s.doublePickFlyTo&&(d(),!s.firstPerson&&s.followPointer)){var y=t.aabb,b=$.getAABB3Center(y);i.pivotController.setPivotPos(b),i.pivotController.startPivot()&&i.pivotController.showPivot()}o._clicks=0}}},!1)}return C(e,[{key:"reset",value:function(){this._clicks=0,this._lastPickedEntityId=null,this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}},{key:"destroy",value:function(){var e=this._scene.canvas.canvas;e.removeEventListener("mousemove",this._canvasMouseMoveHandler),e.removeEventListener("mousedown",this._canvasMouseDownHandler),document.removeEventListener("mouseup",this._documentMouseUpHandler),e.removeEventListener("mouseup",this._canvasMouseUpHandler),this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null)}}]),e}(),jd=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o=t.input,a=[],l=t.canvas.canvas,u=!0;this._onSceneMouseMove=o.on("mousemove",(function(){u=!0})),this._onSceneKeyDown=o.on("keydown",(function(e){s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&r.mouseover&&(a[e]=!0,e===o.KEY_SHIFT&&(l.style.cursor="move"))})),this._onSceneKeyUp=o.on("keyup",(function(e){s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&(a[e]=!1,e===o.KEY_SHIFT&&(l.style.cursor=null),i.pivotController.getPivoting()&&i.pivotController.endPivot())})),this._onTick=t.on("tick",(function(e){if(s.active&&s.pointerEnabled&&t.input.keyboardEnabled&&r.mouseover){var l=i.cameraControl,A=e.deltaTime/1e3;if(!s.planView){var c=l._isKeyDownForAction(l.ROTATE_Y_POS,a),h=l._isKeyDownForAction(l.ROTATE_Y_NEG,a),d=l._isKeyDownForAction(l.ROTATE_X_POS,a),p=l._isKeyDownForAction(l.ROTATE_X_NEG,a),f=A*s.keyboardRotationRate;(c||h||d||p)&&(!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),c?n.rotateDeltaY+=f:h&&(n.rotateDeltaY-=f),d?n.rotateDeltaX+=f:p&&(n.rotateDeltaX-=f),!s.firstPerson&&s.followPointer&&i.pivotController.startPivot())}if(!a[o.KEY_CTRL]&&!a[o.KEY_ALT]){var v=l._isKeyDownForAction(l.DOLLY_BACKWARDS,a),g=l._isKeyDownForAction(l.DOLLY_FORWARDS,a);if(v||g){var m=A*s.keyboardDollyRate;!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),g?n.dollyDelta-=m:v&&(n.dollyDelta+=m),u&&(r.followPointerDirty=!0,u=!1)}}var _=l._isKeyDownForAction(l.PAN_FORWARDS,a),y=l._isKeyDownForAction(l.PAN_BACKWARDS,a),b=l._isKeyDownForAction(l.PAN_LEFT,a),B=l._isKeyDownForAction(l.PAN_RIGHT,a),w=l._isKeyDownForAction(l.PAN_UP,a),x=l._isKeyDownForAction(l.PAN_DOWN,a),P=(a[o.KEY_ALT]?.3:1)*A*s.keyboardPanRate;(_||y||b||B||w||x)&&(!s.firstPerson&&s.followPointer&&i.pivotController.startPivot(),x?n.panDeltaY+=P:w&&(n.panDeltaY+=-P),B?n.panDeltaX+=-P:b&&(n.panDeltaX+=P),y?n.panDeltaZ+=P:_&&(n.panDeltaZ+=-P))}}))}return C(e,[{key:"reset",value:function(){}},{key:"destroy",value:function(){this._scene.off(this._onTick),this._scene.input.off(this._onSceneMouseMove),this._scene.input.off(this._onSceneKeyDown),this._scene.input.off(this._onSceneKeyUp)}}]),e}(),Gd=$.vec3(),zd=function(){function e(t,i,s,r,n){x(this,e),this._scene=t;var o=t.camera,a=i.pickController,l=i.pivotController,u=i.panController,A=1,c=1,h=null;this._onTick=t.on("tick",(function(){if(s.active&&s.pointerEnabled){var e="default";if(Math.abs(n.dollyDelta)<.001&&(n.dollyDelta=0),Math.abs(n.rotateDeltaX)<.001&&(n.rotateDeltaX=0),Math.abs(n.rotateDeltaY)<.001&&(n.rotateDeltaY=0),0===n.rotateDeltaX&&0===n.rotateDeltaY||(n.dollyDelta=0),s.followPointer){if(--A<=0&&(A=1,0!==n.dollyDelta)){if(0===n.rotateDeltaY&&0===n.rotateDeltaX&&s.followPointer&&r.followPointerDirty&&(a.pickCursorPos=r.pointerCanvasPos,a.schedulePickSurface=!0,a.update(),a.pickResult&&a.pickResult.worldPos?h=a.pickResult.worldPos:(c=1,h=null),r.followPointerDirty=!1),h){var i=Math.abs($.lenVec3($.subVec3(h,t.camera.eye,Gd)));c=i/s.dollyProximityThreshold}cs.longTapRadius||Math.abs(g)>s.longTapRadius)&&(clearTimeout(r.longTouchTimeout),r.longTouchTimeout=null),s.planView){var m=t.camera;if("perspective"===m.projection){var _=Math.abs(t.camera.eyeLookDist)*Math.tan(m.perspective.fov/2*Math.PI/180);n.panDeltaX+=v*_/l*s.touchPanRate,n.panDeltaY+=g*_/l*s.touchPanRate}else n.panDeltaX+=.5*m.ortho.scale*(v/l)*s.touchPanRate,n.panDeltaY+=.5*m.ortho.scale*(g/l)*s.touchPanRate}else n.rotateDeltaY-=v/a*(1*s.dragRotationRate),n.rotateDeltaX+=g/l*(1.5*s.dragRotationRate)}else if(2===p){var y=d[0],b=d[1];Xd(y,u),Xd(b,A);var B=$.geometricMeanVec2(h[0],h[1]),w=$.geometricMeanVec2(u,A),x=$.vec2();$.subVec2(B,w,x);var P=x[0],C=x[1],M=t.camera,F=$.distVec2([y.pageX,y.pageY],[b.pageX,b.pageY]),E=($.distVec2(h[0],h[1])-F)*s.touchDollyRate;if(n.dollyDelta=E,Math.abs(E)<1)if("perspective"===M.projection){var k=o.pickResult?o.pickResult.worldPos:t.center,I=Math.abs($.lenVec3($.subVec3(k,t.camera.eye,[])))*Math.tan(M.perspective.fov/2*Math.PI/180);n.panDeltaX-=P*I/l*s.touchPanRate,n.panDeltaY-=C*I/l*s.touchPanRate}else n.panDeltaX-=.5*M.ortho.scale*(P/l)*s.touchPanRate,n.panDeltaY-=.5*M.ortho.scale*(C/l)*s.touchPanRate;r.pointerCanvasPos=w}for(var D=0;D-1&&t-c<150&&(h>-1&&c-h<325?(Yd(n[0],a.pickCursorPos),a.schedulePickEntity=!0,a.schedulePickSurface=o,a.update(),a.pickResult?(a.pickResult.touchInput=!0,l.fire("doublePicked",a.pickResult),a.pickedSurface&&l.fire("doublePickedSurface",a.pickResult),s.doublePickFlyTo&&p(a.pickResult)):(l.fire("doublePickedNothing"),s.doublePickFlyTo&&p()),h=-1):$.distVec2(u[0],A)<4&&(Yd(n[0],a.pickCursorPos),a.schedulePickEntity=!0,a.schedulePickSurface=o,a.update(),a.pickResult?(a.pickResult.touchInput=!0,l.fire("picked",a.pickResult),a.pickedSurface&&l.fire("pickedSurface",a.pickResult)):l.fire("pickedNothing"),h=t),c=-1),u.length=i.length;for(var d=0,f=i.length;d1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(s=t.call(this,e,r)).PAN_LEFT=0,s.PAN_RIGHT=1,s.PAN_UP=2,s.PAN_DOWN=3,s.PAN_FORWARDS=4,s.PAN_BACKWARDS=5,s.ROTATE_X_POS=6,s.ROTATE_X_NEG=7,s.ROTATE_Y_POS=8,s.ROTATE_Y_NEG=9,s.DOLLY_FORWARDS=10,s.DOLLY_BACKWARDS=11,s.AXIS_VIEW_RIGHT=12,s.AXIS_VIEW_BACK=13,s.AXIS_VIEW_LEFT=14,s.AXIS_VIEW_FRONT=15,s.AXIS_VIEW_TOP=16,s.AXIS_VIEW_BOTTOM=17,s._keyMap={},s.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault()},s._configs={longTapTimeout:600,longTapRadius:5,active:!0,keyboardLayout:"qwerty",navMode:"orbit",planView:!1,firstPerson:!1,followPointer:!0,doublePickFlyTo:!0,panRightClick:!0,showPivot:!1,pointerEnabled:!0,constrainVertical:!1,smartPivot:!1,doubleClickTimeFrame:250,snapToVertex:true,snapToEdge:true,snapRadius:30,dragRotationRate:360,keyboardRotationRate:90,rotationInertia:0,keyboardPanRate:1,touchPanRate:1,panInertia:.5,keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:.2,dollyInertia:0,dollyProximityThreshold:30,dollyMinSpeed:.04},s._states={pointerCanvasPos:$.vec2(),mouseover:!1,followPointerDirty:!0,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,activeTouches:[],tapStartPos:$.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null},s._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};var n=s.scene;return s._controllers={cameraControl:b(s),pickController:new Dd(b(s),s._configs),pivotController:new Id(n,s._configs),panController:new xd(n),cameraFlight:new zh(b(s),{duration:.5})},s._handlers=[new Wd(s.scene,s._controllers,s._configs,s._states,s._updates),new Jd(s.scene,s._controllers,s._configs,s._states,s._updates),new Td(s.scene,s._controllers,s._configs,s._states,s._updates),new Vd(s.scene,s._controllers,s._configs,s._states,s._updates),new Hd(s.scene,s._controllers,s._configs,s._states,s._updates),new Zd(s.scene,s._controllers,s._configs,s._states,s._updates),new jd(s.scene,s._controllers,s._configs,s._states,s._updates)],s._cameraUpdater=new zd(s.scene,s._controllers,s._configs,s._states,s._updates),s.navMode=r.navMode,r.planView&&(s.planView=r.planView),s.constrainVertical=r.constrainVertical,r.keyboardLayout?s.keyboardLayout=r.keyboardLayout:s.keyMap=r.keyMap,s.doublePickFlyTo=r.doublePickFlyTo,s.panRightClick=r.panRightClick,s.active=r.active,s.followPointer=r.followPointer,s.rotationInertia=r.rotationInertia,s.keyboardPanRate=r.keyboardPanRate,s.touchPanRate=r.touchPanRate,s.keyboardRotationRate=r.keyboardRotationRate,s.dragRotationRate=r.dragRotationRate,s.touchDollyRate=r.touchDollyRate,s.dollyInertia=r.dollyInertia,s.dollyProximityThreshold=r.dollyProximityThreshold,s.dollyMinSpeed=r.dollyMinSpeed,s.panInertia=r.panInertia,s.pointerEnabled=!0,s.keyboardDollyRate=r.keyboardDollyRate,s.mouseWheelDollyRate=r.mouseWheelDollyRate,s}return C(i,[{key:"keyMap",get:function(){return this._keyMap},set:function(e){if(e=e||"qwerty",le.isString(e)){var t=this.scene.input,i={};switch(e){default:this.error("Unsupported value for 'keyMap': "+e+" defaulting to 'qwerty'");case"qwerty":i[this.PAN_LEFT]=[t.KEY_A],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_Z],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_W,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_Q,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6];break;case"azerty":i[this.PAN_LEFT]=[t.KEY_Q],i[this.PAN_RIGHT]=[t.KEY_D],i[this.PAN_UP]=[t.KEY_W],i[this.PAN_DOWN]=[t.KEY_X],i[this.PAN_BACKWARDS]=[],i[this.PAN_FORWARDS]=[],i[this.DOLLY_FORWARDS]=[t.KEY_Z,t.KEY_ADD],i[this.DOLLY_BACKWARDS]=[t.KEY_S,t.KEY_SUBTRACT],i[this.ROTATE_X_POS]=[t.KEY_DOWN_ARROW],i[this.ROTATE_X_NEG]=[t.KEY_UP_ARROW],i[this.ROTATE_Y_POS]=[t.KEY_A,t.KEY_LEFT_ARROW],i[this.ROTATE_Y_NEG]=[t.KEY_E,t.KEY_RIGHT_ARROW],i[this.AXIS_VIEW_RIGHT]=[t.KEY_NUM_1],i[this.AXIS_VIEW_BACK]=[t.KEY_NUM_2],i[this.AXIS_VIEW_LEFT]=[t.KEY_NUM_3],i[this.AXIS_VIEW_FRONT]=[t.KEY_NUM_4],i[this.AXIS_VIEW_TOP]=[t.KEY_NUM_5],i[this.AXIS_VIEW_BOTTOM]=[t.KEY_NUM_6]}this._keyMap=i}else{var s=e;this._keyMap=s}}},{key:"_isKeyDownForAction",value:function(e,t){var i=this._keyMap[e];if(!i)return!1;t||(t=this.scene.input.keyDown);for(var s=0,r=i.length;s0&&void 0!==arguments[0]?arguments[0]:{};this._controllers.pivotController.enablePivotSphere(e)}},{key:"disablePivotSphere",value:function(){this._controllers.pivotController.disablePivotSphere()}},{key:"smartPivot",get:function(){return this._configs.smartPivot},set:function(e){this._configs.smartPivot=!1!==e}},{key:"doubleClickTimeFrame",get:function(){return this._configs.doubleClickTimeFrame},set:function(e){this._configs.doubleClickTimeFrame=null!=e?e:250}},{key:"destroy",value:function(){this._destroyHandlers(),this._destroyControllers(),this._cameraUpdater.destroy(),f(B(i.prototype),"destroy",this).call(this)}},{key:"_destroyHandlers",value:function(){for(var e=0,t=this._handlers.length;e1&&void 0!==arguments[1]?arguments[1]:{};if(this.finalized)throw"MetaScene already finalized - can't add more data";this._globalizeIDs(e,t);var i=this.metaScene,s=e.properties;if(e.propertySets)for(var r=0,n=e.propertySets.length;r0?rp(t):null,o=i&&i.length>0?rp(i):null;return function e(t){if(t){var i=!0;(o&&o[t.type]||n&&!n[t.type])&&(i=!1),i&&s.push(t.id);var r=t.children;if(r)for(var a=0,l=r.length;a * Copyright (c) 2022 Niklas von Hertzen diff --git a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.json b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.json index fc45a2850b..43da28ac48 100644 --- a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.json +++ b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2311, + "end": 2535, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, "program": { "type": "Program", "start": 0, - "end": 2311, + "end": 2535, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -135,14 +135,14 @@ { "type": "ExportNamedDeclaration", "start": 190, - "end": 2311, + "end": 2535, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -151,14 +151,14 @@ "declaration": { "type": "ClassDeclaration", "start": 197, - "end": 2311, + "end": 2535, "loc": { "start": { "line": 9, "column": 7 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -200,14 +200,14 @@ "body": { "type": "ClassBody", "start": 246, - "end": 2311, + "end": 2535, "loc": { "start": { "line": 9, "column": 56 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -818,16 +818,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 2095, - "end": 2287, + "end": 2255, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, "column": 7 } } @@ -836,15 +836,15 @@ }, { "type": "ClassMethod", - "start": 2292, - "end": 2309, + "start": 2260, + "end": 2313, "loc": { "start": { - "line": 82, + "line": 80, "column": 4 }, "end": { - "line": 83, + "line": 82, "column": 5 } }, @@ -852,15 +852,140 @@ "computed": false, "key": { "type": "Identifier", - "start": 2292, - "end": 2299, + "start": 2264, + "end": 2282, + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 2285, + "end": 2313, "loc": { "start": { + "line": 80, + "column": 29 + }, + "end": { "line": 82, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 2295, + "end": 2307, + "loc": { + "start": { + "line": 81, + "column": 8 + }, + "end": { + "line": 81, + "column": 20 + } + }, + "argument": { + "type": "NullLiteral", + "start": 2302, + "end": 2306, + "loc": { + "start": { + "line": 81, + "column": 15 + }, + "end": { + "line": 81, + "column": 19 + } + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 2095, + "end": 2255, + "loc": { + "start": { + "line": 75, + "column": 4 + }, + "end": { + "line": 79, + "column": 7 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "start": 2319, + "end": 2511, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 2516, + "end": 2533, + "loc": { + "start": { + "line": 91, + "column": 4 + }, + "end": { + "line": 92, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 2516, + "end": 2523, + "loc": { + "start": { + "line": 91, "column": 4 }, "end": { - "line": 82, + "line": 91, "column": 11 }, "identifierName": "destroy" @@ -876,15 +1001,15 @@ "params": [], "body": { "type": "BlockStatement", - "start": 2302, - "end": 2309, + "start": 2526, + "end": 2533, "loc": { "start": { - "line": 82, + "line": 91, "column": 14 }, "end": { - "line": 83, + "line": 92, "column": 5 } }, @@ -895,15 +1020,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", - "start": 2095, - "end": 2287, + "start": 2319, + "end": 2511, "loc": { "start": { - "line": 75, + "line": 84, "column": 4 }, "end": { - "line": 81, + "line": 90, "column": 7 } } @@ -1069,16 +1194,32 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 2095, - "end": 2287, + "end": 2255, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, + "column": 7 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "start": 2319, + "end": 2511, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, "column": 7 } } @@ -2485,16 +2626,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 2095, - "end": 2287, + "end": 2255, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, "column": 7 } } @@ -2511,9 +2652,217 @@ "postfix": false, "binop": null }, - "value": "destroy", - "start": 2292, - "end": 2299, + "value": "get", + "start": 2260, + "end": 2263, + "loc": { + "start": { + "line": 80, + "column": 4 + }, + "end": { + "line": 80, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 2264, + "end": 2282, + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2282, + "end": 2283, + "loc": { + "start": { + "line": 80, + "column": 26 + }, + "end": { + "line": 80, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2283, + "end": 2284, + "loc": { + "start": { + "line": 80, + "column": 27 + }, + "end": { + "line": 80, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2285, + "end": 2286, + "loc": { + "start": { + "line": 80, + "column": 29 + }, + "end": { + "line": 80, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2295, + "end": 2301, + "loc": { + "start": { + "line": 81, + "column": 8 + }, + "end": { + "line": 81, + "column": 14 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2302, + "end": 2306, + "loc": { + "start": { + "line": 81, + "column": 15 + }, + "end": { + "line": 81, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2306, + "end": 2307, + "loc": { + "start": { + "line": 81, + "column": 19 + }, + "end": { + "line": 81, + "column": 20 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2312, + "end": 2313, "loc": { "start": { "line": 82, @@ -2521,6 +2870,48 @@ }, "end": { "line": 82, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n ", + "start": 2319, + "end": 2511, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "destroy", + "start": 2516, + "end": 2523, + "loc": { + "start": { + "line": 91, + "column": 4 + }, + "end": { + "line": 91, "column": 11 } } @@ -2537,15 +2928,15 @@ "postfix": false, "binop": null }, - "start": 2299, - "end": 2300, + "start": 2523, + "end": 2524, "loc": { "start": { - "line": 82, + "line": 91, "column": 11 }, "end": { - "line": 82, + "line": 91, "column": 12 } } @@ -2562,15 +2953,15 @@ "postfix": false, "binop": null }, - "start": 2300, - "end": 2301, + "start": 2524, + "end": 2525, "loc": { "start": { - "line": 82, + "line": 91, "column": 12 }, "end": { - "line": 82, + "line": 91, "column": 13 } } @@ -2587,15 +2978,15 @@ "postfix": false, "binop": null }, - "start": 2302, - "end": 2303, + "start": 2526, + "end": 2527, "loc": { "start": { - "line": 82, + "line": 91, "column": 14 }, "end": { - "line": 82, + "line": 91, "column": 15 } } @@ -2612,15 +3003,15 @@ "postfix": false, "binop": null }, - "start": 2308, - "end": 2309, + "start": 2532, + "end": 2533, "loc": { "start": { - "line": 83, + "line": 92, "column": 4 }, "end": { - "line": 83, + "line": 92, "column": 5 } } @@ -2637,15 +3028,15 @@ "postfix": false, "binop": null }, - "start": 2310, - "end": 2311, + "start": 2534, + "end": 2535, "loc": { "start": { - "line": 84, + "line": 93, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } } @@ -2663,15 +3054,15 @@ "binop": null, "updateContext": null }, - "start": 2311, - "end": 2311, + "start": 2535, + "end": 2535, "loc": { "start": { - "line": 84, + "line": 93, "column": 1 }, "end": { - "line": 84, + "line": 93, "column": 1 } } diff --git a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.json b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.json index 60a5fd636f..5f6350eb32 100644 --- a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.json +++ b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 18888, + "end": 19228, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 451, + "line": 460, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 18888, + "end": 19228, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 451, + "line": 460, "column": 0 } }, @@ -431,14 +431,14 @@ { "type": "ExportNamedDeclaration", "start": 1252, - "end": 18887, + "end": 19227, "loc": { "start": { "line": 44, "column": 0 }, "end": { - "line": 450, + "line": 459, "column": 1 } }, @@ -447,14 +447,14 @@ "declaration": { "type": "ClassDeclaration", "start": 1259, - "end": 18887, + "end": 19227, "loc": { "start": { "line": 44, "column": 7 }, "end": { - "line": 450, + "line": 459, "column": 1 } }, @@ -496,14 +496,14 @@ "body": { "type": "ClassBody", "start": 1328, - "end": 18887, + "end": 19227, "loc": { "start": { "line": 44, "column": 76 }, "end": { - "line": 450, + "line": 459, "column": 1 } }, @@ -6293,7 +6293,7 @@ { "type": "ClassMethod", "start": 5754, - "end": 17108, + "end": 17194, "loc": { "start": { "line": 174, @@ -6333,7 +6333,7 @@ "body": { "type": "BlockStatement", "start": 5765, - "end": 17108, + "end": 17194, "loc": { "start": { "line": 174, @@ -8004,7 +8004,7 @@ { "type": "VariableDeclaration", "start": 6594, - "end": 6675, + "end": 6718, "loc": { "start": { "line": 196, @@ -8012,14 +8012,14 @@ }, "end": { "line": 196, - "column": 89 + "column": 132 } }, "declarations": [ { "type": "VariableDeclarator", "start": 6600, - "end": 6674, + "end": 6717, "loc": { "start": { "line": 196, @@ -8027,7 +8027,7 @@ }, "end": { "line": 196, - "column": 88 + "column": 131 } }, "id": { @@ -8050,7 +8050,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 6609, - "end": 6674, + "end": 6717, "loc": { "start": { "line": 196, @@ -8058,7 +8058,7 @@ }, "end": { "line": 196, - "column": 88 + "column": 131 } }, "id": null, @@ -8087,7 +8087,7 @@ "body": { "type": "BinaryExpression", "start": 6615, - "end": 6674, + "end": 6717, "loc": { "start": { "line": 196, @@ -8095,7 +8095,7 @@ }, "end": { "line": 196, - "column": 88 + "column": 131 } }, "left": { @@ -8152,7 +8152,7 @@ "right": { "type": "LogicalExpression", "start": 6631, - "end": 6673, + "end": 6716, "loc": { "start": { "line": 196, @@ -8160,13 +8160,13 @@ }, "end": { "line": 196, - "column": 87 + "column": 130 } }, "left": { - "type": "MemberExpression", + "type": "LogicalExpression", "start": 6631, - "end": 6646, + "end": 6689, "loc": { "start": { "line": 196, @@ -8174,13 +8174,13 @@ }, "end": { "line": 196, - "column": 60 + "column": 103 } }, - "object": { - "type": "Identifier", + "left": { + "type": "MemberExpression", "start": 6631, - "end": 6633, + "end": 6646, "loc": { "start": { "line": 196, @@ -8188,58 +8188,194 @@ }, "end": { "line": 196, - "column": 47 + "column": 60 + } + }, + "object": { + "type": "Identifier", + "start": 6631, + "end": 6633, + "loc": { + "start": { + "line": 196, + "column": 45 + }, + "end": { + "line": 196, + "column": 47 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6634, + "end": 6646, + "loc": { + "start": { + "line": 196, + "column": 48 + }, + "end": { + "line": 196, + "column": 60 + }, + "identifierName": "offsetParent" }, - "identifierName": "el" + "name": "offsetParent" }, - "name": "el" + "computed": false }, - "property": { - "type": "Identifier", - "start": 6634, - "end": 6646, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 6651, + "end": 6688, "loc": { "start": { "line": 196, - "column": 48 + "column": 65 }, "end": { "line": 196, - "column": 60 + "column": 102 + } + }, + "left": { + "type": "MemberExpression", + "start": 6651, + "end": 6666, + "loc": { + "start": { + "line": 196, + "column": 65 + }, + "end": { + "line": 196, + "column": 80 + } + }, + "object": { + "type": "Identifier", + "start": 6651, + "end": 6653, + "loc": { + "start": { + "line": 196, + "column": 65 + }, + "end": { + "line": 196, + "column": 67 + }, + "identifierName": "el" + }, + "name": "el" }, - "identifierName": "offsetParent" + "property": { + "type": "Identifier", + "start": 6654, + "end": 6666, + "loc": { + "start": { + "line": 196, + "column": 68 + }, + "end": { + "line": 196, + "column": 80 + }, + "identifierName": "offsetParent" + }, + "name": "offsetParent" + }, + "computed": false }, - "name": "offsetParent" - }, - "computed": false + "operator": "!==", + "right": { + "type": "MemberExpression", + "start": 6671, + "end": 6688, + "loc": { + "start": { + "line": 196, + "column": 85 + }, + "end": { + "line": 196, + "column": 102 + } + }, + "object": { + "type": "Identifier", + "start": 6671, + "end": 6677, + "loc": { + "start": { + "line": 196, + "column": 85 + }, + "end": { + "line": 196, + "column": 91 + }, + "identifierName": "canvas" + }, + "name": "canvas" + }, + "property": { + "type": "Identifier", + "start": 6678, + "end": 6688, + "loc": { + "start": { + "line": 196, + "column": 92 + }, + "end": { + "line": 196, + "column": 102 + }, + "identifierName": "parentNode" + }, + "name": "parentNode" + }, + "computed": false + }, + "extra": { + "parenthesized": true, + "parenStart": 6650 + } + } }, "operator": "&&", "right": { "type": "CallExpression", - "start": 6650, - "end": 6673, + "start": 6693, + "end": 6716, "loc": { "start": { "line": 196, - "column": 64 + "column": 107 }, "end": { "line": 196, - "column": 87 + "column": 130 } }, "callee": { "type": "Identifier", - "start": 6650, - "end": 6656, + "start": 6693, + "end": 6699, "loc": { "start": { "line": 196, - "column": 64 + "column": 107 }, "end": { "line": 196, - "column": 70 + "column": 113 }, "identifierName": "getTop" }, @@ -8248,30 +8384,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 6657, - "end": 6672, + "start": 6700, + "end": 6715, "loc": { "start": { "line": 196, - "column": 71 + "column": 114 }, "end": { "line": 196, - "column": 86 + "column": 129 } }, "object": { "type": "Identifier", - "start": 6657, - "end": 6659, + "start": 6700, + "end": 6702, "loc": { "start": { "line": 196, - "column": 71 + "column": 114 }, "end": { "line": 196, - "column": 73 + "column": 116 }, "identifierName": "el" }, @@ -8279,16 +8415,16 @@ }, "property": { "type": "Identifier", - "start": 6660, - "end": 6672, + "start": 6703, + "end": 6715, "loc": { "start": { "line": 196, - "column": 74 + "column": 117 }, "end": { "line": 196, - "column": 86 + "column": 129 }, "identifierName": "offsetParent" }, @@ -8311,8 +8447,8 @@ }, { "type": "VariableDeclaration", - "start": 6684, - "end": 6768, + "start": 6727, + "end": 6854, "loc": { "start": { "line": 197, @@ -8320,14 +8456,14 @@ }, "end": { "line": 197, - "column": 92 + "column": 135 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 6690, - "end": 6767, + "start": 6733, + "end": 6853, "loc": { "start": { "line": 197, @@ -8335,13 +8471,13 @@ }, "end": { "line": 197, - "column": 91 + "column": 134 } }, "id": { "type": "Identifier", - "start": 6690, - "end": 6697, + "start": 6733, + "end": 6740, "loc": { "start": { "line": 197, @@ -8357,8 +8493,8 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 6700, - "end": 6767, + "start": 6743, + "end": 6853, "loc": { "start": { "line": 197, @@ -8366,7 +8502,7 @@ }, "end": { "line": 197, - "column": 91 + "column": 134 } }, "id": null, @@ -8376,8 +8512,8 @@ "params": [ { "type": "Identifier", - "start": 6700, - "end": 6702, + "start": 6743, + "end": 6745, "loc": { "start": { "line": 197, @@ -8394,8 +8530,8 @@ ], "body": { "type": "BinaryExpression", - "start": 6706, - "end": 6767, + "start": 6749, + "end": 6853, "loc": { "start": { "line": 197, @@ -8403,13 +8539,13 @@ }, "end": { "line": 197, - "column": 91 + "column": 134 } }, "left": { "type": "MemberExpression", - "start": 6706, - "end": 6719, + "start": 6749, + "end": 6762, "loc": { "start": { "line": 197, @@ -8422,8 +8558,8 @@ }, "object": { "type": "Identifier", - "start": 6706, - "end": 6708, + "start": 6749, + "end": 6751, "loc": { "start": { "line": 197, @@ -8439,8 +8575,8 @@ }, "property": { "type": "Identifier", - "start": 6709, - "end": 6719, + "start": 6752, + "end": 6762, "loc": { "start": { "line": 197, @@ -8459,8 +8595,8 @@ "operator": "+", "right": { "type": "LogicalExpression", - "start": 6723, - "end": 6766, + "start": 6766, + "end": 6852, "loc": { "start": { "line": 197, @@ -8468,13 +8604,13 @@ }, "end": { "line": 197, - "column": 90 + "column": 133 } }, "left": { - "type": "MemberExpression", - "start": 6723, - "end": 6738, + "type": "LogicalExpression", + "start": 6766, + "end": 6824, "loc": { "start": { "line": 197, @@ -8482,13 +8618,13 @@ }, "end": { "line": 197, - "column": 62 + "column": 105 } }, - "object": { - "type": "Identifier", - "start": 6723, - "end": 6725, + "left": { + "type": "MemberExpression", + "start": 6766, + "end": 6781, "loc": { "start": { "line": 197, @@ -8496,58 +8632,194 @@ }, "end": { "line": 197, - "column": 49 + "column": 62 + } + }, + "object": { + "type": "Identifier", + "start": 6766, + "end": 6768, + "loc": { + "start": { + "line": 197, + "column": 47 + }, + "end": { + "line": 197, + "column": 49 + }, + "identifierName": "el" }, - "identifierName": "el" + "name": "el" }, - "name": "el" + "property": { + "type": "Identifier", + "start": 6769, + "end": 6781, + "loc": { + "start": { + "line": 197, + "column": 50 + }, + "end": { + "line": 197, + "column": 62 + }, + "identifierName": "offsetParent" + }, + "name": "offsetParent" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 6726, - "end": 6738, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 6786, + "end": 6823, "loc": { "start": { "line": 197, - "column": 50 + "column": 67 }, "end": { "line": 197, - "column": 62 + "column": 104 + } + }, + "left": { + "type": "MemberExpression", + "start": 6786, + "end": 6801, + "loc": { + "start": { + "line": 197, + "column": 67 + }, + "end": { + "line": 197, + "column": 82 + } + }, + "object": { + "type": "Identifier", + "start": 6786, + "end": 6788, + "loc": { + "start": { + "line": 197, + "column": 67 + }, + "end": { + "line": 197, + "column": 69 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6789, + "end": 6801, + "loc": { + "start": { + "line": 197, + "column": 70 + }, + "end": { + "line": 197, + "column": 82 + }, + "identifierName": "offsetParent" + }, + "name": "offsetParent" }, - "identifierName": "offsetParent" + "computed": false }, - "name": "offsetParent" - }, - "computed": false + "operator": "!==", + "right": { + "type": "MemberExpression", + "start": 6806, + "end": 6823, + "loc": { + "start": { + "line": 197, + "column": 87 + }, + "end": { + "line": 197, + "column": 104 + } + }, + "object": { + "type": "Identifier", + "start": 6806, + "end": 6812, + "loc": { + "start": { + "line": 197, + "column": 87 + }, + "end": { + "line": 197, + "column": 93 + }, + "identifierName": "canvas" + }, + "name": "canvas" + }, + "property": { + "type": "Identifier", + "start": 6813, + "end": 6823, + "loc": { + "start": { + "line": 197, + "column": 94 + }, + "end": { + "line": 197, + "column": 104 + }, + "identifierName": "parentNode" + }, + "name": "parentNode" + }, + "computed": false + }, + "extra": { + "parenthesized": true, + "parenStart": 6785 + } + } }, "operator": "&&", "right": { "type": "CallExpression", - "start": 6742, - "end": 6766, + "start": 6828, + "end": 6852, "loc": { "start": { "line": 197, - "column": 66 + "column": 109 }, "end": { "line": 197, - "column": 90 + "column": 133 } }, "callee": { "type": "Identifier", - "start": 6742, - "end": 6749, + "start": 6828, + "end": 6835, "loc": { "start": { "line": 197, - "column": 66 + "column": 109 }, "end": { "line": 197, - "column": 73 + "column": 116 }, "identifierName": "getLeft" }, @@ -8556,30 +8828,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 6750, - "end": 6765, + "start": 6836, + "end": 6851, "loc": { "start": { "line": 197, - "column": 74 + "column": 117 }, "end": { "line": 197, - "column": 89 + "column": 132 } }, "object": { "type": "Identifier", - "start": 6750, - "end": 6752, + "start": 6836, + "end": 6838, "loc": { "start": { "line": 197, - "column": 74 + "column": 117 }, "end": { "line": 197, - "column": 76 + "column": 119 }, "identifierName": "el" }, @@ -8587,16 +8859,16 @@ }, "property": { "type": "Identifier", - "start": 6753, - "end": 6765, + "start": 6839, + "end": 6851, "loc": { "start": { "line": 197, - "column": 77 + "column": 120 }, "end": { "line": 197, - "column": 89 + "column": 132 }, "identifierName": "offsetParent" }, @@ -8608,7 +8880,7 @@ }, "extra": { "parenthesized": true, - "parenStart": 6722 + "parenStart": 6765 } } } @@ -8619,8 +8891,8 @@ }, { "type": "VariableDeclaration", - "start": 6778, - "end": 6806, + "start": 6864, + "end": 6892, "loc": { "start": { "line": 199, @@ -8634,8 +8906,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 6784, - "end": 6805, + "start": 6870, + "end": 6891, "loc": { "start": { "line": 199, @@ -8648,8 +8920,8 @@ }, "id": { "type": "Identifier", - "start": 6784, - "end": 6791, + "start": 6870, + "end": 6877, "loc": { "start": { "line": 199, @@ -8665,8 +8937,8 @@ }, "init": { "type": "CallExpression", - "start": 6794, - "end": 6805, + "start": 6880, + "end": 6891, "loc": { "start": { "line": 199, @@ -8679,8 +8951,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6794, - "end": 6803, + "start": 6880, + "end": 6889, "loc": { "start": { "line": 199, @@ -8693,8 +8965,8 @@ }, "object": { "type": "Identifier", - "start": 6794, - "end": 6798, + "start": 6880, + "end": 6884, "loc": { "start": { "line": 199, @@ -8710,8 +8982,8 @@ }, "property": { "type": "Identifier", - "start": 6799, - "end": 6803, + "start": 6885, + "end": 6889, "loc": { "start": { "line": 199, @@ -8735,8 +9007,8 @@ }, { "type": "ExpressionStatement", - "start": 6816, - "end": 10588, + "start": 6902, + "end": 10674, "loc": { "start": { "line": 201, @@ -8749,8 +9021,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6816, - "end": 10587, + "start": 6902, + "end": 10673, "loc": { "start": { "line": 201, @@ -8764,8 +9036,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6816, - "end": 6841, + "start": 6902, + "end": 6927, "loc": { "start": { "line": 201, @@ -8778,8 +9050,8 @@ }, "object": { "type": "ThisExpression", - "start": 6816, - "end": 6820, + "start": 6902, + "end": 6906, "loc": { "start": { "line": 201, @@ -8793,8 +9065,8 @@ }, "property": { "type": "Identifier", - "start": 6821, - "end": 6841, + "start": 6907, + "end": 6927, "loc": { "start": { "line": 201, @@ -8812,8 +9084,8 @@ }, "right": { "type": "CallExpression", - "start": 6844, - "end": 10587, + "start": 6930, + "end": 10673, "loc": { "start": { "line": 201, @@ -8826,8 +9098,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6844, - "end": 6860, + "start": 6930, + "end": 6946, "loc": { "start": { "line": 201, @@ -8840,8 +9112,8 @@ }, "object": { "type": "Identifier", - "start": 6844, - "end": 6857, + "start": 6930, + "end": 6943, "loc": { "start": { "line": 201, @@ -8857,8 +9129,8 @@ }, "property": { "type": "Identifier", - "start": 6858, - "end": 6860, + "start": 6944, + "end": 6946, "loc": { "start": { "line": 201, @@ -8877,8 +9149,8 @@ "arguments": [ { "type": "ConditionalExpression", - "start": 6874, - "end": 6960, + "start": 6960, + "end": 7046, "loc": { "start": { "line": 202, @@ -8891,8 +9163,8 @@ }, "test": { "type": "MemberExpression", - "start": 6874, - "end": 6888, + "start": 6960, + "end": 6974, "loc": { "start": { "line": 202, @@ -8905,8 +9177,8 @@ }, "object": { "type": "ThisExpression", - "start": 6874, - "end": 6878, + "start": 6960, + "end": 6964, "loc": { "start": { "line": 202, @@ -8920,8 +9192,8 @@ }, "property": { "type": "Identifier", - "start": 6879, - "end": 6888, + "start": 6965, + "end": 6974, "loc": { "start": { "line": 202, @@ -8939,8 +9211,8 @@ }, "consequent": { "type": "StringLiteral", - "start": 6907, - "end": 6927, + "start": 6993, + "end": 7013, "loc": { "start": { "line": 203, @@ -8959,8 +9231,8 @@ }, "alternate": { "type": "StringLiteral", - "start": 6946, - "end": 6960, + "start": 7032, + "end": 7046, "loc": { "start": { "line": 204, @@ -8980,8 +9252,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 6974, - "end": 10586, + "start": 7060, + "end": 10672, "loc": { "start": { "line": 205, @@ -8999,8 +9271,8 @@ "params": [ { "type": "Identifier", - "start": 6974, - "end": 6979, + "start": 7060, + "end": 7065, "loc": { "start": { "line": 205, @@ -9017,8 +9289,8 @@ ], "body": { "type": "BlockStatement", - "start": 6983, - "end": 10586, + "start": 7069, + "end": 10672, "loc": { "start": { "line": 205, @@ -9032,8 +9304,8 @@ "body": [ { "type": "IfStatement", - "start": 7001, - "end": 7994, + "start": 7087, + "end": 8080, "loc": { "start": { "line": 206, @@ -9046,8 +9318,8 @@ }, "test": { "type": "LogicalExpression", - "start": 7005, - "end": 7049, + "start": 7091, + "end": 7135, "loc": { "start": { "line": 206, @@ -9060,8 +9332,8 @@ }, "left": { "type": "MemberExpression", - "start": 7005, - "end": 7026, + "start": 7091, + "end": 7112, "loc": { "start": { "line": 206, @@ -9074,8 +9346,8 @@ }, "object": { "type": "Identifier", - "start": 7005, - "end": 7010, + "start": 7091, + "end": 7096, "loc": { "start": { "line": 206, @@ -9091,8 +9363,8 @@ }, "property": { "type": "Identifier", - "start": 7011, - "end": 7026, + "start": 7097, + "end": 7112, "loc": { "start": { "line": 206, @@ -9111,8 +9383,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 7030, - "end": 7049, + "start": 7116, + "end": 7135, "loc": { "start": { "line": 206, @@ -9125,8 +9397,8 @@ }, "object": { "type": "Identifier", - "start": 7030, - "end": 7035, + "start": 7116, + "end": 7121, "loc": { "start": { "line": 206, @@ -9142,8 +9414,8 @@ }, "property": { "type": "Identifier", - "start": 7036, - "end": 7049, + "start": 7122, + "end": 7135, "loc": { "start": { "line": 206, @@ -9162,8 +9434,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7051, - "end": 7536, + "start": 7137, + "end": 7622, "loc": { "start": { "line": 206, @@ -9177,8 +9449,8 @@ "body": [ { "type": "IfStatement", - "start": 7073, - "end": 7380, + "start": 7159, + "end": 7466, "loc": { "start": { "line": 207, @@ -9191,8 +9463,8 @@ }, "test": { "type": "Identifier", - "start": 7077, - "end": 7088, + "start": 7163, + "end": 7174, "loc": { "start": { "line": 207, @@ -9208,8 +9480,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7090, - "end": 7380, + "start": 7176, + "end": 7466, "loc": { "start": { "line": 207, @@ -9223,8 +9495,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7116, - "end": 7143, + "start": 7202, + "end": 7229, "loc": { "start": { "line": 208, @@ -9237,8 +9509,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7116, - "end": 7142, + "start": 7202, + "end": 7228, "loc": { "start": { "line": 208, @@ -9252,8 +9524,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7116, - "end": 7135, + "start": 7202, + "end": 7221, "loc": { "start": { "line": 208, @@ -9266,8 +9538,8 @@ }, "object": { "type": "Identifier", - "start": 7116, - "end": 7127, + "start": 7202, + "end": 7213, "loc": { "start": { "line": 208, @@ -9283,8 +9555,8 @@ }, "property": { "type": "Identifier", - "start": 7128, - "end": 7135, + "start": 7214, + "end": 7221, "loc": { "start": { "line": 208, @@ -9302,8 +9574,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7138, - "end": 7142, + "start": 7224, + "end": 7228, "loc": { "start": { "line": 208, @@ -9320,8 +9592,8 @@ }, { "type": "ExpressionStatement", - "start": 7168, - "end": 7208, + "start": 7254, + "end": 7294, "loc": { "start": { "line": 209, @@ -9334,8 +9606,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7168, - "end": 7207, + "start": 7254, + "end": 7293, "loc": { "start": { "line": 209, @@ -9349,8 +9621,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7168, - "end": 7189, + "start": 7254, + "end": 7275, "loc": { "start": { "line": 209, @@ -9363,8 +9635,8 @@ }, "object": { "type": "Identifier", - "start": 7168, - "end": 7179, + "start": 7254, + "end": 7265, "loc": { "start": { "line": 209, @@ -9380,8 +9652,8 @@ }, "property": { "type": "Identifier", - "start": 7180, - "end": 7189, + "start": 7266, + "end": 7275, "loc": { "start": { "line": 209, @@ -9399,8 +9671,8 @@ }, "right": { "type": "MemberExpression", - "start": 7192, - "end": 7207, + "start": 7278, + "end": 7293, "loc": { "start": { "line": 209, @@ -9413,8 +9685,8 @@ }, "object": { "type": "Identifier", - "start": 7192, - "end": 7197, + "start": 7278, + "end": 7283, "loc": { "start": { "line": 209, @@ -9430,8 +9702,8 @@ }, "property": { "type": "Identifier", - "start": 7198, - "end": 7207, + "start": 7284, + "end": 7293, "loc": { "start": { "line": 209, @@ -9451,8 +9723,8 @@ }, { "type": "ExpressionStatement", - "start": 7233, - "end": 7306, + "start": 7319, + "end": 7392, "loc": { "start": { "line": 210, @@ -9465,8 +9737,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7233, - "end": 7305, + "start": 7319, + "end": 7391, "loc": { "start": { "line": 210, @@ -9480,8 +9752,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7233, - "end": 7261, + "start": 7319, + "end": 7347, "loc": { "start": { "line": 210, @@ -9494,8 +9766,8 @@ }, "object": { "type": "Identifier", - "start": 7233, - "end": 7244, + "start": 7319, + "end": 7330, "loc": { "start": { "line": 210, @@ -9511,8 +9783,8 @@ }, "property": { "type": "Identifier", - "start": 7245, - "end": 7261, + "start": 7331, + "end": 7347, "loc": { "start": { "line": 210, @@ -9530,8 +9802,8 @@ }, "right": { "type": "LogicalExpression", - "start": 7264, - "end": 7305, + "start": 7350, + "end": 7391, "loc": { "start": { "line": 210, @@ -9544,8 +9816,8 @@ }, "left": { "type": "MemberExpression", - "start": 7264, - "end": 7286, + "start": 7350, + "end": 7372, "loc": { "start": { "line": 210, @@ -9558,8 +9830,8 @@ }, "object": { "type": "Identifier", - "start": 7264, - "end": 7269, + "start": 7350, + "end": 7355, "loc": { "start": { "line": 210, @@ -9575,8 +9847,8 @@ }, "property": { "type": "Identifier", - "start": 7270, - "end": 7286, + "start": 7356, + "end": 7372, "loc": { "start": { "line": 210, @@ -9595,8 +9867,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 7290, - "end": 7305, + "start": 7376, + "end": 7391, "loc": { "start": { "line": 210, @@ -9609,8 +9881,8 @@ }, "object": { "type": "Identifier", - "start": 7290, - "end": 7295, + "start": 7376, + "end": 7381, "loc": { "start": { "line": 210, @@ -9626,8 +9898,8 @@ }, "property": { "type": "Identifier", - "start": 7296, - "end": 7305, + "start": 7382, + "end": 7391, "loc": { "start": { "line": 210, @@ -9648,8 +9920,8 @@ }, { "type": "ExpressionStatement", - "start": 7331, - "end": 7358, + "start": 7417, + "end": 7444, "loc": { "start": { "line": 211, @@ -9662,8 +9934,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7331, - "end": 7357, + "start": 7417, + "end": 7443, "loc": { "start": { "line": 211, @@ -9677,8 +9949,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7331, - "end": 7350, + "start": 7417, + "end": 7436, "loc": { "start": { "line": 211, @@ -9691,8 +9963,8 @@ }, "object": { "type": "Identifier", - "start": 7331, - "end": 7342, + "start": 7417, + "end": 7428, "loc": { "start": { "line": 211, @@ -9708,8 +9980,8 @@ }, "property": { "type": "Identifier", - "start": 7343, - "end": 7350, + "start": 7429, + "end": 7436, "loc": { "start": { "line": 211, @@ -9727,8 +9999,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7353, - "end": 7357, + "start": 7439, + "end": 7443, "loc": { "start": { "line": 211, @@ -9750,8 +10022,8 @@ }, { "type": "ExpressionStatement", - "start": 7401, - "end": 7449, + "start": 7487, + "end": 7535, "loc": { "start": { "line": 213, @@ -9764,8 +10036,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7401, - "end": 7448, + "start": 7487, + "end": 7534, "loc": { "start": { "line": 213, @@ -9779,8 +10051,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7401, - "end": 7432, + "start": 7487, + "end": 7518, "loc": { "start": { "line": 213, @@ -9793,8 +10065,8 @@ }, "object": { "type": "MemberExpression", - "start": 7401, - "end": 7421, + "start": 7487, + "end": 7507, "loc": { "start": { "line": 213, @@ -9807,8 +10079,8 @@ }, "object": { "type": "MemberExpression", - "start": 7401, - "end": 7415, + "start": 7487, + "end": 7501, "loc": { "start": { "line": 213, @@ -9821,8 +10093,8 @@ }, "object": { "type": "ThisExpression", - "start": 7401, - "end": 7405, + "start": 7487, + "end": 7491, "loc": { "start": { "line": 213, @@ -9836,8 +10108,8 @@ }, "property": { "type": "Identifier", - "start": 7406, - "end": 7415, + "start": 7492, + "end": 7501, "loc": { "start": { "line": 213, @@ -9855,8 +10127,8 @@ }, "property": { "type": "Identifier", - "start": 7416, - "end": 7421, + "start": 7502, + "end": 7507, "loc": { "start": { "line": 213, @@ -9874,8 +10146,8 @@ }, "property": { "type": "Identifier", - "start": 7422, - "end": 7432, + "start": 7508, + "end": 7518, "loc": { "start": { "line": 213, @@ -9893,8 +10165,8 @@ }, "right": { "type": "StringLiteral", - "start": 7435, - "end": 7448, + "start": 7521, + "end": 7534, "loc": { "start": { "line": 213, @@ -9915,8 +10187,8 @@ }, { "type": "ExpressionStatement", - "start": 7470, - "end": 7518, + "start": 7556, + "end": 7604, "loc": { "start": { "line": 214, @@ -9929,8 +10201,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7470, - "end": 7517, + "start": 7556, + "end": 7603, "loc": { "start": { "line": 214, @@ -9944,8 +10216,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7470, - "end": 7497, + "start": 7556, + "end": 7583, "loc": { "start": { "line": 214, @@ -9958,8 +10230,8 @@ }, "object": { "type": "MemberExpression", - "start": 7470, - "end": 7490, + "start": 7556, + "end": 7576, "loc": { "start": { "line": 214, @@ -9972,8 +10244,8 @@ }, "object": { "type": "MemberExpression", - "start": 7470, - "end": 7484, + "start": 7556, + "end": 7570, "loc": { "start": { "line": 214, @@ -9986,8 +10258,8 @@ }, "object": { "type": "ThisExpression", - "start": 7470, - "end": 7474, + "start": 7556, + "end": 7560, "loc": { "start": { "line": 214, @@ -10001,8 +10273,8 @@ }, "property": { "type": "Identifier", - "start": 7475, - "end": 7484, + "start": 7561, + "end": 7570, "loc": { "start": { "line": 214, @@ -10020,8 +10292,8 @@ }, "property": { "type": "Identifier", - "start": 7485, - "end": 7490, + "start": 7571, + "end": 7576, "loc": { "start": { "line": 214, @@ -10039,8 +10311,8 @@ }, "property": { "type": "Identifier", - "start": 7491, - "end": 7497, + "start": 7577, + "end": 7583, "loc": { "start": { "line": 214, @@ -10058,8 +10330,8 @@ }, "right": { "type": "StringLiteral", - "start": 7500, - "end": 7517, + "start": 7586, + "end": 7603, "loc": { "start": { "line": 214, @@ -10083,8 +10355,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 7542, - "end": 7994, + "start": 7628, + "end": 8080, "loc": { "start": { "line": 215, @@ -10098,8 +10370,8 @@ "body": [ { "type": "IfStatement", - "start": 7564, - "end": 7847, + "start": 7650, + "end": 7933, "loc": { "start": { "line": 216, @@ -10112,8 +10384,8 @@ }, "test": { "type": "Identifier", - "start": 7568, - "end": 7579, + "start": 7654, + "end": 7665, "loc": { "start": { "line": 216, @@ -10129,8 +10401,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7581, - "end": 7847, + "start": 7667, + "end": 7933, "loc": { "start": { "line": 216, @@ -10144,8 +10416,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7607, - "end": 7634, + "start": 7693, + "end": 7720, "loc": { "start": { "line": 217, @@ -10158,8 +10430,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7607, - "end": 7633, + "start": 7693, + "end": 7719, "loc": { "start": { "line": 217, @@ -10173,8 +10445,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7607, - "end": 7626, + "start": 7693, + "end": 7712, "loc": { "start": { "line": 217, @@ -10187,8 +10459,8 @@ }, "object": { "type": "Identifier", - "start": 7607, - "end": 7618, + "start": 7693, + "end": 7704, "loc": { "start": { "line": 217, @@ -10204,8 +10476,8 @@ }, "property": { "type": "Identifier", - "start": 7619, - "end": 7626, + "start": 7705, + "end": 7712, "loc": { "start": { "line": 217, @@ -10223,8 +10495,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7629, - "end": 7633, + "start": 7715, + "end": 7719, "loc": { "start": { "line": 217, @@ -10241,8 +10513,8 @@ }, { "type": "ExpressionStatement", - "start": 7659, - "end": 7700, + "start": 7745, + "end": 7786, "loc": { "start": { "line": 218, @@ -10255,8 +10527,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7659, - "end": 7699, + "start": 7745, + "end": 7785, "loc": { "start": { "line": 218, @@ -10270,8 +10542,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7659, - "end": 7680, + "start": 7745, + "end": 7766, "loc": { "start": { "line": 218, @@ -10284,8 +10556,8 @@ }, "object": { "type": "Identifier", - "start": 7659, - "end": 7670, + "start": 7745, + "end": 7756, "loc": { "start": { "line": 218, @@ -10301,8 +10573,8 @@ }, "property": { "type": "Identifier", - "start": 7671, - "end": 7680, + "start": 7757, + "end": 7766, "loc": { "start": { "line": 218, @@ -10320,8 +10592,8 @@ }, "right": { "type": "MemberExpression", - "start": 7684, - "end": 7699, + "start": 7770, + "end": 7785, "loc": { "start": { "line": 218, @@ -10334,8 +10606,8 @@ }, "object": { "type": "Identifier", - "start": 7684, - "end": 7689, + "start": 7770, + "end": 7775, "loc": { "start": { "line": 218, @@ -10351,8 +10623,8 @@ }, "property": { "type": "Identifier", - "start": 7690, - "end": 7699, + "start": 7776, + "end": 7785, "loc": { "start": { "line": 218, @@ -10372,8 +10644,8 @@ }, { "type": "ExpressionStatement", - "start": 7725, - "end": 7772, + "start": 7811, + "end": 7858, "loc": { "start": { "line": 219, @@ -10386,8 +10658,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7725, - "end": 7771, + "start": 7811, + "end": 7857, "loc": { "start": { "line": 219, @@ -10401,8 +10673,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7725, - "end": 7753, + "start": 7811, + "end": 7839, "loc": { "start": { "line": 219, @@ -10415,8 +10687,8 @@ }, "object": { "type": "Identifier", - "start": 7725, - "end": 7736, + "start": 7811, + "end": 7822, "loc": { "start": { "line": 219, @@ -10432,8 +10704,8 @@ }, "property": { "type": "Identifier", - "start": 7737, - "end": 7753, + "start": 7823, + "end": 7839, "loc": { "start": { "line": 219, @@ -10451,8 +10723,8 @@ }, "right": { "type": "MemberExpression", - "start": 7756, - "end": 7771, + "start": 7842, + "end": 7857, "loc": { "start": { "line": 219, @@ -10465,8 +10737,8 @@ }, "object": { "type": "Identifier", - "start": 7756, - "end": 7761, + "start": 7842, + "end": 7847, "loc": { "start": { "line": 219, @@ -10482,8 +10754,8 @@ }, "property": { "type": "Identifier", - "start": 7762, - "end": 7771, + "start": 7848, + "end": 7857, "loc": { "start": { "line": 219, @@ -10503,8 +10775,8 @@ }, { "type": "ExpressionStatement", - "start": 7797, - "end": 7825, + "start": 7883, + "end": 7911, "loc": { "start": { "line": 220, @@ -10517,8 +10789,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7797, - "end": 7824, + "start": 7883, + "end": 7910, "loc": { "start": { "line": 220, @@ -10532,8 +10804,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7797, - "end": 7816, + "start": 7883, + "end": 7902, "loc": { "start": { "line": 220, @@ -10546,8 +10818,8 @@ }, "object": { "type": "Identifier", - "start": 7797, - "end": 7808, + "start": 7883, + "end": 7894, "loc": { "start": { "line": 220, @@ -10563,8 +10835,8 @@ }, "property": { "type": "Identifier", - "start": 7809, - "end": 7816, + "start": 7895, + "end": 7902, "loc": { "start": { "line": 220, @@ -10582,8 +10854,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7819, - "end": 7824, + "start": 7905, + "end": 7910, "loc": { "start": { "line": 220, @@ -10605,8 +10877,8 @@ }, { "type": "ExpressionStatement", - "start": 7868, - "end": 7909, + "start": 7954, + "end": 7995, "loc": { "start": { "line": 222, @@ -10619,8 +10891,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7868, - "end": 7908, + "start": 7954, + "end": 7994, "loc": { "start": { "line": 222, @@ -10634,8 +10906,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7868, - "end": 7899, + "start": 7954, + "end": 7985, "loc": { "start": { "line": 222, @@ -10648,8 +10920,8 @@ }, "object": { "type": "MemberExpression", - "start": 7868, - "end": 7888, + "start": 7954, + "end": 7974, "loc": { "start": { "line": 222, @@ -10662,8 +10934,8 @@ }, "object": { "type": "MemberExpression", - "start": 7868, - "end": 7882, + "start": 7954, + "end": 7968, "loc": { "start": { "line": 222, @@ -10676,8 +10948,8 @@ }, "object": { "type": "ThisExpression", - "start": 7868, - "end": 7872, + "start": 7954, + "end": 7958, "loc": { "start": { "line": 222, @@ -10691,8 +10963,8 @@ }, "property": { "type": "Identifier", - "start": 7873, - "end": 7882, + "start": 7959, + "end": 7968, "loc": { "start": { "line": 222, @@ -10710,8 +10982,8 @@ }, "property": { "type": "Identifier", - "start": 7883, - "end": 7888, + "start": 7969, + "end": 7974, "loc": { "start": { "line": 222, @@ -10729,8 +11001,8 @@ }, "property": { "type": "Identifier", - "start": 7889, - "end": 7899, + "start": 7975, + "end": 7985, "loc": { "start": { "line": 222, @@ -10748,8 +11020,8 @@ }, "right": { "type": "StringLiteral", - "start": 7902, - "end": 7908, + "start": 7988, + "end": 7994, "loc": { "start": { "line": 222, @@ -10770,8 +11042,8 @@ }, { "type": "ExpressionStatement", - "start": 7930, - "end": 7976, + "start": 8016, + "end": 8062, "loc": { "start": { "line": 223, @@ -10784,8 +11056,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7930, - "end": 7975, + "start": 8016, + "end": 8061, "loc": { "start": { "line": 223, @@ -10799,8 +11071,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7930, - "end": 7957, + "start": 8016, + "end": 8043, "loc": { "start": { "line": 223, @@ -10813,8 +11085,8 @@ }, "object": { "type": "MemberExpression", - "start": 7930, - "end": 7950, + "start": 8016, + "end": 8036, "loc": { "start": { "line": 223, @@ -10827,8 +11099,8 @@ }, "object": { "type": "MemberExpression", - "start": 7930, - "end": 7944, + "start": 8016, + "end": 8030, "loc": { "start": { "line": 223, @@ -10841,8 +11113,8 @@ }, "object": { "type": "ThisExpression", - "start": 7930, - "end": 7934, + "start": 8016, + "end": 8020, "loc": { "start": { "line": 223, @@ -10856,8 +11128,8 @@ }, "property": { "type": "Identifier", - "start": 7935, - "end": 7944, + "start": 8021, + "end": 8030, "loc": { "start": { "line": 223, @@ -10875,8 +11147,8 @@ }, "property": { "type": "Identifier", - "start": 7945, - "end": 7950, + "start": 8031, + "end": 8036, "loc": { "start": { "line": 223, @@ -10894,8 +11166,8 @@ }, "property": { "type": "Identifier", - "start": 7951, - "end": 7957, + "start": 8037, + "end": 8043, "loc": { "start": { "line": 223, @@ -10913,8 +11185,8 @@ }, "right": { "type": "StringLiteral", - "start": 7960, - "end": 7975, + "start": 8046, + "end": 8061, "loc": { "start": { "line": 223, @@ -10939,8 +11211,8 @@ }, { "type": "VariableDeclaration", - "start": 8011, - "end": 8071, + "start": 8097, + "end": 8157, "loc": { "start": { "line": 225, @@ -10954,8 +11226,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 8017, - "end": 8070, + "start": 8103, + "end": 8156, "loc": { "start": { "line": 225, @@ -10968,8 +11240,8 @@ }, "id": { "type": "Identifier", - "start": 8017, - "end": 8026, + "start": 8103, + "end": 8112, "loc": { "start": { "line": 225, @@ -10985,8 +11257,8 @@ }, "init": { "type": "LogicalExpression", - "start": 8029, - "end": 8070, + "start": 8115, + "end": 8156, "loc": { "start": { "line": 225, @@ -10999,8 +11271,8 @@ }, "left": { "type": "MemberExpression", - "start": 8029, - "end": 8051, + "start": 8115, + "end": 8137, "loc": { "start": { "line": 225, @@ -11013,8 +11285,8 @@ }, "object": { "type": "Identifier", - "start": 8029, - "end": 8034, + "start": 8115, + "end": 8120, "loc": { "start": { "line": 225, @@ -11030,8 +11302,8 @@ }, "property": { "type": "Identifier", - "start": 8035, - "end": 8051, + "start": 8121, + "end": 8137, "loc": { "start": { "line": 225, @@ -11050,8 +11322,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 8055, - "end": 8070, + "start": 8141, + "end": 8156, "loc": { "start": { "line": 225, @@ -11064,8 +11336,8 @@ }, "object": { "type": "Identifier", - "start": 8055, - "end": 8060, + "start": 8141, + "end": 8146, "loc": { "start": { "line": 225, @@ -11081,8 +11353,8 @@ }, "property": { "type": "Identifier", - "start": 8061, - "end": 8070, + "start": 8147, + "end": 8156, "loc": { "start": { "line": 225, @@ -11105,8 +11377,8 @@ }, { "type": "ExpressionStatement", - "start": 8088, - "end": 8109, + "start": 8174, + "end": 8195, "loc": { "start": { "line": 226, @@ -11119,8 +11391,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8088, - "end": 8108, + "start": 8174, + "end": 8194, "loc": { "start": { "line": 226, @@ -11134,8 +11406,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 8088, - "end": 8101, + "start": 8174, + "end": 8187, "loc": { "start": { "line": 226, @@ -11151,8 +11423,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 8104, - "end": 8108, + "start": 8190, + "end": 8194, "loc": { "start": { "line": 226, @@ -11169,8 +11441,8 @@ }, { "type": "ExpressionStatement", - "start": 8126, - "end": 8155, + "start": 8212, + "end": 8241, "loc": { "start": { "line": 227, @@ -11183,8 +11455,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8126, - "end": 8154, + "start": 8212, + "end": 8240, "loc": { "start": { "line": 227, @@ -11198,8 +11470,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 8126, - "end": 8139, + "start": 8212, + "end": 8225, "loc": { "start": { "line": 227, @@ -11215,8 +11487,8 @@ }, "right": { "type": "MemberExpression", - "start": 8142, - "end": 8154, + "start": 8228, + "end": 8240, "loc": { "start": { "line": 227, @@ -11229,8 +11501,8 @@ }, "object": { "type": "Identifier", - "start": 8142, - "end": 8147, + "start": 8228, + "end": 8233, "loc": { "start": { "line": 227, @@ -11246,8 +11518,8 @@ }, "property": { "type": "Identifier", - "start": 8148, - "end": 8154, + "start": 8234, + "end": 8240, "loc": { "start": { "line": 227, @@ -11267,8 +11539,8 @@ }, { "type": "ExpressionStatement", - "start": 8172, - "end": 8206, + "start": 8258, + "end": 8292, "loc": { "start": { "line": 228, @@ -11281,8 +11553,8 @@ }, "expression": { "type": "CallExpression", - "start": 8172, - "end": 8205, + "start": 8258, + "end": 8291, "loc": { "start": { "line": 228, @@ -11295,8 +11567,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8172, - "end": 8189, + "start": 8258, + "end": 8275, "loc": { "start": { "line": 228, @@ -11309,8 +11581,8 @@ }, "object": { "type": "Identifier", - "start": 8172, - "end": 8185, + "start": 8258, + "end": 8271, "loc": { "start": { "line": 228, @@ -11326,8 +11598,8 @@ }, "property": { "type": "Identifier", - "start": 8186, - "end": 8189, + "start": 8272, + "end": 8275, "loc": { "start": { "line": 228, @@ -11346,8 +11618,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 8190, - "end": 8204, + "start": 8276, + "end": 8290, "loc": { "start": { "line": 228, @@ -11360,8 +11632,8 @@ }, "object": { "type": "Identifier", - "start": 8190, - "end": 8195, + "start": 8276, + "end": 8281, "loc": { "start": { "line": 228, @@ -11377,8 +11649,8 @@ }, "property": { "type": "Identifier", - "start": 8196, - "end": 8204, + "start": 8282, + "end": 8290, "loc": { "start": { "line": 228, @@ -11399,8 +11671,8 @@ }, { "type": "ExpressionStatement", - "start": 8223, - "end": 8258, + "start": 8309, + "end": 8344, "loc": { "start": { "line": 229, @@ -11413,8 +11685,8 @@ }, "expression": { "type": "CallExpression", - "start": 8223, - "end": 8257, + "start": 8309, + "end": 8343, "loc": { "start": { "line": 229, @@ -11427,8 +11699,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8223, - "end": 8246, + "start": 8309, + "end": 8332, "loc": { "start": { "line": 229, @@ -11441,8 +11713,8 @@ }, "object": { "type": "Identifier", - "start": 8223, - "end": 8242, + "start": 8309, + "end": 8328, "loc": { "start": { "line": 229, @@ -11458,8 +11730,8 @@ }, "property": { "type": "Identifier", - "start": 8243, - "end": 8246, + "start": 8329, + "end": 8332, "loc": { "start": { "line": 229, @@ -11478,8 +11750,8 @@ "arguments": [ { "type": "Identifier", - "start": 8247, - "end": 8256, + "start": 8333, + "end": 8342, "loc": { "start": { "line": 229, @@ -11498,8 +11770,8 @@ }, { "type": "SwitchStatement", - "start": 8275, - "end": 10572, + "start": 8361, + "end": 10658, "loc": { "start": { "line": 230, @@ -11512,8 +11784,8 @@ }, "discriminant": { "type": "MemberExpression", - "start": 8283, - "end": 8299, + "start": 8369, + "end": 8385, "loc": { "start": { "line": 230, @@ -11526,8 +11798,8 @@ }, "object": { "type": "ThisExpression", - "start": 8283, - "end": 8287, + "start": 8369, + "end": 8373, "loc": { "start": { "line": 230, @@ -11541,8 +11813,8 @@ }, "property": { "type": "Identifier", - "start": 8288, - "end": 8299, + "start": 8374, + "end": 8385, "loc": { "start": { "line": 230, @@ -11561,8 +11833,8 @@ "cases": [ { "type": "SwitchCase", - "start": 8323, - "end": 8924, + "start": 8409, + "end": 9010, "loc": { "start": { "line": 231, @@ -11576,8 +11848,8 @@ "consequent": [ { "type": "IfStatement", - "start": 8374, - "end": 8893, + "start": 8460, + "end": 8979, "loc": { "start": { "line": 232, @@ -11590,8 +11862,8 @@ }, "test": { "type": "MemberExpression", - "start": 8378, - "end": 8399, + "start": 8464, + "end": 8485, "loc": { "start": { "line": 232, @@ -11604,8 +11876,8 @@ }, "object": { "type": "ThisExpression", - "start": 8378, - "end": 8382, + "start": 8464, + "end": 8468, "loc": { "start": { "line": 232, @@ -11619,8 +11891,8 @@ }, "property": { "type": "Identifier", - "start": 8383, - "end": 8399, + "start": 8469, + "end": 8485, "loc": { "start": { "line": 232, @@ -11638,8 +11910,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8401, - "end": 8664, + "start": 8487, + "end": 8750, "loc": { "start": { "line": 232, @@ -11653,8 +11925,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8431, - "end": 8481, + "start": 8517, + "end": 8567, "loc": { "start": { "line": 233, @@ -11667,8 +11939,8 @@ }, "expression": { "type": "CallExpression", - "start": 8431, - "end": 8480, + "start": 8517, + "end": 8566, "loc": { "start": { "line": 233, @@ -11681,8 +11953,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8431, - "end": 8452, + "start": 8517, + "end": 8538, "loc": { "start": { "line": 233, @@ -11695,8 +11967,8 @@ }, "object": { "type": "ThisExpression", - "start": 8431, - "end": 8435, + "start": 8517, + "end": 8521, "loc": { "start": { "line": 233, @@ -11710,8 +11982,8 @@ }, "property": { "type": "Identifier", - "start": 8436, - "end": 8452, + "start": 8522, + "end": 8538, "loc": { "start": { "line": 233, @@ -11730,8 +12002,8 @@ "arguments": [ { "type": "Identifier", - "start": 8453, - "end": 8459, + "start": 8539, + "end": 8545, "loc": { "start": { "line": 233, @@ -11747,8 +12019,8 @@ }, { "type": "Identifier", - "start": 8461, - "end": 8470, + "start": 8547, + "end": 8556, "loc": { "start": { "line": 233, @@ -11764,8 +12036,8 @@ }, { "type": "Identifier", - "start": 8472, - "end": 8479, + "start": 8558, + "end": 8565, "loc": { "start": { "line": 233, @@ -11784,8 +12056,8 @@ }, { "type": "ExpressionStatement", - "start": 8510, - "end": 8560, + "start": 8596, + "end": 8646, "loc": { "start": { "line": 234, @@ -11798,8 +12070,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8510, - "end": 8559, + "start": 8596, + "end": 8645, "loc": { "start": { "line": 234, @@ -11813,8 +12085,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8510, - "end": 8535, + "start": 8596, + "end": 8621, "loc": { "start": { "line": 234, @@ -11827,8 +12099,8 @@ }, "object": { "type": "MemberExpression", - "start": 8510, - "end": 8530, + "start": 8596, + "end": 8616, "loc": { "start": { "line": 234, @@ -11841,8 +12113,8 @@ }, "object": { "type": "MemberExpression", - "start": 8510, - "end": 8524, + "start": 8596, + "end": 8610, "loc": { "start": { "line": 234, @@ -11855,8 +12127,8 @@ }, "object": { "type": "ThisExpression", - "start": 8510, - "end": 8514, + "start": 8596, + "end": 8600, "loc": { "start": { "line": 234, @@ -11870,8 +12142,8 @@ }, "property": { "type": "Identifier", - "start": 8515, - "end": 8524, + "start": 8601, + "end": 8610, "loc": { "start": { "line": 234, @@ -11889,8 +12161,8 @@ }, "property": { "type": "Identifier", - "start": 8525, - "end": 8530, + "start": 8611, + "end": 8616, "loc": { "start": { "line": 234, @@ -11908,8 +12180,8 @@ }, "property": { "type": "Identifier", - "start": 8531, - "end": 8535, + "start": 8617, + "end": 8621, "loc": { "start": { "line": 234, @@ -11927,8 +12199,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 8538, - "end": 8559, + "start": 8624, + "end": 8645, "loc": { "start": { "line": 234, @@ -11942,8 +12214,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 8541, - "end": 8555, + "start": 8627, + "end": 8641, "loc": { "start": { "line": 234, @@ -11956,8 +12228,8 @@ }, "left": { "type": "MemberExpression", - "start": 8541, - "end": 8551, + "start": 8627, + "end": 8637, "loc": { "start": { "line": 234, @@ -11970,8 +12242,8 @@ }, "object": { "type": "Identifier", - "start": 8541, - "end": 8548, + "start": 8627, + "end": 8634, "loc": { "start": { "line": 234, @@ -11987,8 +12259,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8549, - "end": 8550, + "start": 8635, + "end": 8636, "loc": { "start": { "line": 234, @@ -12010,8 +12282,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 8554, - "end": 8555, + "start": 8640, + "end": 8641, "loc": { "start": { "line": 234, @@ -12033,8 +12305,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 8539, - "end": 8539, + "start": 8625, + "end": 8625, "loc": { "start": { "line": 234, @@ -12053,8 +12325,8 @@ }, { "type": "TemplateElement", - "start": 8556, - "end": 8558, + "start": 8642, + "end": 8644, "loc": { "start": { "line": 234, @@ -12077,8 +12349,8 @@ }, { "type": "ExpressionStatement", - "start": 8589, - "end": 8638, + "start": 8675, + "end": 8724, "loc": { "start": { "line": 235, @@ -12091,8 +12363,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8589, - "end": 8637, + "start": 8675, + "end": 8723, "loc": { "start": { "line": 235, @@ -12106,8 +12378,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8589, - "end": 8613, + "start": 8675, + "end": 8699, "loc": { "start": { "line": 235, @@ -12120,8 +12392,8 @@ }, "object": { "type": "MemberExpression", - "start": 8589, - "end": 8609, + "start": 8675, + "end": 8695, "loc": { "start": { "line": 235, @@ -12134,8 +12406,8 @@ }, "object": { "type": "MemberExpression", - "start": 8589, - "end": 8603, + "start": 8675, + "end": 8689, "loc": { "start": { "line": 235, @@ -12148,8 +12420,8 @@ }, "object": { "type": "ThisExpression", - "start": 8589, - "end": 8593, + "start": 8675, + "end": 8679, "loc": { "start": { "line": 235, @@ -12163,8 +12435,8 @@ }, "property": { "type": "Identifier", - "start": 8594, - "end": 8603, + "start": 8680, + "end": 8689, "loc": { "start": { "line": 235, @@ -12182,8 +12454,8 @@ }, "property": { "type": "Identifier", - "start": 8604, - "end": 8609, + "start": 8690, + "end": 8695, "loc": { "start": { "line": 235, @@ -12201,8 +12473,8 @@ }, "property": { "type": "Identifier", - "start": 8610, - "end": 8613, + "start": 8696, + "end": 8699, "loc": { "start": { "line": 235, @@ -12220,8 +12492,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 8616, - "end": 8637, + "start": 8702, + "end": 8723, "loc": { "start": { "line": 235, @@ -12235,8 +12507,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 8619, - "end": 8633, + "start": 8705, + "end": 8719, "loc": { "start": { "line": 235, @@ -12249,8 +12521,8 @@ }, "left": { "type": "MemberExpression", - "start": 8619, - "end": 8629, + "start": 8705, + "end": 8715, "loc": { "start": { "line": 235, @@ -12263,8 +12535,8 @@ }, "object": { "type": "Identifier", - "start": 8619, - "end": 8626, + "start": 8705, + "end": 8712, "loc": { "start": { "line": 235, @@ -12280,8 +12552,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8627, - "end": 8628, + "start": 8713, + "end": 8714, "loc": { "start": { "line": 235, @@ -12303,8 +12575,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 8632, - "end": 8633, + "start": 8718, + "end": 8719, "loc": { "start": { "line": 235, @@ -12326,8 +12598,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 8617, - "end": 8617, + "start": 8703, + "end": 8703, "loc": { "start": { "line": 235, @@ -12346,8 +12618,8 @@ }, { "type": "TemplateElement", - "start": 8634, - "end": 8636, + "start": 8720, + "end": 8722, "loc": { "start": { "line": 235, @@ -12373,8 +12645,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 8670, - "end": 8893, + "start": 8756, + "end": 8979, "loc": { "start": { "line": 236, @@ -12388,8 +12660,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8700, - "end": 8770, + "start": 8786, + "end": 8856, "loc": { "start": { "line": 237, @@ -12402,8 +12674,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8700, - "end": 8769, + "start": 8786, + "end": 8855, "loc": { "start": { "line": 237, @@ -12417,8 +12689,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8700, - "end": 8725, + "start": 8786, + "end": 8811, "loc": { "start": { "line": 237, @@ -12431,8 +12703,8 @@ }, "object": { "type": "MemberExpression", - "start": 8700, - "end": 8720, + "start": 8786, + "end": 8806, "loc": { "start": { "line": 237, @@ -12445,8 +12717,8 @@ }, "object": { "type": "MemberExpression", - "start": 8700, - "end": 8714, + "start": 8786, + "end": 8800, "loc": { "start": { "line": 237, @@ -12459,8 +12731,8 @@ }, "object": { "type": "ThisExpression", - "start": 8700, - "end": 8704, + "start": 8786, + "end": 8790, "loc": { "start": { "line": 237, @@ -12474,8 +12746,8 @@ }, "property": { "type": "Identifier", - "start": 8705, - "end": 8714, + "start": 8791, + "end": 8800, "loc": { "start": { "line": 237, @@ -12493,8 +12765,8 @@ }, "property": { "type": "Identifier", - "start": 8715, - "end": 8720, + "start": 8801, + "end": 8806, "loc": { "start": { "line": 237, @@ -12512,8 +12784,8 @@ }, "property": { "type": "Identifier", - "start": 8721, - "end": 8725, + "start": 8807, + "end": 8811, "loc": { "start": { "line": 237, @@ -12531,8 +12803,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 8728, - "end": 8769, + "start": 8814, + "end": 8855, "loc": { "start": { "line": 237, @@ -12546,8 +12818,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 8731, - "end": 8765, + "start": 8817, + "end": 8851, "loc": { "start": { "line": 237, @@ -12560,8 +12832,8 @@ }, "left": { "type": "BinaryExpression", - "start": 8731, - "end": 8761, + "start": 8817, + "end": 8847, "loc": { "start": { "line": 237, @@ -12574,8 +12846,8 @@ }, "left": { "type": "CallExpression", - "start": 8731, - "end": 8746, + "start": 8817, + "end": 8832, "loc": { "start": { "line": 237, @@ -12588,8 +12860,8 @@ }, "callee": { "type": "Identifier", - "start": 8731, - "end": 8738, + "start": 8817, + "end": 8824, "loc": { "start": { "line": 237, @@ -12606,8 +12878,8 @@ "arguments": [ { "type": "Identifier", - "start": 8739, - "end": 8745, + "start": 8825, + "end": 8831, "loc": { "start": { "line": 237, @@ -12626,8 +12898,8 @@ "operator": "+", "right": { "type": "MemberExpression", - "start": 8749, - "end": 8761, + "start": 8835, + "end": 8847, "loc": { "start": { "line": 237, @@ -12640,8 +12912,8 @@ }, "object": { "type": "Identifier", - "start": 8749, - "end": 8758, + "start": 8835, + "end": 8844, "loc": { "start": { "line": 237, @@ -12657,8 +12929,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8759, - "end": 8760, + "start": 8845, + "end": 8846, "loc": { "start": { "line": 237, @@ -12681,8 +12953,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 8764, - "end": 8765, + "start": 8850, + "end": 8851, "loc": { "start": { "line": 237, @@ -12704,8 +12976,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 8729, - "end": 8729, + "start": 8815, + "end": 8815, "loc": { "start": { "line": 237, @@ -12724,8 +12996,8 @@ }, { "type": "TemplateElement", - "start": 8766, - "end": 8768, + "start": 8852, + "end": 8854, "loc": { "start": { "line": 237, @@ -12748,8 +13020,8 @@ }, { "type": "ExpressionStatement", - "start": 8799, - "end": 8867, + "start": 8885, + "end": 8953, "loc": { "start": { "line": 238, @@ -12762,8 +13034,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8799, - "end": 8866, + "start": 8885, + "end": 8952, "loc": { "start": { "line": 238, @@ -12777,8 +13049,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8799, - "end": 8823, + "start": 8885, + "end": 8909, "loc": { "start": { "line": 238, @@ -12791,8 +13063,8 @@ }, "object": { "type": "MemberExpression", - "start": 8799, - "end": 8819, + "start": 8885, + "end": 8905, "loc": { "start": { "line": 238, @@ -12805,8 +13077,8 @@ }, "object": { "type": "MemberExpression", - "start": 8799, - "end": 8813, + "start": 8885, + "end": 8899, "loc": { "start": { "line": 238, @@ -12819,8 +13091,8 @@ }, "object": { "type": "ThisExpression", - "start": 8799, - "end": 8803, + "start": 8885, + "end": 8889, "loc": { "start": { "line": 238, @@ -12834,8 +13106,8 @@ }, "property": { "type": "Identifier", - "start": 8804, - "end": 8813, + "start": 8890, + "end": 8899, "loc": { "start": { "line": 238, @@ -12853,8 +13125,8 @@ }, "property": { "type": "Identifier", - "start": 8814, - "end": 8819, + "start": 8900, + "end": 8905, "loc": { "start": { "line": 238, @@ -12872,8 +13144,8 @@ }, "property": { "type": "Identifier", - "start": 8820, - "end": 8823, + "start": 8906, + "end": 8909, "loc": { "start": { "line": 238, @@ -12891,8 +13163,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 8826, - "end": 8866, + "start": 8912, + "end": 8952, "loc": { "start": { "line": 238, @@ -12906,8 +13178,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 8829, - "end": 8862, + "start": 8915, + "end": 8948, "loc": { "start": { "line": 238, @@ -12920,8 +13192,8 @@ }, "left": { "type": "BinaryExpression", - "start": 8829, - "end": 8858, + "start": 8915, + "end": 8944, "loc": { "start": { "line": 238, @@ -12934,8 +13206,8 @@ }, "left": { "type": "CallExpression", - "start": 8829, - "end": 8843, + "start": 8915, + "end": 8929, "loc": { "start": { "line": 238, @@ -12948,8 +13220,8 @@ }, "callee": { "type": "Identifier", - "start": 8829, - "end": 8835, + "start": 8915, + "end": 8921, "loc": { "start": { "line": 238, @@ -12966,8 +13238,8 @@ "arguments": [ { "type": "Identifier", - "start": 8836, - "end": 8842, + "start": 8922, + "end": 8928, "loc": { "start": { "line": 238, @@ -12986,8 +13258,8 @@ "operator": "+", "right": { "type": "MemberExpression", - "start": 8846, - "end": 8858, + "start": 8932, + "end": 8944, "loc": { "start": { "line": 238, @@ -13000,8 +13272,8 @@ }, "object": { "type": "Identifier", - "start": 8846, - "end": 8855, + "start": 8932, + "end": 8941, "loc": { "start": { "line": 238, @@ -13017,8 +13289,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8856, - "end": 8857, + "start": 8942, + "end": 8943, "loc": { "start": { "line": 238, @@ -13041,8 +13313,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 8861, - "end": 8862, + "start": 8947, + "end": 8948, "loc": { "start": { "line": 238, @@ -13064,8 +13336,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 8827, - "end": 8827, + "start": 8913, + "end": 8913, "loc": { "start": { "line": 238, @@ -13084,8 +13356,8 @@ }, { "type": "TemplateElement", - "start": 8863, - "end": 8865, + "start": 8949, + "end": 8951, "loc": { "start": { "line": 238, @@ -13112,8 +13384,8 @@ }, { "type": "BreakStatement", - "start": 8918, - "end": 8924, + "start": 9004, + "end": 9010, "loc": { "start": { "line": 240, @@ -13129,8 +13401,8 @@ ], "test": { "type": "Identifier", - "start": 8328, - "end": 8348, + "start": 8414, + "end": 8434, "loc": { "start": { "line": 231, @@ -13147,8 +13419,8 @@ }, { "type": "SwitchCase", - "start": 8945, - "end": 9782, + "start": 9031, + "end": 9868, "loc": { "start": { "line": 241, @@ -13162,8 +13434,8 @@ "consequent": [ { "type": "IfStatement", - "start": 8996, - "end": 9567, + "start": 9082, + "end": 9653, "loc": { "start": { "line": 242, @@ -13176,8 +13448,8 @@ }, "test": { "type": "MemberExpression", - "start": 9000, - "end": 9029, + "start": 9086, + "end": 9115, "loc": { "start": { "line": 242, @@ -13190,8 +13462,8 @@ }, "object": { "type": "ThisExpression", - "start": 9000, - "end": 9004, + "start": 9086, + "end": 9090, "loc": { "start": { "line": 242, @@ -13205,8 +13477,8 @@ }, "property": { "type": "Identifier", - "start": 9005, - "end": 9029, + "start": 9091, + "end": 9115, "loc": { "start": { "line": 242, @@ -13224,8 +13496,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 9031, - "end": 9567, + "start": 9117, + "end": 9653, "loc": { "start": { "line": 242, @@ -13239,8 +13511,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9061, - "end": 9116, + "start": 9147, + "end": 9202, "loc": { "start": { "line": 243, @@ -13253,8 +13525,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9061, - "end": 9115, + "start": 9147, + "end": 9201, "loc": { "start": { "line": 243, @@ -13268,8 +13540,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9061, - "end": 9108, + "start": 9147, + "end": 9194, "loc": { "start": { "line": 243, @@ -13282,8 +13554,8 @@ }, "object": { "type": "MemberExpression", - "start": 9061, - "end": 9090, + "start": 9147, + "end": 9176, "loc": { "start": { "line": 243, @@ -13296,8 +13568,8 @@ }, "object": { "type": "ThisExpression", - "start": 9061, - "end": 9065, + "start": 9147, + "end": 9151, "loc": { "start": { "line": 243, @@ -13311,8 +13583,8 @@ }, "property": { "type": "Identifier", - "start": 9066, - "end": 9090, + "start": 9152, + "end": 9176, "loc": { "start": { "line": 243, @@ -13330,8 +13602,8 @@ }, "property": { "type": "Identifier", - "start": 9091, - "end": 9108, + "start": 9177, + "end": 9194, "loc": { "start": { "line": 243, @@ -13349,8 +13621,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9111, - "end": 9115, + "start": 9197, + "end": 9201, "loc": { "start": { "line": 243, @@ -13367,8 +13639,8 @@ }, { "type": "ExpressionStatement", - "start": 9145, - "end": 9201, + "start": 9231, + "end": 9287, "loc": { "start": { "line": 244, @@ -13381,8 +13653,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9145, - "end": 9200, + "start": 9231, + "end": 9286, "loc": { "start": { "line": 244, @@ -13396,8 +13668,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9145, - "end": 9192, + "start": 9231, + "end": 9278, "loc": { "start": { "line": 244, @@ -13410,8 +13682,8 @@ }, "object": { "type": "MemberExpression", - "start": 9145, - "end": 9174, + "start": 9231, + "end": 9260, "loc": { "start": { "line": 244, @@ -13424,8 +13696,8 @@ }, "object": { "type": "ThisExpression", - "start": 9145, - "end": 9149, + "start": 9231, + "end": 9235, "loc": { "start": { "line": 244, @@ -13439,8 +13711,8 @@ }, "property": { "type": "Identifier", - "start": 9150, - "end": 9174, + "start": 9236, + "end": 9260, "loc": { "start": { "line": 244, @@ -13458,8 +13730,8 @@ }, "property": { "type": "Identifier", - "start": 9175, - "end": 9192, + "start": 9261, + "end": 9278, "loc": { "start": { "line": 244, @@ -13477,8 +13749,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9195, - "end": 9200, + "start": 9281, + "end": 9286, "loc": { "start": { "line": 244, @@ -13495,8 +13767,8 @@ }, { "type": "ExpressionStatement", - "start": 9230, - "end": 9281, + "start": 9316, + "end": 9367, "loc": { "start": { "line": 245, @@ -13509,8 +13781,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9230, - "end": 9280, + "start": 9316, + "end": 9366, "loc": { "start": { "line": 245, @@ -13524,8 +13796,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9230, - "end": 9273, + "start": 9316, + "end": 9359, "loc": { "start": { "line": 245, @@ -13538,8 +13810,8 @@ }, "object": { "type": "MemberExpression", - "start": 9230, - "end": 9259, + "start": 9316, + "end": 9345, "loc": { "start": { "line": 245, @@ -13552,8 +13824,8 @@ }, "object": { "type": "ThisExpression", - "start": 9230, - "end": 9234, + "start": 9316, + "end": 9320, "loc": { "start": { "line": 245, @@ -13567,8 +13839,8 @@ }, "property": { "type": "Identifier", - "start": 9235, - "end": 9259, + "start": 9321, + "end": 9345, "loc": { "start": { "line": 245, @@ -13586,8 +13858,8 @@ }, "property": { "type": "Identifier", - "start": 9260, - "end": 9273, + "start": 9346, + "end": 9359, "loc": { "start": { "line": 245, @@ -13605,8 +13877,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9276, - "end": 9280, + "start": 9362, + "end": 9366, "loc": { "start": { "line": 245, @@ -13623,8 +13895,8 @@ }, { "type": "ExpressionStatement", - "start": 9310, - "end": 9361, + "start": 9396, + "end": 9447, "loc": { "start": { "line": 246, @@ -13637,8 +13909,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9310, - "end": 9360, + "start": 9396, + "end": 9446, "loc": { "start": { "line": 246, @@ -13652,8 +13924,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9310, - "end": 9352, + "start": 9396, + "end": 9438, "loc": { "start": { "line": 246, @@ -13666,8 +13938,8 @@ }, "object": { "type": "MemberExpression", - "start": 9310, - "end": 9339, + "start": 9396, + "end": 9425, "loc": { "start": { "line": 246, @@ -13680,8 +13952,8 @@ }, "object": { "type": "ThisExpression", - "start": 9310, - "end": 9314, + "start": 9396, + "end": 9400, "loc": { "start": { "line": 246, @@ -13695,8 +13967,8 @@ }, "property": { "type": "Identifier", - "start": 9315, - "end": 9339, + "start": 9401, + "end": 9425, "loc": { "start": { "line": 246, @@ -13714,8 +13986,8 @@ }, "property": { "type": "Identifier", - "start": 9340, - "end": 9352, + "start": 9426, + "end": 9438, "loc": { "start": { "line": 246, @@ -13733,8 +14005,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9355, - "end": 9360, + "start": 9441, + "end": 9446, "loc": { "start": { "line": 246, @@ -13751,8 +14023,8 @@ }, { "type": "ExpressionStatement", - "start": 9390, - "end": 9453, + "start": 9476, + "end": 9539, "loc": { "start": { "line": 247, @@ -13765,8 +14037,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9390, - "end": 9452, + "start": 9476, + "end": 9538, "loc": { "start": { "line": 247, @@ -13780,8 +14052,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9390, - "end": 9435, + "start": 9476, + "end": 9521, "loc": { "start": { "line": 247, @@ -13794,8 +14066,8 @@ }, "object": { "type": "MemberExpression", - "start": 9390, - "end": 9426, + "start": 9476, + "end": 9512, "loc": { "start": { "line": 247, @@ -13808,8 +14080,8 @@ }, "object": { "type": "MemberExpression", - "start": 9390, - "end": 9419, + "start": 9476, + "end": 9505, "loc": { "start": { "line": 247, @@ -13822,8 +14094,8 @@ }, "object": { "type": "ThisExpression", - "start": 9390, - "end": 9394, + "start": 9476, + "end": 9480, "loc": { "start": { "line": 247, @@ -13837,8 +14109,8 @@ }, "property": { "type": "Identifier", - "start": 9395, - "end": 9419, + "start": 9481, + "end": 9505, "loc": { "start": { "line": 247, @@ -13856,8 +14128,8 @@ }, "property": { "type": "Identifier", - "start": 9420, - "end": 9426, + "start": 9506, + "end": 9512, "loc": { "start": { "line": 247, @@ -13875,8 +14147,8 @@ }, "property": { "type": "Identifier", - "start": 9427, - "end": 9435, + "start": 9513, + "end": 9521, "loc": { "start": { "line": 247, @@ -13894,8 +14166,8 @@ }, "right": { "type": "MemberExpression", - "start": 9438, - "end": 9452, + "start": 9524, + "end": 9538, "loc": { "start": { "line": 247, @@ -13908,8 +14180,8 @@ }, "object": { "type": "Identifier", - "start": 9438, - "end": 9443, + "start": 9524, + "end": 9529, "loc": { "start": { "line": 247, @@ -13925,8 +14197,8 @@ }, "property": { "type": "Identifier", - "start": 9444, - "end": 9452, + "start": 9530, + "end": 9538, "loc": { "start": { "line": 247, @@ -13946,8 +14218,8 @@ }, { "type": "ExpressionStatement", - "start": 9482, - "end": 9541, + "start": 9568, + "end": 9627, "loc": { "start": { "line": 248, @@ -13960,8 +14232,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9482, - "end": 9540, + "start": 9568, + "end": 9626, "loc": { "start": { "line": 248, @@ -13975,8 +14247,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9482, - "end": 9525, + "start": 9568, + "end": 9611, "loc": { "start": { "line": 248, @@ -13989,8 +14261,8 @@ }, "object": { "type": "MemberExpression", - "start": 9482, - "end": 9518, + "start": 9568, + "end": 9604, "loc": { "start": { "line": 248, @@ -14003,8 +14275,8 @@ }, "object": { "type": "MemberExpression", - "start": 9482, - "end": 9511, + "start": 9568, + "end": 9597, "loc": { "start": { "line": 248, @@ -14017,8 +14289,8 @@ }, "object": { "type": "ThisExpression", - "start": 9482, - "end": 9486, + "start": 9568, + "end": 9572, "loc": { "start": { "line": 248, @@ -14032,8 +14304,8 @@ }, "property": { "type": "Identifier", - "start": 9487, - "end": 9511, + "start": 9573, + "end": 9597, "loc": { "start": { "line": 248, @@ -14051,8 +14323,8 @@ }, "property": { "type": "Identifier", - "start": 9512, - "end": 9518, + "start": 9598, + "end": 9604, "loc": { "start": { "line": 248, @@ -14070,8 +14342,8 @@ }, "property": { "type": "Identifier", - "start": 9519, - "end": 9525, + "start": 9605, + "end": 9611, "loc": { "start": { "line": 248, @@ -14089,8 +14361,8 @@ }, "right": { "type": "MemberExpression", - "start": 9528, - "end": 9540, + "start": 9614, + "end": 9626, "loc": { "start": { "line": 248, @@ -14103,8 +14375,8 @@ }, "object": { "type": "Identifier", - "start": 9528, - "end": 9533, + "start": 9614, + "end": 9619, "loc": { "start": { "line": 248, @@ -14120,8 +14392,8 @@ }, "property": { "type": "Identifier", - "start": 9534, - "end": 9540, + "start": 9620, + "end": 9626, "loc": { "start": { "line": 248, @@ -14146,8 +14418,8 @@ }, { "type": "ExpressionStatement", - "start": 9592, - "end": 9631, + "start": 9678, + "end": 9717, "loc": { "start": { "line": 250, @@ -14160,8 +14432,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9592, - "end": 9630, + "start": 9678, + "end": 9716, "loc": { "start": { "line": 250, @@ -14175,8 +14447,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9592, - "end": 9617, + "start": 9678, + "end": 9703, "loc": { "start": { "line": 250, @@ -14189,8 +14461,8 @@ }, "object": { "type": "MemberExpression", - "start": 9592, - "end": 9612, + "start": 9678, + "end": 9698, "loc": { "start": { "line": 250, @@ -14203,8 +14475,8 @@ }, "object": { "type": "MemberExpression", - "start": 9592, - "end": 9606, + "start": 9678, + "end": 9692, "loc": { "start": { "line": 250, @@ -14217,8 +14489,8 @@ }, "object": { "type": "ThisExpression", - "start": 9592, - "end": 9596, + "start": 9678, + "end": 9682, "loc": { "start": { "line": 250, @@ -14232,8 +14504,8 @@ }, "property": { "type": "Identifier", - "start": 9597, - "end": 9606, + "start": 9683, + "end": 9692, "loc": { "start": { "line": 250, @@ -14251,8 +14523,8 @@ }, "property": { "type": "Identifier", - "start": 9607, - "end": 9612, + "start": 9693, + "end": 9698, "loc": { "start": { "line": 250, @@ -14270,8 +14542,8 @@ }, "property": { "type": "Identifier", - "start": 9613, - "end": 9617, + "start": 9699, + "end": 9703, "loc": { "start": { "line": 250, @@ -14289,8 +14561,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 9620, - "end": 9630, + "start": 9706, + "end": 9716, "loc": { "start": { "line": 250, @@ -14305,8 +14577,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 9621, - "end": 9629, + "start": 9707, + "end": 9715, "loc": { "start": { "line": 250, @@ -14329,8 +14601,8 @@ }, { "type": "ExpressionStatement", - "start": 9656, - "end": 9694, + "start": 9742, + "end": 9780, "loc": { "start": { "line": 251, @@ -14343,8 +14615,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9656, - "end": 9693, + "start": 9742, + "end": 9779, "loc": { "start": { "line": 251, @@ -14358,8 +14630,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9656, - "end": 9680, + "start": 9742, + "end": 9766, "loc": { "start": { "line": 251, @@ -14372,8 +14644,8 @@ }, "object": { "type": "MemberExpression", - "start": 9656, - "end": 9676, + "start": 9742, + "end": 9762, "loc": { "start": { "line": 251, @@ -14386,8 +14658,8 @@ }, "object": { "type": "MemberExpression", - "start": 9656, - "end": 9670, + "start": 9742, + "end": 9756, "loc": { "start": { "line": 251, @@ -14400,8 +14672,8 @@ }, "object": { "type": "ThisExpression", - "start": 9656, - "end": 9660, + "start": 9742, + "end": 9746, "loc": { "start": { "line": 251, @@ -14415,8 +14687,8 @@ }, "property": { "type": "Identifier", - "start": 9661, - "end": 9670, + "start": 9747, + "end": 9756, "loc": { "start": { "line": 251, @@ -14434,8 +14706,8 @@ }, "property": { "type": "Identifier", - "start": 9671, - "end": 9676, + "start": 9757, + "end": 9762, "loc": { "start": { "line": 251, @@ -14453,8 +14725,8 @@ }, "property": { "type": "Identifier", - "start": 9677, - "end": 9680, + "start": 9763, + "end": 9766, "loc": { "start": { "line": 251, @@ -14472,8 +14744,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 9683, - "end": 9693, + "start": 9769, + "end": 9779, "loc": { "start": { "line": 251, @@ -14488,8 +14760,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 9684, - "end": 9692, + "start": 9770, + "end": 9778, "loc": { "start": { "line": 251, @@ -14512,8 +14784,8 @@ }, { "type": "ExpressionStatement", - "start": 9719, - "end": 9751, + "start": 9805, + "end": 9837, "loc": { "start": { "line": 252, @@ -14526,8 +14798,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9719, - "end": 9750, + "start": 9805, + "end": 9836, "loc": { "start": { "line": 252, @@ -14541,8 +14813,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9719, - "end": 9738, + "start": 9805, + "end": 9824, "loc": { "start": { "line": 252, @@ -14555,8 +14827,8 @@ }, "object": { "type": "MemberExpression", - "start": 9719, - "end": 9731, + "start": 9805, + "end": 9817, "loc": { "start": { "line": 252, @@ -14569,8 +14841,8 @@ }, "object": { "type": "Identifier", - "start": 9719, - "end": 9725, + "start": 9805, + "end": 9811, "loc": { "start": { "line": 252, @@ -14586,8 +14858,8 @@ }, "property": { "type": "Identifier", - "start": 9726, - "end": 9731, + "start": 9812, + "end": 9817, "loc": { "start": { "line": 252, @@ -14605,8 +14877,8 @@ }, "property": { "type": "Identifier", - "start": 9732, - "end": 9738, + "start": 9818, + "end": 9824, "loc": { "start": { "line": 252, @@ -14624,8 +14896,8 @@ }, "right": { "type": "StringLiteral", - "start": 9741, - "end": 9750, + "start": 9827, + "end": 9836, "loc": { "start": { "line": 252, @@ -14646,8 +14918,8 @@ }, { "type": "BreakStatement", - "start": 9776, - "end": 9782, + "start": 9862, + "end": 9868, "loc": { "start": { "line": 253, @@ -14663,8 +14935,8 @@ ], "test": { "type": "Identifier", - "start": 8950, - "end": 8970, + "start": 9036, + "end": 9056, "loc": { "start": { "line": 241, @@ -14681,8 +14953,8 @@ }, { "type": "SwitchCase", - "start": 9803, - "end": 10554, + "start": 9889, + "end": 10640, "loc": { "start": { "line": 254, @@ -14696,8 +14968,8 @@ "consequent": [ { "type": "IfStatement", - "start": 9854, - "end": 10339, + "start": 9940, + "end": 10425, "loc": { "start": { "line": 255, @@ -14710,8 +14982,8 @@ }, "test": { "type": "MemberExpression", - "start": 9858, - "end": 9887, + "start": 9944, + "end": 9973, "loc": { "start": { "line": 255, @@ -14724,8 +14996,8 @@ }, "object": { "type": "ThisExpression", - "start": 9858, - "end": 9862, + "start": 9944, + "end": 9948, "loc": { "start": { "line": 255, @@ -14739,8 +15011,8 @@ }, "property": { "type": "Identifier", - "start": 9863, - "end": 9887, + "start": 9949, + "end": 9973, "loc": { "start": { "line": 255, @@ -14758,8 +15030,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 9889, - "end": 10339, + "start": 9975, + "end": 10425, "loc": { "start": { "line": 255, @@ -14773,8 +15045,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9919, - "end": 9974, + "start": 10005, + "end": 10060, "loc": { "start": { "line": 256, @@ -14787,8 +15059,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9919, - "end": 9973, + "start": 10005, + "end": 10059, "loc": { "start": { "line": 256, @@ -14802,8 +15074,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9919, - "end": 9966, + "start": 10005, + "end": 10052, "loc": { "start": { "line": 256, @@ -14816,8 +15088,8 @@ }, "object": { "type": "MemberExpression", - "start": 9919, - "end": 9948, + "start": 10005, + "end": 10034, "loc": { "start": { "line": 256, @@ -14830,8 +15102,8 @@ }, "object": { "type": "ThisExpression", - "start": 9919, - "end": 9923, + "start": 10005, + "end": 10009, "loc": { "start": { "line": 256, @@ -14845,8 +15117,8 @@ }, "property": { "type": "Identifier", - "start": 9924, - "end": 9948, + "start": 10010, + "end": 10034, "loc": { "start": { "line": 256, @@ -14864,8 +15136,8 @@ }, "property": { "type": "Identifier", - "start": 9949, - "end": 9966, + "start": 10035, + "end": 10052, "loc": { "start": { "line": 256, @@ -14883,8 +15155,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9969, - "end": 9973, + "start": 10055, + "end": 10059, "loc": { "start": { "line": 256, @@ -14901,8 +15173,8 @@ }, { "type": "ExpressionStatement", - "start": 10003, - "end": 10054, + "start": 10089, + "end": 10140, "loc": { "start": { "line": 257, @@ -14915,8 +15187,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10003, - "end": 10053, + "start": 10089, + "end": 10139, "loc": { "start": { "line": 257, @@ -14930,8 +15202,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10003, - "end": 10046, + "start": 10089, + "end": 10132, "loc": { "start": { "line": 257, @@ -14944,8 +15216,8 @@ }, "object": { "type": "MemberExpression", - "start": 10003, - "end": 10032, + "start": 10089, + "end": 10118, "loc": { "start": { "line": 257, @@ -14958,8 +15230,8 @@ }, "object": { "type": "ThisExpression", - "start": 10003, - "end": 10007, + "start": 10089, + "end": 10093, "loc": { "start": { "line": 257, @@ -14973,8 +15245,8 @@ }, "property": { "type": "Identifier", - "start": 10008, - "end": 10032, + "start": 10094, + "end": 10118, "loc": { "start": { "line": 257, @@ -14992,8 +15264,8 @@ }, "property": { "type": "Identifier", - "start": 10033, - "end": 10046, + "start": 10119, + "end": 10132, "loc": { "start": { "line": 257, @@ -15011,8 +15283,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 10049, - "end": 10053, + "start": 10135, + "end": 10139, "loc": { "start": { "line": 257, @@ -15029,8 +15301,8 @@ }, { "type": "ExpressionStatement", - "start": 10083, - "end": 10133, + "start": 10169, + "end": 10219, "loc": { "start": { "line": 258, @@ -15043,8 +15315,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10083, - "end": 10132, + "start": 10169, + "end": 10218, "loc": { "start": { "line": 258, @@ -15058,8 +15330,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10083, - "end": 10125, + "start": 10169, + "end": 10211, "loc": { "start": { "line": 258, @@ -15072,8 +15344,8 @@ }, "object": { "type": "MemberExpression", - "start": 10083, - "end": 10112, + "start": 10169, + "end": 10198, "loc": { "start": { "line": 258, @@ -15086,8 +15358,8 @@ }, "object": { "type": "ThisExpression", - "start": 10083, - "end": 10087, + "start": 10169, + "end": 10173, "loc": { "start": { "line": 258, @@ -15101,8 +15373,8 @@ }, "property": { "type": "Identifier", - "start": 10088, - "end": 10112, + "start": 10174, + "end": 10198, "loc": { "start": { "line": 258, @@ -15120,8 +15392,8 @@ }, "property": { "type": "Identifier", - "start": 10113, - "end": 10125, + "start": 10199, + "end": 10211, "loc": { "start": { "line": 258, @@ -15139,8 +15411,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 10128, - "end": 10132, + "start": 10214, + "end": 10218, "loc": { "start": { "line": 258, @@ -15157,8 +15429,8 @@ }, { "type": "ExpressionStatement", - "start": 10162, - "end": 10225, + "start": 10248, + "end": 10311, "loc": { "start": { "line": 259, @@ -15171,8 +15443,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10162, - "end": 10224, + "start": 10248, + "end": 10310, "loc": { "start": { "line": 259, @@ -15186,8 +15458,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10162, - "end": 10207, + "start": 10248, + "end": 10293, "loc": { "start": { "line": 259, @@ -15200,8 +15472,8 @@ }, "object": { "type": "MemberExpression", - "start": 10162, - "end": 10198, + "start": 10248, + "end": 10284, "loc": { "start": { "line": 259, @@ -15214,8 +15486,8 @@ }, "object": { "type": "MemberExpression", - "start": 10162, - "end": 10191, + "start": 10248, + "end": 10277, "loc": { "start": { "line": 259, @@ -15228,8 +15500,8 @@ }, "object": { "type": "ThisExpression", - "start": 10162, - "end": 10166, + "start": 10248, + "end": 10252, "loc": { "start": { "line": 259, @@ -15243,8 +15515,8 @@ }, "property": { "type": "Identifier", - "start": 10167, - "end": 10191, + "start": 10253, + "end": 10277, "loc": { "start": { "line": 259, @@ -15262,8 +15534,8 @@ }, "property": { "type": "Identifier", - "start": 10192, - "end": 10198, + "start": 10278, + "end": 10284, "loc": { "start": { "line": 259, @@ -15281,8 +15553,8 @@ }, "property": { "type": "Identifier", - "start": 10199, - "end": 10207, + "start": 10285, + "end": 10293, "loc": { "start": { "line": 259, @@ -15300,8 +15572,8 @@ }, "right": { "type": "MemberExpression", - "start": 10210, - "end": 10224, + "start": 10296, + "end": 10310, "loc": { "start": { "line": 259, @@ -15314,8 +15586,8 @@ }, "object": { "type": "Identifier", - "start": 10210, - "end": 10215, + "start": 10296, + "end": 10301, "loc": { "start": { "line": 259, @@ -15331,8 +15603,8 @@ }, "property": { "type": "Identifier", - "start": 10216, - "end": 10224, + "start": 10302, + "end": 10310, "loc": { "start": { "line": 259, @@ -15352,8 +15624,8 @@ }, { "type": "ExpressionStatement", - "start": 10254, - "end": 10313, + "start": 10340, + "end": 10399, "loc": { "start": { "line": 260, @@ -15366,8 +15638,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10254, - "end": 10312, + "start": 10340, + "end": 10398, "loc": { "start": { "line": 260, @@ -15381,8 +15653,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10254, - "end": 10297, + "start": 10340, + "end": 10383, "loc": { "start": { "line": 260, @@ -15395,8 +15667,8 @@ }, "object": { "type": "MemberExpression", - "start": 10254, - "end": 10290, + "start": 10340, + "end": 10376, "loc": { "start": { "line": 260, @@ -15409,8 +15681,8 @@ }, "object": { "type": "MemberExpression", - "start": 10254, - "end": 10283, + "start": 10340, + "end": 10369, "loc": { "start": { "line": 260, @@ -15423,8 +15695,8 @@ }, "object": { "type": "ThisExpression", - "start": 10254, - "end": 10258, + "start": 10340, + "end": 10344, "loc": { "start": { "line": 260, @@ -15438,8 +15710,8 @@ }, "property": { "type": "Identifier", - "start": 10259, - "end": 10283, + "start": 10345, + "end": 10369, "loc": { "start": { "line": 260, @@ -15457,8 +15729,8 @@ }, "property": { "type": "Identifier", - "start": 10284, - "end": 10290, + "start": 10370, + "end": 10376, "loc": { "start": { "line": 260, @@ -15476,8 +15748,8 @@ }, "property": { "type": "Identifier", - "start": 10291, - "end": 10297, + "start": 10377, + "end": 10383, "loc": { "start": { "line": 260, @@ -15495,8 +15767,8 @@ }, "right": { "type": "MemberExpression", - "start": 10300, - "end": 10312, + "start": 10386, + "end": 10398, "loc": { "start": { "line": 260, @@ -15509,8 +15781,8 @@ }, "object": { "type": "Identifier", - "start": 10300, - "end": 10305, + "start": 10386, + "end": 10391, "loc": { "start": { "line": 260, @@ -15526,8 +15798,8 @@ }, "property": { "type": "Identifier", - "start": 10306, - "end": 10312, + "start": 10392, + "end": 10398, "loc": { "start": { "line": 260, @@ -15552,8 +15824,8 @@ }, { "type": "ExpressionStatement", - "start": 10364, - "end": 10403, + "start": 10450, + "end": 10489, "loc": { "start": { "line": 262, @@ -15566,8 +15838,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10364, - "end": 10402, + "start": 10450, + "end": 10488, "loc": { "start": { "line": 262, @@ -15581,8 +15853,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10364, - "end": 10389, + "start": 10450, + "end": 10475, "loc": { "start": { "line": 262, @@ -15595,8 +15867,8 @@ }, "object": { "type": "MemberExpression", - "start": 10364, - "end": 10384, + "start": 10450, + "end": 10470, "loc": { "start": { "line": 262, @@ -15609,8 +15881,8 @@ }, "object": { "type": "MemberExpression", - "start": 10364, - "end": 10378, + "start": 10450, + "end": 10464, "loc": { "start": { "line": 262, @@ -15623,8 +15895,8 @@ }, "object": { "type": "ThisExpression", - "start": 10364, - "end": 10368, + "start": 10450, + "end": 10454, "loc": { "start": { "line": 262, @@ -15638,8 +15910,8 @@ }, "property": { "type": "Identifier", - "start": 10369, - "end": 10378, + "start": 10455, + "end": 10464, "loc": { "start": { "line": 262, @@ -15657,8 +15929,8 @@ }, "property": { "type": "Identifier", - "start": 10379, - "end": 10384, + "start": 10465, + "end": 10470, "loc": { "start": { "line": 262, @@ -15676,8 +15948,8 @@ }, "property": { "type": "Identifier", - "start": 10385, - "end": 10389, + "start": 10471, + "end": 10475, "loc": { "start": { "line": 262, @@ -15695,8 +15967,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 10392, - "end": 10402, + "start": 10478, + "end": 10488, "loc": { "start": { "line": 262, @@ -15711,8 +15983,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 10393, - "end": 10401, + "start": 10479, + "end": 10487, "loc": { "start": { "line": 262, @@ -15735,8 +16007,8 @@ }, { "type": "ExpressionStatement", - "start": 10428, - "end": 10466, + "start": 10514, + "end": 10552, "loc": { "start": { "line": 263, @@ -15749,8 +16021,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10428, - "end": 10465, + "start": 10514, + "end": 10551, "loc": { "start": { "line": 263, @@ -15764,8 +16036,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10428, - "end": 10452, + "start": 10514, + "end": 10538, "loc": { "start": { "line": 263, @@ -15778,8 +16050,8 @@ }, "object": { "type": "MemberExpression", - "start": 10428, - "end": 10448, + "start": 10514, + "end": 10534, "loc": { "start": { "line": 263, @@ -15792,8 +16064,8 @@ }, "object": { "type": "MemberExpression", - "start": 10428, - "end": 10442, + "start": 10514, + "end": 10528, "loc": { "start": { "line": 263, @@ -15806,8 +16078,8 @@ }, "object": { "type": "ThisExpression", - "start": 10428, - "end": 10432, + "start": 10514, + "end": 10518, "loc": { "start": { "line": 263, @@ -15821,8 +16093,8 @@ }, "property": { "type": "Identifier", - "start": 10433, - "end": 10442, + "start": 10519, + "end": 10528, "loc": { "start": { "line": 263, @@ -15840,8 +16112,8 @@ }, "property": { "type": "Identifier", - "start": 10443, - "end": 10448, + "start": 10529, + "end": 10534, "loc": { "start": { "line": 263, @@ -15859,8 +16131,8 @@ }, "property": { "type": "Identifier", - "start": 10449, - "end": 10452, + "start": 10535, + "end": 10538, "loc": { "start": { "line": 263, @@ -15878,8 +16150,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 10455, - "end": 10465, + "start": 10541, + "end": 10551, "loc": { "start": { "line": 263, @@ -15894,8 +16166,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 10456, - "end": 10464, + "start": 10542, + "end": 10550, "loc": { "start": { "line": 263, @@ -15918,8 +16190,8 @@ }, { "type": "ExpressionStatement", - "start": 10491, - "end": 10523, + "start": 10577, + "end": 10609, "loc": { "start": { "line": 264, @@ -15932,8 +16204,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10491, - "end": 10522, + "start": 10577, + "end": 10608, "loc": { "start": { "line": 264, @@ -15947,8 +16219,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10491, - "end": 10510, + "start": 10577, + "end": 10596, "loc": { "start": { "line": 264, @@ -15961,8 +16233,8 @@ }, "object": { "type": "MemberExpression", - "start": 10491, - "end": 10503, + "start": 10577, + "end": 10589, "loc": { "start": { "line": 264, @@ -15975,8 +16247,8 @@ }, "object": { "type": "Identifier", - "start": 10491, - "end": 10497, + "start": 10577, + "end": 10583, "loc": { "start": { "line": 264, @@ -15992,8 +16264,8 @@ }, "property": { "type": "Identifier", - "start": 10498, - "end": 10503, + "start": 10584, + "end": 10589, "loc": { "start": { "line": 264, @@ -16011,8 +16283,8 @@ }, "property": { "type": "Identifier", - "start": 10504, - "end": 10510, + "start": 10590, + "end": 10596, "loc": { "start": { "line": 264, @@ -16030,8 +16302,8 @@ }, "right": { "type": "StringLiteral", - "start": 10513, - "end": 10522, + "start": 10599, + "end": 10608, "loc": { "start": { "line": 264, @@ -16052,8 +16324,8 @@ }, { "type": "BreakStatement", - "start": 10548, - "end": 10554, + "start": 10634, + "end": 10640, "loc": { "start": { "line": 265, @@ -16069,8 +16341,8 @@ ], "test": { "type": "Identifier", - "start": 9808, - "end": 9828, + "start": 9894, + "end": 9914, "loc": { "start": { "line": 254, @@ -16097,8 +16369,8 @@ }, { "type": "ExpressionStatement", - "start": 10597, - "end": 10829, + "start": 10683, + "end": 10915, "loc": { "start": { "line": 268, @@ -16111,8 +16383,8 @@ }, "expression": { "type": "CallExpression", - "start": 10597, - "end": 10828, + "start": 10683, + "end": 10914, "loc": { "start": { "line": 268, @@ -16125,8 +16397,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10597, - "end": 10620, + "start": 10683, + "end": 10706, "loc": { "start": { "line": 268, @@ -16139,8 +16411,8 @@ }, "object": { "type": "Identifier", - "start": 10597, - "end": 10603, + "start": 10683, + "end": 10689, "loc": { "start": { "line": 268, @@ -16156,8 +16428,8 @@ }, "property": { "type": "Identifier", - "start": 10604, - "end": 10620, + "start": 10690, + "end": 10706, "loc": { "start": { "line": 268, @@ -16176,8 +16448,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10621, - "end": 10632, + "start": 10707, + "end": 10718, "loc": { "start": { "line": 268, @@ -16196,8 +16468,8 @@ }, { "type": "AssignmentExpression", - "start": 10634, - "end": 10827, + "start": 10720, + "end": 10913, "loc": { "start": { "line": 268, @@ -16211,8 +16483,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10634, - "end": 10651, + "start": 10720, + "end": 10737, "loc": { "start": { "line": 268, @@ -16225,8 +16497,8 @@ }, "object": { "type": "ThisExpression", - "start": 10634, - "end": 10638, + "start": 10720, + "end": 10724, "loc": { "start": { "line": 268, @@ -16240,8 +16512,8 @@ }, "property": { "type": "Identifier", - "start": 10639, - "end": 10651, + "start": 10725, + "end": 10737, "loc": { "start": { "line": 268, @@ -16259,8 +16531,8 @@ }, "right": { "type": "ArrowFunctionExpression", - "start": 10654, - "end": 10827, + "start": 10740, + "end": 10913, "loc": { "start": { "line": 268, @@ -16278,8 +16550,8 @@ "params": [ { "type": "Identifier", - "start": 10655, - "end": 10656, + "start": 10741, + "end": 10742, "loc": { "start": { "line": 268, @@ -16296,8 +16568,8 @@ ], "body": { "type": "BlockStatement", - "start": 10661, - "end": 10827, + "start": 10747, + "end": 10913, "loc": { "start": { "line": 268, @@ -16311,8 +16583,8 @@ "body": [ { "type": "IfStatement", - "start": 10675, - "end": 10733, + "start": 10761, + "end": 10819, "loc": { "start": { "line": 269, @@ -16325,8 +16597,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10679, - "end": 10692, + "start": 10765, + "end": 10778, "loc": { "start": { "line": 269, @@ -16339,8 +16611,8 @@ }, "left": { "type": "MemberExpression", - "start": 10679, - "end": 10686, + "start": 10765, + "end": 10772, "loc": { "start": { "line": 269, @@ -16353,8 +16625,8 @@ }, "object": { "type": "Identifier", - "start": 10679, - "end": 10680, + "start": 10765, + "end": 10766, "loc": { "start": { "line": 269, @@ -16370,8 +16642,8 @@ }, "property": { "type": "Identifier", - "start": 10681, - "end": 10686, + "start": 10767, + "end": 10772, "loc": { "start": { "line": 269, @@ -16390,8 +16662,8 @@ "operator": "!==", "right": { "type": "NumericLiteral", - "start": 10691, - "end": 10692, + "start": 10777, + "end": 10778, "loc": { "start": { "line": 269, @@ -16411,8 +16683,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10694, - "end": 10733, + "start": 10780, + "end": 10819, "loc": { "start": { "line": 269, @@ -16426,8 +16698,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10712, - "end": 10719, + "start": 10798, + "end": 10805, "loc": { "start": { "line": 270, @@ -16447,8 +16719,8 @@ }, { "type": "ExpressionStatement", - "start": 10746, - "end": 10775, + "start": 10832, + "end": 10861, "loc": { "start": { "line": 272, @@ -16461,8 +16733,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10746, - "end": 10774, + "start": 10832, + "end": 10860, "loc": { "start": { "line": 272, @@ -16476,8 +16748,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 10746, - "end": 10762, + "start": 10832, + "end": 10848, "loc": { "start": { "line": 272, @@ -16493,8 +16765,8 @@ }, "right": { "type": "MemberExpression", - "start": 10765, - "end": 10774, + "start": 10851, + "end": 10860, "loc": { "start": { "line": 272, @@ -16507,8 +16779,8 @@ }, "object": { "type": "Identifier", - "start": 10765, - "end": 10766, + "start": 10851, + "end": 10852, "loc": { "start": { "line": 272, @@ -16524,8 +16796,8 @@ }, "property": { "type": "Identifier", - "start": 10767, - "end": 10774, + "start": 10853, + "end": 10860, "loc": { "start": { "line": 272, @@ -16545,8 +16817,8 @@ }, { "type": "ExpressionStatement", - "start": 10788, - "end": 10817, + "start": 10874, + "end": 10903, "loc": { "start": { "line": 273, @@ -16559,8 +16831,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10788, - "end": 10816, + "start": 10874, + "end": 10902, "loc": { "start": { "line": 273, @@ -16574,8 +16846,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 10788, - "end": 10804, + "start": 10874, + "end": 10890, "loc": { "start": { "line": 273, @@ -16591,8 +16863,8 @@ }, "right": { "type": "MemberExpression", - "start": 10807, - "end": 10816, + "start": 10893, + "end": 10902, "loc": { "start": { "line": 273, @@ -16605,8 +16877,8 @@ }, "object": { "type": "Identifier", - "start": 10807, - "end": 10808, + "start": 10893, + "end": 10894, "loc": { "start": { "line": 273, @@ -16622,8 +16894,8 @@ }, "property": { "type": "Identifier", - "start": 10809, - "end": 10816, + "start": 10895, + "end": 10902, "loc": { "start": { "line": 273, @@ -16651,8 +16923,8 @@ }, { "type": "ExpressionStatement", - "start": 10838, - "end": 15242, + "start": 10924, + "end": 15328, "loc": { "start": { "line": 275, @@ -16665,8 +16937,8 @@ }, "expression": { "type": "CallExpression", - "start": 10838, - "end": 15241, + "start": 10924, + "end": 15327, "loc": { "start": { "line": 275, @@ -16679,8 +16951,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10838, - "end": 10861, + "start": 10924, + "end": 10947, "loc": { "start": { "line": 275, @@ -16693,8 +16965,8 @@ }, "object": { "type": "Identifier", - "start": 10838, - "end": 10844, + "start": 10924, + "end": 10930, "loc": { "start": { "line": 275, @@ -16710,8 +16982,8 @@ }, "property": { "type": "Identifier", - "start": 10845, - "end": 10861, + "start": 10931, + "end": 10947, "loc": { "start": { "line": 275, @@ -16730,8 +17002,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10862, - "end": 10871, + "start": 10948, + "end": 10957, "loc": { "start": { "line": 275, @@ -16750,8 +17022,8 @@ }, { "type": "AssignmentExpression", - "start": 10873, - "end": 15240, + "start": 10959, + "end": 15326, "loc": { "start": { "line": 275, @@ -16765,8 +17037,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10873, - "end": 10888, + "start": 10959, + "end": 10974, "loc": { "start": { "line": 275, @@ -16779,8 +17051,8 @@ }, "object": { "type": "ThisExpression", - "start": 10873, - "end": 10877, + "start": 10959, + "end": 10963, "loc": { "start": { "line": 275, @@ -16794,8 +17066,8 @@ }, "property": { "type": "Identifier", - "start": 10878, - "end": 10888, + "start": 10964, + "end": 10974, "loc": { "start": { "line": 275, @@ -16813,8 +17085,8 @@ }, "right": { "type": "ArrowFunctionExpression", - "start": 10890, - "end": 15240, + "start": 10976, + "end": 15326, "loc": { "start": { "line": 275, @@ -16832,8 +17104,8 @@ "params": [ { "type": "Identifier", - "start": 10891, - "end": 10892, + "start": 10977, + "end": 10978, "loc": { "start": { "line": 275, @@ -16850,8 +17122,8 @@ ], "body": { "type": "BlockStatement", - "start": 10897, - "end": 15240, + "start": 10983, + "end": 15326, "loc": { "start": { "line": 275, @@ -16865,8 +17137,8 @@ "body": [ { "type": "IfStatement", - "start": 10911, - "end": 10969, + "start": 10997, + "end": 11055, "loc": { "start": { "line": 276, @@ -16879,8 +17151,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10915, - "end": 10928, + "start": 11001, + "end": 11014, "loc": { "start": { "line": 276, @@ -16893,8 +17165,8 @@ }, "left": { "type": "MemberExpression", - "start": 10915, - "end": 10922, + "start": 11001, + "end": 11008, "loc": { "start": { "line": 276, @@ -16907,8 +17179,8 @@ }, "object": { "type": "Identifier", - "start": 10915, - "end": 10916, + "start": 11001, + "end": 11002, "loc": { "start": { "line": 276, @@ -16924,8 +17196,8 @@ }, "property": { "type": "Identifier", - "start": 10917, - "end": 10922, + "start": 11003, + "end": 11008, "loc": { "start": { "line": 276, @@ -16944,8 +17216,8 @@ "operator": "!==", "right": { "type": "NumericLiteral", - "start": 10927, - "end": 10928, + "start": 11013, + "end": 11014, "loc": { "start": { "line": 276, @@ -16965,8 +17237,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10930, - "end": 10969, + "start": 11016, + "end": 11055, "loc": { "start": { "line": 276, @@ -16980,8 +17252,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10948, - "end": 10955, + "start": 11034, + "end": 11041, "loc": { "start": { "line": 277, @@ -17001,8 +17273,8 @@ }, { "type": "IfStatement", - "start": 10982, - "end": 11267, + "start": 11068, + "end": 11353, "loc": { "start": { "line": 279, @@ -17015,8 +17287,8 @@ }, "test": { "type": "LogicalExpression", - "start": 10986, - "end": 11226, + "start": 11072, + "end": 11312, "loc": { "start": { "line": 279, @@ -17029,8 +17301,8 @@ }, "left": { "type": "LogicalExpression", - "start": 10986, - "end": 11161, + "start": 11072, + "end": 11247, "loc": { "start": { "line": 279, @@ -17043,8 +17315,8 @@ }, "left": { "type": "LogicalExpression", - "start": 10986, - "end": 11096, + "start": 11072, + "end": 11182, "loc": { "start": { "line": 279, @@ -17057,8 +17329,8 @@ }, "left": { "type": "BinaryExpression", - "start": 10986, - "end": 11031, + "start": 11072, + "end": 11117, "loc": { "start": { "line": 279, @@ -17071,8 +17343,8 @@ }, "left": { "type": "MemberExpression", - "start": 10986, - "end": 10995, + "start": 11072, + "end": 11081, "loc": { "start": { "line": 279, @@ -17085,8 +17357,8 @@ }, "object": { "type": "Identifier", - "start": 10986, - "end": 10987, + "start": 11072, + "end": 11073, "loc": { "start": { "line": 279, @@ -17102,8 +17374,8 @@ }, "property": { "type": "Identifier", - "start": 10988, - "end": 10995, + "start": 11074, + "end": 11081, "loc": { "start": { "line": 279, @@ -17122,8 +17394,8 @@ "operator": ">", "right": { "type": "BinaryExpression", - "start": 10998, - "end": 11031, + "start": 11084, + "end": 11117, "loc": { "start": { "line": 279, @@ -17136,8 +17408,8 @@ }, "left": { "type": "Identifier", - "start": 10998, - "end": 11014, + "start": 11084, + "end": 11100, "loc": { "start": { "line": 279, @@ -17154,8 +17426,8 @@ "operator": "+", "right": { "type": "Identifier", - "start": 11017, - "end": 11031, + "start": 11103, + "end": 11117, "loc": { "start": { "line": 279, @@ -17174,8 +17446,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11051, - "end": 11096, + "start": 11137, + "end": 11182, "loc": { "start": { "line": 280, @@ -17188,8 +17460,8 @@ }, "left": { "type": "MemberExpression", - "start": 11051, - "end": 11060, + "start": 11137, + "end": 11146, "loc": { "start": { "line": 280, @@ -17202,8 +17474,8 @@ }, "object": { "type": "Identifier", - "start": 11051, - "end": 11052, + "start": 11137, + "end": 11138, "loc": { "start": { "line": 280, @@ -17219,8 +17491,8 @@ }, "property": { "type": "Identifier", - "start": 11053, - "end": 11060, + "start": 11139, + "end": 11146, "loc": { "start": { "line": 280, @@ -17239,8 +17511,8 @@ "operator": "<", "right": { "type": "BinaryExpression", - "start": 11063, - "end": 11096, + "start": 11149, + "end": 11182, "loc": { "start": { "line": 280, @@ -17253,8 +17525,8 @@ }, "left": { "type": "Identifier", - "start": 11063, - "end": 11079, + "start": 11149, + "end": 11165, "loc": { "start": { "line": 280, @@ -17271,8 +17543,8 @@ "operator": "-", "right": { "type": "Identifier", - "start": 11082, - "end": 11096, + "start": 11168, + "end": 11182, "loc": { "start": { "line": 280, @@ -17292,8 +17564,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11116, - "end": 11161, + "start": 11202, + "end": 11247, "loc": { "start": { "line": 281, @@ -17306,8 +17578,8 @@ }, "left": { "type": "MemberExpression", - "start": 11116, - "end": 11125, + "start": 11202, + "end": 11211, "loc": { "start": { "line": 281, @@ -17320,8 +17592,8 @@ }, "object": { "type": "Identifier", - "start": 11116, - "end": 11117, + "start": 11202, + "end": 11203, "loc": { "start": { "line": 281, @@ -17337,8 +17609,8 @@ }, "property": { "type": "Identifier", - "start": 11118, - "end": 11125, + "start": 11204, + "end": 11211, "loc": { "start": { "line": 281, @@ -17357,8 +17629,8 @@ "operator": ">", "right": { "type": "BinaryExpression", - "start": 11128, - "end": 11161, + "start": 11214, + "end": 11247, "loc": { "start": { "line": 281, @@ -17371,8 +17643,8 @@ }, "left": { "type": "Identifier", - "start": 11128, - "end": 11144, + "start": 11214, + "end": 11230, "loc": { "start": { "line": 281, @@ -17389,8 +17661,8 @@ "operator": "+", "right": { "type": "Identifier", - "start": 11147, - "end": 11161, + "start": 11233, + "end": 11247, "loc": { "start": { "line": 281, @@ -17410,8 +17682,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11181, - "end": 11226, + "start": 11267, + "end": 11312, "loc": { "start": { "line": 282, @@ -17424,8 +17696,8 @@ }, "left": { "type": "MemberExpression", - "start": 11181, - "end": 11190, + "start": 11267, + "end": 11276, "loc": { "start": { "line": 282, @@ -17438,8 +17710,8 @@ }, "object": { "type": "Identifier", - "start": 11181, - "end": 11182, + "start": 11267, + "end": 11268, "loc": { "start": { "line": 282, @@ -17455,8 +17727,8 @@ }, "property": { "type": "Identifier", - "start": 11183, - "end": 11190, + "start": 11269, + "end": 11276, "loc": { "start": { "line": 282, @@ -17475,8 +17747,8 @@ "operator": "<", "right": { "type": "BinaryExpression", - "start": 11193, - "end": 11226, + "start": 11279, + "end": 11312, "loc": { "start": { "line": 282, @@ -17489,8 +17761,8 @@ }, "left": { "type": "Identifier", - "start": 11193, - "end": 11209, + "start": 11279, + "end": 11295, "loc": { "start": { "line": 282, @@ -17507,8 +17779,8 @@ "operator": "-", "right": { "type": "Identifier", - "start": 11212, - "end": 11226, + "start": 11298, + "end": 11312, "loc": { "start": { "line": 282, @@ -17527,8 +17799,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11228, - "end": 11267, + "start": 11314, + "end": 11353, "loc": { "start": { "line": 282, @@ -17542,8 +17814,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11246, - "end": 11253, + "start": 11332, + "end": 11339, "loc": { "start": { "line": 283, @@ -17563,8 +17835,8 @@ }, { "type": "SwitchStatement", - "start": 11280, - "end": 15230, + "start": 11366, + "end": 15316, "loc": { "start": { "line": 285, @@ -17577,8 +17849,8 @@ }, "discriminant": { "type": "MemberExpression", - "start": 11288, - "end": 11304, + "start": 11374, + "end": 11390, "loc": { "start": { "line": 285, @@ -17591,8 +17863,8 @@ }, "object": { "type": "ThisExpression", - "start": 11288, - "end": 11292, + "start": 11374, + "end": 11378, "loc": { "start": { "line": 285, @@ -17606,8 +17878,8 @@ }, "property": { "type": "Identifier", - "start": 11293, - "end": 11304, + "start": 11379, + "end": 11390, "loc": { "start": { "line": 285, @@ -17626,8 +17898,8 @@ "cases": [ { "type": "SwitchCase", - "start": 11324, - "end": 13010, + "start": 11410, + "end": 13096, "loc": { "start": { "line": 286, @@ -17641,8 +17913,8 @@ "consequent": [ { "type": "IfStatement", - "start": 11371, - "end": 12983, + "start": 11457, + "end": 13069, "loc": { "start": { "line": 287, @@ -17655,8 +17927,8 @@ }, "test": { "type": "Identifier", - "start": 11375, - "end": 11388, + "start": 11461, + "end": 11474, "loc": { "start": { "line": 287, @@ -17672,8 +17944,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11390, - "end": 12983, + "start": 11476, + "end": 13069, "loc": { "start": { "line": 287, @@ -17687,8 +17959,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11416, - "end": 12161, + "start": 11502, + "end": 12247, "loc": { "start": { "line": 288, @@ -17701,8 +17973,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11416, - "end": 12160, + "start": 11502, + "end": 12246, "loc": { "start": { "line": 288, @@ -17716,8 +17988,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11416, - "end": 11445, + "start": 11502, + "end": 11531, "loc": { "start": { "line": 288, @@ -17730,8 +18002,8 @@ }, "object": { "type": "ThisExpression", - "start": 11416, - "end": 11420, + "start": 11502, + "end": 11506, "loc": { "start": { "line": 288, @@ -17745,8 +18017,8 @@ }, "property": { "type": "Identifier", - "start": 11421, - "end": 11445, + "start": 11507, + "end": 11531, "loc": { "start": { "line": 288, @@ -17764,8 +18036,8 @@ }, "right": { "type": "CallExpression", - "start": 11448, - "end": 12160, + "start": 11534, + "end": 12246, "loc": { "start": { "line": 288, @@ -17778,8 +18050,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11448, - "end": 11494, + "start": 11534, + "end": 11580, "loc": { "start": { "line": 288, @@ -17792,8 +18064,8 @@ }, "object": { "type": "MemberExpression", - "start": 11448, - "end": 11476, + "start": 11534, + "end": 11562, "loc": { "start": { "line": 288, @@ -17806,8 +18078,8 @@ }, "object": { "type": "ThisExpression", - "start": 11448, - "end": 11452, + "start": 11534, + "end": 11538, "loc": { "start": { "line": 288, @@ -17821,8 +18093,8 @@ }, "property": { "type": "Identifier", - "start": 11453, - "end": 11476, + "start": 11539, + "end": 11562, "loc": { "start": { "line": 288, @@ -17840,8 +18112,8 @@ }, "property": { "type": "Identifier", - "start": 11477, - "end": 11494, + "start": 11563, + "end": 11580, "loc": { "start": { "line": 288, @@ -17860,8 +18132,8 @@ "arguments": [ { "type": "ObjectExpression", - "start": 11495, - "end": 12159, + "start": 11581, + "end": 12245, "loc": { "start": { "line": 288, @@ -17875,8 +18147,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 11525, - "end": 11546, + "start": 11611, + "end": 11632, "loc": { "start": { "line": 289, @@ -17892,8 +18164,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11525, - "end": 11527, + "start": 11611, + "end": 11613, "loc": { "start": { "line": 289, @@ -17909,8 +18181,8 @@ }, "value": { "type": "CallExpression", - "start": 11529, - "end": 11546, + "start": 11615, + "end": 11632, "loc": { "start": { "line": 289, @@ -17923,8 +18195,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11529, - "end": 11544, + "start": 11615, + "end": 11630, "loc": { "start": { "line": 289, @@ -17937,8 +18209,8 @@ }, "object": { "type": "Identifier", - "start": 11529, - "end": 11533, + "start": 11615, + "end": 11619, "loc": { "start": { "line": 289, @@ -17954,8 +18226,8 @@ }, "property": { "type": "Identifier", - "start": 11534, - "end": 11544, + "start": 11620, + "end": 11630, "loc": { "start": { "line": 289, @@ -17976,8 +18248,8 @@ }, { "type": "ObjectProperty", - "start": 11576, - "end": 11726, + "start": 11662, + "end": 11812, "loc": { "start": { "line": 290, @@ -17993,8 +18265,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11576, - "end": 11582, + "start": 11662, + "end": 11668, "loc": { "start": { "line": 290, @@ -18010,8 +18282,8 @@ }, "value": { "type": "ObjectExpression", - "start": 11584, - "end": 11726, + "start": 11670, + "end": 11812, "loc": { "start": { "line": 290, @@ -18025,8 +18297,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 11618, - "end": 11641, + "start": 11704, + "end": 11727, "loc": { "start": { "line": 291, @@ -18042,8 +18314,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11618, - "end": 11626, + "start": 11704, + "end": 11712, "loc": { "start": { "line": 291, @@ -18059,8 +18331,8 @@ }, "value": { "type": "Identifier", - "start": 11628, - "end": 11641, + "start": 11714, + "end": 11727, "loc": { "start": { "line": 291, @@ -18077,8 +18349,8 @@ }, { "type": "ObjectProperty", - "start": 11675, - "end": 11696, + "start": 11761, + "end": 11782, "loc": { "start": { "line": 292, @@ -18094,8 +18366,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11675, - "end": 11681, + "start": 11761, + "end": 11767, "loc": { "start": { "line": 292, @@ -18111,8 +18383,8 @@ }, "value": { "type": "Identifier", - "start": 11683, - "end": 11696, + "start": 11769, + "end": 11782, "loc": { "start": { "line": 292, @@ -18132,8 +18404,8 @@ }, { "type": "ObjectProperty", - "start": 11756, - "end": 11906, + "start": 11842, + "end": 11992, "loc": { "start": { "line": 294, @@ -18149,8 +18421,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11756, - "end": 11762, + "start": 11842, + "end": 11848, "loc": { "start": { "line": 294, @@ -18166,8 +18438,8 @@ }, "value": { "type": "ObjectExpression", - "start": 11764, - "end": 11906, + "start": 11850, + "end": 11992, "loc": { "start": { "line": 294, @@ -18181,8 +18453,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 11798, - "end": 11821, + "start": 11884, + "end": 11907, "loc": { "start": { "line": 295, @@ -18198,8 +18470,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11798, - "end": 11806, + "start": 11884, + "end": 11892, "loc": { "start": { "line": 295, @@ -18215,8 +18487,8 @@ }, "value": { "type": "Identifier", - "start": 11808, - "end": 11821, + "start": 11894, + "end": 11907, "loc": { "start": { "line": 295, @@ -18233,8 +18505,8 @@ }, { "type": "ObjectProperty", - "start": 11855, - "end": 11876, + "start": 11941, + "end": 11962, "loc": { "start": { "line": 296, @@ -18250,8 +18522,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11855, - "end": 11861, + "start": 11941, + "end": 11947, "loc": { "start": { "line": 296, @@ -18267,8 +18539,8 @@ }, "value": { "type": "Identifier", - "start": 11863, - "end": 11876, + "start": 11949, + "end": 11962, "loc": { "start": { "line": 296, @@ -18288,8 +18560,8 @@ }, { "type": "ObjectProperty", - "start": 11936, - "end": 12086, + "start": 12022, + "end": 12172, "loc": { "start": { "line": 298, @@ -18305,8 +18577,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11936, - "end": 11942, + "start": 12022, + "end": 12028, "loc": { "start": { "line": 298, @@ -18322,8 +18594,8 @@ }, "value": { "type": "ObjectExpression", - "start": 11944, - "end": 12086, + "start": 12030, + "end": 12172, "loc": { "start": { "line": 298, @@ -18337,8 +18609,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 11978, - "end": 12001, + "start": 12064, + "end": 12087, "loc": { "start": { "line": 299, @@ -18354,8 +18626,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11978, - "end": 11986, + "start": 12064, + "end": 12072, "loc": { "start": { "line": 299, @@ -18371,8 +18643,8 @@ }, "value": { "type": "Identifier", - "start": 11988, - "end": 12001, + "start": 12074, + "end": 12087, "loc": { "start": { "line": 299, @@ -18389,8 +18661,8 @@ }, { "type": "ObjectProperty", - "start": 12035, - "end": 12056, + "start": 12121, + "end": 12142, "loc": { "start": { "line": 300, @@ -18406,8 +18678,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12035, - "end": 12041, + "start": 12121, + "end": 12127, "loc": { "start": { "line": 300, @@ -18423,8 +18695,8 @@ }, "value": { "type": "Identifier", - "start": 12043, - "end": 12056, + "start": 12129, + "end": 12142, "loc": { "start": { "line": 300, @@ -18444,8 +18716,8 @@ }, { "type": "ObjectProperty", - "start": 12116, - "end": 12133, + "start": 12202, + "end": 12219, "loc": { "start": { "line": 302, @@ -18461,8 +18733,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12116, - "end": 12127, + "start": 12202, + "end": 12213, "loc": { "start": { "line": 302, @@ -18478,8 +18750,8 @@ }, "value": { "type": "BooleanLiteral", - "start": 12129, - "end": 12133, + "start": 12215, + "end": 12219, "loc": { "start": { "line": 302, @@ -18501,8 +18773,8 @@ }, { "type": "ExpressionStatement", - "start": 12186, - "end": 12234, + "start": 12272, + "end": 12320, "loc": { "start": { "line": 304, @@ -18515,8 +18787,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12186, - "end": 12233, + "start": 12272, + "end": 12319, "loc": { "start": { "line": 304, @@ -18530,8 +18802,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12186, - "end": 12225, + "start": 12272, + "end": 12311, "loc": { "start": { "line": 304, @@ -18544,8 +18816,8 @@ }, "object": { "type": "MemberExpression", - "start": 12186, - "end": 12215, + "start": 12272, + "end": 12301, "loc": { "start": { "line": 304, @@ -18558,8 +18830,8 @@ }, "object": { "type": "ThisExpression", - "start": 12186, - "end": 12190, + "start": 12272, + "end": 12276, "loc": { "start": { "line": 304, @@ -18573,8 +18845,8 @@ }, "property": { "type": "Identifier", - "start": 12191, - "end": 12215, + "start": 12277, + "end": 12301, "loc": { "start": { "line": 304, @@ -18592,8 +18864,8 @@ }, "property": { "type": "Identifier", - "start": 12216, - "end": 12225, + "start": 12302, + "end": 12311, "loc": { "start": { "line": 304, @@ -18611,8 +18883,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12228, - "end": 12233, + "start": 12314, + "end": 12319, "loc": { "start": { "line": 304, @@ -18629,8 +18901,8 @@ }, { "type": "ExpressionStatement", - "start": 12259, - "end": 12310, + "start": 12345, + "end": 12396, "loc": { "start": { "line": 305, @@ -18643,8 +18915,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12259, - "end": 12309, + "start": 12345, + "end": 12395, "loc": { "start": { "line": 305, @@ -18658,8 +18930,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12259, - "end": 12302, + "start": 12345, + "end": 12388, "loc": { "start": { "line": 305, @@ -18672,8 +18944,8 @@ }, "object": { "type": "MemberExpression", - "start": 12259, - "end": 12288, + "start": 12345, + "end": 12374, "loc": { "start": { "line": 305, @@ -18686,8 +18958,8 @@ }, "object": { "type": "ThisExpression", - "start": 12259, - "end": 12263, + "start": 12345, + "end": 12349, "loc": { "start": { "line": 305, @@ -18701,8 +18973,8 @@ }, "property": { "type": "Identifier", - "start": 12264, - "end": 12288, + "start": 12350, + "end": 12374, "loc": { "start": { "line": 305, @@ -18720,8 +18992,8 @@ }, "property": { "type": "Identifier", - "start": 12289, - "end": 12302, + "start": 12375, + "end": 12388, "loc": { "start": { "line": 305, @@ -18739,8 +19011,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12305, - "end": 12309, + "start": 12391, + "end": 12395, "loc": { "start": { "line": 305, @@ -18757,8 +19029,8 @@ }, { "type": "ExpressionStatement", - "start": 12335, - "end": 12390, + "start": 12421, + "end": 12476, "loc": { "start": { "line": 306, @@ -18771,8 +19043,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12335, - "end": 12389, + "start": 12421, + "end": 12475, "loc": { "start": { "line": 306, @@ -18786,8 +19058,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12335, - "end": 12382, + "start": 12421, + "end": 12468, "loc": { "start": { "line": 306, @@ -18800,8 +19072,8 @@ }, "object": { "type": "MemberExpression", - "start": 12335, - "end": 12364, + "start": 12421, + "end": 12450, "loc": { "start": { "line": 306, @@ -18814,8 +19086,8 @@ }, "object": { "type": "ThisExpression", - "start": 12335, - "end": 12339, + "start": 12421, + "end": 12425, "loc": { "start": { "line": 306, @@ -18829,8 +19101,8 @@ }, "property": { "type": "Identifier", - "start": 12340, - "end": 12364, + "start": 12426, + "end": 12450, "loc": { "start": { "line": 306, @@ -18848,8 +19120,8 @@ }, "property": { "type": "Identifier", - "start": 12365, - "end": 12382, + "start": 12451, + "end": 12468, "loc": { "start": { "line": 306, @@ -18867,8 +19139,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12385, - "end": 12389, + "start": 12471, + "end": 12475, "loc": { "start": { "line": 306, @@ -18885,8 +19157,8 @@ }, { "type": "ExpressionStatement", - "start": 12415, - "end": 12467, + "start": 12501, + "end": 12553, "loc": { "start": { "line": 307, @@ -18899,8 +19171,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12415, - "end": 12466, + "start": 12501, + "end": 12552, "loc": { "start": { "line": 307, @@ -18914,8 +19186,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12415, - "end": 12458, + "start": 12501, + "end": 12544, "loc": { "start": { "line": 307, @@ -18928,8 +19200,8 @@ }, "object": { "type": "MemberExpression", - "start": 12415, - "end": 12444, + "start": 12501, + "end": 12530, "loc": { "start": { "line": 307, @@ -18942,8 +19214,8 @@ }, "object": { "type": "ThisExpression", - "start": 12415, - "end": 12419, + "start": 12501, + "end": 12505, "loc": { "start": { "line": 307, @@ -18957,8 +19229,8 @@ }, "property": { "type": "Identifier", - "start": 12420, - "end": 12444, + "start": 12506, + "end": 12530, "loc": { "start": { "line": 307, @@ -18976,8 +19248,8 @@ }, "property": { "type": "Identifier", - "start": 12445, - "end": 12458, + "start": 12531, + "end": 12544, "loc": { "start": { "line": 307, @@ -18995,8 +19267,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12461, - "end": 12466, + "start": 12547, + "end": 12552, "loc": { "start": { "line": 307, @@ -19013,8 +19285,8 @@ }, { "type": "ExpressionStatement", - "start": 12492, - "end": 12548, + "start": 12578, + "end": 12634, "loc": { "start": { "line": 308, @@ -19027,8 +19299,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12492, - "end": 12547, + "start": 12578, + "end": 12633, "loc": { "start": { "line": 308, @@ -19042,8 +19314,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12492, - "end": 12539, + "start": 12578, + "end": 12625, "loc": { "start": { "line": 308, @@ -19056,8 +19328,8 @@ }, "object": { "type": "MemberExpression", - "start": 12492, - "end": 12521, + "start": 12578, + "end": 12607, "loc": { "start": { "line": 308, @@ -19070,8 +19342,8 @@ }, "object": { "type": "ThisExpression", - "start": 12492, - "end": 12496, + "start": 12578, + "end": 12582, "loc": { "start": { "line": 308, @@ -19085,8 +19357,8 @@ }, "property": { "type": "Identifier", - "start": 12497, - "end": 12521, + "start": 12583, + "end": 12607, "loc": { "start": { "line": 308, @@ -19104,8 +19376,8 @@ }, "property": { "type": "Identifier", - "start": 12522, - "end": 12539, + "start": 12608, + "end": 12625, "loc": { "start": { "line": 308, @@ -19123,8 +19395,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12542, - "end": 12547, + "start": 12628, + "end": 12633, "loc": { "start": { "line": 308, @@ -19141,8 +19413,8 @@ }, { "type": "ExpressionStatement", - "start": 12573, - "end": 12625, + "start": 12659, + "end": 12711, "loc": { "start": { "line": 309, @@ -19155,8 +19427,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12573, - "end": 12624, + "start": 12659, + "end": 12710, "loc": { "start": { "line": 309, @@ -19170,8 +19442,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12573, - "end": 12616, + "start": 12659, + "end": 12702, "loc": { "start": { "line": 309, @@ -19184,8 +19456,8 @@ }, "object": { "type": "MemberExpression", - "start": 12573, - "end": 12602, + "start": 12659, + "end": 12688, "loc": { "start": { "line": 309, @@ -19198,8 +19470,8 @@ }, "object": { "type": "ThisExpression", - "start": 12573, - "end": 12577, + "start": 12659, + "end": 12663, "loc": { "start": { "line": 309, @@ -19213,8 +19485,8 @@ }, "property": { "type": "Identifier", - "start": 12578, - "end": 12602, + "start": 12664, + "end": 12688, "loc": { "start": { "line": 309, @@ -19232,8 +19504,8 @@ }, "property": { "type": "Identifier", - "start": 12603, - "end": 12616, + "start": 12689, + "end": 12702, "loc": { "start": { "line": 309, @@ -19251,8 +19523,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12619, - "end": 12624, + "start": 12705, + "end": 12710, "loc": { "start": { "line": 309, @@ -19269,8 +19541,8 @@ }, { "type": "ExpressionStatement", - "start": 12650, - "end": 12701, + "start": 12736, + "end": 12787, "loc": { "start": { "line": 310, @@ -19283,8 +19555,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12650, - "end": 12700, + "start": 12736, + "end": 12786, "loc": { "start": { "line": 310, @@ -19298,8 +19570,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12650, - "end": 12692, + "start": 12736, + "end": 12778, "loc": { "start": { "line": 310, @@ -19312,8 +19584,8 @@ }, "object": { "type": "MemberExpression", - "start": 12650, - "end": 12679, + "start": 12736, + "end": 12765, "loc": { "start": { "line": 310, @@ -19326,8 +19598,8 @@ }, "object": { "type": "ThisExpression", - "start": 12650, - "end": 12654, + "start": 12736, + "end": 12740, "loc": { "start": { "line": 310, @@ -19341,8 +19613,8 @@ }, "property": { "type": "Identifier", - "start": 12655, - "end": 12679, + "start": 12741, + "end": 12765, "loc": { "start": { "line": 310, @@ -19360,8 +19632,8 @@ }, "property": { "type": "Identifier", - "start": 12680, - "end": 12692, + "start": 12766, + "end": 12778, "loc": { "start": { "line": 310, @@ -19379,8 +19651,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 12695, - "end": 12700, + "start": 12781, + "end": 12786, "loc": { "start": { "line": 310, @@ -19397,8 +19669,8 @@ }, { "type": "ExpressionStatement", - "start": 12726, - "end": 12786, + "start": 12812, + "end": 12872, "loc": { "start": { "line": 311, @@ -19411,8 +19683,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12726, - "end": 12785, + "start": 12812, + "end": 12871, "loc": { "start": { "line": 311, @@ -19426,8 +19698,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12726, - "end": 12769, + "start": 12812, + "end": 12855, "loc": { "start": { "line": 311, @@ -19440,8 +19712,8 @@ }, "object": { "type": "MemberExpression", - "start": 12726, - "end": 12762, + "start": 12812, + "end": 12848, "loc": { "start": { "line": 311, @@ -19454,8 +19726,8 @@ }, "object": { "type": "MemberExpression", - "start": 12726, - "end": 12755, + "start": 12812, + "end": 12841, "loc": { "start": { "line": 311, @@ -19468,8 +19740,8 @@ }, "object": { "type": "ThisExpression", - "start": 12726, - "end": 12730, + "start": 12812, + "end": 12816, "loc": { "start": { "line": 311, @@ -19483,8 +19755,8 @@ }, "property": { "type": "Identifier", - "start": 12731, - "end": 12755, + "start": 12817, + "end": 12841, "loc": { "start": { "line": 311, @@ -19502,8 +19774,8 @@ }, "property": { "type": "Identifier", - "start": 12756, - "end": 12762, + "start": 12842, + "end": 12848, "loc": { "start": { "line": 311, @@ -19521,8 +19793,8 @@ }, "property": { "type": "Identifier", - "start": 12763, - "end": 12769, + "start": 12849, + "end": 12855, "loc": { "start": { "line": 311, @@ -19540,8 +19812,8 @@ }, "right": { "type": "Identifier", - "start": 12772, - "end": 12785, + "start": 12858, + "end": 12871, "loc": { "start": { "line": 311, @@ -19559,8 +19831,8 @@ }, { "type": "ExpressionStatement", - "start": 12811, - "end": 12851, + "start": 12897, + "end": 12937, "loc": { "start": { "line": 312, @@ -19573,8 +19845,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12811, - "end": 12850, + "start": 12897, + "end": 12936, "loc": { "start": { "line": 312, @@ -19588,8 +19860,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12811, - "end": 12827, + "start": 12897, + "end": 12913, "loc": { "start": { "line": 312, @@ -19602,8 +19874,8 @@ }, "object": { "type": "ThisExpression", - "start": 12811, - "end": 12815, + "start": 12897, + "end": 12901, "loc": { "start": { "line": 312, @@ -19617,8 +19889,8 @@ }, "property": { "type": "Identifier", - "start": 12816, - "end": 12827, + "start": 12902, + "end": 12913, "loc": { "start": { "line": 312, @@ -19636,8 +19908,8 @@ }, "right": { "type": "Identifier", - "start": 12830, - "end": 12850, + "start": 12916, + "end": 12936, "loc": { "start": { "line": 312, @@ -19655,8 +19927,8 @@ }, { "type": "ExpressionStatement", - "start": 12876, - "end": 12961, + "start": 12962, + "end": 13047, "loc": { "start": { "line": 313, @@ -19669,8 +19941,8 @@ }, "expression": { "type": "CallExpression", - "start": 12876, - "end": 12960, + "start": 12962, + "end": 13046, "loc": { "start": { "line": 313, @@ -19683,8 +19955,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12876, - "end": 12909, + "start": 12962, + "end": 12995, "loc": { "start": { "line": 313, @@ -19697,8 +19969,8 @@ }, "object": { "type": "MemberExpression", - "start": 12876, - "end": 12904, + "start": 12962, + "end": 12990, "loc": { "start": { "line": 313, @@ -19711,8 +19983,8 @@ }, "object": { "type": "ThisExpression", - "start": 12876, - "end": 12880, + "start": 12962, + "end": 12966, "loc": { "start": { "line": 313, @@ -19726,8 +19998,8 @@ }, "property": { "type": "Identifier", - "start": 12881, - "end": 12904, + "start": 12967, + "end": 12990, "loc": { "start": { "line": 313, @@ -19745,8 +20017,8 @@ }, "property": { "type": "Identifier", - "start": 12905, - "end": 12909, + "start": 12991, + "end": 12995, "loc": { "start": { "line": 313, @@ -19765,8 +20037,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 12910, - "end": 12928, + "start": 12996, + "end": 13014, "loc": { "start": { "line": 313, @@ -19785,8 +20057,8 @@ }, { "type": "MemberExpression", - "start": 12930, - "end": 12959, + "start": 13016, + "end": 13045, "loc": { "start": { "line": 313, @@ -19799,8 +20071,8 @@ }, "object": { "type": "ThisExpression", - "start": 12930, - "end": 12934, + "start": 13016, + "end": 13020, "loc": { "start": { "line": 313, @@ -19814,8 +20086,8 @@ }, "property": { "type": "Identifier", - "start": 12935, - "end": 12959, + "start": 13021, + "end": 13045, "loc": { "start": { "line": 313, @@ -19841,8 +20113,8 @@ }, { "type": "BreakStatement", - "start": 13004, - "end": 13010, + "start": 13090, + "end": 13096, "loc": { "start": { "line": 315, @@ -19858,8 +20130,8 @@ ], "test": { "type": "Identifier", - "start": 11329, - "end": 11349, + "start": 11415, + "end": 11435, "loc": { "start": { "line": 286, @@ -19876,8 +20148,8 @@ }, { "type": "SwitchCase", - "start": 13027, - "end": 14009, + "start": 13113, + "end": 14095, "loc": { "start": { "line": 316, @@ -19891,8 +20163,8 @@ "consequent": [ { "type": "IfStatement", - "start": 13074, - "end": 13982, + "start": 13160, + "end": 14068, "loc": { "start": { "line": 317, @@ -19905,8 +20177,8 @@ }, "test": { "type": "Identifier", - "start": 13078, - "end": 13091, + "start": 13164, + "end": 13177, "loc": { "start": { "line": 317, @@ -19922,8 +20194,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13093, - "end": 13498, + "start": 13179, + "end": 13584, "loc": { "start": { "line": 317, @@ -19937,8 +20209,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13119, - "end": 13175, + "start": 13205, + "end": 13261, "loc": { "start": { "line": 318, @@ -19951,8 +20223,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13119, - "end": 13174, + "start": 13205, + "end": 13260, "loc": { "start": { "line": 318, @@ -19966,8 +20238,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13119, - "end": 13166, + "start": 13205, + "end": 13252, "loc": { "start": { "line": 318, @@ -19980,8 +20252,8 @@ }, "object": { "type": "MemberExpression", - "start": 13119, - "end": 13148, + "start": 13205, + "end": 13234, "loc": { "start": { "line": 318, @@ -19994,8 +20266,8 @@ }, "object": { "type": "ThisExpression", - "start": 13119, - "end": 13123, + "start": 13205, + "end": 13209, "loc": { "start": { "line": 318, @@ -20009,8 +20281,8 @@ }, "property": { "type": "Identifier", - "start": 13124, - "end": 13148, + "start": 13210, + "end": 13234, "loc": { "start": { "line": 318, @@ -20028,8 +20300,8 @@ }, "property": { "type": "Identifier", - "start": 13149, - "end": 13166, + "start": 13235, + "end": 13252, "loc": { "start": { "line": 318, @@ -20047,8 +20319,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 13169, - "end": 13174, + "start": 13255, + "end": 13260, "loc": { "start": { "line": 318, @@ -20065,8 +20337,8 @@ }, { "type": "ExpressionStatement", - "start": 13200, - "end": 13251, + "start": 13286, + "end": 13337, "loc": { "start": { "line": 319, @@ -20079,8 +20351,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13200, - "end": 13250, + "start": 13286, + "end": 13336, "loc": { "start": { "line": 319, @@ -20094,8 +20366,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13200, - "end": 13243, + "start": 13286, + "end": 13329, "loc": { "start": { "line": 319, @@ -20108,8 +20380,8 @@ }, "object": { "type": "MemberExpression", - "start": 13200, - "end": 13229, + "start": 13286, + "end": 13315, "loc": { "start": { "line": 319, @@ -20122,8 +20394,8 @@ }, "object": { "type": "ThisExpression", - "start": 13200, - "end": 13204, + "start": 13286, + "end": 13290, "loc": { "start": { "line": 319, @@ -20137,8 +20409,8 @@ }, "property": { "type": "Identifier", - "start": 13205, - "end": 13229, + "start": 13291, + "end": 13315, "loc": { "start": { "line": 319, @@ -20156,8 +20428,8 @@ }, "property": { "type": "Identifier", - "start": 13230, - "end": 13243, + "start": 13316, + "end": 13329, "loc": { "start": { "line": 319, @@ -20175,8 +20447,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 13246, - "end": 13250, + "start": 13332, + "end": 13336, "loc": { "start": { "line": 319, @@ -20193,8 +20465,8 @@ }, { "type": "ExpressionStatement", - "start": 13276, - "end": 13326, + "start": 13362, + "end": 13412, "loc": { "start": { "line": 320, @@ -20207,8 +20479,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13276, - "end": 13325, + "start": 13362, + "end": 13411, "loc": { "start": { "line": 320, @@ -20222,8 +20494,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13276, - "end": 13318, + "start": 13362, + "end": 13404, "loc": { "start": { "line": 320, @@ -20236,8 +20508,8 @@ }, "object": { "type": "MemberExpression", - "start": 13276, - "end": 13305, + "start": 13362, + "end": 13391, "loc": { "start": { "line": 320, @@ -20250,8 +20522,8 @@ }, "object": { "type": "ThisExpression", - "start": 13276, - "end": 13280, + "start": 13362, + "end": 13366, "loc": { "start": { "line": 320, @@ -20265,8 +20537,8 @@ }, "property": { "type": "Identifier", - "start": 13281, - "end": 13305, + "start": 13367, + "end": 13391, "loc": { "start": { "line": 320, @@ -20284,8 +20556,8 @@ }, "property": { "type": "Identifier", - "start": 13306, - "end": 13318, + "start": 13392, + "end": 13404, "loc": { "start": { "line": 320, @@ -20303,8 +20575,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 13321, - "end": 13325, + "start": 13407, + "end": 13411, "loc": { "start": { "line": 320, @@ -20321,8 +20593,8 @@ }, { "type": "ExpressionStatement", - "start": 13351, - "end": 13411, + "start": 13437, + "end": 13497, "loc": { "start": { "line": 321, @@ -20335,8 +20607,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13351, - "end": 13410, + "start": 13437, + "end": 13496, "loc": { "start": { "line": 321, @@ -20350,8 +20622,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13351, - "end": 13394, + "start": 13437, + "end": 13480, "loc": { "start": { "line": 321, @@ -20364,8 +20636,8 @@ }, "object": { "type": "MemberExpression", - "start": 13351, - "end": 13387, + "start": 13437, + "end": 13473, "loc": { "start": { "line": 321, @@ -20378,8 +20650,8 @@ }, "object": { "type": "MemberExpression", - "start": 13351, - "end": 13380, + "start": 13437, + "end": 13466, "loc": { "start": { "line": 321, @@ -20392,8 +20664,8 @@ }, "object": { "type": "ThisExpression", - "start": 13351, - "end": 13355, + "start": 13437, + "end": 13441, "loc": { "start": { "line": 321, @@ -20407,8 +20679,8 @@ }, "property": { "type": "Identifier", - "start": 13356, - "end": 13380, + "start": 13442, + "end": 13466, "loc": { "start": { "line": 321, @@ -20426,8 +20698,8 @@ }, "property": { "type": "Identifier", - "start": 13381, - "end": 13387, + "start": 13467, + "end": 13473, "loc": { "start": { "line": 321, @@ -20445,8 +20717,8 @@ }, "property": { "type": "Identifier", - "start": 13388, - "end": 13394, + "start": 13474, + "end": 13480, "loc": { "start": { "line": 321, @@ -20464,8 +20736,8 @@ }, "right": { "type": "Identifier", - "start": 13397, - "end": 13410, + "start": 13483, + "end": 13496, "loc": { "start": { "line": 321, @@ -20483,8 +20755,8 @@ }, { "type": "ExpressionStatement", - "start": 13436, - "end": 13476, + "start": 13522, + "end": 13562, "loc": { "start": { "line": 322, @@ -20497,8 +20769,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13436, - "end": 13475, + "start": 13522, + "end": 13561, "loc": { "start": { "line": 322, @@ -20512,8 +20784,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13436, - "end": 13452, + "start": 13522, + "end": 13538, "loc": { "start": { "line": 322, @@ -20526,8 +20798,8 @@ }, "object": { "type": "ThisExpression", - "start": 13436, - "end": 13440, + "start": 13522, + "end": 13526, "loc": { "start": { "line": 322, @@ -20541,8 +20813,8 @@ }, "property": { "type": "Identifier", - "start": 13441, - "end": 13452, + "start": 13527, + "end": 13538, "loc": { "start": { "line": 322, @@ -20560,8 +20832,8 @@ }, "right": { "type": "Identifier", - "start": 13455, - "end": 13475, + "start": 13541, + "end": 13561, "loc": { "start": { "line": 322, @@ -20582,8 +20854,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 13504, - "end": 13982, + "start": 13590, + "end": 14068, "loc": { "start": { "line": 323, @@ -20597,8 +20869,8 @@ "body": [ { "type": "IfStatement", - "start": 13530, - "end": 13960, + "start": 13616, + "end": 14046, "loc": { "start": { "line": 324, @@ -20611,8 +20883,8 @@ }, "test": { "type": "MemberExpression", - "start": 13534, - "end": 13563, + "start": 13620, + "end": 13649, "loc": { "start": { "line": 324, @@ -20625,8 +20897,8 @@ }, "object": { "type": "ThisExpression", - "start": 13534, - "end": 13538, + "start": 13620, + "end": 13624, "loc": { "start": { "line": 324, @@ -20640,8 +20912,8 @@ }, "property": { "type": "Identifier", - "start": 13539, - "end": 13563, + "start": 13625, + "end": 13649, "loc": { "start": { "line": 324, @@ -20659,8 +20931,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13565, - "end": 13960, + "start": 13651, + "end": 14046, "loc": { "start": { "line": 324, @@ -20674,8 +20946,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13595, - "end": 13635, + "start": 13681, + "end": 13721, "loc": { "start": { "line": 325, @@ -20688,8 +20960,8 @@ }, "expression": { "type": "CallExpression", - "start": 13595, - "end": 13634, + "start": 13681, + "end": 13720, "loc": { "start": { "line": 325, @@ -20702,8 +20974,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13595, - "end": 13632, + "start": 13681, + "end": 13718, "loc": { "start": { "line": 325, @@ -20716,8 +20988,8 @@ }, "object": { "type": "MemberExpression", - "start": 13595, - "end": 13624, + "start": 13681, + "end": 13710, "loc": { "start": { "line": 325, @@ -20730,8 +21002,8 @@ }, "object": { "type": "ThisExpression", - "start": 13595, - "end": 13599, + "start": 13681, + "end": 13685, "loc": { "start": { "line": 325, @@ -20745,8 +21017,8 @@ }, "property": { "type": "Identifier", - "start": 13600, - "end": 13624, + "start": 13686, + "end": 13710, "loc": { "start": { "line": 325, @@ -20764,8 +21036,8 @@ }, "property": { "type": "Identifier", - "start": 13625, - "end": 13632, + "start": 13711, + "end": 13718, "loc": { "start": { "line": 325, @@ -20786,8 +21058,8 @@ }, { "type": "ExpressionStatement", - "start": 13664, - "end": 13701, + "start": 13750, + "end": 13787, "loc": { "start": { "line": 326, @@ -20800,8 +21072,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13664, - "end": 13700, + "start": 13750, + "end": 13786, "loc": { "start": { "line": 326, @@ -20815,8 +21087,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13664, - "end": 13693, + "start": 13750, + "end": 13779, "loc": { "start": { "line": 326, @@ -20829,8 +21101,8 @@ }, "object": { "type": "ThisExpression", - "start": 13664, - "end": 13668, + "start": 13750, + "end": 13754, "loc": { "start": { "line": 326, @@ -20844,8 +21116,8 @@ }, "property": { "type": "Identifier", - "start": 13669, - "end": 13693, + "start": 13755, + "end": 13779, "loc": { "start": { "line": 326, @@ -20863,8 +21135,8 @@ }, "right": { "type": "NullLiteral", - "start": 13696, - "end": 13700, + "start": 13782, + "end": 13786, "loc": { "start": { "line": 326, @@ -20880,8 +21152,8 @@ }, { "type": "ExpressionStatement", - "start": 13730, - "end": 13751, + "start": 13816, + "end": 13837, "loc": { "start": { "line": 327, @@ -20894,8 +21166,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13730, - "end": 13750, + "start": 13816, + "end": 13836, "loc": { "start": { "line": 327, @@ -20909,8 +21181,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 13730, - "end": 13743, + "start": 13816, + "end": 13829, "loc": { "start": { "line": 327, @@ -20926,8 +21198,8 @@ }, "right": { "type": "NullLiteral", - "start": 13746, - "end": 13750, + "start": 13832, + "end": 13836, "loc": { "start": { "line": 327, @@ -20943,8 +21215,8 @@ }, { "type": "ExpressionStatement", - "start": 13780, - "end": 13819, + "start": 13866, + "end": 13905, "loc": { "start": { "line": 328, @@ -20957,8 +21229,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13780, - "end": 13819, + "start": 13866, + "end": 13905, "loc": { "start": { "line": 328, @@ -20972,8 +21244,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13780, - "end": 13796, + "start": 13866, + "end": 13882, "loc": { "start": { "line": 328, @@ -20986,8 +21258,8 @@ }, "object": { "type": "ThisExpression", - "start": 13780, - "end": 13784, + "start": 13866, + "end": 13870, "loc": { "start": { "line": 328, @@ -21001,8 +21273,8 @@ }, "property": { "type": "Identifier", - "start": 13785, - "end": 13796, + "start": 13871, + "end": 13882, "loc": { "start": { "line": 328, @@ -21020,8 +21292,8 @@ }, "right": { "type": "Identifier", - "start": 13799, - "end": 13819, + "start": 13885, + "end": 13905, "loc": { "start": { "line": 328, @@ -21039,8 +21311,8 @@ }, { "type": "ExpressionStatement", - "start": 13848, - "end": 13934, + "start": 13934, + "end": 14020, "loc": { "start": { "line": 329, @@ -21053,8 +21325,8 @@ }, "expression": { "type": "CallExpression", - "start": 13848, - "end": 13933, + "start": 13934, + "end": 14019, "loc": { "start": { "line": 329, @@ -21067,8 +21339,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13848, - "end": 13881, + "start": 13934, + "end": 13967, "loc": { "start": { "line": 329, @@ -21081,8 +21353,8 @@ }, "object": { "type": "MemberExpression", - "start": 13848, - "end": 13876, + "start": 13934, + "end": 13962, "loc": { "start": { "line": 329, @@ -21095,8 +21367,8 @@ }, "object": { "type": "ThisExpression", - "start": 13848, - "end": 13852, + "start": 13934, + "end": 13938, "loc": { "start": { "line": 329, @@ -21110,8 +21382,8 @@ }, "property": { "type": "Identifier", - "start": 13853, - "end": 13876, + "start": 13939, + "end": 13962, "loc": { "start": { "line": 329, @@ -21129,8 +21401,8 @@ }, "property": { "type": "Identifier", - "start": 13877, - "end": 13881, + "start": 13963, + "end": 13967, "loc": { "start": { "line": 329, @@ -21149,8 +21421,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 13882, - "end": 13901, + "start": 13968, + "end": 13987, "loc": { "start": { "line": 329, @@ -21169,8 +21441,8 @@ }, { "type": "MemberExpression", - "start": 13903, - "end": 13932, + "start": 13989, + "end": 14018, "loc": { "start": { "line": 329, @@ -21183,8 +21455,8 @@ }, "object": { "type": "ThisExpression", - "start": 13903, - "end": 13907, + "start": 13989, + "end": 13993, "loc": { "start": { "line": 329, @@ -21198,8 +21470,8 @@ }, "property": { "type": "Identifier", - "start": 13908, - "end": 13932, + "start": 13994, + "end": 14018, "loc": { "start": { "line": 329, @@ -21229,8 +21501,8 @@ }, { "type": "BreakStatement", - "start": 14003, - "end": 14009, + "start": 14089, + "end": 14095, "loc": { "start": { "line": 332, @@ -21246,8 +21518,8 @@ ], "test": { "type": "Identifier", - "start": 13032, - "end": 13052, + "start": 13118, + "end": 13138, "loc": { "start": { "line": 316, @@ -21264,8 +21536,8 @@ }, { "type": "SwitchCase", - "start": 14026, - "end": 15216, + "start": 14112, + "end": 15302, "loc": { "start": { "line": 333, @@ -21279,8 +21551,8 @@ "consequent": [ { "type": "IfStatement", - "start": 14073, - "end": 15189, + "start": 14159, + "end": 15275, "loc": { "start": { "line": 334, @@ -21293,8 +21565,8 @@ }, "test": { "type": "Identifier", - "start": 14077, - "end": 14090, + "start": 14163, + "end": 14176, "loc": { "start": { "line": 334, @@ -21310,8 +21582,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 14092, - "end": 14704, + "start": 14178, + "end": 14790, "loc": { "start": { "line": 334, @@ -21325,8 +21597,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 14118, - "end": 14169, + "start": 14204, + "end": 14255, "loc": { "start": { "line": 335, @@ -21339,8 +21611,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14118, - "end": 14168, + "start": 14204, + "end": 14254, "loc": { "start": { "line": 335, @@ -21354,8 +21626,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14118, - "end": 14161, + "start": 14204, + "end": 14247, "loc": { "start": { "line": 335, @@ -21368,8 +21640,8 @@ }, "object": { "type": "MemberExpression", - "start": 14118, - "end": 14147, + "start": 14204, + "end": 14233, "loc": { "start": { "line": 335, @@ -21382,8 +21654,8 @@ }, "object": { "type": "ThisExpression", - "start": 14118, - "end": 14122, + "start": 14204, + "end": 14208, "loc": { "start": { "line": 335, @@ -21397,8 +21669,8 @@ }, "property": { "type": "Identifier", - "start": 14123, - "end": 14147, + "start": 14209, + "end": 14233, "loc": { "start": { "line": 335, @@ -21416,8 +21688,8 @@ }, "property": { "type": "Identifier", - "start": 14148, - "end": 14161, + "start": 14234, + "end": 14247, "loc": { "start": { "line": 335, @@ -21435,8 +21707,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14164, - "end": 14168, + "start": 14250, + "end": 14254, "loc": { "start": { "line": 335, @@ -21453,8 +21725,8 @@ }, { "type": "ExpressionStatement", - "start": 14194, - "end": 14244, + "start": 14280, + "end": 14330, "loc": { "start": { "line": 336, @@ -21467,8 +21739,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14194, - "end": 14243, + "start": 14280, + "end": 14329, "loc": { "start": { "line": 336, @@ -21482,8 +21754,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14194, - "end": 14236, + "start": 14280, + "end": 14322, "loc": { "start": { "line": 336, @@ -21496,8 +21768,8 @@ }, "object": { "type": "MemberExpression", - "start": 14194, - "end": 14223, + "start": 14280, + "end": 14309, "loc": { "start": { "line": 336, @@ -21510,8 +21782,8 @@ }, "object": { "type": "ThisExpression", - "start": 14194, - "end": 14198, + "start": 14280, + "end": 14284, "loc": { "start": { "line": 336, @@ -21525,8 +21797,8 @@ }, "property": { "type": "Identifier", - "start": 14199, - "end": 14223, + "start": 14285, + "end": 14309, "loc": { "start": { "line": 336, @@ -21544,8 +21816,8 @@ }, "property": { "type": "Identifier", - "start": 14224, - "end": 14236, + "start": 14310, + "end": 14322, "loc": { "start": { "line": 336, @@ -21563,8 +21835,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14239, - "end": 14243, + "start": 14325, + "end": 14329, "loc": { "start": { "line": 336, @@ -21581,8 +21853,8 @@ }, { "type": "ExpressionStatement", - "start": 14269, - "end": 14329, + "start": 14355, + "end": 14415, "loc": { "start": { "line": 337, @@ -21595,8 +21867,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14269, - "end": 14328, + "start": 14355, + "end": 14414, "loc": { "start": { "line": 337, @@ -21610,8 +21882,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14269, - "end": 14312, + "start": 14355, + "end": 14398, "loc": { "start": { "line": 337, @@ -21624,8 +21896,8 @@ }, "object": { "type": "MemberExpression", - "start": 14269, - "end": 14305, + "start": 14355, + "end": 14391, "loc": { "start": { "line": 337, @@ -21638,8 +21910,8 @@ }, "object": { "type": "MemberExpression", - "start": 14269, - "end": 14298, + "start": 14355, + "end": 14384, "loc": { "start": { "line": 337, @@ -21652,8 +21924,8 @@ }, "object": { "type": "ThisExpression", - "start": 14269, - "end": 14273, + "start": 14355, + "end": 14359, "loc": { "start": { "line": 337, @@ -21667,8 +21939,8 @@ }, "property": { "type": "Identifier", - "start": 14274, - "end": 14298, + "start": 14360, + "end": 14384, "loc": { "start": { "line": 337, @@ -21686,8 +21958,8 @@ }, "property": { "type": "Identifier", - "start": 14299, - "end": 14305, + "start": 14385, + "end": 14391, "loc": { "start": { "line": 337, @@ -21705,8 +21977,8 @@ }, "property": { "type": "Identifier", - "start": 14306, - "end": 14312, + "start": 14392, + "end": 14398, "loc": { "start": { "line": 337, @@ -21724,8 +21996,8 @@ }, "right": { "type": "Identifier", - "start": 14315, - "end": 14328, + "start": 14401, + "end": 14414, "loc": { "start": { "line": 337, @@ -21743,8 +22015,8 @@ }, { "type": "ExpressionStatement", - "start": 14354, - "end": 14401, + "start": 14440, + "end": 14487, "loc": { "start": { "line": 338, @@ -21757,8 +22029,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14354, - "end": 14400, + "start": 14440, + "end": 14486, "loc": { "start": { "line": 338, @@ -21772,8 +22044,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14354, - "end": 14393, + "start": 14440, + "end": 14479, "loc": { "start": { "line": 338, @@ -21786,8 +22058,8 @@ }, "object": { "type": "MemberExpression", - "start": 14354, - "end": 14383, + "start": 14440, + "end": 14469, "loc": { "start": { "line": 338, @@ -21800,8 +22072,8 @@ }, "object": { "type": "ThisExpression", - "start": 14354, - "end": 14358, + "start": 14440, + "end": 14444, "loc": { "start": { "line": 338, @@ -21815,8 +22087,8 @@ }, "property": { "type": "Identifier", - "start": 14359, - "end": 14383, + "start": 14445, + "end": 14469, "loc": { "start": { "line": 338, @@ -21834,8 +22106,8 @@ }, "property": { "type": "Identifier", - "start": 14384, - "end": 14393, + "start": 14470, + "end": 14479, "loc": { "start": { "line": 338, @@ -21853,8 +22125,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14396, - "end": 14400, + "start": 14482, + "end": 14486, "loc": { "start": { "line": 338, @@ -21871,8 +22143,8 @@ }, { "type": "ExpressionStatement", - "start": 14426, - "end": 14447, + "start": 14512, + "end": 14533, "loc": { "start": { "line": 339, @@ -21885,8 +22157,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14426, - "end": 14446, + "start": 14512, + "end": 14532, "loc": { "start": { "line": 339, @@ -21900,8 +22172,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 14426, - "end": 14439, + "start": 14512, + "end": 14525, "loc": { "start": { "line": 339, @@ -21917,8 +22189,8 @@ }, "right": { "type": "NullLiteral", - "start": 14442, - "end": 14446, + "start": 14528, + "end": 14532, "loc": { "start": { "line": 339, @@ -21934,8 +22206,8 @@ }, { "type": "ExpressionStatement", - "start": 14472, - "end": 14555, + "start": 14558, + "end": 14641, "loc": { "start": { "line": 340, @@ -21948,8 +22220,8 @@ }, "expression": { "type": "CallExpression", - "start": 14472, - "end": 14554, + "start": 14558, + "end": 14640, "loc": { "start": { "line": 340, @@ -21962,8 +22234,8 @@ }, "callee": { "type": "MemberExpression", - "start": 14472, - "end": 14505, + "start": 14558, + "end": 14591, "loc": { "start": { "line": 340, @@ -21976,8 +22248,8 @@ }, "object": { "type": "MemberExpression", - "start": 14472, - "end": 14500, + "start": 14558, + "end": 14586, "loc": { "start": { "line": 340, @@ -21990,8 +22262,8 @@ }, "object": { "type": "ThisExpression", - "start": 14472, - "end": 14476, + "start": 14558, + "end": 14562, "loc": { "start": { "line": 340, @@ -22005,8 +22277,8 @@ }, "property": { "type": "Identifier", - "start": 14477, - "end": 14500, + "start": 14563, + "end": 14586, "loc": { "start": { "line": 340, @@ -22024,8 +22296,8 @@ }, "property": { "type": "Identifier", - "start": 14501, - "end": 14505, + "start": 14587, + "end": 14591, "loc": { "start": { "line": 340, @@ -22044,8 +22316,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 14506, - "end": 14522, + "start": 14592, + "end": 14608, "loc": { "start": { "line": 340, @@ -22064,8 +22336,8 @@ }, { "type": "MemberExpression", - "start": 14524, - "end": 14553, + "start": 14610, + "end": 14639, "loc": { "start": { "line": 340, @@ -22078,8 +22350,8 @@ }, "object": { "type": "ThisExpression", - "start": 14524, - "end": 14528, + "start": 14610, + "end": 14614, "loc": { "start": { "line": 340, @@ -22093,8 +22365,8 @@ }, "property": { "type": "Identifier", - "start": 14529, - "end": 14553, + "start": 14615, + "end": 14639, "loc": { "start": { "line": 340, @@ -22115,8 +22387,8 @@ }, { "type": "ExpressionStatement", - "start": 14580, - "end": 14617, + "start": 14666, + "end": 14703, "loc": { "start": { "line": 341, @@ -22129,8 +22401,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14580, - "end": 14616, + "start": 14666, + "end": 14702, "loc": { "start": { "line": 341, @@ -22144,8 +22416,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14580, - "end": 14609, + "start": 14666, + "end": 14695, "loc": { "start": { "line": 341, @@ -22158,8 +22430,8 @@ }, "object": { "type": "ThisExpression", - "start": 14580, - "end": 14584, + "start": 14666, + "end": 14670, "loc": { "start": { "line": 341, @@ -22173,8 +22445,8 @@ }, "property": { "type": "Identifier", - "start": 14585, - "end": 14609, + "start": 14671, + "end": 14695, "loc": { "start": { "line": 341, @@ -22192,8 +22464,8 @@ }, "right": { "type": "NullLiteral", - "start": 14612, - "end": 14616, + "start": 14698, + "end": 14702, "loc": { "start": { "line": 341, @@ -22209,8 +22481,8 @@ }, { "type": "ExpressionStatement", - "start": 14642, - "end": 14682, + "start": 14728, + "end": 14768, "loc": { "start": { "line": 342, @@ -22223,8 +22495,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14642, - "end": 14681, + "start": 14728, + "end": 14767, "loc": { "start": { "line": 342, @@ -22238,8 +22510,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14642, - "end": 14658, + "start": 14728, + "end": 14744, "loc": { "start": { "line": 342, @@ -22252,8 +22524,8 @@ }, "object": { "type": "ThisExpression", - "start": 14642, - "end": 14646, + "start": 14728, + "end": 14732, "loc": { "start": { "line": 342, @@ -22267,8 +22539,8 @@ }, "property": { "type": "Identifier", - "start": 14647, - "end": 14658, + "start": 14733, + "end": 14744, "loc": { "start": { "line": 342, @@ -22286,8 +22558,8 @@ }, "right": { "type": "Identifier", - "start": 14661, - "end": 14681, + "start": 14747, + "end": 14767, "loc": { "start": { "line": 342, @@ -22308,8 +22580,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 14710, - "end": 15189, + "start": 14796, + "end": 15275, "loc": { "start": { "line": 343, @@ -22323,8 +22595,8 @@ "body": [ { "type": "IfStatement", - "start": 14736, - "end": 15167, + "start": 14822, + "end": 15253, "loc": { "start": { "line": 344, @@ -22337,8 +22609,8 @@ }, "test": { "type": "MemberExpression", - "start": 14740, - "end": 14769, + "start": 14826, + "end": 14855, "loc": { "start": { "line": 344, @@ -22351,8 +22623,8 @@ }, "object": { "type": "ThisExpression", - "start": 14740, - "end": 14744, + "start": 14826, + "end": 14830, "loc": { "start": { "line": 344, @@ -22366,8 +22638,8 @@ }, "property": { "type": "Identifier", - "start": 14745, - "end": 14769, + "start": 14831, + "end": 14855, "loc": { "start": { "line": 344, @@ -22385,8 +22657,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 14771, - "end": 15167, + "start": 14857, + "end": 15253, "loc": { "start": { "line": 344, @@ -22400,8 +22672,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 14801, - "end": 14841, + "start": 14887, + "end": 14927, "loc": { "start": { "line": 345, @@ -22414,8 +22686,8 @@ }, "expression": { "type": "CallExpression", - "start": 14801, - "end": 14840, + "start": 14887, + "end": 14926, "loc": { "start": { "line": 345, @@ -22428,8 +22700,8 @@ }, "callee": { "type": "MemberExpression", - "start": 14801, - "end": 14838, + "start": 14887, + "end": 14924, "loc": { "start": { "line": 345, @@ -22442,8 +22714,8 @@ }, "object": { "type": "MemberExpression", - "start": 14801, - "end": 14830, + "start": 14887, + "end": 14916, "loc": { "start": { "line": 345, @@ -22456,8 +22728,8 @@ }, "object": { "type": "ThisExpression", - "start": 14801, - "end": 14805, + "start": 14887, + "end": 14891, "loc": { "start": { "line": 345, @@ -22471,8 +22743,8 @@ }, "property": { "type": "Identifier", - "start": 14806, - "end": 14830, + "start": 14892, + "end": 14916, "loc": { "start": { "line": 345, @@ -22490,8 +22762,8 @@ }, "property": { "type": "Identifier", - "start": 14831, - "end": 14838, + "start": 14917, + "end": 14924, "loc": { "start": { "line": 345, @@ -22512,8 +22784,8 @@ }, { "type": "ExpressionStatement", - "start": 14870, - "end": 14907, + "start": 14956, + "end": 14993, "loc": { "start": { "line": 346, @@ -22526,8 +22798,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14870, - "end": 14906, + "start": 14956, + "end": 14992, "loc": { "start": { "line": 346, @@ -22541,8 +22813,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14870, - "end": 14899, + "start": 14956, + "end": 14985, "loc": { "start": { "line": 346, @@ -22555,8 +22827,8 @@ }, "object": { "type": "ThisExpression", - "start": 14870, - "end": 14874, + "start": 14956, + "end": 14960, "loc": { "start": { "line": 346, @@ -22570,8 +22842,8 @@ }, "property": { "type": "Identifier", - "start": 14875, - "end": 14899, + "start": 14961, + "end": 14985, "loc": { "start": { "line": 346, @@ -22589,8 +22861,8 @@ }, "right": { "type": "NullLiteral", - "start": 14902, - "end": 14906, + "start": 14988, + "end": 14992, "loc": { "start": { "line": 346, @@ -22606,8 +22878,8 @@ }, { "type": "ExpressionStatement", - "start": 14936, - "end": 14957, + "start": 15022, + "end": 15043, "loc": { "start": { "line": 347, @@ -22620,8 +22892,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14936, - "end": 14956, + "start": 15022, + "end": 15042, "loc": { "start": { "line": 347, @@ -22635,8 +22907,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 14936, - "end": 14949, + "start": 15022, + "end": 15035, "loc": { "start": { "line": 347, @@ -22652,8 +22924,8 @@ }, "right": { "type": "NullLiteral", - "start": 14952, - "end": 14956, + "start": 15038, + "end": 15042, "loc": { "start": { "line": 347, @@ -22669,8 +22941,8 @@ }, { "type": "ExpressionStatement", - "start": 14986, - "end": 15026, + "start": 15072, + "end": 15112, "loc": { "start": { "line": 348, @@ -22683,8 +22955,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14986, - "end": 15025, + "start": 15072, + "end": 15111, "loc": { "start": { "line": 348, @@ -22698,8 +22970,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14986, - "end": 15002, + "start": 15072, + "end": 15088, "loc": { "start": { "line": 348, @@ -22712,8 +22984,8 @@ }, "object": { "type": "ThisExpression", - "start": 14986, - "end": 14990, + "start": 15072, + "end": 15076, "loc": { "start": { "line": 348, @@ -22727,8 +22999,8 @@ }, "property": { "type": "Identifier", - "start": 14991, - "end": 15002, + "start": 15077, + "end": 15088, "loc": { "start": { "line": 348, @@ -22746,8 +23018,8 @@ }, "right": { "type": "Identifier", - "start": 15005, - "end": 15025, + "start": 15091, + "end": 15111, "loc": { "start": { "line": 348, @@ -22765,8 +23037,8 @@ }, { "type": "ExpressionStatement", - "start": 15055, - "end": 15141, + "start": 15141, + "end": 15227, "loc": { "start": { "line": 349, @@ -22779,8 +23051,8 @@ }, "expression": { "type": "CallExpression", - "start": 15055, - "end": 15140, + "start": 15141, + "end": 15226, "loc": { "start": { "line": 349, @@ -22793,8 +23065,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15055, - "end": 15088, + "start": 15141, + "end": 15174, "loc": { "start": { "line": 349, @@ -22807,8 +23079,8 @@ }, "object": { "type": "MemberExpression", - "start": 15055, - "end": 15083, + "start": 15141, + "end": 15169, "loc": { "start": { "line": 349, @@ -22821,8 +23093,8 @@ }, "object": { "type": "ThisExpression", - "start": 15055, - "end": 15059, + "start": 15141, + "end": 15145, "loc": { "start": { "line": 349, @@ -22836,8 +23108,8 @@ }, "property": { "type": "Identifier", - "start": 15060, - "end": 15083, + "start": 15146, + "end": 15169, "loc": { "start": { "line": 349, @@ -22855,8 +23127,8 @@ }, "property": { "type": "Identifier", - "start": 15084, - "end": 15088, + "start": 15170, + "end": 15174, "loc": { "start": { "line": 349, @@ -22875,8 +23147,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 15089, - "end": 15108, + "start": 15175, + "end": 15194, "loc": { "start": { "line": 349, @@ -22895,8 +23167,8 @@ }, { "type": "MemberExpression", - "start": 15110, - "end": 15139, + "start": 15196, + "end": 15225, "loc": { "start": { "line": 349, @@ -22909,8 +23181,8 @@ }, "object": { "type": "ThisExpression", - "start": 15110, - "end": 15114, + "start": 15196, + "end": 15200, "loc": { "start": { "line": 349, @@ -22924,8 +23196,8 @@ }, "property": { "type": "Identifier", - "start": 15115, - "end": 15139, + "start": 15201, + "end": 15225, "loc": { "start": { "line": 349, @@ -22955,8 +23227,8 @@ }, { "type": "BreakStatement", - "start": 15210, - "end": 15216, + "start": 15296, + "end": 15302, "loc": { "start": { "line": 352, @@ -22972,8 +23244,8 @@ ], "test": { "type": "Identifier", - "start": 14031, - "end": 14051, + "start": 14117, + "end": 14137, "loc": { "start": { "line": 333, @@ -23000,8 +23272,8 @@ }, { "type": "ExpressionStatement", - "start": 15251, - "end": 17073, + "start": 15337, + "end": 17159, "loc": { "start": { "line": 355, @@ -23014,8 +23286,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15251, - "end": 17072, + "start": 15337, + "end": 17158, "loc": { "start": { "line": 355, @@ -23029,8 +23301,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15251, - "end": 15272, + "start": 15337, + "end": 15358, "loc": { "start": { "line": 355, @@ -23043,8 +23315,8 @@ }, "object": { "type": "ThisExpression", - "start": 15251, - "end": 15255, + "start": 15337, + "end": 15341, "loc": { "start": { "line": 355, @@ -23058,8 +23330,8 @@ }, "property": { "type": "Identifier", - "start": 15256, - "end": 15272, + "start": 15342, + "end": 15358, "loc": { "start": { "line": 355, @@ -23077,8 +23349,8 @@ }, "right": { "type": "CallExpression", - "start": 15275, - "end": 17072, + "start": 15361, + "end": 17158, "loc": { "start": { "line": 355, @@ -23091,8 +23363,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15275, - "end": 15291, + "start": 15361, + "end": 15377, "loc": { "start": { "line": 355, @@ -23105,8 +23377,8 @@ }, "object": { "type": "Identifier", - "start": 15275, - "end": 15288, + "start": 15361, + "end": 15374, "loc": { "start": { "line": 355, @@ -23122,8 +23394,8 @@ }, "property": { "type": "Identifier", - "start": 15289, - "end": 15291, + "start": 15375, + "end": 15377, "loc": { "start": { "line": 355, @@ -23142,8 +23414,8 @@ "arguments": [ { "type": "ConditionalExpression", - "start": 15305, - "end": 15390, + "start": 15391, + "end": 15476, "loc": { "start": { "line": 356, @@ -23156,8 +23428,8 @@ }, "test": { "type": "MemberExpression", - "start": 15305, - "end": 15319, + "start": 15391, + "end": 15405, "loc": { "start": { "line": 356, @@ -23170,8 +23442,8 @@ }, "object": { "type": "ThisExpression", - "start": 15305, - "end": 15309, + "start": 15391, + "end": 15395, "loc": { "start": { "line": 356, @@ -23185,8 +23457,8 @@ }, "property": { "type": "Identifier", - "start": 15310, - "end": 15319, + "start": 15396, + "end": 15405, "loc": { "start": { "line": 356, @@ -23204,8 +23476,8 @@ }, "consequent": { "type": "StringLiteral", - "start": 15338, - "end": 15361, + "start": 15424, + "end": 15447, "loc": { "start": { "line": 357, @@ -23224,8 +23496,8 @@ }, "alternate": { "type": "StringLiteral", - "start": 15380, - "end": 15390, + "start": 15466, + "end": 15476, "loc": { "start": { "line": 358, @@ -23245,8 +23517,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 15404, - "end": 17071, + "start": 15490, + "end": 17157, "loc": { "start": { "line": 359, @@ -23264,8 +23536,8 @@ "params": [ { "type": "Identifier", - "start": 15404, - "end": 15409, + "start": 15490, + "end": 15495, "loc": { "start": { "line": 359, @@ -23282,8 +23554,8 @@ ], "body": { "type": "BlockStatement", - "start": 15413, - "end": 17071, + "start": 15499, + "end": 17157, "loc": { "start": { "line": 359, @@ -23297,8 +23569,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 15431, - "end": 15453, + "start": 15517, + "end": 15539, "loc": { "start": { "line": 360, @@ -23311,8 +23583,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15431, - "end": 15452, + "start": 15517, + "end": 15538, "loc": { "start": { "line": 360, @@ -23326,8 +23598,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 15431, - "end": 15444, + "start": 15517, + "end": 15530, "loc": { "start": { "line": 360, @@ -23343,8 +23615,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 15447, - "end": 15452, + "start": 15533, + "end": 15538, "loc": { "start": { "line": 360, @@ -23361,8 +23633,8 @@ }, { "type": "IfStatement", - "start": 15470, - "end": 15759, + "start": 15556, + "end": 15845, "loc": { "start": { "line": 361, @@ -23375,8 +23647,8 @@ }, "test": { "type": "Identifier", - "start": 15474, - "end": 15485, + "start": 15560, + "end": 15571, "loc": { "start": { "line": 361, @@ -23392,8 +23664,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 15487, - "end": 15759, + "start": 15573, + "end": 15845, "loc": { "start": { "line": 361, @@ -23407,8 +23679,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 15509, - "end": 15536, + "start": 15595, + "end": 15622, "loc": { "start": { "line": 362, @@ -23421,8 +23693,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15509, - "end": 15535, + "start": 15595, + "end": 15621, "loc": { "start": { "line": 362, @@ -23436,8 +23708,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15509, - "end": 15528, + "start": 15595, + "end": 15614, "loc": { "start": { "line": 362, @@ -23450,8 +23722,8 @@ }, "object": { "type": "Identifier", - "start": 15509, - "end": 15520, + "start": 15595, + "end": 15606, "loc": { "start": { "line": 362, @@ -23467,8 +23739,8 @@ }, "property": { "type": "Identifier", - "start": 15521, - "end": 15528, + "start": 15607, + "end": 15614, "loc": { "start": { "line": 362, @@ -23486,8 +23758,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 15531, - "end": 15535, + "start": 15617, + "end": 15621, "loc": { "start": { "line": 362, @@ -23504,8 +23776,8 @@ }, { "type": "ExpressionStatement", - "start": 15557, - "end": 15598, + "start": 15643, + "end": 15684, "loc": { "start": { "line": 363, @@ -23518,8 +23790,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15557, - "end": 15597, + "start": 15643, + "end": 15683, "loc": { "start": { "line": 363, @@ -23533,8 +23805,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15557, - "end": 15579, + "start": 15643, + "end": 15665, "loc": { "start": { "line": 363, @@ -23547,8 +23819,8 @@ }, "object": { "type": "Identifier", - "start": 15557, - "end": 15568, + "start": 15643, + "end": 15654, "loc": { "start": { "line": 363, @@ -23564,8 +23836,8 @@ }, "property": { "type": "Identifier", - "start": 15569, - "end": 15579, + "start": 15655, + "end": 15665, "loc": { "start": { "line": 363, @@ -23583,8 +23855,8 @@ }, "right": { "type": "MemberExpression", - "start": 15582, - "end": 15597, + "start": 15668, + "end": 15683, "loc": { "start": { "line": 363, @@ -23597,8 +23869,8 @@ }, "object": { "type": "Identifier", - "start": 15582, - "end": 15587, + "start": 15668, + "end": 15673, "loc": { "start": { "line": 363, @@ -23614,8 +23886,8 @@ }, "property": { "type": "Identifier", - "start": 15588, - "end": 15597, + "start": 15674, + "end": 15683, "loc": { "start": { "line": 363, @@ -23635,8 +23907,8 @@ }, { "type": "ExpressionStatement", - "start": 15619, - "end": 15692, + "start": 15705, + "end": 15778, "loc": { "start": { "line": 364, @@ -23649,8 +23921,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15619, - "end": 15691, + "start": 15705, + "end": 15777, "loc": { "start": { "line": 364, @@ -23664,8 +23936,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15619, - "end": 15647, + "start": 15705, + "end": 15733, "loc": { "start": { "line": 364, @@ -23678,8 +23950,8 @@ }, "object": { "type": "Identifier", - "start": 15619, - "end": 15630, + "start": 15705, + "end": 15716, "loc": { "start": { "line": 364, @@ -23695,8 +23967,8 @@ }, "property": { "type": "Identifier", - "start": 15631, - "end": 15647, + "start": 15717, + "end": 15733, "loc": { "start": { "line": 364, @@ -23714,8 +23986,8 @@ }, "right": { "type": "LogicalExpression", - "start": 15650, - "end": 15691, + "start": 15736, + "end": 15777, "loc": { "start": { "line": 364, @@ -23728,8 +24000,8 @@ }, "left": { "type": "MemberExpression", - "start": 15650, - "end": 15672, + "start": 15736, + "end": 15758, "loc": { "start": { "line": 364, @@ -23742,8 +24014,8 @@ }, "object": { "type": "Identifier", - "start": 15650, - "end": 15655, + "start": 15736, + "end": 15741, "loc": { "start": { "line": 364, @@ -23759,8 +24031,8 @@ }, "property": { "type": "Identifier", - "start": 15656, - "end": 15672, + "start": 15742, + "end": 15758, "loc": { "start": { "line": 364, @@ -23779,8 +24051,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 15676, - "end": 15691, + "start": 15762, + "end": 15777, "loc": { "start": { "line": 364, @@ -23793,8 +24065,8 @@ }, "object": { "type": "Identifier", - "start": 15676, - "end": 15681, + "start": 15762, + "end": 15767, "loc": { "start": { "line": 364, @@ -23810,8 +24082,8 @@ }, "property": { "type": "Identifier", - "start": 15682, - "end": 15691, + "start": 15768, + "end": 15777, "loc": { "start": { "line": 364, @@ -23832,8 +24104,8 @@ }, { "type": "ExpressionStatement", - "start": 15713, - "end": 15741, + "start": 15799, + "end": 15827, "loc": { "start": { "line": 365, @@ -23846,8 +24118,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15713, - "end": 15740, + "start": 15799, + "end": 15826, "loc": { "start": { "line": 365, @@ -23861,8 +24133,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15713, - "end": 15732, + "start": 15799, + "end": 15818, "loc": { "start": { "line": 365, @@ -23875,8 +24147,8 @@ }, "object": { "type": "Identifier", - "start": 15713, - "end": 15724, + "start": 15799, + "end": 15810, "loc": { "start": { "line": 365, @@ -23892,8 +24164,8 @@ }, "property": { "type": "Identifier", - "start": 15725, - "end": 15732, + "start": 15811, + "end": 15818, "loc": { "start": { "line": 365, @@ -23911,8 +24183,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 15735, - "end": 15740, + "start": 15821, + "end": 15826, "loc": { "start": { "line": 365, @@ -23934,8 +24206,8 @@ }, { "type": "ExpressionStatement", - "start": 15776, - "end": 15813, + "start": 15862, + "end": 15899, "loc": { "start": { "line": 367, @@ -23948,8 +24220,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15776, - "end": 15812, + "start": 15862, + "end": 15898, "loc": { "start": { "line": 367, @@ -23963,8 +24235,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15776, - "end": 15801, + "start": 15862, + "end": 15887, "loc": { "start": { "line": 367, @@ -23977,8 +24249,8 @@ }, "object": { "type": "MemberExpression", - "start": 15776, - "end": 15796, + "start": 15862, + "end": 15882, "loc": { "start": { "line": 367, @@ -23991,8 +24263,8 @@ }, "object": { "type": "MemberExpression", - "start": 15776, - "end": 15790, + "start": 15862, + "end": 15876, "loc": { "start": { "line": 367, @@ -24005,8 +24277,8 @@ }, "object": { "type": "ThisExpression", - "start": 15776, - "end": 15780, + "start": 15862, + "end": 15866, "loc": { "start": { "line": 367, @@ -24020,8 +24292,8 @@ }, "property": { "type": "Identifier", - "start": 15781, - "end": 15790, + "start": 15867, + "end": 15876, "loc": { "start": { "line": 367, @@ -24039,8 +24311,8 @@ }, "property": { "type": "Identifier", - "start": 15791, - "end": 15796, + "start": 15877, + "end": 15882, "loc": { "start": { "line": 367, @@ -24058,8 +24330,8 @@ }, "property": { "type": "Identifier", - "start": 15797, - "end": 15801, + "start": 15883, + "end": 15887, "loc": { "start": { "line": 367, @@ -24077,8 +24349,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 15804, - "end": 15812, + "start": 15890, + "end": 15898, "loc": { "start": { "line": 367, @@ -24093,8 +24365,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 15805, - "end": 15811, + "start": 15891, + "end": 15897, "loc": { "start": { "line": 367, @@ -24117,8 +24389,8 @@ }, { "type": "ExpressionStatement", - "start": 15830, - "end": 15866, + "start": 15916, + "end": 15952, "loc": { "start": { "line": 368, @@ -24131,8 +24403,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15830, - "end": 15865, + "start": 15916, + "end": 15951, "loc": { "start": { "line": 368, @@ -24146,8 +24418,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15830, - "end": 15854, + "start": 15916, + "end": 15940, "loc": { "start": { "line": 368, @@ -24160,8 +24432,8 @@ }, "object": { "type": "MemberExpression", - "start": 15830, - "end": 15850, + "start": 15916, + "end": 15936, "loc": { "start": { "line": 368, @@ -24174,8 +24446,8 @@ }, "object": { "type": "MemberExpression", - "start": 15830, - "end": 15844, + "start": 15916, + "end": 15930, "loc": { "start": { "line": 368, @@ -24188,8 +24460,8 @@ }, "object": { "type": "ThisExpression", - "start": 15830, - "end": 15834, + "start": 15916, + "end": 15920, "loc": { "start": { "line": 368, @@ -24203,8 +24475,8 @@ }, "property": { "type": "Identifier", - "start": 15835, - "end": 15844, + "start": 15921, + "end": 15930, "loc": { "start": { "line": 368, @@ -24222,8 +24494,8 @@ }, "property": { "type": "Identifier", - "start": 15845, - "end": 15850, + "start": 15931, + "end": 15936, "loc": { "start": { "line": 368, @@ -24241,8 +24513,8 @@ }, "property": { "type": "Identifier", - "start": 15851, - "end": 15854, + "start": 15937, + "end": 15940, "loc": { "start": { "line": 368, @@ -24260,8 +24532,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 15857, - "end": 15865, + "start": 15943, + "end": 15951, "loc": { "start": { "line": 368, @@ -24276,8 +24548,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 15858, - "end": 15864, + "start": 15944, + "end": 15950, "loc": { "start": { "line": 368, @@ -24300,8 +24572,8 @@ }, { "type": "IfStatement", - "start": 15883, - "end": 17057, + "start": 15969, + "end": 17143, "loc": { "start": { "line": 369, @@ -24314,8 +24586,8 @@ }, "test": { "type": "MemberExpression", - "start": 15887, - "end": 15916, + "start": 15973, + "end": 16002, "loc": { "start": { "line": 369, @@ -24328,8 +24600,8 @@ }, "object": { "type": "ThisExpression", - "start": 15887, - "end": 15891, + "start": 15973, + "end": 15977, "loc": { "start": { "line": 369, @@ -24343,8 +24615,8 @@ }, "property": { "type": "Identifier", - "start": 15892, - "end": 15916, + "start": 15978, + "end": 16002, "loc": { "start": { "line": 369, @@ -24362,8 +24634,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 15918, - "end": 17057, + "start": 16004, + "end": 17143, "loc": { "start": { "line": 369, @@ -24377,8 +24649,8 @@ "body": [ { "type": "SwitchStatement", - "start": 15940, - "end": 16986, + "start": 16026, + "end": 17072, "loc": { "start": { "line": 370, @@ -24391,8 +24663,8 @@ }, "discriminant": { "type": "MemberExpression", - "start": 15948, - "end": 15964, + "start": 16034, + "end": 16050, "loc": { "start": { "line": 370, @@ -24405,8 +24677,8 @@ }, "object": { "type": "ThisExpression", - "start": 15948, - "end": 15952, + "start": 16034, + "end": 16038, "loc": { "start": { "line": 370, @@ -24420,8 +24692,8 @@ }, "property": { "type": "Identifier", - "start": 15953, - "end": 15964, + "start": 16039, + "end": 16050, "loc": { "start": { "line": 370, @@ -24440,8 +24712,8 @@ "cases": [ { "type": "SwitchCase", - "start": 15992, - "end": 16134, + "start": 16078, + "end": 16220, "loc": { "start": { "line": 371, @@ -24455,8 +24727,8 @@ "consequent": [ { "type": "ExpressionStatement", - "start": 16047, - "end": 16099, + "start": 16133, + "end": 16185, "loc": { "start": { "line": 372, @@ -24469,8 +24741,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16047, - "end": 16098, + "start": 16133, + "end": 16184, "loc": { "start": { "line": 372, @@ -24484,8 +24756,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16047, - "end": 16090, + "start": 16133, + "end": 16176, "loc": { "start": { "line": 372, @@ -24498,8 +24770,8 @@ }, "object": { "type": "MemberExpression", - "start": 16047, - "end": 16076, + "start": 16133, + "end": 16162, "loc": { "start": { "line": 372, @@ -24512,8 +24784,8 @@ }, "object": { "type": "ThisExpression", - "start": 16047, - "end": 16051, + "start": 16133, + "end": 16137, "loc": { "start": { "line": 372, @@ -24527,8 +24799,8 @@ }, "property": { "type": "Identifier", - "start": 16052, - "end": 16076, + "start": 16138, + "end": 16162, "loc": { "start": { "line": 372, @@ -24546,8 +24818,8 @@ }, "property": { "type": "Identifier", - "start": 16077, - "end": 16090, + "start": 16163, + "end": 16176, "loc": { "start": { "line": 372, @@ -24565,8 +24837,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16093, - "end": 16098, + "start": 16179, + "end": 16184, "loc": { "start": { "line": 372, @@ -24583,8 +24855,8 @@ }, { "type": "BreakStatement", - "start": 16128, - "end": 16134, + "start": 16214, + "end": 16220, "loc": { "start": { "line": 373, @@ -24600,8 +24872,8 @@ ], "test": { "type": "Identifier", - "start": 15997, - "end": 16017, + "start": 16083, + "end": 16103, "loc": { "start": { "line": 371, @@ -24618,8 +24890,8 @@ }, { "type": "SwitchCase", - "start": 16159, - "end": 16632, + "start": 16245, + "end": 16718, "loc": { "start": { "line": 374, @@ -24633,8 +24905,8 @@ "consequent": [ { "type": "ExpressionStatement", - "start": 16214, - "end": 16266, + "start": 16300, + "end": 16352, "loc": { "start": { "line": 375, @@ -24647,8 +24919,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16214, - "end": 16265, + "start": 16300, + "end": 16351, "loc": { "start": { "line": 375, @@ -24662,8 +24934,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16214, - "end": 16257, + "start": 16300, + "end": 16343, "loc": { "start": { "line": 375, @@ -24676,8 +24948,8 @@ }, "object": { "type": "MemberExpression", - "start": 16214, - "end": 16243, + "start": 16300, + "end": 16329, "loc": { "start": { "line": 375, @@ -24690,8 +24962,8 @@ }, "object": { "type": "ThisExpression", - "start": 16214, - "end": 16218, + "start": 16300, + "end": 16304, "loc": { "start": { "line": 375, @@ -24705,8 +24977,8 @@ }, "property": { "type": "Identifier", - "start": 16219, - "end": 16243, + "start": 16305, + "end": 16329, "loc": { "start": { "line": 375, @@ -24724,8 +24996,8 @@ }, "property": { "type": "Identifier", - "start": 16244, - "end": 16257, + "start": 16330, + "end": 16343, "loc": { "start": { "line": 375, @@ -24743,8 +25015,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16260, - "end": 16265, + "start": 16346, + "end": 16351, "loc": { "start": { "line": 375, @@ -24761,8 +25033,8 @@ }, { "type": "ExpressionStatement", - "start": 16295, - "end": 16351, + "start": 16381, + "end": 16437, "loc": { "start": { "line": 376, @@ -24775,8 +25047,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16295, - "end": 16350, + "start": 16381, + "end": 16436, "loc": { "start": { "line": 376, @@ -24790,8 +25062,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16295, - "end": 16342, + "start": 16381, + "end": 16428, "loc": { "start": { "line": 376, @@ -24804,8 +25076,8 @@ }, "object": { "type": "MemberExpression", - "start": 16295, - "end": 16324, + "start": 16381, + "end": 16410, "loc": { "start": { "line": 376, @@ -24818,8 +25090,8 @@ }, "object": { "type": "ThisExpression", - "start": 16295, - "end": 16299, + "start": 16381, + "end": 16385, "loc": { "start": { "line": 376, @@ -24833,8 +25105,8 @@ }, "property": { "type": "Identifier", - "start": 16300, - "end": 16324, + "start": 16386, + "end": 16410, "loc": { "start": { "line": 376, @@ -24852,8 +25124,8 @@ }, "property": { "type": "Identifier", - "start": 16325, - "end": 16342, + "start": 16411, + "end": 16428, "loc": { "start": { "line": 376, @@ -24871,8 +25143,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16345, - "end": 16350, + "start": 16431, + "end": 16436, "loc": { "start": { "line": 376, @@ -24889,8 +25161,8 @@ }, { "type": "ExpressionStatement", - "start": 16380, - "end": 16432, + "start": 16466, + "end": 16518, "loc": { "start": { "line": 377, @@ -24903,8 +25175,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16380, - "end": 16431, + "start": 16466, + "end": 16517, "loc": { "start": { "line": 377, @@ -24918,8 +25190,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16380, - "end": 16423, + "start": 16466, + "end": 16509, "loc": { "start": { "line": 377, @@ -24932,8 +25204,8 @@ }, "object": { "type": "MemberExpression", - "start": 16380, - "end": 16409, + "start": 16466, + "end": 16495, "loc": { "start": { "line": 377, @@ -24946,8 +25218,8 @@ }, "object": { "type": "ThisExpression", - "start": 16380, - "end": 16384, + "start": 16466, + "end": 16470, "loc": { "start": { "line": 377, @@ -24961,8 +25233,8 @@ }, "property": { "type": "Identifier", - "start": 16385, - "end": 16409, + "start": 16471, + "end": 16495, "loc": { "start": { "line": 377, @@ -24980,8 +25252,8 @@ }, "property": { "type": "Identifier", - "start": 16410, - "end": 16423, + "start": 16496, + "end": 16509, "loc": { "start": { "line": 377, @@ -24999,8 +25271,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16426, - "end": 16431, + "start": 16512, + "end": 16517, "loc": { "start": { "line": 377, @@ -25017,8 +25289,8 @@ }, { "type": "ExpressionStatement", - "start": 16461, - "end": 16517, + "start": 16547, + "end": 16603, "loc": { "start": { "line": 378, @@ -25031,8 +25303,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16461, - "end": 16516, + "start": 16547, + "end": 16602, "loc": { "start": { "line": 378, @@ -25046,8 +25318,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16461, - "end": 16508, + "start": 16547, + "end": 16594, "loc": { "start": { "line": 378, @@ -25060,8 +25332,8 @@ }, "object": { "type": "MemberExpression", - "start": 16461, - "end": 16490, + "start": 16547, + "end": 16576, "loc": { "start": { "line": 378, @@ -25074,8 +25346,8 @@ }, "object": { "type": "ThisExpression", - "start": 16461, - "end": 16465, + "start": 16547, + "end": 16551, "loc": { "start": { "line": 378, @@ -25089,8 +25361,8 @@ }, "property": { "type": "Identifier", - "start": 16466, - "end": 16490, + "start": 16552, + "end": 16576, "loc": { "start": { "line": 378, @@ -25108,8 +25380,8 @@ }, "property": { "type": "Identifier", - "start": 16491, - "end": 16508, + "start": 16577, + "end": 16594, "loc": { "start": { "line": 378, @@ -25127,8 +25399,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16511, - "end": 16516, + "start": 16597, + "end": 16602, "loc": { "start": { "line": 378, @@ -25145,8 +25417,8 @@ }, { "type": "ExpressionStatement", - "start": 16546, - "end": 16597, + "start": 16632, + "end": 16683, "loc": { "start": { "line": 379, @@ -25159,8 +25431,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16546, - "end": 16596, + "start": 16632, + "end": 16682, "loc": { "start": { "line": 379, @@ -25174,8 +25446,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16546, - "end": 16588, + "start": 16632, + "end": 16674, "loc": { "start": { "line": 379, @@ -25188,8 +25460,8 @@ }, "object": { "type": "MemberExpression", - "start": 16546, - "end": 16575, + "start": 16632, + "end": 16661, "loc": { "start": { "line": 379, @@ -25202,8 +25474,8 @@ }, "object": { "type": "ThisExpression", - "start": 16546, - "end": 16550, + "start": 16632, + "end": 16636, "loc": { "start": { "line": 379, @@ -25217,8 +25489,8 @@ }, "property": { "type": "Identifier", - "start": 16551, - "end": 16575, + "start": 16637, + "end": 16661, "loc": { "start": { "line": 379, @@ -25236,8 +25508,8 @@ }, "property": { "type": "Identifier", - "start": 16576, - "end": 16588, + "start": 16662, + "end": 16674, "loc": { "start": { "line": 379, @@ -25255,8 +25527,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16591, - "end": 16596, + "start": 16677, + "end": 16682, "loc": { "start": { "line": 379, @@ -25273,8 +25545,8 @@ }, { "type": "BreakStatement", - "start": 16626, - "end": 16632, + "start": 16712, + "end": 16718, "loc": { "start": { "line": 380, @@ -25290,8 +25562,8 @@ ], "test": { "type": "Identifier", - "start": 16164, - "end": 16184, + "start": 16250, + "end": 16270, "loc": { "start": { "line": 374, @@ -25308,8 +25580,8 @@ }, { "type": "SwitchCase", - "start": 16657, - "end": 16964, + "start": 16743, + "end": 17050, "loc": { "start": { "line": 381, @@ -25323,8 +25595,8 @@ "consequent": [ { "type": "ExpressionStatement", - "start": 16712, - "end": 16764, + "start": 16798, + "end": 16850, "loc": { "start": { "line": 382, @@ -25337,8 +25609,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16712, - "end": 16763, + "start": 16798, + "end": 16849, "loc": { "start": { "line": 382, @@ -25352,8 +25624,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16712, - "end": 16755, + "start": 16798, + "end": 16841, "loc": { "start": { "line": 382, @@ -25366,8 +25638,8 @@ }, "object": { "type": "MemberExpression", - "start": 16712, - "end": 16741, + "start": 16798, + "end": 16827, "loc": { "start": { "line": 382, @@ -25380,8 +25652,8 @@ }, "object": { "type": "ThisExpression", - "start": 16712, - "end": 16716, + "start": 16798, + "end": 16802, "loc": { "start": { "line": 382, @@ -25395,8 +25667,8 @@ }, "property": { "type": "Identifier", - "start": 16717, - "end": 16741, + "start": 16803, + "end": 16827, "loc": { "start": { "line": 382, @@ -25414,8 +25686,8 @@ }, "property": { "type": "Identifier", - "start": 16742, - "end": 16755, + "start": 16828, + "end": 16841, "loc": { "start": { "line": 382, @@ -25433,8 +25705,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16758, - "end": 16763, + "start": 16844, + "end": 16849, "loc": { "start": { "line": 382, @@ -25451,8 +25723,8 @@ }, { "type": "ExpressionStatement", - "start": 16793, - "end": 16849, + "start": 16879, + "end": 16935, "loc": { "start": { "line": 383, @@ -25465,8 +25737,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16793, - "end": 16848, + "start": 16879, + "end": 16934, "loc": { "start": { "line": 383, @@ -25480,8 +25752,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16793, - "end": 16840, + "start": 16879, + "end": 16926, "loc": { "start": { "line": 383, @@ -25494,8 +25766,8 @@ }, "object": { "type": "MemberExpression", - "start": 16793, - "end": 16822, + "start": 16879, + "end": 16908, "loc": { "start": { "line": 383, @@ -25508,8 +25780,8 @@ }, "object": { "type": "ThisExpression", - "start": 16793, - "end": 16797, + "start": 16879, + "end": 16883, "loc": { "start": { "line": 383, @@ -25523,8 +25795,8 @@ }, "property": { "type": "Identifier", - "start": 16798, - "end": 16822, + "start": 16884, + "end": 16908, "loc": { "start": { "line": 383, @@ -25542,8 +25814,8 @@ }, "property": { "type": "Identifier", - "start": 16823, - "end": 16840, + "start": 16909, + "end": 16926, "loc": { "start": { "line": 383, @@ -25561,8 +25833,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16843, - "end": 16848, + "start": 16929, + "end": 16934, "loc": { "start": { "line": 383, @@ -25579,8 +25851,8 @@ }, { "type": "ExpressionStatement", - "start": 16878, - "end": 16929, + "start": 16964, + "end": 17015, "loc": { "start": { "line": 384, @@ -25593,8 +25865,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16878, - "end": 16928, + "start": 16964, + "end": 17014, "loc": { "start": { "line": 384, @@ -25608,8 +25880,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16878, - "end": 16920, + "start": 16964, + "end": 17006, "loc": { "start": { "line": 384, @@ -25622,8 +25894,8 @@ }, "object": { "type": "MemberExpression", - "start": 16878, - "end": 16907, + "start": 16964, + "end": 16993, "loc": { "start": { "line": 384, @@ -25636,8 +25908,8 @@ }, "object": { "type": "ThisExpression", - "start": 16878, - "end": 16882, + "start": 16964, + "end": 16968, "loc": { "start": { "line": 384, @@ -25651,8 +25923,8 @@ }, "property": { "type": "Identifier", - "start": 16883, - "end": 16907, + "start": 16969, + "end": 16993, "loc": { "start": { "line": 384, @@ -25670,8 +25942,8 @@ }, "property": { "type": "Identifier", - "start": 16908, - "end": 16920, + "start": 16994, + "end": 17006, "loc": { "start": { "line": 384, @@ -25689,8 +25961,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16923, - "end": 16928, + "start": 17009, + "end": 17014, "loc": { "start": { "line": 384, @@ -25707,8 +25979,8 @@ }, { "type": "BreakStatement", - "start": 16958, - "end": 16964, + "start": 17044, + "end": 17050, "loc": { "start": { "line": 385, @@ -25724,8 +25996,8 @@ ], "test": { "type": "Identifier", - "start": 16662, - "end": 16682, + "start": 16748, + "end": 16768, "loc": { "start": { "line": 381, @@ -25744,8 +26016,8 @@ }, { "type": "ExpressionStatement", - "start": 17007, - "end": 17039, + "start": 17093, + "end": 17125, "loc": { "start": { "line": 387, @@ -25758,8 +26030,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 17007, - "end": 17038, + "start": 17093, + "end": 17124, "loc": { "start": { "line": 387, @@ -25773,8 +26045,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 17007, - "end": 17026, + "start": 17093, + "end": 17112, "loc": { "start": { "line": 387, @@ -25787,8 +26059,8 @@ }, "object": { "type": "MemberExpression", - "start": 17007, - "end": 17019, + "start": 17093, + "end": 17105, "loc": { "start": { "line": 387, @@ -25801,8 +26073,8 @@ }, "object": { "type": "Identifier", - "start": 17007, - "end": 17013, + "start": 17093, + "end": 17099, "loc": { "start": { "line": 387, @@ -25818,8 +26090,8 @@ }, "property": { "type": "Identifier", - "start": 17014, - "end": 17019, + "start": 17100, + "end": 17105, "loc": { "start": { "line": 387, @@ -25837,8 +26109,8 @@ }, "property": { "type": "Identifier", - "start": 17020, - "end": 17026, + "start": 17106, + "end": 17112, "loc": { "start": { "line": 387, @@ -25856,8 +26128,8 @@ }, "right": { "type": "StringLiteral", - "start": 17029, - "end": 17038, + "start": 17115, + "end": 17124, "loc": { "start": { "line": 387, @@ -25891,8 +26163,8 @@ }, { "type": "ExpressionStatement", - "start": 17082, - "end": 17102, + "start": 17168, + "end": 17188, "loc": { "start": { "line": 390, @@ -25905,8 +26177,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 17082, - "end": 17101, + "start": 17168, + "end": 17187, "loc": { "start": { "line": 390, @@ -25920,8 +26192,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 17082, - "end": 17094, + "start": 17168, + "end": 17180, "loc": { "start": { "line": 390, @@ -25934,8 +26206,8 @@ }, "object": { "type": "ThisExpression", - "start": 17082, - "end": 17086, + "start": 17168, + "end": 17172, "loc": { "start": { "line": 390, @@ -25949,8 +26221,8 @@ }, "property": { "type": "Identifier", - "start": 17087, - "end": 17094, + "start": 17173, + "end": 17180, "loc": { "start": { "line": 390, @@ -25968,8 +26240,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 17097, - "end": 17101, + "start": 17183, + "end": 17187, "loc": { "start": { "line": 390, @@ -26010,8 +26282,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n ", - "start": 17114, - "end": 17323, + "start": 17200, + "end": 17409, "loc": { "start": { "line": 393, @@ -26027,8 +26299,8 @@ }, { "type": "ClassMethod", - "start": 17328, - "end": 18135, + "start": 17414, + "end": 18221, "loc": { "start": { "line": 398, @@ -26043,8 +26315,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 17328, - "end": 17338, + "start": 17414, + "end": 17424, "loc": { "start": { "line": 398, @@ -26067,8 +26339,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17341, - "end": 18135, + "start": 17427, + "end": 18221, "loc": { "start": { "line": 398, @@ -26082,8 +26354,8 @@ "body": [ { "type": "IfStatement", - "start": 17351, - "end": 17401, + "start": 17437, + "end": 17487, "loc": { "start": { "line": 399, @@ -26096,8 +26368,8 @@ }, "test": { "type": "UnaryExpression", - "start": 17355, - "end": 17368, + "start": 17441, + "end": 17454, "loc": { "start": { "line": 399, @@ -26112,8 +26384,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 17356, - "end": 17368, + "start": 17442, + "end": 17454, "loc": { "start": { "line": 399, @@ -26126,8 +26398,8 @@ }, "object": { "type": "ThisExpression", - "start": 17356, - "end": 17360, + "start": 17442, + "end": 17446, "loc": { "start": { "line": 399, @@ -26141,8 +26413,8 @@ }, "property": { "type": "Identifier", - "start": 17361, - "end": 17368, + "start": 17447, + "end": 17454, "loc": { "start": { "line": 399, @@ -26164,8 +26436,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 17370, - "end": 17401, + "start": 17456, + "end": 17487, "loc": { "start": { "line": 399, @@ -26179,8 +26451,8 @@ "body": [ { "type": "ReturnStatement", - "start": 17384, - "end": 17391, + "start": 17470, + "end": 17477, "loc": { "start": { "line": 400, @@ -26200,8 +26472,8 @@ }, { "type": "IfStatement", - "start": 17410, - "end": 17489, + "start": 17496, + "end": 17575, "loc": { "start": { "line": 402, @@ -26214,8 +26486,8 @@ }, "test": { "type": "MemberExpression", - "start": 17414, - "end": 17430, + "start": 17500, + "end": 17516, "loc": { "start": { "line": 402, @@ -26228,8 +26500,8 @@ }, "object": { "type": "ThisExpression", - "start": 17414, - "end": 17418, + "start": 17500, + "end": 17504, "loc": { "start": { "line": 402, @@ -26243,8 +26515,8 @@ }, "property": { "type": "Identifier", - "start": 17419, - "end": 17430, + "start": 17505, + "end": 17516, "loc": { "start": { "line": 402, @@ -26262,8 +26534,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 17432, - "end": 17489, + "start": 17518, + "end": 17575, "loc": { "start": { "line": 402, @@ -26277,8 +26549,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 17446, - "end": 17479, + "start": 17532, + "end": 17565, "loc": { "start": { "line": 403, @@ -26291,8 +26563,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 17446, - "end": 17478, + "start": 17532, + "end": 17564, "loc": { "start": { "line": 403, @@ -26306,8 +26578,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 17446, - "end": 17470, + "start": 17532, + "end": 17556, "loc": { "start": { "line": 403, @@ -26320,8 +26592,8 @@ }, "object": { "type": "MemberExpression", - "start": 17446, - "end": 17462, + "start": 17532, + "end": 17548, "loc": { "start": { "line": 403, @@ -26334,8 +26606,8 @@ }, "object": { "type": "ThisExpression", - "start": 17446, - "end": 17450, + "start": 17532, + "end": 17536, "loc": { "start": { "line": 403, @@ -26349,8 +26621,8 @@ }, "property": { "type": "Identifier", - "start": 17451, - "end": 17462, + "start": 17537, + "end": 17548, "loc": { "start": { "line": 403, @@ -26368,8 +26640,8 @@ }, "property": { "type": "Identifier", - "start": 17463, - "end": 17470, + "start": 17549, + "end": 17556, "loc": { "start": { "line": 403, @@ -26387,8 +26659,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 17473, - "end": 17478, + "start": 17559, + "end": 17564, "loc": { "start": { "line": 403, @@ -26410,8 +26682,8 @@ }, { "type": "IfStatement", - "start": 17498, - "end": 17566, + "start": 17584, + "end": 17652, "loc": { "start": { "line": 405, @@ -26424,8 +26696,8 @@ }, "test": { "type": "MemberExpression", - "start": 17502, - "end": 17516, + "start": 17588, + "end": 17602, "loc": { "start": { "line": 405, @@ -26438,8 +26710,8 @@ }, "object": { "type": "ThisExpression", - "start": 17502, - "end": 17506, + "start": 17588, + "end": 17592, "loc": { "start": { "line": 405, @@ -26453,8 +26725,8 @@ }, "property": { "type": "Identifier", - "start": 17507, - "end": 17516, + "start": 17593, + "end": 17602, "loc": { "start": { "line": 405, @@ -26472,8 +26744,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 17518, - "end": 17566, + "start": 17604, + "end": 17652, "loc": { "start": { "line": 405, @@ -26487,8 +26759,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 17532, - "end": 17556, + "start": 17618, + "end": 17642, "loc": { "start": { "line": 406, @@ -26501,8 +26773,8 @@ }, "expression": { "type": "CallExpression", - "start": 17532, - "end": 17556, + "start": 17618, + "end": 17642, "loc": { "start": { "line": 406, @@ -26515,8 +26787,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17532, - "end": 17554, + "start": 17618, + "end": 17640, "loc": { "start": { "line": 406, @@ -26529,8 +26801,8 @@ }, "object": { "type": "ThisExpression", - "start": 17532, - "end": 17536, + "start": 17618, + "end": 17622, "loc": { "start": { "line": 406, @@ -26544,8 +26816,8 @@ }, "property": { "type": "Identifier", - "start": 17537, - "end": 17554, + "start": 17623, + "end": 17640, "loc": { "start": { "line": 406, @@ -26571,8 +26843,8 @@ }, { "type": "ExpressionStatement", - "start": 17575, - "end": 17588, + "start": 17661, + "end": 17674, "loc": { "start": { "line": 408, @@ -26585,8 +26857,8 @@ }, "expression": { "type": "CallExpression", - "start": 17575, - "end": 17587, + "start": 17661, + "end": 17673, "loc": { "start": { "line": 408, @@ -26599,8 +26871,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17575, - "end": 17585, + "start": 17661, + "end": 17671, "loc": { "start": { "line": 408, @@ -26613,8 +26885,8 @@ }, "object": { "type": "ThisExpression", - "start": 17575, - "end": 17579, + "start": 17661, + "end": 17665, "loc": { "start": { "line": 408, @@ -26628,8 +26900,8 @@ }, "property": { "type": "Identifier", - "start": 17580, - "end": 17585, + "start": 17666, + "end": 17671, "loc": { "start": { "line": 408, @@ -26650,8 +26922,8 @@ }, { "type": "VariableDeclaration", - "start": 17597, - "end": 17637, + "start": 17683, + "end": 17723, "loc": { "start": { "line": 409, @@ -26665,8 +26937,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 17603, - "end": 17636, + "start": 17689, + "end": 17722, "loc": { "start": { "line": 409, @@ -26679,8 +26951,8 @@ }, "id": { "type": "Identifier", - "start": 17603, - "end": 17609, + "start": 17689, + "end": 17695, "loc": { "start": { "line": 409, @@ -26696,8 +26968,8 @@ }, "init": { "type": "MemberExpression", - "start": 17612, - "end": 17636, + "start": 17698, + "end": 17722, "loc": { "start": { "line": 409, @@ -26710,8 +26982,8 @@ }, "object": { "type": "MemberExpression", - "start": 17612, - "end": 17629, + "start": 17698, + "end": 17715, "loc": { "start": { "line": 409, @@ -26724,8 +26996,8 @@ }, "object": { "type": "MemberExpression", - "start": 17612, - "end": 17622, + "start": 17698, + "end": 17708, "loc": { "start": { "line": 409, @@ -26738,8 +27010,8 @@ }, "object": { "type": "ThisExpression", - "start": 17612, - "end": 17616, + "start": 17698, + "end": 17702, "loc": { "start": { "line": 409, @@ -26753,8 +27025,8 @@ }, "property": { "type": "Identifier", - "start": 17617, - "end": 17622, + "start": 17703, + "end": 17708, "loc": { "start": { "line": 409, @@ -26772,8 +27044,8 @@ }, "property": { "type": "Identifier", - "start": 17623, - "end": 17629, + "start": 17709, + "end": 17715, "loc": { "start": { "line": 409, @@ -26791,8 +27063,8 @@ }, "property": { "type": "Identifier", - "start": 17630, - "end": 17636, + "start": 17716, + "end": 17722, "loc": { "start": { "line": 409, @@ -26814,8 +27086,8 @@ }, { "type": "ExpressionStatement", - "start": 17646, - "end": 17705, + "start": 17732, + "end": 17791, "loc": { "start": { "line": 410, @@ -26828,8 +27100,8 @@ }, "expression": { "type": "CallExpression", - "start": 17646, - "end": 17704, + "start": 17732, + "end": 17790, "loc": { "start": { "line": 410, @@ -26842,8 +27114,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17646, - "end": 17672, + "start": 17732, + "end": 17758, "loc": { "start": { "line": 410, @@ -26856,8 +27128,8 @@ }, "object": { "type": "Identifier", - "start": 17646, - "end": 17652, + "start": 17732, + "end": 17738, "loc": { "start": { "line": 410, @@ -26873,8 +27145,8 @@ }, "property": { "type": "Identifier", - "start": 17653, - "end": 17672, + "start": 17739, + "end": 17758, "loc": { "start": { "line": 410, @@ -26893,8 +27165,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 17673, - "end": 17684, + "start": 17759, + "end": 17770, "loc": { "start": { "line": 410, @@ -26913,8 +27185,8 @@ }, { "type": "MemberExpression", - "start": 17686, - "end": 17703, + "start": 17772, + "end": 17789, "loc": { "start": { "line": 410, @@ -26927,8 +27199,8 @@ }, "object": { "type": "ThisExpression", - "start": 17686, - "end": 17690, + "start": 17772, + "end": 17776, "loc": { "start": { "line": 410, @@ -26942,8 +27214,8 @@ }, "property": { "type": "Identifier", - "start": 17691, - "end": 17703, + "start": 17777, + "end": 17789, "loc": { "start": { "line": 410, @@ -26964,8 +27236,8 @@ }, { "type": "ExpressionStatement", - "start": 17714, - "end": 17769, + "start": 17800, + "end": 17855, "loc": { "start": { "line": 411, @@ -26978,8 +27250,8 @@ }, "expression": { "type": "CallExpression", - "start": 17714, - "end": 17768, + "start": 17800, + "end": 17854, "loc": { "start": { "line": 411, @@ -26992,8 +27264,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17714, - "end": 17740, + "start": 17800, + "end": 17826, "loc": { "start": { "line": 411, @@ -27006,8 +27278,8 @@ }, "object": { "type": "Identifier", - "start": 17714, - "end": 17720, + "start": 17800, + "end": 17806, "loc": { "start": { "line": 411, @@ -27023,8 +27295,8 @@ }, "property": { "type": "Identifier", - "start": 17721, - "end": 17740, + "start": 17807, + "end": 17826, "loc": { "start": { "line": 411, @@ -27043,8 +27315,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 17741, - "end": 17750, + "start": 17827, + "end": 17836, "loc": { "start": { "line": 411, @@ -27063,8 +27335,8 @@ }, { "type": "MemberExpression", - "start": 17752, - "end": 17767, + "start": 17838, + "end": 17853, "loc": { "start": { "line": 411, @@ -27077,8 +27349,8 @@ }, "object": { "type": "ThisExpression", - "start": 17752, - "end": 17756, + "start": 17838, + "end": 17842, "loc": { "start": { "line": 411, @@ -27092,8 +27364,8 @@ }, "property": { "type": "Identifier", - "start": 17757, - "end": 17767, + "start": 17843, + "end": 17853, "loc": { "start": { "line": 411, @@ -27114,8 +27386,8 @@ }, { "type": "VariableDeclaration", - "start": 17778, - "end": 17850, + "start": 17864, + "end": 17936, "loc": { "start": { "line": 412, @@ -27129,8 +27401,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 17784, - "end": 17849, + "start": 17870, + "end": 17935, "loc": { "start": { "line": 412, @@ -27143,8 +27415,8 @@ }, "id": { "type": "Identifier", - "start": 17784, - "end": 17797, + "start": 17870, + "end": 17883, "loc": { "start": { "line": 412, @@ -27160,8 +27432,8 @@ }, "init": { "type": "MemberExpression", - "start": 17800, - "end": 17849, + "start": 17886, + "end": 17935, "loc": { "start": { "line": 412, @@ -27174,8 +27446,8 @@ }, "object": { "type": "MemberExpression", - "start": 17800, - "end": 17835, + "start": 17886, + "end": 17921, "loc": { "start": { "line": 412, @@ -27188,8 +27460,8 @@ }, "object": { "type": "MemberExpression", - "start": 17800, - "end": 17828, + "start": 17886, + "end": 17914, "loc": { "start": { "line": 412, @@ -27202,8 +27474,8 @@ }, "object": { "type": "ThisExpression", - "start": 17800, - "end": 17804, + "start": 17886, + "end": 17890, "loc": { "start": { "line": 412, @@ -27217,8 +27489,8 @@ }, "property": { "type": "Identifier", - "start": 17805, - "end": 17828, + "start": 17891, + "end": 17914, "loc": { "start": { "line": 412, @@ -27236,8 +27508,8 @@ }, "property": { "type": "Identifier", - "start": 17829, - "end": 17835, + "start": 17915, + "end": 17921, "loc": { "start": { "line": 412, @@ -27255,8 +27527,8 @@ }, "property": { "type": "Identifier", - "start": 17836, - "end": 17849, + "start": 17922, + "end": 17935, "loc": { "start": { "line": 412, @@ -27278,8 +27550,8 @@ }, { "type": "ExpressionStatement", - "start": 17859, - "end": 17904, + "start": 17945, + "end": 17990, "loc": { "start": { "line": 413, @@ -27292,8 +27564,8 @@ }, "expression": { "type": "CallExpression", - "start": 17859, - "end": 17903, + "start": 17945, + "end": 17989, "loc": { "start": { "line": 413, @@ -27306,8 +27578,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17859, - "end": 17876, + "start": 17945, + "end": 17962, "loc": { "start": { "line": 413, @@ -27320,8 +27592,8 @@ }, "object": { "type": "Identifier", - "start": 17859, - "end": 17872, + "start": 17945, + "end": 17958, "loc": { "start": { "line": 413, @@ -27337,8 +27609,8 @@ }, "property": { "type": "Identifier", - "start": 17873, - "end": 17876, + "start": 17959, + "end": 17962, "loc": { "start": { "line": 413, @@ -27357,8 +27629,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 17877, - "end": 17902, + "start": 17963, + "end": 17988, "loc": { "start": { "line": 413, @@ -27371,8 +27643,8 @@ }, "object": { "type": "ThisExpression", - "start": 17877, - "end": 17881, + "start": 17963, + "end": 17967, "loc": { "start": { "line": 413, @@ -27386,8 +27658,8 @@ }, "property": { "type": "Identifier", - "start": 17882, - "end": 17902, + "start": 17968, + "end": 17988, "loc": { "start": { "line": 413, @@ -27408,8 +27680,8 @@ }, { "type": "ExpressionStatement", - "start": 17913, - "end": 17954, + "start": 17999, + "end": 18040, "loc": { "start": { "line": 414, @@ -27422,8 +27694,8 @@ }, "expression": { "type": "CallExpression", - "start": 17913, - "end": 17953, + "start": 17999, + "end": 18039, "loc": { "start": { "line": 414, @@ -27436,8 +27708,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17913, - "end": 17930, + "start": 17999, + "end": 18016, "loc": { "start": { "line": 414, @@ -27450,8 +27722,8 @@ }, "object": { "type": "Identifier", - "start": 17913, - "end": 17926, + "start": 17999, + "end": 18012, "loc": { "start": { "line": 414, @@ -27467,8 +27739,8 @@ }, "property": { "type": "Identifier", - "start": 17927, - "end": 17930, + "start": 18013, + "end": 18016, "loc": { "start": { "line": 414, @@ -27487,8 +27759,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 17931, - "end": 17952, + "start": 18017, + "end": 18038, "loc": { "start": { "line": 414, @@ -27501,8 +27773,8 @@ }, "object": { "type": "ThisExpression", - "start": 17931, - "end": 17935, + "start": 18017, + "end": 18021, "loc": { "start": { "line": 414, @@ -27516,8 +27788,8 @@ }, "property": { "type": "Identifier", - "start": 17936, - "end": 17952, + "start": 18022, + "end": 18038, "loc": { "start": { "line": 414, @@ -27538,8 +27810,8 @@ }, { "type": "ExpressionStatement", - "start": 17963, - "end": 18003, + "start": 18049, + "end": 18089, "loc": { "start": { "line": 415, @@ -27552,8 +27824,8 @@ }, "expression": { "type": "CallExpression", - "start": 17963, - "end": 18002, + "start": 18049, + "end": 18088, "loc": { "start": { "line": 415, @@ -27566,8 +27838,8 @@ }, "callee": { "type": "MemberExpression", - "start": 17963, - "end": 17980, + "start": 18049, + "end": 18066, "loc": { "start": { "line": 415, @@ -27580,8 +27852,8 @@ }, "object": { "type": "Identifier", - "start": 17963, - "end": 17976, + "start": 18049, + "end": 18062, "loc": { "start": { "line": 415, @@ -27597,8 +27869,8 @@ }, "property": { "type": "Identifier", - "start": 17977, - "end": 17980, + "start": 18063, + "end": 18066, "loc": { "start": { "line": 415, @@ -27617,8 +27889,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 17981, - "end": 18001, + "start": 18067, + "end": 18087, "loc": { "start": { "line": 415, @@ -27631,8 +27903,8 @@ }, "object": { "type": "ThisExpression", - "start": 17981, - "end": 17985, + "start": 18067, + "end": 18071, "loc": { "start": { "line": 415, @@ -27646,8 +27918,8 @@ }, "property": { "type": "Identifier", - "start": 17986, - "end": 18001, + "start": 18072, + "end": 18087, "loc": { "start": { "line": 415, @@ -27668,8 +27940,8 @@ }, { "type": "ExpressionStatement", - "start": 18012, - "end": 18053, + "start": 18098, + "end": 18139, "loc": { "start": { "line": 416, @@ -27682,8 +27954,8 @@ }, "expression": { "type": "CallExpression", - "start": 18012, - "end": 18052, + "start": 18098, + "end": 18138, "loc": { "start": { "line": 416, @@ -27696,8 +27968,8 @@ }, "callee": { "type": "MemberExpression", - "start": 18012, - "end": 18029, + "start": 18098, + "end": 18115, "loc": { "start": { "line": 416, @@ -27710,8 +27982,8 @@ }, "object": { "type": "Identifier", - "start": 18012, - "end": 18025, + "start": 18098, + "end": 18111, "loc": { "start": { "line": 416, @@ -27727,8 +27999,8 @@ }, "property": { "type": "Identifier", - "start": 18026, - "end": 18029, + "start": 18112, + "end": 18115, "loc": { "start": { "line": 416, @@ -27747,8 +28019,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 18030, - "end": 18051, + "start": 18116, + "end": 18137, "loc": { "start": { "line": 416, @@ -27761,8 +28033,8 @@ }, "object": { "type": "ThisExpression", - "start": 18030, - "end": 18034, + "start": 18116, + "end": 18120, "loc": { "start": { "line": 416, @@ -27776,8 +28048,8 @@ }, "property": { "type": "Identifier", - "start": 18035, - "end": 18051, + "start": 18121, + "end": 18137, "loc": { "start": { "line": 416, @@ -27798,8 +28070,8 @@ }, { "type": "ExpressionStatement", - "start": 18062, - "end": 18099, + "start": 18148, + "end": 18185, "loc": { "start": { "line": 417, @@ -27812,8 +28084,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 18062, - "end": 18098, + "start": 18148, + "end": 18184, "loc": { "start": { "line": 417, @@ -27827,8 +28099,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 18062, - "end": 18091, + "start": 18148, + "end": 18177, "loc": { "start": { "line": 417, @@ -27841,8 +28113,8 @@ }, "object": { "type": "ThisExpression", - "start": 18062, - "end": 18066, + "start": 18148, + "end": 18152, "loc": { "start": { "line": 417, @@ -27856,8 +28128,8 @@ }, "property": { "type": "Identifier", - "start": 18067, - "end": 18091, + "start": 18153, + "end": 18177, "loc": { "start": { "line": 417, @@ -27875,8 +28147,8 @@ }, "right": { "type": "NullLiteral", - "start": 18094, - "end": 18098, + "start": 18180, + "end": 18184, "loc": { "start": { "line": 417, @@ -27892,8 +28164,8 @@ }, { "type": "ExpressionStatement", - "start": 18108, - "end": 18129, + "start": 18194, + "end": 18215, "loc": { "start": { "line": 418, @@ -27906,8 +28178,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 18108, - "end": 18128, + "start": 18194, + "end": 18214, "loc": { "start": { "line": 418, @@ -27921,8 +28193,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 18108, - "end": 18120, + "start": 18194, + "end": 18206, "loc": { "start": { "line": 418, @@ -27935,8 +28207,8 @@ }, "object": { "type": "ThisExpression", - "start": 18108, - "end": 18112, + "start": 18194, + "end": 18198, "loc": { "start": { "line": 418, @@ -27950,8 +28222,8 @@ }, "property": { "type": "Identifier", - "start": 18113, - "end": 18120, + "start": 18199, + "end": 18206, "loc": { "start": { "line": 418, @@ -27969,8 +28241,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 18123, - "end": 18128, + "start": 18209, + "end": 18214, "loc": { "start": { "line": 418, @@ -27993,8 +28265,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n ", - "start": 17114, - "end": 17323, + "start": 17200, + "end": 17409, "loc": { "start": { "line": 393, @@ -28011,8 +28283,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n ", - "start": 18141, - "end": 18391, + "start": 18227, + "end": 18477, "loc": { "start": { "line": 421, @@ -28028,8 +28300,8 @@ }, { "type": "ClassMethod", - "start": 18396, - "end": 18742, + "start": 18482, + "end": 18828, "loc": { "start": { "line": 428, @@ -28044,8 +28316,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 18396, - "end": 18401, + "start": 18482, + "end": 18487, "loc": { "start": { "line": 428, @@ -28068,8 +28340,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18404, - "end": 18742, + "start": 18490, + "end": 18828, "loc": { "start": { "line": 428, @@ -28083,8 +28355,8 @@ "body": [ { "type": "IfStatement", - "start": 18414, - "end": 18464, + "start": 18500, + "end": 18550, "loc": { "start": { "line": 429, @@ -28097,8 +28369,8 @@ }, "test": { "type": "UnaryExpression", - "start": 18418, - "end": 18431, + "start": 18504, + "end": 18517, "loc": { "start": { "line": 429, @@ -28113,8 +28385,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 18419, - "end": 18431, + "start": 18505, + "end": 18517, "loc": { "start": { "line": 429, @@ -28127,8 +28399,8 @@ }, "object": { "type": "ThisExpression", - "start": 18419, - "end": 18423, + "start": 18505, + "end": 18509, "loc": { "start": { "line": 429, @@ -28142,8 +28414,8 @@ }, "property": { "type": "Identifier", - "start": 18424, - "end": 18431, + "start": 18510, + "end": 18517, "loc": { "start": { "line": 429, @@ -28165,8 +28437,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 18433, - "end": 18464, + "start": 18519, + "end": 18550, "loc": { "start": { "line": 429, @@ -28180,8 +28452,8 @@ "body": [ { "type": "ReturnStatement", - "start": 18447, - "end": 18454, + "start": 18533, + "end": 18540, "loc": { "start": { "line": 430, @@ -28201,8 +28473,8 @@ }, { "type": "ExpressionStatement", - "start": 18474, - "end": 18498, + "start": 18560, + "end": 18584, "loc": { "start": { "line": 433, @@ -28215,8 +28487,8 @@ }, "expression": { "type": "CallExpression", - "start": 18474, - "end": 18498, + "start": 18560, + "end": 18584, "loc": { "start": { "line": 433, @@ -28229,8 +28501,8 @@ }, "callee": { "type": "MemberExpression", - "start": 18474, - "end": 18496, + "start": 18560, + "end": 18582, "loc": { "start": { "line": 433, @@ -28243,8 +28515,8 @@ }, "object": { "type": "ThisExpression", - "start": 18474, - "end": 18478, + "start": 18560, + "end": 18564, "loc": { "start": { "line": 433, @@ -28258,8 +28530,8 @@ }, "property": { "type": "Identifier", - "start": 18479, - "end": 18496, + "start": 18565, + "end": 18582, "loc": { "start": { "line": 433, @@ -28280,8 +28552,8 @@ }, { "type": "ExpressionStatement", - "start": 18507, - "end": 18528, + "start": 18593, + "end": 18614, "loc": { "start": { "line": 434, @@ -28294,8 +28566,8 @@ }, "expression": { "type": "CallExpression", - "start": 18507, - "end": 18528, + "start": 18593, + "end": 18614, "loc": { "start": { "line": 434, @@ -28308,8 +28580,8 @@ }, "callee": { "type": "MemberExpression", - "start": 18507, - "end": 18526, + "start": 18593, + "end": 18612, "loc": { "start": { "line": 434, @@ -28322,8 +28594,8 @@ }, "object": { "type": "ThisExpression", - "start": 18507, - "end": 18511, + "start": 18593, + "end": 18597, "loc": { "start": { "line": 434, @@ -28337,8 +28609,8 @@ }, "property": { "type": "Identifier", - "start": 18512, - "end": 18526, + "start": 18598, + "end": 18612, "loc": { "start": { "line": 434, @@ -28359,8 +28631,8 @@ }, { "type": "IfStatement", - "start": 18538, - "end": 18687, + "start": 18624, + "end": 18773, "loc": { "start": { "line": 436, @@ -28373,8 +28645,8 @@ }, "test": { "type": "MemberExpression", - "start": 18542, - "end": 18571, + "start": 18628, + "end": 18657, "loc": { "start": { "line": 436, @@ -28387,8 +28659,8 @@ }, "object": { "type": "ThisExpression", - "start": 18542, - "end": 18546, + "start": 18628, + "end": 18632, "loc": { "start": { "line": 436, @@ -28402,8 +28674,8 @@ }, "property": { "type": "Identifier", - "start": 18547, - "end": 18571, + "start": 18633, + "end": 18657, "loc": { "start": { "line": 436, @@ -28421,8 +28693,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 18573, - "end": 18687, + "start": 18659, + "end": 18773, "loc": { "start": { "line": 436, @@ -28436,8 +28708,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 18587, - "end": 18627, + "start": 18673, + "end": 18713, "loc": { "start": { "line": 437, @@ -28450,8 +28722,8 @@ }, "expression": { "type": "CallExpression", - "start": 18587, - "end": 18626, + "start": 18673, + "end": 18712, "loc": { "start": { "line": 437, @@ -28464,8 +28736,8 @@ }, "callee": { "type": "MemberExpression", - "start": 18587, - "end": 18624, + "start": 18673, + "end": 18710, "loc": { "start": { "line": 437, @@ -28478,8 +28750,8 @@ }, "object": { "type": "MemberExpression", - "start": 18587, - "end": 18616, + "start": 18673, + "end": 18702, "loc": { "start": { "line": 437, @@ -28492,8 +28764,8 @@ }, "object": { "type": "ThisExpression", - "start": 18587, - "end": 18591, + "start": 18673, + "end": 18677, "loc": { "start": { "line": 437, @@ -28507,8 +28779,8 @@ }, "property": { "type": "Identifier", - "start": 18592, - "end": 18616, + "start": 18678, + "end": 18702, "loc": { "start": { "line": 437, @@ -28526,8 +28798,8 @@ }, "property": { "type": "Identifier", - "start": 18617, - "end": 18624, + "start": 18703, + "end": 18710, "loc": { "start": { "line": 437, @@ -28548,8 +28820,8 @@ }, { "type": "ExpressionStatement", - "start": 18640, - "end": 18677, + "start": 18726, + "end": 18763, "loc": { "start": { "line": 438, @@ -28562,8 +28834,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 18640, - "end": 18676, + "start": 18726, + "end": 18762, "loc": { "start": { "line": 438, @@ -28577,8 +28849,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 18640, - "end": 18669, + "start": 18726, + "end": 18755, "loc": { "start": { "line": 438, @@ -28591,8 +28863,8 @@ }, "object": { "type": "ThisExpression", - "start": 18640, - "end": 18644, + "start": 18726, + "end": 18730, "loc": { "start": { "line": 438, @@ -28606,8 +28878,8 @@ }, "property": { "type": "Identifier", - "start": 18645, - "end": 18669, + "start": 18731, + "end": 18755, "loc": { "start": { "line": 438, @@ -28625,8 +28897,8 @@ }, "right": { "type": "NullLiteral", - "start": 18672, - "end": 18676, + "start": 18758, + "end": 18762, "loc": { "start": { "line": 438, @@ -28647,8 +28919,8 @@ }, { "type": "ExpressionStatement", - "start": 18696, - "end": 18736, + "start": 18782, + "end": 18822, "loc": { "start": { "line": 440, @@ -28661,8 +28933,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 18696, - "end": 18735, + "start": 18782, + "end": 18821, "loc": { "start": { "line": 440, @@ -28676,8 +28948,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 18696, - "end": 18712, + "start": 18782, + "end": 18798, "loc": { "start": { "line": 440, @@ -28690,8 +28962,8 @@ }, "object": { "type": "ThisExpression", - "start": 18696, - "end": 18700, + "start": 18782, + "end": 18786, "loc": { "start": { "line": 440, @@ -28705,8 +28977,8 @@ }, "property": { "type": "Identifier", - "start": 18701, - "end": 18712, + "start": 18787, + "end": 18798, "loc": { "start": { "line": 440, @@ -28724,8 +28996,8 @@ }, "right": { "type": "Identifier", - "start": 18715, - "end": 18735, + "start": 18801, + "end": 18821, "loc": { "start": { "line": 440, @@ -28749,8 +29021,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n ", - "start": 18141, - "end": 18391, + "start": 18227, + "end": 18477, "loc": { "start": { "line": 421, @@ -28766,16 +29038,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", - "start": 18748, - "end": 18811, + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 18834, + "end": 18999, "loc": { "start": { "line": 443, "column": 4 }, "end": { - "line": 445, + "line": 447, "column": 7 } } @@ -28784,15 +29056,15 @@ }, { "type": "ClassMethod", - "start": 18816, - "end": 18885, + "start": 19004, + "end": 19082, "loc": { "start": { - "line": 446, + "line": 448, "column": 4 }, "end": { - "line": 449, + "line": 450, "column": 5 } }, @@ -28800,15 +29072,173 @@ "computed": false, "key": { "type": "Identifier", - "start": 18816, - "end": 18823, + "start": 19008, + "end": 19026, + "loc": { + "start": { + "line": 448, + "column": 8 + }, + "end": { + "line": 448, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19029, + "end": 19082, "loc": { "start": { - "line": 446, + "line": 448, + "column": 29 + }, + "end": { + "line": 450, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 19039, + "end": 19076, + "loc": { + "start": { + "line": 449, + "column": 8 + }, + "end": { + "line": 449, + "column": 45 + } + }, + "argument": { + "type": "MemberExpression", + "start": 19046, + "end": 19075, + "loc": { + "start": { + "line": 449, + "column": 15 + }, + "end": { + "line": 449, + "column": 44 + } + }, + "object": { + "type": "ThisExpression", + "start": 19046, + "end": 19050, + "loc": { + "start": { + "line": 449, + "column": 15 + }, + "end": { + "line": 449, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "start": 19051, + "end": 19075, + "loc": { + "start": { + "line": 449, + "column": 20 + }, + "end": { + "line": 449, + "column": 44 + }, + "identifierName": "_currentAngleMeasurement" + }, + "name": "_currentAngleMeasurement" + }, + "computed": false + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 18834, + "end": 18999, + "loc": { + "start": { + "line": 443, + "column": 4 + }, + "end": { + "line": 447, + "column": 7 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", + "start": 19088, + "end": 19151, + "loc": { + "start": { + "line": 452, + "column": 4 + }, + "end": { + "line": 454, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 19156, + "end": 19225, + "loc": { + "start": { + "line": 455, + "column": 4 + }, + "end": { + "line": 458, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 19156, + "end": 19163, + "loc": { + "start": { + "line": 455, "column": 4 }, "end": { - "line": 446, + "line": 455, "column": 11 }, "identifierName": "destroy" @@ -28824,87 +29254,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 18826, - "end": 18885, + "start": 19166, + "end": 19225, "loc": { "start": { - "line": 446, + "line": 455, "column": 14 }, "end": { - "line": 449, + "line": 458, "column": 5 } }, "body": [ { "type": "ExpressionStatement", - "start": 18836, - "end": 18854, + "start": 19176, + "end": 19194, "loc": { "start": { - "line": 447, + "line": 456, "column": 8 }, "end": { - "line": 447, + "line": 456, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 18836, - "end": 18853, + "start": 19176, + "end": 19193, "loc": { "start": { - "line": 447, + "line": 456, "column": 8 }, "end": { - "line": 447, + "line": 456, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 18836, - "end": 18851, + "start": 19176, + "end": 19191, "loc": { "start": { - "line": 447, + "line": 456, "column": 8 }, "end": { - "line": 447, + "line": 456, "column": 23 } }, "object": { "type": "ThisExpression", - "start": 18836, - "end": 18840, + "start": 19176, + "end": 19180, "loc": { "start": { - "line": 447, + "line": 456, "column": 8 }, "end": { - "line": 447, + "line": 456, "column": 12 } } }, "property": { "type": "Identifier", - "start": 18841, - "end": 18851, + "start": 19181, + "end": 19191, "loc": { "start": { - "line": 447, + "line": 456, "column": 13 }, "end": { - "line": 447, + "line": 456, "column": 23 }, "identifierName": "deactivate" @@ -28918,72 +29348,72 @@ }, { "type": "ExpressionStatement", - "start": 18863, - "end": 18879, + "start": 19203, + "end": 19219, "loc": { "start": { - "line": 448, + "line": 457, "column": 8 }, "end": { - "line": 448, + "line": 457, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 18863, - "end": 18878, + "start": 19203, + "end": 19218, "loc": { "start": { - "line": 448, + "line": 457, "column": 8 }, "end": { - "line": 448, + "line": 457, "column": 23 } }, "callee": { "type": "MemberExpression", - "start": 18863, - "end": 18876, + "start": 19203, + "end": 19216, "loc": { "start": { - "line": 448, + "line": 457, "column": 8 }, "end": { - "line": 448, + "line": 457, "column": 21 } }, "object": { "type": "Super", - "start": 18863, - "end": 18868, + "start": 19203, + "end": 19208, "loc": { "start": { - "line": 448, + "line": 457, "column": 8 }, "end": { - "line": 448, + "line": 457, "column": 13 } } }, "property": { "type": "Identifier", - "start": 18869, - "end": 18876, + "start": 19209, + "end": 19216, "loc": { "start": { - "line": 448, + "line": 457, "column": 14 }, "end": { - "line": 448, + "line": 457, "column": 21 }, "identifierName": "destroy" @@ -29002,15 +29432,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", - "start": 18748, - "end": 18811, + "start": 19088, + "end": 19151, "loc": { "start": { - "line": 443, + "line": 452, "column": 4 }, "end": { - "line": 445, + "line": 454, "column": 7 } } @@ -29225,8 +29655,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n ", - "start": 17114, - "end": 17323, + "start": 17200, + "end": 17409, "loc": { "start": { "line": 393, @@ -29241,8 +29671,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n ", - "start": 18141, - "end": 18391, + "start": 18227, + "end": 18477, "loc": { "start": { "line": 421, @@ -29256,16 +29686,32 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", - "start": 18748, - "end": 18811, + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 18834, + "end": 18999, "loc": { "start": { "line": 443, "column": 4 }, "end": { - "line": 445, + "line": 447, + "column": 7 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", + "start": 19088, + "end": 19151, + "loc": { + "start": { + "line": 452, + "column": 4 + }, + "end": { + "line": 454, "column": 7 } } @@ -43943,6 +44389,266 @@ } } }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6650, + "end": 6651, + "loc": { + "start": { + "line": 196, + "column": 64 + }, + "end": { + "line": 196, + "column": 65 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "el", + "start": 6651, + "end": 6653, + "loc": { + "start": { + "line": 196, + "column": 65 + }, + "end": { + "line": 196, + "column": 67 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6653, + "end": 6654, + "loc": { + "start": { + "line": 196, + "column": 67 + }, + "end": { + "line": 196, + "column": 68 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "offsetParent", + "start": 6654, + "end": 6666, + "loc": { + "start": { + "line": 196, + "column": 68 + }, + "end": { + "line": 196, + "column": 80 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 6667, + "end": 6670, + "loc": { + "start": { + "line": 196, + "column": 81 + }, + "end": { + "line": 196, + "column": 84 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "canvas", + "start": 6671, + "end": 6677, + "loc": { + "start": { + "line": 196, + "column": 85 + }, + "end": { + "line": 196, + "column": 91 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6677, + "end": 6678, + "loc": { + "start": { + "line": 196, + "column": 91 + }, + "end": { + "line": 196, + "column": 92 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parentNode", + "start": 6678, + "end": 6688, + "loc": { + "start": { + "line": 196, + "column": 92 + }, + "end": { + "line": 196, + "column": 102 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6688, + "end": 6689, + "loc": { + "start": { + "line": 196, + "column": 102 + }, + "end": { + "line": 196, + "column": 103 + } + } + }, + { + "type": { + "label": "&&", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 2, + "updateContext": null + }, + "value": "&&", + "start": 6690, + "end": 6692, + "loc": { + "start": { + "line": 196, + "column": 104 + }, + "end": { + "line": 196, + "column": 106 + } + } + }, { "type": { "label": "name", @@ -43956,16 +44662,16 @@ "binop": null }, "value": "getTop", - "start": 6650, - "end": 6656, + "start": 6693, + "end": 6699, "loc": { "start": { "line": 196, - "column": 64 + "column": 107 }, "end": { "line": 196, - "column": 70 + "column": 113 } } }, @@ -43981,16 +44687,16 @@ "postfix": false, "binop": null }, - "start": 6656, - "end": 6657, + "start": 6699, + "end": 6700, "loc": { "start": { "line": 196, - "column": 70 + "column": 113 }, "end": { "line": 196, - "column": 71 + "column": 114 } } }, @@ -44007,16 +44713,16 @@ "binop": null }, "value": "el", - "start": 6657, - "end": 6659, + "start": 6700, + "end": 6702, "loc": { "start": { "line": 196, - "column": 71 + "column": 114 }, "end": { "line": 196, - "column": 73 + "column": 116 } } }, @@ -44033,16 +44739,16 @@ "binop": null, "updateContext": null }, - "start": 6659, - "end": 6660, + "start": 6702, + "end": 6703, "loc": { "start": { "line": 196, - "column": 73 + "column": 116 }, "end": { "line": 196, - "column": 74 + "column": 117 } } }, @@ -44059,16 +44765,16 @@ "binop": null }, "value": "offsetParent", - "start": 6660, - "end": 6672, + "start": 6703, + "end": 6715, "loc": { "start": { "line": 196, - "column": 74 + "column": 117 }, "end": { "line": 196, - "column": 86 + "column": 129 } } }, @@ -44084,16 +44790,16 @@ "postfix": false, "binop": null }, - "start": 6672, - "end": 6673, + "start": 6715, + "end": 6716, "loc": { "start": { "line": 196, - "column": 86 + "column": 129 }, "end": { "line": 196, - "column": 87 + "column": 130 } } }, @@ -44109,16 +44815,16 @@ "postfix": false, "binop": null }, - "start": 6673, - "end": 6674, + "start": 6716, + "end": 6717, "loc": { "start": { "line": 196, - "column": 87 + "column": 130 }, "end": { "line": 196, - "column": 88 + "column": 131 } } }, @@ -44135,16 +44841,16 @@ "binop": null, "updateContext": null }, - "start": 6674, - "end": 6675, + "start": 6717, + "end": 6718, "loc": { "start": { "line": 196, - "column": 88 + "column": 131 }, "end": { "line": 196, - "column": 89 + "column": 132 } } }, @@ -44163,8 +44869,8 @@ "updateContext": null }, "value": "const", - "start": 6684, - "end": 6689, + "start": 6727, + "end": 6732, "loc": { "start": { "line": 197, @@ -44189,8 +44895,8 @@ "binop": null }, "value": "getLeft", - "start": 6690, - "end": 6697, + "start": 6733, + "end": 6740, "loc": { "start": { "line": 197, @@ -44216,8 +44922,8 @@ "updateContext": null }, "value": "=", - "start": 6698, - "end": 6699, + "start": 6741, + "end": 6742, "loc": { "start": { "line": 197, @@ -44242,8 +44948,8 @@ "binop": null }, "value": "el", - "start": 6700, - "end": 6702, + "start": 6743, + "end": 6745, "loc": { "start": { "line": 197, @@ -44268,8 +44974,8 @@ "binop": null, "updateContext": null }, - "start": 6703, - "end": 6705, + "start": 6746, + "end": 6748, "loc": { "start": { "line": 197, @@ -44294,8 +45000,8 @@ "binop": null }, "value": "el", - "start": 6706, - "end": 6708, + "start": 6749, + "end": 6751, "loc": { "start": { "line": 197, @@ -44320,8 +45026,8 @@ "binop": null, "updateContext": null }, - "start": 6708, - "end": 6709, + "start": 6751, + "end": 6752, "loc": { "start": { "line": 197, @@ -44346,8 +45052,8 @@ "binop": null }, "value": "offsetLeft", - "start": 6709, - "end": 6719, + "start": 6752, + "end": 6762, "loc": { "start": { "line": 197, @@ -44373,8 +45079,8 @@ "updateContext": null }, "value": "+", - "start": 6720, - "end": 6721, + "start": 6763, + "end": 6764, "loc": { "start": { "line": 197, @@ -44398,8 +45104,8 @@ "postfix": false, "binop": null }, - "start": 6722, - "end": 6723, + "start": 6765, + "end": 6766, "loc": { "start": { "line": 197, @@ -44424,8 +45130,8 @@ "binop": null }, "value": "el", - "start": 6723, - "end": 6725, + "start": 6766, + "end": 6768, "loc": { "start": { "line": 197, @@ -44450,8 +45156,8 @@ "binop": null, "updateContext": null }, - "start": 6725, - "end": 6726, + "start": 6768, + "end": 6769, "loc": { "start": { "line": 197, @@ -44476,8 +45182,8 @@ "binop": null }, "value": "offsetParent", - "start": 6726, - "end": 6738, + "start": 6769, + "end": 6781, "loc": { "start": { "line": 197, @@ -44503,8 +45209,8 @@ "updateContext": null }, "value": "&&", - "start": 6739, - "end": 6741, + "start": 6782, + "end": 6784, "loc": { "start": { "line": 197, @@ -44516,6 +45222,266 @@ } } }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6785, + "end": 6786, + "loc": { + "start": { + "line": 197, + "column": 66 + }, + "end": { + "line": 197, + "column": 67 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "el", + "start": 6786, + "end": 6788, + "loc": { + "start": { + "line": 197, + "column": 67 + }, + "end": { + "line": 197, + "column": 69 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6788, + "end": 6789, + "loc": { + "start": { + "line": 197, + "column": 69 + }, + "end": { + "line": 197, + "column": 70 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "offsetParent", + "start": 6789, + "end": 6801, + "loc": { + "start": { + "line": 197, + "column": 70 + }, + "end": { + "line": 197, + "column": 82 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 6802, + "end": 6805, + "loc": { + "start": { + "line": 197, + "column": 83 + }, + "end": { + "line": 197, + "column": 86 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "canvas", + "start": 6806, + "end": 6812, + "loc": { + "start": { + "line": 197, + "column": 87 + }, + "end": { + "line": 197, + "column": 93 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6812, + "end": 6813, + "loc": { + "start": { + "line": 197, + "column": 93 + }, + "end": { + "line": 197, + "column": 94 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parentNode", + "start": 6813, + "end": 6823, + "loc": { + "start": { + "line": 197, + "column": 94 + }, + "end": { + "line": 197, + "column": 104 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6823, + "end": 6824, + "loc": { + "start": { + "line": 197, + "column": 104 + }, + "end": { + "line": 197, + "column": 105 + } + } + }, + { + "type": { + "label": "&&", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 2, + "updateContext": null + }, + "value": "&&", + "start": 6825, + "end": 6827, + "loc": { + "start": { + "line": 197, + "column": 106 + }, + "end": { + "line": 197, + "column": 108 + } + } + }, { "type": { "label": "name", @@ -44529,16 +45495,16 @@ "binop": null }, "value": "getLeft", - "start": 6742, - "end": 6749, + "start": 6828, + "end": 6835, "loc": { "start": { "line": 197, - "column": 66 + "column": 109 }, "end": { "line": 197, - "column": 73 + "column": 116 } } }, @@ -44554,16 +45520,16 @@ "postfix": false, "binop": null }, - "start": 6749, - "end": 6750, + "start": 6835, + "end": 6836, "loc": { "start": { "line": 197, - "column": 73 + "column": 116 }, "end": { "line": 197, - "column": 74 + "column": 117 } } }, @@ -44580,16 +45546,16 @@ "binop": null }, "value": "el", - "start": 6750, - "end": 6752, + "start": 6836, + "end": 6838, "loc": { "start": { "line": 197, - "column": 74 + "column": 117 }, "end": { "line": 197, - "column": 76 + "column": 119 } } }, @@ -44606,16 +45572,16 @@ "binop": null, "updateContext": null }, - "start": 6752, - "end": 6753, + "start": 6838, + "end": 6839, "loc": { "start": { "line": 197, - "column": 76 + "column": 119 }, "end": { "line": 197, - "column": 77 + "column": 120 } } }, @@ -44632,16 +45598,16 @@ "binop": null }, "value": "offsetParent", - "start": 6753, - "end": 6765, + "start": 6839, + "end": 6851, "loc": { "start": { "line": 197, - "column": 77 + "column": 120 }, "end": { "line": 197, - "column": 89 + "column": 132 } } }, @@ -44657,16 +45623,16 @@ "postfix": false, "binop": null }, - "start": 6765, - "end": 6766, + "start": 6851, + "end": 6852, "loc": { "start": { "line": 197, - "column": 89 + "column": 132 }, "end": { "line": 197, - "column": 90 + "column": 133 } } }, @@ -44682,16 +45648,16 @@ "postfix": false, "binop": null }, - "start": 6766, - "end": 6767, + "start": 6852, + "end": 6853, "loc": { "start": { "line": 197, - "column": 90 + "column": 133 }, "end": { "line": 197, - "column": 91 + "column": 134 } } }, @@ -44708,16 +45674,16 @@ "binop": null, "updateContext": null }, - "start": 6767, - "end": 6768, + "start": 6853, + "end": 6854, "loc": { "start": { "line": 197, - "column": 91 + "column": 134 }, "end": { "line": 197, - "column": 92 + "column": 135 } } }, @@ -44736,8 +45702,8 @@ "updateContext": null }, "value": "const", - "start": 6778, - "end": 6783, + "start": 6864, + "end": 6869, "loc": { "start": { "line": 199, @@ -44762,8 +45728,8 @@ "binop": null }, "value": "pagePos", - "start": 6784, - "end": 6791, + "start": 6870, + "end": 6877, "loc": { "start": { "line": 199, @@ -44789,8 +45755,8 @@ "updateContext": null }, "value": "=", - "start": 6792, - "end": 6793, + "start": 6878, + "end": 6879, "loc": { "start": { "line": 199, @@ -44815,8 +45781,8 @@ "binop": null }, "value": "math", - "start": 6794, - "end": 6798, + "start": 6880, + "end": 6884, "loc": { "start": { "line": 199, @@ -44841,8 +45807,8 @@ "binop": null, "updateContext": null }, - "start": 6798, - "end": 6799, + "start": 6884, + "end": 6885, "loc": { "start": { "line": 199, @@ -44867,8 +45833,8 @@ "binop": null }, "value": "vec2", - "start": 6799, - "end": 6803, + "start": 6885, + "end": 6889, "loc": { "start": { "line": 199, @@ -44892,8 +45858,8 @@ "postfix": false, "binop": null }, - "start": 6803, - "end": 6804, + "start": 6889, + "end": 6890, "loc": { "start": { "line": 199, @@ -44917,8 +45883,8 @@ "postfix": false, "binop": null }, - "start": 6804, - "end": 6805, + "start": 6890, + "end": 6891, "loc": { "start": { "line": 199, @@ -44943,8 +45909,8 @@ "binop": null, "updateContext": null }, - "start": 6805, - "end": 6806, + "start": 6891, + "end": 6892, "loc": { "start": { "line": 199, @@ -44971,8 +45937,8 @@ "updateContext": null }, "value": "this", - "start": 6816, - "end": 6820, + "start": 6902, + "end": 6906, "loc": { "start": { "line": 201, @@ -44997,8 +45963,8 @@ "binop": null, "updateContext": null }, - "start": 6820, - "end": 6821, + "start": 6906, + "end": 6907, "loc": { "start": { "line": 201, @@ -45023,8 +45989,8 @@ "binop": null }, "value": "_onMouseHoverSurface", - "start": 6821, - "end": 6841, + "start": 6907, + "end": 6927, "loc": { "start": { "line": 201, @@ -45050,8 +46016,8 @@ "updateContext": null }, "value": "=", - "start": 6842, - "end": 6843, + "start": 6928, + "end": 6929, "loc": { "start": { "line": 201, @@ -45076,8 +46042,8 @@ "binop": null }, "value": "cameraControl", - "start": 6844, - "end": 6857, + "start": 6930, + "end": 6943, "loc": { "start": { "line": 201, @@ -45102,8 +46068,8 @@ "binop": null, "updateContext": null }, - "start": 6857, - "end": 6858, + "start": 6943, + "end": 6944, "loc": { "start": { "line": 201, @@ -45128,8 +46094,8 @@ "binop": null }, "value": "on", - "start": 6858, - "end": 6860, + "start": 6944, + "end": 6946, "loc": { "start": { "line": 201, @@ -45153,8 +46119,8 @@ "postfix": false, "binop": null }, - "start": 6860, - "end": 6861, + "start": 6946, + "end": 6947, "loc": { "start": { "line": 201, @@ -45181,8 +46147,8 @@ "updateContext": null }, "value": "this", - "start": 6874, - "end": 6878, + "start": 6960, + "end": 6964, "loc": { "start": { "line": 202, @@ -45207,8 +46173,8 @@ "binop": null, "updateContext": null }, - "start": 6878, - "end": 6879, + "start": 6964, + "end": 6965, "loc": { "start": { "line": 202, @@ -45233,8 +46199,8 @@ "binop": null }, "value": "_snapping", - "start": 6879, - "end": 6888, + "start": 6965, + "end": 6974, "loc": { "start": { "line": 202, @@ -45259,8 +46225,8 @@ "binop": null, "updateContext": null }, - "start": 6905, - "end": 6906, + "start": 6991, + "end": 6992, "loc": { "start": { "line": 203, @@ -45286,8 +46252,8 @@ "updateContext": null }, "value": "hoverSnapOrSurface", - "start": 6907, - "end": 6927, + "start": 6993, + "end": 7013, "loc": { "start": { "line": 203, @@ -45312,8 +46278,8 @@ "binop": null, "updateContext": null }, - "start": 6944, - "end": 6945, + "start": 7030, + "end": 7031, "loc": { "start": { "line": 204, @@ -45339,8 +46305,8 @@ "updateContext": null }, "value": "hoverSurface", - "start": 6946, - "end": 6960, + "start": 7032, + "end": 7046, "loc": { "start": { "line": 204, @@ -45365,8 +46331,8 @@ "binop": null, "updateContext": null }, - "start": 6960, - "end": 6961, + "start": 7046, + "end": 7047, "loc": { "start": { "line": 204, @@ -45391,8 +46357,8 @@ "binop": null }, "value": "event", - "start": 6974, - "end": 6979, + "start": 7060, + "end": 7065, "loc": { "start": { "line": 205, @@ -45417,8 +46383,8 @@ "binop": null, "updateContext": null }, - "start": 6980, - "end": 6982, + "start": 7066, + "end": 7068, "loc": { "start": { "line": 205, @@ -45442,8 +46408,8 @@ "postfix": false, "binop": null }, - "start": 6983, - "end": 6984, + "start": 7069, + "end": 7070, "loc": { "start": { "line": 205, @@ -45470,8 +46436,8 @@ "updateContext": null }, "value": "if", - "start": 7001, - "end": 7003, + "start": 7087, + "end": 7089, "loc": { "start": { "line": 206, @@ -45495,8 +46461,8 @@ "postfix": false, "binop": null }, - "start": 7004, - "end": 7005, + "start": 7090, + "end": 7091, "loc": { "start": { "line": 206, @@ -45521,8 +46487,8 @@ "binop": null }, "value": "event", - "start": 7005, - "end": 7010, + "start": 7091, + "end": 7096, "loc": { "start": { "line": 206, @@ -45547,8 +46513,8 @@ "binop": null, "updateContext": null }, - "start": 7010, - "end": 7011, + "start": 7096, + "end": 7097, "loc": { "start": { "line": 206, @@ -45573,8 +46539,8 @@ "binop": null }, "value": "snappedToVertex", - "start": 7011, - "end": 7026, + "start": 7097, + "end": 7112, "loc": { "start": { "line": 206, @@ -45600,8 +46566,8 @@ "updateContext": null }, "value": "||", - "start": 7027, - "end": 7029, + "start": 7113, + "end": 7115, "loc": { "start": { "line": 206, @@ -45626,8 +46592,8 @@ "binop": null }, "value": "event", - "start": 7030, - "end": 7035, + "start": 7116, + "end": 7121, "loc": { "start": { "line": 206, @@ -45652,8 +46618,8 @@ "binop": null, "updateContext": null }, - "start": 7035, - "end": 7036, + "start": 7121, + "end": 7122, "loc": { "start": { "line": 206, @@ -45678,8 +46644,8 @@ "binop": null }, "value": "snappedToEdge", - "start": 7036, - "end": 7049, + "start": 7122, + "end": 7135, "loc": { "start": { "line": 206, @@ -45703,8 +46669,8 @@ "postfix": false, "binop": null }, - "start": 7049, - "end": 7050, + "start": 7135, + "end": 7136, "loc": { "start": { "line": 206, @@ -45728,8 +46694,8 @@ "postfix": false, "binop": null }, - "start": 7051, - "end": 7052, + "start": 7137, + "end": 7138, "loc": { "start": { "line": 206, @@ -45756,8 +46722,8 @@ "updateContext": null }, "value": "if", - "start": 7073, - "end": 7075, + "start": 7159, + "end": 7161, "loc": { "start": { "line": 207, @@ -45781,8 +46747,8 @@ "postfix": false, "binop": null }, - "start": 7076, - "end": 7077, + "start": 7162, + "end": 7163, "loc": { "start": { "line": 207, @@ -45807,8 +46773,8 @@ "binop": null }, "value": "pointerLens", - "start": 7077, - "end": 7088, + "start": 7163, + "end": 7174, "loc": { "start": { "line": 207, @@ -45832,8 +46798,8 @@ "postfix": false, "binop": null }, - "start": 7088, - "end": 7089, + "start": 7174, + "end": 7175, "loc": { "start": { "line": 207, @@ -45857,8 +46823,8 @@ "postfix": false, "binop": null }, - "start": 7090, - "end": 7091, + "start": 7176, + "end": 7177, "loc": { "start": { "line": 207, @@ -45883,8 +46849,8 @@ "binop": null }, "value": "pointerLens", - "start": 7116, - "end": 7127, + "start": 7202, + "end": 7213, "loc": { "start": { "line": 208, @@ -45909,8 +46875,8 @@ "binop": null, "updateContext": null }, - "start": 7127, - "end": 7128, + "start": 7213, + "end": 7214, "loc": { "start": { "line": 208, @@ -45935,8 +46901,8 @@ "binop": null }, "value": "visible", - "start": 7128, - "end": 7135, + "start": 7214, + "end": 7221, "loc": { "start": { "line": 208, @@ -45962,8 +46928,8 @@ "updateContext": null }, "value": "=", - "start": 7136, - "end": 7137, + "start": 7222, + "end": 7223, "loc": { "start": { "line": 208, @@ -45990,8 +46956,8 @@ "updateContext": null }, "value": "true", - "start": 7138, - "end": 7142, + "start": 7224, + "end": 7228, "loc": { "start": { "line": 208, @@ -46016,8 +46982,8 @@ "binop": null, "updateContext": null }, - "start": 7142, - "end": 7143, + "start": 7228, + "end": 7229, "loc": { "start": { "line": 208, @@ -46042,8 +47008,8 @@ "binop": null }, "value": "pointerLens", - "start": 7168, - "end": 7179, + "start": 7254, + "end": 7265, "loc": { "start": { "line": 209, @@ -46068,8 +47034,8 @@ "binop": null, "updateContext": null }, - "start": 7179, - "end": 7180, + "start": 7265, + "end": 7266, "loc": { "start": { "line": 209, @@ -46094,8 +47060,8 @@ "binop": null }, "value": "canvasPos", - "start": 7180, - "end": 7189, + "start": 7266, + "end": 7275, "loc": { "start": { "line": 209, @@ -46121,8 +47087,8 @@ "updateContext": null }, "value": "=", - "start": 7190, - "end": 7191, + "start": 7276, + "end": 7277, "loc": { "start": { "line": 209, @@ -46147,8 +47113,8 @@ "binop": null }, "value": "event", - "start": 7192, - "end": 7197, + "start": 7278, + "end": 7283, "loc": { "start": { "line": 209, @@ -46173,8 +47139,8 @@ "binop": null, "updateContext": null }, - "start": 7197, - "end": 7198, + "start": 7283, + "end": 7284, "loc": { "start": { "line": 209, @@ -46199,8 +47165,8 @@ "binop": null }, "value": "canvasPos", - "start": 7198, - "end": 7207, + "start": 7284, + "end": 7293, "loc": { "start": { "line": 209, @@ -46225,8 +47191,8 @@ "binop": null, "updateContext": null }, - "start": 7207, - "end": 7208, + "start": 7293, + "end": 7294, "loc": { "start": { "line": 209, @@ -46251,8 +47217,8 @@ "binop": null }, "value": "pointerLens", - "start": 7233, - "end": 7244, + "start": 7319, + "end": 7330, "loc": { "start": { "line": 210, @@ -46277,8 +47243,8 @@ "binop": null, "updateContext": null }, - "start": 7244, - "end": 7245, + "start": 7330, + "end": 7331, "loc": { "start": { "line": 210, @@ -46303,8 +47269,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 7245, - "end": 7261, + "start": 7331, + "end": 7347, "loc": { "start": { "line": 210, @@ -46330,8 +47296,8 @@ "updateContext": null }, "value": "=", - "start": 7262, - "end": 7263, + "start": 7348, + "end": 7349, "loc": { "start": { "line": 210, @@ -46356,8 +47322,8 @@ "binop": null }, "value": "event", - "start": 7264, - "end": 7269, + "start": 7350, + "end": 7355, "loc": { "start": { "line": 210, @@ -46382,8 +47348,8 @@ "binop": null, "updateContext": null }, - "start": 7269, - "end": 7270, + "start": 7355, + "end": 7356, "loc": { "start": { "line": 210, @@ -46408,8 +47374,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 7270, - "end": 7286, + "start": 7356, + "end": 7372, "loc": { "start": { "line": 210, @@ -46435,8 +47401,8 @@ "updateContext": null }, "value": "||", - "start": 7287, - "end": 7289, + "start": 7373, + "end": 7375, "loc": { "start": { "line": 210, @@ -46461,8 +47427,8 @@ "binop": null }, "value": "event", - "start": 7290, - "end": 7295, + "start": 7376, + "end": 7381, "loc": { "start": { "line": 210, @@ -46487,8 +47453,8 @@ "binop": null, "updateContext": null }, - "start": 7295, - "end": 7296, + "start": 7381, + "end": 7382, "loc": { "start": { "line": 210, @@ -46513,8 +47479,8 @@ "binop": null }, "value": "canvasPos", - "start": 7296, - "end": 7305, + "start": 7382, + "end": 7391, "loc": { "start": { "line": 210, @@ -46539,8 +47505,8 @@ "binop": null, "updateContext": null }, - "start": 7305, - "end": 7306, + "start": 7391, + "end": 7392, "loc": { "start": { "line": 210, @@ -46565,8 +47531,8 @@ "binop": null }, "value": "pointerLens", - "start": 7331, - "end": 7342, + "start": 7417, + "end": 7428, "loc": { "start": { "line": 211, @@ -46591,8 +47557,8 @@ "binop": null, "updateContext": null }, - "start": 7342, - "end": 7343, + "start": 7428, + "end": 7429, "loc": { "start": { "line": 211, @@ -46617,8 +47583,8 @@ "binop": null }, "value": "snapped", - "start": 7343, - "end": 7350, + "start": 7429, + "end": 7436, "loc": { "start": { "line": 211, @@ -46644,8 +47610,8 @@ "updateContext": null }, "value": "=", - "start": 7351, - "end": 7352, + "start": 7437, + "end": 7438, "loc": { "start": { "line": 211, @@ -46672,8 +47638,8 @@ "updateContext": null }, "value": "true", - "start": 7353, - "end": 7357, + "start": 7439, + "end": 7443, "loc": { "start": { "line": 211, @@ -46698,8 +47664,8 @@ "binop": null, "updateContext": null }, - "start": 7357, - "end": 7358, + "start": 7443, + "end": 7444, "loc": { "start": { "line": 211, @@ -46723,8 +47689,8 @@ "postfix": false, "binop": null }, - "start": 7379, - "end": 7380, + "start": 7465, + "end": 7466, "loc": { "start": { "line": 212, @@ -46751,8 +47717,8 @@ "updateContext": null }, "value": "this", - "start": 7401, - "end": 7405, + "start": 7487, + "end": 7491, "loc": { "start": { "line": 213, @@ -46777,8 +47743,8 @@ "binop": null, "updateContext": null }, - "start": 7405, - "end": 7406, + "start": 7491, + "end": 7492, "loc": { "start": { "line": 213, @@ -46803,8 +47769,8 @@ "binop": null }, "value": "markerDiv", - "start": 7406, - "end": 7415, + "start": 7492, + "end": 7501, "loc": { "start": { "line": 213, @@ -46829,8 +47795,8 @@ "binop": null, "updateContext": null }, - "start": 7415, - "end": 7416, + "start": 7501, + "end": 7502, "loc": { "start": { "line": 213, @@ -46855,8 +47821,8 @@ "binop": null }, "value": "style", - "start": 7416, - "end": 7421, + "start": 7502, + "end": 7507, "loc": { "start": { "line": 213, @@ -46881,8 +47847,8 @@ "binop": null, "updateContext": null }, - "start": 7421, - "end": 7422, + "start": 7507, + "end": 7508, "loc": { "start": { "line": 213, @@ -46907,8 +47873,8 @@ "binop": null }, "value": "background", - "start": 7422, - "end": 7432, + "start": 7508, + "end": 7518, "loc": { "start": { "line": 213, @@ -46934,8 +47900,8 @@ "updateContext": null }, "value": "=", - "start": 7433, - "end": 7434, + "start": 7519, + "end": 7520, "loc": { "start": { "line": 213, @@ -46961,8 +47927,8 @@ "updateContext": null }, "value": "greenyellow", - "start": 7435, - "end": 7448, + "start": 7521, + "end": 7534, "loc": { "start": { "line": 213, @@ -46987,8 +47953,8 @@ "binop": null, "updateContext": null }, - "start": 7448, - "end": 7449, + "start": 7534, + "end": 7535, "loc": { "start": { "line": 213, @@ -47015,8 +47981,8 @@ "updateContext": null }, "value": "this", - "start": 7470, - "end": 7474, + "start": 7556, + "end": 7560, "loc": { "start": { "line": 214, @@ -47041,8 +48007,8 @@ "binop": null, "updateContext": null }, - "start": 7474, - "end": 7475, + "start": 7560, + "end": 7561, "loc": { "start": { "line": 214, @@ -47067,8 +48033,8 @@ "binop": null }, "value": "markerDiv", - "start": 7475, - "end": 7484, + "start": 7561, + "end": 7570, "loc": { "start": { "line": 214, @@ -47093,8 +48059,8 @@ "binop": null, "updateContext": null }, - "start": 7484, - "end": 7485, + "start": 7570, + "end": 7571, "loc": { "start": { "line": 214, @@ -47119,8 +48085,8 @@ "binop": null }, "value": "style", - "start": 7485, - "end": 7490, + "start": 7571, + "end": 7576, "loc": { "start": { "line": 214, @@ -47145,8 +48111,8 @@ "binop": null, "updateContext": null }, - "start": 7490, - "end": 7491, + "start": 7576, + "end": 7577, "loc": { "start": { "line": 214, @@ -47171,8 +48137,8 @@ "binop": null }, "value": "border", - "start": 7491, - "end": 7497, + "start": 7577, + "end": 7583, "loc": { "start": { "line": 214, @@ -47198,8 +48164,8 @@ "updateContext": null }, "value": "=", - "start": 7498, - "end": 7499, + "start": 7584, + "end": 7585, "loc": { "start": { "line": 214, @@ -47225,8 +48191,8 @@ "updateContext": null }, "value": "2px solid green", - "start": 7500, - "end": 7517, + "start": 7586, + "end": 7603, "loc": { "start": { "line": 214, @@ -47251,8 +48217,8 @@ "binop": null, "updateContext": null }, - "start": 7517, - "end": 7518, + "start": 7603, + "end": 7604, "loc": { "start": { "line": 214, @@ -47276,8 +48242,8 @@ "postfix": false, "binop": null }, - "start": 7535, - "end": 7536, + "start": 7621, + "end": 7622, "loc": { "start": { "line": 215, @@ -47304,8 +48270,8 @@ "updateContext": null }, "value": "else", - "start": 7537, - "end": 7541, + "start": 7623, + "end": 7627, "loc": { "start": { "line": 215, @@ -47329,8 +48295,8 @@ "postfix": false, "binop": null }, - "start": 7542, - "end": 7543, + "start": 7628, + "end": 7629, "loc": { "start": { "line": 215, @@ -47357,8 +48323,8 @@ "updateContext": null }, "value": "if", - "start": 7564, - "end": 7566, + "start": 7650, + "end": 7652, "loc": { "start": { "line": 216, @@ -47382,8 +48348,8 @@ "postfix": false, "binop": null }, - "start": 7567, - "end": 7568, + "start": 7653, + "end": 7654, "loc": { "start": { "line": 216, @@ -47408,8 +48374,8 @@ "binop": null }, "value": "pointerLens", - "start": 7568, - "end": 7579, + "start": 7654, + "end": 7665, "loc": { "start": { "line": 216, @@ -47433,8 +48399,8 @@ "postfix": false, "binop": null }, - "start": 7579, - "end": 7580, + "start": 7665, + "end": 7666, "loc": { "start": { "line": 216, @@ -47458,8 +48424,8 @@ "postfix": false, "binop": null }, - "start": 7581, - "end": 7582, + "start": 7667, + "end": 7668, "loc": { "start": { "line": 216, @@ -47484,8 +48450,8 @@ "binop": null }, "value": "pointerLens", - "start": 7607, - "end": 7618, + "start": 7693, + "end": 7704, "loc": { "start": { "line": 217, @@ -47510,8 +48476,8 @@ "binop": null, "updateContext": null }, - "start": 7618, - "end": 7619, + "start": 7704, + "end": 7705, "loc": { "start": { "line": 217, @@ -47536,8 +48502,8 @@ "binop": null }, "value": "visible", - "start": 7619, - "end": 7626, + "start": 7705, + "end": 7712, "loc": { "start": { "line": 217, @@ -47563,8 +48529,8 @@ "updateContext": null }, "value": "=", - "start": 7627, - "end": 7628, + "start": 7713, + "end": 7714, "loc": { "start": { "line": 217, @@ -47591,8 +48557,8 @@ "updateContext": null }, "value": "true", - "start": 7629, - "end": 7633, + "start": 7715, + "end": 7719, "loc": { "start": { "line": 217, @@ -47617,8 +48583,8 @@ "binop": null, "updateContext": null }, - "start": 7633, - "end": 7634, + "start": 7719, + "end": 7720, "loc": { "start": { "line": 217, @@ -47643,8 +48609,8 @@ "binop": null }, "value": "pointerLens", - "start": 7659, - "end": 7670, + "start": 7745, + "end": 7756, "loc": { "start": { "line": 218, @@ -47669,8 +48635,8 @@ "binop": null, "updateContext": null }, - "start": 7670, - "end": 7671, + "start": 7756, + "end": 7757, "loc": { "start": { "line": 218, @@ -47695,8 +48661,8 @@ "binop": null }, "value": "canvasPos", - "start": 7671, - "end": 7680, + "start": 7757, + "end": 7766, "loc": { "start": { "line": 218, @@ -47722,8 +48688,8 @@ "updateContext": null }, "value": "=", - "start": 7681, - "end": 7682, + "start": 7767, + "end": 7768, "loc": { "start": { "line": 218, @@ -47748,8 +48714,8 @@ "binop": null }, "value": "event", - "start": 7684, - "end": 7689, + "start": 7770, + "end": 7775, "loc": { "start": { "line": 218, @@ -47774,8 +48740,8 @@ "binop": null, "updateContext": null }, - "start": 7689, - "end": 7690, + "start": 7775, + "end": 7776, "loc": { "start": { "line": 218, @@ -47800,8 +48766,8 @@ "binop": null }, "value": "canvasPos", - "start": 7690, - "end": 7699, + "start": 7776, + "end": 7785, "loc": { "start": { "line": 218, @@ -47826,8 +48792,8 @@ "binop": null, "updateContext": null }, - "start": 7699, - "end": 7700, + "start": 7785, + "end": 7786, "loc": { "start": { "line": 218, @@ -47852,8 +48818,8 @@ "binop": null }, "value": "pointerLens", - "start": 7725, - "end": 7736, + "start": 7811, + "end": 7822, "loc": { "start": { "line": 219, @@ -47878,8 +48844,8 @@ "binop": null, "updateContext": null }, - "start": 7736, - "end": 7737, + "start": 7822, + "end": 7823, "loc": { "start": { "line": 219, @@ -47904,8 +48870,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 7737, - "end": 7753, + "start": 7823, + "end": 7839, "loc": { "start": { "line": 219, @@ -47931,8 +48897,8 @@ "updateContext": null }, "value": "=", - "start": 7754, - "end": 7755, + "start": 7840, + "end": 7841, "loc": { "start": { "line": 219, @@ -47957,8 +48923,8 @@ "binop": null }, "value": "event", - "start": 7756, - "end": 7761, + "start": 7842, + "end": 7847, "loc": { "start": { "line": 219, @@ -47983,8 +48949,8 @@ "binop": null, "updateContext": null }, - "start": 7761, - "end": 7762, + "start": 7847, + "end": 7848, "loc": { "start": { "line": 219, @@ -48009,8 +48975,8 @@ "binop": null }, "value": "canvasPos", - "start": 7762, - "end": 7771, + "start": 7848, + "end": 7857, "loc": { "start": { "line": 219, @@ -48035,8 +49001,8 @@ "binop": null, "updateContext": null }, - "start": 7771, - "end": 7772, + "start": 7857, + "end": 7858, "loc": { "start": { "line": 219, @@ -48061,8 +49027,8 @@ "binop": null }, "value": "pointerLens", - "start": 7797, - "end": 7808, + "start": 7883, + "end": 7894, "loc": { "start": { "line": 220, @@ -48087,8 +49053,8 @@ "binop": null, "updateContext": null }, - "start": 7808, - "end": 7809, + "start": 7894, + "end": 7895, "loc": { "start": { "line": 220, @@ -48113,8 +49079,8 @@ "binop": null }, "value": "snapped", - "start": 7809, - "end": 7816, + "start": 7895, + "end": 7902, "loc": { "start": { "line": 220, @@ -48140,8 +49106,8 @@ "updateContext": null }, "value": "=", - "start": 7817, - "end": 7818, + "start": 7903, + "end": 7904, "loc": { "start": { "line": 220, @@ -48168,8 +49134,8 @@ "updateContext": null }, "value": "false", - "start": 7819, - "end": 7824, + "start": 7905, + "end": 7910, "loc": { "start": { "line": 220, @@ -48194,8 +49160,8 @@ "binop": null, "updateContext": null }, - "start": 7824, - "end": 7825, + "start": 7910, + "end": 7911, "loc": { "start": { "line": 220, @@ -48219,8 +49185,8 @@ "postfix": false, "binop": null }, - "start": 7846, - "end": 7847, + "start": 7932, + "end": 7933, "loc": { "start": { "line": 221, @@ -48247,8 +49213,8 @@ "updateContext": null }, "value": "this", - "start": 7868, - "end": 7872, + "start": 7954, + "end": 7958, "loc": { "start": { "line": 222, @@ -48273,8 +49239,8 @@ "binop": null, "updateContext": null }, - "start": 7872, - "end": 7873, + "start": 7958, + "end": 7959, "loc": { "start": { "line": 222, @@ -48299,8 +49265,8 @@ "binop": null }, "value": "markerDiv", - "start": 7873, - "end": 7882, + "start": 7959, + "end": 7968, "loc": { "start": { "line": 222, @@ -48325,8 +49291,8 @@ "binop": null, "updateContext": null }, - "start": 7882, - "end": 7883, + "start": 7968, + "end": 7969, "loc": { "start": { "line": 222, @@ -48351,8 +49317,8 @@ "binop": null }, "value": "style", - "start": 7883, - "end": 7888, + "start": 7969, + "end": 7974, "loc": { "start": { "line": 222, @@ -48377,8 +49343,8 @@ "binop": null, "updateContext": null }, - "start": 7888, - "end": 7889, + "start": 7974, + "end": 7975, "loc": { "start": { "line": 222, @@ -48403,8 +49369,8 @@ "binop": null }, "value": "background", - "start": 7889, - "end": 7899, + "start": 7975, + "end": 7985, "loc": { "start": { "line": 222, @@ -48430,8 +49396,8 @@ "updateContext": null }, "value": "=", - "start": 7900, - "end": 7901, + "start": 7986, + "end": 7987, "loc": { "start": { "line": 222, @@ -48457,8 +49423,8 @@ "updateContext": null }, "value": "pink", - "start": 7902, - "end": 7908, + "start": 7988, + "end": 7994, "loc": { "start": { "line": 222, @@ -48483,8 +49449,8 @@ "binop": null, "updateContext": null }, - "start": 7908, - "end": 7909, + "start": 7994, + "end": 7995, "loc": { "start": { "line": 222, @@ -48511,8 +49477,8 @@ "updateContext": null }, "value": "this", - "start": 7930, - "end": 7934, + "start": 8016, + "end": 8020, "loc": { "start": { "line": 223, @@ -48537,8 +49503,8 @@ "binop": null, "updateContext": null }, - "start": 7934, - "end": 7935, + "start": 8020, + "end": 8021, "loc": { "start": { "line": 223, @@ -48563,8 +49529,8 @@ "binop": null }, "value": "markerDiv", - "start": 7935, - "end": 7944, + "start": 8021, + "end": 8030, "loc": { "start": { "line": 223, @@ -48589,8 +49555,8 @@ "binop": null, "updateContext": null }, - "start": 7944, - "end": 7945, + "start": 8030, + "end": 8031, "loc": { "start": { "line": 223, @@ -48615,8 +49581,8 @@ "binop": null }, "value": "style", - "start": 7945, - "end": 7950, + "start": 8031, + "end": 8036, "loc": { "start": { "line": 223, @@ -48641,8 +49607,8 @@ "binop": null, "updateContext": null }, - "start": 7950, - "end": 7951, + "start": 8036, + "end": 8037, "loc": { "start": { "line": 223, @@ -48667,8 +49633,8 @@ "binop": null }, "value": "border", - "start": 7951, - "end": 7957, + "start": 8037, + "end": 8043, "loc": { "start": { "line": 223, @@ -48694,8 +49660,8 @@ "updateContext": null }, "value": "=", - "start": 7958, - "end": 7959, + "start": 8044, + "end": 8045, "loc": { "start": { "line": 223, @@ -48721,8 +49687,8 @@ "updateContext": null }, "value": "2px solid red", - "start": 7960, - "end": 7975, + "start": 8046, + "end": 8061, "loc": { "start": { "line": 223, @@ -48747,8 +49713,8 @@ "binop": null, "updateContext": null }, - "start": 7975, - "end": 7976, + "start": 8061, + "end": 8062, "loc": { "start": { "line": 223, @@ -48772,8 +49738,8 @@ "postfix": false, "binop": null }, - "start": 7993, - "end": 7994, + "start": 8079, + "end": 8080, "loc": { "start": { "line": 224, @@ -48800,8 +49766,8 @@ "updateContext": null }, "value": "const", - "start": 8011, - "end": 8016, + "start": 8097, + "end": 8102, "loc": { "start": { "line": 225, @@ -48826,8 +49792,8 @@ "binop": null }, "value": "canvasPos", - "start": 8017, - "end": 8026, + "start": 8103, + "end": 8112, "loc": { "start": { "line": 225, @@ -48853,8 +49819,8 @@ "updateContext": null }, "value": "=", - "start": 8027, - "end": 8028, + "start": 8113, + "end": 8114, "loc": { "start": { "line": 225, @@ -48879,8 +49845,8 @@ "binop": null }, "value": "event", - "start": 8029, - "end": 8034, + "start": 8115, + "end": 8120, "loc": { "start": { "line": 225, @@ -48905,8 +49871,8 @@ "binop": null, "updateContext": null }, - "start": 8034, - "end": 8035, + "start": 8120, + "end": 8121, "loc": { "start": { "line": 225, @@ -48931,8 +49897,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 8035, - "end": 8051, + "start": 8121, + "end": 8137, "loc": { "start": { "line": 225, @@ -48958,8 +49924,8 @@ "updateContext": null }, "value": "||", - "start": 8052, - "end": 8054, + "start": 8138, + "end": 8140, "loc": { "start": { "line": 225, @@ -48984,8 +49950,8 @@ "binop": null }, "value": "event", - "start": 8055, - "end": 8060, + "start": 8141, + "end": 8146, "loc": { "start": { "line": 225, @@ -49010,8 +49976,8 @@ "binop": null, "updateContext": null }, - "start": 8060, - "end": 8061, + "start": 8146, + "end": 8147, "loc": { "start": { "line": 225, @@ -49036,8 +50002,8 @@ "binop": null }, "value": "canvasPos", - "start": 8061, - "end": 8070, + "start": 8147, + "end": 8156, "loc": { "start": { "line": 225, @@ -49062,8 +50028,8 @@ "binop": null, "updateContext": null }, - "start": 8070, - "end": 8071, + "start": 8156, + "end": 8157, "loc": { "start": { "line": 225, @@ -49088,8 +50054,8 @@ "binop": null }, "value": "mouseHovering", - "start": 8088, - "end": 8101, + "start": 8174, + "end": 8187, "loc": { "start": { "line": 226, @@ -49115,8 +50081,8 @@ "updateContext": null }, "value": "=", - "start": 8102, - "end": 8103, + "start": 8188, + "end": 8189, "loc": { "start": { "line": 226, @@ -49143,8 +50109,8 @@ "updateContext": null }, "value": "true", - "start": 8104, - "end": 8108, + "start": 8190, + "end": 8194, "loc": { "start": { "line": 226, @@ -49169,8 +50135,8 @@ "binop": null, "updateContext": null }, - "start": 8108, - "end": 8109, + "start": 8194, + "end": 8195, "loc": { "start": { "line": 226, @@ -49195,8 +50161,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 8126, - "end": 8139, + "start": 8212, + "end": 8225, "loc": { "start": { "line": 227, @@ -49222,8 +50188,8 @@ "updateContext": null }, "value": "=", - "start": 8140, - "end": 8141, + "start": 8226, + "end": 8227, "loc": { "start": { "line": 227, @@ -49248,8 +50214,8 @@ "binop": null }, "value": "event", - "start": 8142, - "end": 8147, + "start": 8228, + "end": 8233, "loc": { "start": { "line": 227, @@ -49274,8 +50240,8 @@ "binop": null, "updateContext": null }, - "start": 8147, - "end": 8148, + "start": 8233, + "end": 8234, "loc": { "start": { "line": 227, @@ -49300,8 +50266,8 @@ "binop": null }, "value": "entity", - "start": 8148, - "end": 8154, + "start": 8234, + "end": 8240, "loc": { "start": { "line": 227, @@ -49326,8 +50292,8 @@ "binop": null, "updateContext": null }, - "start": 8154, - "end": 8155, + "start": 8240, + "end": 8241, "loc": { "start": { "line": 227, @@ -49352,8 +50318,8 @@ "binop": null }, "value": "mouseWorldPos", - "start": 8172, - "end": 8185, + "start": 8258, + "end": 8271, "loc": { "start": { "line": 228, @@ -49378,8 +50344,8 @@ "binop": null, "updateContext": null }, - "start": 8185, - "end": 8186, + "start": 8271, + "end": 8272, "loc": { "start": { "line": 228, @@ -49404,8 +50370,8 @@ "binop": null }, "value": "set", - "start": 8186, - "end": 8189, + "start": 8272, + "end": 8275, "loc": { "start": { "line": 228, @@ -49429,8 +50395,8 @@ "postfix": false, "binop": null }, - "start": 8189, - "end": 8190, + "start": 8275, + "end": 8276, "loc": { "start": { "line": 228, @@ -49455,8 +50421,8 @@ "binop": null }, "value": "event", - "start": 8190, - "end": 8195, + "start": 8276, + "end": 8281, "loc": { "start": { "line": 228, @@ -49481,8 +50447,8 @@ "binop": null, "updateContext": null }, - "start": 8195, - "end": 8196, + "start": 8281, + "end": 8282, "loc": { "start": { "line": 228, @@ -49507,8 +50473,8 @@ "binop": null }, "value": "worldPos", - "start": 8196, - "end": 8204, + "start": 8282, + "end": 8290, "loc": { "start": { "line": 228, @@ -49532,8 +50498,8 @@ "postfix": false, "binop": null }, - "start": 8204, - "end": 8205, + "start": 8290, + "end": 8291, "loc": { "start": { "line": 228, @@ -49558,8 +50524,8 @@ "binop": null, "updateContext": null }, - "start": 8205, - "end": 8206, + "start": 8291, + "end": 8292, "loc": { "start": { "line": 228, @@ -49584,8 +50550,8 @@ "binop": null }, "value": "mouseHoverCanvasPos", - "start": 8223, - "end": 8242, + "start": 8309, + "end": 8328, "loc": { "start": { "line": 229, @@ -49610,8 +50576,8 @@ "binop": null, "updateContext": null }, - "start": 8242, - "end": 8243, + "start": 8328, + "end": 8329, "loc": { "start": { "line": 229, @@ -49636,8 +50602,8 @@ "binop": null }, "value": "set", - "start": 8243, - "end": 8246, + "start": 8329, + "end": 8332, "loc": { "start": { "line": 229, @@ -49661,8 +50627,8 @@ "postfix": false, "binop": null }, - "start": 8246, - "end": 8247, + "start": 8332, + "end": 8333, "loc": { "start": { "line": 229, @@ -49687,8 +50653,8 @@ "binop": null }, "value": "canvasPos", - "start": 8247, - "end": 8256, + "start": 8333, + "end": 8342, "loc": { "start": { "line": 229, @@ -49712,8 +50678,8 @@ "postfix": false, "binop": null }, - "start": 8256, - "end": 8257, + "start": 8342, + "end": 8343, "loc": { "start": { "line": 229, @@ -49738,8 +50704,8 @@ "binop": null, "updateContext": null }, - "start": 8257, - "end": 8258, + "start": 8343, + "end": 8344, "loc": { "start": { "line": 229, @@ -49766,8 +50732,8 @@ "updateContext": null }, "value": "switch", - "start": 8275, - "end": 8281, + "start": 8361, + "end": 8367, "loc": { "start": { "line": 230, @@ -49791,8 +50757,8 @@ "postfix": false, "binop": null }, - "start": 8282, - "end": 8283, + "start": 8368, + "end": 8369, "loc": { "start": { "line": 230, @@ -49819,8 +50785,8 @@ "updateContext": null }, "value": "this", - "start": 8283, - "end": 8287, + "start": 8369, + "end": 8373, "loc": { "start": { "line": 230, @@ -49845,8 +50811,8 @@ "binop": null, "updateContext": null }, - "start": 8287, - "end": 8288, + "start": 8373, + "end": 8374, "loc": { "start": { "line": 230, @@ -49871,8 +50837,8 @@ "binop": null }, "value": "_mouseState", - "start": 8288, - "end": 8299, + "start": 8374, + "end": 8385, "loc": { "start": { "line": 230, @@ -49896,8 +50862,8 @@ "postfix": false, "binop": null }, - "start": 8299, - "end": 8300, + "start": 8385, + "end": 8386, "loc": { "start": { "line": 230, @@ -49921,8 +50887,8 @@ "postfix": false, "binop": null }, - "start": 8301, - "end": 8302, + "start": 8387, + "end": 8388, "loc": { "start": { "line": 230, @@ -49949,8 +50915,8 @@ "updateContext": null }, "value": "case", - "start": 8323, - "end": 8327, + "start": 8409, + "end": 8413, "loc": { "start": { "line": 231, @@ -49975,8 +50941,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 8328, - "end": 8348, + "start": 8414, + "end": 8434, "loc": { "start": { "line": 231, @@ -50001,8 +50967,8 @@ "binop": null, "updateContext": null }, - "start": 8348, - "end": 8349, + "start": 8434, + "end": 8435, "loc": { "start": { "line": 231, @@ -50029,8 +50995,8 @@ "updateContext": null }, "value": "if", - "start": 8374, - "end": 8376, + "start": 8460, + "end": 8462, "loc": { "start": { "line": 232, @@ -50054,8 +51020,8 @@ "postfix": false, "binop": null }, - "start": 8377, - "end": 8378, + "start": 8463, + "end": 8464, "loc": { "start": { "line": 232, @@ -50082,8 +51048,8 @@ "updateContext": null }, "value": "this", - "start": 8378, - "end": 8382, + "start": 8464, + "end": 8468, "loc": { "start": { "line": 232, @@ -50108,8 +51074,8 @@ "binop": null, "updateContext": null }, - "start": 8382, - "end": 8383, + "start": 8468, + "end": 8469, "loc": { "start": { "line": 232, @@ -50134,8 +51100,8 @@ "binop": null }, "value": "_canvasToPagePos", - "start": 8383, - "end": 8399, + "start": 8469, + "end": 8485, "loc": { "start": { "line": 232, @@ -50159,8 +51125,8 @@ "postfix": false, "binop": null }, - "start": 8399, - "end": 8400, + "start": 8485, + "end": 8486, "loc": { "start": { "line": 232, @@ -50184,8 +51150,8 @@ "postfix": false, "binop": null }, - "start": 8401, - "end": 8402, + "start": 8487, + "end": 8488, "loc": { "start": { "line": 232, @@ -50212,8 +51178,8 @@ "updateContext": null }, "value": "this", - "start": 8431, - "end": 8435, + "start": 8517, + "end": 8521, "loc": { "start": { "line": 233, @@ -50238,8 +51204,8 @@ "binop": null, "updateContext": null }, - "start": 8435, - "end": 8436, + "start": 8521, + "end": 8522, "loc": { "start": { "line": 233, @@ -50264,8 +51230,8 @@ "binop": null }, "value": "_canvasToPagePos", - "start": 8436, - "end": 8452, + "start": 8522, + "end": 8538, "loc": { "start": { "line": 233, @@ -50289,8 +51255,8 @@ "postfix": false, "binop": null }, - "start": 8452, - "end": 8453, + "start": 8538, + "end": 8539, "loc": { "start": { "line": 233, @@ -50315,8 +51281,8 @@ "binop": null }, "value": "canvas", - "start": 8453, - "end": 8459, + "start": 8539, + "end": 8545, "loc": { "start": { "line": 233, @@ -50341,8 +51307,8 @@ "binop": null, "updateContext": null }, - "start": 8459, - "end": 8460, + "start": 8545, + "end": 8546, "loc": { "start": { "line": 233, @@ -50367,8 +51333,8 @@ "binop": null }, "value": "canvasPos", - "start": 8461, - "end": 8470, + "start": 8547, + "end": 8556, "loc": { "start": { "line": 233, @@ -50393,8 +51359,8 @@ "binop": null, "updateContext": null }, - "start": 8470, - "end": 8471, + "start": 8556, + "end": 8557, "loc": { "start": { "line": 233, @@ -50419,8 +51385,8 @@ "binop": null }, "value": "pagePos", - "start": 8472, - "end": 8479, + "start": 8558, + "end": 8565, "loc": { "start": { "line": 233, @@ -50444,8 +51410,8 @@ "postfix": false, "binop": null }, - "start": 8479, - "end": 8480, + "start": 8565, + "end": 8566, "loc": { "start": { "line": 233, @@ -50470,8 +51436,8 @@ "binop": null, "updateContext": null }, - "start": 8480, - "end": 8481, + "start": 8566, + "end": 8567, "loc": { "start": { "line": 233, @@ -50498,8 +51464,8 @@ "updateContext": null }, "value": "this", - "start": 8510, - "end": 8514, + "start": 8596, + "end": 8600, "loc": { "start": { "line": 234, @@ -50524,8 +51490,8 @@ "binop": null, "updateContext": null }, - "start": 8514, - "end": 8515, + "start": 8600, + "end": 8601, "loc": { "start": { "line": 234, @@ -50550,8 +51516,8 @@ "binop": null }, "value": "markerDiv", - "start": 8515, - "end": 8524, + "start": 8601, + "end": 8610, "loc": { "start": { "line": 234, @@ -50576,8 +51542,8 @@ "binop": null, "updateContext": null }, - "start": 8524, - "end": 8525, + "start": 8610, + "end": 8611, "loc": { "start": { "line": 234, @@ -50602,8 +51568,8 @@ "binop": null }, "value": "style", - "start": 8525, - "end": 8530, + "start": 8611, + "end": 8616, "loc": { "start": { "line": 234, @@ -50628,8 +51594,8 @@ "binop": null, "updateContext": null }, - "start": 8530, - "end": 8531, + "start": 8616, + "end": 8617, "loc": { "start": { "line": 234, @@ -50654,8 +51620,8 @@ "binop": null }, "value": "left", - "start": 8531, - "end": 8535, + "start": 8617, + "end": 8621, "loc": { "start": { "line": 234, @@ -50681,8 +51647,8 @@ "updateContext": null }, "value": "=", - "start": 8536, - "end": 8537, + "start": 8622, + "end": 8623, "loc": { "start": { "line": 234, @@ -50706,8 +51672,8 @@ "postfix": false, "binop": null }, - "start": 8538, - "end": 8539, + "start": 8624, + "end": 8625, "loc": { "start": { "line": 234, @@ -50733,8 +51699,8 @@ "updateContext": null }, "value": "", - "start": 8539, - "end": 8539, + "start": 8625, + "end": 8625, "loc": { "start": { "line": 234, @@ -50758,8 +51724,8 @@ "postfix": false, "binop": null }, - "start": 8539, - "end": 8541, + "start": 8625, + "end": 8627, "loc": { "start": { "line": 234, @@ -50784,8 +51750,8 @@ "binop": null }, "value": "pagePos", - "start": 8541, - "end": 8548, + "start": 8627, + "end": 8634, "loc": { "start": { "line": 234, @@ -50810,8 +51776,8 @@ "binop": null, "updateContext": null }, - "start": 8548, - "end": 8549, + "start": 8634, + "end": 8635, "loc": { "start": { "line": 234, @@ -50837,8 +51803,8 @@ "updateContext": null }, "value": 0, - "start": 8549, - "end": 8550, + "start": 8635, + "end": 8636, "loc": { "start": { "line": 234, @@ -50863,8 +51829,8 @@ "binop": null, "updateContext": null }, - "start": 8550, - "end": 8551, + "start": 8636, + "end": 8637, "loc": { "start": { "line": 234, @@ -50890,8 +51856,8 @@ "updateContext": null }, "value": "-", - "start": 8552, - "end": 8553, + "start": 8638, + "end": 8639, "loc": { "start": { "line": 234, @@ -50917,8 +51883,8 @@ "updateContext": null }, "value": 5, - "start": 8554, - "end": 8555, + "start": 8640, + "end": 8641, "loc": { "start": { "line": 234, @@ -50942,8 +51908,8 @@ "postfix": false, "binop": null }, - "start": 8555, - "end": 8556, + "start": 8641, + "end": 8642, "loc": { "start": { "line": 234, @@ -50969,8 +51935,8 @@ "updateContext": null }, "value": "px", - "start": 8556, - "end": 8558, + "start": 8642, + "end": 8644, "loc": { "start": { "line": 234, @@ -50994,8 +51960,8 @@ "postfix": false, "binop": null }, - "start": 8558, - "end": 8559, + "start": 8644, + "end": 8645, "loc": { "start": { "line": 234, @@ -51020,8 +51986,8 @@ "binop": null, "updateContext": null }, - "start": 8559, - "end": 8560, + "start": 8645, + "end": 8646, "loc": { "start": { "line": 234, @@ -51048,8 +52014,8 @@ "updateContext": null }, "value": "this", - "start": 8589, - "end": 8593, + "start": 8675, + "end": 8679, "loc": { "start": { "line": 235, @@ -51074,8 +52040,8 @@ "binop": null, "updateContext": null }, - "start": 8593, - "end": 8594, + "start": 8679, + "end": 8680, "loc": { "start": { "line": 235, @@ -51100,8 +52066,8 @@ "binop": null }, "value": "markerDiv", - "start": 8594, - "end": 8603, + "start": 8680, + "end": 8689, "loc": { "start": { "line": 235, @@ -51126,8 +52092,8 @@ "binop": null, "updateContext": null }, - "start": 8603, - "end": 8604, + "start": 8689, + "end": 8690, "loc": { "start": { "line": 235, @@ -51152,8 +52118,8 @@ "binop": null }, "value": "style", - "start": 8604, - "end": 8609, + "start": 8690, + "end": 8695, "loc": { "start": { "line": 235, @@ -51178,8 +52144,8 @@ "binop": null, "updateContext": null }, - "start": 8609, - "end": 8610, + "start": 8695, + "end": 8696, "loc": { "start": { "line": 235, @@ -51204,8 +52170,8 @@ "binop": null }, "value": "top", - "start": 8610, - "end": 8613, + "start": 8696, + "end": 8699, "loc": { "start": { "line": 235, @@ -51231,8 +52197,8 @@ "updateContext": null }, "value": "=", - "start": 8614, - "end": 8615, + "start": 8700, + "end": 8701, "loc": { "start": { "line": 235, @@ -51256,8 +52222,8 @@ "postfix": false, "binop": null }, - "start": 8616, - "end": 8617, + "start": 8702, + "end": 8703, "loc": { "start": { "line": 235, @@ -51283,8 +52249,8 @@ "updateContext": null }, "value": "", - "start": 8617, - "end": 8617, + "start": 8703, + "end": 8703, "loc": { "start": { "line": 235, @@ -51308,8 +52274,8 @@ "postfix": false, "binop": null }, - "start": 8617, - "end": 8619, + "start": 8703, + "end": 8705, "loc": { "start": { "line": 235, @@ -51334,8 +52300,8 @@ "binop": null }, "value": "pagePos", - "start": 8619, - "end": 8626, + "start": 8705, + "end": 8712, "loc": { "start": { "line": 235, @@ -51360,8 +52326,8 @@ "binop": null, "updateContext": null }, - "start": 8626, - "end": 8627, + "start": 8712, + "end": 8713, "loc": { "start": { "line": 235, @@ -51387,8 +52353,8 @@ "updateContext": null }, "value": 1, - "start": 8627, - "end": 8628, + "start": 8713, + "end": 8714, "loc": { "start": { "line": 235, @@ -51413,8 +52379,8 @@ "binop": null, "updateContext": null }, - "start": 8628, - "end": 8629, + "start": 8714, + "end": 8715, "loc": { "start": { "line": 235, @@ -51440,8 +52406,8 @@ "updateContext": null }, "value": "-", - "start": 8630, - "end": 8631, + "start": 8716, + "end": 8717, "loc": { "start": { "line": 235, @@ -51467,8 +52433,8 @@ "updateContext": null }, "value": 5, - "start": 8632, - "end": 8633, + "start": 8718, + "end": 8719, "loc": { "start": { "line": 235, @@ -51492,8 +52458,8 @@ "postfix": false, "binop": null }, - "start": 8633, - "end": 8634, + "start": 8719, + "end": 8720, "loc": { "start": { "line": 235, @@ -51519,8 +52485,8 @@ "updateContext": null }, "value": "px", - "start": 8634, - "end": 8636, + "start": 8720, + "end": 8722, "loc": { "start": { "line": 235, @@ -51544,8 +52510,8 @@ "postfix": false, "binop": null }, - "start": 8636, - "end": 8637, + "start": 8722, + "end": 8723, "loc": { "start": { "line": 235, @@ -51570,8 +52536,8 @@ "binop": null, "updateContext": null }, - "start": 8637, - "end": 8638, + "start": 8723, + "end": 8724, "loc": { "start": { "line": 235, @@ -51595,8 +52561,8 @@ "postfix": false, "binop": null }, - "start": 8663, - "end": 8664, + "start": 8749, + "end": 8750, "loc": { "start": { "line": 236, @@ -51623,8 +52589,8 @@ "updateContext": null }, "value": "else", - "start": 8665, - "end": 8669, + "start": 8751, + "end": 8755, "loc": { "start": { "line": 236, @@ -51648,8 +52614,8 @@ "postfix": false, "binop": null }, - "start": 8670, - "end": 8671, + "start": 8756, + "end": 8757, "loc": { "start": { "line": 236, @@ -51676,8 +52642,8 @@ "updateContext": null }, "value": "this", - "start": 8700, - "end": 8704, + "start": 8786, + "end": 8790, "loc": { "start": { "line": 237, @@ -51702,8 +52668,8 @@ "binop": null, "updateContext": null }, - "start": 8704, - "end": 8705, + "start": 8790, + "end": 8791, "loc": { "start": { "line": 237, @@ -51728,8 +52694,8 @@ "binop": null }, "value": "markerDiv", - "start": 8705, - "end": 8714, + "start": 8791, + "end": 8800, "loc": { "start": { "line": 237, @@ -51754,8 +52720,8 @@ "binop": null, "updateContext": null }, - "start": 8714, - "end": 8715, + "start": 8800, + "end": 8801, "loc": { "start": { "line": 237, @@ -51780,8 +52746,8 @@ "binop": null }, "value": "style", - "start": 8715, - "end": 8720, + "start": 8801, + "end": 8806, "loc": { "start": { "line": 237, @@ -51806,8 +52772,8 @@ "binop": null, "updateContext": null }, - "start": 8720, - "end": 8721, + "start": 8806, + "end": 8807, "loc": { "start": { "line": 237, @@ -51832,8 +52798,8 @@ "binop": null }, "value": "left", - "start": 8721, - "end": 8725, + "start": 8807, + "end": 8811, "loc": { "start": { "line": 237, @@ -51859,8 +52825,8 @@ "updateContext": null }, "value": "=", - "start": 8726, - "end": 8727, + "start": 8812, + "end": 8813, "loc": { "start": { "line": 237, @@ -51884,8 +52850,8 @@ "postfix": false, "binop": null }, - "start": 8728, - "end": 8729, + "start": 8814, + "end": 8815, "loc": { "start": { "line": 237, @@ -51911,8 +52877,8 @@ "updateContext": null }, "value": "", - "start": 8729, - "end": 8729, + "start": 8815, + "end": 8815, "loc": { "start": { "line": 237, @@ -51936,8 +52902,8 @@ "postfix": false, "binop": null }, - "start": 8729, - "end": 8731, + "start": 8815, + "end": 8817, "loc": { "start": { "line": 237, @@ -51962,8 +52928,8 @@ "binop": null }, "value": "getLeft", - "start": 8731, - "end": 8738, + "start": 8817, + "end": 8824, "loc": { "start": { "line": 237, @@ -51987,8 +52953,8 @@ "postfix": false, "binop": null }, - "start": 8738, - "end": 8739, + "start": 8824, + "end": 8825, "loc": { "start": { "line": 237, @@ -52013,8 +52979,8 @@ "binop": null }, "value": "canvas", - "start": 8739, - "end": 8745, + "start": 8825, + "end": 8831, "loc": { "start": { "line": 237, @@ -52038,8 +53004,8 @@ "postfix": false, "binop": null }, - "start": 8745, - "end": 8746, + "start": 8831, + "end": 8832, "loc": { "start": { "line": 237, @@ -52065,8 +53031,8 @@ "updateContext": null }, "value": "+", - "start": 8747, - "end": 8748, + "start": 8833, + "end": 8834, "loc": { "start": { "line": 237, @@ -52091,8 +53057,8 @@ "binop": null }, "value": "canvasPos", - "start": 8749, - "end": 8758, + "start": 8835, + "end": 8844, "loc": { "start": { "line": 237, @@ -52117,8 +53083,8 @@ "binop": null, "updateContext": null }, - "start": 8758, - "end": 8759, + "start": 8844, + "end": 8845, "loc": { "start": { "line": 237, @@ -52144,8 +53110,8 @@ "updateContext": null }, "value": 0, - "start": 8759, - "end": 8760, + "start": 8845, + "end": 8846, "loc": { "start": { "line": 237, @@ -52170,8 +53136,8 @@ "binop": null, "updateContext": null }, - "start": 8760, - "end": 8761, + "start": 8846, + "end": 8847, "loc": { "start": { "line": 237, @@ -52197,8 +53163,8 @@ "updateContext": null }, "value": "-", - "start": 8762, - "end": 8763, + "start": 8848, + "end": 8849, "loc": { "start": { "line": 237, @@ -52224,8 +53190,8 @@ "updateContext": null }, "value": 5, - "start": 8764, - "end": 8765, + "start": 8850, + "end": 8851, "loc": { "start": { "line": 237, @@ -52249,8 +53215,8 @@ "postfix": false, "binop": null }, - "start": 8765, - "end": 8766, + "start": 8851, + "end": 8852, "loc": { "start": { "line": 237, @@ -52276,8 +53242,8 @@ "updateContext": null }, "value": "px", - "start": 8766, - "end": 8768, + "start": 8852, + "end": 8854, "loc": { "start": { "line": 237, @@ -52301,8 +53267,8 @@ "postfix": false, "binop": null }, - "start": 8768, - "end": 8769, + "start": 8854, + "end": 8855, "loc": { "start": { "line": 237, @@ -52327,8 +53293,8 @@ "binop": null, "updateContext": null }, - "start": 8769, - "end": 8770, + "start": 8855, + "end": 8856, "loc": { "start": { "line": 237, @@ -52355,8 +53321,8 @@ "updateContext": null }, "value": "this", - "start": 8799, - "end": 8803, + "start": 8885, + "end": 8889, "loc": { "start": { "line": 238, @@ -52381,8 +53347,8 @@ "binop": null, "updateContext": null }, - "start": 8803, - "end": 8804, + "start": 8889, + "end": 8890, "loc": { "start": { "line": 238, @@ -52407,8 +53373,8 @@ "binop": null }, "value": "markerDiv", - "start": 8804, - "end": 8813, + "start": 8890, + "end": 8899, "loc": { "start": { "line": 238, @@ -52433,8 +53399,8 @@ "binop": null, "updateContext": null }, - "start": 8813, - "end": 8814, + "start": 8899, + "end": 8900, "loc": { "start": { "line": 238, @@ -52459,8 +53425,8 @@ "binop": null }, "value": "style", - "start": 8814, - "end": 8819, + "start": 8900, + "end": 8905, "loc": { "start": { "line": 238, @@ -52485,8 +53451,8 @@ "binop": null, "updateContext": null }, - "start": 8819, - "end": 8820, + "start": 8905, + "end": 8906, "loc": { "start": { "line": 238, @@ -52511,8 +53477,8 @@ "binop": null }, "value": "top", - "start": 8820, - "end": 8823, + "start": 8906, + "end": 8909, "loc": { "start": { "line": 238, @@ -52538,8 +53504,8 @@ "updateContext": null }, "value": "=", - "start": 8824, - "end": 8825, + "start": 8910, + "end": 8911, "loc": { "start": { "line": 238, @@ -52563,8 +53529,8 @@ "postfix": false, "binop": null }, - "start": 8826, - "end": 8827, + "start": 8912, + "end": 8913, "loc": { "start": { "line": 238, @@ -52590,8 +53556,8 @@ "updateContext": null }, "value": "", - "start": 8827, - "end": 8827, + "start": 8913, + "end": 8913, "loc": { "start": { "line": 238, @@ -52615,8 +53581,8 @@ "postfix": false, "binop": null }, - "start": 8827, - "end": 8829, + "start": 8913, + "end": 8915, "loc": { "start": { "line": 238, @@ -52641,8 +53607,8 @@ "binop": null }, "value": "getTop", - "start": 8829, - "end": 8835, + "start": 8915, + "end": 8921, "loc": { "start": { "line": 238, @@ -52666,8 +53632,8 @@ "postfix": false, "binop": null }, - "start": 8835, - "end": 8836, + "start": 8921, + "end": 8922, "loc": { "start": { "line": 238, @@ -52692,8 +53658,8 @@ "binop": null }, "value": "canvas", - "start": 8836, - "end": 8842, + "start": 8922, + "end": 8928, "loc": { "start": { "line": 238, @@ -52717,8 +53683,8 @@ "postfix": false, "binop": null }, - "start": 8842, - "end": 8843, + "start": 8928, + "end": 8929, "loc": { "start": { "line": 238, @@ -52744,8 +53710,8 @@ "updateContext": null }, "value": "+", - "start": 8844, - "end": 8845, + "start": 8930, + "end": 8931, "loc": { "start": { "line": 238, @@ -52770,8 +53736,8 @@ "binop": null }, "value": "canvasPos", - "start": 8846, - "end": 8855, + "start": 8932, + "end": 8941, "loc": { "start": { "line": 238, @@ -52796,8 +53762,8 @@ "binop": null, "updateContext": null }, - "start": 8855, - "end": 8856, + "start": 8941, + "end": 8942, "loc": { "start": { "line": 238, @@ -52823,8 +53789,8 @@ "updateContext": null }, "value": 1, - "start": 8856, - "end": 8857, + "start": 8942, + "end": 8943, "loc": { "start": { "line": 238, @@ -52849,8 +53815,8 @@ "binop": null, "updateContext": null }, - "start": 8857, - "end": 8858, + "start": 8943, + "end": 8944, "loc": { "start": { "line": 238, @@ -52876,8 +53842,8 @@ "updateContext": null }, "value": "-", - "start": 8859, - "end": 8860, + "start": 8945, + "end": 8946, "loc": { "start": { "line": 238, @@ -52903,8 +53869,8 @@ "updateContext": null }, "value": 5, - "start": 8861, - "end": 8862, + "start": 8947, + "end": 8948, "loc": { "start": { "line": 238, @@ -52928,8 +53894,8 @@ "postfix": false, "binop": null }, - "start": 8862, - "end": 8863, + "start": 8948, + "end": 8949, "loc": { "start": { "line": 238, @@ -52955,8 +53921,8 @@ "updateContext": null }, "value": "px", - "start": 8863, - "end": 8865, + "start": 8949, + "end": 8951, "loc": { "start": { "line": 238, @@ -52980,8 +53946,8 @@ "postfix": false, "binop": null }, - "start": 8865, - "end": 8866, + "start": 8951, + "end": 8952, "loc": { "start": { "line": 238, @@ -53006,8 +53972,8 @@ "binop": null, "updateContext": null }, - "start": 8866, - "end": 8867, + "start": 8952, + "end": 8953, "loc": { "start": { "line": 238, @@ -53031,8 +53997,8 @@ "postfix": false, "binop": null }, - "start": 8892, - "end": 8893, + "start": 8978, + "end": 8979, "loc": { "start": { "line": 239, @@ -53059,8 +54025,8 @@ "updateContext": null }, "value": "break", - "start": 8918, - "end": 8923, + "start": 9004, + "end": 9009, "loc": { "start": { "line": 240, @@ -53085,8 +54051,8 @@ "binop": null, "updateContext": null }, - "start": 8923, - "end": 8924, + "start": 9009, + "end": 9010, "loc": { "start": { "line": 240, @@ -53113,8 +54079,8 @@ "updateContext": null }, "value": "case", - "start": 8945, - "end": 8949, + "start": 9031, + "end": 9035, "loc": { "start": { "line": 241, @@ -53139,8 +54105,8 @@ "binop": null }, "value": "MOUSE_FINDING_CORNER", - "start": 8950, - "end": 8970, + "start": 9036, + "end": 9056, "loc": { "start": { "line": 241, @@ -53165,8 +54131,8 @@ "binop": null, "updateContext": null }, - "start": 8970, - "end": 8971, + "start": 9056, + "end": 9057, "loc": { "start": { "line": 241, @@ -53193,8 +54159,8 @@ "updateContext": null }, "value": "if", - "start": 8996, - "end": 8998, + "start": 9082, + "end": 9084, "loc": { "start": { "line": 242, @@ -53218,8 +54184,8 @@ "postfix": false, "binop": null }, - "start": 8999, - "end": 9000, + "start": 9085, + "end": 9086, "loc": { "start": { "line": 242, @@ -53246,8 +54212,8 @@ "updateContext": null }, "value": "this", - "start": 9000, - "end": 9004, + "start": 9086, + "end": 9090, "loc": { "start": { "line": 242, @@ -53272,8 +54238,8 @@ "binop": null, "updateContext": null }, - "start": 9004, - "end": 9005, + "start": 9090, + "end": 9091, "loc": { "start": { "line": 242, @@ -53298,8 +54264,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9005, - "end": 9029, + "start": 9091, + "end": 9115, "loc": { "start": { "line": 242, @@ -53323,8 +54289,8 @@ "postfix": false, "binop": null }, - "start": 9029, - "end": 9030, + "start": 9115, + "end": 9116, "loc": { "start": { "line": 242, @@ -53348,8 +54314,8 @@ "postfix": false, "binop": null }, - "start": 9031, - "end": 9032, + "start": 9117, + "end": 9118, "loc": { "start": { "line": 242, @@ -53376,8 +54342,8 @@ "updateContext": null }, "value": "this", - "start": 9061, - "end": 9065, + "start": 9147, + "end": 9151, "loc": { "start": { "line": 243, @@ -53402,8 +54368,8 @@ "binop": null, "updateContext": null }, - "start": 9065, - "end": 9066, + "start": 9151, + "end": 9152, "loc": { "start": { "line": 243, @@ -53428,8 +54394,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9066, - "end": 9090, + "start": 9152, + "end": 9176, "loc": { "start": { "line": 243, @@ -53454,8 +54420,8 @@ "binop": null, "updateContext": null }, - "start": 9090, - "end": 9091, + "start": 9176, + "end": 9177, "loc": { "start": { "line": 243, @@ -53480,8 +54446,8 @@ "binop": null }, "value": "originWireVisible", - "start": 9091, - "end": 9108, + "start": 9177, + "end": 9194, "loc": { "start": { "line": 243, @@ -53507,8 +54473,8 @@ "updateContext": null }, "value": "=", - "start": 9109, - "end": 9110, + "start": 9195, + "end": 9196, "loc": { "start": { "line": 243, @@ -53535,8 +54501,8 @@ "updateContext": null }, "value": "true", - "start": 9111, - "end": 9115, + "start": 9197, + "end": 9201, "loc": { "start": { "line": 243, @@ -53561,8 +54527,8 @@ "binop": null, "updateContext": null }, - "start": 9115, - "end": 9116, + "start": 9201, + "end": 9202, "loc": { "start": { "line": 243, @@ -53589,8 +54555,8 @@ "updateContext": null }, "value": "this", - "start": 9145, - "end": 9149, + "start": 9231, + "end": 9235, "loc": { "start": { "line": 244, @@ -53615,8 +54581,8 @@ "binop": null, "updateContext": null }, - "start": 9149, - "end": 9150, + "start": 9235, + "end": 9236, "loc": { "start": { "line": 244, @@ -53641,8 +54607,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9150, - "end": 9174, + "start": 9236, + "end": 9260, "loc": { "start": { "line": 244, @@ -53667,8 +54633,8 @@ "binop": null, "updateContext": null }, - "start": 9174, - "end": 9175, + "start": 9260, + "end": 9261, "loc": { "start": { "line": 244, @@ -53693,8 +54659,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 9175, - "end": 9192, + "start": 9261, + "end": 9278, "loc": { "start": { "line": 244, @@ -53720,8 +54686,8 @@ "updateContext": null }, "value": "=", - "start": 9193, - "end": 9194, + "start": 9279, + "end": 9280, "loc": { "start": { "line": 244, @@ -53748,8 +54714,8 @@ "updateContext": null }, "value": "false", - "start": 9195, - "end": 9200, + "start": 9281, + "end": 9286, "loc": { "start": { "line": 244, @@ -53774,8 +54740,8 @@ "binop": null, "updateContext": null }, - "start": 9200, - "end": 9201, + "start": 9286, + "end": 9287, "loc": { "start": { "line": 244, @@ -53802,8 +54768,8 @@ "updateContext": null }, "value": "this", - "start": 9230, - "end": 9234, + "start": 9316, + "end": 9320, "loc": { "start": { "line": 245, @@ -53828,8 +54794,8 @@ "binop": null, "updateContext": null }, - "start": 9234, - "end": 9235, + "start": 9320, + "end": 9321, "loc": { "start": { "line": 245, @@ -53854,8 +54820,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9235, - "end": 9259, + "start": 9321, + "end": 9345, "loc": { "start": { "line": 245, @@ -53880,8 +54846,8 @@ "binop": null, "updateContext": null }, - "start": 9259, - "end": 9260, + "start": 9345, + "end": 9346, "loc": { "start": { "line": 245, @@ -53906,8 +54872,8 @@ "binop": null }, "value": "cornerVisible", - "start": 9260, - "end": 9273, + "start": 9346, + "end": 9359, "loc": { "start": { "line": 245, @@ -53933,8 +54899,8 @@ "updateContext": null }, "value": "=", - "start": 9274, - "end": 9275, + "start": 9360, + "end": 9361, "loc": { "start": { "line": 245, @@ -53961,8 +54927,8 @@ "updateContext": null }, "value": "true", - "start": 9276, - "end": 9280, + "start": 9362, + "end": 9366, "loc": { "start": { "line": 245, @@ -53987,8 +54953,8 @@ "binop": null, "updateContext": null }, - "start": 9280, - "end": 9281, + "start": 9366, + "end": 9367, "loc": { "start": { "line": 245, @@ -54015,8 +54981,8 @@ "updateContext": null }, "value": "this", - "start": 9310, - "end": 9314, + "start": 9396, + "end": 9400, "loc": { "start": { "line": 246, @@ -54041,8 +55007,8 @@ "binop": null, "updateContext": null }, - "start": 9314, - "end": 9315, + "start": 9400, + "end": 9401, "loc": { "start": { "line": 246, @@ -54067,8 +55033,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9315, - "end": 9339, + "start": 9401, + "end": 9425, "loc": { "start": { "line": 246, @@ -54093,8 +55059,8 @@ "binop": null, "updateContext": null }, - "start": 9339, - "end": 9340, + "start": 9425, + "end": 9426, "loc": { "start": { "line": 246, @@ -54119,8 +55085,8 @@ "binop": null }, "value": "angleVisible", - "start": 9340, - "end": 9352, + "start": 9426, + "end": 9438, "loc": { "start": { "line": 246, @@ -54146,8 +55112,8 @@ "updateContext": null }, "value": "=", - "start": 9353, - "end": 9354, + "start": 9439, + "end": 9440, "loc": { "start": { "line": 246, @@ -54174,8 +55140,8 @@ "updateContext": null }, "value": "false", - "start": 9355, - "end": 9360, + "start": 9441, + "end": 9446, "loc": { "start": { "line": 246, @@ -54200,8 +55166,8 @@ "binop": null, "updateContext": null }, - "start": 9360, - "end": 9361, + "start": 9446, + "end": 9447, "loc": { "start": { "line": 246, @@ -54228,8 +55194,8 @@ "updateContext": null }, "value": "this", - "start": 9390, - "end": 9394, + "start": 9476, + "end": 9480, "loc": { "start": { "line": 247, @@ -54254,8 +55220,8 @@ "binop": null, "updateContext": null }, - "start": 9394, - "end": 9395, + "start": 9480, + "end": 9481, "loc": { "start": { "line": 247, @@ -54280,8 +55246,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9395, - "end": 9419, + "start": 9481, + "end": 9505, "loc": { "start": { "line": 247, @@ -54306,8 +55272,8 @@ "binop": null, "updateContext": null }, - "start": 9419, - "end": 9420, + "start": 9505, + "end": 9506, "loc": { "start": { "line": 247, @@ -54332,8 +55298,8 @@ "binop": null }, "value": "corner", - "start": 9420, - "end": 9426, + "start": 9506, + "end": 9512, "loc": { "start": { "line": 247, @@ -54358,8 +55324,8 @@ "binop": null, "updateContext": null }, - "start": 9426, - "end": 9427, + "start": 9512, + "end": 9513, "loc": { "start": { "line": 247, @@ -54384,8 +55350,8 @@ "binop": null }, "value": "worldPos", - "start": 9427, - "end": 9435, + "start": 9513, + "end": 9521, "loc": { "start": { "line": 247, @@ -54411,8 +55377,8 @@ "updateContext": null }, "value": "=", - "start": 9436, - "end": 9437, + "start": 9522, + "end": 9523, "loc": { "start": { "line": 247, @@ -54437,8 +55403,8 @@ "binop": null }, "value": "event", - "start": 9438, - "end": 9443, + "start": 9524, + "end": 9529, "loc": { "start": { "line": 247, @@ -54463,8 +55429,8 @@ "binop": null, "updateContext": null }, - "start": 9443, - "end": 9444, + "start": 9529, + "end": 9530, "loc": { "start": { "line": 247, @@ -54489,8 +55455,8 @@ "binop": null }, "value": "worldPos", - "start": 9444, - "end": 9452, + "start": 9530, + "end": 9538, "loc": { "start": { "line": 247, @@ -54515,8 +55481,8 @@ "binop": null, "updateContext": null }, - "start": 9452, - "end": 9453, + "start": 9538, + "end": 9539, "loc": { "start": { "line": 247, @@ -54543,8 +55509,8 @@ "updateContext": null }, "value": "this", - "start": 9482, - "end": 9486, + "start": 9568, + "end": 9572, "loc": { "start": { "line": 248, @@ -54569,8 +55535,8 @@ "binop": null, "updateContext": null }, - "start": 9486, - "end": 9487, + "start": 9572, + "end": 9573, "loc": { "start": { "line": 248, @@ -54595,8 +55561,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9487, - "end": 9511, + "start": 9573, + "end": 9597, "loc": { "start": { "line": 248, @@ -54621,8 +55587,8 @@ "binop": null, "updateContext": null }, - "start": 9511, - "end": 9512, + "start": 9597, + "end": 9598, "loc": { "start": { "line": 248, @@ -54647,8 +55613,8 @@ "binop": null }, "value": "corner", - "start": 9512, - "end": 9518, + "start": 9598, + "end": 9604, "loc": { "start": { "line": 248, @@ -54673,8 +55639,8 @@ "binop": null, "updateContext": null }, - "start": 9518, - "end": 9519, + "start": 9604, + "end": 9605, "loc": { "start": { "line": 248, @@ -54699,8 +55665,8 @@ "binop": null }, "value": "entity", - "start": 9519, - "end": 9525, + "start": 9605, + "end": 9611, "loc": { "start": { "line": 248, @@ -54726,8 +55692,8 @@ "updateContext": null }, "value": "=", - "start": 9526, - "end": 9527, + "start": 9612, + "end": 9613, "loc": { "start": { "line": 248, @@ -54752,8 +55718,8 @@ "binop": null }, "value": "event", - "start": 9528, - "end": 9533, + "start": 9614, + "end": 9619, "loc": { "start": { "line": 248, @@ -54778,8 +55744,8 @@ "binop": null, "updateContext": null }, - "start": 9533, - "end": 9534, + "start": 9619, + "end": 9620, "loc": { "start": { "line": 248, @@ -54804,8 +55770,8 @@ "binop": null }, "value": "entity", - "start": 9534, - "end": 9540, + "start": 9620, + "end": 9626, "loc": { "start": { "line": 248, @@ -54830,8 +55796,8 @@ "binop": null, "updateContext": null }, - "start": 9540, - "end": 9541, + "start": 9626, + "end": 9627, "loc": { "start": { "line": 248, @@ -54855,8 +55821,8 @@ "postfix": false, "binop": null }, - "start": 9566, - "end": 9567, + "start": 9652, + "end": 9653, "loc": { "start": { "line": 249, @@ -54883,8 +55849,8 @@ "updateContext": null }, "value": "this", - "start": 9592, - "end": 9596, + "start": 9678, + "end": 9682, "loc": { "start": { "line": 250, @@ -54909,8 +55875,8 @@ "binop": null, "updateContext": null }, - "start": 9596, - "end": 9597, + "start": 9682, + "end": 9683, "loc": { "start": { "line": 250, @@ -54935,8 +55901,8 @@ "binop": null }, "value": "markerDiv", - "start": 9597, - "end": 9606, + "start": 9683, + "end": 9692, "loc": { "start": { "line": 250, @@ -54961,8 +55927,8 @@ "binop": null, "updateContext": null }, - "start": 9606, - "end": 9607, + "start": 9692, + "end": 9693, "loc": { "start": { "line": 250, @@ -54987,8 +55953,8 @@ "binop": null }, "value": "style", - "start": 9607, - "end": 9612, + "start": 9693, + "end": 9698, "loc": { "start": { "line": 250, @@ -55013,8 +55979,8 @@ "binop": null, "updateContext": null }, - "start": 9612, - "end": 9613, + "start": 9698, + "end": 9699, "loc": { "start": { "line": 250, @@ -55039,8 +56005,8 @@ "binop": null }, "value": "left", - "start": 9613, - "end": 9617, + "start": 9699, + "end": 9703, "loc": { "start": { "line": 250, @@ -55066,8 +56032,8 @@ "updateContext": null }, "value": "=", - "start": 9618, - "end": 9619, + "start": 9704, + "end": 9705, "loc": { "start": { "line": 250, @@ -55091,8 +56057,8 @@ "postfix": false, "binop": null }, - "start": 9620, - "end": 9621, + "start": 9706, + "end": 9707, "loc": { "start": { "line": 250, @@ -55118,8 +56084,8 @@ "updateContext": null }, "value": "-10000px", - "start": 9621, - "end": 9629, + "start": 9707, + "end": 9715, "loc": { "start": { "line": 250, @@ -55143,8 +56109,8 @@ "postfix": false, "binop": null }, - "start": 9629, - "end": 9630, + "start": 9715, + "end": 9716, "loc": { "start": { "line": 250, @@ -55169,8 +56135,8 @@ "binop": null, "updateContext": null }, - "start": 9630, - "end": 9631, + "start": 9716, + "end": 9717, "loc": { "start": { "line": 250, @@ -55197,8 +56163,8 @@ "updateContext": null }, "value": "this", - "start": 9656, - "end": 9660, + "start": 9742, + "end": 9746, "loc": { "start": { "line": 251, @@ -55223,8 +56189,8 @@ "binop": null, "updateContext": null }, - "start": 9660, - "end": 9661, + "start": 9746, + "end": 9747, "loc": { "start": { "line": 251, @@ -55249,8 +56215,8 @@ "binop": null }, "value": "markerDiv", - "start": 9661, - "end": 9670, + "start": 9747, + "end": 9756, "loc": { "start": { "line": 251, @@ -55275,8 +56241,8 @@ "binop": null, "updateContext": null }, - "start": 9670, - "end": 9671, + "start": 9756, + "end": 9757, "loc": { "start": { "line": 251, @@ -55301,8 +56267,8 @@ "binop": null }, "value": "style", - "start": 9671, - "end": 9676, + "start": 9757, + "end": 9762, "loc": { "start": { "line": 251, @@ -55327,8 +56293,8 @@ "binop": null, "updateContext": null }, - "start": 9676, - "end": 9677, + "start": 9762, + "end": 9763, "loc": { "start": { "line": 251, @@ -55353,8 +56319,8 @@ "binop": null }, "value": "top", - "start": 9677, - "end": 9680, + "start": 9763, + "end": 9766, "loc": { "start": { "line": 251, @@ -55380,8 +56346,8 @@ "updateContext": null }, "value": "=", - "start": 9681, - "end": 9682, + "start": 9767, + "end": 9768, "loc": { "start": { "line": 251, @@ -55405,8 +56371,8 @@ "postfix": false, "binop": null }, - "start": 9683, - "end": 9684, + "start": 9769, + "end": 9770, "loc": { "start": { "line": 251, @@ -55432,8 +56398,8 @@ "updateContext": null }, "value": "-10000px", - "start": 9684, - "end": 9692, + "start": 9770, + "end": 9778, "loc": { "start": { "line": 251, @@ -55457,8 +56423,8 @@ "postfix": false, "binop": null }, - "start": 9692, - "end": 9693, + "start": 9778, + "end": 9779, "loc": { "start": { "line": 251, @@ -55483,8 +56449,8 @@ "binop": null, "updateContext": null }, - "start": 9693, - "end": 9694, + "start": 9779, + "end": 9780, "loc": { "start": { "line": 251, @@ -55509,8 +56475,8 @@ "binop": null }, "value": "canvas", - "start": 9719, - "end": 9725, + "start": 9805, + "end": 9811, "loc": { "start": { "line": 252, @@ -55535,8 +56501,8 @@ "binop": null, "updateContext": null }, - "start": 9725, - "end": 9726, + "start": 9811, + "end": 9812, "loc": { "start": { "line": 252, @@ -55561,8 +56527,8 @@ "binop": null }, "value": "style", - "start": 9726, - "end": 9731, + "start": 9812, + "end": 9817, "loc": { "start": { "line": 252, @@ -55587,8 +56553,8 @@ "binop": null, "updateContext": null }, - "start": 9731, - "end": 9732, + "start": 9817, + "end": 9818, "loc": { "start": { "line": 252, @@ -55613,8 +56579,8 @@ "binop": null }, "value": "cursor", - "start": 9732, - "end": 9738, + "start": 9818, + "end": 9824, "loc": { "start": { "line": 252, @@ -55640,8 +56606,8 @@ "updateContext": null }, "value": "=", - "start": 9739, - "end": 9740, + "start": 9825, + "end": 9826, "loc": { "start": { "line": 252, @@ -55667,8 +56633,8 @@ "updateContext": null }, "value": "pointer", - "start": 9741, - "end": 9750, + "start": 9827, + "end": 9836, "loc": { "start": { "line": 252, @@ -55693,8 +56659,8 @@ "binop": null, "updateContext": null }, - "start": 9750, - "end": 9751, + "start": 9836, + "end": 9837, "loc": { "start": { "line": 252, @@ -55721,8 +56687,8 @@ "updateContext": null }, "value": "break", - "start": 9776, - "end": 9781, + "start": 9862, + "end": 9867, "loc": { "start": { "line": 253, @@ -55747,8 +56713,8 @@ "binop": null, "updateContext": null }, - "start": 9781, - "end": 9782, + "start": 9867, + "end": 9868, "loc": { "start": { "line": 253, @@ -55775,8 +56741,8 @@ "updateContext": null }, "value": "case", - "start": 9803, - "end": 9807, + "start": 9889, + "end": 9893, "loc": { "start": { "line": 254, @@ -55801,8 +56767,8 @@ "binop": null }, "value": "MOUSE_FINDING_TARGET", - "start": 9808, - "end": 9828, + "start": 9894, + "end": 9914, "loc": { "start": { "line": 254, @@ -55827,8 +56793,8 @@ "binop": null, "updateContext": null }, - "start": 9828, - "end": 9829, + "start": 9914, + "end": 9915, "loc": { "start": { "line": 254, @@ -55855,8 +56821,8 @@ "updateContext": null }, "value": "if", - "start": 9854, - "end": 9856, + "start": 9940, + "end": 9942, "loc": { "start": { "line": 255, @@ -55880,8 +56846,8 @@ "postfix": false, "binop": null }, - "start": 9857, - "end": 9858, + "start": 9943, + "end": 9944, "loc": { "start": { "line": 255, @@ -55908,8 +56874,8 @@ "updateContext": null }, "value": "this", - "start": 9858, - "end": 9862, + "start": 9944, + "end": 9948, "loc": { "start": { "line": 255, @@ -55934,8 +56900,8 @@ "binop": null, "updateContext": null }, - "start": 9862, - "end": 9863, + "start": 9948, + "end": 9949, "loc": { "start": { "line": 255, @@ -55960,8 +56926,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9863, - "end": 9887, + "start": 9949, + "end": 9973, "loc": { "start": { "line": 255, @@ -55985,8 +56951,8 @@ "postfix": false, "binop": null }, - "start": 9887, - "end": 9888, + "start": 9973, + "end": 9974, "loc": { "start": { "line": 255, @@ -56010,8 +56976,8 @@ "postfix": false, "binop": null }, - "start": 9889, - "end": 9890, + "start": 9975, + "end": 9976, "loc": { "start": { "line": 255, @@ -56038,8 +57004,8 @@ "updateContext": null }, "value": "this", - "start": 9919, - "end": 9923, + "start": 10005, + "end": 10009, "loc": { "start": { "line": 256, @@ -56064,8 +57030,8 @@ "binop": null, "updateContext": null }, - "start": 9923, - "end": 9924, + "start": 10009, + "end": 10010, "loc": { "start": { "line": 256, @@ -56090,8 +57056,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 9924, - "end": 9948, + "start": 10010, + "end": 10034, "loc": { "start": { "line": 256, @@ -56116,8 +57082,8 @@ "binop": null, "updateContext": null }, - "start": 9948, - "end": 9949, + "start": 10034, + "end": 10035, "loc": { "start": { "line": 256, @@ -56142,8 +57108,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 9949, - "end": 9966, + "start": 10035, + "end": 10052, "loc": { "start": { "line": 256, @@ -56169,8 +57135,8 @@ "updateContext": null }, "value": "=", - "start": 9967, - "end": 9968, + "start": 10053, + "end": 10054, "loc": { "start": { "line": 256, @@ -56197,8 +57163,8 @@ "updateContext": null }, "value": "true", - "start": 9969, - "end": 9973, + "start": 10055, + "end": 10059, "loc": { "start": { "line": 256, @@ -56223,8 +57189,8 @@ "binop": null, "updateContext": null }, - "start": 9973, - "end": 9974, + "start": 10059, + "end": 10060, "loc": { "start": { "line": 256, @@ -56251,8 +57217,8 @@ "updateContext": null }, "value": "this", - "start": 10003, - "end": 10007, + "start": 10089, + "end": 10093, "loc": { "start": { "line": 257, @@ -56277,8 +57243,8 @@ "binop": null, "updateContext": null }, - "start": 10007, - "end": 10008, + "start": 10093, + "end": 10094, "loc": { "start": { "line": 257, @@ -56303,8 +57269,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 10008, - "end": 10032, + "start": 10094, + "end": 10118, "loc": { "start": { "line": 257, @@ -56329,8 +57295,8 @@ "binop": null, "updateContext": null }, - "start": 10032, - "end": 10033, + "start": 10118, + "end": 10119, "loc": { "start": { "line": 257, @@ -56355,8 +57321,8 @@ "binop": null }, "value": "targetVisible", - "start": 10033, - "end": 10046, + "start": 10119, + "end": 10132, "loc": { "start": { "line": 257, @@ -56382,8 +57348,8 @@ "updateContext": null }, "value": "=", - "start": 10047, - "end": 10048, + "start": 10133, + "end": 10134, "loc": { "start": { "line": 257, @@ -56410,8 +57376,8 @@ "updateContext": null }, "value": "true", - "start": 10049, - "end": 10053, + "start": 10135, + "end": 10139, "loc": { "start": { "line": 257, @@ -56436,8 +57402,8 @@ "binop": null, "updateContext": null }, - "start": 10053, - "end": 10054, + "start": 10139, + "end": 10140, "loc": { "start": { "line": 257, @@ -56464,8 +57430,8 @@ "updateContext": null }, "value": "this", - "start": 10083, - "end": 10087, + "start": 10169, + "end": 10173, "loc": { "start": { "line": 258, @@ -56490,8 +57456,8 @@ "binop": null, "updateContext": null }, - "start": 10087, - "end": 10088, + "start": 10173, + "end": 10174, "loc": { "start": { "line": 258, @@ -56516,8 +57482,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 10088, - "end": 10112, + "start": 10174, + "end": 10198, "loc": { "start": { "line": 258, @@ -56542,8 +57508,8 @@ "binop": null, "updateContext": null }, - "start": 10112, - "end": 10113, + "start": 10198, + "end": 10199, "loc": { "start": { "line": 258, @@ -56568,8 +57534,8 @@ "binop": null }, "value": "angleVisible", - "start": 10113, - "end": 10125, + "start": 10199, + "end": 10211, "loc": { "start": { "line": 258, @@ -56595,8 +57561,8 @@ "updateContext": null }, "value": "=", - "start": 10126, - "end": 10127, + "start": 10212, + "end": 10213, "loc": { "start": { "line": 258, @@ -56623,8 +57589,8 @@ "updateContext": null }, "value": "true", - "start": 10128, - "end": 10132, + "start": 10214, + "end": 10218, "loc": { "start": { "line": 258, @@ -56649,8 +57615,8 @@ "binop": null, "updateContext": null }, - "start": 10132, - "end": 10133, + "start": 10218, + "end": 10219, "loc": { "start": { "line": 258, @@ -56677,8 +57643,8 @@ "updateContext": null }, "value": "this", - "start": 10162, - "end": 10166, + "start": 10248, + "end": 10252, "loc": { "start": { "line": 259, @@ -56703,8 +57669,8 @@ "binop": null, "updateContext": null }, - "start": 10166, - "end": 10167, + "start": 10252, + "end": 10253, "loc": { "start": { "line": 259, @@ -56729,8 +57695,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 10167, - "end": 10191, + "start": 10253, + "end": 10277, "loc": { "start": { "line": 259, @@ -56755,8 +57721,8 @@ "binop": null, "updateContext": null }, - "start": 10191, - "end": 10192, + "start": 10277, + "end": 10278, "loc": { "start": { "line": 259, @@ -56781,8 +57747,8 @@ "binop": null }, "value": "target", - "start": 10192, - "end": 10198, + "start": 10278, + "end": 10284, "loc": { "start": { "line": 259, @@ -56807,8 +57773,8 @@ "binop": null, "updateContext": null }, - "start": 10198, - "end": 10199, + "start": 10284, + "end": 10285, "loc": { "start": { "line": 259, @@ -56833,8 +57799,8 @@ "binop": null }, "value": "worldPos", - "start": 10199, - "end": 10207, + "start": 10285, + "end": 10293, "loc": { "start": { "line": 259, @@ -56860,8 +57826,8 @@ "updateContext": null }, "value": "=", - "start": 10208, - "end": 10209, + "start": 10294, + "end": 10295, "loc": { "start": { "line": 259, @@ -56886,8 +57852,8 @@ "binop": null }, "value": "event", - "start": 10210, - "end": 10215, + "start": 10296, + "end": 10301, "loc": { "start": { "line": 259, @@ -56912,8 +57878,8 @@ "binop": null, "updateContext": null }, - "start": 10215, - "end": 10216, + "start": 10301, + "end": 10302, "loc": { "start": { "line": 259, @@ -56938,8 +57904,8 @@ "binop": null }, "value": "worldPos", - "start": 10216, - "end": 10224, + "start": 10302, + "end": 10310, "loc": { "start": { "line": 259, @@ -56964,8 +57930,8 @@ "binop": null, "updateContext": null }, - "start": 10224, - "end": 10225, + "start": 10310, + "end": 10311, "loc": { "start": { "line": 259, @@ -56992,8 +57958,8 @@ "updateContext": null }, "value": "this", - "start": 10254, - "end": 10258, + "start": 10340, + "end": 10344, "loc": { "start": { "line": 260, @@ -57018,8 +57984,8 @@ "binop": null, "updateContext": null }, - "start": 10258, - "end": 10259, + "start": 10344, + "end": 10345, "loc": { "start": { "line": 260, @@ -57044,8 +58010,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 10259, - "end": 10283, + "start": 10345, + "end": 10369, "loc": { "start": { "line": 260, @@ -57070,8 +58036,8 @@ "binop": null, "updateContext": null }, - "start": 10283, - "end": 10284, + "start": 10369, + "end": 10370, "loc": { "start": { "line": 260, @@ -57096,8 +58062,8 @@ "binop": null }, "value": "target", - "start": 10284, - "end": 10290, + "start": 10370, + "end": 10376, "loc": { "start": { "line": 260, @@ -57122,8 +58088,8 @@ "binop": null, "updateContext": null }, - "start": 10290, - "end": 10291, + "start": 10376, + "end": 10377, "loc": { "start": { "line": 260, @@ -57148,8 +58114,8 @@ "binop": null }, "value": "entity", - "start": 10291, - "end": 10297, + "start": 10377, + "end": 10383, "loc": { "start": { "line": 260, @@ -57175,8 +58141,8 @@ "updateContext": null }, "value": "=", - "start": 10298, - "end": 10299, + "start": 10384, + "end": 10385, "loc": { "start": { "line": 260, @@ -57201,8 +58167,8 @@ "binop": null }, "value": "event", - "start": 10300, - "end": 10305, + "start": 10386, + "end": 10391, "loc": { "start": { "line": 260, @@ -57227,8 +58193,8 @@ "binop": null, "updateContext": null }, - "start": 10305, - "end": 10306, + "start": 10391, + "end": 10392, "loc": { "start": { "line": 260, @@ -57253,8 +58219,8 @@ "binop": null }, "value": "entity", - "start": 10306, - "end": 10312, + "start": 10392, + "end": 10398, "loc": { "start": { "line": 260, @@ -57279,8 +58245,8 @@ "binop": null, "updateContext": null }, - "start": 10312, - "end": 10313, + "start": 10398, + "end": 10399, "loc": { "start": { "line": 260, @@ -57304,8 +58270,8 @@ "postfix": false, "binop": null }, - "start": 10338, - "end": 10339, + "start": 10424, + "end": 10425, "loc": { "start": { "line": 261, @@ -57332,8 +58298,8 @@ "updateContext": null }, "value": "this", - "start": 10364, - "end": 10368, + "start": 10450, + "end": 10454, "loc": { "start": { "line": 262, @@ -57358,8 +58324,8 @@ "binop": null, "updateContext": null }, - "start": 10368, - "end": 10369, + "start": 10454, + "end": 10455, "loc": { "start": { "line": 262, @@ -57384,8 +58350,8 @@ "binop": null }, "value": "markerDiv", - "start": 10369, - "end": 10378, + "start": 10455, + "end": 10464, "loc": { "start": { "line": 262, @@ -57410,8 +58376,8 @@ "binop": null, "updateContext": null }, - "start": 10378, - "end": 10379, + "start": 10464, + "end": 10465, "loc": { "start": { "line": 262, @@ -57436,8 +58402,8 @@ "binop": null }, "value": "style", - "start": 10379, - "end": 10384, + "start": 10465, + "end": 10470, "loc": { "start": { "line": 262, @@ -57462,8 +58428,8 @@ "binop": null, "updateContext": null }, - "start": 10384, - "end": 10385, + "start": 10470, + "end": 10471, "loc": { "start": { "line": 262, @@ -57488,8 +58454,8 @@ "binop": null }, "value": "left", - "start": 10385, - "end": 10389, + "start": 10471, + "end": 10475, "loc": { "start": { "line": 262, @@ -57515,8 +58481,8 @@ "updateContext": null }, "value": "=", - "start": 10390, - "end": 10391, + "start": 10476, + "end": 10477, "loc": { "start": { "line": 262, @@ -57540,8 +58506,8 @@ "postfix": false, "binop": null }, - "start": 10392, - "end": 10393, + "start": 10478, + "end": 10479, "loc": { "start": { "line": 262, @@ -57567,8 +58533,8 @@ "updateContext": null }, "value": "-10000px", - "start": 10393, - "end": 10401, + "start": 10479, + "end": 10487, "loc": { "start": { "line": 262, @@ -57592,8 +58558,8 @@ "postfix": false, "binop": null }, - "start": 10401, - "end": 10402, + "start": 10487, + "end": 10488, "loc": { "start": { "line": 262, @@ -57618,8 +58584,8 @@ "binop": null, "updateContext": null }, - "start": 10402, - "end": 10403, + "start": 10488, + "end": 10489, "loc": { "start": { "line": 262, @@ -57646,8 +58612,8 @@ "updateContext": null }, "value": "this", - "start": 10428, - "end": 10432, + "start": 10514, + "end": 10518, "loc": { "start": { "line": 263, @@ -57672,8 +58638,8 @@ "binop": null, "updateContext": null }, - "start": 10432, - "end": 10433, + "start": 10518, + "end": 10519, "loc": { "start": { "line": 263, @@ -57698,8 +58664,8 @@ "binop": null }, "value": "markerDiv", - "start": 10433, - "end": 10442, + "start": 10519, + "end": 10528, "loc": { "start": { "line": 263, @@ -57724,8 +58690,8 @@ "binop": null, "updateContext": null }, - "start": 10442, - "end": 10443, + "start": 10528, + "end": 10529, "loc": { "start": { "line": 263, @@ -57750,8 +58716,8 @@ "binop": null }, "value": "style", - "start": 10443, - "end": 10448, + "start": 10529, + "end": 10534, "loc": { "start": { "line": 263, @@ -57776,8 +58742,8 @@ "binop": null, "updateContext": null }, - "start": 10448, - "end": 10449, + "start": 10534, + "end": 10535, "loc": { "start": { "line": 263, @@ -57802,8 +58768,8 @@ "binop": null }, "value": "top", - "start": 10449, - "end": 10452, + "start": 10535, + "end": 10538, "loc": { "start": { "line": 263, @@ -57829,8 +58795,8 @@ "updateContext": null }, "value": "=", - "start": 10453, - "end": 10454, + "start": 10539, + "end": 10540, "loc": { "start": { "line": 263, @@ -57854,8 +58820,8 @@ "postfix": false, "binop": null }, - "start": 10455, - "end": 10456, + "start": 10541, + "end": 10542, "loc": { "start": { "line": 263, @@ -57881,8 +58847,8 @@ "updateContext": null }, "value": "-10000px", - "start": 10456, - "end": 10464, + "start": 10542, + "end": 10550, "loc": { "start": { "line": 263, @@ -57906,8 +58872,8 @@ "postfix": false, "binop": null }, - "start": 10464, - "end": 10465, + "start": 10550, + "end": 10551, "loc": { "start": { "line": 263, @@ -57932,8 +58898,8 @@ "binop": null, "updateContext": null }, - "start": 10465, - "end": 10466, + "start": 10551, + "end": 10552, "loc": { "start": { "line": 263, @@ -57958,8 +58924,8 @@ "binop": null }, "value": "canvas", - "start": 10491, - "end": 10497, + "start": 10577, + "end": 10583, "loc": { "start": { "line": 264, @@ -57984,8 +58950,8 @@ "binop": null, "updateContext": null }, - "start": 10497, - "end": 10498, + "start": 10583, + "end": 10584, "loc": { "start": { "line": 264, @@ -58010,8 +58976,8 @@ "binop": null }, "value": "style", - "start": 10498, - "end": 10503, + "start": 10584, + "end": 10589, "loc": { "start": { "line": 264, @@ -58036,8 +59002,8 @@ "binop": null, "updateContext": null }, - "start": 10503, - "end": 10504, + "start": 10589, + "end": 10590, "loc": { "start": { "line": 264, @@ -58062,8 +59028,8 @@ "binop": null }, "value": "cursor", - "start": 10504, - "end": 10510, + "start": 10590, + "end": 10596, "loc": { "start": { "line": 264, @@ -58089,8 +59055,8 @@ "updateContext": null }, "value": "=", - "start": 10511, - "end": 10512, + "start": 10597, + "end": 10598, "loc": { "start": { "line": 264, @@ -58116,8 +59082,8 @@ "updateContext": null }, "value": "pointer", - "start": 10513, - "end": 10522, + "start": 10599, + "end": 10608, "loc": { "start": { "line": 264, @@ -58142,8 +59108,8 @@ "binop": null, "updateContext": null }, - "start": 10522, - "end": 10523, + "start": 10608, + "end": 10609, "loc": { "start": { "line": 264, @@ -58170,8 +59136,8 @@ "updateContext": null }, "value": "break", - "start": 10548, - "end": 10553, + "start": 10634, + "end": 10639, "loc": { "start": { "line": 265, @@ -58196,8 +59162,8 @@ "binop": null, "updateContext": null }, - "start": 10553, - "end": 10554, + "start": 10639, + "end": 10640, "loc": { "start": { "line": 265, @@ -58221,8 +59187,8 @@ "postfix": false, "binop": null }, - "start": 10571, - "end": 10572, + "start": 10657, + "end": 10658, "loc": { "start": { "line": 266, @@ -58246,8 +59212,8 @@ "postfix": false, "binop": null }, - "start": 10585, - "end": 10586, + "start": 10671, + "end": 10672, "loc": { "start": { "line": 267, @@ -58271,8 +59237,8 @@ "postfix": false, "binop": null }, - "start": 10586, - "end": 10587, + "start": 10672, + "end": 10673, "loc": { "start": { "line": 267, @@ -58297,8 +59263,8 @@ "binop": null, "updateContext": null }, - "start": 10587, - "end": 10588, + "start": 10673, + "end": 10674, "loc": { "start": { "line": 267, @@ -58323,8 +59289,8 @@ "binop": null }, "value": "canvas", - "start": 10597, - "end": 10603, + "start": 10683, + "end": 10689, "loc": { "start": { "line": 268, @@ -58349,8 +59315,8 @@ "binop": null, "updateContext": null }, - "start": 10603, - "end": 10604, + "start": 10689, + "end": 10690, "loc": { "start": { "line": 268, @@ -58375,8 +59341,8 @@ "binop": null }, "value": "addEventListener", - "start": 10604, - "end": 10620, + "start": 10690, + "end": 10706, "loc": { "start": { "line": 268, @@ -58400,8 +59366,8 @@ "postfix": false, "binop": null }, - "start": 10620, - "end": 10621, + "start": 10706, + "end": 10707, "loc": { "start": { "line": 268, @@ -58427,8 +59393,8 @@ "updateContext": null }, "value": "mousedown", - "start": 10621, - "end": 10632, + "start": 10707, + "end": 10718, "loc": { "start": { "line": 268, @@ -58453,8 +59419,8 @@ "binop": null, "updateContext": null }, - "start": 10632, - "end": 10633, + "start": 10718, + "end": 10719, "loc": { "start": { "line": 268, @@ -58481,8 +59447,8 @@ "updateContext": null }, "value": "this", - "start": 10634, - "end": 10638, + "start": 10720, + "end": 10724, "loc": { "start": { "line": 268, @@ -58507,8 +59473,8 @@ "binop": null, "updateContext": null }, - "start": 10638, - "end": 10639, + "start": 10724, + "end": 10725, "loc": { "start": { "line": 268, @@ -58533,8 +59499,8 @@ "binop": null }, "value": "_onMouseDown", - "start": 10639, - "end": 10651, + "start": 10725, + "end": 10737, "loc": { "start": { "line": 268, @@ -58560,8 +59526,8 @@ "updateContext": null }, "value": "=", - "start": 10652, - "end": 10653, + "start": 10738, + "end": 10739, "loc": { "start": { "line": 268, @@ -58585,8 +59551,8 @@ "postfix": false, "binop": null }, - "start": 10654, - "end": 10655, + "start": 10740, + "end": 10741, "loc": { "start": { "line": 268, @@ -58611,8 +59577,8 @@ "binop": null }, "value": "e", - "start": 10655, - "end": 10656, + "start": 10741, + "end": 10742, "loc": { "start": { "line": 268, @@ -58636,8 +59602,8 @@ "postfix": false, "binop": null }, - "start": 10656, - "end": 10657, + "start": 10742, + "end": 10743, "loc": { "start": { "line": 268, @@ -58662,8 +59628,8 @@ "binop": null, "updateContext": null }, - "start": 10658, - "end": 10660, + "start": 10744, + "end": 10746, "loc": { "start": { "line": 268, @@ -58687,8 +59653,8 @@ "postfix": false, "binop": null }, - "start": 10661, - "end": 10662, + "start": 10747, + "end": 10748, "loc": { "start": { "line": 268, @@ -58715,8 +59681,8 @@ "updateContext": null }, "value": "if", - "start": 10675, - "end": 10677, + "start": 10761, + "end": 10763, "loc": { "start": { "line": 269, @@ -58740,8 +59706,8 @@ "postfix": false, "binop": null }, - "start": 10678, - "end": 10679, + "start": 10764, + "end": 10765, "loc": { "start": { "line": 269, @@ -58766,8 +59732,8 @@ "binop": null }, "value": "e", - "start": 10679, - "end": 10680, + "start": 10765, + "end": 10766, "loc": { "start": { "line": 269, @@ -58792,8 +59758,8 @@ "binop": null, "updateContext": null }, - "start": 10680, - "end": 10681, + "start": 10766, + "end": 10767, "loc": { "start": { "line": 269, @@ -58818,8 +59784,8 @@ "binop": null }, "value": "which", - "start": 10681, - "end": 10686, + "start": 10767, + "end": 10772, "loc": { "start": { "line": 269, @@ -58845,8 +59811,8 @@ "updateContext": null }, "value": "!==", - "start": 10687, - "end": 10690, + "start": 10773, + "end": 10776, "loc": { "start": { "line": 269, @@ -58872,8 +59838,8 @@ "updateContext": null }, "value": 1, - "start": 10691, - "end": 10692, + "start": 10777, + "end": 10778, "loc": { "start": { "line": 269, @@ -58897,8 +59863,8 @@ "postfix": false, "binop": null }, - "start": 10692, - "end": 10693, + "start": 10778, + "end": 10779, "loc": { "start": { "line": 269, @@ -58922,8 +59888,8 @@ "postfix": false, "binop": null }, - "start": 10694, - "end": 10695, + "start": 10780, + "end": 10781, "loc": { "start": { "line": 269, @@ -58950,8 +59916,8 @@ "updateContext": null }, "value": "return", - "start": 10712, - "end": 10718, + "start": 10798, + "end": 10804, "loc": { "start": { "line": 270, @@ -58976,8 +59942,8 @@ "binop": null, "updateContext": null }, - "start": 10718, - "end": 10719, + "start": 10804, + "end": 10805, "loc": { "start": { "line": 270, @@ -59001,8 +59967,8 @@ "postfix": false, "binop": null }, - "start": 10732, - "end": 10733, + "start": 10818, + "end": 10819, "loc": { "start": { "line": 271, @@ -59027,8 +59993,8 @@ "binop": null }, "value": "lastMouseCanvasX", - "start": 10746, - "end": 10762, + "start": 10832, + "end": 10848, "loc": { "start": { "line": 272, @@ -59054,8 +60020,8 @@ "updateContext": null }, "value": "=", - "start": 10763, - "end": 10764, + "start": 10849, + "end": 10850, "loc": { "start": { "line": 272, @@ -59080,8 +60046,8 @@ "binop": null }, "value": "e", - "start": 10765, - "end": 10766, + "start": 10851, + "end": 10852, "loc": { "start": { "line": 272, @@ -59106,8 +60072,8 @@ "binop": null, "updateContext": null }, - "start": 10766, - "end": 10767, + "start": 10852, + "end": 10853, "loc": { "start": { "line": 272, @@ -59132,8 +60098,8 @@ "binop": null }, "value": "clientX", - "start": 10767, - "end": 10774, + "start": 10853, + "end": 10860, "loc": { "start": { "line": 272, @@ -59158,8 +60124,8 @@ "binop": null, "updateContext": null }, - "start": 10774, - "end": 10775, + "start": 10860, + "end": 10861, "loc": { "start": { "line": 272, @@ -59184,8 +60150,8 @@ "binop": null }, "value": "lastMouseCanvasY", - "start": 10788, - "end": 10804, + "start": 10874, + "end": 10890, "loc": { "start": { "line": 273, @@ -59211,8 +60177,8 @@ "updateContext": null }, "value": "=", - "start": 10805, - "end": 10806, + "start": 10891, + "end": 10892, "loc": { "start": { "line": 273, @@ -59237,8 +60203,8 @@ "binop": null }, "value": "e", - "start": 10807, - "end": 10808, + "start": 10893, + "end": 10894, "loc": { "start": { "line": 273, @@ -59263,8 +60229,8 @@ "binop": null, "updateContext": null }, - "start": 10808, - "end": 10809, + "start": 10894, + "end": 10895, "loc": { "start": { "line": 273, @@ -59289,8 +60255,8 @@ "binop": null }, "value": "clientY", - "start": 10809, - "end": 10816, + "start": 10895, + "end": 10902, "loc": { "start": { "line": 273, @@ -59315,8 +60281,8 @@ "binop": null, "updateContext": null }, - "start": 10816, - "end": 10817, + "start": 10902, + "end": 10903, "loc": { "start": { "line": 273, @@ -59340,8 +60306,8 @@ "postfix": false, "binop": null }, - "start": 10826, - "end": 10827, + "start": 10912, + "end": 10913, "loc": { "start": { "line": 274, @@ -59365,8 +60331,8 @@ "postfix": false, "binop": null }, - "start": 10827, - "end": 10828, + "start": 10913, + "end": 10914, "loc": { "start": { "line": 274, @@ -59391,8 +60357,8 @@ "binop": null, "updateContext": null }, - "start": 10828, - "end": 10829, + "start": 10914, + "end": 10915, "loc": { "start": { "line": 274, @@ -59417,8 +60383,8 @@ "binop": null }, "value": "canvas", - "start": 10838, - "end": 10844, + "start": 10924, + "end": 10930, "loc": { "start": { "line": 275, @@ -59443,8 +60409,8 @@ "binop": null, "updateContext": null }, - "start": 10844, - "end": 10845, + "start": 10930, + "end": 10931, "loc": { "start": { "line": 275, @@ -59469,8 +60435,8 @@ "binop": null }, "value": "addEventListener", - "start": 10845, - "end": 10861, + "start": 10931, + "end": 10947, "loc": { "start": { "line": 275, @@ -59494,8 +60460,8 @@ "postfix": false, "binop": null }, - "start": 10861, - "end": 10862, + "start": 10947, + "end": 10948, "loc": { "start": { "line": 275, @@ -59521,8 +60487,8 @@ "updateContext": null }, "value": "mouseup", - "start": 10862, - "end": 10871, + "start": 10948, + "end": 10957, "loc": { "start": { "line": 275, @@ -59547,8 +60513,8 @@ "binop": null, "updateContext": null }, - "start": 10871, - "end": 10872, + "start": 10957, + "end": 10958, "loc": { "start": { "line": 275, @@ -59575,8 +60541,8 @@ "updateContext": null }, "value": "this", - "start": 10873, - "end": 10877, + "start": 10959, + "end": 10963, "loc": { "start": { "line": 275, @@ -59601,8 +60567,8 @@ "binop": null, "updateContext": null }, - "start": 10877, - "end": 10878, + "start": 10963, + "end": 10964, "loc": { "start": { "line": 275, @@ -59627,8 +60593,8 @@ "binop": null }, "value": "_onMouseUp", - "start": 10878, - "end": 10888, + "start": 10964, + "end": 10974, "loc": { "start": { "line": 275, @@ -59654,8 +60620,8 @@ "updateContext": null }, "value": "=", - "start": 10889, - "end": 10890, + "start": 10975, + "end": 10976, "loc": { "start": { "line": 275, @@ -59679,8 +60645,8 @@ "postfix": false, "binop": null }, - "start": 10890, - "end": 10891, + "start": 10976, + "end": 10977, "loc": { "start": { "line": 275, @@ -59705,8 +60671,8 @@ "binop": null }, "value": "e", - "start": 10891, - "end": 10892, + "start": 10977, + "end": 10978, "loc": { "start": { "line": 275, @@ -59730,8 +60696,8 @@ "postfix": false, "binop": null }, - "start": 10892, - "end": 10893, + "start": 10978, + "end": 10979, "loc": { "start": { "line": 275, @@ -59756,8 +60722,8 @@ "binop": null, "updateContext": null }, - "start": 10894, - "end": 10896, + "start": 10980, + "end": 10982, "loc": { "start": { "line": 275, @@ -59781,8 +60747,8 @@ "postfix": false, "binop": null }, - "start": 10897, - "end": 10898, + "start": 10983, + "end": 10984, "loc": { "start": { "line": 275, @@ -59809,8 +60775,8 @@ "updateContext": null }, "value": "if", - "start": 10911, - "end": 10913, + "start": 10997, + "end": 10999, "loc": { "start": { "line": 276, @@ -59834,8 +60800,8 @@ "postfix": false, "binop": null }, - "start": 10914, - "end": 10915, + "start": 11000, + "end": 11001, "loc": { "start": { "line": 276, @@ -59860,8 +60826,8 @@ "binop": null }, "value": "e", - "start": 10915, - "end": 10916, + "start": 11001, + "end": 11002, "loc": { "start": { "line": 276, @@ -59886,8 +60852,8 @@ "binop": null, "updateContext": null }, - "start": 10916, - "end": 10917, + "start": 11002, + "end": 11003, "loc": { "start": { "line": 276, @@ -59912,8 +60878,8 @@ "binop": null }, "value": "which", - "start": 10917, - "end": 10922, + "start": 11003, + "end": 11008, "loc": { "start": { "line": 276, @@ -59939,8 +60905,8 @@ "updateContext": null }, "value": "!==", - "start": 10923, - "end": 10926, + "start": 11009, + "end": 11012, "loc": { "start": { "line": 276, @@ -59966,8 +60932,8 @@ "updateContext": null }, "value": 1, - "start": 10927, - "end": 10928, + "start": 11013, + "end": 11014, "loc": { "start": { "line": 276, @@ -59991,8 +60957,8 @@ "postfix": false, "binop": null }, - "start": 10928, - "end": 10929, + "start": 11014, + "end": 11015, "loc": { "start": { "line": 276, @@ -60016,8 +60982,8 @@ "postfix": false, "binop": null }, - "start": 10930, - "end": 10931, + "start": 11016, + "end": 11017, "loc": { "start": { "line": 276, @@ -60044,8 +61010,8 @@ "updateContext": null }, "value": "return", - "start": 10948, - "end": 10954, + "start": 11034, + "end": 11040, "loc": { "start": { "line": 277, @@ -60070,8 +61036,8 @@ "binop": null, "updateContext": null }, - "start": 10954, - "end": 10955, + "start": 11040, + "end": 11041, "loc": { "start": { "line": 277, @@ -60095,8 +61061,8 @@ "postfix": false, "binop": null }, - "start": 10968, - "end": 10969, + "start": 11054, + "end": 11055, "loc": { "start": { "line": 278, @@ -60123,8 +61089,8 @@ "updateContext": null }, "value": "if", - "start": 10982, - "end": 10984, + "start": 11068, + "end": 11070, "loc": { "start": { "line": 279, @@ -60148,8 +61114,8 @@ "postfix": false, "binop": null }, - "start": 10985, - "end": 10986, + "start": 11071, + "end": 11072, "loc": { "start": { "line": 279, @@ -60174,8 +61140,8 @@ "binop": null }, "value": "e", - "start": 10986, - "end": 10987, + "start": 11072, + "end": 11073, "loc": { "start": { "line": 279, @@ -60200,8 +61166,8 @@ "binop": null, "updateContext": null }, - "start": 10987, - "end": 10988, + "start": 11073, + "end": 11074, "loc": { "start": { "line": 279, @@ -60226,8 +61192,8 @@ "binop": null }, "value": "clientX", - "start": 10988, - "end": 10995, + "start": 11074, + "end": 11081, "loc": { "start": { "line": 279, @@ -60253,8 +61219,8 @@ "updateContext": null }, "value": ">", - "start": 10996, - "end": 10997, + "start": 11082, + "end": 11083, "loc": { "start": { "line": 279, @@ -60279,8 +61245,8 @@ "binop": null }, "value": "lastMouseCanvasX", - "start": 10998, - "end": 11014, + "start": 11084, + "end": 11100, "loc": { "start": { "line": 279, @@ -60306,8 +61272,8 @@ "updateContext": null }, "value": "+", - "start": 11015, - "end": 11016, + "start": 11101, + "end": 11102, "loc": { "start": { "line": 279, @@ -60332,8 +61298,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11017, - "end": 11031, + "start": 11103, + "end": 11117, "loc": { "start": { "line": 279, @@ -60359,8 +61325,8 @@ "updateContext": null }, "value": "||", - "start": 11032, - "end": 11034, + "start": 11118, + "end": 11120, "loc": { "start": { "line": 279, @@ -60385,8 +61351,8 @@ "binop": null }, "value": "e", - "start": 11051, - "end": 11052, + "start": 11137, + "end": 11138, "loc": { "start": { "line": 280, @@ -60411,8 +61377,8 @@ "binop": null, "updateContext": null }, - "start": 11052, - "end": 11053, + "start": 11138, + "end": 11139, "loc": { "start": { "line": 280, @@ -60437,8 +61403,8 @@ "binop": null }, "value": "clientX", - "start": 11053, - "end": 11060, + "start": 11139, + "end": 11146, "loc": { "start": { "line": 280, @@ -60464,8 +61430,8 @@ "updateContext": null }, "value": "<", - "start": 11061, - "end": 11062, + "start": 11147, + "end": 11148, "loc": { "start": { "line": 280, @@ -60490,8 +61456,8 @@ "binop": null }, "value": "lastMouseCanvasX", - "start": 11063, - "end": 11079, + "start": 11149, + "end": 11165, "loc": { "start": { "line": 280, @@ -60517,8 +61483,8 @@ "updateContext": null }, "value": "-", - "start": 11080, - "end": 11081, + "start": 11166, + "end": 11167, "loc": { "start": { "line": 280, @@ -60543,8 +61509,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11082, - "end": 11096, + "start": 11168, + "end": 11182, "loc": { "start": { "line": 280, @@ -60570,8 +61536,8 @@ "updateContext": null }, "value": "||", - "start": 11097, - "end": 11099, + "start": 11183, + "end": 11185, "loc": { "start": { "line": 280, @@ -60596,8 +61562,8 @@ "binop": null }, "value": "e", - "start": 11116, - "end": 11117, + "start": 11202, + "end": 11203, "loc": { "start": { "line": 281, @@ -60622,8 +61588,8 @@ "binop": null, "updateContext": null }, - "start": 11117, - "end": 11118, + "start": 11203, + "end": 11204, "loc": { "start": { "line": 281, @@ -60648,8 +61614,8 @@ "binop": null }, "value": "clientY", - "start": 11118, - "end": 11125, + "start": 11204, + "end": 11211, "loc": { "start": { "line": 281, @@ -60675,8 +61641,8 @@ "updateContext": null }, "value": ">", - "start": 11126, - "end": 11127, + "start": 11212, + "end": 11213, "loc": { "start": { "line": 281, @@ -60701,8 +61667,8 @@ "binop": null }, "value": "lastMouseCanvasY", - "start": 11128, - "end": 11144, + "start": 11214, + "end": 11230, "loc": { "start": { "line": 281, @@ -60728,8 +61694,8 @@ "updateContext": null }, "value": "+", - "start": 11145, - "end": 11146, + "start": 11231, + "end": 11232, "loc": { "start": { "line": 281, @@ -60754,8 +61720,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11147, - "end": 11161, + "start": 11233, + "end": 11247, "loc": { "start": { "line": 281, @@ -60781,8 +61747,8 @@ "updateContext": null }, "value": "||", - "start": 11162, - "end": 11164, + "start": 11248, + "end": 11250, "loc": { "start": { "line": 281, @@ -60807,8 +61773,8 @@ "binop": null }, "value": "e", - "start": 11181, - "end": 11182, + "start": 11267, + "end": 11268, "loc": { "start": { "line": 282, @@ -60833,8 +61799,8 @@ "binop": null, "updateContext": null }, - "start": 11182, - "end": 11183, + "start": 11268, + "end": 11269, "loc": { "start": { "line": 282, @@ -60859,8 +61825,8 @@ "binop": null }, "value": "clientY", - "start": 11183, - "end": 11190, + "start": 11269, + "end": 11276, "loc": { "start": { "line": 282, @@ -60886,8 +61852,8 @@ "updateContext": null }, "value": "<", - "start": 11191, - "end": 11192, + "start": 11277, + "end": 11278, "loc": { "start": { "line": 282, @@ -60912,8 +61878,8 @@ "binop": null }, "value": "lastMouseCanvasY", - "start": 11193, - "end": 11209, + "start": 11279, + "end": 11295, "loc": { "start": { "line": 282, @@ -60939,8 +61905,8 @@ "updateContext": null }, "value": "-", - "start": 11210, - "end": 11211, + "start": 11296, + "end": 11297, "loc": { "start": { "line": 282, @@ -60965,8 +61931,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11212, - "end": 11226, + "start": 11298, + "end": 11312, "loc": { "start": { "line": 282, @@ -60990,8 +61956,8 @@ "postfix": false, "binop": null }, - "start": 11226, - "end": 11227, + "start": 11312, + "end": 11313, "loc": { "start": { "line": 282, @@ -61015,8 +61981,8 @@ "postfix": false, "binop": null }, - "start": 11228, - "end": 11229, + "start": 11314, + "end": 11315, "loc": { "start": { "line": 282, @@ -61043,8 +62009,8 @@ "updateContext": null }, "value": "return", - "start": 11246, - "end": 11252, + "start": 11332, + "end": 11338, "loc": { "start": { "line": 283, @@ -61069,8 +62035,8 @@ "binop": null, "updateContext": null }, - "start": 11252, - "end": 11253, + "start": 11338, + "end": 11339, "loc": { "start": { "line": 283, @@ -61094,8 +62060,8 @@ "postfix": false, "binop": null }, - "start": 11266, - "end": 11267, + "start": 11352, + "end": 11353, "loc": { "start": { "line": 284, @@ -61122,8 +62088,8 @@ "updateContext": null }, "value": "switch", - "start": 11280, - "end": 11286, + "start": 11366, + "end": 11372, "loc": { "start": { "line": 285, @@ -61147,8 +62113,8 @@ "postfix": false, "binop": null }, - "start": 11287, - "end": 11288, + "start": 11373, + "end": 11374, "loc": { "start": { "line": 285, @@ -61175,8 +62141,8 @@ "updateContext": null }, "value": "this", - "start": 11288, - "end": 11292, + "start": 11374, + "end": 11378, "loc": { "start": { "line": 285, @@ -61201,8 +62167,8 @@ "binop": null, "updateContext": null }, - "start": 11292, - "end": 11293, + "start": 11378, + "end": 11379, "loc": { "start": { "line": 285, @@ -61227,8 +62193,8 @@ "binop": null }, "value": "_mouseState", - "start": 11293, - "end": 11304, + "start": 11379, + "end": 11390, "loc": { "start": { "line": 285, @@ -61252,8 +62218,8 @@ "postfix": false, "binop": null }, - "start": 11304, - "end": 11305, + "start": 11390, + "end": 11391, "loc": { "start": { "line": 285, @@ -61277,8 +62243,8 @@ "postfix": false, "binop": null }, - "start": 11306, - "end": 11307, + "start": 11392, + "end": 11393, "loc": { "start": { "line": 285, @@ -61305,8 +62271,8 @@ "updateContext": null }, "value": "case", - "start": 11324, - "end": 11328, + "start": 11410, + "end": 11414, "loc": { "start": { "line": 286, @@ -61331,8 +62297,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 11329, - "end": 11349, + "start": 11415, + "end": 11435, "loc": { "start": { "line": 286, @@ -61357,8 +62323,8 @@ "binop": null, "updateContext": null }, - "start": 11349, - "end": 11350, + "start": 11435, + "end": 11436, "loc": { "start": { "line": 286, @@ -61385,8 +62351,8 @@ "updateContext": null }, "value": "if", - "start": 11371, - "end": 11373, + "start": 11457, + "end": 11459, "loc": { "start": { "line": 287, @@ -61410,8 +62376,8 @@ "postfix": false, "binop": null }, - "start": 11374, - "end": 11375, + "start": 11460, + "end": 11461, "loc": { "start": { "line": 287, @@ -61436,8 +62402,8 @@ "binop": null }, "value": "mouseHovering", - "start": 11375, - "end": 11388, + "start": 11461, + "end": 11474, "loc": { "start": { "line": 287, @@ -61461,8 +62427,8 @@ "postfix": false, "binop": null }, - "start": 11388, - "end": 11389, + "start": 11474, + "end": 11475, "loc": { "start": { "line": 287, @@ -61486,8 +62452,8 @@ "postfix": false, "binop": null }, - "start": 11390, - "end": 11391, + "start": 11476, + "end": 11477, "loc": { "start": { "line": 287, @@ -61514,8 +62480,8 @@ "updateContext": null }, "value": "this", - "start": 11416, - "end": 11420, + "start": 11502, + "end": 11506, "loc": { "start": { "line": 288, @@ -61540,8 +62506,8 @@ "binop": null, "updateContext": null }, - "start": 11420, - "end": 11421, + "start": 11506, + "end": 11507, "loc": { "start": { "line": 288, @@ -61566,8 +62532,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 11421, - "end": 11445, + "start": 11507, + "end": 11531, "loc": { "start": { "line": 288, @@ -61593,8 +62559,8 @@ "updateContext": null }, "value": "=", - "start": 11446, - "end": 11447, + "start": 11532, + "end": 11533, "loc": { "start": { "line": 288, @@ -61621,8 +62587,8 @@ "updateContext": null }, "value": "this", - "start": 11448, - "end": 11452, + "start": 11534, + "end": 11538, "loc": { "start": { "line": 288, @@ -61647,8 +62613,8 @@ "binop": null, "updateContext": null }, - "start": 11452, - "end": 11453, + "start": 11538, + "end": 11539, "loc": { "start": { "line": 288, @@ -61673,8 +62639,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 11453, - "end": 11476, + "start": 11539, + "end": 11562, "loc": { "start": { "line": 288, @@ -61699,8 +62665,8 @@ "binop": null, "updateContext": null }, - "start": 11476, - "end": 11477, + "start": 11562, + "end": 11563, "loc": { "start": { "line": 288, @@ -61725,8 +62691,8 @@ "binop": null }, "value": "createMeasurement", - "start": 11477, - "end": 11494, + "start": 11563, + "end": 11580, "loc": { "start": { "line": 288, @@ -61750,8 +62716,8 @@ "postfix": false, "binop": null }, - "start": 11494, - "end": 11495, + "start": 11580, + "end": 11581, "loc": { "start": { "line": 288, @@ -61775,8 +62741,8 @@ "postfix": false, "binop": null }, - "start": 11495, - "end": 11496, + "start": 11581, + "end": 11582, "loc": { "start": { "line": 288, @@ -61801,8 +62767,8 @@ "binop": null }, "value": "id", - "start": 11525, - "end": 11527, + "start": 11611, + "end": 11613, "loc": { "start": { "line": 289, @@ -61827,8 +62793,8 @@ "binop": null, "updateContext": null }, - "start": 11527, - "end": 11528, + "start": 11613, + "end": 11614, "loc": { "start": { "line": 289, @@ -61853,8 +62819,8 @@ "binop": null }, "value": "math", - "start": 11529, - "end": 11533, + "start": 11615, + "end": 11619, "loc": { "start": { "line": 289, @@ -61879,8 +62845,8 @@ "binop": null, "updateContext": null }, - "start": 11533, - "end": 11534, + "start": 11619, + "end": 11620, "loc": { "start": { "line": 289, @@ -61905,8 +62871,8 @@ "binop": null }, "value": "createUUID", - "start": 11534, - "end": 11544, + "start": 11620, + "end": 11630, "loc": { "start": { "line": 289, @@ -61930,8 +62896,8 @@ "postfix": false, "binop": null }, - "start": 11544, - "end": 11545, + "start": 11630, + "end": 11631, "loc": { "start": { "line": 289, @@ -61955,8 +62921,8 @@ "postfix": false, "binop": null }, - "start": 11545, - "end": 11546, + "start": 11631, + "end": 11632, "loc": { "start": { "line": 289, @@ -61981,8 +62947,8 @@ "binop": null, "updateContext": null }, - "start": 11546, - "end": 11547, + "start": 11632, + "end": 11633, "loc": { "start": { "line": 289, @@ -62007,8 +62973,8 @@ "binop": null }, "value": "origin", - "start": 11576, - "end": 11582, + "start": 11662, + "end": 11668, "loc": { "start": { "line": 290, @@ -62033,8 +62999,8 @@ "binop": null, "updateContext": null }, - "start": 11582, - "end": 11583, + "start": 11668, + "end": 11669, "loc": { "start": { "line": 290, @@ -62058,8 +63024,8 @@ "postfix": false, "binop": null }, - "start": 11584, - "end": 11585, + "start": 11670, + "end": 11671, "loc": { "start": { "line": 290, @@ -62084,8 +63050,8 @@ "binop": null }, "value": "worldPos", - "start": 11618, - "end": 11626, + "start": 11704, + "end": 11712, "loc": { "start": { "line": 291, @@ -62110,8 +63076,8 @@ "binop": null, "updateContext": null }, - "start": 11626, - "end": 11627, + "start": 11712, + "end": 11713, "loc": { "start": { "line": 291, @@ -62136,8 +63102,8 @@ "binop": null }, "value": "mouseWorldPos", - "start": 11628, - "end": 11641, + "start": 11714, + "end": 11727, "loc": { "start": { "line": 291, @@ -62162,8 +63128,8 @@ "binop": null, "updateContext": null }, - "start": 11641, - "end": 11642, + "start": 11727, + "end": 11728, "loc": { "start": { "line": 291, @@ -62188,8 +63154,8 @@ "binop": null }, "value": "entity", - "start": 11675, - "end": 11681, + "start": 11761, + "end": 11767, "loc": { "start": { "line": 292, @@ -62214,8 +63180,8 @@ "binop": null, "updateContext": null }, - "start": 11681, - "end": 11682, + "start": 11767, + "end": 11768, "loc": { "start": { "line": 292, @@ -62240,8 +63206,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 11683, - "end": 11696, + "start": 11769, + "end": 11782, "loc": { "start": { "line": 292, @@ -62265,8 +63231,8 @@ "postfix": false, "binop": null }, - "start": 11725, - "end": 11726, + "start": 11811, + "end": 11812, "loc": { "start": { "line": 293, @@ -62291,8 +63257,8 @@ "binop": null, "updateContext": null }, - "start": 11726, - "end": 11727, + "start": 11812, + "end": 11813, "loc": { "start": { "line": 293, @@ -62317,8 +63283,8 @@ "binop": null }, "value": "corner", - "start": 11756, - "end": 11762, + "start": 11842, + "end": 11848, "loc": { "start": { "line": 294, @@ -62343,8 +63309,8 @@ "binop": null, "updateContext": null }, - "start": 11762, - "end": 11763, + "start": 11848, + "end": 11849, "loc": { "start": { "line": 294, @@ -62368,8 +63334,8 @@ "postfix": false, "binop": null }, - "start": 11764, - "end": 11765, + "start": 11850, + "end": 11851, "loc": { "start": { "line": 294, @@ -62394,8 +63360,8 @@ "binop": null }, "value": "worldPos", - "start": 11798, - "end": 11806, + "start": 11884, + "end": 11892, "loc": { "start": { "line": 295, @@ -62420,8 +63386,8 @@ "binop": null, "updateContext": null }, - "start": 11806, - "end": 11807, + "start": 11892, + "end": 11893, "loc": { "start": { "line": 295, @@ -62446,8 +63412,8 @@ "binop": null }, "value": "mouseWorldPos", - "start": 11808, - "end": 11821, + "start": 11894, + "end": 11907, "loc": { "start": { "line": 295, @@ -62472,8 +63438,8 @@ "binop": null, "updateContext": null }, - "start": 11821, - "end": 11822, + "start": 11907, + "end": 11908, "loc": { "start": { "line": 295, @@ -62498,8 +63464,8 @@ "binop": null }, "value": "entity", - "start": 11855, - "end": 11861, + "start": 11941, + "end": 11947, "loc": { "start": { "line": 296, @@ -62524,8 +63490,8 @@ "binop": null, "updateContext": null }, - "start": 11861, - "end": 11862, + "start": 11947, + "end": 11948, "loc": { "start": { "line": 296, @@ -62550,8 +63516,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 11863, - "end": 11876, + "start": 11949, + "end": 11962, "loc": { "start": { "line": 296, @@ -62575,8 +63541,8 @@ "postfix": false, "binop": null }, - "start": 11905, - "end": 11906, + "start": 11991, + "end": 11992, "loc": { "start": { "line": 297, @@ -62601,8 +63567,8 @@ "binop": null, "updateContext": null }, - "start": 11906, - "end": 11907, + "start": 11992, + "end": 11993, "loc": { "start": { "line": 297, @@ -62627,8 +63593,8 @@ "binop": null }, "value": "target", - "start": 11936, - "end": 11942, + "start": 12022, + "end": 12028, "loc": { "start": { "line": 298, @@ -62653,8 +63619,8 @@ "binop": null, "updateContext": null }, - "start": 11942, - "end": 11943, + "start": 12028, + "end": 12029, "loc": { "start": { "line": 298, @@ -62678,8 +63644,8 @@ "postfix": false, "binop": null }, - "start": 11944, - "end": 11945, + "start": 12030, + "end": 12031, "loc": { "start": { "line": 298, @@ -62704,8 +63670,8 @@ "binop": null }, "value": "worldPos", - "start": 11978, - "end": 11986, + "start": 12064, + "end": 12072, "loc": { "start": { "line": 299, @@ -62730,8 +63696,8 @@ "binop": null, "updateContext": null }, - "start": 11986, - "end": 11987, + "start": 12072, + "end": 12073, "loc": { "start": { "line": 299, @@ -62756,8 +63722,8 @@ "binop": null }, "value": "mouseWorldPos", - "start": 11988, - "end": 12001, + "start": 12074, + "end": 12087, "loc": { "start": { "line": 299, @@ -62782,8 +63748,8 @@ "binop": null, "updateContext": null }, - "start": 12001, - "end": 12002, + "start": 12087, + "end": 12088, "loc": { "start": { "line": 299, @@ -62808,8 +63774,8 @@ "binop": null }, "value": "entity", - "start": 12035, - "end": 12041, + "start": 12121, + "end": 12127, "loc": { "start": { "line": 300, @@ -62834,8 +63800,8 @@ "binop": null, "updateContext": null }, - "start": 12041, - "end": 12042, + "start": 12127, + "end": 12128, "loc": { "start": { "line": 300, @@ -62860,8 +63826,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 12043, - "end": 12056, + "start": 12129, + "end": 12142, "loc": { "start": { "line": 300, @@ -62885,8 +63851,8 @@ "postfix": false, "binop": null }, - "start": 12085, - "end": 12086, + "start": 12171, + "end": 12172, "loc": { "start": { "line": 301, @@ -62911,8 +63877,8 @@ "binop": null, "updateContext": null }, - "start": 12086, - "end": 12087, + "start": 12172, + "end": 12173, "loc": { "start": { "line": 301, @@ -62937,8 +63903,8 @@ "binop": null }, "value": "approximate", - "start": 12116, - "end": 12127, + "start": 12202, + "end": 12213, "loc": { "start": { "line": 302, @@ -62963,8 +63929,8 @@ "binop": null, "updateContext": null }, - "start": 12127, - "end": 12128, + "start": 12213, + "end": 12214, "loc": { "start": { "line": 302, @@ -62991,8 +63957,8 @@ "updateContext": null }, "value": "true", - "start": 12129, - "end": 12133, + "start": 12215, + "end": 12219, "loc": { "start": { "line": 302, @@ -63016,8 +63982,8 @@ "postfix": false, "binop": null }, - "start": 12158, - "end": 12159, + "start": 12244, + "end": 12245, "loc": { "start": { "line": 303, @@ -63041,8 +64007,8 @@ "postfix": false, "binop": null }, - "start": 12159, - "end": 12160, + "start": 12245, + "end": 12246, "loc": { "start": { "line": 303, @@ -63067,8 +64033,8 @@ "binop": null, "updateContext": null }, - "start": 12160, - "end": 12161, + "start": 12246, + "end": 12247, "loc": { "start": { "line": 303, @@ -63095,8 +64061,8 @@ "updateContext": null }, "value": "this", - "start": 12186, - "end": 12190, + "start": 12272, + "end": 12276, "loc": { "start": { "line": 304, @@ -63121,8 +64087,8 @@ "binop": null, "updateContext": null }, - "start": 12190, - "end": 12191, + "start": 12276, + "end": 12277, "loc": { "start": { "line": 304, @@ -63147,8 +64113,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12191, - "end": 12215, + "start": 12277, + "end": 12301, "loc": { "start": { "line": 304, @@ -63173,8 +64139,8 @@ "binop": null, "updateContext": null }, - "start": 12215, - "end": 12216, + "start": 12301, + "end": 12302, "loc": { "start": { "line": 304, @@ -63199,8 +64165,8 @@ "binop": null }, "value": "clickable", - "start": 12216, - "end": 12225, + "start": 12302, + "end": 12311, "loc": { "start": { "line": 304, @@ -63226,8 +64192,8 @@ "updateContext": null }, "value": "=", - "start": 12226, - "end": 12227, + "start": 12312, + "end": 12313, "loc": { "start": { "line": 304, @@ -63254,8 +64220,8 @@ "updateContext": null }, "value": "false", - "start": 12228, - "end": 12233, + "start": 12314, + "end": 12319, "loc": { "start": { "line": 304, @@ -63280,8 +64246,8 @@ "binop": null, "updateContext": null }, - "start": 12233, - "end": 12234, + "start": 12319, + "end": 12320, "loc": { "start": { "line": 304, @@ -63308,8 +64274,8 @@ "updateContext": null }, "value": "this", - "start": 12259, - "end": 12263, + "start": 12345, + "end": 12349, "loc": { "start": { "line": 305, @@ -63334,8 +64300,8 @@ "binop": null, "updateContext": null }, - "start": 12263, - "end": 12264, + "start": 12349, + "end": 12350, "loc": { "start": { "line": 305, @@ -63360,8 +64326,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12264, - "end": 12288, + "start": 12350, + "end": 12374, "loc": { "start": { "line": 305, @@ -63386,8 +64352,8 @@ "binop": null, "updateContext": null }, - "start": 12288, - "end": 12289, + "start": 12374, + "end": 12375, "loc": { "start": { "line": 305, @@ -63412,8 +64378,8 @@ "binop": null }, "value": "originVisible", - "start": 12289, - "end": 12302, + "start": 12375, + "end": 12388, "loc": { "start": { "line": 305, @@ -63439,8 +64405,8 @@ "updateContext": null }, "value": "=", - "start": 12303, - "end": 12304, + "start": 12389, + "end": 12390, "loc": { "start": { "line": 305, @@ -63467,8 +64433,8 @@ "updateContext": null }, "value": "true", - "start": 12305, - "end": 12309, + "start": 12391, + "end": 12395, "loc": { "start": { "line": 305, @@ -63493,8 +64459,8 @@ "binop": null, "updateContext": null }, - "start": 12309, - "end": 12310, + "start": 12395, + "end": 12396, "loc": { "start": { "line": 305, @@ -63521,8 +64487,8 @@ "updateContext": null }, "value": "this", - "start": 12335, - "end": 12339, + "start": 12421, + "end": 12425, "loc": { "start": { "line": 306, @@ -63547,8 +64513,8 @@ "binop": null, "updateContext": null }, - "start": 12339, - "end": 12340, + "start": 12425, + "end": 12426, "loc": { "start": { "line": 306, @@ -63573,8 +64539,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12340, - "end": 12364, + "start": 12426, + "end": 12450, "loc": { "start": { "line": 306, @@ -63599,8 +64565,8 @@ "binop": null, "updateContext": null }, - "start": 12364, - "end": 12365, + "start": 12450, + "end": 12451, "loc": { "start": { "line": 306, @@ -63625,8 +64591,8 @@ "binop": null }, "value": "originWireVisible", - "start": 12365, - "end": 12382, + "start": 12451, + "end": 12468, "loc": { "start": { "line": 306, @@ -63652,8 +64618,8 @@ "updateContext": null }, "value": "=", - "start": 12383, - "end": 12384, + "start": 12469, + "end": 12470, "loc": { "start": { "line": 306, @@ -63680,8 +64646,8 @@ "updateContext": null }, "value": "true", - "start": 12385, - "end": 12389, + "start": 12471, + "end": 12475, "loc": { "start": { "line": 306, @@ -63706,8 +64672,8 @@ "binop": null, "updateContext": null }, - "start": 12389, - "end": 12390, + "start": 12475, + "end": 12476, "loc": { "start": { "line": 306, @@ -63734,8 +64700,8 @@ "updateContext": null }, "value": "this", - "start": 12415, - "end": 12419, + "start": 12501, + "end": 12505, "loc": { "start": { "line": 307, @@ -63760,8 +64726,8 @@ "binop": null, "updateContext": null }, - "start": 12419, - "end": 12420, + "start": 12505, + "end": 12506, "loc": { "start": { "line": 307, @@ -63786,8 +64752,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12420, - "end": 12444, + "start": 12506, + "end": 12530, "loc": { "start": { "line": 307, @@ -63812,8 +64778,8 @@ "binop": null, "updateContext": null }, - "start": 12444, - "end": 12445, + "start": 12530, + "end": 12531, "loc": { "start": { "line": 307, @@ -63838,8 +64804,8 @@ "binop": null }, "value": "cornerVisible", - "start": 12445, - "end": 12458, + "start": 12531, + "end": 12544, "loc": { "start": { "line": 307, @@ -63865,8 +64831,8 @@ "updateContext": null }, "value": "=", - "start": 12459, - "end": 12460, + "start": 12545, + "end": 12546, "loc": { "start": { "line": 307, @@ -63893,8 +64859,8 @@ "updateContext": null }, "value": "false", - "start": 12461, - "end": 12466, + "start": 12547, + "end": 12552, "loc": { "start": { "line": 307, @@ -63919,8 +64885,8 @@ "binop": null, "updateContext": null }, - "start": 12466, - "end": 12467, + "start": 12552, + "end": 12553, "loc": { "start": { "line": 307, @@ -63947,8 +64913,8 @@ "updateContext": null }, "value": "this", - "start": 12492, - "end": 12496, + "start": 12578, + "end": 12582, "loc": { "start": { "line": 308, @@ -63973,8 +64939,8 @@ "binop": null, "updateContext": null }, - "start": 12496, - "end": 12497, + "start": 12582, + "end": 12583, "loc": { "start": { "line": 308, @@ -63999,8 +64965,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12497, - "end": 12521, + "start": 12583, + "end": 12607, "loc": { "start": { "line": 308, @@ -64025,8 +64991,8 @@ "binop": null, "updateContext": null }, - "start": 12521, - "end": 12522, + "start": 12607, + "end": 12608, "loc": { "start": { "line": 308, @@ -64051,8 +65017,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 12522, - "end": 12539, + "start": 12608, + "end": 12625, "loc": { "start": { "line": 308, @@ -64078,8 +65044,8 @@ "updateContext": null }, "value": "=", - "start": 12540, - "end": 12541, + "start": 12626, + "end": 12627, "loc": { "start": { "line": 308, @@ -64106,8 +65072,8 @@ "updateContext": null }, "value": "false", - "start": 12542, - "end": 12547, + "start": 12628, + "end": 12633, "loc": { "start": { "line": 308, @@ -64132,8 +65098,8 @@ "binop": null, "updateContext": null }, - "start": 12547, - "end": 12548, + "start": 12633, + "end": 12634, "loc": { "start": { "line": 308, @@ -64160,8 +65126,8 @@ "updateContext": null }, "value": "this", - "start": 12573, - "end": 12577, + "start": 12659, + "end": 12663, "loc": { "start": { "line": 309, @@ -64186,8 +65152,8 @@ "binop": null, "updateContext": null }, - "start": 12577, - "end": 12578, + "start": 12663, + "end": 12664, "loc": { "start": { "line": 309, @@ -64212,8 +65178,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12578, - "end": 12602, + "start": 12664, + "end": 12688, "loc": { "start": { "line": 309, @@ -64238,8 +65204,8 @@ "binop": null, "updateContext": null }, - "start": 12602, - "end": 12603, + "start": 12688, + "end": 12689, "loc": { "start": { "line": 309, @@ -64264,8 +65230,8 @@ "binop": null }, "value": "targetVisible", - "start": 12603, - "end": 12616, + "start": 12689, + "end": 12702, "loc": { "start": { "line": 309, @@ -64291,8 +65257,8 @@ "updateContext": null }, "value": "=", - "start": 12617, - "end": 12618, + "start": 12703, + "end": 12704, "loc": { "start": { "line": 309, @@ -64319,8 +65285,8 @@ "updateContext": null }, "value": "false", - "start": 12619, - "end": 12624, + "start": 12705, + "end": 12710, "loc": { "start": { "line": 309, @@ -64345,8 +65311,8 @@ "binop": null, "updateContext": null }, - "start": 12624, - "end": 12625, + "start": 12710, + "end": 12711, "loc": { "start": { "line": 309, @@ -64373,8 +65339,8 @@ "updateContext": null }, "value": "this", - "start": 12650, - "end": 12654, + "start": 12736, + "end": 12740, "loc": { "start": { "line": 310, @@ -64399,8 +65365,8 @@ "binop": null, "updateContext": null }, - "start": 12654, - "end": 12655, + "start": 12740, + "end": 12741, "loc": { "start": { "line": 310, @@ -64425,8 +65391,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12655, - "end": 12679, + "start": 12741, + "end": 12765, "loc": { "start": { "line": 310, @@ -64451,8 +65417,8 @@ "binop": null, "updateContext": null }, - "start": 12679, - "end": 12680, + "start": 12765, + "end": 12766, "loc": { "start": { "line": 310, @@ -64477,8 +65443,8 @@ "binop": null }, "value": "angleVisible", - "start": 12680, - "end": 12692, + "start": 12766, + "end": 12778, "loc": { "start": { "line": 310, @@ -64504,8 +65470,8 @@ "updateContext": null }, "value": "=", - "start": 12693, - "end": 12694, + "start": 12779, + "end": 12780, "loc": { "start": { "line": 310, @@ -64532,8 +65498,8 @@ "updateContext": null }, "value": "false", - "start": 12695, - "end": 12700, + "start": 12781, + "end": 12786, "loc": { "start": { "line": 310, @@ -64558,8 +65524,8 @@ "binop": null, "updateContext": null }, - "start": 12700, - "end": 12701, + "start": 12786, + "end": 12787, "loc": { "start": { "line": 310, @@ -64586,8 +65552,8 @@ "updateContext": null }, "value": "this", - "start": 12726, - "end": 12730, + "start": 12812, + "end": 12816, "loc": { "start": { "line": 311, @@ -64612,8 +65578,8 @@ "binop": null, "updateContext": null }, - "start": 12730, - "end": 12731, + "start": 12816, + "end": 12817, "loc": { "start": { "line": 311, @@ -64638,8 +65604,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12731, - "end": 12755, + "start": 12817, + "end": 12841, "loc": { "start": { "line": 311, @@ -64664,8 +65630,8 @@ "binop": null, "updateContext": null }, - "start": 12755, - "end": 12756, + "start": 12841, + "end": 12842, "loc": { "start": { "line": 311, @@ -64690,8 +65656,8 @@ "binop": null }, "value": "origin", - "start": 12756, - "end": 12762, + "start": 12842, + "end": 12848, "loc": { "start": { "line": 311, @@ -64716,8 +65682,8 @@ "binop": null, "updateContext": null }, - "start": 12762, - "end": 12763, + "start": 12848, + "end": 12849, "loc": { "start": { "line": 311, @@ -64742,8 +65708,8 @@ "binop": null }, "value": "entity", - "start": 12763, - "end": 12769, + "start": 12849, + "end": 12855, "loc": { "start": { "line": 311, @@ -64769,8 +65735,8 @@ "updateContext": null }, "value": "=", - "start": 12770, - "end": 12771, + "start": 12856, + "end": 12857, "loc": { "start": { "line": 311, @@ -64795,8 +65761,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 12772, - "end": 12785, + "start": 12858, + "end": 12871, "loc": { "start": { "line": 311, @@ -64821,8 +65787,8 @@ "binop": null, "updateContext": null }, - "start": 12785, - "end": 12786, + "start": 12871, + "end": 12872, "loc": { "start": { "line": 311, @@ -64849,8 +65815,8 @@ "updateContext": null }, "value": "this", - "start": 12811, - "end": 12815, + "start": 12897, + "end": 12901, "loc": { "start": { "line": 312, @@ -64875,8 +65841,8 @@ "binop": null, "updateContext": null }, - "start": 12815, - "end": 12816, + "start": 12901, + "end": 12902, "loc": { "start": { "line": 312, @@ -64901,8 +65867,8 @@ "binop": null }, "value": "_mouseState", - "start": 12816, - "end": 12827, + "start": 12902, + "end": 12913, "loc": { "start": { "line": 312, @@ -64928,8 +65894,8 @@ "updateContext": null }, "value": "=", - "start": 12828, - "end": 12829, + "start": 12914, + "end": 12915, "loc": { "start": { "line": 312, @@ -64954,8 +65920,8 @@ "binop": null }, "value": "MOUSE_FINDING_CORNER", - "start": 12830, - "end": 12850, + "start": 12916, + "end": 12936, "loc": { "start": { "line": 312, @@ -64980,8 +65946,8 @@ "binop": null, "updateContext": null }, - "start": 12850, - "end": 12851, + "start": 12936, + "end": 12937, "loc": { "start": { "line": 312, @@ -65008,8 +65974,8 @@ "updateContext": null }, "value": "this", - "start": 12876, - "end": 12880, + "start": 12962, + "end": 12966, "loc": { "start": { "line": 313, @@ -65034,8 +66000,8 @@ "binop": null, "updateContext": null }, - "start": 12880, - "end": 12881, + "start": 12966, + "end": 12967, "loc": { "start": { "line": 313, @@ -65060,8 +66026,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 12881, - "end": 12904, + "start": 12967, + "end": 12990, "loc": { "start": { "line": 313, @@ -65086,8 +66052,8 @@ "binop": null, "updateContext": null }, - "start": 12904, - "end": 12905, + "start": 12990, + "end": 12991, "loc": { "start": { "line": 313, @@ -65112,8 +66078,8 @@ "binop": null }, "value": "fire", - "start": 12905, - "end": 12909, + "start": 12991, + "end": 12995, "loc": { "start": { "line": 313, @@ -65137,8 +66103,8 @@ "postfix": false, "binop": null }, - "start": 12909, - "end": 12910, + "start": 12995, + "end": 12996, "loc": { "start": { "line": 313, @@ -65164,8 +66130,8 @@ "updateContext": null }, "value": "measurementStart", - "start": 12910, - "end": 12928, + "start": 12996, + "end": 13014, "loc": { "start": { "line": 313, @@ -65190,8 +66156,8 @@ "binop": null, "updateContext": null }, - "start": 12928, - "end": 12929, + "start": 13014, + "end": 13015, "loc": { "start": { "line": 313, @@ -65218,8 +66184,8 @@ "updateContext": null }, "value": "this", - "start": 12930, - "end": 12934, + "start": 13016, + "end": 13020, "loc": { "start": { "line": 313, @@ -65244,8 +66210,8 @@ "binop": null, "updateContext": null }, - "start": 12934, - "end": 12935, + "start": 13020, + "end": 13021, "loc": { "start": { "line": 313, @@ -65270,8 +66236,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 12935, - "end": 12959, + "start": 13021, + "end": 13045, "loc": { "start": { "line": 313, @@ -65295,8 +66261,8 @@ "postfix": false, "binop": null }, - "start": 12959, - "end": 12960, + "start": 13045, + "end": 13046, "loc": { "start": { "line": 313, @@ -65321,8 +66287,8 @@ "binop": null, "updateContext": null }, - "start": 12960, - "end": 12961, + "start": 13046, + "end": 13047, "loc": { "start": { "line": 313, @@ -65346,8 +66312,8 @@ "postfix": false, "binop": null }, - "start": 12982, - "end": 12983, + "start": 13068, + "end": 13069, "loc": { "start": { "line": 314, @@ -65374,8 +66340,8 @@ "updateContext": null }, "value": "break", - "start": 13004, - "end": 13009, + "start": 13090, + "end": 13095, "loc": { "start": { "line": 315, @@ -65400,8 +66366,8 @@ "binop": null, "updateContext": null }, - "start": 13009, - "end": 13010, + "start": 13095, + "end": 13096, "loc": { "start": { "line": 315, @@ -65428,8 +66394,8 @@ "updateContext": null }, "value": "case", - "start": 13027, - "end": 13031, + "start": 13113, + "end": 13117, "loc": { "start": { "line": 316, @@ -65454,8 +66420,8 @@ "binop": null }, "value": "MOUSE_FINDING_CORNER", - "start": 13032, - "end": 13052, + "start": 13118, + "end": 13138, "loc": { "start": { "line": 316, @@ -65480,8 +66446,8 @@ "binop": null, "updateContext": null }, - "start": 13052, - "end": 13053, + "start": 13138, + "end": 13139, "loc": { "start": { "line": 316, @@ -65508,8 +66474,8 @@ "updateContext": null }, "value": "if", - "start": 13074, - "end": 13076, + "start": 13160, + "end": 13162, "loc": { "start": { "line": 317, @@ -65533,8 +66499,8 @@ "postfix": false, "binop": null }, - "start": 13077, - "end": 13078, + "start": 13163, + "end": 13164, "loc": { "start": { "line": 317, @@ -65559,8 +66525,8 @@ "binop": null }, "value": "mouseHovering", - "start": 13078, - "end": 13091, + "start": 13164, + "end": 13177, "loc": { "start": { "line": 317, @@ -65584,8 +66550,8 @@ "postfix": false, "binop": null }, - "start": 13091, - "end": 13092, + "start": 13177, + "end": 13178, "loc": { "start": { "line": 317, @@ -65609,8 +66575,8 @@ "postfix": false, "binop": null }, - "start": 13093, - "end": 13094, + "start": 13179, + "end": 13180, "loc": { "start": { "line": 317, @@ -65637,8 +66603,8 @@ "updateContext": null }, "value": "this", - "start": 13119, - "end": 13123, + "start": 13205, + "end": 13209, "loc": { "start": { "line": 318, @@ -65663,8 +66629,8 @@ "binop": null, "updateContext": null }, - "start": 13123, - "end": 13124, + "start": 13209, + "end": 13210, "loc": { "start": { "line": 318, @@ -65689,8 +66655,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13124, - "end": 13148, + "start": 13210, + "end": 13234, "loc": { "start": { "line": 318, @@ -65715,8 +66681,8 @@ "binop": null, "updateContext": null }, - "start": 13148, - "end": 13149, + "start": 13234, + "end": 13235, "loc": { "start": { "line": 318, @@ -65741,8 +66707,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 13149, - "end": 13166, + "start": 13235, + "end": 13252, "loc": { "start": { "line": 318, @@ -65768,8 +66734,8 @@ "updateContext": null }, "value": "=", - "start": 13167, - "end": 13168, + "start": 13253, + "end": 13254, "loc": { "start": { "line": 318, @@ -65796,8 +66762,8 @@ "updateContext": null }, "value": "false", - "start": 13169, - "end": 13174, + "start": 13255, + "end": 13260, "loc": { "start": { "line": 318, @@ -65822,8 +66788,8 @@ "binop": null, "updateContext": null }, - "start": 13174, - "end": 13175, + "start": 13260, + "end": 13261, "loc": { "start": { "line": 318, @@ -65850,8 +66816,8 @@ "updateContext": null }, "value": "this", - "start": 13200, - "end": 13204, + "start": 13286, + "end": 13290, "loc": { "start": { "line": 319, @@ -65876,8 +66842,8 @@ "binop": null, "updateContext": null }, - "start": 13204, - "end": 13205, + "start": 13290, + "end": 13291, "loc": { "start": { "line": 319, @@ -65902,8 +66868,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13205, - "end": 13229, + "start": 13291, + "end": 13315, "loc": { "start": { "line": 319, @@ -65928,8 +66894,8 @@ "binop": null, "updateContext": null }, - "start": 13229, - "end": 13230, + "start": 13315, + "end": 13316, "loc": { "start": { "line": 319, @@ -65954,8 +66920,8 @@ "binop": null }, "value": "targetVisible", - "start": 13230, - "end": 13243, + "start": 13316, + "end": 13329, "loc": { "start": { "line": 319, @@ -65981,8 +66947,8 @@ "updateContext": null }, "value": "=", - "start": 13244, - "end": 13245, + "start": 13330, + "end": 13331, "loc": { "start": { "line": 319, @@ -66009,8 +66975,8 @@ "updateContext": null }, "value": "true", - "start": 13246, - "end": 13250, + "start": 13332, + "end": 13336, "loc": { "start": { "line": 319, @@ -66035,8 +67001,8 @@ "binop": null, "updateContext": null }, - "start": 13250, - "end": 13251, + "start": 13336, + "end": 13337, "loc": { "start": { "line": 319, @@ -66063,8 +67029,8 @@ "updateContext": null }, "value": "this", - "start": 13276, - "end": 13280, + "start": 13362, + "end": 13366, "loc": { "start": { "line": 320, @@ -66089,8 +67055,8 @@ "binop": null, "updateContext": null }, - "start": 13280, - "end": 13281, + "start": 13366, + "end": 13367, "loc": { "start": { "line": 320, @@ -66115,8 +67081,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13281, - "end": 13305, + "start": 13367, + "end": 13391, "loc": { "start": { "line": 320, @@ -66141,8 +67107,8 @@ "binop": null, "updateContext": null }, - "start": 13305, - "end": 13306, + "start": 13391, + "end": 13392, "loc": { "start": { "line": 320, @@ -66167,8 +67133,8 @@ "binop": null }, "value": "angleVisible", - "start": 13306, - "end": 13318, + "start": 13392, + "end": 13404, "loc": { "start": { "line": 320, @@ -66194,8 +67160,8 @@ "updateContext": null }, "value": "=", - "start": 13319, - "end": 13320, + "start": 13405, + "end": 13406, "loc": { "start": { "line": 320, @@ -66222,8 +67188,8 @@ "updateContext": null }, "value": "true", - "start": 13321, - "end": 13325, + "start": 13407, + "end": 13411, "loc": { "start": { "line": 320, @@ -66248,8 +67214,8 @@ "binop": null, "updateContext": null }, - "start": 13325, - "end": 13326, + "start": 13411, + "end": 13412, "loc": { "start": { "line": 320, @@ -66276,8 +67242,8 @@ "updateContext": null }, "value": "this", - "start": 13351, - "end": 13355, + "start": 13437, + "end": 13441, "loc": { "start": { "line": 321, @@ -66302,8 +67268,8 @@ "binop": null, "updateContext": null }, - "start": 13355, - "end": 13356, + "start": 13441, + "end": 13442, "loc": { "start": { "line": 321, @@ -66328,8 +67294,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13356, - "end": 13380, + "start": 13442, + "end": 13466, "loc": { "start": { "line": 321, @@ -66354,8 +67320,8 @@ "binop": null, "updateContext": null }, - "start": 13380, - "end": 13381, + "start": 13466, + "end": 13467, "loc": { "start": { "line": 321, @@ -66380,8 +67346,8 @@ "binop": null }, "value": "corner", - "start": 13381, - "end": 13387, + "start": 13467, + "end": 13473, "loc": { "start": { "line": 321, @@ -66406,8 +67372,8 @@ "binop": null, "updateContext": null }, - "start": 13387, - "end": 13388, + "start": 13473, + "end": 13474, "loc": { "start": { "line": 321, @@ -66432,8 +67398,8 @@ "binop": null }, "value": "entity", - "start": 13388, - "end": 13394, + "start": 13474, + "end": 13480, "loc": { "start": { "line": 321, @@ -66459,8 +67425,8 @@ "updateContext": null }, "value": "=", - "start": 13395, - "end": 13396, + "start": 13481, + "end": 13482, "loc": { "start": { "line": 321, @@ -66485,8 +67451,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 13397, - "end": 13410, + "start": 13483, + "end": 13496, "loc": { "start": { "line": 321, @@ -66511,8 +67477,8 @@ "binop": null, "updateContext": null }, - "start": 13410, - "end": 13411, + "start": 13496, + "end": 13497, "loc": { "start": { "line": 321, @@ -66539,8 +67505,8 @@ "updateContext": null }, "value": "this", - "start": 13436, - "end": 13440, + "start": 13522, + "end": 13526, "loc": { "start": { "line": 322, @@ -66565,8 +67531,8 @@ "binop": null, "updateContext": null }, - "start": 13440, - "end": 13441, + "start": 13526, + "end": 13527, "loc": { "start": { "line": 322, @@ -66591,8 +67557,8 @@ "binop": null }, "value": "_mouseState", - "start": 13441, - "end": 13452, + "start": 13527, + "end": 13538, "loc": { "start": { "line": 322, @@ -66618,8 +67584,8 @@ "updateContext": null }, "value": "=", - "start": 13453, - "end": 13454, + "start": 13539, + "end": 13540, "loc": { "start": { "line": 322, @@ -66644,8 +67610,8 @@ "binop": null }, "value": "MOUSE_FINDING_TARGET", - "start": 13455, - "end": 13475, + "start": 13541, + "end": 13561, "loc": { "start": { "line": 322, @@ -66670,8 +67636,8 @@ "binop": null, "updateContext": null }, - "start": 13475, - "end": 13476, + "start": 13561, + "end": 13562, "loc": { "start": { "line": 322, @@ -66695,8 +67661,8 @@ "postfix": false, "binop": null }, - "start": 13497, - "end": 13498, + "start": 13583, + "end": 13584, "loc": { "start": { "line": 323, @@ -66723,8 +67689,8 @@ "updateContext": null }, "value": "else", - "start": 13499, - "end": 13503, + "start": 13585, + "end": 13589, "loc": { "start": { "line": 323, @@ -66748,8 +67714,8 @@ "postfix": false, "binop": null }, - "start": 13504, - "end": 13505, + "start": 13590, + "end": 13591, "loc": { "start": { "line": 323, @@ -66776,8 +67742,8 @@ "updateContext": null }, "value": "if", - "start": 13530, - "end": 13532, + "start": 13616, + "end": 13618, "loc": { "start": { "line": 324, @@ -66801,8 +67767,8 @@ "postfix": false, "binop": null }, - "start": 13533, - "end": 13534, + "start": 13619, + "end": 13620, "loc": { "start": { "line": 324, @@ -66829,8 +67795,8 @@ "updateContext": null }, "value": "this", - "start": 13534, - "end": 13538, + "start": 13620, + "end": 13624, "loc": { "start": { "line": 324, @@ -66855,8 +67821,8 @@ "binop": null, "updateContext": null }, - "start": 13538, - "end": 13539, + "start": 13624, + "end": 13625, "loc": { "start": { "line": 324, @@ -66881,8 +67847,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13539, - "end": 13563, + "start": 13625, + "end": 13649, "loc": { "start": { "line": 324, @@ -66906,8 +67872,8 @@ "postfix": false, "binop": null }, - "start": 13563, - "end": 13564, + "start": 13649, + "end": 13650, "loc": { "start": { "line": 324, @@ -66931,8 +67897,8 @@ "postfix": false, "binop": null }, - "start": 13565, - "end": 13566, + "start": 13651, + "end": 13652, "loc": { "start": { "line": 324, @@ -66959,8 +67925,8 @@ "updateContext": null }, "value": "this", - "start": 13595, - "end": 13599, + "start": 13681, + "end": 13685, "loc": { "start": { "line": 325, @@ -66985,8 +67951,8 @@ "binop": null, "updateContext": null }, - "start": 13599, - "end": 13600, + "start": 13685, + "end": 13686, "loc": { "start": { "line": 325, @@ -67011,8 +67977,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13600, - "end": 13624, + "start": 13686, + "end": 13710, "loc": { "start": { "line": 325, @@ -67037,8 +68003,8 @@ "binop": null, "updateContext": null }, - "start": 13624, - "end": 13625, + "start": 13710, + "end": 13711, "loc": { "start": { "line": 325, @@ -67063,8 +68029,8 @@ "binop": null }, "value": "destroy", - "start": 13625, - "end": 13632, + "start": 13711, + "end": 13718, "loc": { "start": { "line": 325, @@ -67088,8 +68054,8 @@ "postfix": false, "binop": null }, - "start": 13632, - "end": 13633, + "start": 13718, + "end": 13719, "loc": { "start": { "line": 325, @@ -67113,8 +68079,8 @@ "postfix": false, "binop": null }, - "start": 13633, - "end": 13634, + "start": 13719, + "end": 13720, "loc": { "start": { "line": 325, @@ -67139,8 +68105,8 @@ "binop": null, "updateContext": null }, - "start": 13634, - "end": 13635, + "start": 13720, + "end": 13721, "loc": { "start": { "line": 325, @@ -67167,8 +68133,8 @@ "updateContext": null }, "value": "this", - "start": 13664, - "end": 13668, + "start": 13750, + "end": 13754, "loc": { "start": { "line": 326, @@ -67193,8 +68159,8 @@ "binop": null, "updateContext": null }, - "start": 13668, - "end": 13669, + "start": 13754, + "end": 13755, "loc": { "start": { "line": 326, @@ -67219,8 +68185,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13669, - "end": 13693, + "start": 13755, + "end": 13779, "loc": { "start": { "line": 326, @@ -67246,8 +68212,8 @@ "updateContext": null }, "value": "=", - "start": 13694, - "end": 13695, + "start": 13780, + "end": 13781, "loc": { "start": { "line": 326, @@ -67274,8 +68240,8 @@ "updateContext": null }, "value": "null", - "start": 13696, - "end": 13700, + "start": 13782, + "end": 13786, "loc": { "start": { "line": 326, @@ -67300,8 +68266,8 @@ "binop": null, "updateContext": null }, - "start": 13700, - "end": 13701, + "start": 13786, + "end": 13787, "loc": { "start": { "line": 326, @@ -67326,8 +68292,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 13730, - "end": 13743, + "start": 13816, + "end": 13829, "loc": { "start": { "line": 327, @@ -67353,8 +68319,8 @@ "updateContext": null }, "value": "=", - "start": 13744, - "end": 13745, + "start": 13830, + "end": 13831, "loc": { "start": { "line": 327, @@ -67381,8 +68347,8 @@ "updateContext": null }, "value": "null", - "start": 13746, - "end": 13750, + "start": 13832, + "end": 13836, "loc": { "start": { "line": 327, @@ -67407,8 +68373,8 @@ "binop": null, "updateContext": null }, - "start": 13750, - "end": 13751, + "start": 13836, + "end": 13837, "loc": { "start": { "line": 327, @@ -67435,8 +68401,8 @@ "updateContext": null }, "value": "this", - "start": 13780, - "end": 13784, + "start": 13866, + "end": 13870, "loc": { "start": { "line": 328, @@ -67461,8 +68427,8 @@ "binop": null, "updateContext": null }, - "start": 13784, - "end": 13785, + "start": 13870, + "end": 13871, "loc": { "start": { "line": 328, @@ -67487,8 +68453,8 @@ "binop": null }, "value": "_mouseState", - "start": 13785, - "end": 13796, + "start": 13871, + "end": 13882, "loc": { "start": { "line": 328, @@ -67514,8 +68480,8 @@ "updateContext": null }, "value": "=", - "start": 13797, - "end": 13798, + "start": 13883, + "end": 13884, "loc": { "start": { "line": 328, @@ -67540,8 +68506,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 13799, - "end": 13819, + "start": 13885, + "end": 13905, "loc": { "start": { "line": 328, @@ -67568,8 +68534,8 @@ "updateContext": null }, "value": "this", - "start": 13848, - "end": 13852, + "start": 13934, + "end": 13938, "loc": { "start": { "line": 329, @@ -67594,8 +68560,8 @@ "binop": null, "updateContext": null }, - "start": 13852, - "end": 13853, + "start": 13938, + "end": 13939, "loc": { "start": { "line": 329, @@ -67620,8 +68586,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 13853, - "end": 13876, + "start": 13939, + "end": 13962, "loc": { "start": { "line": 329, @@ -67646,8 +68612,8 @@ "binop": null, "updateContext": null }, - "start": 13876, - "end": 13877, + "start": 13962, + "end": 13963, "loc": { "start": { "line": 329, @@ -67672,8 +68638,8 @@ "binop": null }, "value": "fire", - "start": 13877, - "end": 13881, + "start": 13963, + "end": 13967, "loc": { "start": { "line": 329, @@ -67697,8 +68663,8 @@ "postfix": false, "binop": null }, - "start": 13881, - "end": 13882, + "start": 13967, + "end": 13968, "loc": { "start": { "line": 329, @@ -67724,8 +68690,8 @@ "updateContext": null }, "value": "measurementCancel", - "start": 13882, - "end": 13901, + "start": 13968, + "end": 13987, "loc": { "start": { "line": 329, @@ -67750,8 +68716,8 @@ "binop": null, "updateContext": null }, - "start": 13901, - "end": 13902, + "start": 13987, + "end": 13988, "loc": { "start": { "line": 329, @@ -67778,8 +68744,8 @@ "updateContext": null }, "value": "this", - "start": 13903, - "end": 13907, + "start": 13989, + "end": 13993, "loc": { "start": { "line": 329, @@ -67804,8 +68770,8 @@ "binop": null, "updateContext": null }, - "start": 13907, - "end": 13908, + "start": 13993, + "end": 13994, "loc": { "start": { "line": 329, @@ -67830,8 +68796,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 13908, - "end": 13932, + "start": 13994, + "end": 14018, "loc": { "start": { "line": 329, @@ -67855,8 +68821,8 @@ "postfix": false, "binop": null }, - "start": 13932, - "end": 13933, + "start": 14018, + "end": 14019, "loc": { "start": { "line": 329, @@ -67881,8 +68847,8 @@ "binop": null, "updateContext": null }, - "start": 13933, - "end": 13934, + "start": 14019, + "end": 14020, "loc": { "start": { "line": 329, @@ -67906,8 +68872,8 @@ "postfix": false, "binop": null }, - "start": 13959, - "end": 13960, + "start": 14045, + "end": 14046, "loc": { "start": { "line": 330, @@ -67931,8 +68897,8 @@ "postfix": false, "binop": null }, - "start": 13981, - "end": 13982, + "start": 14067, + "end": 14068, "loc": { "start": { "line": 331, @@ -67959,8 +68925,8 @@ "updateContext": null }, "value": "break", - "start": 14003, - "end": 14008, + "start": 14089, + "end": 14094, "loc": { "start": { "line": 332, @@ -67985,8 +68951,8 @@ "binop": null, "updateContext": null }, - "start": 14008, - "end": 14009, + "start": 14094, + "end": 14095, "loc": { "start": { "line": 332, @@ -68013,8 +68979,8 @@ "updateContext": null }, "value": "case", - "start": 14026, - "end": 14030, + "start": 14112, + "end": 14116, "loc": { "start": { "line": 333, @@ -68039,8 +69005,8 @@ "binop": null }, "value": "MOUSE_FINDING_TARGET", - "start": 14031, - "end": 14051, + "start": 14117, + "end": 14137, "loc": { "start": { "line": 333, @@ -68065,8 +69031,8 @@ "binop": null, "updateContext": null }, - "start": 14051, - "end": 14052, + "start": 14137, + "end": 14138, "loc": { "start": { "line": 333, @@ -68093,8 +69059,8 @@ "updateContext": null }, "value": "if", - "start": 14073, - "end": 14075, + "start": 14159, + "end": 14161, "loc": { "start": { "line": 334, @@ -68118,8 +69084,8 @@ "postfix": false, "binop": null }, - "start": 14076, - "end": 14077, + "start": 14162, + "end": 14163, "loc": { "start": { "line": 334, @@ -68144,8 +69110,8 @@ "binop": null }, "value": "mouseHovering", - "start": 14077, - "end": 14090, + "start": 14163, + "end": 14176, "loc": { "start": { "line": 334, @@ -68169,8 +69135,8 @@ "postfix": false, "binop": null }, - "start": 14090, - "end": 14091, + "start": 14176, + "end": 14177, "loc": { "start": { "line": 334, @@ -68194,8 +69160,8 @@ "postfix": false, "binop": null }, - "start": 14092, - "end": 14093, + "start": 14178, + "end": 14179, "loc": { "start": { "line": 334, @@ -68222,8 +69188,8 @@ "updateContext": null }, "value": "this", - "start": 14118, - "end": 14122, + "start": 14204, + "end": 14208, "loc": { "start": { "line": 335, @@ -68248,8 +69214,8 @@ "binop": null, "updateContext": null }, - "start": 14122, - "end": 14123, + "start": 14208, + "end": 14209, "loc": { "start": { "line": 335, @@ -68274,8 +69240,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14123, - "end": 14147, + "start": 14209, + "end": 14233, "loc": { "start": { "line": 335, @@ -68300,8 +69266,8 @@ "binop": null, "updateContext": null }, - "start": 14147, - "end": 14148, + "start": 14233, + "end": 14234, "loc": { "start": { "line": 335, @@ -68326,8 +69292,8 @@ "binop": null }, "value": "targetVisible", - "start": 14148, - "end": 14161, + "start": 14234, + "end": 14247, "loc": { "start": { "line": 335, @@ -68353,8 +69319,8 @@ "updateContext": null }, "value": "=", - "start": 14162, - "end": 14163, + "start": 14248, + "end": 14249, "loc": { "start": { "line": 335, @@ -68381,8 +69347,8 @@ "updateContext": null }, "value": "true", - "start": 14164, - "end": 14168, + "start": 14250, + "end": 14254, "loc": { "start": { "line": 335, @@ -68407,8 +69373,8 @@ "binop": null, "updateContext": null }, - "start": 14168, - "end": 14169, + "start": 14254, + "end": 14255, "loc": { "start": { "line": 335, @@ -68435,8 +69401,8 @@ "updateContext": null }, "value": "this", - "start": 14194, - "end": 14198, + "start": 14280, + "end": 14284, "loc": { "start": { "line": 336, @@ -68461,8 +69427,8 @@ "binop": null, "updateContext": null }, - "start": 14198, - "end": 14199, + "start": 14284, + "end": 14285, "loc": { "start": { "line": 336, @@ -68487,8 +69453,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14199, - "end": 14223, + "start": 14285, + "end": 14309, "loc": { "start": { "line": 336, @@ -68513,8 +69479,8 @@ "binop": null, "updateContext": null }, - "start": 14223, - "end": 14224, + "start": 14309, + "end": 14310, "loc": { "start": { "line": 336, @@ -68539,8 +69505,8 @@ "binop": null }, "value": "angleVisible", - "start": 14224, - "end": 14236, + "start": 14310, + "end": 14322, "loc": { "start": { "line": 336, @@ -68566,8 +69532,8 @@ "updateContext": null }, "value": "=", - "start": 14237, - "end": 14238, + "start": 14323, + "end": 14324, "loc": { "start": { "line": 336, @@ -68594,8 +69560,8 @@ "updateContext": null }, "value": "true", - "start": 14239, - "end": 14243, + "start": 14325, + "end": 14329, "loc": { "start": { "line": 336, @@ -68620,8 +69586,8 @@ "binop": null, "updateContext": null }, - "start": 14243, - "end": 14244, + "start": 14329, + "end": 14330, "loc": { "start": { "line": 336, @@ -68648,8 +69614,8 @@ "updateContext": null }, "value": "this", - "start": 14269, - "end": 14273, + "start": 14355, + "end": 14359, "loc": { "start": { "line": 337, @@ -68674,8 +69640,8 @@ "binop": null, "updateContext": null }, - "start": 14273, - "end": 14274, + "start": 14359, + "end": 14360, "loc": { "start": { "line": 337, @@ -68700,8 +69666,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14274, - "end": 14298, + "start": 14360, + "end": 14384, "loc": { "start": { "line": 337, @@ -68726,8 +69692,8 @@ "binop": null, "updateContext": null }, - "start": 14298, - "end": 14299, + "start": 14384, + "end": 14385, "loc": { "start": { "line": 337, @@ -68752,8 +69718,8 @@ "binop": null }, "value": "target", - "start": 14299, - "end": 14305, + "start": 14385, + "end": 14391, "loc": { "start": { "line": 337, @@ -68778,8 +69744,8 @@ "binop": null, "updateContext": null }, - "start": 14305, - "end": 14306, + "start": 14391, + "end": 14392, "loc": { "start": { "line": 337, @@ -68804,8 +69770,8 @@ "binop": null }, "value": "entity", - "start": 14306, - "end": 14312, + "start": 14392, + "end": 14398, "loc": { "start": { "line": 337, @@ -68831,8 +69797,8 @@ "updateContext": null }, "value": "=", - "start": 14313, - "end": 14314, + "start": 14399, + "end": 14400, "loc": { "start": { "line": 337, @@ -68857,8 +69823,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 14315, - "end": 14328, + "start": 14401, + "end": 14414, "loc": { "start": { "line": 337, @@ -68883,8 +69849,8 @@ "binop": null, "updateContext": null }, - "start": 14328, - "end": 14329, + "start": 14414, + "end": 14415, "loc": { "start": { "line": 337, @@ -68911,8 +69877,8 @@ "updateContext": null }, "value": "this", - "start": 14354, - "end": 14358, + "start": 14440, + "end": 14444, "loc": { "start": { "line": 338, @@ -68937,8 +69903,8 @@ "binop": null, "updateContext": null }, - "start": 14358, - "end": 14359, + "start": 14444, + "end": 14445, "loc": { "start": { "line": 338, @@ -68963,8 +69929,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14359, - "end": 14383, + "start": 14445, + "end": 14469, "loc": { "start": { "line": 338, @@ -68989,8 +69955,8 @@ "binop": null, "updateContext": null }, - "start": 14383, - "end": 14384, + "start": 14469, + "end": 14470, "loc": { "start": { "line": 338, @@ -69015,8 +69981,8 @@ "binop": null }, "value": "clickable", - "start": 14384, - "end": 14393, + "start": 14470, + "end": 14479, "loc": { "start": { "line": 338, @@ -69042,8 +70008,8 @@ "updateContext": null }, "value": "=", - "start": 14394, - "end": 14395, + "start": 14480, + "end": 14481, "loc": { "start": { "line": 338, @@ -69070,8 +70036,8 @@ "updateContext": null }, "value": "true", - "start": 14396, - "end": 14400, + "start": 14482, + "end": 14486, "loc": { "start": { "line": 338, @@ -69096,8 +70062,8 @@ "binop": null, "updateContext": null }, - "start": 14400, - "end": 14401, + "start": 14486, + "end": 14487, "loc": { "start": { "line": 338, @@ -69122,8 +70088,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 14426, - "end": 14439, + "start": 14512, + "end": 14525, "loc": { "start": { "line": 339, @@ -69149,8 +70115,8 @@ "updateContext": null }, "value": "=", - "start": 14440, - "end": 14441, + "start": 14526, + "end": 14527, "loc": { "start": { "line": 339, @@ -69177,8 +70143,8 @@ "updateContext": null }, "value": "null", - "start": 14442, - "end": 14446, + "start": 14528, + "end": 14532, "loc": { "start": { "line": 339, @@ -69203,8 +70169,8 @@ "binop": null, "updateContext": null }, - "start": 14446, - "end": 14447, + "start": 14532, + "end": 14533, "loc": { "start": { "line": 339, @@ -69231,8 +70197,8 @@ "updateContext": null }, "value": "this", - "start": 14472, - "end": 14476, + "start": 14558, + "end": 14562, "loc": { "start": { "line": 340, @@ -69257,8 +70223,8 @@ "binop": null, "updateContext": null }, - "start": 14476, - "end": 14477, + "start": 14562, + "end": 14563, "loc": { "start": { "line": 340, @@ -69283,8 +70249,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 14477, - "end": 14500, + "start": 14563, + "end": 14586, "loc": { "start": { "line": 340, @@ -69309,8 +70275,8 @@ "binop": null, "updateContext": null }, - "start": 14500, - "end": 14501, + "start": 14586, + "end": 14587, "loc": { "start": { "line": 340, @@ -69335,8 +70301,8 @@ "binop": null }, "value": "fire", - "start": 14501, - "end": 14505, + "start": 14587, + "end": 14591, "loc": { "start": { "line": 340, @@ -69360,8 +70326,8 @@ "postfix": false, "binop": null }, - "start": 14505, - "end": 14506, + "start": 14591, + "end": 14592, "loc": { "start": { "line": 340, @@ -69387,8 +70353,8 @@ "updateContext": null }, "value": "measurementEnd", - "start": 14506, - "end": 14522, + "start": 14592, + "end": 14608, "loc": { "start": { "line": 340, @@ -69413,8 +70379,8 @@ "binop": null, "updateContext": null }, - "start": 14522, - "end": 14523, + "start": 14608, + "end": 14609, "loc": { "start": { "line": 340, @@ -69441,8 +70407,8 @@ "updateContext": null }, "value": "this", - "start": 14524, - "end": 14528, + "start": 14610, + "end": 14614, "loc": { "start": { "line": 340, @@ -69467,8 +70433,8 @@ "binop": null, "updateContext": null }, - "start": 14528, - "end": 14529, + "start": 14614, + "end": 14615, "loc": { "start": { "line": 340, @@ -69493,8 +70459,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14529, - "end": 14553, + "start": 14615, + "end": 14639, "loc": { "start": { "line": 340, @@ -69518,8 +70484,8 @@ "postfix": false, "binop": null }, - "start": 14553, - "end": 14554, + "start": 14639, + "end": 14640, "loc": { "start": { "line": 340, @@ -69544,8 +70510,8 @@ "binop": null, "updateContext": null }, - "start": 14554, - "end": 14555, + "start": 14640, + "end": 14641, "loc": { "start": { "line": 340, @@ -69572,8 +70538,8 @@ "updateContext": null }, "value": "this", - "start": 14580, - "end": 14584, + "start": 14666, + "end": 14670, "loc": { "start": { "line": 341, @@ -69598,8 +70564,8 @@ "binop": null, "updateContext": null }, - "start": 14584, - "end": 14585, + "start": 14670, + "end": 14671, "loc": { "start": { "line": 341, @@ -69624,8 +70590,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14585, - "end": 14609, + "start": 14671, + "end": 14695, "loc": { "start": { "line": 341, @@ -69651,8 +70617,8 @@ "updateContext": null }, "value": "=", - "start": 14610, - "end": 14611, + "start": 14696, + "end": 14697, "loc": { "start": { "line": 341, @@ -69679,8 +70645,8 @@ "updateContext": null }, "value": "null", - "start": 14612, - "end": 14616, + "start": 14698, + "end": 14702, "loc": { "start": { "line": 341, @@ -69705,8 +70671,8 @@ "binop": null, "updateContext": null }, - "start": 14616, - "end": 14617, + "start": 14702, + "end": 14703, "loc": { "start": { "line": 341, @@ -69733,8 +70699,8 @@ "updateContext": null }, "value": "this", - "start": 14642, - "end": 14646, + "start": 14728, + "end": 14732, "loc": { "start": { "line": 342, @@ -69759,8 +70725,8 @@ "binop": null, "updateContext": null }, - "start": 14646, - "end": 14647, + "start": 14732, + "end": 14733, "loc": { "start": { "line": 342, @@ -69785,8 +70751,8 @@ "binop": null }, "value": "_mouseState", - "start": 14647, - "end": 14658, + "start": 14733, + "end": 14744, "loc": { "start": { "line": 342, @@ -69812,8 +70778,8 @@ "updateContext": null }, "value": "=", - "start": 14659, - "end": 14660, + "start": 14745, + "end": 14746, "loc": { "start": { "line": 342, @@ -69838,8 +70804,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 14661, - "end": 14681, + "start": 14747, + "end": 14767, "loc": { "start": { "line": 342, @@ -69864,8 +70830,8 @@ "binop": null, "updateContext": null }, - "start": 14681, - "end": 14682, + "start": 14767, + "end": 14768, "loc": { "start": { "line": 342, @@ -69889,8 +70855,8 @@ "postfix": false, "binop": null }, - "start": 14703, - "end": 14704, + "start": 14789, + "end": 14790, "loc": { "start": { "line": 343, @@ -69917,8 +70883,8 @@ "updateContext": null }, "value": "else", - "start": 14705, - "end": 14709, + "start": 14791, + "end": 14795, "loc": { "start": { "line": 343, @@ -69942,8 +70908,8 @@ "postfix": false, "binop": null }, - "start": 14710, - "end": 14711, + "start": 14796, + "end": 14797, "loc": { "start": { "line": 343, @@ -69970,8 +70936,8 @@ "updateContext": null }, "value": "if", - "start": 14736, - "end": 14738, + "start": 14822, + "end": 14824, "loc": { "start": { "line": 344, @@ -69995,8 +70961,8 @@ "postfix": false, "binop": null }, - "start": 14739, - "end": 14740, + "start": 14825, + "end": 14826, "loc": { "start": { "line": 344, @@ -70023,8 +70989,8 @@ "updateContext": null }, "value": "this", - "start": 14740, - "end": 14744, + "start": 14826, + "end": 14830, "loc": { "start": { "line": 344, @@ -70049,8 +71015,8 @@ "binop": null, "updateContext": null }, - "start": 14744, - "end": 14745, + "start": 14830, + "end": 14831, "loc": { "start": { "line": 344, @@ -70075,8 +71041,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14745, - "end": 14769, + "start": 14831, + "end": 14855, "loc": { "start": { "line": 344, @@ -70100,8 +71066,8 @@ "postfix": false, "binop": null }, - "start": 14769, - "end": 14770, + "start": 14855, + "end": 14856, "loc": { "start": { "line": 344, @@ -70125,8 +71091,8 @@ "postfix": false, "binop": null }, - "start": 14771, - "end": 14772, + "start": 14857, + "end": 14858, "loc": { "start": { "line": 344, @@ -70153,8 +71119,8 @@ "updateContext": null }, "value": "this", - "start": 14801, - "end": 14805, + "start": 14887, + "end": 14891, "loc": { "start": { "line": 345, @@ -70179,8 +71145,8 @@ "binop": null, "updateContext": null }, - "start": 14805, - "end": 14806, + "start": 14891, + "end": 14892, "loc": { "start": { "line": 345, @@ -70205,8 +71171,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14806, - "end": 14830, + "start": 14892, + "end": 14916, "loc": { "start": { "line": 345, @@ -70231,8 +71197,8 @@ "binop": null, "updateContext": null }, - "start": 14830, - "end": 14831, + "start": 14916, + "end": 14917, "loc": { "start": { "line": 345, @@ -70257,8 +71223,8 @@ "binop": null }, "value": "destroy", - "start": 14831, - "end": 14838, + "start": 14917, + "end": 14924, "loc": { "start": { "line": 345, @@ -70282,8 +71248,8 @@ "postfix": false, "binop": null }, - "start": 14838, - "end": 14839, + "start": 14924, + "end": 14925, "loc": { "start": { "line": 345, @@ -70307,8 +71273,8 @@ "postfix": false, "binop": null }, - "start": 14839, - "end": 14840, + "start": 14925, + "end": 14926, "loc": { "start": { "line": 345, @@ -70333,8 +71299,8 @@ "binop": null, "updateContext": null }, - "start": 14840, - "end": 14841, + "start": 14926, + "end": 14927, "loc": { "start": { "line": 345, @@ -70361,8 +71327,8 @@ "updateContext": null }, "value": "this", - "start": 14870, - "end": 14874, + "start": 14956, + "end": 14960, "loc": { "start": { "line": 346, @@ -70387,8 +71353,8 @@ "binop": null, "updateContext": null }, - "start": 14874, - "end": 14875, + "start": 14960, + "end": 14961, "loc": { "start": { "line": 346, @@ -70413,8 +71379,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 14875, - "end": 14899, + "start": 14961, + "end": 14985, "loc": { "start": { "line": 346, @@ -70440,8 +71406,8 @@ "updateContext": null }, "value": "=", - "start": 14900, - "end": 14901, + "start": 14986, + "end": 14987, "loc": { "start": { "line": 346, @@ -70468,8 +71434,8 @@ "updateContext": null }, "value": "null", - "start": 14902, - "end": 14906, + "start": 14988, + "end": 14992, "loc": { "start": { "line": 346, @@ -70494,8 +71460,8 @@ "binop": null, "updateContext": null }, - "start": 14906, - "end": 14907, + "start": 14992, + "end": 14993, "loc": { "start": { "line": 346, @@ -70520,8 +71486,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 14936, - "end": 14949, + "start": 15022, + "end": 15035, "loc": { "start": { "line": 347, @@ -70547,8 +71513,8 @@ "updateContext": null }, "value": "=", - "start": 14950, - "end": 14951, + "start": 15036, + "end": 15037, "loc": { "start": { "line": 347, @@ -70575,8 +71541,8 @@ "updateContext": null }, "value": "null", - "start": 14952, - "end": 14956, + "start": 15038, + "end": 15042, "loc": { "start": { "line": 347, @@ -70601,8 +71567,8 @@ "binop": null, "updateContext": null }, - "start": 14956, - "end": 14957, + "start": 15042, + "end": 15043, "loc": { "start": { "line": 347, @@ -70629,8 +71595,8 @@ "updateContext": null }, "value": "this", - "start": 14986, - "end": 14990, + "start": 15072, + "end": 15076, "loc": { "start": { "line": 348, @@ -70655,8 +71621,8 @@ "binop": null, "updateContext": null }, - "start": 14990, - "end": 14991, + "start": 15076, + "end": 15077, "loc": { "start": { "line": 348, @@ -70681,8 +71647,8 @@ "binop": null }, "value": "_mouseState", - "start": 14991, - "end": 15002, + "start": 15077, + "end": 15088, "loc": { "start": { "line": 348, @@ -70708,8 +71674,8 @@ "updateContext": null }, "value": "=", - "start": 15003, - "end": 15004, + "start": 15089, + "end": 15090, "loc": { "start": { "line": 348, @@ -70734,8 +71700,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 15005, - "end": 15025, + "start": 15091, + "end": 15111, "loc": { "start": { "line": 348, @@ -70760,8 +71726,8 @@ "binop": null, "updateContext": null }, - "start": 15025, - "end": 15026, + "start": 15111, + "end": 15112, "loc": { "start": { "line": 348, @@ -70788,8 +71754,8 @@ "updateContext": null }, "value": "this", - "start": 15055, - "end": 15059, + "start": 15141, + "end": 15145, "loc": { "start": { "line": 349, @@ -70814,8 +71780,8 @@ "binop": null, "updateContext": null }, - "start": 15059, - "end": 15060, + "start": 15145, + "end": 15146, "loc": { "start": { "line": 349, @@ -70840,8 +71806,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 15060, - "end": 15083, + "start": 15146, + "end": 15169, "loc": { "start": { "line": 349, @@ -70866,8 +71832,8 @@ "binop": null, "updateContext": null }, - "start": 15083, - "end": 15084, + "start": 15169, + "end": 15170, "loc": { "start": { "line": 349, @@ -70892,8 +71858,8 @@ "binop": null }, "value": "fire", - "start": 15084, - "end": 15088, + "start": 15170, + "end": 15174, "loc": { "start": { "line": 349, @@ -70917,8 +71883,8 @@ "postfix": false, "binop": null }, - "start": 15088, - "end": 15089, + "start": 15174, + "end": 15175, "loc": { "start": { "line": 349, @@ -70944,8 +71910,8 @@ "updateContext": null }, "value": "measurementCancel", - "start": 15089, - "end": 15108, + "start": 15175, + "end": 15194, "loc": { "start": { "line": 349, @@ -70970,8 +71936,8 @@ "binop": null, "updateContext": null }, - "start": 15108, - "end": 15109, + "start": 15194, + "end": 15195, "loc": { "start": { "line": 349, @@ -70998,8 +71964,8 @@ "updateContext": null }, "value": "this", - "start": 15110, - "end": 15114, + "start": 15196, + "end": 15200, "loc": { "start": { "line": 349, @@ -71024,8 +71990,8 @@ "binop": null, "updateContext": null }, - "start": 15114, - "end": 15115, + "start": 15200, + "end": 15201, "loc": { "start": { "line": 349, @@ -71050,8 +72016,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 15115, - "end": 15139, + "start": 15201, + "end": 15225, "loc": { "start": { "line": 349, @@ -71075,8 +72041,8 @@ "postfix": false, "binop": null }, - "start": 15139, - "end": 15140, + "start": 15225, + "end": 15226, "loc": { "start": { "line": 349, @@ -71101,8 +72067,8 @@ "binop": null, "updateContext": null }, - "start": 15140, - "end": 15141, + "start": 15226, + "end": 15227, "loc": { "start": { "line": 349, @@ -71126,8 +72092,8 @@ "postfix": false, "binop": null }, - "start": 15166, - "end": 15167, + "start": 15252, + "end": 15253, "loc": { "start": { "line": 350, @@ -71151,8 +72117,8 @@ "postfix": false, "binop": null }, - "start": 15188, - "end": 15189, + "start": 15274, + "end": 15275, "loc": { "start": { "line": 351, @@ -71179,8 +72145,8 @@ "updateContext": null }, "value": "break", - "start": 15210, - "end": 15215, + "start": 15296, + "end": 15301, "loc": { "start": { "line": 352, @@ -71205,8 +72171,8 @@ "binop": null, "updateContext": null }, - "start": 15215, - "end": 15216, + "start": 15301, + "end": 15302, "loc": { "start": { "line": 352, @@ -71230,8 +72196,8 @@ "postfix": false, "binop": null }, - "start": 15229, - "end": 15230, + "start": 15315, + "end": 15316, "loc": { "start": { "line": 353, @@ -71255,8 +72221,8 @@ "postfix": false, "binop": null }, - "start": 15239, - "end": 15240, + "start": 15325, + "end": 15326, "loc": { "start": { "line": 354, @@ -71280,8 +72246,8 @@ "postfix": false, "binop": null }, - "start": 15240, - "end": 15241, + "start": 15326, + "end": 15327, "loc": { "start": { "line": 354, @@ -71306,8 +72272,8 @@ "binop": null, "updateContext": null }, - "start": 15241, - "end": 15242, + "start": 15327, + "end": 15328, "loc": { "start": { "line": 354, @@ -71334,8 +72300,8 @@ "updateContext": null }, "value": "this", - "start": 15251, - "end": 15255, + "start": 15337, + "end": 15341, "loc": { "start": { "line": 355, @@ -71360,8 +72326,8 @@ "binop": null, "updateContext": null }, - "start": 15255, - "end": 15256, + "start": 15341, + "end": 15342, "loc": { "start": { "line": 355, @@ -71386,8 +72352,8 @@ "binop": null }, "value": "_onMouseHoverOff", - "start": 15256, - "end": 15272, + "start": 15342, + "end": 15358, "loc": { "start": { "line": 355, @@ -71413,8 +72379,8 @@ "updateContext": null }, "value": "=", - "start": 15273, - "end": 15274, + "start": 15359, + "end": 15360, "loc": { "start": { "line": 355, @@ -71439,8 +72405,8 @@ "binop": null }, "value": "cameraControl", - "start": 15275, - "end": 15288, + "start": 15361, + "end": 15374, "loc": { "start": { "line": 355, @@ -71465,8 +72431,8 @@ "binop": null, "updateContext": null }, - "start": 15288, - "end": 15289, + "start": 15374, + "end": 15375, "loc": { "start": { "line": 355, @@ -71491,8 +72457,8 @@ "binop": null }, "value": "on", - "start": 15289, - "end": 15291, + "start": 15375, + "end": 15377, "loc": { "start": { "line": 355, @@ -71516,8 +72482,8 @@ "postfix": false, "binop": null }, - "start": 15291, - "end": 15292, + "start": 15377, + "end": 15378, "loc": { "start": { "line": 355, @@ -71544,8 +72510,8 @@ "updateContext": null }, "value": "this", - "start": 15305, - "end": 15309, + "start": 15391, + "end": 15395, "loc": { "start": { "line": 356, @@ -71570,8 +72536,8 @@ "binop": null, "updateContext": null }, - "start": 15309, - "end": 15310, + "start": 15395, + "end": 15396, "loc": { "start": { "line": 356, @@ -71596,8 +72562,8 @@ "binop": null }, "value": "_snapping", - "start": 15310, - "end": 15319, + "start": 15396, + "end": 15405, "loc": { "start": { "line": 356, @@ -71622,8 +72588,8 @@ "binop": null, "updateContext": null }, - "start": 15336, - "end": 15337, + "start": 15422, + "end": 15423, "loc": { "start": { "line": 357, @@ -71649,8 +72615,8 @@ "updateContext": null }, "value": "hoverSnapOrSurfaceOff", - "start": 15338, - "end": 15361, + "start": 15424, + "end": 15447, "loc": { "start": { "line": 357, @@ -71675,8 +72641,8 @@ "binop": null, "updateContext": null }, - "start": 15378, - "end": 15379, + "start": 15464, + "end": 15465, "loc": { "start": { "line": 358, @@ -71702,8 +72668,8 @@ "updateContext": null }, "value": "hoverOff", - "start": 15380, - "end": 15390, + "start": 15466, + "end": 15476, "loc": { "start": { "line": 358, @@ -71728,8 +72694,8 @@ "binop": null, "updateContext": null }, - "start": 15390, - "end": 15391, + "start": 15476, + "end": 15477, "loc": { "start": { "line": 358, @@ -71754,8 +72720,8 @@ "binop": null }, "value": "event", - "start": 15404, - "end": 15409, + "start": 15490, + "end": 15495, "loc": { "start": { "line": 359, @@ -71780,8 +72746,8 @@ "binop": null, "updateContext": null }, - "start": 15410, - "end": 15412, + "start": 15496, + "end": 15498, "loc": { "start": { "line": 359, @@ -71805,8 +72771,8 @@ "postfix": false, "binop": null }, - "start": 15413, - "end": 15414, + "start": 15499, + "end": 15500, "loc": { "start": { "line": 359, @@ -71831,8 +72797,8 @@ "binop": null }, "value": "mouseHovering", - "start": 15431, - "end": 15444, + "start": 15517, + "end": 15530, "loc": { "start": { "line": 360, @@ -71858,8 +72824,8 @@ "updateContext": null }, "value": "=", - "start": 15445, - "end": 15446, + "start": 15531, + "end": 15532, "loc": { "start": { "line": 360, @@ -71886,8 +72852,8 @@ "updateContext": null }, "value": "false", - "start": 15447, - "end": 15452, + "start": 15533, + "end": 15538, "loc": { "start": { "line": 360, @@ -71912,8 +72878,8 @@ "binop": null, "updateContext": null }, - "start": 15452, - "end": 15453, + "start": 15538, + "end": 15539, "loc": { "start": { "line": 360, @@ -71940,8 +72906,8 @@ "updateContext": null }, "value": "if", - "start": 15470, - "end": 15472, + "start": 15556, + "end": 15558, "loc": { "start": { "line": 361, @@ -71965,8 +72931,8 @@ "postfix": false, "binop": null }, - "start": 15473, - "end": 15474, + "start": 15559, + "end": 15560, "loc": { "start": { "line": 361, @@ -71991,8 +72957,8 @@ "binop": null }, "value": "pointerLens", - "start": 15474, - "end": 15485, + "start": 15560, + "end": 15571, "loc": { "start": { "line": 361, @@ -72016,8 +72982,8 @@ "postfix": false, "binop": null }, - "start": 15485, - "end": 15486, + "start": 15571, + "end": 15572, "loc": { "start": { "line": 361, @@ -72041,8 +73007,8 @@ "postfix": false, "binop": null }, - "start": 15487, - "end": 15488, + "start": 15573, + "end": 15574, "loc": { "start": { "line": 361, @@ -72067,8 +73033,8 @@ "binop": null }, "value": "pointerLens", - "start": 15509, - "end": 15520, + "start": 15595, + "end": 15606, "loc": { "start": { "line": 362, @@ -72093,8 +73059,8 @@ "binop": null, "updateContext": null }, - "start": 15520, - "end": 15521, + "start": 15606, + "end": 15607, "loc": { "start": { "line": 362, @@ -72119,8 +73085,8 @@ "binop": null }, "value": "visible", - "start": 15521, - "end": 15528, + "start": 15607, + "end": 15614, "loc": { "start": { "line": 362, @@ -72146,8 +73112,8 @@ "updateContext": null }, "value": "=", - "start": 15529, - "end": 15530, + "start": 15615, + "end": 15616, "loc": { "start": { "line": 362, @@ -72174,8 +73140,8 @@ "updateContext": null }, "value": "true", - "start": 15531, - "end": 15535, + "start": 15617, + "end": 15621, "loc": { "start": { "line": 362, @@ -72200,8 +73166,8 @@ "binop": null, "updateContext": null }, - "start": 15535, - "end": 15536, + "start": 15621, + "end": 15622, "loc": { "start": { "line": 362, @@ -72226,8 +73192,8 @@ "binop": null }, "value": "pointerLens", - "start": 15557, - "end": 15568, + "start": 15643, + "end": 15654, "loc": { "start": { "line": 363, @@ -72252,8 +73218,8 @@ "binop": null, "updateContext": null }, - "start": 15568, - "end": 15569, + "start": 15654, + "end": 15655, "loc": { "start": { "line": 363, @@ -72278,8 +73244,8 @@ "binop": null }, "value": "pointerPos", - "start": 15569, - "end": 15579, + "start": 15655, + "end": 15665, "loc": { "start": { "line": 363, @@ -72305,8 +73271,8 @@ "updateContext": null }, "value": "=", - "start": 15580, - "end": 15581, + "start": 15666, + "end": 15667, "loc": { "start": { "line": 363, @@ -72331,8 +73297,8 @@ "binop": null }, "value": "event", - "start": 15582, - "end": 15587, + "start": 15668, + "end": 15673, "loc": { "start": { "line": 363, @@ -72357,8 +73323,8 @@ "binop": null, "updateContext": null }, - "start": 15587, - "end": 15588, + "start": 15673, + "end": 15674, "loc": { "start": { "line": 363, @@ -72383,8 +73349,8 @@ "binop": null }, "value": "canvasPos", - "start": 15588, - "end": 15597, + "start": 15674, + "end": 15683, "loc": { "start": { "line": 363, @@ -72409,8 +73375,8 @@ "binop": null, "updateContext": null }, - "start": 15597, - "end": 15598, + "start": 15683, + "end": 15684, "loc": { "start": { "line": 363, @@ -72435,8 +73401,8 @@ "binop": null }, "value": "pointerLens", - "start": 15619, - "end": 15630, + "start": 15705, + "end": 15716, "loc": { "start": { "line": 364, @@ -72461,8 +73427,8 @@ "binop": null, "updateContext": null }, - "start": 15630, - "end": 15631, + "start": 15716, + "end": 15717, "loc": { "start": { "line": 364, @@ -72487,8 +73453,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 15631, - "end": 15647, + "start": 15717, + "end": 15733, "loc": { "start": { "line": 364, @@ -72514,8 +73480,8 @@ "updateContext": null }, "value": "=", - "start": 15648, - "end": 15649, + "start": 15734, + "end": 15735, "loc": { "start": { "line": 364, @@ -72540,8 +73506,8 @@ "binop": null }, "value": "event", - "start": 15650, - "end": 15655, + "start": 15736, + "end": 15741, "loc": { "start": { "line": 364, @@ -72566,8 +73532,8 @@ "binop": null, "updateContext": null }, - "start": 15655, - "end": 15656, + "start": 15741, + "end": 15742, "loc": { "start": { "line": 364, @@ -72592,8 +73558,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 15656, - "end": 15672, + "start": 15742, + "end": 15758, "loc": { "start": { "line": 364, @@ -72619,8 +73585,8 @@ "updateContext": null }, "value": "||", - "start": 15673, - "end": 15675, + "start": 15759, + "end": 15761, "loc": { "start": { "line": 364, @@ -72645,8 +73611,8 @@ "binop": null }, "value": "event", - "start": 15676, - "end": 15681, + "start": 15762, + "end": 15767, "loc": { "start": { "line": 364, @@ -72671,8 +73637,8 @@ "binop": null, "updateContext": null }, - "start": 15681, - "end": 15682, + "start": 15767, + "end": 15768, "loc": { "start": { "line": 364, @@ -72697,8 +73663,8 @@ "binop": null }, "value": "canvasPos", - "start": 15682, - "end": 15691, + "start": 15768, + "end": 15777, "loc": { "start": { "line": 364, @@ -72723,8 +73689,8 @@ "binop": null, "updateContext": null }, - "start": 15691, - "end": 15692, + "start": 15777, + "end": 15778, "loc": { "start": { "line": 364, @@ -72749,8 +73715,8 @@ "binop": null }, "value": "pointerLens", - "start": 15713, - "end": 15724, + "start": 15799, + "end": 15810, "loc": { "start": { "line": 365, @@ -72775,8 +73741,8 @@ "binop": null, "updateContext": null }, - "start": 15724, - "end": 15725, + "start": 15810, + "end": 15811, "loc": { "start": { "line": 365, @@ -72801,8 +73767,8 @@ "binop": null }, "value": "snapped", - "start": 15725, - "end": 15732, + "start": 15811, + "end": 15818, "loc": { "start": { "line": 365, @@ -72828,8 +73794,8 @@ "updateContext": null }, "value": "=", - "start": 15733, - "end": 15734, + "start": 15819, + "end": 15820, "loc": { "start": { "line": 365, @@ -72856,8 +73822,8 @@ "updateContext": null }, "value": "false", - "start": 15735, - "end": 15740, + "start": 15821, + "end": 15826, "loc": { "start": { "line": 365, @@ -72882,8 +73848,8 @@ "binop": null, "updateContext": null }, - "start": 15740, - "end": 15741, + "start": 15826, + "end": 15827, "loc": { "start": { "line": 365, @@ -72907,8 +73873,8 @@ "postfix": false, "binop": null }, - "start": 15758, - "end": 15759, + "start": 15844, + "end": 15845, "loc": { "start": { "line": 366, @@ -72935,8 +73901,8 @@ "updateContext": null }, "value": "this", - "start": 15776, - "end": 15780, + "start": 15862, + "end": 15866, "loc": { "start": { "line": 367, @@ -72961,8 +73927,8 @@ "binop": null, "updateContext": null }, - "start": 15780, - "end": 15781, + "start": 15866, + "end": 15867, "loc": { "start": { "line": 367, @@ -72987,8 +73953,8 @@ "binop": null }, "value": "markerDiv", - "start": 15781, - "end": 15790, + "start": 15867, + "end": 15876, "loc": { "start": { "line": 367, @@ -73013,8 +73979,8 @@ "binop": null, "updateContext": null }, - "start": 15790, - "end": 15791, + "start": 15876, + "end": 15877, "loc": { "start": { "line": 367, @@ -73039,8 +74005,8 @@ "binop": null }, "value": "style", - "start": 15791, - "end": 15796, + "start": 15877, + "end": 15882, "loc": { "start": { "line": 367, @@ -73065,8 +74031,8 @@ "binop": null, "updateContext": null }, - "start": 15796, - "end": 15797, + "start": 15882, + "end": 15883, "loc": { "start": { "line": 367, @@ -73091,8 +74057,8 @@ "binop": null }, "value": "left", - "start": 15797, - "end": 15801, + "start": 15883, + "end": 15887, "loc": { "start": { "line": 367, @@ -73118,8 +74084,8 @@ "updateContext": null }, "value": "=", - "start": 15802, - "end": 15803, + "start": 15888, + "end": 15889, "loc": { "start": { "line": 367, @@ -73143,8 +74109,8 @@ "postfix": false, "binop": null }, - "start": 15804, - "end": 15805, + "start": 15890, + "end": 15891, "loc": { "start": { "line": 367, @@ -73170,8 +74136,8 @@ "updateContext": null }, "value": "-100px", - "start": 15805, - "end": 15811, + "start": 15891, + "end": 15897, "loc": { "start": { "line": 367, @@ -73195,8 +74161,8 @@ "postfix": false, "binop": null }, - "start": 15811, - "end": 15812, + "start": 15897, + "end": 15898, "loc": { "start": { "line": 367, @@ -73221,8 +74187,8 @@ "binop": null, "updateContext": null }, - "start": 15812, - "end": 15813, + "start": 15898, + "end": 15899, "loc": { "start": { "line": 367, @@ -73249,8 +74215,8 @@ "updateContext": null }, "value": "this", - "start": 15830, - "end": 15834, + "start": 15916, + "end": 15920, "loc": { "start": { "line": 368, @@ -73275,8 +74241,8 @@ "binop": null, "updateContext": null }, - "start": 15834, - "end": 15835, + "start": 15920, + "end": 15921, "loc": { "start": { "line": 368, @@ -73301,8 +74267,8 @@ "binop": null }, "value": "markerDiv", - "start": 15835, - "end": 15844, + "start": 15921, + "end": 15930, "loc": { "start": { "line": 368, @@ -73327,8 +74293,8 @@ "binop": null, "updateContext": null }, - "start": 15844, - "end": 15845, + "start": 15930, + "end": 15931, "loc": { "start": { "line": 368, @@ -73353,8 +74319,8 @@ "binop": null }, "value": "style", - "start": 15845, - "end": 15850, + "start": 15931, + "end": 15936, "loc": { "start": { "line": 368, @@ -73379,8 +74345,8 @@ "binop": null, "updateContext": null }, - "start": 15850, - "end": 15851, + "start": 15936, + "end": 15937, "loc": { "start": { "line": 368, @@ -73405,8 +74371,8 @@ "binop": null }, "value": "top", - "start": 15851, - "end": 15854, + "start": 15937, + "end": 15940, "loc": { "start": { "line": 368, @@ -73432,8 +74398,8 @@ "updateContext": null }, "value": "=", - "start": 15855, - "end": 15856, + "start": 15941, + "end": 15942, "loc": { "start": { "line": 368, @@ -73457,8 +74423,8 @@ "postfix": false, "binop": null }, - "start": 15857, - "end": 15858, + "start": 15943, + "end": 15944, "loc": { "start": { "line": 368, @@ -73484,8 +74450,8 @@ "updateContext": null }, "value": "-100px", - "start": 15858, - "end": 15864, + "start": 15944, + "end": 15950, "loc": { "start": { "line": 368, @@ -73509,8 +74475,8 @@ "postfix": false, "binop": null }, - "start": 15864, - "end": 15865, + "start": 15950, + "end": 15951, "loc": { "start": { "line": 368, @@ -73535,8 +74501,8 @@ "binop": null, "updateContext": null }, - "start": 15865, - "end": 15866, + "start": 15951, + "end": 15952, "loc": { "start": { "line": 368, @@ -73563,8 +74529,8 @@ "updateContext": null }, "value": "if", - "start": 15883, - "end": 15885, + "start": 15969, + "end": 15971, "loc": { "start": { "line": 369, @@ -73588,8 +74554,8 @@ "postfix": false, "binop": null }, - "start": 15886, - "end": 15887, + "start": 15972, + "end": 15973, "loc": { "start": { "line": 369, @@ -73616,8 +74582,8 @@ "updateContext": null }, "value": "this", - "start": 15887, - "end": 15891, + "start": 15973, + "end": 15977, "loc": { "start": { "line": 369, @@ -73642,8 +74608,8 @@ "binop": null, "updateContext": null }, - "start": 15891, - "end": 15892, + "start": 15977, + "end": 15978, "loc": { "start": { "line": 369, @@ -73668,8 +74634,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 15892, - "end": 15916, + "start": 15978, + "end": 16002, "loc": { "start": { "line": 369, @@ -73693,8 +74659,8 @@ "postfix": false, "binop": null }, - "start": 15916, - "end": 15917, + "start": 16002, + "end": 16003, "loc": { "start": { "line": 369, @@ -73718,8 +74684,8 @@ "postfix": false, "binop": null }, - "start": 15918, - "end": 15919, + "start": 16004, + "end": 16005, "loc": { "start": { "line": 369, @@ -73746,8 +74712,8 @@ "updateContext": null }, "value": "switch", - "start": 15940, - "end": 15946, + "start": 16026, + "end": 16032, "loc": { "start": { "line": 370, @@ -73771,8 +74737,8 @@ "postfix": false, "binop": null }, - "start": 15947, - "end": 15948, + "start": 16033, + "end": 16034, "loc": { "start": { "line": 370, @@ -73799,8 +74765,8 @@ "updateContext": null }, "value": "this", - "start": 15948, - "end": 15952, + "start": 16034, + "end": 16038, "loc": { "start": { "line": 370, @@ -73825,8 +74791,8 @@ "binop": null, "updateContext": null }, - "start": 15952, - "end": 15953, + "start": 16038, + "end": 16039, "loc": { "start": { "line": 370, @@ -73851,8 +74817,8 @@ "binop": null }, "value": "_mouseState", - "start": 15953, - "end": 15964, + "start": 16039, + "end": 16050, "loc": { "start": { "line": 370, @@ -73876,8 +74842,8 @@ "postfix": false, "binop": null }, - "start": 15964, - "end": 15965, + "start": 16050, + "end": 16051, "loc": { "start": { "line": 370, @@ -73901,8 +74867,8 @@ "postfix": false, "binop": null }, - "start": 15966, - "end": 15967, + "start": 16052, + "end": 16053, "loc": { "start": { "line": 370, @@ -73929,8 +74895,8 @@ "updateContext": null }, "value": "case", - "start": 15992, - "end": 15996, + "start": 16078, + "end": 16082, "loc": { "start": { "line": 371, @@ -73955,8 +74921,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 15997, - "end": 16017, + "start": 16083, + "end": 16103, "loc": { "start": { "line": 371, @@ -73981,8 +74947,8 @@ "binop": null, "updateContext": null }, - "start": 16017, - "end": 16018, + "start": 16103, + "end": 16104, "loc": { "start": { "line": 371, @@ -74009,8 +74975,8 @@ "updateContext": null }, "value": "this", - "start": 16047, - "end": 16051, + "start": 16133, + "end": 16137, "loc": { "start": { "line": 372, @@ -74035,8 +75001,8 @@ "binop": null, "updateContext": null }, - "start": 16051, - "end": 16052, + "start": 16137, + "end": 16138, "loc": { "start": { "line": 372, @@ -74061,8 +75027,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16052, - "end": 16076, + "start": 16138, + "end": 16162, "loc": { "start": { "line": 372, @@ -74087,8 +75053,8 @@ "binop": null, "updateContext": null }, - "start": 16076, - "end": 16077, + "start": 16162, + "end": 16163, "loc": { "start": { "line": 372, @@ -74113,8 +75079,8 @@ "binop": null }, "value": "originVisible", - "start": 16077, - "end": 16090, + "start": 16163, + "end": 16176, "loc": { "start": { "line": 372, @@ -74140,8 +75106,8 @@ "updateContext": null }, "value": "=", - "start": 16091, - "end": 16092, + "start": 16177, + "end": 16178, "loc": { "start": { "line": 372, @@ -74168,8 +75134,8 @@ "updateContext": null }, "value": "false", - "start": 16093, - "end": 16098, + "start": 16179, + "end": 16184, "loc": { "start": { "line": 372, @@ -74194,8 +75160,8 @@ "binop": null, "updateContext": null }, - "start": 16098, - "end": 16099, + "start": 16184, + "end": 16185, "loc": { "start": { "line": 372, @@ -74222,8 +75188,8 @@ "updateContext": null }, "value": "break", - "start": 16128, - "end": 16133, + "start": 16214, + "end": 16219, "loc": { "start": { "line": 373, @@ -74248,8 +75214,8 @@ "binop": null, "updateContext": null }, - "start": 16133, - "end": 16134, + "start": 16219, + "end": 16220, "loc": { "start": { "line": 373, @@ -74276,8 +75242,8 @@ "updateContext": null }, "value": "case", - "start": 16159, - "end": 16163, + "start": 16245, + "end": 16249, "loc": { "start": { "line": 374, @@ -74302,8 +75268,8 @@ "binop": null }, "value": "MOUSE_FINDING_CORNER", - "start": 16164, - "end": 16184, + "start": 16250, + "end": 16270, "loc": { "start": { "line": 374, @@ -74328,8 +75294,8 @@ "binop": null, "updateContext": null }, - "start": 16184, - "end": 16185, + "start": 16270, + "end": 16271, "loc": { "start": { "line": 374, @@ -74356,8 +75322,8 @@ "updateContext": null }, "value": "this", - "start": 16214, - "end": 16218, + "start": 16300, + "end": 16304, "loc": { "start": { "line": 375, @@ -74382,8 +75348,8 @@ "binop": null, "updateContext": null }, - "start": 16218, - "end": 16219, + "start": 16304, + "end": 16305, "loc": { "start": { "line": 375, @@ -74408,8 +75374,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16219, - "end": 16243, + "start": 16305, + "end": 16329, "loc": { "start": { "line": 375, @@ -74434,8 +75400,8 @@ "binop": null, "updateContext": null }, - "start": 16243, - "end": 16244, + "start": 16329, + "end": 16330, "loc": { "start": { "line": 375, @@ -74460,8 +75426,8 @@ "binop": null }, "value": "cornerVisible", - "start": 16244, - "end": 16257, + "start": 16330, + "end": 16343, "loc": { "start": { "line": 375, @@ -74487,8 +75453,8 @@ "updateContext": null }, "value": "=", - "start": 16258, - "end": 16259, + "start": 16344, + "end": 16345, "loc": { "start": { "line": 375, @@ -74515,8 +75481,8 @@ "updateContext": null }, "value": "false", - "start": 16260, - "end": 16265, + "start": 16346, + "end": 16351, "loc": { "start": { "line": 375, @@ -74541,8 +75507,8 @@ "binop": null, "updateContext": null }, - "start": 16265, - "end": 16266, + "start": 16351, + "end": 16352, "loc": { "start": { "line": 375, @@ -74569,8 +75535,8 @@ "updateContext": null }, "value": "this", - "start": 16295, - "end": 16299, + "start": 16381, + "end": 16385, "loc": { "start": { "line": 376, @@ -74595,8 +75561,8 @@ "binop": null, "updateContext": null }, - "start": 16299, - "end": 16300, + "start": 16385, + "end": 16386, "loc": { "start": { "line": 376, @@ -74621,8 +75587,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16300, - "end": 16324, + "start": 16386, + "end": 16410, "loc": { "start": { "line": 376, @@ -74647,8 +75613,8 @@ "binop": null, "updateContext": null }, - "start": 16324, - "end": 16325, + "start": 16410, + "end": 16411, "loc": { "start": { "line": 376, @@ -74673,8 +75639,8 @@ "binop": null }, "value": "originWireVisible", - "start": 16325, - "end": 16342, + "start": 16411, + "end": 16428, "loc": { "start": { "line": 376, @@ -74700,8 +75666,8 @@ "updateContext": null }, "value": "=", - "start": 16343, - "end": 16344, + "start": 16429, + "end": 16430, "loc": { "start": { "line": 376, @@ -74728,8 +75694,8 @@ "updateContext": null }, "value": "false", - "start": 16345, - "end": 16350, + "start": 16431, + "end": 16436, "loc": { "start": { "line": 376, @@ -74754,8 +75720,8 @@ "binop": null, "updateContext": null }, - "start": 16350, - "end": 16351, + "start": 16436, + "end": 16437, "loc": { "start": { "line": 376, @@ -74782,8 +75748,8 @@ "updateContext": null }, "value": "this", - "start": 16380, - "end": 16384, + "start": 16466, + "end": 16470, "loc": { "start": { "line": 377, @@ -74808,8 +75774,8 @@ "binop": null, "updateContext": null }, - "start": 16384, - "end": 16385, + "start": 16470, + "end": 16471, "loc": { "start": { "line": 377, @@ -74834,8 +75800,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16385, - "end": 16409, + "start": 16471, + "end": 16495, "loc": { "start": { "line": 377, @@ -74860,8 +75826,8 @@ "binop": null, "updateContext": null }, - "start": 16409, - "end": 16410, + "start": 16495, + "end": 16496, "loc": { "start": { "line": 377, @@ -74886,8 +75852,8 @@ "binop": null }, "value": "targetVisible", - "start": 16410, - "end": 16423, + "start": 16496, + "end": 16509, "loc": { "start": { "line": 377, @@ -74913,8 +75879,8 @@ "updateContext": null }, "value": "=", - "start": 16424, - "end": 16425, + "start": 16510, + "end": 16511, "loc": { "start": { "line": 377, @@ -74941,8 +75907,8 @@ "updateContext": null }, "value": "false", - "start": 16426, - "end": 16431, + "start": 16512, + "end": 16517, "loc": { "start": { "line": 377, @@ -74967,8 +75933,8 @@ "binop": null, "updateContext": null }, - "start": 16431, - "end": 16432, + "start": 16517, + "end": 16518, "loc": { "start": { "line": 377, @@ -74995,8 +75961,8 @@ "updateContext": null }, "value": "this", - "start": 16461, - "end": 16465, + "start": 16547, + "end": 16551, "loc": { "start": { "line": 378, @@ -75021,8 +75987,8 @@ "binop": null, "updateContext": null }, - "start": 16465, - "end": 16466, + "start": 16551, + "end": 16552, "loc": { "start": { "line": 378, @@ -75047,8 +76013,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16466, - "end": 16490, + "start": 16552, + "end": 16576, "loc": { "start": { "line": 378, @@ -75073,8 +76039,8 @@ "binop": null, "updateContext": null }, - "start": 16490, - "end": 16491, + "start": 16576, + "end": 16577, "loc": { "start": { "line": 378, @@ -75099,8 +76065,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 16491, - "end": 16508, + "start": 16577, + "end": 16594, "loc": { "start": { "line": 378, @@ -75126,8 +76092,8 @@ "updateContext": null }, "value": "=", - "start": 16509, - "end": 16510, + "start": 16595, + "end": 16596, "loc": { "start": { "line": 378, @@ -75154,8 +76120,8 @@ "updateContext": null }, "value": "false", - "start": 16511, - "end": 16516, + "start": 16597, + "end": 16602, "loc": { "start": { "line": 378, @@ -75180,8 +76146,8 @@ "binop": null, "updateContext": null }, - "start": 16516, - "end": 16517, + "start": 16602, + "end": 16603, "loc": { "start": { "line": 378, @@ -75208,8 +76174,8 @@ "updateContext": null }, "value": "this", - "start": 16546, - "end": 16550, + "start": 16632, + "end": 16636, "loc": { "start": { "line": 379, @@ -75234,8 +76200,8 @@ "binop": null, "updateContext": null }, - "start": 16550, - "end": 16551, + "start": 16636, + "end": 16637, "loc": { "start": { "line": 379, @@ -75260,8 +76226,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16551, - "end": 16575, + "start": 16637, + "end": 16661, "loc": { "start": { "line": 379, @@ -75286,8 +76252,8 @@ "binop": null, "updateContext": null }, - "start": 16575, - "end": 16576, + "start": 16661, + "end": 16662, "loc": { "start": { "line": 379, @@ -75312,8 +76278,8 @@ "binop": null }, "value": "angleVisible", - "start": 16576, - "end": 16588, + "start": 16662, + "end": 16674, "loc": { "start": { "line": 379, @@ -75339,8 +76305,8 @@ "updateContext": null }, "value": "=", - "start": 16589, - "end": 16590, + "start": 16675, + "end": 16676, "loc": { "start": { "line": 379, @@ -75367,8 +76333,8 @@ "updateContext": null }, "value": "false", - "start": 16591, - "end": 16596, + "start": 16677, + "end": 16682, "loc": { "start": { "line": 379, @@ -75393,8 +76359,8 @@ "binop": null, "updateContext": null }, - "start": 16596, - "end": 16597, + "start": 16682, + "end": 16683, "loc": { "start": { "line": 379, @@ -75421,8 +76387,8 @@ "updateContext": null }, "value": "break", - "start": 16626, - "end": 16631, + "start": 16712, + "end": 16717, "loc": { "start": { "line": 380, @@ -75447,8 +76413,8 @@ "binop": null, "updateContext": null }, - "start": 16631, - "end": 16632, + "start": 16717, + "end": 16718, "loc": { "start": { "line": 380, @@ -75475,8 +76441,8 @@ "updateContext": null }, "value": "case", - "start": 16657, - "end": 16661, + "start": 16743, + "end": 16747, "loc": { "start": { "line": 381, @@ -75501,8 +76467,8 @@ "binop": null }, "value": "MOUSE_FINDING_TARGET", - "start": 16662, - "end": 16682, + "start": 16748, + "end": 16768, "loc": { "start": { "line": 381, @@ -75527,8 +76493,8 @@ "binop": null, "updateContext": null }, - "start": 16682, - "end": 16683, + "start": 16768, + "end": 16769, "loc": { "start": { "line": 381, @@ -75555,8 +76521,8 @@ "updateContext": null }, "value": "this", - "start": 16712, - "end": 16716, + "start": 16798, + "end": 16802, "loc": { "start": { "line": 382, @@ -75581,8 +76547,8 @@ "binop": null, "updateContext": null }, - "start": 16716, - "end": 16717, + "start": 16802, + "end": 16803, "loc": { "start": { "line": 382, @@ -75607,8 +76573,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16717, - "end": 16741, + "start": 16803, + "end": 16827, "loc": { "start": { "line": 382, @@ -75633,8 +76599,8 @@ "binop": null, "updateContext": null }, - "start": 16741, - "end": 16742, + "start": 16827, + "end": 16828, "loc": { "start": { "line": 382, @@ -75659,8 +76625,8 @@ "binop": null }, "value": "targetVisible", - "start": 16742, - "end": 16755, + "start": 16828, + "end": 16841, "loc": { "start": { "line": 382, @@ -75686,8 +76652,8 @@ "updateContext": null }, "value": "=", - "start": 16756, - "end": 16757, + "start": 16842, + "end": 16843, "loc": { "start": { "line": 382, @@ -75714,8 +76680,8 @@ "updateContext": null }, "value": "false", - "start": 16758, - "end": 16763, + "start": 16844, + "end": 16849, "loc": { "start": { "line": 382, @@ -75740,8 +76706,8 @@ "binop": null, "updateContext": null }, - "start": 16763, - "end": 16764, + "start": 16849, + "end": 16850, "loc": { "start": { "line": 382, @@ -75768,8 +76734,8 @@ "updateContext": null }, "value": "this", - "start": 16793, - "end": 16797, + "start": 16879, + "end": 16883, "loc": { "start": { "line": 383, @@ -75794,8 +76760,8 @@ "binop": null, "updateContext": null }, - "start": 16797, - "end": 16798, + "start": 16883, + "end": 16884, "loc": { "start": { "line": 383, @@ -75820,8 +76786,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16798, - "end": 16822, + "start": 16884, + "end": 16908, "loc": { "start": { "line": 383, @@ -75846,8 +76812,8 @@ "binop": null, "updateContext": null }, - "start": 16822, - "end": 16823, + "start": 16908, + "end": 16909, "loc": { "start": { "line": 383, @@ -75872,8 +76838,8 @@ "binop": null }, "value": "targetWireVisible", - "start": 16823, - "end": 16840, + "start": 16909, + "end": 16926, "loc": { "start": { "line": 383, @@ -75899,8 +76865,8 @@ "updateContext": null }, "value": "=", - "start": 16841, - "end": 16842, + "start": 16927, + "end": 16928, "loc": { "start": { "line": 383, @@ -75927,8 +76893,8 @@ "updateContext": null }, "value": "false", - "start": 16843, - "end": 16848, + "start": 16929, + "end": 16934, "loc": { "start": { "line": 383, @@ -75953,8 +76919,8 @@ "binop": null, "updateContext": null }, - "start": 16848, - "end": 16849, + "start": 16934, + "end": 16935, "loc": { "start": { "line": 383, @@ -75981,8 +76947,8 @@ "updateContext": null }, "value": "this", - "start": 16878, - "end": 16882, + "start": 16964, + "end": 16968, "loc": { "start": { "line": 384, @@ -76007,8 +76973,8 @@ "binop": null, "updateContext": null }, - "start": 16882, - "end": 16883, + "start": 16968, + "end": 16969, "loc": { "start": { "line": 384, @@ -76033,8 +76999,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 16883, - "end": 16907, + "start": 16969, + "end": 16993, "loc": { "start": { "line": 384, @@ -76059,8 +77025,8 @@ "binop": null, "updateContext": null }, - "start": 16907, - "end": 16908, + "start": 16993, + "end": 16994, "loc": { "start": { "line": 384, @@ -76085,8 +77051,8 @@ "binop": null }, "value": "angleVisible", - "start": 16908, - "end": 16920, + "start": 16994, + "end": 17006, "loc": { "start": { "line": 384, @@ -76112,8 +77078,8 @@ "updateContext": null }, "value": "=", - "start": 16921, - "end": 16922, + "start": 17007, + "end": 17008, "loc": { "start": { "line": 384, @@ -76140,8 +77106,8 @@ "updateContext": null }, "value": "false", - "start": 16923, - "end": 16928, + "start": 17009, + "end": 17014, "loc": { "start": { "line": 384, @@ -76166,8 +77132,8 @@ "binop": null, "updateContext": null }, - "start": 16928, - "end": 16929, + "start": 17014, + "end": 17015, "loc": { "start": { "line": 384, @@ -76194,8 +77160,8 @@ "updateContext": null }, "value": "break", - "start": 16958, - "end": 16963, + "start": 17044, + "end": 17049, "loc": { "start": { "line": 385, @@ -76220,8 +77186,8 @@ "binop": null, "updateContext": null }, - "start": 16963, - "end": 16964, + "start": 17049, + "end": 17050, "loc": { "start": { "line": 385, @@ -76245,8 +77211,8 @@ "postfix": false, "binop": null }, - "start": 16985, - "end": 16986, + "start": 17071, + "end": 17072, "loc": { "start": { "line": 386, @@ -76271,8 +77237,8 @@ "binop": null }, "value": "canvas", - "start": 17007, - "end": 17013, + "start": 17093, + "end": 17099, "loc": { "start": { "line": 387, @@ -76297,8 +77263,8 @@ "binop": null, "updateContext": null }, - "start": 17013, - "end": 17014, + "start": 17099, + "end": 17100, "loc": { "start": { "line": 387, @@ -76323,8 +77289,8 @@ "binop": null }, "value": "style", - "start": 17014, - "end": 17019, + "start": 17100, + "end": 17105, "loc": { "start": { "line": 387, @@ -76349,8 +77315,8 @@ "binop": null, "updateContext": null }, - "start": 17019, - "end": 17020, + "start": 17105, + "end": 17106, "loc": { "start": { "line": 387, @@ -76375,8 +77341,8 @@ "binop": null }, "value": "cursor", - "start": 17020, - "end": 17026, + "start": 17106, + "end": 17112, "loc": { "start": { "line": 387, @@ -76402,8 +77368,8 @@ "updateContext": null }, "value": "=", - "start": 17027, - "end": 17028, + "start": 17113, + "end": 17114, "loc": { "start": { "line": 387, @@ -76429,8 +77395,8 @@ "updateContext": null }, "value": "default", - "start": 17029, - "end": 17038, + "start": 17115, + "end": 17124, "loc": { "start": { "line": 387, @@ -76455,8 +77421,8 @@ "binop": null, "updateContext": null }, - "start": 17038, - "end": 17039, + "start": 17124, + "end": 17125, "loc": { "start": { "line": 387, @@ -76480,8 +77446,8 @@ "postfix": false, "binop": null }, - "start": 17056, - "end": 17057, + "start": 17142, + "end": 17143, "loc": { "start": { "line": 388, @@ -76505,8 +77471,8 @@ "postfix": false, "binop": null }, - "start": 17070, - "end": 17071, + "start": 17156, + "end": 17157, "loc": { "start": { "line": 389, @@ -76530,8 +77496,8 @@ "postfix": false, "binop": null }, - "start": 17071, - "end": 17072, + "start": 17157, + "end": 17158, "loc": { "start": { "line": 389, @@ -76556,8 +77522,8 @@ "binop": null, "updateContext": null }, - "start": 17072, - "end": 17073, + "start": 17158, + "end": 17159, "loc": { "start": { "line": 389, @@ -76584,8 +77550,8 @@ "updateContext": null }, "value": "this", - "start": 17082, - "end": 17086, + "start": 17168, + "end": 17172, "loc": { "start": { "line": 390, @@ -76610,8 +77576,8 @@ "binop": null, "updateContext": null }, - "start": 17086, - "end": 17087, + "start": 17172, + "end": 17173, "loc": { "start": { "line": 390, @@ -76636,8 +77602,8 @@ "binop": null }, "value": "_active", - "start": 17087, - "end": 17094, + "start": 17173, + "end": 17180, "loc": { "start": { "line": 390, @@ -76663,8 +77629,8 @@ "updateContext": null }, "value": "=", - "start": 17095, - "end": 17096, + "start": 17181, + "end": 17182, "loc": { "start": { "line": 390, @@ -76691,8 +77657,8 @@ "updateContext": null }, "value": "true", - "start": 17097, - "end": 17101, + "start": 17183, + "end": 17187, "loc": { "start": { "line": 390, @@ -76717,8 +77683,8 @@ "binop": null, "updateContext": null }, - "start": 17101, - "end": 17102, + "start": 17187, + "end": 17188, "loc": { "start": { "line": 390, @@ -76742,8 +77708,8 @@ "postfix": false, "binop": null }, - "start": 17107, - "end": 17108, + "start": 17193, + "end": 17194, "loc": { "start": { "line": 391, @@ -76758,8 +77724,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n ", - "start": 17114, - "end": 17323, + "start": 17200, + "end": 17409, "loc": { "start": { "line": 393, @@ -76784,8 +77750,8 @@ "binop": null }, "value": "deactivate", - "start": 17328, - "end": 17338, + "start": 17414, + "end": 17424, "loc": { "start": { "line": 398, @@ -76809,8 +77775,8 @@ "postfix": false, "binop": null }, - "start": 17338, - "end": 17339, + "start": 17424, + "end": 17425, "loc": { "start": { "line": 398, @@ -76834,8 +77800,8 @@ "postfix": false, "binop": null }, - "start": 17339, - "end": 17340, + "start": 17425, + "end": 17426, "loc": { "start": { "line": 398, @@ -76859,8 +77825,8 @@ "postfix": false, "binop": null }, - "start": 17341, - "end": 17342, + "start": 17427, + "end": 17428, "loc": { "start": { "line": 398, @@ -76887,8 +77853,8 @@ "updateContext": null }, "value": "if", - "start": 17351, - "end": 17353, + "start": 17437, + "end": 17439, "loc": { "start": { "line": 399, @@ -76912,8 +77878,8 @@ "postfix": false, "binop": null }, - "start": 17354, - "end": 17355, + "start": 17440, + "end": 17441, "loc": { "start": { "line": 399, @@ -76939,8 +77905,8 @@ "updateContext": null }, "value": "!", - "start": 17355, - "end": 17356, + "start": 17441, + "end": 17442, "loc": { "start": { "line": 399, @@ -76967,8 +77933,8 @@ "updateContext": null }, "value": "this", - "start": 17356, - "end": 17360, + "start": 17442, + "end": 17446, "loc": { "start": { "line": 399, @@ -76993,8 +77959,8 @@ "binop": null, "updateContext": null }, - "start": 17360, - "end": 17361, + "start": 17446, + "end": 17447, "loc": { "start": { "line": 399, @@ -77019,8 +77985,8 @@ "binop": null }, "value": "_active", - "start": 17361, - "end": 17368, + "start": 17447, + "end": 17454, "loc": { "start": { "line": 399, @@ -77044,8 +78010,8 @@ "postfix": false, "binop": null }, - "start": 17368, - "end": 17369, + "start": 17454, + "end": 17455, "loc": { "start": { "line": 399, @@ -77069,8 +78035,8 @@ "postfix": false, "binop": null }, - "start": 17370, - "end": 17371, + "start": 17456, + "end": 17457, "loc": { "start": { "line": 399, @@ -77097,8 +78063,8 @@ "updateContext": null }, "value": "return", - "start": 17384, - "end": 17390, + "start": 17470, + "end": 17476, "loc": { "start": { "line": 400, @@ -77123,8 +78089,8 @@ "binop": null, "updateContext": null }, - "start": 17390, - "end": 17391, + "start": 17476, + "end": 17477, "loc": { "start": { "line": 400, @@ -77148,8 +78114,8 @@ "postfix": false, "binop": null }, - "start": 17400, - "end": 17401, + "start": 17486, + "end": 17487, "loc": { "start": { "line": 401, @@ -77176,8 +78142,8 @@ "updateContext": null }, "value": "if", - "start": 17410, - "end": 17412, + "start": 17496, + "end": 17498, "loc": { "start": { "line": 402, @@ -77201,8 +78167,8 @@ "postfix": false, "binop": null }, - "start": 17413, - "end": 17414, + "start": 17499, + "end": 17500, "loc": { "start": { "line": 402, @@ -77229,8 +78195,8 @@ "updateContext": null }, "value": "this", - "start": 17414, - "end": 17418, + "start": 17500, + "end": 17504, "loc": { "start": { "line": 402, @@ -77255,8 +78221,8 @@ "binop": null, "updateContext": null }, - "start": 17418, - "end": 17419, + "start": 17504, + "end": 17505, "loc": { "start": { "line": 402, @@ -77281,8 +78247,8 @@ "binop": null }, "value": "pointerLens", - "start": 17419, - "end": 17430, + "start": 17505, + "end": 17516, "loc": { "start": { "line": 402, @@ -77306,8 +78272,8 @@ "postfix": false, "binop": null }, - "start": 17430, - "end": 17431, + "start": 17516, + "end": 17517, "loc": { "start": { "line": 402, @@ -77331,8 +78297,8 @@ "postfix": false, "binop": null }, - "start": 17432, - "end": 17433, + "start": 17518, + "end": 17519, "loc": { "start": { "line": 402, @@ -77359,8 +78325,8 @@ "updateContext": null }, "value": "this", - "start": 17446, - "end": 17450, + "start": 17532, + "end": 17536, "loc": { "start": { "line": 403, @@ -77385,8 +78351,8 @@ "binop": null, "updateContext": null }, - "start": 17450, - "end": 17451, + "start": 17536, + "end": 17537, "loc": { "start": { "line": 403, @@ -77411,8 +78377,8 @@ "binop": null }, "value": "pointerLens", - "start": 17451, - "end": 17462, + "start": 17537, + "end": 17548, "loc": { "start": { "line": 403, @@ -77437,8 +78403,8 @@ "binop": null, "updateContext": null }, - "start": 17462, - "end": 17463, + "start": 17548, + "end": 17549, "loc": { "start": { "line": 403, @@ -77463,8 +78429,8 @@ "binop": null }, "value": "visible", - "start": 17463, - "end": 17470, + "start": 17549, + "end": 17556, "loc": { "start": { "line": 403, @@ -77490,8 +78456,8 @@ "updateContext": null }, "value": "=", - "start": 17471, - "end": 17472, + "start": 17557, + "end": 17558, "loc": { "start": { "line": 403, @@ -77518,8 +78484,8 @@ "updateContext": null }, "value": "false", - "start": 17473, - "end": 17478, + "start": 17559, + "end": 17564, "loc": { "start": { "line": 403, @@ -77544,8 +78510,8 @@ "binop": null, "updateContext": null }, - "start": 17478, - "end": 17479, + "start": 17564, + "end": 17565, "loc": { "start": { "line": 403, @@ -77569,8 +78535,8 @@ "postfix": false, "binop": null }, - "start": 17488, - "end": 17489, + "start": 17574, + "end": 17575, "loc": { "start": { "line": 404, @@ -77597,8 +78563,8 @@ "updateContext": null }, "value": "if", - "start": 17498, - "end": 17500, + "start": 17584, + "end": 17586, "loc": { "start": { "line": 405, @@ -77622,8 +78588,8 @@ "postfix": false, "binop": null }, - "start": 17501, - "end": 17502, + "start": 17587, + "end": 17588, "loc": { "start": { "line": 405, @@ -77650,8 +78616,8 @@ "updateContext": null }, "value": "this", - "start": 17502, - "end": 17506, + "start": 17588, + "end": 17592, "loc": { "start": { "line": 405, @@ -77676,8 +78642,8 @@ "binop": null, "updateContext": null }, - "start": 17506, - "end": 17507, + "start": 17592, + "end": 17593, "loc": { "start": { "line": 405, @@ -77702,8 +78668,8 @@ "binop": null }, "value": "markerDiv", - "start": 17507, - "end": 17516, + "start": 17593, + "end": 17602, "loc": { "start": { "line": 405, @@ -77727,8 +78693,8 @@ "postfix": false, "binop": null }, - "start": 17516, - "end": 17517, + "start": 17602, + "end": 17603, "loc": { "start": { "line": 405, @@ -77752,8 +78718,8 @@ "postfix": false, "binop": null }, - "start": 17518, - "end": 17519, + "start": 17604, + "end": 17605, "loc": { "start": { "line": 405, @@ -77780,8 +78746,8 @@ "updateContext": null }, "value": "this", - "start": 17532, - "end": 17536, + "start": 17618, + "end": 17622, "loc": { "start": { "line": 406, @@ -77806,8 +78772,8 @@ "binop": null, "updateContext": null }, - "start": 17536, - "end": 17537, + "start": 17622, + "end": 17623, "loc": { "start": { "line": 406, @@ -77832,8 +78798,8 @@ "binop": null }, "value": "_destroyMarkerDiv", - "start": 17537, - "end": 17554, + "start": 17623, + "end": 17640, "loc": { "start": { "line": 406, @@ -77857,8 +78823,8 @@ "postfix": false, "binop": null }, - "start": 17554, - "end": 17555, + "start": 17640, + "end": 17641, "loc": { "start": { "line": 406, @@ -77882,8 +78848,8 @@ "postfix": false, "binop": null }, - "start": 17555, - "end": 17556, + "start": 17641, + "end": 17642, "loc": { "start": { "line": 406, @@ -77907,8 +78873,8 @@ "postfix": false, "binop": null }, - "start": 17565, - "end": 17566, + "start": 17651, + "end": 17652, "loc": { "start": { "line": 407, @@ -77935,8 +78901,8 @@ "updateContext": null }, "value": "this", - "start": 17575, - "end": 17579, + "start": 17661, + "end": 17665, "loc": { "start": { "line": 408, @@ -77961,8 +78927,8 @@ "binop": null, "updateContext": null }, - "start": 17579, - "end": 17580, + "start": 17665, + "end": 17666, "loc": { "start": { "line": 408, @@ -77987,8 +78953,8 @@ "binop": null }, "value": "reset", - "start": 17580, - "end": 17585, + "start": 17666, + "end": 17671, "loc": { "start": { "line": 408, @@ -78012,8 +78978,8 @@ "postfix": false, "binop": null }, - "start": 17585, - "end": 17586, + "start": 17671, + "end": 17672, "loc": { "start": { "line": 408, @@ -78037,8 +79003,8 @@ "postfix": false, "binop": null }, - "start": 17586, - "end": 17587, + "start": 17672, + "end": 17673, "loc": { "start": { "line": 408, @@ -78063,8 +79029,8 @@ "binop": null, "updateContext": null }, - "start": 17587, - "end": 17588, + "start": 17673, + "end": 17674, "loc": { "start": { "line": 408, @@ -78091,8 +79057,8 @@ "updateContext": null }, "value": "const", - "start": 17597, - "end": 17602, + "start": 17683, + "end": 17688, "loc": { "start": { "line": 409, @@ -78117,8 +79083,8 @@ "binop": null }, "value": "canvas", - "start": 17603, - "end": 17609, + "start": 17689, + "end": 17695, "loc": { "start": { "line": 409, @@ -78144,8 +79110,8 @@ "updateContext": null }, "value": "=", - "start": 17610, - "end": 17611, + "start": 17696, + "end": 17697, "loc": { "start": { "line": 409, @@ -78172,8 +79138,8 @@ "updateContext": null }, "value": "this", - "start": 17612, - "end": 17616, + "start": 17698, + "end": 17702, "loc": { "start": { "line": 409, @@ -78198,8 +79164,8 @@ "binop": null, "updateContext": null }, - "start": 17616, - "end": 17617, + "start": 17702, + "end": 17703, "loc": { "start": { "line": 409, @@ -78224,8 +79190,8 @@ "binop": null }, "value": "scene", - "start": 17617, - "end": 17622, + "start": 17703, + "end": 17708, "loc": { "start": { "line": 409, @@ -78250,8 +79216,8 @@ "binop": null, "updateContext": null }, - "start": 17622, - "end": 17623, + "start": 17708, + "end": 17709, "loc": { "start": { "line": 409, @@ -78276,8 +79242,8 @@ "binop": null }, "value": "canvas", - "start": 17623, - "end": 17629, + "start": 17709, + "end": 17715, "loc": { "start": { "line": 409, @@ -78302,8 +79268,8 @@ "binop": null, "updateContext": null }, - "start": 17629, - "end": 17630, + "start": 17715, + "end": 17716, "loc": { "start": { "line": 409, @@ -78328,8 +79294,8 @@ "binop": null }, "value": "canvas", - "start": 17630, - "end": 17636, + "start": 17716, + "end": 17722, "loc": { "start": { "line": 409, @@ -78354,8 +79320,8 @@ "binop": null, "updateContext": null }, - "start": 17636, - "end": 17637, + "start": 17722, + "end": 17723, "loc": { "start": { "line": 409, @@ -78380,8 +79346,8 @@ "binop": null }, "value": "canvas", - "start": 17646, - "end": 17652, + "start": 17732, + "end": 17738, "loc": { "start": { "line": 410, @@ -78406,8 +79372,8 @@ "binop": null, "updateContext": null }, - "start": 17652, - "end": 17653, + "start": 17738, + "end": 17739, "loc": { "start": { "line": 410, @@ -78432,8 +79398,8 @@ "binop": null }, "value": "removeEventListener", - "start": 17653, - "end": 17672, + "start": 17739, + "end": 17758, "loc": { "start": { "line": 410, @@ -78457,8 +79423,8 @@ "postfix": false, "binop": null }, - "start": 17672, - "end": 17673, + "start": 17758, + "end": 17759, "loc": { "start": { "line": 410, @@ -78484,8 +79450,8 @@ "updateContext": null }, "value": "mousedown", - "start": 17673, - "end": 17684, + "start": 17759, + "end": 17770, "loc": { "start": { "line": 410, @@ -78510,8 +79476,8 @@ "binop": null, "updateContext": null }, - "start": 17684, - "end": 17685, + "start": 17770, + "end": 17771, "loc": { "start": { "line": 410, @@ -78538,8 +79504,8 @@ "updateContext": null }, "value": "this", - "start": 17686, - "end": 17690, + "start": 17772, + "end": 17776, "loc": { "start": { "line": 410, @@ -78564,8 +79530,8 @@ "binop": null, "updateContext": null }, - "start": 17690, - "end": 17691, + "start": 17776, + "end": 17777, "loc": { "start": { "line": 410, @@ -78590,8 +79556,8 @@ "binop": null }, "value": "_onMouseDown", - "start": 17691, - "end": 17703, + "start": 17777, + "end": 17789, "loc": { "start": { "line": 410, @@ -78615,8 +79581,8 @@ "postfix": false, "binop": null }, - "start": 17703, - "end": 17704, + "start": 17789, + "end": 17790, "loc": { "start": { "line": 410, @@ -78641,8 +79607,8 @@ "binop": null, "updateContext": null }, - "start": 17704, - "end": 17705, + "start": 17790, + "end": 17791, "loc": { "start": { "line": 410, @@ -78667,8 +79633,8 @@ "binop": null }, "value": "canvas", - "start": 17714, - "end": 17720, + "start": 17800, + "end": 17806, "loc": { "start": { "line": 411, @@ -78693,8 +79659,8 @@ "binop": null, "updateContext": null }, - "start": 17720, - "end": 17721, + "start": 17806, + "end": 17807, "loc": { "start": { "line": 411, @@ -78719,8 +79685,8 @@ "binop": null }, "value": "removeEventListener", - "start": 17721, - "end": 17740, + "start": 17807, + "end": 17826, "loc": { "start": { "line": 411, @@ -78744,8 +79710,8 @@ "postfix": false, "binop": null }, - "start": 17740, - "end": 17741, + "start": 17826, + "end": 17827, "loc": { "start": { "line": 411, @@ -78771,8 +79737,8 @@ "updateContext": null }, "value": "mouseup", - "start": 17741, - "end": 17750, + "start": 17827, + "end": 17836, "loc": { "start": { "line": 411, @@ -78797,8 +79763,8 @@ "binop": null, "updateContext": null }, - "start": 17750, - "end": 17751, + "start": 17836, + "end": 17837, "loc": { "start": { "line": 411, @@ -78825,8 +79791,8 @@ "updateContext": null }, "value": "this", - "start": 17752, - "end": 17756, + "start": 17838, + "end": 17842, "loc": { "start": { "line": 411, @@ -78851,8 +79817,8 @@ "binop": null, "updateContext": null }, - "start": 17756, - "end": 17757, + "start": 17842, + "end": 17843, "loc": { "start": { "line": 411, @@ -78877,8 +79843,8 @@ "binop": null }, "value": "_onMouseUp", - "start": 17757, - "end": 17767, + "start": 17843, + "end": 17853, "loc": { "start": { "line": 411, @@ -78902,8 +79868,8 @@ "postfix": false, "binop": null }, - "start": 17767, - "end": 17768, + "start": 17853, + "end": 17854, "loc": { "start": { "line": 411, @@ -78928,8 +79894,8 @@ "binop": null, "updateContext": null }, - "start": 17768, - "end": 17769, + "start": 17854, + "end": 17855, "loc": { "start": { "line": 411, @@ -78956,8 +79922,8 @@ "updateContext": null }, "value": "const", - "start": 17778, - "end": 17783, + "start": 17864, + "end": 17869, "loc": { "start": { "line": 412, @@ -78982,8 +79948,8 @@ "binop": null }, "value": "cameraControl", - "start": 17784, - "end": 17797, + "start": 17870, + "end": 17883, "loc": { "start": { "line": 412, @@ -79009,8 +79975,8 @@ "updateContext": null }, "value": "=", - "start": 17798, - "end": 17799, + "start": 17884, + "end": 17885, "loc": { "start": { "line": 412, @@ -79037,8 +80003,8 @@ "updateContext": null }, "value": "this", - "start": 17800, - "end": 17804, + "start": 17886, + "end": 17890, "loc": { "start": { "line": 412, @@ -79063,8 +80029,8 @@ "binop": null, "updateContext": null }, - "start": 17804, - "end": 17805, + "start": 17890, + "end": 17891, "loc": { "start": { "line": 412, @@ -79089,8 +80055,8 @@ "binop": null }, "value": "angleMeasurementsPlugin", - "start": 17805, - "end": 17828, + "start": 17891, + "end": 17914, "loc": { "start": { "line": 412, @@ -79115,8 +80081,8 @@ "binop": null, "updateContext": null }, - "start": 17828, - "end": 17829, + "start": 17914, + "end": 17915, "loc": { "start": { "line": 412, @@ -79141,8 +80107,8 @@ "binop": null }, "value": "viewer", - "start": 17829, - "end": 17835, + "start": 17915, + "end": 17921, "loc": { "start": { "line": 412, @@ -79167,8 +80133,8 @@ "binop": null, "updateContext": null }, - "start": 17835, - "end": 17836, + "start": 17921, + "end": 17922, "loc": { "start": { "line": 412, @@ -79193,8 +80159,8 @@ "binop": null }, "value": "cameraControl", - "start": 17836, - "end": 17849, + "start": 17922, + "end": 17935, "loc": { "start": { "line": 412, @@ -79219,8 +80185,8 @@ "binop": null, "updateContext": null }, - "start": 17849, - "end": 17850, + "start": 17935, + "end": 17936, "loc": { "start": { "line": 412, @@ -79245,8 +80211,8 @@ "binop": null }, "value": "cameraControl", - "start": 17859, - "end": 17872, + "start": 17945, + "end": 17958, "loc": { "start": { "line": 413, @@ -79271,8 +80237,8 @@ "binop": null, "updateContext": null }, - "start": 17872, - "end": 17873, + "start": 17958, + "end": 17959, "loc": { "start": { "line": 413, @@ -79297,8 +80263,8 @@ "binop": null }, "value": "off", - "start": 17873, - "end": 17876, + "start": 17959, + "end": 17962, "loc": { "start": { "line": 413, @@ -79322,8 +80288,8 @@ "postfix": false, "binop": null }, - "start": 17876, - "end": 17877, + "start": 17962, + "end": 17963, "loc": { "start": { "line": 413, @@ -79350,8 +80316,8 @@ "updateContext": null }, "value": "this", - "start": 17877, - "end": 17881, + "start": 17963, + "end": 17967, "loc": { "start": { "line": 413, @@ -79376,8 +80342,8 @@ "binop": null, "updateContext": null }, - "start": 17881, - "end": 17882, + "start": 17967, + "end": 17968, "loc": { "start": { "line": 413, @@ -79402,8 +80368,8 @@ "binop": null }, "value": "_onMouseHoverSurface", - "start": 17882, - "end": 17902, + "start": 17968, + "end": 17988, "loc": { "start": { "line": 413, @@ -79427,8 +80393,8 @@ "postfix": false, "binop": null }, - "start": 17902, - "end": 17903, + "start": 17988, + "end": 17989, "loc": { "start": { "line": 413, @@ -79453,8 +80419,8 @@ "binop": null, "updateContext": null }, - "start": 17903, - "end": 17904, + "start": 17989, + "end": 17990, "loc": { "start": { "line": 413, @@ -79479,8 +80445,8 @@ "binop": null }, "value": "cameraControl", - "start": 17913, - "end": 17926, + "start": 17999, + "end": 18012, "loc": { "start": { "line": 414, @@ -79505,8 +80471,8 @@ "binop": null, "updateContext": null }, - "start": 17926, - "end": 17927, + "start": 18012, + "end": 18013, "loc": { "start": { "line": 414, @@ -79531,8 +80497,8 @@ "binop": null }, "value": "off", - "start": 17927, - "end": 17930, + "start": 18013, + "end": 18016, "loc": { "start": { "line": 414, @@ -79556,8 +80522,8 @@ "postfix": false, "binop": null }, - "start": 17930, - "end": 17931, + "start": 18016, + "end": 18017, "loc": { "start": { "line": 414, @@ -79584,8 +80550,8 @@ "updateContext": null }, "value": "this", - "start": 17931, - "end": 17935, + "start": 18017, + "end": 18021, "loc": { "start": { "line": 414, @@ -79610,8 +80576,8 @@ "binop": null, "updateContext": null }, - "start": 17935, - "end": 17936, + "start": 18021, + "end": 18022, "loc": { "start": { "line": 414, @@ -79636,8 +80602,8 @@ "binop": null }, "value": "_onPickedSurface", - "start": 17936, - "end": 17952, + "start": 18022, + "end": 18038, "loc": { "start": { "line": 414, @@ -79661,8 +80627,8 @@ "postfix": false, "binop": null }, - "start": 17952, - "end": 17953, + "start": 18038, + "end": 18039, "loc": { "start": { "line": 414, @@ -79687,8 +80653,8 @@ "binop": null, "updateContext": null }, - "start": 17953, - "end": 17954, + "start": 18039, + "end": 18040, "loc": { "start": { "line": 414, @@ -79713,8 +80679,8 @@ "binop": null }, "value": "cameraControl", - "start": 17963, - "end": 17976, + "start": 18049, + "end": 18062, "loc": { "start": { "line": 415, @@ -79739,8 +80705,8 @@ "binop": null, "updateContext": null }, - "start": 17976, - "end": 17977, + "start": 18062, + "end": 18063, "loc": { "start": { "line": 415, @@ -79765,8 +80731,8 @@ "binop": null }, "value": "off", - "start": 17977, - "end": 17980, + "start": 18063, + "end": 18066, "loc": { "start": { "line": 415, @@ -79790,8 +80756,8 @@ "postfix": false, "binop": null }, - "start": 17980, - "end": 17981, + "start": 18066, + "end": 18067, "loc": { "start": { "line": 415, @@ -79818,8 +80784,8 @@ "updateContext": null }, "value": "this", - "start": 17981, - "end": 17985, + "start": 18067, + "end": 18071, "loc": { "start": { "line": 415, @@ -79844,8 +80810,8 @@ "binop": null, "updateContext": null }, - "start": 17985, - "end": 17986, + "start": 18071, + "end": 18072, "loc": { "start": { "line": 415, @@ -79870,8 +80836,8 @@ "binop": null }, "value": "_onHoverNothing", - "start": 17986, - "end": 18001, + "start": 18072, + "end": 18087, "loc": { "start": { "line": 415, @@ -79895,8 +80861,8 @@ "postfix": false, "binop": null }, - "start": 18001, - "end": 18002, + "start": 18087, + "end": 18088, "loc": { "start": { "line": 415, @@ -79921,8 +80887,8 @@ "binop": null, "updateContext": null }, - "start": 18002, - "end": 18003, + "start": 18088, + "end": 18089, "loc": { "start": { "line": 415, @@ -79947,8 +80913,8 @@ "binop": null }, "value": "cameraControl", - "start": 18012, - "end": 18025, + "start": 18098, + "end": 18111, "loc": { "start": { "line": 416, @@ -79973,8 +80939,8 @@ "binop": null, "updateContext": null }, - "start": 18025, - "end": 18026, + "start": 18111, + "end": 18112, "loc": { "start": { "line": 416, @@ -79999,8 +80965,8 @@ "binop": null }, "value": "off", - "start": 18026, - "end": 18029, + "start": 18112, + "end": 18115, "loc": { "start": { "line": 416, @@ -80024,8 +80990,8 @@ "postfix": false, "binop": null }, - "start": 18029, - "end": 18030, + "start": 18115, + "end": 18116, "loc": { "start": { "line": 416, @@ -80052,8 +81018,8 @@ "updateContext": null }, "value": "this", - "start": 18030, - "end": 18034, + "start": 18116, + "end": 18120, "loc": { "start": { "line": 416, @@ -80078,8 +81044,8 @@ "binop": null, "updateContext": null }, - "start": 18034, - "end": 18035, + "start": 18120, + "end": 18121, "loc": { "start": { "line": 416, @@ -80104,8 +81070,8 @@ "binop": null }, "value": "_onPickedNothing", - "start": 18035, - "end": 18051, + "start": 18121, + "end": 18137, "loc": { "start": { "line": 416, @@ -80129,8 +81095,8 @@ "postfix": false, "binop": null }, - "start": 18051, - "end": 18052, + "start": 18137, + "end": 18138, "loc": { "start": { "line": 416, @@ -80155,8 +81121,8 @@ "binop": null, "updateContext": null }, - "start": 18052, - "end": 18053, + "start": 18138, + "end": 18139, "loc": { "start": { "line": 416, @@ -80183,8 +81149,8 @@ "updateContext": null }, "value": "this", - "start": 18062, - "end": 18066, + "start": 18148, + "end": 18152, "loc": { "start": { "line": 417, @@ -80209,8 +81175,8 @@ "binop": null, "updateContext": null }, - "start": 18066, - "end": 18067, + "start": 18152, + "end": 18153, "loc": { "start": { "line": 417, @@ -80235,8 +81201,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 18067, - "end": 18091, + "start": 18153, + "end": 18177, "loc": { "start": { "line": 417, @@ -80262,8 +81228,8 @@ "updateContext": null }, "value": "=", - "start": 18092, - "end": 18093, + "start": 18178, + "end": 18179, "loc": { "start": { "line": 417, @@ -80290,8 +81256,8 @@ "updateContext": null }, "value": "null", - "start": 18094, - "end": 18098, + "start": 18180, + "end": 18184, "loc": { "start": { "line": 417, @@ -80316,8 +81282,8 @@ "binop": null, "updateContext": null }, - "start": 18098, - "end": 18099, + "start": 18184, + "end": 18185, "loc": { "start": { "line": 417, @@ -80344,8 +81310,8 @@ "updateContext": null }, "value": "this", - "start": 18108, - "end": 18112, + "start": 18194, + "end": 18198, "loc": { "start": { "line": 418, @@ -80370,8 +81336,8 @@ "binop": null, "updateContext": null }, - "start": 18112, - "end": 18113, + "start": 18198, + "end": 18199, "loc": { "start": { "line": 418, @@ -80396,8 +81362,8 @@ "binop": null }, "value": "_active", - "start": 18113, - "end": 18120, + "start": 18199, + "end": 18206, "loc": { "start": { "line": 418, @@ -80423,8 +81389,8 @@ "updateContext": null }, "value": "=", - "start": 18121, - "end": 18122, + "start": 18207, + "end": 18208, "loc": { "start": { "line": 418, @@ -80451,8 +81417,8 @@ "updateContext": null }, "value": "false", - "start": 18123, - "end": 18128, + "start": 18209, + "end": 18214, "loc": { "start": { "line": 418, @@ -80477,8 +81443,8 @@ "binop": null, "updateContext": null }, - "start": 18128, - "end": 18129, + "start": 18214, + "end": 18215, "loc": { "start": { "line": 418, @@ -80502,8 +81468,8 @@ "postfix": false, "binop": null }, - "start": 18134, - "end": 18135, + "start": 18220, + "end": 18221, "loc": { "start": { "line": 419, @@ -80518,8 +81484,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n ", - "start": 18141, - "end": 18391, + "start": 18227, + "end": 18477, "loc": { "start": { "line": 421, @@ -80544,8 +81510,8 @@ "binop": null }, "value": "reset", - "start": 18396, - "end": 18401, + "start": 18482, + "end": 18487, "loc": { "start": { "line": 428, @@ -80569,8 +81535,8 @@ "postfix": false, "binop": null }, - "start": 18401, - "end": 18402, + "start": 18487, + "end": 18488, "loc": { "start": { "line": 428, @@ -80594,8 +81560,8 @@ "postfix": false, "binop": null }, - "start": 18402, - "end": 18403, + "start": 18488, + "end": 18489, "loc": { "start": { "line": 428, @@ -80619,8 +81585,8 @@ "postfix": false, "binop": null }, - "start": 18404, - "end": 18405, + "start": 18490, + "end": 18491, "loc": { "start": { "line": 428, @@ -80647,8 +81613,8 @@ "updateContext": null }, "value": "if", - "start": 18414, - "end": 18416, + "start": 18500, + "end": 18502, "loc": { "start": { "line": 429, @@ -80672,8 +81638,8 @@ "postfix": false, "binop": null }, - "start": 18417, - "end": 18418, + "start": 18503, + "end": 18504, "loc": { "start": { "line": 429, @@ -80699,8 +81665,8 @@ "updateContext": null }, "value": "!", - "start": 18418, - "end": 18419, + "start": 18504, + "end": 18505, "loc": { "start": { "line": 429, @@ -80727,8 +81693,8 @@ "updateContext": null }, "value": "this", - "start": 18419, - "end": 18423, + "start": 18505, + "end": 18509, "loc": { "start": { "line": 429, @@ -80753,8 +81719,8 @@ "binop": null, "updateContext": null }, - "start": 18423, - "end": 18424, + "start": 18509, + "end": 18510, "loc": { "start": { "line": 429, @@ -80779,8 +81745,8 @@ "binop": null }, "value": "_active", - "start": 18424, - "end": 18431, + "start": 18510, + "end": 18517, "loc": { "start": { "line": 429, @@ -80804,8 +81770,8 @@ "postfix": false, "binop": null }, - "start": 18431, - "end": 18432, + "start": 18517, + "end": 18518, "loc": { "start": { "line": 429, @@ -80829,8 +81795,8 @@ "postfix": false, "binop": null }, - "start": 18433, - "end": 18434, + "start": 18519, + "end": 18520, "loc": { "start": { "line": 429, @@ -80857,8 +81823,8 @@ "updateContext": null }, "value": "return", - "start": 18447, - "end": 18453, + "start": 18533, + "end": 18539, "loc": { "start": { "line": 430, @@ -80883,8 +81849,8 @@ "binop": null, "updateContext": null }, - "start": 18453, - "end": 18454, + "start": 18539, + "end": 18540, "loc": { "start": { "line": 430, @@ -80908,8 +81874,8 @@ "postfix": false, "binop": null }, - "start": 18463, - "end": 18464, + "start": 18549, + "end": 18550, "loc": { "start": { "line": 431, @@ -80936,8 +81902,8 @@ "updateContext": null }, "value": "this", - "start": 18474, - "end": 18478, + "start": 18560, + "end": 18564, "loc": { "start": { "line": 433, @@ -80962,8 +81928,8 @@ "binop": null, "updateContext": null }, - "start": 18478, - "end": 18479, + "start": 18564, + "end": 18565, "loc": { "start": { "line": 433, @@ -80988,8 +81954,8 @@ "binop": null }, "value": "_destroyMarkerDiv", - "start": 18479, - "end": 18496, + "start": 18565, + "end": 18582, "loc": { "start": { "line": 433, @@ -81013,8 +81979,8 @@ "postfix": false, "binop": null }, - "start": 18496, - "end": 18497, + "start": 18582, + "end": 18583, "loc": { "start": { "line": 433, @@ -81038,8 +82004,8 @@ "postfix": false, "binop": null }, - "start": 18497, - "end": 18498, + "start": 18583, + "end": 18584, "loc": { "start": { "line": 433, @@ -81066,8 +82032,8 @@ "updateContext": null }, "value": "this", - "start": 18507, - "end": 18511, + "start": 18593, + "end": 18597, "loc": { "start": { "line": 434, @@ -81092,8 +82058,8 @@ "binop": null, "updateContext": null }, - "start": 18511, - "end": 18512, + "start": 18597, + "end": 18598, "loc": { "start": { "line": 434, @@ -81118,8 +82084,8 @@ "binop": null }, "value": "_initMarkerDiv", - "start": 18512, - "end": 18526, + "start": 18598, + "end": 18612, "loc": { "start": { "line": 434, @@ -81143,8 +82109,8 @@ "postfix": false, "binop": null }, - "start": 18526, - "end": 18527, + "start": 18612, + "end": 18613, "loc": { "start": { "line": 434, @@ -81168,8 +82134,8 @@ "postfix": false, "binop": null }, - "start": 18527, - "end": 18528, + "start": 18613, + "end": 18614, "loc": { "start": { "line": 434, @@ -81196,8 +82162,8 @@ "updateContext": null }, "value": "if", - "start": 18538, - "end": 18540, + "start": 18624, + "end": 18626, "loc": { "start": { "line": 436, @@ -81221,8 +82187,8 @@ "postfix": false, "binop": null }, - "start": 18541, - "end": 18542, + "start": 18627, + "end": 18628, "loc": { "start": { "line": 436, @@ -81249,8 +82215,8 @@ "updateContext": null }, "value": "this", - "start": 18542, - "end": 18546, + "start": 18628, + "end": 18632, "loc": { "start": { "line": 436, @@ -81275,8 +82241,8 @@ "binop": null, "updateContext": null }, - "start": 18546, - "end": 18547, + "start": 18632, + "end": 18633, "loc": { "start": { "line": 436, @@ -81301,8 +82267,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 18547, - "end": 18571, + "start": 18633, + "end": 18657, "loc": { "start": { "line": 436, @@ -81326,8 +82292,8 @@ "postfix": false, "binop": null }, - "start": 18571, - "end": 18572, + "start": 18657, + "end": 18658, "loc": { "start": { "line": 436, @@ -81351,8 +82317,8 @@ "postfix": false, "binop": null }, - "start": 18573, - "end": 18574, + "start": 18659, + "end": 18660, "loc": { "start": { "line": 436, @@ -81379,8 +82345,8 @@ "updateContext": null }, "value": "this", - "start": 18587, - "end": 18591, + "start": 18673, + "end": 18677, "loc": { "start": { "line": 437, @@ -81405,8 +82371,8 @@ "binop": null, "updateContext": null }, - "start": 18591, - "end": 18592, + "start": 18677, + "end": 18678, "loc": { "start": { "line": 437, @@ -81431,8 +82397,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 18592, - "end": 18616, + "start": 18678, + "end": 18702, "loc": { "start": { "line": 437, @@ -81457,8 +82423,8 @@ "binop": null, "updateContext": null }, - "start": 18616, - "end": 18617, + "start": 18702, + "end": 18703, "loc": { "start": { "line": 437, @@ -81483,8 +82449,8 @@ "binop": null }, "value": "destroy", - "start": 18617, - "end": 18624, + "start": 18703, + "end": 18710, "loc": { "start": { "line": 437, @@ -81508,8 +82474,8 @@ "postfix": false, "binop": null }, - "start": 18624, - "end": 18625, + "start": 18710, + "end": 18711, "loc": { "start": { "line": 437, @@ -81533,8 +82499,8 @@ "postfix": false, "binop": null }, - "start": 18625, - "end": 18626, + "start": 18711, + "end": 18712, "loc": { "start": { "line": 437, @@ -81559,8 +82525,8 @@ "binop": null, "updateContext": null }, - "start": 18626, - "end": 18627, + "start": 18712, + "end": 18713, "loc": { "start": { "line": 437, @@ -81587,8 +82553,8 @@ "updateContext": null }, "value": "this", - "start": 18640, - "end": 18644, + "start": 18726, + "end": 18730, "loc": { "start": { "line": 438, @@ -81613,8 +82579,8 @@ "binop": null, "updateContext": null }, - "start": 18644, - "end": 18645, + "start": 18730, + "end": 18731, "loc": { "start": { "line": 438, @@ -81639,8 +82605,8 @@ "binop": null }, "value": "_currentAngleMeasurement", - "start": 18645, - "end": 18669, + "start": 18731, + "end": 18755, "loc": { "start": { "line": 438, @@ -81666,8 +82632,8 @@ "updateContext": null }, "value": "=", - "start": 18670, - "end": 18671, + "start": 18756, + "end": 18757, "loc": { "start": { "line": 438, @@ -81694,8 +82660,8 @@ "updateContext": null }, "value": "null", - "start": 18672, - "end": 18676, + "start": 18758, + "end": 18762, "loc": { "start": { "line": 438, @@ -81720,8 +82686,8 @@ "binop": null, "updateContext": null }, - "start": 18676, - "end": 18677, + "start": 18762, + "end": 18763, "loc": { "start": { "line": 438, @@ -81745,8 +82711,8 @@ "postfix": false, "binop": null }, - "start": 18686, - "end": 18687, + "start": 18772, + "end": 18773, "loc": { "start": { "line": 439, @@ -81773,8 +82739,8 @@ "updateContext": null }, "value": "this", - "start": 18696, - "end": 18700, + "start": 18782, + "end": 18786, "loc": { "start": { "line": 440, @@ -81799,8 +82765,8 @@ "binop": null, "updateContext": null }, - "start": 18700, - "end": 18701, + "start": 18786, + "end": 18787, "loc": { "start": { "line": 440, @@ -81825,8 +82791,8 @@ "binop": null }, "value": "_mouseState", - "start": 18701, - "end": 18712, + "start": 18787, + "end": 18798, "loc": { "start": { "line": 440, @@ -81852,8 +82818,8 @@ "updateContext": null }, "value": "=", - "start": 18713, - "end": 18714, + "start": 18799, + "end": 18800, "loc": { "start": { "line": 440, @@ -81878,8 +82844,8 @@ "binop": null }, "value": "MOUSE_FINDING_ORIGIN", - "start": 18715, - "end": 18735, + "start": 18801, + "end": 18821, "loc": { "start": { "line": 440, @@ -81904,8 +82870,8 @@ "binop": null, "updateContext": null }, - "start": 18735, - "end": 18736, + "start": 18821, + "end": 18822, "loc": { "start": { "line": 440, @@ -81929,8 +82895,8 @@ "postfix": false, "binop": null }, - "start": 18741, - "end": 18742, + "start": 18827, + "end": 18828, "loc": { "start": { "line": 441, @@ -81944,16 +82910,318 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", - "start": 18748, - "end": 18811, + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 18834, + "end": 18999, "loc": { "start": { "line": 443, "column": 4 }, "end": { - "line": 445, + "line": 447, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "get", + "start": 19004, + "end": 19007, + "loc": { + "start": { + "line": 448, + "column": 4 + }, + "end": { + "line": 448, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 19008, + "end": 19026, + "loc": { + "start": { + "line": 448, + "column": 8 + }, + "end": { + "line": 448, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 19026, + "end": 19027, + "loc": { + "start": { + "line": 448, + "column": 26 + }, + "end": { + "line": 448, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 19027, + "end": 19028, + "loc": { + "start": { + "line": 448, + "column": 27 + }, + "end": { + "line": 448, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 19029, + "end": 19030, + "loc": { + "start": { + "line": 448, + "column": 29 + }, + "end": { + "line": 448, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 19039, + "end": 19045, + "loc": { + "start": { + "line": 449, + "column": 8 + }, + "end": { + "line": 449, + "column": 14 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 19046, + "end": 19050, + "loc": { + "start": { + "line": 449, + "column": 15 + }, + "end": { + "line": 449, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 19050, + "end": 19051, + "loc": { + "start": { + "line": 449, + "column": 19 + }, + "end": { + "line": 449, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_currentAngleMeasurement", + "start": 19051, + "end": 19075, + "loc": { + "start": { + "line": 449, + "column": 20 + }, + "end": { + "line": 449, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 19075, + "end": 19076, + "loc": { + "start": { + "line": 449, + "column": 44 + }, + "end": { + "line": 449, + "column": 45 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 19081, + "end": 19082, + "loc": { + "start": { + "line": 450, + "column": 4 + }, + "end": { + "line": 450, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsMouseControl.\n ", + "start": 19088, + "end": 19151, + "loc": { + "start": { + "line": 452, + "column": 4 + }, + "end": { + "line": 454, "column": 7 } } @@ -81971,15 +83239,15 @@ "binop": null }, "value": "destroy", - "start": 18816, - "end": 18823, + "start": 19156, + "end": 19163, "loc": { "start": { - "line": 446, + "line": 455, "column": 4 }, "end": { - "line": 446, + "line": 455, "column": 11 } } @@ -81996,15 +83264,15 @@ "postfix": false, "binop": null }, - "start": 18823, - "end": 18824, + "start": 19163, + "end": 19164, "loc": { "start": { - "line": 446, + "line": 455, "column": 11 }, "end": { - "line": 446, + "line": 455, "column": 12 } } @@ -82021,15 +83289,15 @@ "postfix": false, "binop": null }, - "start": 18824, - "end": 18825, + "start": 19164, + "end": 19165, "loc": { "start": { - "line": 446, + "line": 455, "column": 12 }, "end": { - "line": 446, + "line": 455, "column": 13 } } @@ -82046,15 +83314,15 @@ "postfix": false, "binop": null }, - "start": 18826, - "end": 18827, + "start": 19166, + "end": 19167, "loc": { "start": { - "line": 446, + "line": 455, "column": 14 }, "end": { - "line": 446, + "line": 455, "column": 15 } } @@ -82074,15 +83342,15 @@ "updateContext": null }, "value": "this", - "start": 18836, - "end": 18840, + "start": 19176, + "end": 19180, "loc": { "start": { - "line": 447, + "line": 456, "column": 8 }, "end": { - "line": 447, + "line": 456, "column": 12 } } @@ -82100,15 +83368,15 @@ "binop": null, "updateContext": null }, - "start": 18840, - "end": 18841, + "start": 19180, + "end": 19181, "loc": { "start": { - "line": 447, + "line": 456, "column": 12 }, "end": { - "line": 447, + "line": 456, "column": 13 } } @@ -82126,15 +83394,15 @@ "binop": null }, "value": "deactivate", - "start": 18841, - "end": 18851, + "start": 19181, + "end": 19191, "loc": { "start": { - "line": 447, + "line": 456, "column": 13 }, "end": { - "line": 447, + "line": 456, "column": 23 } } @@ -82151,15 +83419,15 @@ "postfix": false, "binop": null }, - "start": 18851, - "end": 18852, + "start": 19191, + "end": 19192, "loc": { "start": { - "line": 447, + "line": 456, "column": 23 }, "end": { - "line": 447, + "line": 456, "column": 24 } } @@ -82176,15 +83444,15 @@ "postfix": false, "binop": null }, - "start": 18852, - "end": 18853, + "start": 19192, + "end": 19193, "loc": { "start": { - "line": 447, + "line": 456, "column": 24 }, "end": { - "line": 447, + "line": 456, "column": 25 } } @@ -82202,15 +83470,15 @@ "binop": null, "updateContext": null }, - "start": 18853, - "end": 18854, + "start": 19193, + "end": 19194, "loc": { "start": { - "line": 447, + "line": 456, "column": 25 }, "end": { - "line": 447, + "line": 456, "column": 26 } } @@ -82230,15 +83498,15 @@ "updateContext": null }, "value": "super", - "start": 18863, - "end": 18868, + "start": 19203, + "end": 19208, "loc": { "start": { - "line": 448, + "line": 457, "column": 8 }, "end": { - "line": 448, + "line": 457, "column": 13 } } @@ -82256,15 +83524,15 @@ "binop": null, "updateContext": null }, - "start": 18868, - "end": 18869, + "start": 19208, + "end": 19209, "loc": { "start": { - "line": 448, + "line": 457, "column": 13 }, "end": { - "line": 448, + "line": 457, "column": 14 } } @@ -82282,15 +83550,15 @@ "binop": null }, "value": "destroy", - "start": 18869, - "end": 18876, + "start": 19209, + "end": 19216, "loc": { "start": { - "line": 448, + "line": 457, "column": 14 }, "end": { - "line": 448, + "line": 457, "column": 21 } } @@ -82307,15 +83575,15 @@ "postfix": false, "binop": null }, - "start": 18876, - "end": 18877, + "start": 19216, + "end": 19217, "loc": { "start": { - "line": 448, + "line": 457, "column": 21 }, "end": { - "line": 448, + "line": 457, "column": 22 } } @@ -82332,15 +83600,15 @@ "postfix": false, "binop": null }, - "start": 18877, - "end": 18878, + "start": 19217, + "end": 19218, "loc": { "start": { - "line": 448, + "line": 457, "column": 22 }, "end": { - "line": 448, + "line": 457, "column": 23 } } @@ -82358,15 +83626,15 @@ "binop": null, "updateContext": null }, - "start": 18878, - "end": 18879, + "start": 19218, + "end": 19219, "loc": { "start": { - "line": 448, + "line": 457, "column": 23 }, "end": { - "line": 448, + "line": 457, "column": 24 } } @@ -82383,15 +83651,15 @@ "postfix": false, "binop": null }, - "start": 18884, - "end": 18885, + "start": 19224, + "end": 19225, "loc": { "start": { - "line": 449, + "line": 458, "column": 4 }, "end": { - "line": 449, + "line": 458, "column": 5 } } @@ -82408,15 +83676,15 @@ "postfix": false, "binop": null }, - "start": 18886, - "end": 18887, + "start": 19226, + "end": 19227, "loc": { "start": { - "line": 450, + "line": 459, "column": 0 }, "end": { - "line": 450, + "line": 459, "column": 1 } } @@ -82434,15 +83702,15 @@ "binop": null, "updateContext": null }, - "start": 18888, - "end": 18888, + "start": 19228, + "end": 19228, "loc": { "start": { - "line": 451, + "line": 460, "column": 0 }, "end": { - "line": 451, + "line": 460, "column": 0 } } diff --git a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.json b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.json index 65d03e9f5f..c005af144b 100644 --- a/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.json +++ b/docs/ast/source/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 45353, + "end": 45607, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 919, + "line": 928, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 45353, + "end": 45607, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 919, + "line": 928, "column": 0 } }, @@ -1007,14 +1007,14 @@ { "type": "ExportNamedDeclaration", "start": 756, - "end": 45352, + "end": 45606, "loc": { "start": { "line": 26, "column": 0 }, "end": { - "line": 918, + "line": 927, "column": 1 } }, @@ -1023,14 +1023,14 @@ "declaration": { "type": "ClassDeclaration", "start": 763, - "end": 45352, + "end": 45606, "loc": { "start": { "line": 26, "column": 7 }, "end": { - "line": 918, + "line": 927, "column": 1 } }, @@ -1072,14 +1072,14 @@ "body": { "type": "ClassBody", "start": 832, - "end": 45352, + "end": 45606, "loc": { "start": { "line": 26, "column": 76 }, "end": { - "line": 918, + "line": 927, "column": 1 } }, @@ -63091,16 +63091,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 45213, - "end": 45276, + "end": 45378, "loc": { "start": { "line": 911, "column": 4 }, "end": { - "line": 913, + "line": 915, "column": 7 } } @@ -63109,15 +63109,15 @@ }, { "type": "ClassMethod", - "start": 45281, - "end": 45350, + "start": 45383, + "end": 45461, "loc": { "start": { - "line": 914, + "line": 916, "column": 4 }, "end": { - "line": 917, + "line": 918, "column": 5 } }, @@ -63125,15 +63125,173 @@ "computed": false, "key": { "type": "Identifier", - "start": 45281, - "end": 45288, + "start": 45387, + "end": 45405, + "loc": { + "start": { + "line": 916, + "column": 8 + }, + "end": { + "line": 916, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45408, + "end": 45461, "loc": { "start": { - "line": 914, + "line": 916, + "column": 29 + }, + "end": { + "line": 918, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 45418, + "end": 45455, + "loc": { + "start": { + "line": 917, + "column": 8 + }, + "end": { + "line": 917, + "column": 45 + } + }, + "argument": { + "type": "MemberExpression", + "start": 45425, + "end": 45454, + "loc": { + "start": { + "line": 917, + "column": 15 + }, + "end": { + "line": 917, + "column": 44 + } + }, + "object": { + "type": "ThisExpression", + "start": 45425, + "end": 45429, + "loc": { + "start": { + "line": 917, + "column": 15 + }, + "end": { + "line": 917, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "start": 45430, + "end": 45454, + "loc": { + "start": { + "line": 917, + "column": 20 + }, + "end": { + "line": 917, + "column": 44 + }, + "identifierName": "_currentAngleMeasurement" + }, + "name": "_currentAngleMeasurement" + }, + "computed": false + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", + "start": 45213, + "end": 45378, + "loc": { + "start": { + "line": 911, + "column": 4 + }, + "end": { + "line": 915, + "column": 7 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "start": 45467, + "end": 45530, + "loc": { + "start": { + "line": 920, + "column": 4 + }, + "end": { + "line": 922, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 45535, + "end": 45604, + "loc": { + "start": { + "line": 923, + "column": 4 + }, + "end": { + "line": 926, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 45535, + "end": 45542, + "loc": { + "start": { + "line": 923, "column": 4 }, "end": { - "line": 914, + "line": 923, "column": 11 }, "identifierName": "destroy" @@ -63149,87 +63307,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 45291, - "end": 45350, + "start": 45545, + "end": 45604, "loc": { "start": { - "line": 914, + "line": 923, "column": 14 }, "end": { - "line": 917, + "line": 926, "column": 5 } }, "body": [ { "type": "ExpressionStatement", - "start": 45301, - "end": 45319, + "start": 45555, + "end": 45573, "loc": { "start": { - "line": 915, + "line": 924, "column": 8 }, "end": { - "line": 915, + "line": 924, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 45301, - "end": 45318, + "start": 45555, + "end": 45572, "loc": { "start": { - "line": 915, + "line": 924, "column": 8 }, "end": { - "line": 915, + "line": 924, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 45301, - "end": 45316, + "start": 45555, + "end": 45570, "loc": { "start": { - "line": 915, + "line": 924, "column": 8 }, "end": { - "line": 915, + "line": 924, "column": 23 } }, "object": { "type": "ThisExpression", - "start": 45301, - "end": 45305, + "start": 45555, + "end": 45559, "loc": { "start": { - "line": 915, + "line": 924, "column": 8 }, "end": { - "line": 915, + "line": 924, "column": 12 } } }, "property": { "type": "Identifier", - "start": 45306, - "end": 45316, + "start": 45560, + "end": 45570, "loc": { "start": { - "line": 915, + "line": 924, "column": 13 }, "end": { - "line": 915, + "line": 924, "column": 23 }, "identifierName": "deactivate" @@ -63243,72 +63401,72 @@ }, { "type": "ExpressionStatement", - "start": 45328, - "end": 45344, + "start": 45582, + "end": 45598, "loc": { "start": { - "line": 916, + "line": 925, "column": 8 }, "end": { - "line": 916, + "line": 925, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 45328, - "end": 45343, + "start": 45582, + "end": 45597, "loc": { "start": { - "line": 916, + "line": 925, "column": 8 }, "end": { - "line": 916, + "line": 925, "column": 23 } }, "callee": { "type": "MemberExpression", - "start": 45328, - "end": 45341, + "start": 45582, + "end": 45595, "loc": { "start": { - "line": 916, + "line": 925, "column": 8 }, "end": { - "line": 916, + "line": 925, "column": 21 } }, "object": { "type": "Super", - "start": 45328, - "end": 45333, + "start": 45582, + "end": 45587, "loc": { "start": { - "line": 916, + "line": 925, "column": 8 }, "end": { - "line": 916, + "line": 925, "column": 13 } } }, "property": { "type": "Identifier", - "start": 45334, - "end": 45341, + "start": 45588, + "end": 45595, "loc": { "start": { - "line": 916, + "line": 925, "column": 14 }, "end": { - "line": 916, + "line": 925, "column": 21 }, "identifierName": "destroy" @@ -63327,15 +63485,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", - "start": 45213, - "end": 45276, + "start": 45467, + "end": 45530, "loc": { "start": { - "line": 911, + "line": 920, "column": 4 }, "end": { - "line": 913, + "line": 922, "column": 7 } } @@ -64157,16 +64315,32 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 45213, - "end": 45276, + "end": 45378, "loc": { "start": { "line": 911, "column": 4 }, "end": { - "line": 913, + "line": 915, + "column": 7 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "start": 45467, + "end": 45530, + "loc": { + "start": { + "line": 920, + "column": 4 + }, + "end": { + "line": 922, "column": 7 } } @@ -180894,16 +181068,318 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "value": "*\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.\n *\n * @returns {null|AngleMeasurement}\n ", "start": 45213, - "end": 45276, + "end": 45378, "loc": { "start": { "line": 911, "column": 4 }, "end": { - "line": 913, + "line": 915, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "get", + "start": 45383, + "end": 45386, + "loc": { + "start": { + "line": 916, + "column": 4 + }, + "end": { + "line": 916, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 45387, + "end": 45405, + "loc": { + "start": { + "line": 916, + "column": 8 + }, + "end": { + "line": 916, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 45405, + "end": 45406, + "loc": { + "start": { + "line": 916, + "column": 26 + }, + "end": { + "line": 916, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 45406, + "end": 45407, + "loc": { + "start": { + "line": 916, + "column": 27 + }, + "end": { + "line": 916, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 45408, + "end": 45409, + "loc": { + "start": { + "line": 916, + "column": 29 + }, + "end": { + "line": 916, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 45418, + "end": 45424, + "loc": { + "start": { + "line": 917, + "column": 8 + }, + "end": { + "line": 917, + "column": 14 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 45425, + "end": 45429, + "loc": { + "start": { + "line": 917, + "column": 15 + }, + "end": { + "line": 917, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 45429, + "end": 45430, + "loc": { + "start": { + "line": 917, + "column": 19 + }, + "end": { + "line": 917, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_currentAngleMeasurement", + "start": 45430, + "end": 45454, + "loc": { + "start": { + "line": 917, + "column": 20 + }, + "end": { + "line": 917, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 45454, + "end": 45455, + "loc": { + "start": { + "line": 917, + "column": 44 + }, + "end": { + "line": 917, + "column": 45 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 45460, + "end": 45461, + "loc": { + "start": { + "line": 918, + "column": 4 + }, + "end": { + "line": 918, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this AngleMeasurementsTouchControl.\n ", + "start": 45467, + "end": 45530, + "loc": { + "start": { + "line": 920, + "column": 4 + }, + "end": { + "line": 922, "column": 7 } } @@ -180921,15 +181397,15 @@ "binop": null }, "value": "destroy", - "start": 45281, - "end": 45288, + "start": 45535, + "end": 45542, "loc": { "start": { - "line": 914, + "line": 923, "column": 4 }, "end": { - "line": 914, + "line": 923, "column": 11 } } @@ -180946,15 +181422,15 @@ "postfix": false, "binop": null }, - "start": 45288, - "end": 45289, + "start": 45542, + "end": 45543, "loc": { "start": { - "line": 914, + "line": 923, "column": 11 }, "end": { - "line": 914, + "line": 923, "column": 12 } } @@ -180971,15 +181447,15 @@ "postfix": false, "binop": null }, - "start": 45289, - "end": 45290, + "start": 45543, + "end": 45544, "loc": { "start": { - "line": 914, + "line": 923, "column": 12 }, "end": { - "line": 914, + "line": 923, "column": 13 } } @@ -180996,15 +181472,15 @@ "postfix": false, "binop": null }, - "start": 45291, - "end": 45292, + "start": 45545, + "end": 45546, "loc": { "start": { - "line": 914, + "line": 923, "column": 14 }, "end": { - "line": 914, + "line": 923, "column": 15 } } @@ -181024,15 +181500,15 @@ "updateContext": null }, "value": "this", - "start": 45301, - "end": 45305, + "start": 45555, + "end": 45559, "loc": { "start": { - "line": 915, + "line": 924, "column": 8 }, "end": { - "line": 915, + "line": 924, "column": 12 } } @@ -181050,15 +181526,15 @@ "binop": null, "updateContext": null }, - "start": 45305, - "end": 45306, + "start": 45559, + "end": 45560, "loc": { "start": { - "line": 915, + "line": 924, "column": 12 }, "end": { - "line": 915, + "line": 924, "column": 13 } } @@ -181076,15 +181552,15 @@ "binop": null }, "value": "deactivate", - "start": 45306, - "end": 45316, + "start": 45560, + "end": 45570, "loc": { "start": { - "line": 915, + "line": 924, "column": 13 }, "end": { - "line": 915, + "line": 924, "column": 23 } } @@ -181101,15 +181577,15 @@ "postfix": false, "binop": null }, - "start": 45316, - "end": 45317, + "start": 45570, + "end": 45571, "loc": { "start": { - "line": 915, + "line": 924, "column": 23 }, "end": { - "line": 915, + "line": 924, "column": 24 } } @@ -181126,15 +181602,15 @@ "postfix": false, "binop": null }, - "start": 45317, - "end": 45318, + "start": 45571, + "end": 45572, "loc": { "start": { - "line": 915, + "line": 924, "column": 24 }, "end": { - "line": 915, + "line": 924, "column": 25 } } @@ -181152,15 +181628,15 @@ "binop": null, "updateContext": null }, - "start": 45318, - "end": 45319, + "start": 45572, + "end": 45573, "loc": { "start": { - "line": 915, + "line": 924, "column": 25 }, "end": { - "line": 915, + "line": 924, "column": 26 } } @@ -181180,15 +181656,15 @@ "updateContext": null }, "value": "super", - "start": 45328, - "end": 45333, + "start": 45582, + "end": 45587, "loc": { "start": { - "line": 916, + "line": 925, "column": 8 }, "end": { - "line": 916, + "line": 925, "column": 13 } } @@ -181206,15 +181682,15 @@ "binop": null, "updateContext": null }, - "start": 45333, - "end": 45334, + "start": 45587, + "end": 45588, "loc": { "start": { - "line": 916, + "line": 925, "column": 13 }, "end": { - "line": 916, + "line": 925, "column": 14 } } @@ -181232,15 +181708,15 @@ "binop": null }, "value": "destroy", - "start": 45334, - "end": 45341, + "start": 45588, + "end": 45595, "loc": { "start": { - "line": 916, + "line": 925, "column": 14 }, "end": { - "line": 916, + "line": 925, "column": 21 } } @@ -181257,15 +181733,15 @@ "postfix": false, "binop": null }, - "start": 45341, - "end": 45342, + "start": 45595, + "end": 45596, "loc": { "start": { - "line": 916, + "line": 925, "column": 21 }, "end": { - "line": 916, + "line": 925, "column": 22 } } @@ -181282,15 +181758,15 @@ "postfix": false, "binop": null }, - "start": 45342, - "end": 45343, + "start": 45596, + "end": 45597, "loc": { "start": { - "line": 916, + "line": 925, "column": 22 }, "end": { - "line": 916, + "line": 925, "column": 23 } } @@ -181308,15 +181784,15 @@ "binop": null, "updateContext": null }, - "start": 45343, - "end": 45344, + "start": 45597, + "end": 45598, "loc": { "start": { - "line": 916, + "line": 925, "column": 23 }, "end": { - "line": 916, + "line": 925, "column": 24 } } @@ -181333,15 +181809,15 @@ "postfix": false, "binop": null }, - "start": 45349, - "end": 45350, + "start": 45603, + "end": 45604, "loc": { "start": { - "line": 917, + "line": 926, "column": 4 }, "end": { - "line": 917, + "line": 926, "column": 5 } } @@ -181358,15 +181834,15 @@ "postfix": false, "binop": null }, - "start": 45351, - "end": 45352, + "start": 45605, + "end": 45606, "loc": { "start": { - "line": 918, + "line": 927, "column": 0 }, "end": { - "line": 918, + "line": 927, "column": 1 } } @@ -181384,15 +181860,15 @@ "binop": null, "updateContext": null }, - "start": 45353, - "end": 45353, + "start": 45607, + "end": 45607, "loc": { "start": { - "line": 919, + "line": 928, "column": 0 }, "end": { - "line": 919, + "line": 928, "column": 0 } } diff --git a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.json b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.json index fd86296066..615624e8ee 100644 --- a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.json +++ b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2365, + "end": 2598, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, "program": { "type": "Program", "start": 0, - "end": 2365, + "end": 2598, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -135,14 +135,14 @@ { "type": "ExportNamedDeclaration", "start": 195, - "end": 2365, + "end": 2598, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -151,14 +151,14 @@ "declaration": { "type": "ClassDeclaration", "start": 202, - "end": 2365, + "end": 2598, "loc": { "start": { "line": 9, "column": 7 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -200,14 +200,14 @@ "body": { "type": "ClassBody", "start": 254, - "end": 2365, + "end": 2598, "loc": { "start": { "line": 9, "column": 59 }, "end": { - "line": 84, + "line": 93, "column": 1 } }, @@ -818,16 +818,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", "start": 2145, - "end": 2341, + "end": 2314, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, "column": 7 } } @@ -836,15 +836,15 @@ }, { "type": "ClassMethod", - "start": 2346, - "end": 2363, + "start": 2319, + "end": 2372, "loc": { "start": { - "line": 82, + "line": 80, "column": 4 }, "end": { - "line": 83, + "line": 82, "column": 5 } }, @@ -852,15 +852,140 @@ "computed": false, "key": { "type": "Identifier", - "start": 2346, - "end": 2353, + "start": 2323, + "end": 2341, + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 2344, + "end": 2372, "loc": { "start": { + "line": 80, + "column": 29 + }, + "end": { "line": 82, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 2354, + "end": 2366, + "loc": { + "start": { + "line": 81, + "column": 8 + }, + "end": { + "line": 81, + "column": 20 + } + }, + "argument": { + "type": "NullLiteral", + "start": 2361, + "end": 2365, + "loc": { + "start": { + "line": 81, + "column": 15 + }, + "end": { + "line": 81, + "column": 19 + } + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 2145, + "end": 2314, + "loc": { + "start": { + "line": 75, + "column": 4 + }, + "end": { + "line": 79, + "column": 7 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "start": 2378, + "end": 2574, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 2579, + "end": 2596, + "loc": { + "start": { + "line": 91, + "column": 4 + }, + "end": { + "line": 92, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 2579, + "end": 2586, + "loc": { + "start": { + "line": 91, "column": 4 }, "end": { - "line": 82, + "line": 91, "column": 11 }, "identifierName": "destroy" @@ -876,15 +1001,15 @@ "params": [], "body": { "type": "BlockStatement", - "start": 2356, - "end": 2363, + "start": 2589, + "end": 2596, "loc": { "start": { - "line": 82, + "line": 91, "column": 14 }, "end": { - "line": 83, + "line": 92, "column": 5 } }, @@ -895,15 +1020,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", - "start": 2145, - "end": 2341, + "start": 2378, + "end": 2574, "loc": { "start": { - "line": 75, + "line": 84, "column": 4 }, "end": { - "line": 81, + "line": 90, "column": 7 } } @@ -1069,16 +1194,32 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", "start": 2145, - "end": 2341, + "end": 2314, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, + "column": 7 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "start": 2378, + "end": 2574, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, "column": 7 } } @@ -2485,16 +2626,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", "start": 2145, - "end": 2341, + "end": 2314, "loc": { "start": { "line": 75, "column": 4 }, "end": { - "line": 81, + "line": 79, "column": 7 } } @@ -2511,9 +2652,217 @@ "postfix": false, "binop": null }, - "value": "destroy", - "start": 2346, - "end": 2353, + "value": "get", + "start": 2319, + "end": 2322, + "loc": { + "start": { + "line": 80, + "column": 4 + }, + "end": { + "line": 80, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 2323, + "end": 2341, + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2341, + "end": 2342, + "loc": { + "start": { + "line": 80, + "column": 26 + }, + "end": { + "line": 80, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2342, + "end": 2343, + "loc": { + "start": { + "line": 80, + "column": 27 + }, + "end": { + "line": 80, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2344, + "end": 2345, + "loc": { + "start": { + "line": 80, + "column": 29 + }, + "end": { + "line": 80, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2354, + "end": 2360, + "loc": { + "start": { + "line": 81, + "column": 8 + }, + "end": { + "line": 81, + "column": 14 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2361, + "end": 2365, + "loc": { + "start": { + "line": 81, + "column": 15 + }, + "end": { + "line": 81, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2365, + "end": 2366, + "loc": { + "start": { + "line": 81, + "column": 19 + }, + "end": { + "line": 81, + "column": 20 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2371, + "end": 2372, "loc": { "start": { "line": 82, @@ -2521,6 +2870,48 @@ }, "end": { "line": 82, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n ", + "start": 2378, + "end": 2574, + "loc": { + "start": { + "line": 84, + "column": 4 + }, + "end": { + "line": 90, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "destroy", + "start": 2579, + "end": 2586, + "loc": { + "start": { + "line": 91, + "column": 4 + }, + "end": { + "line": 91, "column": 11 } } @@ -2537,15 +2928,15 @@ "postfix": false, "binop": null }, - "start": 2353, - "end": 2354, + "start": 2586, + "end": 2587, "loc": { "start": { - "line": 82, + "line": 91, "column": 11 }, "end": { - "line": 82, + "line": 91, "column": 12 } } @@ -2562,15 +2953,15 @@ "postfix": false, "binop": null }, - "start": 2354, - "end": 2355, + "start": 2587, + "end": 2588, "loc": { "start": { - "line": 82, + "line": 91, "column": 12 }, "end": { - "line": 82, + "line": 91, "column": 13 } } @@ -2587,15 +2978,15 @@ "postfix": false, "binop": null }, - "start": 2356, - "end": 2357, + "start": 2589, + "end": 2590, "loc": { "start": { - "line": 82, + "line": 91, "column": 14 }, "end": { - "line": 82, + "line": 91, "column": 15 } } @@ -2612,15 +3003,15 @@ "postfix": false, "binop": null }, - "start": 2362, - "end": 2363, + "start": 2595, + "end": 2596, "loc": { "start": { - "line": 83, + "line": 92, "column": 4 }, "end": { - "line": 83, + "line": 92, "column": 5 } } @@ -2637,15 +3028,15 @@ "postfix": false, "binop": null }, - "start": 2364, - "end": 2365, + "start": 2597, + "end": 2598, "loc": { "start": { - "line": 84, + "line": 93, "column": 0 }, "end": { - "line": 84, + "line": 93, "column": 1 } } @@ -2663,15 +3054,15 @@ "binop": null, "updateContext": null }, - "start": 2365, - "end": 2365, + "start": 2598, + "end": 2598, "loc": { "start": { - "line": 84, + "line": 93, "column": 1 }, "end": { - "line": 84, + "line": 93, "column": 1 } } diff --git a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.json b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.json index 5977d15918..0a60297805 100644 --- a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.json +++ b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 17219, + "end": 17627, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 412, + "line": 423, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 17219, + "end": 17627, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 412, + "line": 423, "column": 0 } }, @@ -361,14 +361,14 @@ { "type": "ExportNamedDeclaration", "start": 1258, - "end": 17218, + "end": 17626, "loc": { "start": { "line": 43, "column": 0 }, "end": { - "line": 411, + "line": 422, "column": 1 } }, @@ -377,14 +377,14 @@ "declaration": { "type": "ClassDeclaration", "start": 1265, - "end": 17218, + "end": 17626, "loc": { "start": { "line": 43, "column": 7 }, "end": { - "line": 411, + "line": 422, "column": 1 } }, @@ -426,14 +426,14 @@ "body": { "type": "ClassBody", "start": 1340, - "end": 17218, + "end": 17626, "loc": { "start": { "line": 43, "column": 82 }, "end": { - "line": 411, + "line": 422, "column": 1 } }, @@ -6580,7 +6580,7 @@ { "type": "ClassMethod", "start": 5886, - "end": 15027, + "end": 15113, "loc": { "start": { "line": 175, @@ -6620,7 +6620,7 @@ "body": { "type": "BlockStatement", "start": 5897, - "end": 15027, + "end": 15113, "loc": { "start": { "line": 175, @@ -8223,7 +8223,7 @@ { "type": "VariableDeclaration", "start": 6667, - "end": 6748, + "end": 6791, "loc": { "start": { "line": 202, @@ -8231,14 +8231,14 @@ }, "end": { "line": 202, - "column": 89 + "column": 132 } }, "declarations": [ { "type": "VariableDeclarator", "start": 6673, - "end": 6747, + "end": 6790, "loc": { "start": { "line": 202, @@ -8246,7 +8246,7 @@ }, "end": { "line": 202, - "column": 88 + "column": 131 } }, "id": { @@ -8269,7 +8269,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 6682, - "end": 6747, + "end": 6790, "loc": { "start": { "line": 202, @@ -8277,7 +8277,7 @@ }, "end": { "line": 202, - "column": 88 + "column": 131 } }, "id": null, @@ -8306,7 +8306,7 @@ "body": { "type": "BinaryExpression", "start": 6688, - "end": 6747, + "end": 6790, "loc": { "start": { "line": 202, @@ -8314,7 +8314,7 @@ }, "end": { "line": 202, - "column": 88 + "column": 131 } }, "left": { @@ -8371,7 +8371,7 @@ "right": { "type": "LogicalExpression", "start": 6704, - "end": 6746, + "end": 6789, "loc": { "start": { "line": 202, @@ -8379,13 +8379,13 @@ }, "end": { "line": 202, - "column": 87 + "column": 130 } }, "left": { - "type": "MemberExpression", + "type": "LogicalExpression", "start": 6704, - "end": 6719, + "end": 6762, "loc": { "start": { "line": 202, @@ -8393,13 +8393,13 @@ }, "end": { "line": 202, - "column": 60 + "column": 103 } }, - "object": { - "type": "Identifier", + "left": { + "type": "MemberExpression", "start": 6704, - "end": 6706, + "end": 6719, "loc": { "start": { "line": 202, @@ -8407,58 +8407,194 @@ }, "end": { "line": 202, - "column": 47 + "column": 60 + } + }, + "object": { + "type": "Identifier", + "start": 6704, + "end": 6706, + "loc": { + "start": { + "line": 202, + "column": 45 + }, + "end": { + "line": 202, + "column": 47 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6707, + "end": 6719, + "loc": { + "start": { + "line": 202, + "column": 48 + }, + "end": { + "line": 202, + "column": 60 + }, + "identifierName": "offsetParent" }, - "identifierName": "el" + "name": "offsetParent" }, - "name": "el" + "computed": false }, - "property": { - "type": "Identifier", - "start": 6707, - "end": 6719, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 6724, + "end": 6761, "loc": { "start": { "line": 202, - "column": 48 + "column": 65 }, "end": { "line": 202, - "column": 60 + "column": 102 + } + }, + "left": { + "type": "MemberExpression", + "start": 6724, + "end": 6739, + "loc": { + "start": { + "line": 202, + "column": 65 + }, + "end": { + "line": 202, + "column": 80 + } }, - "identifierName": "offsetParent" + "object": { + "type": "Identifier", + "start": 6724, + "end": 6726, + "loc": { + "start": { + "line": 202, + "column": 65 + }, + "end": { + "line": 202, + "column": 67 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6727, + "end": 6739, + "loc": { + "start": { + "line": 202, + "column": 68 + }, + "end": { + "line": 202, + "column": 80 + }, + "identifierName": "offsetParent" + }, + "name": "offsetParent" + }, + "computed": false }, - "name": "offsetParent" - }, - "computed": false + "operator": "!==", + "right": { + "type": "MemberExpression", + "start": 6744, + "end": 6761, + "loc": { + "start": { + "line": 202, + "column": 85 + }, + "end": { + "line": 202, + "column": 102 + } + }, + "object": { + "type": "Identifier", + "start": 6744, + "end": 6750, + "loc": { + "start": { + "line": 202, + "column": 85 + }, + "end": { + "line": 202, + "column": 91 + }, + "identifierName": "canvas" + }, + "name": "canvas" + }, + "property": { + "type": "Identifier", + "start": 6751, + "end": 6761, + "loc": { + "start": { + "line": 202, + "column": 92 + }, + "end": { + "line": 202, + "column": 102 + }, + "identifierName": "parentNode" + }, + "name": "parentNode" + }, + "computed": false + }, + "extra": { + "parenthesized": true, + "parenStart": 6723 + } + } }, "operator": "&&", "right": { "type": "CallExpression", - "start": 6723, - "end": 6746, + "start": 6766, + "end": 6789, "loc": { "start": { "line": 202, - "column": 64 + "column": 107 }, "end": { "line": 202, - "column": 87 + "column": 130 } }, "callee": { "type": "Identifier", - "start": 6723, - "end": 6729, + "start": 6766, + "end": 6772, "loc": { "start": { "line": 202, - "column": 64 + "column": 107 }, "end": { "line": 202, - "column": 70 + "column": 113 }, "identifierName": "getTop" }, @@ -8467,30 +8603,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 6730, - "end": 6745, + "start": 6773, + "end": 6788, "loc": { "start": { "line": 202, - "column": 71 + "column": 114 }, "end": { "line": 202, - "column": 86 + "column": 129 } }, "object": { "type": "Identifier", - "start": 6730, - "end": 6732, + "start": 6773, + "end": 6775, "loc": { "start": { "line": 202, - "column": 71 + "column": 114 }, "end": { "line": 202, - "column": 73 + "column": 116 }, "identifierName": "el" }, @@ -8498,16 +8634,16 @@ }, "property": { "type": "Identifier", - "start": 6733, - "end": 6745, + "start": 6776, + "end": 6788, "loc": { "start": { "line": 202, - "column": 74 + "column": 117 }, "end": { "line": 202, - "column": 86 + "column": 129 }, "identifierName": "offsetParent" }, @@ -8530,8 +8666,8 @@ }, { "type": "VariableDeclaration", - "start": 6757, - "end": 6841, + "start": 6800, + "end": 6927, "loc": { "start": { "line": 203, @@ -8539,14 +8675,14 @@ }, "end": { "line": 203, - "column": 92 + "column": 135 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 6763, - "end": 6840, + "start": 6806, + "end": 6926, "loc": { "start": { "line": 203, @@ -8554,13 +8690,13 @@ }, "end": { "line": 203, - "column": 91 + "column": 134 } }, "id": { "type": "Identifier", - "start": 6763, - "end": 6770, + "start": 6806, + "end": 6813, "loc": { "start": { "line": 203, @@ -8576,8 +8712,8 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 6773, - "end": 6840, + "start": 6816, + "end": 6926, "loc": { "start": { "line": 203, @@ -8585,7 +8721,7 @@ }, "end": { "line": 203, - "column": 91 + "column": 134 } }, "id": null, @@ -8595,8 +8731,8 @@ "params": [ { "type": "Identifier", - "start": 6773, - "end": 6775, + "start": 6816, + "end": 6818, "loc": { "start": { "line": 203, @@ -8613,8 +8749,8 @@ ], "body": { "type": "BinaryExpression", - "start": 6779, - "end": 6840, + "start": 6822, + "end": 6926, "loc": { "start": { "line": 203, @@ -8622,13 +8758,13 @@ }, "end": { "line": 203, - "column": 91 + "column": 134 } }, "left": { "type": "MemberExpression", - "start": 6779, - "end": 6792, + "start": 6822, + "end": 6835, "loc": { "start": { "line": 203, @@ -8641,8 +8777,8 @@ }, "object": { "type": "Identifier", - "start": 6779, - "end": 6781, + "start": 6822, + "end": 6824, "loc": { "start": { "line": 203, @@ -8658,8 +8794,8 @@ }, "property": { "type": "Identifier", - "start": 6782, - "end": 6792, + "start": 6825, + "end": 6835, "loc": { "start": { "line": 203, @@ -8678,8 +8814,8 @@ "operator": "+", "right": { "type": "LogicalExpression", - "start": 6796, - "end": 6839, + "start": 6839, + "end": 6925, "loc": { "start": { "line": 203, @@ -8687,13 +8823,13 @@ }, "end": { "line": 203, - "column": 90 + "column": 133 } }, "left": { - "type": "MemberExpression", - "start": 6796, - "end": 6811, + "type": "LogicalExpression", + "start": 6839, + "end": 6897, "loc": { "start": { "line": 203, @@ -8701,13 +8837,13 @@ }, "end": { "line": 203, - "column": 62 + "column": 105 } }, - "object": { - "type": "Identifier", - "start": 6796, - "end": 6798, + "left": { + "type": "MemberExpression", + "start": 6839, + "end": 6854, "loc": { "start": { "line": 203, @@ -8715,58 +8851,194 @@ }, "end": { "line": 203, - "column": 49 + "column": 62 + } + }, + "object": { + "type": "Identifier", + "start": 6839, + "end": 6841, + "loc": { + "start": { + "line": 203, + "column": 47 + }, + "end": { + "line": 203, + "column": 49 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6842, + "end": 6854, + "loc": { + "start": { + "line": 203, + "column": 50 + }, + "end": { + "line": 203, + "column": 62 + }, + "identifierName": "offsetParent" }, - "identifierName": "el" + "name": "offsetParent" }, - "name": "el" + "computed": false }, - "property": { - "type": "Identifier", - "start": 6799, - "end": 6811, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 6859, + "end": 6896, "loc": { "start": { "line": 203, - "column": 50 + "column": 67 }, "end": { "line": 203, - "column": 62 + "column": 104 + } + }, + "left": { + "type": "MemberExpression", + "start": 6859, + "end": 6874, + "loc": { + "start": { + "line": 203, + "column": 67 + }, + "end": { + "line": 203, + "column": 82 + } + }, + "object": { + "type": "Identifier", + "start": 6859, + "end": 6861, + "loc": { + "start": { + "line": 203, + "column": 67 + }, + "end": { + "line": 203, + "column": 69 + }, + "identifierName": "el" + }, + "name": "el" + }, + "property": { + "type": "Identifier", + "start": 6862, + "end": 6874, + "loc": { + "start": { + "line": 203, + "column": 70 + }, + "end": { + "line": 203, + "column": 82 + }, + "identifierName": "offsetParent" + }, + "name": "offsetParent" }, - "identifierName": "offsetParent" + "computed": false }, - "name": "offsetParent" - }, - "computed": false + "operator": "!==", + "right": { + "type": "MemberExpression", + "start": 6879, + "end": 6896, + "loc": { + "start": { + "line": 203, + "column": 87 + }, + "end": { + "line": 203, + "column": 104 + } + }, + "object": { + "type": "Identifier", + "start": 6879, + "end": 6885, + "loc": { + "start": { + "line": 203, + "column": 87 + }, + "end": { + "line": 203, + "column": 93 + }, + "identifierName": "canvas" + }, + "name": "canvas" + }, + "property": { + "type": "Identifier", + "start": 6886, + "end": 6896, + "loc": { + "start": { + "line": 203, + "column": 94 + }, + "end": { + "line": 203, + "column": 104 + }, + "identifierName": "parentNode" + }, + "name": "parentNode" + }, + "computed": false + }, + "extra": { + "parenthesized": true, + "parenStart": 6858 + } + } }, "operator": "&&", "right": { "type": "CallExpression", - "start": 6815, - "end": 6839, + "start": 6901, + "end": 6925, "loc": { "start": { "line": 203, - "column": 66 + "column": 109 }, "end": { "line": 203, - "column": 90 + "column": 133 } }, "callee": { "type": "Identifier", - "start": 6815, - "end": 6822, + "start": 6901, + "end": 6908, "loc": { "start": { "line": 203, - "column": 66 + "column": 109 }, "end": { "line": 203, - "column": 73 + "column": 116 }, "identifierName": "getLeft" }, @@ -8775,30 +9047,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 6823, - "end": 6838, + "start": 6909, + "end": 6924, "loc": { "start": { "line": 203, - "column": 74 + "column": 117 }, "end": { "line": 203, - "column": 89 + "column": 132 } }, "object": { "type": "Identifier", - "start": 6823, - "end": 6825, + "start": 6909, + "end": 6911, "loc": { "start": { "line": 203, - "column": 74 + "column": 117 }, "end": { "line": 203, - "column": 76 + "column": 119 }, "identifierName": "el" }, @@ -8806,16 +9078,16 @@ }, "property": { "type": "Identifier", - "start": 6826, - "end": 6838, + "start": 6912, + "end": 6924, "loc": { "start": { "line": 203, - "column": 77 + "column": 120 }, "end": { "line": 203, - "column": 89 + "column": 132 }, "identifierName": "offsetParent" }, @@ -8827,7 +9099,7 @@ }, "extra": { "parenthesized": true, - "parenStart": 6795 + "parenStart": 6838 } } } @@ -8838,8 +9110,8 @@ }, { "type": "VariableDeclaration", - "start": 6851, - "end": 6879, + "start": 6937, + "end": 6965, "loc": { "start": { "line": 205, @@ -8853,8 +9125,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 6857, - "end": 6878, + "start": 6943, + "end": 6964, "loc": { "start": { "line": 205, @@ -8867,8 +9139,8 @@ }, "id": { "type": "Identifier", - "start": 6857, - "end": 6864, + "start": 6943, + "end": 6950, "loc": { "start": { "line": 205, @@ -8884,8 +9156,8 @@ }, "init": { "type": "CallExpression", - "start": 6867, - "end": 6878, + "start": 6953, + "end": 6964, "loc": { "start": { "line": 205, @@ -8898,8 +9170,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6867, - "end": 6876, + "start": 6953, + "end": 6962, "loc": { "start": { "line": 205, @@ -8912,8 +9184,8 @@ }, "object": { "type": "Identifier", - "start": 6867, - "end": 6871, + "start": 6953, + "end": 6957, "loc": { "start": { "line": 205, @@ -8929,8 +9201,8 @@ }, "property": { "type": "Identifier", - "start": 6872, - "end": 6876, + "start": 6958, + "end": 6962, "loc": { "start": { "line": 205, @@ -8954,8 +9226,8 @@ }, { "type": "ExpressionStatement", - "start": 6897, - "end": 10612, + "start": 6983, + "end": 10698, "loc": { "start": { "line": 207, @@ -8968,8 +9240,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6897, - "end": 10611, + "start": 6983, + "end": 10697, "loc": { "start": { "line": 207, @@ -8983,8 +9255,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6897, - "end": 6936, + "start": 6983, + "end": 7022, "loc": { "start": { "line": 207, @@ -8997,8 +9269,8 @@ }, "object": { "type": "ThisExpression", - "start": 6897, - "end": 6901, + "start": 6983, + "end": 6987, "loc": { "start": { "line": 207, @@ -9012,8 +9284,8 @@ }, "property": { "type": "Identifier", - "start": 6902, - "end": 6936, + "start": 6988, + "end": 7022, "loc": { "start": { "line": 207, @@ -9031,8 +9303,8 @@ }, "right": { "type": "CallExpression", - "start": 6939, - "end": 10611, + "start": 7025, + "end": 10697, "loc": { "start": { "line": 207, @@ -9045,8 +9317,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6939, - "end": 6955, + "start": 7025, + "end": 7041, "loc": { "start": { "line": 207, @@ -9059,8 +9331,8 @@ }, "object": { "type": "Identifier", - "start": 6939, - "end": 6952, + "start": 7025, + "end": 7038, "loc": { "start": { "line": 207, @@ -9076,8 +9348,8 @@ }, "property": { "type": "Identifier", - "start": 6953, - "end": 6955, + "start": 7039, + "end": 7041, "loc": { "start": { "line": 207, @@ -9096,8 +9368,8 @@ "arguments": [ { "type": "ConditionalExpression", - "start": 6969, - "end": 7055, + "start": 7055, + "end": 7141, "loc": { "start": { "line": 208, @@ -9110,8 +9382,8 @@ }, "test": { "type": "MemberExpression", - "start": 6969, - "end": 6983, + "start": 7055, + "end": 7069, "loc": { "start": { "line": 208, @@ -9124,8 +9396,8 @@ }, "object": { "type": "ThisExpression", - "start": 6969, - "end": 6973, + "start": 7055, + "end": 7059, "loc": { "start": { "line": 208, @@ -9139,8 +9411,8 @@ }, "property": { "type": "Identifier", - "start": 6974, - "end": 6983, + "start": 7060, + "end": 7069, "loc": { "start": { "line": 208, @@ -9158,8 +9430,8 @@ }, "consequent": { "type": "StringLiteral", - "start": 7002, - "end": 7022, + "start": 7088, + "end": 7108, "loc": { "start": { "line": 209, @@ -9178,8 +9450,8 @@ }, "alternate": { "type": "StringLiteral", - "start": 7041, - "end": 7055, + "start": 7127, + "end": 7141, "loc": { "start": { "line": 210, @@ -9199,8 +9471,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 7057, - "end": 10610, + "start": 7143, + "end": 10696, "loc": { "start": { "line": 210, @@ -9218,8 +9490,8 @@ "params": [ { "type": "Identifier", - "start": 7057, - "end": 7062, + "start": 7143, + "end": 7148, "loc": { "start": { "line": 210, @@ -9236,8 +9508,8 @@ ], "body": { "type": "BlockStatement", - "start": 7066, - "end": 10610, + "start": 7152, + "end": 10696, "loc": { "start": { "line": 210, @@ -9251,8 +9523,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 7084, - "end": 7144, + "start": 7170, + "end": 7230, "loc": { "start": { "line": 211, @@ -9266,8 +9538,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 7090, - "end": 7143, + "start": 7176, + "end": 7229, "loc": { "start": { "line": 211, @@ -9280,8 +9552,8 @@ }, "id": { "type": "Identifier", - "start": 7090, - "end": 7099, + "start": 7176, + "end": 7185, "loc": { "start": { "line": 211, @@ -9297,8 +9569,8 @@ }, "init": { "type": "LogicalExpression", - "start": 7102, - "end": 7143, + "start": 7188, + "end": 7229, "loc": { "start": { "line": 211, @@ -9311,8 +9583,8 @@ }, "left": { "type": "MemberExpression", - "start": 7102, - "end": 7124, + "start": 7188, + "end": 7210, "loc": { "start": { "line": 211, @@ -9325,8 +9597,8 @@ }, "object": { "type": "Identifier", - "start": 7102, - "end": 7107, + "start": 7188, + "end": 7193, "loc": { "start": { "line": 211, @@ -9342,8 +9614,8 @@ }, "property": { "type": "Identifier", - "start": 7108, - "end": 7124, + "start": 7194, + "end": 7210, "loc": { "start": { "line": 211, @@ -9362,8 +9634,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 7128, - "end": 7143, + "start": 7214, + "end": 7229, "loc": { "start": { "line": 211, @@ -9376,8 +9648,8 @@ }, "object": { "type": "Identifier", - "start": 7128, - "end": 7133, + "start": 7214, + "end": 7219, "loc": { "start": { "line": 211, @@ -9393,8 +9665,8 @@ }, "property": { "type": "Identifier", - "start": 7134, - "end": 7143, + "start": 7220, + "end": 7229, "loc": { "start": { "line": 211, @@ -9417,8 +9689,8 @@ }, { "type": "ExpressionStatement", - "start": 7161, - "end": 7182, + "start": 7247, + "end": 7268, "loc": { "start": { "line": 212, @@ -9431,8 +9703,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7161, - "end": 7181, + "start": 7247, + "end": 7267, "loc": { "start": { "line": 212, @@ -9446,8 +9718,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 7161, - "end": 7174, + "start": 7247, + "end": 7260, "loc": { "start": { "line": 212, @@ -9463,8 +9735,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7177, - "end": 7181, + "start": 7263, + "end": 7267, "loc": { "start": { "line": 212, @@ -9481,8 +9753,8 @@ }, { "type": "ExpressionStatement", - "start": 7199, - "end": 7235, + "start": 7285, + "end": 7321, "loc": { "start": { "line": 213, @@ -9495,8 +9767,8 @@ }, "expression": { "type": "CallExpression", - "start": 7199, - "end": 7234, + "start": 7285, + "end": 7320, "loc": { "start": { "line": 213, @@ -9509,8 +9781,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7199, - "end": 7218, + "start": 7285, + "end": 7304, "loc": { "start": { "line": 213, @@ -9523,8 +9795,8 @@ }, "object": { "type": "Identifier", - "start": 7199, - "end": 7214, + "start": 7285, + "end": 7300, "loc": { "start": { "line": 213, @@ -9540,8 +9812,8 @@ }, "property": { "type": "Identifier", - "start": 7215, - "end": 7218, + "start": 7301, + "end": 7304, "loc": { "start": { "line": 213, @@ -9560,8 +9832,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 7219, - "end": 7233, + "start": 7305, + "end": 7319, "loc": { "start": { "line": 213, @@ -9574,8 +9846,8 @@ }, "object": { "type": "Identifier", - "start": 7219, - "end": 7224, + "start": 7305, + "end": 7310, "loc": { "start": { "line": 213, @@ -9591,8 +9863,8 @@ }, "property": { "type": "Identifier", - "start": 7225, - "end": 7233, + "start": 7311, + "end": 7319, "loc": { "start": { "line": 213, @@ -9613,8 +9885,8 @@ }, { "type": "ExpressionStatement", - "start": 7252, - "end": 7290, + "start": 7338, + "end": 7376, "loc": { "start": { "line": 214, @@ -9627,8 +9899,8 @@ }, "expression": { "type": "CallExpression", - "start": 7252, - "end": 7289, + "start": 7338, + "end": 7375, "loc": { "start": { "line": 214, @@ -9641,8 +9913,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7252, - "end": 7272, + "start": 7338, + "end": 7358, "loc": { "start": { "line": 214, @@ -9655,8 +9927,8 @@ }, "object": { "type": "Identifier", - "start": 7252, - "end": 7268, + "start": 7338, + "end": 7354, "loc": { "start": { "line": 214, @@ -9672,8 +9944,8 @@ }, "property": { "type": "Identifier", - "start": 7269, - "end": 7272, + "start": 7355, + "end": 7358, "loc": { "start": { "line": 214, @@ -9692,8 +9964,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 7273, - "end": 7288, + "start": 7359, + "end": 7374, "loc": { "start": { "line": 214, @@ -9706,8 +9978,8 @@ }, "object": { "type": "Identifier", - "start": 7273, - "end": 7278, + "start": 7359, + "end": 7364, "loc": { "start": { "line": 214, @@ -9723,8 +9995,8 @@ }, "property": { "type": "Identifier", - "start": 7279, - "end": 7288, + "start": 7365, + "end": 7374, "loc": { "start": { "line": 214, @@ -9745,8 +10017,8 @@ }, { "type": "IfStatement", - "start": 7307, - "end": 9295, + "start": 7393, + "end": 9381, "loc": { "start": { "line": 215, @@ -9759,8 +10031,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7311, - "end": 7358, + "start": 7397, + "end": 7444, "loc": { "start": { "line": 215, @@ -9773,8 +10045,8 @@ }, "left": { "type": "MemberExpression", - "start": 7311, - "end": 7327, + "start": 7397, + "end": 7413, "loc": { "start": { "line": 215, @@ -9787,8 +10059,8 @@ }, "object": { "type": "ThisExpression", - "start": 7311, - "end": 7315, + "start": 7397, + "end": 7401, "loc": { "start": { "line": 215, @@ -9802,8 +10074,8 @@ }, "property": { "type": "Identifier", - "start": 7316, - "end": 7327, + "start": 7402, + "end": 7413, "loc": { "start": { "line": 215, @@ -9822,8 +10094,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 7332, - "end": 7358, + "start": 7418, + "end": 7444, "loc": { "start": { "line": 215, @@ -9840,8 +10112,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7360, - "end": 9149, + "start": 7446, + "end": 9235, "loc": { "start": { "line": 215, @@ -9855,8 +10127,8 @@ "body": [ { "type": "IfStatement", - "start": 7383, - "end": 7878, + "start": 7469, + "end": 7964, "loc": { "start": { "line": 217, @@ -9869,8 +10141,8 @@ }, "test": { "type": "MemberExpression", - "start": 7387, - "end": 7408, + "start": 7473, + "end": 7494, "loc": { "start": { "line": 217, @@ -9883,8 +10155,8 @@ }, "object": { "type": "ThisExpression", - "start": 7387, - "end": 7391, + "start": 7473, + "end": 7477, "loc": { "start": { "line": 217, @@ -9898,8 +10170,8 @@ }, "property": { "type": "Identifier", - "start": 7392, - "end": 7408, + "start": 7478, + "end": 7494, "loc": { "start": { "line": 217, @@ -9917,8 +10189,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7410, - "end": 7659, + "start": 7496, + "end": 7745, "loc": { "start": { "line": 217, @@ -9932,8 +10204,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7436, - "end": 7486, + "start": 7522, + "end": 7572, "loc": { "start": { "line": 218, @@ -9946,8 +10218,8 @@ }, "expression": { "type": "CallExpression", - "start": 7436, - "end": 7485, + "start": 7522, + "end": 7571, "loc": { "start": { "line": 218, @@ -9960,8 +10232,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7436, - "end": 7457, + "start": 7522, + "end": 7543, "loc": { "start": { "line": 218, @@ -9974,8 +10246,8 @@ }, "object": { "type": "ThisExpression", - "start": 7436, - "end": 7440, + "start": 7522, + "end": 7526, "loc": { "start": { "line": 218, @@ -9989,8 +10261,8 @@ }, "property": { "type": "Identifier", - "start": 7441, - "end": 7457, + "start": 7527, + "end": 7543, "loc": { "start": { "line": 218, @@ -10009,8 +10281,8 @@ "arguments": [ { "type": "Identifier", - "start": 7458, - "end": 7464, + "start": 7544, + "end": 7550, "loc": { "start": { "line": 218, @@ -10026,8 +10298,8 @@ }, { "type": "Identifier", - "start": 7466, - "end": 7475, + "start": 7552, + "end": 7561, "loc": { "start": { "line": 218, @@ -10043,8 +10315,8 @@ }, { "type": "Identifier", - "start": 7477, - "end": 7484, + "start": 7563, + "end": 7570, "loc": { "start": { "line": 218, @@ -10063,8 +10335,8 @@ }, { "type": "ExpressionStatement", - "start": 7511, - "end": 7562, + "start": 7597, + "end": 7648, "loc": { "start": { "line": 219, @@ -10077,8 +10349,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7511, - "end": 7561, + "start": 7597, + "end": 7647, "loc": { "start": { "line": 219, @@ -10092,8 +10364,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7511, - "end": 7537, + "start": 7597, + "end": 7623, "loc": { "start": { "line": 219, @@ -10106,8 +10378,8 @@ }, "object": { "type": "MemberExpression", - "start": 7511, - "end": 7532, + "start": 7597, + "end": 7618, "loc": { "start": { "line": 219, @@ -10120,8 +10392,8 @@ }, "object": { "type": "MemberExpression", - "start": 7511, - "end": 7526, + "start": 7597, + "end": 7612, "loc": { "start": { "line": 219, @@ -10134,8 +10406,8 @@ }, "object": { "type": "ThisExpression", - "start": 7511, - "end": 7515, + "start": 7597, + "end": 7601, "loc": { "start": { "line": 219, @@ -10149,8 +10421,8 @@ }, "property": { "type": "Identifier", - "start": 7516, - "end": 7526, + "start": 7602, + "end": 7612, "loc": { "start": { "line": 219, @@ -10168,8 +10440,8 @@ }, "property": { "type": "Identifier", - "start": 7527, - "end": 7532, + "start": 7613, + "end": 7618, "loc": { "start": { "line": 219, @@ -10187,8 +10459,8 @@ }, "property": { "type": "Identifier", - "start": 7533, - "end": 7537, + "start": 7619, + "end": 7623, "loc": { "start": { "line": 219, @@ -10206,8 +10478,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 7540, - "end": 7561, + "start": 7626, + "end": 7647, "loc": { "start": { "line": 219, @@ -10221,8 +10493,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 7543, - "end": 7557, + "start": 7629, + "end": 7643, "loc": { "start": { "line": 219, @@ -10235,8 +10507,8 @@ }, "left": { "type": "MemberExpression", - "start": 7543, - "end": 7553, + "start": 7629, + "end": 7639, "loc": { "start": { "line": 219, @@ -10249,8 +10521,8 @@ }, "object": { "type": "Identifier", - "start": 7543, - "end": 7550, + "start": 7629, + "end": 7636, "loc": { "start": { "line": 219, @@ -10266,8 +10538,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7551, - "end": 7552, + "start": 7637, + "end": 7638, "loc": { "start": { "line": 219, @@ -10289,8 +10561,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 7556, - "end": 7557, + "start": 7642, + "end": 7643, "loc": { "start": { "line": 219, @@ -10312,8 +10584,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 7541, - "end": 7541, + "start": 7627, + "end": 7627, "loc": { "start": { "line": 219, @@ -10332,8 +10604,8 @@ }, { "type": "TemplateElement", - "start": 7558, - "end": 7560, + "start": 7644, + "end": 7646, "loc": { "start": { "line": 219, @@ -10356,8 +10628,8 @@ }, { "type": "ExpressionStatement", - "start": 7587, - "end": 7637, + "start": 7673, + "end": 7723, "loc": { "start": { "line": 220, @@ -10370,8 +10642,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7587, - "end": 7636, + "start": 7673, + "end": 7722, "loc": { "start": { "line": 220, @@ -10385,8 +10657,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7587, - "end": 7612, + "start": 7673, + "end": 7698, "loc": { "start": { "line": 220, @@ -10399,8 +10671,8 @@ }, "object": { "type": "MemberExpression", - "start": 7587, - "end": 7608, + "start": 7673, + "end": 7694, "loc": { "start": { "line": 220, @@ -10413,8 +10685,8 @@ }, "object": { "type": "MemberExpression", - "start": 7587, - "end": 7602, + "start": 7673, + "end": 7688, "loc": { "start": { "line": 220, @@ -10427,8 +10699,8 @@ }, "object": { "type": "ThisExpression", - "start": 7587, - "end": 7591, + "start": 7673, + "end": 7677, "loc": { "start": { "line": 220, @@ -10442,8 +10714,8 @@ }, "property": { "type": "Identifier", - "start": 7592, - "end": 7602, + "start": 7678, + "end": 7688, "loc": { "start": { "line": 220, @@ -10461,8 +10733,8 @@ }, "property": { "type": "Identifier", - "start": 7603, - "end": 7608, + "start": 7689, + "end": 7694, "loc": { "start": { "line": 220, @@ -10480,8 +10752,8 @@ }, "property": { "type": "Identifier", - "start": 7609, - "end": 7612, + "start": 7695, + "end": 7698, "loc": { "start": { "line": 220, @@ -10499,8 +10771,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 7615, - "end": 7636, + "start": 7701, + "end": 7722, "loc": { "start": { "line": 220, @@ -10514,8 +10786,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 7618, - "end": 7632, + "start": 7704, + "end": 7718, "loc": { "start": { "line": 220, @@ -10528,8 +10800,8 @@ }, "left": { "type": "MemberExpression", - "start": 7618, - "end": 7628, + "start": 7704, + "end": 7714, "loc": { "start": { "line": 220, @@ -10542,8 +10814,8 @@ }, "object": { "type": "Identifier", - "start": 7618, - "end": 7625, + "start": 7704, + "end": 7711, "loc": { "start": { "line": 220, @@ -10559,8 +10831,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7626, - "end": 7627, + "start": 7712, + "end": 7713, "loc": { "start": { "line": 220, @@ -10582,8 +10854,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 7631, - "end": 7632, + "start": 7717, + "end": 7718, "loc": { "start": { "line": 220, @@ -10605,8 +10877,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 7616, - "end": 7616, + "start": 7702, + "end": 7702, "loc": { "start": { "line": 220, @@ -10625,8 +10897,8 @@ }, { "type": "TemplateElement", - "start": 7633, - "end": 7635, + "start": 7719, + "end": 7721, "loc": { "start": { "line": 220, @@ -10652,8 +10924,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 7665, - "end": 7878, + "start": 7751, + "end": 7964, "loc": { "start": { "line": 221, @@ -10667,8 +10939,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7691, - "end": 7762, + "start": 7777, + "end": 7848, "loc": { "start": { "line": 222, @@ -10681,8 +10953,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7691, - "end": 7761, + "start": 7777, + "end": 7847, "loc": { "start": { "line": 222, @@ -10696,8 +10968,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7691, - "end": 7717, + "start": 7777, + "end": 7803, "loc": { "start": { "line": 222, @@ -10710,8 +10982,8 @@ }, "object": { "type": "MemberExpression", - "start": 7691, - "end": 7712, + "start": 7777, + "end": 7798, "loc": { "start": { "line": 222, @@ -10724,8 +10996,8 @@ }, "object": { "type": "MemberExpression", - "start": 7691, - "end": 7706, + "start": 7777, + "end": 7792, "loc": { "start": { "line": 222, @@ -10738,8 +11010,8 @@ }, "object": { "type": "ThisExpression", - "start": 7691, - "end": 7695, + "start": 7777, + "end": 7781, "loc": { "start": { "line": 222, @@ -10753,8 +11025,8 @@ }, "property": { "type": "Identifier", - "start": 7696, - "end": 7706, + "start": 7782, + "end": 7792, "loc": { "start": { "line": 222, @@ -10772,8 +11044,8 @@ }, "property": { "type": "Identifier", - "start": 7707, - "end": 7712, + "start": 7793, + "end": 7798, "loc": { "start": { "line": 222, @@ -10791,8 +11063,8 @@ }, "property": { "type": "Identifier", - "start": 7713, - "end": 7717, + "start": 7799, + "end": 7803, "loc": { "start": { "line": 222, @@ -10810,8 +11082,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 7720, - "end": 7761, + "start": 7806, + "end": 7847, "loc": { "start": { "line": 222, @@ -10825,8 +11097,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 7723, - "end": 7757, + "start": 7809, + "end": 7843, "loc": { "start": { "line": 222, @@ -10839,8 +11111,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7723, - "end": 7753, + "start": 7809, + "end": 7839, "loc": { "start": { "line": 222, @@ -10853,8 +11125,8 @@ }, "left": { "type": "CallExpression", - "start": 7723, - "end": 7738, + "start": 7809, + "end": 7824, "loc": { "start": { "line": 222, @@ -10867,8 +11139,8 @@ }, "callee": { "type": "Identifier", - "start": 7723, - "end": 7730, + "start": 7809, + "end": 7816, "loc": { "start": { "line": 222, @@ -10885,8 +11157,8 @@ "arguments": [ { "type": "Identifier", - "start": 7731, - "end": 7737, + "start": 7817, + "end": 7823, "loc": { "start": { "line": 222, @@ -10905,8 +11177,8 @@ "operator": "+", "right": { "type": "MemberExpression", - "start": 7741, - "end": 7753, + "start": 7827, + "end": 7839, "loc": { "start": { "line": 222, @@ -10919,8 +11191,8 @@ }, "object": { "type": "Identifier", - "start": 7741, - "end": 7750, + "start": 7827, + "end": 7836, "loc": { "start": { "line": 222, @@ -10936,8 +11208,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7751, - "end": 7752, + "start": 7837, + "end": 7838, "loc": { "start": { "line": 222, @@ -10960,8 +11232,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 7756, - "end": 7757, + "start": 7842, + "end": 7843, "loc": { "start": { "line": 222, @@ -10983,8 +11255,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 7721, - "end": 7721, + "start": 7807, + "end": 7807, "loc": { "start": { "line": 222, @@ -11003,8 +11275,8 @@ }, { "type": "TemplateElement", - "start": 7758, - "end": 7760, + "start": 7844, + "end": 7846, "loc": { "start": { "line": 222, @@ -11027,8 +11299,8 @@ }, { "type": "ExpressionStatement", - "start": 7787, - "end": 7856, + "start": 7873, + "end": 7942, "loc": { "start": { "line": 223, @@ -11041,8 +11313,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7787, - "end": 7855, + "start": 7873, + "end": 7941, "loc": { "start": { "line": 223, @@ -11056,8 +11328,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7787, - "end": 7812, + "start": 7873, + "end": 7898, "loc": { "start": { "line": 223, @@ -11070,8 +11342,8 @@ }, "object": { "type": "MemberExpression", - "start": 7787, - "end": 7808, + "start": 7873, + "end": 7894, "loc": { "start": { "line": 223, @@ -11084,8 +11356,8 @@ }, "object": { "type": "MemberExpression", - "start": 7787, - "end": 7802, + "start": 7873, + "end": 7888, "loc": { "start": { "line": 223, @@ -11098,8 +11370,8 @@ }, "object": { "type": "ThisExpression", - "start": 7787, - "end": 7791, + "start": 7873, + "end": 7877, "loc": { "start": { "line": 223, @@ -11113,8 +11385,8 @@ }, "property": { "type": "Identifier", - "start": 7792, - "end": 7802, + "start": 7878, + "end": 7888, "loc": { "start": { "line": 223, @@ -11132,8 +11404,8 @@ }, "property": { "type": "Identifier", - "start": 7803, - "end": 7808, + "start": 7889, + "end": 7894, "loc": { "start": { "line": 223, @@ -11151,8 +11423,8 @@ }, "property": { "type": "Identifier", - "start": 7809, - "end": 7812, + "start": 7895, + "end": 7898, "loc": { "start": { "line": 223, @@ -11170,8 +11442,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 7815, - "end": 7855, + "start": 7901, + "end": 7941, "loc": { "start": { "line": 223, @@ -11185,8 +11457,8 @@ "expressions": [ { "type": "BinaryExpression", - "start": 7818, - "end": 7851, + "start": 7904, + "end": 7937, "loc": { "start": { "line": 223, @@ -11199,8 +11471,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7818, - "end": 7847, + "start": 7904, + "end": 7933, "loc": { "start": { "line": 223, @@ -11213,8 +11485,8 @@ }, "left": { "type": "CallExpression", - "start": 7818, - "end": 7832, + "start": 7904, + "end": 7918, "loc": { "start": { "line": 223, @@ -11227,8 +11499,8 @@ }, "callee": { "type": "Identifier", - "start": 7818, - "end": 7824, + "start": 7904, + "end": 7910, "loc": { "start": { "line": 223, @@ -11245,8 +11517,8 @@ "arguments": [ { "type": "Identifier", - "start": 7825, - "end": 7831, + "start": 7911, + "end": 7917, "loc": { "start": { "line": 223, @@ -11265,8 +11537,8 @@ "operator": "+", "right": { "type": "MemberExpression", - "start": 7835, - "end": 7847, + "start": 7921, + "end": 7933, "loc": { "start": { "line": 223, @@ -11279,8 +11551,8 @@ }, "object": { "type": "Identifier", - "start": 7835, - "end": 7844, + "start": 7921, + "end": 7930, "loc": { "start": { "line": 223, @@ -11296,8 +11568,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7845, - "end": 7846, + "start": 7931, + "end": 7932, "loc": { "start": { "line": 223, @@ -11320,8 +11592,8 @@ "operator": "-", "right": { "type": "NumericLiteral", - "start": 7850, - "end": 7851, + "start": 7936, + "end": 7937, "loc": { "start": { "line": 223, @@ -11343,8 +11615,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 7816, - "end": 7816, + "start": 7902, + "end": 7902, "loc": { "start": { "line": 223, @@ -11363,8 +11635,8 @@ }, { "type": "TemplateElement", - "start": 7852, - "end": 7854, + "start": 7938, + "end": 7940, "loc": { "start": { "line": 223, @@ -11391,8 +11663,8 @@ }, { "type": "ExpressionStatement", - "start": 7900, - "end": 7942, + "start": 7986, + "end": 8028, "loc": { "start": { "line": 226, @@ -11405,8 +11677,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7900, - "end": 7941, + "start": 7986, + "end": 8027, "loc": { "start": { "line": 226, @@ -11420,8 +11692,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7900, - "end": 7932, + "start": 7986, + "end": 8018, "loc": { "start": { "line": 226, @@ -11434,8 +11706,8 @@ }, "object": { "type": "MemberExpression", - "start": 7900, - "end": 7921, + "start": 7986, + "end": 8007, "loc": { "start": { "line": 226, @@ -11448,8 +11720,8 @@ }, "object": { "type": "MemberExpression", - "start": 7900, - "end": 7915, + "start": 7986, + "end": 8001, "loc": { "start": { "line": 226, @@ -11462,8 +11734,8 @@ }, "object": { "type": "ThisExpression", - "start": 7900, - "end": 7904, + "start": 7986, + "end": 7990, "loc": { "start": { "line": 226, @@ -11477,8 +11749,8 @@ }, "property": { "type": "Identifier", - "start": 7905, - "end": 7915, + "start": 7991, + "end": 8001, "loc": { "start": { "line": 226, @@ -11496,8 +11768,8 @@ }, "property": { "type": "Identifier", - "start": 7916, - "end": 7921, + "start": 8002, + "end": 8007, "loc": { "start": { "line": 226, @@ -11515,8 +11787,8 @@ }, "property": { "type": "Identifier", - "start": 7922, - "end": 7932, + "start": 8008, + "end": 8018, "loc": { "start": { "line": 226, @@ -11534,8 +11806,8 @@ }, "right": { "type": "StringLiteral", - "start": 7935, - "end": 7941, + "start": 8021, + "end": 8027, "loc": { "start": { "line": 226, @@ -11556,8 +11828,8 @@ }, { "type": "IfStatement", - "start": 7963, - "end": 9081, + "start": 8049, + "end": 9167, "loc": { "start": { "line": 227, @@ -11570,8 +11842,8 @@ }, "test": { "type": "LogicalExpression", - "start": 7967, - "end": 8011, + "start": 8053, + "end": 8097, "loc": { "start": { "line": 227, @@ -11584,8 +11856,8 @@ }, "left": { "type": "MemberExpression", - "start": 7967, - "end": 7988, + "start": 8053, + "end": 8074, "loc": { "start": { "line": 227, @@ -11598,8 +11870,8 @@ }, "object": { "type": "Identifier", - "start": 7967, - "end": 7972, + "start": 8053, + "end": 8058, "loc": { "start": { "line": 227, @@ -11615,8 +11887,8 @@ }, "property": { "type": "Identifier", - "start": 7973, - "end": 7988, + "start": 8059, + "end": 8074, "loc": { "start": { "line": 227, @@ -11635,8 +11907,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 7992, - "end": 8011, + "start": 8078, + "end": 8097, "loc": { "start": { "line": 227, @@ -11649,8 +11921,8 @@ }, "object": { "type": "Identifier", - "start": 7992, - "end": 7997, + "start": 8078, + "end": 8083, "loc": { "start": { "line": 227, @@ -11666,8 +11938,8 @@ }, "property": { "type": "Identifier", - "start": 7998, - "end": 8011, + "start": 8084, + "end": 8097, "loc": { "start": { "line": 227, @@ -11686,8 +11958,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8013, - "end": 8561, + "start": 8099, + "end": 8647, "loc": { "start": { "line": 227, @@ -11701,8 +11973,8 @@ "body": [ { "type": "IfStatement", - "start": 8039, - "end": 8391, + "start": 8125, + "end": 8477, "loc": { "start": { "line": 228, @@ -11715,8 +11987,8 @@ }, "test": { "type": "MemberExpression", - "start": 8043, - "end": 8059, + "start": 8129, + "end": 8145, "loc": { "start": { "line": 228, @@ -11729,8 +12001,8 @@ }, "object": { "type": "ThisExpression", - "start": 8043, - "end": 8047, + "start": 8129, + "end": 8133, "loc": { "start": { "line": 228, @@ -11744,8 +12016,8 @@ }, "property": { "type": "Identifier", - "start": 8048, - "end": 8059, + "start": 8134, + "end": 8145, "loc": { "start": { "line": 228, @@ -11763,8 +12035,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8061, - "end": 8391, + "start": 8147, + "end": 8477, "loc": { "start": { "line": 228, @@ -11778,8 +12050,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8091, - "end": 8123, + "start": 8177, + "end": 8209, "loc": { "start": { "line": 229, @@ -11792,8 +12064,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8091, - "end": 8122, + "start": 8177, + "end": 8208, "loc": { "start": { "line": 229, @@ -11807,8 +12079,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8091, - "end": 8115, + "start": 8177, + "end": 8201, "loc": { "start": { "line": 229, @@ -11821,8 +12093,8 @@ }, "object": { "type": "MemberExpression", - "start": 8091, - "end": 8107, + "start": 8177, + "end": 8193, "loc": { "start": { "line": 229, @@ -11835,8 +12107,8 @@ }, "object": { "type": "ThisExpression", - "start": 8091, - "end": 8095, + "start": 8177, + "end": 8181, "loc": { "start": { "line": 229, @@ -11850,8 +12122,8 @@ }, "property": { "type": "Identifier", - "start": 8096, - "end": 8107, + "start": 8182, + "end": 8193, "loc": { "start": { "line": 229, @@ -11869,8 +12141,8 @@ }, "property": { "type": "Identifier", - "start": 8108, - "end": 8115, + "start": 8194, + "end": 8201, "loc": { "start": { "line": 229, @@ -11888,8 +12160,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 8118, - "end": 8122, + "start": 8204, + "end": 8208, "loc": { "start": { "line": 229, @@ -11906,8 +12178,8 @@ }, { "type": "ExpressionStatement", - "start": 8152, - "end": 8197, + "start": 8238, + "end": 8283, "loc": { "start": { "line": 230, @@ -11920,8 +12192,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8152, - "end": 8196, + "start": 8238, + "end": 8282, "loc": { "start": { "line": 230, @@ -11935,8 +12207,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8152, - "end": 8178, + "start": 8238, + "end": 8264, "loc": { "start": { "line": 230, @@ -11949,8 +12221,8 @@ }, "object": { "type": "MemberExpression", - "start": 8152, - "end": 8168, + "start": 8238, + "end": 8254, "loc": { "start": { "line": 230, @@ -11963,8 +12235,8 @@ }, "object": { "type": "ThisExpression", - "start": 8152, - "end": 8156, + "start": 8238, + "end": 8242, "loc": { "start": { "line": 230, @@ -11978,8 +12250,8 @@ }, "property": { "type": "Identifier", - "start": 8157, - "end": 8168, + "start": 8243, + "end": 8254, "loc": { "start": { "line": 230, @@ -11997,8 +12269,8 @@ }, "property": { "type": "Identifier", - "start": 8169, - "end": 8178, + "start": 8255, + "end": 8264, "loc": { "start": { "line": 230, @@ -12016,8 +12288,8 @@ }, "right": { "type": "MemberExpression", - "start": 8181, - "end": 8196, + "start": 8267, + "end": 8282, "loc": { "start": { "line": 230, @@ -12030,8 +12302,8 @@ }, "object": { "type": "Identifier", - "start": 8181, - "end": 8186, + "start": 8267, + "end": 8272, "loc": { "start": { "line": 230, @@ -12047,8 +12319,8 @@ }, "property": { "type": "Identifier", - "start": 8187, - "end": 8196, + "start": 8273, + "end": 8282, "loc": { "start": { "line": 230, @@ -12068,8 +12340,8 @@ }, { "type": "ExpressionStatement", - "start": 8226, - "end": 8304, + "start": 8312, + "end": 8390, "loc": { "start": { "line": 231, @@ -12082,8 +12354,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8226, - "end": 8303, + "start": 8312, + "end": 8389, "loc": { "start": { "line": 231, @@ -12097,8 +12369,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8226, - "end": 8259, + "start": 8312, + "end": 8345, "loc": { "start": { "line": 231, @@ -12111,8 +12383,8 @@ }, "object": { "type": "MemberExpression", - "start": 8226, - "end": 8242, + "start": 8312, + "end": 8328, "loc": { "start": { "line": 231, @@ -12125,8 +12397,8 @@ }, "object": { "type": "ThisExpression", - "start": 8226, - "end": 8230, + "start": 8312, + "end": 8316, "loc": { "start": { "line": 231, @@ -12140,8 +12412,8 @@ }, "property": { "type": "Identifier", - "start": 8231, - "end": 8242, + "start": 8317, + "end": 8328, "loc": { "start": { "line": 231, @@ -12159,8 +12431,8 @@ }, "property": { "type": "Identifier", - "start": 8243, - "end": 8259, + "start": 8329, + "end": 8345, "loc": { "start": { "line": 231, @@ -12178,8 +12450,8 @@ }, "right": { "type": "LogicalExpression", - "start": 8262, - "end": 8303, + "start": 8348, + "end": 8389, "loc": { "start": { "line": 231, @@ -12192,8 +12464,8 @@ }, "left": { "type": "MemberExpression", - "start": 8262, - "end": 8284, + "start": 8348, + "end": 8370, "loc": { "start": { "line": 231, @@ -12206,8 +12478,8 @@ }, "object": { "type": "Identifier", - "start": 8262, - "end": 8267, + "start": 8348, + "end": 8353, "loc": { "start": { "line": 231, @@ -12223,8 +12495,8 @@ }, "property": { "type": "Identifier", - "start": 8268, - "end": 8284, + "start": 8354, + "end": 8370, "loc": { "start": { "line": 231, @@ -12243,8 +12515,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 8288, - "end": 8303, + "start": 8374, + "end": 8389, "loc": { "start": { "line": 231, @@ -12257,8 +12529,8 @@ }, "object": { "type": "Identifier", - "start": 8288, - "end": 8293, + "start": 8374, + "end": 8379, "loc": { "start": { "line": 231, @@ -12274,8 +12546,8 @@ }, "property": { "type": "Identifier", - "start": 8294, - "end": 8303, + "start": 8380, + "end": 8389, "loc": { "start": { "line": 231, @@ -12296,8 +12568,8 @@ }, { "type": "ExpressionStatement", - "start": 8333, - "end": 8365, + "start": 8419, + "end": 8451, "loc": { "start": { "line": 232, @@ -12310,8 +12582,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8333, - "end": 8364, + "start": 8419, + "end": 8450, "loc": { "start": { "line": 232, @@ -12325,8 +12597,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8333, - "end": 8357, + "start": 8419, + "end": 8443, "loc": { "start": { "line": 232, @@ -12339,8 +12611,8 @@ }, "object": { "type": "MemberExpression", - "start": 8333, - "end": 8349, + "start": 8419, + "end": 8435, "loc": { "start": { "line": 232, @@ -12353,8 +12625,8 @@ }, "object": { "type": "ThisExpression", - "start": 8333, - "end": 8337, + "start": 8419, + "end": 8423, "loc": { "start": { "line": 232, @@ -12368,8 +12640,8 @@ }, "property": { "type": "Identifier", - "start": 8338, - "end": 8349, + "start": 8424, + "end": 8435, "loc": { "start": { "line": 232, @@ -12387,8 +12659,8 @@ }, "property": { "type": "Identifier", - "start": 8350, - "end": 8357, + "start": 8436, + "end": 8443, "loc": { "start": { "line": 232, @@ -12406,8 +12678,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 8360, - "end": 8364, + "start": 8446, + "end": 8450, "loc": { "start": { "line": 232, @@ -12429,8 +12701,8 @@ }, { "type": "ExpressionStatement", - "start": 8416, - "end": 8465, + "start": 8502, + "end": 8551, "loc": { "start": { "line": 234, @@ -12443,8 +12715,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8416, - "end": 8464, + "start": 8502, + "end": 8550, "loc": { "start": { "line": 234, @@ -12458,8 +12730,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8416, - "end": 8448, + "start": 8502, + "end": 8534, "loc": { "start": { "line": 234, @@ -12472,8 +12744,8 @@ }, "object": { "type": "MemberExpression", - "start": 8416, - "end": 8437, + "start": 8502, + "end": 8523, "loc": { "start": { "line": 234, @@ -12486,8 +12758,8 @@ }, "object": { "type": "MemberExpression", - "start": 8416, - "end": 8431, + "start": 8502, + "end": 8517, "loc": { "start": { "line": 234, @@ -12500,8 +12772,8 @@ }, "object": { "type": "ThisExpression", - "start": 8416, - "end": 8420, + "start": 8502, + "end": 8506, "loc": { "start": { "line": 234, @@ -12515,8 +12787,8 @@ }, "property": { "type": "Identifier", - "start": 8421, - "end": 8431, + "start": 8507, + "end": 8517, "loc": { "start": { "line": 234, @@ -12534,8 +12806,8 @@ }, "property": { "type": "Identifier", - "start": 8432, - "end": 8437, + "start": 8518, + "end": 8523, "loc": { "start": { "line": 234, @@ -12553,8 +12825,8 @@ }, "property": { "type": "Identifier", - "start": 8438, - "end": 8448, + "start": 8524, + "end": 8534, "loc": { "start": { "line": 234, @@ -12572,8 +12844,8 @@ }, "right": { "type": "StringLiteral", - "start": 8451, - "end": 8464, + "start": 8537, + "end": 8550, "loc": { "start": { "line": 234, @@ -12594,8 +12866,8 @@ }, { "type": "ExpressionStatement", - "start": 8490, - "end": 8539, + "start": 8576, + "end": 8625, "loc": { "start": { "line": 235, @@ -12608,8 +12880,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8490, - "end": 8538, + "start": 8576, + "end": 8624, "loc": { "start": { "line": 235, @@ -12623,8 +12895,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8490, - "end": 8518, + "start": 8576, + "end": 8604, "loc": { "start": { "line": 235, @@ -12637,8 +12909,8 @@ }, "object": { "type": "MemberExpression", - "start": 8490, - "end": 8511, + "start": 8576, + "end": 8597, "loc": { "start": { "line": 235, @@ -12651,8 +12923,8 @@ }, "object": { "type": "MemberExpression", - "start": 8490, - "end": 8505, + "start": 8576, + "end": 8591, "loc": { "start": { "line": 235, @@ -12665,8 +12937,8 @@ }, "object": { "type": "ThisExpression", - "start": 8490, - "end": 8494, + "start": 8576, + "end": 8580, "loc": { "start": { "line": 235, @@ -12680,8 +12952,8 @@ }, "property": { "type": "Identifier", - "start": 8495, - "end": 8505, + "start": 8581, + "end": 8591, "loc": { "start": { "line": 235, @@ -12699,8 +12971,8 @@ }, "property": { "type": "Identifier", - "start": 8506, - "end": 8511, + "start": 8592, + "end": 8597, "loc": { "start": { "line": 235, @@ -12718,8 +12990,8 @@ }, "property": { "type": "Identifier", - "start": 8512, - "end": 8518, + "start": 8598, + "end": 8604, "loc": { "start": { "line": 235, @@ -12737,8 +13009,8 @@ }, "right": { "type": "StringLiteral", - "start": 8521, - "end": 8538, + "start": 8607, + "end": 8624, "loc": { "start": { "line": 235, @@ -12762,8 +13034,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 8567, - "end": 9081, + "start": 8653, + "end": 9167, "loc": { "start": { "line": 236, @@ -12777,8 +13049,8 @@ "body": [ { "type": "IfStatement", - "start": 8593, - "end": 8920, + "start": 8679, + "end": 9006, "loc": { "start": { "line": 237, @@ -12791,8 +13063,8 @@ }, "test": { "type": "MemberExpression", - "start": 8597, - "end": 8613, + "start": 8683, + "end": 8699, "loc": { "start": { "line": 237, @@ -12805,8 +13077,8 @@ }, "object": { "type": "ThisExpression", - "start": 8597, - "end": 8601, + "start": 8683, + "end": 8687, "loc": { "start": { "line": 237, @@ -12820,8 +13092,8 @@ }, "property": { "type": "Identifier", - "start": 8602, - "end": 8613, + "start": 8688, + "end": 8699, "loc": { "start": { "line": 237, @@ -12839,8 +13111,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8615, - "end": 8920, + "start": 8701, + "end": 9006, "loc": { "start": { "line": 237, @@ -12854,8 +13126,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8645, - "end": 8677, + "start": 8731, + "end": 8763, "loc": { "start": { "line": 238, @@ -12868,8 +13140,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8645, - "end": 8676, + "start": 8731, + "end": 8762, "loc": { "start": { "line": 238, @@ -12883,8 +13155,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8645, - "end": 8669, + "start": 8731, + "end": 8755, "loc": { "start": { "line": 238, @@ -12897,8 +13169,8 @@ }, "object": { "type": "MemberExpression", - "start": 8645, - "end": 8661, + "start": 8731, + "end": 8747, "loc": { "start": { "line": 238, @@ -12911,8 +13183,8 @@ }, "object": { "type": "ThisExpression", - "start": 8645, - "end": 8649, + "start": 8731, + "end": 8735, "loc": { "start": { "line": 238, @@ -12926,8 +13198,8 @@ }, "property": { "type": "Identifier", - "start": 8650, - "end": 8661, + "start": 8736, + "end": 8747, "loc": { "start": { "line": 238, @@ -12945,8 +13217,8 @@ }, "property": { "type": "Identifier", - "start": 8662, - "end": 8669, + "start": 8748, + "end": 8755, "loc": { "start": { "line": 238, @@ -12964,8 +13236,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 8672, - "end": 8676, + "start": 8758, + "end": 8762, "loc": { "start": { "line": 238, @@ -12982,8 +13254,8 @@ }, { "type": "ExpressionStatement", - "start": 8706, - "end": 8751, + "start": 8792, + "end": 8837, "loc": { "start": { "line": 239, @@ -12996,8 +13268,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8706, - "end": 8750, + "start": 8792, + "end": 8836, "loc": { "start": { "line": 239, @@ -13011,8 +13283,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8706, - "end": 8732, + "start": 8792, + "end": 8818, "loc": { "start": { "line": 239, @@ -13025,8 +13297,8 @@ }, "object": { "type": "MemberExpression", - "start": 8706, - "end": 8722, + "start": 8792, + "end": 8808, "loc": { "start": { "line": 239, @@ -13039,8 +13311,8 @@ }, "object": { "type": "ThisExpression", - "start": 8706, - "end": 8710, + "start": 8792, + "end": 8796, "loc": { "start": { "line": 239, @@ -13054,8 +13326,8 @@ }, "property": { "type": "Identifier", - "start": 8711, - "end": 8722, + "start": 8797, + "end": 8808, "loc": { "start": { "line": 239, @@ -13073,8 +13345,8 @@ }, "property": { "type": "Identifier", - "start": 8723, - "end": 8732, + "start": 8809, + "end": 8818, "loc": { "start": { "line": 239, @@ -13092,8 +13364,8 @@ }, "right": { "type": "MemberExpression", - "start": 8735, - "end": 8750, + "start": 8821, + "end": 8836, "loc": { "start": { "line": 239, @@ -13106,8 +13378,8 @@ }, "object": { "type": "Identifier", - "start": 8735, - "end": 8740, + "start": 8821, + "end": 8826, "loc": { "start": { "line": 239, @@ -13123,8 +13395,8 @@ }, "property": { "type": "Identifier", - "start": 8741, - "end": 8750, + "start": 8827, + "end": 8836, "loc": { "start": { "line": 239, @@ -13144,8 +13416,8 @@ }, { "type": "ExpressionStatement", - "start": 8780, - "end": 8832, + "start": 8866, + "end": 8918, "loc": { "start": { "line": 240, @@ -13158,8 +13430,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8780, - "end": 8831, + "start": 8866, + "end": 8917, "loc": { "start": { "line": 240, @@ -13173,8 +13445,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8780, - "end": 8813, + "start": 8866, + "end": 8899, "loc": { "start": { "line": 240, @@ -13187,8 +13459,8 @@ }, "object": { "type": "MemberExpression", - "start": 8780, - "end": 8796, + "start": 8866, + "end": 8882, "loc": { "start": { "line": 240, @@ -13201,8 +13473,8 @@ }, "object": { "type": "ThisExpression", - "start": 8780, - "end": 8784, + "start": 8866, + "end": 8870, "loc": { "start": { "line": 240, @@ -13216,8 +13488,8 @@ }, "property": { "type": "Identifier", - "start": 8785, - "end": 8796, + "start": 8871, + "end": 8882, "loc": { "start": { "line": 240, @@ -13235,8 +13507,8 @@ }, "property": { "type": "Identifier", - "start": 8797, - "end": 8813, + "start": 8883, + "end": 8899, "loc": { "start": { "line": 240, @@ -13254,8 +13526,8 @@ }, "right": { "type": "MemberExpression", - "start": 8816, - "end": 8831, + "start": 8902, + "end": 8917, "loc": { "start": { "line": 240, @@ -13268,8 +13540,8 @@ }, "object": { "type": "Identifier", - "start": 8816, - "end": 8821, + "start": 8902, + "end": 8907, "loc": { "start": { "line": 240, @@ -13285,8 +13557,8 @@ }, "property": { "type": "Identifier", - "start": 8822, - "end": 8831, + "start": 8908, + "end": 8917, "loc": { "start": { "line": 240, @@ -13306,8 +13578,8 @@ }, { "type": "ExpressionStatement", - "start": 8861, - "end": 8894, + "start": 8947, + "end": 8980, "loc": { "start": { "line": 241, @@ -13320,8 +13592,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8861, - "end": 8893, + "start": 8947, + "end": 8979, "loc": { "start": { "line": 241, @@ -13335,8 +13607,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8861, - "end": 8885, + "start": 8947, + "end": 8971, "loc": { "start": { "line": 241, @@ -13349,8 +13621,8 @@ }, "object": { "type": "MemberExpression", - "start": 8861, - "end": 8877, + "start": 8947, + "end": 8963, "loc": { "start": { "line": 241, @@ -13363,8 +13635,8 @@ }, "object": { "type": "ThisExpression", - "start": 8861, - "end": 8865, + "start": 8947, + "end": 8951, "loc": { "start": { "line": 241, @@ -13378,8 +13650,8 @@ }, "property": { "type": "Identifier", - "start": 8866, - "end": 8877, + "start": 8952, + "end": 8963, "loc": { "start": { "line": 241, @@ -13397,8 +13669,8 @@ }, "property": { "type": "Identifier", - "start": 8878, - "end": 8885, + "start": 8964, + "end": 8971, "loc": { "start": { "line": 241, @@ -13416,8 +13688,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 8888, - "end": 8893, + "start": 8974, + "end": 8979, "loc": { "start": { "line": 241, @@ -13439,8 +13711,8 @@ }, { "type": "ExpressionStatement", - "start": 8945, - "end": 8987, + "start": 9031, + "end": 9073, "loc": { "start": { "line": 243, @@ -13453,8 +13725,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8945, - "end": 8986, + "start": 9031, + "end": 9072, "loc": { "start": { "line": 243, @@ -13468,8 +13740,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8945, - "end": 8977, + "start": 9031, + "end": 9063, "loc": { "start": { "line": 243, @@ -13482,8 +13754,8 @@ }, "object": { "type": "MemberExpression", - "start": 8945, - "end": 8966, + "start": 9031, + "end": 9052, "loc": { "start": { "line": 243, @@ -13496,8 +13768,8 @@ }, "object": { "type": "MemberExpression", - "start": 8945, - "end": 8960, + "start": 9031, + "end": 9046, "loc": { "start": { "line": 243, @@ -13510,8 +13782,8 @@ }, "object": { "type": "ThisExpression", - "start": 8945, - "end": 8949, + "start": 9031, + "end": 9035, "loc": { "start": { "line": 243, @@ -13525,8 +13797,8 @@ }, "property": { "type": "Identifier", - "start": 8950, - "end": 8960, + "start": 9036, + "end": 9046, "loc": { "start": { "line": 243, @@ -13544,8 +13816,8 @@ }, "property": { "type": "Identifier", - "start": 8961, - "end": 8966, + "start": 9047, + "end": 9052, "loc": { "start": { "line": 243, @@ -13563,8 +13835,8 @@ }, "property": { "type": "Identifier", - "start": 8967, - "end": 8977, + "start": 9053, + "end": 9063, "loc": { "start": { "line": 243, @@ -13582,8 +13854,8 @@ }, "right": { "type": "StringLiteral", - "start": 8980, - "end": 8986, + "start": 9066, + "end": 9072, "loc": { "start": { "line": 243, @@ -13604,8 +13876,8 @@ }, { "type": "ExpressionStatement", - "start": 9012, - "end": 9059, + "start": 9098, + "end": 9145, "loc": { "start": { "line": 244, @@ -13618,8 +13890,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9012, - "end": 9058, + "start": 9098, + "end": 9144, "loc": { "start": { "line": 244, @@ -13633,8 +13905,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9012, - "end": 9040, + "start": 9098, + "end": 9126, "loc": { "start": { "line": 244, @@ -13647,8 +13919,8 @@ }, "object": { "type": "MemberExpression", - "start": 9012, - "end": 9033, + "start": 9098, + "end": 9119, "loc": { "start": { "line": 244, @@ -13661,8 +13933,8 @@ }, "object": { "type": "MemberExpression", - "start": 9012, - "end": 9027, + "start": 9098, + "end": 9113, "loc": { "start": { "line": 244, @@ -13675,8 +13947,8 @@ }, "object": { "type": "ThisExpression", - "start": 9012, - "end": 9016, + "start": 9098, + "end": 9102, "loc": { "start": { "line": 244, @@ -13690,8 +13962,8 @@ }, "property": { "type": "Identifier", - "start": 9017, - "end": 9027, + "start": 9103, + "end": 9113, "loc": { "start": { "line": 244, @@ -13709,8 +13981,8 @@ }, "property": { "type": "Identifier", - "start": 9028, - "end": 9033, + "start": 9114, + "end": 9119, "loc": { "start": { "line": 244, @@ -13728,8 +14000,8 @@ }, "property": { "type": "Identifier", - "start": 9034, - "end": 9040, + "start": 9120, + "end": 9126, "loc": { "start": { "line": 244, @@ -13747,8 +14019,8 @@ }, "right": { "type": "StringLiteral", - "start": 9043, - "end": 9058, + "start": 9129, + "end": 9144, "loc": { "start": { "line": 244, @@ -13773,8 +14045,8 @@ }, { "type": "ExpressionStatement", - "start": 9102, - "end": 9131, + "start": 9188, + "end": 9217, "loc": { "start": { "line": 246, @@ -13787,8 +14059,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9102, - "end": 9130, + "start": 9188, + "end": 9216, "loc": { "start": { "line": 246, @@ -13802,8 +14074,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 9102, - "end": 9115, + "start": 9188, + "end": 9201, "loc": { "start": { "line": 246, @@ -13819,8 +14091,8 @@ }, "right": { "type": "MemberExpression", - "start": 9118, - "end": 9130, + "start": 9204, + "end": 9216, "loc": { "start": { "line": 246, @@ -13833,8 +14105,8 @@ }, "object": { "type": "Identifier", - "start": 9118, - "end": 9123, + "start": 9204, + "end": 9209, "loc": { "start": { "line": 246, @@ -13850,8 +14122,8 @@ }, "property": { "type": "Identifier", - "start": 9124, - "end": 9130, + "start": 9210, + "end": 9216, "loc": { "start": { "line": 246, @@ -13874,8 +14146,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 9155, - "end": 9295, + "start": 9241, + "end": 9381, "loc": { "start": { "line": 247, @@ -13889,8 +14161,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9177, - "end": 9217, + "start": 9263, + "end": 9303, "loc": { "start": { "line": 248, @@ -13903,8 +14175,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9177, - "end": 9216, + "start": 9263, + "end": 9302, "loc": { "start": { "line": 248, @@ -13918,8 +14190,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9177, - "end": 9203, + "start": 9263, + "end": 9289, "loc": { "start": { "line": 248, @@ -13932,8 +14204,8 @@ }, "object": { "type": "MemberExpression", - "start": 9177, - "end": 9198, + "start": 9263, + "end": 9284, "loc": { "start": { "line": 248, @@ -13946,8 +14218,8 @@ }, "object": { "type": "MemberExpression", - "start": 9177, - "end": 9192, + "start": 9263, + "end": 9278, "loc": { "start": { "line": 248, @@ -13960,8 +14232,8 @@ }, "object": { "type": "ThisExpression", - "start": 9177, - "end": 9181, + "start": 9263, + "end": 9267, "loc": { "start": { "line": 248, @@ -13975,8 +14247,8 @@ }, "property": { "type": "Identifier", - "start": 9182, - "end": 9192, + "start": 9268, + "end": 9278, "loc": { "start": { "line": 248, @@ -13994,8 +14266,8 @@ }, "property": { "type": "Identifier", - "start": 9193, - "end": 9198, + "start": 9279, + "end": 9284, "loc": { "start": { "line": 248, @@ -14013,8 +14285,8 @@ }, "property": { "type": "Identifier", - "start": 9199, - "end": 9203, + "start": 9285, + "end": 9289, "loc": { "start": { "line": 248, @@ -14032,8 +14304,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 9206, - "end": 9216, + "start": 9292, + "end": 9302, "loc": { "start": { "line": 248, @@ -14048,8 +14320,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 9207, - "end": 9215, + "start": 9293, + "end": 9301, "loc": { "start": { "line": 248, @@ -14072,8 +14344,8 @@ }, { "type": "ExpressionStatement", - "start": 9238, - "end": 9277, + "start": 9324, + "end": 9363, "loc": { "start": { "line": 249, @@ -14086,8 +14358,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9238, - "end": 9276, + "start": 9324, + "end": 9362, "loc": { "start": { "line": 249, @@ -14101,8 +14373,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9238, - "end": 9263, + "start": 9324, + "end": 9349, "loc": { "start": { "line": 249, @@ -14115,8 +14387,8 @@ }, "object": { "type": "MemberExpression", - "start": 9238, - "end": 9259, + "start": 9324, + "end": 9345, "loc": { "start": { "line": 249, @@ -14129,8 +14401,8 @@ }, "object": { "type": "MemberExpression", - "start": 9238, - "end": 9253, + "start": 9324, + "end": 9339, "loc": { "start": { "line": 249, @@ -14143,8 +14415,8 @@ }, "object": { "type": "ThisExpression", - "start": 9238, - "end": 9242, + "start": 9324, + "end": 9328, "loc": { "start": { "line": 249, @@ -14158,8 +14430,8 @@ }, "property": { "type": "Identifier", - "start": 9243, - "end": 9253, + "start": 9329, + "end": 9339, "loc": { "start": { "line": 249, @@ -14177,8 +14449,8 @@ }, "property": { "type": "Identifier", - "start": 9254, - "end": 9259, + "start": 9340, + "end": 9345, "loc": { "start": { "line": 249, @@ -14196,8 +14468,8 @@ }, "property": { "type": "Identifier", - "start": 9260, - "end": 9263, + "start": 9346, + "end": 9349, "loc": { "start": { "line": 249, @@ -14215,8 +14487,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 9266, - "end": 9276, + "start": 9352, + "end": 9362, "loc": { "start": { "line": 249, @@ -14231,8 +14503,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 9267, - "end": 9275, + "start": 9353, + "end": 9361, "loc": { "start": { "line": 249, @@ -14259,8 +14531,8 @@ }, { "type": "ExpressionStatement", - "start": 9312, - "end": 9344, + "start": 9398, + "end": 9430, "loc": { "start": { "line": 251, @@ -14273,8 +14545,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9312, - "end": 9343, + "start": 9398, + "end": 9429, "loc": { "start": { "line": 251, @@ -14288,8 +14560,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9312, - "end": 9331, + "start": 9398, + "end": 9417, "loc": { "start": { "line": 251, @@ -14302,8 +14574,8 @@ }, "object": { "type": "MemberExpression", - "start": 9312, - "end": 9324, + "start": 9398, + "end": 9410, "loc": { "start": { "line": 251, @@ -14316,8 +14588,8 @@ }, "object": { "type": "Identifier", - "start": 9312, - "end": 9318, + "start": 9398, + "end": 9404, "loc": { "start": { "line": 251, @@ -14333,8 +14605,8 @@ }, "property": { "type": "Identifier", - "start": 9319, - "end": 9324, + "start": 9405, + "end": 9410, "loc": { "start": { "line": 251, @@ -14352,8 +14624,8 @@ }, "property": { "type": "Identifier", - "start": 9325, - "end": 9331, + "start": 9411, + "end": 9417, "loc": { "start": { "line": 251, @@ -14371,8 +14643,8 @@ }, "right": { "type": "StringLiteral", - "start": 9334, - "end": 9343, + "start": 9420, + "end": 9429, "loc": { "start": { "line": 251, @@ -14393,8 +14665,8 @@ }, { "type": "IfStatement", - "start": 9361, - "end": 10596, + "start": 9447, + "end": 10682, "loc": { "start": { "line": 252, @@ -14407,8 +14679,8 @@ }, "test": { "type": "MemberExpression", - "start": 9365, - "end": 9397, + "start": 9451, + "end": 9483, "loc": { "start": { "line": 252, @@ -14421,8 +14693,8 @@ }, "object": { "type": "ThisExpression", - "start": 9365, - "end": 9369, + "start": 9451, + "end": 9455, "loc": { "start": { "line": 252, @@ -14436,8 +14708,8 @@ }, "property": { "type": "Identifier", - "start": 9370, - "end": 9397, + "start": 9456, + "end": 9483, "loc": { "start": { "line": 252, @@ -14455,8 +14727,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 9399, - "end": 10596, + "start": 9485, + "end": 10682, "loc": { "start": { "line": 252, @@ -14470,8 +14742,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9421, - "end": 9522, + "start": 9507, + "end": 9608, "loc": { "start": { "line": 253, @@ -14484,8 +14756,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9421, - "end": 9521, + "start": 9507, + "end": 9607, "loc": { "start": { "line": 253, @@ -14499,8 +14771,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9421, - "end": 9465, + "start": 9507, + "end": 9551, "loc": { "start": { "line": 253, @@ -14513,8 +14785,8 @@ }, "object": { "type": "MemberExpression", - "start": 9421, - "end": 9453, + "start": 9507, + "end": 9539, "loc": { "start": { "line": 253, @@ -14527,8 +14799,8 @@ }, "object": { "type": "ThisExpression", - "start": 9421, - "end": 9425, + "start": 9507, + "end": 9511, "loc": { "start": { "line": 253, @@ -14542,8 +14814,8 @@ }, "property": { "type": "Identifier", - "start": 9426, - "end": 9453, + "start": 9512, + "end": 9539, "loc": { "start": { "line": 253, @@ -14561,8 +14833,8 @@ }, "property": { "type": "Identifier", - "start": 9454, - "end": 9465, + "start": 9540, + "end": 9551, "loc": { "start": { "line": 253, @@ -14580,8 +14852,8 @@ }, "right": { "type": "MemberExpression", - "start": 9468, - "end": 9521, + "start": 9554, + "end": 9607, "loc": { "start": { "line": 253, @@ -14594,8 +14866,8 @@ }, "object": { "type": "MemberExpression", - "start": 9468, - "end": 9509, + "start": 9554, + "end": 9595, "loc": { "start": { "line": 253, @@ -14608,8 +14880,8 @@ }, "object": { "type": "ThisExpression", - "start": 9468, - "end": 9472, + "start": 9554, + "end": 9558, "loc": { "start": { "line": 253, @@ -14623,8 +14895,8 @@ }, "property": { "type": "Identifier", - "start": 9473, - "end": 9509, + "start": 9559, + "end": 9595, "loc": { "start": { "line": 253, @@ -14642,8 +14914,8 @@ }, "property": { "type": "Identifier", - "start": 9510, - "end": 9521, + "start": 9596, + "end": 9607, "loc": { "start": { "line": 253, @@ -14663,8 +14935,8 @@ }, { "type": "ExpressionStatement", - "start": 9543, - "end": 9698, + "start": 9629, + "end": 9784, "loc": { "start": { "line": 254, @@ -14677,8 +14949,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9543, - "end": 9697, + "start": 9629, + "end": 9783, "loc": { "start": { "line": 254, @@ -14692,8 +14964,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9543, - "end": 9587, + "start": 9629, + "end": 9673, "loc": { "start": { "line": 254, @@ -14706,8 +14978,8 @@ }, "object": { "type": "MemberExpression", - "start": 9543, - "end": 9575, + "start": 9629, + "end": 9661, "loc": { "start": { "line": 254, @@ -14720,8 +14992,8 @@ }, "object": { "type": "ThisExpression", - "start": 9543, - "end": 9547, + "start": 9629, + "end": 9633, "loc": { "start": { "line": 254, @@ -14735,8 +15007,8 @@ }, "property": { "type": "Identifier", - "start": 9548, - "end": 9575, + "start": 9634, + "end": 9661, "loc": { "start": { "line": 254, @@ -14754,8 +15026,8 @@ }, "property": { "type": "Identifier", - "start": 9576, - "end": 9587, + "start": 9662, + "end": 9673, "loc": { "start": { "line": 254, @@ -14773,8 +15045,8 @@ }, "right": { "type": "LogicalExpression", - "start": 9590, - "end": 9697, + "start": 9676, + "end": 9783, "loc": { "start": { "line": 254, @@ -14787,8 +15059,8 @@ }, "left": { "type": "MemberExpression", - "start": 9590, - "end": 9643, + "start": 9676, + "end": 9729, "loc": { "start": { "line": 254, @@ -14801,8 +15073,8 @@ }, "object": { "type": "MemberExpression", - "start": 9590, - "end": 9631, + "start": 9676, + "end": 9717, "loc": { "start": { "line": 254, @@ -14815,8 +15087,8 @@ }, "object": { "type": "ThisExpression", - "start": 9590, - "end": 9594, + "start": 9676, + "end": 9680, "loc": { "start": { "line": 254, @@ -14830,8 +15102,8 @@ }, "property": { "type": "Identifier", - "start": 9595, - "end": 9631, + "start": 9681, + "end": 9717, "loc": { "start": { "line": 254, @@ -14849,8 +15121,8 @@ }, "property": { "type": "Identifier", - "start": 9632, - "end": 9643, + "start": 9718, + "end": 9729, "loc": { "start": { "line": 254, @@ -14869,8 +15141,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 9647, - "end": 9697, + "start": 9733, + "end": 9783, "loc": { "start": { "line": 254, @@ -14883,8 +15155,8 @@ }, "object": { "type": "MemberExpression", - "start": 9647, - "end": 9678, + "start": 9733, + "end": 9764, "loc": { "start": { "line": 254, @@ -14897,8 +15169,8 @@ }, "object": { "type": "ThisExpression", - "start": 9647, - "end": 9651, + "start": 9733, + "end": 9737, "loc": { "start": { "line": 254, @@ -14912,8 +15184,8 @@ }, "property": { "type": "Identifier", - "start": 9652, - "end": 9678, + "start": 9738, + "end": 9764, "loc": { "start": { "line": 254, @@ -14931,8 +15203,8 @@ }, "property": { "type": "Identifier", - "start": 9679, - "end": 9697, + "start": 9765, + "end": 9783, "loc": { "start": { "line": 254, @@ -14953,8 +15225,8 @@ }, { "type": "ExpressionStatement", - "start": 9719, - "end": 9877, + "start": 9805, + "end": 9963, "loc": { "start": { "line": 255, @@ -14967,8 +15239,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9719, - "end": 9876, + "start": 9805, + "end": 9962, "loc": { "start": { "line": 255, @@ -14982,8 +15254,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9719, - "end": 9764, + "start": 9805, + "end": 9850, "loc": { "start": { "line": 255, @@ -14996,8 +15268,8 @@ }, "object": { "type": "MemberExpression", - "start": 9719, - "end": 9751, + "start": 9805, + "end": 9837, "loc": { "start": { "line": 255, @@ -15010,8 +15282,8 @@ }, "object": { "type": "ThisExpression", - "start": 9719, - "end": 9723, + "start": 9805, + "end": 9809, "loc": { "start": { "line": 255, @@ -15025,8 +15297,8 @@ }, "property": { "type": "Identifier", - "start": 9724, - "end": 9751, + "start": 9810, + "end": 9837, "loc": { "start": { "line": 255, @@ -15044,8 +15316,8 @@ }, "property": { "type": "Identifier", - "start": 9752, - "end": 9764, + "start": 9838, + "end": 9850, "loc": { "start": { "line": 255, @@ -15063,8 +15335,8 @@ }, "right": { "type": "LogicalExpression", - "start": 9767, - "end": 9876, + "start": 9853, + "end": 9962, "loc": { "start": { "line": 255, @@ -15077,8 +15349,8 @@ }, "left": { "type": "MemberExpression", - "start": 9767, - "end": 9821, + "start": 9853, + "end": 9907, "loc": { "start": { "line": 255, @@ -15091,8 +15363,8 @@ }, "object": { "type": "MemberExpression", - "start": 9767, - "end": 9808, + "start": 9853, + "end": 9894, "loc": { "start": { "line": 255, @@ -15105,8 +15377,8 @@ }, "object": { "type": "ThisExpression", - "start": 9767, - "end": 9771, + "start": 9853, + "end": 9857, "loc": { "start": { "line": 255, @@ -15120,8 +15392,8 @@ }, "property": { "type": "Identifier", - "start": 9772, - "end": 9808, + "start": 9858, + "end": 9894, "loc": { "start": { "line": 255, @@ -15139,8 +15411,8 @@ }, "property": { "type": "Identifier", - "start": 9809, - "end": 9821, + "start": 9895, + "end": 9907, "loc": { "start": { "line": 255, @@ -15159,8 +15431,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 9825, - "end": 9876, + "start": 9911, + "end": 9962, "loc": { "start": { "line": 255, @@ -15173,8 +15445,8 @@ }, "object": { "type": "MemberExpression", - "start": 9825, - "end": 9856, + "start": 9911, + "end": 9942, "loc": { "start": { "line": 255, @@ -15187,8 +15459,8 @@ }, "object": { "type": "ThisExpression", - "start": 9825, - "end": 9829, + "start": 9911, + "end": 9915, "loc": { "start": { "line": 255, @@ -15202,8 +15474,8 @@ }, "property": { "type": "Identifier", - "start": 9830, - "end": 9856, + "start": 9916, + "end": 9942, "loc": { "start": { "line": 255, @@ -15221,8 +15493,8 @@ }, "property": { "type": "Identifier", - "start": 9857, - "end": 9876, + "start": 9943, + "end": 9962, "loc": { "start": { "line": 255, @@ -15243,8 +15515,8 @@ }, { "type": "ExpressionStatement", - "start": 9898, - "end": 10056, + "start": 9984, + "end": 10142, "loc": { "start": { "line": 256, @@ -15257,8 +15529,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9898, - "end": 10055, + "start": 9984, + "end": 10141, "loc": { "start": { "line": 256, @@ -15272,8 +15544,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9898, - "end": 9943, + "start": 9984, + "end": 10029, "loc": { "start": { "line": 256, @@ -15286,8 +15558,8 @@ }, "object": { "type": "MemberExpression", - "start": 9898, - "end": 9930, + "start": 9984, + "end": 10016, "loc": { "start": { "line": 256, @@ -15300,8 +15572,8 @@ }, "object": { "type": "ThisExpression", - "start": 9898, - "end": 9902, + "start": 9984, + "end": 9988, "loc": { "start": { "line": 256, @@ -15315,8 +15587,8 @@ }, "property": { "type": "Identifier", - "start": 9903, - "end": 9930, + "start": 9989, + "end": 10016, "loc": { "start": { "line": 256, @@ -15334,8 +15606,8 @@ }, "property": { "type": "Identifier", - "start": 9931, - "end": 9943, + "start": 10017, + "end": 10029, "loc": { "start": { "line": 256, @@ -15353,8 +15625,8 @@ }, "right": { "type": "LogicalExpression", - "start": 9946, - "end": 10055, + "start": 10032, + "end": 10141, "loc": { "start": { "line": 256, @@ -15367,8 +15639,8 @@ }, "left": { "type": "MemberExpression", - "start": 9946, - "end": 10000, + "start": 10032, + "end": 10086, "loc": { "start": { "line": 256, @@ -15381,8 +15653,8 @@ }, "object": { "type": "MemberExpression", - "start": 9946, - "end": 9987, + "start": 10032, + "end": 10073, "loc": { "start": { "line": 256, @@ -15395,8 +15667,8 @@ }, "object": { "type": "ThisExpression", - "start": 9946, - "end": 9950, + "start": 10032, + "end": 10036, "loc": { "start": { "line": 256, @@ -15410,8 +15682,8 @@ }, "property": { "type": "Identifier", - "start": 9951, - "end": 9987, + "start": 10037, + "end": 10073, "loc": { "start": { "line": 256, @@ -15429,8 +15701,8 @@ }, "property": { "type": "Identifier", - "start": 9988, - "end": 10000, + "start": 10074, + "end": 10086, "loc": { "start": { "line": 256, @@ -15449,8 +15721,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 10004, - "end": 10055, + "start": 10090, + "end": 10141, "loc": { "start": { "line": 256, @@ -15463,8 +15735,8 @@ }, "object": { "type": "MemberExpression", - "start": 10004, - "end": 10035, + "start": 10090, + "end": 10121, "loc": { "start": { "line": 256, @@ -15477,8 +15749,8 @@ }, "object": { "type": "ThisExpression", - "start": 10004, - "end": 10008, + "start": 10090, + "end": 10094, "loc": { "start": { "line": 256, @@ -15492,8 +15764,8 @@ }, "property": { "type": "Identifier", - "start": 10009, - "end": 10035, + "start": 10095, + "end": 10121, "loc": { "start": { "line": 256, @@ -15511,8 +15783,8 @@ }, "property": { "type": "Identifier", - "start": 10036, - "end": 10055, + "start": 10122, + "end": 10141, "loc": { "start": { "line": 256, @@ -15533,8 +15805,8 @@ }, { "type": "ExpressionStatement", - "start": 10077, - "end": 10235, + "start": 10163, + "end": 10321, "loc": { "start": { "line": 257, @@ -15547,8 +15819,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10077, - "end": 10234, + "start": 10163, + "end": 10320, "loc": { "start": { "line": 257, @@ -15562,8 +15834,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10077, - "end": 10122, + "start": 10163, + "end": 10208, "loc": { "start": { "line": 257, @@ -15576,8 +15848,8 @@ }, "object": { "type": "MemberExpression", - "start": 10077, - "end": 10109, + "start": 10163, + "end": 10195, "loc": { "start": { "line": 257, @@ -15590,8 +15862,8 @@ }, "object": { "type": "ThisExpression", - "start": 10077, - "end": 10081, + "start": 10163, + "end": 10167, "loc": { "start": { "line": 257, @@ -15605,8 +15877,8 @@ }, "property": { "type": "Identifier", - "start": 10082, - "end": 10109, + "start": 10168, + "end": 10195, "loc": { "start": { "line": 257, @@ -15624,8 +15896,8 @@ }, "property": { "type": "Identifier", - "start": 10110, - "end": 10122, + "start": 10196, + "end": 10208, "loc": { "start": { "line": 257, @@ -15643,8 +15915,8 @@ }, "right": { "type": "LogicalExpression", - "start": 10125, - "end": 10234, + "start": 10211, + "end": 10320, "loc": { "start": { "line": 257, @@ -15657,8 +15929,8 @@ }, "left": { "type": "MemberExpression", - "start": 10125, - "end": 10179, + "start": 10211, + "end": 10265, "loc": { "start": { "line": 257, @@ -15671,8 +15943,8 @@ }, "object": { "type": "MemberExpression", - "start": 10125, - "end": 10166, + "start": 10211, + "end": 10252, "loc": { "start": { "line": 257, @@ -15685,8 +15957,8 @@ }, "object": { "type": "ThisExpression", - "start": 10125, - "end": 10129, + "start": 10211, + "end": 10215, "loc": { "start": { "line": 257, @@ -15700,8 +15972,8 @@ }, "property": { "type": "Identifier", - "start": 10130, - "end": 10166, + "start": 10216, + "end": 10252, "loc": { "start": { "line": 257, @@ -15719,8 +15991,8 @@ }, "property": { "type": "Identifier", - "start": 10167, - "end": 10179, + "start": 10253, + "end": 10265, "loc": { "start": { "line": 257, @@ -15739,8 +16011,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 10183, - "end": 10234, + "start": 10269, + "end": 10320, "loc": { "start": { "line": 257, @@ -15753,8 +16025,8 @@ }, "object": { "type": "MemberExpression", - "start": 10183, - "end": 10214, + "start": 10269, + "end": 10300, "loc": { "start": { "line": 257, @@ -15767,8 +16039,8 @@ }, "object": { "type": "ThisExpression", - "start": 10183, - "end": 10187, + "start": 10269, + "end": 10273, "loc": { "start": { "line": 257, @@ -15782,8 +16054,8 @@ }, "property": { "type": "Identifier", - "start": 10188, - "end": 10214, + "start": 10274, + "end": 10300, "loc": { "start": { "line": 257, @@ -15801,8 +16073,8 @@ }, "property": { "type": "Identifier", - "start": 10215, - "end": 10234, + "start": 10301, + "end": 10320, "loc": { "start": { "line": 257, @@ -15823,8 +16095,8 @@ }, { "type": "ExpressionStatement", - "start": 10256, - "end": 10361, + "start": 10342, + "end": 10447, "loc": { "start": { "line": 258, @@ -15837,8 +16109,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10256, - "end": 10360, + "start": 10342, + "end": 10446, "loc": { "start": { "line": 258, @@ -15852,8 +16124,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10256, - "end": 10302, + "start": 10342, + "end": 10388, "loc": { "start": { "line": 258, @@ -15866,8 +16138,8 @@ }, "object": { "type": "MemberExpression", - "start": 10256, - "end": 10288, + "start": 10342, + "end": 10374, "loc": { "start": { "line": 258, @@ -15880,8 +16152,8 @@ }, "object": { "type": "ThisExpression", - "start": 10256, - "end": 10260, + "start": 10342, + "end": 10346, "loc": { "start": { "line": 258, @@ -15895,8 +16167,8 @@ }, "property": { "type": "Identifier", - "start": 10261, - "end": 10288, + "start": 10347, + "end": 10374, "loc": { "start": { "line": 258, @@ -15914,8 +16186,8 @@ }, "property": { "type": "Identifier", - "start": 10289, - "end": 10302, + "start": 10375, + "end": 10388, "loc": { "start": { "line": 258, @@ -15933,8 +16205,8 @@ }, "right": { "type": "MemberExpression", - "start": 10305, - "end": 10360, + "start": 10391, + "end": 10446, "loc": { "start": { "line": 258, @@ -15947,8 +16219,8 @@ }, "object": { "type": "MemberExpression", - "start": 10305, - "end": 10346, + "start": 10391, + "end": 10432, "loc": { "start": { "line": 258, @@ -15961,8 +16233,8 @@ }, "object": { "type": "ThisExpression", - "start": 10305, - "end": 10309, + "start": 10391, + "end": 10395, "loc": { "start": { "line": 258, @@ -15976,8 +16248,8 @@ }, "property": { "type": "Identifier", - "start": 10310, - "end": 10346, + "start": 10396, + "end": 10432, "loc": { "start": { "line": 258, @@ -15995,8 +16267,8 @@ }, "property": { "type": "Identifier", - "start": 10347, - "end": 10360, + "start": 10433, + "end": 10446, "loc": { "start": { "line": 258, @@ -16016,8 +16288,8 @@ }, { "type": "ExpressionStatement", - "start": 10382, - "end": 10457, + "start": 10468, + "end": 10543, "loc": { "start": { "line": 259, @@ -16030,8 +16302,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10382, - "end": 10456, + "start": 10468, + "end": 10542, "loc": { "start": { "line": 259, @@ -16045,8 +16317,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10382, - "end": 10430, + "start": 10468, + "end": 10516, "loc": { "start": { "line": 259, @@ -16059,8 +16331,8 @@ }, "object": { "type": "MemberExpression", - "start": 10382, - "end": 10421, + "start": 10468, + "end": 10507, "loc": { "start": { "line": 259, @@ -16073,8 +16345,8 @@ }, "object": { "type": "MemberExpression", - "start": 10382, - "end": 10414, + "start": 10468, + "end": 10500, "loc": { "start": { "line": 259, @@ -16087,8 +16359,8 @@ }, "object": { "type": "ThisExpression", - "start": 10382, - "end": 10386, + "start": 10468, + "end": 10472, "loc": { "start": { "line": 259, @@ -16102,8 +16374,8 @@ }, "property": { "type": "Identifier", - "start": 10387, - "end": 10414, + "start": 10473, + "end": 10500, "loc": { "start": { "line": 259, @@ -16121,8 +16393,8 @@ }, "property": { "type": "Identifier", - "start": 10415, - "end": 10421, + "start": 10501, + "end": 10507, "loc": { "start": { "line": 259, @@ -16140,8 +16412,8 @@ }, "property": { "type": "Identifier", - "start": 10422, - "end": 10430, + "start": 10508, + "end": 10516, "loc": { "start": { "line": 259, @@ -16159,8 +16431,8 @@ }, "right": { "type": "CallExpression", - "start": 10433, - "end": 10456, + "start": 10519, + "end": 10542, "loc": { "start": { "line": 259, @@ -16173,8 +16445,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10433, - "end": 10454, + "start": 10519, + "end": 10540, "loc": { "start": { "line": 259, @@ -16187,8 +16459,8 @@ }, "object": { "type": "Identifier", - "start": 10433, - "end": 10448, + "start": 10519, + "end": 10534, "loc": { "start": { "line": 259, @@ -16204,8 +16476,8 @@ }, "property": { "type": "Identifier", - "start": 10449, - "end": 10454, + "start": 10535, + "end": 10540, "loc": { "start": { "line": 259, @@ -16227,8 +16499,8 @@ }, { "type": "ExpressionStatement", - "start": 10478, - "end": 10518, + "start": 10564, + "end": 10604, "loc": { "start": { "line": 260, @@ -16241,8 +16513,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10478, - "end": 10517, + "start": 10564, + "end": 10603, "loc": { "start": { "line": 260, @@ -16256,8 +16528,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10478, - "end": 10504, + "start": 10564, + "end": 10590, "loc": { "start": { "line": 260, @@ -16270,8 +16542,8 @@ }, "object": { "type": "MemberExpression", - "start": 10478, - "end": 10499, + "start": 10564, + "end": 10585, "loc": { "start": { "line": 260, @@ -16284,8 +16556,8 @@ }, "object": { "type": "MemberExpression", - "start": 10478, - "end": 10493, + "start": 10564, + "end": 10579, "loc": { "start": { "line": 260, @@ -16298,8 +16570,8 @@ }, "object": { "type": "ThisExpression", - "start": 10478, - "end": 10482, + "start": 10564, + "end": 10568, "loc": { "start": { "line": 260, @@ -16313,8 +16585,8 @@ }, "property": { "type": "Identifier", - "start": 10483, - "end": 10493, + "start": 10569, + "end": 10579, "loc": { "start": { "line": 260, @@ -16332,8 +16604,8 @@ }, "property": { "type": "Identifier", - "start": 10494, - "end": 10499, + "start": 10580, + "end": 10585, "loc": { "start": { "line": 260, @@ -16351,8 +16623,8 @@ }, "property": { "type": "Identifier", - "start": 10500, - "end": 10504, + "start": 10586, + "end": 10590, "loc": { "start": { "line": 260, @@ -16370,8 +16642,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 10507, - "end": 10517, + "start": 10593, + "end": 10603, "loc": { "start": { "line": 260, @@ -16386,8 +16658,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 10508, - "end": 10516, + "start": 10594, + "end": 10602, "loc": { "start": { "line": 260, @@ -16410,8 +16682,8 @@ }, { "type": "ExpressionStatement", - "start": 10539, - "end": 10578, + "start": 10625, + "end": 10664, "loc": { "start": { "line": 261, @@ -16424,8 +16696,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10539, - "end": 10577, + "start": 10625, + "end": 10663, "loc": { "start": { "line": 261, @@ -16439,8 +16711,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10539, - "end": 10564, + "start": 10625, + "end": 10650, "loc": { "start": { "line": 261, @@ -16453,8 +16725,8 @@ }, "object": { "type": "MemberExpression", - "start": 10539, - "end": 10560, + "start": 10625, + "end": 10646, "loc": { "start": { "line": 261, @@ -16467,8 +16739,8 @@ }, "object": { "type": "MemberExpression", - "start": 10539, - "end": 10554, + "start": 10625, + "end": 10640, "loc": { "start": { "line": 261, @@ -16481,8 +16753,8 @@ }, "object": { "type": "ThisExpression", - "start": 10539, - "end": 10543, + "start": 10625, + "end": 10629, "loc": { "start": { "line": 261, @@ -16496,8 +16768,8 @@ }, "property": { "type": "Identifier", - "start": 10544, - "end": 10554, + "start": 10630, + "end": 10640, "loc": { "start": { "line": 261, @@ -16515,8 +16787,8 @@ }, "property": { "type": "Identifier", - "start": 10555, - "end": 10560, + "start": 10641, + "end": 10646, "loc": { "start": { "line": 261, @@ -16534,8 +16806,8 @@ }, "property": { "type": "Identifier", - "start": 10561, - "end": 10564, + "start": 10647, + "end": 10650, "loc": { "start": { "line": 261, @@ -16553,8 +16825,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 10567, - "end": 10577, + "start": 10653, + "end": 10663, "loc": { "start": { "line": 261, @@ -16569,8 +16841,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 10568, - "end": 10576, + "start": 10654, + "end": 10662, "loc": { "start": { "line": 261, @@ -16606,8 +16878,8 @@ }, { "type": "ExpressionStatement", - "start": 10622, - "end": 10858, + "start": 10708, + "end": 10944, "loc": { "start": { "line": 265, @@ -16620,8 +16892,8 @@ }, "expression": { "type": "CallExpression", - "start": 10622, - "end": 10857, + "start": 10708, + "end": 10943, "loc": { "start": { "line": 265, @@ -16634,8 +16906,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10622, - "end": 10645, + "start": 10708, + "end": 10731, "loc": { "start": { "line": 265, @@ -16648,8 +16920,8 @@ }, "object": { "type": "Identifier", - "start": 10622, - "end": 10628, + "start": 10708, + "end": 10714, "loc": { "start": { "line": 265, @@ -16665,8 +16937,8 @@ }, "property": { "type": "Identifier", - "start": 10629, - "end": 10645, + "start": 10715, + "end": 10731, "loc": { "start": { "line": 265, @@ -16685,8 +16957,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10646, - "end": 10657, + "start": 10732, + "end": 10743, "loc": { "start": { "line": 265, @@ -16705,8 +16977,8 @@ }, { "type": "AssignmentExpression", - "start": 10659, - "end": 10856, + "start": 10745, + "end": 10942, "loc": { "start": { "line": 265, @@ -16720,8 +16992,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10659, - "end": 10676, + "start": 10745, + "end": 10762, "loc": { "start": { "line": 265, @@ -16734,8 +17006,8 @@ }, "object": { "type": "ThisExpression", - "start": 10659, - "end": 10663, + "start": 10745, + "end": 10749, "loc": { "start": { "line": 265, @@ -16749,8 +17021,8 @@ }, "property": { "type": "Identifier", - "start": 10664, - "end": 10676, + "start": 10750, + "end": 10762, "loc": { "start": { "line": 265, @@ -16768,8 +17040,8 @@ }, "right": { "type": "ArrowFunctionExpression", - "start": 10679, - "end": 10856, + "start": 10765, + "end": 10942, "loc": { "start": { "line": 265, @@ -16787,8 +17059,8 @@ "params": [ { "type": "Identifier", - "start": 10680, - "end": 10681, + "start": 10766, + "end": 10767, "loc": { "start": { "line": 265, @@ -16805,8 +17077,8 @@ ], "body": { "type": "BlockStatement", - "start": 10686, - "end": 10856, + "start": 10772, + "end": 10942, "loc": { "start": { "line": 265, @@ -16820,8 +17092,8 @@ "body": [ { "type": "IfStatement", - "start": 10700, - "end": 10758, + "start": 10786, + "end": 10844, "loc": { "start": { "line": 266, @@ -16834,8 +17106,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10704, - "end": 10717, + "start": 10790, + "end": 10803, "loc": { "start": { "line": 266, @@ -16848,8 +17120,8 @@ }, "left": { "type": "MemberExpression", - "start": 10704, - "end": 10711, + "start": 10790, + "end": 10797, "loc": { "start": { "line": 266, @@ -16862,8 +17134,8 @@ }, "object": { "type": "Identifier", - "start": 10704, - "end": 10705, + "start": 10790, + "end": 10791, "loc": { "start": { "line": 266, @@ -16879,8 +17151,8 @@ }, "property": { "type": "Identifier", - "start": 10706, - "end": 10711, + "start": 10792, + "end": 10797, "loc": { "start": { "line": 266, @@ -16899,8 +17171,8 @@ "operator": "!==", "right": { "type": "NumericLiteral", - "start": 10716, - "end": 10717, + "start": 10802, + "end": 10803, "loc": { "start": { "line": 266, @@ -16920,8 +17192,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10719, - "end": 10758, + "start": 10805, + "end": 10844, "loc": { "start": { "line": 266, @@ -16935,8 +17207,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10737, - "end": 10744, + "start": 10823, + "end": 10830, "loc": { "start": { "line": 267, @@ -16956,8 +17228,8 @@ }, { "type": "ExpressionStatement", - "start": 10771, - "end": 10802, + "start": 10857, + "end": 10888, "loc": { "start": { "line": 269, @@ -16970,8 +17242,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10771, - "end": 10801, + "start": 10857, + "end": 10887, "loc": { "start": { "line": 269, @@ -16985,8 +17257,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 10771, - "end": 10789, + "start": 10857, + "end": 10875, "loc": { "start": { "line": 269, @@ -17002,8 +17274,8 @@ }, "right": { "type": "MemberExpression", - "start": 10792, - "end": 10801, + "start": 10878, + "end": 10887, "loc": { "start": { "line": 269, @@ -17016,8 +17288,8 @@ }, "object": { "type": "Identifier", - "start": 10792, - "end": 10793, + "start": 10878, + "end": 10879, "loc": { "start": { "line": 269, @@ -17033,8 +17305,8 @@ }, "property": { "type": "Identifier", - "start": 10794, - "end": 10801, + "start": 10880, + "end": 10887, "loc": { "start": { "line": 269, @@ -17054,8 +17326,8 @@ }, { "type": "ExpressionStatement", - "start": 10815, - "end": 10846, + "start": 10901, + "end": 10932, "loc": { "start": { "line": 270, @@ -17068,8 +17340,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10815, - "end": 10845, + "start": 10901, + "end": 10931, "loc": { "start": { "line": 270, @@ -17083,8 +17355,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 10815, - "end": 10833, + "start": 10901, + "end": 10919, "loc": { "start": { "line": 270, @@ -17100,8 +17372,8 @@ }, "right": { "type": "MemberExpression", - "start": 10836, - "end": 10845, + "start": 10922, + "end": 10931, "loc": { "start": { "line": 270, @@ -17114,8 +17386,8 @@ }, "object": { "type": "Identifier", - "start": 10836, - "end": 10837, + "start": 10922, + "end": 10923, "loc": { "start": { "line": 270, @@ -17131,8 +17403,8 @@ }, "property": { "type": "Identifier", - "start": 10838, - "end": 10845, + "start": 10924, + "end": 10931, "loc": { "start": { "line": 270, @@ -17160,8 +17432,8 @@ }, { "type": "ExpressionStatement", - "start": 10868, - "end": 14022, + "start": 10954, + "end": 14108, "loc": { "start": { "line": 273, @@ -17174,8 +17446,8 @@ }, "expression": { "type": "CallExpression", - "start": 10868, - "end": 14021, + "start": 10954, + "end": 14107, "loc": { "start": { "line": 273, @@ -17188,8 +17460,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10868, - "end": 10891, + "start": 10954, + "end": 10977, "loc": { "start": { "line": 273, @@ -17202,8 +17474,8 @@ }, "object": { "type": "Identifier", - "start": 10868, - "end": 10874, + "start": 10954, + "end": 10960, "loc": { "start": { "line": 273, @@ -17219,8 +17491,8 @@ }, "property": { "type": "Identifier", - "start": 10875, - "end": 10891, + "start": 10961, + "end": 10977, "loc": { "start": { "line": 273, @@ -17239,8 +17511,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10892, - "end": 10901, + "start": 10978, + "end": 10987, "loc": { "start": { "line": 273, @@ -17259,8 +17531,8 @@ }, { "type": "AssignmentExpression", - "start": 10903, - "end": 14020, + "start": 10989, + "end": 14106, "loc": { "start": { "line": 273, @@ -17274,8 +17546,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10903, - "end": 10918, + "start": 10989, + "end": 11004, "loc": { "start": { "line": 273, @@ -17288,8 +17560,8 @@ }, "object": { "type": "ThisExpression", - "start": 10903, - "end": 10907, + "start": 10989, + "end": 10993, "loc": { "start": { "line": 273, @@ -17303,8 +17575,8 @@ }, "property": { "type": "Identifier", - "start": 10908, - "end": 10918, + "start": 10994, + "end": 11004, "loc": { "start": { "line": 273, @@ -17322,8 +17594,8 @@ }, "right": { "type": "ArrowFunctionExpression", - "start": 10921, - "end": 14020, + "start": 11007, + "end": 14106, "loc": { "start": { "line": 273, @@ -17341,8 +17613,8 @@ "params": [ { "type": "Identifier", - "start": 10922, - "end": 10923, + "start": 11008, + "end": 11009, "loc": { "start": { "line": 273, @@ -17359,8 +17631,8 @@ ], "body": { "type": "BlockStatement", - "start": 10928, - "end": 14020, + "start": 11014, + "end": 14106, "loc": { "start": { "line": 273, @@ -17374,8 +17646,8 @@ "body": [ { "type": "IfStatement", - "start": 10942, - "end": 11000, + "start": 11028, + "end": 11086, "loc": { "start": { "line": 274, @@ -17388,8 +17660,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10946, - "end": 10959, + "start": 11032, + "end": 11045, "loc": { "start": { "line": 274, @@ -17402,8 +17674,8 @@ }, "left": { "type": "MemberExpression", - "start": 10946, - "end": 10953, + "start": 11032, + "end": 11039, "loc": { "start": { "line": 274, @@ -17416,8 +17688,8 @@ }, "object": { "type": "Identifier", - "start": 10946, - "end": 10947, + "start": 11032, + "end": 11033, "loc": { "start": { "line": 274, @@ -17433,8 +17705,8 @@ }, "property": { "type": "Identifier", - "start": 10948, - "end": 10953, + "start": 11034, + "end": 11039, "loc": { "start": { "line": 274, @@ -17453,8 +17725,8 @@ "operator": "!==", "right": { "type": "NumericLiteral", - "start": 10958, - "end": 10959, + "start": 11044, + "end": 11045, "loc": { "start": { "line": 274, @@ -17474,8 +17746,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10961, - "end": 11000, + "start": 11047, + "end": 11086, "loc": { "start": { "line": 274, @@ -17489,8 +17761,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10979, - "end": 10986, + "start": 11065, + "end": 11072, "loc": { "start": { "line": 275, @@ -17510,8 +17782,8 @@ }, { "type": "IfStatement", - "start": 11013, - "end": 11306, + "start": 11099, + "end": 11392, "loc": { "start": { "line": 277, @@ -17524,8 +17796,8 @@ }, "test": { "type": "LogicalExpression", - "start": 11017, - "end": 11265, + "start": 11103, + "end": 11351, "loc": { "start": { "line": 277, @@ -17538,8 +17810,8 @@ }, "left": { "type": "LogicalExpression", - "start": 11017, - "end": 11198, + "start": 11103, + "end": 11284, "loc": { "start": { "line": 277, @@ -17552,8 +17824,8 @@ }, "left": { "type": "LogicalExpression", - "start": 11017, - "end": 11131, + "start": 11103, + "end": 11217, "loc": { "start": { "line": 277, @@ -17566,8 +17838,8 @@ }, "left": { "type": "BinaryExpression", - "start": 11017, - "end": 11064, + "start": 11103, + "end": 11150, "loc": { "start": { "line": 277, @@ -17580,8 +17852,8 @@ }, "left": { "type": "MemberExpression", - "start": 11017, - "end": 11026, + "start": 11103, + "end": 11112, "loc": { "start": { "line": 277, @@ -17594,8 +17866,8 @@ }, "object": { "type": "Identifier", - "start": 11017, - "end": 11018, + "start": 11103, + "end": 11104, "loc": { "start": { "line": 277, @@ -17611,8 +17883,8 @@ }, "property": { "type": "Identifier", - "start": 11019, - "end": 11026, + "start": 11105, + "end": 11112, "loc": { "start": { "line": 277, @@ -17631,8 +17903,8 @@ "operator": ">", "right": { "type": "BinaryExpression", - "start": 11029, - "end": 11064, + "start": 11115, + "end": 11150, "loc": { "start": { "line": 277, @@ -17645,8 +17917,8 @@ }, "left": { "type": "Identifier", - "start": 11029, - "end": 11047, + "start": 11115, + "end": 11133, "loc": { "start": { "line": 277, @@ -17663,8 +17935,8 @@ "operator": "+", "right": { "type": "Identifier", - "start": 11050, - "end": 11064, + "start": 11136, + "end": 11150, "loc": { "start": { "line": 277, @@ -17683,8 +17955,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11084, - "end": 11131, + "start": 11170, + "end": 11217, "loc": { "start": { "line": 278, @@ -17697,8 +17969,8 @@ }, "left": { "type": "MemberExpression", - "start": 11084, - "end": 11093, + "start": 11170, + "end": 11179, "loc": { "start": { "line": 278, @@ -17711,8 +17983,8 @@ }, "object": { "type": "Identifier", - "start": 11084, - "end": 11085, + "start": 11170, + "end": 11171, "loc": { "start": { "line": 278, @@ -17728,8 +18000,8 @@ }, "property": { "type": "Identifier", - "start": 11086, - "end": 11093, + "start": 11172, + "end": 11179, "loc": { "start": { "line": 278, @@ -17748,8 +18020,8 @@ "operator": "<", "right": { "type": "BinaryExpression", - "start": 11096, - "end": 11131, + "start": 11182, + "end": 11217, "loc": { "start": { "line": 278, @@ -17762,8 +18034,8 @@ }, "left": { "type": "Identifier", - "start": 11096, - "end": 11114, + "start": 11182, + "end": 11200, "loc": { "start": { "line": 278, @@ -17780,8 +18052,8 @@ "operator": "-", "right": { "type": "Identifier", - "start": 11117, - "end": 11131, + "start": 11203, + "end": 11217, "loc": { "start": { "line": 278, @@ -17801,8 +18073,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11151, - "end": 11198, + "start": 11237, + "end": 11284, "loc": { "start": { "line": 279, @@ -17815,8 +18087,8 @@ }, "left": { "type": "MemberExpression", - "start": 11151, - "end": 11160, + "start": 11237, + "end": 11246, "loc": { "start": { "line": 279, @@ -17829,8 +18101,8 @@ }, "object": { "type": "Identifier", - "start": 11151, - "end": 11152, + "start": 11237, + "end": 11238, "loc": { "start": { "line": 279, @@ -17846,8 +18118,8 @@ }, "property": { "type": "Identifier", - "start": 11153, - "end": 11160, + "start": 11239, + "end": 11246, "loc": { "start": { "line": 279, @@ -17866,8 +18138,8 @@ "operator": ">", "right": { "type": "BinaryExpression", - "start": 11163, - "end": 11198, + "start": 11249, + "end": 11284, "loc": { "start": { "line": 279, @@ -17880,8 +18152,8 @@ }, "left": { "type": "Identifier", - "start": 11163, - "end": 11181, + "start": 11249, + "end": 11267, "loc": { "start": { "line": 279, @@ -17898,8 +18170,8 @@ "operator": "+", "right": { "type": "Identifier", - "start": 11184, - "end": 11198, + "start": 11270, + "end": 11284, "loc": { "start": { "line": 279, @@ -17919,8 +18191,8 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 11218, - "end": 11265, + "start": 11304, + "end": 11351, "loc": { "start": { "line": 280, @@ -17933,8 +18205,8 @@ }, "left": { "type": "MemberExpression", - "start": 11218, - "end": 11227, + "start": 11304, + "end": 11313, "loc": { "start": { "line": 280, @@ -17947,8 +18219,8 @@ }, "object": { "type": "Identifier", - "start": 11218, - "end": 11219, + "start": 11304, + "end": 11305, "loc": { "start": { "line": 280, @@ -17964,8 +18236,8 @@ }, "property": { "type": "Identifier", - "start": 11220, - "end": 11227, + "start": 11306, + "end": 11313, "loc": { "start": { "line": 280, @@ -17984,8 +18256,8 @@ "operator": "<", "right": { "type": "BinaryExpression", - "start": 11230, - "end": 11265, + "start": 11316, + "end": 11351, "loc": { "start": { "line": 280, @@ -17998,8 +18270,8 @@ }, "left": { "type": "Identifier", - "start": 11230, - "end": 11248, + "start": 11316, + "end": 11334, "loc": { "start": { "line": 280, @@ -18016,8 +18288,8 @@ "operator": "-", "right": { "type": "Identifier", - "start": 11251, - "end": 11265, + "start": 11337, + "end": 11351, "loc": { "start": { "line": 280, @@ -18036,8 +18308,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11267, - "end": 11306, + "start": 11353, + "end": 11392, "loc": { "start": { "line": 280, @@ -18051,8 +18323,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11285, - "end": 11292, + "start": 11371, + "end": 11378, "loc": { "start": { "line": 281, @@ -18072,8 +18344,8 @@ }, { "type": "IfStatement", - "start": 11319, - "end": 14010, + "start": 11405, + "end": 14096, "loc": { "start": { "line": 283, @@ -18086,8 +18358,8 @@ }, "test": { "type": "MemberExpression", - "start": 11323, - "end": 11355, + "start": 11409, + "end": 11441, "loc": { "start": { "line": 283, @@ -18100,8 +18372,8 @@ }, "object": { "type": "ThisExpression", - "start": 11323, - "end": 11327, + "start": 11409, + "end": 11413, "loc": { "start": { "line": 283, @@ -18115,8 +18387,8 @@ }, "property": { "type": "Identifier", - "start": 11328, - "end": 11355, + "start": 11414, + "end": 11441, "loc": { "start": { "line": 283, @@ -18134,8 +18406,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11357, - "end": 12100, + "start": 11443, + "end": 12186, "loc": { "start": { "line": 283, @@ -18149,8 +18421,8 @@ "body": [ { "type": "IfStatement", - "start": 11375, - "end": 12086, + "start": 11461, + "end": 12172, "loc": { "start": { "line": 284, @@ -18163,8 +18435,8 @@ }, "test": { "type": "Identifier", - "start": 11379, - "end": 11392, + "start": 11465, + "end": 11478, "loc": { "start": { "line": 284, @@ -18180,8 +18452,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11394, - "end": 11781, + "start": 11480, + "end": 11867, "loc": { "start": { "line": 284, @@ -18195,8 +18467,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11416, - "end": 11479, + "start": 11502, + "end": 11565, "loc": { "start": { "line": 285, @@ -18209,8 +18481,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11416, - "end": 11478, + "start": 11502, + "end": 11564, "loc": { "start": { "line": 285, @@ -18224,8 +18496,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11416, - "end": 11462, + "start": 11502, + "end": 11548, "loc": { "start": { "line": 285, @@ -18238,8 +18510,8 @@ }, "object": { "type": "MemberExpression", - "start": 11416, - "end": 11455, + "start": 11502, + "end": 11541, "loc": { "start": { "line": 285, @@ -18252,8 +18524,8 @@ }, "object": { "type": "MemberExpression", - "start": 11416, - "end": 11448, + "start": 11502, + "end": 11534, "loc": { "start": { "line": 285, @@ -18266,8 +18538,8 @@ }, "object": { "type": "ThisExpression", - "start": 11416, - "end": 11420, + "start": 11502, + "end": 11506, "loc": { "start": { "line": 285, @@ -18281,8 +18553,8 @@ }, "property": { "type": "Identifier", - "start": 11421, - "end": 11448, + "start": 11507, + "end": 11534, "loc": { "start": { "line": 285, @@ -18300,8 +18572,8 @@ }, "property": { "type": "Identifier", - "start": 11449, - "end": 11455, + "start": 11535, + "end": 11541, "loc": { "start": { "line": 285, @@ -18319,8 +18591,8 @@ }, "property": { "type": "Identifier", - "start": 11456, - "end": 11462, + "start": 11542, + "end": 11548, "loc": { "start": { "line": 285, @@ -18338,8 +18610,8 @@ }, "right": { "type": "Identifier", - "start": 11465, - "end": 11478, + "start": 11551, + "end": 11564, "loc": { "start": { "line": 285, @@ -18357,8 +18629,8 @@ }, { "type": "ExpressionStatement", - "start": 11500, - "end": 11521, + "start": 11586, + "end": 11607, "loc": { "start": { "line": 286, @@ -18371,8 +18643,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11500, - "end": 11520, + "start": 11586, + "end": 11606, "loc": { "start": { "line": 286, @@ -18386,8 +18658,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 11500, - "end": 11513, + "start": 11586, + "end": 11599, "loc": { "start": { "line": 286, @@ -18403,8 +18675,8 @@ }, "right": { "type": "NullLiteral", - "start": 11516, - "end": 11520, + "start": 11602, + "end": 11606, "loc": { "start": { "line": 286, @@ -18420,8 +18692,8 @@ }, { "type": "ExpressionStatement", - "start": 11542, - "end": 11592, + "start": 11628, + "end": 11678, "loc": { "start": { "line": 287, @@ -18434,8 +18706,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11542, - "end": 11591, + "start": 11628, + "end": 11677, "loc": { "start": { "line": 287, @@ -18449,8 +18721,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11542, - "end": 11584, + "start": 11628, + "end": 11670, "loc": { "start": { "line": 287, @@ -18463,8 +18735,8 @@ }, "object": { "type": "MemberExpression", - "start": 11542, - "end": 11574, + "start": 11628, + "end": 11660, "loc": { "start": { "line": 287, @@ -18477,8 +18749,8 @@ }, "object": { "type": "ThisExpression", - "start": 11542, - "end": 11546, + "start": 11628, + "end": 11632, "loc": { "start": { "line": 287, @@ -18492,8 +18764,8 @@ }, "property": { "type": "Identifier", - "start": 11547, - "end": 11574, + "start": 11633, + "end": 11660, "loc": { "start": { "line": 287, @@ -18511,8 +18783,8 @@ }, "property": { "type": "Identifier", - "start": 11575, - "end": 11584, + "start": 11661, + "end": 11670, "loc": { "start": { "line": 287, @@ -18530,8 +18802,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 11587, - "end": 11591, + "start": 11673, + "end": 11677, "loc": { "start": { "line": 287, @@ -18548,8 +18820,8 @@ }, { "type": "ExpressionStatement", - "start": 11613, - "end": 11702, + "start": 11699, + "end": 11788, "loc": { "start": { "line": 288, @@ -18562,8 +18834,8 @@ }, "expression": { "type": "CallExpression", - "start": 11613, - "end": 11701, + "start": 11699, + "end": 11787, "loc": { "start": { "line": 288, @@ -18576,8 +18848,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11613, - "end": 11649, + "start": 11699, + "end": 11735, "loc": { "start": { "line": 288, @@ -18590,8 +18862,8 @@ }, "object": { "type": "MemberExpression", - "start": 11613, - "end": 11644, + "start": 11699, + "end": 11730, "loc": { "start": { "line": 288, @@ -18604,8 +18876,8 @@ }, "object": { "type": "ThisExpression", - "start": 11613, - "end": 11617, + "start": 11699, + "end": 11703, "loc": { "start": { "line": 288, @@ -18619,8 +18891,8 @@ }, "property": { "type": "Identifier", - "start": 11618, - "end": 11644, + "start": 11704, + "end": 11730, "loc": { "start": { "line": 288, @@ -18638,8 +18910,8 @@ }, "property": { "type": "Identifier", - "start": 11645, - "end": 11649, + "start": 11731, + "end": 11735, "loc": { "start": { "line": 288, @@ -18658,8 +18930,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 11650, - "end": 11666, + "start": 11736, + "end": 11752, "loc": { "start": { "line": 288, @@ -18678,8 +18950,8 @@ }, { "type": "MemberExpression", - "start": 11668, - "end": 11700, + "start": 11754, + "end": 11786, "loc": { "start": { "line": 288, @@ -18692,8 +18964,8 @@ }, "object": { "type": "ThisExpression", - "start": 11668, - "end": 11672, + "start": 11754, + "end": 11758, "loc": { "start": { "line": 288, @@ -18707,8 +18979,8 @@ }, "property": { "type": "Identifier", - "start": 11673, - "end": 11700, + "start": 11759, + "end": 11786, "loc": { "start": { "line": 288, @@ -18729,8 +19001,8 @@ }, { "type": "ExpressionStatement", - "start": 11723, - "end": 11763, + "start": 11809, + "end": 11849, "loc": { "start": { "line": 289, @@ -18743,8 +19015,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11723, - "end": 11762, + "start": 11809, + "end": 11848, "loc": { "start": { "line": 289, @@ -18758,8 +19030,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11723, - "end": 11755, + "start": 11809, + "end": 11841, "loc": { "start": { "line": 289, @@ -18772,8 +19044,8 @@ }, "object": { "type": "ThisExpression", - "start": 11723, - "end": 11727, + "start": 11809, + "end": 11813, "loc": { "start": { "line": 289, @@ -18787,8 +19059,8 @@ }, "property": { "type": "Identifier", - "start": 11728, - "end": 11755, + "start": 11814, + "end": 11841, "loc": { "start": { "line": 289, @@ -18806,8 +19078,8 @@ }, "right": { "type": "NullLiteral", - "start": 11758, - "end": 11762, + "start": 11844, + "end": 11848, "loc": { "start": { "line": 289, @@ -18826,8 +19098,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 11787, - "end": 12086, + "start": 11873, + "end": 12172, "loc": { "start": { "line": 290, @@ -18841,8 +19113,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11809, - "end": 11852, + "start": 11895, + "end": 11938, "loc": { "start": { "line": 291, @@ -18855,8 +19127,8 @@ }, "expression": { "type": "CallExpression", - "start": 11809, - "end": 11851, + "start": 11895, + "end": 11937, "loc": { "start": { "line": 291, @@ -18869,8 +19141,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11809, - "end": 11849, + "start": 11895, + "end": 11935, "loc": { "start": { "line": 291, @@ -18883,8 +19155,8 @@ }, "object": { "type": "MemberExpression", - "start": 11809, - "end": 11841, + "start": 11895, + "end": 11927, "loc": { "start": { "line": 291, @@ -18897,8 +19169,8 @@ }, "object": { "type": "ThisExpression", - "start": 11809, - "end": 11813, + "start": 11895, + "end": 11899, "loc": { "start": { "line": 291, @@ -18912,8 +19184,8 @@ }, "property": { "type": "Identifier", - "start": 11814, - "end": 11841, + "start": 11900, + "end": 11927, "loc": { "start": { "line": 291, @@ -18931,8 +19203,8 @@ }, "property": { "type": "Identifier", - "start": 11842, - "end": 11849, + "start": 11928, + "end": 11935, "loc": { "start": { "line": 291, @@ -18953,8 +19225,8 @@ }, { "type": "ExpressionStatement", - "start": 11873, - "end": 11965, + "start": 11959, + "end": 12051, "loc": { "start": { "line": 292, @@ -18967,8 +19239,8 @@ }, "expression": { "type": "CallExpression", - "start": 11873, - "end": 11964, + "start": 11959, + "end": 12050, "loc": { "start": { "line": 292, @@ -18981,8 +19253,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11873, - "end": 11909, + "start": 11959, + "end": 11995, "loc": { "start": { "line": 292, @@ -18995,8 +19267,8 @@ }, "object": { "type": "MemberExpression", - "start": 11873, - "end": 11904, + "start": 11959, + "end": 11990, "loc": { "start": { "line": 292, @@ -19009,8 +19281,8 @@ }, "object": { "type": "ThisExpression", - "start": 11873, - "end": 11877, + "start": 11959, + "end": 11963, "loc": { "start": { "line": 292, @@ -19024,8 +19296,8 @@ }, "property": { "type": "Identifier", - "start": 11878, - "end": 11904, + "start": 11964, + "end": 11990, "loc": { "start": { "line": 292, @@ -19043,8 +19315,8 @@ }, "property": { "type": "Identifier", - "start": 11905, - "end": 11909, + "start": 11991, + "end": 11995, "loc": { "start": { "line": 292, @@ -19063,8 +19335,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 11910, - "end": 11929, + "start": 11996, + "end": 12015, "loc": { "start": { "line": 292, @@ -19083,8 +19355,8 @@ }, { "type": "MemberExpression", - "start": 11931, - "end": 11963, + "start": 12017, + "end": 12049, "loc": { "start": { "line": 292, @@ -19097,8 +19369,8 @@ }, "object": { "type": "ThisExpression", - "start": 11931, - "end": 11935, + "start": 12017, + "end": 12021, "loc": { "start": { "line": 292, @@ -19112,8 +19384,8 @@ }, "property": { "type": "Identifier", - "start": 11936, - "end": 11963, + "start": 12022, + "end": 12049, "loc": { "start": { "line": 292, @@ -19134,8 +19406,8 @@ }, { "type": "ExpressionStatement", - "start": 11986, - "end": 12026, + "start": 12072, + "end": 12112, "loc": { "start": { "line": 293, @@ -19148,8 +19420,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11986, - "end": 12025, + "start": 12072, + "end": 12111, "loc": { "start": { "line": 293, @@ -19163,8 +19435,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11986, - "end": 12018, + "start": 12072, + "end": 12104, "loc": { "start": { "line": 293, @@ -19177,8 +19449,8 @@ }, "object": { "type": "ThisExpression", - "start": 11986, - "end": 11990, + "start": 12072, + "end": 12076, "loc": { "start": { "line": 293, @@ -19192,8 +19464,8 @@ }, "property": { "type": "Identifier", - "start": 11991, - "end": 12018, + "start": 12077, + "end": 12104, "loc": { "start": { "line": 293, @@ -19211,8 +19483,8 @@ }, "right": { "type": "NullLiteral", - "start": 12021, - "end": 12025, + "start": 12107, + "end": 12111, "loc": { "start": { "line": 293, @@ -19228,8 +19500,8 @@ }, { "type": "ExpressionStatement", - "start": 12047, - "end": 12068, + "start": 12133, + "end": 12154, "loc": { "start": { "line": 294, @@ -19242,8 +19514,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12047, - "end": 12067, + "start": 12133, + "end": 12153, "loc": { "start": { "line": 294, @@ -19257,8 +19529,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 12047, - "end": 12060, + "start": 12133, + "end": 12146, "loc": { "start": { "line": 294, @@ -19274,8 +19546,8 @@ }, "right": { "type": "NullLiteral", - "start": 12063, - "end": 12067, + "start": 12149, + "end": 12153, "loc": { "start": { "line": 294, @@ -19298,8 +19570,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 12106, - "end": 14010, + "start": 12192, + "end": 14096, "loc": { "start": { "line": 296, @@ -19313,8 +19585,8 @@ "body": [ { "type": "IfStatement", - "start": 12124, - "end": 13996, + "start": 12210, + "end": 14082, "loc": { "start": { "line": 297, @@ -19327,8 +19599,8 @@ }, "test": { "type": "Identifier", - "start": 12128, - "end": 12141, + "start": 12214, + "end": 12227, "loc": { "start": { "line": 297, @@ -19344,8 +19616,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 12143, - "end": 13996, + "start": 12229, + "end": 14082, "loc": { "start": { "line": 297, @@ -19359,8 +19631,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 12165, - "end": 12707, + "start": 12251, + "end": 12793, "loc": { "start": { "line": 298, @@ -19373,8 +19645,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12165, - "end": 12706, + "start": 12251, + "end": 12792, "loc": { "start": { "line": 298, @@ -19388,8 +19660,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12165, - "end": 12197, + "start": 12251, + "end": 12283, "loc": { "start": { "line": 298, @@ -19402,8 +19674,8 @@ }, "object": { "type": "ThisExpression", - "start": 12165, - "end": 12169, + "start": 12251, + "end": 12255, "loc": { "start": { "line": 298, @@ -19417,8 +19689,8 @@ }, "property": { "type": "Identifier", - "start": 12170, - "end": 12197, + "start": 12256, + "end": 12283, "loc": { "start": { "line": 298, @@ -19436,8 +19708,8 @@ }, "right": { "type": "CallExpression", - "start": 12200, - "end": 12706, + "start": 12286, + "end": 12792, "loc": { "start": { "line": 298, @@ -19450,8 +19722,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12200, - "end": 12244, + "start": 12286, + "end": 12330, "loc": { "start": { "line": 298, @@ -19464,8 +19736,8 @@ }, "object": { "type": "Identifier", - "start": 12200, - "end": 12226, + "start": 12286, + "end": 12312, "loc": { "start": { "line": 298, @@ -19481,8 +19753,8 @@ }, "property": { "type": "Identifier", - "start": 12227, - "end": 12244, + "start": 12313, + "end": 12330, "loc": { "start": { "line": 298, @@ -19501,8 +19773,8 @@ "arguments": [ { "type": "ObjectExpression", - "start": 12245, - "end": 12705, + "start": 12331, + "end": 12791, "loc": { "start": { "line": 298, @@ -19516,8 +19788,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 12271, - "end": 12292, + "start": 12357, + "end": 12378, "loc": { "start": { "line": 299, @@ -19533,8 +19805,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12271, - "end": 12273, + "start": 12357, + "end": 12359, "loc": { "start": { "line": 299, @@ -19550,8 +19822,8 @@ }, "value": { "type": "CallExpression", - "start": 12275, - "end": 12292, + "start": 12361, + "end": 12378, "loc": { "start": { "line": 299, @@ -19564,8 +19836,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12275, - "end": 12290, + "start": 12361, + "end": 12376, "loc": { "start": { "line": 299, @@ -19578,8 +19850,8 @@ }, "object": { "type": "Identifier", - "start": 12275, - "end": 12279, + "start": 12361, + "end": 12365, "loc": { "start": { "line": 299, @@ -19595,8 +19867,8 @@ }, "property": { "type": "Identifier", - "start": 12280, - "end": 12290, + "start": 12366, + "end": 12376, "loc": { "start": { "line": 299, @@ -19617,8 +19889,8 @@ }, { "type": "ObjectProperty", - "start": 12318, - "end": 12466, + "start": 12404, + "end": 12552, "loc": { "start": { "line": 300, @@ -19634,8 +19906,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12318, - "end": 12324, + "start": 12404, + "end": 12410, "loc": { "start": { "line": 300, @@ -19651,8 +19923,8 @@ }, "value": { "type": "ObjectExpression", - "start": 12326, - "end": 12466, + "start": 12412, + "end": 12552, "loc": { "start": { "line": 300, @@ -19666,8 +19938,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 12356, - "end": 12389, + "start": 12442, + "end": 12475, "loc": { "start": { "line": 301, @@ -19683,8 +19955,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12356, - "end": 12364, + "start": 12442, + "end": 12450, "loc": { "start": { "line": 301, @@ -19700,8 +19972,8 @@ }, "value": { "type": "CallExpression", - "start": 12366, - "end": 12389, + "start": 12452, + "end": 12475, "loc": { "start": { "line": 301, @@ -19714,8 +19986,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12366, - "end": 12387, + "start": 12452, + "end": 12473, "loc": { "start": { "line": 301, @@ -19728,8 +20000,8 @@ }, "object": { "type": "Identifier", - "start": 12366, - "end": 12381, + "start": 12452, + "end": 12467, "loc": { "start": { "line": 301, @@ -19745,8 +20017,8 @@ }, "property": { "type": "Identifier", - "start": 12382, - "end": 12387, + "start": 12468, + "end": 12473, "loc": { "start": { "line": 301, @@ -19767,8 +20039,8 @@ }, { "type": "ObjectProperty", - "start": 12419, - "end": 12440, + "start": 12505, + "end": 12526, "loc": { "start": { "line": 302, @@ -19784,8 +20056,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12419, - "end": 12425, + "start": 12505, + "end": 12511, "loc": { "start": { "line": 302, @@ -19801,8 +20073,8 @@ }, "value": { "type": "Identifier", - "start": 12427, - "end": 12440, + "start": 12513, + "end": 12526, "loc": { "start": { "line": 302, @@ -19822,8 +20094,8 @@ }, { "type": "ObjectProperty", - "start": 12492, - "end": 12640, + "start": 12578, + "end": 12726, "loc": { "start": { "line": 304, @@ -19839,8 +20111,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12492, - "end": 12498, + "start": 12578, + "end": 12584, "loc": { "start": { "line": 304, @@ -19856,8 +20128,8 @@ }, "value": { "type": "ObjectExpression", - "start": 12500, - "end": 12640, + "start": 12586, + "end": 12726, "loc": { "start": { "line": 304, @@ -19871,8 +20143,8 @@ "properties": [ { "type": "ObjectProperty", - "start": 12530, - "end": 12563, + "start": 12616, + "end": 12649, "loc": { "start": { "line": 305, @@ -19888,8 +20160,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12530, - "end": 12538, + "start": 12616, + "end": 12624, "loc": { "start": { "line": 305, @@ -19905,8 +20177,8 @@ }, "value": { "type": "CallExpression", - "start": 12540, - "end": 12563, + "start": 12626, + "end": 12649, "loc": { "start": { "line": 305, @@ -19919,8 +20191,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12540, - "end": 12561, + "start": 12626, + "end": 12647, "loc": { "start": { "line": 305, @@ -19933,8 +20205,8 @@ }, "object": { "type": "Identifier", - "start": 12540, - "end": 12555, + "start": 12626, + "end": 12641, "loc": { "start": { "line": 305, @@ -19950,8 +20222,8 @@ }, "property": { "type": "Identifier", - "start": 12556, - "end": 12561, + "start": 12642, + "end": 12647, "loc": { "start": { "line": 305, @@ -19972,8 +20244,8 @@ }, { "type": "ObjectProperty", - "start": 12593, - "end": 12614, + "start": 12679, + "end": 12700, "loc": { "start": { "line": 306, @@ -19989,8 +20261,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12593, - "end": 12599, + "start": 12679, + "end": 12685, "loc": { "start": { "line": 306, @@ -20006,8 +20278,8 @@ }, "value": { "type": "Identifier", - "start": 12601, - "end": 12614, + "start": 12687, + "end": 12700, "loc": { "start": { "line": 306, @@ -20027,8 +20299,8 @@ }, { "type": "ObjectProperty", - "start": 12666, - "end": 12683, + "start": 12752, + "end": 12769, "loc": { "start": { "line": 308, @@ -20044,8 +20316,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12666, - "end": 12677, + "start": 12752, + "end": 12763, "loc": { "start": { "line": 308, @@ -20061,8 +20333,8 @@ }, "value": { "type": "BooleanLiteral", - "start": 12679, - "end": 12683, + "start": 12765, + "end": 12769, "loc": { "start": { "line": 308, @@ -20084,8 +20356,8 @@ }, { "type": "ExpressionStatement", - "start": 12728, - "end": 12883, + "start": 12814, + "end": 12969, "loc": { "start": { "line": 310, @@ -20098,8 +20370,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12728, - "end": 12882, + "start": 12814, + "end": 12968, "loc": { "start": { "line": 310, @@ -20113,8 +20385,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12728, - "end": 12781, + "start": 12814, + "end": 12867, "loc": { "start": { "line": 310, @@ -20127,8 +20399,8 @@ }, "object": { "type": "MemberExpression", - "start": 12728, - "end": 12769, + "start": 12814, + "end": 12855, "loc": { "start": { "line": 310, @@ -20141,8 +20413,8 @@ }, "object": { "type": "ThisExpression", - "start": 12728, - "end": 12732, + "start": 12814, + "end": 12818, "loc": { "start": { "line": 310, @@ -20156,8 +20428,8 @@ }, "property": { "type": "Identifier", - "start": 12733, - "end": 12769, + "start": 12819, + "end": 12855, "loc": { "start": { "line": 310, @@ -20175,8 +20447,8 @@ }, "property": { "type": "Identifier", - "start": 12770, - "end": 12781, + "start": 12856, + "end": 12867, "loc": { "start": { "line": 310, @@ -20194,8 +20466,8 @@ }, "right": { "type": "LogicalExpression", - "start": 12784, - "end": 12882, + "start": 12870, + "end": 12968, "loc": { "start": { "line": 310, @@ -20208,8 +20480,8 @@ }, "left": { "type": "MemberExpression", - "start": 12784, - "end": 12828, + "start": 12870, + "end": 12914, "loc": { "start": { "line": 310, @@ -20222,8 +20494,8 @@ }, "object": { "type": "MemberExpression", - "start": 12784, - "end": 12816, + "start": 12870, + "end": 12902, "loc": { "start": { "line": 310, @@ -20236,8 +20508,8 @@ }, "object": { "type": "ThisExpression", - "start": 12784, - "end": 12788, + "start": 12870, + "end": 12874, "loc": { "start": { "line": 310, @@ -20251,8 +20523,8 @@ }, "property": { "type": "Identifier", - "start": 12789, - "end": 12816, + "start": 12875, + "end": 12902, "loc": { "start": { "line": 310, @@ -20270,8 +20542,8 @@ }, "property": { "type": "Identifier", - "start": 12817, - "end": 12828, + "start": 12903, + "end": 12914, "loc": { "start": { "line": 310, @@ -20290,8 +20562,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 12832, - "end": 12882, + "start": 12918, + "end": 12968, "loc": { "start": { "line": 310, @@ -20304,8 +20576,8 @@ }, "object": { "type": "MemberExpression", - "start": 12832, - "end": 12863, + "start": 12918, + "end": 12949, "loc": { "start": { "line": 310, @@ -20318,8 +20590,8 @@ }, "object": { "type": "ThisExpression", - "start": 12832, - "end": 12836, + "start": 12918, + "end": 12922, "loc": { "start": { "line": 310, @@ -20333,8 +20605,8 @@ }, "property": { "type": "Identifier", - "start": 12837, - "end": 12863, + "start": 12923, + "end": 12949, "loc": { "start": { "line": 310, @@ -20352,8 +20624,8 @@ }, "property": { "type": "Identifier", - "start": 12864, - "end": 12882, + "start": 12950, + "end": 12968, "loc": { "start": { "line": 310, @@ -20374,8 +20646,8 @@ }, { "type": "ExpressionStatement", - "start": 12904, - "end": 13062, + "start": 12990, + "end": 13148, "loc": { "start": { "line": 311, @@ -20388,8 +20660,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 12904, - "end": 13061, + "start": 12990, + "end": 13147, "loc": { "start": { "line": 311, @@ -20403,8 +20675,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 12904, - "end": 12958, + "start": 12990, + "end": 13044, "loc": { "start": { "line": 311, @@ -20417,8 +20689,8 @@ }, "object": { "type": "MemberExpression", - "start": 12904, - "end": 12945, + "start": 12990, + "end": 13031, "loc": { "start": { "line": 311, @@ -20431,8 +20703,8 @@ }, "object": { "type": "ThisExpression", - "start": 12904, - "end": 12908, + "start": 12990, + "end": 12994, "loc": { "start": { "line": 311, @@ -20446,8 +20718,8 @@ }, "property": { "type": "Identifier", - "start": 12909, - "end": 12945, + "start": 12995, + "end": 13031, "loc": { "start": { "line": 311, @@ -20465,8 +20737,8 @@ }, "property": { "type": "Identifier", - "start": 12946, - "end": 12958, + "start": 13032, + "end": 13044, "loc": { "start": { "line": 311, @@ -20484,8 +20756,8 @@ }, "right": { "type": "LogicalExpression", - "start": 12961, - "end": 13061, + "start": 13047, + "end": 13147, "loc": { "start": { "line": 311, @@ -20498,8 +20770,8 @@ }, "left": { "type": "MemberExpression", - "start": 12961, - "end": 13006, + "start": 13047, + "end": 13092, "loc": { "start": { "line": 311, @@ -20512,8 +20784,8 @@ }, "object": { "type": "MemberExpression", - "start": 12961, - "end": 12993, + "start": 13047, + "end": 13079, "loc": { "start": { "line": 311, @@ -20526,8 +20798,8 @@ }, "object": { "type": "ThisExpression", - "start": 12961, - "end": 12965, + "start": 13047, + "end": 13051, "loc": { "start": { "line": 311, @@ -20541,8 +20813,8 @@ }, "property": { "type": "Identifier", - "start": 12966, - "end": 12993, + "start": 13052, + "end": 13079, "loc": { "start": { "line": 311, @@ -20560,8 +20832,8 @@ }, "property": { "type": "Identifier", - "start": 12994, - "end": 13006, + "start": 13080, + "end": 13092, "loc": { "start": { "line": 311, @@ -20580,8 +20852,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 13010, - "end": 13061, + "start": 13096, + "end": 13147, "loc": { "start": { "line": 311, @@ -20594,8 +20866,8 @@ }, "object": { "type": "MemberExpression", - "start": 13010, - "end": 13041, + "start": 13096, + "end": 13127, "loc": { "start": { "line": 311, @@ -20608,8 +20880,8 @@ }, "object": { "type": "ThisExpression", - "start": 13010, - "end": 13014, + "start": 13096, + "end": 13100, "loc": { "start": { "line": 311, @@ -20623,8 +20895,8 @@ }, "property": { "type": "Identifier", - "start": 13015, - "end": 13041, + "start": 13101, + "end": 13127, "loc": { "start": { "line": 311, @@ -20642,8 +20914,8 @@ }, "property": { "type": "Identifier", - "start": 13042, - "end": 13061, + "start": 13128, + "end": 13147, "loc": { "start": { "line": 311, @@ -20664,8 +20936,8 @@ }, { "type": "ExpressionStatement", - "start": 13083, - "end": 13241, + "start": 13169, + "end": 13327, "loc": { "start": { "line": 312, @@ -20678,8 +20950,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13083, - "end": 13240, + "start": 13169, + "end": 13326, "loc": { "start": { "line": 312, @@ -20693,8 +20965,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13083, - "end": 13137, + "start": 13169, + "end": 13223, "loc": { "start": { "line": 312, @@ -20707,8 +20979,8 @@ }, "object": { "type": "MemberExpression", - "start": 13083, - "end": 13124, + "start": 13169, + "end": 13210, "loc": { "start": { "line": 312, @@ -20721,8 +20993,8 @@ }, "object": { "type": "ThisExpression", - "start": 13083, - "end": 13087, + "start": 13169, + "end": 13173, "loc": { "start": { "line": 312, @@ -20736,8 +21008,8 @@ }, "property": { "type": "Identifier", - "start": 13088, - "end": 13124, + "start": 13174, + "end": 13210, "loc": { "start": { "line": 312, @@ -20755,8 +21027,8 @@ }, "property": { "type": "Identifier", - "start": 13125, - "end": 13137, + "start": 13211, + "end": 13223, "loc": { "start": { "line": 312, @@ -20774,8 +21046,8 @@ }, "right": { "type": "LogicalExpression", - "start": 13140, - "end": 13240, + "start": 13226, + "end": 13326, "loc": { "start": { "line": 312, @@ -20788,8 +21060,8 @@ }, "left": { "type": "MemberExpression", - "start": 13140, - "end": 13185, + "start": 13226, + "end": 13271, "loc": { "start": { "line": 312, @@ -20802,8 +21074,8 @@ }, "object": { "type": "MemberExpression", - "start": 13140, - "end": 13172, + "start": 13226, + "end": 13258, "loc": { "start": { "line": 312, @@ -20816,8 +21088,8 @@ }, "object": { "type": "ThisExpression", - "start": 13140, - "end": 13144, + "start": 13226, + "end": 13230, "loc": { "start": { "line": 312, @@ -20831,8 +21103,8 @@ }, "property": { "type": "Identifier", - "start": 13145, - "end": 13172, + "start": 13231, + "end": 13258, "loc": { "start": { "line": 312, @@ -20850,8 +21122,8 @@ }, "property": { "type": "Identifier", - "start": 13173, - "end": 13185, + "start": 13259, + "end": 13271, "loc": { "start": { "line": 312, @@ -20870,8 +21142,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 13189, - "end": 13240, + "start": 13275, + "end": 13326, "loc": { "start": { "line": 312, @@ -20884,8 +21156,8 @@ }, "object": { "type": "MemberExpression", - "start": 13189, - "end": 13220, + "start": 13275, + "end": 13306, "loc": { "start": { "line": 312, @@ -20898,8 +21170,8 @@ }, "object": { "type": "ThisExpression", - "start": 13189, - "end": 13193, + "start": 13275, + "end": 13279, "loc": { "start": { "line": 312, @@ -20913,8 +21185,8 @@ }, "property": { "type": "Identifier", - "start": 13194, - "end": 13220, + "start": 13280, + "end": 13306, "loc": { "start": { "line": 312, @@ -20932,8 +21204,8 @@ }, "property": { "type": "Identifier", - "start": 13221, - "end": 13240, + "start": 13307, + "end": 13326, "loc": { "start": { "line": 312, @@ -20954,8 +21226,8 @@ }, { "type": "ExpressionStatement", - "start": 13262, - "end": 13420, + "start": 13348, + "end": 13506, "loc": { "start": { "line": 313, @@ -20968,8 +21240,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13262, - "end": 13419, + "start": 13348, + "end": 13505, "loc": { "start": { "line": 313, @@ -20983,8 +21255,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13262, - "end": 13316, + "start": 13348, + "end": 13402, "loc": { "start": { "line": 313, @@ -20997,8 +21269,8 @@ }, "object": { "type": "MemberExpression", - "start": 13262, - "end": 13303, + "start": 13348, + "end": 13389, "loc": { "start": { "line": 313, @@ -21011,8 +21283,8 @@ }, "object": { "type": "ThisExpression", - "start": 13262, - "end": 13266, + "start": 13348, + "end": 13352, "loc": { "start": { "line": 313, @@ -21026,8 +21298,8 @@ }, "property": { "type": "Identifier", - "start": 13267, - "end": 13303, + "start": 13353, + "end": 13389, "loc": { "start": { "line": 313, @@ -21045,8 +21317,8 @@ }, "property": { "type": "Identifier", - "start": 13304, - "end": 13316, + "start": 13390, + "end": 13402, "loc": { "start": { "line": 313, @@ -21064,8 +21336,8 @@ }, "right": { "type": "LogicalExpression", - "start": 13319, - "end": 13419, + "start": 13405, + "end": 13505, "loc": { "start": { "line": 313, @@ -21078,8 +21350,8 @@ }, "left": { "type": "MemberExpression", - "start": 13319, - "end": 13364, + "start": 13405, + "end": 13450, "loc": { "start": { "line": 313, @@ -21092,8 +21364,8 @@ }, "object": { "type": "MemberExpression", - "start": 13319, - "end": 13351, + "start": 13405, + "end": 13437, "loc": { "start": { "line": 313, @@ -21106,8 +21378,8 @@ }, "object": { "type": "ThisExpression", - "start": 13319, - "end": 13323, + "start": 13405, + "end": 13409, "loc": { "start": { "line": 313, @@ -21121,8 +21393,8 @@ }, "property": { "type": "Identifier", - "start": 13324, - "end": 13351, + "start": 13410, + "end": 13437, "loc": { "start": { "line": 313, @@ -21140,8 +21412,8 @@ }, "property": { "type": "Identifier", - "start": 13352, - "end": 13364, + "start": 13438, + "end": 13450, "loc": { "start": { "line": 313, @@ -21160,8 +21432,8 @@ "operator": "&&", "right": { "type": "MemberExpression", - "start": 13368, - "end": 13419, + "start": 13454, + "end": 13505, "loc": { "start": { "line": 313, @@ -21174,8 +21446,8 @@ }, "object": { "type": "MemberExpression", - "start": 13368, - "end": 13399, + "start": 13454, + "end": 13485, "loc": { "start": { "line": 313, @@ -21188,8 +21460,8 @@ }, "object": { "type": "ThisExpression", - "start": 13368, - "end": 13372, + "start": 13454, + "end": 13458, "loc": { "start": { "line": 313, @@ -21203,8 +21475,8 @@ }, "property": { "type": "Identifier", - "start": 13373, - "end": 13399, + "start": 13459, + "end": 13485, "loc": { "start": { "line": 313, @@ -21222,8 +21494,8 @@ }, "property": { "type": "Identifier", - "start": 13400, - "end": 13419, + "start": 13486, + "end": 13505, "loc": { "start": { "line": 313, @@ -21244,8 +21516,8 @@ }, { "type": "ExpressionStatement", - "start": 13441, - "end": 13542, + "start": 13527, + "end": 13628, "loc": { "start": { "line": 314, @@ -21258,8 +21530,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13441, - "end": 13541, + "start": 13527, + "end": 13627, "loc": { "start": { "line": 314, @@ -21273,8 +21545,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13441, - "end": 13494, + "start": 13527, + "end": 13580, "loc": { "start": { "line": 314, @@ -21287,8 +21559,8 @@ }, "object": { "type": "MemberExpression", - "start": 13441, - "end": 13482, + "start": 13527, + "end": 13568, "loc": { "start": { "line": 314, @@ -21301,8 +21573,8 @@ }, "object": { "type": "ThisExpression", - "start": 13441, - "end": 13445, + "start": 13527, + "end": 13531, "loc": { "start": { "line": 314, @@ -21316,8 +21588,8 @@ }, "property": { "type": "Identifier", - "start": 13446, - "end": 13482, + "start": 13532, + "end": 13568, "loc": { "start": { "line": 314, @@ -21335,8 +21607,8 @@ }, "property": { "type": "Identifier", - "start": 13483, - "end": 13494, + "start": 13569, + "end": 13580, "loc": { "start": { "line": 314, @@ -21354,8 +21626,8 @@ }, "right": { "type": "MemberExpression", - "start": 13497, - "end": 13541, + "start": 13583, + "end": 13627, "loc": { "start": { "line": 314, @@ -21368,8 +21640,8 @@ }, "object": { "type": "MemberExpression", - "start": 13497, - "end": 13529, + "start": 13583, + "end": 13615, "loc": { "start": { "line": 314, @@ -21382,8 +21654,8 @@ }, "object": { "type": "ThisExpression", - "start": 13497, - "end": 13501, + "start": 13583, + "end": 13587, "loc": { "start": { "line": 314, @@ -21397,8 +21669,8 @@ }, "property": { "type": "Identifier", - "start": 13502, - "end": 13529, + "start": 13588, + "end": 13615, "loc": { "start": { "line": 314, @@ -21416,8 +21688,8 @@ }, "property": { "type": "Identifier", - "start": 13530, - "end": 13541, + "start": 13616, + "end": 13627, "loc": { "start": { "line": 314, @@ -21437,8 +21709,8 @@ }, { "type": "ExpressionStatement", - "start": 13563, - "end": 13668, + "start": 13649, + "end": 13754, "loc": { "start": { "line": 315, @@ -21451,8 +21723,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13563, - "end": 13667, + "start": 13649, + "end": 13753, "loc": { "start": { "line": 315, @@ -21466,8 +21738,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13563, - "end": 13618, + "start": 13649, + "end": 13704, "loc": { "start": { "line": 315, @@ -21480,8 +21752,8 @@ }, "object": { "type": "MemberExpression", - "start": 13563, - "end": 13604, + "start": 13649, + "end": 13690, "loc": { "start": { "line": 315, @@ -21494,8 +21766,8 @@ }, "object": { "type": "ThisExpression", - "start": 13563, - "end": 13567, + "start": 13649, + "end": 13653, "loc": { "start": { "line": 315, @@ -21509,8 +21781,8 @@ }, "property": { "type": "Identifier", - "start": 13568, - "end": 13604, + "start": 13654, + "end": 13690, "loc": { "start": { "line": 315, @@ -21528,8 +21800,8 @@ }, "property": { "type": "Identifier", - "start": 13605, - "end": 13618, + "start": 13691, + "end": 13704, "loc": { "start": { "line": 315, @@ -21547,8 +21819,8 @@ }, "right": { "type": "MemberExpression", - "start": 13621, - "end": 13667, + "start": 13707, + "end": 13753, "loc": { "start": { "line": 315, @@ -21561,8 +21833,8 @@ }, "object": { "type": "MemberExpression", - "start": 13621, - "end": 13653, + "start": 13707, + "end": 13739, "loc": { "start": { "line": 315, @@ -21575,8 +21847,8 @@ }, "object": { "type": "ThisExpression", - "start": 13621, - "end": 13625, + "start": 13707, + "end": 13711, "loc": { "start": { "line": 315, @@ -21590,8 +21862,8 @@ }, "property": { "type": "Identifier", - "start": 13626, - "end": 13653, + "start": 13712, + "end": 13739, "loc": { "start": { "line": 315, @@ -21609,8 +21881,8 @@ }, "property": { "type": "Identifier", - "start": 13654, - "end": 13667, + "start": 13740, + "end": 13753, "loc": { "start": { "line": 315, @@ -21630,8 +21902,8 @@ }, { "type": "ExpressionStatement", - "start": 13689, - "end": 13740, + "start": 13775, + "end": 13826, "loc": { "start": { "line": 316, @@ -21644,8 +21916,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13689, - "end": 13739, + "start": 13775, + "end": 13825, "loc": { "start": { "line": 316, @@ -21659,8 +21931,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13689, - "end": 13731, + "start": 13775, + "end": 13817, "loc": { "start": { "line": 316, @@ -21673,8 +21945,8 @@ }, "object": { "type": "MemberExpression", - "start": 13689, - "end": 13721, + "start": 13775, + "end": 13807, "loc": { "start": { "line": 316, @@ -21687,8 +21959,8 @@ }, "object": { "type": "ThisExpression", - "start": 13689, - "end": 13693, + "start": 13775, + "end": 13779, "loc": { "start": { "line": 316, @@ -21702,8 +21974,8 @@ }, "property": { "type": "Identifier", - "start": 13694, - "end": 13721, + "start": 13780, + "end": 13807, "loc": { "start": { "line": 316, @@ -21721,8 +21993,8 @@ }, "property": { "type": "Identifier", - "start": 13722, - "end": 13731, + "start": 13808, + "end": 13817, "loc": { "start": { "line": 316, @@ -21740,8 +22012,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 13734, - "end": 13739, + "start": 13820, + "end": 13825, "loc": { "start": { "line": 316, @@ -21758,8 +22030,8 @@ }, { "type": "ExpressionStatement", - "start": 13761, - "end": 13824, + "start": 13847, + "end": 13910, "loc": { "start": { "line": 317, @@ -21772,8 +22044,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13761, - "end": 13823, + "start": 13847, + "end": 13909, "loc": { "start": { "line": 317, @@ -21787,8 +22059,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 13761, - "end": 13807, + "start": 13847, + "end": 13893, "loc": { "start": { "line": 317, @@ -21801,8 +22073,8 @@ }, "object": { "type": "MemberExpression", - "start": 13761, - "end": 13800, + "start": 13847, + "end": 13886, "loc": { "start": { "line": 317, @@ -21815,8 +22087,8 @@ }, "object": { "type": "MemberExpression", - "start": 13761, - "end": 13793, + "start": 13847, + "end": 13879, "loc": { "start": { "line": 317, @@ -21829,8 +22101,8 @@ }, "object": { "type": "ThisExpression", - "start": 13761, - "end": 13765, + "start": 13847, + "end": 13851, "loc": { "start": { "line": 317, @@ -21844,8 +22116,8 @@ }, "property": { "type": "Identifier", - "start": 13766, - "end": 13793, + "start": 13852, + "end": 13879, "loc": { "start": { "line": 317, @@ -21863,8 +22135,8 @@ }, "property": { "type": "Identifier", - "start": 13794, - "end": 13800, + "start": 13880, + "end": 13886, "loc": { "start": { "line": 317, @@ -21882,8 +22154,8 @@ }, "property": { "type": "Identifier", - "start": 13801, - "end": 13807, + "start": 13887, + "end": 13893, "loc": { "start": { "line": 317, @@ -21901,8 +22173,8 @@ }, "right": { "type": "Identifier", - "start": 13810, - "end": 13823, + "start": 13896, + "end": 13909, "loc": { "start": { "line": 317, @@ -21920,8 +22192,8 @@ }, { "type": "ExpressionStatement", - "start": 13845, - "end": 13866, + "start": 13931, + "end": 13952, "loc": { "start": { "line": 318, @@ -21934,8 +22206,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 13845, - "end": 13865, + "start": 13931, + "end": 13951, "loc": { "start": { "line": 318, @@ -21949,8 +22221,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 13845, - "end": 13858, + "start": 13931, + "end": 13944, "loc": { "start": { "line": 318, @@ -21966,8 +22238,8 @@ }, "right": { "type": "NullLiteral", - "start": 13861, - "end": 13865, + "start": 13947, + "end": 13951, "loc": { "start": { "line": 318, @@ -21983,8 +22255,8 @@ }, { "type": "ExpressionStatement", - "start": 13887, - "end": 13978, + "start": 13973, + "end": 14064, "loc": { "start": { "line": 319, @@ -21997,8 +22269,8 @@ }, "expression": { "type": "CallExpression", - "start": 13887, - "end": 13977, + "start": 13973, + "end": 14063, "loc": { "start": { "line": 319, @@ -22011,8 +22283,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13887, - "end": 13923, + "start": 13973, + "end": 14009, "loc": { "start": { "line": 319, @@ -22025,8 +22297,8 @@ }, "object": { "type": "MemberExpression", - "start": 13887, - "end": 13918, + "start": 13973, + "end": 14004, "loc": { "start": { "line": 319, @@ -22039,8 +22311,8 @@ }, "object": { "type": "ThisExpression", - "start": 13887, - "end": 13891, + "start": 13973, + "end": 13977, "loc": { "start": { "line": 319, @@ -22054,8 +22326,8 @@ }, "property": { "type": "Identifier", - "start": 13892, - "end": 13918, + "start": 13978, + "end": 14004, "loc": { "start": { "line": 319, @@ -22073,8 +22345,8 @@ }, "property": { "type": "Identifier", - "start": 13919, - "end": 13923, + "start": 14005, + "end": 14009, "loc": { "start": { "line": 319, @@ -22093,8 +22365,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 13924, - "end": 13942, + "start": 14010, + "end": 14028, "loc": { "start": { "line": 319, @@ -22113,8 +22385,8 @@ }, { "type": "MemberExpression", - "start": 13944, - "end": 13976, + "start": 14030, + "end": 14062, "loc": { "start": { "line": 319, @@ -22127,8 +22399,8 @@ }, "object": { "type": "ThisExpression", - "start": 13944, - "end": 13948, + "start": 14030, + "end": 14034, "loc": { "start": { "line": 319, @@ -22142,8 +22414,8 @@ }, "property": { "type": "Identifier", - "start": 13949, - "end": 13976, + "start": 14035, + "end": 14062, "loc": { "start": { "line": 319, @@ -22181,8 +22453,8 @@ }, { "type": "ExpressionStatement", - "start": 14032, - "end": 14991, + "start": 14118, + "end": 15077, "loc": { "start": { "line": 324, @@ -22195,8 +22467,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14032, - "end": 14990, + "start": 14118, + "end": 15076, "loc": { "start": { "line": 324, @@ -22210,8 +22482,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14032, - "end": 14074, + "start": 14118, + "end": 14160, "loc": { "start": { "line": 324, @@ -22224,8 +22496,8 @@ }, "object": { "type": "ThisExpression", - "start": 14032, - "end": 14036, + "start": 14118, + "end": 14122, "loc": { "start": { "line": 324, @@ -22239,8 +22511,8 @@ }, "property": { "type": "Identifier", - "start": 14037, - "end": 14074, + "start": 14123, + "end": 14160, "loc": { "start": { "line": 324, @@ -22258,8 +22530,8 @@ }, "right": { "type": "CallExpression", - "start": 14077, - "end": 14990, + "start": 14163, + "end": 15076, "loc": { "start": { "line": 324, @@ -22272,8 +22544,8 @@ }, "callee": { "type": "MemberExpression", - "start": 14077, - "end": 14093, + "start": 14163, + "end": 14179, "loc": { "start": { "line": 324, @@ -22286,8 +22558,8 @@ }, "object": { "type": "Identifier", - "start": 14077, - "end": 14090, + "start": 14163, + "end": 14176, "loc": { "start": { "line": 324, @@ -22303,8 +22575,8 @@ }, "property": { "type": "Identifier", - "start": 14091, - "end": 14093, + "start": 14177, + "end": 14179, "loc": { "start": { "line": 324, @@ -22323,8 +22595,8 @@ "arguments": [ { "type": "ConditionalExpression", - "start": 14107, - "end": 14192, + "start": 14193, + "end": 14278, "loc": { "start": { "line": 325, @@ -22337,8 +22609,8 @@ }, "test": { "type": "MemberExpression", - "start": 14107, - "end": 14121, + "start": 14193, + "end": 14207, "loc": { "start": { "line": 325, @@ -22351,8 +22623,8 @@ }, "object": { "type": "ThisExpression", - "start": 14107, - "end": 14111, + "start": 14193, + "end": 14197, "loc": { "start": { "line": 325, @@ -22366,8 +22638,8 @@ }, "property": { "type": "Identifier", - "start": 14112, - "end": 14121, + "start": 14198, + "end": 14207, "loc": { "start": { "line": 325, @@ -22385,8 +22657,8 @@ }, "consequent": { "type": "StringLiteral", - "start": 14140, - "end": 14163, + "start": 14226, + "end": 14249, "loc": { "start": { "line": 326, @@ -22405,8 +22677,8 @@ }, "alternate": { "type": "StringLiteral", - "start": 14182, - "end": 14192, + "start": 14268, + "end": 14278, "loc": { "start": { "line": 327, @@ -22426,8 +22698,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 14194, - "end": 14989, + "start": 14280, + "end": 15075, "loc": { "start": { "line": 327, @@ -22445,8 +22717,8 @@ "params": [ { "type": "Identifier", - "start": 14194, - "end": 14199, + "start": 14280, + "end": 14285, "loc": { "start": { "line": 327, @@ -22463,8 +22735,8 @@ ], "body": { "type": "BlockStatement", - "start": 14203, - "end": 14989, + "start": 14289, + "end": 15075, "loc": { "start": { "line": 327, @@ -22478,8 +22750,8 @@ "body": [ { "type": "IfStatement", - "start": 14221, - "end": 14480, + "start": 14307, + "end": 14566, "loc": { "start": { "line": 328, @@ -22492,8 +22764,8 @@ }, "test": { "type": "MemberExpression", - "start": 14225, - "end": 14241, + "start": 14311, + "end": 14327, "loc": { "start": { "line": 328, @@ -22506,8 +22778,8 @@ }, "object": { "type": "ThisExpression", - "start": 14225, - "end": 14229, + "start": 14311, + "end": 14315, "loc": { "start": { "line": 328, @@ -22521,8 +22793,8 @@ }, "property": { "type": "Identifier", - "start": 14230, - "end": 14241, + "start": 14316, + "end": 14327, "loc": { "start": { "line": 328, @@ -22540,8 +22812,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 14243, - "end": 14480, + "start": 14329, + "end": 14566, "loc": { "start": { "line": 328, @@ -22555,8 +22827,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 14265, - "end": 14297, + "start": 14351, + "end": 14383, "loc": { "start": { "line": 329, @@ -22569,8 +22841,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14265, - "end": 14296, + "start": 14351, + "end": 14382, "loc": { "start": { "line": 329, @@ -22584,8 +22856,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14265, - "end": 14289, + "start": 14351, + "end": 14375, "loc": { "start": { "line": 329, @@ -22598,8 +22870,8 @@ }, "object": { "type": "MemberExpression", - "start": 14265, - "end": 14281, + "start": 14351, + "end": 14367, "loc": { "start": { "line": 329, @@ -22612,8 +22884,8 @@ }, "object": { "type": "ThisExpression", - "start": 14265, - "end": 14269, + "start": 14351, + "end": 14355, "loc": { "start": { "line": 329, @@ -22627,8 +22899,8 @@ }, "property": { "type": "Identifier", - "start": 14270, - "end": 14281, + "start": 14356, + "end": 14367, "loc": { "start": { "line": 329, @@ -22646,8 +22918,8 @@ }, "property": { "type": "Identifier", - "start": 14282, - "end": 14289, + "start": 14368, + "end": 14375, "loc": { "start": { "line": 329, @@ -22665,8 +22937,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14292, - "end": 14296, + "start": 14378, + "end": 14382, "loc": { "start": { "line": 329, @@ -22683,8 +22955,8 @@ }, { "type": "ExpressionStatement", - "start": 14318, - "end": 14363, + "start": 14404, + "end": 14449, "loc": { "start": { "line": 330, @@ -22697,8 +22969,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14318, - "end": 14362, + "start": 14404, + "end": 14448, "loc": { "start": { "line": 330, @@ -22712,8 +22984,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14318, - "end": 14344, + "start": 14404, + "end": 14430, "loc": { "start": { "line": 330, @@ -22726,8 +22998,8 @@ }, "object": { "type": "MemberExpression", - "start": 14318, - "end": 14334, + "start": 14404, + "end": 14420, "loc": { "start": { "line": 330, @@ -22740,8 +23012,8 @@ }, "object": { "type": "ThisExpression", - "start": 14318, - "end": 14322, + "start": 14404, + "end": 14408, "loc": { "start": { "line": 330, @@ -22755,8 +23027,8 @@ }, "property": { "type": "Identifier", - "start": 14323, - "end": 14334, + "start": 14409, + "end": 14420, "loc": { "start": { "line": 330, @@ -22774,8 +23046,8 @@ }, "property": { "type": "Identifier", - "start": 14335, - "end": 14344, + "start": 14421, + "end": 14430, "loc": { "start": { "line": 330, @@ -22793,8 +23065,8 @@ }, "right": { "type": "MemberExpression", - "start": 14347, - "end": 14362, + "start": 14433, + "end": 14448, "loc": { "start": { "line": 330, @@ -22807,8 +23079,8 @@ }, "object": { "type": "Identifier", - "start": 14347, - "end": 14352, + "start": 14433, + "end": 14438, "loc": { "start": { "line": 330, @@ -22824,8 +23096,8 @@ }, "property": { "type": "Identifier", - "start": 14353, - "end": 14362, + "start": 14439, + "end": 14448, "loc": { "start": { "line": 330, @@ -22845,8 +23117,8 @@ }, { "type": "ExpressionStatement", - "start": 14384, - "end": 14462, + "start": 14470, + "end": 14548, "loc": { "start": { "line": 331, @@ -22859,8 +23131,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14384, - "end": 14461, + "start": 14470, + "end": 14547, "loc": { "start": { "line": 331, @@ -22874,8 +23146,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14384, - "end": 14417, + "start": 14470, + "end": 14503, "loc": { "start": { "line": 331, @@ -22888,8 +23160,8 @@ }, "object": { "type": "MemberExpression", - "start": 14384, - "end": 14400, + "start": 14470, + "end": 14486, "loc": { "start": { "line": 331, @@ -22902,8 +23174,8 @@ }, "object": { "type": "ThisExpression", - "start": 14384, - "end": 14388, + "start": 14470, + "end": 14474, "loc": { "start": { "line": 331, @@ -22917,8 +23189,8 @@ }, "property": { "type": "Identifier", - "start": 14389, - "end": 14400, + "start": 14475, + "end": 14486, "loc": { "start": { "line": 331, @@ -22936,8 +23208,8 @@ }, "property": { "type": "Identifier", - "start": 14401, - "end": 14417, + "start": 14487, + "end": 14503, "loc": { "start": { "line": 331, @@ -22955,8 +23227,8 @@ }, "right": { "type": "LogicalExpression", - "start": 14420, - "end": 14461, + "start": 14506, + "end": 14547, "loc": { "start": { "line": 331, @@ -22969,8 +23241,8 @@ }, "left": { "type": "MemberExpression", - "start": 14420, - "end": 14442, + "start": 14506, + "end": 14528, "loc": { "start": { "line": 331, @@ -22983,8 +23255,8 @@ }, "object": { "type": "Identifier", - "start": 14420, - "end": 14425, + "start": 14506, + "end": 14511, "loc": { "start": { "line": 331, @@ -23000,8 +23272,8 @@ }, "property": { "type": "Identifier", - "start": 14426, - "end": 14442, + "start": 14512, + "end": 14528, "loc": { "start": { "line": 331, @@ -23020,8 +23292,8 @@ "operator": "||", "right": { "type": "MemberExpression", - "start": 14446, - "end": 14461, + "start": 14532, + "end": 14547, "loc": { "start": { "line": 331, @@ -23034,8 +23306,8 @@ }, "object": { "type": "Identifier", - "start": 14446, - "end": 14451, + "start": 14532, + "end": 14537, "loc": { "start": { "line": 331, @@ -23051,8 +23323,8 @@ }, "property": { "type": "Identifier", - "start": 14452, - "end": 14461, + "start": 14538, + "end": 14547, "loc": { "start": { "line": 331, @@ -23078,8 +23350,8 @@ }, { "type": "ExpressionStatement", - "start": 14497, - "end": 14519, + "start": 14583, + "end": 14605, "loc": { "start": { "line": 333, @@ -23092,8 +23364,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14497, - "end": 14518, + "start": 14583, + "end": 14604, "loc": { "start": { "line": 333, @@ -23107,8 +23379,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 14497, - "end": 14510, + "start": 14583, + "end": 14596, "loc": { "start": { "line": 333, @@ -23124,8 +23396,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14513, - "end": 14518, + "start": 14599, + "end": 14604, "loc": { "start": { "line": 333, @@ -23142,8 +23414,8 @@ }, { "type": "ExpressionStatement", - "start": 14536, - "end": 14574, + "start": 14622, + "end": 14660, "loc": { "start": { "line": 334, @@ -23156,8 +23428,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14536, - "end": 14573, + "start": 14622, + "end": 14659, "loc": { "start": { "line": 334, @@ -23171,8 +23443,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14536, - "end": 14562, + "start": 14622, + "end": 14648, "loc": { "start": { "line": 334, @@ -23185,8 +23457,8 @@ }, "object": { "type": "MemberExpression", - "start": 14536, - "end": 14557, + "start": 14622, + "end": 14643, "loc": { "start": { "line": 334, @@ -23199,8 +23471,8 @@ }, "object": { "type": "MemberExpression", - "start": 14536, - "end": 14551, + "start": 14622, + "end": 14637, "loc": { "start": { "line": 334, @@ -23213,8 +23485,8 @@ }, "object": { "type": "ThisExpression", - "start": 14536, - "end": 14540, + "start": 14622, + "end": 14626, "loc": { "start": { "line": 334, @@ -23228,8 +23500,8 @@ }, "property": { "type": "Identifier", - "start": 14541, - "end": 14551, + "start": 14627, + "end": 14637, "loc": { "start": { "line": 334, @@ -23247,8 +23519,8 @@ }, "property": { "type": "Identifier", - "start": 14552, - "end": 14557, + "start": 14638, + "end": 14643, "loc": { "start": { "line": 334, @@ -23266,8 +23538,8 @@ }, "property": { "type": "Identifier", - "start": 14558, - "end": 14562, + "start": 14644, + "end": 14648, "loc": { "start": { "line": 334, @@ -23285,8 +23557,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 14565, - "end": 14573, + "start": 14651, + "end": 14659, "loc": { "start": { "line": 334, @@ -23301,8 +23573,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 14566, - "end": 14572, + "start": 14652, + "end": 14658, "loc": { "start": { "line": 334, @@ -23325,8 +23597,8 @@ }, { "type": "ExpressionStatement", - "start": 14591, - "end": 14628, + "start": 14677, + "end": 14714, "loc": { "start": { "line": 335, @@ -23339,8 +23611,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14591, - "end": 14627, + "start": 14677, + "end": 14713, "loc": { "start": { "line": 335, @@ -23354,8 +23626,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14591, - "end": 14616, + "start": 14677, + "end": 14702, "loc": { "start": { "line": 335, @@ -23368,8 +23640,8 @@ }, "object": { "type": "MemberExpression", - "start": 14591, - "end": 14612, + "start": 14677, + "end": 14698, "loc": { "start": { "line": 335, @@ -23382,8 +23654,8 @@ }, "object": { "type": "MemberExpression", - "start": 14591, - "end": 14606, + "start": 14677, + "end": 14692, "loc": { "start": { "line": 335, @@ -23396,8 +23668,8 @@ }, "object": { "type": "ThisExpression", - "start": 14591, - "end": 14595, + "start": 14677, + "end": 14681, "loc": { "start": { "line": 335, @@ -23411,8 +23683,8 @@ }, "property": { "type": "Identifier", - "start": 14596, - "end": 14606, + "start": 14682, + "end": 14692, "loc": { "start": { "line": 335, @@ -23430,8 +23702,8 @@ }, "property": { "type": "Identifier", - "start": 14607, - "end": 14612, + "start": 14693, + "end": 14698, "loc": { "start": { "line": 335, @@ -23449,8 +23721,8 @@ }, "property": { "type": "Identifier", - "start": 14613, - "end": 14616, + "start": 14699, + "end": 14702, "loc": { "start": { "line": 335, @@ -23468,8 +23740,8 @@ }, "right": { "type": "TemplateLiteral", - "start": 14619, - "end": 14627, + "start": 14705, + "end": 14713, "loc": { "start": { "line": 335, @@ -23484,8 +23756,8 @@ "quasis": [ { "type": "TemplateElement", - "start": 14620, - "end": 14626, + "start": 14706, + "end": 14712, "loc": { "start": { "line": 335, @@ -23508,8 +23780,8 @@ }, { "type": "IfStatement", - "start": 14645, - "end": 14926, + "start": 14731, + "end": 15012, "loc": { "start": { "line": 336, @@ -23522,8 +23794,8 @@ }, "test": { "type": "MemberExpression", - "start": 14649, - "end": 14681, + "start": 14735, + "end": 14767, "loc": { "start": { "line": 336, @@ -23536,8 +23808,8 @@ }, "object": { "type": "ThisExpression", - "start": 14649, - "end": 14653, + "start": 14735, + "end": 14739, "loc": { "start": { "line": 336, @@ -23551,8 +23823,8 @@ }, "property": { "type": "Identifier", - "start": 14654, - "end": 14681, + "start": 14740, + "end": 14767, "loc": { "start": { "line": 336, @@ -23570,8 +23842,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 14683, - "end": 14926, + "start": 14769, + "end": 15012, "loc": { "start": { "line": 336, @@ -23585,8 +23857,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 14705, - "end": 14758, + "start": 14791, + "end": 14844, "loc": { "start": { "line": 337, @@ -23599,8 +23871,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14705, - "end": 14757, + "start": 14791, + "end": 14843, "loc": { "start": { "line": 337, @@ -23614,8 +23886,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14705, - "end": 14749, + "start": 14791, + "end": 14835, "loc": { "start": { "line": 337, @@ -23628,8 +23900,8 @@ }, "object": { "type": "MemberExpression", - "start": 14705, - "end": 14737, + "start": 14791, + "end": 14823, "loc": { "start": { "line": 337, @@ -23642,8 +23914,8 @@ }, "object": { "type": "ThisExpression", - "start": 14705, - "end": 14709, + "start": 14791, + "end": 14795, "loc": { "start": { "line": 337, @@ -23657,8 +23929,8 @@ }, "property": { "type": "Identifier", - "start": 14710, - "end": 14737, + "start": 14796, + "end": 14823, "loc": { "start": { "line": 337, @@ -23676,8 +23948,8 @@ }, "property": { "type": "Identifier", - "start": 14738, - "end": 14749, + "start": 14824, + "end": 14835, "loc": { "start": { "line": 337, @@ -23695,8 +23967,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14752, - "end": 14757, + "start": 14838, + "end": 14843, "loc": { "start": { "line": 337, @@ -23713,8 +23985,8 @@ }, { "type": "ExpressionStatement", - "start": 14779, - "end": 14834, + "start": 14865, + "end": 14920, "loc": { "start": { "line": 338, @@ -23727,8 +23999,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14779, - "end": 14833, + "start": 14865, + "end": 14919, "loc": { "start": { "line": 338, @@ -23742,8 +24014,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14779, - "end": 14825, + "start": 14865, + "end": 14911, "loc": { "start": { "line": 338, @@ -23756,8 +24028,8 @@ }, "object": { "type": "MemberExpression", - "start": 14779, - "end": 14811, + "start": 14865, + "end": 14897, "loc": { "start": { "line": 338, @@ -23770,8 +24042,8 @@ }, "object": { "type": "ThisExpression", - "start": 14779, - "end": 14783, + "start": 14865, + "end": 14869, "loc": { "start": { "line": 338, @@ -23785,8 +24057,8 @@ }, "property": { "type": "Identifier", - "start": 14784, - "end": 14811, + "start": 14870, + "end": 14897, "loc": { "start": { "line": 338, @@ -23804,8 +24076,8 @@ }, "property": { "type": "Identifier", - "start": 14812, - "end": 14825, + "start": 14898, + "end": 14911, "loc": { "start": { "line": 338, @@ -23823,8 +24095,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14828, - "end": 14833, + "start": 14914, + "end": 14919, "loc": { "start": { "line": 338, @@ -23841,8 +24113,8 @@ }, { "type": "ExpressionStatement", - "start": 14855, - "end": 14908, + "start": 14941, + "end": 14994, "loc": { "start": { "line": 339, @@ -23855,8 +24127,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14855, - "end": 14907, + "start": 14941, + "end": 14993, "loc": { "start": { "line": 339, @@ -23870,8 +24142,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14855, - "end": 14899, + "start": 14941, + "end": 14985, "loc": { "start": { "line": 339, @@ -23884,8 +24156,8 @@ }, "object": { "type": "MemberExpression", - "start": 14855, - "end": 14887, + "start": 14941, + "end": 14973, "loc": { "start": { "line": 339, @@ -23898,8 +24170,8 @@ }, "object": { "type": "ThisExpression", - "start": 14855, - "end": 14859, + "start": 14941, + "end": 14945, "loc": { "start": { "line": 339, @@ -23913,8 +24185,8 @@ }, "property": { "type": "Identifier", - "start": 14860, - "end": 14887, + "start": 14946, + "end": 14973, "loc": { "start": { "line": 339, @@ -23932,8 +24204,8 @@ }, "property": { "type": "Identifier", - "start": 14888, - "end": 14899, + "start": 14974, + "end": 14985, "loc": { "start": { "line": 339, @@ -23951,8 +24223,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 14902, - "end": 14907, + "start": 14988, + "end": 14993, "loc": { "start": { "line": 339, @@ -23974,8 +24246,8 @@ }, { "type": "ExpressionStatement", - "start": 14943, - "end": 14975, + "start": 15029, + "end": 15061, "loc": { "start": { "line": 341, @@ -23988,8 +24260,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 14943, - "end": 14974, + "start": 15029, + "end": 15060, "loc": { "start": { "line": 341, @@ -24003,8 +24275,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 14943, - "end": 14962, + "start": 15029, + "end": 15048, "loc": { "start": { "line": 341, @@ -24017,8 +24289,8 @@ }, "object": { "type": "MemberExpression", - "start": 14943, - "end": 14955, + "start": 15029, + "end": 15041, "loc": { "start": { "line": 341, @@ -24031,8 +24303,8 @@ }, "object": { "type": "Identifier", - "start": 14943, - "end": 14949, + "start": 15029, + "end": 15035, "loc": { "start": { "line": 341, @@ -24048,8 +24320,8 @@ }, "property": { "type": "Identifier", - "start": 14950, - "end": 14955, + "start": 15036, + "end": 15041, "loc": { "start": { "line": 341, @@ -24067,8 +24339,8 @@ }, "property": { "type": "Identifier", - "start": 14956, - "end": 14962, + "start": 15042, + "end": 15048, "loc": { "start": { "line": 341, @@ -24086,8 +24358,8 @@ }, "right": { "type": "StringLiteral", - "start": 14965, - "end": 14974, + "start": 15051, + "end": 15060, "loc": { "start": { "line": 341, @@ -24116,8 +24388,8 @@ }, { "type": "ExpressionStatement", - "start": 15001, - "end": 15021, + "start": 15087, + "end": 15107, "loc": { "start": { "line": 344, @@ -24130,8 +24402,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15001, - "end": 15020, + "start": 15087, + "end": 15106, "loc": { "start": { "line": 344, @@ -24145,8 +24417,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15001, - "end": 15013, + "start": 15087, + "end": 15099, "loc": { "start": { "line": 344, @@ -24159,8 +24431,8 @@ }, "object": { "type": "ThisExpression", - "start": 15001, - "end": 15005, + "start": 15087, + "end": 15091, "loc": { "start": { "line": 344, @@ -24174,8 +24446,8 @@ }, "property": { "type": "Identifier", - "start": 15006, - "end": 15013, + "start": 15092, + "end": 15099, "loc": { "start": { "line": 344, @@ -24193,8 +24465,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 15016, - "end": 15020, + "start": 15102, + "end": 15106, "loc": { "start": { "line": 344, @@ -24235,8 +24507,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 15033, - "end": 15251, + "start": 15119, + "end": 15337, "loc": { "start": { "line": 347, @@ -24252,8 +24524,8 @@ }, { "type": "ClassMethod", - "start": 15256, - "end": 16270, + "start": 15342, + "end": 16356, "loc": { "start": { "line": 352, @@ -24268,8 +24540,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 15256, - "end": 15266, + "start": 15342, + "end": 15352, "loc": { "start": { "line": 352, @@ -24292,8 +24564,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 15269, - "end": 16270, + "start": 15355, + "end": 16356, "loc": { "start": { "line": 352, @@ -24307,8 +24579,8 @@ "body": [ { "type": "IfStatement", - "start": 15279, - "end": 15329, + "start": 15365, + "end": 15415, "loc": { "start": { "line": 353, @@ -24321,8 +24593,8 @@ }, "test": { "type": "UnaryExpression", - "start": 15283, - "end": 15296, + "start": 15369, + "end": 15382, "loc": { "start": { "line": 353, @@ -24337,8 +24609,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 15284, - "end": 15296, + "start": 15370, + "end": 15382, "loc": { "start": { "line": 353, @@ -24351,8 +24623,8 @@ }, "object": { "type": "ThisExpression", - "start": 15284, - "end": 15288, + "start": 15370, + "end": 15374, "loc": { "start": { "line": 353, @@ -24366,8 +24638,8 @@ }, "property": { "type": "Identifier", - "start": 15289, - "end": 15296, + "start": 15375, + "end": 15382, "loc": { "start": { "line": 353, @@ -24389,8 +24661,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 15298, - "end": 15329, + "start": 15384, + "end": 15415, "loc": { "start": { "line": 353, @@ -24404,8 +24676,8 @@ "body": [ { "type": "ReturnStatement", - "start": 15312, - "end": 15319, + "start": 15398, + "end": 15405, "loc": { "start": { "line": 354, @@ -24425,8 +24697,8 @@ }, { "type": "ExpressionStatement", - "start": 15339, - "end": 15369, + "start": 15425, + "end": 15455, "loc": { "start": { "line": 357, @@ -24439,8 +24711,8 @@ }, "expression": { "type": "CallExpression", - "start": 15339, - "end": 15368, + "start": 15425, + "end": 15454, "loc": { "start": { "line": 357, @@ -24453,8 +24725,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15339, - "end": 15348, + "start": 15425, + "end": 15434, "loc": { "start": { "line": 357, @@ -24467,8 +24739,8 @@ }, "object": { "type": "ThisExpression", - "start": 15339, - "end": 15343, + "start": 15425, + "end": 15429, "loc": { "start": { "line": 357, @@ -24482,8 +24754,8 @@ }, "property": { "type": "Identifier", - "start": 15344, - "end": 15348, + "start": 15430, + "end": 15434, "loc": { "start": { "line": 357, @@ -24502,8 +24774,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 15349, - "end": 15360, + "start": 15435, + "end": 15446, "loc": { "start": { "line": 357, @@ -24522,8 +24794,8 @@ }, { "type": "BooleanLiteral", - "start": 15362, - "end": 15367, + "start": 15448, + "end": 15453, "loc": { "start": { "line": 357, @@ -24541,8 +24813,8 @@ }, { "type": "IfStatement", - "start": 15379, - "end": 15458, + "start": 15465, + "end": 15544, "loc": { "start": { "line": 359, @@ -24555,8 +24827,8 @@ }, "test": { "type": "MemberExpression", - "start": 15383, - "end": 15399, + "start": 15469, + "end": 15485, "loc": { "start": { "line": 359, @@ -24569,8 +24841,8 @@ }, "object": { "type": "ThisExpression", - "start": 15383, - "end": 15387, + "start": 15469, + "end": 15473, "loc": { "start": { "line": 359, @@ -24584,8 +24856,8 @@ }, "property": { "type": "Identifier", - "start": 15388, - "end": 15399, + "start": 15474, + "end": 15485, "loc": { "start": { "line": 359, @@ -24603,8 +24875,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 15401, - "end": 15458, + "start": 15487, + "end": 15544, "loc": { "start": { "line": 359, @@ -24618,8 +24890,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 15415, - "end": 15448, + "start": 15501, + "end": 15534, "loc": { "start": { "line": 360, @@ -24632,8 +24904,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 15415, - "end": 15447, + "start": 15501, + "end": 15533, "loc": { "start": { "line": 360, @@ -24647,8 +24919,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 15415, - "end": 15439, + "start": 15501, + "end": 15525, "loc": { "start": { "line": 360, @@ -24661,8 +24933,8 @@ }, "object": { "type": "MemberExpression", - "start": 15415, - "end": 15431, + "start": 15501, + "end": 15517, "loc": { "start": { "line": 360, @@ -24675,8 +24947,8 @@ }, "object": { "type": "ThisExpression", - "start": 15415, - "end": 15419, + "start": 15501, + "end": 15505, "loc": { "start": { "line": 360, @@ -24690,8 +24962,8 @@ }, "property": { "type": "Identifier", - "start": 15420, - "end": 15431, + "start": 15506, + "end": 15517, "loc": { "start": { "line": 360, @@ -24709,8 +24981,8 @@ }, "property": { "type": "Identifier", - "start": 15432, - "end": 15439, + "start": 15518, + "end": 15525, "loc": { "start": { "line": 360, @@ -24728,8 +25000,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 15442, - "end": 15447, + "start": 15528, + "end": 15533, "loc": { "start": { "line": 360, @@ -24751,8 +25023,8 @@ }, { "type": "IfStatement", - "start": 15467, - "end": 15536, + "start": 15553, + "end": 15622, "loc": { "start": { "line": 362, @@ -24765,8 +25037,8 @@ }, "test": { "type": "MemberExpression", - "start": 15471, - "end": 15486, + "start": 15557, + "end": 15572, "loc": { "start": { "line": 362, @@ -24779,8 +25051,8 @@ }, "object": { "type": "ThisExpression", - "start": 15471, - "end": 15475, + "start": 15557, + "end": 15561, "loc": { "start": { "line": 362, @@ -24794,8 +25066,8 @@ }, "property": { "type": "Identifier", - "start": 15476, - "end": 15486, + "start": 15562, + "end": 15572, "loc": { "start": { "line": 362, @@ -24813,8 +25085,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 15488, - "end": 15536, + "start": 15574, + "end": 15622, "loc": { "start": { "line": 362, @@ -24828,8 +25100,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 15502, - "end": 15526, + "start": 15588, + "end": 15612, "loc": { "start": { "line": 363, @@ -24842,8 +25114,8 @@ }, "expression": { "type": "CallExpression", - "start": 15502, - "end": 15526, + "start": 15588, + "end": 15612, "loc": { "start": { "line": 363, @@ -24856,8 +25128,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15502, - "end": 15524, + "start": 15588, + "end": 15610, "loc": { "start": { "line": 363, @@ -24870,8 +25142,8 @@ }, "object": { "type": "ThisExpression", - "start": 15502, - "end": 15506, + "start": 15588, + "end": 15592, "loc": { "start": { "line": 363, @@ -24885,8 +25157,8 @@ }, "property": { "type": "Identifier", - "start": 15507, - "end": 15524, + "start": 15593, + "end": 15610, "loc": { "start": { "line": 363, @@ -24912,8 +25184,8 @@ }, { "type": "ExpressionStatement", - "start": 15545, - "end": 15558, + "start": 15631, + "end": 15644, "loc": { "start": { "line": 365, @@ -24926,8 +25198,8 @@ }, "expression": { "type": "CallExpression", - "start": 15545, - "end": 15557, + "start": 15631, + "end": 15643, "loc": { "start": { "line": 365, @@ -24940,8 +25212,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15545, - "end": 15555, + "start": 15631, + "end": 15641, "loc": { "start": { "line": 365, @@ -24954,8 +25226,8 @@ }, "object": { "type": "ThisExpression", - "start": 15545, - "end": 15549, + "start": 15631, + "end": 15635, "loc": { "start": { "line": 365, @@ -24969,8 +25241,8 @@ }, "property": { "type": "Identifier", - "start": 15550, - "end": 15555, + "start": 15636, + "end": 15641, "loc": { "start": { "line": 365, @@ -24991,8 +25263,8 @@ }, { "type": "VariableDeclaration", - "start": 15567, - "end": 15607, + "start": 15653, + "end": 15693, "loc": { "start": { "line": 366, @@ -25006,8 +25278,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 15573, - "end": 15606, + "start": 15659, + "end": 15692, "loc": { "start": { "line": 366, @@ -25020,8 +25292,8 @@ }, "id": { "type": "Identifier", - "start": 15573, - "end": 15579, + "start": 15659, + "end": 15665, "loc": { "start": { "line": 366, @@ -25037,8 +25309,8 @@ }, "init": { "type": "MemberExpression", - "start": 15582, - "end": 15606, + "start": 15668, + "end": 15692, "loc": { "start": { "line": 366, @@ -25051,8 +25323,8 @@ }, "object": { "type": "MemberExpression", - "start": 15582, - "end": 15599, + "start": 15668, + "end": 15685, "loc": { "start": { "line": 366, @@ -25065,8 +25337,8 @@ }, "object": { "type": "MemberExpression", - "start": 15582, - "end": 15592, + "start": 15668, + "end": 15678, "loc": { "start": { "line": 366, @@ -25079,8 +25351,8 @@ }, "object": { "type": "ThisExpression", - "start": 15582, - "end": 15586, + "start": 15668, + "end": 15672, "loc": { "start": { "line": 366, @@ -25094,8 +25366,8 @@ }, "property": { "type": "Identifier", - "start": 15587, - "end": 15592, + "start": 15673, + "end": 15678, "loc": { "start": { "line": 366, @@ -25113,8 +25385,8 @@ }, "property": { "type": "Identifier", - "start": 15593, - "end": 15599, + "start": 15679, + "end": 15685, "loc": { "start": { "line": 366, @@ -25132,8 +25404,8 @@ }, "property": { "type": "Identifier", - "start": 15600, - "end": 15606, + "start": 15686, + "end": 15692, "loc": { "start": { "line": 366, @@ -25155,8 +25427,8 @@ }, { "type": "ExpressionStatement", - "start": 15616, - "end": 15675, + "start": 15702, + "end": 15761, "loc": { "start": { "line": 367, @@ -25169,8 +25441,8 @@ }, "expression": { "type": "CallExpression", - "start": 15616, - "end": 15674, + "start": 15702, + "end": 15760, "loc": { "start": { "line": 367, @@ -25183,8 +25455,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15616, - "end": 15642, + "start": 15702, + "end": 15728, "loc": { "start": { "line": 367, @@ -25197,8 +25469,8 @@ }, "object": { "type": "Identifier", - "start": 15616, - "end": 15622, + "start": 15702, + "end": 15708, "loc": { "start": { "line": 367, @@ -25214,8 +25486,8 @@ }, "property": { "type": "Identifier", - "start": 15623, - "end": 15642, + "start": 15709, + "end": 15728, "loc": { "start": { "line": 367, @@ -25234,8 +25506,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 15643, - "end": 15654, + "start": 15729, + "end": 15740, "loc": { "start": { "line": 367, @@ -25254,8 +25526,8 @@ }, { "type": "MemberExpression", - "start": 15656, - "end": 15673, + "start": 15742, + "end": 15759, "loc": { "start": { "line": 367, @@ -25268,8 +25540,8 @@ }, "object": { "type": "ThisExpression", - "start": 15656, - "end": 15660, + "start": 15742, + "end": 15746, "loc": { "start": { "line": 367, @@ -25283,8 +25555,8 @@ }, "property": { "type": "Identifier", - "start": 15661, - "end": 15673, + "start": 15747, + "end": 15759, "loc": { "start": { "line": 367, @@ -25305,8 +25577,8 @@ }, { "type": "ExpressionStatement", - "start": 15684, - "end": 15739, + "start": 15770, + "end": 15825, "loc": { "start": { "line": 368, @@ -25319,8 +25591,8 @@ }, "expression": { "type": "CallExpression", - "start": 15684, - "end": 15738, + "start": 15770, + "end": 15824, "loc": { "start": { "line": 368, @@ -25333,8 +25605,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15684, - "end": 15710, + "start": 15770, + "end": 15796, "loc": { "start": { "line": 368, @@ -25347,8 +25619,8 @@ }, "object": { "type": "Identifier", - "start": 15684, - "end": 15690, + "start": 15770, + "end": 15776, "loc": { "start": { "line": 368, @@ -25364,8 +25636,8 @@ }, "property": { "type": "Identifier", - "start": 15691, - "end": 15710, + "start": 15777, + "end": 15796, "loc": { "start": { "line": 368, @@ -25384,8 +25656,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 15711, - "end": 15720, + "start": 15797, + "end": 15806, "loc": { "start": { "line": 368, @@ -25404,8 +25676,8 @@ }, { "type": "MemberExpression", - "start": 15722, - "end": 15737, + "start": 15808, + "end": 15823, "loc": { "start": { "line": 368, @@ -25418,8 +25690,8 @@ }, "object": { "type": "ThisExpression", - "start": 15722, - "end": 15726, + "start": 15808, + "end": 15812, "loc": { "start": { "line": 368, @@ -25433,8 +25705,8 @@ }, "property": { "type": "Identifier", - "start": 15727, - "end": 15737, + "start": 15813, + "end": 15823, "loc": { "start": { "line": 368, @@ -25455,8 +25727,8 @@ }, { "type": "VariableDeclaration", - "start": 15748, - "end": 15823, + "start": 15834, + "end": 15909, "loc": { "start": { "line": 369, @@ -25470,8 +25742,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 15754, - "end": 15822, + "start": 15840, + "end": 15908, "loc": { "start": { "line": 369, @@ -25484,8 +25756,8 @@ }, "id": { "type": "Identifier", - "start": 15754, - "end": 15767, + "start": 15840, + "end": 15853, "loc": { "start": { "line": 369, @@ -25501,8 +25773,8 @@ }, "init": { "type": "MemberExpression", - "start": 15770, - "end": 15822, + "start": 15856, + "end": 15908, "loc": { "start": { "line": 369, @@ -25515,8 +25787,8 @@ }, "object": { "type": "MemberExpression", - "start": 15770, - "end": 15808, + "start": 15856, + "end": 15894, "loc": { "start": { "line": 369, @@ -25529,8 +25801,8 @@ }, "object": { "type": "MemberExpression", - "start": 15770, - "end": 15801, + "start": 15856, + "end": 15887, "loc": { "start": { "line": 369, @@ -25543,8 +25815,8 @@ }, "object": { "type": "ThisExpression", - "start": 15770, - "end": 15774, + "start": 15856, + "end": 15860, "loc": { "start": { "line": 369, @@ -25558,8 +25830,8 @@ }, "property": { "type": "Identifier", - "start": 15775, - "end": 15801, + "start": 15861, + "end": 15887, "loc": { "start": { "line": 369, @@ -25577,8 +25849,8 @@ }, "property": { "type": "Identifier", - "start": 15802, - "end": 15808, + "start": 15888, + "end": 15894, "loc": { "start": { "line": 369, @@ -25596,8 +25868,8 @@ }, "property": { "type": "Identifier", - "start": 15809, - "end": 15822, + "start": 15895, + "end": 15908, "loc": { "start": { "line": 369, @@ -25619,8 +25891,8 @@ }, { "type": "ExpressionStatement", - "start": 15832, - "end": 15891, + "start": 15918, + "end": 15977, "loc": { "start": { "line": 370, @@ -25633,8 +25905,8 @@ }, "expression": { "type": "CallExpression", - "start": 15832, - "end": 15890, + "start": 15918, + "end": 15976, "loc": { "start": { "line": 370, @@ -25647,8 +25919,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15832, - "end": 15849, + "start": 15918, + "end": 15935, "loc": { "start": { "line": 370, @@ -25661,8 +25933,8 @@ }, "object": { "type": "Identifier", - "start": 15832, - "end": 15845, + "start": 15918, + "end": 15931, "loc": { "start": { "line": 370, @@ -25678,8 +25950,8 @@ }, "property": { "type": "Identifier", - "start": 15846, - "end": 15849, + "start": 15932, + "end": 15935, "loc": { "start": { "line": 370, @@ -25698,8 +25970,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 15850, - "end": 15889, + "start": 15936, + "end": 15975, "loc": { "start": { "line": 370, @@ -25712,8 +25984,8 @@ }, "object": { "type": "ThisExpression", - "start": 15850, - "end": 15854, + "start": 15936, + "end": 15940, "loc": { "start": { "line": 370, @@ -25727,8 +25999,8 @@ }, "property": { "type": "Identifier", - "start": 15855, - "end": 15889, + "start": 15941, + "end": 15975, "loc": { "start": { "line": 370, @@ -25749,8 +26021,8 @@ }, { "type": "ExpressionStatement", - "start": 15900, - "end": 15962, + "start": 15986, + "end": 16048, "loc": { "start": { "line": 371, @@ -25763,8 +26035,8 @@ }, "expression": { "type": "CallExpression", - "start": 15900, - "end": 15961, + "start": 15986, + "end": 16047, "loc": { "start": { "line": 371, @@ -25777,8 +26049,8 @@ }, "callee": { "type": "MemberExpression", - "start": 15900, - "end": 15917, + "start": 15986, + "end": 16003, "loc": { "start": { "line": 371, @@ -25791,8 +26063,8 @@ }, "object": { "type": "Identifier", - "start": 15900, - "end": 15913, + "start": 15986, + "end": 15999, "loc": { "start": { "line": 371, @@ -25808,8 +26080,8 @@ }, "property": { "type": "Identifier", - "start": 15914, - "end": 15917, + "start": 16000, + "end": 16003, "loc": { "start": { "line": 371, @@ -25828,8 +26100,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 15918, - "end": 15960, + "start": 16004, + "end": 16046, "loc": { "start": { "line": 371, @@ -25842,8 +26114,8 @@ }, "object": { "type": "ThisExpression", - "start": 15918, - "end": 15922, + "start": 16004, + "end": 16008, "loc": { "start": { "line": 371, @@ -25857,8 +26129,8 @@ }, "property": { "type": "Identifier", - "start": 15923, - "end": 15960, + "start": 16009, + "end": 16046, "loc": { "start": { "line": 371, @@ -25879,8 +26151,8 @@ }, { "type": "IfStatement", - "start": 15971, - "end": 16234, + "start": 16057, + "end": 16320, "loc": { "start": { "line": 372, @@ -25893,8 +26165,8 @@ }, "test": { "type": "MemberExpression", - "start": 15975, - "end": 16007, + "start": 16061, + "end": 16093, "loc": { "start": { "line": 372, @@ -25907,8 +26179,8 @@ }, "object": { "type": "ThisExpression", - "start": 15975, - "end": 15979, + "start": 16061, + "end": 16065, "loc": { "start": { "line": 372, @@ -25922,8 +26194,8 @@ }, "property": { "type": "Identifier", - "start": 15980, - "end": 16007, + "start": 16066, + "end": 16093, "loc": { "start": { "line": 372, @@ -25941,8 +26213,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 16009, - "end": 16234, + "start": 16095, + "end": 16320, "loc": { "start": { "line": 372, @@ -25956,8 +26228,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 16023, - "end": 16115, + "start": 16109, + "end": 16201, "loc": { "start": { "line": 373, @@ -25970,8 +26242,8 @@ }, "expression": { "type": "CallExpression", - "start": 16023, - "end": 16114, + "start": 16109, + "end": 16200, "loc": { "start": { "line": 373, @@ -25984,8 +26256,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16023, - "end": 16059, + "start": 16109, + "end": 16145, "loc": { "start": { "line": 373, @@ -25998,8 +26270,8 @@ }, "object": { "type": "MemberExpression", - "start": 16023, - "end": 16054, + "start": 16109, + "end": 16140, "loc": { "start": { "line": 373, @@ -26012,8 +26284,8 @@ }, "object": { "type": "ThisExpression", - "start": 16023, - "end": 16027, + "start": 16109, + "end": 16113, "loc": { "start": { "line": 373, @@ -26027,8 +26299,8 @@ }, "property": { "type": "Identifier", - "start": 16028, - "end": 16054, + "start": 16114, + "end": 16140, "loc": { "start": { "line": 373, @@ -26046,8 +26318,8 @@ }, "property": { "type": "Identifier", - "start": 16055, - "end": 16059, + "start": 16141, + "end": 16145, "loc": { "start": { "line": 373, @@ -26066,8 +26338,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 16060, - "end": 16079, + "start": 16146, + "end": 16165, "loc": { "start": { "line": 373, @@ -26086,8 +26358,8 @@ }, { "type": "MemberExpression", - "start": 16081, - "end": 16113, + "start": 16167, + "end": 16199, "loc": { "start": { "line": 373, @@ -26100,8 +26372,8 @@ }, "object": { "type": "ThisExpression", - "start": 16081, - "end": 16085, + "start": 16167, + "end": 16171, "loc": { "start": { "line": 373, @@ -26115,8 +26387,8 @@ }, "property": { "type": "Identifier", - "start": 16086, - "end": 16113, + "start": 16172, + "end": 16199, "loc": { "start": { "line": 373, @@ -26137,8 +26409,8 @@ }, { "type": "ExpressionStatement", - "start": 16128, - "end": 16171, + "start": 16214, + "end": 16257, "loc": { "start": { "line": 374, @@ -26151,8 +26423,8 @@ }, "expression": { "type": "CallExpression", - "start": 16128, - "end": 16170, + "start": 16214, + "end": 16256, "loc": { "start": { "line": 374, @@ -26165,8 +26437,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16128, - "end": 16168, + "start": 16214, + "end": 16254, "loc": { "start": { "line": 374, @@ -26179,8 +26451,8 @@ }, "object": { "type": "MemberExpression", - "start": 16128, - "end": 16160, + "start": 16214, + "end": 16246, "loc": { "start": { "line": 374, @@ -26193,8 +26465,8 @@ }, "object": { "type": "ThisExpression", - "start": 16128, - "end": 16132, + "start": 16214, + "end": 16218, "loc": { "start": { "line": 374, @@ -26208,8 +26480,8 @@ }, "property": { "type": "Identifier", - "start": 16133, - "end": 16160, + "start": 16219, + "end": 16246, "loc": { "start": { "line": 374, @@ -26227,8 +26499,8 @@ }, "property": { "type": "Identifier", - "start": 16161, - "end": 16168, + "start": 16247, + "end": 16254, "loc": { "start": { "line": 374, @@ -26249,8 +26521,8 @@ }, { "type": "ExpressionStatement", - "start": 16184, - "end": 16224, + "start": 16270, + "end": 16310, "loc": { "start": { "line": 375, @@ -26263,8 +26535,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16184, - "end": 16223, + "start": 16270, + "end": 16309, "loc": { "start": { "line": 375, @@ -26278,8 +26550,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16184, - "end": 16216, + "start": 16270, + "end": 16302, "loc": { "start": { "line": 375, @@ -26292,8 +26564,8 @@ }, "object": { "type": "ThisExpression", - "start": 16184, - "end": 16188, + "start": 16270, + "end": 16274, "loc": { "start": { "line": 375, @@ -26307,8 +26579,8 @@ }, "property": { "type": "Identifier", - "start": 16189, - "end": 16216, + "start": 16275, + "end": 16302, "loc": { "start": { "line": 375, @@ -26326,8 +26598,8 @@ }, "right": { "type": "NullLiteral", - "start": 16219, - "end": 16223, + "start": 16305, + "end": 16309, "loc": { "start": { "line": 375, @@ -26348,8 +26620,8 @@ }, { "type": "ExpressionStatement", - "start": 16243, - "end": 16264, + "start": 16329, + "end": 16350, "loc": { "start": { "line": 377, @@ -26362,8 +26634,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16243, - "end": 16263, + "start": 16329, + "end": 16349, "loc": { "start": { "line": 377, @@ -26377,8 +26649,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16243, - "end": 16255, + "start": 16329, + "end": 16341, "loc": { "start": { "line": 377, @@ -26391,8 +26663,8 @@ }, "object": { "type": "ThisExpression", - "start": 16243, - "end": 16247, + "start": 16329, + "end": 16333, "loc": { "start": { "line": 377, @@ -26406,8 +26678,8 @@ }, "property": { "type": "Identifier", - "start": 16248, - "end": 16255, + "start": 16334, + "end": 16341, "loc": { "start": { "line": 377, @@ -26425,8 +26697,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 16258, - "end": 16263, + "start": 16344, + "end": 16349, "loc": { "start": { "line": 377, @@ -26449,8 +26721,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 15033, - "end": 15251, + "start": 15119, + "end": 15337, "loc": { "start": { "line": 347, @@ -26467,8 +26739,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n ", - "start": 16276, - "end": 16538, + "start": 16362, + "end": 16624, "loc": { "start": { "line": 380, @@ -26484,15 +26756,15 @@ }, { "type": "ClassMethod", - "start": 16543, - "end": 16954, + "start": 16629, + "end": 17096, "loc": { "start": { "line": 387, "column": 4 }, "end": { - "line": 400, + "line": 402, "column": 5 } }, @@ -26500,8 +26772,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 16543, - "end": 16548, + "start": 16629, + "end": 16634, "loc": { "start": { "line": 387, @@ -26524,23 +26796,23 @@ "params": [], "body": { "type": "BlockStatement", - "start": 16551, - "end": 16954, + "start": 16637, + "end": 17096, "loc": { "start": { "line": 387, "column": 12 }, "end": { - "line": 400, + "line": 402, "column": 5 } }, "body": [ { "type": "IfStatement", - "start": 16561, - "end": 16611, + "start": 16647, + "end": 16697, "loc": { "start": { "line": 388, @@ -26553,8 +26825,8 @@ }, "test": { "type": "UnaryExpression", - "start": 16565, - "end": 16578, + "start": 16651, + "end": 16664, "loc": { "start": { "line": 388, @@ -26569,8 +26841,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 16566, - "end": 16578, + "start": 16652, + "end": 16664, "loc": { "start": { "line": 388, @@ -26583,8 +26855,8 @@ }, "object": { "type": "ThisExpression", - "start": 16566, - "end": 16570, + "start": 16652, + "end": 16656, "loc": { "start": { "line": 388, @@ -26598,8 +26870,8 @@ }, "property": { "type": "Identifier", - "start": 16571, - "end": 16578, + "start": 16657, + "end": 16664, "loc": { "start": { "line": 388, @@ -26621,8 +26893,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 16580, - "end": 16611, + "start": 16666, + "end": 16697, "loc": { "start": { "line": 388, @@ -26636,8 +26908,8 @@ "body": [ { "type": "ReturnStatement", - "start": 16594, - "end": 16601, + "start": 16680, + "end": 16687, "loc": { "start": { "line": 389, @@ -26657,8 +26929,8 @@ }, { "type": "ExpressionStatement", - "start": 16621, - "end": 16645, + "start": 16707, + "end": 16731, "loc": { "start": { "line": 392, @@ -26671,8 +26943,8 @@ }, "expression": { "type": "CallExpression", - "start": 16621, - "end": 16645, + "start": 16707, + "end": 16731, "loc": { "start": { "line": 392, @@ -26685,8 +26957,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16621, - "end": 16643, + "start": 16707, + "end": 16729, "loc": { "start": { "line": 392, @@ -26699,8 +26971,8 @@ }, "object": { "type": "ThisExpression", - "start": 16621, - "end": 16625, + "start": 16707, + "end": 16711, "loc": { "start": { "line": 392, @@ -26714,8 +26986,8 @@ }, "property": { "type": "Identifier", - "start": 16626, - "end": 16643, + "start": 16712, + "end": 16729, "loc": { "start": { "line": 392, @@ -26736,8 +27008,8 @@ }, { "type": "ExpressionStatement", - "start": 16654, - "end": 16675, + "start": 16740, + "end": 16761, "loc": { "start": { "line": 393, @@ -26750,8 +27022,8 @@ }, "expression": { "type": "CallExpression", - "start": 16654, - "end": 16675, + "start": 16740, + "end": 16761, "loc": { "start": { "line": 393, @@ -26764,8 +27036,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16654, - "end": 16673, + "start": 16740, + "end": 16759, "loc": { "start": { "line": 393, @@ -26778,8 +27050,8 @@ }, "object": { "type": "ThisExpression", - "start": 16654, - "end": 16658, + "start": 16740, + "end": 16744, "loc": { "start": { "line": 393, @@ -26793,8 +27065,8 @@ }, "property": { "type": "Identifier", - "start": 16659, - "end": 16673, + "start": 16745, + "end": 16759, "loc": { "start": { "line": 393, @@ -26815,8 +27087,8 @@ }, { "type": "IfStatement", - "start": 16685, - "end": 16948, + "start": 16771, + "end": 17034, "loc": { "start": { "line": 395, @@ -26829,8 +27101,8 @@ }, "test": { "type": "MemberExpression", - "start": 16689, - "end": 16721, + "start": 16775, + "end": 16807, "loc": { "start": { "line": 395, @@ -26843,8 +27115,8 @@ }, "object": { "type": "ThisExpression", - "start": 16689, - "end": 16693, + "start": 16775, + "end": 16779, "loc": { "start": { "line": 395, @@ -26858,8 +27130,8 @@ }, "property": { "type": "Identifier", - "start": 16694, - "end": 16721, + "start": 16780, + "end": 16807, "loc": { "start": { "line": 395, @@ -26877,8 +27149,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 16723, - "end": 16948, + "start": 16809, + "end": 17034, "loc": { "start": { "line": 395, @@ -26892,8 +27164,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 16737, - "end": 16829, + "start": 16823, + "end": 16915, "loc": { "start": { "line": 396, @@ -26906,8 +27178,8 @@ }, "expression": { "type": "CallExpression", - "start": 16737, - "end": 16828, + "start": 16823, + "end": 16914, "loc": { "start": { "line": 396, @@ -26920,8 +27192,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16737, - "end": 16773, + "start": 16823, + "end": 16859, "loc": { "start": { "line": 396, @@ -26934,8 +27206,8 @@ }, "object": { "type": "MemberExpression", - "start": 16737, - "end": 16768, + "start": 16823, + "end": 16854, "loc": { "start": { "line": 396, @@ -26948,8 +27220,8 @@ }, "object": { "type": "ThisExpression", - "start": 16737, - "end": 16741, + "start": 16823, + "end": 16827, "loc": { "start": { "line": 396, @@ -26963,8 +27235,8 @@ }, "property": { "type": "Identifier", - "start": 16742, - "end": 16768, + "start": 16828, + "end": 16854, "loc": { "start": { "line": 396, @@ -26982,8 +27254,8 @@ }, "property": { "type": "Identifier", - "start": 16769, - "end": 16773, + "start": 16855, + "end": 16859, "loc": { "start": { "line": 396, @@ -27002,8 +27274,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 16774, - "end": 16793, + "start": 16860, + "end": 16879, "loc": { "start": { "line": 396, @@ -27022,8 +27294,8 @@ }, { "type": "MemberExpression", - "start": 16795, - "end": 16827, + "start": 16881, + "end": 16913, "loc": { "start": { "line": 396, @@ -27036,8 +27308,8 @@ }, "object": { "type": "ThisExpression", - "start": 16795, - "end": 16799, + "start": 16881, + "end": 16885, "loc": { "start": { "line": 396, @@ -27051,8 +27323,8 @@ }, "property": { "type": "Identifier", - "start": 16800, - "end": 16827, + "start": 16886, + "end": 16913, "loc": { "start": { "line": 396, @@ -27073,8 +27345,8 @@ }, { "type": "ExpressionStatement", - "start": 16842, - "end": 16885, + "start": 16928, + "end": 16971, "loc": { "start": { "line": 397, @@ -27087,8 +27359,8 @@ }, "expression": { "type": "CallExpression", - "start": 16842, - "end": 16884, + "start": 16928, + "end": 16970, "loc": { "start": { "line": 397, @@ -27101,8 +27373,8 @@ }, "callee": { "type": "MemberExpression", - "start": 16842, - "end": 16882, + "start": 16928, + "end": 16968, "loc": { "start": { "line": 397, @@ -27115,8 +27387,8 @@ }, "object": { "type": "MemberExpression", - "start": 16842, - "end": 16874, + "start": 16928, + "end": 16960, "loc": { "start": { "line": 397, @@ -27129,8 +27401,8 @@ }, "object": { "type": "ThisExpression", - "start": 16842, - "end": 16846, + "start": 16928, + "end": 16932, "loc": { "start": { "line": 397, @@ -27144,8 +27416,8 @@ }, "property": { "type": "Identifier", - "start": 16847, - "end": 16874, + "start": 16933, + "end": 16960, "loc": { "start": { "line": 397, @@ -27163,8 +27435,8 @@ }, "property": { "type": "Identifier", - "start": 16875, - "end": 16882, + "start": 16961, + "end": 16968, "loc": { "start": { "line": 397, @@ -27185,8 +27457,8 @@ }, { "type": "ExpressionStatement", - "start": 16898, - "end": 16938, + "start": 16984, + "end": 17024, "loc": { "start": { "line": 398, @@ -27199,8 +27471,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 16898, - "end": 16937, + "start": 16984, + "end": 17023, "loc": { "start": { "line": 398, @@ -27214,8 +27486,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 16898, - "end": 16930, + "start": 16984, + "end": 17016, "loc": { "start": { "line": 398, @@ -27228,8 +27500,8 @@ }, "object": { "type": "ThisExpression", - "start": 16898, - "end": 16902, + "start": 16984, + "end": 16988, "loc": { "start": { "line": 398, @@ -27243,8 +27515,8 @@ }, "property": { "type": "Identifier", - "start": 16903, - "end": 16930, + "start": 16989, + "end": 17016, "loc": { "start": { "line": 398, @@ -27262,8 +27534,8 @@ }, "right": { "type": "NullLiteral", - "start": 16933, - "end": 16937, + "start": 17019, + "end": 17023, "loc": { "start": { "line": 398, @@ -27281,6 +27553,102 @@ "directives": [] }, "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 17044, + "end": 17090, + "loc": { + "start": { + "line": 401, + "column": 8 + }, + "end": { + "line": 401, + "column": 54 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 17044, + "end": 17089, + "loc": { + "start": { + "line": 401, + "column": 8 + }, + "end": { + "line": 401, + "column": 53 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 17044, + "end": 17060, + "loc": { + "start": { + "line": 401, + "column": 8 + }, + "end": { + "line": 401, + "column": 24 + } + }, + "object": { + "type": "ThisExpression", + "start": 17044, + "end": 17048, + "loc": { + "start": { + "line": 401, + "column": 8 + }, + "end": { + "line": 401, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "start": 17049, + "end": 17060, + "loc": { + "start": { + "line": 401, + "column": 13 + }, + "end": { + "line": 401, + "column": 24 + }, + "identifierName": "_mouseState" + }, + "name": "_mouseState" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 17063, + "end": 17089, + "loc": { + "start": { + "line": 401, + "column": 27 + }, + "end": { + "line": 401, + "column": 53 + }, + "identifierName": "MOUSE_FIRST_CLICK_EXPECTED" + }, + "name": "MOUSE_FIRST_CLICK_EXPECTED" + } + } } ], "directives": [], @@ -27290,8 +27658,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n ", - "start": 16276, - "end": 16538, + "start": 16362, + "end": 16624, "loc": { "start": { "line": 380, @@ -27304,19 +27672,177 @@ } } ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 17102, + "end": 17276, + "loc": { + "start": { + "line": 404, + "column": 4 + }, + "end": { + "line": 408, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 17281, + "end": 17362, + "loc": { + "start": { + "line": 409, + "column": 4 + }, + "end": { + "line": 411, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 17285, + "end": 17303, + "loc": { + "start": { + "line": 409, + "column": 8 + }, + "end": { + "line": 409, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17306, + "end": 17362, + "loc": { + "start": { + "line": 409, + "column": 29 + }, + "end": { + "line": 411, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 17316, + "end": 17356, + "loc": { + "start": { + "line": 410, + "column": 8 + }, + "end": { + "line": 410, + "column": 48 + } + }, + "argument": { + "type": "MemberExpression", + "start": 17323, + "end": 17355, + "loc": { + "start": { + "line": 410, + "column": 15 + }, + "end": { + "line": 410, + "column": 47 + } + }, + "object": { + "type": "ThisExpression", + "start": 17323, + "end": 17327, + "loc": { + "start": { + "line": 410, + "column": 15 + }, + "end": { + "line": 410, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "start": 17328, + "end": 17355, + "loc": { + "start": { + "line": 410, + "column": 20 + }, + "end": { + "line": 410, + "column": 47 + }, + "identifierName": "_currentDistanceMeasurement" + }, + "name": "_currentDistanceMeasurement" + }, + "computed": false + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 17102, + "end": 17276, + "loc": { + "start": { + "line": 404, + "column": 4 + }, + "end": { + "line": 408, + "column": 7 + } + } + } + ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 16960, - "end": 17142, + "start": 17368, + "end": 17550, "loc": { "start": { - "line": 402, + "line": 413, "column": 4 }, "end": { - "line": 406, + "line": 417, "column": 7 } } @@ -27325,15 +27851,15 @@ }, { "type": "ClassMethod", - "start": 17147, - "end": 17216, + "start": 17555, + "end": 17624, "loc": { "start": { - "line": 407, + "line": 418, "column": 4 }, "end": { - "line": 410, + "line": 421, "column": 5 } }, @@ -27341,15 +27867,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 17147, - "end": 17154, + "start": 17555, + "end": 17562, "loc": { "start": { - "line": 407, + "line": 418, "column": 4 }, "end": { - "line": 407, + "line": 418, "column": 11 }, "identifierName": "destroy" @@ -27365,87 +27891,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 17157, - "end": 17216, + "start": 17565, + "end": 17624, "loc": { "start": { - "line": 407, + "line": 418, "column": 14 }, "end": { - "line": 410, + "line": 421, "column": 5 } }, "body": [ { "type": "ExpressionStatement", - "start": 17167, - "end": 17185, + "start": 17575, + "end": 17593, "loc": { "start": { - "line": 408, + "line": 419, "column": 8 }, "end": { - "line": 408, + "line": 419, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 17167, - "end": 17184, + "start": 17575, + "end": 17592, "loc": { "start": { - "line": 408, + "line": 419, "column": 8 }, "end": { - "line": 408, + "line": 419, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 17167, - "end": 17182, + "start": 17575, + "end": 17590, "loc": { "start": { - "line": 408, + "line": 419, "column": 8 }, "end": { - "line": 408, + "line": 419, "column": 23 } }, "object": { "type": "ThisExpression", - "start": 17167, - "end": 17171, + "start": 17575, + "end": 17579, "loc": { "start": { - "line": 408, + "line": 419, "column": 8 }, "end": { - "line": 408, + "line": 419, "column": 12 } } }, "property": { "type": "Identifier", - "start": 17172, - "end": 17182, + "start": 17580, + "end": 17590, "loc": { "start": { - "line": 408, + "line": 419, "column": 13 }, "end": { - "line": 408, + "line": 419, "column": 23 }, "identifierName": "deactivate" @@ -27459,72 +27985,72 @@ }, { "type": "ExpressionStatement", - "start": 17194, - "end": 17210, + "start": 17602, + "end": 17618, "loc": { "start": { - "line": 409, + "line": 420, "column": 8 }, "end": { - "line": 409, + "line": 420, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 17194, - "end": 17209, + "start": 17602, + "end": 17617, "loc": { "start": { - "line": 409, + "line": 420, "column": 8 }, "end": { - "line": 409, + "line": 420, "column": 23 } }, "callee": { "type": "MemberExpression", - "start": 17194, - "end": 17207, + "start": 17602, + "end": 17615, "loc": { "start": { - "line": 409, + "line": 420, "column": 8 }, "end": { - "line": 409, + "line": 420, "column": 21 } }, "object": { "type": "Super", - "start": 17194, - "end": 17199, + "start": 17602, + "end": 17607, "loc": { "start": { - "line": 409, + "line": 420, "column": 8 }, "end": { - "line": 409, + "line": 420, "column": 13 } } }, "property": { "type": "Identifier", - "start": 17200, - "end": 17207, + "start": 17608, + "end": 17615, "loc": { "start": { - "line": 409, + "line": 420, "column": 14 }, "end": { - "line": 409, + "line": 420, "column": 21 }, "identifierName": "destroy" @@ -27543,15 +28069,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 16960, - "end": 17142, + "start": 17368, + "end": 17550, "loc": { "start": { - "line": 402, + "line": 413, "column": 4 }, "end": { - "line": 406, + "line": 417, "column": 7 } } @@ -27734,8 +28260,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 15033, - "end": 15251, + "start": 15119, + "end": 15337, "loc": { "start": { "line": 347, @@ -27750,8 +28276,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n ", - "start": 16276, - "end": 16538, + "start": 16362, + "end": 16624, "loc": { "start": { "line": 380, @@ -27763,18 +28289,34 @@ } } }, + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 17102, + "end": 17276, + "loc": { + "start": { + "line": 404, + "column": 4 + }, + "end": { + "line": 408, + "column": 7 + } + } + }, { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 16960, - "end": 17142, + "start": 17368, + "end": 17550, "loc": { "start": { - "line": 402, + "line": 413, "column": 4 }, "end": { - "line": 406, + "line": 417, "column": 7 } } @@ -42965,6 +43507,266 @@ } } }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6723, + "end": 6724, + "loc": { + "start": { + "line": 202, + "column": 64 + }, + "end": { + "line": 202, + "column": 65 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "el", + "start": 6724, + "end": 6726, + "loc": { + "start": { + "line": 202, + "column": 65 + }, + "end": { + "line": 202, + "column": 67 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6726, + "end": 6727, + "loc": { + "start": { + "line": 202, + "column": 67 + }, + "end": { + "line": 202, + "column": 68 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "offsetParent", + "start": 6727, + "end": 6739, + "loc": { + "start": { + "line": 202, + "column": 68 + }, + "end": { + "line": 202, + "column": 80 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 6740, + "end": 6743, + "loc": { + "start": { + "line": 202, + "column": 81 + }, + "end": { + "line": 202, + "column": 84 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "canvas", + "start": 6744, + "end": 6750, + "loc": { + "start": { + "line": 202, + "column": 85 + }, + "end": { + "line": 202, + "column": 91 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6750, + "end": 6751, + "loc": { + "start": { + "line": 202, + "column": 91 + }, + "end": { + "line": 202, + "column": 92 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parentNode", + "start": 6751, + "end": 6761, + "loc": { + "start": { + "line": 202, + "column": 92 + }, + "end": { + "line": 202, + "column": 102 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6761, + "end": 6762, + "loc": { + "start": { + "line": 202, + "column": 102 + }, + "end": { + "line": 202, + "column": 103 + } + } + }, + { + "type": { + "label": "&&", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 2, + "updateContext": null + }, + "value": "&&", + "start": 6763, + "end": 6765, + "loc": { + "start": { + "line": 202, + "column": 104 + }, + "end": { + "line": 202, + "column": 106 + } + } + }, { "type": { "label": "name", @@ -42978,16 +43780,16 @@ "binop": null }, "value": "getTop", - "start": 6723, - "end": 6729, + "start": 6766, + "end": 6772, "loc": { "start": { "line": 202, - "column": 64 + "column": 107 }, "end": { "line": 202, - "column": 70 + "column": 113 } } }, @@ -43003,16 +43805,16 @@ "postfix": false, "binop": null }, - "start": 6729, - "end": 6730, + "start": 6772, + "end": 6773, "loc": { "start": { "line": 202, - "column": 70 + "column": 113 }, "end": { "line": 202, - "column": 71 + "column": 114 } } }, @@ -43029,16 +43831,16 @@ "binop": null }, "value": "el", - "start": 6730, - "end": 6732, + "start": 6773, + "end": 6775, "loc": { "start": { "line": 202, - "column": 71 + "column": 114 }, "end": { "line": 202, - "column": 73 + "column": 116 } } }, @@ -43055,16 +43857,16 @@ "binop": null, "updateContext": null }, - "start": 6732, - "end": 6733, + "start": 6775, + "end": 6776, "loc": { "start": { "line": 202, - "column": 73 + "column": 116 }, "end": { "line": 202, - "column": 74 + "column": 117 } } }, @@ -43081,16 +43883,16 @@ "binop": null }, "value": "offsetParent", - "start": 6733, - "end": 6745, + "start": 6776, + "end": 6788, "loc": { "start": { "line": 202, - "column": 74 + "column": 117 }, "end": { "line": 202, - "column": 86 + "column": 129 } } }, @@ -43106,16 +43908,16 @@ "postfix": false, "binop": null }, - "start": 6745, - "end": 6746, + "start": 6788, + "end": 6789, "loc": { "start": { "line": 202, - "column": 86 + "column": 129 }, "end": { "line": 202, - "column": 87 + "column": 130 } } }, @@ -43131,16 +43933,16 @@ "postfix": false, "binop": null }, - "start": 6746, - "end": 6747, + "start": 6789, + "end": 6790, "loc": { "start": { "line": 202, - "column": 87 + "column": 130 }, "end": { "line": 202, - "column": 88 + "column": 131 } } }, @@ -43157,16 +43959,16 @@ "binop": null, "updateContext": null }, - "start": 6747, - "end": 6748, + "start": 6790, + "end": 6791, "loc": { "start": { "line": 202, - "column": 88 + "column": 131 }, "end": { "line": 202, - "column": 89 + "column": 132 } } }, @@ -43185,8 +43987,8 @@ "updateContext": null }, "value": "const", - "start": 6757, - "end": 6762, + "start": 6800, + "end": 6805, "loc": { "start": { "line": 203, @@ -43211,8 +44013,8 @@ "binop": null }, "value": "getLeft", - "start": 6763, - "end": 6770, + "start": 6806, + "end": 6813, "loc": { "start": { "line": 203, @@ -43238,8 +44040,8 @@ "updateContext": null }, "value": "=", - "start": 6771, - "end": 6772, + "start": 6814, + "end": 6815, "loc": { "start": { "line": 203, @@ -43264,8 +44066,8 @@ "binop": null }, "value": "el", - "start": 6773, - "end": 6775, + "start": 6816, + "end": 6818, "loc": { "start": { "line": 203, @@ -43290,8 +44092,8 @@ "binop": null, "updateContext": null }, - "start": 6776, - "end": 6778, + "start": 6819, + "end": 6821, "loc": { "start": { "line": 203, @@ -43316,8 +44118,8 @@ "binop": null }, "value": "el", - "start": 6779, - "end": 6781, + "start": 6822, + "end": 6824, "loc": { "start": { "line": 203, @@ -43342,8 +44144,8 @@ "binop": null, "updateContext": null }, - "start": 6781, - "end": 6782, + "start": 6824, + "end": 6825, "loc": { "start": { "line": 203, @@ -43368,8 +44170,8 @@ "binop": null }, "value": "offsetLeft", - "start": 6782, - "end": 6792, + "start": 6825, + "end": 6835, "loc": { "start": { "line": 203, @@ -43395,8 +44197,8 @@ "updateContext": null }, "value": "+", - "start": 6793, - "end": 6794, + "start": 6836, + "end": 6837, "loc": { "start": { "line": 203, @@ -43420,8 +44222,8 @@ "postfix": false, "binop": null }, - "start": 6795, - "end": 6796, + "start": 6838, + "end": 6839, "loc": { "start": { "line": 203, @@ -43446,8 +44248,8 @@ "binop": null }, "value": "el", - "start": 6796, - "end": 6798, + "start": 6839, + "end": 6841, "loc": { "start": { "line": 203, @@ -43472,8 +44274,8 @@ "binop": null, "updateContext": null }, - "start": 6798, - "end": 6799, + "start": 6841, + "end": 6842, "loc": { "start": { "line": 203, @@ -43498,8 +44300,8 @@ "binop": null }, "value": "offsetParent", - "start": 6799, - "end": 6811, + "start": 6842, + "end": 6854, "loc": { "start": { "line": 203, @@ -43525,8 +44327,8 @@ "updateContext": null }, "value": "&&", - "start": 6812, - "end": 6814, + "start": 6855, + "end": 6857, "loc": { "start": { "line": 203, @@ -43538,6 +44340,266 @@ } } }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6858, + "end": 6859, + "loc": { + "start": { + "line": 203, + "column": 66 + }, + "end": { + "line": 203, + "column": 67 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "el", + "start": 6859, + "end": 6861, + "loc": { + "start": { + "line": 203, + "column": 67 + }, + "end": { + "line": 203, + "column": 69 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6861, + "end": 6862, + "loc": { + "start": { + "line": 203, + "column": 69 + }, + "end": { + "line": 203, + "column": 70 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "offsetParent", + "start": 6862, + "end": 6874, + "loc": { + "start": { + "line": 203, + "column": 70 + }, + "end": { + "line": 203, + "column": 82 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 6875, + "end": 6878, + "loc": { + "start": { + "line": 203, + "column": 83 + }, + "end": { + "line": 203, + "column": 86 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "canvas", + "start": 6879, + "end": 6885, + "loc": { + "start": { + "line": 203, + "column": 87 + }, + "end": { + "line": 203, + "column": 93 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 6885, + "end": 6886, + "loc": { + "start": { + "line": 203, + "column": 93 + }, + "end": { + "line": 203, + "column": 94 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parentNode", + "start": 6886, + "end": 6896, + "loc": { + "start": { + "line": 203, + "column": 94 + }, + "end": { + "line": 203, + "column": 104 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 6896, + "end": 6897, + "loc": { + "start": { + "line": 203, + "column": 104 + }, + "end": { + "line": 203, + "column": 105 + } + } + }, + { + "type": { + "label": "&&", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 2, + "updateContext": null + }, + "value": "&&", + "start": 6898, + "end": 6900, + "loc": { + "start": { + "line": 203, + "column": 106 + }, + "end": { + "line": 203, + "column": 108 + } + } + }, { "type": { "label": "name", @@ -43551,16 +44613,16 @@ "binop": null }, "value": "getLeft", - "start": 6815, - "end": 6822, + "start": 6901, + "end": 6908, "loc": { "start": { "line": 203, - "column": 66 + "column": 109 }, "end": { "line": 203, - "column": 73 + "column": 116 } } }, @@ -43576,16 +44638,16 @@ "postfix": false, "binop": null }, - "start": 6822, - "end": 6823, + "start": 6908, + "end": 6909, "loc": { "start": { "line": 203, - "column": 73 + "column": 116 }, "end": { "line": 203, - "column": 74 + "column": 117 } } }, @@ -43602,16 +44664,16 @@ "binop": null }, "value": "el", - "start": 6823, - "end": 6825, + "start": 6909, + "end": 6911, "loc": { "start": { "line": 203, - "column": 74 + "column": 117 }, "end": { "line": 203, - "column": 76 + "column": 119 } } }, @@ -43628,16 +44690,16 @@ "binop": null, "updateContext": null }, - "start": 6825, - "end": 6826, + "start": 6911, + "end": 6912, "loc": { "start": { "line": 203, - "column": 76 + "column": 119 }, "end": { "line": 203, - "column": 77 + "column": 120 } } }, @@ -43654,16 +44716,16 @@ "binop": null }, "value": "offsetParent", - "start": 6826, - "end": 6838, + "start": 6912, + "end": 6924, "loc": { "start": { "line": 203, - "column": 77 + "column": 120 }, "end": { "line": 203, - "column": 89 + "column": 132 } } }, @@ -43679,16 +44741,16 @@ "postfix": false, "binop": null }, - "start": 6838, - "end": 6839, + "start": 6924, + "end": 6925, "loc": { "start": { "line": 203, - "column": 89 + "column": 132 }, "end": { "line": 203, - "column": 90 + "column": 133 } } }, @@ -43704,16 +44766,16 @@ "postfix": false, "binop": null }, - "start": 6839, - "end": 6840, + "start": 6925, + "end": 6926, "loc": { "start": { "line": 203, - "column": 90 + "column": 133 }, "end": { "line": 203, - "column": 91 + "column": 134 } } }, @@ -43730,16 +44792,16 @@ "binop": null, "updateContext": null }, - "start": 6840, - "end": 6841, + "start": 6926, + "end": 6927, "loc": { "start": { "line": 203, - "column": 91 + "column": 134 }, "end": { "line": 203, - "column": 92 + "column": 135 } } }, @@ -43758,8 +44820,8 @@ "updateContext": null }, "value": "const", - "start": 6851, - "end": 6856, + "start": 6937, + "end": 6942, "loc": { "start": { "line": 205, @@ -43784,8 +44846,8 @@ "binop": null }, "value": "pagePos", - "start": 6857, - "end": 6864, + "start": 6943, + "end": 6950, "loc": { "start": { "line": 205, @@ -43811,8 +44873,8 @@ "updateContext": null }, "value": "=", - "start": 6865, - "end": 6866, + "start": 6951, + "end": 6952, "loc": { "start": { "line": 205, @@ -43837,8 +44899,8 @@ "binop": null }, "value": "math", - "start": 6867, - "end": 6871, + "start": 6953, + "end": 6957, "loc": { "start": { "line": 205, @@ -43863,8 +44925,8 @@ "binop": null, "updateContext": null }, - "start": 6871, - "end": 6872, + "start": 6957, + "end": 6958, "loc": { "start": { "line": 205, @@ -43889,8 +44951,8 @@ "binop": null }, "value": "vec2", - "start": 6872, - "end": 6876, + "start": 6958, + "end": 6962, "loc": { "start": { "line": 205, @@ -43914,8 +44976,8 @@ "postfix": false, "binop": null }, - "start": 6876, - "end": 6877, + "start": 6962, + "end": 6963, "loc": { "start": { "line": 205, @@ -43939,8 +45001,8 @@ "postfix": false, "binop": null }, - "start": 6877, - "end": 6878, + "start": 6963, + "end": 6964, "loc": { "start": { "line": 205, @@ -43965,8 +45027,8 @@ "binop": null, "updateContext": null }, - "start": 6878, - "end": 6879, + "start": 6964, + "end": 6965, "loc": { "start": { "line": 205, @@ -43993,8 +45055,8 @@ "updateContext": null }, "value": "this", - "start": 6897, - "end": 6901, + "start": 6983, + "end": 6987, "loc": { "start": { "line": 207, @@ -44019,8 +45081,8 @@ "binop": null, "updateContext": null }, - "start": 6901, - "end": 6902, + "start": 6987, + "end": 6988, "loc": { "start": { "line": 207, @@ -44045,8 +45107,8 @@ "binop": null }, "value": "_onCameraControlHoverSnapOrSurface", - "start": 6902, - "end": 6936, + "start": 6988, + "end": 7022, "loc": { "start": { "line": 207, @@ -44072,8 +45134,8 @@ "updateContext": null }, "value": "=", - "start": 6937, - "end": 6938, + "start": 7023, + "end": 7024, "loc": { "start": { "line": 207, @@ -44098,8 +45160,8 @@ "binop": null }, "value": "cameraControl", - "start": 6939, - "end": 6952, + "start": 7025, + "end": 7038, "loc": { "start": { "line": 207, @@ -44124,8 +45186,8 @@ "binop": null, "updateContext": null }, - "start": 6952, - "end": 6953, + "start": 7038, + "end": 7039, "loc": { "start": { "line": 207, @@ -44150,8 +45212,8 @@ "binop": null }, "value": "on", - "start": 6953, - "end": 6955, + "start": 7039, + "end": 7041, "loc": { "start": { "line": 207, @@ -44175,8 +45237,8 @@ "postfix": false, "binop": null }, - "start": 6955, - "end": 6956, + "start": 7041, + "end": 7042, "loc": { "start": { "line": 207, @@ -44203,8 +45265,8 @@ "updateContext": null }, "value": "this", - "start": 6969, - "end": 6973, + "start": 7055, + "end": 7059, "loc": { "start": { "line": 208, @@ -44229,8 +45291,8 @@ "binop": null, "updateContext": null }, - "start": 6973, - "end": 6974, + "start": 7059, + "end": 7060, "loc": { "start": { "line": 208, @@ -44255,8 +45317,8 @@ "binop": null }, "value": "_snapping", - "start": 6974, - "end": 6983, + "start": 7060, + "end": 7069, "loc": { "start": { "line": 208, @@ -44281,8 +45343,8 @@ "binop": null, "updateContext": null }, - "start": 7000, - "end": 7001, + "start": 7086, + "end": 7087, "loc": { "start": { "line": 209, @@ -44308,8 +45370,8 @@ "updateContext": null }, "value": "hoverSnapOrSurface", - "start": 7002, - "end": 7022, + "start": 7088, + "end": 7108, "loc": { "start": { "line": 209, @@ -44334,8 +45396,8 @@ "binop": null, "updateContext": null }, - "start": 7039, - "end": 7040, + "start": 7125, + "end": 7126, "loc": { "start": { "line": 210, @@ -44361,8 +45423,8 @@ "updateContext": null }, "value": "hoverSurface", - "start": 7041, - "end": 7055, + "start": 7127, + "end": 7141, "loc": { "start": { "line": 210, @@ -44387,8 +45449,8 @@ "binop": null, "updateContext": null }, - "start": 7055, - "end": 7056, + "start": 7141, + "end": 7142, "loc": { "start": { "line": 210, @@ -44413,8 +45475,8 @@ "binop": null }, "value": "event", - "start": 7057, - "end": 7062, + "start": 7143, + "end": 7148, "loc": { "start": { "line": 210, @@ -44439,8 +45501,8 @@ "binop": null, "updateContext": null }, - "start": 7063, - "end": 7065, + "start": 7149, + "end": 7151, "loc": { "start": { "line": 210, @@ -44464,8 +45526,8 @@ "postfix": false, "binop": null }, - "start": 7066, - "end": 7067, + "start": 7152, + "end": 7153, "loc": { "start": { "line": 210, @@ -44492,8 +45554,8 @@ "updateContext": null }, "value": "const", - "start": 7084, - "end": 7089, + "start": 7170, + "end": 7175, "loc": { "start": { "line": 211, @@ -44518,8 +45580,8 @@ "binop": null }, "value": "canvasPos", - "start": 7090, - "end": 7099, + "start": 7176, + "end": 7185, "loc": { "start": { "line": 211, @@ -44545,8 +45607,8 @@ "updateContext": null }, "value": "=", - "start": 7100, - "end": 7101, + "start": 7186, + "end": 7187, "loc": { "start": { "line": 211, @@ -44571,8 +45633,8 @@ "binop": null }, "value": "event", - "start": 7102, - "end": 7107, + "start": 7188, + "end": 7193, "loc": { "start": { "line": 211, @@ -44597,8 +45659,8 @@ "binop": null, "updateContext": null }, - "start": 7107, - "end": 7108, + "start": 7193, + "end": 7194, "loc": { "start": { "line": 211, @@ -44623,8 +45685,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 7108, - "end": 7124, + "start": 7194, + "end": 7210, "loc": { "start": { "line": 211, @@ -44650,8 +45712,8 @@ "updateContext": null }, "value": "||", - "start": 7125, - "end": 7127, + "start": 7211, + "end": 7213, "loc": { "start": { "line": 211, @@ -44676,8 +45738,8 @@ "binop": null }, "value": "event", - "start": 7128, - "end": 7133, + "start": 7214, + "end": 7219, "loc": { "start": { "line": 211, @@ -44702,8 +45764,8 @@ "binop": null, "updateContext": null }, - "start": 7133, - "end": 7134, + "start": 7219, + "end": 7220, "loc": { "start": { "line": 211, @@ -44728,8 +45790,8 @@ "binop": null }, "value": "canvasPos", - "start": 7134, - "end": 7143, + "start": 7220, + "end": 7229, "loc": { "start": { "line": 211, @@ -44754,8 +45816,8 @@ "binop": null, "updateContext": null }, - "start": 7143, - "end": 7144, + "start": 7229, + "end": 7230, "loc": { "start": { "line": 211, @@ -44780,8 +45842,8 @@ "binop": null }, "value": "mouseHovering", - "start": 7161, - "end": 7174, + "start": 7247, + "end": 7260, "loc": { "start": { "line": 212, @@ -44807,8 +45869,8 @@ "updateContext": null }, "value": "=", - "start": 7175, - "end": 7176, + "start": 7261, + "end": 7262, "loc": { "start": { "line": 212, @@ -44835,8 +45897,8 @@ "updateContext": null }, "value": "true", - "start": 7177, - "end": 7181, + "start": 7263, + "end": 7267, "loc": { "start": { "line": 212, @@ -44861,8 +45923,8 @@ "binop": null, "updateContext": null }, - "start": 7181, - "end": 7182, + "start": 7267, + "end": 7268, "loc": { "start": { "line": 212, @@ -44887,8 +45949,8 @@ "binop": null }, "value": "pointerWorldPos", - "start": 7199, - "end": 7214, + "start": 7285, + "end": 7300, "loc": { "start": { "line": 213, @@ -44913,8 +45975,8 @@ "binop": null, "updateContext": null }, - "start": 7214, - "end": 7215, + "start": 7300, + "end": 7301, "loc": { "start": { "line": 213, @@ -44939,8 +46001,8 @@ "binop": null }, "value": "set", - "start": 7215, - "end": 7218, + "start": 7301, + "end": 7304, "loc": { "start": { "line": 213, @@ -44964,8 +46026,8 @@ "postfix": false, "binop": null }, - "start": 7218, - "end": 7219, + "start": 7304, + "end": 7305, "loc": { "start": { "line": 213, @@ -44990,8 +46052,8 @@ "binop": null }, "value": "event", - "start": 7219, - "end": 7224, + "start": 7305, + "end": 7310, "loc": { "start": { "line": 213, @@ -45016,8 +46078,8 @@ "binop": null, "updateContext": null }, - "start": 7224, - "end": 7225, + "start": 7310, + "end": 7311, "loc": { "start": { "line": 213, @@ -45042,8 +46104,8 @@ "binop": null }, "value": "worldPos", - "start": 7225, - "end": 7233, + "start": 7311, + "end": 7319, "loc": { "start": { "line": 213, @@ -45067,8 +46129,8 @@ "postfix": false, "binop": null }, - "start": 7233, - "end": 7234, + "start": 7319, + "end": 7320, "loc": { "start": { "line": 213, @@ -45093,8 +46155,8 @@ "binop": null, "updateContext": null }, - "start": 7234, - "end": 7235, + "start": 7320, + "end": 7321, "loc": { "start": { "line": 213, @@ -45119,8 +46181,8 @@ "binop": null }, "value": "pointerCanvasPos", - "start": 7252, - "end": 7268, + "start": 7338, + "end": 7354, "loc": { "start": { "line": 214, @@ -45145,8 +46207,8 @@ "binop": null, "updateContext": null }, - "start": 7268, - "end": 7269, + "start": 7354, + "end": 7355, "loc": { "start": { "line": 214, @@ -45171,8 +46233,8 @@ "binop": null }, "value": "set", - "start": 7269, - "end": 7272, + "start": 7355, + "end": 7358, "loc": { "start": { "line": 214, @@ -45196,8 +46258,8 @@ "postfix": false, "binop": null }, - "start": 7272, - "end": 7273, + "start": 7358, + "end": 7359, "loc": { "start": { "line": 214, @@ -45222,8 +46284,8 @@ "binop": null }, "value": "event", - "start": 7273, - "end": 7278, + "start": 7359, + "end": 7364, "loc": { "start": { "line": 214, @@ -45248,8 +46310,8 @@ "binop": null, "updateContext": null }, - "start": 7278, - "end": 7279, + "start": 7364, + "end": 7365, "loc": { "start": { "line": 214, @@ -45274,8 +46336,8 @@ "binop": null }, "value": "canvasPos", - "start": 7279, - "end": 7288, + "start": 7365, + "end": 7374, "loc": { "start": { "line": 214, @@ -45299,8 +46361,8 @@ "postfix": false, "binop": null }, - "start": 7288, - "end": 7289, + "start": 7374, + "end": 7375, "loc": { "start": { "line": 214, @@ -45325,8 +46387,8 @@ "binop": null, "updateContext": null }, - "start": 7289, - "end": 7290, + "start": 7375, + "end": 7376, "loc": { "start": { "line": 214, @@ -45353,8 +46415,8 @@ "updateContext": null }, "value": "if", - "start": 7307, - "end": 7309, + "start": 7393, + "end": 7395, "loc": { "start": { "line": 215, @@ -45378,8 +46440,8 @@ "postfix": false, "binop": null }, - "start": 7310, - "end": 7311, + "start": 7396, + "end": 7397, "loc": { "start": { "line": 215, @@ -45406,8 +46468,8 @@ "updateContext": null }, "value": "this", - "start": 7311, - "end": 7315, + "start": 7397, + "end": 7401, "loc": { "start": { "line": 215, @@ -45432,8 +46494,8 @@ "binop": null, "updateContext": null }, - "start": 7315, - "end": 7316, + "start": 7401, + "end": 7402, "loc": { "start": { "line": 215, @@ -45458,8 +46520,8 @@ "binop": null }, "value": "_mouseState", - "start": 7316, - "end": 7327, + "start": 7402, + "end": 7413, "loc": { "start": { "line": 215, @@ -45485,8 +46547,8 @@ "updateContext": null }, "value": "===", - "start": 7328, - "end": 7331, + "start": 7414, + "end": 7417, "loc": { "start": { "line": 215, @@ -45511,8 +46573,8 @@ "binop": null }, "value": "MOUSE_FIRST_CLICK_EXPECTED", - "start": 7332, - "end": 7358, + "start": 7418, + "end": 7444, "loc": { "start": { "line": 215, @@ -45536,8 +46598,8 @@ "postfix": false, "binop": null }, - "start": 7358, - "end": 7359, + "start": 7444, + "end": 7445, "loc": { "start": { "line": 215, @@ -45561,8 +46623,8 @@ "postfix": false, "binop": null }, - "start": 7360, - "end": 7361, + "start": 7446, + "end": 7447, "loc": { "start": { "line": 215, @@ -45589,8 +46651,8 @@ "updateContext": null }, "value": "if", - "start": 7383, - "end": 7385, + "start": 7469, + "end": 7471, "loc": { "start": { "line": 217, @@ -45614,8 +46676,8 @@ "postfix": false, "binop": null }, - "start": 7386, - "end": 7387, + "start": 7472, + "end": 7473, "loc": { "start": { "line": 217, @@ -45642,8 +46704,8 @@ "updateContext": null }, "value": "this", - "start": 7387, - "end": 7391, + "start": 7473, + "end": 7477, "loc": { "start": { "line": 217, @@ -45668,8 +46730,8 @@ "binop": null, "updateContext": null }, - "start": 7391, - "end": 7392, + "start": 7477, + "end": 7478, "loc": { "start": { "line": 217, @@ -45694,8 +46756,8 @@ "binop": null }, "value": "_canvasToPagePos", - "start": 7392, - "end": 7408, + "start": 7478, + "end": 7494, "loc": { "start": { "line": 217, @@ -45719,8 +46781,8 @@ "postfix": false, "binop": null }, - "start": 7408, - "end": 7409, + "start": 7494, + "end": 7495, "loc": { "start": { "line": 217, @@ -45744,8 +46806,8 @@ "postfix": false, "binop": null }, - "start": 7410, - "end": 7411, + "start": 7496, + "end": 7497, "loc": { "start": { "line": 217, @@ -45772,8 +46834,8 @@ "updateContext": null }, "value": "this", - "start": 7436, - "end": 7440, + "start": 7522, + "end": 7526, "loc": { "start": { "line": 218, @@ -45798,8 +46860,8 @@ "binop": null, "updateContext": null }, - "start": 7440, - "end": 7441, + "start": 7526, + "end": 7527, "loc": { "start": { "line": 218, @@ -45824,8 +46886,8 @@ "binop": null }, "value": "_canvasToPagePos", - "start": 7441, - "end": 7457, + "start": 7527, + "end": 7543, "loc": { "start": { "line": 218, @@ -45849,8 +46911,8 @@ "postfix": false, "binop": null }, - "start": 7457, - "end": 7458, + "start": 7543, + "end": 7544, "loc": { "start": { "line": 218, @@ -45875,8 +46937,8 @@ "binop": null }, "value": "canvas", - "start": 7458, - "end": 7464, + "start": 7544, + "end": 7550, "loc": { "start": { "line": 218, @@ -45901,8 +46963,8 @@ "binop": null, "updateContext": null }, - "start": 7464, - "end": 7465, + "start": 7550, + "end": 7551, "loc": { "start": { "line": 218, @@ -45927,8 +46989,8 @@ "binop": null }, "value": "canvasPos", - "start": 7466, - "end": 7475, + "start": 7552, + "end": 7561, "loc": { "start": { "line": 218, @@ -45953,8 +47015,8 @@ "binop": null, "updateContext": null }, - "start": 7475, - "end": 7476, + "start": 7561, + "end": 7562, "loc": { "start": { "line": 218, @@ -45979,8 +47041,8 @@ "binop": null }, "value": "pagePos", - "start": 7477, - "end": 7484, + "start": 7563, + "end": 7570, "loc": { "start": { "line": 218, @@ -46004,8 +47066,8 @@ "postfix": false, "binop": null }, - "start": 7484, - "end": 7485, + "start": 7570, + "end": 7571, "loc": { "start": { "line": 218, @@ -46030,8 +47092,8 @@ "binop": null, "updateContext": null }, - "start": 7485, - "end": 7486, + "start": 7571, + "end": 7572, "loc": { "start": { "line": 218, @@ -46058,8 +47120,8 @@ "updateContext": null }, "value": "this", - "start": 7511, - "end": 7515, + "start": 7597, + "end": 7601, "loc": { "start": { "line": 219, @@ -46084,8 +47146,8 @@ "binop": null, "updateContext": null }, - "start": 7515, - "end": 7516, + "start": 7601, + "end": 7602, "loc": { "start": { "line": 219, @@ -46110,8 +47172,8 @@ "binop": null }, "value": "_markerDiv", - "start": 7516, - "end": 7526, + "start": 7602, + "end": 7612, "loc": { "start": { "line": 219, @@ -46136,8 +47198,8 @@ "binop": null, "updateContext": null }, - "start": 7526, - "end": 7527, + "start": 7612, + "end": 7613, "loc": { "start": { "line": 219, @@ -46162,8 +47224,8 @@ "binop": null }, "value": "style", - "start": 7527, - "end": 7532, + "start": 7613, + "end": 7618, "loc": { "start": { "line": 219, @@ -46188,8 +47250,8 @@ "binop": null, "updateContext": null }, - "start": 7532, - "end": 7533, + "start": 7618, + "end": 7619, "loc": { "start": { "line": 219, @@ -46214,8 +47276,8 @@ "binop": null }, "value": "left", - "start": 7533, - "end": 7537, + "start": 7619, + "end": 7623, "loc": { "start": { "line": 219, @@ -46241,8 +47303,8 @@ "updateContext": null }, "value": "=", - "start": 7538, - "end": 7539, + "start": 7624, + "end": 7625, "loc": { "start": { "line": 219, @@ -46266,8 +47328,8 @@ "postfix": false, "binop": null }, - "start": 7540, - "end": 7541, + "start": 7626, + "end": 7627, "loc": { "start": { "line": 219, @@ -46293,8 +47355,8 @@ "updateContext": null }, "value": "", - "start": 7541, - "end": 7541, + "start": 7627, + "end": 7627, "loc": { "start": { "line": 219, @@ -46318,8 +47380,8 @@ "postfix": false, "binop": null }, - "start": 7541, - "end": 7543, + "start": 7627, + "end": 7629, "loc": { "start": { "line": 219, @@ -46344,8 +47406,8 @@ "binop": null }, "value": "pagePos", - "start": 7543, - "end": 7550, + "start": 7629, + "end": 7636, "loc": { "start": { "line": 219, @@ -46370,8 +47432,8 @@ "binop": null, "updateContext": null }, - "start": 7550, - "end": 7551, + "start": 7636, + "end": 7637, "loc": { "start": { "line": 219, @@ -46397,8 +47459,8 @@ "updateContext": null }, "value": 0, - "start": 7551, - "end": 7552, + "start": 7637, + "end": 7638, "loc": { "start": { "line": 219, @@ -46423,8 +47485,8 @@ "binop": null, "updateContext": null }, - "start": 7552, - "end": 7553, + "start": 7638, + "end": 7639, "loc": { "start": { "line": 219, @@ -46450,8 +47512,8 @@ "updateContext": null }, "value": "-", - "start": 7554, - "end": 7555, + "start": 7640, + "end": 7641, "loc": { "start": { "line": 219, @@ -46477,8 +47539,8 @@ "updateContext": null }, "value": 5, - "start": 7556, - "end": 7557, + "start": 7642, + "end": 7643, "loc": { "start": { "line": 219, @@ -46502,8 +47564,8 @@ "postfix": false, "binop": null }, - "start": 7557, - "end": 7558, + "start": 7643, + "end": 7644, "loc": { "start": { "line": 219, @@ -46529,8 +47591,8 @@ "updateContext": null }, "value": "px", - "start": 7558, - "end": 7560, + "start": 7644, + "end": 7646, "loc": { "start": { "line": 219, @@ -46554,8 +47616,8 @@ "postfix": false, "binop": null }, - "start": 7560, - "end": 7561, + "start": 7646, + "end": 7647, "loc": { "start": { "line": 219, @@ -46580,8 +47642,8 @@ "binop": null, "updateContext": null }, - "start": 7561, - "end": 7562, + "start": 7647, + "end": 7648, "loc": { "start": { "line": 219, @@ -46608,8 +47670,8 @@ "updateContext": null }, "value": "this", - "start": 7587, - "end": 7591, + "start": 7673, + "end": 7677, "loc": { "start": { "line": 220, @@ -46634,8 +47696,8 @@ "binop": null, "updateContext": null }, - "start": 7591, - "end": 7592, + "start": 7677, + "end": 7678, "loc": { "start": { "line": 220, @@ -46660,8 +47722,8 @@ "binop": null }, "value": "_markerDiv", - "start": 7592, - "end": 7602, + "start": 7678, + "end": 7688, "loc": { "start": { "line": 220, @@ -46686,8 +47748,8 @@ "binop": null, "updateContext": null }, - "start": 7602, - "end": 7603, + "start": 7688, + "end": 7689, "loc": { "start": { "line": 220, @@ -46712,8 +47774,8 @@ "binop": null }, "value": "style", - "start": 7603, - "end": 7608, + "start": 7689, + "end": 7694, "loc": { "start": { "line": 220, @@ -46738,8 +47800,8 @@ "binop": null, "updateContext": null }, - "start": 7608, - "end": 7609, + "start": 7694, + "end": 7695, "loc": { "start": { "line": 220, @@ -46764,8 +47826,8 @@ "binop": null }, "value": "top", - "start": 7609, - "end": 7612, + "start": 7695, + "end": 7698, "loc": { "start": { "line": 220, @@ -46791,8 +47853,8 @@ "updateContext": null }, "value": "=", - "start": 7613, - "end": 7614, + "start": 7699, + "end": 7700, "loc": { "start": { "line": 220, @@ -46816,8 +47878,8 @@ "postfix": false, "binop": null }, - "start": 7615, - "end": 7616, + "start": 7701, + "end": 7702, "loc": { "start": { "line": 220, @@ -46843,8 +47905,8 @@ "updateContext": null }, "value": "", - "start": 7616, - "end": 7616, + "start": 7702, + "end": 7702, "loc": { "start": { "line": 220, @@ -46868,8 +47930,8 @@ "postfix": false, "binop": null }, - "start": 7616, - "end": 7618, + "start": 7702, + "end": 7704, "loc": { "start": { "line": 220, @@ -46894,8 +47956,8 @@ "binop": null }, "value": "pagePos", - "start": 7618, - "end": 7625, + "start": 7704, + "end": 7711, "loc": { "start": { "line": 220, @@ -46920,8 +47982,8 @@ "binop": null, "updateContext": null }, - "start": 7625, - "end": 7626, + "start": 7711, + "end": 7712, "loc": { "start": { "line": 220, @@ -46947,8 +48009,8 @@ "updateContext": null }, "value": 1, - "start": 7626, - "end": 7627, + "start": 7712, + "end": 7713, "loc": { "start": { "line": 220, @@ -46973,8 +48035,8 @@ "binop": null, "updateContext": null }, - "start": 7627, - "end": 7628, + "start": 7713, + "end": 7714, "loc": { "start": { "line": 220, @@ -47000,8 +48062,8 @@ "updateContext": null }, "value": "-", - "start": 7629, - "end": 7630, + "start": 7715, + "end": 7716, "loc": { "start": { "line": 220, @@ -47027,8 +48089,8 @@ "updateContext": null }, "value": 5, - "start": 7631, - "end": 7632, + "start": 7717, + "end": 7718, "loc": { "start": { "line": 220, @@ -47052,8 +48114,8 @@ "postfix": false, "binop": null }, - "start": 7632, - "end": 7633, + "start": 7718, + "end": 7719, "loc": { "start": { "line": 220, @@ -47079,8 +48141,8 @@ "updateContext": null }, "value": "px", - "start": 7633, - "end": 7635, + "start": 7719, + "end": 7721, "loc": { "start": { "line": 220, @@ -47104,8 +48166,8 @@ "postfix": false, "binop": null }, - "start": 7635, - "end": 7636, + "start": 7721, + "end": 7722, "loc": { "start": { "line": 220, @@ -47130,8 +48192,8 @@ "binop": null, "updateContext": null }, - "start": 7636, - "end": 7637, + "start": 7722, + "end": 7723, "loc": { "start": { "line": 220, @@ -47155,8 +48217,8 @@ "postfix": false, "binop": null }, - "start": 7658, - "end": 7659, + "start": 7744, + "end": 7745, "loc": { "start": { "line": 221, @@ -47183,8 +48245,8 @@ "updateContext": null }, "value": "else", - "start": 7660, - "end": 7664, + "start": 7746, + "end": 7750, "loc": { "start": { "line": 221, @@ -47208,8 +48270,8 @@ "postfix": false, "binop": null }, - "start": 7665, - "end": 7666, + "start": 7751, + "end": 7752, "loc": { "start": { "line": 221, @@ -47236,8 +48298,8 @@ "updateContext": null }, "value": "this", - "start": 7691, - "end": 7695, + "start": 7777, + "end": 7781, "loc": { "start": { "line": 222, @@ -47262,8 +48324,8 @@ "binop": null, "updateContext": null }, - "start": 7695, - "end": 7696, + "start": 7781, + "end": 7782, "loc": { "start": { "line": 222, @@ -47288,8 +48350,8 @@ "binop": null }, "value": "_markerDiv", - "start": 7696, - "end": 7706, + "start": 7782, + "end": 7792, "loc": { "start": { "line": 222, @@ -47314,8 +48376,8 @@ "binop": null, "updateContext": null }, - "start": 7706, - "end": 7707, + "start": 7792, + "end": 7793, "loc": { "start": { "line": 222, @@ -47340,8 +48402,8 @@ "binop": null }, "value": "style", - "start": 7707, - "end": 7712, + "start": 7793, + "end": 7798, "loc": { "start": { "line": 222, @@ -47366,8 +48428,8 @@ "binop": null, "updateContext": null }, - "start": 7712, - "end": 7713, + "start": 7798, + "end": 7799, "loc": { "start": { "line": 222, @@ -47392,8 +48454,8 @@ "binop": null }, "value": "left", - "start": 7713, - "end": 7717, + "start": 7799, + "end": 7803, "loc": { "start": { "line": 222, @@ -47419,8 +48481,8 @@ "updateContext": null }, "value": "=", - "start": 7718, - "end": 7719, + "start": 7804, + "end": 7805, "loc": { "start": { "line": 222, @@ -47444,8 +48506,8 @@ "postfix": false, "binop": null }, - "start": 7720, - "end": 7721, + "start": 7806, + "end": 7807, "loc": { "start": { "line": 222, @@ -47471,8 +48533,8 @@ "updateContext": null }, "value": "", - "start": 7721, - "end": 7721, + "start": 7807, + "end": 7807, "loc": { "start": { "line": 222, @@ -47496,8 +48558,8 @@ "postfix": false, "binop": null }, - "start": 7721, - "end": 7723, + "start": 7807, + "end": 7809, "loc": { "start": { "line": 222, @@ -47522,8 +48584,8 @@ "binop": null }, "value": "getLeft", - "start": 7723, - "end": 7730, + "start": 7809, + "end": 7816, "loc": { "start": { "line": 222, @@ -47547,8 +48609,8 @@ "postfix": false, "binop": null }, - "start": 7730, - "end": 7731, + "start": 7816, + "end": 7817, "loc": { "start": { "line": 222, @@ -47573,8 +48635,8 @@ "binop": null }, "value": "canvas", - "start": 7731, - "end": 7737, + "start": 7817, + "end": 7823, "loc": { "start": { "line": 222, @@ -47598,8 +48660,8 @@ "postfix": false, "binop": null }, - "start": 7737, - "end": 7738, + "start": 7823, + "end": 7824, "loc": { "start": { "line": 222, @@ -47625,8 +48687,8 @@ "updateContext": null }, "value": "+", - "start": 7739, - "end": 7740, + "start": 7825, + "end": 7826, "loc": { "start": { "line": 222, @@ -47651,8 +48713,8 @@ "binop": null }, "value": "canvasPos", - "start": 7741, - "end": 7750, + "start": 7827, + "end": 7836, "loc": { "start": { "line": 222, @@ -47677,8 +48739,8 @@ "binop": null, "updateContext": null }, - "start": 7750, - "end": 7751, + "start": 7836, + "end": 7837, "loc": { "start": { "line": 222, @@ -47704,8 +48766,8 @@ "updateContext": null }, "value": 0, - "start": 7751, - "end": 7752, + "start": 7837, + "end": 7838, "loc": { "start": { "line": 222, @@ -47730,8 +48792,8 @@ "binop": null, "updateContext": null }, - "start": 7752, - "end": 7753, + "start": 7838, + "end": 7839, "loc": { "start": { "line": 222, @@ -47757,8 +48819,8 @@ "updateContext": null }, "value": "-", - "start": 7754, - "end": 7755, + "start": 7840, + "end": 7841, "loc": { "start": { "line": 222, @@ -47784,8 +48846,8 @@ "updateContext": null }, "value": 5, - "start": 7756, - "end": 7757, + "start": 7842, + "end": 7843, "loc": { "start": { "line": 222, @@ -47809,8 +48871,8 @@ "postfix": false, "binop": null }, - "start": 7757, - "end": 7758, + "start": 7843, + "end": 7844, "loc": { "start": { "line": 222, @@ -47836,8 +48898,8 @@ "updateContext": null }, "value": "px", - "start": 7758, - "end": 7760, + "start": 7844, + "end": 7846, "loc": { "start": { "line": 222, @@ -47861,8 +48923,8 @@ "postfix": false, "binop": null }, - "start": 7760, - "end": 7761, + "start": 7846, + "end": 7847, "loc": { "start": { "line": 222, @@ -47887,8 +48949,8 @@ "binop": null, "updateContext": null }, - "start": 7761, - "end": 7762, + "start": 7847, + "end": 7848, "loc": { "start": { "line": 222, @@ -47915,8 +48977,8 @@ "updateContext": null }, "value": "this", - "start": 7787, - "end": 7791, + "start": 7873, + "end": 7877, "loc": { "start": { "line": 223, @@ -47941,8 +49003,8 @@ "binop": null, "updateContext": null }, - "start": 7791, - "end": 7792, + "start": 7877, + "end": 7878, "loc": { "start": { "line": 223, @@ -47967,8 +49029,8 @@ "binop": null }, "value": "_markerDiv", - "start": 7792, - "end": 7802, + "start": 7878, + "end": 7888, "loc": { "start": { "line": 223, @@ -47993,8 +49055,8 @@ "binop": null, "updateContext": null }, - "start": 7802, - "end": 7803, + "start": 7888, + "end": 7889, "loc": { "start": { "line": 223, @@ -48019,8 +49081,8 @@ "binop": null }, "value": "style", - "start": 7803, - "end": 7808, + "start": 7889, + "end": 7894, "loc": { "start": { "line": 223, @@ -48045,8 +49107,8 @@ "binop": null, "updateContext": null }, - "start": 7808, - "end": 7809, + "start": 7894, + "end": 7895, "loc": { "start": { "line": 223, @@ -48071,8 +49133,8 @@ "binop": null }, "value": "top", - "start": 7809, - "end": 7812, + "start": 7895, + "end": 7898, "loc": { "start": { "line": 223, @@ -48098,8 +49160,8 @@ "updateContext": null }, "value": "=", - "start": 7813, - "end": 7814, + "start": 7899, + "end": 7900, "loc": { "start": { "line": 223, @@ -48123,8 +49185,8 @@ "postfix": false, "binop": null }, - "start": 7815, - "end": 7816, + "start": 7901, + "end": 7902, "loc": { "start": { "line": 223, @@ -48150,8 +49212,8 @@ "updateContext": null }, "value": "", - "start": 7816, - "end": 7816, + "start": 7902, + "end": 7902, "loc": { "start": { "line": 223, @@ -48175,8 +49237,8 @@ "postfix": false, "binop": null }, - "start": 7816, - "end": 7818, + "start": 7902, + "end": 7904, "loc": { "start": { "line": 223, @@ -48201,8 +49263,8 @@ "binop": null }, "value": "getTop", - "start": 7818, - "end": 7824, + "start": 7904, + "end": 7910, "loc": { "start": { "line": 223, @@ -48226,8 +49288,8 @@ "postfix": false, "binop": null }, - "start": 7824, - "end": 7825, + "start": 7910, + "end": 7911, "loc": { "start": { "line": 223, @@ -48252,8 +49314,8 @@ "binop": null }, "value": "canvas", - "start": 7825, - "end": 7831, + "start": 7911, + "end": 7917, "loc": { "start": { "line": 223, @@ -48277,8 +49339,8 @@ "postfix": false, "binop": null }, - "start": 7831, - "end": 7832, + "start": 7917, + "end": 7918, "loc": { "start": { "line": 223, @@ -48304,8 +49366,8 @@ "updateContext": null }, "value": "+", - "start": 7833, - "end": 7834, + "start": 7919, + "end": 7920, "loc": { "start": { "line": 223, @@ -48330,8 +49392,8 @@ "binop": null }, "value": "canvasPos", - "start": 7835, - "end": 7844, + "start": 7921, + "end": 7930, "loc": { "start": { "line": 223, @@ -48356,8 +49418,8 @@ "binop": null, "updateContext": null }, - "start": 7844, - "end": 7845, + "start": 7930, + "end": 7931, "loc": { "start": { "line": 223, @@ -48383,8 +49445,8 @@ "updateContext": null }, "value": 1, - "start": 7845, - "end": 7846, + "start": 7931, + "end": 7932, "loc": { "start": { "line": 223, @@ -48409,8 +49471,8 @@ "binop": null, "updateContext": null }, - "start": 7846, - "end": 7847, + "start": 7932, + "end": 7933, "loc": { "start": { "line": 223, @@ -48436,8 +49498,8 @@ "updateContext": null }, "value": "-", - "start": 7848, - "end": 7849, + "start": 7934, + "end": 7935, "loc": { "start": { "line": 223, @@ -48463,8 +49525,8 @@ "updateContext": null }, "value": 5, - "start": 7850, - "end": 7851, + "start": 7936, + "end": 7937, "loc": { "start": { "line": 223, @@ -48488,8 +49550,8 @@ "postfix": false, "binop": null }, - "start": 7851, - "end": 7852, + "start": 7937, + "end": 7938, "loc": { "start": { "line": 223, @@ -48515,8 +49577,8 @@ "updateContext": null }, "value": "px", - "start": 7852, - "end": 7854, + "start": 7938, + "end": 7940, "loc": { "start": { "line": 223, @@ -48540,8 +49602,8 @@ "postfix": false, "binop": null }, - "start": 7854, - "end": 7855, + "start": 7940, + "end": 7941, "loc": { "start": { "line": 223, @@ -48566,8 +49628,8 @@ "binop": null, "updateContext": null }, - "start": 7855, - "end": 7856, + "start": 7941, + "end": 7942, "loc": { "start": { "line": 223, @@ -48591,8 +49653,8 @@ "postfix": false, "binop": null }, - "start": 7877, - "end": 7878, + "start": 7963, + "end": 7964, "loc": { "start": { "line": 224, @@ -48619,8 +49681,8 @@ "updateContext": null }, "value": "this", - "start": 7900, - "end": 7904, + "start": 7986, + "end": 7990, "loc": { "start": { "line": 226, @@ -48645,8 +49707,8 @@ "binop": null, "updateContext": null }, - "start": 7904, - "end": 7905, + "start": 7990, + "end": 7991, "loc": { "start": { "line": 226, @@ -48671,8 +49733,8 @@ "binop": null }, "value": "_markerDiv", - "start": 7905, - "end": 7915, + "start": 7991, + "end": 8001, "loc": { "start": { "line": 226, @@ -48697,8 +49759,8 @@ "binop": null, "updateContext": null }, - "start": 7915, - "end": 7916, + "start": 8001, + "end": 8002, "loc": { "start": { "line": 226, @@ -48723,8 +49785,8 @@ "binop": null }, "value": "style", - "start": 7916, - "end": 7921, + "start": 8002, + "end": 8007, "loc": { "start": { "line": 226, @@ -48749,8 +49811,8 @@ "binop": null, "updateContext": null }, - "start": 7921, - "end": 7922, + "start": 8007, + "end": 8008, "loc": { "start": { "line": 226, @@ -48775,8 +49837,8 @@ "binop": null }, "value": "background", - "start": 7922, - "end": 7932, + "start": 8008, + "end": 8018, "loc": { "start": { "line": 226, @@ -48802,8 +49864,8 @@ "updateContext": null }, "value": "=", - "start": 7933, - "end": 7934, + "start": 8019, + "end": 8020, "loc": { "start": { "line": 226, @@ -48829,8 +49891,8 @@ "updateContext": null }, "value": "pink", - "start": 7935, - "end": 7941, + "start": 8021, + "end": 8027, "loc": { "start": { "line": 226, @@ -48855,8 +49917,8 @@ "binop": null, "updateContext": null }, - "start": 7941, - "end": 7942, + "start": 8027, + "end": 8028, "loc": { "start": { "line": 226, @@ -48883,8 +49945,8 @@ "updateContext": null }, "value": "if", - "start": 7963, - "end": 7965, + "start": 8049, + "end": 8051, "loc": { "start": { "line": 227, @@ -48908,8 +49970,8 @@ "postfix": false, "binop": null }, - "start": 7966, - "end": 7967, + "start": 8052, + "end": 8053, "loc": { "start": { "line": 227, @@ -48934,8 +49996,8 @@ "binop": null }, "value": "event", - "start": 7967, - "end": 7972, + "start": 8053, + "end": 8058, "loc": { "start": { "line": 227, @@ -48960,8 +50022,8 @@ "binop": null, "updateContext": null }, - "start": 7972, - "end": 7973, + "start": 8058, + "end": 8059, "loc": { "start": { "line": 227, @@ -48986,8 +50048,8 @@ "binop": null }, "value": "snappedToVertex", - "start": 7973, - "end": 7988, + "start": 8059, + "end": 8074, "loc": { "start": { "line": 227, @@ -49013,8 +50075,8 @@ "updateContext": null }, "value": "||", - "start": 7989, - "end": 7991, + "start": 8075, + "end": 8077, "loc": { "start": { "line": 227, @@ -49039,8 +50101,8 @@ "binop": null }, "value": "event", - "start": 7992, - "end": 7997, + "start": 8078, + "end": 8083, "loc": { "start": { "line": 227, @@ -49065,8 +50127,8 @@ "binop": null, "updateContext": null }, - "start": 7997, - "end": 7998, + "start": 8083, + "end": 8084, "loc": { "start": { "line": 227, @@ -49091,8 +50153,8 @@ "binop": null }, "value": "snappedToEdge", - "start": 7998, - "end": 8011, + "start": 8084, + "end": 8097, "loc": { "start": { "line": 227, @@ -49116,8 +50178,8 @@ "postfix": false, "binop": null }, - "start": 8011, - "end": 8012, + "start": 8097, + "end": 8098, "loc": { "start": { "line": 227, @@ -49141,8 +50203,8 @@ "postfix": false, "binop": null }, - "start": 8013, - "end": 8014, + "start": 8099, + "end": 8100, "loc": { "start": { "line": 227, @@ -49169,8 +50231,8 @@ "updateContext": null }, "value": "if", - "start": 8039, - "end": 8041, + "start": 8125, + "end": 8127, "loc": { "start": { "line": 228, @@ -49194,8 +50256,8 @@ "postfix": false, "binop": null }, - "start": 8042, - "end": 8043, + "start": 8128, + "end": 8129, "loc": { "start": { "line": 228, @@ -49222,8 +50284,8 @@ "updateContext": null }, "value": "this", - "start": 8043, - "end": 8047, + "start": 8129, + "end": 8133, "loc": { "start": { "line": 228, @@ -49248,8 +50310,8 @@ "binop": null, "updateContext": null }, - "start": 8047, - "end": 8048, + "start": 8133, + "end": 8134, "loc": { "start": { "line": 228, @@ -49274,8 +50336,8 @@ "binop": null }, "value": "pointerLens", - "start": 8048, - "end": 8059, + "start": 8134, + "end": 8145, "loc": { "start": { "line": 228, @@ -49299,8 +50361,8 @@ "postfix": false, "binop": null }, - "start": 8059, - "end": 8060, + "start": 8145, + "end": 8146, "loc": { "start": { "line": 228, @@ -49324,8 +50386,8 @@ "postfix": false, "binop": null }, - "start": 8061, - "end": 8062, + "start": 8147, + "end": 8148, "loc": { "start": { "line": 228, @@ -49352,8 +50414,8 @@ "updateContext": null }, "value": "this", - "start": 8091, - "end": 8095, + "start": 8177, + "end": 8181, "loc": { "start": { "line": 229, @@ -49378,8 +50440,8 @@ "binop": null, "updateContext": null }, - "start": 8095, - "end": 8096, + "start": 8181, + "end": 8182, "loc": { "start": { "line": 229, @@ -49404,8 +50466,8 @@ "binop": null }, "value": "pointerLens", - "start": 8096, - "end": 8107, + "start": 8182, + "end": 8193, "loc": { "start": { "line": 229, @@ -49430,8 +50492,8 @@ "binop": null, "updateContext": null }, - "start": 8107, - "end": 8108, + "start": 8193, + "end": 8194, "loc": { "start": { "line": 229, @@ -49456,8 +50518,8 @@ "binop": null }, "value": "visible", - "start": 8108, - "end": 8115, + "start": 8194, + "end": 8201, "loc": { "start": { "line": 229, @@ -49483,8 +50545,8 @@ "updateContext": null }, "value": "=", - "start": 8116, - "end": 8117, + "start": 8202, + "end": 8203, "loc": { "start": { "line": 229, @@ -49511,8 +50573,8 @@ "updateContext": null }, "value": "true", - "start": 8118, - "end": 8122, + "start": 8204, + "end": 8208, "loc": { "start": { "line": 229, @@ -49537,8 +50599,8 @@ "binop": null, "updateContext": null }, - "start": 8122, - "end": 8123, + "start": 8208, + "end": 8209, "loc": { "start": { "line": 229, @@ -49565,8 +50627,8 @@ "updateContext": null }, "value": "this", - "start": 8152, - "end": 8156, + "start": 8238, + "end": 8242, "loc": { "start": { "line": 230, @@ -49591,8 +50653,8 @@ "binop": null, "updateContext": null }, - "start": 8156, - "end": 8157, + "start": 8242, + "end": 8243, "loc": { "start": { "line": 230, @@ -49617,8 +50679,8 @@ "binop": null }, "value": "pointerLens", - "start": 8157, - "end": 8168, + "start": 8243, + "end": 8254, "loc": { "start": { "line": 230, @@ -49643,8 +50705,8 @@ "binop": null, "updateContext": null }, - "start": 8168, - "end": 8169, + "start": 8254, + "end": 8255, "loc": { "start": { "line": 230, @@ -49669,8 +50731,8 @@ "binop": null }, "value": "canvasPos", - "start": 8169, - "end": 8178, + "start": 8255, + "end": 8264, "loc": { "start": { "line": 230, @@ -49696,8 +50758,8 @@ "updateContext": null }, "value": "=", - "start": 8179, - "end": 8180, + "start": 8265, + "end": 8266, "loc": { "start": { "line": 230, @@ -49722,8 +50784,8 @@ "binop": null }, "value": "event", - "start": 8181, - "end": 8186, + "start": 8267, + "end": 8272, "loc": { "start": { "line": 230, @@ -49748,8 +50810,8 @@ "binop": null, "updateContext": null }, - "start": 8186, - "end": 8187, + "start": 8272, + "end": 8273, "loc": { "start": { "line": 230, @@ -49774,8 +50836,8 @@ "binop": null }, "value": "canvasPos", - "start": 8187, - "end": 8196, + "start": 8273, + "end": 8282, "loc": { "start": { "line": 230, @@ -49800,8 +50862,8 @@ "binop": null, "updateContext": null }, - "start": 8196, - "end": 8197, + "start": 8282, + "end": 8283, "loc": { "start": { "line": 230, @@ -49828,8 +50890,8 @@ "updateContext": null }, "value": "this", - "start": 8226, - "end": 8230, + "start": 8312, + "end": 8316, "loc": { "start": { "line": 231, @@ -49854,8 +50916,8 @@ "binop": null, "updateContext": null }, - "start": 8230, - "end": 8231, + "start": 8316, + "end": 8317, "loc": { "start": { "line": 231, @@ -49880,8 +50942,8 @@ "binop": null }, "value": "pointerLens", - "start": 8231, - "end": 8242, + "start": 8317, + "end": 8328, "loc": { "start": { "line": 231, @@ -49906,8 +50968,8 @@ "binop": null, "updateContext": null }, - "start": 8242, - "end": 8243, + "start": 8328, + "end": 8329, "loc": { "start": { "line": 231, @@ -49932,8 +50994,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 8243, - "end": 8259, + "start": 8329, + "end": 8345, "loc": { "start": { "line": 231, @@ -49959,8 +51021,8 @@ "updateContext": null }, "value": "=", - "start": 8260, - "end": 8261, + "start": 8346, + "end": 8347, "loc": { "start": { "line": 231, @@ -49985,8 +51047,8 @@ "binop": null }, "value": "event", - "start": 8262, - "end": 8267, + "start": 8348, + "end": 8353, "loc": { "start": { "line": 231, @@ -50011,8 +51073,8 @@ "binop": null, "updateContext": null }, - "start": 8267, - "end": 8268, + "start": 8353, + "end": 8354, "loc": { "start": { "line": 231, @@ -50037,8 +51099,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 8268, - "end": 8284, + "start": 8354, + "end": 8370, "loc": { "start": { "line": 231, @@ -50064,8 +51126,8 @@ "updateContext": null }, "value": "||", - "start": 8285, - "end": 8287, + "start": 8371, + "end": 8373, "loc": { "start": { "line": 231, @@ -50090,8 +51152,8 @@ "binop": null }, "value": "event", - "start": 8288, - "end": 8293, + "start": 8374, + "end": 8379, "loc": { "start": { "line": 231, @@ -50116,8 +51178,8 @@ "binop": null, "updateContext": null }, - "start": 8293, - "end": 8294, + "start": 8379, + "end": 8380, "loc": { "start": { "line": 231, @@ -50142,8 +51204,8 @@ "binop": null }, "value": "canvasPos", - "start": 8294, - "end": 8303, + "start": 8380, + "end": 8389, "loc": { "start": { "line": 231, @@ -50168,8 +51230,8 @@ "binop": null, "updateContext": null }, - "start": 8303, - "end": 8304, + "start": 8389, + "end": 8390, "loc": { "start": { "line": 231, @@ -50196,8 +51258,8 @@ "updateContext": null }, "value": "this", - "start": 8333, - "end": 8337, + "start": 8419, + "end": 8423, "loc": { "start": { "line": 232, @@ -50222,8 +51284,8 @@ "binop": null, "updateContext": null }, - "start": 8337, - "end": 8338, + "start": 8423, + "end": 8424, "loc": { "start": { "line": 232, @@ -50248,8 +51310,8 @@ "binop": null }, "value": "pointerLens", - "start": 8338, - "end": 8349, + "start": 8424, + "end": 8435, "loc": { "start": { "line": 232, @@ -50274,8 +51336,8 @@ "binop": null, "updateContext": null }, - "start": 8349, - "end": 8350, + "start": 8435, + "end": 8436, "loc": { "start": { "line": 232, @@ -50300,8 +51362,8 @@ "binop": null }, "value": "snapped", - "start": 8350, - "end": 8357, + "start": 8436, + "end": 8443, "loc": { "start": { "line": 232, @@ -50327,8 +51389,8 @@ "updateContext": null }, "value": "=", - "start": 8358, - "end": 8359, + "start": 8444, + "end": 8445, "loc": { "start": { "line": 232, @@ -50355,8 +51417,8 @@ "updateContext": null }, "value": "true", - "start": 8360, - "end": 8364, + "start": 8446, + "end": 8450, "loc": { "start": { "line": 232, @@ -50381,8 +51443,8 @@ "binop": null, "updateContext": null }, - "start": 8364, - "end": 8365, + "start": 8450, + "end": 8451, "loc": { "start": { "line": 232, @@ -50406,8 +51468,8 @@ "postfix": false, "binop": null }, - "start": 8390, - "end": 8391, + "start": 8476, + "end": 8477, "loc": { "start": { "line": 233, @@ -50434,8 +51496,8 @@ "updateContext": null }, "value": "this", - "start": 8416, - "end": 8420, + "start": 8502, + "end": 8506, "loc": { "start": { "line": 234, @@ -50460,8 +51522,8 @@ "binop": null, "updateContext": null }, - "start": 8420, - "end": 8421, + "start": 8506, + "end": 8507, "loc": { "start": { "line": 234, @@ -50486,8 +51548,8 @@ "binop": null }, "value": "_markerDiv", - "start": 8421, - "end": 8431, + "start": 8507, + "end": 8517, "loc": { "start": { "line": 234, @@ -50512,8 +51574,8 @@ "binop": null, "updateContext": null }, - "start": 8431, - "end": 8432, + "start": 8517, + "end": 8518, "loc": { "start": { "line": 234, @@ -50538,8 +51600,8 @@ "binop": null }, "value": "style", - "start": 8432, - "end": 8437, + "start": 8518, + "end": 8523, "loc": { "start": { "line": 234, @@ -50564,8 +51626,8 @@ "binop": null, "updateContext": null }, - "start": 8437, - "end": 8438, + "start": 8523, + "end": 8524, "loc": { "start": { "line": 234, @@ -50590,8 +51652,8 @@ "binop": null }, "value": "background", - "start": 8438, - "end": 8448, + "start": 8524, + "end": 8534, "loc": { "start": { "line": 234, @@ -50617,8 +51679,8 @@ "updateContext": null }, "value": "=", - "start": 8449, - "end": 8450, + "start": 8535, + "end": 8536, "loc": { "start": { "line": 234, @@ -50644,8 +51706,8 @@ "updateContext": null }, "value": "greenyellow", - "start": 8451, - "end": 8464, + "start": 8537, + "end": 8550, "loc": { "start": { "line": 234, @@ -50670,8 +51732,8 @@ "binop": null, "updateContext": null }, - "start": 8464, - "end": 8465, + "start": 8550, + "end": 8551, "loc": { "start": { "line": 234, @@ -50698,8 +51760,8 @@ "updateContext": null }, "value": "this", - "start": 8490, - "end": 8494, + "start": 8576, + "end": 8580, "loc": { "start": { "line": 235, @@ -50724,8 +51786,8 @@ "binop": null, "updateContext": null }, - "start": 8494, - "end": 8495, + "start": 8580, + "end": 8581, "loc": { "start": { "line": 235, @@ -50750,8 +51812,8 @@ "binop": null }, "value": "_markerDiv", - "start": 8495, - "end": 8505, + "start": 8581, + "end": 8591, "loc": { "start": { "line": 235, @@ -50776,8 +51838,8 @@ "binop": null, "updateContext": null }, - "start": 8505, - "end": 8506, + "start": 8591, + "end": 8592, "loc": { "start": { "line": 235, @@ -50802,8 +51864,8 @@ "binop": null }, "value": "style", - "start": 8506, - "end": 8511, + "start": 8592, + "end": 8597, "loc": { "start": { "line": 235, @@ -50828,8 +51890,8 @@ "binop": null, "updateContext": null }, - "start": 8511, - "end": 8512, + "start": 8597, + "end": 8598, "loc": { "start": { "line": 235, @@ -50854,8 +51916,8 @@ "binop": null }, "value": "border", - "start": 8512, - "end": 8518, + "start": 8598, + "end": 8604, "loc": { "start": { "line": 235, @@ -50881,8 +51943,8 @@ "updateContext": null }, "value": "=", - "start": 8519, - "end": 8520, + "start": 8605, + "end": 8606, "loc": { "start": { "line": 235, @@ -50908,8 +51970,8 @@ "updateContext": null }, "value": "2px solid green", - "start": 8521, - "end": 8538, + "start": 8607, + "end": 8624, "loc": { "start": { "line": 235, @@ -50934,8 +51996,8 @@ "binop": null, "updateContext": null }, - "start": 8538, - "end": 8539, + "start": 8624, + "end": 8625, "loc": { "start": { "line": 235, @@ -50959,8 +52021,8 @@ "postfix": false, "binop": null }, - "start": 8560, - "end": 8561, + "start": 8646, + "end": 8647, "loc": { "start": { "line": 236, @@ -50987,8 +52049,8 @@ "updateContext": null }, "value": "else", - "start": 8562, - "end": 8566, + "start": 8648, + "end": 8652, "loc": { "start": { "line": 236, @@ -51012,8 +52074,8 @@ "postfix": false, "binop": null }, - "start": 8567, - "end": 8568, + "start": 8653, + "end": 8654, "loc": { "start": { "line": 236, @@ -51040,8 +52102,8 @@ "updateContext": null }, "value": "if", - "start": 8593, - "end": 8595, + "start": 8679, + "end": 8681, "loc": { "start": { "line": 237, @@ -51065,8 +52127,8 @@ "postfix": false, "binop": null }, - "start": 8596, - "end": 8597, + "start": 8682, + "end": 8683, "loc": { "start": { "line": 237, @@ -51093,8 +52155,8 @@ "updateContext": null }, "value": "this", - "start": 8597, - "end": 8601, + "start": 8683, + "end": 8687, "loc": { "start": { "line": 237, @@ -51119,8 +52181,8 @@ "binop": null, "updateContext": null }, - "start": 8601, - "end": 8602, + "start": 8687, + "end": 8688, "loc": { "start": { "line": 237, @@ -51145,8 +52207,8 @@ "binop": null }, "value": "pointerLens", - "start": 8602, - "end": 8613, + "start": 8688, + "end": 8699, "loc": { "start": { "line": 237, @@ -51170,8 +52232,8 @@ "postfix": false, "binop": null }, - "start": 8613, - "end": 8614, + "start": 8699, + "end": 8700, "loc": { "start": { "line": 237, @@ -51195,8 +52257,8 @@ "postfix": false, "binop": null }, - "start": 8615, - "end": 8616, + "start": 8701, + "end": 8702, "loc": { "start": { "line": 237, @@ -51223,8 +52285,8 @@ "updateContext": null }, "value": "this", - "start": 8645, - "end": 8649, + "start": 8731, + "end": 8735, "loc": { "start": { "line": 238, @@ -51249,8 +52311,8 @@ "binop": null, "updateContext": null }, - "start": 8649, - "end": 8650, + "start": 8735, + "end": 8736, "loc": { "start": { "line": 238, @@ -51275,8 +52337,8 @@ "binop": null }, "value": "pointerLens", - "start": 8650, - "end": 8661, + "start": 8736, + "end": 8747, "loc": { "start": { "line": 238, @@ -51301,8 +52363,8 @@ "binop": null, "updateContext": null }, - "start": 8661, - "end": 8662, + "start": 8747, + "end": 8748, "loc": { "start": { "line": 238, @@ -51327,8 +52389,8 @@ "binop": null }, "value": "visible", - "start": 8662, - "end": 8669, + "start": 8748, + "end": 8755, "loc": { "start": { "line": 238, @@ -51354,8 +52416,8 @@ "updateContext": null }, "value": "=", - "start": 8670, - "end": 8671, + "start": 8756, + "end": 8757, "loc": { "start": { "line": 238, @@ -51382,8 +52444,8 @@ "updateContext": null }, "value": "true", - "start": 8672, - "end": 8676, + "start": 8758, + "end": 8762, "loc": { "start": { "line": 238, @@ -51408,8 +52470,8 @@ "binop": null, "updateContext": null }, - "start": 8676, - "end": 8677, + "start": 8762, + "end": 8763, "loc": { "start": { "line": 238, @@ -51436,8 +52498,8 @@ "updateContext": null }, "value": "this", - "start": 8706, - "end": 8710, + "start": 8792, + "end": 8796, "loc": { "start": { "line": 239, @@ -51462,8 +52524,8 @@ "binop": null, "updateContext": null }, - "start": 8710, - "end": 8711, + "start": 8796, + "end": 8797, "loc": { "start": { "line": 239, @@ -51488,8 +52550,8 @@ "binop": null }, "value": "pointerLens", - "start": 8711, - "end": 8722, + "start": 8797, + "end": 8808, "loc": { "start": { "line": 239, @@ -51514,8 +52576,8 @@ "binop": null, "updateContext": null }, - "start": 8722, - "end": 8723, + "start": 8808, + "end": 8809, "loc": { "start": { "line": 239, @@ -51540,8 +52602,8 @@ "binop": null }, "value": "canvasPos", - "start": 8723, - "end": 8732, + "start": 8809, + "end": 8818, "loc": { "start": { "line": 239, @@ -51567,8 +52629,8 @@ "updateContext": null }, "value": "=", - "start": 8733, - "end": 8734, + "start": 8819, + "end": 8820, "loc": { "start": { "line": 239, @@ -51593,8 +52655,8 @@ "binop": null }, "value": "event", - "start": 8735, - "end": 8740, + "start": 8821, + "end": 8826, "loc": { "start": { "line": 239, @@ -51619,8 +52681,8 @@ "binop": null, "updateContext": null }, - "start": 8740, - "end": 8741, + "start": 8826, + "end": 8827, "loc": { "start": { "line": 239, @@ -51645,8 +52707,8 @@ "binop": null }, "value": "canvasPos", - "start": 8741, - "end": 8750, + "start": 8827, + "end": 8836, "loc": { "start": { "line": 239, @@ -51671,8 +52733,8 @@ "binop": null, "updateContext": null }, - "start": 8750, - "end": 8751, + "start": 8836, + "end": 8837, "loc": { "start": { "line": 239, @@ -51699,8 +52761,8 @@ "updateContext": null }, "value": "this", - "start": 8780, - "end": 8784, + "start": 8866, + "end": 8870, "loc": { "start": { "line": 240, @@ -51725,8 +52787,8 @@ "binop": null, "updateContext": null }, - "start": 8784, - "end": 8785, + "start": 8870, + "end": 8871, "loc": { "start": { "line": 240, @@ -51751,8 +52813,8 @@ "binop": null }, "value": "pointerLens", - "start": 8785, - "end": 8796, + "start": 8871, + "end": 8882, "loc": { "start": { "line": 240, @@ -51777,8 +52839,8 @@ "binop": null, "updateContext": null }, - "start": 8796, - "end": 8797, + "start": 8882, + "end": 8883, "loc": { "start": { "line": 240, @@ -51803,8 +52865,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 8797, - "end": 8813, + "start": 8883, + "end": 8899, "loc": { "start": { "line": 240, @@ -51830,8 +52892,8 @@ "updateContext": null }, "value": "=", - "start": 8814, - "end": 8815, + "start": 8900, + "end": 8901, "loc": { "start": { "line": 240, @@ -51856,8 +52918,8 @@ "binop": null }, "value": "event", - "start": 8816, - "end": 8821, + "start": 8902, + "end": 8907, "loc": { "start": { "line": 240, @@ -51882,8 +52944,8 @@ "binop": null, "updateContext": null }, - "start": 8821, - "end": 8822, + "start": 8907, + "end": 8908, "loc": { "start": { "line": 240, @@ -51908,8 +52970,8 @@ "binop": null }, "value": "canvasPos", - "start": 8822, - "end": 8831, + "start": 8908, + "end": 8917, "loc": { "start": { "line": 240, @@ -51934,8 +52996,8 @@ "binop": null, "updateContext": null }, - "start": 8831, - "end": 8832, + "start": 8917, + "end": 8918, "loc": { "start": { "line": 240, @@ -51962,8 +53024,8 @@ "updateContext": null }, "value": "this", - "start": 8861, - "end": 8865, + "start": 8947, + "end": 8951, "loc": { "start": { "line": 241, @@ -51988,8 +53050,8 @@ "binop": null, "updateContext": null }, - "start": 8865, - "end": 8866, + "start": 8951, + "end": 8952, "loc": { "start": { "line": 241, @@ -52014,8 +53076,8 @@ "binop": null }, "value": "pointerLens", - "start": 8866, - "end": 8877, + "start": 8952, + "end": 8963, "loc": { "start": { "line": 241, @@ -52040,8 +53102,8 @@ "binop": null, "updateContext": null }, - "start": 8877, - "end": 8878, + "start": 8963, + "end": 8964, "loc": { "start": { "line": 241, @@ -52066,8 +53128,8 @@ "binop": null }, "value": "snapped", - "start": 8878, - "end": 8885, + "start": 8964, + "end": 8971, "loc": { "start": { "line": 241, @@ -52093,8 +53155,8 @@ "updateContext": null }, "value": "=", - "start": 8886, - "end": 8887, + "start": 8972, + "end": 8973, "loc": { "start": { "line": 241, @@ -52121,8 +53183,8 @@ "updateContext": null }, "value": "false", - "start": 8888, - "end": 8893, + "start": 8974, + "end": 8979, "loc": { "start": { "line": 241, @@ -52147,8 +53209,8 @@ "binop": null, "updateContext": null }, - "start": 8893, - "end": 8894, + "start": 8979, + "end": 8980, "loc": { "start": { "line": 241, @@ -52172,8 +53234,8 @@ "postfix": false, "binop": null }, - "start": 8919, - "end": 8920, + "start": 9005, + "end": 9006, "loc": { "start": { "line": 242, @@ -52200,8 +53262,8 @@ "updateContext": null }, "value": "this", - "start": 8945, - "end": 8949, + "start": 9031, + "end": 9035, "loc": { "start": { "line": 243, @@ -52226,8 +53288,8 @@ "binop": null, "updateContext": null }, - "start": 8949, - "end": 8950, + "start": 9035, + "end": 9036, "loc": { "start": { "line": 243, @@ -52252,8 +53314,8 @@ "binop": null }, "value": "_markerDiv", - "start": 8950, - "end": 8960, + "start": 9036, + "end": 9046, "loc": { "start": { "line": 243, @@ -52278,8 +53340,8 @@ "binop": null, "updateContext": null }, - "start": 8960, - "end": 8961, + "start": 9046, + "end": 9047, "loc": { "start": { "line": 243, @@ -52304,8 +53366,8 @@ "binop": null }, "value": "style", - "start": 8961, - "end": 8966, + "start": 9047, + "end": 9052, "loc": { "start": { "line": 243, @@ -52330,8 +53392,8 @@ "binop": null, "updateContext": null }, - "start": 8966, - "end": 8967, + "start": 9052, + "end": 9053, "loc": { "start": { "line": 243, @@ -52356,8 +53418,8 @@ "binop": null }, "value": "background", - "start": 8967, - "end": 8977, + "start": 9053, + "end": 9063, "loc": { "start": { "line": 243, @@ -52383,8 +53445,8 @@ "updateContext": null }, "value": "=", - "start": 8978, - "end": 8979, + "start": 9064, + "end": 9065, "loc": { "start": { "line": 243, @@ -52410,8 +53472,8 @@ "updateContext": null }, "value": "pink", - "start": 8980, - "end": 8986, + "start": 9066, + "end": 9072, "loc": { "start": { "line": 243, @@ -52436,8 +53498,8 @@ "binop": null, "updateContext": null }, - "start": 8986, - "end": 8987, + "start": 9072, + "end": 9073, "loc": { "start": { "line": 243, @@ -52464,8 +53526,8 @@ "updateContext": null }, "value": "this", - "start": 9012, - "end": 9016, + "start": 9098, + "end": 9102, "loc": { "start": { "line": 244, @@ -52490,8 +53552,8 @@ "binop": null, "updateContext": null }, - "start": 9016, - "end": 9017, + "start": 9102, + "end": 9103, "loc": { "start": { "line": 244, @@ -52516,8 +53578,8 @@ "binop": null }, "value": "_markerDiv", - "start": 9017, - "end": 9027, + "start": 9103, + "end": 9113, "loc": { "start": { "line": 244, @@ -52542,8 +53604,8 @@ "binop": null, "updateContext": null }, - "start": 9027, - "end": 9028, + "start": 9113, + "end": 9114, "loc": { "start": { "line": 244, @@ -52568,8 +53630,8 @@ "binop": null }, "value": "style", - "start": 9028, - "end": 9033, + "start": 9114, + "end": 9119, "loc": { "start": { "line": 244, @@ -52594,8 +53656,8 @@ "binop": null, "updateContext": null }, - "start": 9033, - "end": 9034, + "start": 9119, + "end": 9120, "loc": { "start": { "line": 244, @@ -52620,8 +53682,8 @@ "binop": null }, "value": "border", - "start": 9034, - "end": 9040, + "start": 9120, + "end": 9126, "loc": { "start": { "line": 244, @@ -52647,8 +53709,8 @@ "updateContext": null }, "value": "=", - "start": 9041, - "end": 9042, + "start": 9127, + "end": 9128, "loc": { "start": { "line": 244, @@ -52674,8 +53736,8 @@ "updateContext": null }, "value": "2px solid red", - "start": 9043, - "end": 9058, + "start": 9129, + "end": 9144, "loc": { "start": { "line": 244, @@ -52700,8 +53762,8 @@ "binop": null, "updateContext": null }, - "start": 9058, - "end": 9059, + "start": 9144, + "end": 9145, "loc": { "start": { "line": 244, @@ -52725,8 +53787,8 @@ "postfix": false, "binop": null }, - "start": 9080, - "end": 9081, + "start": 9166, + "end": 9167, "loc": { "start": { "line": 245, @@ -52751,8 +53813,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 9102, - "end": 9115, + "start": 9188, + "end": 9201, "loc": { "start": { "line": 246, @@ -52778,8 +53840,8 @@ "updateContext": null }, "value": "=", - "start": 9116, - "end": 9117, + "start": 9202, + "end": 9203, "loc": { "start": { "line": 246, @@ -52804,8 +53866,8 @@ "binop": null }, "value": "event", - "start": 9118, - "end": 9123, + "start": 9204, + "end": 9209, "loc": { "start": { "line": 246, @@ -52830,8 +53892,8 @@ "binop": null, "updateContext": null }, - "start": 9123, - "end": 9124, + "start": 9209, + "end": 9210, "loc": { "start": { "line": 246, @@ -52856,8 +53918,8 @@ "binop": null }, "value": "entity", - "start": 9124, - "end": 9130, + "start": 9210, + "end": 9216, "loc": { "start": { "line": 246, @@ -52882,8 +53944,8 @@ "binop": null, "updateContext": null }, - "start": 9130, - "end": 9131, + "start": 9216, + "end": 9217, "loc": { "start": { "line": 246, @@ -52907,8 +53969,8 @@ "postfix": false, "binop": null }, - "start": 9148, - "end": 9149, + "start": 9234, + "end": 9235, "loc": { "start": { "line": 247, @@ -52935,8 +53997,8 @@ "updateContext": null }, "value": "else", - "start": 9150, - "end": 9154, + "start": 9236, + "end": 9240, "loc": { "start": { "line": 247, @@ -52960,8 +54022,8 @@ "postfix": false, "binop": null }, - "start": 9155, - "end": 9156, + "start": 9241, + "end": 9242, "loc": { "start": { "line": 247, @@ -52988,8 +54050,8 @@ "updateContext": null }, "value": "this", - "start": 9177, - "end": 9181, + "start": 9263, + "end": 9267, "loc": { "start": { "line": 248, @@ -53014,8 +54076,8 @@ "binop": null, "updateContext": null }, - "start": 9181, - "end": 9182, + "start": 9267, + "end": 9268, "loc": { "start": { "line": 248, @@ -53040,8 +54102,8 @@ "binop": null }, "value": "_markerDiv", - "start": 9182, - "end": 9192, + "start": 9268, + "end": 9278, "loc": { "start": { "line": 248, @@ -53066,8 +54128,8 @@ "binop": null, "updateContext": null }, - "start": 9192, - "end": 9193, + "start": 9278, + "end": 9279, "loc": { "start": { "line": 248, @@ -53092,8 +54154,8 @@ "binop": null }, "value": "style", - "start": 9193, - "end": 9198, + "start": 9279, + "end": 9284, "loc": { "start": { "line": 248, @@ -53118,8 +54180,8 @@ "binop": null, "updateContext": null }, - "start": 9198, - "end": 9199, + "start": 9284, + "end": 9285, "loc": { "start": { "line": 248, @@ -53144,8 +54206,8 @@ "binop": null }, "value": "left", - "start": 9199, - "end": 9203, + "start": 9285, + "end": 9289, "loc": { "start": { "line": 248, @@ -53171,8 +54233,8 @@ "updateContext": null }, "value": "=", - "start": 9204, - "end": 9205, + "start": 9290, + "end": 9291, "loc": { "start": { "line": 248, @@ -53196,8 +54258,8 @@ "postfix": false, "binop": null }, - "start": 9206, - "end": 9207, + "start": 9292, + "end": 9293, "loc": { "start": { "line": 248, @@ -53223,8 +54285,8 @@ "updateContext": null }, "value": "-10000px", - "start": 9207, - "end": 9215, + "start": 9293, + "end": 9301, "loc": { "start": { "line": 248, @@ -53248,8 +54310,8 @@ "postfix": false, "binop": null }, - "start": 9215, - "end": 9216, + "start": 9301, + "end": 9302, "loc": { "start": { "line": 248, @@ -53274,8 +54336,8 @@ "binop": null, "updateContext": null }, - "start": 9216, - "end": 9217, + "start": 9302, + "end": 9303, "loc": { "start": { "line": 248, @@ -53302,8 +54364,8 @@ "updateContext": null }, "value": "this", - "start": 9238, - "end": 9242, + "start": 9324, + "end": 9328, "loc": { "start": { "line": 249, @@ -53328,8 +54390,8 @@ "binop": null, "updateContext": null }, - "start": 9242, - "end": 9243, + "start": 9328, + "end": 9329, "loc": { "start": { "line": 249, @@ -53354,8 +54416,8 @@ "binop": null }, "value": "_markerDiv", - "start": 9243, - "end": 9253, + "start": 9329, + "end": 9339, "loc": { "start": { "line": 249, @@ -53380,8 +54442,8 @@ "binop": null, "updateContext": null }, - "start": 9253, - "end": 9254, + "start": 9339, + "end": 9340, "loc": { "start": { "line": 249, @@ -53406,8 +54468,8 @@ "binop": null }, "value": "style", - "start": 9254, - "end": 9259, + "start": 9340, + "end": 9345, "loc": { "start": { "line": 249, @@ -53432,8 +54494,8 @@ "binop": null, "updateContext": null }, - "start": 9259, - "end": 9260, + "start": 9345, + "end": 9346, "loc": { "start": { "line": 249, @@ -53458,8 +54520,8 @@ "binop": null }, "value": "top", - "start": 9260, - "end": 9263, + "start": 9346, + "end": 9349, "loc": { "start": { "line": 249, @@ -53485,8 +54547,8 @@ "updateContext": null }, "value": "=", - "start": 9264, - "end": 9265, + "start": 9350, + "end": 9351, "loc": { "start": { "line": 249, @@ -53510,8 +54572,8 @@ "postfix": false, "binop": null }, - "start": 9266, - "end": 9267, + "start": 9352, + "end": 9353, "loc": { "start": { "line": 249, @@ -53537,8 +54599,8 @@ "updateContext": null }, "value": "-10000px", - "start": 9267, - "end": 9275, + "start": 9353, + "end": 9361, "loc": { "start": { "line": 249, @@ -53562,8 +54624,8 @@ "postfix": false, "binop": null }, - "start": 9275, - "end": 9276, + "start": 9361, + "end": 9362, "loc": { "start": { "line": 249, @@ -53588,8 +54650,8 @@ "binop": null, "updateContext": null }, - "start": 9276, - "end": 9277, + "start": 9362, + "end": 9363, "loc": { "start": { "line": 249, @@ -53613,8 +54675,8 @@ "postfix": false, "binop": null }, - "start": 9294, - "end": 9295, + "start": 9380, + "end": 9381, "loc": { "start": { "line": 250, @@ -53639,8 +54701,8 @@ "binop": null }, "value": "canvas", - "start": 9312, - "end": 9318, + "start": 9398, + "end": 9404, "loc": { "start": { "line": 251, @@ -53665,8 +54727,8 @@ "binop": null, "updateContext": null }, - "start": 9318, - "end": 9319, + "start": 9404, + "end": 9405, "loc": { "start": { "line": 251, @@ -53691,8 +54753,8 @@ "binop": null }, "value": "style", - "start": 9319, - "end": 9324, + "start": 9405, + "end": 9410, "loc": { "start": { "line": 251, @@ -53717,8 +54779,8 @@ "binop": null, "updateContext": null }, - "start": 9324, - "end": 9325, + "start": 9410, + "end": 9411, "loc": { "start": { "line": 251, @@ -53743,8 +54805,8 @@ "binop": null }, "value": "cursor", - "start": 9325, - "end": 9331, + "start": 9411, + "end": 9417, "loc": { "start": { "line": 251, @@ -53770,8 +54832,8 @@ "updateContext": null }, "value": "=", - "start": 9332, - "end": 9333, + "start": 9418, + "end": 9419, "loc": { "start": { "line": 251, @@ -53797,8 +54859,8 @@ "updateContext": null }, "value": "pointer", - "start": 9334, - "end": 9343, + "start": 9420, + "end": 9429, "loc": { "start": { "line": 251, @@ -53823,8 +54885,8 @@ "binop": null, "updateContext": null }, - "start": 9343, - "end": 9344, + "start": 9429, + "end": 9430, "loc": { "start": { "line": 251, @@ -53851,8 +54913,8 @@ "updateContext": null }, "value": "if", - "start": 9361, - "end": 9363, + "start": 9447, + "end": 9449, "loc": { "start": { "line": 252, @@ -53876,8 +54938,8 @@ "postfix": false, "binop": null }, - "start": 9364, - "end": 9365, + "start": 9450, + "end": 9451, "loc": { "start": { "line": 252, @@ -53904,8 +54966,8 @@ "updateContext": null }, "value": "this", - "start": 9365, - "end": 9369, + "start": 9451, + "end": 9455, "loc": { "start": { "line": 252, @@ -53930,8 +54992,8 @@ "binop": null, "updateContext": null }, - "start": 9369, - "end": 9370, + "start": 9455, + "end": 9456, "loc": { "start": { "line": 252, @@ -53956,8 +55018,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 9370, - "end": 9397, + "start": 9456, + "end": 9483, "loc": { "start": { "line": 252, @@ -53981,8 +55043,8 @@ "postfix": false, "binop": null }, - "start": 9397, - "end": 9398, + "start": 9483, + "end": 9484, "loc": { "start": { "line": 252, @@ -54006,8 +55068,8 @@ "postfix": false, "binop": null }, - "start": 9399, - "end": 9400, + "start": 9485, + "end": 9486, "loc": { "start": { "line": 252, @@ -54034,8 +55096,8 @@ "updateContext": null }, "value": "this", - "start": 9421, - "end": 9425, + "start": 9507, + "end": 9511, "loc": { "start": { "line": 253, @@ -54060,8 +55122,8 @@ "binop": null, "updateContext": null }, - "start": 9425, - "end": 9426, + "start": 9511, + "end": 9512, "loc": { "start": { "line": 253, @@ -54086,8 +55148,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 9426, - "end": 9453, + "start": 9512, + "end": 9539, "loc": { "start": { "line": 253, @@ -54112,8 +55174,8 @@ "binop": null, "updateContext": null }, - "start": 9453, - "end": 9454, + "start": 9539, + "end": 9540, "loc": { "start": { "line": 253, @@ -54138,8 +55200,8 @@ "binop": null }, "value": "wireVisible", - "start": 9454, - "end": 9465, + "start": 9540, + "end": 9551, "loc": { "start": { "line": 253, @@ -54165,8 +55227,8 @@ "updateContext": null }, "value": "=", - "start": 9466, - "end": 9467, + "start": 9552, + "end": 9553, "loc": { "start": { "line": 253, @@ -54193,8 +55255,8 @@ "updateContext": null }, "value": "this", - "start": 9468, - "end": 9472, + "start": 9554, + "end": 9558, "loc": { "start": { "line": 253, @@ -54219,8 +55281,8 @@ "binop": null, "updateContext": null }, - "start": 9472, - "end": 9473, + "start": 9558, + "end": 9559, "loc": { "start": { "line": 253, @@ -54245,8 +55307,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 9473, - "end": 9509, + "start": 9559, + "end": 9595, "loc": { "start": { "line": 253, @@ -54271,8 +55333,8 @@ "binop": null, "updateContext": null }, - "start": 9509, - "end": 9510, + "start": 9595, + "end": 9596, "loc": { "start": { "line": 253, @@ -54297,8 +55359,8 @@ "binop": null }, "value": "wireVisible", - "start": 9510, - "end": 9521, + "start": 9596, + "end": 9607, "loc": { "start": { "line": 253, @@ -54323,8 +55385,8 @@ "binop": null, "updateContext": null }, - "start": 9521, - "end": 9522, + "start": 9607, + "end": 9608, "loc": { "start": { "line": 253, @@ -54351,8 +55413,8 @@ "updateContext": null }, "value": "this", - "start": 9543, - "end": 9547, + "start": 9629, + "end": 9633, "loc": { "start": { "line": 254, @@ -54377,8 +55439,8 @@ "binop": null, "updateContext": null }, - "start": 9547, - "end": 9548, + "start": 9633, + "end": 9634, "loc": { "start": { "line": 254, @@ -54403,8 +55465,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 9548, - "end": 9575, + "start": 9634, + "end": 9661, "loc": { "start": { "line": 254, @@ -54429,8 +55491,8 @@ "binop": null, "updateContext": null }, - "start": 9575, - "end": 9576, + "start": 9661, + "end": 9662, "loc": { "start": { "line": 254, @@ -54455,8 +55517,8 @@ "binop": null }, "value": "axisVisible", - "start": 9576, - "end": 9587, + "start": 9662, + "end": 9673, "loc": { "start": { "line": 254, @@ -54482,8 +55544,8 @@ "updateContext": null }, "value": "=", - "start": 9588, - "end": 9589, + "start": 9674, + "end": 9675, "loc": { "start": { "line": 254, @@ -54510,8 +55572,8 @@ "updateContext": null }, "value": "this", - "start": 9590, - "end": 9594, + "start": 9676, + "end": 9680, "loc": { "start": { "line": 254, @@ -54536,8 +55598,8 @@ "binop": null, "updateContext": null }, - "start": 9594, - "end": 9595, + "start": 9680, + "end": 9681, "loc": { "start": { "line": 254, @@ -54562,8 +55624,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 9595, - "end": 9631, + "start": 9681, + "end": 9717, "loc": { "start": { "line": 254, @@ -54588,8 +55650,8 @@ "binop": null, "updateContext": null }, - "start": 9631, - "end": 9632, + "start": 9717, + "end": 9718, "loc": { "start": { "line": 254, @@ -54614,8 +55676,8 @@ "binop": null }, "value": "axisVisible", - "start": 9632, - "end": 9643, + "start": 9718, + "end": 9729, "loc": { "start": { "line": 254, @@ -54641,8 +55703,8 @@ "updateContext": null }, "value": "&&", - "start": 9644, - "end": 9646, + "start": 9730, + "end": 9732, "loc": { "start": { "line": 254, @@ -54669,8 +55731,8 @@ "updateContext": null }, "value": "this", - "start": 9647, - "end": 9651, + "start": 9733, + "end": 9737, "loc": { "start": { "line": 254, @@ -54695,8 +55757,8 @@ "binop": null, "updateContext": null }, - "start": 9651, - "end": 9652, + "start": 9737, + "end": 9738, "loc": { "start": { "line": 254, @@ -54721,8 +55783,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 9652, - "end": 9678, + "start": 9738, + "end": 9764, "loc": { "start": { "line": 254, @@ -54747,8 +55809,8 @@ "binop": null, "updateContext": null }, - "start": 9678, - "end": 9679, + "start": 9764, + "end": 9765, "loc": { "start": { "line": 254, @@ -54773,8 +55835,8 @@ "binop": null }, "value": "defaultAxisVisible", - "start": 9679, - "end": 9697, + "start": 9765, + "end": 9783, "loc": { "start": { "line": 254, @@ -54799,8 +55861,8 @@ "binop": null, "updateContext": null }, - "start": 9697, - "end": 9698, + "start": 9783, + "end": 9784, "loc": { "start": { "line": 254, @@ -54827,8 +55889,8 @@ "updateContext": null }, "value": "this", - "start": 9719, - "end": 9723, + "start": 9805, + "end": 9809, "loc": { "start": { "line": 255, @@ -54853,8 +55915,8 @@ "binop": null, "updateContext": null }, - "start": 9723, - "end": 9724, + "start": 9809, + "end": 9810, "loc": { "start": { "line": 255, @@ -54879,8 +55941,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 9724, - "end": 9751, + "start": 9810, + "end": 9837, "loc": { "start": { "line": 255, @@ -54905,8 +55967,8 @@ "binop": null, "updateContext": null }, - "start": 9751, - "end": 9752, + "start": 9837, + "end": 9838, "loc": { "start": { "line": 255, @@ -54931,8 +55993,8 @@ "binop": null }, "value": "xAxisVisible", - "start": 9752, - "end": 9764, + "start": 9838, + "end": 9850, "loc": { "start": { "line": 255, @@ -54958,8 +56020,8 @@ "updateContext": null }, "value": "=", - "start": 9765, - "end": 9766, + "start": 9851, + "end": 9852, "loc": { "start": { "line": 255, @@ -54986,8 +56048,8 @@ "updateContext": null }, "value": "this", - "start": 9767, - "end": 9771, + "start": 9853, + "end": 9857, "loc": { "start": { "line": 255, @@ -55012,8 +56074,8 @@ "binop": null, "updateContext": null }, - "start": 9771, - "end": 9772, + "start": 9857, + "end": 9858, "loc": { "start": { "line": 255, @@ -55038,8 +56100,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 9772, - "end": 9808, + "start": 9858, + "end": 9894, "loc": { "start": { "line": 255, @@ -55064,8 +56126,8 @@ "binop": null, "updateContext": null }, - "start": 9808, - "end": 9809, + "start": 9894, + "end": 9895, "loc": { "start": { "line": 255, @@ -55090,8 +56152,8 @@ "binop": null }, "value": "xAxisVisible", - "start": 9809, - "end": 9821, + "start": 9895, + "end": 9907, "loc": { "start": { "line": 255, @@ -55117,8 +56179,8 @@ "updateContext": null }, "value": "&&", - "start": 9822, - "end": 9824, + "start": 9908, + "end": 9910, "loc": { "start": { "line": 255, @@ -55145,8 +56207,8 @@ "updateContext": null }, "value": "this", - "start": 9825, - "end": 9829, + "start": 9911, + "end": 9915, "loc": { "start": { "line": 255, @@ -55171,8 +56233,8 @@ "binop": null, "updateContext": null }, - "start": 9829, - "end": 9830, + "start": 9915, + "end": 9916, "loc": { "start": { "line": 255, @@ -55197,8 +56259,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 9830, - "end": 9856, + "start": 9916, + "end": 9942, "loc": { "start": { "line": 255, @@ -55223,8 +56285,8 @@ "binop": null, "updateContext": null }, - "start": 9856, - "end": 9857, + "start": 9942, + "end": 9943, "loc": { "start": { "line": 255, @@ -55249,8 +56311,8 @@ "binop": null }, "value": "defaultXAxisVisible", - "start": 9857, - "end": 9876, + "start": 9943, + "end": 9962, "loc": { "start": { "line": 255, @@ -55275,8 +56337,8 @@ "binop": null, "updateContext": null }, - "start": 9876, - "end": 9877, + "start": 9962, + "end": 9963, "loc": { "start": { "line": 255, @@ -55303,8 +56365,8 @@ "updateContext": null }, "value": "this", - "start": 9898, - "end": 9902, + "start": 9984, + "end": 9988, "loc": { "start": { "line": 256, @@ -55329,8 +56391,8 @@ "binop": null, "updateContext": null }, - "start": 9902, - "end": 9903, + "start": 9988, + "end": 9989, "loc": { "start": { "line": 256, @@ -55355,8 +56417,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 9903, - "end": 9930, + "start": 9989, + "end": 10016, "loc": { "start": { "line": 256, @@ -55381,8 +56443,8 @@ "binop": null, "updateContext": null }, - "start": 9930, - "end": 9931, + "start": 10016, + "end": 10017, "loc": { "start": { "line": 256, @@ -55407,8 +56469,8 @@ "binop": null }, "value": "yAxisVisible", - "start": 9931, - "end": 9943, + "start": 10017, + "end": 10029, "loc": { "start": { "line": 256, @@ -55434,8 +56496,8 @@ "updateContext": null }, "value": "=", - "start": 9944, - "end": 9945, + "start": 10030, + "end": 10031, "loc": { "start": { "line": 256, @@ -55462,8 +56524,8 @@ "updateContext": null }, "value": "this", - "start": 9946, - "end": 9950, + "start": 10032, + "end": 10036, "loc": { "start": { "line": 256, @@ -55488,8 +56550,8 @@ "binop": null, "updateContext": null }, - "start": 9950, - "end": 9951, + "start": 10036, + "end": 10037, "loc": { "start": { "line": 256, @@ -55514,8 +56576,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 9951, - "end": 9987, + "start": 10037, + "end": 10073, "loc": { "start": { "line": 256, @@ -55540,8 +56602,8 @@ "binop": null, "updateContext": null }, - "start": 9987, - "end": 9988, + "start": 10073, + "end": 10074, "loc": { "start": { "line": 256, @@ -55566,8 +56628,8 @@ "binop": null }, "value": "yAxisVisible", - "start": 9988, - "end": 10000, + "start": 10074, + "end": 10086, "loc": { "start": { "line": 256, @@ -55593,8 +56655,8 @@ "updateContext": null }, "value": "&&", - "start": 10001, - "end": 10003, + "start": 10087, + "end": 10089, "loc": { "start": { "line": 256, @@ -55621,8 +56683,8 @@ "updateContext": null }, "value": "this", - "start": 10004, - "end": 10008, + "start": 10090, + "end": 10094, "loc": { "start": { "line": 256, @@ -55647,8 +56709,8 @@ "binop": null, "updateContext": null }, - "start": 10008, - "end": 10009, + "start": 10094, + "end": 10095, "loc": { "start": { "line": 256, @@ -55673,8 +56735,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 10009, - "end": 10035, + "start": 10095, + "end": 10121, "loc": { "start": { "line": 256, @@ -55699,8 +56761,8 @@ "binop": null, "updateContext": null }, - "start": 10035, - "end": 10036, + "start": 10121, + "end": 10122, "loc": { "start": { "line": 256, @@ -55725,8 +56787,8 @@ "binop": null }, "value": "defaultYAxisVisible", - "start": 10036, - "end": 10055, + "start": 10122, + "end": 10141, "loc": { "start": { "line": 256, @@ -55751,8 +56813,8 @@ "binop": null, "updateContext": null }, - "start": 10055, - "end": 10056, + "start": 10141, + "end": 10142, "loc": { "start": { "line": 256, @@ -55779,8 +56841,8 @@ "updateContext": null }, "value": "this", - "start": 10077, - "end": 10081, + "start": 10163, + "end": 10167, "loc": { "start": { "line": 257, @@ -55805,8 +56867,8 @@ "binop": null, "updateContext": null }, - "start": 10081, - "end": 10082, + "start": 10167, + "end": 10168, "loc": { "start": { "line": 257, @@ -55831,8 +56893,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 10082, - "end": 10109, + "start": 10168, + "end": 10195, "loc": { "start": { "line": 257, @@ -55857,8 +56919,8 @@ "binop": null, "updateContext": null }, - "start": 10109, - "end": 10110, + "start": 10195, + "end": 10196, "loc": { "start": { "line": 257, @@ -55883,8 +56945,8 @@ "binop": null }, "value": "zAxisVisible", - "start": 10110, - "end": 10122, + "start": 10196, + "end": 10208, "loc": { "start": { "line": 257, @@ -55910,8 +56972,8 @@ "updateContext": null }, "value": "=", - "start": 10123, - "end": 10124, + "start": 10209, + "end": 10210, "loc": { "start": { "line": 257, @@ -55938,8 +57000,8 @@ "updateContext": null }, "value": "this", - "start": 10125, - "end": 10129, + "start": 10211, + "end": 10215, "loc": { "start": { "line": 257, @@ -55964,8 +57026,8 @@ "binop": null, "updateContext": null }, - "start": 10129, - "end": 10130, + "start": 10215, + "end": 10216, "loc": { "start": { "line": 257, @@ -55990,8 +57052,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 10130, - "end": 10166, + "start": 10216, + "end": 10252, "loc": { "start": { "line": 257, @@ -56016,8 +57078,8 @@ "binop": null, "updateContext": null }, - "start": 10166, - "end": 10167, + "start": 10252, + "end": 10253, "loc": { "start": { "line": 257, @@ -56042,8 +57104,8 @@ "binop": null }, "value": "zAxisVisible", - "start": 10167, - "end": 10179, + "start": 10253, + "end": 10265, "loc": { "start": { "line": 257, @@ -56069,8 +57131,8 @@ "updateContext": null }, "value": "&&", - "start": 10180, - "end": 10182, + "start": 10266, + "end": 10268, "loc": { "start": { "line": 257, @@ -56097,8 +57159,8 @@ "updateContext": null }, "value": "this", - "start": 10183, - "end": 10187, + "start": 10269, + "end": 10273, "loc": { "start": { "line": 257, @@ -56123,8 +57185,8 @@ "binop": null, "updateContext": null }, - "start": 10187, - "end": 10188, + "start": 10273, + "end": 10274, "loc": { "start": { "line": 257, @@ -56149,8 +57211,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 10188, - "end": 10214, + "start": 10274, + "end": 10300, "loc": { "start": { "line": 257, @@ -56175,8 +57237,8 @@ "binop": null, "updateContext": null }, - "start": 10214, - "end": 10215, + "start": 10300, + "end": 10301, "loc": { "start": { "line": 257, @@ -56201,8 +57263,8 @@ "binop": null }, "value": "defaultZAxisVisible", - "start": 10215, - "end": 10234, + "start": 10301, + "end": 10320, "loc": { "start": { "line": 257, @@ -56227,8 +57289,8 @@ "binop": null, "updateContext": null }, - "start": 10234, - "end": 10235, + "start": 10320, + "end": 10321, "loc": { "start": { "line": 257, @@ -56255,8 +57317,8 @@ "updateContext": null }, "value": "this", - "start": 10256, - "end": 10260, + "start": 10342, + "end": 10346, "loc": { "start": { "line": 258, @@ -56281,8 +57343,8 @@ "binop": null, "updateContext": null }, - "start": 10260, - "end": 10261, + "start": 10346, + "end": 10347, "loc": { "start": { "line": 258, @@ -56307,8 +57369,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 10261, - "end": 10288, + "start": 10347, + "end": 10374, "loc": { "start": { "line": 258, @@ -56333,8 +57395,8 @@ "binop": null, "updateContext": null }, - "start": 10288, - "end": 10289, + "start": 10374, + "end": 10375, "loc": { "start": { "line": 258, @@ -56359,8 +57421,8 @@ "binop": null }, "value": "targetVisible", - "start": 10289, - "end": 10302, + "start": 10375, + "end": 10388, "loc": { "start": { "line": 258, @@ -56386,8 +57448,8 @@ "updateContext": null }, "value": "=", - "start": 10303, - "end": 10304, + "start": 10389, + "end": 10390, "loc": { "start": { "line": 258, @@ -56414,8 +57476,8 @@ "updateContext": null }, "value": "this", - "start": 10305, - "end": 10309, + "start": 10391, + "end": 10395, "loc": { "start": { "line": 258, @@ -56440,8 +57502,8 @@ "binop": null, "updateContext": null }, - "start": 10309, - "end": 10310, + "start": 10395, + "end": 10396, "loc": { "start": { "line": 258, @@ -56466,8 +57528,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 10310, - "end": 10346, + "start": 10396, + "end": 10432, "loc": { "start": { "line": 258, @@ -56492,8 +57554,8 @@ "binop": null, "updateContext": null }, - "start": 10346, - "end": 10347, + "start": 10432, + "end": 10433, "loc": { "start": { "line": 258, @@ -56518,8 +57580,8 @@ "binop": null }, "value": "targetVisible", - "start": 10347, - "end": 10360, + "start": 10433, + "end": 10446, "loc": { "start": { "line": 258, @@ -56544,8 +57606,8 @@ "binop": null, "updateContext": null }, - "start": 10360, - "end": 10361, + "start": 10446, + "end": 10447, "loc": { "start": { "line": 258, @@ -56572,8 +57634,8 @@ "updateContext": null }, "value": "this", - "start": 10382, - "end": 10386, + "start": 10468, + "end": 10472, "loc": { "start": { "line": 259, @@ -56598,8 +57660,8 @@ "binop": null, "updateContext": null }, - "start": 10386, - "end": 10387, + "start": 10472, + "end": 10473, "loc": { "start": { "line": 259, @@ -56624,8 +57686,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 10387, - "end": 10414, + "start": 10473, + "end": 10500, "loc": { "start": { "line": 259, @@ -56650,8 +57712,8 @@ "binop": null, "updateContext": null }, - "start": 10414, - "end": 10415, + "start": 10500, + "end": 10501, "loc": { "start": { "line": 259, @@ -56676,8 +57738,8 @@ "binop": null }, "value": "target", - "start": 10415, - "end": 10421, + "start": 10501, + "end": 10507, "loc": { "start": { "line": 259, @@ -56702,8 +57764,8 @@ "binop": null, "updateContext": null }, - "start": 10421, - "end": 10422, + "start": 10507, + "end": 10508, "loc": { "start": { "line": 259, @@ -56728,8 +57790,8 @@ "binop": null }, "value": "worldPos", - "start": 10422, - "end": 10430, + "start": 10508, + "end": 10516, "loc": { "start": { "line": 259, @@ -56755,8 +57817,8 @@ "updateContext": null }, "value": "=", - "start": 10431, - "end": 10432, + "start": 10517, + "end": 10518, "loc": { "start": { "line": 259, @@ -56781,8 +57843,8 @@ "binop": null }, "value": "pointerWorldPos", - "start": 10433, - "end": 10448, + "start": 10519, + "end": 10534, "loc": { "start": { "line": 259, @@ -56807,8 +57869,8 @@ "binop": null, "updateContext": null }, - "start": 10448, - "end": 10449, + "start": 10534, + "end": 10535, "loc": { "start": { "line": 259, @@ -56833,8 +57895,8 @@ "binop": null }, "value": "slice", - "start": 10449, - "end": 10454, + "start": 10535, + "end": 10540, "loc": { "start": { "line": 259, @@ -56858,8 +57920,8 @@ "postfix": false, "binop": null }, - "start": 10454, - "end": 10455, + "start": 10540, + "end": 10541, "loc": { "start": { "line": 259, @@ -56883,8 +57945,8 @@ "postfix": false, "binop": null }, - "start": 10455, - "end": 10456, + "start": 10541, + "end": 10542, "loc": { "start": { "line": 259, @@ -56909,8 +57971,8 @@ "binop": null, "updateContext": null }, - "start": 10456, - "end": 10457, + "start": 10542, + "end": 10543, "loc": { "start": { "line": 259, @@ -56937,8 +57999,8 @@ "updateContext": null }, "value": "this", - "start": 10478, - "end": 10482, + "start": 10564, + "end": 10568, "loc": { "start": { "line": 260, @@ -56963,8 +58025,8 @@ "binop": null, "updateContext": null }, - "start": 10482, - "end": 10483, + "start": 10568, + "end": 10569, "loc": { "start": { "line": 260, @@ -56989,8 +58051,8 @@ "binop": null }, "value": "_markerDiv", - "start": 10483, - "end": 10493, + "start": 10569, + "end": 10579, "loc": { "start": { "line": 260, @@ -57015,8 +58077,8 @@ "binop": null, "updateContext": null }, - "start": 10493, - "end": 10494, + "start": 10579, + "end": 10580, "loc": { "start": { "line": 260, @@ -57041,8 +58103,8 @@ "binop": null }, "value": "style", - "start": 10494, - "end": 10499, + "start": 10580, + "end": 10585, "loc": { "start": { "line": 260, @@ -57067,8 +58129,8 @@ "binop": null, "updateContext": null }, - "start": 10499, - "end": 10500, + "start": 10585, + "end": 10586, "loc": { "start": { "line": 260, @@ -57093,8 +58155,8 @@ "binop": null }, "value": "left", - "start": 10500, - "end": 10504, + "start": 10586, + "end": 10590, "loc": { "start": { "line": 260, @@ -57120,8 +58182,8 @@ "updateContext": null }, "value": "=", - "start": 10505, - "end": 10506, + "start": 10591, + "end": 10592, "loc": { "start": { "line": 260, @@ -57145,8 +58207,8 @@ "postfix": false, "binop": null }, - "start": 10507, - "end": 10508, + "start": 10593, + "end": 10594, "loc": { "start": { "line": 260, @@ -57172,8 +58234,8 @@ "updateContext": null }, "value": "-10000px", - "start": 10508, - "end": 10516, + "start": 10594, + "end": 10602, "loc": { "start": { "line": 260, @@ -57197,8 +58259,8 @@ "postfix": false, "binop": null }, - "start": 10516, - "end": 10517, + "start": 10602, + "end": 10603, "loc": { "start": { "line": 260, @@ -57223,8 +58285,8 @@ "binop": null, "updateContext": null }, - "start": 10517, - "end": 10518, + "start": 10603, + "end": 10604, "loc": { "start": { "line": 260, @@ -57251,8 +58313,8 @@ "updateContext": null }, "value": "this", - "start": 10539, - "end": 10543, + "start": 10625, + "end": 10629, "loc": { "start": { "line": 261, @@ -57277,8 +58339,8 @@ "binop": null, "updateContext": null }, - "start": 10543, - "end": 10544, + "start": 10629, + "end": 10630, "loc": { "start": { "line": 261, @@ -57303,8 +58365,8 @@ "binop": null }, "value": "_markerDiv", - "start": 10544, - "end": 10554, + "start": 10630, + "end": 10640, "loc": { "start": { "line": 261, @@ -57329,8 +58391,8 @@ "binop": null, "updateContext": null }, - "start": 10554, - "end": 10555, + "start": 10640, + "end": 10641, "loc": { "start": { "line": 261, @@ -57355,8 +58417,8 @@ "binop": null }, "value": "style", - "start": 10555, - "end": 10560, + "start": 10641, + "end": 10646, "loc": { "start": { "line": 261, @@ -57381,8 +58443,8 @@ "binop": null, "updateContext": null }, - "start": 10560, - "end": 10561, + "start": 10646, + "end": 10647, "loc": { "start": { "line": 261, @@ -57407,8 +58469,8 @@ "binop": null }, "value": "top", - "start": 10561, - "end": 10564, + "start": 10647, + "end": 10650, "loc": { "start": { "line": 261, @@ -57434,8 +58496,8 @@ "updateContext": null }, "value": "=", - "start": 10565, - "end": 10566, + "start": 10651, + "end": 10652, "loc": { "start": { "line": 261, @@ -57459,8 +58521,8 @@ "postfix": false, "binop": null }, - "start": 10567, - "end": 10568, + "start": 10653, + "end": 10654, "loc": { "start": { "line": 261, @@ -57486,8 +58548,8 @@ "updateContext": null }, "value": "-10000px", - "start": 10568, - "end": 10576, + "start": 10654, + "end": 10662, "loc": { "start": { "line": 261, @@ -57511,8 +58573,8 @@ "postfix": false, "binop": null }, - "start": 10576, - "end": 10577, + "start": 10662, + "end": 10663, "loc": { "start": { "line": 261, @@ -57537,8 +58599,8 @@ "binop": null, "updateContext": null }, - "start": 10577, - "end": 10578, + "start": 10663, + "end": 10664, "loc": { "start": { "line": 261, @@ -57562,8 +58624,8 @@ "postfix": false, "binop": null }, - "start": 10595, - "end": 10596, + "start": 10681, + "end": 10682, "loc": { "start": { "line": 262, @@ -57587,8 +58649,8 @@ "postfix": false, "binop": null }, - "start": 10609, - "end": 10610, + "start": 10695, + "end": 10696, "loc": { "start": { "line": 263, @@ -57612,8 +58674,8 @@ "postfix": false, "binop": null }, - "start": 10610, - "end": 10611, + "start": 10696, + "end": 10697, "loc": { "start": { "line": 263, @@ -57638,8 +58700,8 @@ "binop": null, "updateContext": null }, - "start": 10611, - "end": 10612, + "start": 10697, + "end": 10698, "loc": { "start": { "line": 263, @@ -57664,8 +58726,8 @@ "binop": null }, "value": "canvas", - "start": 10622, - "end": 10628, + "start": 10708, + "end": 10714, "loc": { "start": { "line": 265, @@ -57690,8 +58752,8 @@ "binop": null, "updateContext": null }, - "start": 10628, - "end": 10629, + "start": 10714, + "end": 10715, "loc": { "start": { "line": 265, @@ -57716,8 +58778,8 @@ "binop": null }, "value": "addEventListener", - "start": 10629, - "end": 10645, + "start": 10715, + "end": 10731, "loc": { "start": { "line": 265, @@ -57741,8 +58803,8 @@ "postfix": false, "binop": null }, - "start": 10645, - "end": 10646, + "start": 10731, + "end": 10732, "loc": { "start": { "line": 265, @@ -57768,8 +58830,8 @@ "updateContext": null }, "value": "mousedown", - "start": 10646, - "end": 10657, + "start": 10732, + "end": 10743, "loc": { "start": { "line": 265, @@ -57794,8 +58856,8 @@ "binop": null, "updateContext": null }, - "start": 10657, - "end": 10658, + "start": 10743, + "end": 10744, "loc": { "start": { "line": 265, @@ -57822,8 +58884,8 @@ "updateContext": null }, "value": "this", - "start": 10659, - "end": 10663, + "start": 10745, + "end": 10749, "loc": { "start": { "line": 265, @@ -57848,8 +58910,8 @@ "binop": null, "updateContext": null }, - "start": 10663, - "end": 10664, + "start": 10749, + "end": 10750, "loc": { "start": { "line": 265, @@ -57874,8 +58936,8 @@ "binop": null }, "value": "_onMouseDown", - "start": 10664, - "end": 10676, + "start": 10750, + "end": 10762, "loc": { "start": { "line": 265, @@ -57901,8 +58963,8 @@ "updateContext": null }, "value": "=", - "start": 10677, - "end": 10678, + "start": 10763, + "end": 10764, "loc": { "start": { "line": 265, @@ -57926,8 +58988,8 @@ "postfix": false, "binop": null }, - "start": 10679, - "end": 10680, + "start": 10765, + "end": 10766, "loc": { "start": { "line": 265, @@ -57952,8 +59014,8 @@ "binop": null }, "value": "e", - "start": 10680, - "end": 10681, + "start": 10766, + "end": 10767, "loc": { "start": { "line": 265, @@ -57977,8 +59039,8 @@ "postfix": false, "binop": null }, - "start": 10681, - "end": 10682, + "start": 10767, + "end": 10768, "loc": { "start": { "line": 265, @@ -58003,8 +59065,8 @@ "binop": null, "updateContext": null }, - "start": 10683, - "end": 10685, + "start": 10769, + "end": 10771, "loc": { "start": { "line": 265, @@ -58028,8 +59090,8 @@ "postfix": false, "binop": null }, - "start": 10686, - "end": 10687, + "start": 10772, + "end": 10773, "loc": { "start": { "line": 265, @@ -58056,8 +59118,8 @@ "updateContext": null }, "value": "if", - "start": 10700, - "end": 10702, + "start": 10786, + "end": 10788, "loc": { "start": { "line": 266, @@ -58081,8 +59143,8 @@ "postfix": false, "binop": null }, - "start": 10703, - "end": 10704, + "start": 10789, + "end": 10790, "loc": { "start": { "line": 266, @@ -58107,8 +59169,8 @@ "binop": null }, "value": "e", - "start": 10704, - "end": 10705, + "start": 10790, + "end": 10791, "loc": { "start": { "line": 266, @@ -58133,8 +59195,8 @@ "binop": null, "updateContext": null }, - "start": 10705, - "end": 10706, + "start": 10791, + "end": 10792, "loc": { "start": { "line": 266, @@ -58159,8 +59221,8 @@ "binop": null }, "value": "which", - "start": 10706, - "end": 10711, + "start": 10792, + "end": 10797, "loc": { "start": { "line": 266, @@ -58186,8 +59248,8 @@ "updateContext": null }, "value": "!==", - "start": 10712, - "end": 10715, + "start": 10798, + "end": 10801, "loc": { "start": { "line": 266, @@ -58213,8 +59275,8 @@ "updateContext": null }, "value": 1, - "start": 10716, - "end": 10717, + "start": 10802, + "end": 10803, "loc": { "start": { "line": 266, @@ -58238,8 +59300,8 @@ "postfix": false, "binop": null }, - "start": 10717, - "end": 10718, + "start": 10803, + "end": 10804, "loc": { "start": { "line": 266, @@ -58263,8 +59325,8 @@ "postfix": false, "binop": null }, - "start": 10719, - "end": 10720, + "start": 10805, + "end": 10806, "loc": { "start": { "line": 266, @@ -58291,8 +59353,8 @@ "updateContext": null }, "value": "return", - "start": 10737, - "end": 10743, + "start": 10823, + "end": 10829, "loc": { "start": { "line": 267, @@ -58317,8 +59379,8 @@ "binop": null, "updateContext": null }, - "start": 10743, - "end": 10744, + "start": 10829, + "end": 10830, "loc": { "start": { "line": 267, @@ -58342,8 +59404,8 @@ "postfix": false, "binop": null }, - "start": 10757, - "end": 10758, + "start": 10843, + "end": 10844, "loc": { "start": { "line": 268, @@ -58368,8 +59430,8 @@ "binop": null }, "value": "pointerDownCanvasX", - "start": 10771, - "end": 10789, + "start": 10857, + "end": 10875, "loc": { "start": { "line": 269, @@ -58395,8 +59457,8 @@ "updateContext": null }, "value": "=", - "start": 10790, - "end": 10791, + "start": 10876, + "end": 10877, "loc": { "start": { "line": 269, @@ -58421,8 +59483,8 @@ "binop": null }, "value": "e", - "start": 10792, - "end": 10793, + "start": 10878, + "end": 10879, "loc": { "start": { "line": 269, @@ -58447,8 +59509,8 @@ "binop": null, "updateContext": null }, - "start": 10793, - "end": 10794, + "start": 10879, + "end": 10880, "loc": { "start": { "line": 269, @@ -58473,8 +59535,8 @@ "binop": null }, "value": "clientX", - "start": 10794, - "end": 10801, + "start": 10880, + "end": 10887, "loc": { "start": { "line": 269, @@ -58499,8 +59561,8 @@ "binop": null, "updateContext": null }, - "start": 10801, - "end": 10802, + "start": 10887, + "end": 10888, "loc": { "start": { "line": 269, @@ -58525,8 +59587,8 @@ "binop": null }, "value": "pointerDownCanvasY", - "start": 10815, - "end": 10833, + "start": 10901, + "end": 10919, "loc": { "start": { "line": 270, @@ -58552,8 +59614,8 @@ "updateContext": null }, "value": "=", - "start": 10834, - "end": 10835, + "start": 10920, + "end": 10921, "loc": { "start": { "line": 270, @@ -58578,8 +59640,8 @@ "binop": null }, "value": "e", - "start": 10836, - "end": 10837, + "start": 10922, + "end": 10923, "loc": { "start": { "line": 270, @@ -58604,8 +59666,8 @@ "binop": null, "updateContext": null }, - "start": 10837, - "end": 10838, + "start": 10923, + "end": 10924, "loc": { "start": { "line": 270, @@ -58630,8 +59692,8 @@ "binop": null }, "value": "clientY", - "start": 10838, - "end": 10845, + "start": 10924, + "end": 10931, "loc": { "start": { "line": 270, @@ -58656,8 +59718,8 @@ "binop": null, "updateContext": null }, - "start": 10845, - "end": 10846, + "start": 10931, + "end": 10932, "loc": { "start": { "line": 270, @@ -58681,8 +59743,8 @@ "postfix": false, "binop": null }, - "start": 10855, - "end": 10856, + "start": 10941, + "end": 10942, "loc": { "start": { "line": 271, @@ -58706,8 +59768,8 @@ "postfix": false, "binop": null }, - "start": 10856, - "end": 10857, + "start": 10942, + "end": 10943, "loc": { "start": { "line": 271, @@ -58732,8 +59794,8 @@ "binop": null, "updateContext": null }, - "start": 10857, - "end": 10858, + "start": 10943, + "end": 10944, "loc": { "start": { "line": 271, @@ -58758,8 +59820,8 @@ "binop": null }, "value": "canvas", - "start": 10868, - "end": 10874, + "start": 10954, + "end": 10960, "loc": { "start": { "line": 273, @@ -58784,8 +59846,8 @@ "binop": null, "updateContext": null }, - "start": 10874, - "end": 10875, + "start": 10960, + "end": 10961, "loc": { "start": { "line": 273, @@ -58810,8 +59872,8 @@ "binop": null }, "value": "addEventListener", - "start": 10875, - "end": 10891, + "start": 10961, + "end": 10977, "loc": { "start": { "line": 273, @@ -58835,8 +59897,8 @@ "postfix": false, "binop": null }, - "start": 10891, - "end": 10892, + "start": 10977, + "end": 10978, "loc": { "start": { "line": 273, @@ -58862,8 +59924,8 @@ "updateContext": null }, "value": "mouseup", - "start": 10892, - "end": 10901, + "start": 10978, + "end": 10987, "loc": { "start": { "line": 273, @@ -58888,8 +59950,8 @@ "binop": null, "updateContext": null }, - "start": 10901, - "end": 10902, + "start": 10987, + "end": 10988, "loc": { "start": { "line": 273, @@ -58916,8 +59978,8 @@ "updateContext": null }, "value": "this", - "start": 10903, - "end": 10907, + "start": 10989, + "end": 10993, "loc": { "start": { "line": 273, @@ -58942,8 +60004,8 @@ "binop": null, "updateContext": null }, - "start": 10907, - "end": 10908, + "start": 10993, + "end": 10994, "loc": { "start": { "line": 273, @@ -58968,8 +60030,8 @@ "binop": null }, "value": "_onMouseUp", - "start": 10908, - "end": 10918, + "start": 10994, + "end": 11004, "loc": { "start": { "line": 273, @@ -58995,8 +60057,8 @@ "updateContext": null }, "value": "=", - "start": 10919, - "end": 10920, + "start": 11005, + "end": 11006, "loc": { "start": { "line": 273, @@ -59020,8 +60082,8 @@ "postfix": false, "binop": null }, - "start": 10921, - "end": 10922, + "start": 11007, + "end": 11008, "loc": { "start": { "line": 273, @@ -59046,8 +60108,8 @@ "binop": null }, "value": "e", - "start": 10922, - "end": 10923, + "start": 11008, + "end": 11009, "loc": { "start": { "line": 273, @@ -59071,8 +60133,8 @@ "postfix": false, "binop": null }, - "start": 10923, - "end": 10924, + "start": 11009, + "end": 11010, "loc": { "start": { "line": 273, @@ -59097,8 +60159,8 @@ "binop": null, "updateContext": null }, - "start": 10925, - "end": 10927, + "start": 11011, + "end": 11013, "loc": { "start": { "line": 273, @@ -59122,8 +60184,8 @@ "postfix": false, "binop": null }, - "start": 10928, - "end": 10929, + "start": 11014, + "end": 11015, "loc": { "start": { "line": 273, @@ -59150,8 +60212,8 @@ "updateContext": null }, "value": "if", - "start": 10942, - "end": 10944, + "start": 11028, + "end": 11030, "loc": { "start": { "line": 274, @@ -59175,8 +60237,8 @@ "postfix": false, "binop": null }, - "start": 10945, - "end": 10946, + "start": 11031, + "end": 11032, "loc": { "start": { "line": 274, @@ -59201,8 +60263,8 @@ "binop": null }, "value": "e", - "start": 10946, - "end": 10947, + "start": 11032, + "end": 11033, "loc": { "start": { "line": 274, @@ -59227,8 +60289,8 @@ "binop": null, "updateContext": null }, - "start": 10947, - "end": 10948, + "start": 11033, + "end": 11034, "loc": { "start": { "line": 274, @@ -59253,8 +60315,8 @@ "binop": null }, "value": "which", - "start": 10948, - "end": 10953, + "start": 11034, + "end": 11039, "loc": { "start": { "line": 274, @@ -59280,8 +60342,8 @@ "updateContext": null }, "value": "!==", - "start": 10954, - "end": 10957, + "start": 11040, + "end": 11043, "loc": { "start": { "line": 274, @@ -59307,8 +60369,8 @@ "updateContext": null }, "value": 1, - "start": 10958, - "end": 10959, + "start": 11044, + "end": 11045, "loc": { "start": { "line": 274, @@ -59332,8 +60394,8 @@ "postfix": false, "binop": null }, - "start": 10959, - "end": 10960, + "start": 11045, + "end": 11046, "loc": { "start": { "line": 274, @@ -59357,8 +60419,8 @@ "postfix": false, "binop": null }, - "start": 10961, - "end": 10962, + "start": 11047, + "end": 11048, "loc": { "start": { "line": 274, @@ -59385,8 +60447,8 @@ "updateContext": null }, "value": "return", - "start": 10979, - "end": 10985, + "start": 11065, + "end": 11071, "loc": { "start": { "line": 275, @@ -59411,8 +60473,8 @@ "binop": null, "updateContext": null }, - "start": 10985, - "end": 10986, + "start": 11071, + "end": 11072, "loc": { "start": { "line": 275, @@ -59436,8 +60498,8 @@ "postfix": false, "binop": null }, - "start": 10999, - "end": 11000, + "start": 11085, + "end": 11086, "loc": { "start": { "line": 276, @@ -59464,8 +60526,8 @@ "updateContext": null }, "value": "if", - "start": 11013, - "end": 11015, + "start": 11099, + "end": 11101, "loc": { "start": { "line": 277, @@ -59489,8 +60551,8 @@ "postfix": false, "binop": null }, - "start": 11016, - "end": 11017, + "start": 11102, + "end": 11103, "loc": { "start": { "line": 277, @@ -59515,8 +60577,8 @@ "binop": null }, "value": "e", - "start": 11017, - "end": 11018, + "start": 11103, + "end": 11104, "loc": { "start": { "line": 277, @@ -59541,8 +60603,8 @@ "binop": null, "updateContext": null }, - "start": 11018, - "end": 11019, + "start": 11104, + "end": 11105, "loc": { "start": { "line": 277, @@ -59567,8 +60629,8 @@ "binop": null }, "value": "clientX", - "start": 11019, - "end": 11026, + "start": 11105, + "end": 11112, "loc": { "start": { "line": 277, @@ -59594,8 +60656,8 @@ "updateContext": null }, "value": ">", - "start": 11027, - "end": 11028, + "start": 11113, + "end": 11114, "loc": { "start": { "line": 277, @@ -59620,8 +60682,8 @@ "binop": null }, "value": "pointerDownCanvasX", - "start": 11029, - "end": 11047, + "start": 11115, + "end": 11133, "loc": { "start": { "line": 277, @@ -59647,8 +60709,8 @@ "updateContext": null }, "value": "+", - "start": 11048, - "end": 11049, + "start": 11134, + "end": 11135, "loc": { "start": { "line": 277, @@ -59673,8 +60735,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11050, - "end": 11064, + "start": 11136, + "end": 11150, "loc": { "start": { "line": 277, @@ -59700,8 +60762,8 @@ "updateContext": null }, "value": "||", - "start": 11065, - "end": 11067, + "start": 11151, + "end": 11153, "loc": { "start": { "line": 277, @@ -59726,8 +60788,8 @@ "binop": null }, "value": "e", - "start": 11084, - "end": 11085, + "start": 11170, + "end": 11171, "loc": { "start": { "line": 278, @@ -59752,8 +60814,8 @@ "binop": null, "updateContext": null }, - "start": 11085, - "end": 11086, + "start": 11171, + "end": 11172, "loc": { "start": { "line": 278, @@ -59778,8 +60840,8 @@ "binop": null }, "value": "clientX", - "start": 11086, - "end": 11093, + "start": 11172, + "end": 11179, "loc": { "start": { "line": 278, @@ -59805,8 +60867,8 @@ "updateContext": null }, "value": "<", - "start": 11094, - "end": 11095, + "start": 11180, + "end": 11181, "loc": { "start": { "line": 278, @@ -59831,8 +60893,8 @@ "binop": null }, "value": "pointerDownCanvasX", - "start": 11096, - "end": 11114, + "start": 11182, + "end": 11200, "loc": { "start": { "line": 278, @@ -59858,8 +60920,8 @@ "updateContext": null }, "value": "-", - "start": 11115, - "end": 11116, + "start": 11201, + "end": 11202, "loc": { "start": { "line": 278, @@ -59884,8 +60946,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11117, - "end": 11131, + "start": 11203, + "end": 11217, "loc": { "start": { "line": 278, @@ -59911,8 +60973,8 @@ "updateContext": null }, "value": "||", - "start": 11132, - "end": 11134, + "start": 11218, + "end": 11220, "loc": { "start": { "line": 278, @@ -59937,8 +60999,8 @@ "binop": null }, "value": "e", - "start": 11151, - "end": 11152, + "start": 11237, + "end": 11238, "loc": { "start": { "line": 279, @@ -59963,8 +61025,8 @@ "binop": null, "updateContext": null }, - "start": 11152, - "end": 11153, + "start": 11238, + "end": 11239, "loc": { "start": { "line": 279, @@ -59989,8 +61051,8 @@ "binop": null }, "value": "clientY", - "start": 11153, - "end": 11160, + "start": 11239, + "end": 11246, "loc": { "start": { "line": 279, @@ -60016,8 +61078,8 @@ "updateContext": null }, "value": ">", - "start": 11161, - "end": 11162, + "start": 11247, + "end": 11248, "loc": { "start": { "line": 279, @@ -60042,8 +61104,8 @@ "binop": null }, "value": "pointerDownCanvasY", - "start": 11163, - "end": 11181, + "start": 11249, + "end": 11267, "loc": { "start": { "line": 279, @@ -60069,8 +61131,8 @@ "updateContext": null }, "value": "+", - "start": 11182, - "end": 11183, + "start": 11268, + "end": 11269, "loc": { "start": { "line": 279, @@ -60095,8 +61157,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11184, - "end": 11198, + "start": 11270, + "end": 11284, "loc": { "start": { "line": 279, @@ -60122,8 +61184,8 @@ "updateContext": null }, "value": "||", - "start": 11199, - "end": 11201, + "start": 11285, + "end": 11287, "loc": { "start": { "line": 279, @@ -60148,8 +61210,8 @@ "binop": null }, "value": "e", - "start": 11218, - "end": 11219, + "start": 11304, + "end": 11305, "loc": { "start": { "line": 280, @@ -60174,8 +61236,8 @@ "binop": null, "updateContext": null }, - "start": 11219, - "end": 11220, + "start": 11305, + "end": 11306, "loc": { "start": { "line": 280, @@ -60200,8 +61262,8 @@ "binop": null }, "value": "clientY", - "start": 11220, - "end": 11227, + "start": 11306, + "end": 11313, "loc": { "start": { "line": 280, @@ -60227,8 +61289,8 @@ "updateContext": null }, "value": "<", - "start": 11228, - "end": 11229, + "start": 11314, + "end": 11315, "loc": { "start": { "line": 280, @@ -60253,8 +61315,8 @@ "binop": null }, "value": "pointerDownCanvasY", - "start": 11230, - "end": 11248, + "start": 11316, + "end": 11334, "loc": { "start": { "line": 280, @@ -60280,8 +61342,8 @@ "updateContext": null }, "value": "-", - "start": 11249, - "end": 11250, + "start": 11335, + "end": 11336, "loc": { "start": { "line": 280, @@ -60306,8 +61368,8 @@ "binop": null }, "value": "clickTolerance", - "start": 11251, - "end": 11265, + "start": 11337, + "end": 11351, "loc": { "start": { "line": 280, @@ -60331,8 +61393,8 @@ "postfix": false, "binop": null }, - "start": 11265, - "end": 11266, + "start": 11351, + "end": 11352, "loc": { "start": { "line": 280, @@ -60356,8 +61418,8 @@ "postfix": false, "binop": null }, - "start": 11267, - "end": 11268, + "start": 11353, + "end": 11354, "loc": { "start": { "line": 280, @@ -60384,8 +61446,8 @@ "updateContext": null }, "value": "return", - "start": 11285, - "end": 11291, + "start": 11371, + "end": 11377, "loc": { "start": { "line": 281, @@ -60410,8 +61472,8 @@ "binop": null, "updateContext": null }, - "start": 11291, - "end": 11292, + "start": 11377, + "end": 11378, "loc": { "start": { "line": 281, @@ -60435,8 +61497,8 @@ "postfix": false, "binop": null }, - "start": 11305, - "end": 11306, + "start": 11391, + "end": 11392, "loc": { "start": { "line": 282, @@ -60463,8 +61525,8 @@ "updateContext": null }, "value": "if", - "start": 11319, - "end": 11321, + "start": 11405, + "end": 11407, "loc": { "start": { "line": 283, @@ -60488,8 +61550,8 @@ "postfix": false, "binop": null }, - "start": 11322, - "end": 11323, + "start": 11408, + "end": 11409, "loc": { "start": { "line": 283, @@ -60516,8 +61578,8 @@ "updateContext": null }, "value": "this", - "start": 11323, - "end": 11327, + "start": 11409, + "end": 11413, "loc": { "start": { "line": 283, @@ -60542,8 +61604,8 @@ "binop": null, "updateContext": null }, - "start": 11327, - "end": 11328, + "start": 11413, + "end": 11414, "loc": { "start": { "line": 283, @@ -60568,8 +61630,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11328, - "end": 11355, + "start": 11414, + "end": 11441, "loc": { "start": { "line": 283, @@ -60593,8 +61655,8 @@ "postfix": false, "binop": null }, - "start": 11355, - "end": 11356, + "start": 11441, + "end": 11442, "loc": { "start": { "line": 283, @@ -60618,8 +61680,8 @@ "postfix": false, "binop": null }, - "start": 11357, - "end": 11358, + "start": 11443, + "end": 11444, "loc": { "start": { "line": 283, @@ -60646,8 +61708,8 @@ "updateContext": null }, "value": "if", - "start": 11375, - "end": 11377, + "start": 11461, + "end": 11463, "loc": { "start": { "line": 284, @@ -60671,8 +61733,8 @@ "postfix": false, "binop": null }, - "start": 11378, - "end": 11379, + "start": 11464, + "end": 11465, "loc": { "start": { "line": 284, @@ -60697,8 +61759,8 @@ "binop": null }, "value": "mouseHovering", - "start": 11379, - "end": 11392, + "start": 11465, + "end": 11478, "loc": { "start": { "line": 284, @@ -60722,8 +61784,8 @@ "postfix": false, "binop": null }, - "start": 11392, - "end": 11393, + "start": 11478, + "end": 11479, "loc": { "start": { "line": 284, @@ -60747,8 +61809,8 @@ "postfix": false, "binop": null }, - "start": 11394, - "end": 11395, + "start": 11480, + "end": 11481, "loc": { "start": { "line": 284, @@ -60775,8 +61837,8 @@ "updateContext": null }, "value": "this", - "start": 11416, - "end": 11420, + "start": 11502, + "end": 11506, "loc": { "start": { "line": 285, @@ -60801,8 +61863,8 @@ "binop": null, "updateContext": null }, - "start": 11420, - "end": 11421, + "start": 11506, + "end": 11507, "loc": { "start": { "line": 285, @@ -60827,8 +61889,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11421, - "end": 11448, + "start": 11507, + "end": 11534, "loc": { "start": { "line": 285, @@ -60853,8 +61915,8 @@ "binop": null, "updateContext": null }, - "start": 11448, - "end": 11449, + "start": 11534, + "end": 11535, "loc": { "start": { "line": 285, @@ -60879,8 +61941,8 @@ "binop": null }, "value": "target", - "start": 11449, - "end": 11455, + "start": 11535, + "end": 11541, "loc": { "start": { "line": 285, @@ -60905,8 +61967,8 @@ "binop": null, "updateContext": null }, - "start": 11455, - "end": 11456, + "start": 11541, + "end": 11542, "loc": { "start": { "line": 285, @@ -60931,8 +61993,8 @@ "binop": null }, "value": "entity", - "start": 11456, - "end": 11462, + "start": 11542, + "end": 11548, "loc": { "start": { "line": 285, @@ -60958,8 +62020,8 @@ "updateContext": null }, "value": "=", - "start": 11463, - "end": 11464, + "start": 11549, + "end": 11550, "loc": { "start": { "line": 285, @@ -60984,8 +62046,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 11465, - "end": 11478, + "start": 11551, + "end": 11564, "loc": { "start": { "line": 285, @@ -61010,8 +62072,8 @@ "binop": null, "updateContext": null }, - "start": 11478, - "end": 11479, + "start": 11564, + "end": 11565, "loc": { "start": { "line": 285, @@ -61036,8 +62098,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 11500, - "end": 11513, + "start": 11586, + "end": 11599, "loc": { "start": { "line": 286, @@ -61063,8 +62125,8 @@ "updateContext": null }, "value": "=", - "start": 11514, - "end": 11515, + "start": 11600, + "end": 11601, "loc": { "start": { "line": 286, @@ -61091,8 +62153,8 @@ "updateContext": null }, "value": "null", - "start": 11516, - "end": 11520, + "start": 11602, + "end": 11606, "loc": { "start": { "line": 286, @@ -61117,8 +62179,8 @@ "binop": null, "updateContext": null }, - "start": 11520, - "end": 11521, + "start": 11606, + "end": 11607, "loc": { "start": { "line": 286, @@ -61145,8 +62207,8 @@ "updateContext": null }, "value": "this", - "start": 11542, - "end": 11546, + "start": 11628, + "end": 11632, "loc": { "start": { "line": 287, @@ -61171,8 +62233,8 @@ "binop": null, "updateContext": null }, - "start": 11546, - "end": 11547, + "start": 11632, + "end": 11633, "loc": { "start": { "line": 287, @@ -61197,8 +62259,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11547, - "end": 11574, + "start": 11633, + "end": 11660, "loc": { "start": { "line": 287, @@ -61223,8 +62285,8 @@ "binop": null, "updateContext": null }, - "start": 11574, - "end": 11575, + "start": 11660, + "end": 11661, "loc": { "start": { "line": 287, @@ -61249,8 +62311,8 @@ "binop": null }, "value": "clickable", - "start": 11575, - "end": 11584, + "start": 11661, + "end": 11670, "loc": { "start": { "line": 287, @@ -61276,8 +62338,8 @@ "updateContext": null }, "value": "=", - "start": 11585, - "end": 11586, + "start": 11671, + "end": 11672, "loc": { "start": { "line": 287, @@ -61304,8 +62366,8 @@ "updateContext": null }, "value": "true", - "start": 11587, - "end": 11591, + "start": 11673, + "end": 11677, "loc": { "start": { "line": 287, @@ -61330,8 +62392,8 @@ "binop": null, "updateContext": null }, - "start": 11591, - "end": 11592, + "start": 11677, + "end": 11678, "loc": { "start": { "line": 287, @@ -61358,8 +62420,8 @@ "updateContext": null }, "value": "this", - "start": 11613, - "end": 11617, + "start": 11699, + "end": 11703, "loc": { "start": { "line": 288, @@ -61384,8 +62446,8 @@ "binop": null, "updateContext": null }, - "start": 11617, - "end": 11618, + "start": 11703, + "end": 11704, "loc": { "start": { "line": 288, @@ -61410,8 +62472,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 11618, - "end": 11644, + "start": 11704, + "end": 11730, "loc": { "start": { "line": 288, @@ -61436,8 +62498,8 @@ "binop": null, "updateContext": null }, - "start": 11644, - "end": 11645, + "start": 11730, + "end": 11731, "loc": { "start": { "line": 288, @@ -61462,8 +62524,8 @@ "binop": null }, "value": "fire", - "start": 11645, - "end": 11649, + "start": 11731, + "end": 11735, "loc": { "start": { "line": 288, @@ -61487,8 +62549,8 @@ "postfix": false, "binop": null }, - "start": 11649, - "end": 11650, + "start": 11735, + "end": 11736, "loc": { "start": { "line": 288, @@ -61514,8 +62576,8 @@ "updateContext": null }, "value": "measurementEnd", - "start": 11650, - "end": 11666, + "start": 11736, + "end": 11752, "loc": { "start": { "line": 288, @@ -61540,8 +62602,8 @@ "binop": null, "updateContext": null }, - "start": 11666, - "end": 11667, + "start": 11752, + "end": 11753, "loc": { "start": { "line": 288, @@ -61568,8 +62630,8 @@ "updateContext": null }, "value": "this", - "start": 11668, - "end": 11672, + "start": 11754, + "end": 11758, "loc": { "start": { "line": 288, @@ -61594,8 +62656,8 @@ "binop": null, "updateContext": null }, - "start": 11672, - "end": 11673, + "start": 11758, + "end": 11759, "loc": { "start": { "line": 288, @@ -61620,8 +62682,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11673, - "end": 11700, + "start": 11759, + "end": 11786, "loc": { "start": { "line": 288, @@ -61645,8 +62707,8 @@ "postfix": false, "binop": null }, - "start": 11700, - "end": 11701, + "start": 11786, + "end": 11787, "loc": { "start": { "line": 288, @@ -61671,8 +62733,8 @@ "binop": null, "updateContext": null }, - "start": 11701, - "end": 11702, + "start": 11787, + "end": 11788, "loc": { "start": { "line": 288, @@ -61699,8 +62761,8 @@ "updateContext": null }, "value": "this", - "start": 11723, - "end": 11727, + "start": 11809, + "end": 11813, "loc": { "start": { "line": 289, @@ -61725,8 +62787,8 @@ "binop": null, "updateContext": null }, - "start": 11727, - "end": 11728, + "start": 11813, + "end": 11814, "loc": { "start": { "line": 289, @@ -61751,8 +62813,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11728, - "end": 11755, + "start": 11814, + "end": 11841, "loc": { "start": { "line": 289, @@ -61778,8 +62840,8 @@ "updateContext": null }, "value": "=", - "start": 11756, - "end": 11757, + "start": 11842, + "end": 11843, "loc": { "start": { "line": 289, @@ -61806,8 +62868,8 @@ "updateContext": null }, "value": "null", - "start": 11758, - "end": 11762, + "start": 11844, + "end": 11848, "loc": { "start": { "line": 289, @@ -61832,8 +62894,8 @@ "binop": null, "updateContext": null }, - "start": 11762, - "end": 11763, + "start": 11848, + "end": 11849, "loc": { "start": { "line": 289, @@ -61857,8 +62919,8 @@ "postfix": false, "binop": null }, - "start": 11780, - "end": 11781, + "start": 11866, + "end": 11867, "loc": { "start": { "line": 290, @@ -61885,8 +62947,8 @@ "updateContext": null }, "value": "else", - "start": 11782, - "end": 11786, + "start": 11868, + "end": 11872, "loc": { "start": { "line": 290, @@ -61910,8 +62972,8 @@ "postfix": false, "binop": null }, - "start": 11787, - "end": 11788, + "start": 11873, + "end": 11874, "loc": { "start": { "line": 290, @@ -61938,8 +63000,8 @@ "updateContext": null }, "value": "this", - "start": 11809, - "end": 11813, + "start": 11895, + "end": 11899, "loc": { "start": { "line": 291, @@ -61964,8 +63026,8 @@ "binop": null, "updateContext": null }, - "start": 11813, - "end": 11814, + "start": 11899, + "end": 11900, "loc": { "start": { "line": 291, @@ -61990,8 +63052,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11814, - "end": 11841, + "start": 11900, + "end": 11927, "loc": { "start": { "line": 291, @@ -62016,8 +63078,8 @@ "binop": null, "updateContext": null }, - "start": 11841, - "end": 11842, + "start": 11927, + "end": 11928, "loc": { "start": { "line": 291, @@ -62042,8 +63104,8 @@ "binop": null }, "value": "destroy", - "start": 11842, - "end": 11849, + "start": 11928, + "end": 11935, "loc": { "start": { "line": 291, @@ -62067,8 +63129,8 @@ "postfix": false, "binop": null }, - "start": 11849, - "end": 11850, + "start": 11935, + "end": 11936, "loc": { "start": { "line": 291, @@ -62092,8 +63154,8 @@ "postfix": false, "binop": null }, - "start": 11850, - "end": 11851, + "start": 11936, + "end": 11937, "loc": { "start": { "line": 291, @@ -62118,8 +63180,8 @@ "binop": null, "updateContext": null }, - "start": 11851, - "end": 11852, + "start": 11937, + "end": 11938, "loc": { "start": { "line": 291, @@ -62146,8 +63208,8 @@ "updateContext": null }, "value": "this", - "start": 11873, - "end": 11877, + "start": 11959, + "end": 11963, "loc": { "start": { "line": 292, @@ -62172,8 +63234,8 @@ "binop": null, "updateContext": null }, - "start": 11877, - "end": 11878, + "start": 11963, + "end": 11964, "loc": { "start": { "line": 292, @@ -62198,8 +63260,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 11878, - "end": 11904, + "start": 11964, + "end": 11990, "loc": { "start": { "line": 292, @@ -62224,8 +63286,8 @@ "binop": null, "updateContext": null }, - "start": 11904, - "end": 11905, + "start": 11990, + "end": 11991, "loc": { "start": { "line": 292, @@ -62250,8 +63312,8 @@ "binop": null }, "value": "fire", - "start": 11905, - "end": 11909, + "start": 11991, + "end": 11995, "loc": { "start": { "line": 292, @@ -62275,8 +63337,8 @@ "postfix": false, "binop": null }, - "start": 11909, - "end": 11910, + "start": 11995, + "end": 11996, "loc": { "start": { "line": 292, @@ -62302,8 +63364,8 @@ "updateContext": null }, "value": "measurementCancel", - "start": 11910, - "end": 11929, + "start": 11996, + "end": 12015, "loc": { "start": { "line": 292, @@ -62328,8 +63390,8 @@ "binop": null, "updateContext": null }, - "start": 11929, - "end": 11930, + "start": 12015, + "end": 12016, "loc": { "start": { "line": 292, @@ -62356,8 +63418,8 @@ "updateContext": null }, "value": "this", - "start": 11931, - "end": 11935, + "start": 12017, + "end": 12021, "loc": { "start": { "line": 292, @@ -62382,8 +63444,8 @@ "binop": null, "updateContext": null }, - "start": 11935, - "end": 11936, + "start": 12021, + "end": 12022, "loc": { "start": { "line": 292, @@ -62408,8 +63470,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11936, - "end": 11963, + "start": 12022, + "end": 12049, "loc": { "start": { "line": 292, @@ -62433,8 +63495,8 @@ "postfix": false, "binop": null }, - "start": 11963, - "end": 11964, + "start": 12049, + "end": 12050, "loc": { "start": { "line": 292, @@ -62459,8 +63521,8 @@ "binop": null, "updateContext": null }, - "start": 11964, - "end": 11965, + "start": 12050, + "end": 12051, "loc": { "start": { "line": 292, @@ -62487,8 +63549,8 @@ "updateContext": null }, "value": "this", - "start": 11986, - "end": 11990, + "start": 12072, + "end": 12076, "loc": { "start": { "line": 293, @@ -62513,8 +63575,8 @@ "binop": null, "updateContext": null }, - "start": 11990, - "end": 11991, + "start": 12076, + "end": 12077, "loc": { "start": { "line": 293, @@ -62539,8 +63601,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 11991, - "end": 12018, + "start": 12077, + "end": 12104, "loc": { "start": { "line": 293, @@ -62566,8 +63628,8 @@ "updateContext": null }, "value": "=", - "start": 12019, - "end": 12020, + "start": 12105, + "end": 12106, "loc": { "start": { "line": 293, @@ -62594,8 +63656,8 @@ "updateContext": null }, "value": "null", - "start": 12021, - "end": 12025, + "start": 12107, + "end": 12111, "loc": { "start": { "line": 293, @@ -62620,8 +63682,8 @@ "binop": null, "updateContext": null }, - "start": 12025, - "end": 12026, + "start": 12111, + "end": 12112, "loc": { "start": { "line": 293, @@ -62646,8 +63708,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 12047, - "end": 12060, + "start": 12133, + "end": 12146, "loc": { "start": { "line": 294, @@ -62673,8 +63735,8 @@ "updateContext": null }, "value": "=", - "start": 12061, - "end": 12062, + "start": 12147, + "end": 12148, "loc": { "start": { "line": 294, @@ -62701,8 +63763,8 @@ "updateContext": null }, "value": "null", - "start": 12063, - "end": 12067, + "start": 12149, + "end": 12153, "loc": { "start": { "line": 294, @@ -62727,8 +63789,8 @@ "binop": null, "updateContext": null }, - "start": 12067, - "end": 12068, + "start": 12153, + "end": 12154, "loc": { "start": { "line": 294, @@ -62752,8 +63814,8 @@ "postfix": false, "binop": null }, - "start": 12085, - "end": 12086, + "start": 12171, + "end": 12172, "loc": { "start": { "line": 295, @@ -62777,8 +63839,8 @@ "postfix": false, "binop": null }, - "start": 12099, - "end": 12100, + "start": 12185, + "end": 12186, "loc": { "start": { "line": 296, @@ -62805,8 +63867,8 @@ "updateContext": null }, "value": "else", - "start": 12101, - "end": 12105, + "start": 12187, + "end": 12191, "loc": { "start": { "line": 296, @@ -62830,8 +63892,8 @@ "postfix": false, "binop": null }, - "start": 12106, - "end": 12107, + "start": 12192, + "end": 12193, "loc": { "start": { "line": 296, @@ -62858,8 +63920,8 @@ "updateContext": null }, "value": "if", - "start": 12124, - "end": 12126, + "start": 12210, + "end": 12212, "loc": { "start": { "line": 297, @@ -62883,8 +63945,8 @@ "postfix": false, "binop": null }, - "start": 12127, - "end": 12128, + "start": 12213, + "end": 12214, "loc": { "start": { "line": 297, @@ -62909,8 +63971,8 @@ "binop": null }, "value": "mouseHovering", - "start": 12128, - "end": 12141, + "start": 12214, + "end": 12227, "loc": { "start": { "line": 297, @@ -62934,8 +63996,8 @@ "postfix": false, "binop": null }, - "start": 12141, - "end": 12142, + "start": 12227, + "end": 12228, "loc": { "start": { "line": 297, @@ -62959,8 +64021,8 @@ "postfix": false, "binop": null }, - "start": 12143, - "end": 12144, + "start": 12229, + "end": 12230, "loc": { "start": { "line": 297, @@ -62987,8 +64049,8 @@ "updateContext": null }, "value": "this", - "start": 12165, - "end": 12169, + "start": 12251, + "end": 12255, "loc": { "start": { "line": 298, @@ -63013,8 +64075,8 @@ "binop": null, "updateContext": null }, - "start": 12169, - "end": 12170, + "start": 12255, + "end": 12256, "loc": { "start": { "line": 298, @@ -63039,8 +64101,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 12170, - "end": 12197, + "start": 12256, + "end": 12283, "loc": { "start": { "line": 298, @@ -63066,8 +64128,8 @@ "updateContext": null }, "value": "=", - "start": 12198, - "end": 12199, + "start": 12284, + "end": 12285, "loc": { "start": { "line": 298, @@ -63092,8 +64154,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 12200, - "end": 12226, + "start": 12286, + "end": 12312, "loc": { "start": { "line": 298, @@ -63118,8 +64180,8 @@ "binop": null, "updateContext": null }, - "start": 12226, - "end": 12227, + "start": 12312, + "end": 12313, "loc": { "start": { "line": 298, @@ -63144,8 +64206,8 @@ "binop": null }, "value": "createMeasurement", - "start": 12227, - "end": 12244, + "start": 12313, + "end": 12330, "loc": { "start": { "line": 298, @@ -63169,8 +64231,8 @@ "postfix": false, "binop": null }, - "start": 12244, - "end": 12245, + "start": 12330, + "end": 12331, "loc": { "start": { "line": 298, @@ -63194,8 +64256,8 @@ "postfix": false, "binop": null }, - "start": 12245, - "end": 12246, + "start": 12331, + "end": 12332, "loc": { "start": { "line": 298, @@ -63220,8 +64282,8 @@ "binop": null }, "value": "id", - "start": 12271, - "end": 12273, + "start": 12357, + "end": 12359, "loc": { "start": { "line": 299, @@ -63246,8 +64308,8 @@ "binop": null, "updateContext": null }, - "start": 12273, - "end": 12274, + "start": 12359, + "end": 12360, "loc": { "start": { "line": 299, @@ -63272,8 +64334,8 @@ "binop": null }, "value": "math", - "start": 12275, - "end": 12279, + "start": 12361, + "end": 12365, "loc": { "start": { "line": 299, @@ -63298,8 +64360,8 @@ "binop": null, "updateContext": null }, - "start": 12279, - "end": 12280, + "start": 12365, + "end": 12366, "loc": { "start": { "line": 299, @@ -63324,8 +64386,8 @@ "binop": null }, "value": "createUUID", - "start": 12280, - "end": 12290, + "start": 12366, + "end": 12376, "loc": { "start": { "line": 299, @@ -63349,8 +64411,8 @@ "postfix": false, "binop": null }, - "start": 12290, - "end": 12291, + "start": 12376, + "end": 12377, "loc": { "start": { "line": 299, @@ -63374,8 +64436,8 @@ "postfix": false, "binop": null }, - "start": 12291, - "end": 12292, + "start": 12377, + "end": 12378, "loc": { "start": { "line": 299, @@ -63400,8 +64462,8 @@ "binop": null, "updateContext": null }, - "start": 12292, - "end": 12293, + "start": 12378, + "end": 12379, "loc": { "start": { "line": 299, @@ -63426,8 +64488,8 @@ "binop": null }, "value": "origin", - "start": 12318, - "end": 12324, + "start": 12404, + "end": 12410, "loc": { "start": { "line": 300, @@ -63452,8 +64514,8 @@ "binop": null, "updateContext": null }, - "start": 12324, - "end": 12325, + "start": 12410, + "end": 12411, "loc": { "start": { "line": 300, @@ -63477,8 +64539,8 @@ "postfix": false, "binop": null }, - "start": 12326, - "end": 12327, + "start": 12412, + "end": 12413, "loc": { "start": { "line": 300, @@ -63503,8 +64565,8 @@ "binop": null }, "value": "worldPos", - "start": 12356, - "end": 12364, + "start": 12442, + "end": 12450, "loc": { "start": { "line": 301, @@ -63529,8 +64591,8 @@ "binop": null, "updateContext": null }, - "start": 12364, - "end": 12365, + "start": 12450, + "end": 12451, "loc": { "start": { "line": 301, @@ -63555,8 +64617,8 @@ "binop": null }, "value": "pointerWorldPos", - "start": 12366, - "end": 12381, + "start": 12452, + "end": 12467, "loc": { "start": { "line": 301, @@ -63581,8 +64643,8 @@ "binop": null, "updateContext": null }, - "start": 12381, - "end": 12382, + "start": 12467, + "end": 12468, "loc": { "start": { "line": 301, @@ -63607,8 +64669,8 @@ "binop": null }, "value": "slice", - "start": 12382, - "end": 12387, + "start": 12468, + "end": 12473, "loc": { "start": { "line": 301, @@ -63632,8 +64694,8 @@ "postfix": false, "binop": null }, - "start": 12387, - "end": 12388, + "start": 12473, + "end": 12474, "loc": { "start": { "line": 301, @@ -63657,8 +64719,8 @@ "postfix": false, "binop": null }, - "start": 12388, - "end": 12389, + "start": 12474, + "end": 12475, "loc": { "start": { "line": 301, @@ -63683,8 +64745,8 @@ "binop": null, "updateContext": null }, - "start": 12389, - "end": 12390, + "start": 12475, + "end": 12476, "loc": { "start": { "line": 301, @@ -63709,8 +64771,8 @@ "binop": null }, "value": "entity", - "start": 12419, - "end": 12425, + "start": 12505, + "end": 12511, "loc": { "start": { "line": 302, @@ -63735,8 +64797,8 @@ "binop": null, "updateContext": null }, - "start": 12425, - "end": 12426, + "start": 12511, + "end": 12512, "loc": { "start": { "line": 302, @@ -63761,8 +64823,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 12427, - "end": 12440, + "start": 12513, + "end": 12526, "loc": { "start": { "line": 302, @@ -63786,8 +64848,8 @@ "postfix": false, "binop": null }, - "start": 12465, - "end": 12466, + "start": 12551, + "end": 12552, "loc": { "start": { "line": 303, @@ -63812,8 +64874,8 @@ "binop": null, "updateContext": null }, - "start": 12466, - "end": 12467, + "start": 12552, + "end": 12553, "loc": { "start": { "line": 303, @@ -63838,8 +64900,8 @@ "binop": null }, "value": "target", - "start": 12492, - "end": 12498, + "start": 12578, + "end": 12584, "loc": { "start": { "line": 304, @@ -63864,8 +64926,8 @@ "binop": null, "updateContext": null }, - "start": 12498, - "end": 12499, + "start": 12584, + "end": 12585, "loc": { "start": { "line": 304, @@ -63889,8 +64951,8 @@ "postfix": false, "binop": null }, - "start": 12500, - "end": 12501, + "start": 12586, + "end": 12587, "loc": { "start": { "line": 304, @@ -63915,8 +64977,8 @@ "binop": null }, "value": "worldPos", - "start": 12530, - "end": 12538, + "start": 12616, + "end": 12624, "loc": { "start": { "line": 305, @@ -63941,8 +65003,8 @@ "binop": null, "updateContext": null }, - "start": 12538, - "end": 12539, + "start": 12624, + "end": 12625, "loc": { "start": { "line": 305, @@ -63967,8 +65029,8 @@ "binop": null }, "value": "pointerWorldPos", - "start": 12540, - "end": 12555, + "start": 12626, + "end": 12641, "loc": { "start": { "line": 305, @@ -63993,8 +65055,8 @@ "binop": null, "updateContext": null }, - "start": 12555, - "end": 12556, + "start": 12641, + "end": 12642, "loc": { "start": { "line": 305, @@ -64019,8 +65081,8 @@ "binop": null }, "value": "slice", - "start": 12556, - "end": 12561, + "start": 12642, + "end": 12647, "loc": { "start": { "line": 305, @@ -64044,8 +65106,8 @@ "postfix": false, "binop": null }, - "start": 12561, - "end": 12562, + "start": 12647, + "end": 12648, "loc": { "start": { "line": 305, @@ -64069,8 +65131,8 @@ "postfix": false, "binop": null }, - "start": 12562, - "end": 12563, + "start": 12648, + "end": 12649, "loc": { "start": { "line": 305, @@ -64095,8 +65157,8 @@ "binop": null, "updateContext": null }, - "start": 12563, - "end": 12564, + "start": 12649, + "end": 12650, "loc": { "start": { "line": 305, @@ -64121,8 +65183,8 @@ "binop": null }, "value": "entity", - "start": 12593, - "end": 12599, + "start": 12679, + "end": 12685, "loc": { "start": { "line": 306, @@ -64147,8 +65209,8 @@ "binop": null, "updateContext": null }, - "start": 12599, - "end": 12600, + "start": 12685, + "end": 12686, "loc": { "start": { "line": 306, @@ -64173,8 +65235,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 12601, - "end": 12614, + "start": 12687, + "end": 12700, "loc": { "start": { "line": 306, @@ -64198,8 +65260,8 @@ "postfix": false, "binop": null }, - "start": 12639, - "end": 12640, + "start": 12725, + "end": 12726, "loc": { "start": { "line": 307, @@ -64224,8 +65286,8 @@ "binop": null, "updateContext": null }, - "start": 12640, - "end": 12641, + "start": 12726, + "end": 12727, "loc": { "start": { "line": 307, @@ -64250,8 +65312,8 @@ "binop": null }, "value": "approximate", - "start": 12666, - "end": 12677, + "start": 12752, + "end": 12763, "loc": { "start": { "line": 308, @@ -64276,8 +65338,8 @@ "binop": null, "updateContext": null }, - "start": 12677, - "end": 12678, + "start": 12763, + "end": 12764, "loc": { "start": { "line": 308, @@ -64304,8 +65366,8 @@ "updateContext": null }, "value": "true", - "start": 12679, - "end": 12683, + "start": 12765, + "end": 12769, "loc": { "start": { "line": 308, @@ -64329,8 +65391,8 @@ "postfix": false, "binop": null }, - "start": 12704, - "end": 12705, + "start": 12790, + "end": 12791, "loc": { "start": { "line": 309, @@ -64354,8 +65416,8 @@ "postfix": false, "binop": null }, - "start": 12705, - "end": 12706, + "start": 12791, + "end": 12792, "loc": { "start": { "line": 309, @@ -64380,8 +65442,8 @@ "binop": null, "updateContext": null }, - "start": 12706, - "end": 12707, + "start": 12792, + "end": 12793, "loc": { "start": { "line": 309, @@ -64408,8 +65470,8 @@ "updateContext": null }, "value": "this", - "start": 12728, - "end": 12732, + "start": 12814, + "end": 12818, "loc": { "start": { "line": 310, @@ -64434,8 +65496,8 @@ "binop": null, "updateContext": null }, - "start": 12732, - "end": 12733, + "start": 12818, + "end": 12819, "loc": { "start": { "line": 310, @@ -64460,8 +65522,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 12733, - "end": 12769, + "start": 12819, + "end": 12855, "loc": { "start": { "line": 310, @@ -64486,8 +65548,8 @@ "binop": null, "updateContext": null }, - "start": 12769, - "end": 12770, + "start": 12855, + "end": 12856, "loc": { "start": { "line": 310, @@ -64512,8 +65574,8 @@ "binop": null }, "value": "axisVisible", - "start": 12770, - "end": 12781, + "start": 12856, + "end": 12867, "loc": { "start": { "line": 310, @@ -64539,8 +65601,8 @@ "updateContext": null }, "value": "=", - "start": 12782, - "end": 12783, + "start": 12868, + "end": 12869, "loc": { "start": { "line": 310, @@ -64567,8 +65629,8 @@ "updateContext": null }, "value": "this", - "start": 12784, - "end": 12788, + "start": 12870, + "end": 12874, "loc": { "start": { "line": 310, @@ -64593,8 +65655,8 @@ "binop": null, "updateContext": null }, - "start": 12788, - "end": 12789, + "start": 12874, + "end": 12875, "loc": { "start": { "line": 310, @@ -64619,8 +65681,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 12789, - "end": 12816, + "start": 12875, + "end": 12902, "loc": { "start": { "line": 310, @@ -64645,8 +65707,8 @@ "binop": null, "updateContext": null }, - "start": 12816, - "end": 12817, + "start": 12902, + "end": 12903, "loc": { "start": { "line": 310, @@ -64671,8 +65733,8 @@ "binop": null }, "value": "axisVisible", - "start": 12817, - "end": 12828, + "start": 12903, + "end": 12914, "loc": { "start": { "line": 310, @@ -64698,8 +65760,8 @@ "updateContext": null }, "value": "&&", - "start": 12829, - "end": 12831, + "start": 12915, + "end": 12917, "loc": { "start": { "line": 310, @@ -64726,8 +65788,8 @@ "updateContext": null }, "value": "this", - "start": 12832, - "end": 12836, + "start": 12918, + "end": 12922, "loc": { "start": { "line": 310, @@ -64752,8 +65814,8 @@ "binop": null, "updateContext": null }, - "start": 12836, - "end": 12837, + "start": 12922, + "end": 12923, "loc": { "start": { "line": 310, @@ -64778,8 +65840,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 12837, - "end": 12863, + "start": 12923, + "end": 12949, "loc": { "start": { "line": 310, @@ -64804,8 +65866,8 @@ "binop": null, "updateContext": null }, - "start": 12863, - "end": 12864, + "start": 12949, + "end": 12950, "loc": { "start": { "line": 310, @@ -64830,8 +65892,8 @@ "binop": null }, "value": "defaultAxisVisible", - "start": 12864, - "end": 12882, + "start": 12950, + "end": 12968, "loc": { "start": { "line": 310, @@ -64856,8 +65918,8 @@ "binop": null, "updateContext": null }, - "start": 12882, - "end": 12883, + "start": 12968, + "end": 12969, "loc": { "start": { "line": 310, @@ -64884,8 +65946,8 @@ "updateContext": null }, "value": "this", - "start": 12904, - "end": 12908, + "start": 12990, + "end": 12994, "loc": { "start": { "line": 311, @@ -64910,8 +65972,8 @@ "binop": null, "updateContext": null }, - "start": 12908, - "end": 12909, + "start": 12994, + "end": 12995, "loc": { "start": { "line": 311, @@ -64936,8 +65998,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 12909, - "end": 12945, + "start": 12995, + "end": 13031, "loc": { "start": { "line": 311, @@ -64962,8 +66024,8 @@ "binop": null, "updateContext": null }, - "start": 12945, - "end": 12946, + "start": 13031, + "end": 13032, "loc": { "start": { "line": 311, @@ -64988,8 +66050,8 @@ "binop": null }, "value": "xAxisVisible", - "start": 12946, - "end": 12958, + "start": 13032, + "end": 13044, "loc": { "start": { "line": 311, @@ -65015,8 +66077,8 @@ "updateContext": null }, "value": "=", - "start": 12959, - "end": 12960, + "start": 13045, + "end": 13046, "loc": { "start": { "line": 311, @@ -65043,8 +66105,8 @@ "updateContext": null }, "value": "this", - "start": 12961, - "end": 12965, + "start": 13047, + "end": 13051, "loc": { "start": { "line": 311, @@ -65069,8 +66131,8 @@ "binop": null, "updateContext": null }, - "start": 12965, - "end": 12966, + "start": 13051, + "end": 13052, "loc": { "start": { "line": 311, @@ -65095,8 +66157,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 12966, - "end": 12993, + "start": 13052, + "end": 13079, "loc": { "start": { "line": 311, @@ -65121,8 +66183,8 @@ "binop": null, "updateContext": null }, - "start": 12993, - "end": 12994, + "start": 13079, + "end": 13080, "loc": { "start": { "line": 311, @@ -65147,8 +66209,8 @@ "binop": null }, "value": "xAxisVisible", - "start": 12994, - "end": 13006, + "start": 13080, + "end": 13092, "loc": { "start": { "line": 311, @@ -65174,8 +66236,8 @@ "updateContext": null }, "value": "&&", - "start": 13007, - "end": 13009, + "start": 13093, + "end": 13095, "loc": { "start": { "line": 311, @@ -65202,8 +66264,8 @@ "updateContext": null }, "value": "this", - "start": 13010, - "end": 13014, + "start": 13096, + "end": 13100, "loc": { "start": { "line": 311, @@ -65228,8 +66290,8 @@ "binop": null, "updateContext": null }, - "start": 13014, - "end": 13015, + "start": 13100, + "end": 13101, "loc": { "start": { "line": 311, @@ -65254,8 +66316,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 13015, - "end": 13041, + "start": 13101, + "end": 13127, "loc": { "start": { "line": 311, @@ -65280,8 +66342,8 @@ "binop": null, "updateContext": null }, - "start": 13041, - "end": 13042, + "start": 13127, + "end": 13128, "loc": { "start": { "line": 311, @@ -65306,8 +66368,8 @@ "binop": null }, "value": "defaultXAxisVisible", - "start": 13042, - "end": 13061, + "start": 13128, + "end": 13147, "loc": { "start": { "line": 311, @@ -65332,8 +66394,8 @@ "binop": null, "updateContext": null }, - "start": 13061, - "end": 13062, + "start": 13147, + "end": 13148, "loc": { "start": { "line": 311, @@ -65360,8 +66422,8 @@ "updateContext": null }, "value": "this", - "start": 13083, - "end": 13087, + "start": 13169, + "end": 13173, "loc": { "start": { "line": 312, @@ -65386,8 +66448,8 @@ "binop": null, "updateContext": null }, - "start": 13087, - "end": 13088, + "start": 13173, + "end": 13174, "loc": { "start": { "line": 312, @@ -65412,8 +66474,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 13088, - "end": 13124, + "start": 13174, + "end": 13210, "loc": { "start": { "line": 312, @@ -65438,8 +66500,8 @@ "binop": null, "updateContext": null }, - "start": 13124, - "end": 13125, + "start": 13210, + "end": 13211, "loc": { "start": { "line": 312, @@ -65464,8 +66526,8 @@ "binop": null }, "value": "yAxisVisible", - "start": 13125, - "end": 13137, + "start": 13211, + "end": 13223, "loc": { "start": { "line": 312, @@ -65491,8 +66553,8 @@ "updateContext": null }, "value": "=", - "start": 13138, - "end": 13139, + "start": 13224, + "end": 13225, "loc": { "start": { "line": 312, @@ -65519,8 +66581,8 @@ "updateContext": null }, "value": "this", - "start": 13140, - "end": 13144, + "start": 13226, + "end": 13230, "loc": { "start": { "line": 312, @@ -65545,8 +66607,8 @@ "binop": null, "updateContext": null }, - "start": 13144, - "end": 13145, + "start": 13230, + "end": 13231, "loc": { "start": { "line": 312, @@ -65571,8 +66633,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13145, - "end": 13172, + "start": 13231, + "end": 13258, "loc": { "start": { "line": 312, @@ -65597,8 +66659,8 @@ "binop": null, "updateContext": null }, - "start": 13172, - "end": 13173, + "start": 13258, + "end": 13259, "loc": { "start": { "line": 312, @@ -65623,8 +66685,8 @@ "binop": null }, "value": "yAxisVisible", - "start": 13173, - "end": 13185, + "start": 13259, + "end": 13271, "loc": { "start": { "line": 312, @@ -65650,8 +66712,8 @@ "updateContext": null }, "value": "&&", - "start": 13186, - "end": 13188, + "start": 13272, + "end": 13274, "loc": { "start": { "line": 312, @@ -65678,8 +66740,8 @@ "updateContext": null }, "value": "this", - "start": 13189, - "end": 13193, + "start": 13275, + "end": 13279, "loc": { "start": { "line": 312, @@ -65704,8 +66766,8 @@ "binop": null, "updateContext": null }, - "start": 13193, - "end": 13194, + "start": 13279, + "end": 13280, "loc": { "start": { "line": 312, @@ -65730,8 +66792,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 13194, - "end": 13220, + "start": 13280, + "end": 13306, "loc": { "start": { "line": 312, @@ -65756,8 +66818,8 @@ "binop": null, "updateContext": null }, - "start": 13220, - "end": 13221, + "start": 13306, + "end": 13307, "loc": { "start": { "line": 312, @@ -65782,8 +66844,8 @@ "binop": null }, "value": "defaultYAxisVisible", - "start": 13221, - "end": 13240, + "start": 13307, + "end": 13326, "loc": { "start": { "line": 312, @@ -65808,8 +66870,8 @@ "binop": null, "updateContext": null }, - "start": 13240, - "end": 13241, + "start": 13326, + "end": 13327, "loc": { "start": { "line": 312, @@ -65836,8 +66898,8 @@ "updateContext": null }, "value": "this", - "start": 13262, - "end": 13266, + "start": 13348, + "end": 13352, "loc": { "start": { "line": 313, @@ -65862,8 +66924,8 @@ "binop": null, "updateContext": null }, - "start": 13266, - "end": 13267, + "start": 13352, + "end": 13353, "loc": { "start": { "line": 313, @@ -65888,8 +66950,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 13267, - "end": 13303, + "start": 13353, + "end": 13389, "loc": { "start": { "line": 313, @@ -65914,8 +66976,8 @@ "binop": null, "updateContext": null }, - "start": 13303, - "end": 13304, + "start": 13389, + "end": 13390, "loc": { "start": { "line": 313, @@ -65940,8 +67002,8 @@ "binop": null }, "value": "zAxisVisible", - "start": 13304, - "end": 13316, + "start": 13390, + "end": 13402, "loc": { "start": { "line": 313, @@ -65967,8 +67029,8 @@ "updateContext": null }, "value": "=", - "start": 13317, - "end": 13318, + "start": 13403, + "end": 13404, "loc": { "start": { "line": 313, @@ -65995,8 +67057,8 @@ "updateContext": null }, "value": "this", - "start": 13319, - "end": 13323, + "start": 13405, + "end": 13409, "loc": { "start": { "line": 313, @@ -66021,8 +67083,8 @@ "binop": null, "updateContext": null }, - "start": 13323, - "end": 13324, + "start": 13409, + "end": 13410, "loc": { "start": { "line": 313, @@ -66047,8 +67109,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13324, - "end": 13351, + "start": 13410, + "end": 13437, "loc": { "start": { "line": 313, @@ -66073,8 +67135,8 @@ "binop": null, "updateContext": null }, - "start": 13351, - "end": 13352, + "start": 13437, + "end": 13438, "loc": { "start": { "line": 313, @@ -66099,8 +67161,8 @@ "binop": null }, "value": "zAxisVisible", - "start": 13352, - "end": 13364, + "start": 13438, + "end": 13450, "loc": { "start": { "line": 313, @@ -66126,8 +67188,8 @@ "updateContext": null }, "value": "&&", - "start": 13365, - "end": 13367, + "start": 13451, + "end": 13453, "loc": { "start": { "line": 313, @@ -66154,8 +67216,8 @@ "updateContext": null }, "value": "this", - "start": 13368, - "end": 13372, + "start": 13454, + "end": 13458, "loc": { "start": { "line": 313, @@ -66180,8 +67242,8 @@ "binop": null, "updateContext": null }, - "start": 13372, - "end": 13373, + "start": 13458, + "end": 13459, "loc": { "start": { "line": 313, @@ -66206,8 +67268,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 13373, - "end": 13399, + "start": 13459, + "end": 13485, "loc": { "start": { "line": 313, @@ -66232,8 +67294,8 @@ "binop": null, "updateContext": null }, - "start": 13399, - "end": 13400, + "start": 13485, + "end": 13486, "loc": { "start": { "line": 313, @@ -66258,8 +67320,8 @@ "binop": null }, "value": "defaultZAxisVisible", - "start": 13400, - "end": 13419, + "start": 13486, + "end": 13505, "loc": { "start": { "line": 313, @@ -66284,8 +67346,8 @@ "binop": null, "updateContext": null }, - "start": 13419, - "end": 13420, + "start": 13505, + "end": 13506, "loc": { "start": { "line": 313, @@ -66312,8 +67374,8 @@ "updateContext": null }, "value": "this", - "start": 13441, - "end": 13445, + "start": 13527, + "end": 13531, "loc": { "start": { "line": 314, @@ -66338,8 +67400,8 @@ "binop": null, "updateContext": null }, - "start": 13445, - "end": 13446, + "start": 13531, + "end": 13532, "loc": { "start": { "line": 314, @@ -66364,8 +67426,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 13446, - "end": 13482, + "start": 13532, + "end": 13568, "loc": { "start": { "line": 314, @@ -66390,8 +67452,8 @@ "binop": null, "updateContext": null }, - "start": 13482, - "end": 13483, + "start": 13568, + "end": 13569, "loc": { "start": { "line": 314, @@ -66416,8 +67478,8 @@ "binop": null }, "value": "wireVisible", - "start": 13483, - "end": 13494, + "start": 13569, + "end": 13580, "loc": { "start": { "line": 314, @@ -66443,8 +67505,8 @@ "updateContext": null }, "value": "=", - "start": 13495, - "end": 13496, + "start": 13581, + "end": 13582, "loc": { "start": { "line": 314, @@ -66471,8 +67533,8 @@ "updateContext": null }, "value": "this", - "start": 13497, - "end": 13501, + "start": 13583, + "end": 13587, "loc": { "start": { "line": 314, @@ -66497,8 +67559,8 @@ "binop": null, "updateContext": null }, - "start": 13501, - "end": 13502, + "start": 13587, + "end": 13588, "loc": { "start": { "line": 314, @@ -66523,8 +67585,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13502, - "end": 13529, + "start": 13588, + "end": 13615, "loc": { "start": { "line": 314, @@ -66549,8 +67611,8 @@ "binop": null, "updateContext": null }, - "start": 13529, - "end": 13530, + "start": 13615, + "end": 13616, "loc": { "start": { "line": 314, @@ -66575,8 +67637,8 @@ "binop": null }, "value": "wireVisible", - "start": 13530, - "end": 13541, + "start": 13616, + "end": 13627, "loc": { "start": { "line": 314, @@ -66601,8 +67663,8 @@ "binop": null, "updateContext": null }, - "start": 13541, - "end": 13542, + "start": 13627, + "end": 13628, "loc": { "start": { "line": 314, @@ -66629,8 +67691,8 @@ "updateContext": null }, "value": "this", - "start": 13563, - "end": 13567, + "start": 13649, + "end": 13653, "loc": { "start": { "line": 315, @@ -66655,8 +67717,8 @@ "binop": null, "updateContext": null }, - "start": 13567, - "end": 13568, + "start": 13653, + "end": 13654, "loc": { "start": { "line": 315, @@ -66681,8 +67743,8 @@ "binop": null }, "value": "_currentDistanceMeasurementInitState", - "start": 13568, - "end": 13604, + "start": 13654, + "end": 13690, "loc": { "start": { "line": 315, @@ -66707,8 +67769,8 @@ "binop": null, "updateContext": null }, - "start": 13604, - "end": 13605, + "start": 13690, + "end": 13691, "loc": { "start": { "line": 315, @@ -66733,8 +67795,8 @@ "binop": null }, "value": "targetVisible", - "start": 13605, - "end": 13618, + "start": 13691, + "end": 13704, "loc": { "start": { "line": 315, @@ -66760,8 +67822,8 @@ "updateContext": null }, "value": "=", - "start": 13619, - "end": 13620, + "start": 13705, + "end": 13706, "loc": { "start": { "line": 315, @@ -66788,8 +67850,8 @@ "updateContext": null }, "value": "this", - "start": 13621, - "end": 13625, + "start": 13707, + "end": 13711, "loc": { "start": { "line": 315, @@ -66814,8 +67876,8 @@ "binop": null, "updateContext": null }, - "start": 13625, - "end": 13626, + "start": 13711, + "end": 13712, "loc": { "start": { "line": 315, @@ -66840,8 +67902,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13626, - "end": 13653, + "start": 13712, + "end": 13739, "loc": { "start": { "line": 315, @@ -66866,8 +67928,8 @@ "binop": null, "updateContext": null }, - "start": 13653, - "end": 13654, + "start": 13739, + "end": 13740, "loc": { "start": { "line": 315, @@ -66892,8 +67954,8 @@ "binop": null }, "value": "targetVisible", - "start": 13654, - "end": 13667, + "start": 13740, + "end": 13753, "loc": { "start": { "line": 315, @@ -66918,8 +67980,8 @@ "binop": null, "updateContext": null }, - "start": 13667, - "end": 13668, + "start": 13753, + "end": 13754, "loc": { "start": { "line": 315, @@ -66946,8 +68008,8 @@ "updateContext": null }, "value": "this", - "start": 13689, - "end": 13693, + "start": 13775, + "end": 13779, "loc": { "start": { "line": 316, @@ -66972,8 +68034,8 @@ "binop": null, "updateContext": null }, - "start": 13693, - "end": 13694, + "start": 13779, + "end": 13780, "loc": { "start": { "line": 316, @@ -66998,8 +68060,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13694, - "end": 13721, + "start": 13780, + "end": 13807, "loc": { "start": { "line": 316, @@ -67024,8 +68086,8 @@ "binop": null, "updateContext": null }, - "start": 13721, - "end": 13722, + "start": 13807, + "end": 13808, "loc": { "start": { "line": 316, @@ -67050,8 +68112,8 @@ "binop": null }, "value": "clickable", - "start": 13722, - "end": 13731, + "start": 13808, + "end": 13817, "loc": { "start": { "line": 316, @@ -67077,8 +68139,8 @@ "updateContext": null }, "value": "=", - "start": 13732, - "end": 13733, + "start": 13818, + "end": 13819, "loc": { "start": { "line": 316, @@ -67105,8 +68167,8 @@ "updateContext": null }, "value": "false", - "start": 13734, - "end": 13739, + "start": 13820, + "end": 13825, "loc": { "start": { "line": 316, @@ -67131,8 +68193,8 @@ "binop": null, "updateContext": null }, - "start": 13739, - "end": 13740, + "start": 13825, + "end": 13826, "loc": { "start": { "line": 316, @@ -67159,8 +68221,8 @@ "updateContext": null }, "value": "this", - "start": 13761, - "end": 13765, + "start": 13847, + "end": 13851, "loc": { "start": { "line": 317, @@ -67185,8 +68247,8 @@ "binop": null, "updateContext": null }, - "start": 13765, - "end": 13766, + "start": 13851, + "end": 13852, "loc": { "start": { "line": 317, @@ -67211,8 +68273,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13766, - "end": 13793, + "start": 13852, + "end": 13879, "loc": { "start": { "line": 317, @@ -67237,8 +68299,8 @@ "binop": null, "updateContext": null }, - "start": 13793, - "end": 13794, + "start": 13879, + "end": 13880, "loc": { "start": { "line": 317, @@ -67263,8 +68325,8 @@ "binop": null }, "value": "origin", - "start": 13794, - "end": 13800, + "start": 13880, + "end": 13886, "loc": { "start": { "line": 317, @@ -67289,8 +68351,8 @@ "binop": null, "updateContext": null }, - "start": 13800, - "end": 13801, + "start": 13886, + "end": 13887, "loc": { "start": { "line": 317, @@ -67315,8 +68377,8 @@ "binop": null }, "value": "entity", - "start": 13801, - "end": 13807, + "start": 13887, + "end": 13893, "loc": { "start": { "line": 317, @@ -67342,8 +68404,8 @@ "updateContext": null }, "value": "=", - "start": 13808, - "end": 13809, + "start": 13894, + "end": 13895, "loc": { "start": { "line": 317, @@ -67368,8 +68430,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 13810, - "end": 13823, + "start": 13896, + "end": 13909, "loc": { "start": { "line": 317, @@ -67394,8 +68456,8 @@ "binop": null, "updateContext": null }, - "start": 13823, - "end": 13824, + "start": 13909, + "end": 13910, "loc": { "start": { "line": 317, @@ -67420,8 +68482,8 @@ "binop": null }, "value": "hoveredEntity", - "start": 13845, - "end": 13858, + "start": 13931, + "end": 13944, "loc": { "start": { "line": 318, @@ -67447,8 +68509,8 @@ "updateContext": null }, "value": "=", - "start": 13859, - "end": 13860, + "start": 13945, + "end": 13946, "loc": { "start": { "line": 318, @@ -67475,8 +68537,8 @@ "updateContext": null }, "value": "null", - "start": 13861, - "end": 13865, + "start": 13947, + "end": 13951, "loc": { "start": { "line": 318, @@ -67501,8 +68563,8 @@ "binop": null, "updateContext": null }, - "start": 13865, - "end": 13866, + "start": 13951, + "end": 13952, "loc": { "start": { "line": 318, @@ -67529,8 +68591,8 @@ "updateContext": null }, "value": "this", - "start": 13887, - "end": 13891, + "start": 13973, + "end": 13977, "loc": { "start": { "line": 319, @@ -67555,8 +68617,8 @@ "binop": null, "updateContext": null }, - "start": 13891, - "end": 13892, + "start": 13977, + "end": 13978, "loc": { "start": { "line": 319, @@ -67581,8 +68643,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 13892, - "end": 13918, + "start": 13978, + "end": 14004, "loc": { "start": { "line": 319, @@ -67607,8 +68669,8 @@ "binop": null, "updateContext": null }, - "start": 13918, - "end": 13919, + "start": 14004, + "end": 14005, "loc": { "start": { "line": 319, @@ -67633,8 +68695,8 @@ "binop": null }, "value": "fire", - "start": 13919, - "end": 13923, + "start": 14005, + "end": 14009, "loc": { "start": { "line": 319, @@ -67658,8 +68720,8 @@ "postfix": false, "binop": null }, - "start": 13923, - "end": 13924, + "start": 14009, + "end": 14010, "loc": { "start": { "line": 319, @@ -67685,8 +68747,8 @@ "updateContext": null }, "value": "measurementStart", - "start": 13924, - "end": 13942, + "start": 14010, + "end": 14028, "loc": { "start": { "line": 319, @@ -67711,8 +68773,8 @@ "binop": null, "updateContext": null }, - "start": 13942, - "end": 13943, + "start": 14028, + "end": 14029, "loc": { "start": { "line": 319, @@ -67739,8 +68801,8 @@ "updateContext": null }, "value": "this", - "start": 13944, - "end": 13948, + "start": 14030, + "end": 14034, "loc": { "start": { "line": 319, @@ -67765,8 +68827,8 @@ "binop": null, "updateContext": null }, - "start": 13948, - "end": 13949, + "start": 14034, + "end": 14035, "loc": { "start": { "line": 319, @@ -67791,8 +68853,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 13949, - "end": 13976, + "start": 14035, + "end": 14062, "loc": { "start": { "line": 319, @@ -67816,8 +68878,8 @@ "postfix": false, "binop": null }, - "start": 13976, - "end": 13977, + "start": 14062, + "end": 14063, "loc": { "start": { "line": 319, @@ -67842,8 +68904,8 @@ "binop": null, "updateContext": null }, - "start": 13977, - "end": 13978, + "start": 14063, + "end": 14064, "loc": { "start": { "line": 319, @@ -67867,8 +68929,8 @@ "postfix": false, "binop": null }, - "start": 13995, - "end": 13996, + "start": 14081, + "end": 14082, "loc": { "start": { "line": 320, @@ -67892,8 +68954,8 @@ "postfix": false, "binop": null }, - "start": 14009, - "end": 14010, + "start": 14095, + "end": 14096, "loc": { "start": { "line": 321, @@ -67917,8 +68979,8 @@ "postfix": false, "binop": null }, - "start": 14019, - "end": 14020, + "start": 14105, + "end": 14106, "loc": { "start": { "line": 322, @@ -67942,8 +69004,8 @@ "postfix": false, "binop": null }, - "start": 14020, - "end": 14021, + "start": 14106, + "end": 14107, "loc": { "start": { "line": 322, @@ -67968,8 +69030,8 @@ "binop": null, "updateContext": null }, - "start": 14021, - "end": 14022, + "start": 14107, + "end": 14108, "loc": { "start": { "line": 322, @@ -67996,8 +69058,8 @@ "updateContext": null }, "value": "this", - "start": 14032, - "end": 14036, + "start": 14118, + "end": 14122, "loc": { "start": { "line": 324, @@ -68022,8 +69084,8 @@ "binop": null, "updateContext": null }, - "start": 14036, - "end": 14037, + "start": 14122, + "end": 14123, "loc": { "start": { "line": 324, @@ -68048,8 +69110,8 @@ "binop": null }, "value": "_onCameraControlHoverSnapOrSurfaceOff", - "start": 14037, - "end": 14074, + "start": 14123, + "end": 14160, "loc": { "start": { "line": 324, @@ -68075,8 +69137,8 @@ "updateContext": null }, "value": "=", - "start": 14075, - "end": 14076, + "start": 14161, + "end": 14162, "loc": { "start": { "line": 324, @@ -68101,8 +69163,8 @@ "binop": null }, "value": "cameraControl", - "start": 14077, - "end": 14090, + "start": 14163, + "end": 14176, "loc": { "start": { "line": 324, @@ -68127,8 +69189,8 @@ "binop": null, "updateContext": null }, - "start": 14090, - "end": 14091, + "start": 14176, + "end": 14177, "loc": { "start": { "line": 324, @@ -68153,8 +69215,8 @@ "binop": null }, "value": "on", - "start": 14091, - "end": 14093, + "start": 14177, + "end": 14179, "loc": { "start": { "line": 324, @@ -68178,8 +69240,8 @@ "postfix": false, "binop": null }, - "start": 14093, - "end": 14094, + "start": 14179, + "end": 14180, "loc": { "start": { "line": 324, @@ -68206,8 +69268,8 @@ "updateContext": null }, "value": "this", - "start": 14107, - "end": 14111, + "start": 14193, + "end": 14197, "loc": { "start": { "line": 325, @@ -68232,8 +69294,8 @@ "binop": null, "updateContext": null }, - "start": 14111, - "end": 14112, + "start": 14197, + "end": 14198, "loc": { "start": { "line": 325, @@ -68258,8 +69320,8 @@ "binop": null }, "value": "_snapping", - "start": 14112, - "end": 14121, + "start": 14198, + "end": 14207, "loc": { "start": { "line": 325, @@ -68284,8 +69346,8 @@ "binop": null, "updateContext": null }, - "start": 14138, - "end": 14139, + "start": 14224, + "end": 14225, "loc": { "start": { "line": 326, @@ -68311,8 +69373,8 @@ "updateContext": null }, "value": "hoverSnapOrSurfaceOff", - "start": 14140, - "end": 14163, + "start": 14226, + "end": 14249, "loc": { "start": { "line": 326, @@ -68337,8 +69399,8 @@ "binop": null, "updateContext": null }, - "start": 14180, - "end": 14181, + "start": 14266, + "end": 14267, "loc": { "start": { "line": 327, @@ -68364,8 +69426,8 @@ "updateContext": null }, "value": "hoverOff", - "start": 14182, - "end": 14192, + "start": 14268, + "end": 14278, "loc": { "start": { "line": 327, @@ -68390,8 +69452,8 @@ "binop": null, "updateContext": null }, - "start": 14192, - "end": 14193, + "start": 14278, + "end": 14279, "loc": { "start": { "line": 327, @@ -68416,8 +69478,8 @@ "binop": null }, "value": "event", - "start": 14194, - "end": 14199, + "start": 14280, + "end": 14285, "loc": { "start": { "line": 327, @@ -68442,8 +69504,8 @@ "binop": null, "updateContext": null }, - "start": 14200, - "end": 14202, + "start": 14286, + "end": 14288, "loc": { "start": { "line": 327, @@ -68467,8 +69529,8 @@ "postfix": false, "binop": null }, - "start": 14203, - "end": 14204, + "start": 14289, + "end": 14290, "loc": { "start": { "line": 327, @@ -68495,8 +69557,8 @@ "updateContext": null }, "value": "if", - "start": 14221, - "end": 14223, + "start": 14307, + "end": 14309, "loc": { "start": { "line": 328, @@ -68520,8 +69582,8 @@ "postfix": false, "binop": null }, - "start": 14224, - "end": 14225, + "start": 14310, + "end": 14311, "loc": { "start": { "line": 328, @@ -68548,8 +69610,8 @@ "updateContext": null }, "value": "this", - "start": 14225, - "end": 14229, + "start": 14311, + "end": 14315, "loc": { "start": { "line": 328, @@ -68574,8 +69636,8 @@ "binop": null, "updateContext": null }, - "start": 14229, - "end": 14230, + "start": 14315, + "end": 14316, "loc": { "start": { "line": 328, @@ -68600,8 +69662,8 @@ "binop": null }, "value": "pointerLens", - "start": 14230, - "end": 14241, + "start": 14316, + "end": 14327, "loc": { "start": { "line": 328, @@ -68625,8 +69687,8 @@ "postfix": false, "binop": null }, - "start": 14241, - "end": 14242, + "start": 14327, + "end": 14328, "loc": { "start": { "line": 328, @@ -68650,8 +69712,8 @@ "postfix": false, "binop": null }, - "start": 14243, - "end": 14244, + "start": 14329, + "end": 14330, "loc": { "start": { "line": 328, @@ -68678,8 +69740,8 @@ "updateContext": null }, "value": "this", - "start": 14265, - "end": 14269, + "start": 14351, + "end": 14355, "loc": { "start": { "line": 329, @@ -68704,8 +69766,8 @@ "binop": null, "updateContext": null }, - "start": 14269, - "end": 14270, + "start": 14355, + "end": 14356, "loc": { "start": { "line": 329, @@ -68730,8 +69792,8 @@ "binop": null }, "value": "pointerLens", - "start": 14270, - "end": 14281, + "start": 14356, + "end": 14367, "loc": { "start": { "line": 329, @@ -68756,8 +69818,8 @@ "binop": null, "updateContext": null }, - "start": 14281, - "end": 14282, + "start": 14367, + "end": 14368, "loc": { "start": { "line": 329, @@ -68782,8 +69844,8 @@ "binop": null }, "value": "visible", - "start": 14282, - "end": 14289, + "start": 14368, + "end": 14375, "loc": { "start": { "line": 329, @@ -68809,8 +69871,8 @@ "updateContext": null }, "value": "=", - "start": 14290, - "end": 14291, + "start": 14376, + "end": 14377, "loc": { "start": { "line": 329, @@ -68837,8 +69899,8 @@ "updateContext": null }, "value": "true", - "start": 14292, - "end": 14296, + "start": 14378, + "end": 14382, "loc": { "start": { "line": 329, @@ -68863,8 +69925,8 @@ "binop": null, "updateContext": null }, - "start": 14296, - "end": 14297, + "start": 14382, + "end": 14383, "loc": { "start": { "line": 329, @@ -68891,8 +69953,8 @@ "updateContext": null }, "value": "this", - "start": 14318, - "end": 14322, + "start": 14404, + "end": 14408, "loc": { "start": { "line": 330, @@ -68917,8 +69979,8 @@ "binop": null, "updateContext": null }, - "start": 14322, - "end": 14323, + "start": 14408, + "end": 14409, "loc": { "start": { "line": 330, @@ -68943,8 +70005,8 @@ "binop": null }, "value": "pointerLens", - "start": 14323, - "end": 14334, + "start": 14409, + "end": 14420, "loc": { "start": { "line": 330, @@ -68969,8 +70031,8 @@ "binop": null, "updateContext": null }, - "start": 14334, - "end": 14335, + "start": 14420, + "end": 14421, "loc": { "start": { "line": 330, @@ -68995,8 +70057,8 @@ "binop": null }, "value": "canvasPos", - "start": 14335, - "end": 14344, + "start": 14421, + "end": 14430, "loc": { "start": { "line": 330, @@ -69022,8 +70084,8 @@ "updateContext": null }, "value": "=", - "start": 14345, - "end": 14346, + "start": 14431, + "end": 14432, "loc": { "start": { "line": 330, @@ -69048,8 +70110,8 @@ "binop": null }, "value": "event", - "start": 14347, - "end": 14352, + "start": 14433, + "end": 14438, "loc": { "start": { "line": 330, @@ -69074,8 +70136,8 @@ "binop": null, "updateContext": null }, - "start": 14352, - "end": 14353, + "start": 14438, + "end": 14439, "loc": { "start": { "line": 330, @@ -69100,8 +70162,8 @@ "binop": null }, "value": "canvasPos", - "start": 14353, - "end": 14362, + "start": 14439, + "end": 14448, "loc": { "start": { "line": 330, @@ -69126,8 +70188,8 @@ "binop": null, "updateContext": null }, - "start": 14362, - "end": 14363, + "start": 14448, + "end": 14449, "loc": { "start": { "line": 330, @@ -69154,8 +70216,8 @@ "updateContext": null }, "value": "this", - "start": 14384, - "end": 14388, + "start": 14470, + "end": 14474, "loc": { "start": { "line": 331, @@ -69180,8 +70242,8 @@ "binop": null, "updateContext": null }, - "start": 14388, - "end": 14389, + "start": 14474, + "end": 14475, "loc": { "start": { "line": 331, @@ -69206,8 +70268,8 @@ "binop": null }, "value": "pointerLens", - "start": 14389, - "end": 14400, + "start": 14475, + "end": 14486, "loc": { "start": { "line": 331, @@ -69232,8 +70294,8 @@ "binop": null, "updateContext": null }, - "start": 14400, - "end": 14401, + "start": 14486, + "end": 14487, "loc": { "start": { "line": 331, @@ -69258,8 +70320,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 14401, - "end": 14417, + "start": 14487, + "end": 14503, "loc": { "start": { "line": 331, @@ -69285,8 +70347,8 @@ "updateContext": null }, "value": "=", - "start": 14418, - "end": 14419, + "start": 14504, + "end": 14505, "loc": { "start": { "line": 331, @@ -69311,8 +70373,8 @@ "binop": null }, "value": "event", - "start": 14420, - "end": 14425, + "start": 14506, + "end": 14511, "loc": { "start": { "line": 331, @@ -69337,8 +70399,8 @@ "binop": null, "updateContext": null }, - "start": 14425, - "end": 14426, + "start": 14511, + "end": 14512, "loc": { "start": { "line": 331, @@ -69363,8 +70425,8 @@ "binop": null }, "value": "snappedCanvasPos", - "start": 14426, - "end": 14442, + "start": 14512, + "end": 14528, "loc": { "start": { "line": 331, @@ -69390,8 +70452,8 @@ "updateContext": null }, "value": "||", - "start": 14443, - "end": 14445, + "start": 14529, + "end": 14531, "loc": { "start": { "line": 331, @@ -69416,8 +70478,8 @@ "binop": null }, "value": "event", - "start": 14446, - "end": 14451, + "start": 14532, + "end": 14537, "loc": { "start": { "line": 331, @@ -69442,8 +70504,8 @@ "binop": null, "updateContext": null }, - "start": 14451, - "end": 14452, + "start": 14537, + "end": 14538, "loc": { "start": { "line": 331, @@ -69468,8 +70530,8 @@ "binop": null }, "value": "canvasPos", - "start": 14452, - "end": 14461, + "start": 14538, + "end": 14547, "loc": { "start": { "line": 331, @@ -69494,8 +70556,8 @@ "binop": null, "updateContext": null }, - "start": 14461, - "end": 14462, + "start": 14547, + "end": 14548, "loc": { "start": { "line": 331, @@ -69519,8 +70581,8 @@ "postfix": false, "binop": null }, - "start": 14479, - "end": 14480, + "start": 14565, + "end": 14566, "loc": { "start": { "line": 332, @@ -69545,8 +70607,8 @@ "binop": null }, "value": "mouseHovering", - "start": 14497, - "end": 14510, + "start": 14583, + "end": 14596, "loc": { "start": { "line": 333, @@ -69572,8 +70634,8 @@ "updateContext": null }, "value": "=", - "start": 14511, - "end": 14512, + "start": 14597, + "end": 14598, "loc": { "start": { "line": 333, @@ -69600,8 +70662,8 @@ "updateContext": null }, "value": "false", - "start": 14513, - "end": 14518, + "start": 14599, + "end": 14604, "loc": { "start": { "line": 333, @@ -69626,8 +70688,8 @@ "binop": null, "updateContext": null }, - "start": 14518, - "end": 14519, + "start": 14604, + "end": 14605, "loc": { "start": { "line": 333, @@ -69654,8 +70716,8 @@ "updateContext": null }, "value": "this", - "start": 14536, - "end": 14540, + "start": 14622, + "end": 14626, "loc": { "start": { "line": 334, @@ -69680,8 +70742,8 @@ "binop": null, "updateContext": null }, - "start": 14540, - "end": 14541, + "start": 14626, + "end": 14627, "loc": { "start": { "line": 334, @@ -69706,8 +70768,8 @@ "binop": null }, "value": "_markerDiv", - "start": 14541, - "end": 14551, + "start": 14627, + "end": 14637, "loc": { "start": { "line": 334, @@ -69732,8 +70794,8 @@ "binop": null, "updateContext": null }, - "start": 14551, - "end": 14552, + "start": 14637, + "end": 14638, "loc": { "start": { "line": 334, @@ -69758,8 +70820,8 @@ "binop": null }, "value": "style", - "start": 14552, - "end": 14557, + "start": 14638, + "end": 14643, "loc": { "start": { "line": 334, @@ -69784,8 +70846,8 @@ "binop": null, "updateContext": null }, - "start": 14557, - "end": 14558, + "start": 14643, + "end": 14644, "loc": { "start": { "line": 334, @@ -69810,8 +70872,8 @@ "binop": null }, "value": "left", - "start": 14558, - "end": 14562, + "start": 14644, + "end": 14648, "loc": { "start": { "line": 334, @@ -69837,8 +70899,8 @@ "updateContext": null }, "value": "=", - "start": 14563, - "end": 14564, + "start": 14649, + "end": 14650, "loc": { "start": { "line": 334, @@ -69862,8 +70924,8 @@ "postfix": false, "binop": null }, - "start": 14565, - "end": 14566, + "start": 14651, + "end": 14652, "loc": { "start": { "line": 334, @@ -69889,8 +70951,8 @@ "updateContext": null }, "value": "-100px", - "start": 14566, - "end": 14572, + "start": 14652, + "end": 14658, "loc": { "start": { "line": 334, @@ -69914,8 +70976,8 @@ "postfix": false, "binop": null }, - "start": 14572, - "end": 14573, + "start": 14658, + "end": 14659, "loc": { "start": { "line": 334, @@ -69940,8 +71002,8 @@ "binop": null, "updateContext": null }, - "start": 14573, - "end": 14574, + "start": 14659, + "end": 14660, "loc": { "start": { "line": 334, @@ -69968,8 +71030,8 @@ "updateContext": null }, "value": "this", - "start": 14591, - "end": 14595, + "start": 14677, + "end": 14681, "loc": { "start": { "line": 335, @@ -69994,8 +71056,8 @@ "binop": null, "updateContext": null }, - "start": 14595, - "end": 14596, + "start": 14681, + "end": 14682, "loc": { "start": { "line": 335, @@ -70020,8 +71082,8 @@ "binop": null }, "value": "_markerDiv", - "start": 14596, - "end": 14606, + "start": 14682, + "end": 14692, "loc": { "start": { "line": 335, @@ -70046,8 +71108,8 @@ "binop": null, "updateContext": null }, - "start": 14606, - "end": 14607, + "start": 14692, + "end": 14693, "loc": { "start": { "line": 335, @@ -70072,8 +71134,8 @@ "binop": null }, "value": "style", - "start": 14607, - "end": 14612, + "start": 14693, + "end": 14698, "loc": { "start": { "line": 335, @@ -70098,8 +71160,8 @@ "binop": null, "updateContext": null }, - "start": 14612, - "end": 14613, + "start": 14698, + "end": 14699, "loc": { "start": { "line": 335, @@ -70124,8 +71186,8 @@ "binop": null }, "value": "top", - "start": 14613, - "end": 14616, + "start": 14699, + "end": 14702, "loc": { "start": { "line": 335, @@ -70151,8 +71213,8 @@ "updateContext": null }, "value": "=", - "start": 14617, - "end": 14618, + "start": 14703, + "end": 14704, "loc": { "start": { "line": 335, @@ -70176,8 +71238,8 @@ "postfix": false, "binop": null }, - "start": 14619, - "end": 14620, + "start": 14705, + "end": 14706, "loc": { "start": { "line": 335, @@ -70203,8 +71265,8 @@ "updateContext": null }, "value": "-100px", - "start": 14620, - "end": 14626, + "start": 14706, + "end": 14712, "loc": { "start": { "line": 335, @@ -70228,8 +71290,8 @@ "postfix": false, "binop": null }, - "start": 14626, - "end": 14627, + "start": 14712, + "end": 14713, "loc": { "start": { "line": 335, @@ -70254,8 +71316,8 @@ "binop": null, "updateContext": null }, - "start": 14627, - "end": 14628, + "start": 14713, + "end": 14714, "loc": { "start": { "line": 335, @@ -70282,8 +71344,8 @@ "updateContext": null }, "value": "if", - "start": 14645, - "end": 14647, + "start": 14731, + "end": 14733, "loc": { "start": { "line": 336, @@ -70307,8 +71369,8 @@ "postfix": false, "binop": null }, - "start": 14648, - "end": 14649, + "start": 14734, + "end": 14735, "loc": { "start": { "line": 336, @@ -70335,8 +71397,8 @@ "updateContext": null }, "value": "this", - "start": 14649, - "end": 14653, + "start": 14735, + "end": 14739, "loc": { "start": { "line": 336, @@ -70361,8 +71423,8 @@ "binop": null, "updateContext": null }, - "start": 14653, - "end": 14654, + "start": 14739, + "end": 14740, "loc": { "start": { "line": 336, @@ -70387,8 +71449,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 14654, - "end": 14681, + "start": 14740, + "end": 14767, "loc": { "start": { "line": 336, @@ -70412,8 +71474,8 @@ "postfix": false, "binop": null }, - "start": 14681, - "end": 14682, + "start": 14767, + "end": 14768, "loc": { "start": { "line": 336, @@ -70437,8 +71499,8 @@ "postfix": false, "binop": null }, - "start": 14683, - "end": 14684, + "start": 14769, + "end": 14770, "loc": { "start": { "line": 336, @@ -70465,8 +71527,8 @@ "updateContext": null }, "value": "this", - "start": 14705, - "end": 14709, + "start": 14791, + "end": 14795, "loc": { "start": { "line": 337, @@ -70491,8 +71553,8 @@ "binop": null, "updateContext": null }, - "start": 14709, - "end": 14710, + "start": 14795, + "end": 14796, "loc": { "start": { "line": 337, @@ -70517,8 +71579,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 14710, - "end": 14737, + "start": 14796, + "end": 14823, "loc": { "start": { "line": 337, @@ -70543,8 +71605,8 @@ "binop": null, "updateContext": null }, - "start": 14737, - "end": 14738, + "start": 14823, + "end": 14824, "loc": { "start": { "line": 337, @@ -70569,8 +71631,8 @@ "binop": null }, "value": "wireVisible", - "start": 14738, - "end": 14749, + "start": 14824, + "end": 14835, "loc": { "start": { "line": 337, @@ -70596,8 +71658,8 @@ "updateContext": null }, "value": "=", - "start": 14750, - "end": 14751, + "start": 14836, + "end": 14837, "loc": { "start": { "line": 337, @@ -70624,8 +71686,8 @@ "updateContext": null }, "value": "false", - "start": 14752, - "end": 14757, + "start": 14838, + "end": 14843, "loc": { "start": { "line": 337, @@ -70650,8 +71712,8 @@ "binop": null, "updateContext": null }, - "start": 14757, - "end": 14758, + "start": 14843, + "end": 14844, "loc": { "start": { "line": 337, @@ -70678,8 +71740,8 @@ "updateContext": null }, "value": "this", - "start": 14779, - "end": 14783, + "start": 14865, + "end": 14869, "loc": { "start": { "line": 338, @@ -70704,8 +71766,8 @@ "binop": null, "updateContext": null }, - "start": 14783, - "end": 14784, + "start": 14869, + "end": 14870, "loc": { "start": { "line": 338, @@ -70730,8 +71792,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 14784, - "end": 14811, + "start": 14870, + "end": 14897, "loc": { "start": { "line": 338, @@ -70756,8 +71818,8 @@ "binop": null, "updateContext": null }, - "start": 14811, - "end": 14812, + "start": 14897, + "end": 14898, "loc": { "start": { "line": 338, @@ -70782,8 +71844,8 @@ "binop": null }, "value": "targetVisible", - "start": 14812, - "end": 14825, + "start": 14898, + "end": 14911, "loc": { "start": { "line": 338, @@ -70809,8 +71871,8 @@ "updateContext": null }, "value": "=", - "start": 14826, - "end": 14827, + "start": 14912, + "end": 14913, "loc": { "start": { "line": 338, @@ -70837,8 +71899,8 @@ "updateContext": null }, "value": "false", - "start": 14828, - "end": 14833, + "start": 14914, + "end": 14919, "loc": { "start": { "line": 338, @@ -70863,8 +71925,8 @@ "binop": null, "updateContext": null }, - "start": 14833, - "end": 14834, + "start": 14919, + "end": 14920, "loc": { "start": { "line": 338, @@ -70891,8 +71953,8 @@ "updateContext": null }, "value": "this", - "start": 14855, - "end": 14859, + "start": 14941, + "end": 14945, "loc": { "start": { "line": 339, @@ -70917,8 +71979,8 @@ "binop": null, "updateContext": null }, - "start": 14859, - "end": 14860, + "start": 14945, + "end": 14946, "loc": { "start": { "line": 339, @@ -70943,8 +72005,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 14860, - "end": 14887, + "start": 14946, + "end": 14973, "loc": { "start": { "line": 339, @@ -70969,8 +72031,8 @@ "binop": null, "updateContext": null }, - "start": 14887, - "end": 14888, + "start": 14973, + "end": 14974, "loc": { "start": { "line": 339, @@ -70995,8 +72057,8 @@ "binop": null }, "value": "axisVisible", - "start": 14888, - "end": 14899, + "start": 14974, + "end": 14985, "loc": { "start": { "line": 339, @@ -71022,8 +72084,8 @@ "updateContext": null }, "value": "=", - "start": 14900, - "end": 14901, + "start": 14986, + "end": 14987, "loc": { "start": { "line": 339, @@ -71050,8 +72112,8 @@ "updateContext": null }, "value": "false", - "start": 14902, - "end": 14907, + "start": 14988, + "end": 14993, "loc": { "start": { "line": 339, @@ -71076,8 +72138,8 @@ "binop": null, "updateContext": null }, - "start": 14907, - "end": 14908, + "start": 14993, + "end": 14994, "loc": { "start": { "line": 339, @@ -71101,8 +72163,8 @@ "postfix": false, "binop": null }, - "start": 14925, - "end": 14926, + "start": 15011, + "end": 15012, "loc": { "start": { "line": 340, @@ -71127,8 +72189,8 @@ "binop": null }, "value": "canvas", - "start": 14943, - "end": 14949, + "start": 15029, + "end": 15035, "loc": { "start": { "line": 341, @@ -71153,8 +72215,8 @@ "binop": null, "updateContext": null }, - "start": 14949, - "end": 14950, + "start": 15035, + "end": 15036, "loc": { "start": { "line": 341, @@ -71179,8 +72241,8 @@ "binop": null }, "value": "style", - "start": 14950, - "end": 14955, + "start": 15036, + "end": 15041, "loc": { "start": { "line": 341, @@ -71205,8 +72267,8 @@ "binop": null, "updateContext": null }, - "start": 14955, - "end": 14956, + "start": 15041, + "end": 15042, "loc": { "start": { "line": 341, @@ -71231,8 +72293,8 @@ "binop": null }, "value": "cursor", - "start": 14956, - "end": 14962, + "start": 15042, + "end": 15048, "loc": { "start": { "line": 341, @@ -71258,8 +72320,8 @@ "updateContext": null }, "value": "=", - "start": 14963, - "end": 14964, + "start": 15049, + "end": 15050, "loc": { "start": { "line": 341, @@ -71285,8 +72347,8 @@ "updateContext": null }, "value": "default", - "start": 14965, - "end": 14974, + "start": 15051, + "end": 15060, "loc": { "start": { "line": 341, @@ -71311,8 +72373,8 @@ "binop": null, "updateContext": null }, - "start": 14974, - "end": 14975, + "start": 15060, + "end": 15061, "loc": { "start": { "line": 341, @@ -71336,8 +72398,8 @@ "postfix": false, "binop": null }, - "start": 14988, - "end": 14989, + "start": 15074, + "end": 15075, "loc": { "start": { "line": 342, @@ -71361,8 +72423,8 @@ "postfix": false, "binop": null }, - "start": 14989, - "end": 14990, + "start": 15075, + "end": 15076, "loc": { "start": { "line": 342, @@ -71387,8 +72449,8 @@ "binop": null, "updateContext": null }, - "start": 14990, - "end": 14991, + "start": 15076, + "end": 15077, "loc": { "start": { "line": 342, @@ -71415,8 +72477,8 @@ "updateContext": null }, "value": "this", - "start": 15001, - "end": 15005, + "start": 15087, + "end": 15091, "loc": { "start": { "line": 344, @@ -71441,8 +72503,8 @@ "binop": null, "updateContext": null }, - "start": 15005, - "end": 15006, + "start": 15091, + "end": 15092, "loc": { "start": { "line": 344, @@ -71467,8 +72529,8 @@ "binop": null }, "value": "_active", - "start": 15006, - "end": 15013, + "start": 15092, + "end": 15099, "loc": { "start": { "line": 344, @@ -71494,8 +72556,8 @@ "updateContext": null }, "value": "=", - "start": 15014, - "end": 15015, + "start": 15100, + "end": 15101, "loc": { "start": { "line": 344, @@ -71522,8 +72584,8 @@ "updateContext": null }, "value": "true", - "start": 15016, - "end": 15020, + "start": 15102, + "end": 15106, "loc": { "start": { "line": 344, @@ -71548,8 +72610,8 @@ "binop": null, "updateContext": null }, - "start": 15020, - "end": 15021, + "start": 15106, + "end": 15107, "loc": { "start": { "line": 344, @@ -71573,8 +72635,8 @@ "postfix": false, "binop": null }, - "start": 15026, - "end": 15027, + "start": 15112, + "end": 15113, "loc": { "start": { "line": 345, @@ -71589,8 +72651,8 @@ { "type": "CommentBlock", "value": "*\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 15033, - "end": 15251, + "start": 15119, + "end": 15337, "loc": { "start": { "line": 347, @@ -71615,8 +72677,8 @@ "binop": null }, "value": "deactivate", - "start": 15256, - "end": 15266, + "start": 15342, + "end": 15352, "loc": { "start": { "line": 352, @@ -71640,8 +72702,8 @@ "postfix": false, "binop": null }, - "start": 15266, - "end": 15267, + "start": 15352, + "end": 15353, "loc": { "start": { "line": 352, @@ -71665,8 +72727,8 @@ "postfix": false, "binop": null }, - "start": 15267, - "end": 15268, + "start": 15353, + "end": 15354, "loc": { "start": { "line": 352, @@ -71690,8 +72752,8 @@ "postfix": false, "binop": null }, - "start": 15269, - "end": 15270, + "start": 15355, + "end": 15356, "loc": { "start": { "line": 352, @@ -71718,8 +72780,8 @@ "updateContext": null }, "value": "if", - "start": 15279, - "end": 15281, + "start": 15365, + "end": 15367, "loc": { "start": { "line": 353, @@ -71743,8 +72805,8 @@ "postfix": false, "binop": null }, - "start": 15282, - "end": 15283, + "start": 15368, + "end": 15369, "loc": { "start": { "line": 353, @@ -71770,8 +72832,8 @@ "updateContext": null }, "value": "!", - "start": 15283, - "end": 15284, + "start": 15369, + "end": 15370, "loc": { "start": { "line": 353, @@ -71798,8 +72860,8 @@ "updateContext": null }, "value": "this", - "start": 15284, - "end": 15288, + "start": 15370, + "end": 15374, "loc": { "start": { "line": 353, @@ -71824,8 +72886,8 @@ "binop": null, "updateContext": null }, - "start": 15288, - "end": 15289, + "start": 15374, + "end": 15375, "loc": { "start": { "line": 353, @@ -71850,8 +72912,8 @@ "binop": null }, "value": "_active", - "start": 15289, - "end": 15296, + "start": 15375, + "end": 15382, "loc": { "start": { "line": 353, @@ -71875,8 +72937,8 @@ "postfix": false, "binop": null }, - "start": 15296, - "end": 15297, + "start": 15382, + "end": 15383, "loc": { "start": { "line": 353, @@ -71900,8 +72962,8 @@ "postfix": false, "binop": null }, - "start": 15298, - "end": 15299, + "start": 15384, + "end": 15385, "loc": { "start": { "line": 353, @@ -71928,8 +72990,8 @@ "updateContext": null }, "value": "return", - "start": 15312, - "end": 15318, + "start": 15398, + "end": 15404, "loc": { "start": { "line": 354, @@ -71954,8 +73016,8 @@ "binop": null, "updateContext": null }, - "start": 15318, - "end": 15319, + "start": 15404, + "end": 15405, "loc": { "start": { "line": 354, @@ -71979,8 +73041,8 @@ "postfix": false, "binop": null }, - "start": 15328, - "end": 15329, + "start": 15414, + "end": 15415, "loc": { "start": { "line": 355, @@ -72007,8 +73069,8 @@ "updateContext": null }, "value": "this", - "start": 15339, - "end": 15343, + "start": 15425, + "end": 15429, "loc": { "start": { "line": 357, @@ -72033,8 +73095,8 @@ "binop": null, "updateContext": null }, - "start": 15343, - "end": 15344, + "start": 15429, + "end": 15430, "loc": { "start": { "line": 357, @@ -72059,8 +73121,8 @@ "binop": null }, "value": "fire", - "start": 15344, - "end": 15348, + "start": 15430, + "end": 15434, "loc": { "start": { "line": 357, @@ -72084,8 +73146,8 @@ "postfix": false, "binop": null }, - "start": 15348, - "end": 15349, + "start": 15434, + "end": 15435, "loc": { "start": { "line": 357, @@ -72111,8 +73173,8 @@ "updateContext": null }, "value": "activated", - "start": 15349, - "end": 15360, + "start": 15435, + "end": 15446, "loc": { "start": { "line": 357, @@ -72137,8 +73199,8 @@ "binop": null, "updateContext": null }, - "start": 15360, - "end": 15361, + "start": 15446, + "end": 15447, "loc": { "start": { "line": 357, @@ -72165,8 +73227,8 @@ "updateContext": null }, "value": "false", - "start": 15362, - "end": 15367, + "start": 15448, + "end": 15453, "loc": { "start": { "line": 357, @@ -72190,8 +73252,8 @@ "postfix": false, "binop": null }, - "start": 15367, - "end": 15368, + "start": 15453, + "end": 15454, "loc": { "start": { "line": 357, @@ -72216,8 +73278,8 @@ "binop": null, "updateContext": null }, - "start": 15368, - "end": 15369, + "start": 15454, + "end": 15455, "loc": { "start": { "line": 357, @@ -72244,8 +73306,8 @@ "updateContext": null }, "value": "if", - "start": 15379, - "end": 15381, + "start": 15465, + "end": 15467, "loc": { "start": { "line": 359, @@ -72269,8 +73331,8 @@ "postfix": false, "binop": null }, - "start": 15382, - "end": 15383, + "start": 15468, + "end": 15469, "loc": { "start": { "line": 359, @@ -72297,8 +73359,8 @@ "updateContext": null }, "value": "this", - "start": 15383, - "end": 15387, + "start": 15469, + "end": 15473, "loc": { "start": { "line": 359, @@ -72323,8 +73385,8 @@ "binop": null, "updateContext": null }, - "start": 15387, - "end": 15388, + "start": 15473, + "end": 15474, "loc": { "start": { "line": 359, @@ -72349,8 +73411,8 @@ "binop": null }, "value": "pointerLens", - "start": 15388, - "end": 15399, + "start": 15474, + "end": 15485, "loc": { "start": { "line": 359, @@ -72374,8 +73436,8 @@ "postfix": false, "binop": null }, - "start": 15399, - "end": 15400, + "start": 15485, + "end": 15486, "loc": { "start": { "line": 359, @@ -72399,8 +73461,8 @@ "postfix": false, "binop": null }, - "start": 15401, - "end": 15402, + "start": 15487, + "end": 15488, "loc": { "start": { "line": 359, @@ -72427,8 +73489,8 @@ "updateContext": null }, "value": "this", - "start": 15415, - "end": 15419, + "start": 15501, + "end": 15505, "loc": { "start": { "line": 360, @@ -72453,8 +73515,8 @@ "binop": null, "updateContext": null }, - "start": 15419, - "end": 15420, + "start": 15505, + "end": 15506, "loc": { "start": { "line": 360, @@ -72479,8 +73541,8 @@ "binop": null }, "value": "pointerLens", - "start": 15420, - "end": 15431, + "start": 15506, + "end": 15517, "loc": { "start": { "line": 360, @@ -72505,8 +73567,8 @@ "binop": null, "updateContext": null }, - "start": 15431, - "end": 15432, + "start": 15517, + "end": 15518, "loc": { "start": { "line": 360, @@ -72531,8 +73593,8 @@ "binop": null }, "value": "visible", - "start": 15432, - "end": 15439, + "start": 15518, + "end": 15525, "loc": { "start": { "line": 360, @@ -72558,8 +73620,8 @@ "updateContext": null }, "value": "=", - "start": 15440, - "end": 15441, + "start": 15526, + "end": 15527, "loc": { "start": { "line": 360, @@ -72586,8 +73648,8 @@ "updateContext": null }, "value": "false", - "start": 15442, - "end": 15447, + "start": 15528, + "end": 15533, "loc": { "start": { "line": 360, @@ -72612,8 +73674,8 @@ "binop": null, "updateContext": null }, - "start": 15447, - "end": 15448, + "start": 15533, + "end": 15534, "loc": { "start": { "line": 360, @@ -72637,8 +73699,8 @@ "postfix": false, "binop": null }, - "start": 15457, - "end": 15458, + "start": 15543, + "end": 15544, "loc": { "start": { "line": 361, @@ -72665,8 +73727,8 @@ "updateContext": null }, "value": "if", - "start": 15467, - "end": 15469, + "start": 15553, + "end": 15555, "loc": { "start": { "line": 362, @@ -72690,8 +73752,8 @@ "postfix": false, "binop": null }, - "start": 15470, - "end": 15471, + "start": 15556, + "end": 15557, "loc": { "start": { "line": 362, @@ -72718,8 +73780,8 @@ "updateContext": null }, "value": "this", - "start": 15471, - "end": 15475, + "start": 15557, + "end": 15561, "loc": { "start": { "line": 362, @@ -72744,8 +73806,8 @@ "binop": null, "updateContext": null }, - "start": 15475, - "end": 15476, + "start": 15561, + "end": 15562, "loc": { "start": { "line": 362, @@ -72770,8 +73832,8 @@ "binop": null }, "value": "_markerDiv", - "start": 15476, - "end": 15486, + "start": 15562, + "end": 15572, "loc": { "start": { "line": 362, @@ -72795,8 +73857,8 @@ "postfix": false, "binop": null }, - "start": 15486, - "end": 15487, + "start": 15572, + "end": 15573, "loc": { "start": { "line": 362, @@ -72820,8 +73882,8 @@ "postfix": false, "binop": null }, - "start": 15488, - "end": 15489, + "start": 15574, + "end": 15575, "loc": { "start": { "line": 362, @@ -72848,8 +73910,8 @@ "updateContext": null }, "value": "this", - "start": 15502, - "end": 15506, + "start": 15588, + "end": 15592, "loc": { "start": { "line": 363, @@ -72874,8 +73936,8 @@ "binop": null, "updateContext": null }, - "start": 15506, - "end": 15507, + "start": 15592, + "end": 15593, "loc": { "start": { "line": 363, @@ -72900,8 +73962,8 @@ "binop": null }, "value": "_destroyMarkerDiv", - "start": 15507, - "end": 15524, + "start": 15593, + "end": 15610, "loc": { "start": { "line": 363, @@ -72925,8 +73987,8 @@ "postfix": false, "binop": null }, - "start": 15524, - "end": 15525, + "start": 15610, + "end": 15611, "loc": { "start": { "line": 363, @@ -72950,8 +74012,8 @@ "postfix": false, "binop": null }, - "start": 15525, - "end": 15526, + "start": 15611, + "end": 15612, "loc": { "start": { "line": 363, @@ -72975,8 +74037,8 @@ "postfix": false, "binop": null }, - "start": 15535, - "end": 15536, + "start": 15621, + "end": 15622, "loc": { "start": { "line": 364, @@ -73003,8 +74065,8 @@ "updateContext": null }, "value": "this", - "start": 15545, - "end": 15549, + "start": 15631, + "end": 15635, "loc": { "start": { "line": 365, @@ -73029,8 +74091,8 @@ "binop": null, "updateContext": null }, - "start": 15549, - "end": 15550, + "start": 15635, + "end": 15636, "loc": { "start": { "line": 365, @@ -73055,8 +74117,8 @@ "binop": null }, "value": "reset", - "start": 15550, - "end": 15555, + "start": 15636, + "end": 15641, "loc": { "start": { "line": 365, @@ -73080,8 +74142,8 @@ "postfix": false, "binop": null }, - "start": 15555, - "end": 15556, + "start": 15641, + "end": 15642, "loc": { "start": { "line": 365, @@ -73105,8 +74167,8 @@ "postfix": false, "binop": null }, - "start": 15556, - "end": 15557, + "start": 15642, + "end": 15643, "loc": { "start": { "line": 365, @@ -73131,8 +74193,8 @@ "binop": null, "updateContext": null }, - "start": 15557, - "end": 15558, + "start": 15643, + "end": 15644, "loc": { "start": { "line": 365, @@ -73159,8 +74221,8 @@ "updateContext": null }, "value": "const", - "start": 15567, - "end": 15572, + "start": 15653, + "end": 15658, "loc": { "start": { "line": 366, @@ -73185,8 +74247,8 @@ "binop": null }, "value": "canvas", - "start": 15573, - "end": 15579, + "start": 15659, + "end": 15665, "loc": { "start": { "line": 366, @@ -73212,8 +74274,8 @@ "updateContext": null }, "value": "=", - "start": 15580, - "end": 15581, + "start": 15666, + "end": 15667, "loc": { "start": { "line": 366, @@ -73240,8 +74302,8 @@ "updateContext": null }, "value": "this", - "start": 15582, - "end": 15586, + "start": 15668, + "end": 15672, "loc": { "start": { "line": 366, @@ -73266,8 +74328,8 @@ "binop": null, "updateContext": null }, - "start": 15586, - "end": 15587, + "start": 15672, + "end": 15673, "loc": { "start": { "line": 366, @@ -73292,8 +74354,8 @@ "binop": null }, "value": "scene", - "start": 15587, - "end": 15592, + "start": 15673, + "end": 15678, "loc": { "start": { "line": 366, @@ -73318,8 +74380,8 @@ "binop": null, "updateContext": null }, - "start": 15592, - "end": 15593, + "start": 15678, + "end": 15679, "loc": { "start": { "line": 366, @@ -73344,8 +74406,8 @@ "binop": null }, "value": "canvas", - "start": 15593, - "end": 15599, + "start": 15679, + "end": 15685, "loc": { "start": { "line": 366, @@ -73370,8 +74432,8 @@ "binop": null, "updateContext": null }, - "start": 15599, - "end": 15600, + "start": 15685, + "end": 15686, "loc": { "start": { "line": 366, @@ -73396,8 +74458,8 @@ "binop": null }, "value": "canvas", - "start": 15600, - "end": 15606, + "start": 15686, + "end": 15692, "loc": { "start": { "line": 366, @@ -73422,8 +74484,8 @@ "binop": null, "updateContext": null }, - "start": 15606, - "end": 15607, + "start": 15692, + "end": 15693, "loc": { "start": { "line": 366, @@ -73448,8 +74510,8 @@ "binop": null }, "value": "canvas", - "start": 15616, - "end": 15622, + "start": 15702, + "end": 15708, "loc": { "start": { "line": 367, @@ -73474,8 +74536,8 @@ "binop": null, "updateContext": null }, - "start": 15622, - "end": 15623, + "start": 15708, + "end": 15709, "loc": { "start": { "line": 367, @@ -73500,8 +74562,8 @@ "binop": null }, "value": "removeEventListener", - "start": 15623, - "end": 15642, + "start": 15709, + "end": 15728, "loc": { "start": { "line": 367, @@ -73525,8 +74587,8 @@ "postfix": false, "binop": null }, - "start": 15642, - "end": 15643, + "start": 15728, + "end": 15729, "loc": { "start": { "line": 367, @@ -73552,8 +74614,8 @@ "updateContext": null }, "value": "mousedown", - "start": 15643, - "end": 15654, + "start": 15729, + "end": 15740, "loc": { "start": { "line": 367, @@ -73578,8 +74640,8 @@ "binop": null, "updateContext": null }, - "start": 15654, - "end": 15655, + "start": 15740, + "end": 15741, "loc": { "start": { "line": 367, @@ -73606,8 +74668,8 @@ "updateContext": null }, "value": "this", - "start": 15656, - "end": 15660, + "start": 15742, + "end": 15746, "loc": { "start": { "line": 367, @@ -73632,8 +74694,8 @@ "binop": null, "updateContext": null }, - "start": 15660, - "end": 15661, + "start": 15746, + "end": 15747, "loc": { "start": { "line": 367, @@ -73658,8 +74720,8 @@ "binop": null }, "value": "_onMouseDown", - "start": 15661, - "end": 15673, + "start": 15747, + "end": 15759, "loc": { "start": { "line": 367, @@ -73683,8 +74745,8 @@ "postfix": false, "binop": null }, - "start": 15673, - "end": 15674, + "start": 15759, + "end": 15760, "loc": { "start": { "line": 367, @@ -73709,8 +74771,8 @@ "binop": null, "updateContext": null }, - "start": 15674, - "end": 15675, + "start": 15760, + "end": 15761, "loc": { "start": { "line": 367, @@ -73735,8 +74797,8 @@ "binop": null }, "value": "canvas", - "start": 15684, - "end": 15690, + "start": 15770, + "end": 15776, "loc": { "start": { "line": 368, @@ -73761,8 +74823,8 @@ "binop": null, "updateContext": null }, - "start": 15690, - "end": 15691, + "start": 15776, + "end": 15777, "loc": { "start": { "line": 368, @@ -73787,8 +74849,8 @@ "binop": null }, "value": "removeEventListener", - "start": 15691, - "end": 15710, + "start": 15777, + "end": 15796, "loc": { "start": { "line": 368, @@ -73812,8 +74874,8 @@ "postfix": false, "binop": null }, - "start": 15710, - "end": 15711, + "start": 15796, + "end": 15797, "loc": { "start": { "line": 368, @@ -73839,8 +74901,8 @@ "updateContext": null }, "value": "mouseup", - "start": 15711, - "end": 15720, + "start": 15797, + "end": 15806, "loc": { "start": { "line": 368, @@ -73865,8 +74927,8 @@ "binop": null, "updateContext": null }, - "start": 15720, - "end": 15721, + "start": 15806, + "end": 15807, "loc": { "start": { "line": 368, @@ -73893,8 +74955,8 @@ "updateContext": null }, "value": "this", - "start": 15722, - "end": 15726, + "start": 15808, + "end": 15812, "loc": { "start": { "line": 368, @@ -73919,8 +74981,8 @@ "binop": null, "updateContext": null }, - "start": 15726, - "end": 15727, + "start": 15812, + "end": 15813, "loc": { "start": { "line": 368, @@ -73945,8 +75007,8 @@ "binop": null }, "value": "_onMouseUp", - "start": 15727, - "end": 15737, + "start": 15813, + "end": 15823, "loc": { "start": { "line": 368, @@ -73970,8 +75032,8 @@ "postfix": false, "binop": null }, - "start": 15737, - "end": 15738, + "start": 15823, + "end": 15824, "loc": { "start": { "line": 368, @@ -73996,8 +75058,8 @@ "binop": null, "updateContext": null }, - "start": 15738, - "end": 15739, + "start": 15824, + "end": 15825, "loc": { "start": { "line": 368, @@ -74024,8 +75086,8 @@ "updateContext": null }, "value": "const", - "start": 15748, - "end": 15753, + "start": 15834, + "end": 15839, "loc": { "start": { "line": 369, @@ -74050,8 +75112,8 @@ "binop": null }, "value": "cameraControl", - "start": 15754, - "end": 15767, + "start": 15840, + "end": 15853, "loc": { "start": { "line": 369, @@ -74077,8 +75139,8 @@ "updateContext": null }, "value": "=", - "start": 15768, - "end": 15769, + "start": 15854, + "end": 15855, "loc": { "start": { "line": 369, @@ -74105,8 +75167,8 @@ "updateContext": null }, "value": "this", - "start": 15770, - "end": 15774, + "start": 15856, + "end": 15860, "loc": { "start": { "line": 369, @@ -74131,8 +75193,8 @@ "binop": null, "updateContext": null }, - "start": 15774, - "end": 15775, + "start": 15860, + "end": 15861, "loc": { "start": { "line": 369, @@ -74157,8 +75219,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 15775, - "end": 15801, + "start": 15861, + "end": 15887, "loc": { "start": { "line": 369, @@ -74183,8 +75245,8 @@ "binop": null, "updateContext": null }, - "start": 15801, - "end": 15802, + "start": 15887, + "end": 15888, "loc": { "start": { "line": 369, @@ -74209,8 +75271,8 @@ "binop": null }, "value": "viewer", - "start": 15802, - "end": 15808, + "start": 15888, + "end": 15894, "loc": { "start": { "line": 369, @@ -74235,8 +75297,8 @@ "binop": null, "updateContext": null }, - "start": 15808, - "end": 15809, + "start": 15894, + "end": 15895, "loc": { "start": { "line": 369, @@ -74261,8 +75323,8 @@ "binop": null }, "value": "cameraControl", - "start": 15809, - "end": 15822, + "start": 15895, + "end": 15908, "loc": { "start": { "line": 369, @@ -74287,8 +75349,8 @@ "binop": null, "updateContext": null }, - "start": 15822, - "end": 15823, + "start": 15908, + "end": 15909, "loc": { "start": { "line": 369, @@ -74313,8 +75375,8 @@ "binop": null }, "value": "cameraControl", - "start": 15832, - "end": 15845, + "start": 15918, + "end": 15931, "loc": { "start": { "line": 370, @@ -74339,8 +75401,8 @@ "binop": null, "updateContext": null }, - "start": 15845, - "end": 15846, + "start": 15931, + "end": 15932, "loc": { "start": { "line": 370, @@ -74365,8 +75427,8 @@ "binop": null }, "value": "off", - "start": 15846, - "end": 15849, + "start": 15932, + "end": 15935, "loc": { "start": { "line": 370, @@ -74390,8 +75452,8 @@ "postfix": false, "binop": null }, - "start": 15849, - "end": 15850, + "start": 15935, + "end": 15936, "loc": { "start": { "line": 370, @@ -74418,8 +75480,8 @@ "updateContext": null }, "value": "this", - "start": 15850, - "end": 15854, + "start": 15936, + "end": 15940, "loc": { "start": { "line": 370, @@ -74444,8 +75506,8 @@ "binop": null, "updateContext": null }, - "start": 15854, - "end": 15855, + "start": 15940, + "end": 15941, "loc": { "start": { "line": 370, @@ -74470,8 +75532,8 @@ "binop": null }, "value": "_onCameraControlHoverSnapOrSurface", - "start": 15855, - "end": 15889, + "start": 15941, + "end": 15975, "loc": { "start": { "line": 370, @@ -74495,8 +75557,8 @@ "postfix": false, "binop": null }, - "start": 15889, - "end": 15890, + "start": 15975, + "end": 15976, "loc": { "start": { "line": 370, @@ -74521,8 +75583,8 @@ "binop": null, "updateContext": null }, - "start": 15890, - "end": 15891, + "start": 15976, + "end": 15977, "loc": { "start": { "line": 370, @@ -74547,8 +75609,8 @@ "binop": null }, "value": "cameraControl", - "start": 15900, - "end": 15913, + "start": 15986, + "end": 15999, "loc": { "start": { "line": 371, @@ -74573,8 +75635,8 @@ "binop": null, "updateContext": null }, - "start": 15913, - "end": 15914, + "start": 15999, + "end": 16000, "loc": { "start": { "line": 371, @@ -74599,8 +75661,8 @@ "binop": null }, "value": "off", - "start": 15914, - "end": 15917, + "start": 16000, + "end": 16003, "loc": { "start": { "line": 371, @@ -74624,8 +75686,8 @@ "postfix": false, "binop": null }, - "start": 15917, - "end": 15918, + "start": 16003, + "end": 16004, "loc": { "start": { "line": 371, @@ -74652,8 +75714,8 @@ "updateContext": null }, "value": "this", - "start": 15918, - "end": 15922, + "start": 16004, + "end": 16008, "loc": { "start": { "line": 371, @@ -74678,8 +75740,8 @@ "binop": null, "updateContext": null }, - "start": 15922, - "end": 15923, + "start": 16008, + "end": 16009, "loc": { "start": { "line": 371, @@ -74704,8 +75766,8 @@ "binop": null }, "value": "_onCameraControlHoverSnapOrSurfaceOff", - "start": 15923, - "end": 15960, + "start": 16009, + "end": 16046, "loc": { "start": { "line": 371, @@ -74729,8 +75791,8 @@ "postfix": false, "binop": null }, - "start": 15960, - "end": 15961, + "start": 16046, + "end": 16047, "loc": { "start": { "line": 371, @@ -74755,8 +75817,8 @@ "binop": null, "updateContext": null }, - "start": 15961, - "end": 15962, + "start": 16047, + "end": 16048, "loc": { "start": { "line": 371, @@ -74783,8 +75845,8 @@ "updateContext": null }, "value": "if", - "start": 15971, - "end": 15973, + "start": 16057, + "end": 16059, "loc": { "start": { "line": 372, @@ -74808,8 +75870,8 @@ "postfix": false, "binop": null }, - "start": 15974, - "end": 15975, + "start": 16060, + "end": 16061, "loc": { "start": { "line": 372, @@ -74836,8 +75898,8 @@ "updateContext": null }, "value": "this", - "start": 15975, - "end": 15979, + "start": 16061, + "end": 16065, "loc": { "start": { "line": 372, @@ -74862,8 +75924,8 @@ "binop": null, "updateContext": null }, - "start": 15979, - "end": 15980, + "start": 16065, + "end": 16066, "loc": { "start": { "line": 372, @@ -74888,8 +75950,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 15980, - "end": 16007, + "start": 16066, + "end": 16093, "loc": { "start": { "line": 372, @@ -74913,8 +75975,8 @@ "postfix": false, "binop": null }, - "start": 16007, - "end": 16008, + "start": 16093, + "end": 16094, "loc": { "start": { "line": 372, @@ -74938,8 +76000,8 @@ "postfix": false, "binop": null }, - "start": 16009, - "end": 16010, + "start": 16095, + "end": 16096, "loc": { "start": { "line": 372, @@ -74966,8 +76028,8 @@ "updateContext": null }, "value": "this", - "start": 16023, - "end": 16027, + "start": 16109, + "end": 16113, "loc": { "start": { "line": 373, @@ -74992,8 +76054,8 @@ "binop": null, "updateContext": null }, - "start": 16027, - "end": 16028, + "start": 16113, + "end": 16114, "loc": { "start": { "line": 373, @@ -75018,8 +76080,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 16028, - "end": 16054, + "start": 16114, + "end": 16140, "loc": { "start": { "line": 373, @@ -75044,8 +76106,8 @@ "binop": null, "updateContext": null }, - "start": 16054, - "end": 16055, + "start": 16140, + "end": 16141, "loc": { "start": { "line": 373, @@ -75070,8 +76132,8 @@ "binop": null }, "value": "fire", - "start": 16055, - "end": 16059, + "start": 16141, + "end": 16145, "loc": { "start": { "line": 373, @@ -75095,8 +76157,8 @@ "postfix": false, "binop": null }, - "start": 16059, - "end": 16060, + "start": 16145, + "end": 16146, "loc": { "start": { "line": 373, @@ -75122,8 +76184,8 @@ "updateContext": null }, "value": "measurementCancel", - "start": 16060, - "end": 16079, + "start": 16146, + "end": 16165, "loc": { "start": { "line": 373, @@ -75148,8 +76210,8 @@ "binop": null, "updateContext": null }, - "start": 16079, - "end": 16080, + "start": 16165, + "end": 16166, "loc": { "start": { "line": 373, @@ -75176,8 +76238,8 @@ "updateContext": null }, "value": "this", - "start": 16081, - "end": 16085, + "start": 16167, + "end": 16171, "loc": { "start": { "line": 373, @@ -75202,8 +76264,8 @@ "binop": null, "updateContext": null }, - "start": 16085, - "end": 16086, + "start": 16171, + "end": 16172, "loc": { "start": { "line": 373, @@ -75228,8 +76290,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16086, - "end": 16113, + "start": 16172, + "end": 16199, "loc": { "start": { "line": 373, @@ -75253,8 +76315,8 @@ "postfix": false, "binop": null }, - "start": 16113, - "end": 16114, + "start": 16199, + "end": 16200, "loc": { "start": { "line": 373, @@ -75279,8 +76341,8 @@ "binop": null, "updateContext": null }, - "start": 16114, - "end": 16115, + "start": 16200, + "end": 16201, "loc": { "start": { "line": 373, @@ -75307,8 +76369,8 @@ "updateContext": null }, "value": "this", - "start": 16128, - "end": 16132, + "start": 16214, + "end": 16218, "loc": { "start": { "line": 374, @@ -75333,8 +76395,8 @@ "binop": null, "updateContext": null }, - "start": 16132, - "end": 16133, + "start": 16218, + "end": 16219, "loc": { "start": { "line": 374, @@ -75359,8 +76421,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16133, - "end": 16160, + "start": 16219, + "end": 16246, "loc": { "start": { "line": 374, @@ -75385,8 +76447,8 @@ "binop": null, "updateContext": null }, - "start": 16160, - "end": 16161, + "start": 16246, + "end": 16247, "loc": { "start": { "line": 374, @@ -75411,8 +76473,8 @@ "binop": null }, "value": "destroy", - "start": 16161, - "end": 16168, + "start": 16247, + "end": 16254, "loc": { "start": { "line": 374, @@ -75436,8 +76498,8 @@ "postfix": false, "binop": null }, - "start": 16168, - "end": 16169, + "start": 16254, + "end": 16255, "loc": { "start": { "line": 374, @@ -75461,8 +76523,8 @@ "postfix": false, "binop": null }, - "start": 16169, - "end": 16170, + "start": 16255, + "end": 16256, "loc": { "start": { "line": 374, @@ -75487,8 +76549,8 @@ "binop": null, "updateContext": null }, - "start": 16170, - "end": 16171, + "start": 16256, + "end": 16257, "loc": { "start": { "line": 374, @@ -75515,8 +76577,8 @@ "updateContext": null }, "value": "this", - "start": 16184, - "end": 16188, + "start": 16270, + "end": 16274, "loc": { "start": { "line": 375, @@ -75541,8 +76603,8 @@ "binop": null, "updateContext": null }, - "start": 16188, - "end": 16189, + "start": 16274, + "end": 16275, "loc": { "start": { "line": 375, @@ -75567,8 +76629,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16189, - "end": 16216, + "start": 16275, + "end": 16302, "loc": { "start": { "line": 375, @@ -75594,8 +76656,8 @@ "updateContext": null }, "value": "=", - "start": 16217, - "end": 16218, + "start": 16303, + "end": 16304, "loc": { "start": { "line": 375, @@ -75622,8 +76684,8 @@ "updateContext": null }, "value": "null", - "start": 16219, - "end": 16223, + "start": 16305, + "end": 16309, "loc": { "start": { "line": 375, @@ -75648,8 +76710,8 @@ "binop": null, "updateContext": null }, - "start": 16223, - "end": 16224, + "start": 16309, + "end": 16310, "loc": { "start": { "line": 375, @@ -75673,8 +76735,8 @@ "postfix": false, "binop": null }, - "start": 16233, - "end": 16234, + "start": 16319, + "end": 16320, "loc": { "start": { "line": 376, @@ -75701,8 +76763,8 @@ "updateContext": null }, "value": "this", - "start": 16243, - "end": 16247, + "start": 16329, + "end": 16333, "loc": { "start": { "line": 377, @@ -75727,8 +76789,8 @@ "binop": null, "updateContext": null }, - "start": 16247, - "end": 16248, + "start": 16333, + "end": 16334, "loc": { "start": { "line": 377, @@ -75753,8 +76815,8 @@ "binop": null }, "value": "_active", - "start": 16248, - "end": 16255, + "start": 16334, + "end": 16341, "loc": { "start": { "line": 377, @@ -75780,8 +76842,8 @@ "updateContext": null }, "value": "=", - "start": 16256, - "end": 16257, + "start": 16342, + "end": 16343, "loc": { "start": { "line": 377, @@ -75808,8 +76870,8 @@ "updateContext": null }, "value": "false", - "start": 16258, - "end": 16263, + "start": 16344, + "end": 16349, "loc": { "start": { "line": 377, @@ -75834,8 +76896,8 @@ "binop": null, "updateContext": null }, - "start": 16263, - "end": 16264, + "start": 16349, + "end": 16350, "loc": { "start": { "line": 377, @@ -75859,8 +76921,8 @@ "postfix": false, "binop": null }, - "start": 16269, - "end": 16270, + "start": 16355, + "end": 16356, "loc": { "start": { "line": 378, @@ -75875,8 +76937,8 @@ { "type": "CommentBlock", "value": "*\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n ", - "start": 16276, - "end": 16538, + "start": 16362, + "end": 16624, "loc": { "start": { "line": 380, @@ -75901,8 +76963,8 @@ "binop": null }, "value": "reset", - "start": 16543, - "end": 16548, + "start": 16629, + "end": 16634, "loc": { "start": { "line": 387, @@ -75926,8 +76988,8 @@ "postfix": false, "binop": null }, - "start": 16548, - "end": 16549, + "start": 16634, + "end": 16635, "loc": { "start": { "line": 387, @@ -75951,8 +77013,8 @@ "postfix": false, "binop": null }, - "start": 16549, - "end": 16550, + "start": 16635, + "end": 16636, "loc": { "start": { "line": 387, @@ -75976,8 +77038,8 @@ "postfix": false, "binop": null }, - "start": 16551, - "end": 16552, + "start": 16637, + "end": 16638, "loc": { "start": { "line": 387, @@ -76004,8 +77066,8 @@ "updateContext": null }, "value": "if", - "start": 16561, - "end": 16563, + "start": 16647, + "end": 16649, "loc": { "start": { "line": 388, @@ -76029,8 +77091,8 @@ "postfix": false, "binop": null }, - "start": 16564, - "end": 16565, + "start": 16650, + "end": 16651, "loc": { "start": { "line": 388, @@ -76056,8 +77118,8 @@ "updateContext": null }, "value": "!", - "start": 16565, - "end": 16566, + "start": 16651, + "end": 16652, "loc": { "start": { "line": 388, @@ -76084,8 +77146,8 @@ "updateContext": null }, "value": "this", - "start": 16566, - "end": 16570, + "start": 16652, + "end": 16656, "loc": { "start": { "line": 388, @@ -76110,8 +77172,8 @@ "binop": null, "updateContext": null }, - "start": 16570, - "end": 16571, + "start": 16656, + "end": 16657, "loc": { "start": { "line": 388, @@ -76136,8 +77198,8 @@ "binop": null }, "value": "_active", - "start": 16571, - "end": 16578, + "start": 16657, + "end": 16664, "loc": { "start": { "line": 388, @@ -76161,8 +77223,8 @@ "postfix": false, "binop": null }, - "start": 16578, - "end": 16579, + "start": 16664, + "end": 16665, "loc": { "start": { "line": 388, @@ -76186,8 +77248,8 @@ "postfix": false, "binop": null }, - "start": 16580, - "end": 16581, + "start": 16666, + "end": 16667, "loc": { "start": { "line": 388, @@ -76214,8 +77276,8 @@ "updateContext": null }, "value": "return", - "start": 16594, - "end": 16600, + "start": 16680, + "end": 16686, "loc": { "start": { "line": 389, @@ -76240,8 +77302,8 @@ "binop": null, "updateContext": null }, - "start": 16600, - "end": 16601, + "start": 16686, + "end": 16687, "loc": { "start": { "line": 389, @@ -76265,8 +77327,8 @@ "postfix": false, "binop": null }, - "start": 16610, - "end": 16611, + "start": 16696, + "end": 16697, "loc": { "start": { "line": 390, @@ -76293,8 +77355,8 @@ "updateContext": null }, "value": "this", - "start": 16621, - "end": 16625, + "start": 16707, + "end": 16711, "loc": { "start": { "line": 392, @@ -76319,8 +77381,8 @@ "binop": null, "updateContext": null }, - "start": 16625, - "end": 16626, + "start": 16711, + "end": 16712, "loc": { "start": { "line": 392, @@ -76345,8 +77407,8 @@ "binop": null }, "value": "_destroyMarkerDiv", - "start": 16626, - "end": 16643, + "start": 16712, + "end": 16729, "loc": { "start": { "line": 392, @@ -76370,8 +77432,8 @@ "postfix": false, "binop": null }, - "start": 16643, - "end": 16644, + "start": 16729, + "end": 16730, "loc": { "start": { "line": 392, @@ -76395,8 +77457,8 @@ "postfix": false, "binop": null }, - "start": 16644, - "end": 16645, + "start": 16730, + "end": 16731, "loc": { "start": { "line": 392, @@ -76423,8 +77485,8 @@ "updateContext": null }, "value": "this", - "start": 16654, - "end": 16658, + "start": 16740, + "end": 16744, "loc": { "start": { "line": 393, @@ -76449,8 +77511,8 @@ "binop": null, "updateContext": null }, - "start": 16658, - "end": 16659, + "start": 16744, + "end": 16745, "loc": { "start": { "line": 393, @@ -76475,8 +77537,8 @@ "binop": null }, "value": "_initMarkerDiv", - "start": 16659, - "end": 16673, + "start": 16745, + "end": 16759, "loc": { "start": { "line": 393, @@ -76500,8 +77562,8 @@ "postfix": false, "binop": null }, - "start": 16673, - "end": 16674, + "start": 16759, + "end": 16760, "loc": { "start": { "line": 393, @@ -76525,8 +77587,8 @@ "postfix": false, "binop": null }, - "start": 16674, - "end": 16675, + "start": 16760, + "end": 16761, "loc": { "start": { "line": 393, @@ -76553,8 +77615,8 @@ "updateContext": null }, "value": "if", - "start": 16685, - "end": 16687, + "start": 16771, + "end": 16773, "loc": { "start": { "line": 395, @@ -76578,8 +77640,8 @@ "postfix": false, "binop": null }, - "start": 16688, - "end": 16689, + "start": 16774, + "end": 16775, "loc": { "start": { "line": 395, @@ -76606,8 +77668,8 @@ "updateContext": null }, "value": "this", - "start": 16689, - "end": 16693, + "start": 16775, + "end": 16779, "loc": { "start": { "line": 395, @@ -76632,8 +77694,8 @@ "binop": null, "updateContext": null }, - "start": 16693, - "end": 16694, + "start": 16779, + "end": 16780, "loc": { "start": { "line": 395, @@ -76658,8 +77720,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16694, - "end": 16721, + "start": 16780, + "end": 16807, "loc": { "start": { "line": 395, @@ -76683,8 +77745,8 @@ "postfix": false, "binop": null }, - "start": 16721, - "end": 16722, + "start": 16807, + "end": 16808, "loc": { "start": { "line": 395, @@ -76708,8 +77770,8 @@ "postfix": false, "binop": null }, - "start": 16723, - "end": 16724, + "start": 16809, + "end": 16810, "loc": { "start": { "line": 395, @@ -76736,8 +77798,8 @@ "updateContext": null }, "value": "this", - "start": 16737, - "end": 16741, + "start": 16823, + "end": 16827, "loc": { "start": { "line": 396, @@ -76762,8 +77824,8 @@ "binop": null, "updateContext": null }, - "start": 16741, - "end": 16742, + "start": 16827, + "end": 16828, "loc": { "start": { "line": 396, @@ -76788,8 +77850,8 @@ "binop": null }, "value": "distanceMeasurementsPlugin", - "start": 16742, - "end": 16768, + "start": 16828, + "end": 16854, "loc": { "start": { "line": 396, @@ -76814,8 +77876,8 @@ "binop": null, "updateContext": null }, - "start": 16768, - "end": 16769, + "start": 16854, + "end": 16855, "loc": { "start": { "line": 396, @@ -76840,8 +77902,8 @@ "binop": null }, "value": "fire", - "start": 16769, - "end": 16773, + "start": 16855, + "end": 16859, "loc": { "start": { "line": 396, @@ -76865,8 +77927,8 @@ "postfix": false, "binop": null }, - "start": 16773, - "end": 16774, + "start": 16859, + "end": 16860, "loc": { "start": { "line": 396, @@ -76892,8 +77954,8 @@ "updateContext": null }, "value": "measurementCancel", - "start": 16774, - "end": 16793, + "start": 16860, + "end": 16879, "loc": { "start": { "line": 396, @@ -76918,8 +77980,8 @@ "binop": null, "updateContext": null }, - "start": 16793, - "end": 16794, + "start": 16879, + "end": 16880, "loc": { "start": { "line": 396, @@ -76946,8 +78008,8 @@ "updateContext": null }, "value": "this", - "start": 16795, - "end": 16799, + "start": 16881, + "end": 16885, "loc": { "start": { "line": 396, @@ -76972,8 +78034,8 @@ "binop": null, "updateContext": null }, - "start": 16799, - "end": 16800, + "start": 16885, + "end": 16886, "loc": { "start": { "line": 396, @@ -76998,8 +78060,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16800, - "end": 16827, + "start": 16886, + "end": 16913, "loc": { "start": { "line": 396, @@ -77023,8 +78085,8 @@ "postfix": false, "binop": null }, - "start": 16827, - "end": 16828, + "start": 16913, + "end": 16914, "loc": { "start": { "line": 396, @@ -77049,8 +78111,8 @@ "binop": null, "updateContext": null }, - "start": 16828, - "end": 16829, + "start": 16914, + "end": 16915, "loc": { "start": { "line": 396, @@ -77077,8 +78139,8 @@ "updateContext": null }, "value": "this", - "start": 16842, - "end": 16846, + "start": 16928, + "end": 16932, "loc": { "start": { "line": 397, @@ -77103,8 +78165,8 @@ "binop": null, "updateContext": null }, - "start": 16846, - "end": 16847, + "start": 16932, + "end": 16933, "loc": { "start": { "line": 397, @@ -77129,8 +78191,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16847, - "end": 16874, + "start": 16933, + "end": 16960, "loc": { "start": { "line": 397, @@ -77155,8 +78217,8 @@ "binop": null, "updateContext": null }, - "start": 16874, - "end": 16875, + "start": 16960, + "end": 16961, "loc": { "start": { "line": 397, @@ -77181,8 +78243,8 @@ "binop": null }, "value": "destroy", - "start": 16875, - "end": 16882, + "start": 16961, + "end": 16968, "loc": { "start": { "line": 397, @@ -77206,8 +78268,8 @@ "postfix": false, "binop": null }, - "start": 16882, - "end": 16883, + "start": 16968, + "end": 16969, "loc": { "start": { "line": 397, @@ -77231,8 +78293,8 @@ "postfix": false, "binop": null }, - "start": 16883, - "end": 16884, + "start": 16969, + "end": 16970, "loc": { "start": { "line": 397, @@ -77257,8 +78319,8 @@ "binop": null, "updateContext": null }, - "start": 16884, - "end": 16885, + "start": 16970, + "end": 16971, "loc": { "start": { "line": 397, @@ -77285,8 +78347,8 @@ "updateContext": null }, "value": "this", - "start": 16898, - "end": 16902, + "start": 16984, + "end": 16988, "loc": { "start": { "line": 398, @@ -77311,8 +78373,8 @@ "binop": null, "updateContext": null }, - "start": 16902, - "end": 16903, + "start": 16988, + "end": 16989, "loc": { "start": { "line": 398, @@ -77337,8 +78399,8 @@ "binop": null }, "value": "_currentDistanceMeasurement", - "start": 16903, - "end": 16930, + "start": 16989, + "end": 17016, "loc": { "start": { "line": 398, @@ -77364,8 +78426,8 @@ "updateContext": null }, "value": "=", - "start": 16931, - "end": 16932, + "start": 17017, + "end": 17018, "loc": { "start": { "line": 398, @@ -77392,8 +78454,8 @@ "updateContext": null }, "value": "null", - "start": 16933, - "end": 16937, + "start": 17019, + "end": 17023, "loc": { "start": { "line": 398, @@ -77418,8 +78480,8 @@ "binop": null, "updateContext": null }, - "start": 16937, - "end": 16938, + "start": 17023, + "end": 17024, "loc": { "start": { "line": 398, @@ -77443,8 +78505,8 @@ "postfix": false, "binop": null }, - "start": 16947, - "end": 16948, + "start": 17033, + "end": 17034, "loc": { "start": { "line": 399, @@ -77456,6 +78518,467 @@ } } }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 17044, + "end": 17048, + "loc": { + "start": { + "line": 401, + "column": 8 + }, + "end": { + "line": 401, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 17048, + "end": 17049, + "loc": { + "start": { + "line": 401, + "column": 12 + }, + "end": { + "line": 401, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_mouseState", + "start": 17049, + "end": 17060, + "loc": { + "start": { + "line": 401, + "column": 13 + }, + "end": { + "line": 401, + "column": 24 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 17061, + "end": 17062, + "loc": { + "start": { + "line": 401, + "column": 25 + }, + "end": { + "line": 401, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "MOUSE_FIRST_CLICK_EXPECTED", + "start": 17063, + "end": 17089, + "loc": { + "start": { + "line": 401, + "column": 27 + }, + "end": { + "line": 401, + "column": 53 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 17089, + "end": 17090, + "loc": { + "start": { + "line": 401, + "column": 53 + }, + "end": { + "line": 401, + "column": 54 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 17095, + "end": 17096, + "loc": { + "start": { + "line": 402, + "column": 4 + }, + "end": { + "line": 402, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 17102, + "end": 17276, + "loc": { + "start": { + "line": 404, + "column": 4 + }, + "end": { + "line": 408, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "get", + "start": 17281, + "end": 17284, + "loc": { + "start": { + "line": 409, + "column": 4 + }, + "end": { + "line": 409, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 17285, + "end": 17303, + "loc": { + "start": { + "line": 409, + "column": 8 + }, + "end": { + "line": 409, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 17303, + "end": 17304, + "loc": { + "start": { + "line": 409, + "column": 26 + }, + "end": { + "line": 409, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 17304, + "end": 17305, + "loc": { + "start": { + "line": 409, + "column": 27 + }, + "end": { + "line": 409, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 17306, + "end": 17307, + "loc": { + "start": { + "line": 409, + "column": 29 + }, + "end": { + "line": 409, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 17316, + "end": 17322, + "loc": { + "start": { + "line": 410, + "column": 8 + }, + "end": { + "line": 410, + "column": 14 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 17323, + "end": 17327, + "loc": { + "start": { + "line": 410, + "column": 15 + }, + "end": { + "line": 410, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 17327, + "end": 17328, + "loc": { + "start": { + "line": 410, + "column": 19 + }, + "end": { + "line": 410, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_currentDistanceMeasurement", + "start": 17328, + "end": 17355, + "loc": { + "start": { + "line": 410, + "column": 20 + }, + "end": { + "line": 410, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 17355, + "end": 17356, + "loc": { + "start": { + "line": 410, + "column": 47 + }, + "end": { + "line": 410, + "column": 48 + } + } + }, { "type": { "label": "}", @@ -77468,15 +78991,15 @@ "postfix": false, "binop": null }, - "start": 16953, - "end": 16954, + "start": 17361, + "end": 17362, "loc": { "start": { - "line": 400, + "line": 411, "column": 4 }, "end": { - "line": 400, + "line": 411, "column": 5 } } @@ -77484,15 +79007,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n ", - "start": 16960, - "end": 17142, + "start": 17368, + "end": 17550, "loc": { "start": { - "line": 402, + "line": 413, "column": 4 }, "end": { - "line": 406, + "line": 417, "column": 7 } } @@ -77510,15 +79033,15 @@ "binop": null }, "value": "destroy", - "start": 17147, - "end": 17154, + "start": 17555, + "end": 17562, "loc": { "start": { - "line": 407, + "line": 418, "column": 4 }, "end": { - "line": 407, + "line": 418, "column": 11 } } @@ -77535,15 +79058,15 @@ "postfix": false, "binop": null }, - "start": 17154, - "end": 17155, + "start": 17562, + "end": 17563, "loc": { "start": { - "line": 407, + "line": 418, "column": 11 }, "end": { - "line": 407, + "line": 418, "column": 12 } } @@ -77560,15 +79083,15 @@ "postfix": false, "binop": null }, - "start": 17155, - "end": 17156, + "start": 17563, + "end": 17564, "loc": { "start": { - "line": 407, + "line": 418, "column": 12 }, "end": { - "line": 407, + "line": 418, "column": 13 } } @@ -77585,15 +79108,15 @@ "postfix": false, "binop": null }, - "start": 17157, - "end": 17158, + "start": 17565, + "end": 17566, "loc": { "start": { - "line": 407, + "line": 418, "column": 14 }, "end": { - "line": 407, + "line": 418, "column": 15 } } @@ -77613,15 +79136,15 @@ "updateContext": null }, "value": "this", - "start": 17167, - "end": 17171, + "start": 17575, + "end": 17579, "loc": { "start": { - "line": 408, + "line": 419, "column": 8 }, "end": { - "line": 408, + "line": 419, "column": 12 } } @@ -77639,15 +79162,15 @@ "binop": null, "updateContext": null }, - "start": 17171, - "end": 17172, + "start": 17579, + "end": 17580, "loc": { "start": { - "line": 408, + "line": 419, "column": 12 }, "end": { - "line": 408, + "line": 419, "column": 13 } } @@ -77665,15 +79188,15 @@ "binop": null }, "value": "deactivate", - "start": 17172, - "end": 17182, + "start": 17580, + "end": 17590, "loc": { "start": { - "line": 408, + "line": 419, "column": 13 }, "end": { - "line": 408, + "line": 419, "column": 23 } } @@ -77690,15 +79213,15 @@ "postfix": false, "binop": null }, - "start": 17182, - "end": 17183, + "start": 17590, + "end": 17591, "loc": { "start": { - "line": 408, + "line": 419, "column": 23 }, "end": { - "line": 408, + "line": 419, "column": 24 } } @@ -77715,15 +79238,15 @@ "postfix": false, "binop": null }, - "start": 17183, - "end": 17184, + "start": 17591, + "end": 17592, "loc": { "start": { - "line": 408, + "line": 419, "column": 24 }, "end": { - "line": 408, + "line": 419, "column": 25 } } @@ -77741,15 +79264,15 @@ "binop": null, "updateContext": null }, - "start": 17184, - "end": 17185, + "start": 17592, + "end": 17593, "loc": { "start": { - "line": 408, + "line": 419, "column": 25 }, "end": { - "line": 408, + "line": 419, "column": 26 } } @@ -77769,15 +79292,15 @@ "updateContext": null }, "value": "super", - "start": 17194, - "end": 17199, + "start": 17602, + "end": 17607, "loc": { "start": { - "line": 409, + "line": 420, "column": 8 }, "end": { - "line": 409, + "line": 420, "column": 13 } } @@ -77795,15 +79318,15 @@ "binop": null, "updateContext": null }, - "start": 17199, - "end": 17200, + "start": 17607, + "end": 17608, "loc": { "start": { - "line": 409, + "line": 420, "column": 13 }, "end": { - "line": 409, + "line": 420, "column": 14 } } @@ -77821,15 +79344,15 @@ "binop": null }, "value": "destroy", - "start": 17200, - "end": 17207, + "start": 17608, + "end": 17615, "loc": { "start": { - "line": 409, + "line": 420, "column": 14 }, "end": { - "line": 409, + "line": 420, "column": 21 } } @@ -77846,15 +79369,15 @@ "postfix": false, "binop": null }, - "start": 17207, - "end": 17208, + "start": 17615, + "end": 17616, "loc": { "start": { - "line": 409, + "line": 420, "column": 21 }, "end": { - "line": 409, + "line": 420, "column": 22 } } @@ -77871,15 +79394,15 @@ "postfix": false, "binop": null }, - "start": 17208, - "end": 17209, + "start": 17616, + "end": 17617, "loc": { "start": { - "line": 409, + "line": 420, "column": 22 }, "end": { - "line": 409, + "line": 420, "column": 23 } } @@ -77897,15 +79420,15 @@ "binop": null, "updateContext": null }, - "start": 17209, - "end": 17210, + "start": 17617, + "end": 17618, "loc": { "start": { - "line": 409, + "line": 420, "column": 23 }, "end": { - "line": 409, + "line": 420, "column": 24 } } @@ -77922,15 +79445,15 @@ "postfix": false, "binop": null }, - "start": 17215, - "end": 17216, + "start": 17623, + "end": 17624, "loc": { "start": { - "line": 410, + "line": 421, "column": 4 }, "end": { - "line": 410, + "line": 421, "column": 5 } } @@ -77947,15 +79470,15 @@ "postfix": false, "binop": null }, - "start": 17217, - "end": 17218, + "start": 17625, + "end": 17626, "loc": { "start": { - "line": 411, + "line": 422, "column": 0 }, "end": { - "line": 411, + "line": 422, "column": 1 } } @@ -77973,15 +79496,15 @@ "binop": null, "updateContext": null }, - "start": 17219, - "end": 17219, + "start": 17627, + "end": 17627, "loc": { "start": { - "line": 412, + "line": 423, "column": 0 }, "end": { - "line": 412, + "line": 423, "column": 0 } } diff --git a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.json b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.json index b125657258..2a7c1640ff 100644 --- a/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.json +++ b/docs/ast/source/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 35844, + "end": 36169, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 761, + "line": 771, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 35844, + "end": 36169, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 761, + "line": 771, "column": 0 } }, @@ -797,14 +797,14 @@ { "type": "ExportNamedDeclaration", "start": 634, - "end": 35843, + "end": 36168, "loc": { "start": { "line": 22, "column": 0 }, "end": { - "line": 760, + "line": 770, "column": 1 } }, @@ -813,14 +813,14 @@ "declaration": { "type": "ClassDeclaration", "start": 641, - "end": 35843, + "end": 36168, "loc": { "start": { "line": 22, "column": 7 }, "end": { - "line": 760, + "line": 770, "column": 1 } }, @@ -862,14 +862,14 @@ "body": { "type": "ClassBody", "start": 716, - "end": 35843, + "end": 36168, "loc": { "start": { "line": 22, "column": 82 }, "end": { - "line": 760, + "line": 770, "column": 1 } }, @@ -48745,14 +48745,14 @@ { "type": "ClassMethod", "start": 35349, - "end": 35695, + "end": 35754, "loc": { "start": { "line": 742, "column": 4 }, "end": { - "line": 751, + "line": 752, "column": 5 } }, @@ -48785,14 +48785,14 @@ "body": { "type": "BlockStatement", "start": 35357, - "end": 35695, + "end": 35754, "loc": { "start": { "line": 742, "column": 12 }, "end": { - "line": 751, + "line": 752, "column": 5 } }, @@ -49383,6 +49383,102 @@ "directives": [] }, "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 35698, + "end": 35748, + "loc": { + "start": { + "line": 751, + "column": 8 + }, + "end": { + "line": 751, + "column": 58 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 35698, + "end": 35747, + "loc": { + "start": { + "line": 751, + "column": 8 + }, + "end": { + "line": 751, + "column": 57 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 35698, + "end": 35714, + "loc": { + "start": { + "line": 751, + "column": 8 + }, + "end": { + "line": 751, + "column": 24 + } + }, + "object": { + "type": "ThisExpression", + "start": 35698, + "end": 35702, + "loc": { + "start": { + "line": 751, + "column": 8 + }, + "end": { + "line": 751, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "start": 35703, + "end": 35714, + "loc": { + "start": { + "line": 751, + "column": 13 + }, + "end": { + "line": 751, + "column": 24 + }, + "identifierName": "_mouseState" + }, + "name": "_mouseState" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 35717, + "end": 35747, + "loc": { + "start": { + "line": 751, + "column": 27 + }, + "end": { + "line": 751, + "column": 57 + }, + "identifierName": "WAITING_FOR_ORIGIN_TOUCH_START" + }, + "name": "WAITING_FOR_ORIGIN_TOUCH_START" + } + } } ], "directives": [], @@ -49406,19 +49502,177 @@ } } ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 35760, + "end": 35934, + "loc": { + "start": { + "line": 754, + "column": 4 + }, + "end": { + "line": 758, + "column": 7 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 35939, + "end": 36020, + "loc": { + "start": { + "line": 759, + "column": 4 + }, + "end": { + "line": 761, + "column": 5 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 35943, + "end": 35961, + "loc": { + "start": { + "line": 759, + "column": 8 + }, + "end": { + "line": 759, + "column": 26 + }, + "identifierName": "currentMeasurement" + }, + "name": "currentMeasurement" + }, + "kind": "get", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35964, + "end": 36020, + "loc": { + "start": { + "line": 759, + "column": 29 + }, + "end": { + "line": 761, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 35974, + "end": 36014, + "loc": { + "start": { + "line": 760, + "column": 8 + }, + "end": { + "line": 760, + "column": 48 + } + }, + "argument": { + "type": "MemberExpression", + "start": 35981, + "end": 36013, + "loc": { + "start": { + "line": 760, + "column": 15 + }, + "end": { + "line": 760, + "column": 47 + } + }, + "object": { + "type": "ThisExpression", + "start": 35981, + "end": 35985, + "loc": { + "start": { + "line": 760, + "column": 15 + }, + "end": { + "line": 760, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "start": 35986, + "end": 36013, + "loc": { + "start": { + "line": 760, + "column": 20 + }, + "end": { + "line": 760, + "column": 47 + }, + "identifierName": "_currentDistanceMeasurement" + }, + "name": "_currentDistanceMeasurement" + }, + "computed": false + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 35760, + "end": 35934, + "loc": { + "start": { + "line": 754, + "column": 4 + }, + "end": { + "line": 758, + "column": 7 + } + } + } + ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsTouchControl.\n ", - "start": 35701, - "end": 35767, + "start": 36026, + "end": 36092, "loc": { "start": { - "line": 753, + "line": 763, "column": 4 }, "end": { - "line": 755, + "line": 765, "column": 7 } } @@ -49427,15 +49681,15 @@ }, { "type": "ClassMethod", - "start": 35772, - "end": 35841, + "start": 36097, + "end": 36166, "loc": { "start": { - "line": 756, + "line": 766, "column": 4 }, "end": { - "line": 759, + "line": 769, "column": 5 } }, @@ -49443,15 +49697,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 35772, - "end": 35779, + "start": 36097, + "end": 36104, "loc": { "start": { - "line": 756, + "line": 766, "column": 4 }, "end": { - "line": 756, + "line": 766, "column": 11 }, "identifierName": "destroy" @@ -49467,87 +49721,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 35782, - "end": 35841, + "start": 36107, + "end": 36166, "loc": { "start": { - "line": 756, + "line": 766, "column": 14 }, "end": { - "line": 759, + "line": 769, "column": 5 } }, "body": [ { "type": "ExpressionStatement", - "start": 35792, - "end": 35810, + "start": 36117, + "end": 36135, "loc": { "start": { - "line": 757, + "line": 767, "column": 8 }, "end": { - "line": 757, + "line": 767, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 35792, - "end": 35809, + "start": 36117, + "end": 36134, "loc": { "start": { - "line": 757, + "line": 767, "column": 8 }, "end": { - "line": 757, + "line": 767, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 35792, - "end": 35807, + "start": 36117, + "end": 36132, "loc": { "start": { - "line": 757, + "line": 767, "column": 8 }, "end": { - "line": 757, + "line": 767, "column": 23 } }, "object": { "type": "ThisExpression", - "start": 35792, - "end": 35796, + "start": 36117, + "end": 36121, "loc": { "start": { - "line": 757, + "line": 767, "column": 8 }, "end": { - "line": 757, + "line": 767, "column": 12 } } }, "property": { "type": "Identifier", - "start": 35797, - "end": 35807, + "start": 36122, + "end": 36132, "loc": { "start": { - "line": 757, + "line": 767, "column": 13 }, "end": { - "line": 757, + "line": 767, "column": 23 }, "identifierName": "deactivate" @@ -49561,72 +49815,72 @@ }, { "type": "ExpressionStatement", - "start": 35819, - "end": 35835, + "start": 36144, + "end": 36160, "loc": { "start": { - "line": 758, + "line": 768, "column": 8 }, "end": { - "line": 758, + "line": 768, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 35819, - "end": 35834, + "start": 36144, + "end": 36159, "loc": { "start": { - "line": 758, + "line": 768, "column": 8 }, "end": { - "line": 758, + "line": 768, "column": 23 } }, "callee": { "type": "MemberExpression", - "start": 35819, - "end": 35832, + "start": 36144, + "end": 36157, "loc": { "start": { - "line": 758, + "line": 768, "column": 8 }, "end": { - "line": 758, + "line": 768, "column": 21 } }, "object": { "type": "Super", - "start": 35819, - "end": 35824, + "start": 36144, + "end": 36149, "loc": { "start": { - "line": 758, + "line": 768, "column": 8 }, "end": { - "line": 758, + "line": 768, "column": 13 } } }, "property": { "type": "Identifier", - "start": 35825, - "end": 35832, + "start": 36150, + "end": 36157, "loc": { "start": { - "line": 758, + "line": 768, "column": 14 }, "end": { - "line": 758, + "line": 768, "column": 21 }, "identifierName": "destroy" @@ -49645,15 +49899,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsTouchControl.\n ", - "start": 35701, - "end": 35767, + "start": 36026, + "end": 36092, "loc": { "start": { - "line": 753, + "line": 763, "column": 4 }, "end": { - "line": 755, + "line": 765, "column": 7 } } @@ -50361,18 +50615,34 @@ } } }, + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 35760, + "end": 35934, + "loc": { + "start": { + "line": 754, + "column": 4 + }, + "end": { + "line": 758, + "column": 7 + } + } + }, { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsTouchControl.\n ", - "start": 35701, - "end": 35767, + "start": 36026, + "end": 36092, "loc": { "start": { - "line": 753, + "line": 763, "column": 4 }, "end": { - "line": 755, + "line": 765, "column": 7 } } @@ -142541,7 +142811,35 @@ }, { "type": { - "label": "}", + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 35698, + "end": 35702, + "loc": { + "start": { + "line": 751, + "column": 8 + }, + "end": { + "line": 751, + "column": 12 + } + } + }, + { + "type": { + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -142549,17 +142847,450 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 35702, + "end": 35703, + "loc": { + "start": { + "line": 751, + "column": 12 + }, + "end": { + "line": 751, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null }, - "start": 35694, - "end": 35695, + "value": "_mouseState", + "start": 35703, + "end": 35714, "loc": { "start": { "line": 751, - "column": 4 + "column": 13 + }, + "end": { + "line": 751, + "column": 24 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 35715, + "end": 35716, + "loc": { + "start": { + "line": 751, + "column": 25 }, "end": { "line": 751, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "WAITING_FOR_ORIGIN_TOUCH_START", + "start": 35717, + "end": 35747, + "loc": { + "start": { + "line": 751, + "column": 27 + }, + "end": { + "line": 751, + "column": 57 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 35747, + "end": 35748, + "loc": { + "start": { + "line": 751, + "column": 57 + }, + "end": { + "line": 751, + "column": 58 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 35753, + "end": 35754, + "loc": { + "start": { + "line": 752, + "column": 4 + }, + "end": { + "line": 752, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n ", + "start": 35760, + "end": 35934, + "loc": { + "start": { + "line": 754, + "column": 4 + }, + "end": { + "line": 758, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "get", + "start": 35939, + "end": 35942, + "loc": { + "start": { + "line": 759, + "column": 4 + }, + "end": { + "line": 759, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "currentMeasurement", + "start": 35943, + "end": 35961, + "loc": { + "start": { + "line": 759, + "column": 8 + }, + "end": { + "line": 759, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 35961, + "end": 35962, + "loc": { + "start": { + "line": 759, + "column": 26 + }, + "end": { + "line": 759, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 35962, + "end": 35963, + "loc": { + "start": { + "line": 759, + "column": 27 + }, + "end": { + "line": 759, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 35964, + "end": 35965, + "loc": { + "start": { + "line": 759, + "column": 29 + }, + "end": { + "line": 759, + "column": 30 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 35974, + "end": 35980, + "loc": { + "start": { + "line": 760, + "column": 8 + }, + "end": { + "line": 760, + "column": 14 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 35981, + "end": 35985, + "loc": { + "start": { + "line": 760, + "column": 15 + }, + "end": { + "line": 760, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 35985, + "end": 35986, + "loc": { + "start": { + "line": 760, + "column": 19 + }, + "end": { + "line": 760, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_currentDistanceMeasurement", + "start": 35986, + "end": 36013, + "loc": { + "start": { + "line": 760, + "column": 20 + }, + "end": { + "line": 760, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 36013, + "end": 36014, + "loc": { + "start": { + "line": 760, + "column": 47 + }, + "end": { + "line": 760, + "column": 48 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 36019, + "end": 36020, + "loc": { + "start": { + "line": 761, + "column": 4 + }, + "end": { + "line": 761, "column": 5 } } @@ -142567,15 +143298,15 @@ { "type": "CommentBlock", "value": "*\n * Destroys this DistanceMeasurementsTouchControl.\n ", - "start": 35701, - "end": 35767, + "start": 36026, + "end": 36092, "loc": { "start": { - "line": 753, + "line": 763, "column": 4 }, "end": { - "line": 755, + "line": 765, "column": 7 } } @@ -142593,15 +143324,15 @@ "binop": null }, "value": "destroy", - "start": 35772, - "end": 35779, + "start": 36097, + "end": 36104, "loc": { "start": { - "line": 756, + "line": 766, "column": 4 }, "end": { - "line": 756, + "line": 766, "column": 11 } } @@ -142618,15 +143349,15 @@ "postfix": false, "binop": null }, - "start": 35779, - "end": 35780, + "start": 36104, + "end": 36105, "loc": { "start": { - "line": 756, + "line": 766, "column": 11 }, "end": { - "line": 756, + "line": 766, "column": 12 } } @@ -142643,15 +143374,15 @@ "postfix": false, "binop": null }, - "start": 35780, - "end": 35781, + "start": 36105, + "end": 36106, "loc": { "start": { - "line": 756, + "line": 766, "column": 12 }, "end": { - "line": 756, + "line": 766, "column": 13 } } @@ -142668,15 +143399,15 @@ "postfix": false, "binop": null }, - "start": 35782, - "end": 35783, + "start": 36107, + "end": 36108, "loc": { "start": { - "line": 756, + "line": 766, "column": 14 }, "end": { - "line": 756, + "line": 766, "column": 15 } } @@ -142696,15 +143427,15 @@ "updateContext": null }, "value": "this", - "start": 35792, - "end": 35796, + "start": 36117, + "end": 36121, "loc": { "start": { - "line": 757, + "line": 767, "column": 8 }, "end": { - "line": 757, + "line": 767, "column": 12 } } @@ -142722,15 +143453,15 @@ "binop": null, "updateContext": null }, - "start": 35796, - "end": 35797, + "start": 36121, + "end": 36122, "loc": { "start": { - "line": 757, + "line": 767, "column": 12 }, "end": { - "line": 757, + "line": 767, "column": 13 } } @@ -142748,15 +143479,15 @@ "binop": null }, "value": "deactivate", - "start": 35797, - "end": 35807, + "start": 36122, + "end": 36132, "loc": { "start": { - "line": 757, + "line": 767, "column": 13 }, "end": { - "line": 757, + "line": 767, "column": 23 } } @@ -142773,15 +143504,15 @@ "postfix": false, "binop": null }, - "start": 35807, - "end": 35808, + "start": 36132, + "end": 36133, "loc": { "start": { - "line": 757, + "line": 767, "column": 23 }, "end": { - "line": 757, + "line": 767, "column": 24 } } @@ -142798,15 +143529,15 @@ "postfix": false, "binop": null }, - "start": 35808, - "end": 35809, + "start": 36133, + "end": 36134, "loc": { "start": { - "line": 757, + "line": 767, "column": 24 }, "end": { - "line": 757, + "line": 767, "column": 25 } } @@ -142824,15 +143555,15 @@ "binop": null, "updateContext": null }, - "start": 35809, - "end": 35810, + "start": 36134, + "end": 36135, "loc": { "start": { - "line": 757, + "line": 767, "column": 25 }, "end": { - "line": 757, + "line": 767, "column": 26 } } @@ -142852,15 +143583,15 @@ "updateContext": null }, "value": "super", - "start": 35819, - "end": 35824, + "start": 36144, + "end": 36149, "loc": { "start": { - "line": 758, + "line": 768, "column": 8 }, "end": { - "line": 758, + "line": 768, "column": 13 } } @@ -142878,15 +143609,15 @@ "binop": null, "updateContext": null }, - "start": 35824, - "end": 35825, + "start": 36149, + "end": 36150, "loc": { "start": { - "line": 758, + "line": 768, "column": 13 }, "end": { - "line": 758, + "line": 768, "column": 14 } } @@ -142904,15 +143635,15 @@ "binop": null }, "value": "destroy", - "start": 35825, - "end": 35832, + "start": 36150, + "end": 36157, "loc": { "start": { - "line": 758, + "line": 768, "column": 14 }, "end": { - "line": 758, + "line": 768, "column": 21 } } @@ -142929,15 +143660,15 @@ "postfix": false, "binop": null }, - "start": 35832, - "end": 35833, + "start": 36157, + "end": 36158, "loc": { "start": { - "line": 758, + "line": 768, "column": 21 }, "end": { - "line": 758, + "line": 768, "column": 22 } } @@ -142954,15 +143685,15 @@ "postfix": false, "binop": null }, - "start": 35833, - "end": 35834, + "start": 36158, + "end": 36159, "loc": { "start": { - "line": 758, + "line": 768, "column": 22 }, "end": { - "line": 758, + "line": 768, "column": 23 } } @@ -142980,15 +143711,15 @@ "binop": null, "updateContext": null }, - "start": 35834, - "end": 35835, + "start": 36159, + "end": 36160, "loc": { "start": { - "line": 758, + "line": 768, "column": 23 }, "end": { - "line": 758, + "line": 768, "column": 24 } } @@ -143005,15 +143736,15 @@ "postfix": false, "binop": null }, - "start": 35840, - "end": 35841, + "start": 36165, + "end": 36166, "loc": { "start": { - "line": 759, + "line": 769, "column": 4 }, "end": { - "line": 759, + "line": 769, "column": 5 } } @@ -143030,15 +143761,15 @@ "postfix": false, "binop": null }, - "start": 35842, - "end": 35843, + "start": 36167, + "end": 36168, "loc": { "start": { - "line": 760, + "line": 770, "column": 0 }, "end": { - "line": 760, + "line": 770, "column": 1 } } @@ -143056,15 +143787,15 @@ "binop": null, "updateContext": null }, - "start": 35844, - "end": 35844, + "start": 36169, + "end": 36169, "loc": { "start": { - "line": 761, + "line": 771, "column": 0 }, "end": { - "line": 761, + "line": 771, "column": 0 } } diff --git a/docs/ast/source/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.json b/docs/ast/source/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.json index 00d3c9ef3d..bf5cb07370 100644 --- a/docs/ast/source/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.json +++ b/docs/ast/source/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 2046, + "end": 2012, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 2046, + "end": 2012, "loc": { "start": { "line": 1, @@ -3658,7 +3658,7 @@ { "type": "FunctionDeclaration", "start": 1619, - "end": 2017, + "end": 1983, "loc": { "start": { "line": 55, @@ -3745,7 +3745,7 @@ "body": { "type": "BlockStatement", "start": 1676, - "end": 2017, + "end": 1983, "loc": { "start": { "line": 55, @@ -3760,7 +3760,7 @@ { "type": "IfStatement", "start": 1682, - "end": 1993, + "end": 1959, "loc": { "start": { "line": 56, @@ -4195,7 +4195,7 @@ "alternate": { "type": "BlockStatement", "start": 1801, - "end": 1993, + "end": 1959, "loc": { "start": { "line": 60, @@ -4436,7 +4436,7 @@ { "type": "ExpressionStatement", "start": 1873, - "end": 1926, + "end": 1909, "loc": { "start": { "line": 62, @@ -4444,13 +4444,13 @@ }, "end": { "line": 62, - "column": 61 + "column": 44 } }, "expression": { "type": "AssignmentExpression", "start": 1873, - "end": 1925, + "end": 1908, "loc": { "start": { "line": 62, @@ -4458,7 +4458,7 @@ }, "end": { "line": 62, - "column": 60 + "column": 43 } }, "operator": "=", @@ -4518,7 +4518,7 @@ "right": { "type": "BinaryExpression", "start": 1888, - "end": 1925, + "end": 1908, "loc": { "start": { "line": 62, @@ -4526,13 +4526,13 @@ }, "end": { "line": 62, - "column": 60 + "column": 43 } }, "left": { - "type": "BinaryExpression", + "type": "MemberExpression", "start": 1888, - "end": 1908, + "end": 1901, "loc": { "start": { "line": 62, @@ -4540,13 +4540,13 @@ }, "end": { "line": 62, - "column": 43 + "column": 36 } }, - "left": { - "type": "MemberExpression", + "object": { + "type": "Identifier", "start": 1888, - "end": 1901, + "end": 1893, "loc": { "start": { "line": 62, @@ -4554,122 +4554,56 @@ }, "end": { "line": 62, - "column": 36 - } - }, - "object": { - "type": "Identifier", - "start": 1888, - "end": 1893, - "loc": { - "start": { - "line": 62, - "column": 23 - }, - "end": { - "line": 62, - "column": 28 - }, - "identifierName": "event" + "column": 28 }, - "name": "event" + "identifierName": "event" }, - "property": { - "type": "Identifier", - "start": 1894, - "end": 1901, - "loc": { - "start": { - "line": 62, - "column": 29 - }, - "end": { - "line": 62, - "column": 36 - }, - "identifierName": "clientX" - }, - "name": "clientX" - }, - "computed": false + "name": "event" }, - "operator": "-", - "right": { + "property": { "type": "Identifier", - "start": 1904, - "end": 1908, + "start": 1894, + "end": 1901, "loc": { "start": { "line": 62, - "column": 39 + "column": 29 }, "end": { "line": 62, - "column": 43 + "column": 36 }, - "identifierName": "left" + "identifierName": "clientX" }, - "name": "left" - } + "name": "clientX" + }, + "computed": false }, "operator": "-", "right": { - "type": "MemberExpression", - "start": 1911, - "end": 1925, + "type": "Identifier", + "start": 1904, + "end": 1908, "loc": { "start": { "line": 62, - "column": 46 + "column": 39 }, "end": { "line": 62, - "column": 60 - } - }, - "object": { - "type": "Identifier", - "start": 1911, - "end": 1917, - "loc": { - "start": { - "line": 62, - "column": 46 - }, - "end": { - "line": 62, - "column": 52 - }, - "identifierName": "window" - }, - "name": "window" - }, - "property": { - "type": "Identifier", - "start": 1918, - "end": 1925, - "loc": { - "start": { - "line": 62, - "column": 53 - }, - "end": { - "line": 62, - "column": 60 - }, - "identifierName": "scrollX" + "column": 43 }, - "name": "scrollX" + "identifierName": "left" }, - "computed": false + "name": "left" } } } }, { "type": "ExpressionStatement", - "start": 1935, - "end": 1987, + "start": 1918, + "end": 1953, "loc": { "start": { "line": 63, @@ -4677,13 +4611,13 @@ }, "end": { "line": 63, - "column": 60 + "column": 43 } }, "expression": { "type": "AssignmentExpression", - "start": 1935, - "end": 1986, + "start": 1918, + "end": 1952, "loc": { "start": { "line": 63, @@ -4691,14 +4625,14 @@ }, "end": { "line": 63, - "column": 59 + "column": 42 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1935, - "end": 1947, + "start": 1918, + "end": 1930, "loc": { "start": { "line": 63, @@ -4711,8 +4645,8 @@ }, "object": { "type": "Identifier", - "start": 1935, - "end": 1944, + "start": 1918, + "end": 1927, "loc": { "start": { "line": 63, @@ -4728,8 +4662,8 @@ }, "property": { "type": "NumericLiteral", - "start": 1945, - "end": 1946, + "start": 1928, + "end": 1929, "loc": { "start": { "line": 63, @@ -4750,8 +4684,8 @@ }, "right": { "type": "BinaryExpression", - "start": 1950, - "end": 1986, + "start": 1933, + "end": 1952, "loc": { "start": { "line": 63, @@ -4759,13 +4693,13 @@ }, "end": { "line": 63, - "column": 59 + "column": 42 } }, "left": { - "type": "BinaryExpression", - "start": 1950, - "end": 1969, + "type": "MemberExpression", + "start": 1933, + "end": 1946, "loc": { "start": { "line": 63, @@ -4773,13 +4707,13 @@ }, "end": { "line": 63, - "column": 42 + "column": 36 } }, - "left": { - "type": "MemberExpression", - "start": 1950, - "end": 1963, + "object": { + "type": "Identifier", + "start": 1933, + "end": 1938, "loc": { "start": { "line": 63, @@ -4787,114 +4721,48 @@ }, "end": { "line": 63, - "column": 36 - } - }, - "object": { - "type": "Identifier", - "start": 1950, - "end": 1955, - "loc": { - "start": { - "line": 63, - "column": 23 - }, - "end": { - "line": 63, - "column": 28 - }, - "identifierName": "event" - }, - "name": "event" - }, - "property": { - "type": "Identifier", - "start": 1956, - "end": 1963, - "loc": { - "start": { - "line": 63, - "column": 29 - }, - "end": { - "line": 63, - "column": 36 - }, - "identifierName": "clientY" + "column": 28 }, - "name": "clientY" + "identifierName": "event" }, - "computed": false + "name": "event" }, - "operator": "-", - "right": { + "property": { "type": "Identifier", - "start": 1966, - "end": 1969, + "start": 1939, + "end": 1946, "loc": { "start": { "line": 63, - "column": 39 + "column": 29 }, "end": { "line": 63, - "column": 42 + "column": 36 }, - "identifierName": "top" + "identifierName": "clientY" }, - "name": "top" - } + "name": "clientY" + }, + "computed": false }, "operator": "-", "right": { - "type": "MemberExpression", - "start": 1972, - "end": 1986, + "type": "Identifier", + "start": 1949, + "end": 1952, "loc": { "start": { "line": 63, - "column": 45 + "column": 39 }, "end": { "line": 63, - "column": 59 - } - }, - "object": { - "type": "Identifier", - "start": 1972, - "end": 1978, - "loc": { - "start": { - "line": 63, - "column": 45 - }, - "end": { - "line": 63, - "column": 51 - }, - "identifierName": "window" - }, - "name": "window" - }, - "property": { - "type": "Identifier", - "start": 1979, - "end": 1986, - "loc": { - "start": { - "line": 63, - "column": 52 - }, - "end": { - "line": 63, - "column": 59 - }, - "identifierName": "scrollY" + "column": 42 }, - "name": "scrollY" + "identifierName": "top" }, - "computed": false + "name": "top" } } } @@ -4905,8 +4773,8 @@ }, { "type": "ReturnStatement", - "start": 1998, - "end": 2015, + "start": 1964, + "end": 1981, "loc": { "start": { "line": 65, @@ -4919,8 +4787,8 @@ }, "argument": { "type": "Identifier", - "start": 2005, - "end": 2014, + "start": 1971, + "end": 1980, "loc": { "start": { "line": 65, @@ -4941,8 +4809,8 @@ }, { "type": "ExportNamedDeclaration", - "start": 2019, - "end": 2045, + "start": 1985, + "end": 2011, "loc": { "start": { "line": 68, @@ -4957,8 +4825,8 @@ "specifiers": [ { "type": "ExportSpecifier", - "start": 2027, - "end": 2043, + "start": 1993, + "end": 2009, "loc": { "start": { "line": 68, @@ -4971,8 +4839,8 @@ }, "local": { "type": "Identifier", - "start": 2027, - "end": 2043, + "start": 1993, + "end": 2009, "loc": { "start": { "line": 68, @@ -4988,8 +4856,8 @@ }, "exported": { "type": "Identifier", - "start": 2027, - "end": 2043, + "start": 1993, + "end": 2009, "loc": { "start": { "line": 68, @@ -5009,8 +4877,8 @@ }, { "type": "ExportNamedDeclaration", - "start": 2019, - "end": 2045, + "start": 1985, + "end": 2011, "loc": { "start": { "line": 68, @@ -17738,111 +17606,6 @@ } } }, - { - "type": { - "label": "+/-", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": 9, - "updateContext": null - }, - "value": "-", - "start": 1909, - "end": 1910, - "loc": { - "start": { - "line": 62, - "column": 44 - }, - "end": { - "line": 62, - "column": 45 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "window", - "start": 1911, - "end": 1917, - "loc": { - "start": { - "line": 62, - "column": 46 - }, - "end": { - "line": 62, - "column": 52 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1917, - "end": 1918, - "loc": { - "start": { - "line": 62, - "column": 52 - }, - "end": { - "line": 62, - "column": 53 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "scrollX", - "start": 1918, - "end": 1925, - "loc": { - "start": { - "line": 62, - "column": 53 - }, - "end": { - "line": 62, - "column": 60 - } - } - }, { "type": { "label": ";", @@ -17856,16 +17619,16 @@ "binop": null, "updateContext": null }, - "start": 1925, - "end": 1926, + "start": 1908, + "end": 1909, "loc": { "start": { "line": 62, - "column": 60 + "column": 43 }, "end": { "line": 62, - "column": 61 + "column": 44 } } }, @@ -17882,8 +17645,8 @@ "binop": null }, "value": "canvasPos", - "start": 1935, - "end": 1944, + "start": 1918, + "end": 1927, "loc": { "start": { "line": 63, @@ -17908,8 +17671,8 @@ "binop": null, "updateContext": null }, - "start": 1944, - "end": 1945, + "start": 1927, + "end": 1928, "loc": { "start": { "line": 63, @@ -17935,8 +17698,8 @@ "updateContext": null }, "value": 1, - "start": 1945, - "end": 1946, + "start": 1928, + "end": 1929, "loc": { "start": { "line": 63, @@ -17961,8 +17724,8 @@ "binop": null, "updateContext": null }, - "start": 1946, - "end": 1947, + "start": 1929, + "end": 1930, "loc": { "start": { "line": 63, @@ -17988,8 +17751,8 @@ "updateContext": null }, "value": "=", - "start": 1948, - "end": 1949, + "start": 1931, + "end": 1932, "loc": { "start": { "line": 63, @@ -18014,8 +17777,8 @@ "binop": null }, "value": "event", - "start": 1950, - "end": 1955, + "start": 1933, + "end": 1938, "loc": { "start": { "line": 63, @@ -18040,8 +17803,8 @@ "binop": null, "updateContext": null }, - "start": 1955, - "end": 1956, + "start": 1938, + "end": 1939, "loc": { "start": { "line": 63, @@ -18066,8 +17829,8 @@ "binop": null }, "value": "clientY", - "start": 1956, - "end": 1963, + "start": 1939, + "end": 1946, "loc": { "start": { "line": 63, @@ -18093,8 +17856,8 @@ "updateContext": null }, "value": "-", - "start": 1964, - "end": 1965, + "start": 1947, + "end": 1948, "loc": { "start": { "line": 63, @@ -18119,8 +17882,8 @@ "binop": null }, "value": "top", - "start": 1966, - "end": 1969, + "start": 1949, + "end": 1952, "loc": { "start": { "line": 63, @@ -18132,111 +17895,6 @@ } } }, - { - "type": { - "label": "+/-", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": 9, - "updateContext": null - }, - "value": "-", - "start": 1970, - "end": 1971, - "loc": { - "start": { - "line": 63, - "column": 43 - }, - "end": { - "line": 63, - "column": 44 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "window", - "start": 1972, - "end": 1978, - "loc": { - "start": { - "line": 63, - "column": 45 - }, - "end": { - "line": 63, - "column": 51 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1978, - "end": 1979, - "loc": { - "start": { - "line": 63, - "column": 51 - }, - "end": { - "line": 63, - "column": 52 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "scrollY", - "start": 1979, - "end": 1986, - "loc": { - "start": { - "line": 63, - "column": 52 - }, - "end": { - "line": 63, - "column": 59 - } - } - }, { "type": { "label": ";", @@ -18250,16 +17908,16 @@ "binop": null, "updateContext": null }, - "start": 1986, - "end": 1987, + "start": 1952, + "end": 1953, "loc": { "start": { "line": 63, - "column": 59 + "column": 42 }, "end": { "line": 63, - "column": 60 + "column": 43 } } }, @@ -18275,8 +17933,8 @@ "postfix": false, "binop": null }, - "start": 1992, - "end": 1993, + "start": 1958, + "end": 1959, "loc": { "start": { "line": 64, @@ -18303,8 +17961,8 @@ "updateContext": null }, "value": "return", - "start": 1998, - "end": 2004, + "start": 1964, + "end": 1970, "loc": { "start": { "line": 65, @@ -18329,8 +17987,8 @@ "binop": null }, "value": "canvasPos", - "start": 2005, - "end": 2014, + "start": 1971, + "end": 1980, "loc": { "start": { "line": 65, @@ -18355,8 +18013,8 @@ "binop": null, "updateContext": null }, - "start": 2014, - "end": 2015, + "start": 1980, + "end": 1981, "loc": { "start": { "line": 65, @@ -18380,8 +18038,8 @@ "postfix": false, "binop": null }, - "start": 2016, - "end": 2017, + "start": 1982, + "end": 1983, "loc": { "start": { "line": 66, @@ -18408,8 +18066,8 @@ "updateContext": null }, "value": "export", - "start": 2019, - "end": 2025, + "start": 1985, + "end": 1991, "loc": { "start": { "line": 68, @@ -18433,8 +18091,8 @@ "postfix": false, "binop": null }, - "start": 2026, - "end": 2027, + "start": 1992, + "end": 1993, "loc": { "start": { "line": 68, @@ -18459,8 +18117,8 @@ "binop": null }, "value": "MouseMiscHandler", - "start": 2027, - "end": 2043, + "start": 1993, + "end": 2009, "loc": { "start": { "line": 68, @@ -18484,8 +18142,8 @@ "postfix": false, "binop": null }, - "start": 2043, - "end": 2044, + "start": 2009, + "end": 2010, "loc": { "start": { "line": 68, @@ -18510,8 +18168,8 @@ "binop": null, "updateContext": null }, - "start": 2044, - "end": 2045, + "start": 2010, + "end": 2011, "loc": { "start": { "line": 68, @@ -18536,8 +18194,8 @@ "binop": null, "updateContext": null }, - "start": 2046, - "end": 2046, + "start": 2012, + "end": 2012, "loc": { "start": { "line": 69, diff --git a/docs/ast/source/viewer/scene/marker/Marker.js.json b/docs/ast/source/viewer/scene/marker/Marker.js.json index 360999ab34..7a4798d741 100644 --- a/docs/ast/source/viewer/scene/marker/Marker.js.json +++ b/docs/ast/source/viewer/scene/marker/Marker.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 13485, + "end": 13493, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 13485, + "end": 13493, "loc": { "start": { "line": 1, @@ -606,9 +606,9 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker({\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", + "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker(viewer, {\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", "start": 261, - "end": 4561, + "end": 4569, "loc": { "start": { "line": 10, @@ -624,8 +624,8 @@ }, { "type": "Identifier", - "start": 4562, - "end": 13466, + "start": 4570, + "end": 13474, "loc": { "start": { "line": 114, @@ -638,8 +638,8 @@ }, "id": { "type": "Identifier", - "start": 4568, - "end": 4574, + "start": 4576, + "end": 4582, "loc": { "start": { "line": 114, @@ -656,8 +656,8 @@ }, "superClass": { "type": "Identifier", - "start": 4583, - "end": 4592, + "start": 4591, + "end": 4600, "loc": { "start": { "line": 114, @@ -673,8 +673,8 @@ }, "body": { "type": "ClassBody", - "start": 4593, - "end": 13466, + "start": 4601, + "end": 13474, "loc": { "start": { "line": 114, @@ -688,8 +688,8 @@ "body": [ { "type": "ClassMethod", - "start": 5410, - "end": 6313, + "start": 5418, + "end": 6321, "loc": { "start": { "line": 125, @@ -704,8 +704,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 5410, - "end": 5421, + "start": 5418, + "end": 5429, "loc": { "start": { "line": 125, @@ -728,8 +728,8 @@ "params": [ { "type": "Identifier", - "start": 5422, - "end": 5427, + "start": 5430, + "end": 5435, "loc": { "start": { "line": 125, @@ -745,8 +745,8 @@ }, { "type": "Identifier", - "start": 5429, - "end": 5432, + "start": 5437, + "end": 5440, "loc": { "start": { "line": 125, @@ -763,8 +763,8 @@ ], "body": { "type": "BlockStatement", - "start": 5434, - "end": 6313, + "start": 5442, + "end": 6321, "loc": { "start": { "line": 125, @@ -778,8 +778,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5445, - "end": 5463, + "start": 5453, + "end": 5471, "loc": { "start": { "line": 127, @@ -792,8 +792,8 @@ }, "expression": { "type": "CallExpression", - "start": 5445, - "end": 5462, + "start": 5453, + "end": 5470, "loc": { "start": { "line": 127, @@ -806,8 +806,8 @@ }, "callee": { "type": "Super", - "start": 5445, - "end": 5450, + "start": 5453, + "end": 5458, "loc": { "start": { "line": 127, @@ -822,8 +822,8 @@ "arguments": [ { "type": "Identifier", - "start": 5451, - "end": 5456, + "start": 5459, + "end": 5464, "loc": { "start": { "line": 127, @@ -839,8 +839,8 @@ }, { "type": "Identifier", - "start": 5458, - "end": 5461, + "start": 5466, + "end": 5469, "loc": { "start": { "line": 127, @@ -859,8 +859,8 @@ }, { "type": "ExpressionStatement", - "start": 5473, - "end": 5493, + "start": 5481, + "end": 5501, "loc": { "start": { "line": 129, @@ -873,8 +873,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5473, - "end": 5492, + "start": 5481, + "end": 5500, "loc": { "start": { "line": 129, @@ -888,8 +888,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5473, - "end": 5485, + "start": 5481, + "end": 5493, "loc": { "start": { "line": 129, @@ -902,8 +902,8 @@ }, "object": { "type": "ThisExpression", - "start": 5473, - "end": 5477, + "start": 5481, + "end": 5485, "loc": { "start": { "line": 129, @@ -917,8 +917,8 @@ }, "property": { "type": "Identifier", - "start": 5478, - "end": 5485, + "start": 5486, + "end": 5493, "loc": { "start": { "line": 129, @@ -936,8 +936,8 @@ }, "right": { "type": "NullLiteral", - "start": 5488, - "end": 5492, + "start": 5496, + "end": 5500, "loc": { "start": { "line": 129, @@ -953,8 +953,8 @@ }, { "type": "ExpressionStatement", - "start": 5502, - "end": 5523, + "start": 5510, + "end": 5531, "loc": { "start": { "line": 130, @@ -967,8 +967,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5502, - "end": 5522, + "start": 5510, + "end": 5530, "loc": { "start": { "line": 130, @@ -982,8 +982,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5502, - "end": 5515, + "start": 5510, + "end": 5523, "loc": { "start": { "line": 130, @@ -996,8 +996,8 @@ }, "object": { "type": "ThisExpression", - "start": 5502, - "end": 5506, + "start": 5510, + "end": 5514, "loc": { "start": { "line": 130, @@ -1011,8 +1011,8 @@ }, "property": { "type": "Identifier", - "start": 5507, - "end": 5515, + "start": 5515, + "end": 5523, "loc": { "start": { "line": 130, @@ -1030,8 +1030,8 @@ }, "right": { "type": "NullLiteral", - "start": 5518, - "end": 5522, + "start": 5526, + "end": 5530, "loc": { "start": { "line": 130, @@ -1047,8 +1047,8 @@ }, { "type": "ExpressionStatement", - "start": 5532, - "end": 5561, + "start": 5540, + "end": 5569, "loc": { "start": { "line": 131, @@ -1061,8 +1061,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5532, - "end": 5560, + "start": 5540, + "end": 5568, "loc": { "start": { "line": 131, @@ -1076,8 +1076,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5532, - "end": 5546, + "start": 5540, + "end": 5554, "loc": { "start": { "line": 131, @@ -1090,8 +1090,8 @@ }, "object": { "type": "ThisExpression", - "start": 5532, - "end": 5536, + "start": 5540, + "end": 5544, "loc": { "start": { "line": 131, @@ -1105,8 +1105,8 @@ }, "property": { "type": "Identifier", - "start": 5537, - "end": 5546, + "start": 5545, + "end": 5554, "loc": { "start": { "line": 131, @@ -1124,8 +1124,8 @@ }, "right": { "type": "CallExpression", - "start": 5549, - "end": 5560, + "start": 5557, + "end": 5568, "loc": { "start": { "line": 131, @@ -1138,8 +1138,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5549, - "end": 5558, + "start": 5557, + "end": 5566, "loc": { "start": { "line": 131, @@ -1152,8 +1152,8 @@ }, "object": { "type": "Identifier", - "start": 5549, - "end": 5553, + "start": 5557, + "end": 5561, "loc": { "start": { "line": 131, @@ -1169,8 +1169,8 @@ }, "property": { "type": "Identifier", - "start": 5554, - "end": 5558, + "start": 5562, + "end": 5566, "loc": { "start": { "line": 131, @@ -1192,8 +1192,8 @@ }, { "type": "ExpressionStatement", - "start": 5570, - "end": 5597, + "start": 5578, + "end": 5605, "loc": { "start": { "line": 132, @@ -1206,8 +1206,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5570, - "end": 5596, + "start": 5578, + "end": 5604, "loc": { "start": { "line": 132, @@ -1221,8 +1221,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5570, - "end": 5582, + "start": 5578, + "end": 5590, "loc": { "start": { "line": 132, @@ -1235,8 +1235,8 @@ }, "object": { "type": "ThisExpression", - "start": 5570, - "end": 5574, + "start": 5578, + "end": 5582, "loc": { "start": { "line": 132, @@ -1250,8 +1250,8 @@ }, "property": { "type": "Identifier", - "start": 5575, - "end": 5582, + "start": 5583, + "end": 5590, "loc": { "start": { "line": 132, @@ -1269,8 +1269,8 @@ }, "right": { "type": "CallExpression", - "start": 5585, - "end": 5596, + "start": 5593, + "end": 5604, "loc": { "start": { "line": 132, @@ -1283,8 +1283,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5585, - "end": 5594, + "start": 5593, + "end": 5602, "loc": { "start": { "line": 132, @@ -1297,8 +1297,8 @@ }, "object": { "type": "Identifier", - "start": 5585, - "end": 5589, + "start": 5593, + "end": 5597, "loc": { "start": { "line": 132, @@ -1314,8 +1314,8 @@ }, "property": { "type": "Identifier", - "start": 5590, - "end": 5594, + "start": 5598, + "end": 5602, "loc": { "start": { "line": 132, @@ -1337,8 +1337,8 @@ }, { "type": "ExpressionStatement", - "start": 5606, - "end": 5633, + "start": 5614, + "end": 5641, "loc": { "start": { "line": 133, @@ -1351,8 +1351,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5606, - "end": 5632, + "start": 5614, + "end": 5640, "loc": { "start": { "line": 133, @@ -1366,8 +1366,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5606, - "end": 5618, + "start": 5614, + "end": 5626, "loc": { "start": { "line": 133, @@ -1380,8 +1380,8 @@ }, "object": { "type": "ThisExpression", - "start": 5606, - "end": 5610, + "start": 5614, + "end": 5618, "loc": { "start": { "line": 133, @@ -1395,8 +1395,8 @@ }, "property": { "type": "Identifier", - "start": 5611, - "end": 5618, + "start": 5619, + "end": 5626, "loc": { "start": { "line": 133, @@ -1414,8 +1414,8 @@ }, "right": { "type": "CallExpression", - "start": 5621, - "end": 5632, + "start": 5629, + "end": 5640, "loc": { "start": { "line": 133, @@ -1428,8 +1428,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5621, - "end": 5630, + "start": 5629, + "end": 5638, "loc": { "start": { "line": 133, @@ -1442,8 +1442,8 @@ }, "object": { "type": "Identifier", - "start": 5621, - "end": 5625, + "start": 5629, + "end": 5633, "loc": { "start": { "line": 133, @@ -1459,8 +1459,8 @@ }, "property": { "type": "Identifier", - "start": 5626, - "end": 5630, + "start": 5634, + "end": 5638, "loc": { "start": { "line": 133, @@ -1482,8 +1482,8 @@ }, { "type": "ExpressionStatement", - "start": 5642, - "end": 5670, + "start": 5650, + "end": 5678, "loc": { "start": { "line": 134, @@ -1496,8 +1496,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5642, - "end": 5669, + "start": 5650, + "end": 5677, "loc": { "start": { "line": 134, @@ -1511,8 +1511,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5642, - "end": 5655, + "start": 5650, + "end": 5663, "loc": { "start": { "line": 134, @@ -1525,8 +1525,8 @@ }, "object": { "type": "ThisExpression", - "start": 5642, - "end": 5646, + "start": 5650, + "end": 5654, "loc": { "start": { "line": 134, @@ -1540,8 +1540,8 @@ }, "property": { "type": "Identifier", - "start": 5647, - "end": 5655, + "start": 5655, + "end": 5663, "loc": { "start": { "line": 134, @@ -1559,8 +1559,8 @@ }, "right": { "type": "CallExpression", - "start": 5658, - "end": 5669, + "start": 5666, + "end": 5677, "loc": { "start": { "line": 134, @@ -1573,8 +1573,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5658, - "end": 5667, + "start": 5666, + "end": 5675, "loc": { "start": { "line": 134, @@ -1587,8 +1587,8 @@ }, "object": { "type": "Identifier", - "start": 5658, - "end": 5662, + "start": 5666, + "end": 5670, "loc": { "start": { "line": 134, @@ -1604,8 +1604,8 @@ }, "property": { "type": "Identifier", - "start": 5663, - "end": 5667, + "start": 5671, + "end": 5675, "loc": { "start": { "line": 134, @@ -1627,8 +1627,8 @@ }, { "type": "ExpressionStatement", - "start": 5679, - "end": 5709, + "start": 5687, + "end": 5717, "loc": { "start": { "line": 135, @@ -1641,8 +1641,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5679, - "end": 5708, + "start": 5687, + "end": 5716, "loc": { "start": { "line": 135, @@ -1656,8 +1656,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5679, - "end": 5694, + "start": 5687, + "end": 5702, "loc": { "start": { "line": 135, @@ -1670,8 +1670,8 @@ }, "object": { "type": "ThisExpression", - "start": 5679, - "end": 5683, + "start": 5687, + "end": 5691, "loc": { "start": { "line": 135, @@ -1685,8 +1685,8 @@ }, "property": { "type": "Identifier", - "start": 5684, - "end": 5694, + "start": 5692, + "end": 5702, "loc": { "start": { "line": 135, @@ -1704,8 +1704,8 @@ }, "right": { "type": "CallExpression", - "start": 5697, - "end": 5708, + "start": 5705, + "end": 5716, "loc": { "start": { "line": 135, @@ -1718,8 +1718,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5697, - "end": 5706, + "start": 5705, + "end": 5714, "loc": { "start": { "line": 135, @@ -1732,8 +1732,8 @@ }, "object": { "type": "Identifier", - "start": 5697, - "end": 5701, + "start": 5705, + "end": 5709, "loc": { "start": { "line": 135, @@ -1749,8 +1749,8 @@ }, "property": { "type": "Identifier", - "start": 5702, - "end": 5706, + "start": 5710, + "end": 5714, "loc": { "start": { "line": 135, @@ -1772,8 +1772,8 @@ }, { "type": "ExpressionStatement", - "start": 5718, - "end": 5743, + "start": 5726, + "end": 5751, "loc": { "start": { "line": 136, @@ -1786,8 +1786,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5718, - "end": 5742, + "start": 5726, + "end": 5750, "loc": { "start": { "line": 136, @@ -1801,8 +1801,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5718, - "end": 5734, + "start": 5726, + "end": 5742, "loc": { "start": { "line": 136, @@ -1815,8 +1815,8 @@ }, "object": { "type": "ThisExpression", - "start": 5718, - "end": 5722, + "start": 5726, + "end": 5730, "loc": { "start": { "line": 136, @@ -1830,8 +1830,8 @@ }, "property": { "type": "Identifier", - "start": 5723, - "end": 5734, + "start": 5731, + "end": 5742, "loc": { "start": { "line": 136, @@ -1849,8 +1849,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 5737, - "end": 5742, + "start": 5745, + "end": 5750, "loc": { "start": { "line": 136, @@ -1867,8 +1867,8 @@ }, { "type": "ExpressionStatement", - "start": 5753, - "end": 5901, + "start": 5761, + "end": 5909, "loc": { "start": { "line": 138, @@ -1881,8 +1881,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5753, - "end": 5900, + "start": 5761, + "end": 5908, "loc": { "start": { "line": 138, @@ -1896,8 +1896,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5753, - "end": 5777, + "start": 5761, + "end": 5785, "loc": { "start": { "line": 138, @@ -1910,8 +1910,8 @@ }, "object": { "type": "ThisExpression", - "start": 5753, - "end": 5757, + "start": 5761, + "end": 5765, "loc": { "start": { "line": 138, @@ -1925,8 +1925,8 @@ }, "property": { "type": "Identifier", - "start": 5758, - "end": 5777, + "start": 5766, + "end": 5785, "loc": { "start": { "line": 138, @@ -1944,8 +1944,8 @@ }, "right": { "type": "CallExpression", - "start": 5780, - "end": 5900, + "start": 5788, + "end": 5908, "loc": { "start": { "line": 138, @@ -1958,8 +1958,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5780, - "end": 5800, + "start": 5788, + "end": 5808, "loc": { "start": { "line": 138, @@ -1972,8 +1972,8 @@ }, "object": { "type": "MemberExpression", - "start": 5780, - "end": 5797, + "start": 5788, + "end": 5805, "loc": { "start": { "line": 138, @@ -1986,8 +1986,8 @@ }, "object": { "type": "MemberExpression", - "start": 5780, - "end": 5790, + "start": 5788, + "end": 5798, "loc": { "start": { "line": 138, @@ -2000,8 +2000,8 @@ }, "object": { "type": "ThisExpression", - "start": 5780, - "end": 5784, + "start": 5788, + "end": 5792, "loc": { "start": { "line": 138, @@ -2015,8 +2015,8 @@ }, "property": { "type": "Identifier", - "start": 5785, - "end": 5790, + "start": 5793, + "end": 5798, "loc": { "start": { "line": 138, @@ -2034,8 +2034,8 @@ }, "property": { "type": "Identifier", - "start": 5791, - "end": 5797, + "start": 5799, + "end": 5805, "loc": { "start": { "line": 138, @@ -2053,8 +2053,8 @@ }, "property": { "type": "Identifier", - "start": 5798, - "end": 5800, + "start": 5806, + "end": 5808, "loc": { "start": { "line": 138, @@ -2073,8 +2073,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 5801, - "end": 5809, + "start": 5809, + "end": 5817, "loc": { "start": { "line": 138, @@ -2093,8 +2093,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 5811, - "end": 5899, + "start": 5819, + "end": 5907, "loc": { "start": { "line": 138, @@ -2112,8 +2112,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5817, - "end": 5899, + "start": 5825, + "end": 5907, "loc": { "start": { "line": 138, @@ -2127,8 +2127,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5831, - "end": 5857, + "start": 5839, + "end": 5865, "loc": { "start": { "line": 139, @@ -2141,8 +2141,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5831, - "end": 5856, + "start": 5839, + "end": 5864, "loc": { "start": { "line": 139, @@ -2156,8 +2156,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5831, - "end": 5849, + "start": 5839, + "end": 5857, "loc": { "start": { "line": 139, @@ -2170,8 +2170,8 @@ }, "object": { "type": "ThisExpression", - "start": 5831, - "end": 5835, + "start": 5839, + "end": 5843, "loc": { "start": { "line": 139, @@ -2185,8 +2185,8 @@ }, "property": { "type": "Identifier", - "start": 5836, - "end": 5849, + "start": 5844, + "end": 5857, "loc": { "start": { "line": 139, @@ -2204,8 +2204,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 5852, - "end": 5856, + "start": 5860, + "end": 5864, "loc": { "start": { "line": 139, @@ -2222,8 +2222,8 @@ }, { "type": "ExpressionStatement", - "start": 5870, - "end": 5889, + "start": 5878, + "end": 5897, "loc": { "start": { "line": 140, @@ -2236,8 +2236,8 @@ }, "expression": { "type": "CallExpression", - "start": 5870, - "end": 5888, + "start": 5878, + "end": 5896, "loc": { "start": { "line": 140, @@ -2250,8 +2250,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5870, - "end": 5886, + "start": 5878, + "end": 5894, "loc": { "start": { "line": 140, @@ -2264,8 +2264,8 @@ }, "object": { "type": "ThisExpression", - "start": 5870, - "end": 5874, + "start": 5878, + "end": 5882, "loc": { "start": { "line": 140, @@ -2279,8 +2279,8 @@ }, "property": { "type": "Identifier", - "start": 5875, - "end": 5886, + "start": 5883, + "end": 5894, "loc": { "start": { "line": 140, @@ -2309,8 +2309,8 @@ }, { "type": "ExpressionStatement", - "start": 5911, - "end": 6065, + "start": 5919, + "end": 6073, "loc": { "start": { "line": 143, @@ -2323,8 +2323,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5911, - "end": 6064, + "start": 5919, + "end": 6072, "loc": { "start": { "line": 143, @@ -2338,8 +2338,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5911, - "end": 5935, + "start": 5919, + "end": 5943, "loc": { "start": { "line": 143, @@ -2352,8 +2352,8 @@ }, "object": { "type": "ThisExpression", - "start": 5911, - "end": 5915, + "start": 5919, + "end": 5923, "loc": { "start": { "line": 143, @@ -2367,8 +2367,8 @@ }, "property": { "type": "Identifier", - "start": 5916, - "end": 5935, + "start": 5924, + "end": 5943, "loc": { "start": { "line": 143, @@ -2386,8 +2386,8 @@ }, "right": { "type": "CallExpression", - "start": 5938, - "end": 6064, + "start": 5946, + "end": 6072, "loc": { "start": { "line": 143, @@ -2400,8 +2400,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5938, - "end": 5958, + "start": 5946, + "end": 5966, "loc": { "start": { "line": 143, @@ -2414,8 +2414,8 @@ }, "object": { "type": "MemberExpression", - "start": 5938, - "end": 5955, + "start": 5946, + "end": 5963, "loc": { "start": { "line": 143, @@ -2428,8 +2428,8 @@ }, "object": { "type": "MemberExpression", - "start": 5938, - "end": 5948, + "start": 5946, + "end": 5956, "loc": { "start": { "line": 143, @@ -2442,8 +2442,8 @@ }, "object": { "type": "ThisExpression", - "start": 5938, - "end": 5942, + "start": 5946, + "end": 5950, "loc": { "start": { "line": 143, @@ -2457,8 +2457,8 @@ }, "property": { "type": "Identifier", - "start": 5943, - "end": 5948, + "start": 5951, + "end": 5956, "loc": { "start": { "line": 143, @@ -2476,8 +2476,8 @@ }, "property": { "type": "Identifier", - "start": 5949, - "end": 5955, + "start": 5957, + "end": 5963, "loc": { "start": { "line": 143, @@ -2495,8 +2495,8 @@ }, "property": { "type": "Identifier", - "start": 5956, - "end": 5958, + "start": 5964, + "end": 5966, "loc": { "start": { "line": 143, @@ -2515,8 +2515,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 5959, - "end": 5971, + "start": 5967, + "end": 5979, "loc": { "start": { "line": 143, @@ -2535,8 +2535,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 5973, - "end": 6063, + "start": 5981, + "end": 6071, "loc": { "start": { "line": 143, @@ -2554,8 +2554,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5979, - "end": 6063, + "start": 5987, + "end": 6071, "loc": { "start": { "line": 143, @@ -2569,8 +2569,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5993, - "end": 6021, + "start": 6001, + "end": 6029, "loc": { "start": { "line": 144, @@ -2583,8 +2583,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5993, - "end": 6020, + "start": 6001, + "end": 6028, "loc": { "start": { "line": 144, @@ -2598,8 +2598,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5993, - "end": 6013, + "start": 6001, + "end": 6021, "loc": { "start": { "line": 144, @@ -2612,8 +2612,8 @@ }, "object": { "type": "ThisExpression", - "start": 5993, - "end": 5997, + "start": 6001, + "end": 6005, "loc": { "start": { "line": 144, @@ -2627,8 +2627,8 @@ }, "property": { "type": "Identifier", - "start": 5998, - "end": 6013, + "start": 6006, + "end": 6021, "loc": { "start": { "line": 144, @@ -2646,8 +2646,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6016, - "end": 6020, + "start": 6024, + "end": 6028, "loc": { "start": { "line": 144, @@ -2664,8 +2664,8 @@ }, { "type": "ExpressionStatement", - "start": 6034, - "end": 6053, + "start": 6042, + "end": 6061, "loc": { "start": { "line": 145, @@ -2678,8 +2678,8 @@ }, "expression": { "type": "CallExpression", - "start": 6034, - "end": 6052, + "start": 6042, + "end": 6060, "loc": { "start": { "line": 145, @@ -2692,8 +2692,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6034, - "end": 6050, + "start": 6042, + "end": 6058, "loc": { "start": { "line": 145, @@ -2706,8 +2706,8 @@ }, "object": { "type": "ThisExpression", - "start": 6034, - "end": 6038, + "start": 6042, + "end": 6046, "loc": { "start": { "line": 145, @@ -2721,8 +2721,8 @@ }, "property": { "type": "Identifier", - "start": 6039, - "end": 6050, + "start": 6047, + "end": 6058, "loc": { "start": { "line": 145, @@ -2751,8 +2751,8 @@ }, { "type": "ExpressionStatement", - "start": 6075, - "end": 6106, + "start": 6083, + "end": 6114, "loc": { "start": { "line": 148, @@ -2765,8 +2765,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6075, - "end": 6105, + "start": 6083, + "end": 6113, "loc": { "start": { "line": 148, @@ -2780,8 +2780,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6075, - "end": 6098, + "start": 6083, + "end": 6106, "loc": { "start": { "line": 148, @@ -2794,8 +2794,8 @@ }, "object": { "type": "ThisExpression", - "start": 6075, - "end": 6079, + "start": 6083, + "end": 6087, "loc": { "start": { "line": 148, @@ -2809,8 +2809,8 @@ }, "property": { "type": "Identifier", - "start": 6080, - "end": 6098, + "start": 6088, + "end": 6106, "loc": { "start": { "line": 148, @@ -2828,8 +2828,8 @@ }, "right": { "type": "NullLiteral", - "start": 6101, - "end": 6105, + "start": 6109, + "end": 6113, "loc": { "start": { "line": 148, @@ -2845,8 +2845,8 @@ }, { "type": "ExpressionStatement", - "start": 6115, - "end": 6151, + "start": 6123, + "end": 6159, "loc": { "start": { "line": 149, @@ -2859,8 +2859,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6115, - "end": 6150, + "start": 6123, + "end": 6158, "loc": { "start": { "line": 149, @@ -2874,8 +2874,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6115, - "end": 6143, + "start": 6123, + "end": 6151, "loc": { "start": { "line": 149, @@ -2888,8 +2888,8 @@ }, "object": { "type": "ThisExpression", - "start": 6115, - "end": 6119, + "start": 6123, + "end": 6127, "loc": { "start": { "line": 149, @@ -2903,8 +2903,8 @@ }, "property": { "type": "Identifier", - "start": 6120, - "end": 6143, + "start": 6128, + "end": 6151, "loc": { "start": { "line": 149, @@ -2922,8 +2922,8 @@ }, "right": { "type": "NullLiteral", - "start": 6146, - "end": 6150, + "start": 6154, + "end": 6158, "loc": { "start": { "line": 149, @@ -2939,8 +2939,8 @@ }, { "type": "ExpressionStatement", - "start": 6161, - "end": 6192, + "start": 6169, + "end": 6200, "loc": { "start": { "line": 151, @@ -2953,8 +2953,8 @@ }, "expression": { "type": "CallExpression", - "start": 6161, - "end": 6191, + "start": 6169, + "end": 6199, "loc": { "start": { "line": 151, @@ -2967,8 +2967,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6161, - "end": 6185, + "start": 6169, + "end": 6193, "loc": { "start": { "line": 151, @@ -2981,8 +2981,8 @@ }, "object": { "type": "MemberExpression", - "start": 6161, - "end": 6175, + "start": 6169, + "end": 6183, "loc": { "start": { "line": 151, @@ -2995,8 +2995,8 @@ }, "object": { "type": "ThisExpression", - "start": 6161, - "end": 6165, + "start": 6169, + "end": 6173, "loc": { "start": { "line": 151, @@ -3010,8 +3010,8 @@ }, "property": { "type": "Identifier", - "start": 6166, - "end": 6175, + "start": 6174, + "end": 6183, "loc": { "start": { "line": 151, @@ -3029,8 +3029,8 @@ }, "property": { "type": "Identifier", - "start": 6176, - "end": 6185, + "start": 6184, + "end": 6193, "loc": { "start": { "line": 151, @@ -3049,8 +3049,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 6186, - "end": 6190, + "start": 6194, + "end": 6198, "loc": { "start": { "line": 151, @@ -3067,8 +3067,8 @@ }, { "type": "ExpressionStatement", - "start": 6202, - "end": 6227, + "start": 6210, + "end": 6235, "loc": { "start": { "line": 153, @@ -3081,8 +3081,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6202, - "end": 6226, + "start": 6210, + "end": 6234, "loc": { "start": { "line": 153, @@ -3096,8 +3096,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6202, - "end": 6213, + "start": 6210, + "end": 6221, "loc": { "start": { "line": 153, @@ -3110,8 +3110,8 @@ }, "object": { "type": "ThisExpression", - "start": 6202, - "end": 6206, + "start": 6210, + "end": 6214, "loc": { "start": { "line": 153, @@ -3125,8 +3125,8 @@ }, "property": { "type": "Identifier", - "start": 6207, - "end": 6213, + "start": 6215, + "end": 6221, "loc": { "start": { "line": 153, @@ -3144,8 +3144,8 @@ }, "right": { "type": "MemberExpression", - "start": 6216, - "end": 6226, + "start": 6224, + "end": 6234, "loc": { "start": { "line": 153, @@ -3158,8 +3158,8 @@ }, "object": { "type": "Identifier", - "start": 6216, - "end": 6219, + "start": 6224, + "end": 6227, "loc": { "start": { "line": 153, @@ -3175,8 +3175,8 @@ }, "property": { "type": "Identifier", - "start": 6220, - "end": 6226, + "start": 6228, + "end": 6234, "loc": { "start": { "line": 153, @@ -3196,8 +3196,8 @@ }, { "type": "ExpressionStatement", - "start": 6236, - "end": 6265, + "start": 6244, + "end": 6273, "loc": { "start": { "line": 154, @@ -3210,8 +3210,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6236, - "end": 6264, + "start": 6244, + "end": 6272, "loc": { "start": { "line": 154, @@ -3225,8 +3225,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6236, - "end": 6249, + "start": 6244, + "end": 6257, "loc": { "start": { "line": 154, @@ -3239,8 +3239,8 @@ }, "object": { "type": "ThisExpression", - "start": 6236, - "end": 6240, + "start": 6244, + "end": 6248, "loc": { "start": { "line": 154, @@ -3254,8 +3254,8 @@ }, "property": { "type": "Identifier", - "start": 6241, - "end": 6249, + "start": 6249, + "end": 6257, "loc": { "start": { "line": 154, @@ -3273,8 +3273,8 @@ }, "right": { "type": "MemberExpression", - "start": 6252, - "end": 6264, + "start": 6260, + "end": 6272, "loc": { "start": { "line": 154, @@ -3287,8 +3287,8 @@ }, "object": { "type": "Identifier", - "start": 6252, - "end": 6255, + "start": 6260, + "end": 6263, "loc": { "start": { "line": 154, @@ -3304,8 +3304,8 @@ }, "property": { "type": "Identifier", - "start": 6256, - "end": 6264, + "start": 6264, + "end": 6272, "loc": { "start": { "line": 154, @@ -3325,8 +3325,8 @@ }, { "type": "ExpressionStatement", - "start": 6274, - "end": 6307, + "start": 6282, + "end": 6315, "loc": { "start": { "line": 155, @@ -3339,8 +3339,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6274, - "end": 6306, + "start": 6282, + "end": 6314, "loc": { "start": { "line": 155, @@ -3354,8 +3354,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6274, - "end": 6289, + "start": 6282, + "end": 6297, "loc": { "start": { "line": 155, @@ -3368,8 +3368,8 @@ }, "object": { "type": "ThisExpression", - "start": 6274, - "end": 6278, + "start": 6282, + "end": 6286, "loc": { "start": { "line": 155, @@ -3383,8 +3383,8 @@ }, "property": { "type": "Identifier", - "start": 6279, - "end": 6289, + "start": 6287, + "end": 6297, "loc": { "start": { "line": 155, @@ -3402,8 +3402,8 @@ }, "right": { "type": "MemberExpression", - "start": 6292, - "end": 6306, + "start": 6300, + "end": 6314, "loc": { "start": { "line": 155, @@ -3416,8 +3416,8 @@ }, "object": { "type": "Identifier", - "start": 6292, - "end": 6295, + "start": 6300, + "end": 6303, "loc": { "start": { "line": 155, @@ -3433,8 +3433,8 @@ }, "property": { "type": "Identifier", - "start": 6296, - "end": 6306, + "start": 6304, + "end": 6314, "loc": { "start": { "line": 155, @@ -3459,8 +3459,8 @@ { "type": "CommentBlock", "value": "*\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n ", - "start": 4600, - "end": 5405, + "start": 4608, + "end": 5413, "loc": { "start": { "line": 116, @@ -3476,8 +3476,8 @@ }, { "type": "ClassMethod", - "start": 6319, - "end": 7198, + "start": 6327, + "end": 7206, "loc": { "start": { "line": 158, @@ -3492,8 +3492,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 6319, - "end": 6326, + "start": 6327, + "end": 6334, "loc": { "start": { "line": 158, @@ -3515,8 +3515,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6329, - "end": 7198, + "start": 6337, + "end": 7206, "loc": { "start": { "line": 158, @@ -3530,8 +3530,8 @@ "body": [ { "type": "IfStatement", - "start": 6390, - "end": 6650, + "start": 6398, + "end": 6658, "loc": { "start": { "line": 159, @@ -3544,8 +3544,8 @@ }, "test": { "type": "MemberExpression", - "start": 6394, - "end": 6412, + "start": 6402, + "end": 6420, "loc": { "start": { "line": 159, @@ -3558,8 +3558,8 @@ }, "object": { "type": "ThisExpression", - "start": 6394, - "end": 6398, + "start": 6402, + "end": 6406, "loc": { "start": { "line": 159, @@ -3574,8 +3574,8 @@ }, "property": { "type": "Identifier", - "start": 6399, - "end": 6412, + "start": 6407, + "end": 6420, "loc": { "start": { "line": 159, @@ -3594,8 +3594,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 6414, - "end": 6650, + "start": 6422, + "end": 6658, "loc": { "start": { "line": 159, @@ -3609,8 +3609,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6428, - "end": 6510, + "start": 6436, + "end": 6518, "loc": { "start": { "line": 160, @@ -3623,8 +3623,8 @@ }, "expression": { "type": "CallExpression", - "start": 6428, - "end": 6509, + "start": 6436, + "end": 6517, "loc": { "start": { "line": 160, @@ -3637,8 +3637,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6428, - "end": 6448, + "start": 6436, + "end": 6456, "loc": { "start": { "line": 160, @@ -3651,8 +3651,8 @@ }, "object": { "type": "Identifier", - "start": 6428, - "end": 6432, + "start": 6436, + "end": 6440, "loc": { "start": { "line": 160, @@ -3668,8 +3668,8 @@ }, "property": { "type": "Identifier", - "start": 6433, - "end": 6448, + "start": 6441, + "end": 6456, "loc": { "start": { "line": 160, @@ -3688,8 +3688,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6449, - "end": 6477, + "start": 6457, + "end": 6485, "loc": { "start": { "line": 160, @@ -3702,8 +3702,8 @@ }, "object": { "type": "MemberExpression", - "start": 6449, - "end": 6466, + "start": 6457, + "end": 6474, "loc": { "start": { "line": 160, @@ -3716,8 +3716,8 @@ }, "object": { "type": "MemberExpression", - "start": 6449, - "end": 6459, + "start": 6457, + "end": 6467, "loc": { "start": { "line": 160, @@ -3730,8 +3730,8 @@ }, "object": { "type": "ThisExpression", - "start": 6449, - "end": 6453, + "start": 6457, + "end": 6461, "loc": { "start": { "line": 160, @@ -3745,8 +3745,8 @@ }, "property": { "type": "Identifier", - "start": 6454, - "end": 6459, + "start": 6462, + "end": 6467, "loc": { "start": { "line": 160, @@ -3764,8 +3764,8 @@ }, "property": { "type": "Identifier", - "start": 6460, - "end": 6466, + "start": 6468, + "end": 6474, "loc": { "start": { "line": 160, @@ -3783,8 +3783,8 @@ }, "property": { "type": "Identifier", - "start": 6467, - "end": 6477, + "start": 6475, + "end": 6485, "loc": { "start": { "line": 160, @@ -3802,8 +3802,8 @@ }, { "type": "MemberExpression", - "start": 6479, - "end": 6493, + "start": 6487, + "end": 6501, "loc": { "start": { "line": 160, @@ -3816,8 +3816,8 @@ }, "object": { "type": "ThisExpression", - "start": 6479, - "end": 6483, + "start": 6487, + "end": 6491, "loc": { "start": { "line": 160, @@ -3831,8 +3831,8 @@ }, "property": { "type": "Identifier", - "start": 6484, - "end": 6493, + "start": 6492, + "end": 6501, "loc": { "start": { "line": 160, @@ -3850,8 +3850,8 @@ }, { "type": "MemberExpression", - "start": 6495, - "end": 6508, + "start": 6503, + "end": 6516, "loc": { "start": { "line": 160, @@ -3864,8 +3864,8 @@ }, "object": { "type": "ThisExpression", - "start": 6495, - "end": 6499, + "start": 6503, + "end": 6507, "loc": { "start": { "line": 160, @@ -3879,8 +3879,8 @@ }, "property": { "type": "Identifier", - "start": 6500, - "end": 6508, + "start": 6508, + "end": 6516, "loc": { "start": { "line": 160, @@ -3901,8 +3901,8 @@ }, { "type": "ExpressionStatement", - "start": 6523, - "end": 6550, + "start": 6531, + "end": 6558, "loc": { "start": { "line": 161, @@ -3915,8 +3915,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6523, - "end": 6549, + "start": 6531, + "end": 6557, "loc": { "start": { "line": 161, @@ -3930,8 +3930,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6523, - "end": 6541, + "start": 6531, + "end": 6549, "loc": { "start": { "line": 161, @@ -3944,8 +3944,8 @@ }, "object": { "type": "ThisExpression", - "start": 6523, - "end": 6527, + "start": 6531, + "end": 6535, "loc": { "start": { "line": 161, @@ -3959,8 +3959,8 @@ }, "property": { "type": "Identifier", - "start": 6528, - "end": 6541, + "start": 6536, + "end": 6549, "loc": { "start": { "line": 161, @@ -3978,8 +3978,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6544, - "end": 6549, + "start": 6552, + "end": 6557, "loc": { "start": { "line": 161, @@ -3996,8 +3996,8 @@ }, { "type": "ExpressionStatement", - "start": 6563, - "end": 6591, + "start": 6571, + "end": 6599, "loc": { "start": { "line": 162, @@ -4010,8 +4010,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6563, - "end": 6590, + "start": 6571, + "end": 6598, "loc": { "start": { "line": 162, @@ -4025,8 +4025,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6563, - "end": 6583, + "start": 6571, + "end": 6591, "loc": { "start": { "line": 162, @@ -4039,8 +4039,8 @@ }, "object": { "type": "ThisExpression", - "start": 6563, - "end": 6567, + "start": 6571, + "end": 6575, "loc": { "start": { "line": 162, @@ -4054,8 +4054,8 @@ }, "property": { "type": "Identifier", - "start": 6568, - "end": 6583, + "start": 6576, + "end": 6591, "loc": { "start": { "line": 162, @@ -4073,8 +4073,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6586, - "end": 6590, + "start": 6594, + "end": 6598, "loc": { "start": { "line": 162, @@ -4091,8 +4091,8 @@ }, { "type": "ExpressionStatement", - "start": 6604, - "end": 6640, + "start": 6612, + "end": 6648, "loc": { "start": { "line": 163, @@ -4105,8 +4105,8 @@ }, "expression": { "type": "CallExpression", - "start": 6604, - "end": 6639, + "start": 6612, + "end": 6647, "loc": { "start": { "line": 163, @@ -4119,8 +4119,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6604, - "end": 6613, + "start": 6612, + "end": 6621, "loc": { "start": { "line": 163, @@ -4133,8 +4133,8 @@ }, "object": { "type": "ThisExpression", - "start": 6604, - "end": 6608, + "start": 6612, + "end": 6616, "loc": { "start": { "line": 163, @@ -4148,8 +4148,8 @@ }, "property": { "type": "Identifier", - "start": 6609, - "end": 6613, + "start": 6617, + "end": 6621, "loc": { "start": { "line": 163, @@ -4168,8 +4168,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 6614, - "end": 6623, + "start": 6622, + "end": 6631, "loc": { "start": { "line": 163, @@ -4188,8 +4188,8 @@ }, { "type": "MemberExpression", - "start": 6625, - "end": 6638, + "start": 6633, + "end": 6646, "loc": { "start": { "line": 163, @@ -4202,8 +4202,8 @@ }, "object": { "type": "ThisExpression", - "start": 6625, - "end": 6629, + "start": 6633, + "end": 6637, "loc": { "start": { "line": 163, @@ -4217,8 +4217,8 @@ }, "property": { "type": "Identifier", - "start": 6630, - "end": 6638, + "start": 6638, + "end": 6646, "loc": { "start": { "line": 163, @@ -4245,8 +4245,8 @@ { "type": "CommentLine", "value": " this._needUpdate() schedules this for next tick", - "start": 6331, - "end": 6381, + "start": 6339, + "end": 6389, "loc": { "start": { "line": 158, @@ -4262,8 +4262,8 @@ }, { "type": "IfStatement", - "start": 6659, - "end": 7192, + "start": 6667, + "end": 7200, "loc": { "start": { "line": 165, @@ -4276,8 +4276,8 @@ }, "test": { "type": "MemberExpression", - "start": 6663, - "end": 6683, + "start": 6671, + "end": 6691, "loc": { "start": { "line": 165, @@ -4290,8 +4290,8 @@ }, "object": { "type": "ThisExpression", - "start": 6663, - "end": 6667, + "start": 6671, + "end": 6675, "loc": { "start": { "line": 165, @@ -4305,8 +4305,8 @@ }, "property": { "type": "Identifier", - "start": 6668, - "end": 6683, + "start": 6676, + "end": 6691, "loc": { "start": { "line": 165, @@ -4324,8 +4324,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 6685, - "end": 7192, + "start": 6693, + "end": 7200, "loc": { "start": { "line": 165, @@ -4339,8 +4339,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6699, - "end": 6728, + "start": 6707, + "end": 6736, "loc": { "start": { "line": 166, @@ -4353,8 +4353,8 @@ }, "expression": { "type": "CallExpression", - "start": 6699, - "end": 6727, + "start": 6707, + "end": 6735, "loc": { "start": { "line": 166, @@ -4367,8 +4367,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6699, - "end": 6712, + "start": 6707, + "end": 6720, "loc": { "start": { "line": 166, @@ -4381,8 +4381,8 @@ }, "object": { "type": "Identifier", - "start": 6699, - "end": 6708, + "start": 6707, + "end": 6716, "loc": { "start": { "line": 166, @@ -4398,8 +4398,8 @@ }, "property": { "type": "Identifier", - "start": 6709, - "end": 6712, + "start": 6717, + "end": 6720, "loc": { "start": { "line": 166, @@ -4418,8 +4418,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6713, - "end": 6726, + "start": 6721, + "end": 6734, "loc": { "start": { "line": 166, @@ -4432,8 +4432,8 @@ }, "object": { "type": "ThisExpression", - "start": 6713, - "end": 6717, + "start": 6721, + "end": 6725, "loc": { "start": { "line": 166, @@ -4447,8 +4447,8 @@ }, "property": { "type": "Identifier", - "start": 6718, - "end": 6726, + "start": 6726, + "end": 6734, "loc": { "start": { "line": 166, @@ -4469,8 +4469,8 @@ }, { "type": "ExpressionStatement", - "start": 6741, - "end": 6760, + "start": 6749, + "end": 6768, "loc": { "start": { "line": 167, @@ -4483,8 +4483,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6741, - "end": 6759, + "start": 6749, + "end": 6767, "loc": { "start": { "line": 167, @@ -4498,8 +4498,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6741, - "end": 6753, + "start": 6749, + "end": 6761, "loc": { "start": { "line": 167, @@ -4512,8 +4512,8 @@ }, "object": { "type": "Identifier", - "start": 6741, - "end": 6750, + "start": 6749, + "end": 6758, "loc": { "start": { "line": 167, @@ -4529,8 +4529,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6751, - "end": 6752, + "start": 6759, + "end": 6760, "loc": { "start": { "line": 167, @@ -4551,8 +4551,8 @@ }, "right": { "type": "NumericLiteral", - "start": 6756, - "end": 6759, + "start": 6764, + "end": 6767, "loc": { "start": { "line": 167, @@ -4573,8 +4573,8 @@ }, { "type": "ExpressionStatement", - "start": 6773, - "end": 6846, + "start": 6781, + "end": 6854, "loc": { "start": { "line": 168, @@ -4587,8 +4587,8 @@ }, "expression": { "type": "CallExpression", - "start": 6773, - "end": 6845, + "start": 6781, + "end": 6853, "loc": { "start": { "line": 168, @@ -4601,8 +4601,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6773, - "end": 6793, + "start": 6781, + "end": 6801, "loc": { "start": { "line": 168, @@ -4615,8 +4615,8 @@ }, "object": { "type": "Identifier", - "start": 6773, - "end": 6777, + "start": 6781, + "end": 6785, "loc": { "start": { "line": 168, @@ -4632,8 +4632,8 @@ }, "property": { "type": "Identifier", - "start": 6778, - "end": 6793, + "start": 6786, + "end": 6801, "loc": { "start": { "line": 168, @@ -4652,8 +4652,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6794, - "end": 6822, + "start": 6802, + "end": 6830, "loc": { "start": { "line": 168, @@ -4666,8 +4666,8 @@ }, "object": { "type": "MemberExpression", - "start": 6794, - "end": 6811, + "start": 6802, + "end": 6819, "loc": { "start": { "line": 168, @@ -4680,8 +4680,8 @@ }, "object": { "type": "MemberExpression", - "start": 6794, - "end": 6804, + "start": 6802, + "end": 6812, "loc": { "start": { "line": 168, @@ -4694,8 +4694,8 @@ }, "object": { "type": "ThisExpression", - "start": 6794, - "end": 6798, + "start": 6802, + "end": 6806, "loc": { "start": { "line": 168, @@ -4709,8 +4709,8 @@ }, "property": { "type": "Identifier", - "start": 6799, - "end": 6804, + "start": 6807, + "end": 6812, "loc": { "start": { "line": 168, @@ -4728,8 +4728,8 @@ }, "property": { "type": "Identifier", - "start": 6805, - "end": 6811, + "start": 6813, + "end": 6819, "loc": { "start": { "line": 168, @@ -4747,8 +4747,8 @@ }, "property": { "type": "Identifier", - "start": 6812, - "end": 6822, + "start": 6820, + "end": 6830, "loc": { "start": { "line": 168, @@ -4766,8 +4766,8 @@ }, { "type": "Identifier", - "start": 6824, - "end": 6833, + "start": 6832, + "end": 6841, "loc": { "start": { "line": 168, @@ -4783,8 +4783,8 @@ }, { "type": "Identifier", - "start": 6835, - "end": 6844, + "start": 6843, + "end": 6852, "loc": { "start": { "line": 168, @@ -4803,8 +4803,8 @@ }, { "type": "VariableDeclaration", - "start": 6859, - "end": 6899, + "start": 6867, + "end": 6907, "loc": { "start": { "line": 169, @@ -4818,8 +4818,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 6865, - "end": 6898, + "start": 6873, + "end": 6906, "loc": { "start": { "line": 169, @@ -4832,8 +4832,8 @@ }, "id": { "type": "Identifier", - "start": 6865, - "end": 6869, + "start": 6873, + "end": 6877, "loc": { "start": { "line": 169, @@ -4849,8 +4849,8 @@ }, "init": { "type": "MemberExpression", - "start": 6872, - "end": 6898, + "start": 6880, + "end": 6906, "loc": { "start": { "line": 169, @@ -4863,8 +4863,8 @@ }, "object": { "type": "MemberExpression", - "start": 6872, - "end": 6889, + "start": 6880, + "end": 6897, "loc": { "start": { "line": 169, @@ -4877,8 +4877,8 @@ }, "object": { "type": "MemberExpression", - "start": 6872, - "end": 6882, + "start": 6880, + "end": 6890, "loc": { "start": { "line": 169, @@ -4891,8 +4891,8 @@ }, "object": { "type": "ThisExpression", - "start": 6872, - "end": 6876, + "start": 6880, + "end": 6884, "loc": { "start": { "line": 169, @@ -4906,8 +4906,8 @@ }, "property": { "type": "Identifier", - "start": 6877, - "end": 6882, + "start": 6885, + "end": 6890, "loc": { "start": { "line": 169, @@ -4925,8 +4925,8 @@ }, "property": { "type": "Identifier", - "start": 6883, - "end": 6889, + "start": 6891, + "end": 6897, "loc": { "start": { "line": 169, @@ -4944,8 +4944,8 @@ }, "property": { "type": "Identifier", - "start": 6890, - "end": 6898, + "start": 6898, + "end": 6906, "loc": { "start": { "line": 169, @@ -4967,8 +4967,8 @@ }, { "type": "ExpressionStatement", - "start": 6912, - "end": 6993, + "start": 6920, + "end": 7001, "loc": { "start": { "line": 170, @@ -4981,8 +4981,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6912, - "end": 6992, + "start": 6920, + "end": 7000, "loc": { "start": { "line": 170, @@ -4996,8 +4996,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6912, - "end": 6930, + "start": 6920, + "end": 6938, "loc": { "start": { "line": 170, @@ -5010,8 +5010,8 @@ }, "object": { "type": "MemberExpression", - "start": 6912, - "end": 6927, + "start": 6920, + "end": 6935, "loc": { "start": { "line": 170, @@ -5024,8 +5024,8 @@ }, "object": { "type": "ThisExpression", - "start": 6912, - "end": 6916, + "start": 6920, + "end": 6924, "loc": { "start": { "line": 170, @@ -5039,8 +5039,8 @@ }, "property": { "type": "Identifier", - "start": 6917, - "end": 6927, + "start": 6925, + "end": 6935, "loc": { "start": { "line": 170, @@ -5058,8 +5058,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6928, - "end": 6929, + "start": 6936, + "end": 6937, "loc": { "start": { "line": 170, @@ -5080,8 +5080,8 @@ }, "right": { "type": "CallExpression", - "start": 6933, - "end": 6992, + "start": 6941, + "end": 7000, "loc": { "start": { "line": 170, @@ -5094,8 +5094,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6933, - "end": 6943, + "start": 6941, + "end": 6951, "loc": { "start": { "line": 170, @@ -5108,8 +5108,8 @@ }, "object": { "type": "Identifier", - "start": 6933, - "end": 6937, + "start": 6941, + "end": 6945, "loc": { "start": { "line": 170, @@ -5125,8 +5125,8 @@ }, "property": { "type": "Identifier", - "start": 6938, - "end": 6943, + "start": 6946, + "end": 6951, "loc": { "start": { "line": 170, @@ -5145,8 +5145,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 6944, - "end": 6991, + "start": 6952, + "end": 6999, "loc": { "start": { "line": 170, @@ -5159,8 +5159,8 @@ }, "left": { "type": "BinaryExpression", - "start": 6944, - "end": 6987, + "start": 6952, + "end": 6995, "loc": { "start": { "line": 170, @@ -5173,8 +5173,8 @@ }, "left": { "type": "BinaryExpression", - "start": 6945, - "end": 6976, + "start": 6953, + "end": 6984, "loc": { "start": { "line": 170, @@ -5187,8 +5187,8 @@ }, "left": { "type": "NumericLiteral", - "start": 6945, - "end": 6946, + "start": 6953, + "end": 6954, "loc": { "start": { "line": 170, @@ -5208,8 +5208,8 @@ "operator": "+", "right": { "type": "BinaryExpression", - "start": 6949, - "end": 6976, + "start": 6957, + "end": 6984, "loc": { "start": { "line": 170, @@ -5222,8 +5222,8 @@ }, "left": { "type": "MemberExpression", - "start": 6949, - "end": 6961, + "start": 6957, + "end": 6969, "loc": { "start": { "line": 170, @@ -5236,8 +5236,8 @@ }, "object": { "type": "Identifier", - "start": 6949, - "end": 6958, + "start": 6957, + "end": 6966, "loc": { "start": { "line": 170, @@ -5253,8 +5253,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6959, - "end": 6960, + "start": 6967, + "end": 6968, "loc": { "start": { "line": 170, @@ -5276,8 +5276,8 @@ "operator": "/", "right": { "type": "MemberExpression", - "start": 6964, - "end": 6976, + "start": 6972, + "end": 6984, "loc": { "start": { "line": 170, @@ -5290,8 +5290,8 @@ }, "object": { "type": "Identifier", - "start": 6964, - "end": 6973, + "start": 6972, + "end": 6981, "loc": { "start": { "line": 170, @@ -5307,8 +5307,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6974, - "end": 6975, + "start": 6982, + "end": 6983, "loc": { "start": { "line": 170, @@ -5330,14 +5330,14 @@ }, "extra": { "parenthesized": true, - "parenStart": 6944 + "parenStart": 6952 } }, "operator": "*", "right": { "type": "MemberExpression", - "start": 6980, - "end": 6987, + "start": 6988, + "end": 6995, "loc": { "start": { "line": 170, @@ -5350,8 +5350,8 @@ }, "object": { "type": "Identifier", - "start": 6980, - "end": 6984, + "start": 6988, + "end": 6992, "loc": { "start": { "line": 170, @@ -5367,8 +5367,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6985, - "end": 6986, + "start": 6993, + "end": 6994, "loc": { "start": { "line": 170, @@ -5391,8 +5391,8 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 6990, - "end": 6991, + "start": 6998, + "end": 6999, "loc": { "start": { "line": 170, @@ -5416,8 +5416,8 @@ }, { "type": "ExpressionStatement", - "start": 7006, - "end": 7087, + "start": 7014, + "end": 7095, "loc": { "start": { "line": 171, @@ -5430,8 +5430,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7006, - "end": 7086, + "start": 7014, + "end": 7094, "loc": { "start": { "line": 171, @@ -5445,8 +5445,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7006, - "end": 7024, + "start": 7014, + "end": 7032, "loc": { "start": { "line": 171, @@ -5459,8 +5459,8 @@ }, "object": { "type": "MemberExpression", - "start": 7006, - "end": 7021, + "start": 7014, + "end": 7029, "loc": { "start": { "line": 171, @@ -5473,8 +5473,8 @@ }, "object": { "type": "ThisExpression", - "start": 7006, - "end": 7010, + "start": 7014, + "end": 7018, "loc": { "start": { "line": 171, @@ -5488,8 +5488,8 @@ }, "property": { "type": "Identifier", - "start": 7011, - "end": 7021, + "start": 7019, + "end": 7029, "loc": { "start": { "line": 171, @@ -5507,8 +5507,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7022, - "end": 7023, + "start": 7030, + "end": 7031, "loc": { "start": { "line": 171, @@ -5529,8 +5529,8 @@ }, "right": { "type": "CallExpression", - "start": 7027, - "end": 7086, + "start": 7035, + "end": 7094, "loc": { "start": { "line": 171, @@ -5543,8 +5543,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7027, - "end": 7037, + "start": 7035, + "end": 7045, "loc": { "start": { "line": 171, @@ -5557,8 +5557,8 @@ }, "object": { "type": "Identifier", - "start": 7027, - "end": 7031, + "start": 7035, + "end": 7039, "loc": { "start": { "line": 171, @@ -5574,8 +5574,8 @@ }, "property": { "type": "Identifier", - "start": 7032, - "end": 7037, + "start": 7040, + "end": 7045, "loc": { "start": { "line": 171, @@ -5594,8 +5594,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 7038, - "end": 7085, + "start": 7046, + "end": 7093, "loc": { "start": { "line": 171, @@ -5608,8 +5608,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7038, - "end": 7081, + "start": 7046, + "end": 7089, "loc": { "start": { "line": 171, @@ -5622,8 +5622,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7039, - "end": 7070, + "start": 7047, + "end": 7078, "loc": { "start": { "line": 171, @@ -5636,8 +5636,8 @@ }, "left": { "type": "NumericLiteral", - "start": 7039, - "end": 7040, + "start": 7047, + "end": 7048, "loc": { "start": { "line": 171, @@ -5657,8 +5657,8 @@ "operator": "-", "right": { "type": "BinaryExpression", - "start": 7043, - "end": 7070, + "start": 7051, + "end": 7078, "loc": { "start": { "line": 171, @@ -5671,8 +5671,8 @@ }, "left": { "type": "MemberExpression", - "start": 7043, - "end": 7055, + "start": 7051, + "end": 7063, "loc": { "start": { "line": 171, @@ -5685,8 +5685,8 @@ }, "object": { "type": "Identifier", - "start": 7043, - "end": 7052, + "start": 7051, + "end": 7060, "loc": { "start": { "line": 171, @@ -5702,8 +5702,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7053, - "end": 7054, + "start": 7061, + "end": 7062, "loc": { "start": { "line": 171, @@ -5725,8 +5725,8 @@ "operator": "/", "right": { "type": "MemberExpression", - "start": 7058, - "end": 7070, + "start": 7066, + "end": 7078, "loc": { "start": { "line": 171, @@ -5739,8 +5739,8 @@ }, "object": { "type": "Identifier", - "start": 7058, - "end": 7067, + "start": 7066, + "end": 7075, "loc": { "start": { "line": 171, @@ -5756,8 +5756,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7068, - "end": 7069, + "start": 7076, + "end": 7077, "loc": { "start": { "line": 171, @@ -5779,14 +5779,14 @@ }, "extra": { "parenthesized": true, - "parenStart": 7038 + "parenStart": 7046 } }, "operator": "*", "right": { "type": "MemberExpression", - "start": 7074, - "end": 7081, + "start": 7082, + "end": 7089, "loc": { "start": { "line": 171, @@ -5799,8 +5799,8 @@ }, "object": { "type": "Identifier", - "start": 7074, - "end": 7078, + "start": 7082, + "end": 7086, "loc": { "start": { "line": 171, @@ -5816,8 +5816,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7079, - "end": 7080, + "start": 7087, + "end": 7088, "loc": { "start": { "line": 171, @@ -5840,8 +5840,8 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 7084, - "end": 7085, + "start": 7092, + "end": 7093, "loc": { "start": { "line": 171, @@ -5865,8 +5865,8 @@ }, { "type": "ExpressionStatement", - "start": 7100, - "end": 7129, + "start": 7108, + "end": 7137, "loc": { "start": { "line": 172, @@ -5879,8 +5879,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7100, - "end": 7128, + "start": 7108, + "end": 7136, "loc": { "start": { "line": 172, @@ -5894,8 +5894,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7100, - "end": 7120, + "start": 7108, + "end": 7128, "loc": { "start": { "line": 172, @@ -5908,8 +5908,8 @@ }, "object": { "type": "ThisExpression", - "start": 7100, - "end": 7104, + "start": 7108, + "end": 7112, "loc": { "start": { "line": 172, @@ -5923,8 +5923,8 @@ }, "property": { "type": "Identifier", - "start": 7105, - "end": 7120, + "start": 7113, + "end": 7128, "loc": { "start": { "line": 172, @@ -5942,8 +5942,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7123, - "end": 7128, + "start": 7131, + "end": 7136, "loc": { "start": { "line": 172, @@ -5960,8 +5960,8 @@ }, { "type": "ExpressionStatement", - "start": 7142, - "end": 7182, + "start": 7150, + "end": 7190, "loc": { "start": { "line": 173, @@ -5974,8 +5974,8 @@ }, "expression": { "type": "CallExpression", - "start": 7142, - "end": 7181, + "start": 7150, + "end": 7189, "loc": { "start": { "line": 173, @@ -5988,8 +5988,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7142, - "end": 7151, + "start": 7150, + "end": 7159, "loc": { "start": { "line": 173, @@ -6002,8 +6002,8 @@ }, "object": { "type": "ThisExpression", - "start": 7142, - "end": 7146, + "start": 7150, + "end": 7154, "loc": { "start": { "line": 173, @@ -6017,8 +6017,8 @@ }, "property": { "type": "Identifier", - "start": 7147, - "end": 7151, + "start": 7155, + "end": 7159, "loc": { "start": { "line": 173, @@ -6037,8 +6037,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 7152, - "end": 7163, + "start": 7160, + "end": 7171, "loc": { "start": { "line": 173, @@ -6057,8 +6057,8 @@ }, { "type": "MemberExpression", - "start": 7165, - "end": 7180, + "start": 7173, + "end": 7188, "loc": { "start": { "line": 173, @@ -6071,8 +6071,8 @@ }, "object": { "type": "ThisExpression", - "start": 7165, - "end": 7169, + "start": 7173, + "end": 7177, "loc": { "start": { "line": 173, @@ -6086,8 +6086,8 @@ }, "property": { "type": "Identifier", - "start": 7170, - "end": 7180, + "start": 7178, + "end": 7188, "loc": { "start": { "line": 173, @@ -6117,8 +6117,8 @@ }, { "type": "ClassMethod", - "start": 7204, - "end": 7450, + "start": 7212, + "end": 7458, "loc": { "start": { "line": 177, @@ -6133,8 +6133,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7204, - "end": 7215, + "start": 7212, + "end": 7223, "loc": { "start": { "line": 177, @@ -6156,8 +6156,8 @@ "params": [ { "type": "Identifier", - "start": 7216, - "end": 7223, + "start": 7224, + "end": 7231, "loc": { "start": { "line": 177, @@ -6174,8 +6174,8 @@ ], "body": { "type": "BlockStatement", - "start": 7225, - "end": 7450, + "start": 7233, + "end": 7458, "loc": { "start": { "line": 177, @@ -6189,8 +6189,8 @@ "body": [ { "type": "IfStatement", - "start": 7300, - "end": 7366, + "start": 7308, + "end": 7374, "loc": { "start": { "line": 178, @@ -6203,8 +6203,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7304, - "end": 7329, + "start": 7312, + "end": 7337, "loc": { "start": { "line": 178, @@ -6217,8 +6217,8 @@ }, "left": { "type": "MemberExpression", - "start": 7304, - "end": 7317, + "start": 7312, + "end": 7325, "loc": { "start": { "line": 178, @@ -6231,8 +6231,8 @@ }, "object": { "type": "ThisExpression", - "start": 7304, - "end": 7308, + "start": 7312, + "end": 7316, "loc": { "start": { "line": 178, @@ -6247,8 +6247,8 @@ }, "property": { "type": "Identifier", - "start": 7309, - "end": 7317, + "start": 7317, + "end": 7325, "loc": { "start": { "line": 178, @@ -6268,8 +6268,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 7322, - "end": 7329, + "start": 7330, + "end": 7337, "loc": { "start": { "line": 178, @@ -6287,8 +6287,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7331, - "end": 7366, + "start": 7339, + "end": 7374, "loc": { "start": { "line": 178, @@ -6306,8 +6306,8 @@ { "type": "CommentLine", "value": " return;", - "start": 7345, - "end": 7356, + "start": 7353, + "end": 7364, "loc": { "start": { "line": 179, @@ -6326,8 +6326,8 @@ { "type": "CommentLine", "value": " Called by VisibilityTester and this._entity.on(\"destroyed\"..)", - "start": 7227, - "end": 7291, + "start": 7235, + "end": 7299, "loc": { "start": { "line": 177, @@ -6343,8 +6343,8 @@ }, { "type": "ExpressionStatement", - "start": 7375, - "end": 7399, + "start": 7383, + "end": 7407, "loc": { "start": { "line": 181, @@ -6357,8 +6357,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7375, - "end": 7398, + "start": 7383, + "end": 7406, "loc": { "start": { "line": 181, @@ -6372,8 +6372,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7375, - "end": 7388, + "start": 7383, + "end": 7396, "loc": { "start": { "line": 181, @@ -6386,8 +6386,8 @@ }, "object": { "type": "ThisExpression", - "start": 7375, - "end": 7379, + "start": 7383, + "end": 7387, "loc": { "start": { "line": 181, @@ -6401,8 +6401,8 @@ }, "property": { "type": "Identifier", - "start": 7380, - "end": 7388, + "start": 7388, + "end": 7396, "loc": { "start": { "line": 181, @@ -6420,8 +6420,8 @@ }, "right": { "type": "Identifier", - "start": 7391, - "end": 7398, + "start": 7399, + "end": 7406, "loc": { "start": { "line": 181, @@ -6439,8 +6439,8 @@ }, { "type": "ExpressionStatement", - "start": 7408, - "end": 7444, + "start": 7416, + "end": 7452, "loc": { "start": { "line": 182, @@ -6453,8 +6453,8 @@ }, "expression": { "type": "CallExpression", - "start": 7408, - "end": 7443, + "start": 7416, + "end": 7451, "loc": { "start": { "line": 182, @@ -6467,8 +6467,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7408, - "end": 7417, + "start": 7416, + "end": 7425, "loc": { "start": { "line": 182, @@ -6481,8 +6481,8 @@ }, "object": { "type": "ThisExpression", - "start": 7408, - "end": 7412, + "start": 7416, + "end": 7420, "loc": { "start": { "line": 182, @@ -6496,8 +6496,8 @@ }, "property": { "type": "Identifier", - "start": 7413, - "end": 7417, + "start": 7421, + "end": 7425, "loc": { "start": { "line": 182, @@ -6516,8 +6516,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 7418, - "end": 7427, + "start": 7426, + "end": 7435, "loc": { "start": { "line": 182, @@ -6536,8 +6536,8 @@ }, { "type": "MemberExpression", - "start": 7429, - "end": 7442, + "start": 7437, + "end": 7450, "loc": { "start": { "line": 182, @@ -6550,8 +6550,8 @@ }, "object": { "type": "ThisExpression", - "start": 7429, - "end": 7433, + "start": 7437, + "end": 7441, "loc": { "start": { "line": 182, @@ -6565,8 +6565,8 @@ }, "property": { "type": "Identifier", - "start": 7434, - "end": 7442, + "start": 7442, + "end": 7450, "loc": { "start": { "line": 182, @@ -6593,8 +6593,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -6610,8 +6610,8 @@ }, { "type": "ClassMethod", - "start": 7732, - "end": 9026, + "start": 7740, + "end": 9034, "loc": { "start": { "line": 193, @@ -6626,8 +6626,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7736, - "end": 7742, + "start": 7744, + "end": 7750, "loc": { "start": { "line": 193, @@ -6649,8 +6649,8 @@ "params": [ { "type": "Identifier", - "start": 7743, - "end": 7749, + "start": 7751, + "end": 7757, "loc": { "start": { "line": 193, @@ -6667,8 +6667,8 @@ ], "body": { "type": "BlockStatement", - "start": 7751, - "end": 9026, + "start": 7759, + "end": 9034, "loc": { "start": { "line": 193, @@ -6682,8 +6682,8 @@ "body": [ { "type": "IfStatement", - "start": 7761, - "end": 8238, + "start": 7769, + "end": 8246, "loc": { "start": { "line": 194, @@ -6696,8 +6696,8 @@ }, "test": { "type": "MemberExpression", - "start": 7765, - "end": 7777, + "start": 7773, + "end": 7785, "loc": { "start": { "line": 194, @@ -6710,8 +6710,8 @@ }, "object": { "type": "ThisExpression", - "start": 7765, - "end": 7769, + "start": 7773, + "end": 7777, "loc": { "start": { "line": 194, @@ -6725,8 +6725,8 @@ }, "property": { "type": "Identifier", - "start": 7770, - "end": 7777, + "start": 7778, + "end": 7785, "loc": { "start": { "line": 194, @@ -6744,8 +6744,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7779, - "end": 8238, + "start": 7787, + "end": 8246, "loc": { "start": { "line": 194, @@ -6759,8 +6759,8 @@ "body": [ { "type": "IfStatement", - "start": 7793, - "end": 7861, + "start": 7801, + "end": 7869, "loc": { "start": { "line": 195, @@ -6773,8 +6773,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7797, - "end": 7820, + "start": 7805, + "end": 7828, "loc": { "start": { "line": 195, @@ -6787,8 +6787,8 @@ }, "left": { "type": "MemberExpression", - "start": 7797, - "end": 7809, + "start": 7805, + "end": 7817, "loc": { "start": { "line": 195, @@ -6801,8 +6801,8 @@ }, "object": { "type": "ThisExpression", - "start": 7797, - "end": 7801, + "start": 7805, + "end": 7809, "loc": { "start": { "line": 195, @@ -6816,8 +6816,8 @@ }, "property": { "type": "Identifier", - "start": 7802, - "end": 7809, + "start": 7810, + "end": 7817, "loc": { "start": { "line": 195, @@ -6836,8 +6836,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 7814, - "end": 7820, + "start": 7822, + "end": 7828, "loc": { "start": { "line": 195, @@ -6854,8 +6854,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7822, - "end": 7861, + "start": 7830, + "end": 7869, "loc": { "start": { "line": 195, @@ -6869,8 +6869,8 @@ "body": [ { "type": "ReturnStatement", - "start": 7840, - "end": 7847, + "start": 7848, + "end": 7855, "loc": { "start": { "line": 196, @@ -6890,8 +6890,8 @@ }, { "type": "IfStatement", - "start": 7874, - "end": 8034, + "start": 7882, + "end": 8042, "loc": { "start": { "line": 198, @@ -6904,8 +6904,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7878, - "end": 7910, + "start": 7886, + "end": 7918, "loc": { "start": { "line": 198, @@ -6918,8 +6918,8 @@ }, "left": { "type": "MemberExpression", - "start": 7878, - "end": 7901, + "start": 7886, + "end": 7909, "loc": { "start": { "line": 198, @@ -6932,8 +6932,8 @@ }, "object": { "type": "ThisExpression", - "start": 7878, - "end": 7882, + "start": 7886, + "end": 7890, "loc": { "start": { "line": 198, @@ -6947,8 +6947,8 @@ }, "property": { "type": "Identifier", - "start": 7883, - "end": 7901, + "start": 7891, + "end": 7909, "loc": { "start": { "line": 198, @@ -6967,8 +6967,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 7906, - "end": 7910, + "start": 7914, + "end": 7918, "loc": { "start": { "line": 198, @@ -6983,8 +6983,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7912, - "end": 8034, + "start": 7920, + "end": 8042, "loc": { "start": { "line": 198, @@ -6998,8 +6998,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7930, - "end": 7972, + "start": 7938, + "end": 7980, "loc": { "start": { "line": 199, @@ -7012,8 +7012,8 @@ }, "expression": { "type": "CallExpression", - "start": 7930, - "end": 7971, + "start": 7938, + "end": 7979, "loc": { "start": { "line": 199, @@ -7026,8 +7026,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7930, - "end": 7946, + "start": 7938, + "end": 7954, "loc": { "start": { "line": 199, @@ -7040,8 +7040,8 @@ }, "object": { "type": "MemberExpression", - "start": 7930, - "end": 7942, + "start": 7938, + "end": 7950, "loc": { "start": { "line": 199, @@ -7054,8 +7054,8 @@ }, "object": { "type": "ThisExpression", - "start": 7930, - "end": 7934, + "start": 7938, + "end": 7942, "loc": { "start": { "line": 199, @@ -7069,8 +7069,8 @@ }, "property": { "type": "Identifier", - "start": 7935, - "end": 7942, + "start": 7943, + "end": 7950, "loc": { "start": { "line": 199, @@ -7088,8 +7088,8 @@ }, "property": { "type": "Identifier", - "start": 7943, - "end": 7946, + "start": 7951, + "end": 7954, "loc": { "start": { "line": 199, @@ -7108,8 +7108,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 7947, - "end": 7970, + "start": 7955, + "end": 7978, "loc": { "start": { "line": 199, @@ -7122,8 +7122,8 @@ }, "object": { "type": "ThisExpression", - "start": 7947, - "end": 7951, + "start": 7955, + "end": 7959, "loc": { "start": { "line": 199, @@ -7137,8 +7137,8 @@ }, "property": { "type": "Identifier", - "start": 7952, - "end": 7970, + "start": 7960, + "end": 7978, "loc": { "start": { "line": 199, @@ -7159,8 +7159,8 @@ }, { "type": "ExpressionStatement", - "start": 7989, - "end": 8020, + "start": 7997, + "end": 8028, "loc": { "start": { "line": 200, @@ -7173,8 +7173,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7989, - "end": 8019, + "start": 7997, + "end": 8027, "loc": { "start": { "line": 200, @@ -7188,8 +7188,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7989, - "end": 8012, + "start": 7997, + "end": 8020, "loc": { "start": { "line": 200, @@ -7202,8 +7202,8 @@ }, "object": { "type": "ThisExpression", - "start": 7989, - "end": 7993, + "start": 7997, + "end": 8001, "loc": { "start": { "line": 200, @@ -7217,8 +7217,8 @@ }, "property": { "type": "Identifier", - "start": 7994, - "end": 8012, + "start": 8002, + "end": 8020, "loc": { "start": { "line": 200, @@ -7236,8 +7236,8 @@ }, "right": { "type": "NullLiteral", - "start": 8015, - "end": 8019, + "start": 8023, + "end": 8027, "loc": { "start": { "line": 200, @@ -7258,8 +7258,8 @@ }, { "type": "IfStatement", - "start": 8047, - "end": 8228, + "start": 8055, + "end": 8236, "loc": { "start": { "line": 202, @@ -7272,8 +7272,8 @@ }, "test": { "type": "BinaryExpression", - "start": 8051, - "end": 8088, + "start": 8059, + "end": 8096, "loc": { "start": { "line": 202, @@ -7286,8 +7286,8 @@ }, "left": { "type": "MemberExpression", - "start": 8051, - "end": 8079, + "start": 8059, + "end": 8087, "loc": { "start": { "line": 202, @@ -7300,8 +7300,8 @@ }, "object": { "type": "ThisExpression", - "start": 8051, - "end": 8055, + "start": 8059, + "end": 8063, "loc": { "start": { "line": 202, @@ -7315,8 +7315,8 @@ }, "property": { "type": "Identifier", - "start": 8056, - "end": 8079, + "start": 8064, + "end": 8087, "loc": { "start": { "line": 202, @@ -7335,8 +7335,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 8084, - "end": 8088, + "start": 8092, + "end": 8096, "loc": { "start": { "line": 202, @@ -7351,8 +7351,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8090, - "end": 8228, + "start": 8098, + "end": 8236, "loc": { "start": { "line": 202, @@ -7366,8 +7366,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8108, - "end": 8161, + "start": 8116, + "end": 8169, "loc": { "start": { "line": 203, @@ -7380,8 +7380,8 @@ }, "expression": { "type": "CallExpression", - "start": 8108, - "end": 8160, + "start": 8116, + "end": 8168, "loc": { "start": { "line": 203, @@ -7394,8 +7394,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8108, - "end": 8130, + "start": 8116, + "end": 8138, "loc": { "start": { "line": 203, @@ -7408,8 +7408,8 @@ }, "object": { "type": "MemberExpression", - "start": 8108, - "end": 8126, + "start": 8116, + "end": 8134, "loc": { "start": { "line": 203, @@ -7422,8 +7422,8 @@ }, "object": { "type": "MemberExpression", - "start": 8108, - "end": 8120, + "start": 8116, + "end": 8128, "loc": { "start": { "line": 203, @@ -7436,8 +7436,8 @@ }, "object": { "type": "ThisExpression", - "start": 8108, - "end": 8112, + "start": 8116, + "end": 8120, "loc": { "start": { "line": 203, @@ -7451,8 +7451,8 @@ }, "property": { "type": "Identifier", - "start": 8113, - "end": 8120, + "start": 8121, + "end": 8128, "loc": { "start": { "line": 203, @@ -7470,8 +7470,8 @@ }, "property": { "type": "Identifier", - "start": 8121, - "end": 8126, + "start": 8129, + "end": 8134, "loc": { "start": { "line": 203, @@ -7489,8 +7489,8 @@ }, "property": { "type": "Identifier", - "start": 8127, - "end": 8130, + "start": 8135, + "end": 8138, "loc": { "start": { "line": 203, @@ -7509,8 +7509,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 8131, - "end": 8159, + "start": 8139, + "end": 8167, "loc": { "start": { "line": 203, @@ -7523,8 +7523,8 @@ }, "object": { "type": "ThisExpression", - "start": 8131, - "end": 8135, + "start": 8139, + "end": 8143, "loc": { "start": { "line": 203, @@ -7538,8 +7538,8 @@ }, "property": { "type": "Identifier", - "start": 8136, - "end": 8159, + "start": 8144, + "end": 8167, "loc": { "start": { "line": 203, @@ -7560,8 +7560,8 @@ }, { "type": "ExpressionStatement", - "start": 8178, - "end": 8214, + "start": 8186, + "end": 8222, "loc": { "start": { "line": 204, @@ -7574,8 +7574,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8178, - "end": 8213, + "start": 8186, + "end": 8221, "loc": { "start": { "line": 204, @@ -7589,8 +7589,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8178, - "end": 8206, + "start": 8186, + "end": 8214, "loc": { "start": { "line": 204, @@ -7603,8 +7603,8 @@ }, "object": { "type": "ThisExpression", - "start": 8178, - "end": 8182, + "start": 8186, + "end": 8190, "loc": { "start": { "line": 204, @@ -7618,8 +7618,8 @@ }, "property": { "type": "Identifier", - "start": 8183, - "end": 8206, + "start": 8191, + "end": 8214, "loc": { "start": { "line": 204, @@ -7637,8 +7637,8 @@ }, "right": { "type": "NullLiteral", - "start": 8209, - "end": 8213, + "start": 8217, + "end": 8221, "loc": { "start": { "line": 204, @@ -7664,8 +7664,8 @@ }, { "type": "ExpressionStatement", - "start": 8247, - "end": 8269, + "start": 8255, + "end": 8277, "loc": { "start": { "line": 207, @@ -7678,8 +7678,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8247, - "end": 8268, + "start": 8255, + "end": 8276, "loc": { "start": { "line": 207, @@ -7693,8 +7693,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8247, - "end": 8259, + "start": 8255, + "end": 8267, "loc": { "start": { "line": 207, @@ -7707,8 +7707,8 @@ }, "object": { "type": "ThisExpression", - "start": 8247, - "end": 8251, + "start": 8255, + "end": 8259, "loc": { "start": { "line": 207, @@ -7722,8 +7722,8 @@ }, "property": { "type": "Identifier", - "start": 8252, - "end": 8259, + "start": 8260, + "end": 8267, "loc": { "start": { "line": 207, @@ -7741,8 +7741,8 @@ }, "right": { "type": "Identifier", - "start": 8262, - "end": 8268, + "start": 8270, + "end": 8276, "loc": { "start": { "line": 207, @@ -7760,8 +7760,8 @@ }, { "type": "IfStatement", - "start": 8278, - "end": 8958, + "start": 8286, + "end": 8966, "loc": { "start": { "line": 208, @@ -7774,8 +7774,8 @@ }, "test": { "type": "MemberExpression", - "start": 8282, - "end": 8294, + "start": 8290, + "end": 8302, "loc": { "start": { "line": 208, @@ -7788,8 +7788,8 @@ }, "object": { "type": "ThisExpression", - "start": 8282, - "end": 8286, + "start": 8290, + "end": 8294, "loc": { "start": { "line": 208, @@ -7803,8 +7803,8 @@ }, "property": { "type": "Identifier", - "start": 8287, - "end": 8294, + "start": 8295, + "end": 8302, "loc": { "start": { "line": 208, @@ -7822,8 +7822,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8296, - "end": 8958, + "start": 8304, + "end": 8966, "loc": { "start": { "line": 208, @@ -7837,8 +7837,8 @@ "body": [ { "type": "IfStatement", - "start": 8310, - "end": 8948, + "start": 8318, + "end": 8956, "loc": { "start": { "line": 209, @@ -7851,8 +7851,8 @@ }, "test": { "type": "BinaryExpression", - "start": 8314, - "end": 8354, + "start": 8322, + "end": 8362, "loc": { "start": { "line": 209, @@ -7865,8 +7865,8 @@ }, "left": { "type": "MemberExpression", - "start": 8314, - "end": 8326, + "start": 8322, + "end": 8334, "loc": { "start": { "line": 209, @@ -7879,8 +7879,8 @@ }, "object": { "type": "ThisExpression", - "start": 8314, - "end": 8318, + "start": 8322, + "end": 8326, "loc": { "start": { "line": 209, @@ -7894,8 +7894,8 @@ }, "property": { "type": "Identifier", - "start": 8319, - "end": 8326, + "start": 8327, + "end": 8334, "loc": { "start": { "line": 209, @@ -7914,8 +7914,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 8338, - "end": 8354, + "start": 8346, + "end": 8362, "loc": { "start": { "line": 209, @@ -7932,8 +7932,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8356, - "end": 8735, + "start": 8364, + "end": 8743, "loc": { "start": { "line": 209, @@ -7947,8 +7947,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8374, - "end": 8721, + "start": 8382, + "end": 8729, "loc": { "start": { "line": 210, @@ -7961,8 +7961,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8374, - "end": 8720, + "start": 8382, + "end": 8728, "loc": { "start": { "line": 210, @@ -7976,8 +7976,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8374, - "end": 8402, + "start": 8382, + "end": 8410, "loc": { "start": { "line": 210, @@ -7990,8 +7990,8 @@ }, "object": { "type": "ThisExpression", - "start": 8374, - "end": 8378, + "start": 8382, + "end": 8386, "loc": { "start": { "line": 210, @@ -8005,8 +8005,8 @@ }, "property": { "type": "Identifier", - "start": 8379, - "end": 8402, + "start": 8387, + "end": 8410, "loc": { "start": { "line": 210, @@ -8024,8 +8024,8 @@ }, "right": { "type": "CallExpression", - "start": 8405, - "end": 8720, + "start": 8413, + "end": 8728, "loc": { "start": { "line": 210, @@ -8038,8 +8038,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8405, - "end": 8426, + "start": 8413, + "end": 8434, "loc": { "start": { "line": 210, @@ -8052,8 +8052,8 @@ }, "object": { "type": "MemberExpression", - "start": 8405, - "end": 8423, + "start": 8413, + "end": 8431, "loc": { "start": { "line": 210, @@ -8066,8 +8066,8 @@ }, "object": { "type": "MemberExpression", - "start": 8405, - "end": 8417, + "start": 8413, + "end": 8425, "loc": { "start": { "line": 210, @@ -8080,8 +8080,8 @@ }, "object": { "type": "ThisExpression", - "start": 8405, - "end": 8409, + "start": 8413, + "end": 8417, "loc": { "start": { "line": 210, @@ -8095,8 +8095,8 @@ }, "property": { "type": "Identifier", - "start": 8410, - "end": 8417, + "start": 8418, + "end": 8425, "loc": { "start": { "line": 210, @@ -8114,8 +8114,8 @@ }, "property": { "type": "Identifier", - "start": 8418, - "end": 8423, + "start": 8426, + "end": 8431, "loc": { "start": { "line": 210, @@ -8133,8 +8133,8 @@ }, "property": { "type": "Identifier", - "start": 8424, - "end": 8426, + "start": 8432, + "end": 8434, "loc": { "start": { "line": 210, @@ -8153,8 +8153,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8427, - "end": 8438, + "start": 8435, + "end": 8446, "loc": { "start": { "line": 210, @@ -8173,8 +8173,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 8440, - "end": 8719, + "start": 8448, + "end": 8727, "loc": { "start": { "line": 210, @@ -8192,8 +8192,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8446, - "end": 8719, + "start": 8454, + "end": 8727, "loc": { "start": { "line": 210, @@ -8207,8 +8207,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8552, - "end": 8572, + "start": 8560, + "end": 8580, "loc": { "start": { "line": 211, @@ -8221,8 +8221,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8552, - "end": 8571, + "start": 8560, + "end": 8579, "loc": { "start": { "line": 211, @@ -8236,8 +8236,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8552, - "end": 8564, + "start": 8560, + "end": 8572, "loc": { "start": { "line": 211, @@ -8250,8 +8250,8 @@ }, "object": { "type": "ThisExpression", - "start": 8552, - "end": 8556, + "start": 8560, + "end": 8564, "loc": { "start": { "line": 211, @@ -8266,8 +8266,8 @@ }, "property": { "type": "Identifier", - "start": 8557, - "end": 8564, + "start": 8565, + "end": 8572, "loc": { "start": { "line": 211, @@ -8286,8 +8286,8 @@ }, "right": { "type": "NullLiteral", - "start": 8567, - "end": 8571, + "start": 8575, + "end": 8579, "loc": { "start": { "line": 211, @@ -8305,8 +8305,8 @@ { "type": "CommentLine", "value": " SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel", - "start": 8448, - "end": 8531, + "start": 8456, + "end": 8539, "loc": { "start": { "line": 210, @@ -8323,8 +8323,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -8340,8 +8340,8 @@ }, { "type": "ExpressionStatement", - "start": 8665, - "end": 8701, + "start": 8673, + "end": 8709, "loc": { "start": { "line": 212, @@ -8354,8 +8354,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8665, - "end": 8700, + "start": 8673, + "end": 8708, "loc": { "start": { "line": 212, @@ -8369,8 +8369,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8665, - "end": 8693, + "start": 8673, + "end": 8701, "loc": { "start": { "line": 212, @@ -8383,8 +8383,8 @@ }, "object": { "type": "ThisExpression", - "start": 8665, - "end": 8669, + "start": 8673, + "end": 8677, "loc": { "start": { "line": 212, @@ -8399,8 +8399,8 @@ }, "property": { "type": "Identifier", - "start": 8670, - "end": 8693, + "start": 8678, + "end": 8701, "loc": { "start": { "line": 212, @@ -8419,8 +8419,8 @@ }, "right": { "type": "NullLiteral", - "start": 8696, - "end": 8700, + "start": 8704, + "end": 8708, "loc": { "start": { "line": 212, @@ -8438,8 +8438,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -8466,8 +8466,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 8741, - "end": 8948, + "start": 8749, + "end": 8956, "loc": { "start": { "line": 214, @@ -8481,8 +8481,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8759, - "end": 8934, + "start": 8767, + "end": 8942, "loc": { "start": { "line": 215, @@ -8495,8 +8495,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8759, - "end": 8933, + "start": 8767, + "end": 8941, "loc": { "start": { "line": 215, @@ -8510,8 +8510,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8759, - "end": 8782, + "start": 8767, + "end": 8790, "loc": { "start": { "line": 215, @@ -8524,8 +8524,8 @@ }, "object": { "type": "ThisExpression", - "start": 8759, - "end": 8763, + "start": 8767, + "end": 8771, "loc": { "start": { "line": 215, @@ -8539,8 +8539,8 @@ }, "property": { "type": "Identifier", - "start": 8764, - "end": 8782, + "start": 8772, + "end": 8790, "loc": { "start": { "line": 215, @@ -8558,8 +8558,8 @@ }, "right": { "type": "CallExpression", - "start": 8785, - "end": 8933, + "start": 8793, + "end": 8941, "loc": { "start": { "line": 215, @@ -8572,8 +8572,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8785, - "end": 8800, + "start": 8793, + "end": 8808, "loc": { "start": { "line": 215, @@ -8586,8 +8586,8 @@ }, "object": { "type": "MemberExpression", - "start": 8785, - "end": 8797, + "start": 8793, + "end": 8805, "loc": { "start": { "line": 215, @@ -8600,8 +8600,8 @@ }, "object": { "type": "ThisExpression", - "start": 8785, - "end": 8789, + "start": 8793, + "end": 8797, "loc": { "start": { "line": 215, @@ -8615,8 +8615,8 @@ }, "property": { "type": "Identifier", - "start": 8790, - "end": 8797, + "start": 8798, + "end": 8805, "loc": { "start": { "line": 215, @@ -8634,8 +8634,8 @@ }, "property": { "type": "Identifier", - "start": 8798, - "end": 8800, + "start": 8806, + "end": 8808, "loc": { "start": { "line": 215, @@ -8654,8 +8654,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8801, - "end": 8812, + "start": 8809, + "end": 8820, "loc": { "start": { "line": 215, @@ -8674,8 +8674,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 8814, - "end": 8932, + "start": 8822, + "end": 8940, "loc": { "start": { "line": 215, @@ -8693,8 +8693,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8820, - "end": 8932, + "start": 8828, + "end": 8940, "loc": { "start": { "line": 215, @@ -8708,8 +8708,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8842, - "end": 8862, + "start": 8850, + "end": 8870, "loc": { "start": { "line": 216, @@ -8722,8 +8722,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8842, - "end": 8861, + "start": 8850, + "end": 8869, "loc": { "start": { "line": 216, @@ -8737,8 +8737,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8842, - "end": 8854, + "start": 8850, + "end": 8862, "loc": { "start": { "line": 216, @@ -8751,8 +8751,8 @@ }, "object": { "type": "ThisExpression", - "start": 8842, - "end": 8846, + "start": 8850, + "end": 8854, "loc": { "start": { "line": 216, @@ -8766,8 +8766,8 @@ }, "property": { "type": "Identifier", - "start": 8847, - "end": 8854, + "start": 8855, + "end": 8862, "loc": { "start": { "line": 216, @@ -8785,8 +8785,8 @@ }, "right": { "type": "NullLiteral", - "start": 8857, - "end": 8861, + "start": 8865, + "end": 8869, "loc": { "start": { "line": 216, @@ -8802,8 +8802,8 @@ }, { "type": "ExpressionStatement", - "start": 8883, - "end": 8914, + "start": 8891, + "end": 8922, "loc": { "start": { "line": 217, @@ -8816,8 +8816,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8883, - "end": 8913, + "start": 8891, + "end": 8921, "loc": { "start": { "line": 217, @@ -8831,8 +8831,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8883, - "end": 8906, + "start": 8891, + "end": 8914, "loc": { "start": { "line": 217, @@ -8845,8 +8845,8 @@ }, "object": { "type": "ThisExpression", - "start": 8883, - "end": 8887, + "start": 8891, + "end": 8895, "loc": { "start": { "line": 217, @@ -8860,8 +8860,8 @@ }, "property": { "type": "Identifier", - "start": 8888, - "end": 8906, + "start": 8896, + "end": 8914, "loc": { "start": { "line": 217, @@ -8879,8 +8879,8 @@ }, "right": { "type": "NullLiteral", - "start": 8909, - "end": 8913, + "start": 8917, + "end": 8921, "loc": { "start": { "line": 217, @@ -8913,8 +8913,8 @@ }, { "type": "ExpressionStatement", - "start": 8967, - "end": 9020, + "start": 8975, + "end": 9028, "loc": { "start": { "line": 221, @@ -8927,8 +8927,8 @@ }, "expression": { "type": "CallExpression", - "start": 8967, - "end": 9019, + "start": 8975, + "end": 9027, "loc": { "start": { "line": 221, @@ -8941,8 +8941,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8967, - "end": 8976, + "start": 8975, + "end": 8984, "loc": { "start": { "line": 221, @@ -8955,8 +8955,8 @@ }, "object": { "type": "ThisExpression", - "start": 8967, - "end": 8971, + "start": 8975, + "end": 8979, "loc": { "start": { "line": 221, @@ -8970,8 +8970,8 @@ }, "property": { "type": "Identifier", - "start": 8972, - "end": 8976, + "start": 8980, + "end": 8984, "loc": { "start": { "line": 221, @@ -8990,8 +8990,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8977, - "end": 8985, + "start": 8985, + "end": 8993, "loc": { "start": { "line": 221, @@ -9010,8 +9010,8 @@ }, { "type": "MemberExpression", - "start": 8987, - "end": 8999, + "start": 8995, + "end": 9007, "loc": { "start": { "line": 221, @@ -9024,8 +9024,8 @@ }, "object": { "type": "ThisExpression", - "start": 8987, - "end": 8991, + "start": 8995, + "end": 8999, "loc": { "start": { "line": 221, @@ -9039,8 +9039,8 @@ }, "property": { "type": "Identifier", - "start": 8992, - "end": 8999, + "start": 9000, + "end": 9007, "loc": { "start": { "line": 221, @@ -9058,8 +9058,8 @@ }, { "type": "BooleanLiteral", - "start": 9001, - "end": 9005, + "start": 9009, + "end": 9013, "loc": { "start": { "line": 221, @@ -9076,8 +9076,8 @@ { "type": "CommentBlock", "value": " forget ", - "start": 9006, - "end": 9018, + "start": 9014, + "end": 9026, "loc": { "start": { "line": 221, @@ -9102,8 +9102,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -9120,8 +9120,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -9137,8 +9137,8 @@ }, { "type": "ClassMethod", - "start": 9140, - "end": 9189, + "start": 9148, + "end": 9197, "loc": { "start": { "line": 229, @@ -9153,8 +9153,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9144, - "end": 9150, + "start": 9152, + "end": 9158, "loc": { "start": { "line": 229, @@ -9176,8 +9176,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 9153, - "end": 9189, + "start": 9161, + "end": 9197, "loc": { "start": { "line": 229, @@ -9191,8 +9191,8 @@ "body": [ { "type": "ReturnStatement", - "start": 9163, - "end": 9183, + "start": 9171, + "end": 9191, "loc": { "start": { "line": 230, @@ -9205,8 +9205,8 @@ }, "argument": { "type": "MemberExpression", - "start": 9170, - "end": 9182, + "start": 9178, + "end": 9190, "loc": { "start": { "line": 230, @@ -9219,8 +9219,8 @@ }, "object": { "type": "ThisExpression", - "start": 9170, - "end": 9174, + "start": 9178, + "end": 9182, "loc": { "start": { "line": 230, @@ -9234,8 +9234,8 @@ }, "property": { "type": "Identifier", - "start": 9175, - "end": 9182, + "start": 9183, + "end": 9190, "loc": { "start": { "line": 230, @@ -9260,8 +9260,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -9278,8 +9278,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -9295,8 +9295,8 @@ }, { "type": "ClassMethod", - "start": 9686, - "end": 9871, + "start": 9694, + "end": 9879, "loc": { "start": { "line": 243, @@ -9311,8 +9311,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9690, - "end": 9700, + "start": 9698, + "end": 9708, "loc": { "start": { "line": 243, @@ -9334,8 +9334,8 @@ "params": [ { "type": "Identifier", - "start": 9701, - "end": 9711, + "start": 9709, + "end": 9719, "loc": { "start": { "line": 243, @@ -9352,8 +9352,8 @@ ], "body": { "type": "BlockStatement", - "start": 9713, - "end": 9871, + "start": 9721, + "end": 9879, "loc": { "start": { "line": 243, @@ -9367,8 +9367,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9723, - "end": 9749, + "start": 9731, + "end": 9757, "loc": { "start": { "line": 244, @@ -9381,8 +9381,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9723, - "end": 9748, + "start": 9731, + "end": 9756, "loc": { "start": { "line": 244, @@ -9396,8 +9396,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 9723, - "end": 9733, + "start": 9731, + "end": 9741, "loc": { "start": { "line": 244, @@ -9413,8 +9413,8 @@ }, "right": { "type": "UnaryExpression", - "start": 9736, - "end": 9748, + "start": 9744, + "end": 9756, "loc": { "start": { "line": 244, @@ -9429,8 +9429,8 @@ "prefix": true, "argument": { "type": "UnaryExpression", - "start": 9737, - "end": 9748, + "start": 9745, + "end": 9756, "loc": { "start": { "line": 244, @@ -9445,8 +9445,8 @@ "prefix": true, "argument": { "type": "Identifier", - "start": 9738, - "end": 9748, + "start": 9746, + "end": 9756, "loc": { "start": { "line": 244, @@ -9472,8 +9472,8 @@ }, { "type": "IfStatement", - "start": 9758, - "end": 9826, + "start": 9766, + "end": 9834, "loc": { "start": { "line": 245, @@ -9486,8 +9486,8 @@ }, "test": { "type": "BinaryExpression", - "start": 9762, - "end": 9793, + "start": 9770, + "end": 9801, "loc": { "start": { "line": 245, @@ -9500,8 +9500,8 @@ }, "left": { "type": "Identifier", - "start": 9762, - "end": 9772, + "start": 9770, + "end": 9780, "loc": { "start": { "line": 245, @@ -9518,8 +9518,8 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 9777, - "end": 9793, + "start": 9785, + "end": 9801, "loc": { "start": { "line": 245, @@ -9532,8 +9532,8 @@ }, "object": { "type": "ThisExpression", - "start": 9777, - "end": 9781, + "start": 9785, + "end": 9789, "loc": { "start": { "line": 245, @@ -9547,8 +9547,8 @@ }, "property": { "type": "Identifier", - "start": 9782, - "end": 9793, + "start": 9790, + "end": 9801, "loc": { "start": { "line": 245, @@ -9567,8 +9567,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 9795, - "end": 9826, + "start": 9803, + "end": 9834, "loc": { "start": { "line": 245, @@ -9582,8 +9582,8 @@ "body": [ { "type": "ReturnStatement", - "start": 9809, - "end": 9816, + "start": 9817, + "end": 9824, "loc": { "start": { "line": 246, @@ -9603,8 +9603,8 @@ }, { "type": "ExpressionStatement", - "start": 9835, - "end": 9865, + "start": 9843, + "end": 9873, "loc": { "start": { "line": 248, @@ -9617,8 +9617,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9835, - "end": 9864, + "start": 9843, + "end": 9872, "loc": { "start": { "line": 248, @@ -9632,8 +9632,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9835, - "end": 9851, + "start": 9843, + "end": 9859, "loc": { "start": { "line": 248, @@ -9646,8 +9646,8 @@ }, "object": { "type": "ThisExpression", - "start": 9835, - "end": 9839, + "start": 9843, + "end": 9847, "loc": { "start": { "line": 248, @@ -9661,8 +9661,8 @@ }, "property": { "type": "Identifier", - "start": 9840, - "end": 9851, + "start": 9848, + "end": 9859, "loc": { "start": { "line": 248, @@ -9680,8 +9680,8 @@ }, "right": { "type": "Identifier", - "start": 9854, - "end": 9864, + "start": 9862, + "end": 9872, "loc": { "start": { "line": 248, @@ -9705,8 +9705,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -9723,8 +9723,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -9740,8 +9740,8 @@ }, { "type": "ClassMethod", - "start": 10151, - "end": 10208, + "start": 10159, + "end": 10216, "loc": { "start": { "line": 258, @@ -9756,8 +9756,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10155, - "end": 10165, + "start": 10163, + "end": 10173, "loc": { "start": { "line": 258, @@ -9779,8 +9779,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10168, - "end": 10208, + "start": 10176, + "end": 10216, "loc": { "start": { "line": 258, @@ -9794,8 +9794,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10178, - "end": 10202, + "start": 10186, + "end": 10210, "loc": { "start": { "line": 259, @@ -9808,8 +9808,8 @@ }, "argument": { "type": "MemberExpression", - "start": 10185, - "end": 10201, + "start": 10193, + "end": 10209, "loc": { "start": { "line": 259, @@ -9822,8 +9822,8 @@ }, "object": { "type": "ThisExpression", - "start": 10185, - "end": 10189, + "start": 10193, + "end": 10197, "loc": { "start": { "line": 259, @@ -9837,8 +9837,8 @@ }, "property": { "type": "Identifier", - "start": 10190, - "end": 10201, + "start": 10198, + "end": 10209, "loc": { "start": { "line": 259, @@ -9863,8 +9863,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -9881,8 +9881,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -9898,8 +9898,8 @@ }, { "type": "ClassMethod", - "start": 10381, - "end": 10737, + "start": 10389, + "end": 10745, "loc": { "start": { "line": 269, @@ -9914,8 +9914,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10385, - "end": 10393, + "start": 10393, + "end": 10401, "loc": { "start": { "line": 269, @@ -9937,8 +9937,8 @@ "params": [ { "type": "Identifier", - "start": 10394, - "end": 10402, + "start": 10402, + "end": 10410, "loc": { "start": { "line": 269, @@ -9955,8 +9955,8 @@ ], "body": { "type": "BlockStatement", - "start": 10404, - "end": 10737, + "start": 10412, + "end": 10745, "loc": { "start": { "line": 269, @@ -9970,8 +9970,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10414, - "end": 10456, + "start": 10422, + "end": 10464, "loc": { "start": { "line": 270, @@ -9984,8 +9984,8 @@ }, "expression": { "type": "CallExpression", - "start": 10414, - "end": 10455, + "start": 10422, + "end": 10463, "loc": { "start": { "line": 270, @@ -9998,8 +9998,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10414, - "end": 10432, + "start": 10422, + "end": 10440, "loc": { "start": { "line": 270, @@ -10012,8 +10012,8 @@ }, "object": { "type": "MemberExpression", - "start": 10414, - "end": 10428, + "start": 10422, + "end": 10436, "loc": { "start": { "line": 270, @@ -10026,8 +10026,8 @@ }, "object": { "type": "ThisExpression", - "start": 10414, - "end": 10418, + "start": 10422, + "end": 10426, "loc": { "start": { "line": 270, @@ -10041,8 +10041,8 @@ }, "property": { "type": "Identifier", - "start": 10419, - "end": 10428, + "start": 10427, + "end": 10436, "loc": { "start": { "line": 270, @@ -10060,8 +10060,8 @@ }, "property": { "type": "Identifier", - "start": 10429, - "end": 10432, + "start": 10437, + "end": 10440, "loc": { "start": { "line": 270, @@ -10080,8 +10080,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 10433, - "end": 10454, + "start": 10441, + "end": 10462, "loc": { "start": { "line": 270, @@ -10094,8 +10094,8 @@ }, "left": { "type": "Identifier", - "start": 10433, - "end": 10441, + "start": 10441, + "end": 10449, "loc": { "start": { "line": 270, @@ -10112,8 +10112,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 10445, - "end": 10454, + "start": 10453, + "end": 10462, "loc": { "start": { "line": 270, @@ -10127,8 +10127,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 10446, - "end": 10447, + "start": 10454, + "end": 10455, "loc": { "start": { "line": 270, @@ -10147,8 +10147,8 @@ }, { "type": "NumericLiteral", - "start": 10449, - "end": 10450, + "start": 10457, + "end": 10458, "loc": { "start": { "line": 270, @@ -10167,8 +10167,8 @@ }, { "type": "NumericLiteral", - "start": 10452, - "end": 10453, + "start": 10460, + "end": 10461, "loc": { "start": { "line": 270, @@ -10193,8 +10193,8 @@ }, { "type": "ExpressionStatement", - "start": 10465, - "end": 10523, + "start": 10473, + "end": 10531, "loc": { "start": { "line": 271, @@ -10207,8 +10207,8 @@ }, "expression": { "type": "CallExpression", - "start": 10465, - "end": 10522, + "start": 10473, + "end": 10530, "loc": { "start": { "line": 271, @@ -10221,8 +10221,8 @@ }, "callee": { "type": "Identifier", - "start": 10465, - "end": 10478, + "start": 10473, + "end": 10486, "loc": { "start": { "line": 271, @@ -10239,8 +10239,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 10479, - "end": 10493, + "start": 10487, + "end": 10501, "loc": { "start": { "line": 271, @@ -10253,8 +10253,8 @@ }, "object": { "type": "ThisExpression", - "start": 10479, - "end": 10483, + "start": 10487, + "end": 10491, "loc": { "start": { "line": 271, @@ -10268,8 +10268,8 @@ }, "property": { "type": "Identifier", - "start": 10484, - "end": 10493, + "start": 10492, + "end": 10501, "loc": { "start": { "line": 271, @@ -10287,8 +10287,8 @@ }, { "type": "MemberExpression", - "start": 10495, - "end": 10507, + "start": 10503, + "end": 10515, "loc": { "start": { "line": 271, @@ -10301,8 +10301,8 @@ }, "object": { "type": "ThisExpression", - "start": 10495, - "end": 10499, + "start": 10503, + "end": 10507, "loc": { "start": { "line": 271, @@ -10316,8 +10316,8 @@ }, "property": { "type": "Identifier", - "start": 10500, - "end": 10507, + "start": 10508, + "end": 10515, "loc": { "start": { "line": 271, @@ -10335,8 +10335,8 @@ }, { "type": "MemberExpression", - "start": 10509, - "end": 10521, + "start": 10517, + "end": 10529, "loc": { "start": { "line": 271, @@ -10349,8 +10349,8 @@ }, "object": { "type": "ThisExpression", - "start": 10509, - "end": 10513, + "start": 10517, + "end": 10521, "loc": { "start": { "line": 271, @@ -10364,8 +10364,8 @@ }, "property": { "type": "Identifier", - "start": 10514, - "end": 10521, + "start": 10522, + "end": 10529, "loc": { "start": { "line": 271, @@ -10386,8 +10386,8 @@ }, { "type": "IfStatement", - "start": 10532, - "end": 10621, + "start": 10540, + "end": 10629, "loc": { "start": { "line": 272, @@ -10400,8 +10400,8 @@ }, "test": { "type": "MemberExpression", - "start": 10536, - "end": 10552, + "start": 10544, + "end": 10560, "loc": { "start": { "line": 272, @@ -10414,8 +10414,8 @@ }, "object": { "type": "ThisExpression", - "start": 10536, - "end": 10540, + "start": 10544, + "end": 10548, "loc": { "start": { "line": 272, @@ -10429,8 +10429,8 @@ }, "property": { "type": "Identifier", - "start": 10541, - "end": 10552, + "start": 10549, + "end": 10560, "loc": { "start": { "line": 272, @@ -10448,8 +10448,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10554, - "end": 10621, + "start": 10562, + "end": 10629, "loc": { "start": { "line": 272, @@ -10463,8 +10463,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10568, - "end": 10611, + "start": 10576, + "end": 10619, "loc": { "start": { "line": 273, @@ -10477,8 +10477,8 @@ }, "expression": { "type": "CallExpression", - "start": 10568, - "end": 10610, + "start": 10576, + "end": 10618, "loc": { "start": { "line": 273, @@ -10491,8 +10491,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10568, - "end": 10604, + "start": 10576, + "end": 10612, "loc": { "start": { "line": 273, @@ -10505,8 +10505,8 @@ }, "object": { "type": "MemberExpression", - "start": 10568, - "end": 10582, + "start": 10576, + "end": 10590, "loc": { "start": { "line": 273, @@ -10519,8 +10519,8 @@ }, "object": { "type": "ThisExpression", - "start": 10568, - "end": 10572, + "start": 10576, + "end": 10580, "loc": { "start": { "line": 273, @@ -10534,8 +10534,8 @@ }, "property": { "type": "Identifier", - "start": 10573, - "end": 10582, + "start": 10581, + "end": 10590, "loc": { "start": { "line": 273, @@ -10553,8 +10553,8 @@ }, "property": { "type": "Identifier", - "start": 10583, - "end": 10604, + "start": 10591, + "end": 10612, "loc": { "start": { "line": 273, @@ -10573,8 +10573,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 10605, - "end": 10609, + "start": 10613, + "end": 10617, "loc": { "start": { "line": 273, @@ -10596,8 +10596,8 @@ }, { "type": "ExpressionStatement", - "start": 10630, - "end": 10656, + "start": 10638, + "end": 10664, "loc": { "start": { "line": 275, @@ -10610,8 +10610,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10630, - "end": 10655, + "start": 10638, + "end": 10663, "loc": { "start": { "line": 275, @@ -10625,8 +10625,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10630, - "end": 10648, + "start": 10638, + "end": 10656, "loc": { "start": { "line": 275, @@ -10639,8 +10639,8 @@ }, "object": { "type": "ThisExpression", - "start": 10630, - "end": 10634, + "start": 10638, + "end": 10642, "loc": { "start": { "line": 275, @@ -10654,8 +10654,8 @@ }, "property": { "type": "Identifier", - "start": 10635, - "end": 10648, + "start": 10643, + "end": 10656, "loc": { "start": { "line": 275, @@ -10673,8 +10673,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 10651, - "end": 10655, + "start": 10659, + "end": 10663, "loc": { "start": { "line": 275, @@ -10691,8 +10691,8 @@ }, { "type": "ExpressionStatement", - "start": 10665, - "end": 10703, + "start": 10673, + "end": 10711, "loc": { "start": { "line": 276, @@ -10705,8 +10705,8 @@ }, "expression": { "type": "CallExpression", - "start": 10665, - "end": 10702, + "start": 10673, + "end": 10710, "loc": { "start": { "line": 276, @@ -10719,8 +10719,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10665, - "end": 10674, + "start": 10673, + "end": 10682, "loc": { "start": { "line": 276, @@ -10733,8 +10733,8 @@ }, "object": { "type": "ThisExpression", - "start": 10665, - "end": 10669, + "start": 10673, + "end": 10677, "loc": { "start": { "line": 276, @@ -10748,8 +10748,8 @@ }, "property": { "type": "Identifier", - "start": 10670, - "end": 10674, + "start": 10678, + "end": 10682, "loc": { "start": { "line": 276, @@ -10768,8 +10768,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10675, - "end": 10685, + "start": 10683, + "end": 10693, "loc": { "start": { "line": 276, @@ -10788,8 +10788,8 @@ }, { "type": "MemberExpression", - "start": 10687, - "end": 10701, + "start": 10695, + "end": 10709, "loc": { "start": { "line": 276, @@ -10802,8 +10802,8 @@ }, "object": { "type": "ThisExpression", - "start": 10687, - "end": 10691, + "start": 10695, + "end": 10699, "loc": { "start": { "line": 276, @@ -10817,8 +10817,8 @@ }, "property": { "type": "Identifier", - "start": 10692, - "end": 10701, + "start": 10700, + "end": 10709, "loc": { "start": { "line": 276, @@ -10839,8 +10839,8 @@ }, { "type": "ExpressionStatement", - "start": 10712, - "end": 10731, + "start": 10720, + "end": 10739, "loc": { "start": { "line": 277, @@ -10853,8 +10853,8 @@ }, "expression": { "type": "CallExpression", - "start": 10712, - "end": 10730, + "start": 10720, + "end": 10738, "loc": { "start": { "line": 277, @@ -10867,8 +10867,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10712, - "end": 10728, + "start": 10720, + "end": 10736, "loc": { "start": { "line": 277, @@ -10881,8 +10881,8 @@ }, "object": { "type": "ThisExpression", - "start": 10712, - "end": 10716, + "start": 10720, + "end": 10724, "loc": { "start": { "line": 277, @@ -10896,8 +10896,8 @@ }, "property": { "type": "Identifier", - "start": 10717, - "end": 10728, + "start": 10725, + "end": 10736, "loc": { "start": { "line": 277, @@ -10924,8 +10924,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -10942,8 +10942,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -10959,8 +10959,8 @@ }, { "type": "ClassMethod", - "start": 10846, - "end": 10899, + "start": 10854, + "end": 10907, "loc": { "start": { "line": 285, @@ -10975,8 +10975,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10850, - "end": 10858, + "start": 10858, + "end": 10866, "loc": { "start": { "line": 285, @@ -10998,8 +10998,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10861, - "end": 10899, + "start": 10869, + "end": 10907, "loc": { "start": { "line": 285, @@ -11013,8 +11013,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10871, - "end": 10893, + "start": 10879, + "end": 10901, "loc": { "start": { "line": 286, @@ -11027,8 +11027,8 @@ }, "argument": { "type": "MemberExpression", - "start": 10878, - "end": 10892, + "start": 10886, + "end": 10900, "loc": { "start": { "line": 286, @@ -11041,8 +11041,8 @@ }, "object": { "type": "ThisExpression", - "start": 10878, - "end": 10882, + "start": 10886, + "end": 10890, "loc": { "start": { "line": 286, @@ -11056,8 +11056,8 @@ }, "property": { "type": "Identifier", - "start": 10883, - "end": 10892, + "start": 10891, + "end": 10900, "loc": { "start": { "line": 286, @@ -11082,8 +11082,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -11100,8 +11100,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -11117,8 +11117,8 @@ }, { "type": "ClassMethod", - "start": 11072, - "end": 11121, + "start": 11080, + "end": 11129, "loc": { "start": { "line": 296, @@ -11133,8 +11133,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11076, - "end": 11082, + "start": 11084, + "end": 11090, "loc": { "start": { "line": 296, @@ -11156,8 +11156,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11085, - "end": 11121, + "start": 11093, + "end": 11129, "loc": { "start": { "line": 296, @@ -11171,8 +11171,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11095, - "end": 11115, + "start": 11103, + "end": 11123, "loc": { "start": { "line": 297, @@ -11185,8 +11185,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11102, - "end": 11114, + "start": 11110, + "end": 11122, "loc": { "start": { "line": 297, @@ -11199,8 +11199,8 @@ }, "object": { "type": "ThisExpression", - "start": 11102, - "end": 11106, + "start": 11110, + "end": 11114, "loc": { "start": { "line": 297, @@ -11214,8 +11214,8 @@ }, "property": { "type": "Identifier", - "start": 11107, - "end": 11114, + "start": 11115, + "end": 11122, "loc": { "start": { "line": 297, @@ -11240,8 +11240,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -11258,8 +11258,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -11275,8 +11275,8 @@ }, { "type": "ClassMethod", - "start": 11296, - "end": 11345, + "start": 11304, + "end": 11353, "loc": { "start": { "line": 307, @@ -11291,8 +11291,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11300, - "end": 11306, + "start": 11308, + "end": 11314, "loc": { "start": { "line": 307, @@ -11314,8 +11314,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11309, - "end": 11345, + "start": 11317, + "end": 11353, "loc": { "start": { "line": 307, @@ -11329,8 +11329,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11319, - "end": 11339, + "start": 11327, + "end": 11347, "loc": { "start": { "line": 308, @@ -11343,8 +11343,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11326, - "end": 11338, + "start": 11334, + "end": 11346, "loc": { "start": { "line": 308, @@ -11357,8 +11357,8 @@ }, "object": { "type": "ThisExpression", - "start": 11326, - "end": 11330, + "start": 11334, + "end": 11338, "loc": { "start": { "line": 308, @@ -11372,8 +11372,8 @@ }, "property": { "type": "Identifier", - "start": 11331, - "end": 11338, + "start": 11339, + "end": 11346, "loc": { "start": { "line": 308, @@ -11398,8 +11398,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -11416,8 +11416,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -11433,8 +11433,8 @@ }, { "type": "ClassMethod", - "start": 11685, - "end": 11760, + "start": 11693, + "end": 11768, "loc": { "start": { "line": 321, @@ -11449,8 +11449,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11689, - "end": 11696, + "start": 11697, + "end": 11704, "loc": { "start": { "line": 321, @@ -11472,8 +11472,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11699, - "end": 11760, + "start": 11707, + "end": 11768, "loc": { "start": { "line": 321, @@ -11487,8 +11487,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11709, - "end": 11724, + "start": 11717, + "end": 11732, "loc": { "start": { "line": 322, @@ -11501,8 +11501,8 @@ }, "expression": { "type": "CallExpression", - "start": 11709, - "end": 11723, + "start": 11717, + "end": 11731, "loc": { "start": { "line": 322, @@ -11515,8 +11515,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11709, - "end": 11721, + "start": 11717, + "end": 11729, "loc": { "start": { "line": 322, @@ -11529,8 +11529,8 @@ }, "object": { "type": "ThisExpression", - "start": 11709, - "end": 11713, + "start": 11717, + "end": 11721, "loc": { "start": { "line": 322, @@ -11544,8 +11544,8 @@ }, "property": { "type": "Identifier", - "start": 11714, - "end": 11721, + "start": 11722, + "end": 11729, "loc": { "start": { "line": 322, @@ -11566,8 +11566,8 @@ }, { "type": "ReturnStatement", - "start": 11733, - "end": 11754, + "start": 11741, + "end": 11762, "loc": { "start": { "line": 323, @@ -11580,8 +11580,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11740, - "end": 11753, + "start": 11748, + "end": 11761, "loc": { "start": { "line": 323, @@ -11594,8 +11594,8 @@ }, "object": { "type": "ThisExpression", - "start": 11740, - "end": 11744, + "start": 11748, + "end": 11752, "loc": { "start": { "line": 323, @@ -11609,8 +11609,8 @@ }, "property": { "type": "Identifier", - "start": 11745, - "end": 11753, + "start": 11753, + "end": 11761, "loc": { "start": { "line": 323, @@ -11635,8 +11635,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -11653,8 +11653,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -11670,8 +11670,8 @@ }, { "type": "ClassMethod", - "start": 12119, - "end": 12198, + "start": 12127, + "end": 12206, "loc": { "start": { "line": 336, @@ -11686,8 +11686,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12123, - "end": 12132, + "start": 12131, + "end": 12140, "loc": { "start": { "line": 336, @@ -11709,8 +11709,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12135, - "end": 12198, + "start": 12143, + "end": 12206, "loc": { "start": { "line": 336, @@ -11724,8 +11724,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 12145, - "end": 12160, + "start": 12153, + "end": 12168, "loc": { "start": { "line": 337, @@ -11738,8 +11738,8 @@ }, "expression": { "type": "CallExpression", - "start": 12145, - "end": 12159, + "start": 12153, + "end": 12167, "loc": { "start": { "line": 337, @@ -11752,8 +11752,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12145, - "end": 12157, + "start": 12153, + "end": 12165, "loc": { "start": { "line": 337, @@ -11766,8 +11766,8 @@ }, "object": { "type": "ThisExpression", - "start": 12145, - "end": 12149, + "start": 12153, + "end": 12157, "loc": { "start": { "line": 337, @@ -11781,8 +11781,8 @@ }, "property": { "type": "Identifier", - "start": 12150, - "end": 12157, + "start": 12158, + "end": 12165, "loc": { "start": { "line": 337, @@ -11803,8 +11803,8 @@ }, { "type": "ReturnStatement", - "start": 12169, - "end": 12192, + "start": 12177, + "end": 12200, "loc": { "start": { "line": 338, @@ -11817,8 +11817,8 @@ }, "argument": { "type": "MemberExpression", - "start": 12176, - "end": 12191, + "start": 12184, + "end": 12199, "loc": { "start": { "line": 338, @@ -11831,8 +11831,8 @@ }, "object": { "type": "ThisExpression", - "start": 12176, - "end": 12180, + "start": 12184, + "end": 12188, "loc": { "start": { "line": 338, @@ -11846,8 +11846,8 @@ }, "property": { "type": "Identifier", - "start": 12181, - "end": 12191, + "start": 12189, + "end": 12199, "loc": { "start": { "line": 338, @@ -11872,8 +11872,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -11890,8 +11890,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -11907,8 +11907,8 @@ }, { "type": "ClassMethod", - "start": 12819, - "end": 12872, + "start": 12827, + "end": 12880, "loc": { "start": { "line": 357, @@ -11923,8 +11923,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12823, - "end": 12830, + "start": 12831, + "end": 12838, "loc": { "start": { "line": 357, @@ -11946,8 +11946,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12833, - "end": 12872, + "start": 12841, + "end": 12880, "loc": { "start": { "line": 357, @@ -11961,8 +11961,8 @@ "body": [ { "type": "ReturnStatement", - "start": 12843, - "end": 12866, + "start": 12851, + "end": 12874, "loc": { "start": { "line": 358, @@ -11975,8 +11975,8 @@ }, "argument": { "type": "UnaryExpression", - "start": 12850, - "end": 12865, + "start": 12858, + "end": 12873, "loc": { "start": { "line": 358, @@ -11991,8 +11991,8 @@ "prefix": true, "argument": { "type": "UnaryExpression", - "start": 12851, - "end": 12865, + "start": 12859, + "end": 12873, "loc": { "start": { "line": 358, @@ -12007,8 +12007,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 12852, - "end": 12865, + "start": 12860, + "end": 12873, "loc": { "start": { "line": 358, @@ -12021,8 +12021,8 @@ }, "object": { "type": "ThisExpression", - "start": 12852, - "end": 12856, + "start": 12860, + "end": 12864, "loc": { "start": { "line": 358, @@ -12036,8 +12036,8 @@ }, "property": { "type": "Identifier", - "start": 12857, - "end": 12865, + "start": 12865, + "end": 12873, "loc": { "start": { "line": 358, @@ -12070,8 +12070,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -12088,8 +12088,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -12105,8 +12105,8 @@ }, { "type": "ClassMethod", - "start": 12923, - "end": 13464, + "start": 12931, + "end": 13472, "loc": { "start": { "line": 364, @@ -12121,8 +12121,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12923, - "end": 12930, + "start": 12931, + "end": 12938, "loc": { "start": { "line": 364, @@ -12145,8 +12145,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12933, - "end": 13464, + "start": 12941, + "end": 13472, "loc": { "start": { "line": 364, @@ -12160,8 +12160,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 12943, - "end": 12972, + "start": 12951, + "end": 12980, "loc": { "start": { "line": 365, @@ -12174,8 +12174,8 @@ }, "expression": { "type": "CallExpression", - "start": 12943, - "end": 12971, + "start": 12951, + "end": 12979, "loc": { "start": { "line": 365, @@ -12188,8 +12188,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12943, - "end": 12952, + "start": 12951, + "end": 12960, "loc": { "start": { "line": 365, @@ -12202,8 +12202,8 @@ }, "object": { "type": "ThisExpression", - "start": 12943, - "end": 12947, + "start": 12951, + "end": 12955, "loc": { "start": { "line": 365, @@ -12217,8 +12217,8 @@ }, "property": { "type": "Identifier", - "start": 12948, - "end": 12952, + "start": 12956, + "end": 12960, "loc": { "start": { "line": 365, @@ -12237,8 +12237,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 12953, - "end": 12964, + "start": 12961, + "end": 12972, "loc": { "start": { "line": 365, @@ -12257,8 +12257,8 @@ }, { "type": "BooleanLiteral", - "start": 12966, - "end": 12970, + "start": 12974, + "end": 12978, "loc": { "start": { "line": 365, @@ -12276,8 +12276,8 @@ }, { "type": "ExpressionStatement", - "start": 12981, - "end": 13029, + "start": 12989, + "end": 13037, "loc": { "start": { "line": 366, @@ -12290,8 +12290,8 @@ }, "expression": { "type": "CallExpression", - "start": 12981, - "end": 13028, + "start": 12989, + "end": 13036, "loc": { "start": { "line": 366, @@ -12304,8 +12304,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12981, - "end": 13002, + "start": 12989, + "end": 13010, "loc": { "start": { "line": 366, @@ -12318,8 +12318,8 @@ }, "object": { "type": "MemberExpression", - "start": 12981, - "end": 12998, + "start": 12989, + "end": 13006, "loc": { "start": { "line": 366, @@ -12332,8 +12332,8 @@ }, "object": { "type": "MemberExpression", - "start": 12981, - "end": 12991, + "start": 12989, + "end": 12999, "loc": { "start": { "line": 366, @@ -12346,8 +12346,8 @@ }, "object": { "type": "ThisExpression", - "start": 12981, - "end": 12985, + "start": 12989, + "end": 12993, "loc": { "start": { "line": 366, @@ -12361,8 +12361,8 @@ }, "property": { "type": "Identifier", - "start": 12986, - "end": 12991, + "start": 12994, + "end": 12999, "loc": { "start": { "line": 366, @@ -12380,8 +12380,8 @@ }, "property": { "type": "Identifier", - "start": 12992, - "end": 12998, + "start": 13000, + "end": 13006, "loc": { "start": { "line": 366, @@ -12399,8 +12399,8 @@ }, "property": { "type": "Identifier", - "start": 12999, - "end": 13002, + "start": 13007, + "end": 13010, "loc": { "start": { "line": 366, @@ -12419,8 +12419,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13003, - "end": 13027, + "start": 13011, + "end": 13035, "loc": { "start": { "line": 366, @@ -12433,8 +12433,8 @@ }, "object": { "type": "ThisExpression", - "start": 13003, - "end": 13007, + "start": 13011, + "end": 13015, "loc": { "start": { "line": 366, @@ -12448,8 +12448,8 @@ }, "property": { "type": "Identifier", - "start": 13008, - "end": 13027, + "start": 13016, + "end": 13035, "loc": { "start": { "line": 366, @@ -12470,8 +12470,8 @@ }, { "type": "ExpressionStatement", - "start": 13038, - "end": 13086, + "start": 13046, + "end": 13094, "loc": { "start": { "line": 367, @@ -12484,8 +12484,8 @@ }, "expression": { "type": "CallExpression", - "start": 13038, - "end": 13085, + "start": 13046, + "end": 13093, "loc": { "start": { "line": 367, @@ -12498,8 +12498,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13038, - "end": 13059, + "start": 13046, + "end": 13067, "loc": { "start": { "line": 367, @@ -12512,8 +12512,8 @@ }, "object": { "type": "MemberExpression", - "start": 13038, - "end": 13055, + "start": 13046, + "end": 13063, "loc": { "start": { "line": 367, @@ -12526,8 +12526,8 @@ }, "object": { "type": "MemberExpression", - "start": 13038, - "end": 13048, + "start": 13046, + "end": 13056, "loc": { "start": { "line": 367, @@ -12540,8 +12540,8 @@ }, "object": { "type": "ThisExpression", - "start": 13038, - "end": 13042, + "start": 13046, + "end": 13050, "loc": { "start": { "line": 367, @@ -12555,8 +12555,8 @@ }, "property": { "type": "Identifier", - "start": 13043, - "end": 13048, + "start": 13051, + "end": 13056, "loc": { "start": { "line": 367, @@ -12574,8 +12574,8 @@ }, "property": { "type": "Identifier", - "start": 13049, - "end": 13055, + "start": 13057, + "end": 13063, "loc": { "start": { "line": 367, @@ -12593,8 +12593,8 @@ }, "property": { "type": "Identifier", - "start": 13056, - "end": 13059, + "start": 13064, + "end": 13067, "loc": { "start": { "line": 367, @@ -12613,8 +12613,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13060, - "end": 13084, + "start": 13068, + "end": 13092, "loc": { "start": { "line": 367, @@ -12627,8 +12627,8 @@ }, "object": { "type": "ThisExpression", - "start": 13060, - "end": 13064, + "start": 13068, + "end": 13072, "loc": { "start": { "line": 367, @@ -12642,8 +12642,8 @@ }, "property": { "type": "Identifier", - "start": 13065, - "end": 13084, + "start": 13073, + "end": 13092, "loc": { "start": { "line": 367, @@ -12664,8 +12664,8 @@ }, { "type": "IfStatement", - "start": 13095, - "end": 13390, + "start": 13103, + "end": 13398, "loc": { "start": { "line": 368, @@ -12678,8 +12678,8 @@ }, "test": { "type": "MemberExpression", - "start": 13099, - "end": 13111, + "start": 13107, + "end": 13119, "loc": { "start": { "line": 368, @@ -12692,8 +12692,8 @@ }, "object": { "type": "ThisExpression", - "start": 13099, - "end": 13103, + "start": 13107, + "end": 13111, "loc": { "start": { "line": 368, @@ -12707,8 +12707,8 @@ }, "property": { "type": "Identifier", - "start": 13104, - "end": 13111, + "start": 13112, + "end": 13119, "loc": { "start": { "line": 368, @@ -12726,8 +12726,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13113, - "end": 13390, + "start": 13121, + "end": 13398, "loc": { "start": { "line": 368, @@ -12741,8 +12741,8 @@ "body": [ { "type": "IfStatement", - "start": 13127, - "end": 13239, + "start": 13135, + "end": 13247, "loc": { "start": { "line": 369, @@ -12755,8 +12755,8 @@ }, "test": { "type": "BinaryExpression", - "start": 13131, - "end": 13163, + "start": 13139, + "end": 13171, "loc": { "start": { "line": 369, @@ -12769,8 +12769,8 @@ }, "left": { "type": "MemberExpression", - "start": 13131, - "end": 13154, + "start": 13139, + "end": 13162, "loc": { "start": { "line": 369, @@ -12783,8 +12783,8 @@ }, "object": { "type": "ThisExpression", - "start": 13131, - "end": 13135, + "start": 13139, + "end": 13143, "loc": { "start": { "line": 369, @@ -12798,8 +12798,8 @@ }, "property": { "type": "Identifier", - "start": 13136, - "end": 13154, + "start": 13144, + "end": 13162, "loc": { "start": { "line": 369, @@ -12818,8 +12818,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 13159, - "end": 13163, + "start": 13167, + "end": 13171, "loc": { "start": { "line": 369, @@ -12834,8 +12834,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13165, - "end": 13239, + "start": 13173, + "end": 13247, "loc": { "start": { "line": 369, @@ -12849,8 +12849,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13183, - "end": 13225, + "start": 13191, + "end": 13233, "loc": { "start": { "line": 370, @@ -12863,8 +12863,8 @@ }, "expression": { "type": "CallExpression", - "start": 13183, - "end": 13224, + "start": 13191, + "end": 13232, "loc": { "start": { "line": 370, @@ -12877,8 +12877,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13183, - "end": 13199, + "start": 13191, + "end": 13207, "loc": { "start": { "line": 370, @@ -12891,8 +12891,8 @@ }, "object": { "type": "MemberExpression", - "start": 13183, - "end": 13195, + "start": 13191, + "end": 13203, "loc": { "start": { "line": 370, @@ -12905,8 +12905,8 @@ }, "object": { "type": "ThisExpression", - "start": 13183, - "end": 13187, + "start": 13191, + "end": 13195, "loc": { "start": { "line": 370, @@ -12920,8 +12920,8 @@ }, "property": { "type": "Identifier", - "start": 13188, - "end": 13195, + "start": 13196, + "end": 13203, "loc": { "start": { "line": 370, @@ -12939,8 +12939,8 @@ }, "property": { "type": "Identifier", - "start": 13196, - "end": 13199, + "start": 13204, + "end": 13207, "loc": { "start": { "line": 370, @@ -12959,8 +12959,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13200, - "end": 13223, + "start": 13208, + "end": 13231, "loc": { "start": { "line": 370, @@ -12973,8 +12973,8 @@ }, "object": { "type": "ThisExpression", - "start": 13200, - "end": 13204, + "start": 13208, + "end": 13212, "loc": { "start": { "line": 370, @@ -12988,8 +12988,8 @@ }, "property": { "type": "Identifier", - "start": 13205, - "end": 13223, + "start": 13213, + "end": 13231, "loc": { "start": { "line": 370, @@ -13015,8 +13015,8 @@ }, { "type": "IfStatement", - "start": 13252, - "end": 13380, + "start": 13260, + "end": 13388, "loc": { "start": { "line": 372, @@ -13029,8 +13029,8 @@ }, "test": { "type": "BinaryExpression", - "start": 13256, - "end": 13293, + "start": 13264, + "end": 13301, "loc": { "start": { "line": 372, @@ -13043,8 +13043,8 @@ }, "left": { "type": "MemberExpression", - "start": 13256, - "end": 13284, + "start": 13264, + "end": 13292, "loc": { "start": { "line": 372, @@ -13057,8 +13057,8 @@ }, "object": { "type": "ThisExpression", - "start": 13256, - "end": 13260, + "start": 13264, + "end": 13268, "loc": { "start": { "line": 372, @@ -13072,8 +13072,8 @@ }, "property": { "type": "Identifier", - "start": 13261, - "end": 13284, + "start": 13269, + "end": 13292, "loc": { "start": { "line": 372, @@ -13092,8 +13092,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 13289, - "end": 13293, + "start": 13297, + "end": 13301, "loc": { "start": { "line": 372, @@ -13108,8 +13108,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13295, - "end": 13380, + "start": 13303, + "end": 13388, "loc": { "start": { "line": 372, @@ -13123,8 +13123,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13313, - "end": 13366, + "start": 13321, + "end": 13374, "loc": { "start": { "line": 373, @@ -13137,8 +13137,8 @@ }, "expression": { "type": "CallExpression", - "start": 13313, - "end": 13365, + "start": 13321, + "end": 13373, "loc": { "start": { "line": 373, @@ -13151,8 +13151,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13313, - "end": 13335, + "start": 13321, + "end": 13343, "loc": { "start": { "line": 373, @@ -13165,8 +13165,8 @@ }, "object": { "type": "MemberExpression", - "start": 13313, - "end": 13331, + "start": 13321, + "end": 13339, "loc": { "start": { "line": 373, @@ -13179,8 +13179,8 @@ }, "object": { "type": "MemberExpression", - "start": 13313, - "end": 13325, + "start": 13321, + "end": 13333, "loc": { "start": { "line": 373, @@ -13193,8 +13193,8 @@ }, "object": { "type": "ThisExpression", - "start": 13313, - "end": 13317, + "start": 13321, + "end": 13325, "loc": { "start": { "line": 373, @@ -13208,8 +13208,8 @@ }, "property": { "type": "Identifier", - "start": 13318, - "end": 13325, + "start": 13326, + "end": 13333, "loc": { "start": { "line": 373, @@ -13227,8 +13227,8 @@ }, "property": { "type": "Identifier", - "start": 13326, - "end": 13331, + "start": 13334, + "end": 13339, "loc": { "start": { "line": 373, @@ -13246,8 +13246,8 @@ }, "property": { "type": "Identifier", - "start": 13332, - "end": 13335, + "start": 13340, + "end": 13343, "loc": { "start": { "line": 373, @@ -13266,8 +13266,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13336, - "end": 13364, + "start": 13344, + "end": 13372, "loc": { "start": { "line": 373, @@ -13280,8 +13280,8 @@ }, "object": { "type": "ThisExpression", - "start": 13336, - "end": 13340, + "start": 13344, + "end": 13348, "loc": { "start": { "line": 373, @@ -13295,8 +13295,8 @@ }, "property": { "type": "Identifier", - "start": 13341, - "end": 13364, + "start": 13349, + "end": 13372, "loc": { "start": { "line": 373, @@ -13327,8 +13327,8 @@ }, { "type": "ExpressionStatement", - "start": 13399, - "end": 13433, + "start": 13407, + "end": 13441, "loc": { "start": { "line": 376, @@ -13341,8 +13341,8 @@ }, "expression": { "type": "CallExpression", - "start": 13399, - "end": 13432, + "start": 13407, + "end": 13440, "loc": { "start": { "line": 376, @@ -13355,8 +13355,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13399, - "end": 13426, + "start": 13407, + "end": 13434, "loc": { "start": { "line": 376, @@ -13369,8 +13369,8 @@ }, "object": { "type": "MemberExpression", - "start": 13399, - "end": 13413, + "start": 13407, + "end": 13421, "loc": { "start": { "line": 376, @@ -13383,8 +13383,8 @@ }, "object": { "type": "ThisExpression", - "start": 13399, - "end": 13403, + "start": 13407, + "end": 13411, "loc": { "start": { "line": 376, @@ -13398,8 +13398,8 @@ }, "property": { "type": "Identifier", - "start": 13404, - "end": 13413, + "start": 13412, + "end": 13421, "loc": { "start": { "line": 376, @@ -13417,8 +13417,8 @@ }, "property": { "type": "Identifier", - "start": 13414, - "end": 13426, + "start": 13422, + "end": 13434, "loc": { "start": { "line": 376, @@ -13437,8 +13437,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 13427, - "end": 13431, + "start": 13435, + "end": 13439, "loc": { "start": { "line": 376, @@ -13455,8 +13455,8 @@ }, { "type": "ExpressionStatement", - "start": 13442, - "end": 13458, + "start": 13450, + "end": 13466, "loc": { "start": { "line": 377, @@ -13469,8 +13469,8 @@ }, "expression": { "type": "CallExpression", - "start": 13442, - "end": 13457, + "start": 13450, + "end": 13465, "loc": { "start": { "line": 377, @@ -13483,8 +13483,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13442, - "end": 13455, + "start": 13450, + "end": 13463, "loc": { "start": { "line": 377, @@ -13497,8 +13497,8 @@ }, "object": { "type": "Super", - "start": 13442, - "end": 13447, + "start": 13450, + "end": 13455, "loc": { "start": { "line": 377, @@ -13512,8 +13512,8 @@ }, "property": { "type": "Identifier", - "start": 13448, - "end": 13455, + "start": 13456, + "end": 13463, "loc": { "start": { "line": 377, @@ -13539,8 +13539,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -13562,8 +13562,8 @@ }, { "type": "ExportNamedDeclaration", - "start": 13468, - "end": 13484, + "start": 13476, + "end": 13492, "loc": { "start": { "line": 381, @@ -13578,8 +13578,8 @@ "specifiers": [ { "type": "ExportSpecifier", - "start": 13476, - "end": 13482, + "start": 13484, + "end": 13490, "loc": { "start": { "line": 381, @@ -13592,8 +13592,8 @@ }, "local": { "type": "Identifier", - "start": 13476, - "end": 13482, + "start": 13484, + "end": 13490, "loc": { "start": { "line": 381, @@ -13609,8 +13609,8 @@ }, "exported": { "type": "Identifier", - "start": 13476, - "end": 13482, + "start": 13484, + "end": 13490, "loc": { "start": { "line": 381, @@ -13630,8 +13630,8 @@ }, { "type": "ExportNamedDeclaration", - "start": 13468, - "end": 13484, + "start": 13476, + "end": 13492, "loc": { "start": { "line": 381, @@ -13644,8 +13644,8 @@ }, "declaration": { "type": "ClassDeclaration", - "start": 4562, - "end": 13466, + "start": 4570, + "end": 13474, "loc": { "start": { "line": 114, @@ -13658,8 +13658,8 @@ }, "id": { "type": "Identifier", - "start": 4568, - "end": 4574, + "start": 4576, + "end": 4582, "loc": { "start": { "line": 114, @@ -13676,8 +13676,8 @@ }, "superClass": { "type": "Identifier", - "start": 4583, - "end": 4592, + "start": 4591, + "end": 4600, "loc": { "start": { "line": 114, @@ -13693,8 +13693,8 @@ }, "body": { "type": "ClassBody", - "start": 4593, - "end": 13466, + "start": 4601, + "end": 13474, "loc": { "start": { "line": 114, @@ -13708,8 +13708,8 @@ "body": [ { "type": "ClassMethod", - "start": 5410, - "end": 6313, + "start": 5418, + "end": 6321, "loc": { "start": { "line": 125, @@ -13724,8 +13724,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 5410, - "end": 5421, + "start": 5418, + "end": 5429, "loc": { "start": { "line": 125, @@ -13748,8 +13748,8 @@ "params": [ { "type": "Identifier", - "start": 5422, - "end": 5427, + "start": 5430, + "end": 5435, "loc": { "start": { "line": 125, @@ -13765,8 +13765,8 @@ }, { "type": "Identifier", - "start": 5429, - "end": 5432, + "start": 5437, + "end": 5440, "loc": { "start": { "line": 125, @@ -13783,8 +13783,8 @@ ], "body": { "type": "BlockStatement", - "start": 5434, - "end": 6313, + "start": 5442, + "end": 6321, "loc": { "start": { "line": 125, @@ -13798,8 +13798,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5445, - "end": 5463, + "start": 5453, + "end": 5471, "loc": { "start": { "line": 127, @@ -13812,8 +13812,8 @@ }, "expression": { "type": "CallExpression", - "start": 5445, - "end": 5462, + "start": 5453, + "end": 5470, "loc": { "start": { "line": 127, @@ -13826,8 +13826,8 @@ }, "callee": { "type": "Super", - "start": 5445, - "end": 5450, + "start": 5453, + "end": 5458, "loc": { "start": { "line": 127, @@ -13842,8 +13842,8 @@ "arguments": [ { "type": "Identifier", - "start": 5451, - "end": 5456, + "start": 5459, + "end": 5464, "loc": { "start": { "line": 127, @@ -13859,8 +13859,8 @@ }, { "type": "Identifier", - "start": 5458, - "end": 5461, + "start": 5466, + "end": 5469, "loc": { "start": { "line": 127, @@ -13879,8 +13879,8 @@ }, { "type": "ExpressionStatement", - "start": 5473, - "end": 5493, + "start": 5481, + "end": 5501, "loc": { "start": { "line": 129, @@ -13893,8 +13893,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5473, - "end": 5492, + "start": 5481, + "end": 5500, "loc": { "start": { "line": 129, @@ -13908,8 +13908,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5473, - "end": 5485, + "start": 5481, + "end": 5493, "loc": { "start": { "line": 129, @@ -13922,8 +13922,8 @@ }, "object": { "type": "ThisExpression", - "start": 5473, - "end": 5477, + "start": 5481, + "end": 5485, "loc": { "start": { "line": 129, @@ -13937,8 +13937,8 @@ }, "property": { "type": "Identifier", - "start": 5478, - "end": 5485, + "start": 5486, + "end": 5493, "loc": { "start": { "line": 129, @@ -13956,8 +13956,8 @@ }, "right": { "type": "NullLiteral", - "start": 5488, - "end": 5492, + "start": 5496, + "end": 5500, "loc": { "start": { "line": 129, @@ -13973,8 +13973,8 @@ }, { "type": "ExpressionStatement", - "start": 5502, - "end": 5523, + "start": 5510, + "end": 5531, "loc": { "start": { "line": 130, @@ -13987,8 +13987,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5502, - "end": 5522, + "start": 5510, + "end": 5530, "loc": { "start": { "line": 130, @@ -14002,8 +14002,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5502, - "end": 5515, + "start": 5510, + "end": 5523, "loc": { "start": { "line": 130, @@ -14016,8 +14016,8 @@ }, "object": { "type": "ThisExpression", - "start": 5502, - "end": 5506, + "start": 5510, + "end": 5514, "loc": { "start": { "line": 130, @@ -14031,8 +14031,8 @@ }, "property": { "type": "Identifier", - "start": 5507, - "end": 5515, + "start": 5515, + "end": 5523, "loc": { "start": { "line": 130, @@ -14050,8 +14050,8 @@ }, "right": { "type": "NullLiteral", - "start": 5518, - "end": 5522, + "start": 5526, + "end": 5530, "loc": { "start": { "line": 130, @@ -14067,8 +14067,8 @@ }, { "type": "ExpressionStatement", - "start": 5532, - "end": 5561, + "start": 5540, + "end": 5569, "loc": { "start": { "line": 131, @@ -14081,8 +14081,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5532, - "end": 5560, + "start": 5540, + "end": 5568, "loc": { "start": { "line": 131, @@ -14096,8 +14096,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5532, - "end": 5546, + "start": 5540, + "end": 5554, "loc": { "start": { "line": 131, @@ -14110,8 +14110,8 @@ }, "object": { "type": "ThisExpression", - "start": 5532, - "end": 5536, + "start": 5540, + "end": 5544, "loc": { "start": { "line": 131, @@ -14125,8 +14125,8 @@ }, "property": { "type": "Identifier", - "start": 5537, - "end": 5546, + "start": 5545, + "end": 5554, "loc": { "start": { "line": 131, @@ -14144,8 +14144,8 @@ }, "right": { "type": "CallExpression", - "start": 5549, - "end": 5560, + "start": 5557, + "end": 5568, "loc": { "start": { "line": 131, @@ -14158,8 +14158,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5549, - "end": 5558, + "start": 5557, + "end": 5566, "loc": { "start": { "line": 131, @@ -14172,8 +14172,8 @@ }, "object": { "type": "Identifier", - "start": 5549, - "end": 5553, + "start": 5557, + "end": 5561, "loc": { "start": { "line": 131, @@ -14189,8 +14189,8 @@ }, "property": { "type": "Identifier", - "start": 5554, - "end": 5558, + "start": 5562, + "end": 5566, "loc": { "start": { "line": 131, @@ -14212,8 +14212,8 @@ }, { "type": "ExpressionStatement", - "start": 5570, - "end": 5597, + "start": 5578, + "end": 5605, "loc": { "start": { "line": 132, @@ -14226,8 +14226,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5570, - "end": 5596, + "start": 5578, + "end": 5604, "loc": { "start": { "line": 132, @@ -14241,8 +14241,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5570, - "end": 5582, + "start": 5578, + "end": 5590, "loc": { "start": { "line": 132, @@ -14255,8 +14255,8 @@ }, "object": { "type": "ThisExpression", - "start": 5570, - "end": 5574, + "start": 5578, + "end": 5582, "loc": { "start": { "line": 132, @@ -14270,8 +14270,8 @@ }, "property": { "type": "Identifier", - "start": 5575, - "end": 5582, + "start": 5583, + "end": 5590, "loc": { "start": { "line": 132, @@ -14289,8 +14289,8 @@ }, "right": { "type": "CallExpression", - "start": 5585, - "end": 5596, + "start": 5593, + "end": 5604, "loc": { "start": { "line": 132, @@ -14303,8 +14303,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5585, - "end": 5594, + "start": 5593, + "end": 5602, "loc": { "start": { "line": 132, @@ -14317,8 +14317,8 @@ }, "object": { "type": "Identifier", - "start": 5585, - "end": 5589, + "start": 5593, + "end": 5597, "loc": { "start": { "line": 132, @@ -14334,8 +14334,8 @@ }, "property": { "type": "Identifier", - "start": 5590, - "end": 5594, + "start": 5598, + "end": 5602, "loc": { "start": { "line": 132, @@ -14357,8 +14357,8 @@ }, { "type": "ExpressionStatement", - "start": 5606, - "end": 5633, + "start": 5614, + "end": 5641, "loc": { "start": { "line": 133, @@ -14371,8 +14371,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5606, - "end": 5632, + "start": 5614, + "end": 5640, "loc": { "start": { "line": 133, @@ -14386,8 +14386,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5606, - "end": 5618, + "start": 5614, + "end": 5626, "loc": { "start": { "line": 133, @@ -14400,8 +14400,8 @@ }, "object": { "type": "ThisExpression", - "start": 5606, - "end": 5610, + "start": 5614, + "end": 5618, "loc": { "start": { "line": 133, @@ -14415,8 +14415,8 @@ }, "property": { "type": "Identifier", - "start": 5611, - "end": 5618, + "start": 5619, + "end": 5626, "loc": { "start": { "line": 133, @@ -14434,8 +14434,8 @@ }, "right": { "type": "CallExpression", - "start": 5621, - "end": 5632, + "start": 5629, + "end": 5640, "loc": { "start": { "line": 133, @@ -14448,8 +14448,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5621, - "end": 5630, + "start": 5629, + "end": 5638, "loc": { "start": { "line": 133, @@ -14462,8 +14462,8 @@ }, "object": { "type": "Identifier", - "start": 5621, - "end": 5625, + "start": 5629, + "end": 5633, "loc": { "start": { "line": 133, @@ -14479,8 +14479,8 @@ }, "property": { "type": "Identifier", - "start": 5626, - "end": 5630, + "start": 5634, + "end": 5638, "loc": { "start": { "line": 133, @@ -14502,8 +14502,8 @@ }, { "type": "ExpressionStatement", - "start": 5642, - "end": 5670, + "start": 5650, + "end": 5678, "loc": { "start": { "line": 134, @@ -14516,8 +14516,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5642, - "end": 5669, + "start": 5650, + "end": 5677, "loc": { "start": { "line": 134, @@ -14531,8 +14531,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5642, - "end": 5655, + "start": 5650, + "end": 5663, "loc": { "start": { "line": 134, @@ -14545,8 +14545,8 @@ }, "object": { "type": "ThisExpression", - "start": 5642, - "end": 5646, + "start": 5650, + "end": 5654, "loc": { "start": { "line": 134, @@ -14560,8 +14560,8 @@ }, "property": { "type": "Identifier", - "start": 5647, - "end": 5655, + "start": 5655, + "end": 5663, "loc": { "start": { "line": 134, @@ -14579,8 +14579,8 @@ }, "right": { "type": "CallExpression", - "start": 5658, - "end": 5669, + "start": 5666, + "end": 5677, "loc": { "start": { "line": 134, @@ -14593,8 +14593,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5658, - "end": 5667, + "start": 5666, + "end": 5675, "loc": { "start": { "line": 134, @@ -14607,8 +14607,8 @@ }, "object": { "type": "Identifier", - "start": 5658, - "end": 5662, + "start": 5666, + "end": 5670, "loc": { "start": { "line": 134, @@ -14624,8 +14624,8 @@ }, "property": { "type": "Identifier", - "start": 5663, - "end": 5667, + "start": 5671, + "end": 5675, "loc": { "start": { "line": 134, @@ -14647,8 +14647,8 @@ }, { "type": "ExpressionStatement", - "start": 5679, - "end": 5709, + "start": 5687, + "end": 5717, "loc": { "start": { "line": 135, @@ -14661,8 +14661,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5679, - "end": 5708, + "start": 5687, + "end": 5716, "loc": { "start": { "line": 135, @@ -14676,8 +14676,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5679, - "end": 5694, + "start": 5687, + "end": 5702, "loc": { "start": { "line": 135, @@ -14690,8 +14690,8 @@ }, "object": { "type": "ThisExpression", - "start": 5679, - "end": 5683, + "start": 5687, + "end": 5691, "loc": { "start": { "line": 135, @@ -14705,8 +14705,8 @@ }, "property": { "type": "Identifier", - "start": 5684, - "end": 5694, + "start": 5692, + "end": 5702, "loc": { "start": { "line": 135, @@ -14724,8 +14724,8 @@ }, "right": { "type": "CallExpression", - "start": 5697, - "end": 5708, + "start": 5705, + "end": 5716, "loc": { "start": { "line": 135, @@ -14738,8 +14738,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5697, - "end": 5706, + "start": 5705, + "end": 5714, "loc": { "start": { "line": 135, @@ -14752,8 +14752,8 @@ }, "object": { "type": "Identifier", - "start": 5697, - "end": 5701, + "start": 5705, + "end": 5709, "loc": { "start": { "line": 135, @@ -14769,8 +14769,8 @@ }, "property": { "type": "Identifier", - "start": 5702, - "end": 5706, + "start": 5710, + "end": 5714, "loc": { "start": { "line": 135, @@ -14792,8 +14792,8 @@ }, { "type": "ExpressionStatement", - "start": 5718, - "end": 5743, + "start": 5726, + "end": 5751, "loc": { "start": { "line": 136, @@ -14806,8 +14806,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5718, - "end": 5742, + "start": 5726, + "end": 5750, "loc": { "start": { "line": 136, @@ -14821,8 +14821,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5718, - "end": 5734, + "start": 5726, + "end": 5742, "loc": { "start": { "line": 136, @@ -14835,8 +14835,8 @@ }, "object": { "type": "ThisExpression", - "start": 5718, - "end": 5722, + "start": 5726, + "end": 5730, "loc": { "start": { "line": 136, @@ -14850,8 +14850,8 @@ }, "property": { "type": "Identifier", - "start": 5723, - "end": 5734, + "start": 5731, + "end": 5742, "loc": { "start": { "line": 136, @@ -14869,8 +14869,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 5737, - "end": 5742, + "start": 5745, + "end": 5750, "loc": { "start": { "line": 136, @@ -14887,8 +14887,8 @@ }, { "type": "ExpressionStatement", - "start": 5753, - "end": 5901, + "start": 5761, + "end": 5909, "loc": { "start": { "line": 138, @@ -14901,8 +14901,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5753, - "end": 5900, + "start": 5761, + "end": 5908, "loc": { "start": { "line": 138, @@ -14916,8 +14916,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5753, - "end": 5777, + "start": 5761, + "end": 5785, "loc": { "start": { "line": 138, @@ -14930,8 +14930,8 @@ }, "object": { "type": "ThisExpression", - "start": 5753, - "end": 5757, + "start": 5761, + "end": 5765, "loc": { "start": { "line": 138, @@ -14945,8 +14945,8 @@ }, "property": { "type": "Identifier", - "start": 5758, - "end": 5777, + "start": 5766, + "end": 5785, "loc": { "start": { "line": 138, @@ -14964,8 +14964,8 @@ }, "right": { "type": "CallExpression", - "start": 5780, - "end": 5900, + "start": 5788, + "end": 5908, "loc": { "start": { "line": 138, @@ -14978,8 +14978,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5780, - "end": 5800, + "start": 5788, + "end": 5808, "loc": { "start": { "line": 138, @@ -14992,8 +14992,8 @@ }, "object": { "type": "MemberExpression", - "start": 5780, - "end": 5797, + "start": 5788, + "end": 5805, "loc": { "start": { "line": 138, @@ -15006,8 +15006,8 @@ }, "object": { "type": "MemberExpression", - "start": 5780, - "end": 5790, + "start": 5788, + "end": 5798, "loc": { "start": { "line": 138, @@ -15020,8 +15020,8 @@ }, "object": { "type": "ThisExpression", - "start": 5780, - "end": 5784, + "start": 5788, + "end": 5792, "loc": { "start": { "line": 138, @@ -15035,8 +15035,8 @@ }, "property": { "type": "Identifier", - "start": 5785, - "end": 5790, + "start": 5793, + "end": 5798, "loc": { "start": { "line": 138, @@ -15054,8 +15054,8 @@ }, "property": { "type": "Identifier", - "start": 5791, - "end": 5797, + "start": 5799, + "end": 5805, "loc": { "start": { "line": 138, @@ -15073,8 +15073,8 @@ }, "property": { "type": "Identifier", - "start": 5798, - "end": 5800, + "start": 5806, + "end": 5808, "loc": { "start": { "line": 138, @@ -15093,8 +15093,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 5801, - "end": 5809, + "start": 5809, + "end": 5817, "loc": { "start": { "line": 138, @@ -15113,8 +15113,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 5811, - "end": 5899, + "start": 5819, + "end": 5907, "loc": { "start": { "line": 138, @@ -15132,8 +15132,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5817, - "end": 5899, + "start": 5825, + "end": 5907, "loc": { "start": { "line": 138, @@ -15147,8 +15147,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5831, - "end": 5857, + "start": 5839, + "end": 5865, "loc": { "start": { "line": 139, @@ -15161,8 +15161,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5831, - "end": 5856, + "start": 5839, + "end": 5864, "loc": { "start": { "line": 139, @@ -15176,8 +15176,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5831, - "end": 5849, + "start": 5839, + "end": 5857, "loc": { "start": { "line": 139, @@ -15190,8 +15190,8 @@ }, "object": { "type": "ThisExpression", - "start": 5831, - "end": 5835, + "start": 5839, + "end": 5843, "loc": { "start": { "line": 139, @@ -15205,8 +15205,8 @@ }, "property": { "type": "Identifier", - "start": 5836, - "end": 5849, + "start": 5844, + "end": 5857, "loc": { "start": { "line": 139, @@ -15224,8 +15224,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 5852, - "end": 5856, + "start": 5860, + "end": 5864, "loc": { "start": { "line": 139, @@ -15242,8 +15242,8 @@ }, { "type": "ExpressionStatement", - "start": 5870, - "end": 5889, + "start": 5878, + "end": 5897, "loc": { "start": { "line": 140, @@ -15256,8 +15256,8 @@ }, "expression": { "type": "CallExpression", - "start": 5870, - "end": 5888, + "start": 5878, + "end": 5896, "loc": { "start": { "line": 140, @@ -15270,8 +15270,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5870, - "end": 5886, + "start": 5878, + "end": 5894, "loc": { "start": { "line": 140, @@ -15284,8 +15284,8 @@ }, "object": { "type": "ThisExpression", - "start": 5870, - "end": 5874, + "start": 5878, + "end": 5882, "loc": { "start": { "line": 140, @@ -15299,8 +15299,8 @@ }, "property": { "type": "Identifier", - "start": 5875, - "end": 5886, + "start": 5883, + "end": 5894, "loc": { "start": { "line": 140, @@ -15329,8 +15329,8 @@ }, { "type": "ExpressionStatement", - "start": 5911, - "end": 6065, + "start": 5919, + "end": 6073, "loc": { "start": { "line": 143, @@ -15343,8 +15343,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5911, - "end": 6064, + "start": 5919, + "end": 6072, "loc": { "start": { "line": 143, @@ -15358,8 +15358,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5911, - "end": 5935, + "start": 5919, + "end": 5943, "loc": { "start": { "line": 143, @@ -15372,8 +15372,8 @@ }, "object": { "type": "ThisExpression", - "start": 5911, - "end": 5915, + "start": 5919, + "end": 5923, "loc": { "start": { "line": 143, @@ -15387,8 +15387,8 @@ }, "property": { "type": "Identifier", - "start": 5916, - "end": 5935, + "start": 5924, + "end": 5943, "loc": { "start": { "line": 143, @@ -15406,8 +15406,8 @@ }, "right": { "type": "CallExpression", - "start": 5938, - "end": 6064, + "start": 5946, + "end": 6072, "loc": { "start": { "line": 143, @@ -15420,8 +15420,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5938, - "end": 5958, + "start": 5946, + "end": 5966, "loc": { "start": { "line": 143, @@ -15434,8 +15434,8 @@ }, "object": { "type": "MemberExpression", - "start": 5938, - "end": 5955, + "start": 5946, + "end": 5963, "loc": { "start": { "line": 143, @@ -15448,8 +15448,8 @@ }, "object": { "type": "MemberExpression", - "start": 5938, - "end": 5948, + "start": 5946, + "end": 5956, "loc": { "start": { "line": 143, @@ -15462,8 +15462,8 @@ }, "object": { "type": "ThisExpression", - "start": 5938, - "end": 5942, + "start": 5946, + "end": 5950, "loc": { "start": { "line": 143, @@ -15477,8 +15477,8 @@ }, "property": { "type": "Identifier", - "start": 5943, - "end": 5948, + "start": 5951, + "end": 5956, "loc": { "start": { "line": 143, @@ -15496,8 +15496,8 @@ }, "property": { "type": "Identifier", - "start": 5949, - "end": 5955, + "start": 5957, + "end": 5963, "loc": { "start": { "line": 143, @@ -15515,8 +15515,8 @@ }, "property": { "type": "Identifier", - "start": 5956, - "end": 5958, + "start": 5964, + "end": 5966, "loc": { "start": { "line": 143, @@ -15535,8 +15535,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 5959, - "end": 5971, + "start": 5967, + "end": 5979, "loc": { "start": { "line": 143, @@ -15555,8 +15555,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 5973, - "end": 6063, + "start": 5981, + "end": 6071, "loc": { "start": { "line": 143, @@ -15574,8 +15574,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5979, - "end": 6063, + "start": 5987, + "end": 6071, "loc": { "start": { "line": 143, @@ -15589,8 +15589,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5993, - "end": 6021, + "start": 6001, + "end": 6029, "loc": { "start": { "line": 144, @@ -15603,8 +15603,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5993, - "end": 6020, + "start": 6001, + "end": 6028, "loc": { "start": { "line": 144, @@ -15618,8 +15618,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5993, - "end": 6013, + "start": 6001, + "end": 6021, "loc": { "start": { "line": 144, @@ -15632,8 +15632,8 @@ }, "object": { "type": "ThisExpression", - "start": 5993, - "end": 5997, + "start": 6001, + "end": 6005, "loc": { "start": { "line": 144, @@ -15647,8 +15647,8 @@ }, "property": { "type": "Identifier", - "start": 5998, - "end": 6013, + "start": 6006, + "end": 6021, "loc": { "start": { "line": 144, @@ -15666,8 +15666,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6016, - "end": 6020, + "start": 6024, + "end": 6028, "loc": { "start": { "line": 144, @@ -15684,8 +15684,8 @@ }, { "type": "ExpressionStatement", - "start": 6034, - "end": 6053, + "start": 6042, + "end": 6061, "loc": { "start": { "line": 145, @@ -15698,8 +15698,8 @@ }, "expression": { "type": "CallExpression", - "start": 6034, - "end": 6052, + "start": 6042, + "end": 6060, "loc": { "start": { "line": 145, @@ -15712,8 +15712,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6034, - "end": 6050, + "start": 6042, + "end": 6058, "loc": { "start": { "line": 145, @@ -15726,8 +15726,8 @@ }, "object": { "type": "ThisExpression", - "start": 6034, - "end": 6038, + "start": 6042, + "end": 6046, "loc": { "start": { "line": 145, @@ -15741,8 +15741,8 @@ }, "property": { "type": "Identifier", - "start": 6039, - "end": 6050, + "start": 6047, + "end": 6058, "loc": { "start": { "line": 145, @@ -15771,8 +15771,8 @@ }, { "type": "ExpressionStatement", - "start": 6075, - "end": 6106, + "start": 6083, + "end": 6114, "loc": { "start": { "line": 148, @@ -15785,8 +15785,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6075, - "end": 6105, + "start": 6083, + "end": 6113, "loc": { "start": { "line": 148, @@ -15800,8 +15800,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6075, - "end": 6098, + "start": 6083, + "end": 6106, "loc": { "start": { "line": 148, @@ -15814,8 +15814,8 @@ }, "object": { "type": "ThisExpression", - "start": 6075, - "end": 6079, + "start": 6083, + "end": 6087, "loc": { "start": { "line": 148, @@ -15829,8 +15829,8 @@ }, "property": { "type": "Identifier", - "start": 6080, - "end": 6098, + "start": 6088, + "end": 6106, "loc": { "start": { "line": 148, @@ -15848,8 +15848,8 @@ }, "right": { "type": "NullLiteral", - "start": 6101, - "end": 6105, + "start": 6109, + "end": 6113, "loc": { "start": { "line": 148, @@ -15865,8 +15865,8 @@ }, { "type": "ExpressionStatement", - "start": 6115, - "end": 6151, + "start": 6123, + "end": 6159, "loc": { "start": { "line": 149, @@ -15879,8 +15879,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6115, - "end": 6150, + "start": 6123, + "end": 6158, "loc": { "start": { "line": 149, @@ -15894,8 +15894,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6115, - "end": 6143, + "start": 6123, + "end": 6151, "loc": { "start": { "line": 149, @@ -15908,8 +15908,8 @@ }, "object": { "type": "ThisExpression", - "start": 6115, - "end": 6119, + "start": 6123, + "end": 6127, "loc": { "start": { "line": 149, @@ -15923,8 +15923,8 @@ }, "property": { "type": "Identifier", - "start": 6120, - "end": 6143, + "start": 6128, + "end": 6151, "loc": { "start": { "line": 149, @@ -15942,8 +15942,8 @@ }, "right": { "type": "NullLiteral", - "start": 6146, - "end": 6150, + "start": 6154, + "end": 6158, "loc": { "start": { "line": 149, @@ -15959,8 +15959,8 @@ }, { "type": "ExpressionStatement", - "start": 6161, - "end": 6192, + "start": 6169, + "end": 6200, "loc": { "start": { "line": 151, @@ -15973,8 +15973,8 @@ }, "expression": { "type": "CallExpression", - "start": 6161, - "end": 6191, + "start": 6169, + "end": 6199, "loc": { "start": { "line": 151, @@ -15987,8 +15987,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6161, - "end": 6185, + "start": 6169, + "end": 6193, "loc": { "start": { "line": 151, @@ -16001,8 +16001,8 @@ }, "object": { "type": "MemberExpression", - "start": 6161, - "end": 6175, + "start": 6169, + "end": 6183, "loc": { "start": { "line": 151, @@ -16015,8 +16015,8 @@ }, "object": { "type": "ThisExpression", - "start": 6161, - "end": 6165, + "start": 6169, + "end": 6173, "loc": { "start": { "line": 151, @@ -16030,8 +16030,8 @@ }, "property": { "type": "Identifier", - "start": 6166, - "end": 6175, + "start": 6174, + "end": 6183, "loc": { "start": { "line": 151, @@ -16049,8 +16049,8 @@ }, "property": { "type": "Identifier", - "start": 6176, - "end": 6185, + "start": 6184, + "end": 6193, "loc": { "start": { "line": 151, @@ -16069,8 +16069,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 6186, - "end": 6190, + "start": 6194, + "end": 6198, "loc": { "start": { "line": 151, @@ -16087,8 +16087,8 @@ }, { "type": "ExpressionStatement", - "start": 6202, - "end": 6227, + "start": 6210, + "end": 6235, "loc": { "start": { "line": 153, @@ -16101,8 +16101,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6202, - "end": 6226, + "start": 6210, + "end": 6234, "loc": { "start": { "line": 153, @@ -16116,8 +16116,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6202, - "end": 6213, + "start": 6210, + "end": 6221, "loc": { "start": { "line": 153, @@ -16130,8 +16130,8 @@ }, "object": { "type": "ThisExpression", - "start": 6202, - "end": 6206, + "start": 6210, + "end": 6214, "loc": { "start": { "line": 153, @@ -16145,8 +16145,8 @@ }, "property": { "type": "Identifier", - "start": 6207, - "end": 6213, + "start": 6215, + "end": 6221, "loc": { "start": { "line": 153, @@ -16164,8 +16164,8 @@ }, "right": { "type": "MemberExpression", - "start": 6216, - "end": 6226, + "start": 6224, + "end": 6234, "loc": { "start": { "line": 153, @@ -16178,8 +16178,8 @@ }, "object": { "type": "Identifier", - "start": 6216, - "end": 6219, + "start": 6224, + "end": 6227, "loc": { "start": { "line": 153, @@ -16195,8 +16195,8 @@ }, "property": { "type": "Identifier", - "start": 6220, - "end": 6226, + "start": 6228, + "end": 6234, "loc": { "start": { "line": 153, @@ -16216,8 +16216,8 @@ }, { "type": "ExpressionStatement", - "start": 6236, - "end": 6265, + "start": 6244, + "end": 6273, "loc": { "start": { "line": 154, @@ -16230,8 +16230,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6236, - "end": 6264, + "start": 6244, + "end": 6272, "loc": { "start": { "line": 154, @@ -16245,8 +16245,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6236, - "end": 6249, + "start": 6244, + "end": 6257, "loc": { "start": { "line": 154, @@ -16259,8 +16259,8 @@ }, "object": { "type": "ThisExpression", - "start": 6236, - "end": 6240, + "start": 6244, + "end": 6248, "loc": { "start": { "line": 154, @@ -16274,8 +16274,8 @@ }, "property": { "type": "Identifier", - "start": 6241, - "end": 6249, + "start": 6249, + "end": 6257, "loc": { "start": { "line": 154, @@ -16293,8 +16293,8 @@ }, "right": { "type": "MemberExpression", - "start": 6252, - "end": 6264, + "start": 6260, + "end": 6272, "loc": { "start": { "line": 154, @@ -16307,8 +16307,8 @@ }, "object": { "type": "Identifier", - "start": 6252, - "end": 6255, + "start": 6260, + "end": 6263, "loc": { "start": { "line": 154, @@ -16324,8 +16324,8 @@ }, "property": { "type": "Identifier", - "start": 6256, - "end": 6264, + "start": 6264, + "end": 6272, "loc": { "start": { "line": 154, @@ -16345,8 +16345,8 @@ }, { "type": "ExpressionStatement", - "start": 6274, - "end": 6307, + "start": 6282, + "end": 6315, "loc": { "start": { "line": 155, @@ -16359,8 +16359,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6274, - "end": 6306, + "start": 6282, + "end": 6314, "loc": { "start": { "line": 155, @@ -16374,8 +16374,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6274, - "end": 6289, + "start": 6282, + "end": 6297, "loc": { "start": { "line": 155, @@ -16388,8 +16388,8 @@ }, "object": { "type": "ThisExpression", - "start": 6274, - "end": 6278, + "start": 6282, + "end": 6286, "loc": { "start": { "line": 155, @@ -16403,8 +16403,8 @@ }, "property": { "type": "Identifier", - "start": 6279, - "end": 6289, + "start": 6287, + "end": 6297, "loc": { "start": { "line": 155, @@ -16422,8 +16422,8 @@ }, "right": { "type": "MemberExpression", - "start": 6292, - "end": 6306, + "start": 6300, + "end": 6314, "loc": { "start": { "line": 155, @@ -16436,8 +16436,8 @@ }, "object": { "type": "Identifier", - "start": 6292, - "end": 6295, + "start": 6300, + "end": 6303, "loc": { "start": { "line": 155, @@ -16453,8 +16453,8 @@ }, "property": { "type": "Identifier", - "start": 6296, - "end": 6306, + "start": 6304, + "end": 6314, "loc": { "start": { "line": 155, @@ -16479,8 +16479,8 @@ { "type": "CommentBlock", "value": "*\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n ", - "start": 4600, - "end": 5405, + "start": 4608, + "end": 5413, "loc": { "start": { "line": 116, @@ -16496,8 +16496,8 @@ }, { "type": "ClassMethod", - "start": 6319, - "end": 7198, + "start": 6327, + "end": 7206, "loc": { "start": { "line": 158, @@ -16512,8 +16512,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 6319, - "end": 6326, + "start": 6327, + "end": 6334, "loc": { "start": { "line": 158, @@ -16535,8 +16535,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6329, - "end": 7198, + "start": 6337, + "end": 7206, "loc": { "start": { "line": 158, @@ -16550,8 +16550,8 @@ "body": [ { "type": "IfStatement", - "start": 6390, - "end": 6650, + "start": 6398, + "end": 6658, "loc": { "start": { "line": 159, @@ -16564,8 +16564,8 @@ }, "test": { "type": "MemberExpression", - "start": 6394, - "end": 6412, + "start": 6402, + "end": 6420, "loc": { "start": { "line": 159, @@ -16578,8 +16578,8 @@ }, "object": { "type": "ThisExpression", - "start": 6394, - "end": 6398, + "start": 6402, + "end": 6406, "loc": { "start": { "line": 159, @@ -16594,8 +16594,8 @@ }, "property": { "type": "Identifier", - "start": 6399, - "end": 6412, + "start": 6407, + "end": 6420, "loc": { "start": { "line": 159, @@ -16614,8 +16614,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 6414, - "end": 6650, + "start": 6422, + "end": 6658, "loc": { "start": { "line": 159, @@ -16629,8 +16629,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6428, - "end": 6510, + "start": 6436, + "end": 6518, "loc": { "start": { "line": 160, @@ -16643,8 +16643,8 @@ }, "expression": { "type": "CallExpression", - "start": 6428, - "end": 6509, + "start": 6436, + "end": 6517, "loc": { "start": { "line": 160, @@ -16657,8 +16657,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6428, - "end": 6448, + "start": 6436, + "end": 6456, "loc": { "start": { "line": 160, @@ -16671,8 +16671,8 @@ }, "object": { "type": "Identifier", - "start": 6428, - "end": 6432, + "start": 6436, + "end": 6440, "loc": { "start": { "line": 160, @@ -16688,8 +16688,8 @@ }, "property": { "type": "Identifier", - "start": 6433, - "end": 6448, + "start": 6441, + "end": 6456, "loc": { "start": { "line": 160, @@ -16708,8 +16708,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6449, - "end": 6477, + "start": 6457, + "end": 6485, "loc": { "start": { "line": 160, @@ -16722,8 +16722,8 @@ }, "object": { "type": "MemberExpression", - "start": 6449, - "end": 6466, + "start": 6457, + "end": 6474, "loc": { "start": { "line": 160, @@ -16736,8 +16736,8 @@ }, "object": { "type": "MemberExpression", - "start": 6449, - "end": 6459, + "start": 6457, + "end": 6467, "loc": { "start": { "line": 160, @@ -16750,8 +16750,8 @@ }, "object": { "type": "ThisExpression", - "start": 6449, - "end": 6453, + "start": 6457, + "end": 6461, "loc": { "start": { "line": 160, @@ -16765,8 +16765,8 @@ }, "property": { "type": "Identifier", - "start": 6454, - "end": 6459, + "start": 6462, + "end": 6467, "loc": { "start": { "line": 160, @@ -16784,8 +16784,8 @@ }, "property": { "type": "Identifier", - "start": 6460, - "end": 6466, + "start": 6468, + "end": 6474, "loc": { "start": { "line": 160, @@ -16803,8 +16803,8 @@ }, "property": { "type": "Identifier", - "start": 6467, - "end": 6477, + "start": 6475, + "end": 6485, "loc": { "start": { "line": 160, @@ -16822,8 +16822,8 @@ }, { "type": "MemberExpression", - "start": 6479, - "end": 6493, + "start": 6487, + "end": 6501, "loc": { "start": { "line": 160, @@ -16836,8 +16836,8 @@ }, "object": { "type": "ThisExpression", - "start": 6479, - "end": 6483, + "start": 6487, + "end": 6491, "loc": { "start": { "line": 160, @@ -16851,8 +16851,8 @@ }, "property": { "type": "Identifier", - "start": 6484, - "end": 6493, + "start": 6492, + "end": 6501, "loc": { "start": { "line": 160, @@ -16870,8 +16870,8 @@ }, { "type": "MemberExpression", - "start": 6495, - "end": 6508, + "start": 6503, + "end": 6516, "loc": { "start": { "line": 160, @@ -16884,8 +16884,8 @@ }, "object": { "type": "ThisExpression", - "start": 6495, - "end": 6499, + "start": 6503, + "end": 6507, "loc": { "start": { "line": 160, @@ -16899,8 +16899,8 @@ }, "property": { "type": "Identifier", - "start": 6500, - "end": 6508, + "start": 6508, + "end": 6516, "loc": { "start": { "line": 160, @@ -16921,8 +16921,8 @@ }, { "type": "ExpressionStatement", - "start": 6523, - "end": 6550, + "start": 6531, + "end": 6558, "loc": { "start": { "line": 161, @@ -16935,8 +16935,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6523, - "end": 6549, + "start": 6531, + "end": 6557, "loc": { "start": { "line": 161, @@ -16950,8 +16950,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6523, - "end": 6541, + "start": 6531, + "end": 6549, "loc": { "start": { "line": 161, @@ -16964,8 +16964,8 @@ }, "object": { "type": "ThisExpression", - "start": 6523, - "end": 6527, + "start": 6531, + "end": 6535, "loc": { "start": { "line": 161, @@ -16979,8 +16979,8 @@ }, "property": { "type": "Identifier", - "start": 6528, - "end": 6541, + "start": 6536, + "end": 6549, "loc": { "start": { "line": 161, @@ -16998,8 +16998,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6544, - "end": 6549, + "start": 6552, + "end": 6557, "loc": { "start": { "line": 161, @@ -17016,8 +17016,8 @@ }, { "type": "ExpressionStatement", - "start": 6563, - "end": 6591, + "start": 6571, + "end": 6599, "loc": { "start": { "line": 162, @@ -17030,8 +17030,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6563, - "end": 6590, + "start": 6571, + "end": 6598, "loc": { "start": { "line": 162, @@ -17045,8 +17045,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6563, - "end": 6583, + "start": 6571, + "end": 6591, "loc": { "start": { "line": 162, @@ -17059,8 +17059,8 @@ }, "object": { "type": "ThisExpression", - "start": 6563, - "end": 6567, + "start": 6571, + "end": 6575, "loc": { "start": { "line": 162, @@ -17074,8 +17074,8 @@ }, "property": { "type": "Identifier", - "start": 6568, - "end": 6583, + "start": 6576, + "end": 6591, "loc": { "start": { "line": 162, @@ -17093,8 +17093,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6586, - "end": 6590, + "start": 6594, + "end": 6598, "loc": { "start": { "line": 162, @@ -17111,8 +17111,8 @@ }, { "type": "ExpressionStatement", - "start": 6604, - "end": 6640, + "start": 6612, + "end": 6648, "loc": { "start": { "line": 163, @@ -17125,8 +17125,8 @@ }, "expression": { "type": "CallExpression", - "start": 6604, - "end": 6639, + "start": 6612, + "end": 6647, "loc": { "start": { "line": 163, @@ -17139,8 +17139,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6604, - "end": 6613, + "start": 6612, + "end": 6621, "loc": { "start": { "line": 163, @@ -17153,8 +17153,8 @@ }, "object": { "type": "ThisExpression", - "start": 6604, - "end": 6608, + "start": 6612, + "end": 6616, "loc": { "start": { "line": 163, @@ -17168,8 +17168,8 @@ }, "property": { "type": "Identifier", - "start": 6609, - "end": 6613, + "start": 6617, + "end": 6621, "loc": { "start": { "line": 163, @@ -17188,8 +17188,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 6614, - "end": 6623, + "start": 6622, + "end": 6631, "loc": { "start": { "line": 163, @@ -17208,8 +17208,8 @@ }, { "type": "MemberExpression", - "start": 6625, - "end": 6638, + "start": 6633, + "end": 6646, "loc": { "start": { "line": 163, @@ -17222,8 +17222,8 @@ }, "object": { "type": "ThisExpression", - "start": 6625, - "end": 6629, + "start": 6633, + "end": 6637, "loc": { "start": { "line": 163, @@ -17237,8 +17237,8 @@ }, "property": { "type": "Identifier", - "start": 6630, - "end": 6638, + "start": 6638, + "end": 6646, "loc": { "start": { "line": 163, @@ -17265,8 +17265,8 @@ { "type": "CommentLine", "value": " this._needUpdate() schedules this for next tick", - "start": 6331, - "end": 6381, + "start": 6339, + "end": 6389, "loc": { "start": { "line": 158, @@ -17282,8 +17282,8 @@ }, { "type": "IfStatement", - "start": 6659, - "end": 7192, + "start": 6667, + "end": 7200, "loc": { "start": { "line": 165, @@ -17296,8 +17296,8 @@ }, "test": { "type": "MemberExpression", - "start": 6663, - "end": 6683, + "start": 6671, + "end": 6691, "loc": { "start": { "line": 165, @@ -17310,8 +17310,8 @@ }, "object": { "type": "ThisExpression", - "start": 6663, - "end": 6667, + "start": 6671, + "end": 6675, "loc": { "start": { "line": 165, @@ -17325,8 +17325,8 @@ }, "property": { "type": "Identifier", - "start": 6668, - "end": 6683, + "start": 6676, + "end": 6691, "loc": { "start": { "line": 165, @@ -17344,8 +17344,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 6685, - "end": 7192, + "start": 6693, + "end": 7200, "loc": { "start": { "line": 165, @@ -17359,8 +17359,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6699, - "end": 6728, + "start": 6707, + "end": 6736, "loc": { "start": { "line": 166, @@ -17373,8 +17373,8 @@ }, "expression": { "type": "CallExpression", - "start": 6699, - "end": 6727, + "start": 6707, + "end": 6735, "loc": { "start": { "line": 166, @@ -17387,8 +17387,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6699, - "end": 6712, + "start": 6707, + "end": 6720, "loc": { "start": { "line": 166, @@ -17401,8 +17401,8 @@ }, "object": { "type": "Identifier", - "start": 6699, - "end": 6708, + "start": 6707, + "end": 6716, "loc": { "start": { "line": 166, @@ -17418,8 +17418,8 @@ }, "property": { "type": "Identifier", - "start": 6709, - "end": 6712, + "start": 6717, + "end": 6720, "loc": { "start": { "line": 166, @@ -17438,8 +17438,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6713, - "end": 6726, + "start": 6721, + "end": 6734, "loc": { "start": { "line": 166, @@ -17452,8 +17452,8 @@ }, "object": { "type": "ThisExpression", - "start": 6713, - "end": 6717, + "start": 6721, + "end": 6725, "loc": { "start": { "line": 166, @@ -17467,8 +17467,8 @@ }, "property": { "type": "Identifier", - "start": 6718, - "end": 6726, + "start": 6726, + "end": 6734, "loc": { "start": { "line": 166, @@ -17489,8 +17489,8 @@ }, { "type": "ExpressionStatement", - "start": 6741, - "end": 6760, + "start": 6749, + "end": 6768, "loc": { "start": { "line": 167, @@ -17503,8 +17503,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6741, - "end": 6759, + "start": 6749, + "end": 6767, "loc": { "start": { "line": 167, @@ -17518,8 +17518,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6741, - "end": 6753, + "start": 6749, + "end": 6761, "loc": { "start": { "line": 167, @@ -17532,8 +17532,8 @@ }, "object": { "type": "Identifier", - "start": 6741, - "end": 6750, + "start": 6749, + "end": 6758, "loc": { "start": { "line": 167, @@ -17549,8 +17549,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6751, - "end": 6752, + "start": 6759, + "end": 6760, "loc": { "start": { "line": 167, @@ -17571,8 +17571,8 @@ }, "right": { "type": "NumericLiteral", - "start": 6756, - "end": 6759, + "start": 6764, + "end": 6767, "loc": { "start": { "line": 167, @@ -17593,8 +17593,8 @@ }, { "type": "ExpressionStatement", - "start": 6773, - "end": 6846, + "start": 6781, + "end": 6854, "loc": { "start": { "line": 168, @@ -17607,8 +17607,8 @@ }, "expression": { "type": "CallExpression", - "start": 6773, - "end": 6845, + "start": 6781, + "end": 6853, "loc": { "start": { "line": 168, @@ -17621,8 +17621,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6773, - "end": 6793, + "start": 6781, + "end": 6801, "loc": { "start": { "line": 168, @@ -17635,8 +17635,8 @@ }, "object": { "type": "Identifier", - "start": 6773, - "end": 6777, + "start": 6781, + "end": 6785, "loc": { "start": { "line": 168, @@ -17652,8 +17652,8 @@ }, "property": { "type": "Identifier", - "start": 6778, - "end": 6793, + "start": 6786, + "end": 6801, "loc": { "start": { "line": 168, @@ -17672,8 +17672,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6794, - "end": 6822, + "start": 6802, + "end": 6830, "loc": { "start": { "line": 168, @@ -17686,8 +17686,8 @@ }, "object": { "type": "MemberExpression", - "start": 6794, - "end": 6811, + "start": 6802, + "end": 6819, "loc": { "start": { "line": 168, @@ -17700,8 +17700,8 @@ }, "object": { "type": "MemberExpression", - "start": 6794, - "end": 6804, + "start": 6802, + "end": 6812, "loc": { "start": { "line": 168, @@ -17714,8 +17714,8 @@ }, "object": { "type": "ThisExpression", - "start": 6794, - "end": 6798, + "start": 6802, + "end": 6806, "loc": { "start": { "line": 168, @@ -17729,8 +17729,8 @@ }, "property": { "type": "Identifier", - "start": 6799, - "end": 6804, + "start": 6807, + "end": 6812, "loc": { "start": { "line": 168, @@ -17748,8 +17748,8 @@ }, "property": { "type": "Identifier", - "start": 6805, - "end": 6811, + "start": 6813, + "end": 6819, "loc": { "start": { "line": 168, @@ -17767,8 +17767,8 @@ }, "property": { "type": "Identifier", - "start": 6812, - "end": 6822, + "start": 6820, + "end": 6830, "loc": { "start": { "line": 168, @@ -17786,8 +17786,8 @@ }, { "type": "Identifier", - "start": 6824, - "end": 6833, + "start": 6832, + "end": 6841, "loc": { "start": { "line": 168, @@ -17803,8 +17803,8 @@ }, { "type": "Identifier", - "start": 6835, - "end": 6844, + "start": 6843, + "end": 6852, "loc": { "start": { "line": 168, @@ -17823,8 +17823,8 @@ }, { "type": "VariableDeclaration", - "start": 6859, - "end": 6899, + "start": 6867, + "end": 6907, "loc": { "start": { "line": 169, @@ -17838,8 +17838,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 6865, - "end": 6898, + "start": 6873, + "end": 6906, "loc": { "start": { "line": 169, @@ -17852,8 +17852,8 @@ }, "id": { "type": "Identifier", - "start": 6865, - "end": 6869, + "start": 6873, + "end": 6877, "loc": { "start": { "line": 169, @@ -17869,8 +17869,8 @@ }, "init": { "type": "MemberExpression", - "start": 6872, - "end": 6898, + "start": 6880, + "end": 6906, "loc": { "start": { "line": 169, @@ -17883,8 +17883,8 @@ }, "object": { "type": "MemberExpression", - "start": 6872, - "end": 6889, + "start": 6880, + "end": 6897, "loc": { "start": { "line": 169, @@ -17897,8 +17897,8 @@ }, "object": { "type": "MemberExpression", - "start": 6872, - "end": 6882, + "start": 6880, + "end": 6890, "loc": { "start": { "line": 169, @@ -17911,8 +17911,8 @@ }, "object": { "type": "ThisExpression", - "start": 6872, - "end": 6876, + "start": 6880, + "end": 6884, "loc": { "start": { "line": 169, @@ -17926,8 +17926,8 @@ }, "property": { "type": "Identifier", - "start": 6877, - "end": 6882, + "start": 6885, + "end": 6890, "loc": { "start": { "line": 169, @@ -17945,8 +17945,8 @@ }, "property": { "type": "Identifier", - "start": 6883, - "end": 6889, + "start": 6891, + "end": 6897, "loc": { "start": { "line": 169, @@ -17964,8 +17964,8 @@ }, "property": { "type": "Identifier", - "start": 6890, - "end": 6898, + "start": 6898, + "end": 6906, "loc": { "start": { "line": 169, @@ -17987,8 +17987,8 @@ }, { "type": "ExpressionStatement", - "start": 6912, - "end": 6993, + "start": 6920, + "end": 7001, "loc": { "start": { "line": 170, @@ -18001,8 +18001,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6912, - "end": 6992, + "start": 6920, + "end": 7000, "loc": { "start": { "line": 170, @@ -18016,8 +18016,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6912, - "end": 6930, + "start": 6920, + "end": 6938, "loc": { "start": { "line": 170, @@ -18030,8 +18030,8 @@ }, "object": { "type": "MemberExpression", - "start": 6912, - "end": 6927, + "start": 6920, + "end": 6935, "loc": { "start": { "line": 170, @@ -18044,8 +18044,8 @@ }, "object": { "type": "ThisExpression", - "start": 6912, - "end": 6916, + "start": 6920, + "end": 6924, "loc": { "start": { "line": 170, @@ -18059,8 +18059,8 @@ }, "property": { "type": "Identifier", - "start": 6917, - "end": 6927, + "start": 6925, + "end": 6935, "loc": { "start": { "line": 170, @@ -18078,8 +18078,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6928, - "end": 6929, + "start": 6936, + "end": 6937, "loc": { "start": { "line": 170, @@ -18100,8 +18100,8 @@ }, "right": { "type": "CallExpression", - "start": 6933, - "end": 6992, + "start": 6941, + "end": 7000, "loc": { "start": { "line": 170, @@ -18114,8 +18114,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6933, - "end": 6943, + "start": 6941, + "end": 6951, "loc": { "start": { "line": 170, @@ -18128,8 +18128,8 @@ }, "object": { "type": "Identifier", - "start": 6933, - "end": 6937, + "start": 6941, + "end": 6945, "loc": { "start": { "line": 170, @@ -18145,8 +18145,8 @@ }, "property": { "type": "Identifier", - "start": 6938, - "end": 6943, + "start": 6946, + "end": 6951, "loc": { "start": { "line": 170, @@ -18165,8 +18165,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 6944, - "end": 6991, + "start": 6952, + "end": 6999, "loc": { "start": { "line": 170, @@ -18179,8 +18179,8 @@ }, "left": { "type": "BinaryExpression", - "start": 6944, - "end": 6987, + "start": 6952, + "end": 6995, "loc": { "start": { "line": 170, @@ -18193,8 +18193,8 @@ }, "left": { "type": "BinaryExpression", - "start": 6945, - "end": 6976, + "start": 6953, + "end": 6984, "loc": { "start": { "line": 170, @@ -18207,8 +18207,8 @@ }, "left": { "type": "NumericLiteral", - "start": 6945, - "end": 6946, + "start": 6953, + "end": 6954, "loc": { "start": { "line": 170, @@ -18228,8 +18228,8 @@ "operator": "+", "right": { "type": "BinaryExpression", - "start": 6949, - "end": 6976, + "start": 6957, + "end": 6984, "loc": { "start": { "line": 170, @@ -18242,8 +18242,8 @@ }, "left": { "type": "MemberExpression", - "start": 6949, - "end": 6961, + "start": 6957, + "end": 6969, "loc": { "start": { "line": 170, @@ -18256,8 +18256,8 @@ }, "object": { "type": "Identifier", - "start": 6949, - "end": 6958, + "start": 6957, + "end": 6966, "loc": { "start": { "line": 170, @@ -18273,8 +18273,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6959, - "end": 6960, + "start": 6967, + "end": 6968, "loc": { "start": { "line": 170, @@ -18296,8 +18296,8 @@ "operator": "/", "right": { "type": "MemberExpression", - "start": 6964, - "end": 6976, + "start": 6972, + "end": 6984, "loc": { "start": { "line": 170, @@ -18310,8 +18310,8 @@ }, "object": { "type": "Identifier", - "start": 6964, - "end": 6973, + "start": 6972, + "end": 6981, "loc": { "start": { "line": 170, @@ -18327,8 +18327,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6974, - "end": 6975, + "start": 6982, + "end": 6983, "loc": { "start": { "line": 170, @@ -18350,14 +18350,14 @@ }, "extra": { "parenthesized": true, - "parenStart": 6944 + "parenStart": 6952 } }, "operator": "*", "right": { "type": "MemberExpression", - "start": 6980, - "end": 6987, + "start": 6988, + "end": 6995, "loc": { "start": { "line": 170, @@ -18370,8 +18370,8 @@ }, "object": { "type": "Identifier", - "start": 6980, - "end": 6984, + "start": 6988, + "end": 6992, "loc": { "start": { "line": 170, @@ -18387,8 +18387,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6985, - "end": 6986, + "start": 6993, + "end": 6994, "loc": { "start": { "line": 170, @@ -18411,8 +18411,8 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 6990, - "end": 6991, + "start": 6998, + "end": 6999, "loc": { "start": { "line": 170, @@ -18436,8 +18436,8 @@ }, { "type": "ExpressionStatement", - "start": 7006, - "end": 7087, + "start": 7014, + "end": 7095, "loc": { "start": { "line": 171, @@ -18450,8 +18450,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7006, - "end": 7086, + "start": 7014, + "end": 7094, "loc": { "start": { "line": 171, @@ -18465,8 +18465,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7006, - "end": 7024, + "start": 7014, + "end": 7032, "loc": { "start": { "line": 171, @@ -18479,8 +18479,8 @@ }, "object": { "type": "MemberExpression", - "start": 7006, - "end": 7021, + "start": 7014, + "end": 7029, "loc": { "start": { "line": 171, @@ -18493,8 +18493,8 @@ }, "object": { "type": "ThisExpression", - "start": 7006, - "end": 7010, + "start": 7014, + "end": 7018, "loc": { "start": { "line": 171, @@ -18508,8 +18508,8 @@ }, "property": { "type": "Identifier", - "start": 7011, - "end": 7021, + "start": 7019, + "end": 7029, "loc": { "start": { "line": 171, @@ -18527,8 +18527,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7022, - "end": 7023, + "start": 7030, + "end": 7031, "loc": { "start": { "line": 171, @@ -18549,8 +18549,8 @@ }, "right": { "type": "CallExpression", - "start": 7027, - "end": 7086, + "start": 7035, + "end": 7094, "loc": { "start": { "line": 171, @@ -18563,8 +18563,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7027, - "end": 7037, + "start": 7035, + "end": 7045, "loc": { "start": { "line": 171, @@ -18577,8 +18577,8 @@ }, "object": { "type": "Identifier", - "start": 7027, - "end": 7031, + "start": 7035, + "end": 7039, "loc": { "start": { "line": 171, @@ -18594,8 +18594,8 @@ }, "property": { "type": "Identifier", - "start": 7032, - "end": 7037, + "start": 7040, + "end": 7045, "loc": { "start": { "line": 171, @@ -18614,8 +18614,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 7038, - "end": 7085, + "start": 7046, + "end": 7093, "loc": { "start": { "line": 171, @@ -18628,8 +18628,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7038, - "end": 7081, + "start": 7046, + "end": 7089, "loc": { "start": { "line": 171, @@ -18642,8 +18642,8 @@ }, "left": { "type": "BinaryExpression", - "start": 7039, - "end": 7070, + "start": 7047, + "end": 7078, "loc": { "start": { "line": 171, @@ -18656,8 +18656,8 @@ }, "left": { "type": "NumericLiteral", - "start": 7039, - "end": 7040, + "start": 7047, + "end": 7048, "loc": { "start": { "line": 171, @@ -18677,8 +18677,8 @@ "operator": "-", "right": { "type": "BinaryExpression", - "start": 7043, - "end": 7070, + "start": 7051, + "end": 7078, "loc": { "start": { "line": 171, @@ -18691,8 +18691,8 @@ }, "left": { "type": "MemberExpression", - "start": 7043, - "end": 7055, + "start": 7051, + "end": 7063, "loc": { "start": { "line": 171, @@ -18705,8 +18705,8 @@ }, "object": { "type": "Identifier", - "start": 7043, - "end": 7052, + "start": 7051, + "end": 7060, "loc": { "start": { "line": 171, @@ -18722,8 +18722,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7053, - "end": 7054, + "start": 7061, + "end": 7062, "loc": { "start": { "line": 171, @@ -18745,8 +18745,8 @@ "operator": "/", "right": { "type": "MemberExpression", - "start": 7058, - "end": 7070, + "start": 7066, + "end": 7078, "loc": { "start": { "line": 171, @@ -18759,8 +18759,8 @@ }, "object": { "type": "Identifier", - "start": 7058, - "end": 7067, + "start": 7066, + "end": 7075, "loc": { "start": { "line": 171, @@ -18776,8 +18776,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7068, - "end": 7069, + "start": 7076, + "end": 7077, "loc": { "start": { "line": 171, @@ -18799,14 +18799,14 @@ }, "extra": { "parenthesized": true, - "parenStart": 7038 + "parenStart": 7046 } }, "operator": "*", "right": { "type": "MemberExpression", - "start": 7074, - "end": 7081, + "start": 7082, + "end": 7089, "loc": { "start": { "line": 171, @@ -18819,8 +18819,8 @@ }, "object": { "type": "Identifier", - "start": 7074, - "end": 7078, + "start": 7082, + "end": 7086, "loc": { "start": { "line": 171, @@ -18836,8 +18836,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7079, - "end": 7080, + "start": 7087, + "end": 7088, "loc": { "start": { "line": 171, @@ -18860,8 +18860,8 @@ "operator": "/", "right": { "type": "NumericLiteral", - "start": 7084, - "end": 7085, + "start": 7092, + "end": 7093, "loc": { "start": { "line": 171, @@ -18885,8 +18885,8 @@ }, { "type": "ExpressionStatement", - "start": 7100, - "end": 7129, + "start": 7108, + "end": 7137, "loc": { "start": { "line": 172, @@ -18899,8 +18899,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7100, - "end": 7128, + "start": 7108, + "end": 7136, "loc": { "start": { "line": 172, @@ -18914,8 +18914,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7100, - "end": 7120, + "start": 7108, + "end": 7128, "loc": { "start": { "line": 172, @@ -18928,8 +18928,8 @@ }, "object": { "type": "ThisExpression", - "start": 7100, - "end": 7104, + "start": 7108, + "end": 7112, "loc": { "start": { "line": 172, @@ -18943,8 +18943,8 @@ }, "property": { "type": "Identifier", - "start": 7105, - "end": 7120, + "start": 7113, + "end": 7128, "loc": { "start": { "line": 172, @@ -18962,8 +18962,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 7123, - "end": 7128, + "start": 7131, + "end": 7136, "loc": { "start": { "line": 172, @@ -18980,8 +18980,8 @@ }, { "type": "ExpressionStatement", - "start": 7142, - "end": 7182, + "start": 7150, + "end": 7190, "loc": { "start": { "line": 173, @@ -18994,8 +18994,8 @@ }, "expression": { "type": "CallExpression", - "start": 7142, - "end": 7181, + "start": 7150, + "end": 7189, "loc": { "start": { "line": 173, @@ -19008,8 +19008,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7142, - "end": 7151, + "start": 7150, + "end": 7159, "loc": { "start": { "line": 173, @@ -19022,8 +19022,8 @@ }, "object": { "type": "ThisExpression", - "start": 7142, - "end": 7146, + "start": 7150, + "end": 7154, "loc": { "start": { "line": 173, @@ -19037,8 +19037,8 @@ }, "property": { "type": "Identifier", - "start": 7147, - "end": 7151, + "start": 7155, + "end": 7159, "loc": { "start": { "line": 173, @@ -19057,8 +19057,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 7152, - "end": 7163, + "start": 7160, + "end": 7171, "loc": { "start": { "line": 173, @@ -19077,8 +19077,8 @@ }, { "type": "MemberExpression", - "start": 7165, - "end": 7180, + "start": 7173, + "end": 7188, "loc": { "start": { "line": 173, @@ -19091,8 +19091,8 @@ }, "object": { "type": "ThisExpression", - "start": 7165, - "end": 7169, + "start": 7173, + "end": 7177, "loc": { "start": { "line": 173, @@ -19106,8 +19106,8 @@ }, "property": { "type": "Identifier", - "start": 7170, - "end": 7180, + "start": 7178, + "end": 7188, "loc": { "start": { "line": 173, @@ -19137,8 +19137,8 @@ }, { "type": "ClassMethod", - "start": 7204, - "end": 7450, + "start": 7212, + "end": 7458, "loc": { "start": { "line": 177, @@ -19153,8 +19153,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7204, - "end": 7215, + "start": 7212, + "end": 7223, "loc": { "start": { "line": 177, @@ -19176,8 +19176,8 @@ "params": [ { "type": "Identifier", - "start": 7216, - "end": 7223, + "start": 7224, + "end": 7231, "loc": { "start": { "line": 177, @@ -19194,8 +19194,8 @@ ], "body": { "type": "BlockStatement", - "start": 7225, - "end": 7450, + "start": 7233, + "end": 7458, "loc": { "start": { "line": 177, @@ -19209,8 +19209,8 @@ "body": [ { "type": "IfStatement", - "start": 7300, - "end": 7366, + "start": 7308, + "end": 7374, "loc": { "start": { "line": 178, @@ -19223,8 +19223,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7304, - "end": 7329, + "start": 7312, + "end": 7337, "loc": { "start": { "line": 178, @@ -19237,8 +19237,8 @@ }, "left": { "type": "MemberExpression", - "start": 7304, - "end": 7317, + "start": 7312, + "end": 7325, "loc": { "start": { "line": 178, @@ -19251,8 +19251,8 @@ }, "object": { "type": "ThisExpression", - "start": 7304, - "end": 7308, + "start": 7312, + "end": 7316, "loc": { "start": { "line": 178, @@ -19267,8 +19267,8 @@ }, "property": { "type": "Identifier", - "start": 7309, - "end": 7317, + "start": 7317, + "end": 7325, "loc": { "start": { "line": 178, @@ -19288,8 +19288,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 7322, - "end": 7329, + "start": 7330, + "end": 7337, "loc": { "start": { "line": 178, @@ -19307,8 +19307,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7331, - "end": 7366, + "start": 7339, + "end": 7374, "loc": { "start": { "line": 178, @@ -19326,8 +19326,8 @@ { "type": "CommentLine", "value": " return;", - "start": 7345, - "end": 7356, + "start": 7353, + "end": 7364, "loc": { "start": { "line": 179, @@ -19346,8 +19346,8 @@ { "type": "CommentLine", "value": " Called by VisibilityTester and this._entity.on(\"destroyed\"..)", - "start": 7227, - "end": 7291, + "start": 7235, + "end": 7299, "loc": { "start": { "line": 177, @@ -19363,8 +19363,8 @@ }, { "type": "ExpressionStatement", - "start": 7375, - "end": 7399, + "start": 7383, + "end": 7407, "loc": { "start": { "line": 181, @@ -19377,8 +19377,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7375, - "end": 7398, + "start": 7383, + "end": 7406, "loc": { "start": { "line": 181, @@ -19392,8 +19392,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7375, - "end": 7388, + "start": 7383, + "end": 7396, "loc": { "start": { "line": 181, @@ -19406,8 +19406,8 @@ }, "object": { "type": "ThisExpression", - "start": 7375, - "end": 7379, + "start": 7383, + "end": 7387, "loc": { "start": { "line": 181, @@ -19421,8 +19421,8 @@ }, "property": { "type": "Identifier", - "start": 7380, - "end": 7388, + "start": 7388, + "end": 7396, "loc": { "start": { "line": 181, @@ -19440,8 +19440,8 @@ }, "right": { "type": "Identifier", - "start": 7391, - "end": 7398, + "start": 7399, + "end": 7406, "loc": { "start": { "line": 181, @@ -19459,8 +19459,8 @@ }, { "type": "ExpressionStatement", - "start": 7408, - "end": 7444, + "start": 7416, + "end": 7452, "loc": { "start": { "line": 182, @@ -19473,8 +19473,8 @@ }, "expression": { "type": "CallExpression", - "start": 7408, - "end": 7443, + "start": 7416, + "end": 7451, "loc": { "start": { "line": 182, @@ -19487,8 +19487,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7408, - "end": 7417, + "start": 7416, + "end": 7425, "loc": { "start": { "line": 182, @@ -19501,8 +19501,8 @@ }, "object": { "type": "ThisExpression", - "start": 7408, - "end": 7412, + "start": 7416, + "end": 7420, "loc": { "start": { "line": 182, @@ -19516,8 +19516,8 @@ }, "property": { "type": "Identifier", - "start": 7413, - "end": 7417, + "start": 7421, + "end": 7425, "loc": { "start": { "line": 182, @@ -19536,8 +19536,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 7418, - "end": 7427, + "start": 7426, + "end": 7435, "loc": { "start": { "line": 182, @@ -19556,8 +19556,8 @@ }, { "type": "MemberExpression", - "start": 7429, - "end": 7442, + "start": 7437, + "end": 7450, "loc": { "start": { "line": 182, @@ -19570,8 +19570,8 @@ }, "object": { "type": "ThisExpression", - "start": 7429, - "end": 7433, + "start": 7437, + "end": 7441, "loc": { "start": { "line": 182, @@ -19585,8 +19585,8 @@ }, "property": { "type": "Identifier", - "start": 7434, - "end": 7442, + "start": 7442, + "end": 7450, "loc": { "start": { "line": 182, @@ -19613,8 +19613,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -19630,8 +19630,8 @@ }, { "type": "ClassMethod", - "start": 7732, - "end": 9026, + "start": 7740, + "end": 9034, "loc": { "start": { "line": 193, @@ -19646,8 +19646,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7736, - "end": 7742, + "start": 7744, + "end": 7750, "loc": { "start": { "line": 193, @@ -19669,8 +19669,8 @@ "params": [ { "type": "Identifier", - "start": 7743, - "end": 7749, + "start": 7751, + "end": 7757, "loc": { "start": { "line": 193, @@ -19687,8 +19687,8 @@ ], "body": { "type": "BlockStatement", - "start": 7751, - "end": 9026, + "start": 7759, + "end": 9034, "loc": { "start": { "line": 193, @@ -19702,8 +19702,8 @@ "body": [ { "type": "IfStatement", - "start": 7761, - "end": 8238, + "start": 7769, + "end": 8246, "loc": { "start": { "line": 194, @@ -19716,8 +19716,8 @@ }, "test": { "type": "MemberExpression", - "start": 7765, - "end": 7777, + "start": 7773, + "end": 7785, "loc": { "start": { "line": 194, @@ -19730,8 +19730,8 @@ }, "object": { "type": "ThisExpression", - "start": 7765, - "end": 7769, + "start": 7773, + "end": 7777, "loc": { "start": { "line": 194, @@ -19745,8 +19745,8 @@ }, "property": { "type": "Identifier", - "start": 7770, - "end": 7777, + "start": 7778, + "end": 7785, "loc": { "start": { "line": 194, @@ -19764,8 +19764,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7779, - "end": 8238, + "start": 7787, + "end": 8246, "loc": { "start": { "line": 194, @@ -19779,8 +19779,8 @@ "body": [ { "type": "IfStatement", - "start": 7793, - "end": 7861, + "start": 7801, + "end": 7869, "loc": { "start": { "line": 195, @@ -19793,8 +19793,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7797, - "end": 7820, + "start": 7805, + "end": 7828, "loc": { "start": { "line": 195, @@ -19807,8 +19807,8 @@ }, "left": { "type": "MemberExpression", - "start": 7797, - "end": 7809, + "start": 7805, + "end": 7817, "loc": { "start": { "line": 195, @@ -19821,8 +19821,8 @@ }, "object": { "type": "ThisExpression", - "start": 7797, - "end": 7801, + "start": 7805, + "end": 7809, "loc": { "start": { "line": 195, @@ -19836,8 +19836,8 @@ }, "property": { "type": "Identifier", - "start": 7802, - "end": 7809, + "start": 7810, + "end": 7817, "loc": { "start": { "line": 195, @@ -19856,8 +19856,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 7814, - "end": 7820, + "start": 7822, + "end": 7828, "loc": { "start": { "line": 195, @@ -19874,8 +19874,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7822, - "end": 7861, + "start": 7830, + "end": 7869, "loc": { "start": { "line": 195, @@ -19889,8 +19889,8 @@ "body": [ { "type": "ReturnStatement", - "start": 7840, - "end": 7847, + "start": 7848, + "end": 7855, "loc": { "start": { "line": 196, @@ -19910,8 +19910,8 @@ }, { "type": "IfStatement", - "start": 7874, - "end": 8034, + "start": 7882, + "end": 8042, "loc": { "start": { "line": 198, @@ -19924,8 +19924,8 @@ }, "test": { "type": "BinaryExpression", - "start": 7878, - "end": 7910, + "start": 7886, + "end": 7918, "loc": { "start": { "line": 198, @@ -19938,8 +19938,8 @@ }, "left": { "type": "MemberExpression", - "start": 7878, - "end": 7901, + "start": 7886, + "end": 7909, "loc": { "start": { "line": 198, @@ -19952,8 +19952,8 @@ }, "object": { "type": "ThisExpression", - "start": 7878, - "end": 7882, + "start": 7886, + "end": 7890, "loc": { "start": { "line": 198, @@ -19967,8 +19967,8 @@ }, "property": { "type": "Identifier", - "start": 7883, - "end": 7901, + "start": 7891, + "end": 7909, "loc": { "start": { "line": 198, @@ -19987,8 +19987,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 7906, - "end": 7910, + "start": 7914, + "end": 7918, "loc": { "start": { "line": 198, @@ -20003,8 +20003,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 7912, - "end": 8034, + "start": 7920, + "end": 8042, "loc": { "start": { "line": 198, @@ -20018,8 +20018,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7930, - "end": 7972, + "start": 7938, + "end": 7980, "loc": { "start": { "line": 199, @@ -20032,8 +20032,8 @@ }, "expression": { "type": "CallExpression", - "start": 7930, - "end": 7971, + "start": 7938, + "end": 7979, "loc": { "start": { "line": 199, @@ -20046,8 +20046,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7930, - "end": 7946, + "start": 7938, + "end": 7954, "loc": { "start": { "line": 199, @@ -20060,8 +20060,8 @@ }, "object": { "type": "MemberExpression", - "start": 7930, - "end": 7942, + "start": 7938, + "end": 7950, "loc": { "start": { "line": 199, @@ -20074,8 +20074,8 @@ }, "object": { "type": "ThisExpression", - "start": 7930, - "end": 7934, + "start": 7938, + "end": 7942, "loc": { "start": { "line": 199, @@ -20089,8 +20089,8 @@ }, "property": { "type": "Identifier", - "start": 7935, - "end": 7942, + "start": 7943, + "end": 7950, "loc": { "start": { "line": 199, @@ -20108,8 +20108,8 @@ }, "property": { "type": "Identifier", - "start": 7943, - "end": 7946, + "start": 7951, + "end": 7954, "loc": { "start": { "line": 199, @@ -20128,8 +20128,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 7947, - "end": 7970, + "start": 7955, + "end": 7978, "loc": { "start": { "line": 199, @@ -20142,8 +20142,8 @@ }, "object": { "type": "ThisExpression", - "start": 7947, - "end": 7951, + "start": 7955, + "end": 7959, "loc": { "start": { "line": 199, @@ -20157,8 +20157,8 @@ }, "property": { "type": "Identifier", - "start": 7952, - "end": 7970, + "start": 7960, + "end": 7978, "loc": { "start": { "line": 199, @@ -20179,8 +20179,8 @@ }, { "type": "ExpressionStatement", - "start": 7989, - "end": 8020, + "start": 7997, + "end": 8028, "loc": { "start": { "line": 200, @@ -20193,8 +20193,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7989, - "end": 8019, + "start": 7997, + "end": 8027, "loc": { "start": { "line": 200, @@ -20208,8 +20208,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7989, - "end": 8012, + "start": 7997, + "end": 8020, "loc": { "start": { "line": 200, @@ -20222,8 +20222,8 @@ }, "object": { "type": "ThisExpression", - "start": 7989, - "end": 7993, + "start": 7997, + "end": 8001, "loc": { "start": { "line": 200, @@ -20237,8 +20237,8 @@ }, "property": { "type": "Identifier", - "start": 7994, - "end": 8012, + "start": 8002, + "end": 8020, "loc": { "start": { "line": 200, @@ -20256,8 +20256,8 @@ }, "right": { "type": "NullLiteral", - "start": 8015, - "end": 8019, + "start": 8023, + "end": 8027, "loc": { "start": { "line": 200, @@ -20278,8 +20278,8 @@ }, { "type": "IfStatement", - "start": 8047, - "end": 8228, + "start": 8055, + "end": 8236, "loc": { "start": { "line": 202, @@ -20292,8 +20292,8 @@ }, "test": { "type": "BinaryExpression", - "start": 8051, - "end": 8088, + "start": 8059, + "end": 8096, "loc": { "start": { "line": 202, @@ -20306,8 +20306,8 @@ }, "left": { "type": "MemberExpression", - "start": 8051, - "end": 8079, + "start": 8059, + "end": 8087, "loc": { "start": { "line": 202, @@ -20320,8 +20320,8 @@ }, "object": { "type": "ThisExpression", - "start": 8051, - "end": 8055, + "start": 8059, + "end": 8063, "loc": { "start": { "line": 202, @@ -20335,8 +20335,8 @@ }, "property": { "type": "Identifier", - "start": 8056, - "end": 8079, + "start": 8064, + "end": 8087, "loc": { "start": { "line": 202, @@ -20355,8 +20355,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 8084, - "end": 8088, + "start": 8092, + "end": 8096, "loc": { "start": { "line": 202, @@ -20371,8 +20371,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8090, - "end": 8228, + "start": 8098, + "end": 8236, "loc": { "start": { "line": 202, @@ -20386,8 +20386,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8108, - "end": 8161, + "start": 8116, + "end": 8169, "loc": { "start": { "line": 203, @@ -20400,8 +20400,8 @@ }, "expression": { "type": "CallExpression", - "start": 8108, - "end": 8160, + "start": 8116, + "end": 8168, "loc": { "start": { "line": 203, @@ -20414,8 +20414,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8108, - "end": 8130, + "start": 8116, + "end": 8138, "loc": { "start": { "line": 203, @@ -20428,8 +20428,8 @@ }, "object": { "type": "MemberExpression", - "start": 8108, - "end": 8126, + "start": 8116, + "end": 8134, "loc": { "start": { "line": 203, @@ -20442,8 +20442,8 @@ }, "object": { "type": "MemberExpression", - "start": 8108, - "end": 8120, + "start": 8116, + "end": 8128, "loc": { "start": { "line": 203, @@ -20456,8 +20456,8 @@ }, "object": { "type": "ThisExpression", - "start": 8108, - "end": 8112, + "start": 8116, + "end": 8120, "loc": { "start": { "line": 203, @@ -20471,8 +20471,8 @@ }, "property": { "type": "Identifier", - "start": 8113, - "end": 8120, + "start": 8121, + "end": 8128, "loc": { "start": { "line": 203, @@ -20490,8 +20490,8 @@ }, "property": { "type": "Identifier", - "start": 8121, - "end": 8126, + "start": 8129, + "end": 8134, "loc": { "start": { "line": 203, @@ -20509,8 +20509,8 @@ }, "property": { "type": "Identifier", - "start": 8127, - "end": 8130, + "start": 8135, + "end": 8138, "loc": { "start": { "line": 203, @@ -20529,8 +20529,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 8131, - "end": 8159, + "start": 8139, + "end": 8167, "loc": { "start": { "line": 203, @@ -20543,8 +20543,8 @@ }, "object": { "type": "ThisExpression", - "start": 8131, - "end": 8135, + "start": 8139, + "end": 8143, "loc": { "start": { "line": 203, @@ -20558,8 +20558,8 @@ }, "property": { "type": "Identifier", - "start": 8136, - "end": 8159, + "start": 8144, + "end": 8167, "loc": { "start": { "line": 203, @@ -20580,8 +20580,8 @@ }, { "type": "ExpressionStatement", - "start": 8178, - "end": 8214, + "start": 8186, + "end": 8222, "loc": { "start": { "line": 204, @@ -20594,8 +20594,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8178, - "end": 8213, + "start": 8186, + "end": 8221, "loc": { "start": { "line": 204, @@ -20609,8 +20609,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8178, - "end": 8206, + "start": 8186, + "end": 8214, "loc": { "start": { "line": 204, @@ -20623,8 +20623,8 @@ }, "object": { "type": "ThisExpression", - "start": 8178, - "end": 8182, + "start": 8186, + "end": 8190, "loc": { "start": { "line": 204, @@ -20638,8 +20638,8 @@ }, "property": { "type": "Identifier", - "start": 8183, - "end": 8206, + "start": 8191, + "end": 8214, "loc": { "start": { "line": 204, @@ -20657,8 +20657,8 @@ }, "right": { "type": "NullLiteral", - "start": 8209, - "end": 8213, + "start": 8217, + "end": 8221, "loc": { "start": { "line": 204, @@ -20684,8 +20684,8 @@ }, { "type": "ExpressionStatement", - "start": 8247, - "end": 8269, + "start": 8255, + "end": 8277, "loc": { "start": { "line": 207, @@ -20698,8 +20698,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8247, - "end": 8268, + "start": 8255, + "end": 8276, "loc": { "start": { "line": 207, @@ -20713,8 +20713,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8247, - "end": 8259, + "start": 8255, + "end": 8267, "loc": { "start": { "line": 207, @@ -20727,8 +20727,8 @@ }, "object": { "type": "ThisExpression", - "start": 8247, - "end": 8251, + "start": 8255, + "end": 8259, "loc": { "start": { "line": 207, @@ -20742,8 +20742,8 @@ }, "property": { "type": "Identifier", - "start": 8252, - "end": 8259, + "start": 8260, + "end": 8267, "loc": { "start": { "line": 207, @@ -20761,8 +20761,8 @@ }, "right": { "type": "Identifier", - "start": 8262, - "end": 8268, + "start": 8270, + "end": 8276, "loc": { "start": { "line": 207, @@ -20780,8 +20780,8 @@ }, { "type": "IfStatement", - "start": 8278, - "end": 8958, + "start": 8286, + "end": 8966, "loc": { "start": { "line": 208, @@ -20794,8 +20794,8 @@ }, "test": { "type": "MemberExpression", - "start": 8282, - "end": 8294, + "start": 8290, + "end": 8302, "loc": { "start": { "line": 208, @@ -20808,8 +20808,8 @@ }, "object": { "type": "ThisExpression", - "start": 8282, - "end": 8286, + "start": 8290, + "end": 8294, "loc": { "start": { "line": 208, @@ -20823,8 +20823,8 @@ }, "property": { "type": "Identifier", - "start": 8287, - "end": 8294, + "start": 8295, + "end": 8302, "loc": { "start": { "line": 208, @@ -20842,8 +20842,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8296, - "end": 8958, + "start": 8304, + "end": 8966, "loc": { "start": { "line": 208, @@ -20857,8 +20857,8 @@ "body": [ { "type": "IfStatement", - "start": 8310, - "end": 8948, + "start": 8318, + "end": 8956, "loc": { "start": { "line": 209, @@ -20871,8 +20871,8 @@ }, "test": { "type": "BinaryExpression", - "start": 8314, - "end": 8354, + "start": 8322, + "end": 8362, "loc": { "start": { "line": 209, @@ -20885,8 +20885,8 @@ }, "left": { "type": "MemberExpression", - "start": 8314, - "end": 8326, + "start": 8322, + "end": 8334, "loc": { "start": { "line": 209, @@ -20899,8 +20899,8 @@ }, "object": { "type": "ThisExpression", - "start": 8314, - "end": 8318, + "start": 8322, + "end": 8326, "loc": { "start": { "line": 209, @@ -20914,8 +20914,8 @@ }, "property": { "type": "Identifier", - "start": 8319, - "end": 8326, + "start": 8327, + "end": 8334, "loc": { "start": { "line": 209, @@ -20934,8 +20934,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 8338, - "end": 8354, + "start": 8346, + "end": 8362, "loc": { "start": { "line": 209, @@ -20952,8 +20952,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 8356, - "end": 8735, + "start": 8364, + "end": 8743, "loc": { "start": { "line": 209, @@ -20967,8 +20967,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8374, - "end": 8721, + "start": 8382, + "end": 8729, "loc": { "start": { "line": 210, @@ -20981,8 +20981,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8374, - "end": 8720, + "start": 8382, + "end": 8728, "loc": { "start": { "line": 210, @@ -20996,8 +20996,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8374, - "end": 8402, + "start": 8382, + "end": 8410, "loc": { "start": { "line": 210, @@ -21010,8 +21010,8 @@ }, "object": { "type": "ThisExpression", - "start": 8374, - "end": 8378, + "start": 8382, + "end": 8386, "loc": { "start": { "line": 210, @@ -21025,8 +21025,8 @@ }, "property": { "type": "Identifier", - "start": 8379, - "end": 8402, + "start": 8387, + "end": 8410, "loc": { "start": { "line": 210, @@ -21044,8 +21044,8 @@ }, "right": { "type": "CallExpression", - "start": 8405, - "end": 8720, + "start": 8413, + "end": 8728, "loc": { "start": { "line": 210, @@ -21058,8 +21058,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8405, - "end": 8426, + "start": 8413, + "end": 8434, "loc": { "start": { "line": 210, @@ -21072,8 +21072,8 @@ }, "object": { "type": "MemberExpression", - "start": 8405, - "end": 8423, + "start": 8413, + "end": 8431, "loc": { "start": { "line": 210, @@ -21086,8 +21086,8 @@ }, "object": { "type": "MemberExpression", - "start": 8405, - "end": 8417, + "start": 8413, + "end": 8425, "loc": { "start": { "line": 210, @@ -21100,8 +21100,8 @@ }, "object": { "type": "ThisExpression", - "start": 8405, - "end": 8409, + "start": 8413, + "end": 8417, "loc": { "start": { "line": 210, @@ -21115,8 +21115,8 @@ }, "property": { "type": "Identifier", - "start": 8410, - "end": 8417, + "start": 8418, + "end": 8425, "loc": { "start": { "line": 210, @@ -21134,8 +21134,8 @@ }, "property": { "type": "Identifier", - "start": 8418, - "end": 8423, + "start": 8426, + "end": 8431, "loc": { "start": { "line": 210, @@ -21153,8 +21153,8 @@ }, "property": { "type": "Identifier", - "start": 8424, - "end": 8426, + "start": 8432, + "end": 8434, "loc": { "start": { "line": 210, @@ -21173,8 +21173,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8427, - "end": 8438, + "start": 8435, + "end": 8446, "loc": { "start": { "line": 210, @@ -21193,8 +21193,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 8440, - "end": 8719, + "start": 8448, + "end": 8727, "loc": { "start": { "line": 210, @@ -21212,8 +21212,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8446, - "end": 8719, + "start": 8454, + "end": 8727, "loc": { "start": { "line": 210, @@ -21227,8 +21227,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8552, - "end": 8572, + "start": 8560, + "end": 8580, "loc": { "start": { "line": 211, @@ -21241,8 +21241,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8552, - "end": 8571, + "start": 8560, + "end": 8579, "loc": { "start": { "line": 211, @@ -21256,8 +21256,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8552, - "end": 8564, + "start": 8560, + "end": 8572, "loc": { "start": { "line": 211, @@ -21270,8 +21270,8 @@ }, "object": { "type": "ThisExpression", - "start": 8552, - "end": 8556, + "start": 8560, + "end": 8564, "loc": { "start": { "line": 211, @@ -21286,8 +21286,8 @@ }, "property": { "type": "Identifier", - "start": 8557, - "end": 8564, + "start": 8565, + "end": 8572, "loc": { "start": { "line": 211, @@ -21306,8 +21306,8 @@ }, "right": { "type": "NullLiteral", - "start": 8567, - "end": 8571, + "start": 8575, + "end": 8579, "loc": { "start": { "line": 211, @@ -21325,8 +21325,8 @@ { "type": "CommentLine", "value": " SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel", - "start": 8448, - "end": 8531, + "start": 8456, + "end": 8539, "loc": { "start": { "line": 210, @@ -21343,8 +21343,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -21360,8 +21360,8 @@ }, { "type": "ExpressionStatement", - "start": 8665, - "end": 8701, + "start": 8673, + "end": 8709, "loc": { "start": { "line": 212, @@ -21374,8 +21374,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8665, - "end": 8700, + "start": 8673, + "end": 8708, "loc": { "start": { "line": 212, @@ -21389,8 +21389,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8665, - "end": 8693, + "start": 8673, + "end": 8701, "loc": { "start": { "line": 212, @@ -21403,8 +21403,8 @@ }, "object": { "type": "ThisExpression", - "start": 8665, - "end": 8669, + "start": 8673, + "end": 8677, "loc": { "start": { "line": 212, @@ -21419,8 +21419,8 @@ }, "property": { "type": "Identifier", - "start": 8670, - "end": 8693, + "start": 8678, + "end": 8701, "loc": { "start": { "line": 212, @@ -21439,8 +21439,8 @@ }, "right": { "type": "NullLiteral", - "start": 8696, - "end": 8700, + "start": 8704, + "end": 8708, "loc": { "start": { "line": 212, @@ -21458,8 +21458,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -21486,8 +21486,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 8741, - "end": 8948, + "start": 8749, + "end": 8956, "loc": { "start": { "line": 214, @@ -21501,8 +21501,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8759, - "end": 8934, + "start": 8767, + "end": 8942, "loc": { "start": { "line": 215, @@ -21515,8 +21515,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8759, - "end": 8933, + "start": 8767, + "end": 8941, "loc": { "start": { "line": 215, @@ -21530,8 +21530,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8759, - "end": 8782, + "start": 8767, + "end": 8790, "loc": { "start": { "line": 215, @@ -21544,8 +21544,8 @@ }, "object": { "type": "ThisExpression", - "start": 8759, - "end": 8763, + "start": 8767, + "end": 8771, "loc": { "start": { "line": 215, @@ -21559,8 +21559,8 @@ }, "property": { "type": "Identifier", - "start": 8764, - "end": 8782, + "start": 8772, + "end": 8790, "loc": { "start": { "line": 215, @@ -21578,8 +21578,8 @@ }, "right": { "type": "CallExpression", - "start": 8785, - "end": 8933, + "start": 8793, + "end": 8941, "loc": { "start": { "line": 215, @@ -21592,8 +21592,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8785, - "end": 8800, + "start": 8793, + "end": 8808, "loc": { "start": { "line": 215, @@ -21606,8 +21606,8 @@ }, "object": { "type": "MemberExpression", - "start": 8785, - "end": 8797, + "start": 8793, + "end": 8805, "loc": { "start": { "line": 215, @@ -21620,8 +21620,8 @@ }, "object": { "type": "ThisExpression", - "start": 8785, - "end": 8789, + "start": 8793, + "end": 8797, "loc": { "start": { "line": 215, @@ -21635,8 +21635,8 @@ }, "property": { "type": "Identifier", - "start": 8790, - "end": 8797, + "start": 8798, + "end": 8805, "loc": { "start": { "line": 215, @@ -21654,8 +21654,8 @@ }, "property": { "type": "Identifier", - "start": 8798, - "end": 8800, + "start": 8806, + "end": 8808, "loc": { "start": { "line": 215, @@ -21674,8 +21674,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8801, - "end": 8812, + "start": 8809, + "end": 8820, "loc": { "start": { "line": 215, @@ -21694,8 +21694,8 @@ }, { "type": "ArrowFunctionExpression", - "start": 8814, - "end": 8932, + "start": 8822, + "end": 8940, "loc": { "start": { "line": 215, @@ -21713,8 +21713,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 8820, - "end": 8932, + "start": 8828, + "end": 8940, "loc": { "start": { "line": 215, @@ -21728,8 +21728,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8842, - "end": 8862, + "start": 8850, + "end": 8870, "loc": { "start": { "line": 216, @@ -21742,8 +21742,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8842, - "end": 8861, + "start": 8850, + "end": 8869, "loc": { "start": { "line": 216, @@ -21757,8 +21757,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8842, - "end": 8854, + "start": 8850, + "end": 8862, "loc": { "start": { "line": 216, @@ -21771,8 +21771,8 @@ }, "object": { "type": "ThisExpression", - "start": 8842, - "end": 8846, + "start": 8850, + "end": 8854, "loc": { "start": { "line": 216, @@ -21786,8 +21786,8 @@ }, "property": { "type": "Identifier", - "start": 8847, - "end": 8854, + "start": 8855, + "end": 8862, "loc": { "start": { "line": 216, @@ -21805,8 +21805,8 @@ }, "right": { "type": "NullLiteral", - "start": 8857, - "end": 8861, + "start": 8865, + "end": 8869, "loc": { "start": { "line": 216, @@ -21822,8 +21822,8 @@ }, { "type": "ExpressionStatement", - "start": 8883, - "end": 8914, + "start": 8891, + "end": 8922, "loc": { "start": { "line": 217, @@ -21836,8 +21836,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8883, - "end": 8913, + "start": 8891, + "end": 8921, "loc": { "start": { "line": 217, @@ -21851,8 +21851,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 8883, - "end": 8906, + "start": 8891, + "end": 8914, "loc": { "start": { "line": 217, @@ -21865,8 +21865,8 @@ }, "object": { "type": "ThisExpression", - "start": 8883, - "end": 8887, + "start": 8891, + "end": 8895, "loc": { "start": { "line": 217, @@ -21880,8 +21880,8 @@ }, "property": { "type": "Identifier", - "start": 8888, - "end": 8906, + "start": 8896, + "end": 8914, "loc": { "start": { "line": 217, @@ -21899,8 +21899,8 @@ }, "right": { "type": "NullLiteral", - "start": 8909, - "end": 8913, + "start": 8917, + "end": 8921, "loc": { "start": { "line": 217, @@ -21933,8 +21933,8 @@ }, { "type": "ExpressionStatement", - "start": 8967, - "end": 9020, + "start": 8975, + "end": 9028, "loc": { "start": { "line": 221, @@ -21947,8 +21947,8 @@ }, "expression": { "type": "CallExpression", - "start": 8967, - "end": 9019, + "start": 8975, + "end": 9027, "loc": { "start": { "line": 221, @@ -21961,8 +21961,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8967, - "end": 8976, + "start": 8975, + "end": 8984, "loc": { "start": { "line": 221, @@ -21975,8 +21975,8 @@ }, "object": { "type": "ThisExpression", - "start": 8967, - "end": 8971, + "start": 8975, + "end": 8979, "loc": { "start": { "line": 221, @@ -21990,8 +21990,8 @@ }, "property": { "type": "Identifier", - "start": 8972, - "end": 8976, + "start": 8980, + "end": 8984, "loc": { "start": { "line": 221, @@ -22010,8 +22010,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 8977, - "end": 8985, + "start": 8985, + "end": 8993, "loc": { "start": { "line": 221, @@ -22030,8 +22030,8 @@ }, { "type": "MemberExpression", - "start": 8987, - "end": 8999, + "start": 8995, + "end": 9007, "loc": { "start": { "line": 221, @@ -22044,8 +22044,8 @@ }, "object": { "type": "ThisExpression", - "start": 8987, - "end": 8991, + "start": 8995, + "end": 8999, "loc": { "start": { "line": 221, @@ -22059,8 +22059,8 @@ }, "property": { "type": "Identifier", - "start": 8992, - "end": 8999, + "start": 9000, + "end": 9007, "loc": { "start": { "line": 221, @@ -22078,8 +22078,8 @@ }, { "type": "BooleanLiteral", - "start": 9001, - "end": 9005, + "start": 9009, + "end": 9013, "loc": { "start": { "line": 221, @@ -22096,8 +22096,8 @@ { "type": "CommentBlock", "value": " forget ", - "start": 9006, - "end": 9018, + "start": 9014, + "end": 9026, "loc": { "start": { "line": 221, @@ -22122,8 +22122,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -22140,8 +22140,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -22157,8 +22157,8 @@ }, { "type": "ClassMethod", - "start": 9140, - "end": 9189, + "start": 9148, + "end": 9197, "loc": { "start": { "line": 229, @@ -22173,8 +22173,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9144, - "end": 9150, + "start": 9152, + "end": 9158, "loc": { "start": { "line": 229, @@ -22196,8 +22196,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 9153, - "end": 9189, + "start": 9161, + "end": 9197, "loc": { "start": { "line": 229, @@ -22211,8 +22211,8 @@ "body": [ { "type": "ReturnStatement", - "start": 9163, - "end": 9183, + "start": 9171, + "end": 9191, "loc": { "start": { "line": 230, @@ -22225,8 +22225,8 @@ }, "argument": { "type": "MemberExpression", - "start": 9170, - "end": 9182, + "start": 9178, + "end": 9190, "loc": { "start": { "line": 230, @@ -22239,8 +22239,8 @@ }, "object": { "type": "ThisExpression", - "start": 9170, - "end": 9174, + "start": 9178, + "end": 9182, "loc": { "start": { "line": 230, @@ -22254,8 +22254,8 @@ }, "property": { "type": "Identifier", - "start": 9175, - "end": 9182, + "start": 9183, + "end": 9190, "loc": { "start": { "line": 230, @@ -22280,8 +22280,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -22298,8 +22298,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -22315,8 +22315,8 @@ }, { "type": "ClassMethod", - "start": 9686, - "end": 9871, + "start": 9694, + "end": 9879, "loc": { "start": { "line": 243, @@ -22331,8 +22331,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9690, - "end": 9700, + "start": 9698, + "end": 9708, "loc": { "start": { "line": 243, @@ -22354,8 +22354,8 @@ "params": [ { "type": "Identifier", - "start": 9701, - "end": 9711, + "start": 9709, + "end": 9719, "loc": { "start": { "line": 243, @@ -22372,8 +22372,8 @@ ], "body": { "type": "BlockStatement", - "start": 9713, - "end": 9871, + "start": 9721, + "end": 9879, "loc": { "start": { "line": 243, @@ -22387,8 +22387,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9723, - "end": 9749, + "start": 9731, + "end": 9757, "loc": { "start": { "line": 244, @@ -22401,8 +22401,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9723, - "end": 9748, + "start": 9731, + "end": 9756, "loc": { "start": { "line": 244, @@ -22416,8 +22416,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 9723, - "end": 9733, + "start": 9731, + "end": 9741, "loc": { "start": { "line": 244, @@ -22433,8 +22433,8 @@ }, "right": { "type": "UnaryExpression", - "start": 9736, - "end": 9748, + "start": 9744, + "end": 9756, "loc": { "start": { "line": 244, @@ -22449,8 +22449,8 @@ "prefix": true, "argument": { "type": "UnaryExpression", - "start": 9737, - "end": 9748, + "start": 9745, + "end": 9756, "loc": { "start": { "line": 244, @@ -22465,8 +22465,8 @@ "prefix": true, "argument": { "type": "Identifier", - "start": 9738, - "end": 9748, + "start": 9746, + "end": 9756, "loc": { "start": { "line": 244, @@ -22492,8 +22492,8 @@ }, { "type": "IfStatement", - "start": 9758, - "end": 9826, + "start": 9766, + "end": 9834, "loc": { "start": { "line": 245, @@ -22506,8 +22506,8 @@ }, "test": { "type": "BinaryExpression", - "start": 9762, - "end": 9793, + "start": 9770, + "end": 9801, "loc": { "start": { "line": 245, @@ -22520,8 +22520,8 @@ }, "left": { "type": "Identifier", - "start": 9762, - "end": 9772, + "start": 9770, + "end": 9780, "loc": { "start": { "line": 245, @@ -22538,8 +22538,8 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 9777, - "end": 9793, + "start": 9785, + "end": 9801, "loc": { "start": { "line": 245, @@ -22552,8 +22552,8 @@ }, "object": { "type": "ThisExpression", - "start": 9777, - "end": 9781, + "start": 9785, + "end": 9789, "loc": { "start": { "line": 245, @@ -22567,8 +22567,8 @@ }, "property": { "type": "Identifier", - "start": 9782, - "end": 9793, + "start": 9790, + "end": 9801, "loc": { "start": { "line": 245, @@ -22587,8 +22587,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 9795, - "end": 9826, + "start": 9803, + "end": 9834, "loc": { "start": { "line": 245, @@ -22602,8 +22602,8 @@ "body": [ { "type": "ReturnStatement", - "start": 9809, - "end": 9816, + "start": 9817, + "end": 9824, "loc": { "start": { "line": 246, @@ -22623,8 +22623,8 @@ }, { "type": "ExpressionStatement", - "start": 9835, - "end": 9865, + "start": 9843, + "end": 9873, "loc": { "start": { "line": 248, @@ -22637,8 +22637,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9835, - "end": 9864, + "start": 9843, + "end": 9872, "loc": { "start": { "line": 248, @@ -22652,8 +22652,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9835, - "end": 9851, + "start": 9843, + "end": 9859, "loc": { "start": { "line": 248, @@ -22666,8 +22666,8 @@ }, "object": { "type": "ThisExpression", - "start": 9835, - "end": 9839, + "start": 9843, + "end": 9847, "loc": { "start": { "line": 248, @@ -22681,8 +22681,8 @@ }, "property": { "type": "Identifier", - "start": 9840, - "end": 9851, + "start": 9848, + "end": 9859, "loc": { "start": { "line": 248, @@ -22700,8 +22700,8 @@ }, "right": { "type": "Identifier", - "start": 9854, - "end": 9864, + "start": 9862, + "end": 9872, "loc": { "start": { "line": 248, @@ -22725,8 +22725,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -22743,8 +22743,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -22760,8 +22760,8 @@ }, { "type": "ClassMethod", - "start": 10151, - "end": 10208, + "start": 10159, + "end": 10216, "loc": { "start": { "line": 258, @@ -22776,8 +22776,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10155, - "end": 10165, + "start": 10163, + "end": 10173, "loc": { "start": { "line": 258, @@ -22799,8 +22799,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10168, - "end": 10208, + "start": 10176, + "end": 10216, "loc": { "start": { "line": 258, @@ -22814,8 +22814,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10178, - "end": 10202, + "start": 10186, + "end": 10210, "loc": { "start": { "line": 259, @@ -22828,8 +22828,8 @@ }, "argument": { "type": "MemberExpression", - "start": 10185, - "end": 10201, + "start": 10193, + "end": 10209, "loc": { "start": { "line": 259, @@ -22842,8 +22842,8 @@ }, "object": { "type": "ThisExpression", - "start": 10185, - "end": 10189, + "start": 10193, + "end": 10197, "loc": { "start": { "line": 259, @@ -22857,8 +22857,8 @@ }, "property": { "type": "Identifier", - "start": 10190, - "end": 10201, + "start": 10198, + "end": 10209, "loc": { "start": { "line": 259, @@ -22883,8 +22883,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -22901,8 +22901,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -22918,8 +22918,8 @@ }, { "type": "ClassMethod", - "start": 10381, - "end": 10737, + "start": 10389, + "end": 10745, "loc": { "start": { "line": 269, @@ -22934,8 +22934,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10385, - "end": 10393, + "start": 10393, + "end": 10401, "loc": { "start": { "line": 269, @@ -22957,8 +22957,8 @@ "params": [ { "type": "Identifier", - "start": 10394, - "end": 10402, + "start": 10402, + "end": 10410, "loc": { "start": { "line": 269, @@ -22975,8 +22975,8 @@ ], "body": { "type": "BlockStatement", - "start": 10404, - "end": 10737, + "start": 10412, + "end": 10745, "loc": { "start": { "line": 269, @@ -22990,8 +22990,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10414, - "end": 10456, + "start": 10422, + "end": 10464, "loc": { "start": { "line": 270, @@ -23004,8 +23004,8 @@ }, "expression": { "type": "CallExpression", - "start": 10414, - "end": 10455, + "start": 10422, + "end": 10463, "loc": { "start": { "line": 270, @@ -23018,8 +23018,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10414, - "end": 10432, + "start": 10422, + "end": 10440, "loc": { "start": { "line": 270, @@ -23032,8 +23032,8 @@ }, "object": { "type": "MemberExpression", - "start": 10414, - "end": 10428, + "start": 10422, + "end": 10436, "loc": { "start": { "line": 270, @@ -23046,8 +23046,8 @@ }, "object": { "type": "ThisExpression", - "start": 10414, - "end": 10418, + "start": 10422, + "end": 10426, "loc": { "start": { "line": 270, @@ -23061,8 +23061,8 @@ }, "property": { "type": "Identifier", - "start": 10419, - "end": 10428, + "start": 10427, + "end": 10436, "loc": { "start": { "line": 270, @@ -23080,8 +23080,8 @@ }, "property": { "type": "Identifier", - "start": 10429, - "end": 10432, + "start": 10437, + "end": 10440, "loc": { "start": { "line": 270, @@ -23100,8 +23100,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 10433, - "end": 10454, + "start": 10441, + "end": 10462, "loc": { "start": { "line": 270, @@ -23114,8 +23114,8 @@ }, "left": { "type": "Identifier", - "start": 10433, - "end": 10441, + "start": 10441, + "end": 10449, "loc": { "start": { "line": 270, @@ -23132,8 +23132,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 10445, - "end": 10454, + "start": 10453, + "end": 10462, "loc": { "start": { "line": 270, @@ -23147,8 +23147,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 10446, - "end": 10447, + "start": 10454, + "end": 10455, "loc": { "start": { "line": 270, @@ -23167,8 +23167,8 @@ }, { "type": "NumericLiteral", - "start": 10449, - "end": 10450, + "start": 10457, + "end": 10458, "loc": { "start": { "line": 270, @@ -23187,8 +23187,8 @@ }, { "type": "NumericLiteral", - "start": 10452, - "end": 10453, + "start": 10460, + "end": 10461, "loc": { "start": { "line": 270, @@ -23213,8 +23213,8 @@ }, { "type": "ExpressionStatement", - "start": 10465, - "end": 10523, + "start": 10473, + "end": 10531, "loc": { "start": { "line": 271, @@ -23227,8 +23227,8 @@ }, "expression": { "type": "CallExpression", - "start": 10465, - "end": 10522, + "start": 10473, + "end": 10530, "loc": { "start": { "line": 271, @@ -23241,8 +23241,8 @@ }, "callee": { "type": "Identifier", - "start": 10465, - "end": 10478, + "start": 10473, + "end": 10486, "loc": { "start": { "line": 271, @@ -23259,8 +23259,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 10479, - "end": 10493, + "start": 10487, + "end": 10501, "loc": { "start": { "line": 271, @@ -23273,8 +23273,8 @@ }, "object": { "type": "ThisExpression", - "start": 10479, - "end": 10483, + "start": 10487, + "end": 10491, "loc": { "start": { "line": 271, @@ -23288,8 +23288,8 @@ }, "property": { "type": "Identifier", - "start": 10484, - "end": 10493, + "start": 10492, + "end": 10501, "loc": { "start": { "line": 271, @@ -23307,8 +23307,8 @@ }, { "type": "MemberExpression", - "start": 10495, - "end": 10507, + "start": 10503, + "end": 10515, "loc": { "start": { "line": 271, @@ -23321,8 +23321,8 @@ }, "object": { "type": "ThisExpression", - "start": 10495, - "end": 10499, + "start": 10503, + "end": 10507, "loc": { "start": { "line": 271, @@ -23336,8 +23336,8 @@ }, "property": { "type": "Identifier", - "start": 10500, - "end": 10507, + "start": 10508, + "end": 10515, "loc": { "start": { "line": 271, @@ -23355,8 +23355,8 @@ }, { "type": "MemberExpression", - "start": 10509, - "end": 10521, + "start": 10517, + "end": 10529, "loc": { "start": { "line": 271, @@ -23369,8 +23369,8 @@ }, "object": { "type": "ThisExpression", - "start": 10509, - "end": 10513, + "start": 10517, + "end": 10521, "loc": { "start": { "line": 271, @@ -23384,8 +23384,8 @@ }, "property": { "type": "Identifier", - "start": 10514, - "end": 10521, + "start": 10522, + "end": 10529, "loc": { "start": { "line": 271, @@ -23406,8 +23406,8 @@ }, { "type": "IfStatement", - "start": 10532, - "end": 10621, + "start": 10540, + "end": 10629, "loc": { "start": { "line": 272, @@ -23420,8 +23420,8 @@ }, "test": { "type": "MemberExpression", - "start": 10536, - "end": 10552, + "start": 10544, + "end": 10560, "loc": { "start": { "line": 272, @@ -23434,8 +23434,8 @@ }, "object": { "type": "ThisExpression", - "start": 10536, - "end": 10540, + "start": 10544, + "end": 10548, "loc": { "start": { "line": 272, @@ -23449,8 +23449,8 @@ }, "property": { "type": "Identifier", - "start": 10541, - "end": 10552, + "start": 10549, + "end": 10560, "loc": { "start": { "line": 272, @@ -23468,8 +23468,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10554, - "end": 10621, + "start": 10562, + "end": 10629, "loc": { "start": { "line": 272, @@ -23483,8 +23483,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10568, - "end": 10611, + "start": 10576, + "end": 10619, "loc": { "start": { "line": 273, @@ -23497,8 +23497,8 @@ }, "expression": { "type": "CallExpression", - "start": 10568, - "end": 10610, + "start": 10576, + "end": 10618, "loc": { "start": { "line": 273, @@ -23511,8 +23511,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10568, - "end": 10604, + "start": 10576, + "end": 10612, "loc": { "start": { "line": 273, @@ -23525,8 +23525,8 @@ }, "object": { "type": "MemberExpression", - "start": 10568, - "end": 10582, + "start": 10576, + "end": 10590, "loc": { "start": { "line": 273, @@ -23539,8 +23539,8 @@ }, "object": { "type": "ThisExpression", - "start": 10568, - "end": 10572, + "start": 10576, + "end": 10580, "loc": { "start": { "line": 273, @@ -23554,8 +23554,8 @@ }, "property": { "type": "Identifier", - "start": 10573, - "end": 10582, + "start": 10581, + "end": 10590, "loc": { "start": { "line": 273, @@ -23573,8 +23573,8 @@ }, "property": { "type": "Identifier", - "start": 10583, - "end": 10604, + "start": 10591, + "end": 10612, "loc": { "start": { "line": 273, @@ -23593,8 +23593,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 10605, - "end": 10609, + "start": 10613, + "end": 10617, "loc": { "start": { "line": 273, @@ -23616,8 +23616,8 @@ }, { "type": "ExpressionStatement", - "start": 10630, - "end": 10656, + "start": 10638, + "end": 10664, "loc": { "start": { "line": 275, @@ -23630,8 +23630,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10630, - "end": 10655, + "start": 10638, + "end": 10663, "loc": { "start": { "line": 275, @@ -23645,8 +23645,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10630, - "end": 10648, + "start": 10638, + "end": 10656, "loc": { "start": { "line": 275, @@ -23659,8 +23659,8 @@ }, "object": { "type": "ThisExpression", - "start": 10630, - "end": 10634, + "start": 10638, + "end": 10642, "loc": { "start": { "line": 275, @@ -23674,8 +23674,8 @@ }, "property": { "type": "Identifier", - "start": 10635, - "end": 10648, + "start": 10643, + "end": 10656, "loc": { "start": { "line": 275, @@ -23693,8 +23693,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 10651, - "end": 10655, + "start": 10659, + "end": 10663, "loc": { "start": { "line": 275, @@ -23711,8 +23711,8 @@ }, { "type": "ExpressionStatement", - "start": 10665, - "end": 10703, + "start": 10673, + "end": 10711, "loc": { "start": { "line": 276, @@ -23725,8 +23725,8 @@ }, "expression": { "type": "CallExpression", - "start": 10665, - "end": 10702, + "start": 10673, + "end": 10710, "loc": { "start": { "line": 276, @@ -23739,8 +23739,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10665, - "end": 10674, + "start": 10673, + "end": 10682, "loc": { "start": { "line": 276, @@ -23753,8 +23753,8 @@ }, "object": { "type": "ThisExpression", - "start": 10665, - "end": 10669, + "start": 10673, + "end": 10677, "loc": { "start": { "line": 276, @@ -23768,8 +23768,8 @@ }, "property": { "type": "Identifier", - "start": 10670, - "end": 10674, + "start": 10678, + "end": 10682, "loc": { "start": { "line": 276, @@ -23788,8 +23788,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 10675, - "end": 10685, + "start": 10683, + "end": 10693, "loc": { "start": { "line": 276, @@ -23808,8 +23808,8 @@ }, { "type": "MemberExpression", - "start": 10687, - "end": 10701, + "start": 10695, + "end": 10709, "loc": { "start": { "line": 276, @@ -23822,8 +23822,8 @@ }, "object": { "type": "ThisExpression", - "start": 10687, - "end": 10691, + "start": 10695, + "end": 10699, "loc": { "start": { "line": 276, @@ -23837,8 +23837,8 @@ }, "property": { "type": "Identifier", - "start": 10692, - "end": 10701, + "start": 10700, + "end": 10709, "loc": { "start": { "line": 276, @@ -23859,8 +23859,8 @@ }, { "type": "ExpressionStatement", - "start": 10712, - "end": 10731, + "start": 10720, + "end": 10739, "loc": { "start": { "line": 277, @@ -23873,8 +23873,8 @@ }, "expression": { "type": "CallExpression", - "start": 10712, - "end": 10730, + "start": 10720, + "end": 10738, "loc": { "start": { "line": 277, @@ -23887,8 +23887,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10712, - "end": 10728, + "start": 10720, + "end": 10736, "loc": { "start": { "line": 277, @@ -23901,8 +23901,8 @@ }, "object": { "type": "ThisExpression", - "start": 10712, - "end": 10716, + "start": 10720, + "end": 10724, "loc": { "start": { "line": 277, @@ -23916,8 +23916,8 @@ }, "property": { "type": "Identifier", - "start": 10717, - "end": 10728, + "start": 10725, + "end": 10736, "loc": { "start": { "line": 277, @@ -23944,8 +23944,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -23962,8 +23962,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -23979,8 +23979,8 @@ }, { "type": "ClassMethod", - "start": 10846, - "end": 10899, + "start": 10854, + "end": 10907, "loc": { "start": { "line": 285, @@ -23995,8 +23995,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10850, - "end": 10858, + "start": 10858, + "end": 10866, "loc": { "start": { "line": 285, @@ -24018,8 +24018,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10861, - "end": 10899, + "start": 10869, + "end": 10907, "loc": { "start": { "line": 285, @@ -24033,8 +24033,8 @@ "body": [ { "type": "ReturnStatement", - "start": 10871, - "end": 10893, + "start": 10879, + "end": 10901, "loc": { "start": { "line": 286, @@ -24047,8 +24047,8 @@ }, "argument": { "type": "MemberExpression", - "start": 10878, - "end": 10892, + "start": 10886, + "end": 10900, "loc": { "start": { "line": 286, @@ -24061,8 +24061,8 @@ }, "object": { "type": "ThisExpression", - "start": 10878, - "end": 10882, + "start": 10886, + "end": 10890, "loc": { "start": { "line": 286, @@ -24076,8 +24076,8 @@ }, "property": { "type": "Identifier", - "start": 10883, - "end": 10892, + "start": 10891, + "end": 10900, "loc": { "start": { "line": 286, @@ -24102,8 +24102,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -24120,8 +24120,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -24137,8 +24137,8 @@ }, { "type": "ClassMethod", - "start": 11072, - "end": 11121, + "start": 11080, + "end": 11129, "loc": { "start": { "line": 296, @@ -24153,8 +24153,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11076, - "end": 11082, + "start": 11084, + "end": 11090, "loc": { "start": { "line": 296, @@ -24176,8 +24176,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11085, - "end": 11121, + "start": 11093, + "end": 11129, "loc": { "start": { "line": 296, @@ -24191,8 +24191,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11095, - "end": 11115, + "start": 11103, + "end": 11123, "loc": { "start": { "line": 297, @@ -24205,8 +24205,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11102, - "end": 11114, + "start": 11110, + "end": 11122, "loc": { "start": { "line": 297, @@ -24219,8 +24219,8 @@ }, "object": { "type": "ThisExpression", - "start": 11102, - "end": 11106, + "start": 11110, + "end": 11114, "loc": { "start": { "line": 297, @@ -24234,8 +24234,8 @@ }, "property": { "type": "Identifier", - "start": 11107, - "end": 11114, + "start": 11115, + "end": 11122, "loc": { "start": { "line": 297, @@ -24260,8 +24260,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -24278,8 +24278,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -24295,8 +24295,8 @@ }, { "type": "ClassMethod", - "start": 11296, - "end": 11345, + "start": 11304, + "end": 11353, "loc": { "start": { "line": 307, @@ -24311,8 +24311,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11300, - "end": 11306, + "start": 11308, + "end": 11314, "loc": { "start": { "line": 307, @@ -24334,8 +24334,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11309, - "end": 11345, + "start": 11317, + "end": 11353, "loc": { "start": { "line": 307, @@ -24349,8 +24349,8 @@ "body": [ { "type": "ReturnStatement", - "start": 11319, - "end": 11339, + "start": 11327, + "end": 11347, "loc": { "start": { "line": 308, @@ -24363,8 +24363,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11326, - "end": 11338, + "start": 11334, + "end": 11346, "loc": { "start": { "line": 308, @@ -24377,8 +24377,8 @@ }, "object": { "type": "ThisExpression", - "start": 11326, - "end": 11330, + "start": 11334, + "end": 11338, "loc": { "start": { "line": 308, @@ -24392,8 +24392,8 @@ }, "property": { "type": "Identifier", - "start": 11331, - "end": 11338, + "start": 11339, + "end": 11346, "loc": { "start": { "line": 308, @@ -24418,8 +24418,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -24436,8 +24436,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -24453,8 +24453,8 @@ }, { "type": "ClassMethod", - "start": 11685, - "end": 11760, + "start": 11693, + "end": 11768, "loc": { "start": { "line": 321, @@ -24469,8 +24469,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11689, - "end": 11696, + "start": 11697, + "end": 11704, "loc": { "start": { "line": 321, @@ -24492,8 +24492,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 11699, - "end": 11760, + "start": 11707, + "end": 11768, "loc": { "start": { "line": 321, @@ -24507,8 +24507,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11709, - "end": 11724, + "start": 11717, + "end": 11732, "loc": { "start": { "line": 322, @@ -24521,8 +24521,8 @@ }, "expression": { "type": "CallExpression", - "start": 11709, - "end": 11723, + "start": 11717, + "end": 11731, "loc": { "start": { "line": 322, @@ -24535,8 +24535,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11709, - "end": 11721, + "start": 11717, + "end": 11729, "loc": { "start": { "line": 322, @@ -24549,8 +24549,8 @@ }, "object": { "type": "ThisExpression", - "start": 11709, - "end": 11713, + "start": 11717, + "end": 11721, "loc": { "start": { "line": 322, @@ -24564,8 +24564,8 @@ }, "property": { "type": "Identifier", - "start": 11714, - "end": 11721, + "start": 11722, + "end": 11729, "loc": { "start": { "line": 322, @@ -24586,8 +24586,8 @@ }, { "type": "ReturnStatement", - "start": 11733, - "end": 11754, + "start": 11741, + "end": 11762, "loc": { "start": { "line": 323, @@ -24600,8 +24600,8 @@ }, "argument": { "type": "MemberExpression", - "start": 11740, - "end": 11753, + "start": 11748, + "end": 11761, "loc": { "start": { "line": 323, @@ -24614,8 +24614,8 @@ }, "object": { "type": "ThisExpression", - "start": 11740, - "end": 11744, + "start": 11748, + "end": 11752, "loc": { "start": { "line": 323, @@ -24629,8 +24629,8 @@ }, "property": { "type": "Identifier", - "start": 11745, - "end": 11753, + "start": 11753, + "end": 11761, "loc": { "start": { "line": 323, @@ -24655,8 +24655,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -24673,8 +24673,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -24690,8 +24690,8 @@ }, { "type": "ClassMethod", - "start": 12119, - "end": 12198, + "start": 12127, + "end": 12206, "loc": { "start": { "line": 336, @@ -24706,8 +24706,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12123, - "end": 12132, + "start": 12131, + "end": 12140, "loc": { "start": { "line": 336, @@ -24729,8 +24729,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12135, - "end": 12198, + "start": 12143, + "end": 12206, "loc": { "start": { "line": 336, @@ -24744,8 +24744,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 12145, - "end": 12160, + "start": 12153, + "end": 12168, "loc": { "start": { "line": 337, @@ -24758,8 +24758,8 @@ }, "expression": { "type": "CallExpression", - "start": 12145, - "end": 12159, + "start": 12153, + "end": 12167, "loc": { "start": { "line": 337, @@ -24772,8 +24772,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12145, - "end": 12157, + "start": 12153, + "end": 12165, "loc": { "start": { "line": 337, @@ -24786,8 +24786,8 @@ }, "object": { "type": "ThisExpression", - "start": 12145, - "end": 12149, + "start": 12153, + "end": 12157, "loc": { "start": { "line": 337, @@ -24801,8 +24801,8 @@ }, "property": { "type": "Identifier", - "start": 12150, - "end": 12157, + "start": 12158, + "end": 12165, "loc": { "start": { "line": 337, @@ -24823,8 +24823,8 @@ }, { "type": "ReturnStatement", - "start": 12169, - "end": 12192, + "start": 12177, + "end": 12200, "loc": { "start": { "line": 338, @@ -24837,8 +24837,8 @@ }, "argument": { "type": "MemberExpression", - "start": 12176, - "end": 12191, + "start": 12184, + "end": 12199, "loc": { "start": { "line": 338, @@ -24851,8 +24851,8 @@ }, "object": { "type": "ThisExpression", - "start": 12176, - "end": 12180, + "start": 12184, + "end": 12188, "loc": { "start": { "line": 338, @@ -24866,8 +24866,8 @@ }, "property": { "type": "Identifier", - "start": 12181, - "end": 12191, + "start": 12189, + "end": 12199, "loc": { "start": { "line": 338, @@ -24892,8 +24892,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -24910,8 +24910,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -24927,8 +24927,8 @@ }, { "type": "ClassMethod", - "start": 12819, - "end": 12872, + "start": 12827, + "end": 12880, "loc": { "start": { "line": 357, @@ -24943,8 +24943,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12823, - "end": 12830, + "start": 12831, + "end": 12838, "loc": { "start": { "line": 357, @@ -24966,8 +24966,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12833, - "end": 12872, + "start": 12841, + "end": 12880, "loc": { "start": { "line": 357, @@ -24981,8 +24981,8 @@ "body": [ { "type": "ReturnStatement", - "start": 12843, - "end": 12866, + "start": 12851, + "end": 12874, "loc": { "start": { "line": 358, @@ -24995,8 +24995,8 @@ }, "argument": { "type": "UnaryExpression", - "start": 12850, - "end": 12865, + "start": 12858, + "end": 12873, "loc": { "start": { "line": 358, @@ -25011,8 +25011,8 @@ "prefix": true, "argument": { "type": "UnaryExpression", - "start": 12851, - "end": 12865, + "start": 12859, + "end": 12873, "loc": { "start": { "line": 358, @@ -25027,8 +25027,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 12852, - "end": 12865, + "start": 12860, + "end": 12873, "loc": { "start": { "line": 358, @@ -25041,8 +25041,8 @@ }, "object": { "type": "ThisExpression", - "start": 12852, - "end": 12856, + "start": 12860, + "end": 12864, "loc": { "start": { "line": 358, @@ -25056,8 +25056,8 @@ }, "property": { "type": "Identifier", - "start": 12857, - "end": 12865, + "start": 12865, + "end": 12873, "loc": { "start": { "line": 358, @@ -25090,8 +25090,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -25108,8 +25108,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -25125,8 +25125,8 @@ }, { "type": "ClassMethod", - "start": 12923, - "end": 13464, + "start": 12931, + "end": 13472, "loc": { "start": { "line": 364, @@ -25141,8 +25141,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 12923, - "end": 12930, + "start": 12931, + "end": 12938, "loc": { "start": { "line": 364, @@ -25165,8 +25165,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 12933, - "end": 13464, + "start": 12941, + "end": 13472, "loc": { "start": { "line": 364, @@ -25180,8 +25180,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 12943, - "end": 12972, + "start": 12951, + "end": 12980, "loc": { "start": { "line": 365, @@ -25194,8 +25194,8 @@ }, "expression": { "type": "CallExpression", - "start": 12943, - "end": 12971, + "start": 12951, + "end": 12979, "loc": { "start": { "line": 365, @@ -25208,8 +25208,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12943, - "end": 12952, + "start": 12951, + "end": 12960, "loc": { "start": { "line": 365, @@ -25222,8 +25222,8 @@ }, "object": { "type": "ThisExpression", - "start": 12943, - "end": 12947, + "start": 12951, + "end": 12955, "loc": { "start": { "line": 365, @@ -25237,8 +25237,8 @@ }, "property": { "type": "Identifier", - "start": 12948, - "end": 12952, + "start": 12956, + "end": 12960, "loc": { "start": { "line": 365, @@ -25257,8 +25257,8 @@ "arguments": [ { "type": "StringLiteral", - "start": 12953, - "end": 12964, + "start": 12961, + "end": 12972, "loc": { "start": { "line": 365, @@ -25277,8 +25277,8 @@ }, { "type": "BooleanLiteral", - "start": 12966, - "end": 12970, + "start": 12974, + "end": 12978, "loc": { "start": { "line": 365, @@ -25296,8 +25296,8 @@ }, { "type": "ExpressionStatement", - "start": 12981, - "end": 13029, + "start": 12989, + "end": 13037, "loc": { "start": { "line": 366, @@ -25310,8 +25310,8 @@ }, "expression": { "type": "CallExpression", - "start": 12981, - "end": 13028, + "start": 12989, + "end": 13036, "loc": { "start": { "line": 366, @@ -25324,8 +25324,8 @@ }, "callee": { "type": "MemberExpression", - "start": 12981, - "end": 13002, + "start": 12989, + "end": 13010, "loc": { "start": { "line": 366, @@ -25338,8 +25338,8 @@ }, "object": { "type": "MemberExpression", - "start": 12981, - "end": 12998, + "start": 12989, + "end": 13006, "loc": { "start": { "line": 366, @@ -25352,8 +25352,8 @@ }, "object": { "type": "MemberExpression", - "start": 12981, - "end": 12991, + "start": 12989, + "end": 12999, "loc": { "start": { "line": 366, @@ -25366,8 +25366,8 @@ }, "object": { "type": "ThisExpression", - "start": 12981, - "end": 12985, + "start": 12989, + "end": 12993, "loc": { "start": { "line": 366, @@ -25381,8 +25381,8 @@ }, "property": { "type": "Identifier", - "start": 12986, - "end": 12991, + "start": 12994, + "end": 12999, "loc": { "start": { "line": 366, @@ -25400,8 +25400,8 @@ }, "property": { "type": "Identifier", - "start": 12992, - "end": 12998, + "start": 13000, + "end": 13006, "loc": { "start": { "line": 366, @@ -25419,8 +25419,8 @@ }, "property": { "type": "Identifier", - "start": 12999, - "end": 13002, + "start": 13007, + "end": 13010, "loc": { "start": { "line": 366, @@ -25439,8 +25439,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13003, - "end": 13027, + "start": 13011, + "end": 13035, "loc": { "start": { "line": 366, @@ -25453,8 +25453,8 @@ }, "object": { "type": "ThisExpression", - "start": 13003, - "end": 13007, + "start": 13011, + "end": 13015, "loc": { "start": { "line": 366, @@ -25468,8 +25468,8 @@ }, "property": { "type": "Identifier", - "start": 13008, - "end": 13027, + "start": 13016, + "end": 13035, "loc": { "start": { "line": 366, @@ -25490,8 +25490,8 @@ }, { "type": "ExpressionStatement", - "start": 13038, - "end": 13086, + "start": 13046, + "end": 13094, "loc": { "start": { "line": 367, @@ -25504,8 +25504,8 @@ }, "expression": { "type": "CallExpression", - "start": 13038, - "end": 13085, + "start": 13046, + "end": 13093, "loc": { "start": { "line": 367, @@ -25518,8 +25518,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13038, - "end": 13059, + "start": 13046, + "end": 13067, "loc": { "start": { "line": 367, @@ -25532,8 +25532,8 @@ }, "object": { "type": "MemberExpression", - "start": 13038, - "end": 13055, + "start": 13046, + "end": 13063, "loc": { "start": { "line": 367, @@ -25546,8 +25546,8 @@ }, "object": { "type": "MemberExpression", - "start": 13038, - "end": 13048, + "start": 13046, + "end": 13056, "loc": { "start": { "line": 367, @@ -25560,8 +25560,8 @@ }, "object": { "type": "ThisExpression", - "start": 13038, - "end": 13042, + "start": 13046, + "end": 13050, "loc": { "start": { "line": 367, @@ -25575,8 +25575,8 @@ }, "property": { "type": "Identifier", - "start": 13043, - "end": 13048, + "start": 13051, + "end": 13056, "loc": { "start": { "line": 367, @@ -25594,8 +25594,8 @@ }, "property": { "type": "Identifier", - "start": 13049, - "end": 13055, + "start": 13057, + "end": 13063, "loc": { "start": { "line": 367, @@ -25613,8 +25613,8 @@ }, "property": { "type": "Identifier", - "start": 13056, - "end": 13059, + "start": 13064, + "end": 13067, "loc": { "start": { "line": 367, @@ -25633,8 +25633,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13060, - "end": 13084, + "start": 13068, + "end": 13092, "loc": { "start": { "line": 367, @@ -25647,8 +25647,8 @@ }, "object": { "type": "ThisExpression", - "start": 13060, - "end": 13064, + "start": 13068, + "end": 13072, "loc": { "start": { "line": 367, @@ -25662,8 +25662,8 @@ }, "property": { "type": "Identifier", - "start": 13065, - "end": 13084, + "start": 13073, + "end": 13092, "loc": { "start": { "line": 367, @@ -25684,8 +25684,8 @@ }, { "type": "IfStatement", - "start": 13095, - "end": 13390, + "start": 13103, + "end": 13398, "loc": { "start": { "line": 368, @@ -25698,8 +25698,8 @@ }, "test": { "type": "MemberExpression", - "start": 13099, - "end": 13111, + "start": 13107, + "end": 13119, "loc": { "start": { "line": 368, @@ -25712,8 +25712,8 @@ }, "object": { "type": "ThisExpression", - "start": 13099, - "end": 13103, + "start": 13107, + "end": 13111, "loc": { "start": { "line": 368, @@ -25727,8 +25727,8 @@ }, "property": { "type": "Identifier", - "start": 13104, - "end": 13111, + "start": 13112, + "end": 13119, "loc": { "start": { "line": 368, @@ -25746,8 +25746,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13113, - "end": 13390, + "start": 13121, + "end": 13398, "loc": { "start": { "line": 368, @@ -25761,8 +25761,8 @@ "body": [ { "type": "IfStatement", - "start": 13127, - "end": 13239, + "start": 13135, + "end": 13247, "loc": { "start": { "line": 369, @@ -25775,8 +25775,8 @@ }, "test": { "type": "BinaryExpression", - "start": 13131, - "end": 13163, + "start": 13139, + "end": 13171, "loc": { "start": { "line": 369, @@ -25789,8 +25789,8 @@ }, "left": { "type": "MemberExpression", - "start": 13131, - "end": 13154, + "start": 13139, + "end": 13162, "loc": { "start": { "line": 369, @@ -25803,8 +25803,8 @@ }, "object": { "type": "ThisExpression", - "start": 13131, - "end": 13135, + "start": 13139, + "end": 13143, "loc": { "start": { "line": 369, @@ -25818,8 +25818,8 @@ }, "property": { "type": "Identifier", - "start": 13136, - "end": 13154, + "start": 13144, + "end": 13162, "loc": { "start": { "line": 369, @@ -25838,8 +25838,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 13159, - "end": 13163, + "start": 13167, + "end": 13171, "loc": { "start": { "line": 369, @@ -25854,8 +25854,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13165, - "end": 13239, + "start": 13173, + "end": 13247, "loc": { "start": { "line": 369, @@ -25869,8 +25869,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13183, - "end": 13225, + "start": 13191, + "end": 13233, "loc": { "start": { "line": 370, @@ -25883,8 +25883,8 @@ }, "expression": { "type": "CallExpression", - "start": 13183, - "end": 13224, + "start": 13191, + "end": 13232, "loc": { "start": { "line": 370, @@ -25897,8 +25897,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13183, - "end": 13199, + "start": 13191, + "end": 13207, "loc": { "start": { "line": 370, @@ -25911,8 +25911,8 @@ }, "object": { "type": "MemberExpression", - "start": 13183, - "end": 13195, + "start": 13191, + "end": 13203, "loc": { "start": { "line": 370, @@ -25925,8 +25925,8 @@ }, "object": { "type": "ThisExpression", - "start": 13183, - "end": 13187, + "start": 13191, + "end": 13195, "loc": { "start": { "line": 370, @@ -25940,8 +25940,8 @@ }, "property": { "type": "Identifier", - "start": 13188, - "end": 13195, + "start": 13196, + "end": 13203, "loc": { "start": { "line": 370, @@ -25959,8 +25959,8 @@ }, "property": { "type": "Identifier", - "start": 13196, - "end": 13199, + "start": 13204, + "end": 13207, "loc": { "start": { "line": 370, @@ -25979,8 +25979,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13200, - "end": 13223, + "start": 13208, + "end": 13231, "loc": { "start": { "line": 370, @@ -25993,8 +25993,8 @@ }, "object": { "type": "ThisExpression", - "start": 13200, - "end": 13204, + "start": 13208, + "end": 13212, "loc": { "start": { "line": 370, @@ -26008,8 +26008,8 @@ }, "property": { "type": "Identifier", - "start": 13205, - "end": 13223, + "start": 13213, + "end": 13231, "loc": { "start": { "line": 370, @@ -26035,8 +26035,8 @@ }, { "type": "IfStatement", - "start": 13252, - "end": 13380, + "start": 13260, + "end": 13388, "loc": { "start": { "line": 372, @@ -26049,8 +26049,8 @@ }, "test": { "type": "BinaryExpression", - "start": 13256, - "end": 13293, + "start": 13264, + "end": 13301, "loc": { "start": { "line": 372, @@ -26063,8 +26063,8 @@ }, "left": { "type": "MemberExpression", - "start": 13256, - "end": 13284, + "start": 13264, + "end": 13292, "loc": { "start": { "line": 372, @@ -26077,8 +26077,8 @@ }, "object": { "type": "ThisExpression", - "start": 13256, - "end": 13260, + "start": 13264, + "end": 13268, "loc": { "start": { "line": 372, @@ -26092,8 +26092,8 @@ }, "property": { "type": "Identifier", - "start": 13261, - "end": 13284, + "start": 13269, + "end": 13292, "loc": { "start": { "line": 372, @@ -26112,8 +26112,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 13289, - "end": 13293, + "start": 13297, + "end": 13301, "loc": { "start": { "line": 372, @@ -26128,8 +26128,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 13295, - "end": 13380, + "start": 13303, + "end": 13388, "loc": { "start": { "line": 372, @@ -26143,8 +26143,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 13313, - "end": 13366, + "start": 13321, + "end": 13374, "loc": { "start": { "line": 373, @@ -26157,8 +26157,8 @@ }, "expression": { "type": "CallExpression", - "start": 13313, - "end": 13365, + "start": 13321, + "end": 13373, "loc": { "start": { "line": 373, @@ -26171,8 +26171,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13313, - "end": 13335, + "start": 13321, + "end": 13343, "loc": { "start": { "line": 373, @@ -26185,8 +26185,8 @@ }, "object": { "type": "MemberExpression", - "start": 13313, - "end": 13331, + "start": 13321, + "end": 13339, "loc": { "start": { "line": 373, @@ -26199,8 +26199,8 @@ }, "object": { "type": "MemberExpression", - "start": 13313, - "end": 13325, + "start": 13321, + "end": 13333, "loc": { "start": { "line": 373, @@ -26213,8 +26213,8 @@ }, "object": { "type": "ThisExpression", - "start": 13313, - "end": 13317, + "start": 13321, + "end": 13325, "loc": { "start": { "line": 373, @@ -26228,8 +26228,8 @@ }, "property": { "type": "Identifier", - "start": 13318, - "end": 13325, + "start": 13326, + "end": 13333, "loc": { "start": { "line": 373, @@ -26247,8 +26247,8 @@ }, "property": { "type": "Identifier", - "start": 13326, - "end": 13331, + "start": 13334, + "end": 13339, "loc": { "start": { "line": 373, @@ -26266,8 +26266,8 @@ }, "property": { "type": "Identifier", - "start": 13332, - "end": 13335, + "start": 13340, + "end": 13343, "loc": { "start": { "line": 373, @@ -26286,8 +26286,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 13336, - "end": 13364, + "start": 13344, + "end": 13372, "loc": { "start": { "line": 373, @@ -26300,8 +26300,8 @@ }, "object": { "type": "ThisExpression", - "start": 13336, - "end": 13340, + "start": 13344, + "end": 13348, "loc": { "start": { "line": 373, @@ -26315,8 +26315,8 @@ }, "property": { "type": "Identifier", - "start": 13341, - "end": 13364, + "start": 13349, + "end": 13372, "loc": { "start": { "line": 373, @@ -26347,8 +26347,8 @@ }, { "type": "ExpressionStatement", - "start": 13399, - "end": 13433, + "start": 13407, + "end": 13441, "loc": { "start": { "line": 376, @@ -26361,8 +26361,8 @@ }, "expression": { "type": "CallExpression", - "start": 13399, - "end": 13432, + "start": 13407, + "end": 13440, "loc": { "start": { "line": 376, @@ -26375,8 +26375,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13399, - "end": 13426, + "start": 13407, + "end": 13434, "loc": { "start": { "line": 376, @@ -26389,8 +26389,8 @@ }, "object": { "type": "MemberExpression", - "start": 13399, - "end": 13413, + "start": 13407, + "end": 13421, "loc": { "start": { "line": 376, @@ -26403,8 +26403,8 @@ }, "object": { "type": "ThisExpression", - "start": 13399, - "end": 13403, + "start": 13407, + "end": 13411, "loc": { "start": { "line": 376, @@ -26418,8 +26418,8 @@ }, "property": { "type": "Identifier", - "start": 13404, - "end": 13413, + "start": 13412, + "end": 13421, "loc": { "start": { "line": 376, @@ -26437,8 +26437,8 @@ }, "property": { "type": "Identifier", - "start": 13414, - "end": 13426, + "start": 13422, + "end": 13434, "loc": { "start": { "line": 376, @@ -26457,8 +26457,8 @@ "arguments": [ { "type": "ThisExpression", - "start": 13427, - "end": 13431, + "start": 13435, + "end": 13439, "loc": { "start": { "line": 376, @@ -26475,8 +26475,8 @@ }, { "type": "ExpressionStatement", - "start": 13442, - "end": 13458, + "start": 13450, + "end": 13466, "loc": { "start": { "line": 377, @@ -26489,8 +26489,8 @@ }, "expression": { "type": "CallExpression", - "start": 13442, - "end": 13457, + "start": 13450, + "end": 13465, "loc": { "start": { "line": 377, @@ -26503,8 +26503,8 @@ }, "callee": { "type": "MemberExpression", - "start": 13442, - "end": 13455, + "start": 13450, + "end": 13463, "loc": { "start": { "line": 377, @@ -26517,8 +26517,8 @@ }, "object": { "type": "Super", - "start": 13442, - "end": 13447, + "start": 13450, + "end": 13455, "loc": { "start": { "line": 377, @@ -26532,8 +26532,8 @@ }, "property": { "type": "Identifier", - "start": 13448, - "end": 13455, + "start": 13456, + "end": 13463, "loc": { "start": { "line": 377, @@ -26559,8 +26559,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -26579,9 +26579,9 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker({\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", + "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker(viewer, {\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", "start": 261, - "end": 4561, + "end": 4569, "loc": { "start": { "line": 10, @@ -26607,9 +26607,9 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker({\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", + "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker(viewer, {\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", "start": 261, - "end": 4561, + "end": 4569, "loc": { "start": { "line": 10, @@ -26624,8 +26624,8 @@ { "type": "CommentBlock", "value": "*\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n ", - "start": 4600, - "end": 5405, + "start": 4608, + "end": 5413, "loc": { "start": { "line": 116, @@ -26640,8 +26640,8 @@ { "type": "CommentLine", "value": " this._needUpdate() schedules this for next tick", - "start": 6331, - "end": 6381, + "start": 6339, + "end": 6389, "loc": { "start": { "line": 158, @@ -26656,8 +26656,8 @@ { "type": "CommentLine", "value": " Called by VisibilityTester and this._entity.on(\"destroyed\"..)", - "start": 7227, - "end": 7291, + "start": 7235, + "end": 7299, "loc": { "start": { "line": 177, @@ -26672,8 +26672,8 @@ { "type": "CommentLine", "value": " return;", - "start": 7345, - "end": 7356, + "start": 7353, + "end": 7364, "loc": { "start": { "line": 179, @@ -26688,8 +26688,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -26704,8 +26704,8 @@ { "type": "CommentLine", "value": " SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel", - "start": 8448, - "end": 8531, + "start": 8456, + "end": 8539, "loc": { "start": { "line": 210, @@ -26720,8 +26720,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -26736,8 +26736,8 @@ { "type": "CommentBlock", "value": " forget ", - "start": 9006, - "end": 9018, + "start": 9014, + "end": 9026, "loc": { "start": { "line": 221, @@ -26752,8 +26752,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -26768,8 +26768,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -26784,8 +26784,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -26800,8 +26800,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -26816,8 +26816,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -26832,8 +26832,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -26848,8 +26848,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -26864,8 +26864,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -26880,8 +26880,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -26896,8 +26896,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -26912,8 +26912,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -28131,9 +28131,9 @@ }, { "type": "CommentBlock", - "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker({\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", + "value": "*\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker(viewer, {\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n ", "start": 261, - "end": 4561, + "end": 4569, "loc": { "start": { "line": 10, @@ -28160,8 +28160,8 @@ "updateContext": null }, "value": "class", - "start": 4562, - "end": 4567, + "start": 4570, + "end": 4575, "loc": { "start": { "line": 114, @@ -28186,8 +28186,8 @@ "binop": null }, "value": "Marker", - "start": 4568, - "end": 4574, + "start": 4576, + "end": 4582, "loc": { "start": { "line": 114, @@ -28214,8 +28214,8 @@ "updateContext": null }, "value": "extends", - "start": 4575, - "end": 4582, + "start": 4583, + "end": 4590, "loc": { "start": { "line": 114, @@ -28240,8 +28240,8 @@ "binop": null }, "value": "Component", - "start": 4583, - "end": 4592, + "start": 4591, + "end": 4600, "loc": { "start": { "line": 114, @@ -28265,8 +28265,8 @@ "postfix": false, "binop": null }, - "start": 4593, - "end": 4594, + "start": 4601, + "end": 4602, "loc": { "start": { "line": 114, @@ -28281,8 +28281,8 @@ { "type": "CommentBlock", "value": "*\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n ", - "start": 4600, - "end": 5405, + "start": 4608, + "end": 5413, "loc": { "start": { "line": 116, @@ -28307,8 +28307,8 @@ "binop": null }, "value": "constructor", - "start": 5410, - "end": 5421, + "start": 5418, + "end": 5429, "loc": { "start": { "line": 125, @@ -28332,8 +28332,8 @@ "postfix": false, "binop": null }, - "start": 5421, - "end": 5422, + "start": 5429, + "end": 5430, "loc": { "start": { "line": 125, @@ -28358,8 +28358,8 @@ "binop": null }, "value": "owner", - "start": 5422, - "end": 5427, + "start": 5430, + "end": 5435, "loc": { "start": { "line": 125, @@ -28384,8 +28384,8 @@ "binop": null, "updateContext": null }, - "start": 5427, - "end": 5428, + "start": 5435, + "end": 5436, "loc": { "start": { "line": 125, @@ -28410,8 +28410,8 @@ "binop": null }, "value": "cfg", - "start": 5429, - "end": 5432, + "start": 5437, + "end": 5440, "loc": { "start": { "line": 125, @@ -28435,8 +28435,8 @@ "postfix": false, "binop": null }, - "start": 5432, - "end": 5433, + "start": 5440, + "end": 5441, "loc": { "start": { "line": 125, @@ -28460,8 +28460,8 @@ "postfix": false, "binop": null }, - "start": 5434, - "end": 5435, + "start": 5442, + "end": 5443, "loc": { "start": { "line": 125, @@ -28488,8 +28488,8 @@ "updateContext": null }, "value": "super", - "start": 5445, - "end": 5450, + "start": 5453, + "end": 5458, "loc": { "start": { "line": 127, @@ -28513,8 +28513,8 @@ "postfix": false, "binop": null }, - "start": 5450, - "end": 5451, + "start": 5458, + "end": 5459, "loc": { "start": { "line": 127, @@ -28539,8 +28539,8 @@ "binop": null }, "value": "owner", - "start": 5451, - "end": 5456, + "start": 5459, + "end": 5464, "loc": { "start": { "line": 127, @@ -28565,8 +28565,8 @@ "binop": null, "updateContext": null }, - "start": 5456, - "end": 5457, + "start": 5464, + "end": 5465, "loc": { "start": { "line": 127, @@ -28591,8 +28591,8 @@ "binop": null }, "value": "cfg", - "start": 5458, - "end": 5461, + "start": 5466, + "end": 5469, "loc": { "start": { "line": 127, @@ -28616,8 +28616,8 @@ "postfix": false, "binop": null }, - "start": 5461, - "end": 5462, + "start": 5469, + "end": 5470, "loc": { "start": { "line": 127, @@ -28642,8 +28642,8 @@ "binop": null, "updateContext": null }, - "start": 5462, - "end": 5463, + "start": 5470, + "end": 5471, "loc": { "start": { "line": 127, @@ -28670,8 +28670,8 @@ "updateContext": null }, "value": "this", - "start": 5473, - "end": 5477, + "start": 5481, + "end": 5485, "loc": { "start": { "line": 129, @@ -28696,8 +28696,8 @@ "binop": null, "updateContext": null }, - "start": 5477, - "end": 5478, + "start": 5485, + "end": 5486, "loc": { "start": { "line": 129, @@ -28722,8 +28722,8 @@ "binop": null }, "value": "_entity", - "start": 5478, - "end": 5485, + "start": 5486, + "end": 5493, "loc": { "start": { "line": 129, @@ -28749,8 +28749,8 @@ "updateContext": null }, "value": "=", - "start": 5486, - "end": 5487, + "start": 5494, + "end": 5495, "loc": { "start": { "line": 129, @@ -28777,8 +28777,8 @@ "updateContext": null }, "value": "null", - "start": 5488, - "end": 5492, + "start": 5496, + "end": 5500, "loc": { "start": { "line": 129, @@ -28803,8 +28803,8 @@ "binop": null, "updateContext": null }, - "start": 5492, - "end": 5493, + "start": 5500, + "end": 5501, "loc": { "start": { "line": 129, @@ -28831,8 +28831,8 @@ "updateContext": null }, "value": "this", - "start": 5502, - "end": 5506, + "start": 5510, + "end": 5514, "loc": { "start": { "line": 130, @@ -28857,8 +28857,8 @@ "binop": null, "updateContext": null }, - "start": 5506, - "end": 5507, + "start": 5514, + "end": 5515, "loc": { "start": { "line": 130, @@ -28883,8 +28883,8 @@ "binop": null }, "value": "_visible", - "start": 5507, - "end": 5515, + "start": 5515, + "end": 5523, "loc": { "start": { "line": 130, @@ -28910,8 +28910,8 @@ "updateContext": null }, "value": "=", - "start": 5516, - "end": 5517, + "start": 5524, + "end": 5525, "loc": { "start": { "line": 130, @@ -28938,8 +28938,8 @@ "updateContext": null }, "value": "null", - "start": 5518, - "end": 5522, + "start": 5526, + "end": 5530, "loc": { "start": { "line": 130, @@ -28964,8 +28964,8 @@ "binop": null, "updateContext": null }, - "start": 5522, - "end": 5523, + "start": 5530, + "end": 5531, "loc": { "start": { "line": 130, @@ -28992,8 +28992,8 @@ "updateContext": null }, "value": "this", - "start": 5532, - "end": 5536, + "start": 5540, + "end": 5544, "loc": { "start": { "line": 131, @@ -29018,8 +29018,8 @@ "binop": null, "updateContext": null }, - "start": 5536, - "end": 5537, + "start": 5544, + "end": 5545, "loc": { "start": { "line": 131, @@ -29044,8 +29044,8 @@ "binop": null }, "value": "_worldPos", - "start": 5537, - "end": 5546, + "start": 5545, + "end": 5554, "loc": { "start": { "line": 131, @@ -29071,8 +29071,8 @@ "updateContext": null }, "value": "=", - "start": 5547, - "end": 5548, + "start": 5555, + "end": 5556, "loc": { "start": { "line": 131, @@ -29097,8 +29097,8 @@ "binop": null }, "value": "math", - "start": 5549, - "end": 5553, + "start": 5557, + "end": 5561, "loc": { "start": { "line": 131, @@ -29123,8 +29123,8 @@ "binop": null, "updateContext": null }, - "start": 5553, - "end": 5554, + "start": 5561, + "end": 5562, "loc": { "start": { "line": 131, @@ -29149,8 +29149,8 @@ "binop": null }, "value": "vec3", - "start": 5554, - "end": 5558, + "start": 5562, + "end": 5566, "loc": { "start": { "line": 131, @@ -29174,8 +29174,8 @@ "postfix": false, "binop": null }, - "start": 5558, - "end": 5559, + "start": 5566, + "end": 5567, "loc": { "start": { "line": 131, @@ -29199,8 +29199,8 @@ "postfix": false, "binop": null }, - "start": 5559, - "end": 5560, + "start": 5567, + "end": 5568, "loc": { "start": { "line": 131, @@ -29225,8 +29225,8 @@ "binop": null, "updateContext": null }, - "start": 5560, - "end": 5561, + "start": 5568, + "end": 5569, "loc": { "start": { "line": 131, @@ -29253,8 +29253,8 @@ "updateContext": null }, "value": "this", - "start": 5570, - "end": 5574, + "start": 5578, + "end": 5582, "loc": { "start": { "line": 132, @@ -29279,8 +29279,8 @@ "binop": null, "updateContext": null }, - "start": 5574, - "end": 5575, + "start": 5582, + "end": 5583, "loc": { "start": { "line": 132, @@ -29305,8 +29305,8 @@ "binop": null }, "value": "_origin", - "start": 5575, - "end": 5582, + "start": 5583, + "end": 5590, "loc": { "start": { "line": 132, @@ -29332,8 +29332,8 @@ "updateContext": null }, "value": "=", - "start": 5583, - "end": 5584, + "start": 5591, + "end": 5592, "loc": { "start": { "line": 132, @@ -29358,8 +29358,8 @@ "binop": null }, "value": "math", - "start": 5585, - "end": 5589, + "start": 5593, + "end": 5597, "loc": { "start": { "line": 132, @@ -29384,8 +29384,8 @@ "binop": null, "updateContext": null }, - "start": 5589, - "end": 5590, + "start": 5597, + "end": 5598, "loc": { "start": { "line": 132, @@ -29410,8 +29410,8 @@ "binop": null }, "value": "vec3", - "start": 5590, - "end": 5594, + "start": 5598, + "end": 5602, "loc": { "start": { "line": 132, @@ -29435,8 +29435,8 @@ "postfix": false, "binop": null }, - "start": 5594, - "end": 5595, + "start": 5602, + "end": 5603, "loc": { "start": { "line": 132, @@ -29460,8 +29460,8 @@ "postfix": false, "binop": null }, - "start": 5595, - "end": 5596, + "start": 5603, + "end": 5604, "loc": { "start": { "line": 132, @@ -29486,8 +29486,8 @@ "binop": null, "updateContext": null }, - "start": 5596, - "end": 5597, + "start": 5604, + "end": 5605, "loc": { "start": { "line": 132, @@ -29514,8 +29514,8 @@ "updateContext": null }, "value": "this", - "start": 5606, - "end": 5610, + "start": 5614, + "end": 5618, "loc": { "start": { "line": 133, @@ -29540,8 +29540,8 @@ "binop": null, "updateContext": null }, - "start": 5610, - "end": 5611, + "start": 5618, + "end": 5619, "loc": { "start": { "line": 133, @@ -29566,8 +29566,8 @@ "binop": null }, "value": "_rtcPos", - "start": 5611, - "end": 5618, + "start": 5619, + "end": 5626, "loc": { "start": { "line": 133, @@ -29593,8 +29593,8 @@ "updateContext": null }, "value": "=", - "start": 5619, - "end": 5620, + "start": 5627, + "end": 5628, "loc": { "start": { "line": 133, @@ -29619,8 +29619,8 @@ "binop": null }, "value": "math", - "start": 5621, - "end": 5625, + "start": 5629, + "end": 5633, "loc": { "start": { "line": 133, @@ -29645,8 +29645,8 @@ "binop": null, "updateContext": null }, - "start": 5625, - "end": 5626, + "start": 5633, + "end": 5634, "loc": { "start": { "line": 133, @@ -29671,8 +29671,8 @@ "binop": null }, "value": "vec3", - "start": 5626, - "end": 5630, + "start": 5634, + "end": 5638, "loc": { "start": { "line": 133, @@ -29696,8 +29696,8 @@ "postfix": false, "binop": null }, - "start": 5630, - "end": 5631, + "start": 5638, + "end": 5639, "loc": { "start": { "line": 133, @@ -29721,8 +29721,8 @@ "postfix": false, "binop": null }, - "start": 5631, - "end": 5632, + "start": 5639, + "end": 5640, "loc": { "start": { "line": 133, @@ -29747,8 +29747,8 @@ "binop": null, "updateContext": null }, - "start": 5632, - "end": 5633, + "start": 5640, + "end": 5641, "loc": { "start": { "line": 133, @@ -29775,8 +29775,8 @@ "updateContext": null }, "value": "this", - "start": 5642, - "end": 5646, + "start": 5650, + "end": 5654, "loc": { "start": { "line": 134, @@ -29801,8 +29801,8 @@ "binop": null, "updateContext": null }, - "start": 5646, - "end": 5647, + "start": 5654, + "end": 5655, "loc": { "start": { "line": 134, @@ -29827,8 +29827,8 @@ "binop": null }, "value": "_viewPos", - "start": 5647, - "end": 5655, + "start": 5655, + "end": 5663, "loc": { "start": { "line": 134, @@ -29854,8 +29854,8 @@ "updateContext": null }, "value": "=", - "start": 5656, - "end": 5657, + "start": 5664, + "end": 5665, "loc": { "start": { "line": 134, @@ -29880,8 +29880,8 @@ "binop": null }, "value": "math", - "start": 5658, - "end": 5662, + "start": 5666, + "end": 5670, "loc": { "start": { "line": 134, @@ -29906,8 +29906,8 @@ "binop": null, "updateContext": null }, - "start": 5662, - "end": 5663, + "start": 5670, + "end": 5671, "loc": { "start": { "line": 134, @@ -29932,8 +29932,8 @@ "binop": null }, "value": "vec3", - "start": 5663, - "end": 5667, + "start": 5671, + "end": 5675, "loc": { "start": { "line": 134, @@ -29957,8 +29957,8 @@ "postfix": false, "binop": null }, - "start": 5667, - "end": 5668, + "start": 5675, + "end": 5676, "loc": { "start": { "line": 134, @@ -29982,8 +29982,8 @@ "postfix": false, "binop": null }, - "start": 5668, - "end": 5669, + "start": 5676, + "end": 5677, "loc": { "start": { "line": 134, @@ -30008,8 +30008,8 @@ "binop": null, "updateContext": null }, - "start": 5669, - "end": 5670, + "start": 5677, + "end": 5678, "loc": { "start": { "line": 134, @@ -30036,8 +30036,8 @@ "updateContext": null }, "value": "this", - "start": 5679, - "end": 5683, + "start": 5687, + "end": 5691, "loc": { "start": { "line": 135, @@ -30062,8 +30062,8 @@ "binop": null, "updateContext": null }, - "start": 5683, - "end": 5684, + "start": 5691, + "end": 5692, "loc": { "start": { "line": 135, @@ -30088,8 +30088,8 @@ "binop": null }, "value": "_canvasPos", - "start": 5684, - "end": 5694, + "start": 5692, + "end": 5702, "loc": { "start": { "line": 135, @@ -30115,8 +30115,8 @@ "updateContext": null }, "value": "=", - "start": 5695, - "end": 5696, + "start": 5703, + "end": 5704, "loc": { "start": { "line": 135, @@ -30141,8 +30141,8 @@ "binop": null }, "value": "math", - "start": 5697, - "end": 5701, + "start": 5705, + "end": 5709, "loc": { "start": { "line": 135, @@ -30167,8 +30167,8 @@ "binop": null, "updateContext": null }, - "start": 5701, - "end": 5702, + "start": 5709, + "end": 5710, "loc": { "start": { "line": 135, @@ -30193,8 +30193,8 @@ "binop": null }, "value": "vec2", - "start": 5702, - "end": 5706, + "start": 5710, + "end": 5714, "loc": { "start": { "line": 135, @@ -30218,8 +30218,8 @@ "postfix": false, "binop": null }, - "start": 5706, - "end": 5707, + "start": 5714, + "end": 5715, "loc": { "start": { "line": 135, @@ -30243,8 +30243,8 @@ "postfix": false, "binop": null }, - "start": 5707, - "end": 5708, + "start": 5715, + "end": 5716, "loc": { "start": { "line": 135, @@ -30269,8 +30269,8 @@ "binop": null, "updateContext": null }, - "start": 5708, - "end": 5709, + "start": 5716, + "end": 5717, "loc": { "start": { "line": 135, @@ -30297,8 +30297,8 @@ "updateContext": null }, "value": "this", - "start": 5718, - "end": 5722, + "start": 5726, + "end": 5730, "loc": { "start": { "line": 136, @@ -30323,8 +30323,8 @@ "binop": null, "updateContext": null }, - "start": 5722, - "end": 5723, + "start": 5730, + "end": 5731, "loc": { "start": { "line": 136, @@ -30349,8 +30349,8 @@ "binop": null }, "value": "_occludable", - "start": 5723, - "end": 5734, + "start": 5731, + "end": 5742, "loc": { "start": { "line": 136, @@ -30376,8 +30376,8 @@ "updateContext": null }, "value": "=", - "start": 5735, - "end": 5736, + "start": 5743, + "end": 5744, "loc": { "start": { "line": 136, @@ -30404,8 +30404,8 @@ "updateContext": null }, "value": "false", - "start": 5737, - "end": 5742, + "start": 5745, + "end": 5750, "loc": { "start": { "line": 136, @@ -30430,8 +30430,8 @@ "binop": null, "updateContext": null }, - "start": 5742, - "end": 5743, + "start": 5750, + "end": 5751, "loc": { "start": { "line": 136, @@ -30458,8 +30458,8 @@ "updateContext": null }, "value": "this", - "start": 5753, - "end": 5757, + "start": 5761, + "end": 5765, "loc": { "start": { "line": 138, @@ -30484,8 +30484,8 @@ "binop": null, "updateContext": null }, - "start": 5757, - "end": 5758, + "start": 5765, + "end": 5766, "loc": { "start": { "line": 138, @@ -30510,8 +30510,8 @@ "binop": null }, "value": "_onCameraViewMatrix", - "start": 5758, - "end": 5777, + "start": 5766, + "end": 5785, "loc": { "start": { "line": 138, @@ -30537,8 +30537,8 @@ "updateContext": null }, "value": "=", - "start": 5778, - "end": 5779, + "start": 5786, + "end": 5787, "loc": { "start": { "line": 138, @@ -30565,8 +30565,8 @@ "updateContext": null }, "value": "this", - "start": 5780, - "end": 5784, + "start": 5788, + "end": 5792, "loc": { "start": { "line": 138, @@ -30591,8 +30591,8 @@ "binop": null, "updateContext": null }, - "start": 5784, - "end": 5785, + "start": 5792, + "end": 5793, "loc": { "start": { "line": 138, @@ -30617,8 +30617,8 @@ "binop": null }, "value": "scene", - "start": 5785, - "end": 5790, + "start": 5793, + "end": 5798, "loc": { "start": { "line": 138, @@ -30643,8 +30643,8 @@ "binop": null, "updateContext": null }, - "start": 5790, - "end": 5791, + "start": 5798, + "end": 5799, "loc": { "start": { "line": 138, @@ -30669,8 +30669,8 @@ "binop": null }, "value": "camera", - "start": 5791, - "end": 5797, + "start": 5799, + "end": 5805, "loc": { "start": { "line": 138, @@ -30695,8 +30695,8 @@ "binop": null, "updateContext": null }, - "start": 5797, - "end": 5798, + "start": 5805, + "end": 5806, "loc": { "start": { "line": 138, @@ -30721,8 +30721,8 @@ "binop": null }, "value": "on", - "start": 5798, - "end": 5800, + "start": 5806, + "end": 5808, "loc": { "start": { "line": 138, @@ -30746,8 +30746,8 @@ "postfix": false, "binop": null }, - "start": 5800, - "end": 5801, + "start": 5808, + "end": 5809, "loc": { "start": { "line": 138, @@ -30773,8 +30773,8 @@ "updateContext": null }, "value": "matrix", - "start": 5801, - "end": 5809, + "start": 5809, + "end": 5817, "loc": { "start": { "line": 138, @@ -30799,8 +30799,8 @@ "binop": null, "updateContext": null }, - "start": 5809, - "end": 5810, + "start": 5817, + "end": 5818, "loc": { "start": { "line": 138, @@ -30824,8 +30824,8 @@ "postfix": false, "binop": null }, - "start": 5811, - "end": 5812, + "start": 5819, + "end": 5820, "loc": { "start": { "line": 138, @@ -30849,8 +30849,8 @@ "postfix": false, "binop": null }, - "start": 5812, - "end": 5813, + "start": 5820, + "end": 5821, "loc": { "start": { "line": 138, @@ -30875,8 +30875,8 @@ "binop": null, "updateContext": null }, - "start": 5814, - "end": 5816, + "start": 5822, + "end": 5824, "loc": { "start": { "line": 138, @@ -30900,8 +30900,8 @@ "postfix": false, "binop": null }, - "start": 5817, - "end": 5818, + "start": 5825, + "end": 5826, "loc": { "start": { "line": 138, @@ -30928,8 +30928,8 @@ "updateContext": null }, "value": "this", - "start": 5831, - "end": 5835, + "start": 5839, + "end": 5843, "loc": { "start": { "line": 139, @@ -30954,8 +30954,8 @@ "binop": null, "updateContext": null }, - "start": 5835, - "end": 5836, + "start": 5843, + "end": 5844, "loc": { "start": { "line": 139, @@ -30980,8 +30980,8 @@ "binop": null }, "value": "_viewPosDirty", - "start": 5836, - "end": 5849, + "start": 5844, + "end": 5857, "loc": { "start": { "line": 139, @@ -31007,8 +31007,8 @@ "updateContext": null }, "value": "=", - "start": 5850, - "end": 5851, + "start": 5858, + "end": 5859, "loc": { "start": { "line": 139, @@ -31035,8 +31035,8 @@ "updateContext": null }, "value": "true", - "start": 5852, - "end": 5856, + "start": 5860, + "end": 5864, "loc": { "start": { "line": 139, @@ -31061,8 +31061,8 @@ "binop": null, "updateContext": null }, - "start": 5856, - "end": 5857, + "start": 5864, + "end": 5865, "loc": { "start": { "line": 139, @@ -31089,8 +31089,8 @@ "updateContext": null }, "value": "this", - "start": 5870, - "end": 5874, + "start": 5878, + "end": 5882, "loc": { "start": { "line": 140, @@ -31115,8 +31115,8 @@ "binop": null, "updateContext": null }, - "start": 5874, - "end": 5875, + "start": 5882, + "end": 5883, "loc": { "start": { "line": 140, @@ -31141,8 +31141,8 @@ "binop": null }, "value": "_needUpdate", - "start": 5875, - "end": 5886, + "start": 5883, + "end": 5894, "loc": { "start": { "line": 140, @@ -31166,8 +31166,8 @@ "postfix": false, "binop": null }, - "start": 5886, - "end": 5887, + "start": 5894, + "end": 5895, "loc": { "start": { "line": 140, @@ -31191,8 +31191,8 @@ "postfix": false, "binop": null }, - "start": 5887, - "end": 5888, + "start": 5895, + "end": 5896, "loc": { "start": { "line": 140, @@ -31217,8 +31217,8 @@ "binop": null, "updateContext": null }, - "start": 5888, - "end": 5889, + "start": 5896, + "end": 5897, "loc": { "start": { "line": 140, @@ -31242,8 +31242,8 @@ "postfix": false, "binop": null }, - "start": 5898, - "end": 5899, + "start": 5906, + "end": 5907, "loc": { "start": { "line": 141, @@ -31267,8 +31267,8 @@ "postfix": false, "binop": null }, - "start": 5899, - "end": 5900, + "start": 5907, + "end": 5908, "loc": { "start": { "line": 141, @@ -31293,8 +31293,8 @@ "binop": null, "updateContext": null }, - "start": 5900, - "end": 5901, + "start": 5908, + "end": 5909, "loc": { "start": { "line": 141, @@ -31321,8 +31321,8 @@ "updateContext": null }, "value": "this", - "start": 5911, - "end": 5915, + "start": 5919, + "end": 5923, "loc": { "start": { "line": 143, @@ -31347,8 +31347,8 @@ "binop": null, "updateContext": null }, - "start": 5915, - "end": 5916, + "start": 5923, + "end": 5924, "loc": { "start": { "line": 143, @@ -31373,8 +31373,8 @@ "binop": null }, "value": "_onCameraProjMatrix", - "start": 5916, - "end": 5935, + "start": 5924, + "end": 5943, "loc": { "start": { "line": 143, @@ -31400,8 +31400,8 @@ "updateContext": null }, "value": "=", - "start": 5936, - "end": 5937, + "start": 5944, + "end": 5945, "loc": { "start": { "line": 143, @@ -31428,8 +31428,8 @@ "updateContext": null }, "value": "this", - "start": 5938, - "end": 5942, + "start": 5946, + "end": 5950, "loc": { "start": { "line": 143, @@ -31454,8 +31454,8 @@ "binop": null, "updateContext": null }, - "start": 5942, - "end": 5943, + "start": 5950, + "end": 5951, "loc": { "start": { "line": 143, @@ -31480,8 +31480,8 @@ "binop": null }, "value": "scene", - "start": 5943, - "end": 5948, + "start": 5951, + "end": 5956, "loc": { "start": { "line": 143, @@ -31506,8 +31506,8 @@ "binop": null, "updateContext": null }, - "start": 5948, - "end": 5949, + "start": 5956, + "end": 5957, "loc": { "start": { "line": 143, @@ -31532,8 +31532,8 @@ "binop": null }, "value": "camera", - "start": 5949, - "end": 5955, + "start": 5957, + "end": 5963, "loc": { "start": { "line": 143, @@ -31558,8 +31558,8 @@ "binop": null, "updateContext": null }, - "start": 5955, - "end": 5956, + "start": 5963, + "end": 5964, "loc": { "start": { "line": 143, @@ -31584,8 +31584,8 @@ "binop": null }, "value": "on", - "start": 5956, - "end": 5958, + "start": 5964, + "end": 5966, "loc": { "start": { "line": 143, @@ -31609,8 +31609,8 @@ "postfix": false, "binop": null }, - "start": 5958, - "end": 5959, + "start": 5966, + "end": 5967, "loc": { "start": { "line": 143, @@ -31636,8 +31636,8 @@ "updateContext": null }, "value": "projMatrix", - "start": 5959, - "end": 5971, + "start": 5967, + "end": 5979, "loc": { "start": { "line": 143, @@ -31662,8 +31662,8 @@ "binop": null, "updateContext": null }, - "start": 5971, - "end": 5972, + "start": 5979, + "end": 5980, "loc": { "start": { "line": 143, @@ -31687,8 +31687,8 @@ "postfix": false, "binop": null }, - "start": 5973, - "end": 5974, + "start": 5981, + "end": 5982, "loc": { "start": { "line": 143, @@ -31712,8 +31712,8 @@ "postfix": false, "binop": null }, - "start": 5974, - "end": 5975, + "start": 5982, + "end": 5983, "loc": { "start": { "line": 143, @@ -31738,8 +31738,8 @@ "binop": null, "updateContext": null }, - "start": 5976, - "end": 5978, + "start": 5984, + "end": 5986, "loc": { "start": { "line": 143, @@ -31763,8 +31763,8 @@ "postfix": false, "binop": null }, - "start": 5979, - "end": 5980, + "start": 5987, + "end": 5988, "loc": { "start": { "line": 143, @@ -31791,8 +31791,8 @@ "updateContext": null }, "value": "this", - "start": 5993, - "end": 5997, + "start": 6001, + "end": 6005, "loc": { "start": { "line": 144, @@ -31817,8 +31817,8 @@ "binop": null, "updateContext": null }, - "start": 5997, - "end": 5998, + "start": 6005, + "end": 6006, "loc": { "start": { "line": 144, @@ -31843,8 +31843,8 @@ "binop": null }, "value": "_canvasPosDirty", - "start": 5998, - "end": 6013, + "start": 6006, + "end": 6021, "loc": { "start": { "line": 144, @@ -31870,8 +31870,8 @@ "updateContext": null }, "value": "=", - "start": 6014, - "end": 6015, + "start": 6022, + "end": 6023, "loc": { "start": { "line": 144, @@ -31898,8 +31898,8 @@ "updateContext": null }, "value": "true", - "start": 6016, - "end": 6020, + "start": 6024, + "end": 6028, "loc": { "start": { "line": 144, @@ -31924,8 +31924,8 @@ "binop": null, "updateContext": null }, - "start": 6020, - "end": 6021, + "start": 6028, + "end": 6029, "loc": { "start": { "line": 144, @@ -31952,8 +31952,8 @@ "updateContext": null }, "value": "this", - "start": 6034, - "end": 6038, + "start": 6042, + "end": 6046, "loc": { "start": { "line": 145, @@ -31978,8 +31978,8 @@ "binop": null, "updateContext": null }, - "start": 6038, - "end": 6039, + "start": 6046, + "end": 6047, "loc": { "start": { "line": 145, @@ -32004,8 +32004,8 @@ "binop": null }, "value": "_needUpdate", - "start": 6039, - "end": 6050, + "start": 6047, + "end": 6058, "loc": { "start": { "line": 145, @@ -32029,8 +32029,8 @@ "postfix": false, "binop": null }, - "start": 6050, - "end": 6051, + "start": 6058, + "end": 6059, "loc": { "start": { "line": 145, @@ -32054,8 +32054,8 @@ "postfix": false, "binop": null }, - "start": 6051, - "end": 6052, + "start": 6059, + "end": 6060, "loc": { "start": { "line": 145, @@ -32080,8 +32080,8 @@ "binop": null, "updateContext": null }, - "start": 6052, - "end": 6053, + "start": 6060, + "end": 6061, "loc": { "start": { "line": 145, @@ -32105,8 +32105,8 @@ "postfix": false, "binop": null }, - "start": 6062, - "end": 6063, + "start": 6070, + "end": 6071, "loc": { "start": { "line": 146, @@ -32130,8 +32130,8 @@ "postfix": false, "binop": null }, - "start": 6063, - "end": 6064, + "start": 6071, + "end": 6072, "loc": { "start": { "line": 146, @@ -32156,8 +32156,8 @@ "binop": null, "updateContext": null }, - "start": 6064, - "end": 6065, + "start": 6072, + "end": 6073, "loc": { "start": { "line": 146, @@ -32184,8 +32184,8 @@ "updateContext": null }, "value": "this", - "start": 6075, - "end": 6079, + "start": 6083, + "end": 6087, "loc": { "start": { "line": 148, @@ -32210,8 +32210,8 @@ "binop": null, "updateContext": null }, - "start": 6079, - "end": 6080, + "start": 6087, + "end": 6088, "loc": { "start": { "line": 148, @@ -32236,8 +32236,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 6080, - "end": 6098, + "start": 6088, + "end": 6106, "loc": { "start": { "line": 148, @@ -32263,8 +32263,8 @@ "updateContext": null }, "value": "=", - "start": 6099, - "end": 6100, + "start": 6107, + "end": 6108, "loc": { "start": { "line": 148, @@ -32291,8 +32291,8 @@ "updateContext": null }, "value": "null", - "start": 6101, - "end": 6105, + "start": 6109, + "end": 6113, "loc": { "start": { "line": 148, @@ -32317,8 +32317,8 @@ "binop": null, "updateContext": null }, - "start": 6105, - "end": 6106, + "start": 6113, + "end": 6114, "loc": { "start": { "line": 148, @@ -32345,8 +32345,8 @@ "updateContext": null }, "value": "this", - "start": 6115, - "end": 6119, + "start": 6123, + "end": 6127, "loc": { "start": { "line": 149, @@ -32371,8 +32371,8 @@ "binop": null, "updateContext": null }, - "start": 6119, - "end": 6120, + "start": 6127, + "end": 6128, "loc": { "start": { "line": 149, @@ -32397,8 +32397,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 6120, - "end": 6143, + "start": 6128, + "end": 6151, "loc": { "start": { "line": 149, @@ -32424,8 +32424,8 @@ "updateContext": null }, "value": "=", - "start": 6144, - "end": 6145, + "start": 6152, + "end": 6153, "loc": { "start": { "line": 149, @@ -32452,8 +32452,8 @@ "updateContext": null }, "value": "null", - "start": 6146, - "end": 6150, + "start": 6154, + "end": 6158, "loc": { "start": { "line": 149, @@ -32478,8 +32478,8 @@ "binop": null, "updateContext": null }, - "start": 6150, - "end": 6151, + "start": 6158, + "end": 6159, "loc": { "start": { "line": 149, @@ -32506,8 +32506,8 @@ "updateContext": null }, "value": "this", - "start": 6161, - "end": 6165, + "start": 6169, + "end": 6173, "loc": { "start": { "line": 151, @@ -32532,8 +32532,8 @@ "binop": null, "updateContext": null }, - "start": 6165, - "end": 6166, + "start": 6173, + "end": 6174, "loc": { "start": { "line": 151, @@ -32558,8 +32558,8 @@ "binop": null }, "value": "_renderer", - "start": 6166, - "end": 6175, + "start": 6174, + "end": 6183, "loc": { "start": { "line": 151, @@ -32584,8 +32584,8 @@ "binop": null, "updateContext": null }, - "start": 6175, - "end": 6176, + "start": 6183, + "end": 6184, "loc": { "start": { "line": 151, @@ -32610,8 +32610,8 @@ "binop": null }, "value": "addMarker", - "start": 6176, - "end": 6185, + "start": 6184, + "end": 6193, "loc": { "start": { "line": 151, @@ -32635,8 +32635,8 @@ "postfix": false, "binop": null }, - "start": 6185, - "end": 6186, + "start": 6193, + "end": 6194, "loc": { "start": { "line": 151, @@ -32663,8 +32663,8 @@ "updateContext": null }, "value": "this", - "start": 6186, - "end": 6190, + "start": 6194, + "end": 6198, "loc": { "start": { "line": 151, @@ -32688,8 +32688,8 @@ "postfix": false, "binop": null }, - "start": 6190, - "end": 6191, + "start": 6198, + "end": 6199, "loc": { "start": { "line": 151, @@ -32714,8 +32714,8 @@ "binop": null, "updateContext": null }, - "start": 6191, - "end": 6192, + "start": 6199, + "end": 6200, "loc": { "start": { "line": 151, @@ -32742,8 +32742,8 @@ "updateContext": null }, "value": "this", - "start": 6202, - "end": 6206, + "start": 6210, + "end": 6214, "loc": { "start": { "line": 153, @@ -32768,8 +32768,8 @@ "binop": null, "updateContext": null }, - "start": 6206, - "end": 6207, + "start": 6214, + "end": 6215, "loc": { "start": { "line": 153, @@ -32794,8 +32794,8 @@ "binop": null }, "value": "entity", - "start": 6207, - "end": 6213, + "start": 6215, + "end": 6221, "loc": { "start": { "line": 153, @@ -32821,8 +32821,8 @@ "updateContext": null }, "value": "=", - "start": 6214, - "end": 6215, + "start": 6222, + "end": 6223, "loc": { "start": { "line": 153, @@ -32847,8 +32847,8 @@ "binop": null }, "value": "cfg", - "start": 6216, - "end": 6219, + "start": 6224, + "end": 6227, "loc": { "start": { "line": 153, @@ -32873,8 +32873,8 @@ "binop": null, "updateContext": null }, - "start": 6219, - "end": 6220, + "start": 6227, + "end": 6228, "loc": { "start": { "line": 153, @@ -32899,8 +32899,8 @@ "binop": null }, "value": "entity", - "start": 6220, - "end": 6226, + "start": 6228, + "end": 6234, "loc": { "start": { "line": 153, @@ -32925,8 +32925,8 @@ "binop": null, "updateContext": null }, - "start": 6226, - "end": 6227, + "start": 6234, + "end": 6235, "loc": { "start": { "line": 153, @@ -32953,8 +32953,8 @@ "updateContext": null }, "value": "this", - "start": 6236, - "end": 6240, + "start": 6244, + "end": 6248, "loc": { "start": { "line": 154, @@ -32979,8 +32979,8 @@ "binop": null, "updateContext": null }, - "start": 6240, - "end": 6241, + "start": 6248, + "end": 6249, "loc": { "start": { "line": 154, @@ -33005,8 +33005,8 @@ "binop": null }, "value": "worldPos", - "start": 6241, - "end": 6249, + "start": 6249, + "end": 6257, "loc": { "start": { "line": 154, @@ -33032,8 +33032,8 @@ "updateContext": null }, "value": "=", - "start": 6250, - "end": 6251, + "start": 6258, + "end": 6259, "loc": { "start": { "line": 154, @@ -33058,8 +33058,8 @@ "binop": null }, "value": "cfg", - "start": 6252, - "end": 6255, + "start": 6260, + "end": 6263, "loc": { "start": { "line": 154, @@ -33084,8 +33084,8 @@ "binop": null, "updateContext": null }, - "start": 6255, - "end": 6256, + "start": 6263, + "end": 6264, "loc": { "start": { "line": 154, @@ -33110,8 +33110,8 @@ "binop": null }, "value": "worldPos", - "start": 6256, - "end": 6264, + "start": 6264, + "end": 6272, "loc": { "start": { "line": 154, @@ -33136,8 +33136,8 @@ "binop": null, "updateContext": null }, - "start": 6264, - "end": 6265, + "start": 6272, + "end": 6273, "loc": { "start": { "line": 154, @@ -33164,8 +33164,8 @@ "updateContext": null }, "value": "this", - "start": 6274, - "end": 6278, + "start": 6282, + "end": 6286, "loc": { "start": { "line": 155, @@ -33190,8 +33190,8 @@ "binop": null, "updateContext": null }, - "start": 6278, - "end": 6279, + "start": 6286, + "end": 6287, "loc": { "start": { "line": 155, @@ -33216,8 +33216,8 @@ "binop": null }, "value": "occludable", - "start": 6279, - "end": 6289, + "start": 6287, + "end": 6297, "loc": { "start": { "line": 155, @@ -33243,8 +33243,8 @@ "updateContext": null }, "value": "=", - "start": 6290, - "end": 6291, + "start": 6298, + "end": 6299, "loc": { "start": { "line": 155, @@ -33269,8 +33269,8 @@ "binop": null }, "value": "cfg", - "start": 6292, - "end": 6295, + "start": 6300, + "end": 6303, "loc": { "start": { "line": 155, @@ -33295,8 +33295,8 @@ "binop": null, "updateContext": null }, - "start": 6295, - "end": 6296, + "start": 6303, + "end": 6304, "loc": { "start": { "line": 155, @@ -33321,8 +33321,8 @@ "binop": null }, "value": "occludable", - "start": 6296, - "end": 6306, + "start": 6304, + "end": 6314, "loc": { "start": { "line": 155, @@ -33347,8 +33347,8 @@ "binop": null, "updateContext": null }, - "start": 6306, - "end": 6307, + "start": 6314, + "end": 6315, "loc": { "start": { "line": 155, @@ -33372,8 +33372,8 @@ "postfix": false, "binop": null }, - "start": 6312, - "end": 6313, + "start": 6320, + "end": 6321, "loc": { "start": { "line": 156, @@ -33398,8 +33398,8 @@ "binop": null }, "value": "_update", - "start": 6319, - "end": 6326, + "start": 6327, + "end": 6334, "loc": { "start": { "line": 158, @@ -33423,8 +33423,8 @@ "postfix": false, "binop": null }, - "start": 6326, - "end": 6327, + "start": 6334, + "end": 6335, "loc": { "start": { "line": 158, @@ -33448,8 +33448,8 @@ "postfix": false, "binop": null }, - "start": 6327, - "end": 6328, + "start": 6335, + "end": 6336, "loc": { "start": { "line": 158, @@ -33473,8 +33473,8 @@ "postfix": false, "binop": null }, - "start": 6329, - "end": 6330, + "start": 6337, + "end": 6338, "loc": { "start": { "line": 158, @@ -33489,8 +33489,8 @@ { "type": "CommentLine", "value": " this._needUpdate() schedules this for next tick", - "start": 6331, - "end": 6381, + "start": 6339, + "end": 6389, "loc": { "start": { "line": 158, @@ -33517,8 +33517,8 @@ "updateContext": null }, "value": "if", - "start": 6390, - "end": 6392, + "start": 6398, + "end": 6400, "loc": { "start": { "line": 159, @@ -33542,8 +33542,8 @@ "postfix": false, "binop": null }, - "start": 6393, - "end": 6394, + "start": 6401, + "end": 6402, "loc": { "start": { "line": 159, @@ -33570,8 +33570,8 @@ "updateContext": null }, "value": "this", - "start": 6394, - "end": 6398, + "start": 6402, + "end": 6406, "loc": { "start": { "line": 159, @@ -33596,8 +33596,8 @@ "binop": null, "updateContext": null }, - "start": 6398, - "end": 6399, + "start": 6406, + "end": 6407, "loc": { "start": { "line": 159, @@ -33622,8 +33622,8 @@ "binop": null }, "value": "_viewPosDirty", - "start": 6399, - "end": 6412, + "start": 6407, + "end": 6420, "loc": { "start": { "line": 159, @@ -33647,8 +33647,8 @@ "postfix": false, "binop": null }, - "start": 6412, - "end": 6413, + "start": 6420, + "end": 6421, "loc": { "start": { "line": 159, @@ -33672,8 +33672,8 @@ "postfix": false, "binop": null }, - "start": 6414, - "end": 6415, + "start": 6422, + "end": 6423, "loc": { "start": { "line": 159, @@ -33698,8 +33698,8 @@ "binop": null }, "value": "math", - "start": 6428, - "end": 6432, + "start": 6436, + "end": 6440, "loc": { "start": { "line": 160, @@ -33724,8 +33724,8 @@ "binop": null, "updateContext": null }, - "start": 6432, - "end": 6433, + "start": 6440, + "end": 6441, "loc": { "start": { "line": 160, @@ -33750,8 +33750,8 @@ "binop": null }, "value": "transformPoint3", - "start": 6433, - "end": 6448, + "start": 6441, + "end": 6456, "loc": { "start": { "line": 160, @@ -33775,8 +33775,8 @@ "postfix": false, "binop": null }, - "start": 6448, - "end": 6449, + "start": 6456, + "end": 6457, "loc": { "start": { "line": 160, @@ -33803,8 +33803,8 @@ "updateContext": null }, "value": "this", - "start": 6449, - "end": 6453, + "start": 6457, + "end": 6461, "loc": { "start": { "line": 160, @@ -33829,8 +33829,8 @@ "binop": null, "updateContext": null }, - "start": 6453, - "end": 6454, + "start": 6461, + "end": 6462, "loc": { "start": { "line": 160, @@ -33855,8 +33855,8 @@ "binop": null }, "value": "scene", - "start": 6454, - "end": 6459, + "start": 6462, + "end": 6467, "loc": { "start": { "line": 160, @@ -33881,8 +33881,8 @@ "binop": null, "updateContext": null }, - "start": 6459, - "end": 6460, + "start": 6467, + "end": 6468, "loc": { "start": { "line": 160, @@ -33907,8 +33907,8 @@ "binop": null }, "value": "camera", - "start": 6460, - "end": 6466, + "start": 6468, + "end": 6474, "loc": { "start": { "line": 160, @@ -33933,8 +33933,8 @@ "binop": null, "updateContext": null }, - "start": 6466, - "end": 6467, + "start": 6474, + "end": 6475, "loc": { "start": { "line": 160, @@ -33959,8 +33959,8 @@ "binop": null }, "value": "viewMatrix", - "start": 6467, - "end": 6477, + "start": 6475, + "end": 6485, "loc": { "start": { "line": 160, @@ -33985,8 +33985,8 @@ "binop": null, "updateContext": null }, - "start": 6477, - "end": 6478, + "start": 6485, + "end": 6486, "loc": { "start": { "line": 160, @@ -34013,8 +34013,8 @@ "updateContext": null }, "value": "this", - "start": 6479, - "end": 6483, + "start": 6487, + "end": 6491, "loc": { "start": { "line": 160, @@ -34039,8 +34039,8 @@ "binop": null, "updateContext": null }, - "start": 6483, - "end": 6484, + "start": 6491, + "end": 6492, "loc": { "start": { "line": 160, @@ -34065,8 +34065,8 @@ "binop": null }, "value": "_worldPos", - "start": 6484, - "end": 6493, + "start": 6492, + "end": 6501, "loc": { "start": { "line": 160, @@ -34091,8 +34091,8 @@ "binop": null, "updateContext": null }, - "start": 6493, - "end": 6494, + "start": 6501, + "end": 6502, "loc": { "start": { "line": 160, @@ -34119,8 +34119,8 @@ "updateContext": null }, "value": "this", - "start": 6495, - "end": 6499, + "start": 6503, + "end": 6507, "loc": { "start": { "line": 160, @@ -34145,8 +34145,8 @@ "binop": null, "updateContext": null }, - "start": 6499, - "end": 6500, + "start": 6507, + "end": 6508, "loc": { "start": { "line": 160, @@ -34171,8 +34171,8 @@ "binop": null }, "value": "_viewPos", - "start": 6500, - "end": 6508, + "start": 6508, + "end": 6516, "loc": { "start": { "line": 160, @@ -34196,8 +34196,8 @@ "postfix": false, "binop": null }, - "start": 6508, - "end": 6509, + "start": 6516, + "end": 6517, "loc": { "start": { "line": 160, @@ -34222,8 +34222,8 @@ "binop": null, "updateContext": null }, - "start": 6509, - "end": 6510, + "start": 6517, + "end": 6518, "loc": { "start": { "line": 160, @@ -34250,8 +34250,8 @@ "updateContext": null }, "value": "this", - "start": 6523, - "end": 6527, + "start": 6531, + "end": 6535, "loc": { "start": { "line": 161, @@ -34276,8 +34276,8 @@ "binop": null, "updateContext": null }, - "start": 6527, - "end": 6528, + "start": 6535, + "end": 6536, "loc": { "start": { "line": 161, @@ -34302,8 +34302,8 @@ "binop": null }, "value": "_viewPosDirty", - "start": 6528, - "end": 6541, + "start": 6536, + "end": 6549, "loc": { "start": { "line": 161, @@ -34329,8 +34329,8 @@ "updateContext": null }, "value": "=", - "start": 6542, - "end": 6543, + "start": 6550, + "end": 6551, "loc": { "start": { "line": 161, @@ -34357,8 +34357,8 @@ "updateContext": null }, "value": "false", - "start": 6544, - "end": 6549, + "start": 6552, + "end": 6557, "loc": { "start": { "line": 161, @@ -34383,8 +34383,8 @@ "binop": null, "updateContext": null }, - "start": 6549, - "end": 6550, + "start": 6557, + "end": 6558, "loc": { "start": { "line": 161, @@ -34411,8 +34411,8 @@ "updateContext": null }, "value": "this", - "start": 6563, - "end": 6567, + "start": 6571, + "end": 6575, "loc": { "start": { "line": 162, @@ -34437,8 +34437,8 @@ "binop": null, "updateContext": null }, - "start": 6567, - "end": 6568, + "start": 6575, + "end": 6576, "loc": { "start": { "line": 162, @@ -34463,8 +34463,8 @@ "binop": null }, "value": "_canvasPosDirty", - "start": 6568, - "end": 6583, + "start": 6576, + "end": 6591, "loc": { "start": { "line": 162, @@ -34490,8 +34490,8 @@ "updateContext": null }, "value": "=", - "start": 6584, - "end": 6585, + "start": 6592, + "end": 6593, "loc": { "start": { "line": 162, @@ -34518,8 +34518,8 @@ "updateContext": null }, "value": "true", - "start": 6586, - "end": 6590, + "start": 6594, + "end": 6598, "loc": { "start": { "line": 162, @@ -34544,8 +34544,8 @@ "binop": null, "updateContext": null }, - "start": 6590, - "end": 6591, + "start": 6598, + "end": 6599, "loc": { "start": { "line": 162, @@ -34572,8 +34572,8 @@ "updateContext": null }, "value": "this", - "start": 6604, - "end": 6608, + "start": 6612, + "end": 6616, "loc": { "start": { "line": 163, @@ -34598,8 +34598,8 @@ "binop": null, "updateContext": null }, - "start": 6608, - "end": 6609, + "start": 6616, + "end": 6617, "loc": { "start": { "line": 163, @@ -34624,8 +34624,8 @@ "binop": null }, "value": "fire", - "start": 6609, - "end": 6613, + "start": 6617, + "end": 6621, "loc": { "start": { "line": 163, @@ -34649,8 +34649,8 @@ "postfix": false, "binop": null }, - "start": 6613, - "end": 6614, + "start": 6621, + "end": 6622, "loc": { "start": { "line": 163, @@ -34676,8 +34676,8 @@ "updateContext": null }, "value": "viewPos", - "start": 6614, - "end": 6623, + "start": 6622, + "end": 6631, "loc": { "start": { "line": 163, @@ -34702,8 +34702,8 @@ "binop": null, "updateContext": null }, - "start": 6623, - "end": 6624, + "start": 6631, + "end": 6632, "loc": { "start": { "line": 163, @@ -34730,8 +34730,8 @@ "updateContext": null }, "value": "this", - "start": 6625, - "end": 6629, + "start": 6633, + "end": 6637, "loc": { "start": { "line": 163, @@ -34756,8 +34756,8 @@ "binop": null, "updateContext": null }, - "start": 6629, - "end": 6630, + "start": 6637, + "end": 6638, "loc": { "start": { "line": 163, @@ -34782,8 +34782,8 @@ "binop": null }, "value": "_viewPos", - "start": 6630, - "end": 6638, + "start": 6638, + "end": 6646, "loc": { "start": { "line": 163, @@ -34807,8 +34807,8 @@ "postfix": false, "binop": null }, - "start": 6638, - "end": 6639, + "start": 6646, + "end": 6647, "loc": { "start": { "line": 163, @@ -34833,8 +34833,8 @@ "binop": null, "updateContext": null }, - "start": 6639, - "end": 6640, + "start": 6647, + "end": 6648, "loc": { "start": { "line": 163, @@ -34858,8 +34858,8 @@ "postfix": false, "binop": null }, - "start": 6649, - "end": 6650, + "start": 6657, + "end": 6658, "loc": { "start": { "line": 164, @@ -34886,8 +34886,8 @@ "updateContext": null }, "value": "if", - "start": 6659, - "end": 6661, + "start": 6667, + "end": 6669, "loc": { "start": { "line": 165, @@ -34911,8 +34911,8 @@ "postfix": false, "binop": null }, - "start": 6662, - "end": 6663, + "start": 6670, + "end": 6671, "loc": { "start": { "line": 165, @@ -34939,8 +34939,8 @@ "updateContext": null }, "value": "this", - "start": 6663, - "end": 6667, + "start": 6671, + "end": 6675, "loc": { "start": { "line": 165, @@ -34965,8 +34965,8 @@ "binop": null, "updateContext": null }, - "start": 6667, - "end": 6668, + "start": 6675, + "end": 6676, "loc": { "start": { "line": 165, @@ -34991,8 +34991,8 @@ "binop": null }, "value": "_canvasPosDirty", - "start": 6668, - "end": 6683, + "start": 6676, + "end": 6691, "loc": { "start": { "line": 165, @@ -35016,8 +35016,8 @@ "postfix": false, "binop": null }, - "start": 6683, - "end": 6684, + "start": 6691, + "end": 6692, "loc": { "start": { "line": 165, @@ -35041,8 +35041,8 @@ "postfix": false, "binop": null }, - "start": 6685, - "end": 6686, + "start": 6693, + "end": 6694, "loc": { "start": { "line": 165, @@ -35067,8 +35067,8 @@ "binop": null }, "value": "tempVec4a", - "start": 6699, - "end": 6708, + "start": 6707, + "end": 6716, "loc": { "start": { "line": 166, @@ -35093,8 +35093,8 @@ "binop": null, "updateContext": null }, - "start": 6708, - "end": 6709, + "start": 6716, + "end": 6717, "loc": { "start": { "line": 166, @@ -35119,8 +35119,8 @@ "binop": null }, "value": "set", - "start": 6709, - "end": 6712, + "start": 6717, + "end": 6720, "loc": { "start": { "line": 166, @@ -35144,8 +35144,8 @@ "postfix": false, "binop": null }, - "start": 6712, - "end": 6713, + "start": 6720, + "end": 6721, "loc": { "start": { "line": 166, @@ -35172,8 +35172,8 @@ "updateContext": null }, "value": "this", - "start": 6713, - "end": 6717, + "start": 6721, + "end": 6725, "loc": { "start": { "line": 166, @@ -35198,8 +35198,8 @@ "binop": null, "updateContext": null }, - "start": 6717, - "end": 6718, + "start": 6725, + "end": 6726, "loc": { "start": { "line": 166, @@ -35224,8 +35224,8 @@ "binop": null }, "value": "_viewPos", - "start": 6718, - "end": 6726, + "start": 6726, + "end": 6734, "loc": { "start": { "line": 166, @@ -35249,8 +35249,8 @@ "postfix": false, "binop": null }, - "start": 6726, - "end": 6727, + "start": 6734, + "end": 6735, "loc": { "start": { "line": 166, @@ -35275,8 +35275,8 @@ "binop": null, "updateContext": null }, - "start": 6727, - "end": 6728, + "start": 6735, + "end": 6736, "loc": { "start": { "line": 166, @@ -35301,8 +35301,8 @@ "binop": null }, "value": "tempVec4a", - "start": 6741, - "end": 6750, + "start": 6749, + "end": 6758, "loc": { "start": { "line": 167, @@ -35327,8 +35327,8 @@ "binop": null, "updateContext": null }, - "start": 6750, - "end": 6751, + "start": 6758, + "end": 6759, "loc": { "start": { "line": 167, @@ -35354,8 +35354,8 @@ "updateContext": null }, "value": 3, - "start": 6751, - "end": 6752, + "start": 6759, + "end": 6760, "loc": { "start": { "line": 167, @@ -35380,8 +35380,8 @@ "binop": null, "updateContext": null }, - "start": 6752, - "end": 6753, + "start": 6760, + "end": 6761, "loc": { "start": { "line": 167, @@ -35407,8 +35407,8 @@ "updateContext": null }, "value": "=", - "start": 6754, - "end": 6755, + "start": 6762, + "end": 6763, "loc": { "start": { "line": 167, @@ -35434,8 +35434,8 @@ "updateContext": null }, "value": 1, - "start": 6756, - "end": 6759, + "start": 6764, + "end": 6767, "loc": { "start": { "line": 167, @@ -35460,8 +35460,8 @@ "binop": null, "updateContext": null }, - "start": 6759, - "end": 6760, + "start": 6767, + "end": 6768, "loc": { "start": { "line": 167, @@ -35486,8 +35486,8 @@ "binop": null }, "value": "math", - "start": 6773, - "end": 6777, + "start": 6781, + "end": 6785, "loc": { "start": { "line": 168, @@ -35512,8 +35512,8 @@ "binop": null, "updateContext": null }, - "start": 6777, - "end": 6778, + "start": 6785, + "end": 6786, "loc": { "start": { "line": 168, @@ -35538,8 +35538,8 @@ "binop": null }, "value": "transformPoint4", - "start": 6778, - "end": 6793, + "start": 6786, + "end": 6801, "loc": { "start": { "line": 168, @@ -35563,8 +35563,8 @@ "postfix": false, "binop": null }, - "start": 6793, - "end": 6794, + "start": 6801, + "end": 6802, "loc": { "start": { "line": 168, @@ -35591,8 +35591,8 @@ "updateContext": null }, "value": "this", - "start": 6794, - "end": 6798, + "start": 6802, + "end": 6806, "loc": { "start": { "line": 168, @@ -35617,8 +35617,8 @@ "binop": null, "updateContext": null }, - "start": 6798, - "end": 6799, + "start": 6806, + "end": 6807, "loc": { "start": { "line": 168, @@ -35643,8 +35643,8 @@ "binop": null }, "value": "scene", - "start": 6799, - "end": 6804, + "start": 6807, + "end": 6812, "loc": { "start": { "line": 168, @@ -35669,8 +35669,8 @@ "binop": null, "updateContext": null }, - "start": 6804, - "end": 6805, + "start": 6812, + "end": 6813, "loc": { "start": { "line": 168, @@ -35695,8 +35695,8 @@ "binop": null }, "value": "camera", - "start": 6805, - "end": 6811, + "start": 6813, + "end": 6819, "loc": { "start": { "line": 168, @@ -35721,8 +35721,8 @@ "binop": null, "updateContext": null }, - "start": 6811, - "end": 6812, + "start": 6819, + "end": 6820, "loc": { "start": { "line": 168, @@ -35747,8 +35747,8 @@ "binop": null }, "value": "projMatrix", - "start": 6812, - "end": 6822, + "start": 6820, + "end": 6830, "loc": { "start": { "line": 168, @@ -35773,8 +35773,8 @@ "binop": null, "updateContext": null }, - "start": 6822, - "end": 6823, + "start": 6830, + "end": 6831, "loc": { "start": { "line": 168, @@ -35799,8 +35799,8 @@ "binop": null }, "value": "tempVec4a", - "start": 6824, - "end": 6833, + "start": 6832, + "end": 6841, "loc": { "start": { "line": 168, @@ -35825,8 +35825,8 @@ "binop": null, "updateContext": null }, - "start": 6833, - "end": 6834, + "start": 6841, + "end": 6842, "loc": { "start": { "line": 168, @@ -35851,8 +35851,8 @@ "binop": null }, "value": "tempVec4b", - "start": 6835, - "end": 6844, + "start": 6843, + "end": 6852, "loc": { "start": { "line": 168, @@ -35876,8 +35876,8 @@ "postfix": false, "binop": null }, - "start": 6844, - "end": 6845, + "start": 6852, + "end": 6853, "loc": { "start": { "line": 168, @@ -35902,8 +35902,8 @@ "binop": null, "updateContext": null }, - "start": 6845, - "end": 6846, + "start": 6853, + "end": 6854, "loc": { "start": { "line": 168, @@ -35930,8 +35930,8 @@ "updateContext": null }, "value": "const", - "start": 6859, - "end": 6864, + "start": 6867, + "end": 6872, "loc": { "start": { "line": 169, @@ -35956,8 +35956,8 @@ "binop": null }, "value": "aabb", - "start": 6865, - "end": 6869, + "start": 6873, + "end": 6877, "loc": { "start": { "line": 169, @@ -35983,8 +35983,8 @@ "updateContext": null }, "value": "=", - "start": 6870, - "end": 6871, + "start": 6878, + "end": 6879, "loc": { "start": { "line": 169, @@ -36011,8 +36011,8 @@ "updateContext": null }, "value": "this", - "start": 6872, - "end": 6876, + "start": 6880, + "end": 6884, "loc": { "start": { "line": 169, @@ -36037,8 +36037,8 @@ "binop": null, "updateContext": null }, - "start": 6876, - "end": 6877, + "start": 6884, + "end": 6885, "loc": { "start": { "line": 169, @@ -36063,8 +36063,8 @@ "binop": null }, "value": "scene", - "start": 6877, - "end": 6882, + "start": 6885, + "end": 6890, "loc": { "start": { "line": 169, @@ -36089,8 +36089,8 @@ "binop": null, "updateContext": null }, - "start": 6882, - "end": 6883, + "start": 6890, + "end": 6891, "loc": { "start": { "line": 169, @@ -36115,8 +36115,8 @@ "binop": null }, "value": "canvas", - "start": 6883, - "end": 6889, + "start": 6891, + "end": 6897, "loc": { "start": { "line": 169, @@ -36141,8 +36141,8 @@ "binop": null, "updateContext": null }, - "start": 6889, - "end": 6890, + "start": 6897, + "end": 6898, "loc": { "start": { "line": 169, @@ -36167,8 +36167,8 @@ "binop": null }, "value": "boundary", - "start": 6890, - "end": 6898, + "start": 6898, + "end": 6906, "loc": { "start": { "line": 169, @@ -36193,8 +36193,8 @@ "binop": null, "updateContext": null }, - "start": 6898, - "end": 6899, + "start": 6906, + "end": 6907, "loc": { "start": { "line": 169, @@ -36221,8 +36221,8 @@ "updateContext": null }, "value": "this", - "start": 6912, - "end": 6916, + "start": 6920, + "end": 6924, "loc": { "start": { "line": 170, @@ -36247,8 +36247,8 @@ "binop": null, "updateContext": null }, - "start": 6916, - "end": 6917, + "start": 6924, + "end": 6925, "loc": { "start": { "line": 170, @@ -36273,8 +36273,8 @@ "binop": null }, "value": "_canvasPos", - "start": 6917, - "end": 6927, + "start": 6925, + "end": 6935, "loc": { "start": { "line": 170, @@ -36299,8 +36299,8 @@ "binop": null, "updateContext": null }, - "start": 6927, - "end": 6928, + "start": 6935, + "end": 6936, "loc": { "start": { "line": 170, @@ -36326,8 +36326,8 @@ "updateContext": null }, "value": 0, - "start": 6928, - "end": 6929, + "start": 6936, + "end": 6937, "loc": { "start": { "line": 170, @@ -36352,8 +36352,8 @@ "binop": null, "updateContext": null }, - "start": 6929, - "end": 6930, + "start": 6937, + "end": 6938, "loc": { "start": { "line": 170, @@ -36379,8 +36379,8 @@ "updateContext": null }, "value": "=", - "start": 6931, - "end": 6932, + "start": 6939, + "end": 6940, "loc": { "start": { "line": 170, @@ -36405,8 +36405,8 @@ "binop": null }, "value": "Math", - "start": 6933, - "end": 6937, + "start": 6941, + "end": 6945, "loc": { "start": { "line": 170, @@ -36431,8 +36431,8 @@ "binop": null, "updateContext": null }, - "start": 6937, - "end": 6938, + "start": 6945, + "end": 6946, "loc": { "start": { "line": 170, @@ -36457,8 +36457,8 @@ "binop": null }, "value": "floor", - "start": 6938, - "end": 6943, + "start": 6946, + "end": 6951, "loc": { "start": { "line": 170, @@ -36482,8 +36482,8 @@ "postfix": false, "binop": null }, - "start": 6943, - "end": 6944, + "start": 6951, + "end": 6952, "loc": { "start": { "line": 170, @@ -36507,8 +36507,8 @@ "postfix": false, "binop": null }, - "start": 6944, - "end": 6945, + "start": 6952, + "end": 6953, "loc": { "start": { "line": 170, @@ -36534,8 +36534,8 @@ "updateContext": null }, "value": 1, - "start": 6945, - "end": 6946, + "start": 6953, + "end": 6954, "loc": { "start": { "line": 170, @@ -36561,8 +36561,8 @@ "updateContext": null }, "value": "+", - "start": 6947, - "end": 6948, + "start": 6955, + "end": 6956, "loc": { "start": { "line": 170, @@ -36587,8 +36587,8 @@ "binop": null }, "value": "tempVec4b", - "start": 6949, - "end": 6958, + "start": 6957, + "end": 6966, "loc": { "start": { "line": 170, @@ -36613,8 +36613,8 @@ "binop": null, "updateContext": null }, - "start": 6958, - "end": 6959, + "start": 6966, + "end": 6967, "loc": { "start": { "line": 170, @@ -36640,8 +36640,8 @@ "updateContext": null }, "value": 0, - "start": 6959, - "end": 6960, + "start": 6967, + "end": 6968, "loc": { "start": { "line": 170, @@ -36666,8 +36666,8 @@ "binop": null, "updateContext": null }, - "start": 6960, - "end": 6961, + "start": 6968, + "end": 6969, "loc": { "start": { "line": 170, @@ -36693,8 +36693,8 @@ "updateContext": null }, "value": "/", - "start": 6962, - "end": 6963, + "start": 6970, + "end": 6971, "loc": { "start": { "line": 170, @@ -36719,8 +36719,8 @@ "binop": null }, "value": "tempVec4b", - "start": 6964, - "end": 6973, + "start": 6972, + "end": 6981, "loc": { "start": { "line": 170, @@ -36745,8 +36745,8 @@ "binop": null, "updateContext": null }, - "start": 6973, - "end": 6974, + "start": 6981, + "end": 6982, "loc": { "start": { "line": 170, @@ -36772,8 +36772,8 @@ "updateContext": null }, "value": 3, - "start": 6974, - "end": 6975, + "start": 6982, + "end": 6983, "loc": { "start": { "line": 170, @@ -36798,8 +36798,8 @@ "binop": null, "updateContext": null }, - "start": 6975, - "end": 6976, + "start": 6983, + "end": 6984, "loc": { "start": { "line": 170, @@ -36823,8 +36823,8 @@ "postfix": false, "binop": null }, - "start": 6976, - "end": 6977, + "start": 6984, + "end": 6985, "loc": { "start": { "line": 170, @@ -36850,8 +36850,8 @@ "updateContext": null }, "value": "*", - "start": 6978, - "end": 6979, + "start": 6986, + "end": 6987, "loc": { "start": { "line": 170, @@ -36876,8 +36876,8 @@ "binop": null }, "value": "aabb", - "start": 6980, - "end": 6984, + "start": 6988, + "end": 6992, "loc": { "start": { "line": 170, @@ -36902,8 +36902,8 @@ "binop": null, "updateContext": null }, - "start": 6984, - "end": 6985, + "start": 6992, + "end": 6993, "loc": { "start": { "line": 170, @@ -36929,8 +36929,8 @@ "updateContext": null }, "value": 2, - "start": 6985, - "end": 6986, + "start": 6993, + "end": 6994, "loc": { "start": { "line": 170, @@ -36955,8 +36955,8 @@ "binop": null, "updateContext": null }, - "start": 6986, - "end": 6987, + "start": 6994, + "end": 6995, "loc": { "start": { "line": 170, @@ -36982,8 +36982,8 @@ "updateContext": null }, "value": "/", - "start": 6988, - "end": 6989, + "start": 6996, + "end": 6997, "loc": { "start": { "line": 170, @@ -37009,8 +37009,8 @@ "updateContext": null }, "value": 2, - "start": 6990, - "end": 6991, + "start": 6998, + "end": 6999, "loc": { "start": { "line": 170, @@ -37034,8 +37034,8 @@ "postfix": false, "binop": null }, - "start": 6991, - "end": 6992, + "start": 6999, + "end": 7000, "loc": { "start": { "line": 170, @@ -37060,8 +37060,8 @@ "binop": null, "updateContext": null }, - "start": 6992, - "end": 6993, + "start": 7000, + "end": 7001, "loc": { "start": { "line": 170, @@ -37088,8 +37088,8 @@ "updateContext": null }, "value": "this", - "start": 7006, - "end": 7010, + "start": 7014, + "end": 7018, "loc": { "start": { "line": 171, @@ -37114,8 +37114,8 @@ "binop": null, "updateContext": null }, - "start": 7010, - "end": 7011, + "start": 7018, + "end": 7019, "loc": { "start": { "line": 171, @@ -37140,8 +37140,8 @@ "binop": null }, "value": "_canvasPos", - "start": 7011, - "end": 7021, + "start": 7019, + "end": 7029, "loc": { "start": { "line": 171, @@ -37166,8 +37166,8 @@ "binop": null, "updateContext": null }, - "start": 7021, - "end": 7022, + "start": 7029, + "end": 7030, "loc": { "start": { "line": 171, @@ -37193,8 +37193,8 @@ "updateContext": null }, "value": 1, - "start": 7022, - "end": 7023, + "start": 7030, + "end": 7031, "loc": { "start": { "line": 171, @@ -37219,8 +37219,8 @@ "binop": null, "updateContext": null }, - "start": 7023, - "end": 7024, + "start": 7031, + "end": 7032, "loc": { "start": { "line": 171, @@ -37246,8 +37246,8 @@ "updateContext": null }, "value": "=", - "start": 7025, - "end": 7026, + "start": 7033, + "end": 7034, "loc": { "start": { "line": 171, @@ -37272,8 +37272,8 @@ "binop": null }, "value": "Math", - "start": 7027, - "end": 7031, + "start": 7035, + "end": 7039, "loc": { "start": { "line": 171, @@ -37298,8 +37298,8 @@ "binop": null, "updateContext": null }, - "start": 7031, - "end": 7032, + "start": 7039, + "end": 7040, "loc": { "start": { "line": 171, @@ -37324,8 +37324,8 @@ "binop": null }, "value": "floor", - "start": 7032, - "end": 7037, + "start": 7040, + "end": 7045, "loc": { "start": { "line": 171, @@ -37349,8 +37349,8 @@ "postfix": false, "binop": null }, - "start": 7037, - "end": 7038, + "start": 7045, + "end": 7046, "loc": { "start": { "line": 171, @@ -37374,8 +37374,8 @@ "postfix": false, "binop": null }, - "start": 7038, - "end": 7039, + "start": 7046, + "end": 7047, "loc": { "start": { "line": 171, @@ -37401,8 +37401,8 @@ "updateContext": null }, "value": 1, - "start": 7039, - "end": 7040, + "start": 7047, + "end": 7048, "loc": { "start": { "line": 171, @@ -37428,8 +37428,8 @@ "updateContext": null }, "value": "-", - "start": 7041, - "end": 7042, + "start": 7049, + "end": 7050, "loc": { "start": { "line": 171, @@ -37454,8 +37454,8 @@ "binop": null }, "value": "tempVec4b", - "start": 7043, - "end": 7052, + "start": 7051, + "end": 7060, "loc": { "start": { "line": 171, @@ -37480,8 +37480,8 @@ "binop": null, "updateContext": null }, - "start": 7052, - "end": 7053, + "start": 7060, + "end": 7061, "loc": { "start": { "line": 171, @@ -37507,8 +37507,8 @@ "updateContext": null }, "value": 1, - "start": 7053, - "end": 7054, + "start": 7061, + "end": 7062, "loc": { "start": { "line": 171, @@ -37533,8 +37533,8 @@ "binop": null, "updateContext": null }, - "start": 7054, - "end": 7055, + "start": 7062, + "end": 7063, "loc": { "start": { "line": 171, @@ -37560,8 +37560,8 @@ "updateContext": null }, "value": "/", - "start": 7056, - "end": 7057, + "start": 7064, + "end": 7065, "loc": { "start": { "line": 171, @@ -37586,8 +37586,8 @@ "binop": null }, "value": "tempVec4b", - "start": 7058, - "end": 7067, + "start": 7066, + "end": 7075, "loc": { "start": { "line": 171, @@ -37612,8 +37612,8 @@ "binop": null, "updateContext": null }, - "start": 7067, - "end": 7068, + "start": 7075, + "end": 7076, "loc": { "start": { "line": 171, @@ -37639,8 +37639,8 @@ "updateContext": null }, "value": 3, - "start": 7068, - "end": 7069, + "start": 7076, + "end": 7077, "loc": { "start": { "line": 171, @@ -37665,8 +37665,8 @@ "binop": null, "updateContext": null }, - "start": 7069, - "end": 7070, + "start": 7077, + "end": 7078, "loc": { "start": { "line": 171, @@ -37690,8 +37690,8 @@ "postfix": false, "binop": null }, - "start": 7070, - "end": 7071, + "start": 7078, + "end": 7079, "loc": { "start": { "line": 171, @@ -37717,8 +37717,8 @@ "updateContext": null }, "value": "*", - "start": 7072, - "end": 7073, + "start": 7080, + "end": 7081, "loc": { "start": { "line": 171, @@ -37743,8 +37743,8 @@ "binop": null }, "value": "aabb", - "start": 7074, - "end": 7078, + "start": 7082, + "end": 7086, "loc": { "start": { "line": 171, @@ -37769,8 +37769,8 @@ "binop": null, "updateContext": null }, - "start": 7078, - "end": 7079, + "start": 7086, + "end": 7087, "loc": { "start": { "line": 171, @@ -37796,8 +37796,8 @@ "updateContext": null }, "value": 3, - "start": 7079, - "end": 7080, + "start": 7087, + "end": 7088, "loc": { "start": { "line": 171, @@ -37822,8 +37822,8 @@ "binop": null, "updateContext": null }, - "start": 7080, - "end": 7081, + "start": 7088, + "end": 7089, "loc": { "start": { "line": 171, @@ -37849,8 +37849,8 @@ "updateContext": null }, "value": "/", - "start": 7082, - "end": 7083, + "start": 7090, + "end": 7091, "loc": { "start": { "line": 171, @@ -37876,8 +37876,8 @@ "updateContext": null }, "value": 2, - "start": 7084, - "end": 7085, + "start": 7092, + "end": 7093, "loc": { "start": { "line": 171, @@ -37901,8 +37901,8 @@ "postfix": false, "binop": null }, - "start": 7085, - "end": 7086, + "start": 7093, + "end": 7094, "loc": { "start": { "line": 171, @@ -37927,8 +37927,8 @@ "binop": null, "updateContext": null }, - "start": 7086, - "end": 7087, + "start": 7094, + "end": 7095, "loc": { "start": { "line": 171, @@ -37955,8 +37955,8 @@ "updateContext": null }, "value": "this", - "start": 7100, - "end": 7104, + "start": 7108, + "end": 7112, "loc": { "start": { "line": 172, @@ -37981,8 +37981,8 @@ "binop": null, "updateContext": null }, - "start": 7104, - "end": 7105, + "start": 7112, + "end": 7113, "loc": { "start": { "line": 172, @@ -38007,8 +38007,8 @@ "binop": null }, "value": "_canvasPosDirty", - "start": 7105, - "end": 7120, + "start": 7113, + "end": 7128, "loc": { "start": { "line": 172, @@ -38034,8 +38034,8 @@ "updateContext": null }, "value": "=", - "start": 7121, - "end": 7122, + "start": 7129, + "end": 7130, "loc": { "start": { "line": 172, @@ -38062,8 +38062,8 @@ "updateContext": null }, "value": "false", - "start": 7123, - "end": 7128, + "start": 7131, + "end": 7136, "loc": { "start": { "line": 172, @@ -38088,8 +38088,8 @@ "binop": null, "updateContext": null }, - "start": 7128, - "end": 7129, + "start": 7136, + "end": 7137, "loc": { "start": { "line": 172, @@ -38116,8 +38116,8 @@ "updateContext": null }, "value": "this", - "start": 7142, - "end": 7146, + "start": 7150, + "end": 7154, "loc": { "start": { "line": 173, @@ -38142,8 +38142,8 @@ "binop": null, "updateContext": null }, - "start": 7146, - "end": 7147, + "start": 7154, + "end": 7155, "loc": { "start": { "line": 173, @@ -38168,8 +38168,8 @@ "binop": null }, "value": "fire", - "start": 7147, - "end": 7151, + "start": 7155, + "end": 7159, "loc": { "start": { "line": 173, @@ -38193,8 +38193,8 @@ "postfix": false, "binop": null }, - "start": 7151, - "end": 7152, + "start": 7159, + "end": 7160, "loc": { "start": { "line": 173, @@ -38220,8 +38220,8 @@ "updateContext": null }, "value": "canvasPos", - "start": 7152, - "end": 7163, + "start": 7160, + "end": 7171, "loc": { "start": { "line": 173, @@ -38246,8 +38246,8 @@ "binop": null, "updateContext": null }, - "start": 7163, - "end": 7164, + "start": 7171, + "end": 7172, "loc": { "start": { "line": 173, @@ -38274,8 +38274,8 @@ "updateContext": null }, "value": "this", - "start": 7165, - "end": 7169, + "start": 7173, + "end": 7177, "loc": { "start": { "line": 173, @@ -38300,8 +38300,8 @@ "binop": null, "updateContext": null }, - "start": 7169, - "end": 7170, + "start": 7177, + "end": 7178, "loc": { "start": { "line": 173, @@ -38326,8 +38326,8 @@ "binop": null }, "value": "_canvasPos", - "start": 7170, - "end": 7180, + "start": 7178, + "end": 7188, "loc": { "start": { "line": 173, @@ -38351,8 +38351,8 @@ "postfix": false, "binop": null }, - "start": 7180, - "end": 7181, + "start": 7188, + "end": 7189, "loc": { "start": { "line": 173, @@ -38377,8 +38377,8 @@ "binop": null, "updateContext": null }, - "start": 7181, - "end": 7182, + "start": 7189, + "end": 7190, "loc": { "start": { "line": 173, @@ -38402,8 +38402,8 @@ "postfix": false, "binop": null }, - "start": 7191, - "end": 7192, + "start": 7199, + "end": 7200, "loc": { "start": { "line": 174, @@ -38427,8 +38427,8 @@ "postfix": false, "binop": null }, - "start": 7197, - "end": 7198, + "start": 7205, + "end": 7206, "loc": { "start": { "line": 175, @@ -38453,8 +38453,8 @@ "binop": null }, "value": "_setVisible", - "start": 7204, - "end": 7215, + "start": 7212, + "end": 7223, "loc": { "start": { "line": 177, @@ -38478,8 +38478,8 @@ "postfix": false, "binop": null }, - "start": 7215, - "end": 7216, + "start": 7223, + "end": 7224, "loc": { "start": { "line": 177, @@ -38504,8 +38504,8 @@ "binop": null }, "value": "visible", - "start": 7216, - "end": 7223, + "start": 7224, + "end": 7231, "loc": { "start": { "line": 177, @@ -38529,8 +38529,8 @@ "postfix": false, "binop": null }, - "start": 7223, - "end": 7224, + "start": 7231, + "end": 7232, "loc": { "start": { "line": 177, @@ -38554,8 +38554,8 @@ "postfix": false, "binop": null }, - "start": 7225, - "end": 7226, + "start": 7233, + "end": 7234, "loc": { "start": { "line": 177, @@ -38570,8 +38570,8 @@ { "type": "CommentLine", "value": " Called by VisibilityTester and this._entity.on(\"destroyed\"..)", - "start": 7227, - "end": 7291, + "start": 7235, + "end": 7299, "loc": { "start": { "line": 177, @@ -38598,8 +38598,8 @@ "updateContext": null }, "value": "if", - "start": 7300, - "end": 7302, + "start": 7308, + "end": 7310, "loc": { "start": { "line": 178, @@ -38623,8 +38623,8 @@ "postfix": false, "binop": null }, - "start": 7303, - "end": 7304, + "start": 7311, + "end": 7312, "loc": { "start": { "line": 178, @@ -38651,8 +38651,8 @@ "updateContext": null }, "value": "this", - "start": 7304, - "end": 7308, + "start": 7312, + "end": 7316, "loc": { "start": { "line": 178, @@ -38677,8 +38677,8 @@ "binop": null, "updateContext": null }, - "start": 7308, - "end": 7309, + "start": 7316, + "end": 7317, "loc": { "start": { "line": 178, @@ -38703,8 +38703,8 @@ "binop": null }, "value": "_visible", - "start": 7309, - "end": 7317, + "start": 7317, + "end": 7325, "loc": { "start": { "line": 178, @@ -38730,8 +38730,8 @@ "updateContext": null }, "value": "===", - "start": 7318, - "end": 7321, + "start": 7326, + "end": 7329, "loc": { "start": { "line": 178, @@ -38756,8 +38756,8 @@ "binop": null }, "value": "visible", - "start": 7322, - "end": 7329, + "start": 7330, + "end": 7337, "loc": { "start": { "line": 178, @@ -38781,8 +38781,8 @@ "postfix": false, "binop": null }, - "start": 7329, - "end": 7330, + "start": 7337, + "end": 7338, "loc": { "start": { "line": 178, @@ -38806,8 +38806,8 @@ "postfix": false, "binop": null }, - "start": 7331, - "end": 7332, + "start": 7339, + "end": 7340, "loc": { "start": { "line": 178, @@ -38822,8 +38822,8 @@ { "type": "CommentLine", "value": " return;", - "start": 7345, - "end": 7356, + "start": 7353, + "end": 7364, "loc": { "start": { "line": 179, @@ -38847,8 +38847,8 @@ "postfix": false, "binop": null }, - "start": 7365, - "end": 7366, + "start": 7373, + "end": 7374, "loc": { "start": { "line": 180, @@ -38875,8 +38875,8 @@ "updateContext": null }, "value": "this", - "start": 7375, - "end": 7379, + "start": 7383, + "end": 7387, "loc": { "start": { "line": 181, @@ -38901,8 +38901,8 @@ "binop": null, "updateContext": null }, - "start": 7379, - "end": 7380, + "start": 7387, + "end": 7388, "loc": { "start": { "line": 181, @@ -38927,8 +38927,8 @@ "binop": null }, "value": "_visible", - "start": 7380, - "end": 7388, + "start": 7388, + "end": 7396, "loc": { "start": { "line": 181, @@ -38954,8 +38954,8 @@ "updateContext": null }, "value": "=", - "start": 7389, - "end": 7390, + "start": 7397, + "end": 7398, "loc": { "start": { "line": 181, @@ -38980,8 +38980,8 @@ "binop": null }, "value": "visible", - "start": 7391, - "end": 7398, + "start": 7399, + "end": 7406, "loc": { "start": { "line": 181, @@ -39006,8 +39006,8 @@ "binop": null, "updateContext": null }, - "start": 7398, - "end": 7399, + "start": 7406, + "end": 7407, "loc": { "start": { "line": 181, @@ -39034,8 +39034,8 @@ "updateContext": null }, "value": "this", - "start": 7408, - "end": 7412, + "start": 7416, + "end": 7420, "loc": { "start": { "line": 182, @@ -39060,8 +39060,8 @@ "binop": null, "updateContext": null }, - "start": 7412, - "end": 7413, + "start": 7420, + "end": 7421, "loc": { "start": { "line": 182, @@ -39086,8 +39086,8 @@ "binop": null }, "value": "fire", - "start": 7413, - "end": 7417, + "start": 7421, + "end": 7425, "loc": { "start": { "line": 182, @@ -39111,8 +39111,8 @@ "postfix": false, "binop": null }, - "start": 7417, - "end": 7418, + "start": 7425, + "end": 7426, "loc": { "start": { "line": 182, @@ -39138,8 +39138,8 @@ "updateContext": null }, "value": "visible", - "start": 7418, - "end": 7427, + "start": 7426, + "end": 7435, "loc": { "start": { "line": 182, @@ -39164,8 +39164,8 @@ "binop": null, "updateContext": null }, - "start": 7427, - "end": 7428, + "start": 7435, + "end": 7436, "loc": { "start": { "line": 182, @@ -39192,8 +39192,8 @@ "updateContext": null }, "value": "this", - "start": 7429, - "end": 7433, + "start": 7437, + "end": 7441, "loc": { "start": { "line": 182, @@ -39218,8 +39218,8 @@ "binop": null, "updateContext": null }, - "start": 7433, - "end": 7434, + "start": 7441, + "end": 7442, "loc": { "start": { "line": 182, @@ -39244,8 +39244,8 @@ "binop": null }, "value": "_visible", - "start": 7434, - "end": 7442, + "start": 7442, + "end": 7450, "loc": { "start": { "line": 182, @@ -39269,8 +39269,8 @@ "postfix": false, "binop": null }, - "start": 7442, - "end": 7443, + "start": 7450, + "end": 7451, "loc": { "start": { "line": 182, @@ -39295,8 +39295,8 @@ "binop": null, "updateContext": null }, - "start": 7443, - "end": 7444, + "start": 7451, + "end": 7452, "loc": { "start": { "line": 182, @@ -39320,8 +39320,8 @@ "postfix": false, "binop": null }, - "start": 7449, - "end": 7450, + "start": 7457, + "end": 7458, "loc": { "start": { "line": 183, @@ -39336,8 +39336,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n ", - "start": 7456, - "end": 7727, + "start": 7464, + "end": 7735, "loc": { "start": { "line": 185, @@ -39362,8 +39362,8 @@ "binop": null }, "value": "set", - "start": 7732, - "end": 7735, + "start": 7740, + "end": 7743, "loc": { "start": { "line": 193, @@ -39388,8 +39388,8 @@ "binop": null }, "value": "entity", - "start": 7736, - "end": 7742, + "start": 7744, + "end": 7750, "loc": { "start": { "line": 193, @@ -39413,8 +39413,8 @@ "postfix": false, "binop": null }, - "start": 7742, - "end": 7743, + "start": 7750, + "end": 7751, "loc": { "start": { "line": 193, @@ -39439,8 +39439,8 @@ "binop": null }, "value": "entity", - "start": 7743, - "end": 7749, + "start": 7751, + "end": 7757, "loc": { "start": { "line": 193, @@ -39464,8 +39464,8 @@ "postfix": false, "binop": null }, - "start": 7749, - "end": 7750, + "start": 7757, + "end": 7758, "loc": { "start": { "line": 193, @@ -39489,8 +39489,8 @@ "postfix": false, "binop": null }, - "start": 7751, - "end": 7752, + "start": 7759, + "end": 7760, "loc": { "start": { "line": 193, @@ -39517,8 +39517,8 @@ "updateContext": null }, "value": "if", - "start": 7761, - "end": 7763, + "start": 7769, + "end": 7771, "loc": { "start": { "line": 194, @@ -39542,8 +39542,8 @@ "postfix": false, "binop": null }, - "start": 7764, - "end": 7765, + "start": 7772, + "end": 7773, "loc": { "start": { "line": 194, @@ -39570,8 +39570,8 @@ "updateContext": null }, "value": "this", - "start": 7765, - "end": 7769, + "start": 7773, + "end": 7777, "loc": { "start": { "line": 194, @@ -39596,8 +39596,8 @@ "binop": null, "updateContext": null }, - "start": 7769, - "end": 7770, + "start": 7777, + "end": 7778, "loc": { "start": { "line": 194, @@ -39622,8 +39622,8 @@ "binop": null }, "value": "_entity", - "start": 7770, - "end": 7777, + "start": 7778, + "end": 7785, "loc": { "start": { "line": 194, @@ -39647,8 +39647,8 @@ "postfix": false, "binop": null }, - "start": 7777, - "end": 7778, + "start": 7785, + "end": 7786, "loc": { "start": { "line": 194, @@ -39672,8 +39672,8 @@ "postfix": false, "binop": null }, - "start": 7779, - "end": 7780, + "start": 7787, + "end": 7788, "loc": { "start": { "line": 194, @@ -39700,8 +39700,8 @@ "updateContext": null }, "value": "if", - "start": 7793, - "end": 7795, + "start": 7801, + "end": 7803, "loc": { "start": { "line": 195, @@ -39725,8 +39725,8 @@ "postfix": false, "binop": null }, - "start": 7796, - "end": 7797, + "start": 7804, + "end": 7805, "loc": { "start": { "line": 195, @@ -39753,8 +39753,8 @@ "updateContext": null }, "value": "this", - "start": 7797, - "end": 7801, + "start": 7805, + "end": 7809, "loc": { "start": { "line": 195, @@ -39779,8 +39779,8 @@ "binop": null, "updateContext": null }, - "start": 7801, - "end": 7802, + "start": 7809, + "end": 7810, "loc": { "start": { "line": 195, @@ -39805,8 +39805,8 @@ "binop": null }, "value": "_entity", - "start": 7802, - "end": 7809, + "start": 7810, + "end": 7817, "loc": { "start": { "line": 195, @@ -39832,8 +39832,8 @@ "updateContext": null }, "value": "===", - "start": 7810, - "end": 7813, + "start": 7818, + "end": 7821, "loc": { "start": { "line": 195, @@ -39858,8 +39858,8 @@ "binop": null }, "value": "entity", - "start": 7814, - "end": 7820, + "start": 7822, + "end": 7828, "loc": { "start": { "line": 195, @@ -39883,8 +39883,8 @@ "postfix": false, "binop": null }, - "start": 7820, - "end": 7821, + "start": 7828, + "end": 7829, "loc": { "start": { "line": 195, @@ -39908,8 +39908,8 @@ "postfix": false, "binop": null }, - "start": 7822, - "end": 7823, + "start": 7830, + "end": 7831, "loc": { "start": { "line": 195, @@ -39936,8 +39936,8 @@ "updateContext": null }, "value": "return", - "start": 7840, - "end": 7846, + "start": 7848, + "end": 7854, "loc": { "start": { "line": 196, @@ -39962,8 +39962,8 @@ "binop": null, "updateContext": null }, - "start": 7846, - "end": 7847, + "start": 7854, + "end": 7855, "loc": { "start": { "line": 196, @@ -39987,8 +39987,8 @@ "postfix": false, "binop": null }, - "start": 7860, - "end": 7861, + "start": 7868, + "end": 7869, "loc": { "start": { "line": 197, @@ -40015,8 +40015,8 @@ "updateContext": null }, "value": "if", - "start": 7874, - "end": 7876, + "start": 7882, + "end": 7884, "loc": { "start": { "line": 198, @@ -40040,8 +40040,8 @@ "postfix": false, "binop": null }, - "start": 7877, - "end": 7878, + "start": 7885, + "end": 7886, "loc": { "start": { "line": 198, @@ -40068,8 +40068,8 @@ "updateContext": null }, "value": "this", - "start": 7878, - "end": 7882, + "start": 7886, + "end": 7890, "loc": { "start": { "line": 198, @@ -40094,8 +40094,8 @@ "binop": null, "updateContext": null }, - "start": 7882, - "end": 7883, + "start": 7890, + "end": 7891, "loc": { "start": { "line": 198, @@ -40120,8 +40120,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 7883, - "end": 7901, + "start": 7891, + "end": 7909, "loc": { "start": { "line": 198, @@ -40147,8 +40147,8 @@ "updateContext": null }, "value": "!==", - "start": 7902, - "end": 7905, + "start": 7910, + "end": 7913, "loc": { "start": { "line": 198, @@ -40175,8 +40175,8 @@ "updateContext": null }, "value": "null", - "start": 7906, - "end": 7910, + "start": 7914, + "end": 7918, "loc": { "start": { "line": 198, @@ -40200,8 +40200,8 @@ "postfix": false, "binop": null }, - "start": 7910, - "end": 7911, + "start": 7918, + "end": 7919, "loc": { "start": { "line": 198, @@ -40225,8 +40225,8 @@ "postfix": false, "binop": null }, - "start": 7912, - "end": 7913, + "start": 7920, + "end": 7921, "loc": { "start": { "line": 198, @@ -40253,8 +40253,8 @@ "updateContext": null }, "value": "this", - "start": 7930, - "end": 7934, + "start": 7938, + "end": 7942, "loc": { "start": { "line": 199, @@ -40279,8 +40279,8 @@ "binop": null, "updateContext": null }, - "start": 7934, - "end": 7935, + "start": 7942, + "end": 7943, "loc": { "start": { "line": 199, @@ -40305,8 +40305,8 @@ "binop": null }, "value": "_entity", - "start": 7935, - "end": 7942, + "start": 7943, + "end": 7950, "loc": { "start": { "line": 199, @@ -40331,8 +40331,8 @@ "binop": null, "updateContext": null }, - "start": 7942, - "end": 7943, + "start": 7950, + "end": 7951, "loc": { "start": { "line": 199, @@ -40357,8 +40357,8 @@ "binop": null }, "value": "off", - "start": 7943, - "end": 7946, + "start": 7951, + "end": 7954, "loc": { "start": { "line": 199, @@ -40382,8 +40382,8 @@ "postfix": false, "binop": null }, - "start": 7946, - "end": 7947, + "start": 7954, + "end": 7955, "loc": { "start": { "line": 199, @@ -40410,8 +40410,8 @@ "updateContext": null }, "value": "this", - "start": 7947, - "end": 7951, + "start": 7955, + "end": 7959, "loc": { "start": { "line": 199, @@ -40436,8 +40436,8 @@ "binop": null, "updateContext": null }, - "start": 7951, - "end": 7952, + "start": 7959, + "end": 7960, "loc": { "start": { "line": 199, @@ -40462,8 +40462,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 7952, - "end": 7970, + "start": 7960, + "end": 7978, "loc": { "start": { "line": 199, @@ -40487,8 +40487,8 @@ "postfix": false, "binop": null }, - "start": 7970, - "end": 7971, + "start": 7978, + "end": 7979, "loc": { "start": { "line": 199, @@ -40513,8 +40513,8 @@ "binop": null, "updateContext": null }, - "start": 7971, - "end": 7972, + "start": 7979, + "end": 7980, "loc": { "start": { "line": 199, @@ -40541,8 +40541,8 @@ "updateContext": null }, "value": "this", - "start": 7989, - "end": 7993, + "start": 7997, + "end": 8001, "loc": { "start": { "line": 200, @@ -40567,8 +40567,8 @@ "binop": null, "updateContext": null }, - "start": 7993, - "end": 7994, + "start": 8001, + "end": 8002, "loc": { "start": { "line": 200, @@ -40593,8 +40593,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 7994, - "end": 8012, + "start": 8002, + "end": 8020, "loc": { "start": { "line": 200, @@ -40620,8 +40620,8 @@ "updateContext": null }, "value": "=", - "start": 8013, - "end": 8014, + "start": 8021, + "end": 8022, "loc": { "start": { "line": 200, @@ -40648,8 +40648,8 @@ "updateContext": null }, "value": "null", - "start": 8015, - "end": 8019, + "start": 8023, + "end": 8027, "loc": { "start": { "line": 200, @@ -40674,8 +40674,8 @@ "binop": null, "updateContext": null }, - "start": 8019, - "end": 8020, + "start": 8027, + "end": 8028, "loc": { "start": { "line": 200, @@ -40699,8 +40699,8 @@ "postfix": false, "binop": null }, - "start": 8033, - "end": 8034, + "start": 8041, + "end": 8042, "loc": { "start": { "line": 201, @@ -40727,8 +40727,8 @@ "updateContext": null }, "value": "if", - "start": 8047, - "end": 8049, + "start": 8055, + "end": 8057, "loc": { "start": { "line": 202, @@ -40752,8 +40752,8 @@ "postfix": false, "binop": null }, - "start": 8050, - "end": 8051, + "start": 8058, + "end": 8059, "loc": { "start": { "line": 202, @@ -40780,8 +40780,8 @@ "updateContext": null }, "value": "this", - "start": 8051, - "end": 8055, + "start": 8059, + "end": 8063, "loc": { "start": { "line": 202, @@ -40806,8 +40806,8 @@ "binop": null, "updateContext": null }, - "start": 8055, - "end": 8056, + "start": 8063, + "end": 8064, "loc": { "start": { "line": 202, @@ -40832,8 +40832,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 8056, - "end": 8079, + "start": 8064, + "end": 8087, "loc": { "start": { "line": 202, @@ -40859,8 +40859,8 @@ "updateContext": null }, "value": "!==", - "start": 8080, - "end": 8083, + "start": 8088, + "end": 8091, "loc": { "start": { "line": 202, @@ -40887,8 +40887,8 @@ "updateContext": null }, "value": "null", - "start": 8084, - "end": 8088, + "start": 8092, + "end": 8096, "loc": { "start": { "line": 202, @@ -40912,8 +40912,8 @@ "postfix": false, "binop": null }, - "start": 8088, - "end": 8089, + "start": 8096, + "end": 8097, "loc": { "start": { "line": 202, @@ -40937,8 +40937,8 @@ "postfix": false, "binop": null }, - "start": 8090, - "end": 8091, + "start": 8098, + "end": 8099, "loc": { "start": { "line": 202, @@ -40965,8 +40965,8 @@ "updateContext": null }, "value": "this", - "start": 8108, - "end": 8112, + "start": 8116, + "end": 8120, "loc": { "start": { "line": 203, @@ -40991,8 +40991,8 @@ "binop": null, "updateContext": null }, - "start": 8112, - "end": 8113, + "start": 8120, + "end": 8121, "loc": { "start": { "line": 203, @@ -41017,8 +41017,8 @@ "binop": null }, "value": "_entity", - "start": 8113, - "end": 8120, + "start": 8121, + "end": 8128, "loc": { "start": { "line": 203, @@ -41043,8 +41043,8 @@ "binop": null, "updateContext": null }, - "start": 8120, - "end": 8121, + "start": 8128, + "end": 8129, "loc": { "start": { "line": 203, @@ -41069,8 +41069,8 @@ "binop": null }, "value": "model", - "start": 8121, - "end": 8126, + "start": 8129, + "end": 8134, "loc": { "start": { "line": 203, @@ -41095,8 +41095,8 @@ "binop": null, "updateContext": null }, - "start": 8126, - "end": 8127, + "start": 8134, + "end": 8135, "loc": { "start": { "line": 203, @@ -41121,8 +41121,8 @@ "binop": null }, "value": "off", - "start": 8127, - "end": 8130, + "start": 8135, + "end": 8138, "loc": { "start": { "line": 203, @@ -41146,8 +41146,8 @@ "postfix": false, "binop": null }, - "start": 8130, - "end": 8131, + "start": 8138, + "end": 8139, "loc": { "start": { "line": 203, @@ -41174,8 +41174,8 @@ "updateContext": null }, "value": "this", - "start": 8131, - "end": 8135, + "start": 8139, + "end": 8143, "loc": { "start": { "line": 203, @@ -41200,8 +41200,8 @@ "binop": null, "updateContext": null }, - "start": 8135, - "end": 8136, + "start": 8143, + "end": 8144, "loc": { "start": { "line": 203, @@ -41226,8 +41226,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 8136, - "end": 8159, + "start": 8144, + "end": 8167, "loc": { "start": { "line": 203, @@ -41251,8 +41251,8 @@ "postfix": false, "binop": null }, - "start": 8159, - "end": 8160, + "start": 8167, + "end": 8168, "loc": { "start": { "line": 203, @@ -41277,8 +41277,8 @@ "binop": null, "updateContext": null }, - "start": 8160, - "end": 8161, + "start": 8168, + "end": 8169, "loc": { "start": { "line": 203, @@ -41305,8 +41305,8 @@ "updateContext": null }, "value": "this", - "start": 8178, - "end": 8182, + "start": 8186, + "end": 8190, "loc": { "start": { "line": 204, @@ -41331,8 +41331,8 @@ "binop": null, "updateContext": null }, - "start": 8182, - "end": 8183, + "start": 8190, + "end": 8191, "loc": { "start": { "line": 204, @@ -41357,8 +41357,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 8183, - "end": 8206, + "start": 8191, + "end": 8214, "loc": { "start": { "line": 204, @@ -41384,8 +41384,8 @@ "updateContext": null }, "value": "=", - "start": 8207, - "end": 8208, + "start": 8215, + "end": 8216, "loc": { "start": { "line": 204, @@ -41412,8 +41412,8 @@ "updateContext": null }, "value": "null", - "start": 8209, - "end": 8213, + "start": 8217, + "end": 8221, "loc": { "start": { "line": 204, @@ -41438,8 +41438,8 @@ "binop": null, "updateContext": null }, - "start": 8213, - "end": 8214, + "start": 8221, + "end": 8222, "loc": { "start": { "line": 204, @@ -41463,8 +41463,8 @@ "postfix": false, "binop": null }, - "start": 8227, - "end": 8228, + "start": 8235, + "end": 8236, "loc": { "start": { "line": 205, @@ -41488,8 +41488,8 @@ "postfix": false, "binop": null }, - "start": 8237, - "end": 8238, + "start": 8245, + "end": 8246, "loc": { "start": { "line": 206, @@ -41516,8 +41516,8 @@ "updateContext": null }, "value": "this", - "start": 8247, - "end": 8251, + "start": 8255, + "end": 8259, "loc": { "start": { "line": 207, @@ -41542,8 +41542,8 @@ "binop": null, "updateContext": null }, - "start": 8251, - "end": 8252, + "start": 8259, + "end": 8260, "loc": { "start": { "line": 207, @@ -41568,8 +41568,8 @@ "binop": null }, "value": "_entity", - "start": 8252, - "end": 8259, + "start": 8260, + "end": 8267, "loc": { "start": { "line": 207, @@ -41595,8 +41595,8 @@ "updateContext": null }, "value": "=", - "start": 8260, - "end": 8261, + "start": 8268, + "end": 8269, "loc": { "start": { "line": 207, @@ -41621,8 +41621,8 @@ "binop": null }, "value": "entity", - "start": 8262, - "end": 8268, + "start": 8270, + "end": 8276, "loc": { "start": { "line": 207, @@ -41647,8 +41647,8 @@ "binop": null, "updateContext": null }, - "start": 8268, - "end": 8269, + "start": 8276, + "end": 8277, "loc": { "start": { "line": 207, @@ -41675,8 +41675,8 @@ "updateContext": null }, "value": "if", - "start": 8278, - "end": 8280, + "start": 8286, + "end": 8288, "loc": { "start": { "line": 208, @@ -41700,8 +41700,8 @@ "postfix": false, "binop": null }, - "start": 8281, - "end": 8282, + "start": 8289, + "end": 8290, "loc": { "start": { "line": 208, @@ -41728,8 +41728,8 @@ "updateContext": null }, "value": "this", - "start": 8282, - "end": 8286, + "start": 8290, + "end": 8294, "loc": { "start": { "line": 208, @@ -41754,8 +41754,8 @@ "binop": null, "updateContext": null }, - "start": 8286, - "end": 8287, + "start": 8294, + "end": 8295, "loc": { "start": { "line": 208, @@ -41780,8 +41780,8 @@ "binop": null }, "value": "_entity", - "start": 8287, - "end": 8294, + "start": 8295, + "end": 8302, "loc": { "start": { "line": 208, @@ -41805,8 +41805,8 @@ "postfix": false, "binop": null }, - "start": 8294, - "end": 8295, + "start": 8302, + "end": 8303, "loc": { "start": { "line": 208, @@ -41830,8 +41830,8 @@ "postfix": false, "binop": null }, - "start": 8296, - "end": 8297, + "start": 8304, + "end": 8305, "loc": { "start": { "line": 208, @@ -41858,8 +41858,8 @@ "updateContext": null }, "value": "if", - "start": 8310, - "end": 8312, + "start": 8318, + "end": 8320, "loc": { "start": { "line": 209, @@ -41883,8 +41883,8 @@ "postfix": false, "binop": null }, - "start": 8313, - "end": 8314, + "start": 8321, + "end": 8322, "loc": { "start": { "line": 209, @@ -41911,8 +41911,8 @@ "updateContext": null }, "value": "this", - "start": 8314, - "end": 8318, + "start": 8322, + "end": 8326, "loc": { "start": { "line": 209, @@ -41937,8 +41937,8 @@ "binop": null, "updateContext": null }, - "start": 8318, - "end": 8319, + "start": 8326, + "end": 8327, "loc": { "start": { "line": 209, @@ -41963,8 +41963,8 @@ "binop": null }, "value": "_entity", - "start": 8319, - "end": 8326, + "start": 8327, + "end": 8334, "loc": { "start": { "line": 209, @@ -41991,8 +41991,8 @@ "updateContext": null }, "value": "instanceof", - "start": 8327, - "end": 8337, + "start": 8335, + "end": 8345, "loc": { "start": { "line": 209, @@ -42017,8 +42017,8 @@ "binop": null }, "value": "SceneModelEntity", - "start": 8338, - "end": 8354, + "start": 8346, + "end": 8362, "loc": { "start": { "line": 209, @@ -42042,8 +42042,8 @@ "postfix": false, "binop": null }, - "start": 8354, - "end": 8355, + "start": 8362, + "end": 8363, "loc": { "start": { "line": 209, @@ -42067,8 +42067,8 @@ "postfix": false, "binop": null }, - "start": 8356, - "end": 8357, + "start": 8364, + "end": 8365, "loc": { "start": { "line": 209, @@ -42095,8 +42095,8 @@ "updateContext": null }, "value": "this", - "start": 8374, - "end": 8378, + "start": 8382, + "end": 8386, "loc": { "start": { "line": 210, @@ -42121,8 +42121,8 @@ "binop": null, "updateContext": null }, - "start": 8378, - "end": 8379, + "start": 8386, + "end": 8387, "loc": { "start": { "line": 210, @@ -42147,8 +42147,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 8379, - "end": 8402, + "start": 8387, + "end": 8410, "loc": { "start": { "line": 210, @@ -42174,8 +42174,8 @@ "updateContext": null }, "value": "=", - "start": 8403, - "end": 8404, + "start": 8411, + "end": 8412, "loc": { "start": { "line": 210, @@ -42202,8 +42202,8 @@ "updateContext": null }, "value": "this", - "start": 8405, - "end": 8409, + "start": 8413, + "end": 8417, "loc": { "start": { "line": 210, @@ -42228,8 +42228,8 @@ "binop": null, "updateContext": null }, - "start": 8409, - "end": 8410, + "start": 8417, + "end": 8418, "loc": { "start": { "line": 210, @@ -42254,8 +42254,8 @@ "binop": null }, "value": "_entity", - "start": 8410, - "end": 8417, + "start": 8418, + "end": 8425, "loc": { "start": { "line": 210, @@ -42280,8 +42280,8 @@ "binop": null, "updateContext": null }, - "start": 8417, - "end": 8418, + "start": 8425, + "end": 8426, "loc": { "start": { "line": 210, @@ -42306,8 +42306,8 @@ "binop": null }, "value": "model", - "start": 8418, - "end": 8423, + "start": 8426, + "end": 8431, "loc": { "start": { "line": 210, @@ -42332,8 +42332,8 @@ "binop": null, "updateContext": null }, - "start": 8423, - "end": 8424, + "start": 8431, + "end": 8432, "loc": { "start": { "line": 210, @@ -42358,8 +42358,8 @@ "binop": null }, "value": "on", - "start": 8424, - "end": 8426, + "start": 8432, + "end": 8434, "loc": { "start": { "line": 210, @@ -42383,8 +42383,8 @@ "postfix": false, "binop": null }, - "start": 8426, - "end": 8427, + "start": 8434, + "end": 8435, "loc": { "start": { "line": 210, @@ -42410,8 +42410,8 @@ "updateContext": null }, "value": "destroyed", - "start": 8427, - "end": 8438, + "start": 8435, + "end": 8446, "loc": { "start": { "line": 210, @@ -42436,8 +42436,8 @@ "binop": null, "updateContext": null }, - "start": 8438, - "end": 8439, + "start": 8446, + "end": 8447, "loc": { "start": { "line": 210, @@ -42461,8 +42461,8 @@ "postfix": false, "binop": null }, - "start": 8440, - "end": 8441, + "start": 8448, + "end": 8449, "loc": { "start": { "line": 210, @@ -42486,8 +42486,8 @@ "postfix": false, "binop": null }, - "start": 8441, - "end": 8442, + "start": 8449, + "end": 8450, "loc": { "start": { "line": 210, @@ -42512,8 +42512,8 @@ "binop": null, "updateContext": null }, - "start": 8443, - "end": 8445, + "start": 8451, + "end": 8453, "loc": { "start": { "line": 210, @@ -42537,8 +42537,8 @@ "postfix": false, "binop": null }, - "start": 8446, - "end": 8447, + "start": 8454, + "end": 8455, "loc": { "start": { "line": 210, @@ -42553,8 +42553,8 @@ { "type": "CommentLine", "value": " SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel", - "start": 8448, - "end": 8531, + "start": 8456, + "end": 8539, "loc": { "start": { "line": 210, @@ -42581,8 +42581,8 @@ "updateContext": null }, "value": "this", - "start": 8552, - "end": 8556, + "start": 8560, + "end": 8564, "loc": { "start": { "line": 211, @@ -42607,8 +42607,8 @@ "binop": null, "updateContext": null }, - "start": 8556, - "end": 8557, + "start": 8564, + "end": 8565, "loc": { "start": { "line": 211, @@ -42633,8 +42633,8 @@ "binop": null }, "value": "_entity", - "start": 8557, - "end": 8564, + "start": 8565, + "end": 8572, "loc": { "start": { "line": 211, @@ -42660,8 +42660,8 @@ "updateContext": null }, "value": "=", - "start": 8565, - "end": 8566, + "start": 8573, + "end": 8574, "loc": { "start": { "line": 211, @@ -42688,8 +42688,8 @@ "updateContext": null }, "value": "null", - "start": 8567, - "end": 8571, + "start": 8575, + "end": 8579, "loc": { "start": { "line": 211, @@ -42714,8 +42714,8 @@ "binop": null, "updateContext": null }, - "start": 8571, - "end": 8572, + "start": 8579, + "end": 8580, "loc": { "start": { "line": 211, @@ -42730,8 +42730,8 @@ { "type": "CommentLine", "value": " Marker now may become visible, if it was synched to invisible Entity", - "start": 8573, - "end": 8644, + "start": 8581, + "end": 8652, "loc": { "start": { "line": 211, @@ -42758,8 +42758,8 @@ "updateContext": null }, "value": "this", - "start": 8665, - "end": 8669, + "start": 8673, + "end": 8677, "loc": { "start": { "line": 212, @@ -42784,8 +42784,8 @@ "binop": null, "updateContext": null }, - "start": 8669, - "end": 8670, + "start": 8677, + "end": 8678, "loc": { "start": { "line": 212, @@ -42810,8 +42810,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 8670, - "end": 8693, + "start": 8678, + "end": 8701, "loc": { "start": { "line": 212, @@ -42837,8 +42837,8 @@ "updateContext": null }, "value": "=", - "start": 8694, - "end": 8695, + "start": 8702, + "end": 8703, "loc": { "start": { "line": 212, @@ -42865,8 +42865,8 @@ "updateContext": null }, "value": "null", - "start": 8696, - "end": 8700, + "start": 8704, + "end": 8708, "loc": { "start": { "line": 212, @@ -42891,8 +42891,8 @@ "binop": null, "updateContext": null }, - "start": 8700, - "end": 8701, + "start": 8708, + "end": 8709, "loc": { "start": { "line": 212, @@ -42916,8 +42916,8 @@ "postfix": false, "binop": null }, - "start": 8718, - "end": 8719, + "start": 8726, + "end": 8727, "loc": { "start": { "line": 213, @@ -42941,8 +42941,8 @@ "postfix": false, "binop": null }, - "start": 8719, - "end": 8720, + "start": 8727, + "end": 8728, "loc": { "start": { "line": 213, @@ -42967,8 +42967,8 @@ "binop": null, "updateContext": null }, - "start": 8720, - "end": 8721, + "start": 8728, + "end": 8729, "loc": { "start": { "line": 213, @@ -42992,8 +42992,8 @@ "postfix": false, "binop": null }, - "start": 8734, - "end": 8735, + "start": 8742, + "end": 8743, "loc": { "start": { "line": 214, @@ -43020,8 +43020,8 @@ "updateContext": null }, "value": "else", - "start": 8736, - "end": 8740, + "start": 8744, + "end": 8748, "loc": { "start": { "line": 214, @@ -43045,8 +43045,8 @@ "postfix": false, "binop": null }, - "start": 8741, - "end": 8742, + "start": 8749, + "end": 8750, "loc": { "start": { "line": 214, @@ -43073,8 +43073,8 @@ "updateContext": null }, "value": "this", - "start": 8759, - "end": 8763, + "start": 8767, + "end": 8771, "loc": { "start": { "line": 215, @@ -43099,8 +43099,8 @@ "binop": null, "updateContext": null }, - "start": 8763, - "end": 8764, + "start": 8771, + "end": 8772, "loc": { "start": { "line": 215, @@ -43125,8 +43125,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 8764, - "end": 8782, + "start": 8772, + "end": 8790, "loc": { "start": { "line": 215, @@ -43152,8 +43152,8 @@ "updateContext": null }, "value": "=", - "start": 8783, - "end": 8784, + "start": 8791, + "end": 8792, "loc": { "start": { "line": 215, @@ -43180,8 +43180,8 @@ "updateContext": null }, "value": "this", - "start": 8785, - "end": 8789, + "start": 8793, + "end": 8797, "loc": { "start": { "line": 215, @@ -43206,8 +43206,8 @@ "binop": null, "updateContext": null }, - "start": 8789, - "end": 8790, + "start": 8797, + "end": 8798, "loc": { "start": { "line": 215, @@ -43232,8 +43232,8 @@ "binop": null }, "value": "_entity", - "start": 8790, - "end": 8797, + "start": 8798, + "end": 8805, "loc": { "start": { "line": 215, @@ -43258,8 +43258,8 @@ "binop": null, "updateContext": null }, - "start": 8797, - "end": 8798, + "start": 8805, + "end": 8806, "loc": { "start": { "line": 215, @@ -43284,8 +43284,8 @@ "binop": null }, "value": "on", - "start": 8798, - "end": 8800, + "start": 8806, + "end": 8808, "loc": { "start": { "line": 215, @@ -43309,8 +43309,8 @@ "postfix": false, "binop": null }, - "start": 8800, - "end": 8801, + "start": 8808, + "end": 8809, "loc": { "start": { "line": 215, @@ -43336,8 +43336,8 @@ "updateContext": null }, "value": "destroyed", - "start": 8801, - "end": 8812, + "start": 8809, + "end": 8820, "loc": { "start": { "line": 215, @@ -43362,8 +43362,8 @@ "binop": null, "updateContext": null }, - "start": 8812, - "end": 8813, + "start": 8820, + "end": 8821, "loc": { "start": { "line": 215, @@ -43387,8 +43387,8 @@ "postfix": false, "binop": null }, - "start": 8814, - "end": 8815, + "start": 8822, + "end": 8823, "loc": { "start": { "line": 215, @@ -43412,8 +43412,8 @@ "postfix": false, "binop": null }, - "start": 8815, - "end": 8816, + "start": 8823, + "end": 8824, "loc": { "start": { "line": 215, @@ -43438,8 +43438,8 @@ "binop": null, "updateContext": null }, - "start": 8817, - "end": 8819, + "start": 8825, + "end": 8827, "loc": { "start": { "line": 215, @@ -43463,8 +43463,8 @@ "postfix": false, "binop": null }, - "start": 8820, - "end": 8821, + "start": 8828, + "end": 8829, "loc": { "start": { "line": 215, @@ -43491,8 +43491,8 @@ "updateContext": null }, "value": "this", - "start": 8842, - "end": 8846, + "start": 8850, + "end": 8854, "loc": { "start": { "line": 216, @@ -43517,8 +43517,8 @@ "binop": null, "updateContext": null }, - "start": 8846, - "end": 8847, + "start": 8854, + "end": 8855, "loc": { "start": { "line": 216, @@ -43543,8 +43543,8 @@ "binop": null }, "value": "_entity", - "start": 8847, - "end": 8854, + "start": 8855, + "end": 8862, "loc": { "start": { "line": 216, @@ -43570,8 +43570,8 @@ "updateContext": null }, "value": "=", - "start": 8855, - "end": 8856, + "start": 8863, + "end": 8864, "loc": { "start": { "line": 216, @@ -43598,8 +43598,8 @@ "updateContext": null }, "value": "null", - "start": 8857, - "end": 8861, + "start": 8865, + "end": 8869, "loc": { "start": { "line": 216, @@ -43624,8 +43624,8 @@ "binop": null, "updateContext": null }, - "start": 8861, - "end": 8862, + "start": 8869, + "end": 8870, "loc": { "start": { "line": 216, @@ -43652,8 +43652,8 @@ "updateContext": null }, "value": "this", - "start": 8883, - "end": 8887, + "start": 8891, + "end": 8895, "loc": { "start": { "line": 217, @@ -43678,8 +43678,8 @@ "binop": null, "updateContext": null }, - "start": 8887, - "end": 8888, + "start": 8895, + "end": 8896, "loc": { "start": { "line": 217, @@ -43704,8 +43704,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 8888, - "end": 8906, + "start": 8896, + "end": 8914, "loc": { "start": { "line": 217, @@ -43731,8 +43731,8 @@ "updateContext": null }, "value": "=", - "start": 8907, - "end": 8908, + "start": 8915, + "end": 8916, "loc": { "start": { "line": 217, @@ -43759,8 +43759,8 @@ "updateContext": null }, "value": "null", - "start": 8909, - "end": 8913, + "start": 8917, + "end": 8921, "loc": { "start": { "line": 217, @@ -43785,8 +43785,8 @@ "binop": null, "updateContext": null }, - "start": 8913, - "end": 8914, + "start": 8921, + "end": 8922, "loc": { "start": { "line": 217, @@ -43810,8 +43810,8 @@ "postfix": false, "binop": null }, - "start": 8931, - "end": 8932, + "start": 8939, + "end": 8940, "loc": { "start": { "line": 218, @@ -43835,8 +43835,8 @@ "postfix": false, "binop": null }, - "start": 8932, - "end": 8933, + "start": 8940, + "end": 8941, "loc": { "start": { "line": 218, @@ -43861,8 +43861,8 @@ "binop": null, "updateContext": null }, - "start": 8933, - "end": 8934, + "start": 8941, + "end": 8942, "loc": { "start": { "line": 218, @@ -43886,8 +43886,8 @@ "postfix": false, "binop": null }, - "start": 8947, - "end": 8948, + "start": 8955, + "end": 8956, "loc": { "start": { "line": 219, @@ -43911,8 +43911,8 @@ "postfix": false, "binop": null }, - "start": 8957, - "end": 8958, + "start": 8965, + "end": 8966, "loc": { "start": { "line": 220, @@ -43939,8 +43939,8 @@ "updateContext": null }, "value": "this", - "start": 8967, - "end": 8971, + "start": 8975, + "end": 8979, "loc": { "start": { "line": 221, @@ -43965,8 +43965,8 @@ "binop": null, "updateContext": null }, - "start": 8971, - "end": 8972, + "start": 8979, + "end": 8980, "loc": { "start": { "line": 221, @@ -43991,8 +43991,8 @@ "binop": null }, "value": "fire", - "start": 8972, - "end": 8976, + "start": 8980, + "end": 8984, "loc": { "start": { "line": 221, @@ -44016,8 +44016,8 @@ "postfix": false, "binop": null }, - "start": 8976, - "end": 8977, + "start": 8984, + "end": 8985, "loc": { "start": { "line": 221, @@ -44043,8 +44043,8 @@ "updateContext": null }, "value": "entity", - "start": 8977, - "end": 8985, + "start": 8985, + "end": 8993, "loc": { "start": { "line": 221, @@ -44069,8 +44069,8 @@ "binop": null, "updateContext": null }, - "start": 8985, - "end": 8986, + "start": 8993, + "end": 8994, "loc": { "start": { "line": 221, @@ -44097,8 +44097,8 @@ "updateContext": null }, "value": "this", - "start": 8987, - "end": 8991, + "start": 8995, + "end": 8999, "loc": { "start": { "line": 221, @@ -44123,8 +44123,8 @@ "binop": null, "updateContext": null }, - "start": 8991, - "end": 8992, + "start": 8999, + "end": 9000, "loc": { "start": { "line": 221, @@ -44149,8 +44149,8 @@ "binop": null }, "value": "_entity", - "start": 8992, - "end": 8999, + "start": 9000, + "end": 9007, "loc": { "start": { "line": 221, @@ -44175,8 +44175,8 @@ "binop": null, "updateContext": null }, - "start": 8999, - "end": 9000, + "start": 9007, + "end": 9008, "loc": { "start": { "line": 221, @@ -44203,8 +44203,8 @@ "updateContext": null }, "value": "true", - "start": 9001, - "end": 9005, + "start": 9009, + "end": 9013, "loc": { "start": { "line": 221, @@ -44219,8 +44219,8 @@ { "type": "CommentBlock", "value": " forget ", - "start": 9006, - "end": 9018, + "start": 9014, + "end": 9026, "loc": { "start": { "line": 221, @@ -44244,8 +44244,8 @@ "postfix": false, "binop": null }, - "start": 9018, - "end": 9019, + "start": 9026, + "end": 9027, "loc": { "start": { "line": 221, @@ -44270,8 +44270,8 @@ "binop": null, "updateContext": null }, - "start": 9019, - "end": 9020, + "start": 9027, + "end": 9028, "loc": { "start": { "line": 221, @@ -44295,8 +44295,8 @@ "postfix": false, "binop": null }, - "start": 9025, - "end": 9026, + "start": 9033, + "end": 9034, "loc": { "start": { "line": 222, @@ -44311,8 +44311,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n ", - "start": 9032, - "end": 9135, + "start": 9040, + "end": 9143, "loc": { "start": { "line": 224, @@ -44337,8 +44337,8 @@ "binop": null }, "value": "get", - "start": 9140, - "end": 9143, + "start": 9148, + "end": 9151, "loc": { "start": { "line": 229, @@ -44363,8 +44363,8 @@ "binop": null }, "value": "entity", - "start": 9144, - "end": 9150, + "start": 9152, + "end": 9158, "loc": { "start": { "line": 229, @@ -44388,8 +44388,8 @@ "postfix": false, "binop": null }, - "start": 9150, - "end": 9151, + "start": 9158, + "end": 9159, "loc": { "start": { "line": 229, @@ -44413,8 +44413,8 @@ "postfix": false, "binop": null }, - "start": 9151, - "end": 9152, + "start": 9159, + "end": 9160, "loc": { "start": { "line": 229, @@ -44438,8 +44438,8 @@ "postfix": false, "binop": null }, - "start": 9153, - "end": 9154, + "start": 9161, + "end": 9162, "loc": { "start": { "line": 229, @@ -44466,8 +44466,8 @@ "updateContext": null }, "value": "return", - "start": 9163, - "end": 9169, + "start": 9171, + "end": 9177, "loc": { "start": { "line": 230, @@ -44494,8 +44494,8 @@ "updateContext": null }, "value": "this", - "start": 9170, - "end": 9174, + "start": 9178, + "end": 9182, "loc": { "start": { "line": 230, @@ -44520,8 +44520,8 @@ "binop": null, "updateContext": null }, - "start": 9174, - "end": 9175, + "start": 9182, + "end": 9183, "loc": { "start": { "line": 230, @@ -44546,8 +44546,8 @@ "binop": null }, "value": "_entity", - "start": 9175, - "end": 9182, + "start": 9183, + "end": 9190, "loc": { "start": { "line": 230, @@ -44572,8 +44572,8 @@ "binop": null, "updateContext": null }, - "start": 9182, - "end": 9183, + "start": 9190, + "end": 9191, "loc": { "start": { "line": 230, @@ -44597,8 +44597,8 @@ "postfix": false, "binop": null }, - "start": 9188, - "end": 9189, + "start": 9196, + "end": 9197, "loc": { "start": { "line": 231, @@ -44613,8 +44613,8 @@ { "type": "CommentBlock", "value": "*\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n ", - "start": 9195, - "end": 9681, + "start": 9203, + "end": 9689, "loc": { "start": { "line": 233, @@ -44639,8 +44639,8 @@ "binop": null }, "value": "set", - "start": 9686, - "end": 9689, + "start": 9694, + "end": 9697, "loc": { "start": { "line": 243, @@ -44665,8 +44665,8 @@ "binop": null }, "value": "occludable", - "start": 9690, - "end": 9700, + "start": 9698, + "end": 9708, "loc": { "start": { "line": 243, @@ -44690,8 +44690,8 @@ "postfix": false, "binop": null }, - "start": 9700, - "end": 9701, + "start": 9708, + "end": 9709, "loc": { "start": { "line": 243, @@ -44716,8 +44716,8 @@ "binop": null }, "value": "occludable", - "start": 9701, - "end": 9711, + "start": 9709, + "end": 9719, "loc": { "start": { "line": 243, @@ -44741,8 +44741,8 @@ "postfix": false, "binop": null }, - "start": 9711, - "end": 9712, + "start": 9719, + "end": 9720, "loc": { "start": { "line": 243, @@ -44766,8 +44766,8 @@ "postfix": false, "binop": null }, - "start": 9713, - "end": 9714, + "start": 9721, + "end": 9722, "loc": { "start": { "line": 243, @@ -44792,8 +44792,8 @@ "binop": null }, "value": "occludable", - "start": 9723, - "end": 9733, + "start": 9731, + "end": 9741, "loc": { "start": { "line": 244, @@ -44819,8 +44819,8 @@ "updateContext": null }, "value": "=", - "start": 9734, - "end": 9735, + "start": 9742, + "end": 9743, "loc": { "start": { "line": 244, @@ -44846,8 +44846,8 @@ "updateContext": null }, "value": "!", - "start": 9736, - "end": 9737, + "start": 9744, + "end": 9745, "loc": { "start": { "line": 244, @@ -44873,8 +44873,8 @@ "updateContext": null }, "value": "!", - "start": 9737, - "end": 9738, + "start": 9745, + "end": 9746, "loc": { "start": { "line": 244, @@ -44899,8 +44899,8 @@ "binop": null }, "value": "occludable", - "start": 9738, - "end": 9748, + "start": 9746, + "end": 9756, "loc": { "start": { "line": 244, @@ -44925,8 +44925,8 @@ "binop": null, "updateContext": null }, - "start": 9748, - "end": 9749, + "start": 9756, + "end": 9757, "loc": { "start": { "line": 244, @@ -44953,8 +44953,8 @@ "updateContext": null }, "value": "if", - "start": 9758, - "end": 9760, + "start": 9766, + "end": 9768, "loc": { "start": { "line": 245, @@ -44978,8 +44978,8 @@ "postfix": false, "binop": null }, - "start": 9761, - "end": 9762, + "start": 9769, + "end": 9770, "loc": { "start": { "line": 245, @@ -45004,8 +45004,8 @@ "binop": null }, "value": "occludable", - "start": 9762, - "end": 9772, + "start": 9770, + "end": 9780, "loc": { "start": { "line": 245, @@ -45031,8 +45031,8 @@ "updateContext": null }, "value": "===", - "start": 9773, - "end": 9776, + "start": 9781, + "end": 9784, "loc": { "start": { "line": 245, @@ -45059,8 +45059,8 @@ "updateContext": null }, "value": "this", - "start": 9777, - "end": 9781, + "start": 9785, + "end": 9789, "loc": { "start": { "line": 245, @@ -45085,8 +45085,8 @@ "binop": null, "updateContext": null }, - "start": 9781, - "end": 9782, + "start": 9789, + "end": 9790, "loc": { "start": { "line": 245, @@ -45111,8 +45111,8 @@ "binop": null }, "value": "_occludable", - "start": 9782, - "end": 9793, + "start": 9790, + "end": 9801, "loc": { "start": { "line": 245, @@ -45136,8 +45136,8 @@ "postfix": false, "binop": null }, - "start": 9793, - "end": 9794, + "start": 9801, + "end": 9802, "loc": { "start": { "line": 245, @@ -45161,8 +45161,8 @@ "postfix": false, "binop": null }, - "start": 9795, - "end": 9796, + "start": 9803, + "end": 9804, "loc": { "start": { "line": 245, @@ -45189,8 +45189,8 @@ "updateContext": null }, "value": "return", - "start": 9809, - "end": 9815, + "start": 9817, + "end": 9823, "loc": { "start": { "line": 246, @@ -45215,8 +45215,8 @@ "binop": null, "updateContext": null }, - "start": 9815, - "end": 9816, + "start": 9823, + "end": 9824, "loc": { "start": { "line": 246, @@ -45240,8 +45240,8 @@ "postfix": false, "binop": null }, - "start": 9825, - "end": 9826, + "start": 9833, + "end": 9834, "loc": { "start": { "line": 247, @@ -45268,8 +45268,8 @@ "updateContext": null }, "value": "this", - "start": 9835, - "end": 9839, + "start": 9843, + "end": 9847, "loc": { "start": { "line": 248, @@ -45294,8 +45294,8 @@ "binop": null, "updateContext": null }, - "start": 9839, - "end": 9840, + "start": 9847, + "end": 9848, "loc": { "start": { "line": 248, @@ -45320,8 +45320,8 @@ "binop": null }, "value": "_occludable", - "start": 9840, - "end": 9851, + "start": 9848, + "end": 9859, "loc": { "start": { "line": 248, @@ -45347,8 +45347,8 @@ "updateContext": null }, "value": "=", - "start": 9852, - "end": 9853, + "start": 9860, + "end": 9861, "loc": { "start": { "line": 248, @@ -45373,8 +45373,8 @@ "binop": null }, "value": "occludable", - "start": 9854, - "end": 9864, + "start": 9862, + "end": 9872, "loc": { "start": { "line": 248, @@ -45399,8 +45399,8 @@ "binop": null, "updateContext": null }, - "start": 9864, - "end": 9865, + "start": 9872, + "end": 9873, "loc": { "start": { "line": 248, @@ -45424,8 +45424,8 @@ "postfix": false, "binop": null }, - "start": 9870, - "end": 9871, + "start": 9878, + "end": 9879, "loc": { "start": { "line": 249, @@ -45440,8 +45440,8 @@ { "type": "CommentBlock", "value": "*\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n ", - "start": 9877, - "end": 10146, + "start": 9885, + "end": 10154, "loc": { "start": { "line": 251, @@ -45466,8 +45466,8 @@ "binop": null }, "value": "get", - "start": 10151, - "end": 10154, + "start": 10159, + "end": 10162, "loc": { "start": { "line": 258, @@ -45492,8 +45492,8 @@ "binop": null }, "value": "occludable", - "start": 10155, - "end": 10165, + "start": 10163, + "end": 10173, "loc": { "start": { "line": 258, @@ -45517,8 +45517,8 @@ "postfix": false, "binop": null }, - "start": 10165, - "end": 10166, + "start": 10173, + "end": 10174, "loc": { "start": { "line": 258, @@ -45542,8 +45542,8 @@ "postfix": false, "binop": null }, - "start": 10166, - "end": 10167, + "start": 10174, + "end": 10175, "loc": { "start": { "line": 258, @@ -45567,8 +45567,8 @@ "postfix": false, "binop": null }, - "start": 10168, - "end": 10169, + "start": 10176, + "end": 10177, "loc": { "start": { "line": 258, @@ -45595,8 +45595,8 @@ "updateContext": null }, "value": "return", - "start": 10178, - "end": 10184, + "start": 10186, + "end": 10192, "loc": { "start": { "line": 259, @@ -45623,8 +45623,8 @@ "updateContext": null }, "value": "this", - "start": 10185, - "end": 10189, + "start": 10193, + "end": 10197, "loc": { "start": { "line": 259, @@ -45649,8 +45649,8 @@ "binop": null, "updateContext": null }, - "start": 10189, - "end": 10190, + "start": 10197, + "end": 10198, "loc": { "start": { "line": 259, @@ -45675,8 +45675,8 @@ "binop": null }, "value": "_occludable", - "start": 10190, - "end": 10201, + "start": 10198, + "end": 10209, "loc": { "start": { "line": 259, @@ -45701,8 +45701,8 @@ "binop": null, "updateContext": null }, - "start": 10201, - "end": 10202, + "start": 10209, + "end": 10210, "loc": { "start": { "line": 259, @@ -45726,8 +45726,8 @@ "postfix": false, "binop": null }, - "start": 10207, - "end": 10208, + "start": 10215, + "end": 10216, "loc": { "start": { "line": 260, @@ -45742,8 +45742,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n ", - "start": 10214, - "end": 10376, + "start": 10222, + "end": 10384, "loc": { "start": { "line": 262, @@ -45768,8 +45768,8 @@ "binop": null }, "value": "set", - "start": 10381, - "end": 10384, + "start": 10389, + "end": 10392, "loc": { "start": { "line": 269, @@ -45794,8 +45794,8 @@ "binop": null }, "value": "worldPos", - "start": 10385, - "end": 10393, + "start": 10393, + "end": 10401, "loc": { "start": { "line": 269, @@ -45819,8 +45819,8 @@ "postfix": false, "binop": null }, - "start": 10393, - "end": 10394, + "start": 10401, + "end": 10402, "loc": { "start": { "line": 269, @@ -45845,8 +45845,8 @@ "binop": null }, "value": "worldPos", - "start": 10394, - "end": 10402, + "start": 10402, + "end": 10410, "loc": { "start": { "line": 269, @@ -45870,8 +45870,8 @@ "postfix": false, "binop": null }, - "start": 10402, - "end": 10403, + "start": 10410, + "end": 10411, "loc": { "start": { "line": 269, @@ -45895,8 +45895,8 @@ "postfix": false, "binop": null }, - "start": 10404, - "end": 10405, + "start": 10412, + "end": 10413, "loc": { "start": { "line": 269, @@ -45923,8 +45923,8 @@ "updateContext": null }, "value": "this", - "start": 10414, - "end": 10418, + "start": 10422, + "end": 10426, "loc": { "start": { "line": 270, @@ -45949,8 +45949,8 @@ "binop": null, "updateContext": null }, - "start": 10418, - "end": 10419, + "start": 10426, + "end": 10427, "loc": { "start": { "line": 270, @@ -45975,8 +45975,8 @@ "binop": null }, "value": "_worldPos", - "start": 10419, - "end": 10428, + "start": 10427, + "end": 10436, "loc": { "start": { "line": 270, @@ -46001,8 +46001,8 @@ "binop": null, "updateContext": null }, - "start": 10428, - "end": 10429, + "start": 10436, + "end": 10437, "loc": { "start": { "line": 270, @@ -46027,8 +46027,8 @@ "binop": null }, "value": "set", - "start": 10429, - "end": 10432, + "start": 10437, + "end": 10440, "loc": { "start": { "line": 270, @@ -46052,8 +46052,8 @@ "postfix": false, "binop": null }, - "start": 10432, - "end": 10433, + "start": 10440, + "end": 10441, "loc": { "start": { "line": 270, @@ -46078,8 +46078,8 @@ "binop": null }, "value": "worldPos", - "start": 10433, - "end": 10441, + "start": 10441, + "end": 10449, "loc": { "start": { "line": 270, @@ -46105,8 +46105,8 @@ "updateContext": null }, "value": "||", - "start": 10442, - "end": 10444, + "start": 10450, + "end": 10452, "loc": { "start": { "line": 270, @@ -46131,8 +46131,8 @@ "binop": null, "updateContext": null }, - "start": 10445, - "end": 10446, + "start": 10453, + "end": 10454, "loc": { "start": { "line": 270, @@ -46158,8 +46158,8 @@ "updateContext": null }, "value": 0, - "start": 10446, - "end": 10447, + "start": 10454, + "end": 10455, "loc": { "start": { "line": 270, @@ -46184,8 +46184,8 @@ "binop": null, "updateContext": null }, - "start": 10447, - "end": 10448, + "start": 10455, + "end": 10456, "loc": { "start": { "line": 270, @@ -46211,8 +46211,8 @@ "updateContext": null }, "value": 0, - "start": 10449, - "end": 10450, + "start": 10457, + "end": 10458, "loc": { "start": { "line": 270, @@ -46237,8 +46237,8 @@ "binop": null, "updateContext": null }, - "start": 10450, - "end": 10451, + "start": 10458, + "end": 10459, "loc": { "start": { "line": 270, @@ -46264,8 +46264,8 @@ "updateContext": null }, "value": 0, - "start": 10452, - "end": 10453, + "start": 10460, + "end": 10461, "loc": { "start": { "line": 270, @@ -46290,8 +46290,8 @@ "binop": null, "updateContext": null }, - "start": 10453, - "end": 10454, + "start": 10461, + "end": 10462, "loc": { "start": { "line": 270, @@ -46315,8 +46315,8 @@ "postfix": false, "binop": null }, - "start": 10454, - "end": 10455, + "start": 10462, + "end": 10463, "loc": { "start": { "line": 270, @@ -46341,8 +46341,8 @@ "binop": null, "updateContext": null }, - "start": 10455, - "end": 10456, + "start": 10463, + "end": 10464, "loc": { "start": { "line": 270, @@ -46367,8 +46367,8 @@ "binop": null }, "value": "worldToRTCPos", - "start": 10465, - "end": 10478, + "start": 10473, + "end": 10486, "loc": { "start": { "line": 271, @@ -46392,8 +46392,8 @@ "postfix": false, "binop": null }, - "start": 10478, - "end": 10479, + "start": 10486, + "end": 10487, "loc": { "start": { "line": 271, @@ -46420,8 +46420,8 @@ "updateContext": null }, "value": "this", - "start": 10479, - "end": 10483, + "start": 10487, + "end": 10491, "loc": { "start": { "line": 271, @@ -46446,8 +46446,8 @@ "binop": null, "updateContext": null }, - "start": 10483, - "end": 10484, + "start": 10491, + "end": 10492, "loc": { "start": { "line": 271, @@ -46472,8 +46472,8 @@ "binop": null }, "value": "_worldPos", - "start": 10484, - "end": 10493, + "start": 10492, + "end": 10501, "loc": { "start": { "line": 271, @@ -46498,8 +46498,8 @@ "binop": null, "updateContext": null }, - "start": 10493, - "end": 10494, + "start": 10501, + "end": 10502, "loc": { "start": { "line": 271, @@ -46526,8 +46526,8 @@ "updateContext": null }, "value": "this", - "start": 10495, - "end": 10499, + "start": 10503, + "end": 10507, "loc": { "start": { "line": 271, @@ -46552,8 +46552,8 @@ "binop": null, "updateContext": null }, - "start": 10499, - "end": 10500, + "start": 10507, + "end": 10508, "loc": { "start": { "line": 271, @@ -46578,8 +46578,8 @@ "binop": null }, "value": "_origin", - "start": 10500, - "end": 10507, + "start": 10508, + "end": 10515, "loc": { "start": { "line": 271, @@ -46604,8 +46604,8 @@ "binop": null, "updateContext": null }, - "start": 10507, - "end": 10508, + "start": 10515, + "end": 10516, "loc": { "start": { "line": 271, @@ -46632,8 +46632,8 @@ "updateContext": null }, "value": "this", - "start": 10509, - "end": 10513, + "start": 10517, + "end": 10521, "loc": { "start": { "line": 271, @@ -46658,8 +46658,8 @@ "binop": null, "updateContext": null }, - "start": 10513, - "end": 10514, + "start": 10521, + "end": 10522, "loc": { "start": { "line": 271, @@ -46684,8 +46684,8 @@ "binop": null }, "value": "_rtcPos", - "start": 10514, - "end": 10521, + "start": 10522, + "end": 10529, "loc": { "start": { "line": 271, @@ -46709,8 +46709,8 @@ "postfix": false, "binop": null }, - "start": 10521, - "end": 10522, + "start": 10529, + "end": 10530, "loc": { "start": { "line": 271, @@ -46735,8 +46735,8 @@ "binop": null, "updateContext": null }, - "start": 10522, - "end": 10523, + "start": 10530, + "end": 10531, "loc": { "start": { "line": 271, @@ -46763,8 +46763,8 @@ "updateContext": null }, "value": "if", - "start": 10532, - "end": 10534, + "start": 10540, + "end": 10542, "loc": { "start": { "line": 272, @@ -46788,8 +46788,8 @@ "postfix": false, "binop": null }, - "start": 10535, - "end": 10536, + "start": 10543, + "end": 10544, "loc": { "start": { "line": 272, @@ -46816,8 +46816,8 @@ "updateContext": null }, "value": "this", - "start": 10536, - "end": 10540, + "start": 10544, + "end": 10548, "loc": { "start": { "line": 272, @@ -46842,8 +46842,8 @@ "binop": null, "updateContext": null }, - "start": 10540, - "end": 10541, + "start": 10548, + "end": 10549, "loc": { "start": { "line": 272, @@ -46868,8 +46868,8 @@ "binop": null }, "value": "_occludable", - "start": 10541, - "end": 10552, + "start": 10549, + "end": 10560, "loc": { "start": { "line": 272, @@ -46893,8 +46893,8 @@ "postfix": false, "binop": null }, - "start": 10552, - "end": 10553, + "start": 10560, + "end": 10561, "loc": { "start": { "line": 272, @@ -46918,8 +46918,8 @@ "postfix": false, "binop": null }, - "start": 10554, - "end": 10555, + "start": 10562, + "end": 10563, "loc": { "start": { "line": 272, @@ -46946,8 +46946,8 @@ "updateContext": null }, "value": "this", - "start": 10568, - "end": 10572, + "start": 10576, + "end": 10580, "loc": { "start": { "line": 273, @@ -46972,8 +46972,8 @@ "binop": null, "updateContext": null }, - "start": 10572, - "end": 10573, + "start": 10580, + "end": 10581, "loc": { "start": { "line": 273, @@ -46998,8 +46998,8 @@ "binop": null }, "value": "_renderer", - "start": 10573, - "end": 10582, + "start": 10581, + "end": 10590, "loc": { "start": { "line": 273, @@ -47024,8 +47024,8 @@ "binop": null, "updateContext": null }, - "start": 10582, - "end": 10583, + "start": 10590, + "end": 10591, "loc": { "start": { "line": 273, @@ -47050,8 +47050,8 @@ "binop": null }, "value": "markerWorldPosUpdated", - "start": 10583, - "end": 10604, + "start": 10591, + "end": 10612, "loc": { "start": { "line": 273, @@ -47075,8 +47075,8 @@ "postfix": false, "binop": null }, - "start": 10604, - "end": 10605, + "start": 10612, + "end": 10613, "loc": { "start": { "line": 273, @@ -47103,8 +47103,8 @@ "updateContext": null }, "value": "this", - "start": 10605, - "end": 10609, + "start": 10613, + "end": 10617, "loc": { "start": { "line": 273, @@ -47128,8 +47128,8 @@ "postfix": false, "binop": null }, - "start": 10609, - "end": 10610, + "start": 10617, + "end": 10618, "loc": { "start": { "line": 273, @@ -47154,8 +47154,8 @@ "binop": null, "updateContext": null }, - "start": 10610, - "end": 10611, + "start": 10618, + "end": 10619, "loc": { "start": { "line": 273, @@ -47179,8 +47179,8 @@ "postfix": false, "binop": null }, - "start": 10620, - "end": 10621, + "start": 10628, + "end": 10629, "loc": { "start": { "line": 274, @@ -47207,8 +47207,8 @@ "updateContext": null }, "value": "this", - "start": 10630, - "end": 10634, + "start": 10638, + "end": 10642, "loc": { "start": { "line": 275, @@ -47233,8 +47233,8 @@ "binop": null, "updateContext": null }, - "start": 10634, - "end": 10635, + "start": 10642, + "end": 10643, "loc": { "start": { "line": 275, @@ -47259,8 +47259,8 @@ "binop": null }, "value": "_viewPosDirty", - "start": 10635, - "end": 10648, + "start": 10643, + "end": 10656, "loc": { "start": { "line": 275, @@ -47286,8 +47286,8 @@ "updateContext": null }, "value": "=", - "start": 10649, - "end": 10650, + "start": 10657, + "end": 10658, "loc": { "start": { "line": 275, @@ -47314,8 +47314,8 @@ "updateContext": null }, "value": "true", - "start": 10651, - "end": 10655, + "start": 10659, + "end": 10663, "loc": { "start": { "line": 275, @@ -47340,8 +47340,8 @@ "binop": null, "updateContext": null }, - "start": 10655, - "end": 10656, + "start": 10663, + "end": 10664, "loc": { "start": { "line": 275, @@ -47368,8 +47368,8 @@ "updateContext": null }, "value": "this", - "start": 10665, - "end": 10669, + "start": 10673, + "end": 10677, "loc": { "start": { "line": 276, @@ -47394,8 +47394,8 @@ "binop": null, "updateContext": null }, - "start": 10669, - "end": 10670, + "start": 10677, + "end": 10678, "loc": { "start": { "line": 276, @@ -47420,8 +47420,8 @@ "binop": null }, "value": "fire", - "start": 10670, - "end": 10674, + "start": 10678, + "end": 10682, "loc": { "start": { "line": 276, @@ -47445,8 +47445,8 @@ "postfix": false, "binop": null }, - "start": 10674, - "end": 10675, + "start": 10682, + "end": 10683, "loc": { "start": { "line": 276, @@ -47472,8 +47472,8 @@ "updateContext": null }, "value": "worldPos", - "start": 10675, - "end": 10685, + "start": 10683, + "end": 10693, "loc": { "start": { "line": 276, @@ -47498,8 +47498,8 @@ "binop": null, "updateContext": null }, - "start": 10685, - "end": 10686, + "start": 10693, + "end": 10694, "loc": { "start": { "line": 276, @@ -47526,8 +47526,8 @@ "updateContext": null }, "value": "this", - "start": 10687, - "end": 10691, + "start": 10695, + "end": 10699, "loc": { "start": { "line": 276, @@ -47552,8 +47552,8 @@ "binop": null, "updateContext": null }, - "start": 10691, - "end": 10692, + "start": 10699, + "end": 10700, "loc": { "start": { "line": 276, @@ -47578,8 +47578,8 @@ "binop": null }, "value": "_worldPos", - "start": 10692, - "end": 10701, + "start": 10700, + "end": 10709, "loc": { "start": { "line": 276, @@ -47603,8 +47603,8 @@ "postfix": false, "binop": null }, - "start": 10701, - "end": 10702, + "start": 10709, + "end": 10710, "loc": { "start": { "line": 276, @@ -47629,8 +47629,8 @@ "binop": null, "updateContext": null }, - "start": 10702, - "end": 10703, + "start": 10710, + "end": 10711, "loc": { "start": { "line": 276, @@ -47657,8 +47657,8 @@ "updateContext": null }, "value": "this", - "start": 10712, - "end": 10716, + "start": 10720, + "end": 10724, "loc": { "start": { "line": 277, @@ -47683,8 +47683,8 @@ "binop": null, "updateContext": null }, - "start": 10716, - "end": 10717, + "start": 10724, + "end": 10725, "loc": { "start": { "line": 277, @@ -47709,8 +47709,8 @@ "binop": null }, "value": "_needUpdate", - "start": 10717, - "end": 10728, + "start": 10725, + "end": 10736, "loc": { "start": { "line": 277, @@ -47734,8 +47734,8 @@ "postfix": false, "binop": null }, - "start": 10728, - "end": 10729, + "start": 10736, + "end": 10737, "loc": { "start": { "line": 277, @@ -47759,8 +47759,8 @@ "postfix": false, "binop": null }, - "start": 10729, - "end": 10730, + "start": 10737, + "end": 10738, "loc": { "start": { "line": 277, @@ -47785,8 +47785,8 @@ "binop": null, "updateContext": null }, - "start": 10730, - "end": 10731, + "start": 10738, + "end": 10739, "loc": { "start": { "line": 277, @@ -47810,8 +47810,8 @@ "postfix": false, "binop": null }, - "start": 10736, - "end": 10737, + "start": 10744, + "end": 10745, "loc": { "start": { "line": 278, @@ -47826,8 +47826,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n ", - "start": 10743, - "end": 10841, + "start": 10751, + "end": 10849, "loc": { "start": { "line": 280, @@ -47852,8 +47852,8 @@ "binop": null }, "value": "get", - "start": 10846, - "end": 10849, + "start": 10854, + "end": 10857, "loc": { "start": { "line": 285, @@ -47878,8 +47878,8 @@ "binop": null }, "value": "worldPos", - "start": 10850, - "end": 10858, + "start": 10858, + "end": 10866, "loc": { "start": { "line": 285, @@ -47903,8 +47903,8 @@ "postfix": false, "binop": null }, - "start": 10858, - "end": 10859, + "start": 10866, + "end": 10867, "loc": { "start": { "line": 285, @@ -47928,8 +47928,8 @@ "postfix": false, "binop": null }, - "start": 10859, - "end": 10860, + "start": 10867, + "end": 10868, "loc": { "start": { "line": 285, @@ -47953,8 +47953,8 @@ "postfix": false, "binop": null }, - "start": 10861, - "end": 10862, + "start": 10869, + "end": 10870, "loc": { "start": { "line": 285, @@ -47981,8 +47981,8 @@ "updateContext": null }, "value": "return", - "start": 10871, - "end": 10877, + "start": 10879, + "end": 10885, "loc": { "start": { "line": 286, @@ -48009,8 +48009,8 @@ "updateContext": null }, "value": "this", - "start": 10878, - "end": 10882, + "start": 10886, + "end": 10890, "loc": { "start": { "line": 286, @@ -48035,8 +48035,8 @@ "binop": null, "updateContext": null }, - "start": 10882, - "end": 10883, + "start": 10890, + "end": 10891, "loc": { "start": { "line": 286, @@ -48061,8 +48061,8 @@ "binop": null }, "value": "_worldPos", - "start": 10883, - "end": 10892, + "start": 10891, + "end": 10900, "loc": { "start": { "line": 286, @@ -48087,8 +48087,8 @@ "binop": null, "updateContext": null }, - "start": 10892, - "end": 10893, + "start": 10900, + "end": 10901, "loc": { "start": { "line": 286, @@ -48112,8 +48112,8 @@ "postfix": false, "binop": null }, - "start": 10898, - "end": 10899, + "start": 10906, + "end": 10907, "loc": { "start": { "line": 287, @@ -48128,8 +48128,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 10905, - "end": 11067, + "start": 10913, + "end": 11075, "loc": { "start": { "line": 289, @@ -48154,8 +48154,8 @@ "binop": null }, "value": "get", - "start": 11072, - "end": 11075, + "start": 11080, + "end": 11083, "loc": { "start": { "line": 296, @@ -48180,8 +48180,8 @@ "binop": null }, "value": "origin", - "start": 11076, - "end": 11082, + "start": 11084, + "end": 11090, "loc": { "start": { "line": 296, @@ -48205,8 +48205,8 @@ "postfix": false, "binop": null }, - "start": 11082, - "end": 11083, + "start": 11090, + "end": 11091, "loc": { "start": { "line": 296, @@ -48230,8 +48230,8 @@ "postfix": false, "binop": null }, - "start": 11083, - "end": 11084, + "start": 11091, + "end": 11092, "loc": { "start": { "line": 296, @@ -48255,8 +48255,8 @@ "postfix": false, "binop": null }, - "start": 11085, - "end": 11086, + "start": 11093, + "end": 11094, "loc": { "start": { "line": 296, @@ -48283,8 +48283,8 @@ "updateContext": null }, "value": "return", - "start": 11095, - "end": 11101, + "start": 11103, + "end": 11109, "loc": { "start": { "line": 297, @@ -48311,8 +48311,8 @@ "updateContext": null }, "value": "this", - "start": 11102, - "end": 11106, + "start": 11110, + "end": 11114, "loc": { "start": { "line": 297, @@ -48337,8 +48337,8 @@ "binop": null, "updateContext": null }, - "start": 11106, - "end": 11107, + "start": 11114, + "end": 11115, "loc": { "start": { "line": 297, @@ -48363,8 +48363,8 @@ "binop": null }, "value": "_origin", - "start": 11107, - "end": 11114, + "start": 11115, + "end": 11122, "loc": { "start": { "line": 297, @@ -48389,8 +48389,8 @@ "binop": null, "updateContext": null }, - "start": 11114, - "end": 11115, + "start": 11122, + "end": 11123, "loc": { "start": { "line": 297, @@ -48414,8 +48414,8 @@ "postfix": false, "binop": null }, - "start": 11120, - "end": 11121, + "start": 11128, + "end": 11129, "loc": { "start": { "line": 298, @@ -48430,8 +48430,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n ", - "start": 11127, - "end": 11291, + "start": 11135, + "end": 11299, "loc": { "start": { "line": 300, @@ -48456,8 +48456,8 @@ "binop": null }, "value": "get", - "start": 11296, - "end": 11299, + "start": 11304, + "end": 11307, "loc": { "start": { "line": 307, @@ -48482,8 +48482,8 @@ "binop": null }, "value": "rtcPos", - "start": 11300, - "end": 11306, + "start": 11308, + "end": 11314, "loc": { "start": { "line": 307, @@ -48507,8 +48507,8 @@ "postfix": false, "binop": null }, - "start": 11306, - "end": 11307, + "start": 11314, + "end": 11315, "loc": { "start": { "line": 307, @@ -48532,8 +48532,8 @@ "postfix": false, "binop": null }, - "start": 11307, - "end": 11308, + "start": 11315, + "end": 11316, "loc": { "start": { "line": 307, @@ -48557,8 +48557,8 @@ "postfix": false, "binop": null }, - "start": 11309, - "end": 11310, + "start": 11317, + "end": 11318, "loc": { "start": { "line": 307, @@ -48585,8 +48585,8 @@ "updateContext": null }, "value": "return", - "start": 11319, - "end": 11325, + "start": 11327, + "end": 11333, "loc": { "start": { "line": 308, @@ -48613,8 +48613,8 @@ "updateContext": null }, "value": "this", - "start": 11326, - "end": 11330, + "start": 11334, + "end": 11338, "loc": { "start": { "line": 308, @@ -48639,8 +48639,8 @@ "binop": null, "updateContext": null }, - "start": 11330, - "end": 11331, + "start": 11338, + "end": 11339, "loc": { "start": { "line": 308, @@ -48665,8 +48665,8 @@ "binop": null }, "value": "_rtcPos", - "start": 11331, - "end": 11338, + "start": 11339, + "end": 11346, "loc": { "start": { "line": 308, @@ -48691,8 +48691,8 @@ "binop": null, "updateContext": null }, - "start": 11338, - "end": 11339, + "start": 11346, + "end": 11347, "loc": { "start": { "line": 308, @@ -48716,8 +48716,8 @@ "postfix": false, "binop": null }, - "start": 11344, - "end": 11345, + "start": 11352, + "end": 11353, "loc": { "start": { "line": 309, @@ -48732,8 +48732,8 @@ { "type": "CommentBlock", "value": "*\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11351, - "end": 11680, + "start": 11359, + "end": 11688, "loc": { "start": { "line": 311, @@ -48758,8 +48758,8 @@ "binop": null }, "value": "get", - "start": 11685, - "end": 11688, + "start": 11693, + "end": 11696, "loc": { "start": { "line": 321, @@ -48784,8 +48784,8 @@ "binop": null }, "value": "viewPos", - "start": 11689, - "end": 11696, + "start": 11697, + "end": 11704, "loc": { "start": { "line": 321, @@ -48809,8 +48809,8 @@ "postfix": false, "binop": null }, - "start": 11696, - "end": 11697, + "start": 11704, + "end": 11705, "loc": { "start": { "line": 321, @@ -48834,8 +48834,8 @@ "postfix": false, "binop": null }, - "start": 11697, - "end": 11698, + "start": 11705, + "end": 11706, "loc": { "start": { "line": 321, @@ -48859,8 +48859,8 @@ "postfix": false, "binop": null }, - "start": 11699, - "end": 11700, + "start": 11707, + "end": 11708, "loc": { "start": { "line": 321, @@ -48887,8 +48887,8 @@ "updateContext": null }, "value": "this", - "start": 11709, - "end": 11713, + "start": 11717, + "end": 11721, "loc": { "start": { "line": 322, @@ -48913,8 +48913,8 @@ "binop": null, "updateContext": null }, - "start": 11713, - "end": 11714, + "start": 11721, + "end": 11722, "loc": { "start": { "line": 322, @@ -48939,8 +48939,8 @@ "binop": null }, "value": "_update", - "start": 11714, - "end": 11721, + "start": 11722, + "end": 11729, "loc": { "start": { "line": 322, @@ -48964,8 +48964,8 @@ "postfix": false, "binop": null }, - "start": 11721, - "end": 11722, + "start": 11729, + "end": 11730, "loc": { "start": { "line": 322, @@ -48989,8 +48989,8 @@ "postfix": false, "binop": null }, - "start": 11722, - "end": 11723, + "start": 11730, + "end": 11731, "loc": { "start": { "line": 322, @@ -49015,8 +49015,8 @@ "binop": null, "updateContext": null }, - "start": 11723, - "end": 11724, + "start": 11731, + "end": 11732, "loc": { "start": { "line": 322, @@ -49043,8 +49043,8 @@ "updateContext": null }, "value": "return", - "start": 11733, - "end": 11739, + "start": 11741, + "end": 11747, "loc": { "start": { "line": 323, @@ -49071,8 +49071,8 @@ "updateContext": null }, "value": "this", - "start": 11740, - "end": 11744, + "start": 11748, + "end": 11752, "loc": { "start": { "line": 323, @@ -49097,8 +49097,8 @@ "binop": null, "updateContext": null }, - "start": 11744, - "end": 11745, + "start": 11752, + "end": 11753, "loc": { "start": { "line": 323, @@ -49123,8 +49123,8 @@ "binop": null }, "value": "_viewPos", - "start": 11745, - "end": 11753, + "start": 11753, + "end": 11761, "loc": { "start": { "line": 323, @@ -49149,8 +49149,8 @@ "binop": null, "updateContext": null }, - "start": 11753, - "end": 11754, + "start": 11761, + "end": 11762, "loc": { "start": { "line": 323, @@ -49174,8 +49174,8 @@ "postfix": false, "binop": null }, - "start": 11759, - "end": 11760, + "start": 11767, + "end": 11768, "loc": { "start": { "line": 324, @@ -49190,8 +49190,8 @@ { "type": "CommentBlock", "value": "*\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n ", - "start": 11766, - "end": 12114, + "start": 11774, + "end": 12122, "loc": { "start": { "line": 326, @@ -49216,8 +49216,8 @@ "binop": null }, "value": "get", - "start": 12119, - "end": 12122, + "start": 12127, + "end": 12130, "loc": { "start": { "line": 336, @@ -49242,8 +49242,8 @@ "binop": null }, "value": "canvasPos", - "start": 12123, - "end": 12132, + "start": 12131, + "end": 12140, "loc": { "start": { "line": 336, @@ -49267,8 +49267,8 @@ "postfix": false, "binop": null }, - "start": 12132, - "end": 12133, + "start": 12140, + "end": 12141, "loc": { "start": { "line": 336, @@ -49292,8 +49292,8 @@ "postfix": false, "binop": null }, - "start": 12133, - "end": 12134, + "start": 12141, + "end": 12142, "loc": { "start": { "line": 336, @@ -49317,8 +49317,8 @@ "postfix": false, "binop": null }, - "start": 12135, - "end": 12136, + "start": 12143, + "end": 12144, "loc": { "start": { "line": 336, @@ -49345,8 +49345,8 @@ "updateContext": null }, "value": "this", - "start": 12145, - "end": 12149, + "start": 12153, + "end": 12157, "loc": { "start": { "line": 337, @@ -49371,8 +49371,8 @@ "binop": null, "updateContext": null }, - "start": 12149, - "end": 12150, + "start": 12157, + "end": 12158, "loc": { "start": { "line": 337, @@ -49397,8 +49397,8 @@ "binop": null }, "value": "_update", - "start": 12150, - "end": 12157, + "start": 12158, + "end": 12165, "loc": { "start": { "line": 337, @@ -49422,8 +49422,8 @@ "postfix": false, "binop": null }, - "start": 12157, - "end": 12158, + "start": 12165, + "end": 12166, "loc": { "start": { "line": 337, @@ -49447,8 +49447,8 @@ "postfix": false, "binop": null }, - "start": 12158, - "end": 12159, + "start": 12166, + "end": 12167, "loc": { "start": { "line": 337, @@ -49473,8 +49473,8 @@ "binop": null, "updateContext": null }, - "start": 12159, - "end": 12160, + "start": 12167, + "end": 12168, "loc": { "start": { "line": 337, @@ -49501,8 +49501,8 @@ "updateContext": null }, "value": "return", - "start": 12169, - "end": 12175, + "start": 12177, + "end": 12183, "loc": { "start": { "line": 338, @@ -49529,8 +49529,8 @@ "updateContext": null }, "value": "this", - "start": 12176, - "end": 12180, + "start": 12184, + "end": 12188, "loc": { "start": { "line": 338, @@ -49555,8 +49555,8 @@ "binop": null, "updateContext": null }, - "start": 12180, - "end": 12181, + "start": 12188, + "end": 12189, "loc": { "start": { "line": 338, @@ -49581,8 +49581,8 @@ "binop": null }, "value": "_canvasPos", - "start": 12181, - "end": 12191, + "start": 12189, + "end": 12199, "loc": { "start": { "line": 338, @@ -49607,8 +49607,8 @@ "binop": null, "updateContext": null }, - "start": 12191, - "end": 12192, + "start": 12199, + "end": 12200, "loc": { "start": { "line": 338, @@ -49632,8 +49632,8 @@ "postfix": false, "binop": null }, - "start": 12197, - "end": 12198, + "start": 12205, + "end": 12206, "loc": { "start": { "line": 339, @@ -49648,8 +49648,8 @@ { "type": "CommentBlock", "value": "*\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n ", - "start": 12204, - "end": 12814, + "start": 12212, + "end": 12822, "loc": { "start": { "line": 341, @@ -49674,8 +49674,8 @@ "binop": null }, "value": "get", - "start": 12819, - "end": 12822, + "start": 12827, + "end": 12830, "loc": { "start": { "line": 357, @@ -49700,8 +49700,8 @@ "binop": null }, "value": "visible", - "start": 12823, - "end": 12830, + "start": 12831, + "end": 12838, "loc": { "start": { "line": 357, @@ -49725,8 +49725,8 @@ "postfix": false, "binop": null }, - "start": 12830, - "end": 12831, + "start": 12838, + "end": 12839, "loc": { "start": { "line": 357, @@ -49750,8 +49750,8 @@ "postfix": false, "binop": null }, - "start": 12831, - "end": 12832, + "start": 12839, + "end": 12840, "loc": { "start": { "line": 357, @@ -49775,8 +49775,8 @@ "postfix": false, "binop": null }, - "start": 12833, - "end": 12834, + "start": 12841, + "end": 12842, "loc": { "start": { "line": 357, @@ -49803,8 +49803,8 @@ "updateContext": null }, "value": "return", - "start": 12843, - "end": 12849, + "start": 12851, + "end": 12857, "loc": { "start": { "line": 358, @@ -49830,8 +49830,8 @@ "updateContext": null }, "value": "!", - "start": 12850, - "end": 12851, + "start": 12858, + "end": 12859, "loc": { "start": { "line": 358, @@ -49857,8 +49857,8 @@ "updateContext": null }, "value": "!", - "start": 12851, - "end": 12852, + "start": 12859, + "end": 12860, "loc": { "start": { "line": 358, @@ -49885,8 +49885,8 @@ "updateContext": null }, "value": "this", - "start": 12852, - "end": 12856, + "start": 12860, + "end": 12864, "loc": { "start": { "line": 358, @@ -49911,8 +49911,8 @@ "binop": null, "updateContext": null }, - "start": 12856, - "end": 12857, + "start": 12864, + "end": 12865, "loc": { "start": { "line": 358, @@ -49937,8 +49937,8 @@ "binop": null }, "value": "_visible", - "start": 12857, - "end": 12865, + "start": 12865, + "end": 12873, "loc": { "start": { "line": 358, @@ -49963,8 +49963,8 @@ "binop": null, "updateContext": null }, - "start": 12865, - "end": 12866, + "start": 12873, + "end": 12874, "loc": { "start": { "line": 358, @@ -49988,8 +49988,8 @@ "postfix": false, "binop": null }, - "start": 12871, - "end": 12872, + "start": 12879, + "end": 12880, "loc": { "start": { "line": 359, @@ -50004,8 +50004,8 @@ { "type": "CommentBlock", "value": "*\n * Destroys this Marker.\n ", - "start": 12878, - "end": 12918, + "start": 12886, + "end": 12926, "loc": { "start": { "line": 361, @@ -50030,8 +50030,8 @@ "binop": null }, "value": "destroy", - "start": 12923, - "end": 12930, + "start": 12931, + "end": 12938, "loc": { "start": { "line": 364, @@ -50055,8 +50055,8 @@ "postfix": false, "binop": null }, - "start": 12930, - "end": 12931, + "start": 12938, + "end": 12939, "loc": { "start": { "line": 364, @@ -50080,8 +50080,8 @@ "postfix": false, "binop": null }, - "start": 12931, - "end": 12932, + "start": 12939, + "end": 12940, "loc": { "start": { "line": 364, @@ -50105,8 +50105,8 @@ "postfix": false, "binop": null }, - "start": 12933, - "end": 12934, + "start": 12941, + "end": 12942, "loc": { "start": { "line": 364, @@ -50133,8 +50133,8 @@ "updateContext": null }, "value": "this", - "start": 12943, - "end": 12947, + "start": 12951, + "end": 12955, "loc": { "start": { "line": 365, @@ -50159,8 +50159,8 @@ "binop": null, "updateContext": null }, - "start": 12947, - "end": 12948, + "start": 12955, + "end": 12956, "loc": { "start": { "line": 365, @@ -50185,8 +50185,8 @@ "binop": null }, "value": "fire", - "start": 12948, - "end": 12952, + "start": 12956, + "end": 12960, "loc": { "start": { "line": 365, @@ -50210,8 +50210,8 @@ "postfix": false, "binop": null }, - "start": 12952, - "end": 12953, + "start": 12960, + "end": 12961, "loc": { "start": { "line": 365, @@ -50237,8 +50237,8 @@ "updateContext": null }, "value": "destroyed", - "start": 12953, - "end": 12964, + "start": 12961, + "end": 12972, "loc": { "start": { "line": 365, @@ -50263,8 +50263,8 @@ "binop": null, "updateContext": null }, - "start": 12964, - "end": 12965, + "start": 12972, + "end": 12973, "loc": { "start": { "line": 365, @@ -50291,8 +50291,8 @@ "updateContext": null }, "value": "true", - "start": 12966, - "end": 12970, + "start": 12974, + "end": 12978, "loc": { "start": { "line": 365, @@ -50316,8 +50316,8 @@ "postfix": false, "binop": null }, - "start": 12970, - "end": 12971, + "start": 12978, + "end": 12979, "loc": { "start": { "line": 365, @@ -50342,8 +50342,8 @@ "binop": null, "updateContext": null }, - "start": 12971, - "end": 12972, + "start": 12979, + "end": 12980, "loc": { "start": { "line": 365, @@ -50370,8 +50370,8 @@ "updateContext": null }, "value": "this", - "start": 12981, - "end": 12985, + "start": 12989, + "end": 12993, "loc": { "start": { "line": 366, @@ -50396,8 +50396,8 @@ "binop": null, "updateContext": null }, - "start": 12985, - "end": 12986, + "start": 12993, + "end": 12994, "loc": { "start": { "line": 366, @@ -50422,8 +50422,8 @@ "binop": null }, "value": "scene", - "start": 12986, - "end": 12991, + "start": 12994, + "end": 12999, "loc": { "start": { "line": 366, @@ -50448,8 +50448,8 @@ "binop": null, "updateContext": null }, - "start": 12991, - "end": 12992, + "start": 12999, + "end": 13000, "loc": { "start": { "line": 366, @@ -50474,8 +50474,8 @@ "binop": null }, "value": "camera", - "start": 12992, - "end": 12998, + "start": 13000, + "end": 13006, "loc": { "start": { "line": 366, @@ -50500,8 +50500,8 @@ "binop": null, "updateContext": null }, - "start": 12998, - "end": 12999, + "start": 13006, + "end": 13007, "loc": { "start": { "line": 366, @@ -50526,8 +50526,8 @@ "binop": null }, "value": "off", - "start": 12999, - "end": 13002, + "start": 13007, + "end": 13010, "loc": { "start": { "line": 366, @@ -50551,8 +50551,8 @@ "postfix": false, "binop": null }, - "start": 13002, - "end": 13003, + "start": 13010, + "end": 13011, "loc": { "start": { "line": 366, @@ -50579,8 +50579,8 @@ "updateContext": null }, "value": "this", - "start": 13003, - "end": 13007, + "start": 13011, + "end": 13015, "loc": { "start": { "line": 366, @@ -50605,8 +50605,8 @@ "binop": null, "updateContext": null }, - "start": 13007, - "end": 13008, + "start": 13015, + "end": 13016, "loc": { "start": { "line": 366, @@ -50631,8 +50631,8 @@ "binop": null }, "value": "_onCameraViewMatrix", - "start": 13008, - "end": 13027, + "start": 13016, + "end": 13035, "loc": { "start": { "line": 366, @@ -50656,8 +50656,8 @@ "postfix": false, "binop": null }, - "start": 13027, - "end": 13028, + "start": 13035, + "end": 13036, "loc": { "start": { "line": 366, @@ -50682,8 +50682,8 @@ "binop": null, "updateContext": null }, - "start": 13028, - "end": 13029, + "start": 13036, + "end": 13037, "loc": { "start": { "line": 366, @@ -50710,8 +50710,8 @@ "updateContext": null }, "value": "this", - "start": 13038, - "end": 13042, + "start": 13046, + "end": 13050, "loc": { "start": { "line": 367, @@ -50736,8 +50736,8 @@ "binop": null, "updateContext": null }, - "start": 13042, - "end": 13043, + "start": 13050, + "end": 13051, "loc": { "start": { "line": 367, @@ -50762,8 +50762,8 @@ "binop": null }, "value": "scene", - "start": 13043, - "end": 13048, + "start": 13051, + "end": 13056, "loc": { "start": { "line": 367, @@ -50788,8 +50788,8 @@ "binop": null, "updateContext": null }, - "start": 13048, - "end": 13049, + "start": 13056, + "end": 13057, "loc": { "start": { "line": 367, @@ -50814,8 +50814,8 @@ "binop": null }, "value": "camera", - "start": 13049, - "end": 13055, + "start": 13057, + "end": 13063, "loc": { "start": { "line": 367, @@ -50840,8 +50840,8 @@ "binop": null, "updateContext": null }, - "start": 13055, - "end": 13056, + "start": 13063, + "end": 13064, "loc": { "start": { "line": 367, @@ -50866,8 +50866,8 @@ "binop": null }, "value": "off", - "start": 13056, - "end": 13059, + "start": 13064, + "end": 13067, "loc": { "start": { "line": 367, @@ -50891,8 +50891,8 @@ "postfix": false, "binop": null }, - "start": 13059, - "end": 13060, + "start": 13067, + "end": 13068, "loc": { "start": { "line": 367, @@ -50919,8 +50919,8 @@ "updateContext": null }, "value": "this", - "start": 13060, - "end": 13064, + "start": 13068, + "end": 13072, "loc": { "start": { "line": 367, @@ -50945,8 +50945,8 @@ "binop": null, "updateContext": null }, - "start": 13064, - "end": 13065, + "start": 13072, + "end": 13073, "loc": { "start": { "line": 367, @@ -50971,8 +50971,8 @@ "binop": null }, "value": "_onCameraProjMatrix", - "start": 13065, - "end": 13084, + "start": 13073, + "end": 13092, "loc": { "start": { "line": 367, @@ -50996,8 +50996,8 @@ "postfix": false, "binop": null }, - "start": 13084, - "end": 13085, + "start": 13092, + "end": 13093, "loc": { "start": { "line": 367, @@ -51022,8 +51022,8 @@ "binop": null, "updateContext": null }, - "start": 13085, - "end": 13086, + "start": 13093, + "end": 13094, "loc": { "start": { "line": 367, @@ -51050,8 +51050,8 @@ "updateContext": null }, "value": "if", - "start": 13095, - "end": 13097, + "start": 13103, + "end": 13105, "loc": { "start": { "line": 368, @@ -51075,8 +51075,8 @@ "postfix": false, "binop": null }, - "start": 13098, - "end": 13099, + "start": 13106, + "end": 13107, "loc": { "start": { "line": 368, @@ -51103,8 +51103,8 @@ "updateContext": null }, "value": "this", - "start": 13099, - "end": 13103, + "start": 13107, + "end": 13111, "loc": { "start": { "line": 368, @@ -51129,8 +51129,8 @@ "binop": null, "updateContext": null }, - "start": 13103, - "end": 13104, + "start": 13111, + "end": 13112, "loc": { "start": { "line": 368, @@ -51155,8 +51155,8 @@ "binop": null }, "value": "_entity", - "start": 13104, - "end": 13111, + "start": 13112, + "end": 13119, "loc": { "start": { "line": 368, @@ -51180,8 +51180,8 @@ "postfix": false, "binop": null }, - "start": 13111, - "end": 13112, + "start": 13119, + "end": 13120, "loc": { "start": { "line": 368, @@ -51205,8 +51205,8 @@ "postfix": false, "binop": null }, - "start": 13113, - "end": 13114, + "start": 13121, + "end": 13122, "loc": { "start": { "line": 368, @@ -51233,8 +51233,8 @@ "updateContext": null }, "value": "if", - "start": 13127, - "end": 13129, + "start": 13135, + "end": 13137, "loc": { "start": { "line": 369, @@ -51258,8 +51258,8 @@ "postfix": false, "binop": null }, - "start": 13130, - "end": 13131, + "start": 13138, + "end": 13139, "loc": { "start": { "line": 369, @@ -51286,8 +51286,8 @@ "updateContext": null }, "value": "this", - "start": 13131, - "end": 13135, + "start": 13139, + "end": 13143, "loc": { "start": { "line": 369, @@ -51312,8 +51312,8 @@ "binop": null, "updateContext": null }, - "start": 13135, - "end": 13136, + "start": 13143, + "end": 13144, "loc": { "start": { "line": 369, @@ -51338,8 +51338,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 13136, - "end": 13154, + "start": 13144, + "end": 13162, "loc": { "start": { "line": 369, @@ -51365,8 +51365,8 @@ "updateContext": null }, "value": "!==", - "start": 13155, - "end": 13158, + "start": 13163, + "end": 13166, "loc": { "start": { "line": 369, @@ -51393,8 +51393,8 @@ "updateContext": null }, "value": "null", - "start": 13159, - "end": 13163, + "start": 13167, + "end": 13171, "loc": { "start": { "line": 369, @@ -51418,8 +51418,8 @@ "postfix": false, "binop": null }, - "start": 13163, - "end": 13164, + "start": 13171, + "end": 13172, "loc": { "start": { "line": 369, @@ -51443,8 +51443,8 @@ "postfix": false, "binop": null }, - "start": 13165, - "end": 13166, + "start": 13173, + "end": 13174, "loc": { "start": { "line": 369, @@ -51471,8 +51471,8 @@ "updateContext": null }, "value": "this", - "start": 13183, - "end": 13187, + "start": 13191, + "end": 13195, "loc": { "start": { "line": 370, @@ -51497,8 +51497,8 @@ "binop": null, "updateContext": null }, - "start": 13187, - "end": 13188, + "start": 13195, + "end": 13196, "loc": { "start": { "line": 370, @@ -51523,8 +51523,8 @@ "binop": null }, "value": "_entity", - "start": 13188, - "end": 13195, + "start": 13196, + "end": 13203, "loc": { "start": { "line": 370, @@ -51549,8 +51549,8 @@ "binop": null, "updateContext": null }, - "start": 13195, - "end": 13196, + "start": 13203, + "end": 13204, "loc": { "start": { "line": 370, @@ -51575,8 +51575,8 @@ "binop": null }, "value": "off", - "start": 13196, - "end": 13199, + "start": 13204, + "end": 13207, "loc": { "start": { "line": 370, @@ -51600,8 +51600,8 @@ "postfix": false, "binop": null }, - "start": 13199, - "end": 13200, + "start": 13207, + "end": 13208, "loc": { "start": { "line": 370, @@ -51628,8 +51628,8 @@ "updateContext": null }, "value": "this", - "start": 13200, - "end": 13204, + "start": 13208, + "end": 13212, "loc": { "start": { "line": 370, @@ -51654,8 +51654,8 @@ "binop": null, "updateContext": null }, - "start": 13204, - "end": 13205, + "start": 13212, + "end": 13213, "loc": { "start": { "line": 370, @@ -51680,8 +51680,8 @@ "binop": null }, "value": "_onEntityDestroyed", - "start": 13205, - "end": 13223, + "start": 13213, + "end": 13231, "loc": { "start": { "line": 370, @@ -51705,8 +51705,8 @@ "postfix": false, "binop": null }, - "start": 13223, - "end": 13224, + "start": 13231, + "end": 13232, "loc": { "start": { "line": 370, @@ -51731,8 +51731,8 @@ "binop": null, "updateContext": null }, - "start": 13224, - "end": 13225, + "start": 13232, + "end": 13233, "loc": { "start": { "line": 370, @@ -51756,8 +51756,8 @@ "postfix": false, "binop": null }, - "start": 13238, - "end": 13239, + "start": 13246, + "end": 13247, "loc": { "start": { "line": 371, @@ -51784,8 +51784,8 @@ "updateContext": null }, "value": "if", - "start": 13252, - "end": 13254, + "start": 13260, + "end": 13262, "loc": { "start": { "line": 372, @@ -51809,8 +51809,8 @@ "postfix": false, "binop": null }, - "start": 13255, - "end": 13256, + "start": 13263, + "end": 13264, "loc": { "start": { "line": 372, @@ -51837,8 +51837,8 @@ "updateContext": null }, "value": "this", - "start": 13256, - "end": 13260, + "start": 13264, + "end": 13268, "loc": { "start": { "line": 372, @@ -51863,8 +51863,8 @@ "binop": null, "updateContext": null }, - "start": 13260, - "end": 13261, + "start": 13268, + "end": 13269, "loc": { "start": { "line": 372, @@ -51889,8 +51889,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 13261, - "end": 13284, + "start": 13269, + "end": 13292, "loc": { "start": { "line": 372, @@ -51916,8 +51916,8 @@ "updateContext": null }, "value": "!==", - "start": 13285, - "end": 13288, + "start": 13293, + "end": 13296, "loc": { "start": { "line": 372, @@ -51944,8 +51944,8 @@ "updateContext": null }, "value": "null", - "start": 13289, - "end": 13293, + "start": 13297, + "end": 13301, "loc": { "start": { "line": 372, @@ -51969,8 +51969,8 @@ "postfix": false, "binop": null }, - "start": 13293, - "end": 13294, + "start": 13301, + "end": 13302, "loc": { "start": { "line": 372, @@ -51994,8 +51994,8 @@ "postfix": false, "binop": null }, - "start": 13295, - "end": 13296, + "start": 13303, + "end": 13304, "loc": { "start": { "line": 372, @@ -52022,8 +52022,8 @@ "updateContext": null }, "value": "this", - "start": 13313, - "end": 13317, + "start": 13321, + "end": 13325, "loc": { "start": { "line": 373, @@ -52048,8 +52048,8 @@ "binop": null, "updateContext": null }, - "start": 13317, - "end": 13318, + "start": 13325, + "end": 13326, "loc": { "start": { "line": 373, @@ -52074,8 +52074,8 @@ "binop": null }, "value": "_entity", - "start": 13318, - "end": 13325, + "start": 13326, + "end": 13333, "loc": { "start": { "line": 373, @@ -52100,8 +52100,8 @@ "binop": null, "updateContext": null }, - "start": 13325, - "end": 13326, + "start": 13333, + "end": 13334, "loc": { "start": { "line": 373, @@ -52126,8 +52126,8 @@ "binop": null }, "value": "model", - "start": 13326, - "end": 13331, + "start": 13334, + "end": 13339, "loc": { "start": { "line": 373, @@ -52152,8 +52152,8 @@ "binop": null, "updateContext": null }, - "start": 13331, - "end": 13332, + "start": 13339, + "end": 13340, "loc": { "start": { "line": 373, @@ -52178,8 +52178,8 @@ "binop": null }, "value": "off", - "start": 13332, - "end": 13335, + "start": 13340, + "end": 13343, "loc": { "start": { "line": 373, @@ -52203,8 +52203,8 @@ "postfix": false, "binop": null }, - "start": 13335, - "end": 13336, + "start": 13343, + "end": 13344, "loc": { "start": { "line": 373, @@ -52231,8 +52231,8 @@ "updateContext": null }, "value": "this", - "start": 13336, - "end": 13340, + "start": 13344, + "end": 13348, "loc": { "start": { "line": 373, @@ -52257,8 +52257,8 @@ "binop": null, "updateContext": null }, - "start": 13340, - "end": 13341, + "start": 13348, + "end": 13349, "loc": { "start": { "line": 373, @@ -52283,8 +52283,8 @@ "binop": null }, "value": "_onEntityModelDestroyed", - "start": 13341, - "end": 13364, + "start": 13349, + "end": 13372, "loc": { "start": { "line": 373, @@ -52308,8 +52308,8 @@ "postfix": false, "binop": null }, - "start": 13364, - "end": 13365, + "start": 13372, + "end": 13373, "loc": { "start": { "line": 373, @@ -52334,8 +52334,8 @@ "binop": null, "updateContext": null }, - "start": 13365, - "end": 13366, + "start": 13373, + "end": 13374, "loc": { "start": { "line": 373, @@ -52359,8 +52359,8 @@ "postfix": false, "binop": null }, - "start": 13379, - "end": 13380, + "start": 13387, + "end": 13388, "loc": { "start": { "line": 374, @@ -52384,8 +52384,8 @@ "postfix": false, "binop": null }, - "start": 13389, - "end": 13390, + "start": 13397, + "end": 13398, "loc": { "start": { "line": 375, @@ -52412,8 +52412,8 @@ "updateContext": null }, "value": "this", - "start": 13399, - "end": 13403, + "start": 13407, + "end": 13411, "loc": { "start": { "line": 376, @@ -52438,8 +52438,8 @@ "binop": null, "updateContext": null }, - "start": 13403, - "end": 13404, + "start": 13411, + "end": 13412, "loc": { "start": { "line": 376, @@ -52464,8 +52464,8 @@ "binop": null }, "value": "_renderer", - "start": 13404, - "end": 13413, + "start": 13412, + "end": 13421, "loc": { "start": { "line": 376, @@ -52490,8 +52490,8 @@ "binop": null, "updateContext": null }, - "start": 13413, - "end": 13414, + "start": 13421, + "end": 13422, "loc": { "start": { "line": 376, @@ -52516,8 +52516,8 @@ "binop": null }, "value": "removeMarker", - "start": 13414, - "end": 13426, + "start": 13422, + "end": 13434, "loc": { "start": { "line": 376, @@ -52541,8 +52541,8 @@ "postfix": false, "binop": null }, - "start": 13426, - "end": 13427, + "start": 13434, + "end": 13435, "loc": { "start": { "line": 376, @@ -52569,8 +52569,8 @@ "updateContext": null }, "value": "this", - "start": 13427, - "end": 13431, + "start": 13435, + "end": 13439, "loc": { "start": { "line": 376, @@ -52594,8 +52594,8 @@ "postfix": false, "binop": null }, - "start": 13431, - "end": 13432, + "start": 13439, + "end": 13440, "loc": { "start": { "line": 376, @@ -52620,8 +52620,8 @@ "binop": null, "updateContext": null }, - "start": 13432, - "end": 13433, + "start": 13440, + "end": 13441, "loc": { "start": { "line": 376, @@ -52648,8 +52648,8 @@ "updateContext": null }, "value": "super", - "start": 13442, - "end": 13447, + "start": 13450, + "end": 13455, "loc": { "start": { "line": 377, @@ -52674,8 +52674,8 @@ "binop": null, "updateContext": null }, - "start": 13447, - "end": 13448, + "start": 13455, + "end": 13456, "loc": { "start": { "line": 377, @@ -52700,8 +52700,8 @@ "binop": null }, "value": "destroy", - "start": 13448, - "end": 13455, + "start": 13456, + "end": 13463, "loc": { "start": { "line": 377, @@ -52725,8 +52725,8 @@ "postfix": false, "binop": null }, - "start": 13455, - "end": 13456, + "start": 13463, + "end": 13464, "loc": { "start": { "line": 377, @@ -52750,8 +52750,8 @@ "postfix": false, "binop": null }, - "start": 13456, - "end": 13457, + "start": 13464, + "end": 13465, "loc": { "start": { "line": 377, @@ -52776,8 +52776,8 @@ "binop": null, "updateContext": null }, - "start": 13457, - "end": 13458, + "start": 13465, + "end": 13466, "loc": { "start": { "line": 377, @@ -52801,8 +52801,8 @@ "postfix": false, "binop": null }, - "start": 13463, - "end": 13464, + "start": 13471, + "end": 13472, "loc": { "start": { "line": 378, @@ -52826,8 +52826,8 @@ "postfix": false, "binop": null }, - "start": 13465, - "end": 13466, + "start": 13473, + "end": 13474, "loc": { "start": { "line": 379, @@ -52854,8 +52854,8 @@ "updateContext": null }, "value": "export", - "start": 13468, - "end": 13474, + "start": 13476, + "end": 13482, "loc": { "start": { "line": 381, @@ -52879,8 +52879,8 @@ "postfix": false, "binop": null }, - "start": 13475, - "end": 13476, + "start": 13483, + "end": 13484, "loc": { "start": { "line": 381, @@ -52905,8 +52905,8 @@ "binop": null }, "value": "Marker", - "start": 13476, - "end": 13482, + "start": 13484, + "end": 13490, "loc": { "start": { "line": 381, @@ -52930,8 +52930,8 @@ "postfix": false, "binop": null }, - "start": 13482, - "end": 13483, + "start": 13490, + "end": 13491, "loc": { "start": { "line": 381, @@ -52956,8 +52956,8 @@ "binop": null, "updateContext": null }, - "start": 13483, - "end": 13484, + "start": 13491, + "end": 13492, "loc": { "start": { "line": 381, @@ -52982,8 +52982,8 @@ "binop": null, "updateContext": null }, - "start": 13485, - "end": 13485, + "start": 13493, + "end": 13493, "loc": { "start": { "line": 382, diff --git a/docs/ast/source/viewer/scene/model/SceneModelTransform.js.json b/docs/ast/source/viewer/scene/model/SceneModelTransform.js.json index 49cf7089ae..90e1ae9529 100644 --- a/docs/ast/source/viewer/scene/model/SceneModelTransform.js.json +++ b/docs/ast/source/viewer/scene/model/SceneModelTransform.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 11462, + "end": 11474, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 11462, + "end": 11474, "loc": { "start": { "line": 1, @@ -1476,7 +1476,7 @@ { "type": "ExportNamedDeclaration", "start": 646, - "end": 11461, + "end": 11473, "loc": { "start": { "line": 24, @@ -1492,7 +1492,7 @@ "declaration": { "type": "ClassDeclaration", "start": 653, - "end": 11461, + "end": 11473, "loc": { "start": { "line": 24, @@ -1525,7 +1525,7 @@ "body": { "type": "ClassBody", "start": 679, - "end": 11461, + "end": 11473, "loc": { "start": { "line": 24, @@ -4428,7 +4428,7 @@ { "type": "ClassMethod", "start": 1900, - "end": 2124, + "end": 2136, "loc": { "start": { "line": 66, @@ -4485,7 +4485,7 @@ "body": { "type": "BlockStatement", "start": 1935, - "end": 2124, + "end": 2136, "loc": { "start": { "line": 66, @@ -4807,7 +4807,7 @@ { "type": "ExpressionStatement", "start": 2087, - "end": 2118, + "end": 2130, "loc": { "start": { "line": 70, @@ -4815,13 +4815,13 @@ }, "end": { "line": 70, - "column": 39 + "column": 51 } }, "expression": { "type": "CallExpression", "start": 2087, - "end": 2117, + "end": 2129, "loc": { "start": { "line": 70, @@ -4829,13 +4829,13 @@ }, "end": { "line": 70, - "column": 38 + "column": 50 } }, "callee": { "type": "MemberExpression", "start": 2087, - "end": 2115, + "end": 2123, "loc": { "start": { "line": 70, @@ -4843,7 +4843,7 @@ }, "end": { "line": 70, - "column": 36 + "column": 44 } }, "object": { @@ -4866,7 +4866,7 @@ "property": { "type": "Identifier", "start": 2102, - "end": 2115, + "end": 2123, "loc": { "start": { "line": 70, @@ -4874,15 +4874,31 @@ }, "end": { "line": 70, - "column": 36 + "column": 44 }, - "identifierName": "_setAABBDirty" + "identifierName": "_setSubtreeAABBsDirty" }, - "name": "_setAABBDirty" + "name": "_setSubtreeAABBsDirty" }, "computed": false }, - "arguments": [] + "arguments": [ + { + "type": "ThisExpression", + "start": 2124, + "end": 2128, + "loc": { + "start": { + "line": 70, + "column": 45 + }, + "end": { + "line": 70, + "column": 49 + } + } + } + ] } } ], @@ -4891,8 +4907,8 @@ }, { "type": "ClassMethod", - "start": 2130, - "end": 2309, + "start": 2142, + "end": 2321, "loc": { "start": { "line": 73, @@ -4907,8 +4923,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 2130, - "end": 2138, + "start": 2142, + "end": 2150, "loc": { "start": { "line": 73, @@ -4930,8 +4946,8 @@ "params": [ { "type": "Identifier", - "start": 2139, - "end": 2143, + "start": 2151, + "end": 2155, "loc": { "start": { "line": 73, @@ -4948,8 +4964,8 @@ ], "body": { "type": "BlockStatement", - "start": 2145, - "end": 2309, + "start": 2157, + "end": 2321, "loc": { "start": { "line": 73, @@ -4963,8 +4979,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 2155, - "end": 2179, + "start": 2167, + "end": 2191, "loc": { "start": { "line": 74, @@ -4977,8 +4993,8 @@ }, "expression": { "type": "CallExpression", - "start": 2155, - "end": 2178, + "start": 2167, + "end": 2190, "loc": { "start": { "line": 74, @@ -4991,8 +5007,8 @@ }, "callee": { "type": "MemberExpression", - "start": 2155, - "end": 2172, + "start": 2167, + "end": 2184, "loc": { "start": { "line": 74, @@ -5005,8 +5021,8 @@ }, "object": { "type": "MemberExpression", - "start": 2155, - "end": 2167, + "start": 2167, + "end": 2179, "loc": { "start": { "line": 74, @@ -5019,8 +5035,8 @@ }, "object": { "type": "ThisExpression", - "start": 2155, - "end": 2159, + "start": 2167, + "end": 2171, "loc": { "start": { "line": 74, @@ -5034,8 +5050,8 @@ }, "property": { "type": "Identifier", - "start": 2160, - "end": 2167, + "start": 2172, + "end": 2179, "loc": { "start": { "line": 74, @@ -5053,8 +5069,8 @@ }, "property": { "type": "Identifier", - "start": 2168, - "end": 2172, + "start": 2180, + "end": 2184, "loc": { "start": { "line": 74, @@ -5073,8 +5089,8 @@ "arguments": [ { "type": "Identifier", - "start": 2173, - "end": 2177, + "start": 2185, + "end": 2189, "loc": { "start": { "line": 74, @@ -5093,8 +5109,8 @@ }, { "type": "ExpressionStatement", - "start": 2188, - "end": 2210, + "start": 2200, + "end": 2222, "loc": { "start": { "line": 75, @@ -5107,8 +5123,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 2188, - "end": 2209, + "start": 2200, + "end": 2221, "loc": { "start": { "line": 75, @@ -5122,8 +5138,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 2188, - "end": 2202, + "start": 2200, + "end": 2214, "loc": { "start": { "line": 75, @@ -5136,8 +5152,8 @@ }, "object": { "type": "Identifier", - "start": 2188, - "end": 2192, + "start": 2200, + "end": 2204, "loc": { "start": { "line": 75, @@ -5153,8 +5169,8 @@ }, "property": { "type": "Identifier", - "start": 2193, - "end": 2202, + "start": 2205, + "end": 2214, "loc": { "start": { "line": 75, @@ -5172,8 +5188,8 @@ }, "right": { "type": "ThisExpression", - "start": 2205, - "end": 2209, + "start": 2217, + "end": 2221, "loc": { "start": { "line": 75, @@ -5190,8 +5206,8 @@ { "type": "CommentLine", "value": " childTransform._setWorldMatrixDirty();", - "start": 2219, - "end": 2260, + "start": 2231, + "end": 2272, "loc": { "start": { "line": 76, @@ -5206,8 +5222,8 @@ { "type": "CommentLine", "value": " childTransform._setAABBDirty();", - "start": 2269, - "end": 2303, + "start": 2281, + "end": 2315, "loc": { "start": { "line": 77, @@ -5229,8 +5245,8 @@ { "type": "CommentBlock", "value": "*\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n ", - "start": 2315, - "end": 2416, + "start": 2327, + "end": 2428, "loc": { "start": { "line": 80, @@ -5246,8 +5262,8 @@ }, { "type": "ClassMethod", - "start": 2421, - "end": 2488, + "start": 2433, + "end": 2500, "loc": { "start": { "line": 85, @@ -5262,8 +5278,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 2425, - "end": 2440, + "start": 2437, + "end": 2452, "loc": { "start": { "line": 85, @@ -5285,8 +5301,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 2443, - "end": 2488, + "start": 2455, + "end": 2500, "loc": { "start": { "line": 85, @@ -5300,8 +5316,8 @@ "body": [ { "type": "ReturnStatement", - "start": 2453, - "end": 2482, + "start": 2465, + "end": 2494, "loc": { "start": { "line": 86, @@ -5314,8 +5330,8 @@ }, "argument": { "type": "MemberExpression", - "start": 2460, - "end": 2481, + "start": 2472, + "end": 2493, "loc": { "start": { "line": 86, @@ -5328,8 +5344,8 @@ }, "object": { "type": "ThisExpression", - "start": 2460, - "end": 2464, + "start": 2472, + "end": 2476, "loc": { "start": { "line": 86, @@ -5343,8 +5359,8 @@ }, "property": { "type": "Identifier", - "start": 2465, - "end": 2481, + "start": 2477, + "end": 2493, "loc": { "start": { "line": 86, @@ -5369,8 +5385,8 @@ { "type": "CommentBlock", "value": "*\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n ", - "start": 2315, - "end": 2416, + "start": 2327, + "end": 2428, "loc": { "start": { "line": 80, @@ -5387,8 +5403,8 @@ { "type": "CommentBlock", "value": "*\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n ", - "start": 2494, - "end": 2610, + "start": 2506, + "end": 2622, "loc": { "start": { "line": 89, @@ -5404,8 +5420,8 @@ }, { "type": "ClassMethod", - "start": 2615, - "end": 2664, + "start": 2627, + "end": 2676, "loc": { "start": { "line": 94, @@ -5420,8 +5436,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 2619, - "end": 2625, + "start": 2631, + "end": 2637, "loc": { "start": { "line": 94, @@ -5443,8 +5459,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 2628, - "end": 2664, + "start": 2640, + "end": 2676, "loc": { "start": { "line": 94, @@ -5458,8 +5474,8 @@ "body": [ { "type": "ReturnStatement", - "start": 2638, - "end": 2658, + "start": 2650, + "end": 2670, "loc": { "start": { "line": 95, @@ -5472,8 +5488,8 @@ }, "argument": { "type": "MemberExpression", - "start": 2645, - "end": 2657, + "start": 2657, + "end": 2669, "loc": { "start": { "line": 95, @@ -5486,8 +5502,8 @@ }, "object": { "type": "ThisExpression", - "start": 2645, - "end": 2649, + "start": 2657, + "end": 2661, "loc": { "start": { "line": 95, @@ -5501,8 +5517,8 @@ }, "property": { "type": "Identifier", - "start": 2650, - "end": 2657, + "start": 2662, + "end": 2669, "loc": { "start": { "line": 95, @@ -5527,8 +5543,8 @@ { "type": "CommentBlock", "value": "*\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n ", - "start": 2494, - "end": 2610, + "start": 2506, + "end": 2622, "loc": { "start": { "line": 89, @@ -5545,8 +5561,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2670, - "end": 2817, + "start": 2682, + "end": 2829, "loc": { "start": { "line": 98, @@ -5562,8 +5578,8 @@ }, { "type": "ClassMethod", - "start": 2822, - "end": 2966, + "start": 2834, + "end": 2978, "loc": { "start": { "line": 105, @@ -5578,8 +5594,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 2826, - "end": 2834, + "start": 2838, + "end": 2846, "loc": { "start": { "line": 105, @@ -5601,8 +5617,8 @@ "params": [ { "type": "Identifier", - "start": 2835, - "end": 2840, + "start": 2847, + "end": 2852, "loc": { "start": { "line": 105, @@ -5619,8 +5635,8 @@ ], "body": { "type": "BlockStatement", - "start": 2842, - "end": 2966, + "start": 2854, + "end": 2978, "loc": { "start": { "line": 105, @@ -5634,8 +5650,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 2852, - "end": 2891, + "start": 2864, + "end": 2903, "loc": { "start": { "line": 106, @@ -5648,8 +5664,8 @@ }, "expression": { "type": "CallExpression", - "start": 2852, - "end": 2890, + "start": 2864, + "end": 2902, "loc": { "start": { "line": 106, @@ -5662,8 +5678,8 @@ }, "callee": { "type": "MemberExpression", - "start": 2852, - "end": 2870, + "start": 2864, + "end": 2882, "loc": { "start": { "line": 106, @@ -5676,8 +5692,8 @@ }, "object": { "type": "MemberExpression", - "start": 2852, - "end": 2866, + "start": 2864, + "end": 2878, "loc": { "start": { "line": 106, @@ -5690,8 +5706,8 @@ }, "object": { "type": "ThisExpression", - "start": 2852, - "end": 2856, + "start": 2864, + "end": 2868, "loc": { "start": { "line": 106, @@ -5705,8 +5721,8 @@ }, "property": { "type": "Identifier", - "start": 2857, - "end": 2866, + "start": 2869, + "end": 2878, "loc": { "start": { "line": 106, @@ -5724,8 +5740,8 @@ }, "property": { "type": "Identifier", - "start": 2867, - "end": 2870, + "start": 2879, + "end": 2882, "loc": { "start": { "line": 106, @@ -5744,8 +5760,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 2871, - "end": 2889, + "start": 2883, + "end": 2901, "loc": { "start": { "line": 106, @@ -5758,8 +5774,8 @@ }, "left": { "type": "Identifier", - "start": 2871, - "end": 2876, + "start": 2883, + "end": 2888, "loc": { "start": { "line": 106, @@ -5776,8 +5792,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 2880, - "end": 2889, + "start": 2892, + "end": 2901, "loc": { "start": { "line": 106, @@ -5791,8 +5807,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 2881, - "end": 2882, + "start": 2893, + "end": 2894, "loc": { "start": { "line": 106, @@ -5811,8 +5827,8 @@ }, { "type": "NumericLiteral", - "start": 2884, - "end": 2885, + "start": 2896, + "end": 2897, "loc": { "start": { "line": 106, @@ -5831,8 +5847,8 @@ }, { "type": "NumericLiteral", - "start": 2887, - "end": 2888, + "start": 2899, + "end": 2900, "loc": { "start": { "line": 106, @@ -5857,8 +5873,8 @@ }, { "type": "ExpressionStatement", - "start": 2900, - "end": 2928, + "start": 2912, + "end": 2940, "loc": { "start": { "line": 107, @@ -5871,8 +5887,8 @@ }, "expression": { "type": "CallExpression", - "start": 2900, - "end": 2927, + "start": 2912, + "end": 2939, "loc": { "start": { "line": 107, @@ -5885,8 +5901,8 @@ }, "callee": { "type": "MemberExpression", - "start": 2900, - "end": 2925, + "start": 2912, + "end": 2937, "loc": { "start": { "line": 107, @@ -5899,8 +5915,8 @@ }, "object": { "type": "ThisExpression", - "start": 2900, - "end": 2904, + "start": 2912, + "end": 2916, "loc": { "start": { "line": 107, @@ -5914,8 +5930,8 @@ }, "property": { "type": "Identifier", - "start": 2905, - "end": 2925, + "start": 2917, + "end": 2937, "loc": { "start": { "line": 107, @@ -5936,8 +5952,8 @@ }, { "type": "ExpressionStatement", - "start": 2937, - "end": 2960, + "start": 2949, + "end": 2972, "loc": { "start": { "line": 108, @@ -5950,8 +5966,8 @@ }, "expression": { "type": "CallExpression", - "start": 2937, - "end": 2959, + "start": 2949, + "end": 2971, "loc": { "start": { "line": 108, @@ -5964,8 +5980,8 @@ }, "callee": { "type": "MemberExpression", - "start": 2937, - "end": 2957, + "start": 2949, + "end": 2969, "loc": { "start": { "line": 108, @@ -5978,8 +5994,8 @@ }, "object": { "type": "MemberExpression", - "start": 2937, - "end": 2948, + "start": 2949, + "end": 2960, "loc": { "start": { "line": 108, @@ -5992,8 +6008,8 @@ }, "object": { "type": "ThisExpression", - "start": 2937, - "end": 2941, + "start": 2949, + "end": 2953, "loc": { "start": { "line": 108, @@ -6007,8 +6023,8 @@ }, "property": { "type": "Identifier", - "start": 2942, - "end": 2948, + "start": 2954, + "end": 2960, "loc": { "start": { "line": 108, @@ -6026,8 +6042,8 @@ }, "property": { "type": "Identifier", - "start": 2949, - "end": 2957, + "start": 2961, + "end": 2969, "loc": { "start": { "line": 108, @@ -6054,8 +6070,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2670, - "end": 2817, + "start": 2682, + "end": 2829, "loc": { "start": { "line": 98, @@ -6072,8 +6088,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2972, - "end": 3113, + "start": 2984, + "end": 3125, "loc": { "start": { "line": 111, @@ -6089,8 +6105,8 @@ }, { "type": "ClassMethod", - "start": 3118, - "end": 3171, + "start": 3130, + "end": 3183, "loc": { "start": { "line": 118, @@ -6105,8 +6121,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 3122, - "end": 3130, + "start": 3134, + "end": 3142, "loc": { "start": { "line": 118, @@ -6128,8 +6144,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 3133, - "end": 3171, + "start": 3145, + "end": 3183, "loc": { "start": { "line": 118, @@ -6143,8 +6159,8 @@ "body": [ { "type": "ReturnStatement", - "start": 3143, - "end": 3165, + "start": 3155, + "end": 3177, "loc": { "start": { "line": 119, @@ -6157,8 +6173,8 @@ }, "argument": { "type": "MemberExpression", - "start": 3150, - "end": 3164, + "start": 3162, + "end": 3176, "loc": { "start": { "line": 119, @@ -6171,8 +6187,8 @@ }, "object": { "type": "ThisExpression", - "start": 3150, - "end": 3154, + "start": 3162, + "end": 3166, "loc": { "start": { "line": 119, @@ -6186,8 +6202,8 @@ }, "property": { "type": "Identifier", - "start": 3155, - "end": 3164, + "start": 3167, + "end": 3176, "loc": { "start": { "line": 119, @@ -6212,8 +6228,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2972, - "end": 3113, + "start": 2984, + "end": 3125, "loc": { "start": { "line": 111, @@ -6230,8 +6246,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3177, - "end": 3382, + "start": 3189, + "end": 3394, "loc": { "start": { "line": 122, @@ -6247,8 +6263,8 @@ }, { "type": "ClassMethod", - "start": 3387, - "end": 3604, + "start": 3399, + "end": 3616, "loc": { "start": { "line": 129, @@ -6263,8 +6279,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 3391, - "end": 3399, + "start": 3403, + "end": 3411, "loc": { "start": { "line": 129, @@ -6286,8 +6302,8 @@ "params": [ { "type": "Identifier", - "start": 3400, - "end": 3405, + "start": 3412, + "end": 3417, "loc": { "start": { "line": 129, @@ -6304,8 +6320,8 @@ ], "body": { "type": "BlockStatement", - "start": 3407, - "end": 3604, + "start": 3419, + "end": 3616, "loc": { "start": { "line": 129, @@ -6319,8 +6335,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 3417, - "end": 3456, + "start": 3429, + "end": 3468, "loc": { "start": { "line": 130, @@ -6333,8 +6349,8 @@ }, "expression": { "type": "CallExpression", - "start": 3417, - "end": 3455, + "start": 3429, + "end": 3467, "loc": { "start": { "line": 130, @@ -6347,8 +6363,8 @@ }, "callee": { "type": "MemberExpression", - "start": 3417, - "end": 3435, + "start": 3429, + "end": 3447, "loc": { "start": { "line": 130, @@ -6361,8 +6377,8 @@ }, "object": { "type": "MemberExpression", - "start": 3417, - "end": 3431, + "start": 3429, + "end": 3443, "loc": { "start": { "line": 130, @@ -6375,8 +6391,8 @@ }, "object": { "type": "ThisExpression", - "start": 3417, - "end": 3421, + "start": 3429, + "end": 3433, "loc": { "start": { "line": 130, @@ -6390,8 +6406,8 @@ }, "property": { "type": "Identifier", - "start": 3422, - "end": 3431, + "start": 3434, + "end": 3443, "loc": { "start": { "line": 130, @@ -6409,8 +6425,8 @@ }, "property": { "type": "Identifier", - "start": 3432, - "end": 3435, + "start": 3444, + "end": 3447, "loc": { "start": { "line": 130, @@ -6429,8 +6445,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 3436, - "end": 3454, + "start": 3448, + "end": 3466, "loc": { "start": { "line": 130, @@ -6443,8 +6459,8 @@ }, "left": { "type": "Identifier", - "start": 3436, - "end": 3441, + "start": 3448, + "end": 3453, "loc": { "start": { "line": 130, @@ -6461,8 +6477,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 3445, - "end": 3454, + "start": 3457, + "end": 3466, "loc": { "start": { "line": 130, @@ -6476,8 +6492,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 3446, - "end": 3447, + "start": 3458, + "end": 3459, "loc": { "start": { "line": 130, @@ -6496,8 +6512,8 @@ }, { "type": "NumericLiteral", - "start": 3449, - "end": 3450, + "start": 3461, + "end": 3462, "loc": { "start": { "line": 130, @@ -6516,8 +6532,8 @@ }, { "type": "NumericLiteral", - "start": 3452, - "end": 3453, + "start": 3464, + "end": 3465, "loc": { "start": { "line": 130, @@ -6542,8 +6558,8 @@ }, { "type": "ExpressionStatement", - "start": 3465, - "end": 3529, + "start": 3477, + "end": 3541, "loc": { "start": { "line": 131, @@ -6556,8 +6572,8 @@ }, "expression": { "type": "CallExpression", - "start": 3465, - "end": 3528, + "start": 3477, + "end": 3540, "loc": { "start": { "line": 131, @@ -6570,8 +6586,8 @@ }, "callee": { "type": "MemberExpression", - "start": 3465, - "end": 3487, + "start": 3477, + "end": 3499, "loc": { "start": { "line": 131, @@ -6584,8 +6600,8 @@ }, "object": { "type": "Identifier", - "start": 3465, - "end": 3469, + "start": 3477, + "end": 3481, "loc": { "start": { "line": 131, @@ -6601,8 +6617,8 @@ }, "property": { "type": "Identifier", - "start": 3470, - "end": 3487, + "start": 3482, + "end": 3499, "loc": { "start": { "line": 131, @@ -6621,8 +6637,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 3488, - "end": 3502, + "start": 3500, + "end": 3514, "loc": { "start": { "line": 131, @@ -6635,8 +6651,8 @@ }, "object": { "type": "ThisExpression", - "start": 3488, - "end": 3492, + "start": 3500, + "end": 3504, "loc": { "start": { "line": 131, @@ -6650,8 +6666,8 @@ }, "property": { "type": "Identifier", - "start": 3493, - "end": 3502, + "start": 3505, + "end": 3514, "loc": { "start": { "line": 131, @@ -6669,8 +6685,8 @@ }, { "type": "StringLiteral", - "start": 3504, - "end": 3509, + "start": 3516, + "end": 3521, "loc": { "start": { "line": 131, @@ -6689,8 +6705,8 @@ }, { "type": "MemberExpression", - "start": 3511, - "end": 3527, + "start": 3523, + "end": 3539, "loc": { "start": { "line": 131, @@ -6703,8 +6719,8 @@ }, "object": { "type": "ThisExpression", - "start": 3511, - "end": 3515, + "start": 3523, + "end": 3527, "loc": { "start": { "line": 131, @@ -6718,8 +6734,8 @@ }, "property": { "type": "Identifier", - "start": 3516, - "end": 3527, + "start": 3528, + "end": 3539, "loc": { "start": { "line": 131, @@ -6740,8 +6756,8 @@ }, { "type": "ExpressionStatement", - "start": 3538, - "end": 3566, + "start": 3550, + "end": 3578, "loc": { "start": { "line": 132, @@ -6754,8 +6770,8 @@ }, "expression": { "type": "CallExpression", - "start": 3538, - "end": 3565, + "start": 3550, + "end": 3577, "loc": { "start": { "line": 132, @@ -6768,8 +6784,8 @@ }, "callee": { "type": "MemberExpression", - "start": 3538, - "end": 3563, + "start": 3550, + "end": 3575, "loc": { "start": { "line": 132, @@ -6782,8 +6798,8 @@ }, "object": { "type": "ThisExpression", - "start": 3538, - "end": 3542, + "start": 3550, + "end": 3554, "loc": { "start": { "line": 132, @@ -6797,8 +6813,8 @@ }, "property": { "type": "Identifier", - "start": 3543, - "end": 3563, + "start": 3555, + "end": 3575, "loc": { "start": { "line": 132, @@ -6819,8 +6835,8 @@ }, { "type": "ExpressionStatement", - "start": 3575, - "end": 3598, + "start": 3587, + "end": 3610, "loc": { "start": { "line": 133, @@ -6833,8 +6849,8 @@ }, "expression": { "type": "CallExpression", - "start": 3575, - "end": 3597, + "start": 3587, + "end": 3609, "loc": { "start": { "line": 133, @@ -6847,8 +6863,8 @@ }, "callee": { "type": "MemberExpression", - "start": 3575, - "end": 3595, + "start": 3587, + "end": 3607, "loc": { "start": { "line": 133, @@ -6861,8 +6877,8 @@ }, "object": { "type": "MemberExpression", - "start": 3575, - "end": 3586, + "start": 3587, + "end": 3598, "loc": { "start": { "line": 133, @@ -6875,8 +6891,8 @@ }, "object": { "type": "ThisExpression", - "start": 3575, - "end": 3579, + "start": 3587, + "end": 3591, "loc": { "start": { "line": 133, @@ -6890,8 +6906,8 @@ }, "property": { "type": "Identifier", - "start": 3580, - "end": 3586, + "start": 3592, + "end": 3598, "loc": { "start": { "line": 133, @@ -6909,8 +6925,8 @@ }, "property": { "type": "Identifier", - "start": 3587, - "end": 3595, + "start": 3599, + "end": 3607, "loc": { "start": { "line": 133, @@ -6937,8 +6953,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3177, - "end": 3382, + "start": 3189, + "end": 3394, "loc": { "start": { "line": 122, @@ -6955,8 +6971,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3610, - "end": 3815, + "start": 3622, + "end": 3827, "loc": { "start": { "line": 136, @@ -6972,8 +6988,8 @@ }, { "type": "ClassMethod", - "start": 3820, - "end": 3873, + "start": 3832, + "end": 3885, "loc": { "start": { "line": 143, @@ -6988,8 +7004,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 3824, - "end": 3832, + "start": 3836, + "end": 3844, "loc": { "start": { "line": 143, @@ -7011,8 +7027,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 3835, - "end": 3873, + "start": 3847, + "end": 3885, "loc": { "start": { "line": 143, @@ -7026,8 +7042,8 @@ "body": [ { "type": "ReturnStatement", - "start": 3845, - "end": 3867, + "start": 3857, + "end": 3879, "loc": { "start": { "line": 144, @@ -7040,8 +7056,8 @@ }, "argument": { "type": "MemberExpression", - "start": 3852, - "end": 3866, + "start": 3864, + "end": 3878, "loc": { "start": { "line": 144, @@ -7054,8 +7070,8 @@ }, "object": { "type": "ThisExpression", - "start": 3852, - "end": 3856, + "start": 3864, + "end": 3868, "loc": { "start": { "line": 144, @@ -7069,8 +7085,8 @@ }, "property": { "type": "Identifier", - "start": 3857, - "end": 3866, + "start": 3869, + "end": 3878, "loc": { "start": { "line": 144, @@ -7095,8 +7111,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3610, - "end": 3815, + "start": 3622, + "end": 3827, "loc": { "start": { "line": 136, @@ -7113,8 +7129,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 3879, - "end": 4030, + "start": 3891, + "end": 4042, "loc": { "start": { "line": 147, @@ -7130,8 +7146,8 @@ }, { "type": "ClassMethod", - "start": 4035, - "end": 4259, + "start": 4047, + "end": 4271, "loc": { "start": { "line": 154, @@ -7146,8 +7162,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 4039, - "end": 4049, + "start": 4051, + "end": 4061, "loc": { "start": { "line": 154, @@ -7169,8 +7185,8 @@ "params": [ { "type": "Identifier", - "start": 4050, - "end": 4055, + "start": 4062, + "end": 4067, "loc": { "start": { "line": 154, @@ -7187,8 +7203,8 @@ ], "body": { "type": "BlockStatement", - "start": 4057, - "end": 4259, + "start": 4069, + "end": 4271, "loc": { "start": { "line": 154, @@ -7202,8 +7218,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 4067, - "end": 4111, + "start": 4079, + "end": 4123, "loc": { "start": { "line": 155, @@ -7216,8 +7232,8 @@ }, "expression": { "type": "CallExpression", - "start": 4067, - "end": 4110, + "start": 4079, + "end": 4122, "loc": { "start": { "line": 155, @@ -7230,8 +7246,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4067, - "end": 4087, + "start": 4079, + "end": 4099, "loc": { "start": { "line": 155, @@ -7244,8 +7260,8 @@ }, "object": { "type": "MemberExpression", - "start": 4067, - "end": 4083, + "start": 4079, + "end": 4095, "loc": { "start": { "line": 155, @@ -7258,8 +7274,8 @@ }, "object": { "type": "ThisExpression", - "start": 4067, - "end": 4071, + "start": 4079, + "end": 4083, "loc": { "start": { "line": 155, @@ -7273,8 +7289,8 @@ }, "property": { "type": "Identifier", - "start": 4072, - "end": 4083, + "start": 4084, + "end": 4095, "loc": { "start": { "line": 155, @@ -7292,8 +7308,8 @@ }, "property": { "type": "Identifier", - "start": 4084, - "end": 4087, + "start": 4096, + "end": 4099, "loc": { "start": { "line": 155, @@ -7312,8 +7328,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 4088, - "end": 4109, + "start": 4100, + "end": 4121, "loc": { "start": { "line": 155, @@ -7326,8 +7342,8 @@ }, "left": { "type": "Identifier", - "start": 4088, - "end": 4093, + "start": 4100, + "end": 4105, "loc": { "start": { "line": 155, @@ -7344,8 +7360,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 4097, - "end": 4109, + "start": 4109, + "end": 4121, "loc": { "start": { "line": 155, @@ -7359,8 +7375,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 4098, - "end": 4099, + "start": 4110, + "end": 4111, "loc": { "start": { "line": 155, @@ -7379,8 +7395,8 @@ }, { "type": "NumericLiteral", - "start": 4101, - "end": 4102, + "start": 4113, + "end": 4114, "loc": { "start": { "line": 155, @@ -7399,8 +7415,8 @@ }, { "type": "NumericLiteral", - "start": 4104, - "end": 4105, + "start": 4116, + "end": 4117, "loc": { "start": { "line": 155, @@ -7419,8 +7435,8 @@ }, { "type": "NumericLiteral", - "start": 4107, - "end": 4108, + "start": 4119, + "end": 4120, "loc": { "start": { "line": 155, @@ -7445,8 +7461,8 @@ }, { "type": "ExpressionStatement", - "start": 4120, - "end": 4184, + "start": 4132, + "end": 4196, "loc": { "start": { "line": 156, @@ -7459,8 +7475,8 @@ }, "expression": { "type": "CallExpression", - "start": 4120, - "end": 4183, + "start": 4132, + "end": 4195, "loc": { "start": { "line": 156, @@ -7473,8 +7489,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4120, - "end": 4142, + "start": 4132, + "end": 4154, "loc": { "start": { "line": 156, @@ -7487,8 +7503,8 @@ }, "object": { "type": "Identifier", - "start": 4120, - "end": 4124, + "start": 4132, + "end": 4136, "loc": { "start": { "line": 156, @@ -7504,8 +7520,8 @@ }, "property": { "type": "Identifier", - "start": 4125, - "end": 4142, + "start": 4137, + "end": 4154, "loc": { "start": { "line": 156, @@ -7524,8 +7540,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 4143, - "end": 4159, + "start": 4155, + "end": 4171, "loc": { "start": { "line": 156, @@ -7538,8 +7554,8 @@ }, "object": { "type": "ThisExpression", - "start": 4143, - "end": 4147, + "start": 4155, + "end": 4159, "loc": { "start": { "line": 156, @@ -7553,8 +7569,8 @@ }, "property": { "type": "Identifier", - "start": 4148, - "end": 4159, + "start": 4160, + "end": 4171, "loc": { "start": { "line": 156, @@ -7572,8 +7588,8 @@ }, { "type": "StringLiteral", - "start": 4161, - "end": 4166, + "start": 4173, + "end": 4178, "loc": { "start": { "line": 156, @@ -7592,8 +7608,8 @@ }, { "type": "MemberExpression", - "start": 4168, - "end": 4182, + "start": 4180, + "end": 4194, "loc": { "start": { "line": 156, @@ -7606,8 +7622,8 @@ }, "object": { "type": "ThisExpression", - "start": 4168, - "end": 4172, + "start": 4180, + "end": 4184, "loc": { "start": { "line": 156, @@ -7621,8 +7637,8 @@ }, "property": { "type": "Identifier", - "start": 4173, - "end": 4182, + "start": 4185, + "end": 4194, "loc": { "start": { "line": 156, @@ -7643,8 +7659,8 @@ }, { "type": "ExpressionStatement", - "start": 4193, - "end": 4221, + "start": 4205, + "end": 4233, "loc": { "start": { "line": 157, @@ -7657,8 +7673,8 @@ }, "expression": { "type": "CallExpression", - "start": 4193, - "end": 4220, + "start": 4205, + "end": 4232, "loc": { "start": { "line": 157, @@ -7671,8 +7687,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4193, - "end": 4218, + "start": 4205, + "end": 4230, "loc": { "start": { "line": 157, @@ -7685,8 +7701,8 @@ }, "object": { "type": "ThisExpression", - "start": 4193, - "end": 4197, + "start": 4205, + "end": 4209, "loc": { "start": { "line": 157, @@ -7700,8 +7716,8 @@ }, "property": { "type": "Identifier", - "start": 4198, - "end": 4218, + "start": 4210, + "end": 4230, "loc": { "start": { "line": 157, @@ -7722,8 +7738,8 @@ }, { "type": "ExpressionStatement", - "start": 4230, - "end": 4253, + "start": 4242, + "end": 4265, "loc": { "start": { "line": 158, @@ -7736,8 +7752,8 @@ }, "expression": { "type": "CallExpression", - "start": 4230, - "end": 4252, + "start": 4242, + "end": 4264, "loc": { "start": { "line": 158, @@ -7750,8 +7766,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4230, - "end": 4250, + "start": 4242, + "end": 4262, "loc": { "start": { "line": 158, @@ -7764,8 +7780,8 @@ }, "object": { "type": "MemberExpression", - "start": 4230, - "end": 4241, + "start": 4242, + "end": 4253, "loc": { "start": { "line": 158, @@ -7778,8 +7794,8 @@ }, "object": { "type": "ThisExpression", - "start": 4230, - "end": 4234, + "start": 4242, + "end": 4246, "loc": { "start": { "line": 158, @@ -7793,8 +7809,8 @@ }, "property": { "type": "Identifier", - "start": 4235, - "end": 4241, + "start": 4247, + "end": 4253, "loc": { "start": { "line": 158, @@ -7812,8 +7828,8 @@ }, "property": { "type": "Identifier", - "start": 4242, - "end": 4250, + "start": 4254, + "end": 4262, "loc": { "start": { "line": 158, @@ -7840,8 +7856,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 3879, - "end": 4030, + "start": 3891, + "end": 4042, "loc": { "start": { "line": 147, @@ -7858,8 +7874,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 4265, - "end": 4416, + "start": 4277, + "end": 4428, "loc": { "start": { "line": 161, @@ -7875,8 +7891,8 @@ }, { "type": "ClassMethod", - "start": 4421, - "end": 4478, + "start": 4433, + "end": 4490, "loc": { "start": { "line": 168, @@ -7891,8 +7907,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 4425, - "end": 4435, + "start": 4437, + "end": 4447, "loc": { "start": { "line": 168, @@ -7914,8 +7930,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 4438, - "end": 4478, + "start": 4450, + "end": 4490, "loc": { "start": { "line": 168, @@ -7929,8 +7945,8 @@ "body": [ { "type": "ReturnStatement", - "start": 4448, - "end": 4472, + "start": 4460, + "end": 4484, "loc": { "start": { "line": 169, @@ -7943,8 +7959,8 @@ }, "argument": { "type": "MemberExpression", - "start": 4455, - "end": 4471, + "start": 4467, + "end": 4483, "loc": { "start": { "line": 169, @@ -7957,8 +7973,8 @@ }, "object": { "type": "ThisExpression", - "start": 4455, - "end": 4459, + "start": 4467, + "end": 4471, "loc": { "start": { "line": 169, @@ -7972,8 +7988,8 @@ }, "property": { "type": "Identifier", - "start": 4460, - "end": 4471, + "start": 4472, + "end": 4483, "loc": { "start": { "line": 169, @@ -7998,8 +8014,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 4265, - "end": 4416, + "start": 4277, + "end": 4428, "loc": { "start": { "line": 161, @@ -8016,8 +8032,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4484, - "end": 4619, + "start": 4496, + "end": 4631, "loc": { "start": { "line": 172, @@ -8033,8 +8049,8 @@ }, { "type": "ClassMethod", - "start": 4624, - "end": 4762, + "start": 4636, + "end": 4774, "loc": { "start": { "line": 179, @@ -8049,8 +8065,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 4628, - "end": 4633, + "start": 4640, + "end": 4645, "loc": { "start": { "line": 179, @@ -8072,8 +8088,8 @@ "params": [ { "type": "Identifier", - "start": 4634, - "end": 4639, + "start": 4646, + "end": 4651, "loc": { "start": { "line": 179, @@ -8090,8 +8106,8 @@ ], "body": { "type": "BlockStatement", - "start": 4641, - "end": 4762, + "start": 4653, + "end": 4774, "loc": { "start": { "line": 179, @@ -8105,8 +8121,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 4651, - "end": 4687, + "start": 4663, + "end": 4699, "loc": { "start": { "line": 180, @@ -8119,8 +8135,8 @@ }, "expression": { "type": "CallExpression", - "start": 4651, - "end": 4686, + "start": 4663, + "end": 4698, "loc": { "start": { "line": 180, @@ -8133,8 +8149,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4651, - "end": 4666, + "start": 4663, + "end": 4678, "loc": { "start": { "line": 180, @@ -8147,8 +8163,8 @@ }, "object": { "type": "MemberExpression", - "start": 4651, - "end": 4662, + "start": 4663, + "end": 4674, "loc": { "start": { "line": 180, @@ -8161,8 +8177,8 @@ }, "object": { "type": "ThisExpression", - "start": 4651, - "end": 4655, + "start": 4663, + "end": 4667, "loc": { "start": { "line": 180, @@ -8176,8 +8192,8 @@ }, "property": { "type": "Identifier", - "start": 4656, - "end": 4662, + "start": 4668, + "end": 4674, "loc": { "start": { "line": 180, @@ -8195,8 +8211,8 @@ }, "property": { "type": "Identifier", - "start": 4663, - "end": 4666, + "start": 4675, + "end": 4678, "loc": { "start": { "line": 180, @@ -8215,8 +8231,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 4667, - "end": 4685, + "start": 4679, + "end": 4697, "loc": { "start": { "line": 180, @@ -8229,8 +8245,8 @@ }, "left": { "type": "Identifier", - "start": 4667, - "end": 4672, + "start": 4679, + "end": 4684, "loc": { "start": { "line": 180, @@ -8247,8 +8263,8 @@ "operator": "||", "right": { "type": "ArrayExpression", - "start": 4676, - "end": 4685, + "start": 4688, + "end": 4697, "loc": { "start": { "line": 180, @@ -8262,8 +8278,8 @@ "elements": [ { "type": "NumericLiteral", - "start": 4677, - "end": 4678, + "start": 4689, + "end": 4690, "loc": { "start": { "line": 180, @@ -8282,8 +8298,8 @@ }, { "type": "NumericLiteral", - "start": 4680, - "end": 4681, + "start": 4692, + "end": 4693, "loc": { "start": { "line": 180, @@ -8302,8 +8318,8 @@ }, { "type": "NumericLiteral", - "start": 4683, - "end": 4684, + "start": 4695, + "end": 4696, "loc": { "start": { "line": 180, @@ -8328,8 +8344,8 @@ }, { "type": "ExpressionStatement", - "start": 4696, - "end": 4724, + "start": 4708, + "end": 4736, "loc": { "start": { "line": 181, @@ -8342,8 +8358,8 @@ }, "expression": { "type": "CallExpression", - "start": 4696, - "end": 4723, + "start": 4708, + "end": 4735, "loc": { "start": { "line": 181, @@ -8356,8 +8372,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4696, - "end": 4721, + "start": 4708, + "end": 4733, "loc": { "start": { "line": 181, @@ -8370,8 +8386,8 @@ }, "object": { "type": "ThisExpression", - "start": 4696, - "end": 4700, + "start": 4708, + "end": 4712, "loc": { "start": { "line": 181, @@ -8385,8 +8401,8 @@ }, "property": { "type": "Identifier", - "start": 4701, - "end": 4721, + "start": 4713, + "end": 4733, "loc": { "start": { "line": 181, @@ -8407,8 +8423,8 @@ }, { "type": "ExpressionStatement", - "start": 4733, - "end": 4756, + "start": 4745, + "end": 4768, "loc": { "start": { "line": 182, @@ -8421,8 +8437,8 @@ }, "expression": { "type": "CallExpression", - "start": 4733, - "end": 4755, + "start": 4745, + "end": 4767, "loc": { "start": { "line": 182, @@ -8435,8 +8451,8 @@ }, "callee": { "type": "MemberExpression", - "start": 4733, - "end": 4753, + "start": 4745, + "end": 4765, "loc": { "start": { "line": 182, @@ -8449,8 +8465,8 @@ }, "object": { "type": "MemberExpression", - "start": 4733, - "end": 4744, + "start": 4745, + "end": 4756, "loc": { "start": { "line": 182, @@ -8463,8 +8479,8 @@ }, "object": { "type": "ThisExpression", - "start": 4733, - "end": 4737, + "start": 4745, + "end": 4749, "loc": { "start": { "line": 182, @@ -8478,8 +8494,8 @@ }, "property": { "type": "Identifier", - "start": 4738, - "end": 4744, + "start": 4750, + "end": 4756, "loc": { "start": { "line": 182, @@ -8497,8 +8513,8 @@ }, "property": { "type": "Identifier", - "start": 4745, - "end": 4753, + "start": 4757, + "end": 4765, "loc": { "start": { "line": 182, @@ -8525,8 +8541,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4484, - "end": 4619, + "start": 4496, + "end": 4631, "loc": { "start": { "line": 172, @@ -8543,8 +8559,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4768, - "end": 4903, + "start": 4780, + "end": 4915, "loc": { "start": { "line": 185, @@ -8560,8 +8576,8 @@ }, { "type": "ClassMethod", - "start": 4908, - "end": 4955, + "start": 4920, + "end": 4967, "loc": { "start": { "line": 192, @@ -8576,8 +8592,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 4912, - "end": 4917, + "start": 4924, + "end": 4929, "loc": { "start": { "line": 192, @@ -8599,8 +8615,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 4920, - "end": 4955, + "start": 4932, + "end": 4967, "loc": { "start": { "line": 192, @@ -8614,8 +8630,8 @@ "body": [ { "type": "ReturnStatement", - "start": 4930, - "end": 4949, + "start": 4942, + "end": 4961, "loc": { "start": { "line": 193, @@ -8628,8 +8644,8 @@ }, "argument": { "type": "MemberExpression", - "start": 4937, - "end": 4948, + "start": 4949, + "end": 4960, "loc": { "start": { "line": 193, @@ -8642,8 +8658,8 @@ }, "object": { "type": "ThisExpression", - "start": 4937, - "end": 4941, + "start": 4949, + "end": 4953, "loc": { "start": { "line": 193, @@ -8657,8 +8673,8 @@ }, "property": { "type": "Identifier", - "start": 4942, - "end": 4948, + "start": 4954, + "end": 4960, "loc": { "start": { "line": 193, @@ -8683,8 +8699,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4768, - "end": 4903, + "start": 4780, + "end": 4915, "loc": { "start": { "line": 185, @@ -8701,8 +8717,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 4961, - "end": 5148, + "start": 4973, + "end": 5160, "loc": { "start": { "line": 196, @@ -8718,8 +8734,8 @@ }, { "type": "ClassMethod", - "start": 5153, - "end": 5526, + "start": 5165, + "end": 5538, "loc": { "start": { "line": 203, @@ -8734,8 +8750,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 5157, - "end": 5163, + "start": 5169, + "end": 5175, "loc": { "start": { "line": 203, @@ -8757,8 +8773,8 @@ "params": [ { "type": "Identifier", - "start": 5164, - "end": 5169, + "start": 5176, + "end": 5181, "loc": { "start": { "line": 203, @@ -8775,8 +8791,8 @@ ], "body": { "type": "BlockStatement", - "start": 5171, - "end": 5526, + "start": 5183, + "end": 5538, "loc": { "start": { "line": 203, @@ -8790,8 +8806,8 @@ "body": [ { "type": "IfStatement", - "start": 5181, - "end": 5269, + "start": 5193, + "end": 5281, "loc": { "start": { "line": 204, @@ -8804,8 +8820,8 @@ }, "test": { "type": "UnaryExpression", - "start": 5185, - "end": 5203, + "start": 5197, + "end": 5215, "loc": { "start": { "line": 204, @@ -8820,8 +8836,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 5186, - "end": 5203, + "start": 5198, + "end": 5215, "loc": { "start": { "line": 204, @@ -8834,8 +8850,8 @@ }, "object": { "type": "ThisExpression", - "start": 5186, - "end": 5190, + "start": 5198, + "end": 5202, "loc": { "start": { "line": 204, @@ -8849,8 +8865,8 @@ }, "property": { "type": "Identifier", - "start": 5191, - "end": 5203, + "start": 5203, + "end": 5215, "loc": { "start": { "line": 204, @@ -8872,8 +8888,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 5205, - "end": 5269, + "start": 5217, + "end": 5281, "loc": { "start": { "line": 204, @@ -8887,8 +8903,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5219, - "end": 5259, + "start": 5231, + "end": 5271, "loc": { "start": { "line": 205, @@ -8901,8 +8917,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5219, - "end": 5258, + "start": 5231, + "end": 5270, "loc": { "start": { "line": 205, @@ -8916,8 +8932,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5219, - "end": 5236, + "start": 5231, + "end": 5248, "loc": { "start": { "line": 205, @@ -8930,8 +8946,8 @@ }, "object": { "type": "ThisExpression", - "start": 5219, - "end": 5223, + "start": 5231, + "end": 5235, "loc": { "start": { "line": 205, @@ -8945,8 +8961,8 @@ }, "property": { "type": "Identifier", - "start": 5224, - "end": 5236, + "start": 5236, + "end": 5248, "loc": { "start": { "line": 205, @@ -8964,8 +8980,8 @@ }, "right": { "type": "CallExpression", - "start": 5239, - "end": 5258, + "start": 5251, + "end": 5270, "loc": { "start": { "line": 205, @@ -8978,8 +8994,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5239, - "end": 5256, + "start": 5251, + "end": 5268, "loc": { "start": { "line": 205, @@ -8992,8 +9008,8 @@ }, "object": { "type": "Identifier", - "start": 5239, - "end": 5243, + "start": 5251, + "end": 5255, "loc": { "start": { "line": 205, @@ -9009,8 +9025,8 @@ }, "property": { "type": "Identifier", - "start": 5244, - "end": 5256, + "start": 5256, + "end": 5268, "loc": { "start": { "line": 205, @@ -9037,8 +9053,8 @@ }, { "type": "ExpressionStatement", - "start": 5278, - "end": 5322, + "start": 5290, + "end": 5334, "loc": { "start": { "line": 207, @@ -9051,8 +9067,8 @@ }, "expression": { "type": "CallExpression", - "start": 5278, - "end": 5321, + "start": 5290, + "end": 5333, "loc": { "start": { "line": 207, @@ -9065,8 +9081,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5278, - "end": 5299, + "start": 5290, + "end": 5311, "loc": { "start": { "line": 207, @@ -9079,8 +9095,8 @@ }, "object": { "type": "MemberExpression", - "start": 5278, - "end": 5295, + "start": 5290, + "end": 5307, "loc": { "start": { "line": 207, @@ -9093,8 +9109,8 @@ }, "object": { "type": "ThisExpression", - "start": 5278, - "end": 5282, + "start": 5290, + "end": 5294, "loc": { "start": { "line": 207, @@ -9108,8 +9124,8 @@ }, "property": { "type": "Identifier", - "start": 5283, - "end": 5295, + "start": 5295, + "end": 5307, "loc": { "start": { "line": 207, @@ -9127,8 +9143,8 @@ }, "property": { "type": "Identifier", - "start": 5296, - "end": 5299, + "start": 5308, + "end": 5311, "loc": { "start": { "line": 207, @@ -9147,8 +9163,8 @@ "arguments": [ { "type": "LogicalExpression", - "start": 5300, - "end": 5320, + "start": 5312, + "end": 5332, "loc": { "start": { "line": 207, @@ -9161,8 +9177,8 @@ }, "left": { "type": "Identifier", - "start": 5300, - "end": 5305, + "start": 5312, + "end": 5317, "loc": { "start": { "line": 207, @@ -9179,8 +9195,8 @@ "operator": "||", "right": { "type": "Identifier", - "start": 5309, - "end": 5320, + "start": 5321, + "end": 5332, "loc": { "start": { "line": 207, @@ -9200,8 +9216,8 @@ }, { "type": "ExpressionStatement", - "start": 5331, - "end": 5416, + "start": 5343, + "end": 5428, "loc": { "start": { "line": 208, @@ -9214,8 +9230,8 @@ }, "expression": { "type": "CallExpression", - "start": 5331, - "end": 5415, + "start": 5343, + "end": 5427, "loc": { "start": { "line": 208, @@ -9228,8 +9244,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5331, - "end": 5349, + "start": 5343, + "end": 5361, "loc": { "start": { "line": 208, @@ -9242,8 +9258,8 @@ }, "object": { "type": "Identifier", - "start": 5331, - "end": 5335, + "start": 5343, + "end": 5347, "loc": { "start": { "line": 208, @@ -9259,8 +9275,8 @@ }, "property": { "type": "Identifier", - "start": 5336, - "end": 5349, + "start": 5348, + "end": 5361, "loc": { "start": { "line": 208, @@ -9279,8 +9295,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 5350, - "end": 5367, + "start": 5362, + "end": 5379, "loc": { "start": { "line": 208, @@ -9293,8 +9309,8 @@ }, "object": { "type": "ThisExpression", - "start": 5350, - "end": 5354, + "start": 5362, + "end": 5366, "loc": { "start": { "line": 208, @@ -9308,8 +9324,8 @@ }, "property": { "type": "Identifier", - "start": 5355, - "end": 5367, + "start": 5367, + "end": 5379, "loc": { "start": { "line": 208, @@ -9327,8 +9343,8 @@ }, { "type": "MemberExpression", - "start": 5369, - "end": 5383, + "start": 5381, + "end": 5395, "loc": { "start": { "line": 208, @@ -9341,8 +9357,8 @@ }, "object": { "type": "ThisExpression", - "start": 5369, - "end": 5373, + "start": 5381, + "end": 5385, "loc": { "start": { "line": 208, @@ -9356,8 +9372,8 @@ }, "property": { "type": "Identifier", - "start": 5374, - "end": 5383, + "start": 5386, + "end": 5395, "loc": { "start": { "line": 208, @@ -9375,8 +9391,8 @@ }, { "type": "MemberExpression", - "start": 5385, - "end": 5401, + "start": 5397, + "end": 5413, "loc": { "start": { "line": 208, @@ -9389,8 +9405,8 @@ }, "object": { "type": "ThisExpression", - "start": 5385, - "end": 5389, + "start": 5397, + "end": 5401, "loc": { "start": { "line": 208, @@ -9404,8 +9420,8 @@ }, "property": { "type": "Identifier", - "start": 5390, - "end": 5401, + "start": 5402, + "end": 5413, "loc": { "start": { "line": 208, @@ -9423,8 +9439,8 @@ }, { "type": "MemberExpression", - "start": 5403, - "end": 5414, + "start": 5415, + "end": 5426, "loc": { "start": { "line": 208, @@ -9437,8 +9453,8 @@ }, "object": { "type": "ThisExpression", - "start": 5403, - "end": 5407, + "start": 5415, + "end": 5419, "loc": { "start": { "line": 208, @@ -9452,8 +9468,8 @@ }, "property": { "type": "Identifier", - "start": 5408, - "end": 5414, + "start": 5420, + "end": 5426, "loc": { "start": { "line": 208, @@ -9474,8 +9490,8 @@ }, { "type": "ExpressionStatement", - "start": 5425, - "end": 5456, + "start": 5437, + "end": 5468, "loc": { "start": { "line": 209, @@ -9488,8 +9504,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5425, - "end": 5455, + "start": 5437, + "end": 5467, "loc": { "start": { "line": 209, @@ -9503,8 +9519,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5425, - "end": 5447, + "start": 5437, + "end": 5459, "loc": { "start": { "line": 209, @@ -9517,8 +9533,8 @@ }, "object": { "type": "ThisExpression", - "start": 5425, - "end": 5429, + "start": 5437, + "end": 5441, "loc": { "start": { "line": 209, @@ -9532,8 +9548,8 @@ }, "property": { "type": "Identifier", - "start": 5430, - "end": 5447, + "start": 5442, + "end": 5459, "loc": { "start": { "line": 209, @@ -9551,8 +9567,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 5450, - "end": 5455, + "start": 5462, + "end": 5467, "loc": { "start": { "line": 209, @@ -9569,8 +9585,8 @@ }, { "type": "ExpressionStatement", - "start": 5465, - "end": 5488, + "start": 5477, + "end": 5500, "loc": { "start": { "line": 210, @@ -9583,8 +9599,8 @@ }, "expression": { "type": "CallExpression", - "start": 5465, - "end": 5487, + "start": 5477, + "end": 5499, "loc": { "start": { "line": 210, @@ -9597,8 +9613,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5465, - "end": 5485, + "start": 5477, + "end": 5497, "loc": { "start": { "line": 210, @@ -9611,8 +9627,8 @@ }, "object": { "type": "ThisExpression", - "start": 5465, - "end": 5469, + "start": 5477, + "end": 5481, "loc": { "start": { "line": 210, @@ -9626,8 +9642,8 @@ }, "property": { "type": "Identifier", - "start": 5470, - "end": 5485, + "start": 5482, + "end": 5497, "loc": { "start": { "line": 210, @@ -9648,8 +9664,8 @@ }, { "type": "ExpressionStatement", - "start": 5497, - "end": 5520, + "start": 5509, + "end": 5532, "loc": { "start": { "line": 211, @@ -9662,8 +9678,8 @@ }, "expression": { "type": "CallExpression", - "start": 5497, - "end": 5519, + "start": 5509, + "end": 5531, "loc": { "start": { "line": 211, @@ -9676,8 +9692,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5497, - "end": 5517, + "start": 5509, + "end": 5529, "loc": { "start": { "line": 211, @@ -9690,8 +9706,8 @@ }, "object": { "type": "MemberExpression", - "start": 5497, - "end": 5508, + "start": 5509, + "end": 5520, "loc": { "start": { "line": 211, @@ -9704,8 +9720,8 @@ }, "object": { "type": "ThisExpression", - "start": 5497, - "end": 5501, + "start": 5509, + "end": 5513, "loc": { "start": { "line": 211, @@ -9719,8 +9735,8 @@ }, "property": { "type": "Identifier", - "start": 5502, - "end": 5508, + "start": 5514, + "end": 5520, "loc": { "start": { "line": 211, @@ -9738,8 +9754,8 @@ }, "property": { "type": "Identifier", - "start": 5509, - "end": 5517, + "start": 5521, + "end": 5529, "loc": { "start": { "line": 211, @@ -9766,8 +9782,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 4961, - "end": 5148, + "start": 4973, + "end": 5160, "loc": { "start": { "line": 196, @@ -9784,8 +9800,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 5532, - "end": 5719, + "start": 5544, + "end": 5731, "loc": { "start": { "line": 214, @@ -9801,8 +9817,8 @@ }, { "type": "ClassMethod", - "start": 5724, - "end": 6075, + "start": 5736, + "end": 6087, "loc": { "start": { "line": 221, @@ -9817,8 +9833,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 5728, - "end": 5734, + "start": 5740, + "end": 5746, "loc": { "start": { "line": 221, @@ -9840,8 +9856,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 5737, - "end": 6075, + "start": 5749, + "end": 6087, "loc": { "start": { "line": 221, @@ -9855,8 +9871,8 @@ "body": [ { "type": "IfStatement", - "start": 5747, - "end": 6035, + "start": 5759, + "end": 6047, "loc": { "start": { "line": 222, @@ -9869,8 +9885,8 @@ }, "test": { "type": "MemberExpression", - "start": 5751, - "end": 5773, + "start": 5763, + "end": 5785, "loc": { "start": { "line": 222, @@ -9883,8 +9899,8 @@ }, "object": { "type": "ThisExpression", - "start": 5751, - "end": 5755, + "start": 5763, + "end": 5767, "loc": { "start": { "line": 222, @@ -9898,8 +9914,8 @@ }, "property": { "type": "Identifier", - "start": 5756, - "end": 5773, + "start": 5768, + "end": 5785, "loc": { "start": { "line": 222, @@ -9917,8 +9933,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 5775, - "end": 6035, + "start": 5787, + "end": 6047, "loc": { "start": { "line": 222, @@ -9932,8 +9948,8 @@ "body": [ { "type": "IfStatement", - "start": 5789, - "end": 5885, + "start": 5801, + "end": 5897, "loc": { "start": { "line": 223, @@ -9946,8 +9962,8 @@ }, "test": { "type": "UnaryExpression", - "start": 5793, - "end": 5811, + "start": 5805, + "end": 5823, "loc": { "start": { "line": 223, @@ -9962,8 +9978,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 5794, - "end": 5811, + "start": 5806, + "end": 5823, "loc": { "start": { "line": 223, @@ -9976,8 +9992,8 @@ }, "object": { "type": "ThisExpression", - "start": 5794, - "end": 5798, + "start": 5806, + "end": 5810, "loc": { "start": { "line": 223, @@ -9991,8 +10007,8 @@ }, "property": { "type": "Identifier", - "start": 5799, - "end": 5811, + "start": 5811, + "end": 5823, "loc": { "start": { "line": 223, @@ -10014,8 +10030,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 5813, - "end": 5885, + "start": 5825, + "end": 5897, "loc": { "start": { "line": 223, @@ -10029,8 +10045,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 5831, - "end": 5871, + "start": 5843, + "end": 5883, "loc": { "start": { "line": 224, @@ -10043,8 +10059,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5831, - "end": 5870, + "start": 5843, + "end": 5882, "loc": { "start": { "line": 224, @@ -10058,8 +10074,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5831, - "end": 5848, + "start": 5843, + "end": 5860, "loc": { "start": { "line": 224, @@ -10072,8 +10088,8 @@ }, "object": { "type": "ThisExpression", - "start": 5831, - "end": 5835, + "start": 5843, + "end": 5847, "loc": { "start": { "line": 224, @@ -10087,8 +10103,8 @@ }, "property": { "type": "Identifier", - "start": 5836, - "end": 5848, + "start": 5848, + "end": 5860, "loc": { "start": { "line": 224, @@ -10106,8 +10122,8 @@ }, "right": { "type": "CallExpression", - "start": 5851, - "end": 5870, + "start": 5863, + "end": 5882, "loc": { "start": { "line": 224, @@ -10120,8 +10136,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5851, - "end": 5868, + "start": 5863, + "end": 5880, "loc": { "start": { "line": 224, @@ -10134,8 +10150,8 @@ }, "object": { "type": "Identifier", - "start": 5851, - "end": 5855, + "start": 5863, + "end": 5867, "loc": { "start": { "line": 224, @@ -10151,8 +10167,8 @@ }, "property": { "type": "Identifier", - "start": 5856, - "end": 5868, + "start": 5868, + "end": 5880, "loc": { "start": { "line": 224, @@ -10179,8 +10195,8 @@ }, { "type": "ExpressionStatement", - "start": 5898, - "end": 5981, + "start": 5910, + "end": 5993, "loc": { "start": { "line": 226, @@ -10193,8 +10209,8 @@ }, "expression": { "type": "CallExpression", - "start": 5898, - "end": 5980, + "start": 5910, + "end": 5992, "loc": { "start": { "line": 226, @@ -10207,8 +10223,8 @@ }, "callee": { "type": "MemberExpression", - "start": 5898, - "end": 5914, + "start": 5910, + "end": 5926, "loc": { "start": { "line": 226, @@ -10221,8 +10237,8 @@ }, "object": { "type": "Identifier", - "start": 5898, - "end": 5902, + "start": 5910, + "end": 5914, "loc": { "start": { "line": 226, @@ -10238,8 +10254,8 @@ }, "property": { "type": "Identifier", - "start": 5903, - "end": 5914, + "start": 5915, + "end": 5926, "loc": { "start": { "line": 226, @@ -10258,8 +10274,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 5915, - "end": 5929, + "start": 5927, + "end": 5941, "loc": { "start": { "line": 226, @@ -10272,8 +10288,8 @@ }, "object": { "type": "ThisExpression", - "start": 5915, - "end": 5919, + "start": 5927, + "end": 5931, "loc": { "start": { "line": 226, @@ -10287,8 +10303,8 @@ }, "property": { "type": "Identifier", - "start": 5920, - "end": 5929, + "start": 5932, + "end": 5941, "loc": { "start": { "line": 226, @@ -10306,8 +10322,8 @@ }, { "type": "MemberExpression", - "start": 5931, - "end": 5947, + "start": 5943, + "end": 5959, "loc": { "start": { "line": 226, @@ -10320,8 +10336,8 @@ }, "object": { "type": "ThisExpression", - "start": 5931, - "end": 5935, + "start": 5943, + "end": 5947, "loc": { "start": { "line": 226, @@ -10335,8 +10351,8 @@ }, "property": { "type": "Identifier", - "start": 5936, - "end": 5947, + "start": 5948, + "end": 5959, "loc": { "start": { "line": 226, @@ -10354,8 +10370,8 @@ }, { "type": "MemberExpression", - "start": 5949, - "end": 5960, + "start": 5961, + "end": 5972, "loc": { "start": { "line": 226, @@ -10368,8 +10384,8 @@ }, "object": { "type": "ThisExpression", - "start": 5949, - "end": 5953, + "start": 5961, + "end": 5965, "loc": { "start": { "line": 226, @@ -10383,8 +10399,8 @@ }, "property": { "type": "Identifier", - "start": 5954, - "end": 5960, + "start": 5966, + "end": 5972, "loc": { "start": { "line": 226, @@ -10402,8 +10418,8 @@ }, { "type": "MemberExpression", - "start": 5962, - "end": 5979, + "start": 5974, + "end": 5991, "loc": { "start": { "line": 226, @@ -10416,8 +10432,8 @@ }, "object": { "type": "ThisExpression", - "start": 5962, - "end": 5966, + "start": 5974, + "end": 5978, "loc": { "start": { "line": 226, @@ -10431,8 +10447,8 @@ }, "property": { "type": "Identifier", - "start": 5967, - "end": 5979, + "start": 5979, + "end": 5991, "loc": { "start": { "line": 226, @@ -10453,8 +10469,8 @@ }, { "type": "ExpressionStatement", - "start": 5994, - "end": 6025, + "start": 6006, + "end": 6037, "loc": { "start": { "line": 227, @@ -10467,8 +10483,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 5994, - "end": 6024, + "start": 6006, + "end": 6036, "loc": { "start": { "line": 227, @@ -10482,8 +10498,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 5994, - "end": 6016, + "start": 6006, + "end": 6028, "loc": { "start": { "line": 227, @@ -10496,8 +10512,8 @@ }, "object": { "type": "ThisExpression", - "start": 5994, - "end": 5998, + "start": 6006, + "end": 6010, "loc": { "start": { "line": 227, @@ -10511,8 +10527,8 @@ }, "property": { "type": "Identifier", - "start": 5999, - "end": 6016, + "start": 6011, + "end": 6028, "loc": { "start": { "line": 227, @@ -10530,8 +10546,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 6019, - "end": 6024, + "start": 6031, + "end": 6036, "loc": { "start": { "line": 227, @@ -10553,8 +10569,8 @@ }, { "type": "ReturnStatement", - "start": 6044, - "end": 6069, + "start": 6056, + "end": 6081, "loc": { "start": { "line": 229, @@ -10567,8 +10583,8 @@ }, "argument": { "type": "MemberExpression", - "start": 6051, - "end": 6068, + "start": 6063, + "end": 6080, "loc": { "start": { "line": 229, @@ -10581,8 +10597,8 @@ }, "object": { "type": "ThisExpression", - "start": 6051, - "end": 6055, + "start": 6063, + "end": 6067, "loc": { "start": { "line": 229, @@ -10596,8 +10612,8 @@ }, "property": { "type": "Identifier", - "start": 6056, - "end": 6068, + "start": 6068, + "end": 6080, "loc": { "start": { "line": 229, @@ -10622,8 +10638,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 5532, - "end": 5719, + "start": 5544, + "end": 5731, "loc": { "start": { "line": 214, @@ -10640,8 +10656,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n ", - "start": 6081, - "end": 6204, + "start": 6093, + "end": 6216, "loc": { "start": { "line": 232, @@ -10657,8 +10673,8 @@ }, { "type": "ClassMethod", - "start": 6209, - "end": 6354, + "start": 6221, + "end": 6366, "loc": { "start": { "line": 238, @@ -10673,8 +10689,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 6213, - "end": 6224, + "start": 6225, + "end": 6236, "loc": { "start": { "line": 238, @@ -10696,8 +10712,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 6227, - "end": 6354, + "start": 6239, + "end": 6366, "loc": { "start": { "line": 238, @@ -10711,8 +10727,8 @@ "body": [ { "type": "IfStatement", - "start": 6237, - "end": 6314, + "start": 6249, + "end": 6326, "loc": { "start": { "line": 239, @@ -10725,8 +10741,8 @@ }, "test": { "type": "MemberExpression", - "start": 6241, - "end": 6263, + "start": 6253, + "end": 6275, "loc": { "start": { "line": 239, @@ -10739,8 +10755,8 @@ }, "object": { "type": "ThisExpression", - "start": 6241, - "end": 6245, + "start": 6253, + "end": 6257, "loc": { "start": { "line": 239, @@ -10754,8 +10770,8 @@ }, "property": { "type": "Identifier", - "start": 6246, - "end": 6263, + "start": 6258, + "end": 6275, "loc": { "start": { "line": 239, @@ -10773,8 +10789,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 6265, - "end": 6314, + "start": 6277, + "end": 6326, "loc": { "start": { "line": 239, @@ -10788,8 +10804,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6279, - "end": 6304, + "start": 6291, + "end": 6316, "loc": { "start": { "line": 240, @@ -10802,8 +10818,8 @@ }, "expression": { "type": "CallExpression", - "start": 6279, - "end": 6303, + "start": 6291, + "end": 6315, "loc": { "start": { "line": 240, @@ -10816,8 +10832,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6279, - "end": 6301, + "start": 6291, + "end": 6313, "loc": { "start": { "line": 240, @@ -10830,8 +10846,8 @@ }, "object": { "type": "ThisExpression", - "start": 6279, - "end": 6283, + "start": 6291, + "end": 6295, "loc": { "start": { "line": 240, @@ -10845,8 +10861,8 @@ }, "property": { "type": "Identifier", - "start": 6284, - "end": 6301, + "start": 6296, + "end": 6313, "loc": { "start": { "line": 240, @@ -10872,8 +10888,8 @@ }, { "type": "ReturnStatement", - "start": 6323, - "end": 6348, + "start": 6335, + "end": 6360, "loc": { "start": { "line": 242, @@ -10886,8 +10902,8 @@ }, "argument": { "type": "MemberExpression", - "start": 6330, - "end": 6347, + "start": 6342, + "end": 6359, "loc": { "start": { "line": 242, @@ -10900,8 +10916,8 @@ }, "object": { "type": "ThisExpression", - "start": 6330, - "end": 6334, + "start": 6342, + "end": 6346, "loc": { "start": { "line": 242, @@ -10915,8 +10931,8 @@ }, "property": { "type": "Identifier", - "start": 6335, - "end": 6347, + "start": 6347, + "end": 6359, "loc": { "start": { "line": 242, @@ -10941,8 +10957,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n ", - "start": 6081, - "end": 6204, + "start": 6093, + "end": 6216, "loc": { "start": { "line": 232, @@ -10959,8 +10975,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6360, - "end": 6583, + "start": 6372, + "end": 6595, "loc": { "start": { "line": 245, @@ -10976,8 +10992,8 @@ }, { "type": "ClassMethod", - "start": 6588, - "end": 6982, + "start": 6600, + "end": 6994, "loc": { "start": { "line": 251, @@ -10992,8 +11008,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 6588, - "end": 6594, + "start": 6600, + "end": 6606, "loc": { "start": { "line": 251, @@ -11016,8 +11032,8 @@ "params": [ { "type": "Identifier", - "start": 6595, - "end": 6599, + "start": 6607, + "end": 6611, "loc": { "start": { "line": 251, @@ -11033,8 +11049,8 @@ }, { "type": "Identifier", - "start": 6601, - "end": 6606, + "start": 6613, + "end": 6618, "loc": { "start": { "line": 251, @@ -11051,8 +11067,8 @@ ], "body": { "type": "BlockStatement", - "start": 6608, - "end": 6982, + "start": 6620, + "end": 6994, "loc": { "start": { "line": 251, @@ -11066,8 +11082,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 6618, - "end": 6641, + "start": 6630, + "end": 6653, "loc": { "start": { "line": 252, @@ -11080,8 +11096,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6618, - "end": 6640, + "start": 6630, + "end": 6652, "loc": { "start": { "line": 252, @@ -11095,8 +11111,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6618, - "end": 6630, + "start": 6630, + "end": 6642, "loc": { "start": { "line": 252, @@ -11109,8 +11125,8 @@ }, "object": { "type": "Identifier", - "start": 6618, - "end": 6627, + "start": 6630, + "end": 6639, "loc": { "start": { "line": 252, @@ -11126,8 +11142,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6628, - "end": 6629, + "start": 6640, + "end": 6641, "loc": { "start": { "line": 252, @@ -11148,8 +11164,8 @@ }, "right": { "type": "MemberExpression", - "start": 6633, - "end": 6640, + "start": 6645, + "end": 6652, "loc": { "start": { "line": 252, @@ -11162,8 +11178,8 @@ }, "object": { "type": "Identifier", - "start": 6633, - "end": 6637, + "start": 6645, + "end": 6649, "loc": { "start": { "line": 252, @@ -11179,8 +11195,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6638, - "end": 6639, + "start": 6650, + "end": 6651, "loc": { "start": { "line": 252, @@ -11203,8 +11219,8 @@ }, { "type": "ExpressionStatement", - "start": 6650, - "end": 6673, + "start": 6662, + "end": 6685, "loc": { "start": { "line": 253, @@ -11217,8 +11233,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6650, - "end": 6672, + "start": 6662, + "end": 6684, "loc": { "start": { "line": 253, @@ -11232,8 +11248,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6650, - "end": 6662, + "start": 6662, + "end": 6674, "loc": { "start": { "line": 253, @@ -11246,8 +11262,8 @@ }, "object": { "type": "Identifier", - "start": 6650, - "end": 6659, + "start": 6662, + "end": 6671, "loc": { "start": { "line": 253, @@ -11263,8 +11279,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6660, - "end": 6661, + "start": 6672, + "end": 6673, "loc": { "start": { "line": 253, @@ -11285,8 +11301,8 @@ }, "right": { "type": "MemberExpression", - "start": 6665, - "end": 6672, + "start": 6677, + "end": 6684, "loc": { "start": { "line": 253, @@ -11299,8 +11315,8 @@ }, "object": { "type": "Identifier", - "start": 6665, - "end": 6669, + "start": 6677, + "end": 6681, "loc": { "start": { "line": 253, @@ -11316,8 +11332,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6670, - "end": 6671, + "start": 6682, + "end": 6683, "loc": { "start": { "line": 253, @@ -11340,8 +11356,8 @@ }, { "type": "ExpressionStatement", - "start": 6682, - "end": 6705, + "start": 6694, + "end": 6717, "loc": { "start": { "line": 254, @@ -11354,8 +11370,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6682, - "end": 6704, + "start": 6694, + "end": 6716, "loc": { "start": { "line": 254, @@ -11369,8 +11385,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6682, - "end": 6694, + "start": 6694, + "end": 6706, "loc": { "start": { "line": 254, @@ -11383,8 +11399,8 @@ }, "object": { "type": "Identifier", - "start": 6682, - "end": 6691, + "start": 6694, + "end": 6703, "loc": { "start": { "line": 254, @@ -11400,8 +11416,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6692, - "end": 6693, + "start": 6704, + "end": 6705, "loc": { "start": { "line": 254, @@ -11422,8 +11438,8 @@ }, "right": { "type": "MemberExpression", - "start": 6697, - "end": 6704, + "start": 6709, + "end": 6716, "loc": { "start": { "line": 254, @@ -11436,8 +11452,8 @@ }, "object": { "type": "Identifier", - "start": 6697, - "end": 6701, + "start": 6709, + "end": 6713, "loc": { "start": { "line": 254, @@ -11453,8 +11469,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6702, - "end": 6703, + "start": 6714, + "end": 6715, "loc": { "start": { "line": 254, @@ -11477,8 +11493,8 @@ }, { "type": "ExpressionStatement", - "start": 6714, - "end": 6751, + "start": 6726, + "end": 6763, "loc": { "start": { "line": 255, @@ -11491,8 +11507,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6714, - "end": 6750, + "start": 6726, + "end": 6762, "loc": { "start": { "line": 255, @@ -11506,8 +11522,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6714, - "end": 6726, + "start": 6726, + "end": 6738, "loc": { "start": { "line": 255, @@ -11520,8 +11536,8 @@ }, "object": { "type": "Identifier", - "start": 6714, - "end": 6723, + "start": 6726, + "end": 6735, "loc": { "start": { "line": 255, @@ -11537,8 +11553,8 @@ }, "property": { "type": "NumericLiteral", - "start": 6724, - "end": 6725, + "start": 6736, + "end": 6737, "loc": { "start": { "line": 255, @@ -11559,8 +11575,8 @@ }, "right": { "type": "BinaryExpression", - "start": 6729, - "end": 6750, + "start": 6741, + "end": 6762, "loc": { "start": { "line": 255, @@ -11573,8 +11589,8 @@ }, "left": { "type": "Identifier", - "start": 6729, - "end": 6734, + "start": 6741, + "end": 6746, "loc": { "start": { "line": 255, @@ -11591,8 +11607,8 @@ "operator": "*", "right": { "type": "MemberExpression", - "start": 6737, - "end": 6750, + "start": 6749, + "end": 6762, "loc": { "start": { "line": 255, @@ -11605,8 +11621,8 @@ }, "object": { "type": "Identifier", - "start": 6737, - "end": 6741, + "start": 6749, + "end": 6753, "loc": { "start": { "line": 255, @@ -11622,8 +11638,8 @@ }, "property": { "type": "Identifier", - "start": 6742, - "end": 6750, + "start": 6754, + "end": 6762, "loc": { "start": { "line": 255, @@ -11644,8 +11660,8 @@ }, { "type": "ExpressionStatement", - "start": 6760, - "end": 6802, + "start": 6772, + "end": 6814, "loc": { "start": { "line": 256, @@ -11658,8 +11674,8 @@ }, "expression": { "type": "CallExpression", - "start": 6760, - "end": 6801, + "start": 6772, + "end": 6813, "loc": { "start": { "line": 256, @@ -11672,8 +11688,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6760, - "end": 6786, + "start": 6772, + "end": 6798, "loc": { "start": { "line": 256, @@ -11686,8 +11702,8 @@ }, "object": { "type": "Identifier", - "start": 6760, - "end": 6764, + "start": 6772, + "end": 6776, "loc": { "start": { "line": 256, @@ -11703,8 +11719,8 @@ }, "property": { "type": "Identifier", - "start": 6765, - "end": 6786, + "start": 6777, + "end": 6798, "loc": { "start": { "line": 256, @@ -11723,8 +11739,8 @@ "arguments": [ { "type": "Identifier", - "start": 6787, - "end": 6796, + "start": 6799, + "end": 6808, "loc": { "start": { "line": 256, @@ -11740,8 +11756,8 @@ }, { "type": "Identifier", - "start": 6798, - "end": 6800, + "start": 6810, + "end": 6812, "loc": { "start": { "line": 256, @@ -11760,8 +11776,8 @@ }, { "type": "ExpressionStatement", - "start": 6811, - "end": 6856, + "start": 6823, + "end": 6868, "loc": { "start": { "line": 257, @@ -11774,8 +11790,8 @@ }, "expression": { "type": "CallExpression", - "start": 6811, - "end": 6855, + "start": 6823, + "end": 6867, "loc": { "start": { "line": 257, @@ -11788,8 +11804,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6811, - "end": 6830, + "start": 6823, + "end": 6842, "loc": { "start": { "line": 257, @@ -11802,8 +11818,8 @@ }, "object": { "type": "Identifier", - "start": 6811, - "end": 6815, + "start": 6823, + "end": 6827, "loc": { "start": { "line": 257, @@ -11819,8 +11835,8 @@ }, "property": { "type": "Identifier", - "start": 6816, - "end": 6830, + "start": 6828, + "end": 6842, "loc": { "start": { "line": 257, @@ -11839,8 +11855,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 6831, - "end": 6846, + "start": 6843, + "end": 6858, "loc": { "start": { "line": 257, @@ -11853,8 +11869,8 @@ }, "object": { "type": "ThisExpression", - "start": 6831, - "end": 6835, + "start": 6843, + "end": 6847, "loc": { "start": { "line": 257, @@ -11868,8 +11884,8 @@ }, "property": { "type": "Identifier", - "start": 6836, - "end": 6846, + "start": 6848, + "end": 6858, "loc": { "start": { "line": 257, @@ -11887,8 +11903,8 @@ }, { "type": "Identifier", - "start": 6848, - "end": 6850, + "start": 6860, + "end": 6862, "loc": { "start": { "line": 257, @@ -11904,8 +11920,8 @@ }, { "type": "Identifier", - "start": 6852, - "end": 6854, + "start": 6864, + "end": 6866, "loc": { "start": { "line": 257, @@ -11924,8 +11940,8 @@ }, { "type": "ExpressionStatement", - "start": 6865, - "end": 6886, + "start": 6877, + "end": 6898, "loc": { "start": { "line": 258, @@ -11938,8 +11954,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 6865, - "end": 6885, + "start": 6877, + "end": 6897, "loc": { "start": { "line": 258, @@ -11953,8 +11969,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 6865, - "end": 6880, + "start": 6877, + "end": 6892, "loc": { "start": { "line": 258, @@ -11967,8 +11983,8 @@ }, "object": { "type": "ThisExpression", - "start": 6865, - "end": 6869, + "start": 6877, + "end": 6881, "loc": { "start": { "line": 258, @@ -11982,8 +11998,8 @@ }, "property": { "type": "Identifier", - "start": 6870, - "end": 6880, + "start": 6882, + "end": 6892, "loc": { "start": { "line": 258, @@ -12001,8 +12017,8 @@ }, "right": { "type": "Identifier", - "start": 6883, - "end": 6885, + "start": 6895, + "end": 6897, "loc": { "start": { "line": 258, @@ -12020,8 +12036,8 @@ }, { "type": "ExpressionStatement", - "start": 6895, - "end": 6923, + "start": 6907, + "end": 6935, "loc": { "start": { "line": 259, @@ -12034,8 +12050,8 @@ }, "expression": { "type": "CallExpression", - "start": 6895, - "end": 6922, + "start": 6907, + "end": 6934, "loc": { "start": { "line": 259, @@ -12048,8 +12064,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6895, - "end": 6920, + "start": 6907, + "end": 6932, "loc": { "start": { "line": 259, @@ -12062,8 +12078,8 @@ }, "object": { "type": "ThisExpression", - "start": 6895, - "end": 6899, + "start": 6907, + "end": 6911, "loc": { "start": { "line": 259, @@ -12077,8 +12093,8 @@ }, "property": { "type": "Identifier", - "start": 6900, - "end": 6920, + "start": 6912, + "end": 6932, "loc": { "start": { "line": 259, @@ -12099,8 +12115,8 @@ }, { "type": "ExpressionStatement", - "start": 6932, - "end": 6955, + "start": 6944, + "end": 6967, "loc": { "start": { "line": 260, @@ -12113,8 +12129,8 @@ }, "expression": { "type": "CallExpression", - "start": 6932, - "end": 6954, + "start": 6944, + "end": 6966, "loc": { "start": { "line": 260, @@ -12127,8 +12143,8 @@ }, "callee": { "type": "MemberExpression", - "start": 6932, - "end": 6952, + "start": 6944, + "end": 6964, "loc": { "start": { "line": 260, @@ -12141,8 +12157,8 @@ }, "object": { "type": "MemberExpression", - "start": 6932, - "end": 6943, + "start": 6944, + "end": 6955, "loc": { "start": { "line": 260, @@ -12155,8 +12171,8 @@ }, "object": { "type": "ThisExpression", - "start": 6932, - "end": 6936, + "start": 6944, + "end": 6948, "loc": { "start": { "line": 260, @@ -12170,8 +12186,8 @@ }, "property": { "type": "Identifier", - "start": 6937, - "end": 6943, + "start": 6949, + "end": 6955, "loc": { "start": { "line": 260, @@ -12189,8 +12205,8 @@ }, "property": { "type": "Identifier", - "start": 6944, - "end": 6952, + "start": 6956, + "end": 6964, "loc": { "start": { "line": 260, @@ -12211,8 +12227,8 @@ }, { "type": "ReturnStatement", - "start": 6964, - "end": 6976, + "start": 6976, + "end": 6988, "loc": { "start": { "line": 261, @@ -12225,8 +12241,8 @@ }, "argument": { "type": "ThisExpression", - "start": 6971, - "end": 6975, + "start": 6983, + "end": 6987, "loc": { "start": { "line": 261, @@ -12247,8 +12263,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6360, - "end": 6583, + "start": 6372, + "end": 6595, "loc": { "start": { "line": 245, @@ -12265,8 +12281,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6988, - "end": 7223, + "start": 7000, + "end": 7235, "loc": { "start": { "line": 264, @@ -12282,8 +12298,8 @@ }, { "type": "ClassMethod", - "start": 7228, - "end": 7577, + "start": 7240, + "end": 7589, "loc": { "start": { "line": 270, @@ -12298,8 +12314,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7228, - "end": 7245, + "start": 7240, + "end": 7257, "loc": { "start": { "line": 270, @@ -12322,8 +12338,8 @@ "params": [ { "type": "Identifier", - "start": 7246, - "end": 7250, + "start": 7258, + "end": 7262, "loc": { "start": { "line": 270, @@ -12339,8 +12355,8 @@ }, { "type": "Identifier", - "start": 7252, - "end": 7257, + "start": 7264, + "end": 7269, "loc": { "start": { "line": 270, @@ -12357,8 +12373,8 @@ ], "body": { "type": "BlockStatement", - "start": 7259, - "end": 7577, + "start": 7271, + "end": 7589, "loc": { "start": { "line": 270, @@ -12372,8 +12388,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 7269, - "end": 7292, + "start": 7281, + "end": 7304, "loc": { "start": { "line": 271, @@ -12386,8 +12402,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7269, - "end": 7291, + "start": 7281, + "end": 7303, "loc": { "start": { "line": 271, @@ -12401,8 +12417,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7269, - "end": 7281, + "start": 7281, + "end": 7293, "loc": { "start": { "line": 271, @@ -12415,8 +12431,8 @@ }, "object": { "type": "Identifier", - "start": 7269, - "end": 7278, + "start": 7281, + "end": 7290, "loc": { "start": { "line": 271, @@ -12432,8 +12448,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7279, - "end": 7280, + "start": 7291, + "end": 7292, "loc": { "start": { "line": 271, @@ -12454,8 +12470,8 @@ }, "right": { "type": "MemberExpression", - "start": 7284, - "end": 7291, + "start": 7296, + "end": 7303, "loc": { "start": { "line": 271, @@ -12468,8 +12484,8 @@ }, "object": { "type": "Identifier", - "start": 7284, - "end": 7288, + "start": 7296, + "end": 7300, "loc": { "start": { "line": 271, @@ -12485,8 +12501,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7289, - "end": 7290, + "start": 7301, + "end": 7302, "loc": { "start": { "line": 271, @@ -12509,8 +12525,8 @@ }, { "type": "ExpressionStatement", - "start": 7301, - "end": 7324, + "start": 7313, + "end": 7336, "loc": { "start": { "line": 272, @@ -12523,8 +12539,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7301, - "end": 7323, + "start": 7313, + "end": 7335, "loc": { "start": { "line": 272, @@ -12538,8 +12554,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7301, - "end": 7313, + "start": 7313, + "end": 7325, "loc": { "start": { "line": 272, @@ -12552,8 +12568,8 @@ }, "object": { "type": "Identifier", - "start": 7301, - "end": 7310, + "start": 7313, + "end": 7322, "loc": { "start": { "line": 272, @@ -12569,8 +12585,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7311, - "end": 7312, + "start": 7323, + "end": 7324, "loc": { "start": { "line": 272, @@ -12591,8 +12607,8 @@ }, "right": { "type": "MemberExpression", - "start": 7316, - "end": 7323, + "start": 7328, + "end": 7335, "loc": { "start": { "line": 272, @@ -12605,8 +12621,8 @@ }, "object": { "type": "Identifier", - "start": 7316, - "end": 7320, + "start": 7328, + "end": 7332, "loc": { "start": { "line": 272, @@ -12622,8 +12638,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7321, - "end": 7322, + "start": 7333, + "end": 7334, "loc": { "start": { "line": 272, @@ -12646,8 +12662,8 @@ }, { "type": "ExpressionStatement", - "start": 7333, - "end": 7356, + "start": 7345, + "end": 7368, "loc": { "start": { "line": 273, @@ -12660,8 +12676,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7333, - "end": 7355, + "start": 7345, + "end": 7367, "loc": { "start": { "line": 273, @@ -12675,8 +12691,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7333, - "end": 7345, + "start": 7345, + "end": 7357, "loc": { "start": { "line": 273, @@ -12689,8 +12705,8 @@ }, "object": { "type": "Identifier", - "start": 7333, - "end": 7342, + "start": 7345, + "end": 7354, "loc": { "start": { "line": 273, @@ -12706,8 +12722,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7343, - "end": 7344, + "start": 7355, + "end": 7356, "loc": { "start": { "line": 273, @@ -12728,8 +12744,8 @@ }, "right": { "type": "MemberExpression", - "start": 7348, - "end": 7355, + "start": 7360, + "end": 7367, "loc": { "start": { "line": 273, @@ -12742,8 +12758,8 @@ }, "object": { "type": "Identifier", - "start": 7348, - "end": 7352, + "start": 7360, + "end": 7364, "loc": { "start": { "line": 273, @@ -12759,8 +12775,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7353, - "end": 7354, + "start": 7365, + "end": 7366, "loc": { "start": { "line": 273, @@ -12783,8 +12799,8 @@ }, { "type": "ExpressionStatement", - "start": 7365, - "end": 7402, + "start": 7377, + "end": 7414, "loc": { "start": { "line": 274, @@ -12797,8 +12813,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 7365, - "end": 7401, + "start": 7377, + "end": 7413, "loc": { "start": { "line": 274, @@ -12812,8 +12828,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 7365, - "end": 7377, + "start": 7377, + "end": 7389, "loc": { "start": { "line": 274, @@ -12826,8 +12842,8 @@ }, "object": { "type": "Identifier", - "start": 7365, - "end": 7374, + "start": 7377, + "end": 7386, "loc": { "start": { "line": 274, @@ -12843,8 +12859,8 @@ }, "property": { "type": "NumericLiteral", - "start": 7375, - "end": 7376, + "start": 7387, + "end": 7388, "loc": { "start": { "line": 274, @@ -12865,8 +12881,8 @@ }, "right": { "type": "BinaryExpression", - "start": 7380, - "end": 7401, + "start": 7392, + "end": 7413, "loc": { "start": { "line": 274, @@ -12879,8 +12895,8 @@ }, "left": { "type": "Identifier", - "start": 7380, - "end": 7385, + "start": 7392, + "end": 7397, "loc": { "start": { "line": 274, @@ -12897,8 +12913,8 @@ "operator": "*", "right": { "type": "MemberExpression", - "start": 7388, - "end": 7401, + "start": 7400, + "end": 7413, "loc": { "start": { "line": 274, @@ -12911,8 +12927,8 @@ }, "object": { "type": "Identifier", - "start": 7388, - "end": 7392, + "start": 7400, + "end": 7404, "loc": { "start": { "line": 274, @@ -12928,8 +12944,8 @@ }, "property": { "type": "Identifier", - "start": 7393, - "end": 7401, + "start": 7405, + "end": 7413, "loc": { "start": { "line": 274, @@ -12950,8 +12966,8 @@ }, { "type": "ExpressionStatement", - "start": 7411, - "end": 7453, + "start": 7423, + "end": 7465, "loc": { "start": { "line": 275, @@ -12964,8 +12980,8 @@ }, "expression": { "type": "CallExpression", - "start": 7411, - "end": 7452, + "start": 7423, + "end": 7464, "loc": { "start": { "line": 275, @@ -12978,8 +12994,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7411, - "end": 7437, + "start": 7423, + "end": 7449, "loc": { "start": { "line": 275, @@ -12992,8 +13008,8 @@ }, "object": { "type": "Identifier", - "start": 7411, - "end": 7415, + "start": 7423, + "end": 7427, "loc": { "start": { "line": 275, @@ -13009,8 +13025,8 @@ }, "property": { "type": "Identifier", - "start": 7416, - "end": 7437, + "start": 7428, + "end": 7449, "loc": { "start": { "line": 275, @@ -13029,8 +13045,8 @@ "arguments": [ { "type": "Identifier", - "start": 7438, - "end": 7447, + "start": 7450, + "end": 7459, "loc": { "start": { "line": 275, @@ -13046,8 +13062,8 @@ }, { "type": "Identifier", - "start": 7449, - "end": 7451, + "start": 7461, + "end": 7463, "loc": { "start": { "line": 275, @@ -13066,8 +13082,8 @@ }, { "type": "ExpressionStatement", - "start": 7462, - "end": 7507, + "start": 7474, + "end": 7519, "loc": { "start": { "line": 276, @@ -13080,8 +13096,8 @@ }, "expression": { "type": "CallExpression", - "start": 7462, - "end": 7506, + "start": 7474, + "end": 7518, "loc": { "start": { "line": 276, @@ -13094,8 +13110,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7462, - "end": 7481, + "start": 7474, + "end": 7493, "loc": { "start": { "line": 276, @@ -13108,8 +13124,8 @@ }, "object": { "type": "Identifier", - "start": 7462, - "end": 7466, + "start": 7474, + "end": 7478, "loc": { "start": { "line": 276, @@ -13125,8 +13141,8 @@ }, "property": { "type": "Identifier", - "start": 7467, - "end": 7481, + "start": 7479, + "end": 7493, "loc": { "start": { "line": 276, @@ -13145,8 +13161,8 @@ "arguments": [ { "type": "Identifier", - "start": 7482, - "end": 7484, + "start": 7494, + "end": 7496, "loc": { "start": { "line": 276, @@ -13162,8 +13178,8 @@ }, { "type": "MemberExpression", - "start": 7486, - "end": 7501, + "start": 7498, + "end": 7513, "loc": { "start": { "line": 276, @@ -13176,8 +13192,8 @@ }, "object": { "type": "ThisExpression", - "start": 7486, - "end": 7490, + "start": 7498, + "end": 7502, "loc": { "start": { "line": 276, @@ -13191,8 +13207,8 @@ }, "property": { "type": "Identifier", - "start": 7491, - "end": 7501, + "start": 7503, + "end": 7513, "loc": { "start": { "line": 276, @@ -13210,8 +13226,8 @@ }, { "type": "Identifier", - "start": 7503, - "end": 7505, + "start": 7515, + "end": 7517, "loc": { "start": { "line": 276, @@ -13231,8 +13247,8 @@ { "type": "CommentLine", "value": "this.quaternion.premultiply(q1);", - "start": 7516, - "end": 7550, + "start": 7528, + "end": 7562, "loc": { "start": { "line": 277, @@ -13248,8 +13264,8 @@ }, { "type": "ReturnStatement", - "start": 7559, - "end": 7571, + "start": 7571, + "end": 7583, "loc": { "start": { "line": 278, @@ -13262,8 +13278,8 @@ }, "argument": { "type": "ThisExpression", - "start": 7566, - "end": 7570, + "start": 7578, + "end": 7582, "loc": { "start": { "line": 278, @@ -13280,8 +13296,8 @@ { "type": "CommentLine", "value": "this.quaternion.premultiply(q1);", - "start": 7516, - "end": 7550, + "start": 7528, + "end": 7562, "loc": { "start": { "line": 277, @@ -13303,8 +13319,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6988, - "end": 7223, + "start": 7000, + "end": 7235, "loc": { "start": { "line": 264, @@ -13321,8 +13337,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7583, - "end": 7744, + "start": 7595, + "end": 7756, "loc": { "start": { "line": 281, @@ -13338,8 +13354,8 @@ }, { "type": "ClassMethod", - "start": 7749, - "end": 7813, + "start": 7761, + "end": 7825, "loc": { "start": { "line": 286, @@ -13354,8 +13370,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7749, - "end": 7756, + "start": 7761, + "end": 7768, "loc": { "start": { "line": 286, @@ -13378,8 +13394,8 @@ "params": [ { "type": "Identifier", - "start": 7757, - "end": 7762, + "start": 7769, + "end": 7774, "loc": { "start": { "line": 286, @@ -13396,8 +13412,8 @@ ], "body": { "type": "BlockStatement", - "start": 7764, - "end": 7813, + "start": 7776, + "end": 7825, "loc": { "start": { "line": 286, @@ -13411,8 +13427,8 @@ "body": [ { "type": "ReturnStatement", - "start": 7774, - "end": 7807, + "start": 7786, + "end": 7819, "loc": { "start": { "line": 287, @@ -13425,8 +13441,8 @@ }, "argument": { "type": "CallExpression", - "start": 7781, - "end": 7806, + "start": 7793, + "end": 7818, "loc": { "start": { "line": 287, @@ -13439,8 +13455,8 @@ }, "callee": { "type": "MemberExpression", - "start": 7781, - "end": 7792, + "start": 7793, + "end": 7804, "loc": { "start": { "line": 287, @@ -13453,8 +13469,8 @@ }, "object": { "type": "ThisExpression", - "start": 7781, - "end": 7785, + "start": 7793, + "end": 7797, "loc": { "start": { "line": 287, @@ -13468,8 +13484,8 @@ }, "property": { "type": "Identifier", - "start": 7786, - "end": 7792, + "start": 7798, + "end": 7804, "loc": { "start": { "line": 287, @@ -13488,8 +13504,8 @@ "arguments": [ { "type": "Identifier", - "start": 7793, - "end": 7798, + "start": 7805, + "end": 7810, "loc": { "start": { "line": 287, @@ -13505,8 +13521,8 @@ }, { "type": "Identifier", - "start": 7800, - "end": 7805, + "start": 7812, + "end": 7817, "loc": { "start": { "line": 287, @@ -13531,8 +13547,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7583, - "end": 7744, + "start": 7595, + "end": 7756, "loc": { "start": { "line": 281, @@ -13549,8 +13565,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7819, - "end": 7980, + "start": 7831, + "end": 7992, "loc": { "start": { "line": 290, @@ -13566,8 +13582,8 @@ }, { "type": "ClassMethod", - "start": 7985, - "end": 8049, + "start": 7997, + "end": 8061, "loc": { "start": { "line": 295, @@ -13582,8 +13598,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 7985, - "end": 7992, + "start": 7997, + "end": 8004, "loc": { "start": { "line": 295, @@ -13606,8 +13622,8 @@ "params": [ { "type": "Identifier", - "start": 7993, - "end": 7998, + "start": 8005, + "end": 8010, "loc": { "start": { "line": 295, @@ -13624,8 +13640,8 @@ ], "body": { "type": "BlockStatement", - "start": 8000, - "end": 8049, + "start": 8012, + "end": 8061, "loc": { "start": { "line": 295, @@ -13639,8 +13655,8 @@ "body": [ { "type": "ReturnStatement", - "start": 8010, - "end": 8043, + "start": 8022, + "end": 8055, "loc": { "start": { "line": 296, @@ -13653,8 +13669,8 @@ }, "argument": { "type": "CallExpression", - "start": 8017, - "end": 8042, + "start": 8029, + "end": 8054, "loc": { "start": { "line": 296, @@ -13667,8 +13683,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8017, - "end": 8028, + "start": 8029, + "end": 8040, "loc": { "start": { "line": 296, @@ -13681,8 +13697,8 @@ }, "object": { "type": "ThisExpression", - "start": 8017, - "end": 8021, + "start": 8029, + "end": 8033, "loc": { "start": { "line": 296, @@ -13696,8 +13712,8 @@ }, "property": { "type": "Identifier", - "start": 8022, - "end": 8028, + "start": 8034, + "end": 8040, "loc": { "start": { "line": 296, @@ -13716,8 +13732,8 @@ "arguments": [ { "type": "Identifier", - "start": 8029, - "end": 8034, + "start": 8041, + "end": 8046, "loc": { "start": { "line": 296, @@ -13733,8 +13749,8 @@ }, { "type": "Identifier", - "start": 8036, - "end": 8041, + "start": 8048, + "end": 8053, "loc": { "start": { "line": 296, @@ -13759,8 +13775,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7819, - "end": 7980, + "start": 7831, + "end": 7992, "loc": { "start": { "line": 290, @@ -13777,8 +13793,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 8055, - "end": 8216, + "start": 8067, + "end": 8228, "loc": { "start": { "line": 299, @@ -13794,8 +13810,8 @@ }, { "type": "ClassMethod", - "start": 8221, - "end": 8285, + "start": 8233, + "end": 8297, "loc": { "start": { "line": 304, @@ -13810,8 +13826,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 8221, - "end": 8228, + "start": 8233, + "end": 8240, "loc": { "start": { "line": 304, @@ -13834,8 +13850,8 @@ "params": [ { "type": "Identifier", - "start": 8229, - "end": 8234, + "start": 8241, + "end": 8246, "loc": { "start": { "line": 304, @@ -13852,8 +13868,8 @@ ], "body": { "type": "BlockStatement", - "start": 8236, - "end": 8285, + "start": 8248, + "end": 8297, "loc": { "start": { "line": 304, @@ -13867,8 +13883,8 @@ "body": [ { "type": "ReturnStatement", - "start": 8246, - "end": 8279, + "start": 8258, + "end": 8291, "loc": { "start": { "line": 305, @@ -13881,8 +13897,8 @@ }, "argument": { "type": "CallExpression", - "start": 8253, - "end": 8278, + "start": 8265, + "end": 8290, "loc": { "start": { "line": 305, @@ -13895,8 +13911,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8253, - "end": 8264, + "start": 8265, + "end": 8276, "loc": { "start": { "line": 305, @@ -13909,8 +13925,8 @@ }, "object": { "type": "ThisExpression", - "start": 8253, - "end": 8257, + "start": 8265, + "end": 8269, "loc": { "start": { "line": 305, @@ -13924,8 +13940,8 @@ }, "property": { "type": "Identifier", - "start": 8258, - "end": 8264, + "start": 8270, + "end": 8276, "loc": { "start": { "line": 305, @@ -13944,8 +13960,8 @@ "arguments": [ { "type": "Identifier", - "start": 8265, - "end": 8270, + "start": 8277, + "end": 8282, "loc": { "start": { "line": 305, @@ -13961,8 +13977,8 @@ }, { "type": "Identifier", - "start": 8272, - "end": 8277, + "start": 8284, + "end": 8289, "loc": { "start": { "line": 305, @@ -13987,8 +14003,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 8055, - "end": 8216, + "start": 8067, + "end": 8228, "loc": { "start": { "line": 299, @@ -14005,8 +14021,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n ", - "start": 8291, - "end": 8558, + "start": 8303, + "end": 8570, "loc": { "start": { "line": 308, @@ -14022,8 +14038,8 @@ }, { "type": "ClassMethod", - "start": 8563, - "end": 8790, + "start": 8575, + "end": 8802, "loc": { "start": { "line": 314, @@ -14038,8 +14054,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 8563, - "end": 8572, + "start": 8575, + "end": 8584, "loc": { "start": { "line": 314, @@ -14062,8 +14078,8 @@ "params": [ { "type": "Identifier", - "start": 8573, - "end": 8577, + "start": 8585, + "end": 8589, "loc": { "start": { "line": 314, @@ -14080,8 +14096,8 @@ ], "body": { "type": "BlockStatement", - "start": 8579, - "end": 8790, + "start": 8591, + "end": 8802, "loc": { "start": { "line": 314, @@ -14095,8 +14111,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 8589, - "end": 8618, + "start": 8601, + "end": 8630, "loc": { "start": { "line": 315, @@ -14109,8 +14125,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8589, - "end": 8617, + "start": 8601, + "end": 8629, "loc": { "start": { "line": 315, @@ -14124,8 +14140,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 8589, - "end": 8606, + "start": 8601, + "end": 8618, "loc": { "start": { "line": 315, @@ -14138,8 +14154,8 @@ }, "object": { "type": "MemberExpression", - "start": 8589, - "end": 8603, + "start": 8601, + "end": 8615, "loc": { "start": { "line": 315, @@ -14152,8 +14168,8 @@ }, "object": { "type": "ThisExpression", - "start": 8589, - "end": 8593, + "start": 8601, + "end": 8605, "loc": { "start": { "line": 315, @@ -14167,8 +14183,8 @@ }, "property": { "type": "Identifier", - "start": 8594, - "end": 8603, + "start": 8606, + "end": 8615, "loc": { "start": { "line": 315, @@ -14186,8 +14202,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8604, - "end": 8605, + "start": 8616, + "end": 8617, "loc": { "start": { "line": 315, @@ -14208,8 +14224,8 @@ }, "right": { "type": "MemberExpression", - "start": 8610, - "end": 8617, + "start": 8622, + "end": 8629, "loc": { "start": { "line": 315, @@ -14222,8 +14238,8 @@ }, "object": { "type": "Identifier", - "start": 8610, - "end": 8614, + "start": 8622, + "end": 8626, "loc": { "start": { "line": 315, @@ -14239,8 +14255,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8615, - "end": 8616, + "start": 8627, + "end": 8628, "loc": { "start": { "line": 315, @@ -14263,8 +14279,8 @@ }, { "type": "ExpressionStatement", - "start": 8627, - "end": 8656, + "start": 8639, + "end": 8668, "loc": { "start": { "line": 316, @@ -14277,8 +14293,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8627, - "end": 8655, + "start": 8639, + "end": 8667, "loc": { "start": { "line": 316, @@ -14292,8 +14308,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 8627, - "end": 8644, + "start": 8639, + "end": 8656, "loc": { "start": { "line": 316, @@ -14306,8 +14322,8 @@ }, "object": { "type": "MemberExpression", - "start": 8627, - "end": 8641, + "start": 8639, + "end": 8653, "loc": { "start": { "line": 316, @@ -14320,8 +14336,8 @@ }, "object": { "type": "ThisExpression", - "start": 8627, - "end": 8631, + "start": 8639, + "end": 8643, "loc": { "start": { "line": 316, @@ -14335,8 +14351,8 @@ }, "property": { "type": "Identifier", - "start": 8632, - "end": 8641, + "start": 8644, + "end": 8653, "loc": { "start": { "line": 316, @@ -14354,8 +14370,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8642, - "end": 8643, + "start": 8654, + "end": 8655, "loc": { "start": { "line": 316, @@ -14376,8 +14392,8 @@ }, "right": { "type": "MemberExpression", - "start": 8648, - "end": 8655, + "start": 8660, + "end": 8667, "loc": { "start": { "line": 316, @@ -14390,8 +14406,8 @@ }, "object": { "type": "Identifier", - "start": 8648, - "end": 8652, + "start": 8660, + "end": 8664, "loc": { "start": { "line": 316, @@ -14407,8 +14423,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8653, - "end": 8654, + "start": 8665, + "end": 8666, "loc": { "start": { "line": 316, @@ -14431,8 +14447,8 @@ }, { "type": "ExpressionStatement", - "start": 8665, - "end": 8694, + "start": 8677, + "end": 8706, "loc": { "start": { "line": 317, @@ -14445,8 +14461,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 8665, - "end": 8693, + "start": 8677, + "end": 8705, "loc": { "start": { "line": 317, @@ -14460,8 +14476,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 8665, - "end": 8682, + "start": 8677, + "end": 8694, "loc": { "start": { "line": 317, @@ -14474,8 +14490,8 @@ }, "object": { "type": "MemberExpression", - "start": 8665, - "end": 8679, + "start": 8677, + "end": 8691, "loc": { "start": { "line": 317, @@ -14488,8 +14504,8 @@ }, "object": { "type": "ThisExpression", - "start": 8665, - "end": 8669, + "start": 8677, + "end": 8681, "loc": { "start": { "line": 317, @@ -14503,8 +14519,8 @@ }, "property": { "type": "Identifier", - "start": 8670, - "end": 8679, + "start": 8682, + "end": 8691, "loc": { "start": { "line": 317, @@ -14522,8 +14538,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8680, - "end": 8681, + "start": 8692, + "end": 8693, "loc": { "start": { "line": 317, @@ -14544,8 +14560,8 @@ }, "right": { "type": "MemberExpression", - "start": 8686, - "end": 8693, + "start": 8698, + "end": 8705, "loc": { "start": { "line": 317, @@ -14558,8 +14574,8 @@ }, "object": { "type": "Identifier", - "start": 8686, - "end": 8690, + "start": 8698, + "end": 8702, "loc": { "start": { "line": 317, @@ -14575,8 +14591,8 @@ }, "property": { "type": "NumericLiteral", - "start": 8691, - "end": 8692, + "start": 8703, + "end": 8704, "loc": { "start": { "line": 317, @@ -14599,8 +14615,8 @@ }, { "type": "ExpressionStatement", - "start": 8703, - "end": 8731, + "start": 8715, + "end": 8743, "loc": { "start": { "line": 318, @@ -14613,8 +14629,8 @@ }, "expression": { "type": "CallExpression", - "start": 8703, - "end": 8730, + "start": 8715, + "end": 8742, "loc": { "start": { "line": 318, @@ -14627,8 +14643,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8703, - "end": 8728, + "start": 8715, + "end": 8740, "loc": { "start": { "line": 318, @@ -14641,8 +14657,8 @@ }, "object": { "type": "ThisExpression", - "start": 8703, - "end": 8707, + "start": 8715, + "end": 8719, "loc": { "start": { "line": 318, @@ -14656,8 +14672,8 @@ }, "property": { "type": "Identifier", - "start": 8708, - "end": 8728, + "start": 8720, + "end": 8740, "loc": { "start": { "line": 318, @@ -14678,8 +14694,8 @@ }, { "type": "ExpressionStatement", - "start": 8740, - "end": 8763, + "start": 8752, + "end": 8775, "loc": { "start": { "line": 319, @@ -14692,8 +14708,8 @@ }, "expression": { "type": "CallExpression", - "start": 8740, - "end": 8762, + "start": 8752, + "end": 8774, "loc": { "start": { "line": 319, @@ -14706,8 +14722,8 @@ }, "callee": { "type": "MemberExpression", - "start": 8740, - "end": 8760, + "start": 8752, + "end": 8772, "loc": { "start": { "line": 319, @@ -14720,8 +14736,8 @@ }, "object": { "type": "MemberExpression", - "start": 8740, - "end": 8751, + "start": 8752, + "end": 8763, "loc": { "start": { "line": 319, @@ -14734,8 +14750,8 @@ }, "object": { "type": "ThisExpression", - "start": 8740, - "end": 8744, + "start": 8752, + "end": 8756, "loc": { "start": { "line": 319, @@ -14749,8 +14765,8 @@ }, "property": { "type": "Identifier", - "start": 8745, - "end": 8751, + "start": 8757, + "end": 8763, "loc": { "start": { "line": 319, @@ -14768,8 +14784,8 @@ }, "property": { "type": "Identifier", - "start": 8752, - "end": 8760, + "start": 8764, + "end": 8772, "loc": { "start": { "line": 319, @@ -14790,8 +14806,8 @@ }, { "type": "ReturnStatement", - "start": 8772, - "end": 8784, + "start": 8784, + "end": 8796, "loc": { "start": { "line": 320, @@ -14804,8 +14820,8 @@ }, "argument": { "type": "ThisExpression", - "start": 8779, - "end": 8783, + "start": 8791, + "end": 8795, "loc": { "start": { "line": 320, @@ -14826,8 +14842,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n ", - "start": 8291, - "end": 8558, + "start": 8303, + "end": 8570, "loc": { "start": { "line": 308, @@ -14844,8 +14860,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n ", - "start": 8796, - "end": 8976, + "start": 8808, + "end": 8988, "loc": { "start": { "line": 323, @@ -14861,8 +14877,8 @@ }, { "type": "ClassMethod", - "start": 8981, - "end": 9138, + "start": 8993, + "end": 9150, "loc": { "start": { "line": 328, @@ -14877,8 +14893,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 8981, - "end": 8991, + "start": 8993, + "end": 9003, "loc": { "start": { "line": 328, @@ -14901,8 +14917,8 @@ "params": [ { "type": "Identifier", - "start": 8992, - "end": 9000, + "start": 9004, + "end": 9012, "loc": { "start": { "line": 328, @@ -14919,8 +14935,8 @@ ], "body": { "type": "BlockStatement", - "start": 9002, - "end": 9138, + "start": 9014, + "end": 9150, "loc": { "start": { "line": 328, @@ -14934,8 +14950,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9012, - "end": 9042, + "start": 9024, + "end": 9054, "loc": { "start": { "line": 329, @@ -14948,8 +14964,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9012, - "end": 9041, + "start": 9024, + "end": 9053, "loc": { "start": { "line": 329, @@ -14963,8 +14979,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 9012, - "end": 9029, + "start": 9024, + "end": 9041, "loc": { "start": { "line": 329, @@ -14977,8 +14993,8 @@ }, "object": { "type": "MemberExpression", - "start": 9012, - "end": 9026, + "start": 9024, + "end": 9038, "loc": { "start": { "line": 329, @@ -14991,8 +15007,8 @@ }, "object": { "type": "ThisExpression", - "start": 9012, - "end": 9016, + "start": 9024, + "end": 9028, "loc": { "start": { "line": 329, @@ -15006,8 +15022,8 @@ }, "property": { "type": "Identifier", - "start": 9017, - "end": 9026, + "start": 9029, + "end": 9038, "loc": { "start": { "line": 329, @@ -15025,8 +15041,8 @@ }, "property": { "type": "NumericLiteral", - "start": 9027, - "end": 9028, + "start": 9039, + "end": 9040, "loc": { "start": { "line": 329, @@ -15047,8 +15063,8 @@ }, "right": { "type": "Identifier", - "start": 9033, - "end": 9041, + "start": 9045, + "end": 9053, "loc": { "start": { "line": 329, @@ -15066,8 +15082,8 @@ }, { "type": "ExpressionStatement", - "start": 9051, - "end": 9079, + "start": 9063, + "end": 9091, "loc": { "start": { "line": 330, @@ -15080,8 +15096,8 @@ }, "expression": { "type": "CallExpression", - "start": 9051, - "end": 9078, + "start": 9063, + "end": 9090, "loc": { "start": { "line": 330, @@ -15094,8 +15110,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9051, - "end": 9076, + "start": 9063, + "end": 9088, "loc": { "start": { "line": 330, @@ -15108,8 +15124,8 @@ }, "object": { "type": "ThisExpression", - "start": 9051, - "end": 9055, + "start": 9063, + "end": 9067, "loc": { "start": { "line": 330, @@ -15123,8 +15139,8 @@ }, "property": { "type": "Identifier", - "start": 9056, - "end": 9076, + "start": 9068, + "end": 9088, "loc": { "start": { "line": 330, @@ -15145,8 +15161,8 @@ }, { "type": "ExpressionStatement", - "start": 9088, - "end": 9111, + "start": 9100, + "end": 9123, "loc": { "start": { "line": 331, @@ -15159,8 +15175,8 @@ }, "expression": { "type": "CallExpression", - "start": 9088, - "end": 9110, + "start": 9100, + "end": 9122, "loc": { "start": { "line": 331, @@ -15173,8 +15189,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9088, - "end": 9108, + "start": 9100, + "end": 9120, "loc": { "start": { "line": 331, @@ -15187,8 +15203,8 @@ }, "object": { "type": "MemberExpression", - "start": 9088, - "end": 9099, + "start": 9100, + "end": 9111, "loc": { "start": { "line": 331, @@ -15201,8 +15217,8 @@ }, "object": { "type": "ThisExpression", - "start": 9088, - "end": 9092, + "start": 9100, + "end": 9104, "loc": { "start": { "line": 331, @@ -15216,8 +15232,8 @@ }, "property": { "type": "Identifier", - "start": 9093, - "end": 9099, + "start": 9105, + "end": 9111, "loc": { "start": { "line": 331, @@ -15235,8 +15251,8 @@ }, "property": { "type": "Identifier", - "start": 9100, - "end": 9108, + "start": 9112, + "end": 9120, "loc": { "start": { "line": 331, @@ -15257,8 +15273,8 @@ }, { "type": "ReturnStatement", - "start": 9120, - "end": 9132, + "start": 9132, + "end": 9144, "loc": { "start": { "line": 332, @@ -15271,8 +15287,8 @@ }, "argument": { "type": "ThisExpression", - "start": 9127, - "end": 9131, + "start": 9139, + "end": 9143, "loc": { "start": { "line": 332, @@ -15293,8 +15309,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n ", - "start": 8796, - "end": 8976, + "start": 8808, + "end": 8988, "loc": { "start": { "line": 323, @@ -15311,8 +15327,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n ", - "start": 9144, - "end": 9324, + "start": 9156, + "end": 9336, "loc": { "start": { "line": 335, @@ -15328,8 +15344,8 @@ }, { "type": "ClassMethod", - "start": 9329, - "end": 9486, + "start": 9341, + "end": 9498, "loc": { "start": { "line": 340, @@ -15344,8 +15360,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9329, - "end": 9339, + "start": 9341, + "end": 9351, "loc": { "start": { "line": 340, @@ -15368,8 +15384,8 @@ "params": [ { "type": "Identifier", - "start": 9340, - "end": 9348, + "start": 9352, + "end": 9360, "loc": { "start": { "line": 340, @@ -15386,8 +15402,8 @@ ], "body": { "type": "BlockStatement", - "start": 9350, - "end": 9486, + "start": 9362, + "end": 9498, "loc": { "start": { "line": 340, @@ -15401,8 +15417,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9360, - "end": 9390, + "start": 9372, + "end": 9402, "loc": { "start": { "line": 341, @@ -15415,8 +15431,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9360, - "end": 9389, + "start": 9372, + "end": 9401, "loc": { "start": { "line": 341, @@ -15430,8 +15446,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 9360, - "end": 9377, + "start": 9372, + "end": 9389, "loc": { "start": { "line": 341, @@ -15444,8 +15460,8 @@ }, "object": { "type": "MemberExpression", - "start": 9360, - "end": 9374, + "start": 9372, + "end": 9386, "loc": { "start": { "line": 341, @@ -15458,8 +15474,8 @@ }, "object": { "type": "ThisExpression", - "start": 9360, - "end": 9364, + "start": 9372, + "end": 9376, "loc": { "start": { "line": 341, @@ -15473,8 +15489,8 @@ }, "property": { "type": "Identifier", - "start": 9365, - "end": 9374, + "start": 9377, + "end": 9386, "loc": { "start": { "line": 341, @@ -15492,8 +15508,8 @@ }, "property": { "type": "NumericLiteral", - "start": 9375, - "end": 9376, + "start": 9387, + "end": 9388, "loc": { "start": { "line": 341, @@ -15514,8 +15530,8 @@ }, "right": { "type": "Identifier", - "start": 9381, - "end": 9389, + "start": 9393, + "end": 9401, "loc": { "start": { "line": 341, @@ -15533,8 +15549,8 @@ }, { "type": "ExpressionStatement", - "start": 9399, - "end": 9427, + "start": 9411, + "end": 9439, "loc": { "start": { "line": 342, @@ -15547,8 +15563,8 @@ }, "expression": { "type": "CallExpression", - "start": 9399, - "end": 9426, + "start": 9411, + "end": 9438, "loc": { "start": { "line": 342, @@ -15561,8 +15577,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9399, - "end": 9424, + "start": 9411, + "end": 9436, "loc": { "start": { "line": 342, @@ -15575,8 +15591,8 @@ }, "object": { "type": "ThisExpression", - "start": 9399, - "end": 9403, + "start": 9411, + "end": 9415, "loc": { "start": { "line": 342, @@ -15590,8 +15606,8 @@ }, "property": { "type": "Identifier", - "start": 9404, - "end": 9424, + "start": 9416, + "end": 9436, "loc": { "start": { "line": 342, @@ -15612,8 +15628,8 @@ }, { "type": "ExpressionStatement", - "start": 9436, - "end": 9459, + "start": 9448, + "end": 9471, "loc": { "start": { "line": 343, @@ -15626,8 +15642,8 @@ }, "expression": { "type": "CallExpression", - "start": 9436, - "end": 9458, + "start": 9448, + "end": 9470, "loc": { "start": { "line": 343, @@ -15640,8 +15656,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9436, - "end": 9456, + "start": 9448, + "end": 9468, "loc": { "start": { "line": 343, @@ -15654,8 +15670,8 @@ }, "object": { "type": "MemberExpression", - "start": 9436, - "end": 9447, + "start": 9448, + "end": 9459, "loc": { "start": { "line": 343, @@ -15668,8 +15684,8 @@ }, "object": { "type": "ThisExpression", - "start": 9436, - "end": 9440, + "start": 9448, + "end": 9452, "loc": { "start": { "line": 343, @@ -15683,8 +15699,8 @@ }, "property": { "type": "Identifier", - "start": 9441, - "end": 9447, + "start": 9453, + "end": 9459, "loc": { "start": { "line": 343, @@ -15702,8 +15718,8 @@ }, "property": { "type": "Identifier", - "start": 9448, - "end": 9456, + "start": 9460, + "end": 9468, "loc": { "start": { "line": 343, @@ -15724,8 +15740,8 @@ }, { "type": "ReturnStatement", - "start": 9468, - "end": 9480, + "start": 9480, + "end": 9492, "loc": { "start": { "line": 344, @@ -15738,8 +15754,8 @@ }, "argument": { "type": "ThisExpression", - "start": 9475, - "end": 9479, + "start": 9487, + "end": 9491, "loc": { "start": { "line": 344, @@ -15760,8 +15776,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n ", - "start": 9144, - "end": 9324, + "start": 9156, + "end": 9336, "loc": { "start": { "line": 335, @@ -15778,8 +15794,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n ", - "start": 9492, - "end": 9672, + "start": 9504, + "end": 9684, "loc": { "start": { "line": 347, @@ -15795,8 +15811,8 @@ }, { "type": "ClassMethod", - "start": 9677, - "end": 9834, + "start": 9689, + "end": 9846, "loc": { "start": { "line": 352, @@ -15811,8 +15827,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9677, - "end": 9687, + "start": 9689, + "end": 9699, "loc": { "start": { "line": 352, @@ -15835,8 +15851,8 @@ "params": [ { "type": "Identifier", - "start": 9688, - "end": 9696, + "start": 9700, + "end": 9708, "loc": { "start": { "line": 352, @@ -15853,8 +15869,8 @@ ], "body": { "type": "BlockStatement", - "start": 9698, - "end": 9834, + "start": 9710, + "end": 9846, "loc": { "start": { "line": 352, @@ -15868,8 +15884,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9708, - "end": 9738, + "start": 9720, + "end": 9750, "loc": { "start": { "line": 353, @@ -15882,8 +15898,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9708, - "end": 9737, + "start": 9720, + "end": 9749, "loc": { "start": { "line": 353, @@ -15897,8 +15913,8 @@ "operator": "+=", "left": { "type": "MemberExpression", - "start": 9708, - "end": 9725, + "start": 9720, + "end": 9737, "loc": { "start": { "line": 353, @@ -15911,8 +15927,8 @@ }, "object": { "type": "MemberExpression", - "start": 9708, - "end": 9722, + "start": 9720, + "end": 9734, "loc": { "start": { "line": 353, @@ -15925,8 +15941,8 @@ }, "object": { "type": "ThisExpression", - "start": 9708, - "end": 9712, + "start": 9720, + "end": 9724, "loc": { "start": { "line": 353, @@ -15940,8 +15956,8 @@ }, "property": { "type": "Identifier", - "start": 9713, - "end": 9722, + "start": 9725, + "end": 9734, "loc": { "start": { "line": 353, @@ -15959,8 +15975,8 @@ }, "property": { "type": "NumericLiteral", - "start": 9723, - "end": 9724, + "start": 9735, + "end": 9736, "loc": { "start": { "line": 353, @@ -15981,8 +15997,8 @@ }, "right": { "type": "Identifier", - "start": 9729, - "end": 9737, + "start": 9741, + "end": 9749, "loc": { "start": { "line": 353, @@ -16000,8 +16016,8 @@ }, { "type": "ExpressionStatement", - "start": 9747, - "end": 9775, + "start": 9759, + "end": 9787, "loc": { "start": { "line": 354, @@ -16014,8 +16030,8 @@ }, "expression": { "type": "CallExpression", - "start": 9747, - "end": 9774, + "start": 9759, + "end": 9786, "loc": { "start": { "line": 354, @@ -16028,8 +16044,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9747, - "end": 9772, + "start": 9759, + "end": 9784, "loc": { "start": { "line": 354, @@ -16042,8 +16058,8 @@ }, "object": { "type": "ThisExpression", - "start": 9747, - "end": 9751, + "start": 9759, + "end": 9763, "loc": { "start": { "line": 354, @@ -16057,8 +16073,8 @@ }, "property": { "type": "Identifier", - "start": 9752, - "end": 9772, + "start": 9764, + "end": 9784, "loc": { "start": { "line": 354, @@ -16079,8 +16095,8 @@ }, { "type": "ExpressionStatement", - "start": 9784, - "end": 9807, + "start": 9796, + "end": 9819, "loc": { "start": { "line": 355, @@ -16093,8 +16109,8 @@ }, "expression": { "type": "CallExpression", - "start": 9784, - "end": 9806, + "start": 9796, + "end": 9818, "loc": { "start": { "line": 355, @@ -16107,8 +16123,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9784, - "end": 9804, + "start": 9796, + "end": 9816, "loc": { "start": { "line": 355, @@ -16121,8 +16137,8 @@ }, "object": { "type": "MemberExpression", - "start": 9784, - "end": 9795, + "start": 9796, + "end": 9807, "loc": { "start": { "line": 355, @@ -16135,8 +16151,8 @@ }, "object": { "type": "ThisExpression", - "start": 9784, - "end": 9788, + "start": 9796, + "end": 9800, "loc": { "start": { "line": 355, @@ -16150,8 +16166,8 @@ }, "property": { "type": "Identifier", - "start": 9789, - "end": 9795, + "start": 9801, + "end": 9807, "loc": { "start": { "line": 355, @@ -16169,8 +16185,8 @@ }, "property": { "type": "Identifier", - "start": 9796, - "end": 9804, + "start": 9808, + "end": 9816, "loc": { "start": { "line": 355, @@ -16191,8 +16207,8 @@ }, { "type": "ReturnStatement", - "start": 9816, - "end": 9828, + "start": 9828, + "end": 9840, "loc": { "start": { "line": 356, @@ -16205,8 +16221,8 @@ }, "argument": { "type": "ThisExpression", - "start": 9823, - "end": 9827, + "start": 9835, + "end": 9839, "loc": { "start": { "line": 356, @@ -16226,8 +16242,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n ", - "start": 9492, - "end": 9672, + "start": 9504, + "end": 9684, "loc": { "start": { "line": 347, @@ -16243,8 +16259,8 @@ }, { "type": "ClassMethod", - "start": 9840, - "end": 9941, + "start": 9852, + "end": 9953, "loc": { "start": { "line": 359, @@ -16259,8 +16275,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9840, - "end": 9860, + "start": 9852, + "end": 9872, "loc": { "start": { "line": 359, @@ -16282,8 +16298,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 9863, - "end": 9941, + "start": 9875, + "end": 9953, "loc": { "start": { "line": 359, @@ -16297,8 +16313,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9873, - "end": 9903, + "start": 9885, + "end": 9915, "loc": { "start": { "line": 360, @@ -16311,8 +16327,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9873, - "end": 9902, + "start": 9885, + "end": 9914, "loc": { "start": { "line": 360, @@ -16326,8 +16342,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9873, - "end": 9895, + "start": 9885, + "end": 9907, "loc": { "start": { "line": 360, @@ -16340,8 +16356,8 @@ }, "object": { "type": "ThisExpression", - "start": 9873, - "end": 9877, + "start": 9885, + "end": 9889, "loc": { "start": { "line": 360, @@ -16355,8 +16371,8 @@ }, "property": { "type": "Identifier", - "start": 9878, - "end": 9895, + "start": 9890, + "end": 9907, "loc": { "start": { "line": 360, @@ -16374,8 +16390,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 9898, - "end": 9902, + "start": 9910, + "end": 9914, "loc": { "start": { "line": 360, @@ -16392,8 +16408,8 @@ }, { "type": "ExpressionStatement", - "start": 9912, - "end": 9935, + "start": 9924, + "end": 9947, "loc": { "start": { "line": 361, @@ -16406,8 +16422,8 @@ }, "expression": { "type": "CallExpression", - "start": 9912, - "end": 9934, + "start": 9924, + "end": 9946, "loc": { "start": { "line": 361, @@ -16420,8 +16436,8 @@ }, "callee": { "type": "MemberExpression", - "start": 9912, - "end": 9932, + "start": 9924, + "end": 9944, "loc": { "start": { "line": 361, @@ -16434,8 +16450,8 @@ }, "object": { "type": "ThisExpression", - "start": 9912, - "end": 9916, + "start": 9924, + "end": 9928, "loc": { "start": { "line": 361, @@ -16449,8 +16465,8 @@ }, "property": { "type": "Identifier", - "start": 9917, - "end": 9932, + "start": 9929, + "end": 9944, "loc": { "start": { "line": 361, @@ -16475,8 +16491,8 @@ }, { "type": "ClassMethod", - "start": 9947, - "end": 10714, + "start": 9959, + "end": 10726, "loc": { "start": { "line": 364, @@ -16491,8 +16507,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 9947, - "end": 9962, + "start": 9959, + "end": 9974, "loc": { "start": { "line": 364, @@ -16514,8 +16530,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 9965, - "end": 10714, + "start": 9977, + "end": 10726, "loc": { "start": { "line": 364, @@ -16529,8 +16545,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 9975, - "end": 10005, + "start": 9987, + "end": 10017, "loc": { "start": { "line": 365, @@ -16543,8 +16559,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 9975, - "end": 10004, + "start": 9987, + "end": 10016, "loc": { "start": { "line": 365, @@ -16558,8 +16574,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 9975, - "end": 9997, + "start": 9987, + "end": 10009, "loc": { "start": { "line": 365, @@ -16572,8 +16588,8 @@ }, "object": { "type": "ThisExpression", - "start": 9975, - "end": 9979, + "start": 9987, + "end": 9991, "loc": { "start": { "line": 365, @@ -16587,8 +16603,8 @@ }, "property": { "type": "Identifier", - "start": 9980, - "end": 9997, + "start": 9992, + "end": 10009, "loc": { "start": { "line": 365, @@ -16606,8 +16622,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 10000, - "end": 10004, + "start": 10012, + "end": 10016, "loc": { "start": { "line": 365, @@ -16624,8 +16640,8 @@ }, { "type": "ForStatement", - "start": 10014, - "end": 10477, + "start": 10026, + "end": 10489, "loc": { "start": { "line": 366, @@ -16638,8 +16654,8 @@ }, "init": { "type": "VariableDeclaration", - "start": 10019, - "end": 10064, + "start": 10031, + "end": 10076, "loc": { "start": { "line": 366, @@ -16653,8 +16669,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10023, - "end": 10028, + "start": 10035, + "end": 10040, "loc": { "start": { "line": 366, @@ -16667,8 +16683,8 @@ }, "id": { "type": "Identifier", - "start": 10023, - "end": 10024, + "start": 10035, + "end": 10036, "loc": { "start": { "line": 366, @@ -16684,8 +16700,8 @@ }, "init": { "type": "NumericLiteral", - "start": 10027, - "end": 10028, + "start": 10039, + "end": 10040, "loc": { "start": { "line": 366, @@ -16705,8 +16721,8 @@ }, { "type": "VariableDeclarator", - "start": 10030, - "end": 10064, + "start": 10042, + "end": 10076, "loc": { "start": { "line": 366, @@ -16719,8 +16735,8 @@ }, "id": { "type": "Identifier", - "start": 10030, - "end": 10033, + "start": 10042, + "end": 10045, "loc": { "start": { "line": 366, @@ -16736,8 +16752,8 @@ }, "init": { "type": "MemberExpression", - "start": 10036, - "end": 10064, + "start": 10048, + "end": 10076, "loc": { "start": { "line": 366, @@ -16750,8 +16766,8 @@ }, "object": { "type": "MemberExpression", - "start": 10036, - "end": 10057, + "start": 10048, + "end": 10069, "loc": { "start": { "line": 366, @@ -16764,8 +16780,8 @@ }, "object": { "type": "ThisExpression", - "start": 10036, - "end": 10040, + "start": 10048, + "end": 10052, "loc": { "start": { "line": 366, @@ -16779,8 +16795,8 @@ }, "property": { "type": "Identifier", - "start": 10041, - "end": 10057, + "start": 10053, + "end": 10069, "loc": { "start": { "line": 366, @@ -16798,8 +16814,8 @@ }, "property": { "type": "Identifier", - "start": 10058, - "end": 10064, + "start": 10070, + "end": 10076, "loc": { "start": { "line": 366, @@ -16821,8 +16837,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10066, - "end": 10073, + "start": 10078, + "end": 10085, "loc": { "start": { "line": 366, @@ -16835,8 +16851,8 @@ }, "left": { "type": "Identifier", - "start": 10066, - "end": 10067, + "start": 10078, + "end": 10079, "loc": { "start": { "line": 366, @@ -16853,8 +16869,8 @@ "operator": "<", "right": { "type": "Identifier", - "start": 10070, - "end": 10073, + "start": 10082, + "end": 10085, "loc": { "start": { "line": 366, @@ -16871,8 +16887,8 @@ }, "update": { "type": "UpdateExpression", - "start": 10075, - "end": 10078, + "start": 10087, + "end": 10090, "loc": { "start": { "line": 366, @@ -16887,8 +16903,8 @@ "prefix": false, "argument": { "type": "Identifier", - "start": 10075, - "end": 10076, + "start": 10087, + "end": 10088, "loc": { "start": { "line": 366, @@ -16905,8 +16921,8 @@ }, "body": { "type": "BlockStatement", - "start": 10080, - "end": 10477, + "start": 10092, + "end": 10489, "loc": { "start": { "line": 366, @@ -16920,8 +16936,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10094, - "end": 10142, + "start": 10106, + "end": 10154, "loc": { "start": { "line": 367, @@ -16935,8 +16951,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10100, - "end": 10141, + "start": 10112, + "end": 10153, "loc": { "start": { "line": 367, @@ -16949,8 +16965,8 @@ }, "id": { "type": "Identifier", - "start": 10100, - "end": 10114, + "start": 10112, + "end": 10126, "loc": { "start": { "line": 367, @@ -16966,8 +16982,8 @@ }, "init": { "type": "MemberExpression", - "start": 10117, - "end": 10141, + "start": 10129, + "end": 10153, "loc": { "start": { "line": 367, @@ -16980,8 +16996,8 @@ }, "object": { "type": "MemberExpression", - "start": 10117, - "end": 10138, + "start": 10129, + "end": 10150, "loc": { "start": { "line": 367, @@ -16994,8 +17010,8 @@ }, "object": { "type": "ThisExpression", - "start": 10117, - "end": 10121, + "start": 10129, + "end": 10133, "loc": { "start": { "line": 367, @@ -17009,8 +17025,8 @@ }, "property": { "type": "Identifier", - "start": 10122, - "end": 10138, + "start": 10134, + "end": 10150, "loc": { "start": { "line": 367, @@ -17028,8 +17044,8 @@ }, "property": { "type": "Identifier", - "start": 10139, - "end": 10140, + "start": 10151, + "end": 10152, "loc": { "start": { "line": 367, @@ -17051,8 +17067,8 @@ }, { "type": "ExpressionStatement", - "start": 10155, - "end": 10188, + "start": 10167, + "end": 10200, "loc": { "start": { "line": 368, @@ -17065,8 +17081,8 @@ }, "expression": { "type": "CallExpression", - "start": 10155, - "end": 10187, + "start": 10167, + "end": 10199, "loc": { "start": { "line": 368, @@ -17079,8 +17095,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10155, - "end": 10185, + "start": 10167, + "end": 10197, "loc": { "start": { "line": 368, @@ -17093,8 +17109,8 @@ }, "object": { "type": "Identifier", - "start": 10155, - "end": 10169, + "start": 10167, + "end": 10181, "loc": { "start": { "line": 368, @@ -17110,8 +17126,8 @@ }, "property": { "type": "Identifier", - "start": 10170, - "end": 10185, + "start": 10182, + "end": 10197, "loc": { "start": { "line": 368, @@ -17132,8 +17148,8 @@ }, { "type": "IfStatement", - "start": 10201, - "end": 10467, + "start": 10213, + "end": 10479, "loc": { "start": { "line": 369, @@ -17146,8 +17162,8 @@ }, "test": { "type": "LogicalExpression", - "start": 10205, - "end": 10264, + "start": 10217, + "end": 10276, "loc": { "start": { "line": 369, @@ -17160,8 +17176,8 @@ }, "left": { "type": "MemberExpression", - "start": 10205, - "end": 10227, + "start": 10217, + "end": 10239, "loc": { "start": { "line": 369, @@ -17174,8 +17190,8 @@ }, "object": { "type": "Identifier", - "start": 10205, - "end": 10219, + "start": 10217, + "end": 10231, "loc": { "start": { "line": 369, @@ -17191,8 +17207,8 @@ }, "property": { "type": "Identifier", - "start": 10220, - "end": 10227, + "start": 10232, + "end": 10239, "loc": { "start": { "line": 369, @@ -17211,8 +17227,8 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 10231, - "end": 10264, + "start": 10243, + "end": 10276, "loc": { "start": { "line": 369, @@ -17225,8 +17241,8 @@ }, "left": { "type": "MemberExpression", - "start": 10231, - "end": 10260, + "start": 10243, + "end": 10272, "loc": { "start": { "line": 369, @@ -17239,8 +17255,8 @@ }, "object": { "type": "MemberExpression", - "start": 10231, - "end": 10253, + "start": 10243, + "end": 10265, "loc": { "start": { "line": 369, @@ -17253,8 +17269,8 @@ }, "object": { "type": "Identifier", - "start": 10231, - "end": 10245, + "start": 10243, + "end": 10257, "loc": { "start": { "line": 369, @@ -17270,8 +17286,8 @@ }, "property": { "type": "Identifier", - "start": 10246, - "end": 10253, + "start": 10258, + "end": 10265, "loc": { "start": { "line": 369, @@ -17289,8 +17305,8 @@ }, "property": { "type": "Identifier", - "start": 10254, - "end": 10260, + "start": 10266, + "end": 10272, "loc": { "start": { "line": 369, @@ -17309,8 +17325,8 @@ "operator": ">", "right": { "type": "NumericLiteral", - "start": 10263, - "end": 10264, + "start": 10275, + "end": 10276, "loc": { "start": { "line": 369, @@ -17331,8 +17347,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10266, - "end": 10467, + "start": 10278, + "end": 10479, "loc": { "start": { "line": 369, @@ -17346,8 +17362,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10283, - "end": 10321, + "start": 10295, + "end": 10333, "loc": { "start": { "line": 370, @@ -17361,8 +17377,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10289, - "end": 10320, + "start": 10301, + "end": 10332, "loc": { "start": { "line": 370, @@ -17375,8 +17391,8 @@ }, "id": { "type": "Identifier", - "start": 10289, - "end": 10295, + "start": 10301, + "end": 10307, "loc": { "start": { "line": 370, @@ -17392,8 +17408,8 @@ }, "init": { "type": "MemberExpression", - "start": 10298, - "end": 10320, + "start": 10310, + "end": 10332, "loc": { "start": { "line": 370, @@ -17406,8 +17422,8 @@ }, "object": { "type": "Identifier", - "start": 10298, - "end": 10312, + "start": 10310, + "end": 10324, "loc": { "start": { "line": 370, @@ -17423,8 +17439,8 @@ }, "property": { "type": "Identifier", - "start": 10313, - "end": 10320, + "start": 10325, + "end": 10332, "loc": { "start": { "line": 370, @@ -17446,8 +17462,8 @@ }, { "type": "ForStatement", - "start": 10337, - "end": 10453, + "start": 10349, + "end": 10465, "loc": { "start": { "line": 371, @@ -17460,8 +17476,8 @@ }, "init": { "type": "VariableDeclaration", - "start": 10342, - "end": 10372, + "start": 10354, + "end": 10384, "loc": { "start": { "line": 371, @@ -17475,8 +17491,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10346, - "end": 10350, + "start": 10358, + "end": 10362, "loc": { "start": { "line": 371, @@ -17489,8 +17505,8 @@ }, "id": { "type": "Identifier", - "start": 10346, - "end": 10347, + "start": 10358, + "end": 10359, "loc": { "start": { "line": 371, @@ -17506,8 +17522,8 @@ }, "init": { "type": "NumericLiteral", - "start": 10349, - "end": 10350, + "start": 10361, + "end": 10362, "loc": { "start": { "line": 371, @@ -17527,8 +17543,8 @@ }, { "type": "VariableDeclarator", - "start": 10352, - "end": 10372, + "start": 10364, + "end": 10384, "loc": { "start": { "line": 371, @@ -17541,8 +17557,8 @@ }, "id": { "type": "Identifier", - "start": 10352, - "end": 10356, + "start": 10364, + "end": 10368, "loc": { "start": { "line": 371, @@ -17558,8 +17574,8 @@ }, "init": { "type": "MemberExpression", - "start": 10359, - "end": 10372, + "start": 10371, + "end": 10384, "loc": { "start": { "line": 371, @@ -17572,8 +17588,8 @@ }, "object": { "type": "Identifier", - "start": 10359, - "end": 10365, + "start": 10371, + "end": 10377, "loc": { "start": { "line": 371, @@ -17589,8 +17605,8 @@ }, "property": { "type": "Identifier", - "start": 10366, - "end": 10372, + "start": 10378, + "end": 10384, "loc": { "start": { "line": 371, @@ -17612,8 +17628,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10374, - "end": 10382, + "start": 10386, + "end": 10394, "loc": { "start": { "line": 371, @@ -17626,8 +17642,8 @@ }, "left": { "type": "Identifier", - "start": 10374, - "end": 10375, + "start": 10386, + "end": 10387, "loc": { "start": { "line": 371, @@ -17644,8 +17660,8 @@ "operator": "<", "right": { "type": "Identifier", - "start": 10378, - "end": 10382, + "start": 10390, + "end": 10394, "loc": { "start": { "line": 371, @@ -17662,8 +17678,8 @@ }, "update": { "type": "UpdateExpression", - "start": 10384, - "end": 10387, + "start": 10396, + "end": 10399, "loc": { "start": { "line": 371, @@ -17678,8 +17694,8 @@ "prefix": false, "argument": { "type": "Identifier", - "start": 10384, - "end": 10385, + "start": 10396, + "end": 10397, "loc": { "start": { "line": 371, @@ -17696,8 +17712,8 @@ }, "body": { "type": "BlockStatement", - "start": 10389, - "end": 10453, + "start": 10401, + "end": 10465, "loc": { "start": { "line": 371, @@ -17711,8 +17727,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10408, - "end": 10436, + "start": 10420, + "end": 10448, "loc": { "start": { "line": 372, @@ -17725,8 +17741,8 @@ }, "expression": { "type": "CallExpression", - "start": 10408, - "end": 10435, + "start": 10420, + "end": 10447, "loc": { "start": { "line": 372, @@ -17739,8 +17755,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10408, - "end": 10433, + "start": 10420, + "end": 10445, "loc": { "start": { "line": 372, @@ -17753,8 +17769,8 @@ }, "object": { "type": "MemberExpression", - "start": 10408, - "end": 10417, + "start": 10420, + "end": 10429, "loc": { "start": { "line": 372, @@ -17767,8 +17783,8 @@ }, "object": { "type": "Identifier", - "start": 10408, - "end": 10414, + "start": 10420, + "end": 10426, "loc": { "start": { "line": 372, @@ -17784,8 +17800,8 @@ }, "property": { "type": "Identifier", - "start": 10415, - "end": 10416, + "start": 10427, + "end": 10428, "loc": { "start": { "line": 372, @@ -17803,8 +17819,8 @@ }, "property": { "type": "Identifier", - "start": 10418, - "end": 10433, + "start": 10430, + "end": 10445, "loc": { "start": { "line": 372, @@ -17838,8 +17854,8 @@ }, { "type": "IfStatement", - "start": 10486, - "end": 10708, + "start": 10498, + "end": 10720, "loc": { "start": { "line": 376, @@ -17852,8 +17868,8 @@ }, "test": { "type": "LogicalExpression", - "start": 10490, - "end": 10529, + "start": 10502, + "end": 10541, "loc": { "start": { "line": 376, @@ -17866,8 +17882,8 @@ }, "left": { "type": "MemberExpression", - "start": 10490, - "end": 10502, + "start": 10502, + "end": 10514, "loc": { "start": { "line": 376, @@ -17880,8 +17896,8 @@ }, "object": { "type": "ThisExpression", - "start": 10490, - "end": 10494, + "start": 10502, + "end": 10506, "loc": { "start": { "line": 376, @@ -17895,8 +17911,8 @@ }, "property": { "type": "Identifier", - "start": 10495, - "end": 10502, + "start": 10507, + "end": 10514, "loc": { "start": { "line": 376, @@ -17915,8 +17931,8 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 10506, - "end": 10529, + "start": 10518, + "end": 10541, "loc": { "start": { "line": 376, @@ -17929,8 +17945,8 @@ }, "left": { "type": "MemberExpression", - "start": 10506, - "end": 10525, + "start": 10518, + "end": 10537, "loc": { "start": { "line": 376, @@ -17943,8 +17959,8 @@ }, "object": { "type": "MemberExpression", - "start": 10506, - "end": 10518, + "start": 10518, + "end": 10530, "loc": { "start": { "line": 376, @@ -17957,8 +17973,8 @@ }, "object": { "type": "ThisExpression", - "start": 10506, - "end": 10510, + "start": 10518, + "end": 10522, "loc": { "start": { "line": 376, @@ -17972,8 +17988,8 @@ }, "property": { "type": "Identifier", - "start": 10511, - "end": 10518, + "start": 10523, + "end": 10530, "loc": { "start": { "line": 376, @@ -17991,8 +18007,8 @@ }, "property": { "type": "Identifier", - "start": 10519, - "end": 10525, + "start": 10531, + "end": 10537, "loc": { "start": { "line": 376, @@ -18011,8 +18027,8 @@ "operator": ">", "right": { "type": "NumericLiteral", - "start": 10528, - "end": 10529, + "start": 10540, + "end": 10541, "loc": { "start": { "line": 376, @@ -18033,8 +18049,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10531, - "end": 10708, + "start": 10543, + "end": 10720, "loc": { "start": { "line": 376, @@ -18048,8 +18064,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10545, - "end": 10573, + "start": 10557, + "end": 10585, "loc": { "start": { "line": 377, @@ -18063,8 +18079,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10551, - "end": 10572, + "start": 10563, + "end": 10584, "loc": { "start": { "line": 377, @@ -18077,8 +18093,8 @@ }, "id": { "type": "Identifier", - "start": 10551, - "end": 10557, + "start": 10563, + "end": 10569, "loc": { "start": { "line": 377, @@ -18094,8 +18110,8 @@ }, "init": { "type": "MemberExpression", - "start": 10560, - "end": 10572, + "start": 10572, + "end": 10584, "loc": { "start": { "line": 377, @@ -18108,8 +18124,8 @@ }, "object": { "type": "ThisExpression", - "start": 10560, - "end": 10564, + "start": 10572, + "end": 10576, "loc": { "start": { "line": 377, @@ -18123,8 +18139,8 @@ }, "property": { "type": "Identifier", - "start": 10565, - "end": 10572, + "start": 10577, + "end": 10584, "loc": { "start": { "line": 377, @@ -18146,8 +18162,8 @@ }, { "type": "ForStatement", - "start": 10586, - "end": 10698, + "start": 10598, + "end": 10710, "loc": { "start": { "line": 378, @@ -18160,8 +18176,8 @@ }, "init": { "type": "VariableDeclaration", - "start": 10591, - "end": 10621, + "start": 10603, + "end": 10633, "loc": { "start": { "line": 378, @@ -18175,8 +18191,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10595, - "end": 10599, + "start": 10607, + "end": 10611, "loc": { "start": { "line": 378, @@ -18189,8 +18205,8 @@ }, "id": { "type": "Identifier", - "start": 10595, - "end": 10596, + "start": 10607, + "end": 10608, "loc": { "start": { "line": 378, @@ -18206,8 +18222,8 @@ }, "init": { "type": "NumericLiteral", - "start": 10598, - "end": 10599, + "start": 10610, + "end": 10611, "loc": { "start": { "line": 378, @@ -18227,8 +18243,8 @@ }, { "type": "VariableDeclarator", - "start": 10601, - "end": 10621, + "start": 10613, + "end": 10633, "loc": { "start": { "line": 378, @@ -18241,8 +18257,8 @@ }, "id": { "type": "Identifier", - "start": 10601, - "end": 10605, + "start": 10613, + "end": 10617, "loc": { "start": { "line": 378, @@ -18258,8 +18274,8 @@ }, "init": { "type": "MemberExpression", - "start": 10608, - "end": 10621, + "start": 10620, + "end": 10633, "loc": { "start": { "line": 378, @@ -18272,8 +18288,8 @@ }, "object": { "type": "Identifier", - "start": 10608, - "end": 10614, + "start": 10620, + "end": 10626, "loc": { "start": { "line": 378, @@ -18289,8 +18305,8 @@ }, "property": { "type": "Identifier", - "start": 10615, - "end": 10621, + "start": 10627, + "end": 10633, "loc": { "start": { "line": 378, @@ -18312,8 +18328,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10623, - "end": 10631, + "start": 10635, + "end": 10643, "loc": { "start": { "line": 378, @@ -18326,8 +18342,8 @@ }, "left": { "type": "Identifier", - "start": 10623, - "end": 10624, + "start": 10635, + "end": 10636, "loc": { "start": { "line": 378, @@ -18344,8 +18360,8 @@ "operator": "<", "right": { "type": "Identifier", - "start": 10627, - "end": 10631, + "start": 10639, + "end": 10643, "loc": { "start": { "line": 378, @@ -18362,8 +18378,8 @@ }, "update": { "type": "UpdateExpression", - "start": 10633, - "end": 10636, + "start": 10645, + "end": 10648, "loc": { "start": { "line": 378, @@ -18378,8 +18394,8 @@ "prefix": false, "argument": { "type": "Identifier", - "start": 10633, - "end": 10634, + "start": 10645, + "end": 10646, "loc": { "start": { "line": 378, @@ -18396,8 +18412,8 @@ }, "body": { "type": "BlockStatement", - "start": 10638, - "end": 10698, + "start": 10650, + "end": 10710, "loc": { "start": { "line": 378, @@ -18411,8 +18427,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10656, - "end": 10684, + "start": 10668, + "end": 10696, "loc": { "start": { "line": 379, @@ -18425,8 +18441,8 @@ }, "expression": { "type": "CallExpression", - "start": 10656, - "end": 10683, + "start": 10668, + "end": 10695, "loc": { "start": { "line": 379, @@ -18439,8 +18455,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10656, - "end": 10681, + "start": 10668, + "end": 10693, "loc": { "start": { "line": 379, @@ -18453,8 +18469,8 @@ }, "object": { "type": "MemberExpression", - "start": 10656, - "end": 10665, + "start": 10668, + "end": 10677, "loc": { "start": { "line": 379, @@ -18467,8 +18483,8 @@ }, "object": { "type": "Identifier", - "start": 10656, - "end": 10662, + "start": 10668, + "end": 10674, "loc": { "start": { "line": 379, @@ -18484,8 +18500,8 @@ }, "property": { "type": "Identifier", - "start": 10663, - "end": 10664, + "start": 10675, + "end": 10676, "loc": { "start": { "line": 379, @@ -18503,8 +18519,8 @@ }, "property": { "type": "Identifier", - "start": 10666, - "end": 10681, + "start": 10678, + "end": 10693, "loc": { "start": { "line": 379, @@ -18538,8 +18554,8 @@ }, { "type": "ClassMethod", - "start": 10720, - "end": 11125, + "start": 10732, + "end": 11137, "loc": { "start": { "line": 384, @@ -18554,8 +18570,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 10720, - "end": 10737, + "start": 10732, + "end": 10749, "loc": { "start": { "line": 384, @@ -18577,8 +18593,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 10740, - "end": 11125, + "start": 10752, + "end": 11137, "loc": { "start": { "line": 384, @@ -18592,8 +18608,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10750, - "end": 10782, + "start": 10762, + "end": 10794, "loc": { "start": { "line": 385, @@ -18607,8 +18623,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10756, - "end": 10781, + "start": 10768, + "end": 10793, "loc": { "start": { "line": 385, @@ -18621,8 +18637,8 @@ }, "id": { "type": "Identifier", - "start": 10756, - "end": 10767, + "start": 10768, + "end": 10779, "loc": { "start": { "line": 385, @@ -18638,8 +18654,8 @@ }, "init": { "type": "MemberExpression", - "start": 10770, - "end": 10781, + "start": 10782, + "end": 10793, "loc": { "start": { "line": 385, @@ -18652,8 +18668,8 @@ }, "object": { "type": "ThisExpression", - "start": 10770, - "end": 10774, + "start": 10782, + "end": 10786, "loc": { "start": { "line": 385, @@ -18667,8 +18683,8 @@ }, "property": { "type": "Identifier", - "start": 10775, - "end": 10781, + "start": 10787, + "end": 10793, "loc": { "start": { "line": 385, @@ -18690,8 +18706,8 @@ }, { "type": "IfStatement", - "start": 10791, - "end": 11079, + "start": 10803, + "end": 11091, "loc": { "start": { "line": 386, @@ -18704,8 +18720,8 @@ }, "test": { "type": "UnaryExpression", - "start": 10795, - "end": 10817, + "start": 10807, + "end": 10829, "loc": { "start": { "line": 386, @@ -18720,8 +18736,8 @@ "prefix": true, "argument": { "type": "MemberExpression", - "start": 10796, - "end": 10817, + "start": 10808, + "end": 10829, "loc": { "start": { "line": 386, @@ -18734,8 +18750,8 @@ }, "object": { "type": "ThisExpression", - "start": 10796, - "end": 10800, + "start": 10808, + "end": 10812, "loc": { "start": { "line": 386, @@ -18749,8 +18765,8 @@ }, "property": { "type": "Identifier", - "start": 10801, - "end": 10817, + "start": 10813, + "end": 10829, "loc": { "start": { "line": 386, @@ -18772,8 +18788,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 10819, - "end": 10969, + "start": 10831, + "end": 10981, "loc": { "start": { "line": 386, @@ -18787,8 +18803,8 @@ "body": [ { "type": "ForStatement", - "start": 10833, - "end": 10959, + "start": 10845, + "end": 10971, "loc": { "start": { "line": 387, @@ -18801,8 +18817,8 @@ }, "init": { "type": "VariableDeclaration", - "start": 10838, - "end": 10873, + "start": 10850, + "end": 10885, "loc": { "start": { "line": 387, @@ -18816,8 +18832,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 10842, - "end": 10847, + "start": 10854, + "end": 10859, "loc": { "start": { "line": 387, @@ -18830,8 +18846,8 @@ }, "id": { "type": "Identifier", - "start": 10842, - "end": 10843, + "start": 10854, + "end": 10855, "loc": { "start": { "line": 387, @@ -18847,8 +18863,8 @@ }, "init": { "type": "NumericLiteral", - "start": 10846, - "end": 10847, + "start": 10858, + "end": 10859, "loc": { "start": { "line": 387, @@ -18868,8 +18884,8 @@ }, { "type": "VariableDeclarator", - "start": 10849, - "end": 10873, + "start": 10861, + "end": 10885, "loc": { "start": { "line": 387, @@ -18882,8 +18898,8 @@ }, "id": { "type": "Identifier", - "start": 10849, - "end": 10852, + "start": 10861, + "end": 10864, "loc": { "start": { "line": 387, @@ -18899,8 +18915,8 @@ }, "init": { "type": "MemberExpression", - "start": 10855, - "end": 10873, + "start": 10867, + "end": 10885, "loc": { "start": { "line": 387, @@ -18913,8 +18929,8 @@ }, "object": { "type": "Identifier", - "start": 10855, - "end": 10866, + "start": 10867, + "end": 10878, "loc": { "start": { "line": 387, @@ -18930,8 +18946,8 @@ }, "property": { "type": "Identifier", - "start": 10867, - "end": 10873, + "start": 10879, + "end": 10885, "loc": { "start": { "line": 387, @@ -18953,8 +18969,8 @@ }, "test": { "type": "BinaryExpression", - "start": 10875, - "end": 10882, + "start": 10887, + "end": 10894, "loc": { "start": { "line": 387, @@ -18967,8 +18983,8 @@ }, "left": { "type": "Identifier", - "start": 10875, - "end": 10876, + "start": 10887, + "end": 10888, "loc": { "start": { "line": 387, @@ -18985,8 +19001,8 @@ "operator": "<", "right": { "type": "Identifier", - "start": 10879, - "end": 10882, + "start": 10891, + "end": 10894, "loc": { "start": { "line": 387, @@ -19003,8 +19019,8 @@ }, "update": { "type": "UpdateExpression", - "start": 10884, - "end": 10887, + "start": 10896, + "end": 10899, "loc": { "start": { "line": 387, @@ -19019,8 +19035,8 @@ "prefix": false, "argument": { "type": "Identifier", - "start": 10884, - "end": 10885, + "start": 10896, + "end": 10897, "loc": { "start": { "line": 387, @@ -19037,8 +19053,8 @@ }, "body": { "type": "BlockStatement", - "start": 10889, - "end": 10959, + "start": 10901, + "end": 10971, "loc": { "start": { "line": 387, @@ -19052,8 +19068,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10907, - "end": 10945, + "start": 10919, + "end": 10957, "loc": { "start": { "line": 388, @@ -19066,8 +19082,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 10907, - "end": 10944, + "start": 10919, + "end": 10956, "loc": { "start": { "line": 388, @@ -19081,8 +19097,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 10907, - "end": 10927, + "start": 10919, + "end": 10939, "loc": { "start": { "line": 388, @@ -19095,8 +19111,8 @@ }, "object": { "type": "MemberExpression", - "start": 10907, - "end": 10924, + "start": 10919, + "end": 10936, "loc": { "start": { "line": 388, @@ -19109,8 +19125,8 @@ }, "object": { "type": "ThisExpression", - "start": 10907, - "end": 10911, + "start": 10919, + "end": 10923, "loc": { "start": { "line": 388, @@ -19124,8 +19140,8 @@ }, "property": { "type": "Identifier", - "start": 10912, - "end": 10924, + "start": 10924, + "end": 10936, "loc": { "start": { "line": 388, @@ -19143,8 +19159,8 @@ }, "property": { "type": "Identifier", - "start": 10925, - "end": 10926, + "start": 10937, + "end": 10938, "loc": { "start": { "line": 388, @@ -19162,8 +19178,8 @@ }, "right": { "type": "MemberExpression", - "start": 10930, - "end": 10944, + "start": 10942, + "end": 10956, "loc": { "start": { "line": 388, @@ -19176,8 +19192,8 @@ }, "object": { "type": "Identifier", - "start": 10930, - "end": 10941, + "start": 10942, + "end": 10953, "loc": { "start": { "line": 388, @@ -19193,8 +19209,8 @@ }, "property": { "type": "Identifier", - "start": 10942, - "end": 10943, + "start": 10954, + "end": 10955, "loc": { "start": { "line": 388, @@ -19221,8 +19237,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 10975, - "end": 11079, + "start": 10987, + "end": 11091, "loc": { "start": { "line": 390, @@ -19236,8 +19252,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 10989, - "end": 11069, + "start": 11001, + "end": 11081, "loc": { "start": { "line": 391, @@ -19250,8 +19266,8 @@ }, "expression": { "type": "CallExpression", - "start": 10989, - "end": 11068, + "start": 11001, + "end": 11080, "loc": { "start": { "line": 391, @@ -19264,8 +19280,8 @@ }, "callee": { "type": "MemberExpression", - "start": 10989, - "end": 11001, + "start": 11001, + "end": 11013, "loc": { "start": { "line": 391, @@ -19278,8 +19294,8 @@ }, "object": { "type": "Identifier", - "start": 10989, - "end": 10993, + "start": 11001, + "end": 11005, "loc": { "start": { "line": 391, @@ -19295,8 +19311,8 @@ }, "property": { "type": "Identifier", - "start": 10994, - "end": 11001, + "start": 11006, + "end": 11013, "loc": { "start": { "line": 391, @@ -19315,8 +19331,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 11002, - "end": 11035, + "start": 11014, + "end": 11047, "loc": { "start": { "line": 391, @@ -19329,8 +19345,8 @@ }, "object": { "type": "MemberExpression", - "start": 11002, - "end": 11023, + "start": 11014, + "end": 11035, "loc": { "start": { "line": 391, @@ -19343,8 +19359,8 @@ }, "object": { "type": "ThisExpression", - "start": 11002, - "end": 11006, + "start": 11014, + "end": 11018, "loc": { "start": { "line": 391, @@ -19358,8 +19374,8 @@ }, "property": { "type": "Identifier", - "start": 11007, - "end": 11023, + "start": 11019, + "end": 11035, "loc": { "start": { "line": 391, @@ -19377,8 +19393,8 @@ }, "property": { "type": "Identifier", - "start": 11024, - "end": 11035, + "start": 11036, + "end": 11047, "loc": { "start": { "line": 391, @@ -19396,8 +19412,8 @@ }, { "type": "Identifier", - "start": 11037, - "end": 11048, + "start": 11049, + "end": 11060, "loc": { "start": { "line": 391, @@ -19413,8 +19429,8 @@ }, { "type": "MemberExpression", - "start": 11050, - "end": 11067, + "start": 11062, + "end": 11079, "loc": { "start": { "line": 391, @@ -19427,8 +19443,8 @@ }, "object": { "type": "ThisExpression", - "start": 11050, - "end": 11054, + "start": 11062, + "end": 11066, "loc": { "start": { "line": 391, @@ -19442,8 +19458,8 @@ }, "property": { "type": "Identifier", - "start": 11055, - "end": 11067, + "start": 11067, + "end": 11079, "loc": { "start": { "line": 391, @@ -19468,8 +19484,8 @@ }, { "type": "ExpressionStatement", - "start": 11088, - "end": 11119, + "start": 11100, + "end": 11131, "loc": { "start": { "line": 393, @@ -19482,8 +19498,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11088, - "end": 11118, + "start": 11100, + "end": 11130, "loc": { "start": { "line": 393, @@ -19497,8 +19513,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11088, - "end": 11110, + "start": 11100, + "end": 11122, "loc": { "start": { "line": 393, @@ -19511,8 +19527,8 @@ }, "object": { "type": "ThisExpression", - "start": 11088, - "end": 11092, + "start": 11100, + "end": 11104, "loc": { "start": { "line": 393, @@ -19526,8 +19542,8 @@ }, "property": { "type": "Identifier", - "start": 11093, - "end": 11110, + "start": 11105, + "end": 11122, "loc": { "start": { "line": 393, @@ -19545,8 +19561,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 11113, - "end": 11118, + "start": 11125, + "end": 11130, "loc": { "start": { "line": 393, @@ -19567,8 +19583,8 @@ }, { "type": "ClassMethod", - "start": 11131, - "end": 11459, + "start": 11143, + "end": 11471, "loc": { "start": { "line": 396, @@ -19583,8 +19599,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 11131, - "end": 11152, + "start": 11143, + "end": 11164, "loc": { "start": { "line": 396, @@ -19606,8 +19622,8 @@ "params": [ { "type": "Identifier", - "start": 11153, - "end": 11167, + "start": 11165, + "end": 11179, "loc": { "start": { "line": 396, @@ -19624,8 +19640,8 @@ ], "body": { "type": "BlockStatement", - "start": 11169, - "end": 11459, + "start": 11181, + "end": 11471, "loc": { "start": { "line": 396, @@ -19639,8 +19655,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11179, - "end": 11212, + "start": 11191, + "end": 11224, "loc": { "start": { "line": 397, @@ -19653,8 +19669,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 11179, - "end": 11211, + "start": 11191, + "end": 11223, "loc": { "start": { "line": 397, @@ -19668,8 +19684,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 11179, - "end": 11204, + "start": 11191, + "end": 11216, "loc": { "start": { "line": 397, @@ -19682,8 +19698,8 @@ }, "object": { "type": "Identifier", - "start": 11179, - "end": 11193, + "start": 11191, + "end": 11205, "loc": { "start": { "line": 397, @@ -19699,8 +19715,8 @@ }, "property": { "type": "Identifier", - "start": 11194, - "end": 11204, + "start": 11206, + "end": 11216, "loc": { "start": { "line": 397, @@ -19718,8 +19734,8 @@ }, "right": { "type": "BooleanLiteral", - "start": 11207, - "end": 11211, + "start": 11219, + "end": 11223, "loc": { "start": { "line": 397, @@ -19736,8 +19752,8 @@ }, { "type": "IfStatement", - "start": 11221, - "end": 11453, + "start": 11233, + "end": 11465, "loc": { "start": { "line": 398, @@ -19750,8 +19766,8 @@ }, "test": { "type": "MemberExpression", - "start": 11225, - "end": 11256, + "start": 11237, + "end": 11268, "loc": { "start": { "line": 398, @@ -19764,8 +19780,8 @@ }, "object": { "type": "Identifier", - "start": 11225, - "end": 11239, + "start": 11237, + "end": 11251, "loc": { "start": { "line": 398, @@ -19781,8 +19797,8 @@ }, "property": { "type": "Identifier", - "start": 11240, - "end": 11256, + "start": 11252, + "end": 11268, "loc": { "start": { "line": 398, @@ -19800,8 +19816,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 11258, - "end": 11453, + "start": 11270, + "end": 11465, "loc": { "start": { "line": 398, @@ -19815,8 +19831,8 @@ "body": [ { "type": "ForStatement", - "start": 11272, - "end": 11443, + "start": 11284, + "end": 11455, "loc": { "start": { "line": 399, @@ -19829,8 +19845,8 @@ }, "init": { "type": "VariableDeclaration", - "start": 11277, - "end": 11332, + "start": 11289, + "end": 11344, "loc": { "start": { "line": 399, @@ -19844,8 +19860,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 11281, - "end": 11286, + "start": 11293, + "end": 11298, "loc": { "start": { "line": 399, @@ -19858,8 +19874,8 @@ }, "id": { "type": "Identifier", - "start": 11281, - "end": 11282, + "start": 11293, + "end": 11294, "loc": { "start": { "line": 399, @@ -19875,8 +19891,8 @@ }, "init": { "type": "NumericLiteral", - "start": 11285, - "end": 11286, + "start": 11297, + "end": 11298, "loc": { "start": { "line": 399, @@ -19896,8 +19912,8 @@ }, { "type": "VariableDeclarator", - "start": 11288, - "end": 11332, + "start": 11300, + "end": 11344, "loc": { "start": { "line": 399, @@ -19910,8 +19926,8 @@ }, "id": { "type": "Identifier", - "start": 11288, - "end": 11291, + "start": 11300, + "end": 11303, "loc": { "start": { "line": 399, @@ -19927,8 +19943,8 @@ }, "init": { "type": "MemberExpression", - "start": 11294, - "end": 11332, + "start": 11306, + "end": 11344, "loc": { "start": { "line": 399, @@ -19941,8 +19957,8 @@ }, "object": { "type": "MemberExpression", - "start": 11294, - "end": 11325, + "start": 11306, + "end": 11337, "loc": { "start": { "line": 399, @@ -19955,8 +19971,8 @@ }, "object": { "type": "Identifier", - "start": 11294, - "end": 11308, + "start": 11306, + "end": 11320, "loc": { "start": { "line": 399, @@ -19972,8 +19988,8 @@ }, "property": { "type": "Identifier", - "start": 11309, - "end": 11325, + "start": 11321, + "end": 11337, "loc": { "start": { "line": 399, @@ -19991,8 +20007,8 @@ }, "property": { "type": "Identifier", - "start": 11326, - "end": 11332, + "start": 11338, + "end": 11344, "loc": { "start": { "line": 399, @@ -20014,8 +20030,8 @@ }, "test": { "type": "BinaryExpression", - "start": 11334, - "end": 11341, + "start": 11346, + "end": 11353, "loc": { "start": { "line": 399, @@ -20028,8 +20044,8 @@ }, "left": { "type": "Identifier", - "start": 11334, - "end": 11335, + "start": 11346, + "end": 11347, "loc": { "start": { "line": 399, @@ -20046,8 +20062,8 @@ "operator": "<", "right": { "type": "Identifier", - "start": 11338, - "end": 11341, + "start": 11350, + "end": 11353, "loc": { "start": { "line": 399, @@ -20064,8 +20080,8 @@ }, "update": { "type": "UpdateExpression", - "start": 11343, - "end": 11346, + "start": 11355, + "end": 11358, "loc": { "start": { "line": 399, @@ -20080,8 +20096,8 @@ "prefix": false, "argument": { "type": "Identifier", - "start": 11343, - "end": 11344, + "start": 11355, + "end": 11356, "loc": { "start": { "line": 399, @@ -20098,8 +20114,8 @@ }, "body": { "type": "BlockStatement", - "start": 11348, - "end": 11443, + "start": 11360, + "end": 11455, "loc": { "start": { "line": 399, @@ -20113,8 +20129,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 11366, - "end": 11429, + "start": 11378, + "end": 11441, "loc": { "start": { "line": 400, @@ -20127,8 +20143,8 @@ }, "expression": { "type": "CallExpression", - "start": 11366, - "end": 11428, + "start": 11378, + "end": 11440, "loc": { "start": { "line": 400, @@ -20141,8 +20157,8 @@ }, "callee": { "type": "MemberExpression", - "start": 11366, - "end": 11392, + "start": 11378, + "end": 11404, "loc": { "start": { "line": 400, @@ -20155,8 +20171,8 @@ }, "object": { "type": "ThisExpression", - "start": 11366, - "end": 11370, + "start": 11378, + "end": 11382, "loc": { "start": { "line": 400, @@ -20170,8 +20186,8 @@ }, "property": { "type": "Identifier", - "start": 11371, - "end": 11392, + "start": 11383, + "end": 11404, "loc": { "start": { "line": 400, @@ -20190,8 +20206,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 11393, - "end": 11427, + "start": 11405, + "end": 11439, "loc": { "start": { "line": 400, @@ -20204,8 +20220,8 @@ }, "object": { "type": "MemberExpression", - "start": 11393, - "end": 11424, + "start": 11405, + "end": 11436, "loc": { "start": { "line": 400, @@ -20218,8 +20234,8 @@ }, "object": { "type": "Identifier", - "start": 11393, - "end": 11407, + "start": 11405, + "end": 11419, "loc": { "start": { "line": 400, @@ -20235,8 +20251,8 @@ }, "property": { "type": "Identifier", - "start": 11408, - "end": 11424, + "start": 11420, + "end": 11436, "loc": { "start": { "line": 400, @@ -20254,8 +20270,8 @@ }, "property": { "type": "Identifier", - "start": 11425, - "end": 11426, + "start": 11437, + "end": 11438, "loc": { "start": { "line": 400, @@ -20383,8 +20399,8 @@ { "type": "CommentLine", "value": " childTransform._setWorldMatrixDirty();", - "start": 2219, - "end": 2260, + "start": 2231, + "end": 2272, "loc": { "start": { "line": 76, @@ -20399,8 +20415,8 @@ { "type": "CommentLine", "value": " childTransform._setAABBDirty();", - "start": 2269, - "end": 2303, + "start": 2281, + "end": 2315, "loc": { "start": { "line": 77, @@ -20415,8 +20431,8 @@ { "type": "CommentBlock", "value": "*\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n ", - "start": 2315, - "end": 2416, + "start": 2327, + "end": 2428, "loc": { "start": { "line": 80, @@ -20431,8 +20447,8 @@ { "type": "CommentBlock", "value": "*\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n ", - "start": 2494, - "end": 2610, + "start": 2506, + "end": 2622, "loc": { "start": { "line": 89, @@ -20447,8 +20463,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2670, - "end": 2817, + "start": 2682, + "end": 2829, "loc": { "start": { "line": 98, @@ -20463,8 +20479,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2972, - "end": 3113, + "start": 2984, + "end": 3125, "loc": { "start": { "line": 111, @@ -20479,8 +20495,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3177, - "end": 3382, + "start": 3189, + "end": 3394, "loc": { "start": { "line": 122, @@ -20495,8 +20511,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3610, - "end": 3815, + "start": 3622, + "end": 3827, "loc": { "start": { "line": 136, @@ -20511,8 +20527,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 3879, - "end": 4030, + "start": 3891, + "end": 4042, "loc": { "start": { "line": 147, @@ -20527,8 +20543,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 4265, - "end": 4416, + "start": 4277, + "end": 4428, "loc": { "start": { "line": 161, @@ -20543,8 +20559,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4484, - "end": 4619, + "start": 4496, + "end": 4631, "loc": { "start": { "line": 172, @@ -20559,8 +20575,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4768, - "end": 4903, + "start": 4780, + "end": 4915, "loc": { "start": { "line": 185, @@ -20575,8 +20591,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 4961, - "end": 5148, + "start": 4973, + "end": 5160, "loc": { "start": { "line": 196, @@ -20591,8 +20607,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 5532, - "end": 5719, + "start": 5544, + "end": 5731, "loc": { "start": { "line": 214, @@ -20607,8 +20623,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n ", - "start": 6081, - "end": 6204, + "start": 6093, + "end": 6216, "loc": { "start": { "line": 232, @@ -20623,8 +20639,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6360, - "end": 6583, + "start": 6372, + "end": 6595, "loc": { "start": { "line": 245, @@ -20639,8 +20655,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6988, - "end": 7223, + "start": 7000, + "end": 7235, "loc": { "start": { "line": 264, @@ -20655,8 +20671,8 @@ { "type": "CommentLine", "value": "this.quaternion.premultiply(q1);", - "start": 7516, - "end": 7550, + "start": 7528, + "end": 7562, "loc": { "start": { "line": 277, @@ -20671,8 +20687,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7583, - "end": 7744, + "start": 7595, + "end": 7756, "loc": { "start": { "line": 281, @@ -20687,8 +20703,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7819, - "end": 7980, + "start": 7831, + "end": 7992, "loc": { "start": { "line": 290, @@ -20703,8 +20719,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 8055, - "end": 8216, + "start": 8067, + "end": 8228, "loc": { "start": { "line": 299, @@ -20719,8 +20735,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n ", - "start": 8291, - "end": 8558, + "start": 8303, + "end": 8570, "loc": { "start": { "line": 308, @@ -20735,8 +20751,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n ", - "start": 8796, - "end": 8976, + "start": 8808, + "end": 8988, "loc": { "start": { "line": 323, @@ -20751,8 +20767,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n ", - "start": 9144, - "end": 9324, + "start": 9156, + "end": 9336, "loc": { "start": { "line": 335, @@ -20767,8 +20783,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n ", - "start": 9492, - "end": 9672, + "start": 9504, + "end": 9684, "loc": { "start": { "line": 347, @@ -30064,9 +30080,9 @@ "postfix": false, "binop": null }, - "value": "_setAABBDirty", + "value": "_setSubtreeAABBsDirty", "start": 2102, - "end": 2115, + "end": 2123, "loc": { "start": { "line": 70, @@ -30074,7 +30090,7 @@ }, "end": { "line": 70, - "column": 36 + "column": 44 } } }, @@ -30090,16 +30106,44 @@ "postfix": false, "binop": null }, - "start": 2115, - "end": 2116, + "start": 2123, + "end": 2124, "loc": { "start": { "line": 70, - "column": 36 + "column": 44 }, "end": { "line": 70, - "column": 37 + "column": 45 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2124, + "end": 2128, + "loc": { + "start": { + "line": 70, + "column": 45 + }, + "end": { + "line": 70, + "column": 49 } } }, @@ -30115,16 +30159,16 @@ "postfix": false, "binop": null }, - "start": 2116, - "end": 2117, + "start": 2128, + "end": 2129, "loc": { "start": { "line": 70, - "column": 37 + "column": 49 }, "end": { "line": 70, - "column": 38 + "column": 50 } } }, @@ -30141,16 +30185,16 @@ "binop": null, "updateContext": null }, - "start": 2117, - "end": 2118, + "start": 2129, + "end": 2130, "loc": { "start": { "line": 70, - "column": 38 + "column": 50 }, "end": { "line": 70, - "column": 39 + "column": 51 } } }, @@ -30166,8 +30210,8 @@ "postfix": false, "binop": null }, - "start": 2123, - "end": 2124, + "start": 2135, + "end": 2136, "loc": { "start": { "line": 71, @@ -30192,8 +30236,8 @@ "binop": null }, "value": "_addMesh", - "start": 2130, - "end": 2138, + "start": 2142, + "end": 2150, "loc": { "start": { "line": 73, @@ -30217,8 +30261,8 @@ "postfix": false, "binop": null }, - "start": 2138, - "end": 2139, + "start": 2150, + "end": 2151, "loc": { "start": { "line": 73, @@ -30243,8 +30287,8 @@ "binop": null }, "value": "mesh", - "start": 2139, - "end": 2143, + "start": 2151, + "end": 2155, "loc": { "start": { "line": 73, @@ -30268,8 +30312,8 @@ "postfix": false, "binop": null }, - "start": 2143, - "end": 2144, + "start": 2155, + "end": 2156, "loc": { "start": { "line": 73, @@ -30293,8 +30337,8 @@ "postfix": false, "binop": null }, - "start": 2145, - "end": 2146, + "start": 2157, + "end": 2158, "loc": { "start": { "line": 73, @@ -30321,8 +30365,8 @@ "updateContext": null }, "value": "this", - "start": 2155, - "end": 2159, + "start": 2167, + "end": 2171, "loc": { "start": { "line": 74, @@ -30347,8 +30391,8 @@ "binop": null, "updateContext": null }, - "start": 2159, - "end": 2160, + "start": 2171, + "end": 2172, "loc": { "start": { "line": 74, @@ -30373,8 +30417,8 @@ "binop": null }, "value": "_meshes", - "start": 2160, - "end": 2167, + "start": 2172, + "end": 2179, "loc": { "start": { "line": 74, @@ -30399,8 +30443,8 @@ "binop": null, "updateContext": null }, - "start": 2167, - "end": 2168, + "start": 2179, + "end": 2180, "loc": { "start": { "line": 74, @@ -30425,8 +30469,8 @@ "binop": null }, "value": "push", - "start": 2168, - "end": 2172, + "start": 2180, + "end": 2184, "loc": { "start": { "line": 74, @@ -30450,8 +30494,8 @@ "postfix": false, "binop": null }, - "start": 2172, - "end": 2173, + "start": 2184, + "end": 2185, "loc": { "start": { "line": 74, @@ -30476,8 +30520,8 @@ "binop": null }, "value": "mesh", - "start": 2173, - "end": 2177, + "start": 2185, + "end": 2189, "loc": { "start": { "line": 74, @@ -30501,8 +30545,8 @@ "postfix": false, "binop": null }, - "start": 2177, - "end": 2178, + "start": 2189, + "end": 2190, "loc": { "start": { "line": 74, @@ -30527,8 +30571,8 @@ "binop": null, "updateContext": null }, - "start": 2178, - "end": 2179, + "start": 2190, + "end": 2191, "loc": { "start": { "line": 74, @@ -30553,8 +30597,8 @@ "binop": null }, "value": "mesh", - "start": 2188, - "end": 2192, + "start": 2200, + "end": 2204, "loc": { "start": { "line": 75, @@ -30579,8 +30623,8 @@ "binop": null, "updateContext": null }, - "start": 2192, - "end": 2193, + "start": 2204, + "end": 2205, "loc": { "start": { "line": 75, @@ -30605,8 +30649,8 @@ "binop": null }, "value": "transform", - "start": 2193, - "end": 2202, + "start": 2205, + "end": 2214, "loc": { "start": { "line": 75, @@ -30632,8 +30676,8 @@ "updateContext": null }, "value": "=", - "start": 2203, - "end": 2204, + "start": 2215, + "end": 2216, "loc": { "start": { "line": 75, @@ -30660,8 +30704,8 @@ "updateContext": null }, "value": "this", - "start": 2205, - "end": 2209, + "start": 2217, + "end": 2221, "loc": { "start": { "line": 75, @@ -30686,8 +30730,8 @@ "binop": null, "updateContext": null }, - "start": 2209, - "end": 2210, + "start": 2221, + "end": 2222, "loc": { "start": { "line": 75, @@ -30702,8 +30746,8 @@ { "type": "CommentLine", "value": " childTransform._setWorldMatrixDirty();", - "start": 2219, - "end": 2260, + "start": 2231, + "end": 2272, "loc": { "start": { "line": 76, @@ -30718,8 +30762,8 @@ { "type": "CommentLine", "value": " childTransform._setAABBDirty();", - "start": 2269, - "end": 2303, + "start": 2281, + "end": 2315, "loc": { "start": { "line": 77, @@ -30743,8 +30787,8 @@ "postfix": false, "binop": null }, - "start": 2308, - "end": 2309, + "start": 2320, + "end": 2321, "loc": { "start": { "line": 78, @@ -30759,8 +30803,8 @@ { "type": "CommentBlock", "value": "*\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n ", - "start": 2315, - "end": 2416, + "start": 2327, + "end": 2428, "loc": { "start": { "line": 80, @@ -30785,8 +30829,8 @@ "binop": null }, "value": "get", - "start": 2421, - "end": 2424, + "start": 2433, + "end": 2436, "loc": { "start": { "line": 85, @@ -30811,8 +30855,8 @@ "binop": null }, "value": "parentTransform", - "start": 2425, - "end": 2440, + "start": 2437, + "end": 2452, "loc": { "start": { "line": 85, @@ -30836,8 +30880,8 @@ "postfix": false, "binop": null }, - "start": 2440, - "end": 2441, + "start": 2452, + "end": 2453, "loc": { "start": { "line": 85, @@ -30861,8 +30905,8 @@ "postfix": false, "binop": null }, - "start": 2441, - "end": 2442, + "start": 2453, + "end": 2454, "loc": { "start": { "line": 85, @@ -30886,8 +30930,8 @@ "postfix": false, "binop": null }, - "start": 2443, - "end": 2444, + "start": 2455, + "end": 2456, "loc": { "start": { "line": 85, @@ -30914,8 +30958,8 @@ "updateContext": null }, "value": "return", - "start": 2453, - "end": 2459, + "start": 2465, + "end": 2471, "loc": { "start": { "line": 86, @@ -30942,8 +30986,8 @@ "updateContext": null }, "value": "this", - "start": 2460, - "end": 2464, + "start": 2472, + "end": 2476, "loc": { "start": { "line": 86, @@ -30968,8 +31012,8 @@ "binop": null, "updateContext": null }, - "start": 2464, - "end": 2465, + "start": 2476, + "end": 2477, "loc": { "start": { "line": 86, @@ -30994,8 +31038,8 @@ "binop": null }, "value": "_parentTransform", - "start": 2465, - "end": 2481, + "start": 2477, + "end": 2493, "loc": { "start": { "line": 86, @@ -31020,8 +31064,8 @@ "binop": null, "updateContext": null }, - "start": 2481, - "end": 2482, + "start": 2493, + "end": 2494, "loc": { "start": { "line": 86, @@ -31045,8 +31089,8 @@ "postfix": false, "binop": null }, - "start": 2487, - "end": 2488, + "start": 2499, + "end": 2500, "loc": { "start": { "line": 87, @@ -31061,8 +31105,8 @@ { "type": "CommentBlock", "value": "*\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n ", - "start": 2494, - "end": 2610, + "start": 2506, + "end": 2622, "loc": { "start": { "line": 89, @@ -31087,8 +31131,8 @@ "binop": null }, "value": "get", - "start": 2615, - "end": 2618, + "start": 2627, + "end": 2630, "loc": { "start": { "line": 94, @@ -31113,8 +31157,8 @@ "binop": null }, "value": "meshes", - "start": 2619, - "end": 2625, + "start": 2631, + "end": 2637, "loc": { "start": { "line": 94, @@ -31138,8 +31182,8 @@ "postfix": false, "binop": null }, - "start": 2625, - "end": 2626, + "start": 2637, + "end": 2638, "loc": { "start": { "line": 94, @@ -31163,8 +31207,8 @@ "postfix": false, "binop": null }, - "start": 2626, - "end": 2627, + "start": 2638, + "end": 2639, "loc": { "start": { "line": 94, @@ -31188,8 +31232,8 @@ "postfix": false, "binop": null }, - "start": 2628, - "end": 2629, + "start": 2640, + "end": 2641, "loc": { "start": { "line": 94, @@ -31216,8 +31260,8 @@ "updateContext": null }, "value": "return", - "start": 2638, - "end": 2644, + "start": 2650, + "end": 2656, "loc": { "start": { "line": 95, @@ -31244,8 +31288,8 @@ "updateContext": null }, "value": "this", - "start": 2645, - "end": 2649, + "start": 2657, + "end": 2661, "loc": { "start": { "line": 95, @@ -31270,8 +31314,8 @@ "binop": null, "updateContext": null }, - "start": 2649, - "end": 2650, + "start": 2661, + "end": 2662, "loc": { "start": { "line": 95, @@ -31296,8 +31340,8 @@ "binop": null }, "value": "_meshes", - "start": 2650, - "end": 2657, + "start": 2662, + "end": 2669, "loc": { "start": { "line": 95, @@ -31322,8 +31366,8 @@ "binop": null, "updateContext": null }, - "start": 2657, - "end": 2658, + "start": 2669, + "end": 2670, "loc": { "start": { "line": 95, @@ -31347,8 +31391,8 @@ "postfix": false, "binop": null }, - "start": 2663, - "end": 2664, + "start": 2675, + "end": 2676, "loc": { "start": { "line": 96, @@ -31363,8 +31407,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2670, - "end": 2817, + "start": 2682, + "end": 2829, "loc": { "start": { "line": 98, @@ -31389,8 +31433,8 @@ "binop": null }, "value": "set", - "start": 2822, - "end": 2825, + "start": 2834, + "end": 2837, "loc": { "start": { "line": 105, @@ -31415,8 +31459,8 @@ "binop": null }, "value": "position", - "start": 2826, - "end": 2834, + "start": 2838, + "end": 2846, "loc": { "start": { "line": 105, @@ -31440,8 +31484,8 @@ "postfix": false, "binop": null }, - "start": 2834, - "end": 2835, + "start": 2846, + "end": 2847, "loc": { "start": { "line": 105, @@ -31466,8 +31510,8 @@ "binop": null }, "value": "value", - "start": 2835, - "end": 2840, + "start": 2847, + "end": 2852, "loc": { "start": { "line": 105, @@ -31491,8 +31535,8 @@ "postfix": false, "binop": null }, - "start": 2840, - "end": 2841, + "start": 2852, + "end": 2853, "loc": { "start": { "line": 105, @@ -31516,8 +31560,8 @@ "postfix": false, "binop": null }, - "start": 2842, - "end": 2843, + "start": 2854, + "end": 2855, "loc": { "start": { "line": 105, @@ -31544,8 +31588,8 @@ "updateContext": null }, "value": "this", - "start": 2852, - "end": 2856, + "start": 2864, + "end": 2868, "loc": { "start": { "line": 106, @@ -31570,8 +31614,8 @@ "binop": null, "updateContext": null }, - "start": 2856, - "end": 2857, + "start": 2868, + "end": 2869, "loc": { "start": { "line": 106, @@ -31596,8 +31640,8 @@ "binop": null }, "value": "_position", - "start": 2857, - "end": 2866, + "start": 2869, + "end": 2878, "loc": { "start": { "line": 106, @@ -31622,8 +31666,8 @@ "binop": null, "updateContext": null }, - "start": 2866, - "end": 2867, + "start": 2878, + "end": 2879, "loc": { "start": { "line": 106, @@ -31648,8 +31692,8 @@ "binop": null }, "value": "set", - "start": 2867, - "end": 2870, + "start": 2879, + "end": 2882, "loc": { "start": { "line": 106, @@ -31673,8 +31717,8 @@ "postfix": false, "binop": null }, - "start": 2870, - "end": 2871, + "start": 2882, + "end": 2883, "loc": { "start": { "line": 106, @@ -31699,8 +31743,8 @@ "binop": null }, "value": "value", - "start": 2871, - "end": 2876, + "start": 2883, + "end": 2888, "loc": { "start": { "line": 106, @@ -31726,8 +31770,8 @@ "updateContext": null }, "value": "||", - "start": 2877, - "end": 2879, + "start": 2889, + "end": 2891, "loc": { "start": { "line": 106, @@ -31752,8 +31796,8 @@ "binop": null, "updateContext": null }, - "start": 2880, - "end": 2881, + "start": 2892, + "end": 2893, "loc": { "start": { "line": 106, @@ -31779,8 +31823,8 @@ "updateContext": null }, "value": 0, - "start": 2881, - "end": 2882, + "start": 2893, + "end": 2894, "loc": { "start": { "line": 106, @@ -31805,8 +31849,8 @@ "binop": null, "updateContext": null }, - "start": 2882, - "end": 2883, + "start": 2894, + "end": 2895, "loc": { "start": { "line": 106, @@ -31832,8 +31876,8 @@ "updateContext": null }, "value": 0, - "start": 2884, - "end": 2885, + "start": 2896, + "end": 2897, "loc": { "start": { "line": 106, @@ -31858,8 +31902,8 @@ "binop": null, "updateContext": null }, - "start": 2885, - "end": 2886, + "start": 2897, + "end": 2898, "loc": { "start": { "line": 106, @@ -31885,8 +31929,8 @@ "updateContext": null }, "value": 0, - "start": 2887, - "end": 2888, + "start": 2899, + "end": 2900, "loc": { "start": { "line": 106, @@ -31911,8 +31955,8 @@ "binop": null, "updateContext": null }, - "start": 2888, - "end": 2889, + "start": 2900, + "end": 2901, "loc": { "start": { "line": 106, @@ -31936,8 +31980,8 @@ "postfix": false, "binop": null }, - "start": 2889, - "end": 2890, + "start": 2901, + "end": 2902, "loc": { "start": { "line": 106, @@ -31962,8 +32006,8 @@ "binop": null, "updateContext": null }, - "start": 2890, - "end": 2891, + "start": 2902, + "end": 2903, "loc": { "start": { "line": 106, @@ -31990,8 +32034,8 @@ "updateContext": null }, "value": "this", - "start": 2900, - "end": 2904, + "start": 2912, + "end": 2916, "loc": { "start": { "line": 107, @@ -32016,8 +32060,8 @@ "binop": null, "updateContext": null }, - "start": 2904, - "end": 2905, + "start": 2916, + "end": 2917, "loc": { "start": { "line": 107, @@ -32042,8 +32086,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 2905, - "end": 2925, + "start": 2917, + "end": 2937, "loc": { "start": { "line": 107, @@ -32067,8 +32111,8 @@ "postfix": false, "binop": null }, - "start": 2925, - "end": 2926, + "start": 2937, + "end": 2938, "loc": { "start": { "line": 107, @@ -32092,8 +32136,8 @@ "postfix": false, "binop": null }, - "start": 2926, - "end": 2927, + "start": 2938, + "end": 2939, "loc": { "start": { "line": 107, @@ -32118,8 +32162,8 @@ "binop": null, "updateContext": null }, - "start": 2927, - "end": 2928, + "start": 2939, + "end": 2940, "loc": { "start": { "line": 107, @@ -32146,8 +32190,8 @@ "updateContext": null }, "value": "this", - "start": 2937, - "end": 2941, + "start": 2949, + "end": 2953, "loc": { "start": { "line": 108, @@ -32172,8 +32216,8 @@ "binop": null, "updateContext": null }, - "start": 2941, - "end": 2942, + "start": 2953, + "end": 2954, "loc": { "start": { "line": 108, @@ -32198,8 +32242,8 @@ "binop": null }, "value": "_model", - "start": 2942, - "end": 2948, + "start": 2954, + "end": 2960, "loc": { "start": { "line": 108, @@ -32224,8 +32268,8 @@ "binop": null, "updateContext": null }, - "start": 2948, - "end": 2949, + "start": 2960, + "end": 2961, "loc": { "start": { "line": 108, @@ -32250,8 +32294,8 @@ "binop": null }, "value": "glRedraw", - "start": 2949, - "end": 2957, + "start": 2961, + "end": 2969, "loc": { "start": { "line": 108, @@ -32275,8 +32319,8 @@ "postfix": false, "binop": null }, - "start": 2957, - "end": 2958, + "start": 2969, + "end": 2970, "loc": { "start": { "line": 108, @@ -32300,8 +32344,8 @@ "postfix": false, "binop": null }, - "start": 2958, - "end": 2959, + "start": 2970, + "end": 2971, "loc": { "start": { "line": 108, @@ -32326,8 +32370,8 @@ "binop": null, "updateContext": null }, - "start": 2959, - "end": 2960, + "start": 2971, + "end": 2972, "loc": { "start": { "line": 108, @@ -32351,8 +32395,8 @@ "postfix": false, "binop": null }, - "start": 2965, - "end": 2966, + "start": 2977, + "end": 2978, "loc": { "start": { "line": 109, @@ -32367,8 +32411,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 2972, - "end": 3113, + "start": 2984, + "end": 3125, "loc": { "start": { "line": 111, @@ -32393,8 +32437,8 @@ "binop": null }, "value": "get", - "start": 3118, - "end": 3121, + "start": 3130, + "end": 3133, "loc": { "start": { "line": 118, @@ -32419,8 +32463,8 @@ "binop": null }, "value": "position", - "start": 3122, - "end": 3130, + "start": 3134, + "end": 3142, "loc": { "start": { "line": 118, @@ -32444,8 +32488,8 @@ "postfix": false, "binop": null }, - "start": 3130, - "end": 3131, + "start": 3142, + "end": 3143, "loc": { "start": { "line": 118, @@ -32469,8 +32513,8 @@ "postfix": false, "binop": null }, - "start": 3131, - "end": 3132, + "start": 3143, + "end": 3144, "loc": { "start": { "line": 118, @@ -32494,8 +32538,8 @@ "postfix": false, "binop": null }, - "start": 3133, - "end": 3134, + "start": 3145, + "end": 3146, "loc": { "start": { "line": 118, @@ -32522,8 +32566,8 @@ "updateContext": null }, "value": "return", - "start": 3143, - "end": 3149, + "start": 3155, + "end": 3161, "loc": { "start": { "line": 119, @@ -32550,8 +32594,8 @@ "updateContext": null }, "value": "this", - "start": 3150, - "end": 3154, + "start": 3162, + "end": 3166, "loc": { "start": { "line": 119, @@ -32576,8 +32620,8 @@ "binop": null, "updateContext": null }, - "start": 3154, - "end": 3155, + "start": 3166, + "end": 3167, "loc": { "start": { "line": 119, @@ -32602,8 +32646,8 @@ "binop": null }, "value": "_position", - "start": 3155, - "end": 3164, + "start": 3167, + "end": 3176, "loc": { "start": { "line": 119, @@ -32628,8 +32672,8 @@ "binop": null, "updateContext": null }, - "start": 3164, - "end": 3165, + "start": 3176, + "end": 3177, "loc": { "start": { "line": 119, @@ -32653,8 +32697,8 @@ "postfix": false, "binop": null }, - "start": 3170, - "end": 3171, + "start": 3182, + "end": 3183, "loc": { "start": { "line": 120, @@ -32669,8 +32713,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3177, - "end": 3382, + "start": 3189, + "end": 3394, "loc": { "start": { "line": 122, @@ -32695,8 +32739,8 @@ "binop": null }, "value": "set", - "start": 3387, - "end": 3390, + "start": 3399, + "end": 3402, "loc": { "start": { "line": 129, @@ -32721,8 +32765,8 @@ "binop": null }, "value": "rotation", - "start": 3391, - "end": 3399, + "start": 3403, + "end": 3411, "loc": { "start": { "line": 129, @@ -32746,8 +32790,8 @@ "postfix": false, "binop": null }, - "start": 3399, - "end": 3400, + "start": 3411, + "end": 3412, "loc": { "start": { "line": 129, @@ -32772,8 +32816,8 @@ "binop": null }, "value": "value", - "start": 3400, - "end": 3405, + "start": 3412, + "end": 3417, "loc": { "start": { "line": 129, @@ -32797,8 +32841,8 @@ "postfix": false, "binop": null }, - "start": 3405, - "end": 3406, + "start": 3417, + "end": 3418, "loc": { "start": { "line": 129, @@ -32822,8 +32866,8 @@ "postfix": false, "binop": null }, - "start": 3407, - "end": 3408, + "start": 3419, + "end": 3420, "loc": { "start": { "line": 129, @@ -32850,8 +32894,8 @@ "updateContext": null }, "value": "this", - "start": 3417, - "end": 3421, + "start": 3429, + "end": 3433, "loc": { "start": { "line": 130, @@ -32876,8 +32920,8 @@ "binop": null, "updateContext": null }, - "start": 3421, - "end": 3422, + "start": 3433, + "end": 3434, "loc": { "start": { "line": 130, @@ -32902,8 +32946,8 @@ "binop": null }, "value": "_rotation", - "start": 3422, - "end": 3431, + "start": 3434, + "end": 3443, "loc": { "start": { "line": 130, @@ -32928,8 +32972,8 @@ "binop": null, "updateContext": null }, - "start": 3431, - "end": 3432, + "start": 3443, + "end": 3444, "loc": { "start": { "line": 130, @@ -32954,8 +32998,8 @@ "binop": null }, "value": "set", - "start": 3432, - "end": 3435, + "start": 3444, + "end": 3447, "loc": { "start": { "line": 130, @@ -32979,8 +33023,8 @@ "postfix": false, "binop": null }, - "start": 3435, - "end": 3436, + "start": 3447, + "end": 3448, "loc": { "start": { "line": 130, @@ -33005,8 +33049,8 @@ "binop": null }, "value": "value", - "start": 3436, - "end": 3441, + "start": 3448, + "end": 3453, "loc": { "start": { "line": 130, @@ -33032,8 +33076,8 @@ "updateContext": null }, "value": "||", - "start": 3442, - "end": 3444, + "start": 3454, + "end": 3456, "loc": { "start": { "line": 130, @@ -33058,8 +33102,8 @@ "binop": null, "updateContext": null }, - "start": 3445, - "end": 3446, + "start": 3457, + "end": 3458, "loc": { "start": { "line": 130, @@ -33085,8 +33129,8 @@ "updateContext": null }, "value": 0, - "start": 3446, - "end": 3447, + "start": 3458, + "end": 3459, "loc": { "start": { "line": 130, @@ -33111,8 +33155,8 @@ "binop": null, "updateContext": null }, - "start": 3447, - "end": 3448, + "start": 3459, + "end": 3460, "loc": { "start": { "line": 130, @@ -33138,8 +33182,8 @@ "updateContext": null }, "value": 0, - "start": 3449, - "end": 3450, + "start": 3461, + "end": 3462, "loc": { "start": { "line": 130, @@ -33164,8 +33208,8 @@ "binop": null, "updateContext": null }, - "start": 3450, - "end": 3451, + "start": 3462, + "end": 3463, "loc": { "start": { "line": 130, @@ -33191,8 +33235,8 @@ "updateContext": null }, "value": 0, - "start": 3452, - "end": 3453, + "start": 3464, + "end": 3465, "loc": { "start": { "line": 130, @@ -33217,8 +33261,8 @@ "binop": null, "updateContext": null }, - "start": 3453, - "end": 3454, + "start": 3465, + "end": 3466, "loc": { "start": { "line": 130, @@ -33242,8 +33286,8 @@ "postfix": false, "binop": null }, - "start": 3454, - "end": 3455, + "start": 3466, + "end": 3467, "loc": { "start": { "line": 130, @@ -33268,8 +33312,8 @@ "binop": null, "updateContext": null }, - "start": 3455, - "end": 3456, + "start": 3467, + "end": 3468, "loc": { "start": { "line": 130, @@ -33294,8 +33338,8 @@ "binop": null }, "value": "math", - "start": 3465, - "end": 3469, + "start": 3477, + "end": 3481, "loc": { "start": { "line": 131, @@ -33320,8 +33364,8 @@ "binop": null, "updateContext": null }, - "start": 3469, - "end": 3470, + "start": 3481, + "end": 3482, "loc": { "start": { "line": 131, @@ -33346,8 +33390,8 @@ "binop": null }, "value": "eulerToQuaternion", - "start": 3470, - "end": 3487, + "start": 3482, + "end": 3499, "loc": { "start": { "line": 131, @@ -33371,8 +33415,8 @@ "postfix": false, "binop": null }, - "start": 3487, - "end": 3488, + "start": 3499, + "end": 3500, "loc": { "start": { "line": 131, @@ -33399,8 +33443,8 @@ "updateContext": null }, "value": "this", - "start": 3488, - "end": 3492, + "start": 3500, + "end": 3504, "loc": { "start": { "line": 131, @@ -33425,8 +33469,8 @@ "binop": null, "updateContext": null }, - "start": 3492, - "end": 3493, + "start": 3504, + "end": 3505, "loc": { "start": { "line": 131, @@ -33451,8 +33495,8 @@ "binop": null }, "value": "_rotation", - "start": 3493, - "end": 3502, + "start": 3505, + "end": 3514, "loc": { "start": { "line": 131, @@ -33477,8 +33521,8 @@ "binop": null, "updateContext": null }, - "start": 3502, - "end": 3503, + "start": 3514, + "end": 3515, "loc": { "start": { "line": 131, @@ -33504,8 +33548,8 @@ "updateContext": null }, "value": "XYZ", - "start": 3504, - "end": 3509, + "start": 3516, + "end": 3521, "loc": { "start": { "line": 131, @@ -33530,8 +33574,8 @@ "binop": null, "updateContext": null }, - "start": 3509, - "end": 3510, + "start": 3521, + "end": 3522, "loc": { "start": { "line": 131, @@ -33558,8 +33602,8 @@ "updateContext": null }, "value": "this", - "start": 3511, - "end": 3515, + "start": 3523, + "end": 3527, "loc": { "start": { "line": 131, @@ -33584,8 +33628,8 @@ "binop": null, "updateContext": null }, - "start": 3515, - "end": 3516, + "start": 3527, + "end": 3528, "loc": { "start": { "line": 131, @@ -33610,8 +33654,8 @@ "binop": null }, "value": "_quaternion", - "start": 3516, - "end": 3527, + "start": 3528, + "end": 3539, "loc": { "start": { "line": 131, @@ -33635,8 +33679,8 @@ "postfix": false, "binop": null }, - "start": 3527, - "end": 3528, + "start": 3539, + "end": 3540, "loc": { "start": { "line": 131, @@ -33661,8 +33705,8 @@ "binop": null, "updateContext": null }, - "start": 3528, - "end": 3529, + "start": 3540, + "end": 3541, "loc": { "start": { "line": 131, @@ -33689,8 +33733,8 @@ "updateContext": null }, "value": "this", - "start": 3538, - "end": 3542, + "start": 3550, + "end": 3554, "loc": { "start": { "line": 132, @@ -33715,8 +33759,8 @@ "binop": null, "updateContext": null }, - "start": 3542, - "end": 3543, + "start": 3554, + "end": 3555, "loc": { "start": { "line": 132, @@ -33741,8 +33785,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 3543, - "end": 3563, + "start": 3555, + "end": 3575, "loc": { "start": { "line": 132, @@ -33766,8 +33810,8 @@ "postfix": false, "binop": null }, - "start": 3563, - "end": 3564, + "start": 3575, + "end": 3576, "loc": { "start": { "line": 132, @@ -33791,8 +33835,8 @@ "postfix": false, "binop": null }, - "start": 3564, - "end": 3565, + "start": 3576, + "end": 3577, "loc": { "start": { "line": 132, @@ -33817,8 +33861,8 @@ "binop": null, "updateContext": null }, - "start": 3565, - "end": 3566, + "start": 3577, + "end": 3578, "loc": { "start": { "line": 132, @@ -33845,8 +33889,8 @@ "updateContext": null }, "value": "this", - "start": 3575, - "end": 3579, + "start": 3587, + "end": 3591, "loc": { "start": { "line": 133, @@ -33871,8 +33915,8 @@ "binop": null, "updateContext": null }, - "start": 3579, - "end": 3580, + "start": 3591, + "end": 3592, "loc": { "start": { "line": 133, @@ -33897,8 +33941,8 @@ "binop": null }, "value": "_model", - "start": 3580, - "end": 3586, + "start": 3592, + "end": 3598, "loc": { "start": { "line": 133, @@ -33923,8 +33967,8 @@ "binop": null, "updateContext": null }, - "start": 3586, - "end": 3587, + "start": 3598, + "end": 3599, "loc": { "start": { "line": 133, @@ -33949,8 +33993,8 @@ "binop": null }, "value": "glRedraw", - "start": 3587, - "end": 3595, + "start": 3599, + "end": 3607, "loc": { "start": { "line": 133, @@ -33974,8 +34018,8 @@ "postfix": false, "binop": null }, - "start": 3595, - "end": 3596, + "start": 3607, + "end": 3608, "loc": { "start": { "line": 133, @@ -33999,8 +34043,8 @@ "postfix": false, "binop": null }, - "start": 3596, - "end": 3597, + "start": 3608, + "end": 3609, "loc": { "start": { "line": 133, @@ -34025,8 +34069,8 @@ "binop": null, "updateContext": null }, - "start": 3597, - "end": 3598, + "start": 3609, + "end": 3610, "loc": { "start": { "line": 133, @@ -34050,8 +34094,8 @@ "postfix": false, "binop": null }, - "start": 3603, - "end": 3604, + "start": 3615, + "end": 3616, "loc": { "start": { "line": 134, @@ -34066,8 +34110,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n ", - "start": 3610, - "end": 3815, + "start": 3622, + "end": 3827, "loc": { "start": { "line": 136, @@ -34092,8 +34136,8 @@ "binop": null }, "value": "get", - "start": 3820, - "end": 3823, + "start": 3832, + "end": 3835, "loc": { "start": { "line": 143, @@ -34118,8 +34162,8 @@ "binop": null }, "value": "rotation", - "start": 3824, - "end": 3832, + "start": 3836, + "end": 3844, "loc": { "start": { "line": 143, @@ -34143,8 +34187,8 @@ "postfix": false, "binop": null }, - "start": 3832, - "end": 3833, + "start": 3844, + "end": 3845, "loc": { "start": { "line": 143, @@ -34168,8 +34212,8 @@ "postfix": false, "binop": null }, - "start": 3833, - "end": 3834, + "start": 3845, + "end": 3846, "loc": { "start": { "line": 143, @@ -34193,8 +34237,8 @@ "postfix": false, "binop": null }, - "start": 3835, - "end": 3836, + "start": 3847, + "end": 3848, "loc": { "start": { "line": 143, @@ -34221,8 +34265,8 @@ "updateContext": null }, "value": "return", - "start": 3845, - "end": 3851, + "start": 3857, + "end": 3863, "loc": { "start": { "line": 144, @@ -34249,8 +34293,8 @@ "updateContext": null }, "value": "this", - "start": 3852, - "end": 3856, + "start": 3864, + "end": 3868, "loc": { "start": { "line": 144, @@ -34275,8 +34319,8 @@ "binop": null, "updateContext": null }, - "start": 3856, - "end": 3857, + "start": 3868, + "end": 3869, "loc": { "start": { "line": 144, @@ -34301,8 +34345,8 @@ "binop": null }, "value": "_rotation", - "start": 3857, - "end": 3866, + "start": 3869, + "end": 3878, "loc": { "start": { "line": 144, @@ -34327,8 +34371,8 @@ "binop": null, "updateContext": null }, - "start": 3866, - "end": 3867, + "start": 3878, + "end": 3879, "loc": { "start": { "line": 144, @@ -34352,8 +34396,8 @@ "postfix": false, "binop": null }, - "start": 3872, - "end": 3873, + "start": 3884, + "end": 3885, "loc": { "start": { "line": 145, @@ -34368,8 +34412,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 3879, - "end": 4030, + "start": 3891, + "end": 4042, "loc": { "start": { "line": 147, @@ -34394,8 +34438,8 @@ "binop": null }, "value": "set", - "start": 4035, - "end": 4038, + "start": 4047, + "end": 4050, "loc": { "start": { "line": 154, @@ -34420,8 +34464,8 @@ "binop": null }, "value": "quaternion", - "start": 4039, - "end": 4049, + "start": 4051, + "end": 4061, "loc": { "start": { "line": 154, @@ -34445,8 +34489,8 @@ "postfix": false, "binop": null }, - "start": 4049, - "end": 4050, + "start": 4061, + "end": 4062, "loc": { "start": { "line": 154, @@ -34471,8 +34515,8 @@ "binop": null }, "value": "value", - "start": 4050, - "end": 4055, + "start": 4062, + "end": 4067, "loc": { "start": { "line": 154, @@ -34496,8 +34540,8 @@ "postfix": false, "binop": null }, - "start": 4055, - "end": 4056, + "start": 4067, + "end": 4068, "loc": { "start": { "line": 154, @@ -34521,8 +34565,8 @@ "postfix": false, "binop": null }, - "start": 4057, - "end": 4058, + "start": 4069, + "end": 4070, "loc": { "start": { "line": 154, @@ -34549,8 +34593,8 @@ "updateContext": null }, "value": "this", - "start": 4067, - "end": 4071, + "start": 4079, + "end": 4083, "loc": { "start": { "line": 155, @@ -34575,8 +34619,8 @@ "binop": null, "updateContext": null }, - "start": 4071, - "end": 4072, + "start": 4083, + "end": 4084, "loc": { "start": { "line": 155, @@ -34601,8 +34645,8 @@ "binop": null }, "value": "_quaternion", - "start": 4072, - "end": 4083, + "start": 4084, + "end": 4095, "loc": { "start": { "line": 155, @@ -34627,8 +34671,8 @@ "binop": null, "updateContext": null }, - "start": 4083, - "end": 4084, + "start": 4095, + "end": 4096, "loc": { "start": { "line": 155, @@ -34653,8 +34697,8 @@ "binop": null }, "value": "set", - "start": 4084, - "end": 4087, + "start": 4096, + "end": 4099, "loc": { "start": { "line": 155, @@ -34678,8 +34722,8 @@ "postfix": false, "binop": null }, - "start": 4087, - "end": 4088, + "start": 4099, + "end": 4100, "loc": { "start": { "line": 155, @@ -34704,8 +34748,8 @@ "binop": null }, "value": "value", - "start": 4088, - "end": 4093, + "start": 4100, + "end": 4105, "loc": { "start": { "line": 155, @@ -34731,8 +34775,8 @@ "updateContext": null }, "value": "||", - "start": 4094, - "end": 4096, + "start": 4106, + "end": 4108, "loc": { "start": { "line": 155, @@ -34757,8 +34801,8 @@ "binop": null, "updateContext": null }, - "start": 4097, - "end": 4098, + "start": 4109, + "end": 4110, "loc": { "start": { "line": 155, @@ -34784,8 +34828,8 @@ "updateContext": null }, "value": 0, - "start": 4098, - "end": 4099, + "start": 4110, + "end": 4111, "loc": { "start": { "line": 155, @@ -34810,8 +34854,8 @@ "binop": null, "updateContext": null }, - "start": 4099, - "end": 4100, + "start": 4111, + "end": 4112, "loc": { "start": { "line": 155, @@ -34837,8 +34881,8 @@ "updateContext": null }, "value": 0, - "start": 4101, - "end": 4102, + "start": 4113, + "end": 4114, "loc": { "start": { "line": 155, @@ -34863,8 +34907,8 @@ "binop": null, "updateContext": null }, - "start": 4102, - "end": 4103, + "start": 4114, + "end": 4115, "loc": { "start": { "line": 155, @@ -34890,8 +34934,8 @@ "updateContext": null }, "value": 0, - "start": 4104, - "end": 4105, + "start": 4116, + "end": 4117, "loc": { "start": { "line": 155, @@ -34916,8 +34960,8 @@ "binop": null, "updateContext": null }, - "start": 4105, - "end": 4106, + "start": 4117, + "end": 4118, "loc": { "start": { "line": 155, @@ -34943,8 +34987,8 @@ "updateContext": null }, "value": 1, - "start": 4107, - "end": 4108, + "start": 4119, + "end": 4120, "loc": { "start": { "line": 155, @@ -34969,8 +35013,8 @@ "binop": null, "updateContext": null }, - "start": 4108, - "end": 4109, + "start": 4120, + "end": 4121, "loc": { "start": { "line": 155, @@ -34994,8 +35038,8 @@ "postfix": false, "binop": null }, - "start": 4109, - "end": 4110, + "start": 4121, + "end": 4122, "loc": { "start": { "line": 155, @@ -35020,8 +35064,8 @@ "binop": null, "updateContext": null }, - "start": 4110, - "end": 4111, + "start": 4122, + "end": 4123, "loc": { "start": { "line": 155, @@ -35046,8 +35090,8 @@ "binop": null }, "value": "math", - "start": 4120, - "end": 4124, + "start": 4132, + "end": 4136, "loc": { "start": { "line": 156, @@ -35072,8 +35116,8 @@ "binop": null, "updateContext": null }, - "start": 4124, - "end": 4125, + "start": 4136, + "end": 4137, "loc": { "start": { "line": 156, @@ -35098,8 +35142,8 @@ "binop": null }, "value": "quaternionToEuler", - "start": 4125, - "end": 4142, + "start": 4137, + "end": 4154, "loc": { "start": { "line": 156, @@ -35123,8 +35167,8 @@ "postfix": false, "binop": null }, - "start": 4142, - "end": 4143, + "start": 4154, + "end": 4155, "loc": { "start": { "line": 156, @@ -35151,8 +35195,8 @@ "updateContext": null }, "value": "this", - "start": 4143, - "end": 4147, + "start": 4155, + "end": 4159, "loc": { "start": { "line": 156, @@ -35177,8 +35221,8 @@ "binop": null, "updateContext": null }, - "start": 4147, - "end": 4148, + "start": 4159, + "end": 4160, "loc": { "start": { "line": 156, @@ -35203,8 +35247,8 @@ "binop": null }, "value": "_quaternion", - "start": 4148, - "end": 4159, + "start": 4160, + "end": 4171, "loc": { "start": { "line": 156, @@ -35229,8 +35273,8 @@ "binop": null, "updateContext": null }, - "start": 4159, - "end": 4160, + "start": 4171, + "end": 4172, "loc": { "start": { "line": 156, @@ -35256,8 +35300,8 @@ "updateContext": null }, "value": "XYZ", - "start": 4161, - "end": 4166, + "start": 4173, + "end": 4178, "loc": { "start": { "line": 156, @@ -35282,8 +35326,8 @@ "binop": null, "updateContext": null }, - "start": 4166, - "end": 4167, + "start": 4178, + "end": 4179, "loc": { "start": { "line": 156, @@ -35310,8 +35354,8 @@ "updateContext": null }, "value": "this", - "start": 4168, - "end": 4172, + "start": 4180, + "end": 4184, "loc": { "start": { "line": 156, @@ -35336,8 +35380,8 @@ "binop": null, "updateContext": null }, - "start": 4172, - "end": 4173, + "start": 4184, + "end": 4185, "loc": { "start": { "line": 156, @@ -35362,8 +35406,8 @@ "binop": null }, "value": "_rotation", - "start": 4173, - "end": 4182, + "start": 4185, + "end": 4194, "loc": { "start": { "line": 156, @@ -35387,8 +35431,8 @@ "postfix": false, "binop": null }, - "start": 4182, - "end": 4183, + "start": 4194, + "end": 4195, "loc": { "start": { "line": 156, @@ -35413,8 +35457,8 @@ "binop": null, "updateContext": null }, - "start": 4183, - "end": 4184, + "start": 4195, + "end": 4196, "loc": { "start": { "line": 156, @@ -35441,8 +35485,8 @@ "updateContext": null }, "value": "this", - "start": 4193, - "end": 4197, + "start": 4205, + "end": 4209, "loc": { "start": { "line": 157, @@ -35467,8 +35511,8 @@ "binop": null, "updateContext": null }, - "start": 4197, - "end": 4198, + "start": 4209, + "end": 4210, "loc": { "start": { "line": 157, @@ -35493,8 +35537,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 4198, - "end": 4218, + "start": 4210, + "end": 4230, "loc": { "start": { "line": 157, @@ -35518,8 +35562,8 @@ "postfix": false, "binop": null }, - "start": 4218, - "end": 4219, + "start": 4230, + "end": 4231, "loc": { "start": { "line": 157, @@ -35543,8 +35587,8 @@ "postfix": false, "binop": null }, - "start": 4219, - "end": 4220, + "start": 4231, + "end": 4232, "loc": { "start": { "line": 157, @@ -35569,8 +35613,8 @@ "binop": null, "updateContext": null }, - "start": 4220, - "end": 4221, + "start": 4232, + "end": 4233, "loc": { "start": { "line": 157, @@ -35597,8 +35641,8 @@ "updateContext": null }, "value": "this", - "start": 4230, - "end": 4234, + "start": 4242, + "end": 4246, "loc": { "start": { "line": 158, @@ -35623,8 +35667,8 @@ "binop": null, "updateContext": null }, - "start": 4234, - "end": 4235, + "start": 4246, + "end": 4247, "loc": { "start": { "line": 158, @@ -35649,8 +35693,8 @@ "binop": null }, "value": "_model", - "start": 4235, - "end": 4241, + "start": 4247, + "end": 4253, "loc": { "start": { "line": 158, @@ -35675,8 +35719,8 @@ "binop": null, "updateContext": null }, - "start": 4241, - "end": 4242, + "start": 4253, + "end": 4254, "loc": { "start": { "line": 158, @@ -35701,8 +35745,8 @@ "binop": null }, "value": "glRedraw", - "start": 4242, - "end": 4250, + "start": 4254, + "end": 4262, "loc": { "start": { "line": 158, @@ -35726,8 +35770,8 @@ "postfix": false, "binop": null }, - "start": 4250, - "end": 4251, + "start": 4262, + "end": 4263, "loc": { "start": { "line": 158, @@ -35751,8 +35795,8 @@ "postfix": false, "binop": null }, - "start": 4251, - "end": 4252, + "start": 4263, + "end": 4264, "loc": { "start": { "line": 158, @@ -35777,8 +35821,8 @@ "binop": null, "updateContext": null }, - "start": 4252, - "end": 4253, + "start": 4264, + "end": 4265, "loc": { "start": { "line": 158, @@ -35802,8 +35846,8 @@ "postfix": false, "binop": null }, - "start": 4258, - "end": 4259, + "start": 4270, + "end": 4271, "loc": { "start": { "line": 159, @@ -35818,8 +35862,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n ", - "start": 4265, - "end": 4416, + "start": 4277, + "end": 4428, "loc": { "start": { "line": 161, @@ -35844,8 +35888,8 @@ "binop": null }, "value": "get", - "start": 4421, - "end": 4424, + "start": 4433, + "end": 4436, "loc": { "start": { "line": 168, @@ -35870,8 +35914,8 @@ "binop": null }, "value": "quaternion", - "start": 4425, - "end": 4435, + "start": 4437, + "end": 4447, "loc": { "start": { "line": 168, @@ -35895,8 +35939,8 @@ "postfix": false, "binop": null }, - "start": 4435, - "end": 4436, + "start": 4447, + "end": 4448, "loc": { "start": { "line": 168, @@ -35920,8 +35964,8 @@ "postfix": false, "binop": null }, - "start": 4436, - "end": 4437, + "start": 4448, + "end": 4449, "loc": { "start": { "line": 168, @@ -35945,8 +35989,8 @@ "postfix": false, "binop": null }, - "start": 4438, - "end": 4439, + "start": 4450, + "end": 4451, "loc": { "start": { "line": 168, @@ -35973,8 +36017,8 @@ "updateContext": null }, "value": "return", - "start": 4448, - "end": 4454, + "start": 4460, + "end": 4466, "loc": { "start": { "line": 169, @@ -36001,8 +36045,8 @@ "updateContext": null }, "value": "this", - "start": 4455, - "end": 4459, + "start": 4467, + "end": 4471, "loc": { "start": { "line": 169, @@ -36027,8 +36071,8 @@ "binop": null, "updateContext": null }, - "start": 4459, - "end": 4460, + "start": 4471, + "end": 4472, "loc": { "start": { "line": 169, @@ -36053,8 +36097,8 @@ "binop": null }, "value": "_quaternion", - "start": 4460, - "end": 4471, + "start": 4472, + "end": 4483, "loc": { "start": { "line": 169, @@ -36079,8 +36123,8 @@ "binop": null, "updateContext": null }, - "start": 4471, - "end": 4472, + "start": 4483, + "end": 4484, "loc": { "start": { "line": 169, @@ -36104,8 +36148,8 @@ "postfix": false, "binop": null }, - "start": 4477, - "end": 4478, + "start": 4489, + "end": 4490, "loc": { "start": { "line": 170, @@ -36120,8 +36164,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4484, - "end": 4619, + "start": 4496, + "end": 4631, "loc": { "start": { "line": 172, @@ -36146,8 +36190,8 @@ "binop": null }, "value": "set", - "start": 4624, - "end": 4627, + "start": 4636, + "end": 4639, "loc": { "start": { "line": 179, @@ -36172,8 +36216,8 @@ "binop": null }, "value": "scale", - "start": 4628, - "end": 4633, + "start": 4640, + "end": 4645, "loc": { "start": { "line": 179, @@ -36197,8 +36241,8 @@ "postfix": false, "binop": null }, - "start": 4633, - "end": 4634, + "start": 4645, + "end": 4646, "loc": { "start": { "line": 179, @@ -36223,8 +36267,8 @@ "binop": null }, "value": "value", - "start": 4634, - "end": 4639, + "start": 4646, + "end": 4651, "loc": { "start": { "line": 179, @@ -36248,8 +36292,8 @@ "postfix": false, "binop": null }, - "start": 4639, - "end": 4640, + "start": 4651, + "end": 4652, "loc": { "start": { "line": 179, @@ -36273,8 +36317,8 @@ "postfix": false, "binop": null }, - "start": 4641, - "end": 4642, + "start": 4653, + "end": 4654, "loc": { "start": { "line": 179, @@ -36301,8 +36345,8 @@ "updateContext": null }, "value": "this", - "start": 4651, - "end": 4655, + "start": 4663, + "end": 4667, "loc": { "start": { "line": 180, @@ -36327,8 +36371,8 @@ "binop": null, "updateContext": null }, - "start": 4655, - "end": 4656, + "start": 4667, + "end": 4668, "loc": { "start": { "line": 180, @@ -36353,8 +36397,8 @@ "binop": null }, "value": "_scale", - "start": 4656, - "end": 4662, + "start": 4668, + "end": 4674, "loc": { "start": { "line": 180, @@ -36379,8 +36423,8 @@ "binop": null, "updateContext": null }, - "start": 4662, - "end": 4663, + "start": 4674, + "end": 4675, "loc": { "start": { "line": 180, @@ -36405,8 +36449,8 @@ "binop": null }, "value": "set", - "start": 4663, - "end": 4666, + "start": 4675, + "end": 4678, "loc": { "start": { "line": 180, @@ -36430,8 +36474,8 @@ "postfix": false, "binop": null }, - "start": 4666, - "end": 4667, + "start": 4678, + "end": 4679, "loc": { "start": { "line": 180, @@ -36456,8 +36500,8 @@ "binop": null }, "value": "value", - "start": 4667, - "end": 4672, + "start": 4679, + "end": 4684, "loc": { "start": { "line": 180, @@ -36483,8 +36527,8 @@ "updateContext": null }, "value": "||", - "start": 4673, - "end": 4675, + "start": 4685, + "end": 4687, "loc": { "start": { "line": 180, @@ -36509,8 +36553,8 @@ "binop": null, "updateContext": null }, - "start": 4676, - "end": 4677, + "start": 4688, + "end": 4689, "loc": { "start": { "line": 180, @@ -36536,8 +36580,8 @@ "updateContext": null }, "value": 1, - "start": 4677, - "end": 4678, + "start": 4689, + "end": 4690, "loc": { "start": { "line": 180, @@ -36562,8 +36606,8 @@ "binop": null, "updateContext": null }, - "start": 4678, - "end": 4679, + "start": 4690, + "end": 4691, "loc": { "start": { "line": 180, @@ -36589,8 +36633,8 @@ "updateContext": null }, "value": 1, - "start": 4680, - "end": 4681, + "start": 4692, + "end": 4693, "loc": { "start": { "line": 180, @@ -36615,8 +36659,8 @@ "binop": null, "updateContext": null }, - "start": 4681, - "end": 4682, + "start": 4693, + "end": 4694, "loc": { "start": { "line": 180, @@ -36642,8 +36686,8 @@ "updateContext": null }, "value": 1, - "start": 4683, - "end": 4684, + "start": 4695, + "end": 4696, "loc": { "start": { "line": 180, @@ -36668,8 +36712,8 @@ "binop": null, "updateContext": null }, - "start": 4684, - "end": 4685, + "start": 4696, + "end": 4697, "loc": { "start": { "line": 180, @@ -36693,8 +36737,8 @@ "postfix": false, "binop": null }, - "start": 4685, - "end": 4686, + "start": 4697, + "end": 4698, "loc": { "start": { "line": 180, @@ -36719,8 +36763,8 @@ "binop": null, "updateContext": null }, - "start": 4686, - "end": 4687, + "start": 4698, + "end": 4699, "loc": { "start": { "line": 180, @@ -36747,8 +36791,8 @@ "updateContext": null }, "value": "this", - "start": 4696, - "end": 4700, + "start": 4708, + "end": 4712, "loc": { "start": { "line": 181, @@ -36773,8 +36817,8 @@ "binop": null, "updateContext": null }, - "start": 4700, - "end": 4701, + "start": 4712, + "end": 4713, "loc": { "start": { "line": 181, @@ -36799,8 +36843,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 4701, - "end": 4721, + "start": 4713, + "end": 4733, "loc": { "start": { "line": 181, @@ -36824,8 +36868,8 @@ "postfix": false, "binop": null }, - "start": 4721, - "end": 4722, + "start": 4733, + "end": 4734, "loc": { "start": { "line": 181, @@ -36849,8 +36893,8 @@ "postfix": false, "binop": null }, - "start": 4722, - "end": 4723, + "start": 4734, + "end": 4735, "loc": { "start": { "line": 181, @@ -36875,8 +36919,8 @@ "binop": null, "updateContext": null }, - "start": 4723, - "end": 4724, + "start": 4735, + "end": 4736, "loc": { "start": { "line": 181, @@ -36903,8 +36947,8 @@ "updateContext": null }, "value": "this", - "start": 4733, - "end": 4737, + "start": 4745, + "end": 4749, "loc": { "start": { "line": 182, @@ -36929,8 +36973,8 @@ "binop": null, "updateContext": null }, - "start": 4737, - "end": 4738, + "start": 4749, + "end": 4750, "loc": { "start": { "line": 182, @@ -36955,8 +36999,8 @@ "binop": null }, "value": "_model", - "start": 4738, - "end": 4744, + "start": 4750, + "end": 4756, "loc": { "start": { "line": 182, @@ -36981,8 +37025,8 @@ "binop": null, "updateContext": null }, - "start": 4744, - "end": 4745, + "start": 4756, + "end": 4757, "loc": { "start": { "line": 182, @@ -37007,8 +37051,8 @@ "binop": null }, "value": "glRedraw", - "start": 4745, - "end": 4753, + "start": 4757, + "end": 4765, "loc": { "start": { "line": 182, @@ -37032,8 +37076,8 @@ "postfix": false, "binop": null }, - "start": 4753, - "end": 4754, + "start": 4765, + "end": 4766, "loc": { "start": { "line": 182, @@ -37057,8 +37101,8 @@ "postfix": false, "binop": null }, - "start": 4754, - "end": 4755, + "start": 4766, + "end": 4767, "loc": { "start": { "line": 182, @@ -37083,8 +37127,8 @@ "binop": null, "updateContext": null }, - "start": 4755, - "end": 4756, + "start": 4767, + "end": 4768, "loc": { "start": { "line": 182, @@ -37108,8 +37152,8 @@ "postfix": false, "binop": null }, - "start": 4761, - "end": 4762, + "start": 4773, + "end": 4774, "loc": { "start": { "line": 183, @@ -37124,8 +37168,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n ", - "start": 4768, - "end": 4903, + "start": 4780, + "end": 4915, "loc": { "start": { "line": 185, @@ -37150,8 +37194,8 @@ "binop": null }, "value": "get", - "start": 4908, - "end": 4911, + "start": 4920, + "end": 4923, "loc": { "start": { "line": 192, @@ -37176,8 +37220,8 @@ "binop": null }, "value": "scale", - "start": 4912, - "end": 4917, + "start": 4924, + "end": 4929, "loc": { "start": { "line": 192, @@ -37201,8 +37245,8 @@ "postfix": false, "binop": null }, - "start": 4917, - "end": 4918, + "start": 4929, + "end": 4930, "loc": { "start": { "line": 192, @@ -37226,8 +37270,8 @@ "postfix": false, "binop": null }, - "start": 4918, - "end": 4919, + "start": 4930, + "end": 4931, "loc": { "start": { "line": 192, @@ -37251,8 +37295,8 @@ "postfix": false, "binop": null }, - "start": 4920, - "end": 4921, + "start": 4932, + "end": 4933, "loc": { "start": { "line": 192, @@ -37279,8 +37323,8 @@ "updateContext": null }, "value": "return", - "start": 4930, - "end": 4936, + "start": 4942, + "end": 4948, "loc": { "start": { "line": 193, @@ -37307,8 +37351,8 @@ "updateContext": null }, "value": "this", - "start": 4937, - "end": 4941, + "start": 4949, + "end": 4953, "loc": { "start": { "line": 193, @@ -37333,8 +37377,8 @@ "binop": null, "updateContext": null }, - "start": 4941, - "end": 4942, + "start": 4953, + "end": 4954, "loc": { "start": { "line": 193, @@ -37359,8 +37403,8 @@ "binop": null }, "value": "_scale", - "start": 4942, - "end": 4948, + "start": 4954, + "end": 4960, "loc": { "start": { "line": 193, @@ -37385,8 +37429,8 @@ "binop": null, "updateContext": null }, - "start": 4948, - "end": 4949, + "start": 4960, + "end": 4961, "loc": { "start": { "line": 193, @@ -37410,8 +37454,8 @@ "postfix": false, "binop": null }, - "start": 4954, - "end": 4955, + "start": 4966, + "end": 4967, "loc": { "start": { "line": 194, @@ -37426,8 +37470,8 @@ { "type": "CommentBlock", "value": "*\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 4961, - "end": 5148, + "start": 4973, + "end": 5160, "loc": { "start": { "line": 196, @@ -37452,8 +37496,8 @@ "binop": null }, "value": "set", - "start": 5153, - "end": 5156, + "start": 5165, + "end": 5168, "loc": { "start": { "line": 203, @@ -37478,8 +37522,8 @@ "binop": null }, "value": "matrix", - "start": 5157, - "end": 5163, + "start": 5169, + "end": 5175, "loc": { "start": { "line": 203, @@ -37503,8 +37547,8 @@ "postfix": false, "binop": null }, - "start": 5163, - "end": 5164, + "start": 5175, + "end": 5176, "loc": { "start": { "line": 203, @@ -37529,8 +37573,8 @@ "binop": null }, "value": "value", - "start": 5164, - "end": 5169, + "start": 5176, + "end": 5181, "loc": { "start": { "line": 203, @@ -37554,8 +37598,8 @@ "postfix": false, "binop": null }, - "start": 5169, - "end": 5170, + "start": 5181, + "end": 5182, "loc": { "start": { "line": 203, @@ -37579,8 +37623,8 @@ "postfix": false, "binop": null }, - "start": 5171, - "end": 5172, + "start": 5183, + "end": 5184, "loc": { "start": { "line": 203, @@ -37607,8 +37651,8 @@ "updateContext": null }, "value": "if", - "start": 5181, - "end": 5183, + "start": 5193, + "end": 5195, "loc": { "start": { "line": 204, @@ -37632,8 +37676,8 @@ "postfix": false, "binop": null }, - "start": 5184, - "end": 5185, + "start": 5196, + "end": 5197, "loc": { "start": { "line": 204, @@ -37659,8 +37703,8 @@ "updateContext": null }, "value": "!", - "start": 5185, - "end": 5186, + "start": 5197, + "end": 5198, "loc": { "start": { "line": 204, @@ -37687,8 +37731,8 @@ "updateContext": null }, "value": "this", - "start": 5186, - "end": 5190, + "start": 5198, + "end": 5202, "loc": { "start": { "line": 204, @@ -37713,8 +37757,8 @@ "binop": null, "updateContext": null }, - "start": 5190, - "end": 5191, + "start": 5202, + "end": 5203, "loc": { "start": { "line": 204, @@ -37739,8 +37783,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5191, - "end": 5203, + "start": 5203, + "end": 5215, "loc": { "start": { "line": 204, @@ -37764,8 +37808,8 @@ "postfix": false, "binop": null }, - "start": 5203, - "end": 5204, + "start": 5215, + "end": 5216, "loc": { "start": { "line": 204, @@ -37789,8 +37833,8 @@ "postfix": false, "binop": null }, - "start": 5205, - "end": 5206, + "start": 5217, + "end": 5218, "loc": { "start": { "line": 204, @@ -37817,8 +37861,8 @@ "updateContext": null }, "value": "this", - "start": 5219, - "end": 5223, + "start": 5231, + "end": 5235, "loc": { "start": { "line": 205, @@ -37843,8 +37887,8 @@ "binop": null, "updateContext": null }, - "start": 5223, - "end": 5224, + "start": 5235, + "end": 5236, "loc": { "start": { "line": 205, @@ -37869,8 +37913,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5224, - "end": 5236, + "start": 5236, + "end": 5248, "loc": { "start": { "line": 205, @@ -37896,8 +37940,8 @@ "updateContext": null }, "value": "=", - "start": 5237, - "end": 5238, + "start": 5249, + "end": 5250, "loc": { "start": { "line": 205, @@ -37922,8 +37966,8 @@ "binop": null }, "value": "math", - "start": 5239, - "end": 5243, + "start": 5251, + "end": 5255, "loc": { "start": { "line": 205, @@ -37948,8 +37992,8 @@ "binop": null, "updateContext": null }, - "start": 5243, - "end": 5244, + "start": 5255, + "end": 5256, "loc": { "start": { "line": 205, @@ -37974,8 +38018,8 @@ "binop": null }, "value": "identityMat4", - "start": 5244, - "end": 5256, + "start": 5256, + "end": 5268, "loc": { "start": { "line": 205, @@ -37999,8 +38043,8 @@ "postfix": false, "binop": null }, - "start": 5256, - "end": 5257, + "start": 5268, + "end": 5269, "loc": { "start": { "line": 205, @@ -38024,8 +38068,8 @@ "postfix": false, "binop": null }, - "start": 5257, - "end": 5258, + "start": 5269, + "end": 5270, "loc": { "start": { "line": 205, @@ -38050,8 +38094,8 @@ "binop": null, "updateContext": null }, - "start": 5258, - "end": 5259, + "start": 5270, + "end": 5271, "loc": { "start": { "line": 205, @@ -38075,8 +38119,8 @@ "postfix": false, "binop": null }, - "start": 5268, - "end": 5269, + "start": 5280, + "end": 5281, "loc": { "start": { "line": 206, @@ -38103,8 +38147,8 @@ "updateContext": null }, "value": "this", - "start": 5278, - "end": 5282, + "start": 5290, + "end": 5294, "loc": { "start": { "line": 207, @@ -38129,8 +38173,8 @@ "binop": null, "updateContext": null }, - "start": 5282, - "end": 5283, + "start": 5294, + "end": 5295, "loc": { "start": { "line": 207, @@ -38155,8 +38199,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5283, - "end": 5295, + "start": 5295, + "end": 5307, "loc": { "start": { "line": 207, @@ -38181,8 +38225,8 @@ "binop": null, "updateContext": null }, - "start": 5295, - "end": 5296, + "start": 5307, + "end": 5308, "loc": { "start": { "line": 207, @@ -38207,8 +38251,8 @@ "binop": null }, "value": "set", - "start": 5296, - "end": 5299, + "start": 5308, + "end": 5311, "loc": { "start": { "line": 207, @@ -38232,8 +38276,8 @@ "postfix": false, "binop": null }, - "start": 5299, - "end": 5300, + "start": 5311, + "end": 5312, "loc": { "start": { "line": 207, @@ -38258,8 +38302,8 @@ "binop": null }, "value": "value", - "start": 5300, - "end": 5305, + "start": 5312, + "end": 5317, "loc": { "start": { "line": 207, @@ -38285,8 +38329,8 @@ "updateContext": null }, "value": "||", - "start": 5306, - "end": 5308, + "start": 5318, + "end": 5320, "loc": { "start": { "line": 207, @@ -38311,8 +38355,8 @@ "binop": null }, "value": "identityMat", - "start": 5309, - "end": 5320, + "start": 5321, + "end": 5332, "loc": { "start": { "line": 207, @@ -38336,8 +38380,8 @@ "postfix": false, "binop": null }, - "start": 5320, - "end": 5321, + "start": 5332, + "end": 5333, "loc": { "start": { "line": 207, @@ -38362,8 +38406,8 @@ "binop": null, "updateContext": null }, - "start": 5321, - "end": 5322, + "start": 5333, + "end": 5334, "loc": { "start": { "line": 207, @@ -38388,8 +38432,8 @@ "binop": null }, "value": "math", - "start": 5331, - "end": 5335, + "start": 5343, + "end": 5347, "loc": { "start": { "line": 208, @@ -38414,8 +38458,8 @@ "binop": null, "updateContext": null }, - "start": 5335, - "end": 5336, + "start": 5347, + "end": 5348, "loc": { "start": { "line": 208, @@ -38440,8 +38484,8 @@ "binop": null }, "value": "decomposeMat4", - "start": 5336, - "end": 5349, + "start": 5348, + "end": 5361, "loc": { "start": { "line": 208, @@ -38465,8 +38509,8 @@ "postfix": false, "binop": null }, - "start": 5349, - "end": 5350, + "start": 5361, + "end": 5362, "loc": { "start": { "line": 208, @@ -38493,8 +38537,8 @@ "updateContext": null }, "value": "this", - "start": 5350, - "end": 5354, + "start": 5362, + "end": 5366, "loc": { "start": { "line": 208, @@ -38519,8 +38563,8 @@ "binop": null, "updateContext": null }, - "start": 5354, - "end": 5355, + "start": 5366, + "end": 5367, "loc": { "start": { "line": 208, @@ -38545,8 +38589,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5355, - "end": 5367, + "start": 5367, + "end": 5379, "loc": { "start": { "line": 208, @@ -38571,8 +38615,8 @@ "binop": null, "updateContext": null }, - "start": 5367, - "end": 5368, + "start": 5379, + "end": 5380, "loc": { "start": { "line": 208, @@ -38599,8 +38643,8 @@ "updateContext": null }, "value": "this", - "start": 5369, - "end": 5373, + "start": 5381, + "end": 5385, "loc": { "start": { "line": 208, @@ -38625,8 +38669,8 @@ "binop": null, "updateContext": null }, - "start": 5373, - "end": 5374, + "start": 5385, + "end": 5386, "loc": { "start": { "line": 208, @@ -38651,8 +38695,8 @@ "binop": null }, "value": "_position", - "start": 5374, - "end": 5383, + "start": 5386, + "end": 5395, "loc": { "start": { "line": 208, @@ -38677,8 +38721,8 @@ "binop": null, "updateContext": null }, - "start": 5383, - "end": 5384, + "start": 5395, + "end": 5396, "loc": { "start": { "line": 208, @@ -38705,8 +38749,8 @@ "updateContext": null }, "value": "this", - "start": 5385, - "end": 5389, + "start": 5397, + "end": 5401, "loc": { "start": { "line": 208, @@ -38731,8 +38775,8 @@ "binop": null, "updateContext": null }, - "start": 5389, - "end": 5390, + "start": 5401, + "end": 5402, "loc": { "start": { "line": 208, @@ -38757,8 +38801,8 @@ "binop": null }, "value": "_quaternion", - "start": 5390, - "end": 5401, + "start": 5402, + "end": 5413, "loc": { "start": { "line": 208, @@ -38783,8 +38827,8 @@ "binop": null, "updateContext": null }, - "start": 5401, - "end": 5402, + "start": 5413, + "end": 5414, "loc": { "start": { "line": 208, @@ -38811,8 +38855,8 @@ "updateContext": null }, "value": "this", - "start": 5403, - "end": 5407, + "start": 5415, + "end": 5419, "loc": { "start": { "line": 208, @@ -38837,8 +38881,8 @@ "binop": null, "updateContext": null }, - "start": 5407, - "end": 5408, + "start": 5419, + "end": 5420, "loc": { "start": { "line": 208, @@ -38863,8 +38907,8 @@ "binop": null }, "value": "_scale", - "start": 5408, - "end": 5414, + "start": 5420, + "end": 5426, "loc": { "start": { "line": 208, @@ -38888,8 +38932,8 @@ "postfix": false, "binop": null }, - "start": 5414, - "end": 5415, + "start": 5426, + "end": 5427, "loc": { "start": { "line": 208, @@ -38914,8 +38958,8 @@ "binop": null, "updateContext": null }, - "start": 5415, - "end": 5416, + "start": 5427, + "end": 5428, "loc": { "start": { "line": 208, @@ -38942,8 +38986,8 @@ "updateContext": null }, "value": "this", - "start": 5425, - "end": 5429, + "start": 5437, + "end": 5441, "loc": { "start": { "line": 209, @@ -38968,8 +39012,8 @@ "binop": null, "updateContext": null }, - "start": 5429, - "end": 5430, + "start": 5441, + "end": 5442, "loc": { "start": { "line": 209, @@ -38994,8 +39038,8 @@ "binop": null }, "value": "_localMatrixDirty", - "start": 5430, - "end": 5447, + "start": 5442, + "end": 5459, "loc": { "start": { "line": 209, @@ -39021,8 +39065,8 @@ "updateContext": null }, "value": "=", - "start": 5448, - "end": 5449, + "start": 5460, + "end": 5461, "loc": { "start": { "line": 209, @@ -39049,8 +39093,8 @@ "updateContext": null }, "value": "false", - "start": 5450, - "end": 5455, + "start": 5462, + "end": 5467, "loc": { "start": { "line": 209, @@ -39075,8 +39119,8 @@ "binop": null, "updateContext": null }, - "start": 5455, - "end": 5456, + "start": 5467, + "end": 5468, "loc": { "start": { "line": 209, @@ -39103,8 +39147,8 @@ "updateContext": null }, "value": "this", - "start": 5465, - "end": 5469, + "start": 5477, + "end": 5481, "loc": { "start": { "line": 210, @@ -39129,8 +39173,8 @@ "binop": null, "updateContext": null }, - "start": 5469, - "end": 5470, + "start": 5481, + "end": 5482, "loc": { "start": { "line": 210, @@ -39155,8 +39199,8 @@ "binop": null }, "value": "_transformDirty", - "start": 5470, - "end": 5485, + "start": 5482, + "end": 5497, "loc": { "start": { "line": 210, @@ -39180,8 +39224,8 @@ "postfix": false, "binop": null }, - "start": 5485, - "end": 5486, + "start": 5497, + "end": 5498, "loc": { "start": { "line": 210, @@ -39205,8 +39249,8 @@ "postfix": false, "binop": null }, - "start": 5486, - "end": 5487, + "start": 5498, + "end": 5499, "loc": { "start": { "line": 210, @@ -39231,8 +39275,8 @@ "binop": null, "updateContext": null }, - "start": 5487, - "end": 5488, + "start": 5499, + "end": 5500, "loc": { "start": { "line": 210, @@ -39259,8 +39303,8 @@ "updateContext": null }, "value": "this", - "start": 5497, - "end": 5501, + "start": 5509, + "end": 5513, "loc": { "start": { "line": 211, @@ -39285,8 +39329,8 @@ "binop": null, "updateContext": null }, - "start": 5501, - "end": 5502, + "start": 5513, + "end": 5514, "loc": { "start": { "line": 211, @@ -39311,8 +39355,8 @@ "binop": null }, "value": "_model", - "start": 5502, - "end": 5508, + "start": 5514, + "end": 5520, "loc": { "start": { "line": 211, @@ -39337,8 +39381,8 @@ "binop": null, "updateContext": null }, - "start": 5508, - "end": 5509, + "start": 5520, + "end": 5521, "loc": { "start": { "line": 211, @@ -39363,8 +39407,8 @@ "binop": null }, "value": "glRedraw", - "start": 5509, - "end": 5517, + "start": 5521, + "end": 5529, "loc": { "start": { "line": 211, @@ -39388,8 +39432,8 @@ "postfix": false, "binop": null }, - "start": 5517, - "end": 5518, + "start": 5529, + "end": 5530, "loc": { "start": { "line": 211, @@ -39413,8 +39457,8 @@ "postfix": false, "binop": null }, - "start": 5518, - "end": 5519, + "start": 5530, + "end": 5531, "loc": { "start": { "line": 211, @@ -39439,8 +39483,8 @@ "binop": null, "updateContext": null }, - "start": 5519, - "end": 5520, + "start": 5531, + "end": 5532, "loc": { "start": { "line": 211, @@ -39464,8 +39508,8 @@ "postfix": false, "binop": null }, - "start": 5525, - "end": 5526, + "start": 5537, + "end": 5538, "loc": { "start": { "line": 212, @@ -39480,8 +39524,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n ", - "start": 5532, - "end": 5719, + "start": 5544, + "end": 5731, "loc": { "start": { "line": 214, @@ -39506,8 +39550,8 @@ "binop": null }, "value": "get", - "start": 5724, - "end": 5727, + "start": 5736, + "end": 5739, "loc": { "start": { "line": 221, @@ -39532,8 +39576,8 @@ "binop": null }, "value": "matrix", - "start": 5728, - "end": 5734, + "start": 5740, + "end": 5746, "loc": { "start": { "line": 221, @@ -39557,8 +39601,8 @@ "postfix": false, "binop": null }, - "start": 5734, - "end": 5735, + "start": 5746, + "end": 5747, "loc": { "start": { "line": 221, @@ -39582,8 +39626,8 @@ "postfix": false, "binop": null }, - "start": 5735, - "end": 5736, + "start": 5747, + "end": 5748, "loc": { "start": { "line": 221, @@ -39607,8 +39651,8 @@ "postfix": false, "binop": null }, - "start": 5737, - "end": 5738, + "start": 5749, + "end": 5750, "loc": { "start": { "line": 221, @@ -39635,8 +39679,8 @@ "updateContext": null }, "value": "if", - "start": 5747, - "end": 5749, + "start": 5759, + "end": 5761, "loc": { "start": { "line": 222, @@ -39660,8 +39704,8 @@ "postfix": false, "binop": null }, - "start": 5750, - "end": 5751, + "start": 5762, + "end": 5763, "loc": { "start": { "line": 222, @@ -39688,8 +39732,8 @@ "updateContext": null }, "value": "this", - "start": 5751, - "end": 5755, + "start": 5763, + "end": 5767, "loc": { "start": { "line": 222, @@ -39714,8 +39758,8 @@ "binop": null, "updateContext": null }, - "start": 5755, - "end": 5756, + "start": 5767, + "end": 5768, "loc": { "start": { "line": 222, @@ -39740,8 +39784,8 @@ "binop": null }, "value": "_localMatrixDirty", - "start": 5756, - "end": 5773, + "start": 5768, + "end": 5785, "loc": { "start": { "line": 222, @@ -39765,8 +39809,8 @@ "postfix": false, "binop": null }, - "start": 5773, - "end": 5774, + "start": 5785, + "end": 5786, "loc": { "start": { "line": 222, @@ -39790,8 +39834,8 @@ "postfix": false, "binop": null }, - "start": 5775, - "end": 5776, + "start": 5787, + "end": 5788, "loc": { "start": { "line": 222, @@ -39818,8 +39862,8 @@ "updateContext": null }, "value": "if", - "start": 5789, - "end": 5791, + "start": 5801, + "end": 5803, "loc": { "start": { "line": 223, @@ -39843,8 +39887,8 @@ "postfix": false, "binop": null }, - "start": 5792, - "end": 5793, + "start": 5804, + "end": 5805, "loc": { "start": { "line": 223, @@ -39870,8 +39914,8 @@ "updateContext": null }, "value": "!", - "start": 5793, - "end": 5794, + "start": 5805, + "end": 5806, "loc": { "start": { "line": 223, @@ -39898,8 +39942,8 @@ "updateContext": null }, "value": "this", - "start": 5794, - "end": 5798, + "start": 5806, + "end": 5810, "loc": { "start": { "line": 223, @@ -39924,8 +39968,8 @@ "binop": null, "updateContext": null }, - "start": 5798, - "end": 5799, + "start": 5810, + "end": 5811, "loc": { "start": { "line": 223, @@ -39950,8 +39994,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5799, - "end": 5811, + "start": 5811, + "end": 5823, "loc": { "start": { "line": 223, @@ -39975,8 +40019,8 @@ "postfix": false, "binop": null }, - "start": 5811, - "end": 5812, + "start": 5823, + "end": 5824, "loc": { "start": { "line": 223, @@ -40000,8 +40044,8 @@ "postfix": false, "binop": null }, - "start": 5813, - "end": 5814, + "start": 5825, + "end": 5826, "loc": { "start": { "line": 223, @@ -40028,8 +40072,8 @@ "updateContext": null }, "value": "this", - "start": 5831, - "end": 5835, + "start": 5843, + "end": 5847, "loc": { "start": { "line": 224, @@ -40054,8 +40098,8 @@ "binop": null, "updateContext": null }, - "start": 5835, - "end": 5836, + "start": 5847, + "end": 5848, "loc": { "start": { "line": 224, @@ -40080,8 +40124,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5836, - "end": 5848, + "start": 5848, + "end": 5860, "loc": { "start": { "line": 224, @@ -40107,8 +40151,8 @@ "updateContext": null }, "value": "=", - "start": 5849, - "end": 5850, + "start": 5861, + "end": 5862, "loc": { "start": { "line": 224, @@ -40133,8 +40177,8 @@ "binop": null }, "value": "math", - "start": 5851, - "end": 5855, + "start": 5863, + "end": 5867, "loc": { "start": { "line": 224, @@ -40159,8 +40203,8 @@ "binop": null, "updateContext": null }, - "start": 5855, - "end": 5856, + "start": 5867, + "end": 5868, "loc": { "start": { "line": 224, @@ -40185,8 +40229,8 @@ "binop": null }, "value": "identityMat4", - "start": 5856, - "end": 5868, + "start": 5868, + "end": 5880, "loc": { "start": { "line": 224, @@ -40210,8 +40254,8 @@ "postfix": false, "binop": null }, - "start": 5868, - "end": 5869, + "start": 5880, + "end": 5881, "loc": { "start": { "line": 224, @@ -40235,8 +40279,8 @@ "postfix": false, "binop": null }, - "start": 5869, - "end": 5870, + "start": 5881, + "end": 5882, "loc": { "start": { "line": 224, @@ -40261,8 +40305,8 @@ "binop": null, "updateContext": null }, - "start": 5870, - "end": 5871, + "start": 5882, + "end": 5883, "loc": { "start": { "line": 224, @@ -40286,8 +40330,8 @@ "postfix": false, "binop": null }, - "start": 5884, - "end": 5885, + "start": 5896, + "end": 5897, "loc": { "start": { "line": 225, @@ -40312,8 +40356,8 @@ "binop": null }, "value": "math", - "start": 5898, - "end": 5902, + "start": 5910, + "end": 5914, "loc": { "start": { "line": 226, @@ -40338,8 +40382,8 @@ "binop": null, "updateContext": null }, - "start": 5902, - "end": 5903, + "start": 5914, + "end": 5915, "loc": { "start": { "line": 226, @@ -40364,8 +40408,8 @@ "binop": null }, "value": "composeMat4", - "start": 5903, - "end": 5914, + "start": 5915, + "end": 5926, "loc": { "start": { "line": 226, @@ -40389,8 +40433,8 @@ "postfix": false, "binop": null }, - "start": 5914, - "end": 5915, + "start": 5926, + "end": 5927, "loc": { "start": { "line": 226, @@ -40417,8 +40461,8 @@ "updateContext": null }, "value": "this", - "start": 5915, - "end": 5919, + "start": 5927, + "end": 5931, "loc": { "start": { "line": 226, @@ -40443,8 +40487,8 @@ "binop": null, "updateContext": null }, - "start": 5919, - "end": 5920, + "start": 5931, + "end": 5932, "loc": { "start": { "line": 226, @@ -40469,8 +40513,8 @@ "binop": null }, "value": "_position", - "start": 5920, - "end": 5929, + "start": 5932, + "end": 5941, "loc": { "start": { "line": 226, @@ -40495,8 +40539,8 @@ "binop": null, "updateContext": null }, - "start": 5929, - "end": 5930, + "start": 5941, + "end": 5942, "loc": { "start": { "line": 226, @@ -40523,8 +40567,8 @@ "updateContext": null }, "value": "this", - "start": 5931, - "end": 5935, + "start": 5943, + "end": 5947, "loc": { "start": { "line": 226, @@ -40549,8 +40593,8 @@ "binop": null, "updateContext": null }, - "start": 5935, - "end": 5936, + "start": 5947, + "end": 5948, "loc": { "start": { "line": 226, @@ -40575,8 +40619,8 @@ "binop": null }, "value": "_quaternion", - "start": 5936, - "end": 5947, + "start": 5948, + "end": 5959, "loc": { "start": { "line": 226, @@ -40601,8 +40645,8 @@ "binop": null, "updateContext": null }, - "start": 5947, - "end": 5948, + "start": 5959, + "end": 5960, "loc": { "start": { "line": 226, @@ -40629,8 +40673,8 @@ "updateContext": null }, "value": "this", - "start": 5949, - "end": 5953, + "start": 5961, + "end": 5965, "loc": { "start": { "line": 226, @@ -40655,8 +40699,8 @@ "binop": null, "updateContext": null }, - "start": 5953, - "end": 5954, + "start": 5965, + "end": 5966, "loc": { "start": { "line": 226, @@ -40681,8 +40725,8 @@ "binop": null }, "value": "_scale", - "start": 5954, - "end": 5960, + "start": 5966, + "end": 5972, "loc": { "start": { "line": 226, @@ -40707,8 +40751,8 @@ "binop": null, "updateContext": null }, - "start": 5960, - "end": 5961, + "start": 5972, + "end": 5973, "loc": { "start": { "line": 226, @@ -40735,8 +40779,8 @@ "updateContext": null }, "value": "this", - "start": 5962, - "end": 5966, + "start": 5974, + "end": 5978, "loc": { "start": { "line": 226, @@ -40761,8 +40805,8 @@ "binop": null, "updateContext": null }, - "start": 5966, - "end": 5967, + "start": 5978, + "end": 5979, "loc": { "start": { "line": 226, @@ -40787,8 +40831,8 @@ "binop": null }, "value": "_localMatrix", - "start": 5967, - "end": 5979, + "start": 5979, + "end": 5991, "loc": { "start": { "line": 226, @@ -40812,8 +40856,8 @@ "postfix": false, "binop": null }, - "start": 5979, - "end": 5980, + "start": 5991, + "end": 5992, "loc": { "start": { "line": 226, @@ -40838,8 +40882,8 @@ "binop": null, "updateContext": null }, - "start": 5980, - "end": 5981, + "start": 5992, + "end": 5993, "loc": { "start": { "line": 226, @@ -40866,8 +40910,8 @@ "updateContext": null }, "value": "this", - "start": 5994, - "end": 5998, + "start": 6006, + "end": 6010, "loc": { "start": { "line": 227, @@ -40892,8 +40936,8 @@ "binop": null, "updateContext": null }, - "start": 5998, - "end": 5999, + "start": 6010, + "end": 6011, "loc": { "start": { "line": 227, @@ -40918,8 +40962,8 @@ "binop": null }, "value": "_localMatrixDirty", - "start": 5999, - "end": 6016, + "start": 6011, + "end": 6028, "loc": { "start": { "line": 227, @@ -40945,8 +40989,8 @@ "updateContext": null }, "value": "=", - "start": 6017, - "end": 6018, + "start": 6029, + "end": 6030, "loc": { "start": { "line": 227, @@ -40973,8 +41017,8 @@ "updateContext": null }, "value": "false", - "start": 6019, - "end": 6024, + "start": 6031, + "end": 6036, "loc": { "start": { "line": 227, @@ -40999,8 +41043,8 @@ "binop": null, "updateContext": null }, - "start": 6024, - "end": 6025, + "start": 6036, + "end": 6037, "loc": { "start": { "line": 227, @@ -41024,8 +41068,8 @@ "postfix": false, "binop": null }, - "start": 6034, - "end": 6035, + "start": 6046, + "end": 6047, "loc": { "start": { "line": 228, @@ -41052,8 +41096,8 @@ "updateContext": null }, "value": "return", - "start": 6044, - "end": 6050, + "start": 6056, + "end": 6062, "loc": { "start": { "line": 229, @@ -41080,8 +41124,8 @@ "updateContext": null }, "value": "this", - "start": 6051, - "end": 6055, + "start": 6063, + "end": 6067, "loc": { "start": { "line": 229, @@ -41106,8 +41150,8 @@ "binop": null, "updateContext": null }, - "start": 6055, - "end": 6056, + "start": 6067, + "end": 6068, "loc": { "start": { "line": 229, @@ -41132,8 +41176,8 @@ "binop": null }, "value": "_localMatrix", - "start": 6056, - "end": 6068, + "start": 6068, + "end": 6080, "loc": { "start": { "line": 229, @@ -41158,8 +41202,8 @@ "binop": null, "updateContext": null }, - "start": 6068, - "end": 6069, + "start": 6080, + "end": 6081, "loc": { "start": { "line": 229, @@ -41183,8 +41227,8 @@ "postfix": false, "binop": null }, - "start": 6074, - "end": 6075, + "start": 6086, + "end": 6087, "loc": { "start": { "line": 230, @@ -41199,8 +41243,8 @@ { "type": "CommentBlock", "value": "*\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n ", - "start": 6081, - "end": 6204, + "start": 6093, + "end": 6216, "loc": { "start": { "line": 232, @@ -41225,8 +41269,8 @@ "binop": null }, "value": "get", - "start": 6209, - "end": 6212, + "start": 6221, + "end": 6224, "loc": { "start": { "line": 238, @@ -41251,8 +41295,8 @@ "binop": null }, "value": "worldMatrix", - "start": 6213, - "end": 6224, + "start": 6225, + "end": 6236, "loc": { "start": { "line": 238, @@ -41276,8 +41320,8 @@ "postfix": false, "binop": null }, - "start": 6224, - "end": 6225, + "start": 6236, + "end": 6237, "loc": { "start": { "line": 238, @@ -41301,8 +41345,8 @@ "postfix": false, "binop": null }, - "start": 6225, - "end": 6226, + "start": 6237, + "end": 6238, "loc": { "start": { "line": 238, @@ -41326,8 +41370,8 @@ "postfix": false, "binop": null }, - "start": 6227, - "end": 6228, + "start": 6239, + "end": 6240, "loc": { "start": { "line": 238, @@ -41354,8 +41398,8 @@ "updateContext": null }, "value": "if", - "start": 6237, - "end": 6239, + "start": 6249, + "end": 6251, "loc": { "start": { "line": 239, @@ -41379,8 +41423,8 @@ "postfix": false, "binop": null }, - "start": 6240, - "end": 6241, + "start": 6252, + "end": 6253, "loc": { "start": { "line": 239, @@ -41407,8 +41451,8 @@ "updateContext": null }, "value": "this", - "start": 6241, - "end": 6245, + "start": 6253, + "end": 6257, "loc": { "start": { "line": 239, @@ -41433,8 +41477,8 @@ "binop": null, "updateContext": null }, - "start": 6245, - "end": 6246, + "start": 6257, + "end": 6258, "loc": { "start": { "line": 239, @@ -41459,8 +41503,8 @@ "binop": null }, "value": "_worldMatrixDirty", - "start": 6246, - "end": 6263, + "start": 6258, + "end": 6275, "loc": { "start": { "line": 239, @@ -41484,8 +41528,8 @@ "postfix": false, "binop": null }, - "start": 6263, - "end": 6264, + "start": 6275, + "end": 6276, "loc": { "start": { "line": 239, @@ -41509,8 +41553,8 @@ "postfix": false, "binop": null }, - "start": 6265, - "end": 6266, + "start": 6277, + "end": 6278, "loc": { "start": { "line": 239, @@ -41537,8 +41581,8 @@ "updateContext": null }, "value": "this", - "start": 6279, - "end": 6283, + "start": 6291, + "end": 6295, "loc": { "start": { "line": 240, @@ -41563,8 +41607,8 @@ "binop": null, "updateContext": null }, - "start": 6283, - "end": 6284, + "start": 6295, + "end": 6296, "loc": { "start": { "line": 240, @@ -41589,8 +41633,8 @@ "binop": null }, "value": "_buildWorldMatrix", - "start": 6284, - "end": 6301, + "start": 6296, + "end": 6313, "loc": { "start": { "line": 240, @@ -41614,8 +41658,8 @@ "postfix": false, "binop": null }, - "start": 6301, - "end": 6302, + "start": 6313, + "end": 6314, "loc": { "start": { "line": 240, @@ -41639,8 +41683,8 @@ "postfix": false, "binop": null }, - "start": 6302, - "end": 6303, + "start": 6314, + "end": 6315, "loc": { "start": { "line": 240, @@ -41665,8 +41709,8 @@ "binop": null, "updateContext": null }, - "start": 6303, - "end": 6304, + "start": 6315, + "end": 6316, "loc": { "start": { "line": 240, @@ -41690,8 +41734,8 @@ "postfix": false, "binop": null }, - "start": 6313, - "end": 6314, + "start": 6325, + "end": 6326, "loc": { "start": { "line": 241, @@ -41718,8 +41762,8 @@ "updateContext": null }, "value": "return", - "start": 6323, - "end": 6329, + "start": 6335, + "end": 6341, "loc": { "start": { "line": 242, @@ -41746,8 +41790,8 @@ "updateContext": null }, "value": "this", - "start": 6330, - "end": 6334, + "start": 6342, + "end": 6346, "loc": { "start": { "line": 242, @@ -41772,8 +41816,8 @@ "binop": null, "updateContext": null }, - "start": 6334, - "end": 6335, + "start": 6346, + "end": 6347, "loc": { "start": { "line": 242, @@ -41798,8 +41842,8 @@ "binop": null }, "value": "_worldMatrix", - "start": 6335, - "end": 6347, + "start": 6347, + "end": 6359, "loc": { "start": { "line": 242, @@ -41824,8 +41868,8 @@ "binop": null, "updateContext": null }, - "start": 6347, - "end": 6348, + "start": 6359, + "end": 6360, "loc": { "start": { "line": 242, @@ -41849,8 +41893,8 @@ "postfix": false, "binop": null }, - "start": 6353, - "end": 6354, + "start": 6365, + "end": 6366, "loc": { "start": { "line": 243, @@ -41865,8 +41909,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6360, - "end": 6583, + "start": 6372, + "end": 6595, "loc": { "start": { "line": 245, @@ -41891,8 +41935,8 @@ "binop": null }, "value": "rotate", - "start": 6588, - "end": 6594, + "start": 6600, + "end": 6606, "loc": { "start": { "line": 251, @@ -41916,8 +41960,8 @@ "postfix": false, "binop": null }, - "start": 6594, - "end": 6595, + "start": 6606, + "end": 6607, "loc": { "start": { "line": 251, @@ -41942,8 +41986,8 @@ "binop": null }, "value": "axis", - "start": 6595, - "end": 6599, + "start": 6607, + "end": 6611, "loc": { "start": { "line": 251, @@ -41968,8 +42012,8 @@ "binop": null, "updateContext": null }, - "start": 6599, - "end": 6600, + "start": 6611, + "end": 6612, "loc": { "start": { "line": 251, @@ -41994,8 +42038,8 @@ "binop": null }, "value": "angle", - "start": 6601, - "end": 6606, + "start": 6613, + "end": 6618, "loc": { "start": { "line": 251, @@ -42019,8 +42063,8 @@ "postfix": false, "binop": null }, - "start": 6606, - "end": 6607, + "start": 6618, + "end": 6619, "loc": { "start": { "line": 251, @@ -42044,8 +42088,8 @@ "postfix": false, "binop": null }, - "start": 6608, - "end": 6609, + "start": 6620, + "end": 6621, "loc": { "start": { "line": 251, @@ -42070,8 +42114,8 @@ "binop": null }, "value": "angleAxis", - "start": 6618, - "end": 6627, + "start": 6630, + "end": 6639, "loc": { "start": { "line": 252, @@ -42096,8 +42140,8 @@ "binop": null, "updateContext": null }, - "start": 6627, - "end": 6628, + "start": 6639, + "end": 6640, "loc": { "start": { "line": 252, @@ -42123,8 +42167,8 @@ "updateContext": null }, "value": 0, - "start": 6628, - "end": 6629, + "start": 6640, + "end": 6641, "loc": { "start": { "line": 252, @@ -42149,8 +42193,8 @@ "binop": null, "updateContext": null }, - "start": 6629, - "end": 6630, + "start": 6641, + "end": 6642, "loc": { "start": { "line": 252, @@ -42176,8 +42220,8 @@ "updateContext": null }, "value": "=", - "start": 6631, - "end": 6632, + "start": 6643, + "end": 6644, "loc": { "start": { "line": 252, @@ -42202,8 +42246,8 @@ "binop": null }, "value": "axis", - "start": 6633, - "end": 6637, + "start": 6645, + "end": 6649, "loc": { "start": { "line": 252, @@ -42228,8 +42272,8 @@ "binop": null, "updateContext": null }, - "start": 6637, - "end": 6638, + "start": 6649, + "end": 6650, "loc": { "start": { "line": 252, @@ -42255,8 +42299,8 @@ "updateContext": null }, "value": 0, - "start": 6638, - "end": 6639, + "start": 6650, + "end": 6651, "loc": { "start": { "line": 252, @@ -42281,8 +42325,8 @@ "binop": null, "updateContext": null }, - "start": 6639, - "end": 6640, + "start": 6651, + "end": 6652, "loc": { "start": { "line": 252, @@ -42307,8 +42351,8 @@ "binop": null, "updateContext": null }, - "start": 6640, - "end": 6641, + "start": 6652, + "end": 6653, "loc": { "start": { "line": 252, @@ -42333,8 +42377,8 @@ "binop": null }, "value": "angleAxis", - "start": 6650, - "end": 6659, + "start": 6662, + "end": 6671, "loc": { "start": { "line": 253, @@ -42359,8 +42403,8 @@ "binop": null, "updateContext": null }, - "start": 6659, - "end": 6660, + "start": 6671, + "end": 6672, "loc": { "start": { "line": 253, @@ -42386,8 +42430,8 @@ "updateContext": null }, "value": 1, - "start": 6660, - "end": 6661, + "start": 6672, + "end": 6673, "loc": { "start": { "line": 253, @@ -42412,8 +42456,8 @@ "binop": null, "updateContext": null }, - "start": 6661, - "end": 6662, + "start": 6673, + "end": 6674, "loc": { "start": { "line": 253, @@ -42439,8 +42483,8 @@ "updateContext": null }, "value": "=", - "start": 6663, - "end": 6664, + "start": 6675, + "end": 6676, "loc": { "start": { "line": 253, @@ -42465,8 +42509,8 @@ "binop": null }, "value": "axis", - "start": 6665, - "end": 6669, + "start": 6677, + "end": 6681, "loc": { "start": { "line": 253, @@ -42491,8 +42535,8 @@ "binop": null, "updateContext": null }, - "start": 6669, - "end": 6670, + "start": 6681, + "end": 6682, "loc": { "start": { "line": 253, @@ -42518,8 +42562,8 @@ "updateContext": null }, "value": 1, - "start": 6670, - "end": 6671, + "start": 6682, + "end": 6683, "loc": { "start": { "line": 253, @@ -42544,8 +42588,8 @@ "binop": null, "updateContext": null }, - "start": 6671, - "end": 6672, + "start": 6683, + "end": 6684, "loc": { "start": { "line": 253, @@ -42570,8 +42614,8 @@ "binop": null, "updateContext": null }, - "start": 6672, - "end": 6673, + "start": 6684, + "end": 6685, "loc": { "start": { "line": 253, @@ -42596,8 +42640,8 @@ "binop": null }, "value": "angleAxis", - "start": 6682, - "end": 6691, + "start": 6694, + "end": 6703, "loc": { "start": { "line": 254, @@ -42622,8 +42666,8 @@ "binop": null, "updateContext": null }, - "start": 6691, - "end": 6692, + "start": 6703, + "end": 6704, "loc": { "start": { "line": 254, @@ -42649,8 +42693,8 @@ "updateContext": null }, "value": 2, - "start": 6692, - "end": 6693, + "start": 6704, + "end": 6705, "loc": { "start": { "line": 254, @@ -42675,8 +42719,8 @@ "binop": null, "updateContext": null }, - "start": 6693, - "end": 6694, + "start": 6705, + "end": 6706, "loc": { "start": { "line": 254, @@ -42702,8 +42746,8 @@ "updateContext": null }, "value": "=", - "start": 6695, - "end": 6696, + "start": 6707, + "end": 6708, "loc": { "start": { "line": 254, @@ -42728,8 +42772,8 @@ "binop": null }, "value": "axis", - "start": 6697, - "end": 6701, + "start": 6709, + "end": 6713, "loc": { "start": { "line": 254, @@ -42754,8 +42798,8 @@ "binop": null, "updateContext": null }, - "start": 6701, - "end": 6702, + "start": 6713, + "end": 6714, "loc": { "start": { "line": 254, @@ -42781,8 +42825,8 @@ "updateContext": null }, "value": 2, - "start": 6702, - "end": 6703, + "start": 6714, + "end": 6715, "loc": { "start": { "line": 254, @@ -42807,8 +42851,8 @@ "binop": null, "updateContext": null }, - "start": 6703, - "end": 6704, + "start": 6715, + "end": 6716, "loc": { "start": { "line": 254, @@ -42833,8 +42877,8 @@ "binop": null, "updateContext": null }, - "start": 6704, - "end": 6705, + "start": 6716, + "end": 6717, "loc": { "start": { "line": 254, @@ -42859,8 +42903,8 @@ "binop": null }, "value": "angleAxis", - "start": 6714, - "end": 6723, + "start": 6726, + "end": 6735, "loc": { "start": { "line": 255, @@ -42885,8 +42929,8 @@ "binop": null, "updateContext": null }, - "start": 6723, - "end": 6724, + "start": 6735, + "end": 6736, "loc": { "start": { "line": 255, @@ -42912,8 +42956,8 @@ "updateContext": null }, "value": 3, - "start": 6724, - "end": 6725, + "start": 6736, + "end": 6737, "loc": { "start": { "line": 255, @@ -42938,8 +42982,8 @@ "binop": null, "updateContext": null }, - "start": 6725, - "end": 6726, + "start": 6737, + "end": 6738, "loc": { "start": { "line": 255, @@ -42965,8 +43009,8 @@ "updateContext": null }, "value": "=", - "start": 6727, - "end": 6728, + "start": 6739, + "end": 6740, "loc": { "start": { "line": 255, @@ -42991,8 +43035,8 @@ "binop": null }, "value": "angle", - "start": 6729, - "end": 6734, + "start": 6741, + "end": 6746, "loc": { "start": { "line": 255, @@ -43018,8 +43062,8 @@ "updateContext": null }, "value": "*", - "start": 6735, - "end": 6736, + "start": 6747, + "end": 6748, "loc": { "start": { "line": 255, @@ -43044,8 +43088,8 @@ "binop": null }, "value": "math", - "start": 6737, - "end": 6741, + "start": 6749, + "end": 6753, "loc": { "start": { "line": 255, @@ -43070,8 +43114,8 @@ "binop": null, "updateContext": null }, - "start": 6741, - "end": 6742, + "start": 6753, + "end": 6754, "loc": { "start": { "line": 255, @@ -43096,8 +43140,8 @@ "binop": null }, "value": "DEGTORAD", - "start": 6742, - "end": 6750, + "start": 6754, + "end": 6762, "loc": { "start": { "line": 255, @@ -43122,8 +43166,8 @@ "binop": null, "updateContext": null }, - "start": 6750, - "end": 6751, + "start": 6762, + "end": 6763, "loc": { "start": { "line": 255, @@ -43148,8 +43192,8 @@ "binop": null }, "value": "math", - "start": 6760, - "end": 6764, + "start": 6772, + "end": 6776, "loc": { "start": { "line": 256, @@ -43174,8 +43218,8 @@ "binop": null, "updateContext": null }, - "start": 6764, - "end": 6765, + "start": 6776, + "end": 6777, "loc": { "start": { "line": 256, @@ -43200,8 +43244,8 @@ "binop": null }, "value": "angleAxisToQuaternion", - "start": 6765, - "end": 6786, + "start": 6777, + "end": 6798, "loc": { "start": { "line": 256, @@ -43225,8 +43269,8 @@ "postfix": false, "binop": null }, - "start": 6786, - "end": 6787, + "start": 6798, + "end": 6799, "loc": { "start": { "line": 256, @@ -43251,8 +43295,8 @@ "binop": null }, "value": "angleAxis", - "start": 6787, - "end": 6796, + "start": 6799, + "end": 6808, "loc": { "start": { "line": 256, @@ -43277,8 +43321,8 @@ "binop": null, "updateContext": null }, - "start": 6796, - "end": 6797, + "start": 6808, + "end": 6809, "loc": { "start": { "line": 256, @@ -43303,8 +43347,8 @@ "binop": null }, "value": "q1", - "start": 6798, - "end": 6800, + "start": 6810, + "end": 6812, "loc": { "start": { "line": 256, @@ -43328,8 +43372,8 @@ "postfix": false, "binop": null }, - "start": 6800, - "end": 6801, + "start": 6812, + "end": 6813, "loc": { "start": { "line": 256, @@ -43354,8 +43398,8 @@ "binop": null, "updateContext": null }, - "start": 6801, - "end": 6802, + "start": 6813, + "end": 6814, "loc": { "start": { "line": 256, @@ -43380,8 +43424,8 @@ "binop": null }, "value": "math", - "start": 6811, - "end": 6815, + "start": 6823, + "end": 6827, "loc": { "start": { "line": 257, @@ -43406,8 +43450,8 @@ "binop": null, "updateContext": null }, - "start": 6815, - "end": 6816, + "start": 6827, + "end": 6828, "loc": { "start": { "line": 257, @@ -43432,8 +43476,8 @@ "binop": null }, "value": "mulQuaternions", - "start": 6816, - "end": 6830, + "start": 6828, + "end": 6842, "loc": { "start": { "line": 257, @@ -43457,8 +43501,8 @@ "postfix": false, "binop": null }, - "start": 6830, - "end": 6831, + "start": 6842, + "end": 6843, "loc": { "start": { "line": 257, @@ -43485,8 +43529,8 @@ "updateContext": null }, "value": "this", - "start": 6831, - "end": 6835, + "start": 6843, + "end": 6847, "loc": { "start": { "line": 257, @@ -43511,8 +43555,8 @@ "binop": null, "updateContext": null }, - "start": 6835, - "end": 6836, + "start": 6847, + "end": 6848, "loc": { "start": { "line": 257, @@ -43537,8 +43581,8 @@ "binop": null }, "value": "quaternion", - "start": 6836, - "end": 6846, + "start": 6848, + "end": 6858, "loc": { "start": { "line": 257, @@ -43563,8 +43607,8 @@ "binop": null, "updateContext": null }, - "start": 6846, - "end": 6847, + "start": 6858, + "end": 6859, "loc": { "start": { "line": 257, @@ -43589,8 +43633,8 @@ "binop": null }, "value": "q1", - "start": 6848, - "end": 6850, + "start": 6860, + "end": 6862, "loc": { "start": { "line": 257, @@ -43615,8 +43659,8 @@ "binop": null, "updateContext": null }, - "start": 6850, - "end": 6851, + "start": 6862, + "end": 6863, "loc": { "start": { "line": 257, @@ -43641,8 +43685,8 @@ "binop": null }, "value": "q2", - "start": 6852, - "end": 6854, + "start": 6864, + "end": 6866, "loc": { "start": { "line": 257, @@ -43666,8 +43710,8 @@ "postfix": false, "binop": null }, - "start": 6854, - "end": 6855, + "start": 6866, + "end": 6867, "loc": { "start": { "line": 257, @@ -43692,8 +43736,8 @@ "binop": null, "updateContext": null }, - "start": 6855, - "end": 6856, + "start": 6867, + "end": 6868, "loc": { "start": { "line": 257, @@ -43720,8 +43764,8 @@ "updateContext": null }, "value": "this", - "start": 6865, - "end": 6869, + "start": 6877, + "end": 6881, "loc": { "start": { "line": 258, @@ -43746,8 +43790,8 @@ "binop": null, "updateContext": null }, - "start": 6869, - "end": 6870, + "start": 6881, + "end": 6882, "loc": { "start": { "line": 258, @@ -43772,8 +43816,8 @@ "binop": null }, "value": "quaternion", - "start": 6870, - "end": 6880, + "start": 6882, + "end": 6892, "loc": { "start": { "line": 258, @@ -43799,8 +43843,8 @@ "updateContext": null }, "value": "=", - "start": 6881, - "end": 6882, + "start": 6893, + "end": 6894, "loc": { "start": { "line": 258, @@ -43825,8 +43869,8 @@ "binop": null }, "value": "q2", - "start": 6883, - "end": 6885, + "start": 6895, + "end": 6897, "loc": { "start": { "line": 258, @@ -43851,8 +43895,8 @@ "binop": null, "updateContext": null }, - "start": 6885, - "end": 6886, + "start": 6897, + "end": 6898, "loc": { "start": { "line": 258, @@ -43879,8 +43923,8 @@ "updateContext": null }, "value": "this", - "start": 6895, - "end": 6899, + "start": 6907, + "end": 6911, "loc": { "start": { "line": 259, @@ -43905,8 +43949,8 @@ "binop": null, "updateContext": null }, - "start": 6899, - "end": 6900, + "start": 6911, + "end": 6912, "loc": { "start": { "line": 259, @@ -43931,8 +43975,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 6900, - "end": 6920, + "start": 6912, + "end": 6932, "loc": { "start": { "line": 259, @@ -43956,8 +44000,8 @@ "postfix": false, "binop": null }, - "start": 6920, - "end": 6921, + "start": 6932, + "end": 6933, "loc": { "start": { "line": 259, @@ -43981,8 +44025,8 @@ "postfix": false, "binop": null }, - "start": 6921, - "end": 6922, + "start": 6933, + "end": 6934, "loc": { "start": { "line": 259, @@ -44007,8 +44051,8 @@ "binop": null, "updateContext": null }, - "start": 6922, - "end": 6923, + "start": 6934, + "end": 6935, "loc": { "start": { "line": 259, @@ -44035,8 +44079,8 @@ "updateContext": null }, "value": "this", - "start": 6932, - "end": 6936, + "start": 6944, + "end": 6948, "loc": { "start": { "line": 260, @@ -44061,8 +44105,8 @@ "binop": null, "updateContext": null }, - "start": 6936, - "end": 6937, + "start": 6948, + "end": 6949, "loc": { "start": { "line": 260, @@ -44087,8 +44131,8 @@ "binop": null }, "value": "_model", - "start": 6937, - "end": 6943, + "start": 6949, + "end": 6955, "loc": { "start": { "line": 260, @@ -44113,8 +44157,8 @@ "binop": null, "updateContext": null }, - "start": 6943, - "end": 6944, + "start": 6955, + "end": 6956, "loc": { "start": { "line": 260, @@ -44139,8 +44183,8 @@ "binop": null }, "value": "glRedraw", - "start": 6944, - "end": 6952, + "start": 6956, + "end": 6964, "loc": { "start": { "line": 260, @@ -44164,8 +44208,8 @@ "postfix": false, "binop": null }, - "start": 6952, - "end": 6953, + "start": 6964, + "end": 6965, "loc": { "start": { "line": 260, @@ -44189,8 +44233,8 @@ "postfix": false, "binop": null }, - "start": 6953, - "end": 6954, + "start": 6965, + "end": 6966, "loc": { "start": { "line": 260, @@ -44215,8 +44259,8 @@ "binop": null, "updateContext": null }, - "start": 6954, - "end": 6955, + "start": 6966, + "end": 6967, "loc": { "start": { "line": 260, @@ -44243,8 +44287,8 @@ "updateContext": null }, "value": "return", - "start": 6964, - "end": 6970, + "start": 6976, + "end": 6982, "loc": { "start": { "line": 261, @@ -44271,8 +44315,8 @@ "updateContext": null }, "value": "this", - "start": 6971, - "end": 6975, + "start": 6983, + "end": 6987, "loc": { "start": { "line": 261, @@ -44297,8 +44341,8 @@ "binop": null, "updateContext": null }, - "start": 6975, - "end": 6976, + "start": 6987, + "end": 6988, "loc": { "start": { "line": 261, @@ -44322,8 +44366,8 @@ "postfix": false, "binop": null }, - "start": 6981, - "end": 6982, + "start": 6993, + "end": 6994, "loc": { "start": { "line": 262, @@ -44338,8 +44382,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 6988, - "end": 7223, + "start": 7000, + "end": 7235, "loc": { "start": { "line": 264, @@ -44364,8 +44408,8 @@ "binop": null }, "value": "rotateOnWorldAxis", - "start": 7228, - "end": 7245, + "start": 7240, + "end": 7257, "loc": { "start": { "line": 270, @@ -44389,8 +44433,8 @@ "postfix": false, "binop": null }, - "start": 7245, - "end": 7246, + "start": 7257, + "end": 7258, "loc": { "start": { "line": 270, @@ -44415,8 +44459,8 @@ "binop": null }, "value": "axis", - "start": 7246, - "end": 7250, + "start": 7258, + "end": 7262, "loc": { "start": { "line": 270, @@ -44441,8 +44485,8 @@ "binop": null, "updateContext": null }, - "start": 7250, - "end": 7251, + "start": 7262, + "end": 7263, "loc": { "start": { "line": 270, @@ -44467,8 +44511,8 @@ "binop": null }, "value": "angle", - "start": 7252, - "end": 7257, + "start": 7264, + "end": 7269, "loc": { "start": { "line": 270, @@ -44492,8 +44536,8 @@ "postfix": false, "binop": null }, - "start": 7257, - "end": 7258, + "start": 7269, + "end": 7270, "loc": { "start": { "line": 270, @@ -44517,8 +44561,8 @@ "postfix": false, "binop": null }, - "start": 7259, - "end": 7260, + "start": 7271, + "end": 7272, "loc": { "start": { "line": 270, @@ -44543,8 +44587,8 @@ "binop": null }, "value": "angleAxis", - "start": 7269, - "end": 7278, + "start": 7281, + "end": 7290, "loc": { "start": { "line": 271, @@ -44569,8 +44613,8 @@ "binop": null, "updateContext": null }, - "start": 7278, - "end": 7279, + "start": 7290, + "end": 7291, "loc": { "start": { "line": 271, @@ -44596,8 +44640,8 @@ "updateContext": null }, "value": 0, - "start": 7279, - "end": 7280, + "start": 7291, + "end": 7292, "loc": { "start": { "line": 271, @@ -44622,8 +44666,8 @@ "binop": null, "updateContext": null }, - "start": 7280, - "end": 7281, + "start": 7292, + "end": 7293, "loc": { "start": { "line": 271, @@ -44649,8 +44693,8 @@ "updateContext": null }, "value": "=", - "start": 7282, - "end": 7283, + "start": 7294, + "end": 7295, "loc": { "start": { "line": 271, @@ -44675,8 +44719,8 @@ "binop": null }, "value": "axis", - "start": 7284, - "end": 7288, + "start": 7296, + "end": 7300, "loc": { "start": { "line": 271, @@ -44701,8 +44745,8 @@ "binop": null, "updateContext": null }, - "start": 7288, - "end": 7289, + "start": 7300, + "end": 7301, "loc": { "start": { "line": 271, @@ -44728,8 +44772,8 @@ "updateContext": null }, "value": 0, - "start": 7289, - "end": 7290, + "start": 7301, + "end": 7302, "loc": { "start": { "line": 271, @@ -44754,8 +44798,8 @@ "binop": null, "updateContext": null }, - "start": 7290, - "end": 7291, + "start": 7302, + "end": 7303, "loc": { "start": { "line": 271, @@ -44780,8 +44824,8 @@ "binop": null, "updateContext": null }, - "start": 7291, - "end": 7292, + "start": 7303, + "end": 7304, "loc": { "start": { "line": 271, @@ -44806,8 +44850,8 @@ "binop": null }, "value": "angleAxis", - "start": 7301, - "end": 7310, + "start": 7313, + "end": 7322, "loc": { "start": { "line": 272, @@ -44832,8 +44876,8 @@ "binop": null, "updateContext": null }, - "start": 7310, - "end": 7311, + "start": 7322, + "end": 7323, "loc": { "start": { "line": 272, @@ -44859,8 +44903,8 @@ "updateContext": null }, "value": 1, - "start": 7311, - "end": 7312, + "start": 7323, + "end": 7324, "loc": { "start": { "line": 272, @@ -44885,8 +44929,8 @@ "binop": null, "updateContext": null }, - "start": 7312, - "end": 7313, + "start": 7324, + "end": 7325, "loc": { "start": { "line": 272, @@ -44912,8 +44956,8 @@ "updateContext": null }, "value": "=", - "start": 7314, - "end": 7315, + "start": 7326, + "end": 7327, "loc": { "start": { "line": 272, @@ -44938,8 +44982,8 @@ "binop": null }, "value": "axis", - "start": 7316, - "end": 7320, + "start": 7328, + "end": 7332, "loc": { "start": { "line": 272, @@ -44964,8 +45008,8 @@ "binop": null, "updateContext": null }, - "start": 7320, - "end": 7321, + "start": 7332, + "end": 7333, "loc": { "start": { "line": 272, @@ -44991,8 +45035,8 @@ "updateContext": null }, "value": 1, - "start": 7321, - "end": 7322, + "start": 7333, + "end": 7334, "loc": { "start": { "line": 272, @@ -45017,8 +45061,8 @@ "binop": null, "updateContext": null }, - "start": 7322, - "end": 7323, + "start": 7334, + "end": 7335, "loc": { "start": { "line": 272, @@ -45043,8 +45087,8 @@ "binop": null, "updateContext": null }, - "start": 7323, - "end": 7324, + "start": 7335, + "end": 7336, "loc": { "start": { "line": 272, @@ -45069,8 +45113,8 @@ "binop": null }, "value": "angleAxis", - "start": 7333, - "end": 7342, + "start": 7345, + "end": 7354, "loc": { "start": { "line": 273, @@ -45095,8 +45139,8 @@ "binop": null, "updateContext": null }, - "start": 7342, - "end": 7343, + "start": 7354, + "end": 7355, "loc": { "start": { "line": 273, @@ -45122,8 +45166,8 @@ "updateContext": null }, "value": 2, - "start": 7343, - "end": 7344, + "start": 7355, + "end": 7356, "loc": { "start": { "line": 273, @@ -45148,8 +45192,8 @@ "binop": null, "updateContext": null }, - "start": 7344, - "end": 7345, + "start": 7356, + "end": 7357, "loc": { "start": { "line": 273, @@ -45175,8 +45219,8 @@ "updateContext": null }, "value": "=", - "start": 7346, - "end": 7347, + "start": 7358, + "end": 7359, "loc": { "start": { "line": 273, @@ -45201,8 +45245,8 @@ "binop": null }, "value": "axis", - "start": 7348, - "end": 7352, + "start": 7360, + "end": 7364, "loc": { "start": { "line": 273, @@ -45227,8 +45271,8 @@ "binop": null, "updateContext": null }, - "start": 7352, - "end": 7353, + "start": 7364, + "end": 7365, "loc": { "start": { "line": 273, @@ -45254,8 +45298,8 @@ "updateContext": null }, "value": 2, - "start": 7353, - "end": 7354, + "start": 7365, + "end": 7366, "loc": { "start": { "line": 273, @@ -45280,8 +45324,8 @@ "binop": null, "updateContext": null }, - "start": 7354, - "end": 7355, + "start": 7366, + "end": 7367, "loc": { "start": { "line": 273, @@ -45306,8 +45350,8 @@ "binop": null, "updateContext": null }, - "start": 7355, - "end": 7356, + "start": 7367, + "end": 7368, "loc": { "start": { "line": 273, @@ -45332,8 +45376,8 @@ "binop": null }, "value": "angleAxis", - "start": 7365, - "end": 7374, + "start": 7377, + "end": 7386, "loc": { "start": { "line": 274, @@ -45358,8 +45402,8 @@ "binop": null, "updateContext": null }, - "start": 7374, - "end": 7375, + "start": 7386, + "end": 7387, "loc": { "start": { "line": 274, @@ -45385,8 +45429,8 @@ "updateContext": null }, "value": 3, - "start": 7375, - "end": 7376, + "start": 7387, + "end": 7388, "loc": { "start": { "line": 274, @@ -45411,8 +45455,8 @@ "binop": null, "updateContext": null }, - "start": 7376, - "end": 7377, + "start": 7388, + "end": 7389, "loc": { "start": { "line": 274, @@ -45438,8 +45482,8 @@ "updateContext": null }, "value": "=", - "start": 7378, - "end": 7379, + "start": 7390, + "end": 7391, "loc": { "start": { "line": 274, @@ -45464,8 +45508,8 @@ "binop": null }, "value": "angle", - "start": 7380, - "end": 7385, + "start": 7392, + "end": 7397, "loc": { "start": { "line": 274, @@ -45491,8 +45535,8 @@ "updateContext": null }, "value": "*", - "start": 7386, - "end": 7387, + "start": 7398, + "end": 7399, "loc": { "start": { "line": 274, @@ -45517,8 +45561,8 @@ "binop": null }, "value": "math", - "start": 7388, - "end": 7392, + "start": 7400, + "end": 7404, "loc": { "start": { "line": 274, @@ -45543,8 +45587,8 @@ "binop": null, "updateContext": null }, - "start": 7392, - "end": 7393, + "start": 7404, + "end": 7405, "loc": { "start": { "line": 274, @@ -45569,8 +45613,8 @@ "binop": null }, "value": "DEGTORAD", - "start": 7393, - "end": 7401, + "start": 7405, + "end": 7413, "loc": { "start": { "line": 274, @@ -45595,8 +45639,8 @@ "binop": null, "updateContext": null }, - "start": 7401, - "end": 7402, + "start": 7413, + "end": 7414, "loc": { "start": { "line": 274, @@ -45621,8 +45665,8 @@ "binop": null }, "value": "math", - "start": 7411, - "end": 7415, + "start": 7423, + "end": 7427, "loc": { "start": { "line": 275, @@ -45647,8 +45691,8 @@ "binop": null, "updateContext": null }, - "start": 7415, - "end": 7416, + "start": 7427, + "end": 7428, "loc": { "start": { "line": 275, @@ -45673,8 +45717,8 @@ "binop": null }, "value": "angleAxisToQuaternion", - "start": 7416, - "end": 7437, + "start": 7428, + "end": 7449, "loc": { "start": { "line": 275, @@ -45698,8 +45742,8 @@ "postfix": false, "binop": null }, - "start": 7437, - "end": 7438, + "start": 7449, + "end": 7450, "loc": { "start": { "line": 275, @@ -45724,8 +45768,8 @@ "binop": null }, "value": "angleAxis", - "start": 7438, - "end": 7447, + "start": 7450, + "end": 7459, "loc": { "start": { "line": 275, @@ -45750,8 +45794,8 @@ "binop": null, "updateContext": null }, - "start": 7447, - "end": 7448, + "start": 7459, + "end": 7460, "loc": { "start": { "line": 275, @@ -45776,8 +45820,8 @@ "binop": null }, "value": "q1", - "start": 7449, - "end": 7451, + "start": 7461, + "end": 7463, "loc": { "start": { "line": 275, @@ -45801,8 +45845,8 @@ "postfix": false, "binop": null }, - "start": 7451, - "end": 7452, + "start": 7463, + "end": 7464, "loc": { "start": { "line": 275, @@ -45827,8 +45871,8 @@ "binop": null, "updateContext": null }, - "start": 7452, - "end": 7453, + "start": 7464, + "end": 7465, "loc": { "start": { "line": 275, @@ -45853,8 +45897,8 @@ "binop": null }, "value": "math", - "start": 7462, - "end": 7466, + "start": 7474, + "end": 7478, "loc": { "start": { "line": 276, @@ -45879,8 +45923,8 @@ "binop": null, "updateContext": null }, - "start": 7466, - "end": 7467, + "start": 7478, + "end": 7479, "loc": { "start": { "line": 276, @@ -45905,8 +45949,8 @@ "binop": null }, "value": "mulQuaternions", - "start": 7467, - "end": 7481, + "start": 7479, + "end": 7493, "loc": { "start": { "line": 276, @@ -45930,8 +45974,8 @@ "postfix": false, "binop": null }, - "start": 7481, - "end": 7482, + "start": 7493, + "end": 7494, "loc": { "start": { "line": 276, @@ -45956,8 +46000,8 @@ "binop": null }, "value": "q1", - "start": 7482, - "end": 7484, + "start": 7494, + "end": 7496, "loc": { "start": { "line": 276, @@ -45982,8 +46026,8 @@ "binop": null, "updateContext": null }, - "start": 7484, - "end": 7485, + "start": 7496, + "end": 7497, "loc": { "start": { "line": 276, @@ -46010,8 +46054,8 @@ "updateContext": null }, "value": "this", - "start": 7486, - "end": 7490, + "start": 7498, + "end": 7502, "loc": { "start": { "line": 276, @@ -46036,8 +46080,8 @@ "binop": null, "updateContext": null }, - "start": 7490, - "end": 7491, + "start": 7502, + "end": 7503, "loc": { "start": { "line": 276, @@ -46062,8 +46106,8 @@ "binop": null }, "value": "quaternion", - "start": 7491, - "end": 7501, + "start": 7503, + "end": 7513, "loc": { "start": { "line": 276, @@ -46088,8 +46132,8 @@ "binop": null, "updateContext": null }, - "start": 7501, - "end": 7502, + "start": 7513, + "end": 7514, "loc": { "start": { "line": 276, @@ -46114,8 +46158,8 @@ "binop": null }, "value": "q1", - "start": 7503, - "end": 7505, + "start": 7515, + "end": 7517, "loc": { "start": { "line": 276, @@ -46139,8 +46183,8 @@ "postfix": false, "binop": null }, - "start": 7505, - "end": 7506, + "start": 7517, + "end": 7518, "loc": { "start": { "line": 276, @@ -46165,8 +46209,8 @@ "binop": null, "updateContext": null }, - "start": 7506, - "end": 7507, + "start": 7518, + "end": 7519, "loc": { "start": { "line": 276, @@ -46181,8 +46225,8 @@ { "type": "CommentLine", "value": "this.quaternion.premultiply(q1);", - "start": 7516, - "end": 7550, + "start": 7528, + "end": 7562, "loc": { "start": { "line": 277, @@ -46209,8 +46253,8 @@ "updateContext": null }, "value": "return", - "start": 7559, - "end": 7565, + "start": 7571, + "end": 7577, "loc": { "start": { "line": 278, @@ -46237,8 +46281,8 @@ "updateContext": null }, "value": "this", - "start": 7566, - "end": 7570, + "start": 7578, + "end": 7582, "loc": { "start": { "line": 278, @@ -46263,8 +46307,8 @@ "binop": null, "updateContext": null }, - "start": 7570, - "end": 7571, + "start": 7582, + "end": 7583, "loc": { "start": { "line": 278, @@ -46288,8 +46332,8 @@ "postfix": false, "binop": null }, - "start": 7576, - "end": 7577, + "start": 7588, + "end": 7589, "loc": { "start": { "line": 279, @@ -46304,8 +46348,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7583, - "end": 7744, + "start": 7595, + "end": 7756, "loc": { "start": { "line": 281, @@ -46330,8 +46374,8 @@ "binop": null }, "value": "rotateX", - "start": 7749, - "end": 7756, + "start": 7761, + "end": 7768, "loc": { "start": { "line": 286, @@ -46355,8 +46399,8 @@ "postfix": false, "binop": null }, - "start": 7756, - "end": 7757, + "start": 7768, + "end": 7769, "loc": { "start": { "line": 286, @@ -46381,8 +46425,8 @@ "binop": null }, "value": "angle", - "start": 7757, - "end": 7762, + "start": 7769, + "end": 7774, "loc": { "start": { "line": 286, @@ -46406,8 +46450,8 @@ "postfix": false, "binop": null }, - "start": 7762, - "end": 7763, + "start": 7774, + "end": 7775, "loc": { "start": { "line": 286, @@ -46431,8 +46475,8 @@ "postfix": false, "binop": null }, - "start": 7764, - "end": 7765, + "start": 7776, + "end": 7777, "loc": { "start": { "line": 286, @@ -46459,8 +46503,8 @@ "updateContext": null }, "value": "return", - "start": 7774, - "end": 7780, + "start": 7786, + "end": 7792, "loc": { "start": { "line": 287, @@ -46487,8 +46531,8 @@ "updateContext": null }, "value": "this", - "start": 7781, - "end": 7785, + "start": 7793, + "end": 7797, "loc": { "start": { "line": 287, @@ -46513,8 +46557,8 @@ "binop": null, "updateContext": null }, - "start": 7785, - "end": 7786, + "start": 7797, + "end": 7798, "loc": { "start": { "line": 287, @@ -46539,8 +46583,8 @@ "binop": null }, "value": "rotate", - "start": 7786, - "end": 7792, + "start": 7798, + "end": 7804, "loc": { "start": { "line": 287, @@ -46564,8 +46608,8 @@ "postfix": false, "binop": null }, - "start": 7792, - "end": 7793, + "start": 7804, + "end": 7805, "loc": { "start": { "line": 287, @@ -46590,8 +46634,8 @@ "binop": null }, "value": "xAxis", - "start": 7793, - "end": 7798, + "start": 7805, + "end": 7810, "loc": { "start": { "line": 287, @@ -46616,8 +46660,8 @@ "binop": null, "updateContext": null }, - "start": 7798, - "end": 7799, + "start": 7810, + "end": 7811, "loc": { "start": { "line": 287, @@ -46642,8 +46686,8 @@ "binop": null }, "value": "angle", - "start": 7800, - "end": 7805, + "start": 7812, + "end": 7817, "loc": { "start": { "line": 287, @@ -46667,8 +46711,8 @@ "postfix": false, "binop": null }, - "start": 7805, - "end": 7806, + "start": 7817, + "end": 7818, "loc": { "start": { "line": 287, @@ -46693,8 +46737,8 @@ "binop": null, "updateContext": null }, - "start": 7806, - "end": 7807, + "start": 7818, + "end": 7819, "loc": { "start": { "line": 287, @@ -46718,8 +46762,8 @@ "postfix": false, "binop": null }, - "start": 7812, - "end": 7813, + "start": 7824, + "end": 7825, "loc": { "start": { "line": 288, @@ -46734,8 +46778,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 7819, - "end": 7980, + "start": 7831, + "end": 7992, "loc": { "start": { "line": 290, @@ -46760,8 +46804,8 @@ "binop": null }, "value": "rotateY", - "start": 7985, - "end": 7992, + "start": 7997, + "end": 8004, "loc": { "start": { "line": 295, @@ -46785,8 +46829,8 @@ "postfix": false, "binop": null }, - "start": 7992, - "end": 7993, + "start": 8004, + "end": 8005, "loc": { "start": { "line": 295, @@ -46811,8 +46855,8 @@ "binop": null }, "value": "angle", - "start": 7993, - "end": 7998, + "start": 8005, + "end": 8010, "loc": { "start": { "line": 295, @@ -46836,8 +46880,8 @@ "postfix": false, "binop": null }, - "start": 7998, - "end": 7999, + "start": 8010, + "end": 8011, "loc": { "start": { "line": 295, @@ -46861,8 +46905,8 @@ "postfix": false, "binop": null }, - "start": 8000, - "end": 8001, + "start": 8012, + "end": 8013, "loc": { "start": { "line": 295, @@ -46889,8 +46933,8 @@ "updateContext": null }, "value": "return", - "start": 8010, - "end": 8016, + "start": 8022, + "end": 8028, "loc": { "start": { "line": 296, @@ -46917,8 +46961,8 @@ "updateContext": null }, "value": "this", - "start": 8017, - "end": 8021, + "start": 8029, + "end": 8033, "loc": { "start": { "line": 296, @@ -46943,8 +46987,8 @@ "binop": null, "updateContext": null }, - "start": 8021, - "end": 8022, + "start": 8033, + "end": 8034, "loc": { "start": { "line": 296, @@ -46969,8 +47013,8 @@ "binop": null }, "value": "rotate", - "start": 8022, - "end": 8028, + "start": 8034, + "end": 8040, "loc": { "start": { "line": 296, @@ -46994,8 +47038,8 @@ "postfix": false, "binop": null }, - "start": 8028, - "end": 8029, + "start": 8040, + "end": 8041, "loc": { "start": { "line": 296, @@ -47020,8 +47064,8 @@ "binop": null }, "value": "yAxis", - "start": 8029, - "end": 8034, + "start": 8041, + "end": 8046, "loc": { "start": { "line": 296, @@ -47046,8 +47090,8 @@ "binop": null, "updateContext": null }, - "start": 8034, - "end": 8035, + "start": 8046, + "end": 8047, "loc": { "start": { "line": 296, @@ -47072,8 +47116,8 @@ "binop": null }, "value": "angle", - "start": 8036, - "end": 8041, + "start": 8048, + "end": 8053, "loc": { "start": { "line": 296, @@ -47097,8 +47141,8 @@ "postfix": false, "binop": null }, - "start": 8041, - "end": 8042, + "start": 8053, + "end": 8054, "loc": { "start": { "line": 296, @@ -47123,8 +47167,8 @@ "binop": null, "updateContext": null }, - "start": 8042, - "end": 8043, + "start": 8054, + "end": 8055, "loc": { "start": { "line": 296, @@ -47148,8 +47192,8 @@ "postfix": false, "binop": null }, - "start": 8048, - "end": 8049, + "start": 8060, + "end": 8061, "loc": { "start": { "line": 297, @@ -47164,8 +47208,8 @@ { "type": "CommentBlock", "value": "*\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n ", - "start": 8055, - "end": 8216, + "start": 8067, + "end": 8228, "loc": { "start": { "line": 299, @@ -47190,8 +47234,8 @@ "binop": null }, "value": "rotateZ", - "start": 8221, - "end": 8228, + "start": 8233, + "end": 8240, "loc": { "start": { "line": 304, @@ -47215,8 +47259,8 @@ "postfix": false, "binop": null }, - "start": 8228, - "end": 8229, + "start": 8240, + "end": 8241, "loc": { "start": { "line": 304, @@ -47241,8 +47285,8 @@ "binop": null }, "value": "angle", - "start": 8229, - "end": 8234, + "start": 8241, + "end": 8246, "loc": { "start": { "line": 304, @@ -47266,8 +47310,8 @@ "postfix": false, "binop": null }, - "start": 8234, - "end": 8235, + "start": 8246, + "end": 8247, "loc": { "start": { "line": 304, @@ -47291,8 +47335,8 @@ "postfix": false, "binop": null }, - "start": 8236, - "end": 8237, + "start": 8248, + "end": 8249, "loc": { "start": { "line": 304, @@ -47319,8 +47363,8 @@ "updateContext": null }, "value": "return", - "start": 8246, - "end": 8252, + "start": 8258, + "end": 8264, "loc": { "start": { "line": 305, @@ -47347,8 +47391,8 @@ "updateContext": null }, "value": "this", - "start": 8253, - "end": 8257, + "start": 8265, + "end": 8269, "loc": { "start": { "line": 305, @@ -47373,8 +47417,8 @@ "binop": null, "updateContext": null }, - "start": 8257, - "end": 8258, + "start": 8269, + "end": 8270, "loc": { "start": { "line": 305, @@ -47399,8 +47443,8 @@ "binop": null }, "value": "rotate", - "start": 8258, - "end": 8264, + "start": 8270, + "end": 8276, "loc": { "start": { "line": 305, @@ -47424,8 +47468,8 @@ "postfix": false, "binop": null }, - "start": 8264, - "end": 8265, + "start": 8276, + "end": 8277, "loc": { "start": { "line": 305, @@ -47450,8 +47494,8 @@ "binop": null }, "value": "zAxis", - "start": 8265, - "end": 8270, + "start": 8277, + "end": 8282, "loc": { "start": { "line": 305, @@ -47476,8 +47520,8 @@ "binop": null, "updateContext": null }, - "start": 8270, - "end": 8271, + "start": 8282, + "end": 8283, "loc": { "start": { "line": 305, @@ -47502,8 +47546,8 @@ "binop": null }, "value": "angle", - "start": 8272, - "end": 8277, + "start": 8284, + "end": 8289, "loc": { "start": { "line": 305, @@ -47527,8 +47571,8 @@ "postfix": false, "binop": null }, - "start": 8277, - "end": 8278, + "start": 8289, + "end": 8290, "loc": { "start": { "line": 305, @@ -47553,8 +47597,8 @@ "binop": null, "updateContext": null }, - "start": 8278, - "end": 8279, + "start": 8290, + "end": 8291, "loc": { "start": { "line": 305, @@ -47578,8 +47622,8 @@ "postfix": false, "binop": null }, - "start": 8284, - "end": 8285, + "start": 8296, + "end": 8297, "loc": { "start": { "line": 306, @@ -47594,8 +47638,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n ", - "start": 8291, - "end": 8558, + "start": 8303, + "end": 8570, "loc": { "start": { "line": 308, @@ -47620,8 +47664,8 @@ "binop": null }, "value": "translate", - "start": 8563, - "end": 8572, + "start": 8575, + "end": 8584, "loc": { "start": { "line": 314, @@ -47645,8 +47689,8 @@ "postfix": false, "binop": null }, - "start": 8572, - "end": 8573, + "start": 8584, + "end": 8585, "loc": { "start": { "line": 314, @@ -47671,8 +47715,8 @@ "binop": null }, "value": "axis", - "start": 8573, - "end": 8577, + "start": 8585, + "end": 8589, "loc": { "start": { "line": 314, @@ -47696,8 +47740,8 @@ "postfix": false, "binop": null }, - "start": 8577, - "end": 8578, + "start": 8589, + "end": 8590, "loc": { "start": { "line": 314, @@ -47721,8 +47765,8 @@ "postfix": false, "binop": null }, - "start": 8579, - "end": 8580, + "start": 8591, + "end": 8592, "loc": { "start": { "line": 314, @@ -47749,8 +47793,8 @@ "updateContext": null }, "value": "this", - "start": 8589, - "end": 8593, + "start": 8601, + "end": 8605, "loc": { "start": { "line": 315, @@ -47775,8 +47819,8 @@ "binop": null, "updateContext": null }, - "start": 8593, - "end": 8594, + "start": 8605, + "end": 8606, "loc": { "start": { "line": 315, @@ -47801,8 +47845,8 @@ "binop": null }, "value": "_position", - "start": 8594, - "end": 8603, + "start": 8606, + "end": 8615, "loc": { "start": { "line": 315, @@ -47827,8 +47871,8 @@ "binop": null, "updateContext": null }, - "start": 8603, - "end": 8604, + "start": 8615, + "end": 8616, "loc": { "start": { "line": 315, @@ -47854,8 +47898,8 @@ "updateContext": null }, "value": 0, - "start": 8604, - "end": 8605, + "start": 8616, + "end": 8617, "loc": { "start": { "line": 315, @@ -47880,8 +47924,8 @@ "binop": null, "updateContext": null }, - "start": 8605, - "end": 8606, + "start": 8617, + "end": 8618, "loc": { "start": { "line": 315, @@ -47907,8 +47951,8 @@ "updateContext": null }, "value": "+=", - "start": 8607, - "end": 8609, + "start": 8619, + "end": 8621, "loc": { "start": { "line": 315, @@ -47933,8 +47977,8 @@ "binop": null }, "value": "axis", - "start": 8610, - "end": 8614, + "start": 8622, + "end": 8626, "loc": { "start": { "line": 315, @@ -47959,8 +48003,8 @@ "binop": null, "updateContext": null }, - "start": 8614, - "end": 8615, + "start": 8626, + "end": 8627, "loc": { "start": { "line": 315, @@ -47986,8 +48030,8 @@ "updateContext": null }, "value": 0, - "start": 8615, - "end": 8616, + "start": 8627, + "end": 8628, "loc": { "start": { "line": 315, @@ -48012,8 +48056,8 @@ "binop": null, "updateContext": null }, - "start": 8616, - "end": 8617, + "start": 8628, + "end": 8629, "loc": { "start": { "line": 315, @@ -48038,8 +48082,8 @@ "binop": null, "updateContext": null }, - "start": 8617, - "end": 8618, + "start": 8629, + "end": 8630, "loc": { "start": { "line": 315, @@ -48066,8 +48110,8 @@ "updateContext": null }, "value": "this", - "start": 8627, - "end": 8631, + "start": 8639, + "end": 8643, "loc": { "start": { "line": 316, @@ -48092,8 +48136,8 @@ "binop": null, "updateContext": null }, - "start": 8631, - "end": 8632, + "start": 8643, + "end": 8644, "loc": { "start": { "line": 316, @@ -48118,8 +48162,8 @@ "binop": null }, "value": "_position", - "start": 8632, - "end": 8641, + "start": 8644, + "end": 8653, "loc": { "start": { "line": 316, @@ -48144,8 +48188,8 @@ "binop": null, "updateContext": null }, - "start": 8641, - "end": 8642, + "start": 8653, + "end": 8654, "loc": { "start": { "line": 316, @@ -48171,8 +48215,8 @@ "updateContext": null }, "value": 1, - "start": 8642, - "end": 8643, + "start": 8654, + "end": 8655, "loc": { "start": { "line": 316, @@ -48197,8 +48241,8 @@ "binop": null, "updateContext": null }, - "start": 8643, - "end": 8644, + "start": 8655, + "end": 8656, "loc": { "start": { "line": 316, @@ -48224,8 +48268,8 @@ "updateContext": null }, "value": "+=", - "start": 8645, - "end": 8647, + "start": 8657, + "end": 8659, "loc": { "start": { "line": 316, @@ -48250,8 +48294,8 @@ "binop": null }, "value": "axis", - "start": 8648, - "end": 8652, + "start": 8660, + "end": 8664, "loc": { "start": { "line": 316, @@ -48276,8 +48320,8 @@ "binop": null, "updateContext": null }, - "start": 8652, - "end": 8653, + "start": 8664, + "end": 8665, "loc": { "start": { "line": 316, @@ -48303,8 +48347,8 @@ "updateContext": null }, "value": 1, - "start": 8653, - "end": 8654, + "start": 8665, + "end": 8666, "loc": { "start": { "line": 316, @@ -48329,8 +48373,8 @@ "binop": null, "updateContext": null }, - "start": 8654, - "end": 8655, + "start": 8666, + "end": 8667, "loc": { "start": { "line": 316, @@ -48355,8 +48399,8 @@ "binop": null, "updateContext": null }, - "start": 8655, - "end": 8656, + "start": 8667, + "end": 8668, "loc": { "start": { "line": 316, @@ -48383,8 +48427,8 @@ "updateContext": null }, "value": "this", - "start": 8665, - "end": 8669, + "start": 8677, + "end": 8681, "loc": { "start": { "line": 317, @@ -48409,8 +48453,8 @@ "binop": null, "updateContext": null }, - "start": 8669, - "end": 8670, + "start": 8681, + "end": 8682, "loc": { "start": { "line": 317, @@ -48435,8 +48479,8 @@ "binop": null }, "value": "_position", - "start": 8670, - "end": 8679, + "start": 8682, + "end": 8691, "loc": { "start": { "line": 317, @@ -48461,8 +48505,8 @@ "binop": null, "updateContext": null }, - "start": 8679, - "end": 8680, + "start": 8691, + "end": 8692, "loc": { "start": { "line": 317, @@ -48488,8 +48532,8 @@ "updateContext": null }, "value": 2, - "start": 8680, - "end": 8681, + "start": 8692, + "end": 8693, "loc": { "start": { "line": 317, @@ -48514,8 +48558,8 @@ "binop": null, "updateContext": null }, - "start": 8681, - "end": 8682, + "start": 8693, + "end": 8694, "loc": { "start": { "line": 317, @@ -48541,8 +48585,8 @@ "updateContext": null }, "value": "+=", - "start": 8683, - "end": 8685, + "start": 8695, + "end": 8697, "loc": { "start": { "line": 317, @@ -48567,8 +48611,8 @@ "binop": null }, "value": "axis", - "start": 8686, - "end": 8690, + "start": 8698, + "end": 8702, "loc": { "start": { "line": 317, @@ -48593,8 +48637,8 @@ "binop": null, "updateContext": null }, - "start": 8690, - "end": 8691, + "start": 8702, + "end": 8703, "loc": { "start": { "line": 317, @@ -48620,8 +48664,8 @@ "updateContext": null }, "value": 2, - "start": 8691, - "end": 8692, + "start": 8703, + "end": 8704, "loc": { "start": { "line": 317, @@ -48646,8 +48690,8 @@ "binop": null, "updateContext": null }, - "start": 8692, - "end": 8693, + "start": 8704, + "end": 8705, "loc": { "start": { "line": 317, @@ -48672,8 +48716,8 @@ "binop": null, "updateContext": null }, - "start": 8693, - "end": 8694, + "start": 8705, + "end": 8706, "loc": { "start": { "line": 317, @@ -48700,8 +48744,8 @@ "updateContext": null }, "value": "this", - "start": 8703, - "end": 8707, + "start": 8715, + "end": 8719, "loc": { "start": { "line": 318, @@ -48726,8 +48770,8 @@ "binop": null, "updateContext": null }, - "start": 8707, - "end": 8708, + "start": 8719, + "end": 8720, "loc": { "start": { "line": 318, @@ -48752,8 +48796,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 8708, - "end": 8728, + "start": 8720, + "end": 8740, "loc": { "start": { "line": 318, @@ -48777,8 +48821,8 @@ "postfix": false, "binop": null }, - "start": 8728, - "end": 8729, + "start": 8740, + "end": 8741, "loc": { "start": { "line": 318, @@ -48802,8 +48846,8 @@ "postfix": false, "binop": null }, - "start": 8729, - "end": 8730, + "start": 8741, + "end": 8742, "loc": { "start": { "line": 318, @@ -48828,8 +48872,8 @@ "binop": null, "updateContext": null }, - "start": 8730, - "end": 8731, + "start": 8742, + "end": 8743, "loc": { "start": { "line": 318, @@ -48856,8 +48900,8 @@ "updateContext": null }, "value": "this", - "start": 8740, - "end": 8744, + "start": 8752, + "end": 8756, "loc": { "start": { "line": 319, @@ -48882,8 +48926,8 @@ "binop": null, "updateContext": null }, - "start": 8744, - "end": 8745, + "start": 8756, + "end": 8757, "loc": { "start": { "line": 319, @@ -48908,8 +48952,8 @@ "binop": null }, "value": "_model", - "start": 8745, - "end": 8751, + "start": 8757, + "end": 8763, "loc": { "start": { "line": 319, @@ -48934,8 +48978,8 @@ "binop": null, "updateContext": null }, - "start": 8751, - "end": 8752, + "start": 8763, + "end": 8764, "loc": { "start": { "line": 319, @@ -48960,8 +49004,8 @@ "binop": null }, "value": "glRedraw", - "start": 8752, - "end": 8760, + "start": 8764, + "end": 8772, "loc": { "start": { "line": 319, @@ -48985,8 +49029,8 @@ "postfix": false, "binop": null }, - "start": 8760, - "end": 8761, + "start": 8772, + "end": 8773, "loc": { "start": { "line": 319, @@ -49010,8 +49054,8 @@ "postfix": false, "binop": null }, - "start": 8761, - "end": 8762, + "start": 8773, + "end": 8774, "loc": { "start": { "line": 319, @@ -49036,8 +49080,8 @@ "binop": null, "updateContext": null }, - "start": 8762, - "end": 8763, + "start": 8774, + "end": 8775, "loc": { "start": { "line": 319, @@ -49064,8 +49108,8 @@ "updateContext": null }, "value": "return", - "start": 8772, - "end": 8778, + "start": 8784, + "end": 8790, "loc": { "start": { "line": 320, @@ -49092,8 +49136,8 @@ "updateContext": null }, "value": "this", - "start": 8779, - "end": 8783, + "start": 8791, + "end": 8795, "loc": { "start": { "line": 320, @@ -49118,8 +49162,8 @@ "binop": null, "updateContext": null }, - "start": 8783, - "end": 8784, + "start": 8795, + "end": 8796, "loc": { "start": { "line": 320, @@ -49143,8 +49187,8 @@ "postfix": false, "binop": null }, - "start": 8789, - "end": 8790, + "start": 8801, + "end": 8802, "loc": { "start": { "line": 321, @@ -49159,8 +49203,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n ", - "start": 8796, - "end": 8976, + "start": 8808, + "end": 8988, "loc": { "start": { "line": 323, @@ -49185,8 +49229,8 @@ "binop": null }, "value": "translateX", - "start": 8981, - "end": 8991, + "start": 8993, + "end": 9003, "loc": { "start": { "line": 328, @@ -49210,8 +49254,8 @@ "postfix": false, "binop": null }, - "start": 8991, - "end": 8992, + "start": 9003, + "end": 9004, "loc": { "start": { "line": 328, @@ -49236,8 +49280,8 @@ "binop": null }, "value": "distance", - "start": 8992, - "end": 9000, + "start": 9004, + "end": 9012, "loc": { "start": { "line": 328, @@ -49261,8 +49305,8 @@ "postfix": false, "binop": null }, - "start": 9000, - "end": 9001, + "start": 9012, + "end": 9013, "loc": { "start": { "line": 328, @@ -49286,8 +49330,8 @@ "postfix": false, "binop": null }, - "start": 9002, - "end": 9003, + "start": 9014, + "end": 9015, "loc": { "start": { "line": 328, @@ -49314,8 +49358,8 @@ "updateContext": null }, "value": "this", - "start": 9012, - "end": 9016, + "start": 9024, + "end": 9028, "loc": { "start": { "line": 329, @@ -49340,8 +49384,8 @@ "binop": null, "updateContext": null }, - "start": 9016, - "end": 9017, + "start": 9028, + "end": 9029, "loc": { "start": { "line": 329, @@ -49366,8 +49410,8 @@ "binop": null }, "value": "_position", - "start": 9017, - "end": 9026, + "start": 9029, + "end": 9038, "loc": { "start": { "line": 329, @@ -49392,8 +49436,8 @@ "binop": null, "updateContext": null }, - "start": 9026, - "end": 9027, + "start": 9038, + "end": 9039, "loc": { "start": { "line": 329, @@ -49419,8 +49463,8 @@ "updateContext": null }, "value": 0, - "start": 9027, - "end": 9028, + "start": 9039, + "end": 9040, "loc": { "start": { "line": 329, @@ -49445,8 +49489,8 @@ "binop": null, "updateContext": null }, - "start": 9028, - "end": 9029, + "start": 9040, + "end": 9041, "loc": { "start": { "line": 329, @@ -49472,8 +49516,8 @@ "updateContext": null }, "value": "+=", - "start": 9030, - "end": 9032, + "start": 9042, + "end": 9044, "loc": { "start": { "line": 329, @@ -49498,8 +49542,8 @@ "binop": null }, "value": "distance", - "start": 9033, - "end": 9041, + "start": 9045, + "end": 9053, "loc": { "start": { "line": 329, @@ -49524,8 +49568,8 @@ "binop": null, "updateContext": null }, - "start": 9041, - "end": 9042, + "start": 9053, + "end": 9054, "loc": { "start": { "line": 329, @@ -49552,8 +49596,8 @@ "updateContext": null }, "value": "this", - "start": 9051, - "end": 9055, + "start": 9063, + "end": 9067, "loc": { "start": { "line": 330, @@ -49578,8 +49622,8 @@ "binop": null, "updateContext": null }, - "start": 9055, - "end": 9056, + "start": 9067, + "end": 9068, "loc": { "start": { "line": 330, @@ -49604,8 +49648,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 9056, - "end": 9076, + "start": 9068, + "end": 9088, "loc": { "start": { "line": 330, @@ -49629,8 +49673,8 @@ "postfix": false, "binop": null }, - "start": 9076, - "end": 9077, + "start": 9088, + "end": 9089, "loc": { "start": { "line": 330, @@ -49654,8 +49698,8 @@ "postfix": false, "binop": null }, - "start": 9077, - "end": 9078, + "start": 9089, + "end": 9090, "loc": { "start": { "line": 330, @@ -49680,8 +49724,8 @@ "binop": null, "updateContext": null }, - "start": 9078, - "end": 9079, + "start": 9090, + "end": 9091, "loc": { "start": { "line": 330, @@ -49708,8 +49752,8 @@ "updateContext": null }, "value": "this", - "start": 9088, - "end": 9092, + "start": 9100, + "end": 9104, "loc": { "start": { "line": 331, @@ -49734,8 +49778,8 @@ "binop": null, "updateContext": null }, - "start": 9092, - "end": 9093, + "start": 9104, + "end": 9105, "loc": { "start": { "line": 331, @@ -49760,8 +49804,8 @@ "binop": null }, "value": "_model", - "start": 9093, - "end": 9099, + "start": 9105, + "end": 9111, "loc": { "start": { "line": 331, @@ -49786,8 +49830,8 @@ "binop": null, "updateContext": null }, - "start": 9099, - "end": 9100, + "start": 9111, + "end": 9112, "loc": { "start": { "line": 331, @@ -49812,8 +49856,8 @@ "binop": null }, "value": "glRedraw", - "start": 9100, - "end": 9108, + "start": 9112, + "end": 9120, "loc": { "start": { "line": 331, @@ -49837,8 +49881,8 @@ "postfix": false, "binop": null }, - "start": 9108, - "end": 9109, + "start": 9120, + "end": 9121, "loc": { "start": { "line": 331, @@ -49862,8 +49906,8 @@ "postfix": false, "binop": null }, - "start": 9109, - "end": 9110, + "start": 9121, + "end": 9122, "loc": { "start": { "line": 331, @@ -49888,8 +49932,8 @@ "binop": null, "updateContext": null }, - "start": 9110, - "end": 9111, + "start": 9122, + "end": 9123, "loc": { "start": { "line": 331, @@ -49916,8 +49960,8 @@ "updateContext": null }, "value": "return", - "start": 9120, - "end": 9126, + "start": 9132, + "end": 9138, "loc": { "start": { "line": 332, @@ -49944,8 +49988,8 @@ "updateContext": null }, "value": "this", - "start": 9127, - "end": 9131, + "start": 9139, + "end": 9143, "loc": { "start": { "line": 332, @@ -49970,8 +50014,8 @@ "binop": null, "updateContext": null }, - "start": 9131, - "end": 9132, + "start": 9143, + "end": 9144, "loc": { "start": { "line": 332, @@ -49995,8 +50039,8 @@ "postfix": false, "binop": null }, - "start": 9137, - "end": 9138, + "start": 9149, + "end": 9150, "loc": { "start": { "line": 333, @@ -50011,8 +50055,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n ", - "start": 9144, - "end": 9324, + "start": 9156, + "end": 9336, "loc": { "start": { "line": 335, @@ -50037,8 +50081,8 @@ "binop": null }, "value": "translateY", - "start": 9329, - "end": 9339, + "start": 9341, + "end": 9351, "loc": { "start": { "line": 340, @@ -50062,8 +50106,8 @@ "postfix": false, "binop": null }, - "start": 9339, - "end": 9340, + "start": 9351, + "end": 9352, "loc": { "start": { "line": 340, @@ -50088,8 +50132,8 @@ "binop": null }, "value": "distance", - "start": 9340, - "end": 9348, + "start": 9352, + "end": 9360, "loc": { "start": { "line": 340, @@ -50113,8 +50157,8 @@ "postfix": false, "binop": null }, - "start": 9348, - "end": 9349, + "start": 9360, + "end": 9361, "loc": { "start": { "line": 340, @@ -50138,8 +50182,8 @@ "postfix": false, "binop": null }, - "start": 9350, - "end": 9351, + "start": 9362, + "end": 9363, "loc": { "start": { "line": 340, @@ -50166,8 +50210,8 @@ "updateContext": null }, "value": "this", - "start": 9360, - "end": 9364, + "start": 9372, + "end": 9376, "loc": { "start": { "line": 341, @@ -50192,8 +50236,8 @@ "binop": null, "updateContext": null }, - "start": 9364, - "end": 9365, + "start": 9376, + "end": 9377, "loc": { "start": { "line": 341, @@ -50218,8 +50262,8 @@ "binop": null }, "value": "_position", - "start": 9365, - "end": 9374, + "start": 9377, + "end": 9386, "loc": { "start": { "line": 341, @@ -50244,8 +50288,8 @@ "binop": null, "updateContext": null }, - "start": 9374, - "end": 9375, + "start": 9386, + "end": 9387, "loc": { "start": { "line": 341, @@ -50271,8 +50315,8 @@ "updateContext": null }, "value": 1, - "start": 9375, - "end": 9376, + "start": 9387, + "end": 9388, "loc": { "start": { "line": 341, @@ -50297,8 +50341,8 @@ "binop": null, "updateContext": null }, - "start": 9376, - "end": 9377, + "start": 9388, + "end": 9389, "loc": { "start": { "line": 341, @@ -50324,8 +50368,8 @@ "updateContext": null }, "value": "+=", - "start": 9378, - "end": 9380, + "start": 9390, + "end": 9392, "loc": { "start": { "line": 341, @@ -50350,8 +50394,8 @@ "binop": null }, "value": "distance", - "start": 9381, - "end": 9389, + "start": 9393, + "end": 9401, "loc": { "start": { "line": 341, @@ -50376,8 +50420,8 @@ "binop": null, "updateContext": null }, - "start": 9389, - "end": 9390, + "start": 9401, + "end": 9402, "loc": { "start": { "line": 341, @@ -50404,8 +50448,8 @@ "updateContext": null }, "value": "this", - "start": 9399, - "end": 9403, + "start": 9411, + "end": 9415, "loc": { "start": { "line": 342, @@ -50430,8 +50474,8 @@ "binop": null, "updateContext": null }, - "start": 9403, - "end": 9404, + "start": 9415, + "end": 9416, "loc": { "start": { "line": 342, @@ -50456,8 +50500,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 9404, - "end": 9424, + "start": 9416, + "end": 9436, "loc": { "start": { "line": 342, @@ -50481,8 +50525,8 @@ "postfix": false, "binop": null }, - "start": 9424, - "end": 9425, + "start": 9436, + "end": 9437, "loc": { "start": { "line": 342, @@ -50506,8 +50550,8 @@ "postfix": false, "binop": null }, - "start": 9425, - "end": 9426, + "start": 9437, + "end": 9438, "loc": { "start": { "line": 342, @@ -50532,8 +50576,8 @@ "binop": null, "updateContext": null }, - "start": 9426, - "end": 9427, + "start": 9438, + "end": 9439, "loc": { "start": { "line": 342, @@ -50560,8 +50604,8 @@ "updateContext": null }, "value": "this", - "start": 9436, - "end": 9440, + "start": 9448, + "end": 9452, "loc": { "start": { "line": 343, @@ -50586,8 +50630,8 @@ "binop": null, "updateContext": null }, - "start": 9440, - "end": 9441, + "start": 9452, + "end": 9453, "loc": { "start": { "line": 343, @@ -50612,8 +50656,8 @@ "binop": null }, "value": "_model", - "start": 9441, - "end": 9447, + "start": 9453, + "end": 9459, "loc": { "start": { "line": 343, @@ -50638,8 +50682,8 @@ "binop": null, "updateContext": null }, - "start": 9447, - "end": 9448, + "start": 9459, + "end": 9460, "loc": { "start": { "line": 343, @@ -50664,8 +50708,8 @@ "binop": null }, "value": "glRedraw", - "start": 9448, - "end": 9456, + "start": 9460, + "end": 9468, "loc": { "start": { "line": 343, @@ -50689,8 +50733,8 @@ "postfix": false, "binop": null }, - "start": 9456, - "end": 9457, + "start": 9468, + "end": 9469, "loc": { "start": { "line": 343, @@ -50714,8 +50758,8 @@ "postfix": false, "binop": null }, - "start": 9457, - "end": 9458, + "start": 9469, + "end": 9470, "loc": { "start": { "line": 343, @@ -50740,8 +50784,8 @@ "binop": null, "updateContext": null }, - "start": 9458, - "end": 9459, + "start": 9470, + "end": 9471, "loc": { "start": { "line": 343, @@ -50768,8 +50812,8 @@ "updateContext": null }, "value": "return", - "start": 9468, - "end": 9474, + "start": 9480, + "end": 9486, "loc": { "start": { "line": 344, @@ -50796,8 +50840,8 @@ "updateContext": null }, "value": "this", - "start": 9475, - "end": 9479, + "start": 9487, + "end": 9491, "loc": { "start": { "line": 344, @@ -50822,8 +50866,8 @@ "binop": null, "updateContext": null }, - "start": 9479, - "end": 9480, + "start": 9491, + "end": 9492, "loc": { "start": { "line": 344, @@ -50847,8 +50891,8 @@ "postfix": false, "binop": null }, - "start": 9485, - "end": 9486, + "start": 9497, + "end": 9498, "loc": { "start": { "line": 345, @@ -50863,8 +50907,8 @@ { "type": "CommentBlock", "value": "*\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n ", - "start": 9492, - "end": 9672, + "start": 9504, + "end": 9684, "loc": { "start": { "line": 347, @@ -50889,8 +50933,8 @@ "binop": null }, "value": "translateZ", - "start": 9677, - "end": 9687, + "start": 9689, + "end": 9699, "loc": { "start": { "line": 352, @@ -50914,8 +50958,8 @@ "postfix": false, "binop": null }, - "start": 9687, - "end": 9688, + "start": 9699, + "end": 9700, "loc": { "start": { "line": 352, @@ -50940,8 +50984,8 @@ "binop": null }, "value": "distance", - "start": 9688, - "end": 9696, + "start": 9700, + "end": 9708, "loc": { "start": { "line": 352, @@ -50965,8 +51009,8 @@ "postfix": false, "binop": null }, - "start": 9696, - "end": 9697, + "start": 9708, + "end": 9709, "loc": { "start": { "line": 352, @@ -50990,8 +51034,8 @@ "postfix": false, "binop": null }, - "start": 9698, - "end": 9699, + "start": 9710, + "end": 9711, "loc": { "start": { "line": 352, @@ -51018,8 +51062,8 @@ "updateContext": null }, "value": "this", - "start": 9708, - "end": 9712, + "start": 9720, + "end": 9724, "loc": { "start": { "line": 353, @@ -51044,8 +51088,8 @@ "binop": null, "updateContext": null }, - "start": 9712, - "end": 9713, + "start": 9724, + "end": 9725, "loc": { "start": { "line": 353, @@ -51070,8 +51114,8 @@ "binop": null }, "value": "_position", - "start": 9713, - "end": 9722, + "start": 9725, + "end": 9734, "loc": { "start": { "line": 353, @@ -51096,8 +51140,8 @@ "binop": null, "updateContext": null }, - "start": 9722, - "end": 9723, + "start": 9734, + "end": 9735, "loc": { "start": { "line": 353, @@ -51123,8 +51167,8 @@ "updateContext": null }, "value": 2, - "start": 9723, - "end": 9724, + "start": 9735, + "end": 9736, "loc": { "start": { "line": 353, @@ -51149,8 +51193,8 @@ "binop": null, "updateContext": null }, - "start": 9724, - "end": 9725, + "start": 9736, + "end": 9737, "loc": { "start": { "line": 353, @@ -51176,8 +51220,8 @@ "updateContext": null }, "value": "+=", - "start": 9726, - "end": 9728, + "start": 9738, + "end": 9740, "loc": { "start": { "line": 353, @@ -51202,8 +51246,8 @@ "binop": null }, "value": "distance", - "start": 9729, - "end": 9737, + "start": 9741, + "end": 9749, "loc": { "start": { "line": 353, @@ -51228,8 +51272,8 @@ "binop": null, "updateContext": null }, - "start": 9737, - "end": 9738, + "start": 9749, + "end": 9750, "loc": { "start": { "line": 353, @@ -51256,8 +51300,8 @@ "updateContext": null }, "value": "this", - "start": 9747, - "end": 9751, + "start": 9759, + "end": 9763, "loc": { "start": { "line": 354, @@ -51282,8 +51326,8 @@ "binop": null, "updateContext": null }, - "start": 9751, - "end": 9752, + "start": 9763, + "end": 9764, "loc": { "start": { "line": 354, @@ -51308,8 +51352,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 9752, - "end": 9772, + "start": 9764, + "end": 9784, "loc": { "start": { "line": 354, @@ -51333,8 +51377,8 @@ "postfix": false, "binop": null }, - "start": 9772, - "end": 9773, + "start": 9784, + "end": 9785, "loc": { "start": { "line": 354, @@ -51358,8 +51402,8 @@ "postfix": false, "binop": null }, - "start": 9773, - "end": 9774, + "start": 9785, + "end": 9786, "loc": { "start": { "line": 354, @@ -51384,8 +51428,8 @@ "binop": null, "updateContext": null }, - "start": 9774, - "end": 9775, + "start": 9786, + "end": 9787, "loc": { "start": { "line": 354, @@ -51412,8 +51456,8 @@ "updateContext": null }, "value": "this", - "start": 9784, - "end": 9788, + "start": 9796, + "end": 9800, "loc": { "start": { "line": 355, @@ -51438,8 +51482,8 @@ "binop": null, "updateContext": null }, - "start": 9788, - "end": 9789, + "start": 9800, + "end": 9801, "loc": { "start": { "line": 355, @@ -51464,8 +51508,8 @@ "binop": null }, "value": "_model", - "start": 9789, - "end": 9795, + "start": 9801, + "end": 9807, "loc": { "start": { "line": 355, @@ -51490,8 +51534,8 @@ "binop": null, "updateContext": null }, - "start": 9795, - "end": 9796, + "start": 9807, + "end": 9808, "loc": { "start": { "line": 355, @@ -51516,8 +51560,8 @@ "binop": null }, "value": "glRedraw", - "start": 9796, - "end": 9804, + "start": 9808, + "end": 9816, "loc": { "start": { "line": 355, @@ -51541,8 +51585,8 @@ "postfix": false, "binop": null }, - "start": 9804, - "end": 9805, + "start": 9816, + "end": 9817, "loc": { "start": { "line": 355, @@ -51566,8 +51610,8 @@ "postfix": false, "binop": null }, - "start": 9805, - "end": 9806, + "start": 9817, + "end": 9818, "loc": { "start": { "line": 355, @@ -51592,8 +51636,8 @@ "binop": null, "updateContext": null }, - "start": 9806, - "end": 9807, + "start": 9818, + "end": 9819, "loc": { "start": { "line": 355, @@ -51620,8 +51664,8 @@ "updateContext": null }, "value": "return", - "start": 9816, - "end": 9822, + "start": 9828, + "end": 9834, "loc": { "start": { "line": 356, @@ -51648,8 +51692,8 @@ "updateContext": null }, "value": "this", - "start": 9823, - "end": 9827, + "start": 9835, + "end": 9839, "loc": { "start": { "line": 356, @@ -51674,8 +51718,8 @@ "binop": null, "updateContext": null }, - "start": 9827, - "end": 9828, + "start": 9839, + "end": 9840, "loc": { "start": { "line": 356, @@ -51699,8 +51743,8 @@ "postfix": false, "binop": null }, - "start": 9833, - "end": 9834, + "start": 9845, + "end": 9846, "loc": { "start": { "line": 357, @@ -51725,8 +51769,8 @@ "binop": null }, "value": "_setLocalMatrixDirty", - "start": 9840, - "end": 9860, + "start": 9852, + "end": 9872, "loc": { "start": { "line": 359, @@ -51750,8 +51794,8 @@ "postfix": false, "binop": null }, - "start": 9860, - "end": 9861, + "start": 9872, + "end": 9873, "loc": { "start": { "line": 359, @@ -51775,8 +51819,8 @@ "postfix": false, "binop": null }, - "start": 9861, - "end": 9862, + "start": 9873, + "end": 9874, "loc": { "start": { "line": 359, @@ -51800,8 +51844,8 @@ "postfix": false, "binop": null }, - "start": 9863, - "end": 9864, + "start": 9875, + "end": 9876, "loc": { "start": { "line": 359, @@ -51828,8 +51872,8 @@ "updateContext": null }, "value": "this", - "start": 9873, - "end": 9877, + "start": 9885, + "end": 9889, "loc": { "start": { "line": 360, @@ -51854,8 +51898,8 @@ "binop": null, "updateContext": null }, - "start": 9877, - "end": 9878, + "start": 9889, + "end": 9890, "loc": { "start": { "line": 360, @@ -51880,8 +51924,8 @@ "binop": null }, "value": "_localMatrixDirty", - "start": 9878, - "end": 9895, + "start": 9890, + "end": 9907, "loc": { "start": { "line": 360, @@ -51907,8 +51951,8 @@ "updateContext": null }, "value": "=", - "start": 9896, - "end": 9897, + "start": 9908, + "end": 9909, "loc": { "start": { "line": 360, @@ -51935,8 +51979,8 @@ "updateContext": null }, "value": "true", - "start": 9898, - "end": 9902, + "start": 9910, + "end": 9914, "loc": { "start": { "line": 360, @@ -51961,8 +52005,8 @@ "binop": null, "updateContext": null }, - "start": 9902, - "end": 9903, + "start": 9914, + "end": 9915, "loc": { "start": { "line": 360, @@ -51989,8 +52033,8 @@ "updateContext": null }, "value": "this", - "start": 9912, - "end": 9916, + "start": 9924, + "end": 9928, "loc": { "start": { "line": 361, @@ -52015,8 +52059,8 @@ "binop": null, "updateContext": null }, - "start": 9916, - "end": 9917, + "start": 9928, + "end": 9929, "loc": { "start": { "line": 361, @@ -52041,8 +52085,8 @@ "binop": null }, "value": "_transformDirty", - "start": 9917, - "end": 9932, + "start": 9929, + "end": 9944, "loc": { "start": { "line": 361, @@ -52066,8 +52110,8 @@ "postfix": false, "binop": null }, - "start": 9932, - "end": 9933, + "start": 9944, + "end": 9945, "loc": { "start": { "line": 361, @@ -52091,8 +52135,8 @@ "postfix": false, "binop": null }, - "start": 9933, - "end": 9934, + "start": 9945, + "end": 9946, "loc": { "start": { "line": 361, @@ -52117,8 +52161,8 @@ "binop": null, "updateContext": null }, - "start": 9934, - "end": 9935, + "start": 9946, + "end": 9947, "loc": { "start": { "line": 361, @@ -52142,8 +52186,8 @@ "postfix": false, "binop": null }, - "start": 9940, - "end": 9941, + "start": 9952, + "end": 9953, "loc": { "start": { "line": 362, @@ -52168,8 +52212,8 @@ "binop": null }, "value": "_transformDirty", - "start": 9947, - "end": 9962, + "start": 9959, + "end": 9974, "loc": { "start": { "line": 364, @@ -52193,8 +52237,8 @@ "postfix": false, "binop": null }, - "start": 9962, - "end": 9963, + "start": 9974, + "end": 9975, "loc": { "start": { "line": 364, @@ -52218,8 +52262,8 @@ "postfix": false, "binop": null }, - "start": 9963, - "end": 9964, + "start": 9975, + "end": 9976, "loc": { "start": { "line": 364, @@ -52243,8 +52287,8 @@ "postfix": false, "binop": null }, - "start": 9965, - "end": 9966, + "start": 9977, + "end": 9978, "loc": { "start": { "line": 364, @@ -52271,8 +52315,8 @@ "updateContext": null }, "value": "this", - "start": 9975, - "end": 9979, + "start": 9987, + "end": 9991, "loc": { "start": { "line": 365, @@ -52297,8 +52341,8 @@ "binop": null, "updateContext": null }, - "start": 9979, - "end": 9980, + "start": 9991, + "end": 9992, "loc": { "start": { "line": 365, @@ -52323,8 +52367,8 @@ "binop": null }, "value": "_worldMatrixDirty", - "start": 9980, - "end": 9997, + "start": 9992, + "end": 10009, "loc": { "start": { "line": 365, @@ -52350,8 +52394,8 @@ "updateContext": null }, "value": "=", - "start": 9998, - "end": 9999, + "start": 10010, + "end": 10011, "loc": { "start": { "line": 365, @@ -52378,8 +52422,8 @@ "updateContext": null }, "value": "true", - "start": 10000, - "end": 10004, + "start": 10012, + "end": 10016, "loc": { "start": { "line": 365, @@ -52404,8 +52448,8 @@ "binop": null, "updateContext": null }, - "start": 10004, - "end": 10005, + "start": 10016, + "end": 10017, "loc": { "start": { "line": 365, @@ -52432,8 +52476,8 @@ "updateContext": null }, "value": "for", - "start": 10014, - "end": 10017, + "start": 10026, + "end": 10029, "loc": { "start": { "line": 366, @@ -52457,8 +52501,8 @@ "postfix": false, "binop": null }, - "start": 10018, - "end": 10019, + "start": 10030, + "end": 10031, "loc": { "start": { "line": 366, @@ -52485,8 +52529,8 @@ "updateContext": null }, "value": "let", - "start": 10019, - "end": 10022, + "start": 10031, + "end": 10034, "loc": { "start": { "line": 366, @@ -52511,8 +52555,8 @@ "binop": null }, "value": "i", - "start": 10023, - "end": 10024, + "start": 10035, + "end": 10036, "loc": { "start": { "line": 366, @@ -52538,8 +52582,8 @@ "updateContext": null }, "value": "=", - "start": 10025, - "end": 10026, + "start": 10037, + "end": 10038, "loc": { "start": { "line": 366, @@ -52565,8 +52609,8 @@ "updateContext": null }, "value": 0, - "start": 10027, - "end": 10028, + "start": 10039, + "end": 10040, "loc": { "start": { "line": 366, @@ -52591,8 +52635,8 @@ "binop": null, "updateContext": null }, - "start": 10028, - "end": 10029, + "start": 10040, + "end": 10041, "loc": { "start": { "line": 366, @@ -52617,8 +52661,8 @@ "binop": null }, "value": "len", - "start": 10030, - "end": 10033, + "start": 10042, + "end": 10045, "loc": { "start": { "line": 366, @@ -52644,8 +52688,8 @@ "updateContext": null }, "value": "=", - "start": 10034, - "end": 10035, + "start": 10046, + "end": 10047, "loc": { "start": { "line": 366, @@ -52672,8 +52716,8 @@ "updateContext": null }, "value": "this", - "start": 10036, - "end": 10040, + "start": 10048, + "end": 10052, "loc": { "start": { "line": 366, @@ -52698,8 +52742,8 @@ "binop": null, "updateContext": null }, - "start": 10040, - "end": 10041, + "start": 10052, + "end": 10053, "loc": { "start": { "line": 366, @@ -52724,8 +52768,8 @@ "binop": null }, "value": "_childTransforms", - "start": 10041, - "end": 10057, + "start": 10053, + "end": 10069, "loc": { "start": { "line": 366, @@ -52750,8 +52794,8 @@ "binop": null, "updateContext": null }, - "start": 10057, - "end": 10058, + "start": 10069, + "end": 10070, "loc": { "start": { "line": 366, @@ -52776,8 +52820,8 @@ "binop": null }, "value": "length", - "start": 10058, - "end": 10064, + "start": 10070, + "end": 10076, "loc": { "start": { "line": 366, @@ -52802,8 +52846,8 @@ "binop": null, "updateContext": null }, - "start": 10064, - "end": 10065, + "start": 10076, + "end": 10077, "loc": { "start": { "line": 366, @@ -52828,8 +52872,8 @@ "binop": null }, "value": "i", - "start": 10066, - "end": 10067, + "start": 10078, + "end": 10079, "loc": { "start": { "line": 366, @@ -52855,8 +52899,8 @@ "updateContext": null }, "value": "<", - "start": 10068, - "end": 10069, + "start": 10080, + "end": 10081, "loc": { "start": { "line": 366, @@ -52881,8 +52925,8 @@ "binop": null }, "value": "len", - "start": 10070, - "end": 10073, + "start": 10082, + "end": 10085, "loc": { "start": { "line": 366, @@ -52907,8 +52951,8 @@ "binop": null, "updateContext": null }, - "start": 10073, - "end": 10074, + "start": 10085, + "end": 10086, "loc": { "start": { "line": 366, @@ -52933,8 +52977,8 @@ "binop": null }, "value": "i", - "start": 10075, - "end": 10076, + "start": 10087, + "end": 10088, "loc": { "start": { "line": 366, @@ -52959,8 +53003,8 @@ "binop": null }, "value": "++", - "start": 10076, - "end": 10078, + "start": 10088, + "end": 10090, "loc": { "start": { "line": 366, @@ -52984,8 +53028,8 @@ "postfix": false, "binop": null }, - "start": 10078, - "end": 10079, + "start": 10090, + "end": 10091, "loc": { "start": { "line": 366, @@ -53009,8 +53053,8 @@ "postfix": false, "binop": null }, - "start": 10080, - "end": 10081, + "start": 10092, + "end": 10093, "loc": { "start": { "line": 366, @@ -53037,8 +53081,8 @@ "updateContext": null }, "value": "const", - "start": 10094, - "end": 10099, + "start": 10106, + "end": 10111, "loc": { "start": { "line": 367, @@ -53063,8 +53107,8 @@ "binop": null }, "value": "childTransform", - "start": 10100, - "end": 10114, + "start": 10112, + "end": 10126, "loc": { "start": { "line": 367, @@ -53090,8 +53134,8 @@ "updateContext": null }, "value": "=", - "start": 10115, - "end": 10116, + "start": 10127, + "end": 10128, "loc": { "start": { "line": 367, @@ -53118,8 +53162,8 @@ "updateContext": null }, "value": "this", - "start": 10117, - "end": 10121, + "start": 10129, + "end": 10133, "loc": { "start": { "line": 367, @@ -53144,8 +53188,8 @@ "binop": null, "updateContext": null }, - "start": 10121, - "end": 10122, + "start": 10133, + "end": 10134, "loc": { "start": { "line": 367, @@ -53170,8 +53214,8 @@ "binop": null }, "value": "_childTransforms", - "start": 10122, - "end": 10138, + "start": 10134, + "end": 10150, "loc": { "start": { "line": 367, @@ -53196,8 +53240,8 @@ "binop": null, "updateContext": null }, - "start": 10138, - "end": 10139, + "start": 10150, + "end": 10151, "loc": { "start": { "line": 367, @@ -53222,8 +53266,8 @@ "binop": null }, "value": "i", - "start": 10139, - "end": 10140, + "start": 10151, + "end": 10152, "loc": { "start": { "line": 367, @@ -53248,8 +53292,8 @@ "binop": null, "updateContext": null }, - "start": 10140, - "end": 10141, + "start": 10152, + "end": 10153, "loc": { "start": { "line": 367, @@ -53274,8 +53318,8 @@ "binop": null, "updateContext": null }, - "start": 10141, - "end": 10142, + "start": 10153, + "end": 10154, "loc": { "start": { "line": 367, @@ -53300,8 +53344,8 @@ "binop": null }, "value": "childTransform", - "start": 10155, - "end": 10169, + "start": 10167, + "end": 10181, "loc": { "start": { "line": 368, @@ -53326,8 +53370,8 @@ "binop": null, "updateContext": null }, - "start": 10169, - "end": 10170, + "start": 10181, + "end": 10182, "loc": { "start": { "line": 368, @@ -53352,8 +53396,8 @@ "binop": null }, "value": "_transformDirty", - "start": 10170, - "end": 10185, + "start": 10182, + "end": 10197, "loc": { "start": { "line": 368, @@ -53377,8 +53421,8 @@ "postfix": false, "binop": null }, - "start": 10185, - "end": 10186, + "start": 10197, + "end": 10198, "loc": { "start": { "line": 368, @@ -53402,8 +53446,8 @@ "postfix": false, "binop": null }, - "start": 10186, - "end": 10187, + "start": 10198, + "end": 10199, "loc": { "start": { "line": 368, @@ -53428,8 +53472,8 @@ "binop": null, "updateContext": null }, - "start": 10187, - "end": 10188, + "start": 10199, + "end": 10200, "loc": { "start": { "line": 368, @@ -53456,8 +53500,8 @@ "updateContext": null }, "value": "if", - "start": 10201, - "end": 10203, + "start": 10213, + "end": 10215, "loc": { "start": { "line": 369, @@ -53481,8 +53525,8 @@ "postfix": false, "binop": null }, - "start": 10204, - "end": 10205, + "start": 10216, + "end": 10217, "loc": { "start": { "line": 369, @@ -53507,8 +53551,8 @@ "binop": null }, "value": "childTransform", - "start": 10205, - "end": 10219, + "start": 10217, + "end": 10231, "loc": { "start": { "line": 369, @@ -53533,8 +53577,8 @@ "binop": null, "updateContext": null }, - "start": 10219, - "end": 10220, + "start": 10231, + "end": 10232, "loc": { "start": { "line": 369, @@ -53559,8 +53603,8 @@ "binop": null }, "value": "_meshes", - "start": 10220, - "end": 10227, + "start": 10232, + "end": 10239, "loc": { "start": { "line": 369, @@ -53586,8 +53630,8 @@ "updateContext": null }, "value": "&&", - "start": 10228, - "end": 10230, + "start": 10240, + "end": 10242, "loc": { "start": { "line": 369, @@ -53612,8 +53656,8 @@ "binop": null }, "value": "childTransform", - "start": 10231, - "end": 10245, + "start": 10243, + "end": 10257, "loc": { "start": { "line": 369, @@ -53638,8 +53682,8 @@ "binop": null, "updateContext": null }, - "start": 10245, - "end": 10246, + "start": 10257, + "end": 10258, "loc": { "start": { "line": 369, @@ -53664,8 +53708,8 @@ "binop": null }, "value": "_meshes", - "start": 10246, - "end": 10253, + "start": 10258, + "end": 10265, "loc": { "start": { "line": 369, @@ -53690,8 +53734,8 @@ "binop": null, "updateContext": null }, - "start": 10253, - "end": 10254, + "start": 10265, + "end": 10266, "loc": { "start": { "line": 369, @@ -53716,8 +53760,8 @@ "binop": null }, "value": "length", - "start": 10254, - "end": 10260, + "start": 10266, + "end": 10272, "loc": { "start": { "line": 369, @@ -53743,8 +53787,8 @@ "updateContext": null }, "value": ">", - "start": 10261, - "end": 10262, + "start": 10273, + "end": 10274, "loc": { "start": { "line": 369, @@ -53770,8 +53814,8 @@ "updateContext": null }, "value": 0, - "start": 10263, - "end": 10264, + "start": 10275, + "end": 10276, "loc": { "start": { "line": 369, @@ -53795,8 +53839,8 @@ "postfix": false, "binop": null }, - "start": 10264, - "end": 10265, + "start": 10276, + "end": 10277, "loc": { "start": { "line": 369, @@ -53820,8 +53864,8 @@ "postfix": false, "binop": null }, - "start": 10266, - "end": 10267, + "start": 10278, + "end": 10279, "loc": { "start": { "line": 369, @@ -53848,8 +53892,8 @@ "updateContext": null }, "value": "const", - "start": 10283, - "end": 10288, + "start": 10295, + "end": 10300, "loc": { "start": { "line": 370, @@ -53874,8 +53918,8 @@ "binop": null }, "value": "meshes", - "start": 10289, - "end": 10295, + "start": 10301, + "end": 10307, "loc": { "start": { "line": 370, @@ -53901,8 +53945,8 @@ "updateContext": null }, "value": "=", - "start": 10296, - "end": 10297, + "start": 10308, + "end": 10309, "loc": { "start": { "line": 370, @@ -53927,8 +53971,8 @@ "binop": null }, "value": "childTransform", - "start": 10298, - "end": 10312, + "start": 10310, + "end": 10324, "loc": { "start": { "line": 370, @@ -53953,8 +53997,8 @@ "binop": null, "updateContext": null }, - "start": 10312, - "end": 10313, + "start": 10324, + "end": 10325, "loc": { "start": { "line": 370, @@ -53979,8 +54023,8 @@ "binop": null }, "value": "_meshes", - "start": 10313, - "end": 10320, + "start": 10325, + "end": 10332, "loc": { "start": { "line": 370, @@ -54005,8 +54049,8 @@ "binop": null, "updateContext": null }, - "start": 10320, - "end": 10321, + "start": 10332, + "end": 10333, "loc": { "start": { "line": 370, @@ -54033,8 +54077,8 @@ "updateContext": null }, "value": "for", - "start": 10337, - "end": 10340, + "start": 10349, + "end": 10352, "loc": { "start": { "line": 371, @@ -54058,8 +54102,8 @@ "postfix": false, "binop": null }, - "start": 10341, - "end": 10342, + "start": 10353, + "end": 10354, "loc": { "start": { "line": 371, @@ -54086,8 +54130,8 @@ "updateContext": null }, "value": "let", - "start": 10342, - "end": 10345, + "start": 10354, + "end": 10357, "loc": { "start": { "line": 371, @@ -54112,8 +54156,8 @@ "binop": null }, "value": "j", - "start": 10346, - "end": 10347, + "start": 10358, + "end": 10359, "loc": { "start": { "line": 371, @@ -54139,8 +54183,8 @@ "updateContext": null }, "value": "=", - "start": 10348, - "end": 10349, + "start": 10360, + "end": 10361, "loc": { "start": { "line": 371, @@ -54166,8 +54210,8 @@ "updateContext": null }, "value": 0, - "start": 10349, - "end": 10350, + "start": 10361, + "end": 10362, "loc": { "start": { "line": 371, @@ -54192,8 +54236,8 @@ "binop": null, "updateContext": null }, - "start": 10350, - "end": 10351, + "start": 10362, + "end": 10363, "loc": { "start": { "line": 371, @@ -54218,8 +54262,8 @@ "binop": null }, "value": "lenj", - "start": 10352, - "end": 10356, + "start": 10364, + "end": 10368, "loc": { "start": { "line": 371, @@ -54245,8 +54289,8 @@ "updateContext": null }, "value": "=", - "start": 10357, - "end": 10358, + "start": 10369, + "end": 10370, "loc": { "start": { "line": 371, @@ -54271,8 +54315,8 @@ "binop": null }, "value": "meshes", - "start": 10359, - "end": 10365, + "start": 10371, + "end": 10377, "loc": { "start": { "line": 371, @@ -54297,8 +54341,8 @@ "binop": null, "updateContext": null }, - "start": 10365, - "end": 10366, + "start": 10377, + "end": 10378, "loc": { "start": { "line": 371, @@ -54323,8 +54367,8 @@ "binop": null }, "value": "length", - "start": 10366, - "end": 10372, + "start": 10378, + "end": 10384, "loc": { "start": { "line": 371, @@ -54349,8 +54393,8 @@ "binop": null, "updateContext": null }, - "start": 10372, - "end": 10373, + "start": 10384, + "end": 10385, "loc": { "start": { "line": 371, @@ -54375,8 +54419,8 @@ "binop": null }, "value": "j", - "start": 10374, - "end": 10375, + "start": 10386, + "end": 10387, "loc": { "start": { "line": 371, @@ -54402,8 +54446,8 @@ "updateContext": null }, "value": "<", - "start": 10376, - "end": 10377, + "start": 10388, + "end": 10389, "loc": { "start": { "line": 371, @@ -54428,8 +54472,8 @@ "binop": null }, "value": "lenj", - "start": 10378, - "end": 10382, + "start": 10390, + "end": 10394, "loc": { "start": { "line": 371, @@ -54454,8 +54498,8 @@ "binop": null, "updateContext": null }, - "start": 10382, - "end": 10383, + "start": 10394, + "end": 10395, "loc": { "start": { "line": 371, @@ -54480,8 +54524,8 @@ "binop": null }, "value": "j", - "start": 10384, - "end": 10385, + "start": 10396, + "end": 10397, "loc": { "start": { "line": 371, @@ -54506,8 +54550,8 @@ "binop": null }, "value": "++", - "start": 10385, - "end": 10387, + "start": 10397, + "end": 10399, "loc": { "start": { "line": 371, @@ -54531,8 +54575,8 @@ "postfix": false, "binop": null }, - "start": 10387, - "end": 10388, + "start": 10399, + "end": 10400, "loc": { "start": { "line": 371, @@ -54556,8 +54600,8 @@ "postfix": false, "binop": null }, - "start": 10389, - "end": 10390, + "start": 10401, + "end": 10402, "loc": { "start": { "line": 371, @@ -54582,8 +54626,8 @@ "binop": null }, "value": "meshes", - "start": 10408, - "end": 10414, + "start": 10420, + "end": 10426, "loc": { "start": { "line": 372, @@ -54608,8 +54652,8 @@ "binop": null, "updateContext": null }, - "start": 10414, - "end": 10415, + "start": 10426, + "end": 10427, "loc": { "start": { "line": 372, @@ -54634,8 +54678,8 @@ "binop": null }, "value": "j", - "start": 10415, - "end": 10416, + "start": 10427, + "end": 10428, "loc": { "start": { "line": 372, @@ -54660,8 +54704,8 @@ "binop": null, "updateContext": null }, - "start": 10416, - "end": 10417, + "start": 10428, + "end": 10429, "loc": { "start": { "line": 372, @@ -54686,8 +54730,8 @@ "binop": null, "updateContext": null }, - "start": 10417, - "end": 10418, + "start": 10429, + "end": 10430, "loc": { "start": { "line": 372, @@ -54712,8 +54756,8 @@ "binop": null }, "value": "_transformDirty", - "start": 10418, - "end": 10433, + "start": 10430, + "end": 10445, "loc": { "start": { "line": 372, @@ -54737,8 +54781,8 @@ "postfix": false, "binop": null }, - "start": 10433, - "end": 10434, + "start": 10445, + "end": 10446, "loc": { "start": { "line": 372, @@ -54762,8 +54806,8 @@ "postfix": false, "binop": null }, - "start": 10434, - "end": 10435, + "start": 10446, + "end": 10447, "loc": { "start": { "line": 372, @@ -54788,8 +54832,8 @@ "binop": null, "updateContext": null }, - "start": 10435, - "end": 10436, + "start": 10447, + "end": 10448, "loc": { "start": { "line": 372, @@ -54813,8 +54857,8 @@ "postfix": false, "binop": null }, - "start": 10452, - "end": 10453, + "start": 10464, + "end": 10465, "loc": { "start": { "line": 373, @@ -54838,8 +54882,8 @@ "postfix": false, "binop": null }, - "start": 10466, - "end": 10467, + "start": 10478, + "end": 10479, "loc": { "start": { "line": 374, @@ -54863,8 +54907,8 @@ "postfix": false, "binop": null }, - "start": 10476, - "end": 10477, + "start": 10488, + "end": 10489, "loc": { "start": { "line": 375, @@ -54891,8 +54935,8 @@ "updateContext": null }, "value": "if", - "start": 10486, - "end": 10488, + "start": 10498, + "end": 10500, "loc": { "start": { "line": 376, @@ -54916,8 +54960,8 @@ "postfix": false, "binop": null }, - "start": 10489, - "end": 10490, + "start": 10501, + "end": 10502, "loc": { "start": { "line": 376, @@ -54944,8 +54988,8 @@ "updateContext": null }, "value": "this", - "start": 10490, - "end": 10494, + "start": 10502, + "end": 10506, "loc": { "start": { "line": 376, @@ -54970,8 +55014,8 @@ "binop": null, "updateContext": null }, - "start": 10494, - "end": 10495, + "start": 10506, + "end": 10507, "loc": { "start": { "line": 376, @@ -54996,8 +55040,8 @@ "binop": null }, "value": "_meshes", - "start": 10495, - "end": 10502, + "start": 10507, + "end": 10514, "loc": { "start": { "line": 376, @@ -55023,8 +55067,8 @@ "updateContext": null }, "value": "&&", - "start": 10503, - "end": 10505, + "start": 10515, + "end": 10517, "loc": { "start": { "line": 376, @@ -55051,8 +55095,8 @@ "updateContext": null }, "value": "this", - "start": 10506, - "end": 10510, + "start": 10518, + "end": 10522, "loc": { "start": { "line": 376, @@ -55077,8 +55121,8 @@ "binop": null, "updateContext": null }, - "start": 10510, - "end": 10511, + "start": 10522, + "end": 10523, "loc": { "start": { "line": 376, @@ -55103,8 +55147,8 @@ "binop": null }, "value": "_meshes", - "start": 10511, - "end": 10518, + "start": 10523, + "end": 10530, "loc": { "start": { "line": 376, @@ -55129,8 +55173,8 @@ "binop": null, "updateContext": null }, - "start": 10518, - "end": 10519, + "start": 10530, + "end": 10531, "loc": { "start": { "line": 376, @@ -55155,8 +55199,8 @@ "binop": null }, "value": "length", - "start": 10519, - "end": 10525, + "start": 10531, + "end": 10537, "loc": { "start": { "line": 376, @@ -55182,8 +55226,8 @@ "updateContext": null }, "value": ">", - "start": 10526, - "end": 10527, + "start": 10538, + "end": 10539, "loc": { "start": { "line": 376, @@ -55209,8 +55253,8 @@ "updateContext": null }, "value": 0, - "start": 10528, - "end": 10529, + "start": 10540, + "end": 10541, "loc": { "start": { "line": 376, @@ -55234,8 +55278,8 @@ "postfix": false, "binop": null }, - "start": 10529, - "end": 10530, + "start": 10541, + "end": 10542, "loc": { "start": { "line": 376, @@ -55259,8 +55303,8 @@ "postfix": false, "binop": null }, - "start": 10531, - "end": 10532, + "start": 10543, + "end": 10544, "loc": { "start": { "line": 376, @@ -55287,8 +55331,8 @@ "updateContext": null }, "value": "const", - "start": 10545, - "end": 10550, + "start": 10557, + "end": 10562, "loc": { "start": { "line": 377, @@ -55313,8 +55357,8 @@ "binop": null }, "value": "meshes", - "start": 10551, - "end": 10557, + "start": 10563, + "end": 10569, "loc": { "start": { "line": 377, @@ -55340,8 +55384,8 @@ "updateContext": null }, "value": "=", - "start": 10558, - "end": 10559, + "start": 10570, + "end": 10571, "loc": { "start": { "line": 377, @@ -55368,8 +55412,8 @@ "updateContext": null }, "value": "this", - "start": 10560, - "end": 10564, + "start": 10572, + "end": 10576, "loc": { "start": { "line": 377, @@ -55394,8 +55438,8 @@ "binop": null, "updateContext": null }, - "start": 10564, - "end": 10565, + "start": 10576, + "end": 10577, "loc": { "start": { "line": 377, @@ -55420,8 +55464,8 @@ "binop": null }, "value": "_meshes", - "start": 10565, - "end": 10572, + "start": 10577, + "end": 10584, "loc": { "start": { "line": 377, @@ -55446,8 +55490,8 @@ "binop": null, "updateContext": null }, - "start": 10572, - "end": 10573, + "start": 10584, + "end": 10585, "loc": { "start": { "line": 377, @@ -55474,8 +55518,8 @@ "updateContext": null }, "value": "for", - "start": 10586, - "end": 10589, + "start": 10598, + "end": 10601, "loc": { "start": { "line": 378, @@ -55499,8 +55543,8 @@ "postfix": false, "binop": null }, - "start": 10590, - "end": 10591, + "start": 10602, + "end": 10603, "loc": { "start": { "line": 378, @@ -55527,8 +55571,8 @@ "updateContext": null }, "value": "let", - "start": 10591, - "end": 10594, + "start": 10603, + "end": 10606, "loc": { "start": { "line": 378, @@ -55553,8 +55597,8 @@ "binop": null }, "value": "j", - "start": 10595, - "end": 10596, + "start": 10607, + "end": 10608, "loc": { "start": { "line": 378, @@ -55580,8 +55624,8 @@ "updateContext": null }, "value": "=", - "start": 10597, - "end": 10598, + "start": 10609, + "end": 10610, "loc": { "start": { "line": 378, @@ -55607,8 +55651,8 @@ "updateContext": null }, "value": 0, - "start": 10598, - "end": 10599, + "start": 10610, + "end": 10611, "loc": { "start": { "line": 378, @@ -55633,8 +55677,8 @@ "binop": null, "updateContext": null }, - "start": 10599, - "end": 10600, + "start": 10611, + "end": 10612, "loc": { "start": { "line": 378, @@ -55659,8 +55703,8 @@ "binop": null }, "value": "lenj", - "start": 10601, - "end": 10605, + "start": 10613, + "end": 10617, "loc": { "start": { "line": 378, @@ -55686,8 +55730,8 @@ "updateContext": null }, "value": "=", - "start": 10606, - "end": 10607, + "start": 10618, + "end": 10619, "loc": { "start": { "line": 378, @@ -55712,8 +55756,8 @@ "binop": null }, "value": "meshes", - "start": 10608, - "end": 10614, + "start": 10620, + "end": 10626, "loc": { "start": { "line": 378, @@ -55738,8 +55782,8 @@ "binop": null, "updateContext": null }, - "start": 10614, - "end": 10615, + "start": 10626, + "end": 10627, "loc": { "start": { "line": 378, @@ -55764,8 +55808,8 @@ "binop": null }, "value": "length", - "start": 10615, - "end": 10621, + "start": 10627, + "end": 10633, "loc": { "start": { "line": 378, @@ -55790,8 +55834,8 @@ "binop": null, "updateContext": null }, - "start": 10621, - "end": 10622, + "start": 10633, + "end": 10634, "loc": { "start": { "line": 378, @@ -55816,8 +55860,8 @@ "binop": null }, "value": "j", - "start": 10623, - "end": 10624, + "start": 10635, + "end": 10636, "loc": { "start": { "line": 378, @@ -55843,8 +55887,8 @@ "updateContext": null }, "value": "<", - "start": 10625, - "end": 10626, + "start": 10637, + "end": 10638, "loc": { "start": { "line": 378, @@ -55869,8 +55913,8 @@ "binop": null }, "value": "lenj", - "start": 10627, - "end": 10631, + "start": 10639, + "end": 10643, "loc": { "start": { "line": 378, @@ -55895,8 +55939,8 @@ "binop": null, "updateContext": null }, - "start": 10631, - "end": 10632, + "start": 10643, + "end": 10644, "loc": { "start": { "line": 378, @@ -55921,8 +55965,8 @@ "binop": null }, "value": "j", - "start": 10633, - "end": 10634, + "start": 10645, + "end": 10646, "loc": { "start": { "line": 378, @@ -55947,8 +55991,8 @@ "binop": null }, "value": "++", - "start": 10634, - "end": 10636, + "start": 10646, + "end": 10648, "loc": { "start": { "line": 378, @@ -55972,8 +56016,8 @@ "postfix": false, "binop": null }, - "start": 10636, - "end": 10637, + "start": 10648, + "end": 10649, "loc": { "start": { "line": 378, @@ -55997,8 +56041,8 @@ "postfix": false, "binop": null }, - "start": 10638, - "end": 10639, + "start": 10650, + "end": 10651, "loc": { "start": { "line": 378, @@ -56023,8 +56067,8 @@ "binop": null }, "value": "meshes", - "start": 10656, - "end": 10662, + "start": 10668, + "end": 10674, "loc": { "start": { "line": 379, @@ -56049,8 +56093,8 @@ "binop": null, "updateContext": null }, - "start": 10662, - "end": 10663, + "start": 10674, + "end": 10675, "loc": { "start": { "line": 379, @@ -56075,8 +56119,8 @@ "binop": null }, "value": "j", - "start": 10663, - "end": 10664, + "start": 10675, + "end": 10676, "loc": { "start": { "line": 379, @@ -56101,8 +56145,8 @@ "binop": null, "updateContext": null }, - "start": 10664, - "end": 10665, + "start": 10676, + "end": 10677, "loc": { "start": { "line": 379, @@ -56127,8 +56171,8 @@ "binop": null, "updateContext": null }, - "start": 10665, - "end": 10666, + "start": 10677, + "end": 10678, "loc": { "start": { "line": 379, @@ -56153,8 +56197,8 @@ "binop": null }, "value": "_transformDirty", - "start": 10666, - "end": 10681, + "start": 10678, + "end": 10693, "loc": { "start": { "line": 379, @@ -56178,8 +56222,8 @@ "postfix": false, "binop": null }, - "start": 10681, - "end": 10682, + "start": 10693, + "end": 10694, "loc": { "start": { "line": 379, @@ -56203,8 +56247,8 @@ "postfix": false, "binop": null }, - "start": 10682, - "end": 10683, + "start": 10694, + "end": 10695, "loc": { "start": { "line": 379, @@ -56229,8 +56273,8 @@ "binop": null, "updateContext": null }, - "start": 10683, - "end": 10684, + "start": 10695, + "end": 10696, "loc": { "start": { "line": 379, @@ -56254,8 +56298,8 @@ "postfix": false, "binop": null }, - "start": 10697, - "end": 10698, + "start": 10709, + "end": 10710, "loc": { "start": { "line": 380, @@ -56279,8 +56323,8 @@ "postfix": false, "binop": null }, - "start": 10707, - "end": 10708, + "start": 10719, + "end": 10720, "loc": { "start": { "line": 381, @@ -56304,8 +56348,8 @@ "postfix": false, "binop": null }, - "start": 10713, - "end": 10714, + "start": 10725, + "end": 10726, "loc": { "start": { "line": 382, @@ -56330,8 +56374,8 @@ "binop": null }, "value": "_buildWorldMatrix", - "start": 10720, - "end": 10737, + "start": 10732, + "end": 10749, "loc": { "start": { "line": 384, @@ -56355,8 +56399,8 @@ "postfix": false, "binop": null }, - "start": 10737, - "end": 10738, + "start": 10749, + "end": 10750, "loc": { "start": { "line": 384, @@ -56380,8 +56424,8 @@ "postfix": false, "binop": null }, - "start": 10738, - "end": 10739, + "start": 10750, + "end": 10751, "loc": { "start": { "line": 384, @@ -56405,8 +56449,8 @@ "postfix": false, "binop": null }, - "start": 10740, - "end": 10741, + "start": 10752, + "end": 10753, "loc": { "start": { "line": 384, @@ -56433,8 +56477,8 @@ "updateContext": null }, "value": "const", - "start": 10750, - "end": 10755, + "start": 10762, + "end": 10767, "loc": { "start": { "line": 385, @@ -56459,8 +56503,8 @@ "binop": null }, "value": "localMatrix", - "start": 10756, - "end": 10767, + "start": 10768, + "end": 10779, "loc": { "start": { "line": 385, @@ -56486,8 +56530,8 @@ "updateContext": null }, "value": "=", - "start": 10768, - "end": 10769, + "start": 10780, + "end": 10781, "loc": { "start": { "line": 385, @@ -56514,8 +56558,8 @@ "updateContext": null }, "value": "this", - "start": 10770, - "end": 10774, + "start": 10782, + "end": 10786, "loc": { "start": { "line": 385, @@ -56540,8 +56584,8 @@ "binop": null, "updateContext": null }, - "start": 10774, - "end": 10775, + "start": 10786, + "end": 10787, "loc": { "start": { "line": 385, @@ -56566,8 +56610,8 @@ "binop": null }, "value": "matrix", - "start": 10775, - "end": 10781, + "start": 10787, + "end": 10793, "loc": { "start": { "line": 385, @@ -56592,8 +56636,8 @@ "binop": null, "updateContext": null }, - "start": 10781, - "end": 10782, + "start": 10793, + "end": 10794, "loc": { "start": { "line": 385, @@ -56620,8 +56664,8 @@ "updateContext": null }, "value": "if", - "start": 10791, - "end": 10793, + "start": 10803, + "end": 10805, "loc": { "start": { "line": 386, @@ -56645,8 +56689,8 @@ "postfix": false, "binop": null }, - "start": 10794, - "end": 10795, + "start": 10806, + "end": 10807, "loc": { "start": { "line": 386, @@ -56672,8 +56716,8 @@ "updateContext": null }, "value": "!", - "start": 10795, - "end": 10796, + "start": 10807, + "end": 10808, "loc": { "start": { "line": 386, @@ -56700,8 +56744,8 @@ "updateContext": null }, "value": "this", - "start": 10796, - "end": 10800, + "start": 10808, + "end": 10812, "loc": { "start": { "line": 386, @@ -56726,8 +56770,8 @@ "binop": null, "updateContext": null }, - "start": 10800, - "end": 10801, + "start": 10812, + "end": 10813, "loc": { "start": { "line": 386, @@ -56752,8 +56796,8 @@ "binop": null }, "value": "_parentTransform", - "start": 10801, - "end": 10817, + "start": 10813, + "end": 10829, "loc": { "start": { "line": 386, @@ -56777,8 +56821,8 @@ "postfix": false, "binop": null }, - "start": 10817, - "end": 10818, + "start": 10829, + "end": 10830, "loc": { "start": { "line": 386, @@ -56802,8 +56846,8 @@ "postfix": false, "binop": null }, - "start": 10819, - "end": 10820, + "start": 10831, + "end": 10832, "loc": { "start": { "line": 386, @@ -56830,8 +56874,8 @@ "updateContext": null }, "value": "for", - "start": 10833, - "end": 10836, + "start": 10845, + "end": 10848, "loc": { "start": { "line": 387, @@ -56855,8 +56899,8 @@ "postfix": false, "binop": null }, - "start": 10837, - "end": 10838, + "start": 10849, + "end": 10850, "loc": { "start": { "line": 387, @@ -56883,8 +56927,8 @@ "updateContext": null }, "value": "let", - "start": 10838, - "end": 10841, + "start": 10850, + "end": 10853, "loc": { "start": { "line": 387, @@ -56909,8 +56953,8 @@ "binop": null }, "value": "i", - "start": 10842, - "end": 10843, + "start": 10854, + "end": 10855, "loc": { "start": { "line": 387, @@ -56936,8 +56980,8 @@ "updateContext": null }, "value": "=", - "start": 10844, - "end": 10845, + "start": 10856, + "end": 10857, "loc": { "start": { "line": 387, @@ -56963,8 +57007,8 @@ "updateContext": null }, "value": 0, - "start": 10846, - "end": 10847, + "start": 10858, + "end": 10859, "loc": { "start": { "line": 387, @@ -56989,8 +57033,8 @@ "binop": null, "updateContext": null }, - "start": 10847, - "end": 10848, + "start": 10859, + "end": 10860, "loc": { "start": { "line": 387, @@ -57015,8 +57059,8 @@ "binop": null }, "value": "len", - "start": 10849, - "end": 10852, + "start": 10861, + "end": 10864, "loc": { "start": { "line": 387, @@ -57042,8 +57086,8 @@ "updateContext": null }, "value": "=", - "start": 10853, - "end": 10854, + "start": 10865, + "end": 10866, "loc": { "start": { "line": 387, @@ -57068,8 +57112,8 @@ "binop": null }, "value": "localMatrix", - "start": 10855, - "end": 10866, + "start": 10867, + "end": 10878, "loc": { "start": { "line": 387, @@ -57094,8 +57138,8 @@ "binop": null, "updateContext": null }, - "start": 10866, - "end": 10867, + "start": 10878, + "end": 10879, "loc": { "start": { "line": 387, @@ -57120,8 +57164,8 @@ "binop": null }, "value": "length", - "start": 10867, - "end": 10873, + "start": 10879, + "end": 10885, "loc": { "start": { "line": 387, @@ -57146,8 +57190,8 @@ "binop": null, "updateContext": null }, - "start": 10873, - "end": 10874, + "start": 10885, + "end": 10886, "loc": { "start": { "line": 387, @@ -57172,8 +57216,8 @@ "binop": null }, "value": "i", - "start": 10875, - "end": 10876, + "start": 10887, + "end": 10888, "loc": { "start": { "line": 387, @@ -57199,8 +57243,8 @@ "updateContext": null }, "value": "<", - "start": 10877, - "end": 10878, + "start": 10889, + "end": 10890, "loc": { "start": { "line": 387, @@ -57225,8 +57269,8 @@ "binop": null }, "value": "len", - "start": 10879, - "end": 10882, + "start": 10891, + "end": 10894, "loc": { "start": { "line": 387, @@ -57251,8 +57295,8 @@ "binop": null, "updateContext": null }, - "start": 10882, - "end": 10883, + "start": 10894, + "end": 10895, "loc": { "start": { "line": 387, @@ -57277,8 +57321,8 @@ "binop": null }, "value": "i", - "start": 10884, - "end": 10885, + "start": 10896, + "end": 10897, "loc": { "start": { "line": 387, @@ -57303,8 +57347,8 @@ "binop": null }, "value": "++", - "start": 10885, - "end": 10887, + "start": 10897, + "end": 10899, "loc": { "start": { "line": 387, @@ -57328,8 +57372,8 @@ "postfix": false, "binop": null }, - "start": 10887, - "end": 10888, + "start": 10899, + "end": 10900, "loc": { "start": { "line": 387, @@ -57353,8 +57397,8 @@ "postfix": false, "binop": null }, - "start": 10889, - "end": 10890, + "start": 10901, + "end": 10902, "loc": { "start": { "line": 387, @@ -57381,8 +57425,8 @@ "updateContext": null }, "value": "this", - "start": 10907, - "end": 10911, + "start": 10919, + "end": 10923, "loc": { "start": { "line": 388, @@ -57407,8 +57451,8 @@ "binop": null, "updateContext": null }, - "start": 10911, - "end": 10912, + "start": 10923, + "end": 10924, "loc": { "start": { "line": 388, @@ -57433,8 +57477,8 @@ "binop": null }, "value": "_worldMatrix", - "start": 10912, - "end": 10924, + "start": 10924, + "end": 10936, "loc": { "start": { "line": 388, @@ -57459,8 +57503,8 @@ "binop": null, "updateContext": null }, - "start": 10924, - "end": 10925, + "start": 10936, + "end": 10937, "loc": { "start": { "line": 388, @@ -57485,8 +57529,8 @@ "binop": null }, "value": "i", - "start": 10925, - "end": 10926, + "start": 10937, + "end": 10938, "loc": { "start": { "line": 388, @@ -57511,8 +57555,8 @@ "binop": null, "updateContext": null }, - "start": 10926, - "end": 10927, + "start": 10938, + "end": 10939, "loc": { "start": { "line": 388, @@ -57538,8 +57582,8 @@ "updateContext": null }, "value": "=", - "start": 10928, - "end": 10929, + "start": 10940, + "end": 10941, "loc": { "start": { "line": 388, @@ -57564,8 +57608,8 @@ "binop": null }, "value": "localMatrix", - "start": 10930, - "end": 10941, + "start": 10942, + "end": 10953, "loc": { "start": { "line": 388, @@ -57590,8 +57634,8 @@ "binop": null, "updateContext": null }, - "start": 10941, - "end": 10942, + "start": 10953, + "end": 10954, "loc": { "start": { "line": 388, @@ -57616,8 +57660,8 @@ "binop": null }, "value": "i", - "start": 10942, - "end": 10943, + "start": 10954, + "end": 10955, "loc": { "start": { "line": 388, @@ -57642,8 +57686,8 @@ "binop": null, "updateContext": null }, - "start": 10943, - "end": 10944, + "start": 10955, + "end": 10956, "loc": { "start": { "line": 388, @@ -57668,8 +57712,8 @@ "binop": null, "updateContext": null }, - "start": 10944, - "end": 10945, + "start": 10956, + "end": 10957, "loc": { "start": { "line": 388, @@ -57693,8 +57737,8 @@ "postfix": false, "binop": null }, - "start": 10958, - "end": 10959, + "start": 10970, + "end": 10971, "loc": { "start": { "line": 389, @@ -57718,8 +57762,8 @@ "postfix": false, "binop": null }, - "start": 10968, - "end": 10969, + "start": 10980, + "end": 10981, "loc": { "start": { "line": 390, @@ -57746,8 +57790,8 @@ "updateContext": null }, "value": "else", - "start": 10970, - "end": 10974, + "start": 10982, + "end": 10986, "loc": { "start": { "line": 390, @@ -57771,8 +57815,8 @@ "postfix": false, "binop": null }, - "start": 10975, - "end": 10976, + "start": 10987, + "end": 10988, "loc": { "start": { "line": 390, @@ -57797,8 +57841,8 @@ "binop": null }, "value": "math", - "start": 10989, - "end": 10993, + "start": 11001, + "end": 11005, "loc": { "start": { "line": 391, @@ -57823,8 +57867,8 @@ "binop": null, "updateContext": null }, - "start": 10993, - "end": 10994, + "start": 11005, + "end": 11006, "loc": { "start": { "line": 391, @@ -57849,8 +57893,8 @@ "binop": null }, "value": "mulMat4", - "start": 10994, - "end": 11001, + "start": 11006, + "end": 11013, "loc": { "start": { "line": 391, @@ -57874,8 +57918,8 @@ "postfix": false, "binop": null }, - "start": 11001, - "end": 11002, + "start": 11013, + "end": 11014, "loc": { "start": { "line": 391, @@ -57902,8 +57946,8 @@ "updateContext": null }, "value": "this", - "start": 11002, - "end": 11006, + "start": 11014, + "end": 11018, "loc": { "start": { "line": 391, @@ -57928,8 +57972,8 @@ "binop": null, "updateContext": null }, - "start": 11006, - "end": 11007, + "start": 11018, + "end": 11019, "loc": { "start": { "line": 391, @@ -57954,8 +57998,8 @@ "binop": null }, "value": "_parentTransform", - "start": 11007, - "end": 11023, + "start": 11019, + "end": 11035, "loc": { "start": { "line": 391, @@ -57980,8 +58024,8 @@ "binop": null, "updateContext": null }, - "start": 11023, - "end": 11024, + "start": 11035, + "end": 11036, "loc": { "start": { "line": 391, @@ -58006,8 +58050,8 @@ "binop": null }, "value": "worldMatrix", - "start": 11024, - "end": 11035, + "start": 11036, + "end": 11047, "loc": { "start": { "line": 391, @@ -58032,8 +58076,8 @@ "binop": null, "updateContext": null }, - "start": 11035, - "end": 11036, + "start": 11047, + "end": 11048, "loc": { "start": { "line": 391, @@ -58058,8 +58102,8 @@ "binop": null }, "value": "localMatrix", - "start": 11037, - "end": 11048, + "start": 11049, + "end": 11060, "loc": { "start": { "line": 391, @@ -58084,8 +58128,8 @@ "binop": null, "updateContext": null }, - "start": 11048, - "end": 11049, + "start": 11060, + "end": 11061, "loc": { "start": { "line": 391, @@ -58112,8 +58156,8 @@ "updateContext": null }, "value": "this", - "start": 11050, - "end": 11054, + "start": 11062, + "end": 11066, "loc": { "start": { "line": 391, @@ -58138,8 +58182,8 @@ "binop": null, "updateContext": null }, - "start": 11054, - "end": 11055, + "start": 11066, + "end": 11067, "loc": { "start": { "line": 391, @@ -58164,8 +58208,8 @@ "binop": null }, "value": "_worldMatrix", - "start": 11055, - "end": 11067, + "start": 11067, + "end": 11079, "loc": { "start": { "line": 391, @@ -58189,8 +58233,8 @@ "postfix": false, "binop": null }, - "start": 11067, - "end": 11068, + "start": 11079, + "end": 11080, "loc": { "start": { "line": 391, @@ -58215,8 +58259,8 @@ "binop": null, "updateContext": null }, - "start": 11068, - "end": 11069, + "start": 11080, + "end": 11081, "loc": { "start": { "line": 391, @@ -58240,8 +58284,8 @@ "postfix": false, "binop": null }, - "start": 11078, - "end": 11079, + "start": 11090, + "end": 11091, "loc": { "start": { "line": 392, @@ -58268,8 +58312,8 @@ "updateContext": null }, "value": "this", - "start": 11088, - "end": 11092, + "start": 11100, + "end": 11104, "loc": { "start": { "line": 393, @@ -58294,8 +58338,8 @@ "binop": null, "updateContext": null }, - "start": 11092, - "end": 11093, + "start": 11104, + "end": 11105, "loc": { "start": { "line": 393, @@ -58320,8 +58364,8 @@ "binop": null }, "value": "_worldMatrixDirty", - "start": 11093, - "end": 11110, + "start": 11105, + "end": 11122, "loc": { "start": { "line": 393, @@ -58347,8 +58391,8 @@ "updateContext": null }, "value": "=", - "start": 11111, - "end": 11112, + "start": 11123, + "end": 11124, "loc": { "start": { "line": 393, @@ -58375,8 +58419,8 @@ "updateContext": null }, "value": "false", - "start": 11113, - "end": 11118, + "start": 11125, + "end": 11130, "loc": { "start": { "line": 393, @@ -58401,8 +58445,8 @@ "binop": null, "updateContext": null }, - "start": 11118, - "end": 11119, + "start": 11130, + "end": 11131, "loc": { "start": { "line": 393, @@ -58426,8 +58470,8 @@ "postfix": false, "binop": null }, - "start": 11124, - "end": 11125, + "start": 11136, + "end": 11137, "loc": { "start": { "line": 394, @@ -58452,8 +58496,8 @@ "binop": null }, "value": "_setSubtreeAABBsDirty", - "start": 11131, - "end": 11152, + "start": 11143, + "end": 11164, "loc": { "start": { "line": 396, @@ -58477,8 +58521,8 @@ "postfix": false, "binop": null }, - "start": 11152, - "end": 11153, + "start": 11164, + "end": 11165, "loc": { "start": { "line": 396, @@ -58503,8 +58547,8 @@ "binop": null }, "value": "sceneTransform", - "start": 11153, - "end": 11167, + "start": 11165, + "end": 11179, "loc": { "start": { "line": 396, @@ -58528,8 +58572,8 @@ "postfix": false, "binop": null }, - "start": 11167, - "end": 11168, + "start": 11179, + "end": 11180, "loc": { "start": { "line": 396, @@ -58553,8 +58597,8 @@ "postfix": false, "binop": null }, - "start": 11169, - "end": 11170, + "start": 11181, + "end": 11182, "loc": { "start": { "line": 396, @@ -58579,8 +58623,8 @@ "binop": null }, "value": "sceneTransform", - "start": 11179, - "end": 11193, + "start": 11191, + "end": 11205, "loc": { "start": { "line": 397, @@ -58605,8 +58649,8 @@ "binop": null, "updateContext": null }, - "start": 11193, - "end": 11194, + "start": 11205, + "end": 11206, "loc": { "start": { "line": 397, @@ -58631,8 +58675,8 @@ "binop": null }, "value": "_aabbDirty", - "start": 11194, - "end": 11204, + "start": 11206, + "end": 11216, "loc": { "start": { "line": 397, @@ -58658,8 +58702,8 @@ "updateContext": null }, "value": "=", - "start": 11205, - "end": 11206, + "start": 11217, + "end": 11218, "loc": { "start": { "line": 397, @@ -58686,8 +58730,8 @@ "updateContext": null }, "value": "true", - "start": 11207, - "end": 11211, + "start": 11219, + "end": 11223, "loc": { "start": { "line": 397, @@ -58712,8 +58756,8 @@ "binop": null, "updateContext": null }, - "start": 11211, - "end": 11212, + "start": 11223, + "end": 11224, "loc": { "start": { "line": 397, @@ -58740,8 +58784,8 @@ "updateContext": null }, "value": "if", - "start": 11221, - "end": 11223, + "start": 11233, + "end": 11235, "loc": { "start": { "line": 398, @@ -58765,8 +58809,8 @@ "postfix": false, "binop": null }, - "start": 11224, - "end": 11225, + "start": 11236, + "end": 11237, "loc": { "start": { "line": 398, @@ -58791,8 +58835,8 @@ "binop": null }, "value": "sceneTransform", - "start": 11225, - "end": 11239, + "start": 11237, + "end": 11251, "loc": { "start": { "line": 398, @@ -58817,8 +58861,8 @@ "binop": null, "updateContext": null }, - "start": 11239, - "end": 11240, + "start": 11251, + "end": 11252, "loc": { "start": { "line": 398, @@ -58843,8 +58887,8 @@ "binop": null }, "value": "_childTransforms", - "start": 11240, - "end": 11256, + "start": 11252, + "end": 11268, "loc": { "start": { "line": 398, @@ -58868,8 +58912,8 @@ "postfix": false, "binop": null }, - "start": 11256, - "end": 11257, + "start": 11268, + "end": 11269, "loc": { "start": { "line": 398, @@ -58893,8 +58937,8 @@ "postfix": false, "binop": null }, - "start": 11258, - "end": 11259, + "start": 11270, + "end": 11271, "loc": { "start": { "line": 398, @@ -58921,8 +58965,8 @@ "updateContext": null }, "value": "for", - "start": 11272, - "end": 11275, + "start": 11284, + "end": 11287, "loc": { "start": { "line": 399, @@ -58946,8 +58990,8 @@ "postfix": false, "binop": null }, - "start": 11276, - "end": 11277, + "start": 11288, + "end": 11289, "loc": { "start": { "line": 399, @@ -58974,8 +59018,8 @@ "updateContext": null }, "value": "let", - "start": 11277, - "end": 11280, + "start": 11289, + "end": 11292, "loc": { "start": { "line": 399, @@ -59000,8 +59044,8 @@ "binop": null }, "value": "i", - "start": 11281, - "end": 11282, + "start": 11293, + "end": 11294, "loc": { "start": { "line": 399, @@ -59027,8 +59071,8 @@ "updateContext": null }, "value": "=", - "start": 11283, - "end": 11284, + "start": 11295, + "end": 11296, "loc": { "start": { "line": 399, @@ -59054,8 +59098,8 @@ "updateContext": null }, "value": 0, - "start": 11285, - "end": 11286, + "start": 11297, + "end": 11298, "loc": { "start": { "line": 399, @@ -59080,8 +59124,8 @@ "binop": null, "updateContext": null }, - "start": 11286, - "end": 11287, + "start": 11298, + "end": 11299, "loc": { "start": { "line": 399, @@ -59106,8 +59150,8 @@ "binop": null }, "value": "len", - "start": 11288, - "end": 11291, + "start": 11300, + "end": 11303, "loc": { "start": { "line": 399, @@ -59133,8 +59177,8 @@ "updateContext": null }, "value": "=", - "start": 11292, - "end": 11293, + "start": 11304, + "end": 11305, "loc": { "start": { "line": 399, @@ -59159,8 +59203,8 @@ "binop": null }, "value": "sceneTransform", - "start": 11294, - "end": 11308, + "start": 11306, + "end": 11320, "loc": { "start": { "line": 399, @@ -59185,8 +59229,8 @@ "binop": null, "updateContext": null }, - "start": 11308, - "end": 11309, + "start": 11320, + "end": 11321, "loc": { "start": { "line": 399, @@ -59211,8 +59255,8 @@ "binop": null }, "value": "_childTransforms", - "start": 11309, - "end": 11325, + "start": 11321, + "end": 11337, "loc": { "start": { "line": 399, @@ -59237,8 +59281,8 @@ "binop": null, "updateContext": null }, - "start": 11325, - "end": 11326, + "start": 11337, + "end": 11338, "loc": { "start": { "line": 399, @@ -59263,8 +59307,8 @@ "binop": null }, "value": "length", - "start": 11326, - "end": 11332, + "start": 11338, + "end": 11344, "loc": { "start": { "line": 399, @@ -59289,8 +59333,8 @@ "binop": null, "updateContext": null }, - "start": 11332, - "end": 11333, + "start": 11344, + "end": 11345, "loc": { "start": { "line": 399, @@ -59315,8 +59359,8 @@ "binop": null }, "value": "i", - "start": 11334, - "end": 11335, + "start": 11346, + "end": 11347, "loc": { "start": { "line": 399, @@ -59342,8 +59386,8 @@ "updateContext": null }, "value": "<", - "start": 11336, - "end": 11337, + "start": 11348, + "end": 11349, "loc": { "start": { "line": 399, @@ -59368,8 +59412,8 @@ "binop": null }, "value": "len", - "start": 11338, - "end": 11341, + "start": 11350, + "end": 11353, "loc": { "start": { "line": 399, @@ -59394,8 +59438,8 @@ "binop": null, "updateContext": null }, - "start": 11341, - "end": 11342, + "start": 11353, + "end": 11354, "loc": { "start": { "line": 399, @@ -59420,8 +59464,8 @@ "binop": null }, "value": "i", - "start": 11343, - "end": 11344, + "start": 11355, + "end": 11356, "loc": { "start": { "line": 399, @@ -59446,8 +59490,8 @@ "binop": null }, "value": "++", - "start": 11344, - "end": 11346, + "start": 11356, + "end": 11358, "loc": { "start": { "line": 399, @@ -59471,8 +59515,8 @@ "postfix": false, "binop": null }, - "start": 11346, - "end": 11347, + "start": 11358, + "end": 11359, "loc": { "start": { "line": 399, @@ -59496,8 +59540,8 @@ "postfix": false, "binop": null }, - "start": 11348, - "end": 11349, + "start": 11360, + "end": 11361, "loc": { "start": { "line": 399, @@ -59524,8 +59568,8 @@ "updateContext": null }, "value": "this", - "start": 11366, - "end": 11370, + "start": 11378, + "end": 11382, "loc": { "start": { "line": 400, @@ -59550,8 +59594,8 @@ "binop": null, "updateContext": null }, - "start": 11370, - "end": 11371, + "start": 11382, + "end": 11383, "loc": { "start": { "line": 400, @@ -59576,8 +59620,8 @@ "binop": null }, "value": "_setSubtreeAABBsDirty", - "start": 11371, - "end": 11392, + "start": 11383, + "end": 11404, "loc": { "start": { "line": 400, @@ -59601,8 +59645,8 @@ "postfix": false, "binop": null }, - "start": 11392, - "end": 11393, + "start": 11404, + "end": 11405, "loc": { "start": { "line": 400, @@ -59627,8 +59671,8 @@ "binop": null }, "value": "sceneTransform", - "start": 11393, - "end": 11407, + "start": 11405, + "end": 11419, "loc": { "start": { "line": 400, @@ -59653,8 +59697,8 @@ "binop": null, "updateContext": null }, - "start": 11407, - "end": 11408, + "start": 11419, + "end": 11420, "loc": { "start": { "line": 400, @@ -59679,8 +59723,8 @@ "binop": null }, "value": "_childTransforms", - "start": 11408, - "end": 11424, + "start": 11420, + "end": 11436, "loc": { "start": { "line": 400, @@ -59705,8 +59749,8 @@ "binop": null, "updateContext": null }, - "start": 11424, - "end": 11425, + "start": 11436, + "end": 11437, "loc": { "start": { "line": 400, @@ -59731,8 +59775,8 @@ "binop": null }, "value": "i", - "start": 11425, - "end": 11426, + "start": 11437, + "end": 11438, "loc": { "start": { "line": 400, @@ -59757,8 +59801,8 @@ "binop": null, "updateContext": null }, - "start": 11426, - "end": 11427, + "start": 11438, + "end": 11439, "loc": { "start": { "line": 400, @@ -59782,8 +59826,8 @@ "postfix": false, "binop": null }, - "start": 11427, - "end": 11428, + "start": 11439, + "end": 11440, "loc": { "start": { "line": 400, @@ -59808,8 +59852,8 @@ "binop": null, "updateContext": null }, - "start": 11428, - "end": 11429, + "start": 11440, + "end": 11441, "loc": { "start": { "line": 400, @@ -59833,8 +59877,8 @@ "postfix": false, "binop": null }, - "start": 11442, - "end": 11443, + "start": 11454, + "end": 11455, "loc": { "start": { "line": 401, @@ -59858,8 +59902,8 @@ "postfix": false, "binop": null }, - "start": 11452, - "end": 11453, + "start": 11464, + "end": 11465, "loc": { "start": { "line": 402, @@ -59883,8 +59927,8 @@ "postfix": false, "binop": null }, - "start": 11458, - "end": 11459, + "start": 11470, + "end": 11471, "loc": { "start": { "line": 403, @@ -59908,8 +59952,8 @@ "postfix": false, "binop": null }, - "start": 11460, - "end": 11461, + "start": 11472, + "end": 11473, "loc": { "start": { "line": 404, @@ -59934,8 +59978,8 @@ "binop": null, "updateContext": null }, - "start": 11462, - "end": 11462, + "start": 11474, + "end": 11474, "loc": { "start": { "line": 405, diff --git a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html index db51bcc363..6b216370a3 100644 --- a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html +++ b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html @@ -329,6 +329,35 @@

AngleMeasurementsControl

+ + + + + public + + get + + + + + +
+ + +

Gets the AngleMeasurement under construction by this AngleMeasurementsControl, if any.

+
+
+ + + + @@ -1107,6 +1136,62 @@

Return:

+ +
+

+ public + + get + + + + currentMeasurement: null | AngleMeasurement: * + + + + source + +

+ + + + +

Gets the AngleMeasurement under construction by this AngleMeasurementsControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | AngleMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1318,7 +1403,7 @@

- source + source

diff --git a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html index c3b9ac1c5b..06a64a91b6 100644 --- a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html +++ b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html @@ -421,6 +421,35 @@

Usage

[ + + public + + get + + + + +

+
+ + +

Gets the AngleMeasurement under construction by this AngleMeasurementsMouseControl, if any.

+
+
+ + + + @@ -1253,6 +1282,35 @@

Usage

[ + + public + + get + + + + +

+
+ + +

Gets the AngleMeasurement under construction by this AngleMeasurementsControl, if any.

+
+
+ + + + @@ -1629,6 +1687,62 @@

+

+
+

+ public + + get + + + + currentMeasurement: null | AngleMeasurement: * + + + + source + +

+ + + + +

Gets the AngleMeasurement under construction by this AngleMeasurementsMouseControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | AngleMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1970,7 +2084,7 @@

- source + source

diff --git a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html index 249a31c0a3..867445f579 100644 --- a/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html +++ b/docs/class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html @@ -394,6 +394,35 @@

AngleMeasurementsTouchControl

+ + + + + public + + get + + + + + +
+ + +

Gets the AngleMeasurement under construction by this AngleMeasurementsTouchControl, if any.

+
+
+ + + + @@ -1254,6 +1283,35 @@

AngleMeasurementsTouchControl

+ + + + + public + + get + + + + + +
+ + +

Gets the AngleMeasurement under construction by this AngleMeasurementsControl, if any.

+
+
+ + + + @@ -1584,6 +1642,62 @@

+

+
+

+ public + + get + + + + currentMeasurement: null | AngleMeasurement: * + + + + source + +

+ + + + +

Gets the AngleMeasurement under construction by this AngleMeasurementsTouchControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | AngleMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1968,7 +2082,7 @@

- source + source

diff --git a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html index 8af39694f6..829206dd15 100644 --- a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html +++ b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html @@ -329,6 +329,35 @@

DistanceMeasurementsControl

+ + + + + public + + get + + + + + +
+ + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsControl, if any.

+
+
+ + + + @@ -1107,6 +1136,62 @@

Return:

+
+
+

+ public + + get + + + + currentMeasurement: null | DistanceMeasurement: * + + + + source + +

+ + + + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | DistanceMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1318,7 +1403,7 @@

- source + source

diff --git a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html index fb9eefa91b..d232fbfd75 100644 --- a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html +++ b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html @@ -392,6 +392,35 @@

Usage

[ + + public + + get + + + + +

+
+ + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsMouseControl, if any.

+
+
+ + + + @@ -1225,6 +1254,35 @@

Usage

[ + + public + + get + + + + +

+
+ + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsControl, if any.

+
+
+ + + + @@ -1558,6 +1616,62 @@

Return:

+
+
+

+ public + + get + + + + currentMeasurement: null | DistanceMeasurement: * + + + + source + +

+ + + + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsMouseControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | DistanceMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1899,7 +2013,7 @@

- source + source

diff --git a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html index 7328e94d65..61b09b3893 100644 --- a/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html +++ b/docs/class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html @@ -365,6 +365,35 @@

DistanceMeasurementsTouchControl

+ + + + + public + + get + + + + + +
+ + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsTouchControl, if any.

+
+
+ + + + @@ -1254,6 +1283,35 @@

DistanceMeasurementsTouchControl

+ + + + + public + + get + + + + + +
+ + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsControl, if any.

+
+
+ + + + @@ -1540,6 +1598,62 @@

Return:

+
+
+

+ public + + get + + + + currentMeasurement: null | DistanceMeasurement: * + + + + source + +

+ + + + +

Gets the DistanceMeasurement under construction by this DistanceMeasurementsTouchControl, if any.

+
+ + + +
+
+ +
+

Return:

+ + + + + + + +
null | DistanceMeasurement
+
+
+
+ + + + + + + + + + + + + + +

@@ -1968,7 +2082,7 @@

- source + source

diff --git a/docs/coverage.json b/docs/coverage.json index a186e81ac5..be67e64638 100644 --- a/docs/coverage.json +++ b/docs/coverage.json @@ -1,7 +1,7 @@ { - "coverage": "40.12%", - "expectCount": 7056, - "actualCount": 2831, + "coverage": "40.16%", + "expectCount": 7063, + "actualCount": 2837, "files": { "src/extras/ContextMenu/ContextMenu.js": { "expectCount": 61, @@ -183,13 +183,13 @@ ] }, "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js": { - "expectCount": 8, - "actualCount": 8, + "expectCount": 9, + "actualCount": 9, "undocumentLines": [] }, "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js": { - "expectCount": 32, - "actualCount": 11, + "expectCount": 33, + "actualCount": 12, "undocumentLines": [ 4, 5, @@ -230,8 +230,8 @@ ] }, "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js": { - "expectCount": 32, - "actualCount": 11, + "expectCount": 33, + "actualCount": 12, "undocumentLines": [ 6, 7, @@ -408,13 +408,13 @@ ] }, "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js": { - "expectCount": 8, - "actualCount": 8, + "expectCount": 9, + "actualCount": 9, "undocumentLines": [] }, "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js": { - "expectCount": 30, - "actualCount": 11, + "expectCount": 31, + "actualCount": 12, "undocumentLines": [ 4, 5, @@ -464,8 +464,8 @@ ] }, "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js": { - "expectCount": 30, - "actualCount": 11, + "expectCount": 32, + "actualCount": 12, "undocumentLines": [ 6, 7, @@ -485,7 +485,8 @@ 65, 66, 67, - 72 + 72, + 751 ] }, "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js": { diff --git a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.html b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.html index 5a81a33a91..f0ad2e5411 100644 --- a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.html +++ b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js.html @@ -330,6 +330,15 @@ reset() { } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this AngleMeasurementsMouseControl. * diff --git a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.html b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.html index 22ef4fb029..b6c7973915 100644 --- a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.html +++ b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js.html @@ -451,8 +451,8 @@ const mouseHoverCanvasPos = math.vec2(); this._currentAngleMeasurement = null; - const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent)); - const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent)); + const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent)); + const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent)); const pagePos = math.vec2(); @@ -698,6 +698,15 @@ this._mouseState = MOUSE_FINDING_ORIGIN; } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsMouseControl. */ diff --git a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.html b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.html index 6be5086466..b2099ad763 100644 --- a/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.html +++ b/docs/file/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js.html @@ -1166,6 +1166,15 @@ } } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsTouchControl. */ diff --git a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.html b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.html index 9832708cd5..5446fec06e 100644 --- a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.html +++ b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js.html @@ -330,6 +330,15 @@ reset() { } + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return null; + } + /** * Destroys this DistanceMeasurementsControl. * diff --git a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.html b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.html index 29d1b6928a..18b8041423 100644 --- a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.html +++ b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js.html @@ -457,8 +457,8 @@ this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; - const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent)); - const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent)); + const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent)); + const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent)); const pagePos = math.vec2(); @@ -655,6 +655,17 @@ this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + + this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** diff --git a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.html b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.html index 9f9e6b42c2..532fe41a0f 100644 --- a/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.html +++ b/docs/file/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js.html @@ -1006,6 +1006,16 @@ this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** diff --git a/docs/file/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.html b/docs/file/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.html index b6194409ec..979c199f3f 100644 --- a/docs/file/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.html +++ b/docs/file/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js.html @@ -317,8 +317,8 @@ canvasPos[1] = event.y; } else { const { left, top } = canvas.getBoundingClientRect(); - canvasPos[0] = event.clientX - left - window.scrollX; - canvasPos[1] = event.clientY - top - window.scrollY; + canvasPos[0] = event.clientX - left; + canvasPos[1] = event.clientY - top; } return canvasPos; } diff --git a/docs/file/src/viewer/scene/marker/Marker.js.html b/docs/file/src/viewer/scene/marker/Marker.js.html index 9520669094..e0a67ce999 100644 --- a/docs/file/src/viewer/scene/marker/Marker.js.html +++ b/docs/file/src/viewer/scene/marker/Marker.js.html @@ -323,7 +323,7 @@ * }); * * // Create the Marker, associated with our Mesh Entity - * const myMarker = new Marker({ + * const myMarker = new Marker(viewer, { * entity: entity, * worldPos: [10,0,0], * occludable: true diff --git a/docs/file/src/viewer/scene/model/SceneModelTransform.js.html b/docs/file/src/viewer/scene/model/SceneModelTransform.js.html index 390c973bfc..662cd87dd3 100644 --- a/docs/file/src/viewer/scene/model/SceneModelTransform.js.html +++ b/docs/file/src/viewer/scene/model/SceneModelTransform.js.html @@ -325,7 +325,7 @@ this._childTransforms.push(childTransform); childTransform._parentTransform = this; childTransform._transformDirty(); - childTransform._setAABBDirty(); + childTransform._setSubtreeAABBsDirty(this); } _addMesh(mesh) { diff --git a/docs/index.json b/docs/index.json index 5a354f8701..61ea8bf774 100644 --- a/docs/index.json +++ b/docs/index.json @@ -569,7 +569,7 @@ "name": "src/extras/ContextMenu/ContextMenu.js", "content": "import {Map} from \"../../viewer/scene/utils/Map.js\";\n\nconst idMap = new Map();\n\n/**\n * Internal data class that represents the state of a menu or a submenu.\n * @private\n */\nclass Menu {\n constructor(id) {\n this.id = id;\n this.parentItem = null; // Set to an Item when this Menu is a submenu\n this.groups = [];\n this.menuElement = null;\n this.shown = false;\n this.mouseOver = 0;\n }\n}\n\n/**\n * Internal data class that represents a group of Items in a Menu.\n * @private\n */\nclass Group {\n constructor() {\n this.items = [];\n }\n}\n\n/**\n * Internal data class that represents the state of a menu item.\n * @private\n */\nclass Item {\n constructor(id, getTitle, doAction, getEnabled, getShown) {\n this.id = id;\n this.getTitle = getTitle;\n this.doAction = doAction;\n this.getEnabled = getEnabled;\n this.getShown = getShown;\n this.itemElement = null;\n this.subMenu = null;\n this.enabled = true;\n }\n}\n\n/**\n * @desc A customizable HTML context menu.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_Canvas_TreeViewPlugin_Custom)\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_Canvas_TreeViewPlugin_Custom)]\n *\n * ## Overview\n *\n * * A pure JavaScript, lightweight context menu\n * * Dynamically configure menu items\n * * Dynamically enable or disable items\n * * Dynamically show or hide items\n * * Supports cascading sub-menus\n * * Configure custom style with CSS (see examples above)\n *\n * ## Usage\n *\n * In the example below we'll create a ````ContextMenu```` that pops up whenever we right-click on an {@link Entity} within\n * our {@link Scene}.\n *\n * First, we'll create the ````ContextMenu````, configuring it with a list of menu items.\n *\n * Each item has:\n *\n * * a ````title```` for the item,\n * * a ````doAction()```` callback to fire when the item's title is clicked,\n * * an optional ````getShown()```` callback that indicates if the item should shown in the menu or not, and\n * * an optional ````getEnabled()```` callback that indicates if the item should be shown enabled in the menu or not.\n *\n *
\n *\n * The ````getShown()```` and ````getEnabled()```` callbacks are invoked whenever the menu is shown.\n *\n * When an item's ````getShown()```` callback\n * returns ````true````, then the item is shown. When it returns ````false````, then the item is hidden. An item without\n * a ````getShown()```` callback is always shown.\n *\n * When an item's ````getEnabled()```` callback returns ````true````, then the item is enabled and clickable (as long as it's also shown). When it\n * returns ````false````, then the item is disabled and cannot be clicked. An item without a ````getEnabled()````\n * callback is always enabled and clickable.\n *\n * Note how the ````doAction()````, ````getShown()```` and ````getEnabled()```` callbacks accept a ````context````\n * object. That must be set on the ````ContextMenu```` before we're able to we show it. The context object can be anything. In this example,\n * we'll use the context object to provide the callbacks with the Entity that we right-clicked.\n *\n * We'll also initially enable the ````ContextMenu````.\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_Canvas_Custom)]\n *\n * ````javascript\n * const canvasContextMenu = new ContextMenu({\n *\n * enabled: true,\n *\n * items: [\n * [\n * {\n * title: \"Hide Object\",\n * getEnabled: (context) => {\n * return context.entity.visible; // Can't hide entity if already hidden\n * },\n * doAction: function (context) {\n * context.entity.visible = false;\n * }\n * }\n * ],\n * [\n * {\n * title: \"Select Object\",\n * getEnabled: (context) => {\n * return (!context.entity.selected); // Can't select an entity that's already selected\n * },\n * doAction: function (context) {\n * context.entity.selected = true;\n * }\n * }\n * ],\n * [\n * {\n * title: \"X-Ray Object\",\n * getEnabled: (context) => {\n * return (!context.entity.xrayed); // Can't X-ray an entity that's already X-rayed\n * },\n * doAction: (context) => {\n * context.entity.xrayed = true;\n * }\n * }\n * ]\n * ]\n * });\n * ````\n *\n * Next, we'll make the ````ContextMenu```` appear whenever we right-click on an Entity. Whenever we right-click\n * on the canvas, we'll attempt to pick the Entity at those mouse coordinates. If we succeed, we'll feed the\n * Entity into ````ContextMenu```` via the context object, then show the ````ContextMenu````.\n *\n * From there, each ````ContextMenu```` item's ````getEnabled()```` callback will be invoked (if provided), to determine if the item should\n * be enabled. If we click an item, its ````doAction()```` callback will be invoked with our context object.\n *\n * Remember that we must set the context on our ````ContextMenu```` before we show it, otherwise it will log an error to the console,\n * and ignore our attempt to show it.\n *\n * ````javascript*\n * viewer.scene.canvas.canvas.oncontextmenu = (e) => { // Right-clicked on the canvas\n *\n * if (!objectContextMenu.enabled) {\n * return;\n * }\n *\n * var hit = viewer.scene.pick({ // Try to pick an Entity at the coordinates\n * canvasPos: [e.pageX, e.pageY]\n * });\n *\n * if (hit) { // Picked an Entity\n *\n * objectContextMenu.context = { // Feed entity to ContextMenu\n * entity: hit.entity\n * };\n *\n * objectContextMenu.show(e.pageX, e.pageY); // Show the ContextMenu\n * }\n *\n * e.preventDefault();\n * });\n * ````\n *\n * Note how we only show the ````ContextMenu```` if it's enabled. We can use that mechanism to switch between multiple\n * ````ContextMenu```` instances depending on what we clicked.\n *\n * ## Dynamic Item Titles\n *\n * To make an item dynamically regenerate its title text whenever we show the ````ContextMenu````, provide its title with a\n * ````getTitle()```` callback. The callback will fire each time you show ````ContextMenu````, which will dynamically\n * set the item title text.\n *\n * In the example below, we'll create a simple ````ContextMenu```` that allows us to toggle the selection of an object\n * via its first item, which changes text depending on whether we are selecting or deselecting the object.\n *\n * [[Run an example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_dynamicItemTitles)]\n *\n * ````javascript\n * const canvasContextMenu = new ContextMenu({\n *\n * enabled: true,\n *\n * items: [\n * [\n * {\n * getTitle: (context) => {\n * return (!context.entity.selected) ? \"Select\" : \"Undo Select\";\n * },\n * doAction: function (context) {\n * context.entity.selected = !context.entity.selected;\n * }\n * },\n * {\n * title: \"Clear Selection\",\n * getEnabled: function (context) {\n * return (context.viewer.scene.numSelectedObjects > 0);\n * },\n * doAction: function (context) {\n * context.viewer.scene.setObjectsSelected(context.viewer.scene.selectedObjectIds, false);\n * }\n * }\n * ]\n * ]\n * });\n * ````\n *\n * ## Sub-menus\n *\n * Each menu item can optionally have a sub-menu, which will appear when we hover over the item.\n *\n * In the example below, we'll create a much simpler ````ContextMenu```` that has only one item, called \"Effects\", which\n * will open a cascading sub-menu whenever we hover over that item.\n *\n * Note that our \"Effects\" item has no ````doAction```` callback, because an item with a sub-menu performs no\n * action of its own.\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_subMenus)]\n *\n * ````javascript\n * const canvasContextMenu = new ContextMenu({\n * items: [ // Top level items\n * [\n * {\n * getTitle: (context) => {\n * return \"Effects\";\n * },\n *\n * items: [ // Sub-menu\n * [\n * {\n * getTitle: (context) => {\n * return (!context.entity.visible) ? \"Show\" : \"Hide\";\n * },\n * doAction: function (context) {\n * context.entity.visible = !context.entity.visible;\n * }\n * },\n * {\n * getTitle: (context) => {\n * return (!context.entity.selected) ? \"Select\" : \"Undo Select\";\n * },\n * doAction: function (context) {\n * context.entity.selected = !context.entity.selected;\n * }\n * },\n * {\n * getTitle: (context) => {\n * return (!context.entity.highlighted) ? \"Highlight\" : \"Undo Highlight\";\n * },\n * doAction: function (context) {\n * context.entity.highlighted = !context.entity.highlighted;\n * }\n * }\n * ]\n * ]\n * }\n * ]\n * ]\n * });\n * ````\n */\nclass ContextMenu {\n\n /**\n * Creates a ````ContextMenu````.\n *\n * The ````ContextMenu```` will be initially hidden.\n *\n * @param {Object} [cfg] ````ContextMenu```` configuration.\n * @param {Object} [cfg.items] The context menu items. These can also be dynamically set on {@link ContextMenu#items}. See the class documentation for an example.\n * @param {Object} [cfg.context] The context, which is passed into the item callbacks. This can also be dynamically set on {@link ContextMenu#context}. This must be set before calling {@link ContextMenu#show}.\n * @param {Boolean} [cfg.enabled=true] Whether this ````ContextMenu```` is initially enabled. {@link ContextMenu#show} does nothing while this is ````false````.\n * @param {Boolean} [cfg.hideOnMouseDown=true] Whether this ````ContextMenu```` automatically hides whenever we mouse-down or tap anywhere in the page.\n * @param {Boolean} [cfg.hideOnAction=true] Whether this ````ContextMenu```` automatically hides after we select a menu item. Se false if we want the menu to remain shown and show any updates to its item titles, after we've selected an item.\n */\n constructor(cfg = {}) {\n\n this._id = idMap.addItem();\n this._context = null;\n this._enabled = false; // True when the ContextMenu is enabled\n this._itemsCfg = []; // Items as given as configs\n this._rootMenu = null; // The root Menu in the tree\n this._menuList = []; // List of Menus\n this._menuMap = {}; // Menus mapped to their IDs\n this._itemList = []; // List of Items\n this._itemMap = {}; // Items mapped to their IDs\n this._shown = false; // True when the ContextMenu is visible\n this._nextId = 0;\n\n /**\n * Subscriptions to events fired at this ContextMenu.\n * @private\n */\n this._eventSubs = {};\n\n if (cfg.hideOnMouseDown !== false) {\n document.addEventListener(\"mousedown\", (event) => {\n if (!event.target.classList.contains(\"xeokit-context-menu-item\")) {\n this.hide();\n }\n });\n document.addEventListener(\"touchstart\", this._canvasTouchStartHandler = (event) => {\n if (!event.target.classList.contains(\"xeokit-context-menu-item\")) {\n this.hide();\n }\n });\n }\n\n if (cfg.items) {\n this.items = cfg.items;\n }\n\n this._hideOnAction = (cfg.hideOnAction !== false);\n\n this.context = cfg.context;\n this.enabled = cfg.enabled !== false;\n this.hide();\n }\n\n\n /**\n Subscribes to an event fired at this ````ContextMenu````.\n\n @param {String} event The event\n @param {Function} callback Callback fired on the event\n */\n on(event, callback) {\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = [];\n this._eventSubs[event] = subs;\n }\n subs.push(callback);\n }\n\n /**\n Fires an event at this ````ContextMenu````.\n\n @param {String} event The event type name\n @param {Object} value The event parameters\n */\n fire(event, value) {\n const subs = this._eventSubs[event];\n if (subs) {\n for (let i = 0, len = subs.length; i < len; i++) {\n subs[i](value);\n }\n }\n }\n\n /**\n * Sets the ````ContextMenu```` items.\n *\n * These can be updated dynamically at any time.\n *\n * See class documentation for an example.\n *\n * @type {Object[]}\n */\n set items(itemsCfg) {\n this._clear();\n this._itemsCfg = itemsCfg || [];\n this._parseItems(itemsCfg);\n this._createUI();\n }\n\n /**\n * Gets the ````ContextMenu```` items.\n *\n * @type {Object[]}\n */\n get items() {\n return this._itemsCfg;\n }\n\n /**\n * Sets whether this ````ContextMenu```` is enabled.\n *\n * Hides the menu when disabling.\n *\n * @type {Boolean}\n */\n set enabled(enabled) {\n enabled = (!!enabled);\n if (enabled === this._enabled) {\n return;\n }\n this._enabled = enabled;\n if (!this._enabled) {\n this.hide();\n }\n }\n\n /**\n * Gets whether this ````ContextMenu```` is enabled.\n *\n * {@link ContextMenu#show} does nothing while this is ````false````.\n *\n * @type {Boolean}\n */\n get enabled() {\n return this._enabled;\n }\n\n /**\n * Sets the ````ContextMenu```` context.\n *\n * The context can be any object that you need to be provides to the callbacks configured on {@link ContextMenu#items}.\n *\n * This must be set before calling {@link ContextMenu#show}.\n *\n * @type {Object}\n */\n set context(context) {\n this._context = context;\n }\n\n /**\n * Gets the ````ContextMenu```` context.\n *\n * @type {Object}\n */\n get context() {\n return this._context;\n }\n\n /**\n * Shows this ````ContextMenu```` at the given page coordinates.\n *\n * Does nothing when {@link ContextMenu#enabled} is ````false````.\n *\n * Logs error to console and does nothing if {@link ContextMenu#context} has not been set.\n *\n * Fires a \"shown\" event when shown.\n *\n * @param {Number} pageX Page X-coordinate.\n * @param {Number} pageY Page Y-coordinate.\n */\n show(pageX, pageY) {\n if (!this._context) {\n console.error(\"ContextMenu cannot be shown without a context - set context first\");\n return;\n }\n if (!this._enabled) {\n return;\n }\n if (this._shown) {\n return;\n }\n this._hideAllMenus();\n this._updateItemsTitles();\n this._updateItemsEnabledStatus();\n this._showMenu(this._rootMenu.id, pageX, pageY);\n this._shown = true;\n this.fire(\"shown\", {});\n }\n\n /**\n * Gets whether this ````ContextMenu```` is currently shown or not.\n *\n * @returns {Boolean} Whether this ````ContextMenu```` is shown.\n */\n get shown() {\n return this._shown;\n }\n\n /**\n * Hides this ````ContextMenu````.\n *\n * Fires a \"hidden\" event when hidden.\n */\n hide() {\n if (!this._enabled) {\n return;\n }\n if (!this._shown) {\n return;\n }\n this._hideAllMenus();\n this._shown = false;\n this.fire(\"hidden\", {});\n }\n\n /**\n * Destroys this ````ContextMenu````.\n */\n destroy() {\n this._context = null;\n this._clear();\n if (this._id !== null) {\n idMap.removeItem(this._id);\n this._id = null;\n }\n }\n\n _clear() { // Destroys DOM elements, clears menu data\n for (let i = 0, len = this._menuList.length; i < len; i++) {\n const menu = this._menuList[i];\n const menuElement = menu.menuElement;\n menuElement.parentElement.removeChild(menuElement);\n }\n this._itemsCfg = [];\n this._rootMenu = null;\n this._menuList = [];\n this._menuMap = {};\n this._itemList = [];\n this._itemMap = {};\n }\n\n _parseItems(itemsCfg) { // Parses \"items\" config into menu data\n\n const visitItems = (itemsCfg) => {\n\n const menuId = this._getNextId();\n const menu = new Menu(menuId);\n\n for (let i = 0, len = itemsCfg.length; i < len; i++) {\n\n const itemsGroupCfg = itemsCfg[i];\n\n const group = new Group();\n\n menu.groups.push(group);\n\n for (let j = 0, lenj = itemsGroupCfg.length; j < lenj; j++) {\n\n const itemCfg = itemsGroupCfg[j];\n const subItemsCfg = itemCfg.items;\n const hasSubItems = (subItemsCfg && (subItemsCfg.length > 0));\n const itemId = this._getNextId();\n\n const getTitle = itemCfg.getTitle || (() => {\n return (itemCfg.title || \"\");\n });\n\n const doAction = itemCfg.doAction || itemCfg.callback || (() => {\n });\n\n const getEnabled = itemCfg.getEnabled || (() => {\n return true;\n });\n\n const getShown = itemCfg.getShown || (() => {\n return true;\n });\n\n const item = new Item(itemId, getTitle, doAction, getEnabled, getShown);\n\n item.parentMenu = menu;\n\n group.items.push(item);\n\n if (hasSubItems) {\n const subMenu = visitItems(subItemsCfg);\n item.subMenu = subMenu;\n subMenu.parentItem = item;\n }\n\n this._itemList.push(item);\n this._itemMap[item.id] = item;\n }\n }\n\n this._menuList.push(menu);\n this._menuMap[menu.id] = menu;\n\n return menu;\n };\n\n this._rootMenu = visitItems(itemsCfg);\n }\n\n _getNextId() { // Returns a unique ID\n return \"ContextMenu_\" + this._id + \"_\" + this._nextId++; // Start ID with alpha chars to make a valid DOM element selector\n }\n\n _createUI() { // Builds DOM elements for the entire menu tree\n\n const visitMenu = (menu) => {\n\n this._createMenuUI(menu);\n\n const groups = menu.groups;\n for (let i = 0, len = groups.length; i < len; i++) {\n const group = groups[i];\n const groupItems = group.items;\n for (let j = 0, lenj = groupItems.length; j < lenj; j++) {\n const item = groupItems[j];\n const subMenu = item.subMenu;\n if (subMenu) {\n visitMenu(subMenu);\n }\n }\n }\n };\n\n visitMenu(this._rootMenu);\n }\n\n _createMenuUI(menu) { // Builds DOM elements for a menu\n\n const groups = menu.groups;\n const html = [];\n\n html.push('
');\n\n html.push('
    ');\n\n if (groups) {\n\n for (let i = 0, len = groups.length; i < len; i++) {\n\n const group = groups[i];\n const groupIdx = i;\n const groupLen = len;\n const groupItems = group.items;\n\n if (groupItems) {\n\n for (let j = 0, lenj = groupItems.length; j < lenj; j++) {\n\n const item = groupItems[j];\n const itemSubMenu = item.subMenu;\n const actionTitle = item.title || \"\";\n\n if (itemSubMenu) {\n\n html.push(\n '
  • ' +\n actionTitle +\n ' [MORE]' +\n '
  • ');\n\n } else {\n\n html.push(\n '
  • ' +\n actionTitle +\n '
  • ');\n }\n }\n }\n }\n }\n\n html.push('
');\n html.push('
');\n\n const htmlString = html.join(\"\");\n\n document.body.insertAdjacentHTML('beforeend', htmlString);\n\n const menuElement = document.querySelector(\".\" + menu.id);\n\n menu.menuElement = menuElement;\n\n menuElement.style[\"border-radius\"] = 4 + \"px\";\n menuElement.style.display = 'none';\n menuElement.style[\"z-index\"] = 300000;\n menuElement.style.background = \"white\";\n menuElement.style.border = \"1px solid black\";\n menuElement.style[\"box-shadow\"] = \"0 4px 5px 0 gray\";\n menuElement.oncontextmenu = (e) => {\n e.preventDefault();\n };\n\n // Bind event handlers\n\n const self = this;\n\n let lastSubMenu = null;\n\n if (groups) {\n\n for (let i = 0, len = groups.length; i < len; i++) {\n\n const group = groups[i];\n const groupItems = group.items;\n\n if (groupItems) {\n\n for (let j = 0, lenj = groupItems.length; j < lenj; j++) {\n\n const item = groupItems[j];\n const itemSubMenu = item.subMenu;\n\n item.itemElement = document.getElementById(item.id);\n\n if (!item.itemElement) {\n console.error(\"ContextMenu item element not found: \" + item.id);\n continue;\n }\n\n item.itemElement.addEventListener(\"mouseenter\", (event) => {\n event.preventDefault();\n\n const subMenu = item.subMenu;\n if (!subMenu) {\n if (lastSubMenu) {\n self._hideMenu(lastSubMenu.id);\n lastSubMenu = null;\n }\n return;\n }\n if (lastSubMenu && (lastSubMenu.id !== subMenu.id)) {\n self._hideMenu(lastSubMenu.id);\n lastSubMenu = null;\n }\n\n if (item.enabled === false) {\n return;\n }\n\n const itemElement = item.itemElement;\n const subMenuElement = subMenu.menuElement;\n\n const itemRect = itemElement.getBoundingClientRect();\n const menuRect = subMenuElement.getBoundingClientRect();\n\n const subMenuWidth = 200; // TODO\n const showOnLeft = ((itemRect.right + subMenuWidth) > window.innerWidth);\n\n if (showOnLeft) {\n self._showMenu(subMenu.id, itemRect.left - subMenuWidth, itemRect.top - 1);\n } else {\n self._showMenu(subMenu.id, itemRect.right - 5, itemRect.top - 1);\n }\n\n lastSubMenu = subMenu;\n });\n\n if (!itemSubMenu) {\n\n // Item without sub-menu\n // clicking item fires the item's action callback\n\n item.itemElement.addEventListener(\"click\", (event) => {\n event.preventDefault();\n if (!self._context) {\n return;\n }\n if (item.enabled === false) {\n return;\n }\n if (item.doAction) {\n item.doAction(self._context);\n }\n if (this._hideOnAction) {\n self.hide();\n } else {\n self._updateItemsTitles();\n self._updateItemsEnabledStatus();\n }\n });\n item.itemElement.addEventListener(\"mouseup\", (event) => {\n if (event.which !== 3) {\n return;\n }\n event.preventDefault();\n if (!self._context) {\n return;\n }\n if (item.enabled === false) {\n return;\n }\n if (item.doAction) {\n item.doAction(self._context);\n }\n if (this._hideOnAction) {\n self.hide();\n } else {\n self._updateItemsTitles();\n self._updateItemsEnabledStatus();\n }\n });\n item.itemElement.addEventListener(\"mouseenter\", (event) => {\n event.preventDefault();\n if (item.enabled === false) {\n return;\n }\n if (item.doHover) {\n item.doHover(self._context);\n }\n });\n\n }\n }\n }\n }\n }\n }\n\n _updateItemsTitles() { // Dynamically updates the title of each Item to the result of Item#getTitle()\n if (!this._context) {\n return;\n }\n for (let i = 0, len = this._itemList.length; i < len; i++) {\n const item = this._itemList[i];\n const itemElement = item.itemElement;\n if (!itemElement) {\n continue;\n }\n const getShown = item.getShown;\n if (!getShown || !getShown(this._context)) {\n continue;\n }\n const title = item.getTitle(this._context);\n if (item.subMenu) {\n itemElement.innerText = title;\n } else {\n itemElement.innerText = title;\n }\n }\n }\n\n _updateItemsEnabledStatus() { // Enables or disables each Item, depending on the result of Item#getEnabled()\n if (!this._context) {\n return;\n }\n for (let i = 0, len = this._itemList.length; i < len; i++) {\n const item = this._itemList[i];\n const itemElement = item.itemElement;\n if (!itemElement) {\n continue;\n }\n const getEnabled = item.getEnabled;\n if (!getEnabled) {\n continue;\n }\n const getShown = item.getShown;\n if (!getShown) {\n continue;\n }\n const shown = getShown(this._context);\n item.shown = shown;\n if (!shown) {\n itemElement.style.visibility = \"hidden\";\n itemElement.style.height = \"0\";\n itemElement.style.padding = \"0\";\n continue;\n } else {\n itemElement.style.visibility = \"visible\";\n itemElement.style.height = \"auto\";\n itemElement.style.padding = null;\n }\n const enabled = getEnabled(this._context);\n item.enabled = enabled;\n if (!enabled) {\n itemElement.classList.add(\"disabled\");\n } else {\n itemElement.classList.remove(\"disabled\");\n }\n }\n }\n\n _showMenu(menuId, pageX, pageY) { // Shows the given menu, at the specified page coordinates\n const menu = this._menuMap[menuId];\n if (!menu) {\n console.error(\"Menu not found: \" + menuId);\n return;\n }\n if (menu.shown) {\n return;\n }\n const menuElement = menu.menuElement;\n if (menuElement) {\n this._showMenuElement(menuElement, pageX, pageY);\n menu.shown = true;\n }\n }\n\n _hideMenu(menuId) { // Hides the given menu\n const menu = this._menuMap[menuId];\n if (!menu) {\n console.error(\"Menu not found: \" + menuId);\n return;\n }\n if (!menu.shown) {\n return;\n }\n const menuElement = menu.menuElement;\n if (menuElement) {\n this._hideMenuElement(menuElement);\n menu.shown = false;\n }\n }\n\n _hideAllMenus() {\n for (let i = 0, len = this._menuList.length; i < len; i++) {\n const menu = this._menuList[i];\n this._hideMenu(menu.id);\n }\n }\n\n _showMenuElement(menuElement, pageX, pageY) { // Shows the given menu element, at the specified page coordinates\n menuElement.style.display = 'block';\n const menuHeight = menuElement.offsetHeight;\n const menuWidth = menuElement.offsetWidth;\n if ((pageY + menuHeight) > window.innerHeight) {\n pageY = window.innerHeight - menuHeight;\n }\n if ((pageX + menuWidth) > window.innerWidth) {\n pageX = window.innerWidth - menuWidth;\n }\n menuElement.style.left = pageX + 'px';\n menuElement.style.top = pageY + 'px';\n }\n\n _hideMenuElement(menuElement) {\n menuElement.style.display = 'none';\n }\n}\n\nexport {ContextMenu};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/ContextMenu/ContextMenu.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/ContextMenu/ContextMenu.js", "access": "public", "description": null, "lineNumber": 1 @@ -1845,7 +1845,7 @@ "name": "src/extras/ContextMenu/index.js", "content": "export * from \"./ContextMenu.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/ContextMenu/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/ContextMenu/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -1856,7 +1856,7 @@ "name": "src/extras/MarqueePicker/MarqueePicker.js", "content": "import {Component} from \"../../viewer/scene/Component.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {Frustum, frustumIntersectsAABB3, setFrustum} from \"../../viewer/scene/math/Frustum.js\";\n\n/**\n * Picks a {@link Viewer}'s {@link Entity}s with a canvas-space 2D marquee box.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/picking/#marqueePick_select)\n *\n * * [[Example 1: Select Objects with Marquee](https://xeokit.github.io/xeokit-sdk/examples/picking/#marqueePick_select)]\n * * [[Example 2: View-Fit Objects with Marquee](https://xeokit.github.io/xeokit-sdk/examples/picking/#marqueePick_viewFit)]\n *\n * # Usage\n *\n * In the example below, we\n *\n * 1. Create a {@link Viewer}, arrange the {@link Camera}\n * 2. Use an {@link XKTLoaderPlugin} to load a BIM model,\n * 3. Create a {@link ObjectsKdTree3} to automatically index the `Viewer's` {@link Entity}s for fast spatial lookup,\n * 4. Create a `MarqueePicker` to pick {@link Entity}s in the {@link Viewer}, using the {@link ObjectsKdTree3} to accelerate picking\n * 5. Create a {@link MarqueePickerMouseControl} to perform the marquee-picking with the `MarqueePicker`, using mouse input to draw the marquee box on the `Viewer's` canvas.\n *\n * When the {@link MarqueePickerMouseControl} is active:\n *\n * * Long-click, drag and release on the canvas to define a marque box that picks {@link Entity}s.\n * * Drag left-to-right to pick {@link Entity}s that intersect the box.\n * * Drag right-to-left to pick {@link Entity}s that are fully inside the box.\n * * On release, the `MarqueePicker` will fire a \"picked\" event with IDs of the picked {@link Entity}s, if any.\n * * Handling that event, we mark the {@link Entity}s as selected.\n * * Hold down CTRL to multi-pick.\n *\n * ````javascript\n * import {\n * Viewer,\n * XKTLoaderPlugin,\n * ObjectsKdTree3,\n * MarqueePicker,\n * MarqueePickerMouseControl\n * } from \"xeokit-sdk.es.js\";\n *\n * // 1\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [14.9, 14.3, 5.4];\n * viewer.scene.camera.look = [6.5, 8.3, -4.1];\n * viewer.scene.camera.up = [-0.28, 0.9, -0.3];\n *\n * // 2\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"../../assets/models/xkt/v8/ifc/HolterTower.ifc.xkt\"\n * });\n *\n * // 3\n *\n * const objectsKdTree3 = new ObjectsKdTree3({viewer});\n *\n * // 4\n *\n * const marqueePicker = new MarqueePicker({viewer, objectsKdTree3});\n *\n * // 5\n *\n * const marqueePickerMouseControl = new MarqueePickerMouseControl({marqueePicker});\n *\n * marqueePicker.on(\"clear\", () => {\n * viewer.scene.setObjectsSelected(viewer.scene.selectedObjectIds, false);\n * });\n *\n * marqueePicker.on(\"picked\", (objectIds) => {\n * viewer.scene.setObjectsSelected(objectIds, true);\n * });\n *\n * marqueePickerMouseControl.setActive(true);\n * ````\n *\n * # Design Notes\n *\n * * The {@link ObjectsKdTree3} can be shared with any other components that want to use it to spatially search for {@link Entity}s.\n * * The {@link MarqueePickerMouseControl} can be replaced with other types of controllers (i.e. touch), or used alongside them.\n * * The `MarqueePicker` has no input handlers of its own, and provides an API through which to programmatically control marquee picking. By firing the \"picked\" events, `MarqueePicker` implements the *Blackboard Pattern*.\n */\nexport class MarqueePicker extends Component {\n\n /**\n * Creates a MarqueePicker.\n *\n * @param {*} cfg Configuration\n * @param {Viewer} cfg.viewer The Viewer to pick Entities from.\n * @param {ObjectsKdTree3} cfg.objectsKdTree3 A k-d tree that indexes the Entities in the Viewer for fast spatial lookup.\n */\n constructor(cfg = {}) {\n\n if (!cfg.viewer) {\n throw \"[MarqueePicker] Missing config: viewer\";\n }\n\n if (!cfg.objectsKdTree3) {\n throw \"[MarqueePicker] Missing config: objectsKdTree3\";\n }\n\n super(cfg.viewer.scene, cfg);\n\n this.viewer = cfg.viewer;\n this._objectsKdTree3 = cfg.objectsKdTree3;\n this._canvasMarqueeCorner1 = math.vec2();\n this._canvasMarqueeCorner2 = math.vec2();\n this._canvasMarquee = math.AABB2();\n this._marqueeFrustum = new Frustum();\n this._marqueeFrustumProjMat = math.mat4();\n this._pickMode = false;\n\n this._marqueeElement = document.createElement('div');\n document.body.appendChild(this._marqueeElement);\n\n this._marqueeElement.style.position = \"absolute\";\n this._marqueeElement.style[\"z-index\"] = \"40000005\";\n this._marqueeElement.style.width = 8 + \"px\";\n this._marqueeElement.style.height = 8 + \"px\";\n this._marqueeElement.style.visibility = \"hidden\";\n this._marqueeElement.style.top = 0 + \"px\";\n this._marqueeElement.style.left = 0 + \"px\";\n this._marqueeElement.style[\"box-shadow\"] = \"0 2px 5px 0 #182A3D;\";\n this._marqueeElement.style[\"opacity\"] = 1.0;\n this._marqueeElement.style[\"pointer-events\"] = \"none\";\n }\n\n /**\n * Sets the canvas-space position of the first marquee box corner.\n *\n * @param corner1\n */\n setMarqueeCorner1(corner1) {\n this._canvasMarqueeCorner1.set(corner1);\n this._canvasMarqueeCorner2.set(corner1);\n this._updateMarquee();\n }\n\n /**\n * Sets the canvas-space position of the second marquee box corner.\n *\n * @param corner2\n */\n setMarqueeCorner2(corner2) {\n this._canvasMarqueeCorner2.set(corner2);\n this._updateMarquee();\n }\n\n /**\n * Sets both canvas-space corner positions of the marquee box.\n *\n * @param corner1\n * @param corner2\n */\n setMarquee(corner1, corner2) {\n this._canvasMarqueeCorner1.set(corner1);\n this._canvasMarqueeCorner2.set(corner2);\n this._updateMarquee();\n }\n\n /**\n * Sets if the marquee box is visible.\n *\n * @param {boolean} visible True if the marquee box is to be visible, else false.\n */\n setMarqueeVisible(visible) {\n this._marqueVisible = visible;\n this._marqueeElement.style.visibility = visible ? \"visible\" : \"hidden\";\n }\n\n /**\n * Gets if the marquee box is visible.\n *\n * @returns {boolean} True if the marquee box is visible, else false.\n */\n getMarqueeVisible() {\n return this._marqueVisible;\n }\n\n /**\n * Sets the pick mode.\n *\n * Supported pick modes are:\n *\n * * MarqueePicker.PICK_MODE_INSIDE - picks {@link Entity}s that are completely inside the marquee box.\n * * MarqueePicker.PICK_MODE_INTERSECTS - picks {@link Entity}s that intersect the marquee box.\n *\n * @param {number} pickMode The pick mode.\n */\n setPickMode(pickMode) {\n if (pickMode !== MarqueePicker.PICK_MODE_INSIDE && pickMode !== MarqueePicker.PICK_MODE_INTERSECTS) {\n throw \"Illegal MarqueePicker pickMode: must be MarqueePicker.PICK_MODE_INSIDE or MarqueePicker.PICK_MODE_INTERSECTS\";\n }\n if (pickMode !== this._pickMode) {\n this._marqueeElement.style[\"background-image\"] =\n pickMode === MarqueePicker.PICK_MODE_INSIDE\n /* Solid */ ? \"url(\\\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4'/%3e%3c/svg%3e\\\")\"\n /* Dashed */ : \"url(\\\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' ry='6' stroke='%23333' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\\\")\";\n this._pickMode = pickMode;\n }\n }\n\n /**\n * Gets the pick mode.\n *\n * Supported pick modes are:\n *\n * * MarqueePicker.PICK_MODE_INSIDE - picks {@link Entity}s that are completely inside the marquee box.\n * * MarqueePicker.PICK_MODE_INTERSECTS - picks {@link Entity}s that intersect the marquee box.\n *\n * @returns {number} The pick mode.\n */\n getPickMode() {\n return this._pickMode;\n }\n\n /**\n * Fires a \"clear\" event on this MarqueePicker.\n */\n clear() {\n this.fire(\"clear\", {})\n }\n\n /**\n * Attempts to pick {@link Entity}s, using the current MarquePicker settings.\n *\n * Fires a \"picked\" event with the IDs of the {@link Entity}s that were picked, if any.\n *\n * @returns {string[]} IDs of the {@link Entity}s that were picked, if any\n */\n pick() {\n this._updateMarquee();\n this._buildMarqueeFrustum();\n const entityIds = [];\n const visitNode = (node, intersects = Frustum.INTERSECT) => {\n if (intersects === Frustum.INTERSECT) {\n intersects = frustumIntersectsAABB3(this._marqueeFrustum, node.aabb);\n }\n if (intersects === Frustum.OUTSIDE) {\n return;\n }\n if (node.entities) {\n const entities = node.entities;\n for (let i = 0, len = entities.length; i < len; i++) {\n const entity = entities[i];\n if (!entity.visible) {\n continue;\n }\n const entityAABB = entity.aabb;\n if (this._pickMode === MarqueePicker.PICK_MODE_INSIDE) {\n // Select entities that are completely inside marquee\n const intersection = frustumIntersectsAABB3(this._marqueeFrustum, entityAABB);\n if (intersection === Frustum.INSIDE) {\n entityIds.push(entity.id);\n }\n } else {\n // Select entities that are partially inside marquee\n const intersection = frustumIntersectsAABB3(this._marqueeFrustum, entityAABB);\n if (intersection !== Frustum.OUTSIDE) {\n entityIds.push(entity.id);\n }\n }\n }\n }\n if (node.left) {\n visitNode(node.left, intersects);\n }\n if (node.right) {\n visitNode(node.right, intersects);\n }\n }\n if (this._canvasMarquee[2] - this._canvasMarquee[0] > 3 || this._canvasMarquee[3] - this._canvasMarquee[1] > 3) { // Marquee pick if rectangle big enough\n visitNode(this._objectsKdTree3.root);\n }\n this.fire(\"picked\", entityIds);\n return entityIds;\n }\n\n _updateMarquee() {\n this._canvasMarquee[0] = Math.min(this._canvasMarqueeCorner1[0], this._canvasMarqueeCorner2[0]);\n this._canvasMarquee[1] = Math.min(this._canvasMarqueeCorner1[1], this._canvasMarqueeCorner2[1]);\n this._canvasMarquee[2] = Math.max(this._canvasMarqueeCorner1[0], this._canvasMarqueeCorner2[0]);\n this._canvasMarquee[3] = Math.max(this._canvasMarqueeCorner1[1], this._canvasMarqueeCorner2[1]);\n this._marqueeElement.style.width = `${this._canvasMarquee[2] - this._canvasMarquee[0]}px`;\n this._marqueeElement.style.height = `${this._canvasMarquee[3] - this._canvasMarquee[1]}px`;\n this._marqueeElement.style.left = `${this._canvasMarquee[0]}px`;\n this._marqueeElement.style.top = `${this._canvasMarquee[1]}px`;\n }\n\n _buildMarqueeFrustum() { // https://github.com/xeokit/xeokit-sdk/issues/869#issuecomment-1165375770\n const canvas = this.viewer.scene.canvas.canvas;\n const canvasWidth = canvas.clientWidth;\n const canvasHeight = canvas.clientHeight;\n const canvasLeft = canvas.clientLeft;\n const canvasTop = canvas.clientTop;\n const xCanvasToClip = 2.0 / canvasWidth;\n const yCanvasToClip = 2.0 / canvasHeight;\n const NEAR_SCALING = 17;\n const ratio = canvas.clientHeight / canvas.clientWidth;\n const FAR_PLANE = 10000;\n const left = (this._canvasMarquee[0] - canvasLeft) * xCanvasToClip + -1;\n const right = (this._canvasMarquee[2] - canvasLeft) * xCanvasToClip + -1;\n const bottom = -(this._canvasMarquee[3] - canvasTop) * yCanvasToClip + 1;\n const top = -(this._canvasMarquee[1] - canvasTop) * yCanvasToClip + 1;\n const near = this.viewer.scene.camera.frustum.near * (NEAR_SCALING * ratio);\n const far = FAR_PLANE;\n math.frustumMat4(\n left,\n right,\n bottom * ratio,\n top * ratio,\n near,\n far,\n this._marqueeFrustumProjMat,\n );\n setFrustum(this._marqueeFrustum, this.viewer.scene.camera.viewMatrix, this._marqueeFrustumProjMat);\n }\n\n /**\n * Destroys this MarqueePicker.\n *\n * Does not destroy the {@link Viewer} or the {@link ObjectsKdTree3} provided to the constructor of this MarqueePicker.\n */\n destroy() {\n super.destroy();\n if (this._marqueeElement.parentElement) {\n this._marqueeElement.parentElement.removeChild(this._marqueeElement);\n this._marqueeElement = null;\n this._objectsKdTree3 = null;\n }\n }\n}\n\n/**\n * Pick mode that picks {@link Entity}s that intersect the marquee box.\n *\n * @type {number}\n */\nMarqueePicker.PICK_MODE_INTERSECTS = 0;\n\n/**\n * Pick mode that picks {@link Entity}s that are completely inside the marquee box.\n *\n * @type {number}\n */\nMarqueePicker.PICK_MODE_INSIDE = 1;\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/MarqueePicker/MarqueePicker.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/MarqueePicker/MarqueePicker.js", "access": "public", "description": null, "lineNumber": 1 @@ -2397,7 +2397,7 @@ "name": "src/extras/MarqueePicker/MarqueePickerMouseControl.js", "content": "import {Component} from \"../../viewer/scene/Component.js\";\nimport {MarqueePicker} from \"./MarqueePicker.js\";\n\n/**\n * Controls a {@link MarqueePicker} with mouse input.\n *\n * See {@link MarqueePicker} for usage example.\n *\n * When the MarqueePickerMouseControl is active:\n *\n * * Long-click, drag and release on the canvas to define a marque box that picks {@link Entity}s.\n * * Drag left-to-right to pick Entities that intersect the box.\n * * Drag right-to-left to pick Entities that are fully inside the box.\n * * On release, the MarqueePicker will fire a \"picked\" event with IDs of the picked Entities , if any.\n */\nexport class MarqueePickerMouseControl extends Component {\n\n /**\n * Creates a new MarqueePickerMouseControl.\n *\n * @param {*} cfg Configuration\n * @param {MarqueePicker} cfg.marqueePicker The MarqueePicker to control.\n */\n constructor(cfg) {\n\n super(cfg.marqueePicker, cfg);\n\n const marqueePicker = cfg.marqueePicker;\n const scene = marqueePicker.viewer.scene;\n const canvas = scene.canvas.canvas;\n\n let pageStartX;\n let pageStartY;\n let pageEndX;\n let pageEndY;\n\n let canvasStartX;\n let canvasStartY;\n let canvasEndX;\n let canvasEndY;\n\n let isMouseDragging = false;\n let isMouseDown = false;\n let mouseWasUpOffCanvas = false;\n let mouseDownTimer;\n\n canvas.addEventListener(\"mousedown\", (e) => {\n if (!this.getActive()) {\n return;\n }\n if (e.button !== 0) { // Left button only\n return;\n }\n mouseDownTimer = setTimeout(function () {\n const input = marqueePicker.viewer.scene.input;\n if (!input.keyDown[input.KEY_CTRL]) { // Clear selection unless CTRL down\n marqueePicker.clear();\n }\n pageStartX = e.pageX;\n pageStartY = e.pageY;\n canvasStartX = e.offsetX;\n canvasStartY = e.offsetY;\n marqueePicker.setMarqueeCorner1([pageStartX, pageStartY]);\n isMouseDragging = true;\n marqueePicker.viewer.cameraControl.pointerEnabled = false; // Disable camera rotation\n marqueePicker.setMarqueeVisible(true);\n canvas.style.cursor = \"crosshair\";\n }, 400);\n\n isMouseDown = true;\n });\n\n canvas.addEventListener(\"mouseup\", (e) => {\n if (!this.getActive()) {\n return;\n }\n if (!isMouseDragging && !mouseWasUpOffCanvas) {\n return\n }\n if (e.button !== 0) {\n return;\n }\n clearTimeout(mouseDownTimer);\n pageEndX = e.pageX;\n pageEndY = e.pageY;\n const width = Math.abs(pageEndX - pageStartX);\n const height = Math.abs(pageEndY - pageStartY);\n isMouseDragging = false;\n marqueePicker.viewer.cameraControl.pointerEnabled = true; // Enable camera rotation\n if (mouseWasUpOffCanvas) {\n mouseWasUpOffCanvas = false;\n }\n if (width > 3 || height > 3) { // Marquee pick if rectangle big enough\n marqueePicker.pick();\n }\n }); // Bubbling\n\n document.addEventListener(\"mouseup\", (e) => {\n if (!this.getActive()) {\n return;\n }\n if (e.button !== 0) { // check if left button was clicked\n return;\n }\n clearTimeout(mouseDownTimer);\n if (!isMouseDragging) {\n return\n }\n marqueePicker.setMarqueeVisible(false);\n isMouseDragging = false;\n isMouseDown = false;\n mouseWasUpOffCanvas = true;\n marqueePicker.viewer.cameraControl.pointerEnabled = true;\n }, true); // Capturing\n\n canvas.addEventListener(\"mousemove\", (e) => {\n if (!this.getActive()) {\n return;\n }\n if (e.button !== 0) { // check if left button was clicked\n return;\n }\n\n if (!isMouseDown) {\n return;\n }\n\n clearTimeout(mouseDownTimer);\n\n if (!isMouseDragging) {\n return\n }\n\n pageEndX = e.pageX;\n pageEndY = e.pageY;\n canvasEndX = e.offsetX;\n canvasEndY = e.offsetY;\n\n marqueePicker.setMarqueeVisible(true);\n marqueePicker.setMarqueeCorner2([pageEndX, pageEndY]);\n marqueePicker.setPickMode((canvasStartX < canvasEndX) ? MarqueePicker.PICK_MODE_INSIDE : MarqueePicker.PICK_MODE_INTERSECTS);\n\n });\n }\n\n /**\n * Activates or deactivates this MarqueePickerMouseControl.\n *\n * @param {boolean} active Whether or not to activate.\n */\n setActive(active) {\n if (this._active === active) {\n return;\n }\n this._active = active;\n this.fire(\"active\", this._active);\n }\n\n /**\n * Gets if this MarqueePickerMouseControl is active.\n *\n * @returns {boolean}\n */\n getActive() {\n return this._active;\n }\n\n /**\n *\n */\n destroy() {\n\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/MarqueePicker/MarqueePickerMouseControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/MarqueePicker/MarqueePickerMouseControl.js", "access": "public", "description": null, "lineNumber": 1 @@ -2548,7 +2548,7 @@ "name": "src/extras/MarqueePicker/index.js", "content": "export * from \"./MarqueePicker.js\";\nexport * from \"./MarqueePickerMouseControl.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/MarqueePicker/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/MarqueePicker/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -2559,7 +2559,7 @@ "name": "src/extras/PointerCircle/PointerCircle.js", "content": "const SHRINK_SPEED = 3;\n\n/**\n * A PointerCircle shows a circle, centered at the position of the\n * mouse or touch pointer.\n */\nexport class PointerCircle {\n\n /**\n * Constructs a new PointerCircle.\n * @param viewer The Viewer\n * @param [cfg] PointerCircle configuration.\n * @param [cfg.active=true] Whether PointerCircle is active. The PointerCircle can only be shown when this is `true` (default).\n */\n constructor(viewer, cfg = {}) {\n\n this.viewer = viewer;\n this.scene = this.viewer.scene;\n this._circleDiv = document.createElement('div');\n this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._circleDiv, this.viewer.scene.canvas.canvas);\n this._circleDiv.style.backgroundColor = \"transparent\";\n this._circleDiv.style.border = \"2px solid green\";\n this._circleDiv.style.borderRadius = \"50px\";\n this._circleDiv.style.width = \"50px\";\n this._circleDiv.style.height = \"50px\";\n this._circleDiv.style.margin = \"-200px -200px\";\n this._circleDiv.style.zIndex = \"100000\";\n this._circleDiv.style.position = \"absolute\";\n this._circleDiv.style.pointerEvents = \"none\";\n\n this._circlePos = null;\n\n this._circleMaxRadius = 200;\n this._circleMinRadius = 2;\n\n this._active = (cfg.active !== false);\n this._visible = false;\n\n this._running = false;\n this._destroyed = false;\n }\n\n /**\n * Show the circle at the given canvas coordinates and begin shrinking it.\n */\n start(circlePos) {\n if (this._destroyed) {\n return;\n }\n this._circlePos = circlePos;\n this._running = false;\n this._circleRadius = this._circleMaxRadius;\n this._circleDiv.style.borderRadius = `${this._circleRadius}px`;\n this._circleDiv.style.marginLeft = `${this._circlePos[0] - this._circleRadius}px`;\n this._circleDiv.style.marginTop = `${this._circlePos[1] - this._circleRadius}px`;\n\n const startValue = this._circleMaxRadius;\n const endValue = 2;\n let startTime;\n const duration = 300;\n\n const animateCircle = (currentTime) => {\n if (!this._running) {\n return;\n }\n if (!startTime) {\n startTime = currentTime;\n }\n\n const elapsedTime = currentTime - startTime;\n const progress = Math.min(elapsedTime / duration, 1);\n const interpolatedValue = startValue + (endValue - startValue) * progress;\n\n this._circleRadius = interpolatedValue;\n this._circleDiv.style.width = `${this._circleRadius}px`;\n this._circleDiv.style.height = `${this._circleRadius}px`;\n this._circleDiv.style.marginLeft = `${this._circlePos[0] - this._circleRadius / 2}px`;\n this._circleDiv.style.marginTop = `${this._circlePos[1] - this._circleRadius / 2}px`;\n\n if (progress < 1) {\n requestAnimationFrame(animateCircle);\n }\n }\n this._running = true;\n requestAnimationFrame(animateCircle);\n this._circleDiv.style.visibility = \"visible\";\n }\n\n /**\n * Stop the shricking circle and hide it.\n */\n stop() {\n if (this._destroyed) {\n return;\n }\n this._running = false;\n this._circleRadius = this._circleMaxRadius;\n this._circleDiv.style.borderRadius = `${this._circleRadius}px`;\n this._circleDiv.style.visibility = \"hidden\";\n }\n\n /**\n * Sets the zoom factor for the lens.\n *\n * This is `2` by default.\n *\n * @param durationMs\n */\n set durationMs(durationMs) {\n this.stop();\n this._durationMs = durationMs;\n }\n\n /**\n * Gets the zoom factor for the lens.\n *\n * This is `2` by default.\n *\n * @returns Number\n */\n get durationMs() {\n return this._durationMs;\n }\n\n /**\n * Destroys this PointerCircle.\n */\n destroy() {\n if (!this._destroyed) {\n this.stop();\n document.body.removeChild(this._circleDiv);\n this._destroyed = true;\n }\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/PointerCircle/PointerCircle.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/PointerCircle/PointerCircle.js", "access": "public", "description": null, "lineNumber": 1 @@ -2976,7 +2976,7 @@ "name": "src/extras/PointerCircle/index.js", "content": "export * from \"./PointerCircle.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/PointerCircle/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/PointerCircle/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -2987,7 +2987,7 @@ "name": "src/extras/PointerLens/PointerLens.js", "content": "/**\n * A PointerLens shows a magnified view of a {@link Viewer}'s canvas, centered at the position of the\n * mouse or touch pointer.\n *\n * This component is used by {@link DistanceMeasurementsControl} and {@link AngleMeasurementsControl}\n * to help position the pointer when snap-to-vertex or snap-toedge is enabled.\n *\n * [[Run an example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_createWithMouse_snapping)]\n *\n * ````JavaScript\n *\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsMouseControl, PointerLens} from \"../../dist/xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * dtxEnabled: true\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt\",\n * edges: true\n * });\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const angleMeasurementsMouseControl = new AngleMeasurementsMouseControl(angleMeasurements, {\n * pointerLens : new PointerLens(viewer, {\n * zoomFactor: 2\n * })\n * })\n *\n * angleMeasurementsMouseControl.activate();\n * ````\n */\nexport class PointerLens {\n\n /**\n * Constructs a new PointerLens.\n * @param viewer The Viewer\n * @param [cfg] PointerLens configuration.\n * @param [cfg.active=true] Whether PointerLens is active. The PointerLens can only be shown when this is `true` (default).\n */\n constructor(viewer, cfg={}) {\n\n this.viewer = viewer;\n this.scene = this.viewer.scene;\n\n this._lensCursorDiv = document.createElement('div');\n this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv, this.viewer.scene.canvas.canvas);\n this._lensCursorDiv.style.background = \"pink\";\n this._lensCursorDiv.style.border = \"2px solid red\";\n this._lensCursorDiv.style.borderRadius = \"20px\";\n this._lensCursorDiv.style.width = \"10px\";\n this._lensCursorDiv.style.height = \"10px\";\n this._lensCursorDiv.style.margin = \"-200px -200px\";\n this._lensCursorDiv.style.zIndex = \"100000\";\n this._lensCursorDiv.style.position = \"absolute\";\n this._lensCursorDiv.style.pointerEvents = \"none\";\n\n this._lensContainer = document.createElement('div');\n this._lensContainer.style.border = \"1px solid black\";\n this._lensContainer.style.background = \"white\";\n // this._lensContainer.style.opacity = \"0\";\n this._lensContainer.style.borderRadius = \"50%\";\n this._lensContainer.style.width = \"300px\";\n this._lensContainer.style.height = \"300px\";\n this._lensContainer.style.marginTop = \"85px\";\n this._lensContainer.style.marginLeft = \"25px\";\n this._lensContainer.style.zIndex = \"15000\";\n this._lensContainer.style.position = \"absolute\";\n this._lensContainer.style.pointerEvents = \"none\";\n this._lensContainer.style.visibility = \"hidden\";\n\n this._lensCanvas = document.createElement('canvas');\n // this._lensCanvas.style.background = \"darkblue\";\n this._lensCanvas.style.borderRadius = \"50%\";\n\n this._lensCanvas.style.width = \"300px\";\n this._lensCanvas.style.height = \"300px\";\n this._lensCanvas.style.zIndex = \"15000\";\n this._lensCanvas.style.pointerEvents = \"none\";\n\n document.body.appendChild(this._lensContainer);\n this._lensContainer.appendChild(this._lensCanvas);\n\n this._lensCanvasContext = this._lensCanvas.getContext('2d');\n this._canvasElement = this.viewer.scene.canvas.canvas;\n\n this._canvasPos = null;\n this._snappedCanvasPos = null;\n this._lensPosToggle = true;\n\n this._zoomLevel = cfg.zoomLevel || 2;\n\n this._active = (cfg.active !== false);\n this._visible = false;\n this._snapped = false;\n\n this._onViewerRendering = this.viewer.scene.on(\"rendering\", () => {\n if (this._active && this._visible) {\n this.update();\n }\n });\n }\n\n /**\n * Updates this PointerLens.\n */\n update() {\n if (!this._active || !this._visible) {\n return;\n }\n if (!this._canvasPos) {\n return;\n }\n const lensRect = this._lensContainer.getBoundingClientRect();\n const canvasRect = this._canvasElement.getBoundingClientRect();\n const pointerOnLens =\n this._canvasPos[0] < lensRect.right && this._canvasPos[0] > lensRect.left &&\n this._canvasPos[1] < lensRect.bottom && this._canvasPos[1] > lensRect.top;\n this._lensContainer.style.marginLeft = `25px`;\n if (pointerOnLens) {\n if (this._lensPosToggle) {\n this._lensContainer.style.marginTop = `${canvasRect.bottom - canvasRect.top - this._lensCanvas.height - 85}px`;\n } else {\n this._lensContainer.style.marginTop = `85px`;\n }\n this._lensPosToggle = !this._lensPosToggle;\n }\n this._lensCanvasContext.clearRect(0, 0, this._lensCanvas.width, this._lensCanvas.height);\n const size = Math.max(this._lensCanvas.width, this._lensCanvas.height) / this._zoomLevel;\n this._lensCanvasContext.drawImage(\n this._canvasElement, // source canvas\n this._canvasPos[0] - size / 2, // source x (zoom center)\n this._canvasPos[1] - size / 2, // source y (zoom center)\n size, // source width\n size, // source height\n 0, // destination x\n 0, // destination y\n this._lensCanvas.width, // destination width\n this._lensCanvas.height // destination height\n );\n\n const centerLensCanvas = [\n (lensRect.left + lensRect.right) / 2,\n (lensRect.top + lensRect.bottom) / 2\n ];\n\n if (this._snappedCanvasPos) {\n const deltaX = this._snappedCanvasPos[0] - this._canvasPos[0];\n const deltaY = this._snappedCanvasPos[1] - this._canvasPos[1];\n\n this._lensCursorDiv.style.marginLeft = `${centerLensCanvas[0] + deltaX * this._zoomLevel - 10}px`;\n this._lensCursorDiv.style.marginTop = `${centerLensCanvas[1] + deltaY * this._zoomLevel - 10}px`;\n } else {\n this._lensCursorDiv.style.marginLeft = `${centerLensCanvas[0] - 10}px`;\n this._lensCursorDiv.style.marginTop = `${centerLensCanvas[1] - 10}px`;\n }\n }\n\n\n /**\n * Sets the zoom factor for the lens.\n *\n * This is `2` by default.\n *\n * @param zoomFactor\n */\n set zoomFactor(zoomFactor) {\n this._zoomFactor = zoomFactor;\n this.update();\n }\n\n /**\n * Gets the zoom factor for the lens.\n *\n * This is `2` by default.\n *\n * @returns Number\n */\n get zoomFactor() {\n return this._zoomFactor;\n }\n\n /**\n * Sets the canvas central position of the lens.\n * @param canvasPos\n */\n set canvasPos(canvasPos) {\n this._canvasPos = canvasPos;\n this.update();\n }\n\n /**\n * Gets the canvas central position of the lens.\n * @returns {Number[]}\n */\n get canvasPos() {\n return this._canvasPos;\n }\n\n /**\n * Sets the canvas coordinates of the pointer.\n * @param snappedCanvasPos\n */\n set snappedCanvasPos(snappedCanvasPos) {\n this._snappedCanvasPos = snappedCanvasPos;\n this.update();\n }\n\n /**\n * Gets the canvas coordinates of the snapped pointer.\n * @returns {Number[]}\n */\n get snappedCanvasPos() {\n return this._snappedCanvasPos;\n }\n\n /**\n * Sets if the cursor has snapped to anything.\n * This is set by plugins.\n * @param snapped\n * @private\n */\n set snapped(snapped) {\n this._snapped = snapped;\n if (snapped) {\n this._lensCursorDiv.style.background = \"greenyellow\";\n this._lensCursorDiv.style.border = \"2px solid green\";\n } else {\n this._lensCursorDiv.style.background = \"pink\";\n this._lensCursorDiv.style.border = \"2px solid red\";\n }\n }\n\n /**\n * Gets if the cursor has snapped to anything.\n * This is called by plugins.\n * @returns {Boolean}\n * @private\n */\n get snapped() {\n return this._snapped;\n }\n \n /**\n * Sets if this PointerLens is active.\n * @param active\n */\n set active(active) {\n this._active = active;\n this._lensContainer.style.visibility = (active && this._visible) ? \"visible\" : \"hidden\";\n if (!active || !this._visible ) {\n this._lensCursorDiv.style.marginLeft = `-100px`;\n this._lensCursorDiv.style.marginTop = `-100px`;\n }\n this.update();\n }\n\n /**\n * Gets if this PointerLens is active.\n * @returns {Boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets if this PointerLens is visible.\n * This is set by plugins.\n * @param visible\n * @private\n */\n set visible(visible) {\n this._visible = visible;\n this._lensContainer.style.visibility = (visible && this._active) ? \"visible\" : \"hidden\";\n if (!visible || !this._active) {\n this._lensCursorDiv.style.marginLeft = `-100px`;\n this._lensCursorDiv.style.marginTop = `-100px`;\n }\n this.update();\n }\n\n /**\n * Gets if this PointerLens is visible.\n * This is called by plugins.\n * @returns {Boolean}\n * @private\n */\n get visible() {\n return this._visible;\n }\n\n /**\n * Destroys this PointerLens.\n */\n destroy() {\n if (!this._destroyed) {\n this.viewer.scene.off(this._onViewerRendering);\n this._lensContainer.removeChild(this._lensCanvas);\n document.body.removeChild(this._lensContainer);\n this._destroyed = true;\n }\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/PointerLens/PointerLens.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/PointerLens/PointerLens.js", "access": "public", "description": null, "lineNumber": 1 @@ -3740,7 +3740,7 @@ "name": "src/extras/PointerLens/index.js", "content": "export * from \"./PointerLens.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/PointerLens/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/PointerLens/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -3751,7 +3751,7 @@ "name": "src/extras/collision/ObjectsKdTree3.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\n\nconst MAX_KD_TREE_DEPTH = 15; // Increase if greater precision needed\nconst kdTreeDimLength = new Float32Array(3);\n\n/**\n * Automatically indexes a {@link Viewer}'s {@link Entity}s in a 3D k-d tree\n * to support fast collision detection with 3D World-space axis-aligned boundaries (AABBs) and frustums.\n *\n * See {@link MarqueePicker} for usage example.\n *\n * An ObjectsKdTree3 is configured with a Viewer, and will then automatically\n * keep itself populated with k-d nodes that contain the Viewer's Entitys.\n *\n * We can then traverse the k-d nodes, starting at {@link ObjectsKdTree3#root}, to find\n * the contained Entities.\n */\nexport class ObjectsKdTree3 {\n\n /**\n * Creates an ObjectsKdTree3.\n *\n * @param {*} cfg Configuration\n * @param {Viewer} cfg.viewer The Viewer that provides the {@link Entity}s in this ObjectsKdTree3.\n * @param {number} [cfg.maxTreeDepth=15] Optional maximum depth for the k-d tree.\n */\n constructor(cfg) {\n\n if (!cfg) {\n throw \"Parameter expected: cfg\";\n }\n\n if (!cfg.viewer) {\n throw \"Parameter expected: cfg.viewer\";\n }\n\n this.viewer = cfg.viewer;\n\n this._maxTreeDepth = cfg.maxTreeDepth || MAX_KD_TREE_DEPTH;\n this._root = null;\n this._needsRebuild = true;\n\n this._onModelLoaded = this.viewer.scene.on(\"modelLoaded\", (modelId) => {\n this._needsRebuild = true;\n });\n\n this._onModelUnloaded = this.viewer.scene.on(\"modelUnloaded\", (modelId) => {\n this._needsRebuild = true;\n });\n }\n\n /**\n * Gets the root ObjectsKdTree3 node.\n *\n * Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3\n * if {@link Entity}s have been created or removed in the {@link Viewer} since the last time it was accessed.\n */\n get root() {\n if (this._needsRebuild) {\n this._rebuild();\n }\n return this._root;\n }\n\n _rebuild() {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const depth = 0;\n this._root = {\n aabb: scene.getAABB()\n };\n for (let objectId in scene.objects) {\n const entity = scene.objects[objectId];\n this._insertEntity(this._root, entity, depth + 1);\n }\n this._needsRebuild = false;\n }\n\n _insertEntity(node, entity, depth) {\n\n const entityAABB = entity.aabb;\n\n if (depth >= this._maxTreeDepth) {\n node.entities = node.entities || [];\n node.entities.push(entity);\n return;\n }\n if (node.left) {\n if (math.containsAABB3(node.left.aabb, entityAABB)) {\n this._insertEntity(node.left, entity, depth + 1);\n return;\n }\n }\n if (node.right) {\n if (math.containsAABB3(node.right.aabb, entityAABB)) {\n this._insertEntity(node.right, entity, depth + 1);\n return;\n }\n }\n const nodeAABB = node.aabb;\n kdTreeDimLength[0] = nodeAABB[3] - nodeAABB[0];\n kdTreeDimLength[1] = nodeAABB[4] - nodeAABB[1];\n kdTreeDimLength[2] = nodeAABB[5] - nodeAABB[2];\n let dim = 0;\n if (kdTreeDimLength[1] > kdTreeDimLength[dim]) {\n dim = 1;\n }\n if (kdTreeDimLength[2] > kdTreeDimLength[dim]) {\n dim = 2;\n }\n if (!node.left) {\n const aabbLeft = nodeAABB.slice();\n aabbLeft[dim + 3] = ((nodeAABB[dim] + nodeAABB[dim + 3]) / 2.0);\n node.left = {\n aabb: aabbLeft\n };\n if (math.containsAABB3(aabbLeft, entityAABB)) {\n this._insertEntity(node.left, entity, depth + 1);\n return;\n }\n }\n if (!node.right) {\n const aabbRight = nodeAABB.slice();\n aabbRight[dim] = ((nodeAABB[dim] + nodeAABB[dim + 3]) / 2.0);\n node.right = {\n aabb: aabbRight\n };\n if (math.containsAABB3(aabbRight, entityAABB)) {\n this._insertEntity(node.right, entity, depth + 1);\n return;\n }\n }\n node.entities = node.entities || [];\n node.entities.push(entity);\n }\n\n /**\n * Destroys this ObjectsKdTree3.\n *\n * Does not destroy the {@link Viewer} given to the constructor of the ObjectsKdTree3.\n */\n destroy() {\n const scene = this.viewer.scene;\n scene.off(this._onModelLoaded);\n scene.off(this._onModelUnloaded);\n this._root = null;\n this._needsRebuild = true;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/collision/ObjectsKdTree3.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/collision/ObjectsKdTree3.js", "access": "public", "description": null, "lineNumber": 1 @@ -4059,7 +4059,7 @@ "name": "src/extras/collision/index.js", "content": "export * from \"./ObjectsKdTree3.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/collision/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/collision/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -4070,7 +4070,7 @@ "name": "src/extras/index.js", "content": "export * from \"./ContextMenu/index.js\";\nexport * from \"./PointerLens/index.js\";\nexport * from \"./collision/index.js\";\nexport * from \"./MarqueePicker/index.js\";\nexport * from \"./PointerCircle/index.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/extras/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/extras/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -4081,7 +4081,7 @@ "name": "src/index.js", "content": "export * from \"./extras/index.js\";\nexport * from \"./plugins/index.js\";\nexport * from \"./viewer/index.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/index.js", "access": "public", "description": null, "lineNumber": 1 @@ -4092,7 +4092,7 @@ "name": "src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js", "content": "import {Marker} from \"../../viewer/scene/marker/Marker.js\";\nimport {Wire} from \"../lib/html/Wire.js\";\nimport {Dot} from \"../lib/html/Dot.js\";\nimport {Label} from \"../lib/html/Label.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {Component} from \"../../viewer/scene/Component.js\";\n\nvar originVec = math.vec3();\nvar targetVec = math.vec3();\n\n/**\n * @desc Measures the angle indicated by three 3D points.\n *\n * See {@link AngleMeasurementsPlugin} for more info.\n */\nclass AngleMeasurement extends Component {\n\n /**\n * @private\n */\n constructor(plugin, cfg = {}) {\n\n super(plugin.viewer.scene, cfg);\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurement.\n * @type {AngleMeasurementsPlugin}\n */\n this.plugin = plugin;\n\n this._container = cfg.container;\n if (!this._container) {\n throw \"config missing: container\";\n }\n\n this._color = cfg.color || plugin.defaultColor;\n\n var scene = this.plugin.viewer.scene;\n\n this._originMarker = new Marker(scene, cfg.origin);\n this._cornerMarker = new Marker(scene, cfg.corner);\n this._targetMarker = new Marker(scene, cfg.target);\n\n this._originWorld = math.vec3();\n this._cornerWorld = math.vec3();\n this._targetWorld = math.vec3();\n\n this._wp = new Float64Array(12);\n this._vp = new Float64Array(12);\n this._pp = new Float64Array(12);\n this._cp = new Int16Array(6);\n\n const onMouseOver = cfg.onMouseOver ? (event) => {\n cfg.onMouseOver(event, this);\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover', event));\n } : null;\n\n const onMouseLeave = cfg.onMouseLeave ? (event) => {\n cfg.onMouseLeave(event, this);\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave', event));\n } : null;\n\n const onContextMenu = cfg.onContextMenu ? (event) => {\n cfg.onContextMenu(event, this);\n } : null;\n\n const onMouseWheel = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel', event));\n };\n\n const onMouseDown = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown', event));\n } ;\n\n const onMouseUp = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup', event));\n };\n\n const onMouseMove = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove', event));\n };\n\n this._originDot = new Dot(this._container, {\n fillColor: this._color,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n this._cornerDot = new Dot(this._container, {\n fillColor: this._color,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n this._targetDot = new Dot(this._container, {\n fillColor: this._color,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._originWire = new Wire(this._container, {\n color: this._color || \"blue\",\n thickness: 1,\n zIndex: plugin.zIndex,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n this._targetWire = new Wire(this._container, {\n color: this._color || \"red\",\n thickness: 1,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._angleLabel = new Label(this._container, {\n fillColor: this._color || \"#00BBFF\",\n prefix: \"\",\n text: \"\",\n zIndex: plugin.zIndex + 2,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._wpDirty = false;\n this._vpDirty = false;\n this._cpDirty = false;\n\n this._visible = false;\n this._originVisible = false;\n this._cornerVisible = false;\n this._targetVisible = false;\n\n this._originWireVisible = false;\n this._targetWireVisible = false;\n\n this._angleVisible = false;\n this._labelsVisible = false;\n this._clickable = false;\n\n this._originMarker.on(\"worldPos\", (value) => {\n this._originWorld.set(value || [0, 0, 0]);\n this._wpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._cornerMarker.on(\"worldPos\", (value) => {\n this._cornerWorld.set(value || [0, 0, 0]);\n this._wpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._targetMarker.on(\"worldPos\", (value) => {\n this._targetWorld.set(value || [0, 0, 0]);\n this._wpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onViewMatrix = scene.camera.on(\"viewMatrix\", () => {\n this._vpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onProjMatrix = scene.camera.on(\"projMatrix\", () => {\n this._cpDirty = true;\n this._needUpdate();\n });\n\n this._onCanvasBoundary = scene.canvas.on(\"boundary\", () => {\n this._cpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onSectionPlaneUpdated = scene.on(\"sectionPlaneUpdated\", () => {\n this._sectionPlanesDirty = true;\n this._needUpdate();\n });\n\n this.approximate = cfg.approximate;\n this.visible = cfg.visible;\n\n this.originVisible = cfg.originVisible;\n this.cornerVisible = cfg.cornerVisible;\n this.targetVisible = cfg.targetVisible;\n\n this.originWireVisible = cfg.originWireVisible;\n this.targetWireVisible = cfg.targetWireVisible;\n\n this.angleVisible = cfg.angleVisible;\n this.labelsVisible = cfg.labelsVisible;\n }\n\n _update() {\n\n if (!this._visible) {\n return;\n }\n\n const scene = this.plugin.viewer.scene;\n\n if (this._wpDirty) {\n\n this._wp[0] = this._originWorld[0];\n this._wp[1] = this._originWorld[1];\n this._wp[2] = this._originWorld[2];\n this._wp[3] = 1.0;\n\n this._wp[4] = this._cornerWorld[0];\n this._wp[5] = this._cornerWorld[1];\n this._wp[6] = this._cornerWorld[2];\n this._wp[7] = 1.0;\n\n this._wp[8] = this._targetWorld[0];\n this._wp[9] = this._targetWorld[1];\n this._wp[10] = this._targetWorld[2];\n this._wp[11] = 1.0;\n\n this._wpDirty = false;\n this._vpDirty = true;\n }\n\n if (this._vpDirty) {\n\n math.transformPositions4(scene.camera.viewMatrix, this._wp, this._vp);\n\n this._vp[3] = 1.0;\n this._vp[7] = 1.0;\n this._vp[11] = 1.0;\n\n this._vpDirty = false;\n this._cpDirty = true;\n }\n\n if (this._sectionPlanesDirty) {\n\n if (this._isSliced(this._wp)) {\n this._angleLabel.setCulled(true);\n this._originWire.setCulled(true);\n this._targetWire.setCulled(true);\n this._originDot.setCulled(true);\n this._cornerDot.setCulled(true);\n this._targetDot.setCulled(true);\n return;\n } else {\n this._angleLabel.setCulled(false);\n this._originWire.setCulled(false);\n this._targetWire.setCulled(false);\n this._originDot.setCulled(false);\n this._cornerDot.setCulled(false);\n this._targetDot.setCulled(false);\n }\n\n this._sectionPlanesDirty = true;\n }\n\n if (this._cpDirty) {\n\n const near = -0.3;\n const zOrigin = this._originMarker.viewPos[2];\n const zCorner = this._cornerMarker.viewPos[2];\n const zTarget = this._targetMarker.viewPos[2];\n\n if (zOrigin > near || zCorner > near || zTarget > near) {\n\n this._originDot.setVisible(false);\n this._cornerDot.setVisible(false);\n this._targetDot.setVisible(false);\n\n this._originWire.setVisible(false);\n this._targetWire.setVisible(false);\n\n this._angleLabel.setCulled(true);\n\n return;\n }\n\n math.transformPositions4(scene.camera.project.matrix, this._vp, this._pp);\n\n var pp = this._pp;\n var cp = this._cp;\n\n var canvas = scene.canvas.canvas;\n var offsets = canvas.getBoundingClientRect();\n const containerOffsets = this._container.getBoundingClientRect();\n var top = offsets.top - containerOffsets.top;\n var left = offsets.left - containerOffsets.left;\n var aabb = scene.canvas.boundary;\n var canvasWidth = aabb[2];\n var canvasHeight = aabb[3];\n var j = 0;\n\n for (var i = 0, len = pp.length; i < len; i += 4) {\n cp[j] = left + Math.floor((1 + pp[i + 0] / pp[i + 3]) * canvasWidth / 2);\n cp[j + 1] = top + Math.floor((1 - pp[i + 1] / pp[i + 3]) * canvasHeight / 2);\n j += 2;\n }\n\n this._originDot.setPos(cp[0], cp[1]);\n this._cornerDot.setPos(cp[2], cp[3]);\n this._targetDot.setPos(cp[4], cp[5]);\n\n this._originWire.setStartAndEnd(cp[0], cp[1], cp[2], cp[3]);\n this._targetWire.setStartAndEnd(cp[2], cp[3], cp[4], cp[5]);\n\n this._angleLabel.setPosBetweenWires(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);\n\n math.subVec3(this._originWorld, this._cornerWorld, originVec);\n math.subVec3(this._targetWorld, this._cornerWorld, targetVec);\n\n var validVecs =\n (originVec[0] !== 0 || originVec[1] !== 0 || originVec[2] !== 0) &&\n (targetVec[0] !== 0 || targetVec[1] !== 0 || targetVec[2] !== 0);\n\n if (validVecs) {\n\n const tilde = this._approximate ? \" ~ \" : \" = \";\n\n math.normalizeVec3(originVec);\n math.normalizeVec3(targetVec);\n const angle = Math.abs(math.angleVec3(originVec, targetVec));\n this._angle = angle / math.DEGTORAD;\n this._angleLabel.setText(tilde + this._angle.toFixed(2) + \"°\");\n } else {\n this._angleLabel.setText(\"\");\n }\n\n // this._angleLabel.setText((Math.abs(math.lenVec3(math.subVec3(this._targetWorld, this._originWorld, distVec3)) * scale).toFixed(2)) + unitAbbrev);\n\n this._originDot.setVisible(this._visible && this._originVisible);\n this._cornerDot.setVisible(this._visible && this._cornerVisible);\n this._targetDot.setVisible(this._visible && this._targetVisible);\n\n this._originWire.setVisible(this._visible && this._originWireVisible);\n this._targetWire.setVisible(this._visible && this._targetWireVisible);\n\n this._angleLabel.setCulled(!(this._visible && this._angleVisible && this.labelsVisible));\n\n this._cpDirty = false;\n }\n }\n\n _isSliced(positions) {\n const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = sectionPlanes.length; i < len; i++) {\n const sectionPlane = sectionPlanes[i];\n if (math.planeClipsPositions3(sectionPlane.pos, sectionPlane.dir, positions, 4)) {\n return true\n }\n }\n return false;\n }\n\n /**\n * Sets whether this AngleMeasurement indicates that its measurement is approximate.\n *\n * This is ````true```` by default.\n *\n * @type {Boolean}\n */\n set approximate(approximate) {\n approximate = approximate !== false;\n if (this._approximate === approximate) {\n return;\n }\n this._approximate = approximate;\n this._cpDirty = true;\n this._needUpdate(0);\n }\n\n /**\n * Gets whether this AngleMeasurement indicates that its measurement is approximate.\n *\n * This is ````true```` by default.\n *\n * @type {Boolean}\n */\n get approximate() {\n return this._approximate;\n }\n\n /**\n * Gets the origin {@link Marker}.\n *\n * @type {Marker}\n */\n get origin() {\n return this._originMarker;\n }\n\n /**\n * Gets the corner {@link Marker}.\n *\n * @type {Marker}\n */\n get corner() {\n return this._cornerMarker;\n }\n\n /**\n * Gets the target {@link Marker}.\n *\n * @type {Marker}\n */\n get target() {\n return this._targetMarker;\n }\n\n /**\n * Gets the angle between two connected 3D line segments, given\n * as three positions on the surface(s) of one or more {@link Entity}s.\n *\n * @type {Number}\n */\n get angle() {\n this._update();\n return this._angle;\n }\n\n /**\n * Gets the color of the angle measurement.\n *\n * The color is an HTML string representation, eg. \"#00BBFF\" and \"blue\".\n *\n * @type {String}\n */\n get color() {\n return this._color;\n }\n\n /** Sets the color of the angle measurement.\n *\n * The color is given as an HTML string representation, eg. \"#00BBFF\" and \"blue\".\n *\n * @type {String}\n */\n set color(value) {\n this._originDot.setFillColor(value);\n this._cornerDot.setFillColor(value);\n this._targetDot.setFillColor(value);\n this._originWire.setColor(value || \"blue\");\n this._targetWire.setColor(value || \"red\");\n this._angleLabel.setFillColor(value || \"#00BBFF\");\n\n this._color = value;\n }\n\n /**\n * Sets whether this AngleMeasurement is visible or not.\n *\n * @type {Boolean}\n */\n set visible(value) {\n value = value !== false;\n this._visible = value;\n this._originDot.setVisible(this._visible && this._originVisible);\n this._cornerDot.setVisible(this._visible && this._cornerVisible);\n this._targetDot.setVisible(this._visible && this._targetVisible);\n this._originWire.setVisible(this._visible && this._originWireVisible);\n this._targetWire.setVisible(this._visible && this._targetWireVisible);\n this._angleLabel.setVisible(this._visible && this._angleVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets whether this AngleMeasurement is visible or not.\n *\n * @type {Boolean}\n */\n get visible() {\n return this._visible;\n }\n\n /**\n * Sets if the origin {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n set originVisible(value) {\n value = value !== false;\n this._originVisible = value;\n this._originDot.setVisible(this._visible && this._originVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the origin {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n get originVisible() {\n return this._originVisible;\n }\n\n /**\n * Sets if the corner {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n set cornerVisible(value) {\n value = value !== false;\n this._cornerVisible = value;\n this._cornerDot.setVisible(this._visible && this._cornerVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the corner {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n get cornerVisible() {\n return this._cornerVisible;\n }\n\n /**\n * Sets if the target {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n set targetVisible(value) {\n value = value !== false;\n this._targetVisible = value;\n this._targetDot.setVisible(this._visible && this._targetVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the target {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n get targetVisible() {\n return this._targetVisible;\n }\n\n /**\n * Sets if the wire between the origin and the corner is visible.\n *\n * @type {Boolean}\n */\n set originWireVisible(value) {\n value = value !== false;\n this._originWireVisible = value;\n this._originWire.setVisible(this._visible && this._originWireVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the wire between the origin and the corner is visible.\n *\n * @type {Boolean}\n */\n get originWireVisible() {\n return this._originWireVisible;\n }\n\n /**\n * Sets if the wire between the target and the corner is visible.\n *\n * @type {Boolean}\n */\n set targetWireVisible(value) {\n value = value !== false;\n this._targetWireVisible = value;\n this._targetWire.setVisible(this._visible && this._targetWireVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the wire between the target and the corner is visible.\n *\n * @type {Boolean}\n */\n get targetWireVisible() {\n return this._targetWireVisible;\n }\n\n /**\n * Sets if the angle label is visible.\n *\n * @type {Boolean}\n */\n set angleVisible(value) {\n value = value !== false;\n this._angleVisible = value;\n this._angleLabel.setVisible(this._visible && this._angleVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the angle label is visible.\n *\n * @type {Boolean}\n */\n get angleVisible() {\n return this._angleVisible;\n }\n\n /**\n * Sets if the labels are visible.\n *\n * @type {Boolean}\n */\n set labelsVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;\n this._labelsVisible = value;\n var labelsVisible = this._visible && this._labelsVisible;\n this._angleLabel.setVisible(labelsVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the labels are visible.\n *\n * @type {Boolean}\n */\n get labelsVisible() {\n return this._labelsVisible;\n }\n\n /**\n * Sets if this DistanceMeasurement appears highlighted.\n * @param highlighted\n */\n setHighlighted(highlighted) {\n this._originDot.setHighlighted(highlighted);\n this._cornerDot.setHighlighted(highlighted);\n this._targetDot.setHighlighted(highlighted);\n this._originWire.setHighlighted(highlighted);\n this._targetWire.setHighlighted(highlighted);\n this._angleLabel.setHighlighted(highlighted);\n }\n\n /**\n * Sets if the wires, dots ad labels will fire \"mouseOver\" \"mouseLeave\" and \"contextMenu\" events.\n *\n * @type {Boolean}\n */\n set clickable(value) {\n value = !!value;\n this._clickable = value;\n this._originDot.setClickable(this._clickable);\n this._cornerDot.setClickable(this._clickable);\n this._targetDot.setClickable(this._clickable);\n this._originWire.setClickable(this._clickable);\n this._targetWire.setClickable(this._clickable);\n this._angleLabel.setClickable(this._clickable);\n }\n\n /**\n * Gets if the wires, dots ad labels will fire \"mouseOver\" \"mouseLeave\" and \"contextMenu\" events.\n *\n * @type {Boolean}\n */\n get clickable() {\n return this._clickable;\n }\n\n /**\n * @private\n */\n destroy() {\n\n const scene = this.plugin.viewer.scene;\n\n if (this._onViewMatrix) {\n scene.camera.off(this._onViewMatrix);\n }\n if (this._onProjMatrix) {\n scene.camera.off(this._onProjMatrix);\n }\n if (this._onCanvasBoundary) {\n scene.canvas.off(this._onCanvasBoundary);\n }\n if (this._onSectionPlaneUpdated) {\n scene.off(this._onSectionPlaneUpdated);\n }\n\n this._originDot.destroy();\n this._cornerDot.destroy();\n this._targetDot.destroy();\n\n this._originWire.destroy();\n this._targetWire.destroy();\n\n this._angleLabel.destroy();\n\n super.destroy();\n }\n}\n\nexport {AngleMeasurement};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js", "access": "public", "description": null, "lineNumber": 1 @@ -5493,9 +5493,9 @@ "__docId__": 371, "kind": "file", "name": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js", - "content": "import {Component} from \"../../viewer/scene/Component.js\";\n\n/**\n * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from user input.\n *\n * @interface\n * @abstract\n */\nexport class AngleMeasurementsControl extends Component {\n\n /**\n * Gets if this AngleMeasurementsControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this AngleMeassurementsControl is active.\n * @abstract\n */\n get active() {\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsControl.\n */\n set snapping(snapping) {\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n */\n get snapping() {\n return true;\n }\n\n /**\n * Activates this AngleMeasurementsMouseControl, ready to respond to input.\n *\n * @abstract\n */\n activate() {\n }\n\n /**\n * Deactivates this AngleMeasurementsControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n */\n deactivate() {\n }\n\n /**\n * Resets this AngleMeasurementsControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * Does nothing if the AngleMeasurementsControl is not active.\n *\n * @abstract\n */\n reset() {\n }\n\n /**\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n */\n destroy() {\n }\n}", + "content": "import {Component} from \"../../viewer/scene/Component.js\";\n\n/**\n * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from user input.\n *\n * @interface\n * @abstract\n */\nexport class AngleMeasurementsControl extends Component {\n\n /**\n * Gets if this AngleMeasurementsControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this AngleMeassurementsControl is active.\n * @abstract\n */\n get active() {\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsControl.\n */\n set snapping(snapping) {\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.\n */\n get snapping() {\n return true;\n }\n\n /**\n * Activates this AngleMeasurementsMouseControl, ready to respond to input.\n *\n * @abstract\n */\n activate() {\n }\n\n /**\n * Deactivates this AngleMeasurementsControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n */\n deactivate() {\n }\n\n /**\n * Resets this AngleMeasurementsControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * Does nothing if the AngleMeasurementsControl is not active.\n *\n * @abstract\n */\n reset() {\n }\n\n /**\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.\n *\n * @returns {null|AngleMeasurement}\n */\n get currentMeasurement() {\n return null;\n }\n\n /**\n * Destroys this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.\n *\n * @abstract\n */\n destroy() {\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js", "access": "public", "description": null, "lineNumber": 1 @@ -5655,6 +5655,39 @@ }, { "__docId__": 379, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.", + "lineNumber": 80, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|AngleMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "AngleMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 380, "kind": "method", "name": "destroy", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl", @@ -5664,24 +5697,24 @@ "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl#destroy", "access": "public", "description": "Destroys this AngleMeasurementsMouseControl.\n\nDestroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.", - "lineNumber": 82, + "lineNumber": 91, "abstract": true, "params": [], "return": null }, { - "__docId__": 380, + "__docId__": 381, "kind": "file", "name": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", - "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {AngleMeasurementsControl} from \"./AngleMeasurementsControl.js\";\n\nconst MOUSE_FINDING_ORIGIN = 0;\nconst MOUSE_FINDING_CORNER = 1;\nconst MOUSE_FINDING_TARGET = 2;\n\n/**\n * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.\n *\n * ## Usage\n *\n * [[Run example](/examples/measurement/#angle_createWithMouse_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"Duplex.xkt\"\n * });\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const angleMeasurementsMouseControl = new AngleMeasurementsMouseControl(angleMeasurements, {\n * pointerLens : new PointerLens(viewer)\n * })\n *\n * angleMeasurementsMouseControl.snapping = true;\n *\n * angleMeasurementsMouseControl.activate();\n * ````\n */\nexport class AngleMeasurementsMouseControl extends AngleMeasurementsControl {\n\n /**\n * Creates a AngleMeasurementsMouseControl bound to the given AngleMeasurementsPlugin.\n *\n * @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.\n * @param {*} [cfg] Configuration\n * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.\n * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.\n * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.\n */\n constructor(angleMeasurementsPlugin, cfg = {}) {\n\n super(angleMeasurementsPlugin.viewer.scene);\n\n this._canvasToPagePos = cfg.canvasToPagePos;\n\n this.pointerLens = cfg.pointerLens;\n\n this._active = false;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n\n this._currentAngleMeasurement = null;\n\n // init markerDiv element (think about making its style configurable)\n this._initMarkerDiv()\n\n this._onMouseHoverSurface = null;\n this._onHoverNothing = null;\n this._onPickedNothing = null;\n this._onPickedSurface = null;\n\n this._onInputMouseDown = null;\n this._onInputMouseUp = null;\n\n this._snapping = cfg.snapping !== false;\n\n this._attachPlugin(angleMeasurementsPlugin, cfg);\n }\n\n _initMarkerDiv() {\n const markerDiv = document.createElement('div');\n markerDiv.setAttribute('id', 'myMarkerDiv');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.top = \"-200px\";\n markerDiv.style.left = \"-200px\";\n markerDiv.style.margin = \"0 0\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n }\n\n _destroyMarkerDiv() {\n if (this._markerDiv) {\n const element = document.getElementById('myMarkerDiv')\n element.parentNode.removeChild(element)\n this._markerDiv = null\n }\n }\n\n _attachPlugin(angleMeasurementsPlugin, cfg = {}) {\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.\n *\n * @type {AngleMeasurementsPlugin}\n */\n this.angleMeasurementsPlugin = angleMeasurementsPlugin;\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.\n *\n * @type {AngleMeasurementsPlugin}\n */\n this.plugin = angleMeasurementsPlugin;\n }\n\n /**\n * Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.\n *\n * @returns {boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this AngleMeasurementsMouseControl, ready to respond to input.\n */\n activate() {\n if (this._active) {\n return;\n }\n if (!this.markerDiv) {\n this._initMarkerDiv() // if the marker is destroyed after deactivation, we recreate it\n }\n const angleMeasurementsPlugin = this.angleMeasurementsPlugin;\n const scene = this.scene;\n const input = scene.input;\n const canvas = scene.canvas.canvas;\n const clickTolerance = 20;\n const cameraControl = this.angleMeasurementsPlugin.viewer.cameraControl;\n const pointerLens = this.pointerLens;\n let mouseHovering = false;\n let hoveredEntity = null;\n let lastMouseCanvasX = 0;\n let lastMouseCanvasY = 0;\n const mouseWorldPos = math.vec3();\n const mouseHoverCanvasPos = math.vec2();\n this._currentAngleMeasurement = null;\n\n const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));\n const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));\n\n const pagePos = math.vec2();\n\n this._onMouseHoverSurface = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurface\"\n : \"hoverSurface\",\n event => {\n if (event.snappedToVertex || event.snappedToEdge) {\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.canvasPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n pointerLens.snapped = true;\n }\n this.markerDiv.style.background = \"greenyellow\";\n this.markerDiv.style.border = \"2px solid green\";\n } else {\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.canvasPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.canvasPos;\n pointerLens.snapped = false;\n }\n this.markerDiv.style.background = \"pink\";\n this.markerDiv.style.border = \"2px solid red\";\n }\n const canvasPos = event.snappedCanvasPos || event.canvasPos;\n mouseHovering = true;\n hoveredEntity = event.entity;\n mouseWorldPos.set(event.worldPos);\n mouseHoverCanvasPos.set(canvasPos);\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n if (this._canvasToPagePos) {\n this._canvasToPagePos(canvas, canvasPos, pagePos);\n this.markerDiv.style.left = `${pagePos[0] - 5}px`;\n this.markerDiv.style.top = `${pagePos[1] - 5}px`;\n } else {\n this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;\n this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;\n }\n break;\n case MOUSE_FINDING_CORNER:\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.angleVisible = false;\n this._currentAngleMeasurement.corner.worldPos = event.worldPos;\n this._currentAngleMeasurement.corner.entity = event.entity;\n }\n this.markerDiv.style.left = `-10000px`;\n this.markerDiv.style.top = `-10000px`;\n canvas.style.cursor = \"pointer\";\n break;\n case MOUSE_FINDING_TARGET:\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.target.worldPos = event.worldPos;\n this._currentAngleMeasurement.target.entity = event.entity;\n }\n this.markerDiv.style.left = `-10000px`;\n this.markerDiv.style.top = `-10000px`;\n canvas.style.cursor = \"pointer\";\n break;\n }\n });\n canvas.addEventListener('mousedown', this._onMouseDown = (e) => {\n if (e.which !== 1) {\n return;\n }\n lastMouseCanvasX = e.clientX;\n lastMouseCanvasY = e.clientY;\n });\n canvas.addEventListener(\"mouseup\", this._onMouseUp =(e) => {\n if (e.which !== 1) {\n return;\n }\n if (e.clientX > lastMouseCanvasX + clickTolerance ||\n e.clientX < lastMouseCanvasX - clickTolerance ||\n e.clientY > lastMouseCanvasY + clickTolerance ||\n e.clientY < lastMouseCanvasY - clickTolerance) {\n return;\n }\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n if (mouseHovering) {\n this._currentAngleMeasurement = this.angleMeasurementsPlugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n corner: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n target: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n approximate: true\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n this._currentAngleMeasurement.origin.entity = hoveredEntity;\n this._mouseState = MOUSE_FINDING_CORNER;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n }\n break;\n case MOUSE_FINDING_CORNER:\n if (mouseHovering) {\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.corner.entity = hoveredEntity;\n this._mouseState = MOUSE_FINDING_TARGET;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n hoveredEntity = null;\n this._mouseState = MOUSE_FINDING_ORIGIN\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n }\n }\n break;\n case MOUSE_FINDING_TARGET:\n if (mouseHovering) {\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.target.entity = hoveredEntity;\n this._currentAngleMeasurement.clickable = true;\n hoveredEntity = null;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n hoveredEntity = null;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n }\n }\n break;\n }\n });\n this._onMouseHoverOff = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurfaceOff\"\n : \"hoverOff\",\n event => {\n mouseHovering = false;\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.pointerPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n pointerLens.snapped = false;\n }\n this.markerDiv.style.left = `-100px`;\n this.markerDiv.style.top = `-100px`;\n if (this._currentAngleMeasurement) {\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n this._currentAngleMeasurement.originVisible = false;\n break;\n case MOUSE_FINDING_CORNER:\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n break;\n case MOUSE_FINDING_TARGET:\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n break;\n }\n canvas.style.cursor = \"default\";\n }\n });\n this._active = true;\n }\n\n /**\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (this.markerDiv) {\n this._destroyMarkerDiv()\n }\n this.reset();\n const canvas = this.scene.canvas.canvas;\n canvas.removeEventListener(\"mousedown\", this._onMouseDown);\n canvas.removeEventListener(\"mouseup\", this._onMouseUp);\n const cameraControl = this.angleMeasurementsPlugin.viewer.cameraControl;\n cameraControl.off(this._onMouseHoverSurface);\n cameraControl.off(this._onPickedSurface);\n cameraControl.off(this._onHoverNothing);\n cameraControl.off(this._onPickedNothing);\n this._currentAngleMeasurement = null;\n this._active = false;\n }\n\n /**\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n\n this._destroyMarkerDiv()\n this._initMarkerDiv()\n\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._mouseState = MOUSE_FINDING_ORIGIN;\n }\n\n /**\n * Destroys this AngleMeasurementsMouseControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", + "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {AngleMeasurementsControl} from \"./AngleMeasurementsControl.js\";\n\nconst MOUSE_FINDING_ORIGIN = 0;\nconst MOUSE_FINDING_CORNER = 1;\nconst MOUSE_FINDING_TARGET = 2;\n\n/**\n * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.\n *\n * ## Usage\n *\n * [[Run example](/examples/measurement/#angle_createWithMouse_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"Duplex.xkt\"\n * });\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const angleMeasurementsMouseControl = new AngleMeasurementsMouseControl(angleMeasurements, {\n * pointerLens : new PointerLens(viewer)\n * })\n *\n * angleMeasurementsMouseControl.snapping = true;\n *\n * angleMeasurementsMouseControl.activate();\n * ````\n */\nexport class AngleMeasurementsMouseControl extends AngleMeasurementsControl {\n\n /**\n * Creates a AngleMeasurementsMouseControl bound to the given AngleMeasurementsPlugin.\n *\n * @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.\n * @param {*} [cfg] Configuration\n * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.\n * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.\n * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.\n */\n constructor(angleMeasurementsPlugin, cfg = {}) {\n\n super(angleMeasurementsPlugin.viewer.scene);\n\n this._canvasToPagePos = cfg.canvasToPagePos;\n\n this.pointerLens = cfg.pointerLens;\n\n this._active = false;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n\n this._currentAngleMeasurement = null;\n\n // init markerDiv element (think about making its style configurable)\n this._initMarkerDiv()\n\n this._onMouseHoverSurface = null;\n this._onHoverNothing = null;\n this._onPickedNothing = null;\n this._onPickedSurface = null;\n\n this._onInputMouseDown = null;\n this._onInputMouseUp = null;\n\n this._snapping = cfg.snapping !== false;\n\n this._attachPlugin(angleMeasurementsPlugin, cfg);\n }\n\n _initMarkerDiv() {\n const markerDiv = document.createElement('div');\n markerDiv.setAttribute('id', 'myMarkerDiv');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.top = \"-200px\";\n markerDiv.style.left = \"-200px\";\n markerDiv.style.margin = \"0 0\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n }\n\n _destroyMarkerDiv() {\n if (this._markerDiv) {\n const element = document.getElementById('myMarkerDiv')\n element.parentNode.removeChild(element)\n this._markerDiv = null\n }\n }\n\n _attachPlugin(angleMeasurementsPlugin, cfg = {}) {\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.\n *\n * @type {AngleMeasurementsPlugin}\n */\n this.angleMeasurementsPlugin = angleMeasurementsPlugin;\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.\n *\n * @type {AngleMeasurementsPlugin}\n */\n this.plugin = angleMeasurementsPlugin;\n }\n\n /**\n * Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.\n *\n * @returns {boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this AngleMeasurementsMouseControl, ready to respond to input.\n */\n activate() {\n if (this._active) {\n return;\n }\n if (!this.markerDiv) {\n this._initMarkerDiv() // if the marker is destroyed after deactivation, we recreate it\n }\n const angleMeasurementsPlugin = this.angleMeasurementsPlugin;\n const scene = this.scene;\n const input = scene.input;\n const canvas = scene.canvas.canvas;\n const clickTolerance = 20;\n const cameraControl = this.angleMeasurementsPlugin.viewer.cameraControl;\n const pointerLens = this.pointerLens;\n let mouseHovering = false;\n let hoveredEntity = null;\n let lastMouseCanvasX = 0;\n let lastMouseCanvasY = 0;\n const mouseWorldPos = math.vec3();\n const mouseHoverCanvasPos = math.vec2();\n this._currentAngleMeasurement = null;\n\n const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));\n const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));\n\n const pagePos = math.vec2();\n\n this._onMouseHoverSurface = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurface\"\n : \"hoverSurface\",\n event => {\n if (event.snappedToVertex || event.snappedToEdge) {\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.canvasPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n pointerLens.snapped = true;\n }\n this.markerDiv.style.background = \"greenyellow\";\n this.markerDiv.style.border = \"2px solid green\";\n } else {\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.canvasPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.canvasPos;\n pointerLens.snapped = false;\n }\n this.markerDiv.style.background = \"pink\";\n this.markerDiv.style.border = \"2px solid red\";\n }\n const canvasPos = event.snappedCanvasPos || event.canvasPos;\n mouseHovering = true;\n hoveredEntity = event.entity;\n mouseWorldPos.set(event.worldPos);\n mouseHoverCanvasPos.set(canvasPos);\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n if (this._canvasToPagePos) {\n this._canvasToPagePos(canvas, canvasPos, pagePos);\n this.markerDiv.style.left = `${pagePos[0] - 5}px`;\n this.markerDiv.style.top = `${pagePos[1] - 5}px`;\n } else {\n this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;\n this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;\n }\n break;\n case MOUSE_FINDING_CORNER:\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.angleVisible = false;\n this._currentAngleMeasurement.corner.worldPos = event.worldPos;\n this._currentAngleMeasurement.corner.entity = event.entity;\n }\n this.markerDiv.style.left = `-10000px`;\n this.markerDiv.style.top = `-10000px`;\n canvas.style.cursor = \"pointer\";\n break;\n case MOUSE_FINDING_TARGET:\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.target.worldPos = event.worldPos;\n this._currentAngleMeasurement.target.entity = event.entity;\n }\n this.markerDiv.style.left = `-10000px`;\n this.markerDiv.style.top = `-10000px`;\n canvas.style.cursor = \"pointer\";\n break;\n }\n });\n canvas.addEventListener('mousedown', this._onMouseDown = (e) => {\n if (e.which !== 1) {\n return;\n }\n lastMouseCanvasX = e.clientX;\n lastMouseCanvasY = e.clientY;\n });\n canvas.addEventListener(\"mouseup\", this._onMouseUp =(e) => {\n if (e.which !== 1) {\n return;\n }\n if (e.clientX > lastMouseCanvasX + clickTolerance ||\n e.clientX < lastMouseCanvasX - clickTolerance ||\n e.clientY > lastMouseCanvasY + clickTolerance ||\n e.clientY < lastMouseCanvasY - clickTolerance) {\n return;\n }\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n if (mouseHovering) {\n this._currentAngleMeasurement = this.angleMeasurementsPlugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n corner: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n target: {\n worldPos: mouseWorldPos,\n entity: hoveredEntity\n },\n approximate: true\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n this._currentAngleMeasurement.origin.entity = hoveredEntity;\n this._mouseState = MOUSE_FINDING_CORNER;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n }\n break;\n case MOUSE_FINDING_CORNER:\n if (mouseHovering) {\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.corner.entity = hoveredEntity;\n this._mouseState = MOUSE_FINDING_TARGET;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n hoveredEntity = null;\n this._mouseState = MOUSE_FINDING_ORIGIN\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n }\n }\n break;\n case MOUSE_FINDING_TARGET:\n if (mouseHovering) {\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this._currentAngleMeasurement.target.entity = hoveredEntity;\n this._currentAngleMeasurement.clickable = true;\n hoveredEntity = null;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n hoveredEntity = null;\n this._mouseState = MOUSE_FINDING_ORIGIN;\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n }\n }\n break;\n }\n });\n this._onMouseHoverOff = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurfaceOff\"\n : \"hoverOff\",\n event => {\n mouseHovering = false;\n if (pointerLens) {\n pointerLens.visible = true;\n pointerLens.pointerPos = event.canvasPos;\n pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n pointerLens.snapped = false;\n }\n this.markerDiv.style.left = `-100px`;\n this.markerDiv.style.top = `-100px`;\n if (this._currentAngleMeasurement) {\n switch (this._mouseState) {\n case MOUSE_FINDING_ORIGIN:\n this._currentAngleMeasurement.originVisible = false;\n break;\n case MOUSE_FINDING_CORNER:\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n break;\n case MOUSE_FINDING_TARGET:\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n break;\n }\n canvas.style.cursor = \"default\";\n }\n });\n this._active = true;\n }\n\n /**\n * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (this.markerDiv) {\n this._destroyMarkerDiv()\n }\n this.reset();\n const canvas = this.scene.canvas.canvas;\n canvas.removeEventListener(\"mousedown\", this._onMouseDown);\n canvas.removeEventListener(\"mouseup\", this._onMouseUp);\n const cameraControl = this.angleMeasurementsPlugin.viewer.cameraControl;\n cameraControl.off(this._onMouseHoverSurface);\n cameraControl.off(this._onPickedSurface);\n cameraControl.off(this._onHoverNothing);\n cameraControl.off(this._onPickedNothing);\n this._currentAngleMeasurement = null;\n this._active = false;\n }\n\n /**\n * Resets this AngleMeasurementsMouseControl.\n *\n * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.\n *\n * Does nothing if the AngleMeasurementsMouseControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n\n this._destroyMarkerDiv()\n this._initMarkerDiv()\n\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._mouseState = MOUSE_FINDING_ORIGIN;\n }\n\n /**\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.\n *\n * @returns {null|AngleMeasurement}\n */\n get currentMeasurement() {\n return this._currentAngleMeasurement;\n }\n\n /**\n * Destroys this AngleMeasurementsMouseControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 381, + "__docId__": 382, "kind": "variable", "name": "MOUSE_FINDING_ORIGIN", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", @@ -5702,7 +5735,7 @@ "ignore": true }, { - "__docId__": 382, + "__docId__": 383, "kind": "variable", "name": "MOUSE_FINDING_CORNER", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", @@ -5723,7 +5756,7 @@ "ignore": true }, { - "__docId__": 383, + "__docId__": 384, "kind": "variable", "name": "MOUSE_FINDING_TARGET", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", @@ -5744,7 +5777,7 @@ "ignore": true }, { - "__docId__": 384, + "__docId__": 385, "kind": "class", "name": "AngleMeasurementsMouseControl", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js", @@ -5762,7 +5795,7 @@ ] }, { - "__docId__": 385, + "__docId__": 386, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5829,7 +5862,7 @@ ] }, { - "__docId__": 386, + "__docId__": 387, "kind": "member", "name": "_canvasToPagePos", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5847,7 +5880,7 @@ } }, { - "__docId__": 387, + "__docId__": 388, "kind": "member", "name": "pointerLens", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5864,7 +5897,7 @@ } }, { - "__docId__": 388, + "__docId__": 389, "kind": "member", "name": "_active", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5882,7 +5915,7 @@ } }, { - "__docId__": 389, + "__docId__": 390, "kind": "member", "name": "_mouseState", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5900,7 +5933,7 @@ } }, { - "__docId__": 390, + "__docId__": 391, "kind": "member", "name": "_currentAngleMeasurement", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5918,7 +5951,7 @@ } }, { - "__docId__": 391, + "__docId__": 392, "kind": "member", "name": "_onMouseHoverSurface", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5936,7 +5969,7 @@ } }, { - "__docId__": 392, + "__docId__": 393, "kind": "member", "name": "_onHoverNothing", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5954,7 +5987,7 @@ } }, { - "__docId__": 393, + "__docId__": 394, "kind": "member", "name": "_onPickedNothing", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5972,7 +6005,7 @@ } }, { - "__docId__": 394, + "__docId__": 395, "kind": "member", "name": "_onPickedSurface", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -5990,7 +6023,7 @@ } }, { - "__docId__": 395, + "__docId__": 396, "kind": "member", "name": "_onInputMouseDown", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6008,7 +6041,7 @@ } }, { - "__docId__": 396, + "__docId__": 397, "kind": "member", "name": "_onInputMouseUp", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6026,7 +6059,7 @@ } }, { - "__docId__": 397, + "__docId__": 398, "kind": "member", "name": "_snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6044,7 +6077,7 @@ } }, { - "__docId__": 398, + "__docId__": 399, "kind": "method", "name": "_initMarkerDiv", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6061,7 +6094,7 @@ "return": null }, { - "__docId__": 399, + "__docId__": 400, "kind": "member", "name": "markerDiv", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6078,7 +6111,7 @@ } }, { - "__docId__": 400, + "__docId__": 401, "kind": "method", "name": "_destroyMarkerDiv", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6095,7 +6128,7 @@ "return": null }, { - "__docId__": 401, + "__docId__": 402, "kind": "member", "name": "_markerDiv", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6113,7 +6146,7 @@ } }, { - "__docId__": 402, + "__docId__": 403, "kind": "method", "name": "_attachPlugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6146,7 +6179,7 @@ "return": null }, { - "__docId__": 403, + "__docId__": 404, "kind": "member", "name": "angleMeasurementsPlugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6165,7 +6198,7 @@ } }, { - "__docId__": 404, + "__docId__": 405, "kind": "member", "name": "plugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6184,7 +6217,7 @@ } }, { - "__docId__": 405, + "__docId__": 406, "kind": "get", "name": "active", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6216,7 +6249,7 @@ } }, { - "__docId__": 406, + "__docId__": 407, "kind": "set", "name": "snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6241,7 +6274,7 @@ ] }, { - "__docId__": 409, + "__docId__": 410, "kind": "get", "name": "snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6273,7 +6306,7 @@ } }, { - "__docId__": 410, + "__docId__": 411, "kind": "method", "name": "activate", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6288,7 +6321,7 @@ "return": null }, { - "__docId__": 422, + "__docId__": 423, "kind": "member", "name": "_onMouseHoverOff", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6306,7 +6339,7 @@ } }, { - "__docId__": 424, + "__docId__": 425, "kind": "method", "name": "deactivate", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6321,7 +6354,7 @@ "return": null }, { - "__docId__": 427, + "__docId__": 428, "kind": "method", "name": "reset", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6336,7 +6369,40 @@ "return": null }, { - "__docId__": 430, + "__docId__": 431, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.", + "lineNumber": 448, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|AngleMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "AngleMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 432, "kind": "method", "name": "destroy", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl", @@ -6346,23 +6412,23 @@ "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl#destroy", "access": "public", "description": "Destroys this AngleMeasurementsMouseControl.", - "lineNumber": 446, + "lineNumber": 455, "params": [], "return": null }, { - "__docId__": 431, + "__docId__": 433, "kind": "file", "name": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {AngleMeasurement} from \"./AngleMeasurement.js\";\nimport {AngleMeasurementsMouseControl} from \"./AngleMeasurementsMouseControl.js\";\n\n/**\n * {@link Viewer} plugin for measuring angles.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_angle_createWithMouse)\n *\n * * [[Example 1: Model with angle measurements](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_angle_modelWithMeasurements)]\n * * [[Example 2: Create angle measurements with mouse](https://xeokit.github.io/xeokit-sdk/examples/measurement/#angle_createWithMouse_snapping)]\n *\n * ## Overview\n *\n * * An {@link AngleMeasurement} shows the angle between two connected 3D line segments, given\n * as three positions on the surface(s) of one or more {@link Entity}s.\n * * As shown on the screen capture above, a AngleMeasurement has two wires that show the line segments, with a label that shows the angle between them.\n * * Create AngleMeasurements programmatically with {@link AngleMeasurementsPlugin#createMeasurement}.\n * * Create AngleMeasurements interactively using a {@link AngleMeasurementsControl}.\n * * Existing AngleMeasurements are registered by ID in {@link AngleMeasurementsPlugin#measurements}.\n * * Destroy AngleMeasurements using {@link AngleMeasurementsPlugin#destroyMeasurement}.\n * * Configure global measurement units and scale via {@link Metrics}, located at {@link Scene#metrics}\n *\n * ## Example 1: Creating AngleMeasurements Programmatically\n *\n * In our first example, we'll use an {@link XKTLoaderPlugin} to load a model, and then use a AngleMeasurementsPlugin to programmatically create two {@link AngleMeasurement}s.\n *\n * Note how each AngleMeasurement has ````origin````, ````corner```` and ````target````, which each indicate a 3D World-space\n * position on the surface of an {@link Entity}. These can be aon the same Entity, or on different Entitys.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_angle_modelWithMeasurements)]\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * const myMeasurement1 = angleMeasurements.createMeasurement({\n * id: \"myAngleMeasurement1\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [0.044, 5.998, 17.767]\n * },\n * corner: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [0.044, 5.998, 17.767]\n * },\n * target: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [4.738, 3.172, 17.768]\n * },\n * visible: true\n * });\n *\n * const myMeasurement2 = angleMeasurements.createMeasurement({\n * id: \"myAngleMeasurement2\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNr2\"],\n * worldPos: [0.457, 2.532, 17.766]\n * },\n * corner: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNr2\"],\n * worldPos: [0.457, 2.532, 17.766]\n * },\n * target: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [0.436, 0.001, 22.135]\n * },\n * visible: true\n * });\n * });\n * ````\n *\n * ## Example 2: Creating AngleMeasurements with Mouse Input\n *\n * In our second example, we'll use an {@link XKTLoaderPlugin} to load a model, then we'll use the AngleMeasurementsPlugin's {@link AngleMeasurementsTouchControl} to interactively create {@link AngleMeasurement}s with mouse or touch input.\n *\n * After we've activated the AngleMeasurementsControl, the first click on any {@link Entity} begins constructing a AngleMeasurement, fixing its\n * origin to that Entity. The next click on any Entity will fix the AngleMeasurement's corner, and the next click after\n * that will fix its target and complete the AngleMeasurement.\n *\n * The AngleMeasurementControl will then wait for the next click on any Entity, to begin constructing\n * another AngleMeasurement, and so on, until deactivated again.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#angle_createWithMouse_snapping)]\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * cconst angleMeasurementsMouseControl = new AngleMeasurementsMouseControl(angleMeasurements, {\n * pointerLens : new PointerLens(viewer)\n * })\n *\n * angleMeasurementsMouseControl.snapToVertex = true;\n * angleMeasurementsMouseControl.snapToEdge = true;\n *\n * angleMeasurementsMouseControl.activate();\n * ````\n *\n * ## Example 4: Attaching Mouse Handlers\n *\n * In our fourth example, we'll attach even handlers to our plugin, to catch when the user\n * hovers or right-clicks over our measurements.\n *\n * [[Run example](/examples/measurement/#angle_modelWithMeasurements)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * angleMeasurements.on(\"mouseOver\", (e) => {\n * e.measurement.setHighlighted(true);\n * });\n *\n * angleMeasurements.on(\"mouseLeave\", (e) => {\n * e.measurement.setHighlighted(false);\n * });\n *\n * angleMeasurements.on(\"contextMenu\", (e) => {\n * // Show context menu\n * e.event.preventDefault();\n * });\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * angleMeasurementsPlugin.createMeasurement({\n * id: \"angleMeasurement1\",\n * origin: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [0.4158603637281142, 2.5193106917110457, 17.79972838299403]\n * },\n * corner: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [0.41857741956197625,0.0987169929481646,17.799763071093395]\n * },\n * target: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [5.235526066859247, 0.11580773869801986, 17.824891550941565]\n * },\n * visible: true\n * });\n *\n * angleMeasurementsPlugin.createMeasurement({\n * id: \"angleMeasurement2\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNr2\"],\n * worldPos: [-0.00003814187850181838, 5.9996748076205115,17.79996871551525]\n * },\n * corner: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNqI\"],\n * worldPos: [-0.0005214119318139865, 3.1010044228517595, 17.787656604483363]\n *\n * },\n * target: {\n * entity: viewer.scene.objects[\"1s1jVhK8z0pgKYcr9jt7AB\"],\n * worldPos: [ 8.380657312957396, 3.1055697628459553, 17.799220108187185]\n * },\n * visible: true\n * });\n * });\n * ````\n *\n * ## Example 5: Creating AngleMeasurements with Touch Input\n *\n * In our fifth example, we'll show how to create angle measurements with touch input, with snapping\n * to the nearest vertex or edge. While creating the measurements, a long-touch when setting the\n * start, corner or end point will cause the point to snap to the nearest vertex or edge. A quick\n * touch-release will immediately set the point at the tapped position on the object surface.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#angle_createWithTouch_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsTouchControl} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * const angleMeasurements = new AngleMeasurementsPlugin(viewer);\n *\n * const angleMeasurementsTouchControl = new AngleMeasurementsTouchControl(angleMeasurements, {\n * pointerLens : new PointerLens(viewer),\n * snapToVertex: true,\n * snapToEdge: true\n * })\n *\n * angleMeasurementsTouchControl.activate();\n * ````\n */\nexport class AngleMeasurementsPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} [cfg] Plugin configuration.\n * @param {String} [cfg.id=\"AngleMeasurements\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.\n * @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.\n * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.\n * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).\n * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"AngleMeasurements\", viewer);\n\n this._container = cfg.container || document.body;\n\n this._defaultControl = null;\n\n this._measurements = {};\n\n this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : \"#00BBFF\";\n this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;\n this.zIndex = cfg.zIndex || 10000;\n\n this._onMouseOver = (event, measurement) => {\n this.fire(\"mouseOver\", {\n plugin: this,\n angleMeasurement: measurement,\n measurement,\n event\n });\n }\n\n this._onMouseLeave = (event, measurement) => {\n this.fire(\"mouseLeave\", {\n plugin: this,\n angleMeasurement: measurement,\n measurement,\n event\n });\n };\n\n this._onContextMenu = (event, measurement) => {\n this.fire(\"contextMenu\", {\n plugin: this,\n angleMeasurement: measurement,\n measurement,\n event\n });\n };\n }\n\n /**\n * Gets the plugin's HTML container element, if any.\n * @returns {*|HTMLElement|HTMLElement}\n */\n getContainerElement() {\n return this._container;\n }\n\n\n /**\n * @private\n */\n send(name, value) {\n\n }\n\n /**\n * Gets the default {@link AngleMeasurementsMouseControl}.\n *\n * @type {AngleMeasurementsMouseControl}\n * @deprecated\n */\n get control() {\n if (!this._defaultControl) {\n this._defaultControl = new AngleMeasurementsMouseControl(this, {});\n }\n return this._defaultControl;\n }\n\n /**\n * Gets the existing {@link AngleMeasurement}s, each mapped to its {@link AngleMeasurement#id}.\n *\n * @type {{String:AngleMeasurement}}\n */\n get measurements() {\n return this._measurements;\n }\n\n /**\n * Creates an {@link AngleMeasurement}.\n *\n * The AngleMeasurement is then registered by {@link AngleMeasurement#id} in {@link AngleMeasurementsPlugin#measurements}.\n *\n * @param {Object} params {@link AngleMeasurement} configuration.\n * @param {String} params.id Unique ID to assign to {@link AngleMeasurement#id}. The AngleMeasurement will be registered by this in {@link AngleMeasurementsPlugin#measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.\n * @param {Number[]} params.origin.worldPos Origin World-space 3D position.\n * @param {Entity} params.origin.entity Origin Entity.\n * @param {Number[]} params.corner.worldPos Corner World-space 3D position.\n * @param {Entity} params.corner.entity Corner Entity.\n * @param {Number[]} params.target.worldPos Target World-space 3D position.\n * @param {Entity} params.target.entity Target Entity.\n * @param {Boolean} [params.visible=true] Whether to initially show the {@link AngleMeasurement}.\n * @returns {AngleMeasurement} The new {@link AngleMeasurement}.\n */\n createMeasurement(params = {}) {\n if (this.viewer.scene.components[params.id]) {\n this.error(\"Viewer scene component with this ID already exists: \" + params.id);\n delete params.id;\n }\n const origin = params.origin;\n const corner = params.corner;\n const target = params.target;\n const measurement = new AngleMeasurement(this, {\n id: params.id,\n plugin: this,\n container: this._container,\n origin: {\n entity: origin.entity,\n worldPos: origin.worldPos\n },\n corner: {\n entity: corner.entity,\n worldPos: corner.worldPos\n },\n target: {\n entity: target.entity,\n worldPos: target.worldPos\n },\n\n visible: params.visible,\n originVisible: true,\n originWireVisible: true,\n cornerVisible: true,\n targetWireVisible: true,\n targetVisible: true,\n onMouseOver: this._onMouseOver,\n onMouseLeave: this._onMouseLeave,\n onContextMenu: this._onContextMenu\n });\n this._measurements[measurement.id] = measurement;\n measurement.on(\"destroyed\", () => {\n delete this._measurements[measurement.id];\n });\n measurement.clickable = true;\n this.fire(\"measurementCreated\", measurement);\n return measurement;\n }\n\n /**\n * Destroys a {@link AngleMeasurement}.\n *\n * @param {String} id ID of AngleMeasurement to destroy.\n */\n destroyMeasurement(id) {\n const measurement = this._measurements[id];\n if (!measurement) {\n this.log(\"AngleMeasurement not found: \" + id);\n return;\n }\n measurement.destroy();\n this.fire(\"measurementDestroyed\", measurement);\n }\n\n /**\n * Shows all or hides the angle label of each {@link AngleMeasurement}.\n *\n * @param {Boolean} labelsShown Whether or not to show the labels.\n */\n setLabelsShown(labelsShown) {\n for (const [key, measurement] of Object.entries(this.measurements)) {\n measurement.labelShown = labelsShown;\n }\n }\n\n /**\n * Destroys all {@link AngleMeasurement}s.\n */\n clear() {\n const ids = Object.keys(this._measurements);\n for (var i = 0, len = ids.length; i < len; i++) {\n this.destroyMeasurement(ids[i]);\n }\n }\n\n /**\n * Destroys this AngleMeasurementsPlugin.\n *\n * Destroys all {@link AngleMeasurement}s first.\n */\n destroy() {\n this.clear();\n super.destroy();\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 432, + "__docId__": 434, "kind": "class", "name": "AngleMeasurementsPlugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js", @@ -6380,7 +6446,7 @@ ] }, { - "__docId__": 433, + "__docId__": 435, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6487,7 +6553,7 @@ ] }, { - "__docId__": 434, + "__docId__": 436, "kind": "member", "name": "_container", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6505,7 +6571,7 @@ } }, { - "__docId__": 435, + "__docId__": 437, "kind": "member", "name": "_defaultControl", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6523,7 +6589,7 @@ } }, { - "__docId__": 436, + "__docId__": 438, "kind": "member", "name": "_measurements", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6541,7 +6607,7 @@ } }, { - "__docId__": 437, + "__docId__": 439, "kind": "member", "name": "defaultColor", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6558,7 +6624,7 @@ } }, { - "__docId__": 438, + "__docId__": 440, "kind": "member", "name": "defaultLabelsVisible", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6575,7 +6641,7 @@ } }, { - "__docId__": 439, + "__docId__": 441, "kind": "member", "name": "zIndex", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6592,7 +6658,7 @@ } }, { - "__docId__": 440, + "__docId__": 442, "kind": "member", "name": "_onMouseOver", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6610,7 +6676,7 @@ } }, { - "__docId__": 441, + "__docId__": 443, "kind": "member", "name": "_onMouseLeave", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6628,7 +6694,7 @@ } }, { - "__docId__": 442, + "__docId__": 444, "kind": "member", "name": "_onContextMenu", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6646,7 +6712,7 @@ } }, { - "__docId__": 443, + "__docId__": 445, "kind": "method", "name": "getContainerElement", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6676,7 +6742,7 @@ "params": [] }, { - "__docId__": 444, + "__docId__": 446, "kind": "method", "name": "send", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6705,7 +6771,7 @@ "return": null }, { - "__docId__": 445, + "__docId__": 447, "kind": "get", "name": "control", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6727,7 +6793,7 @@ } }, { - "__docId__": 447, + "__docId__": 449, "kind": "get", "name": "measurements", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6748,7 +6814,7 @@ } }, { - "__docId__": 448, + "__docId__": 450, "kind": "method", "name": "createMeasurement", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6869,7 +6935,7 @@ } }, { - "__docId__": 449, + "__docId__": 451, "kind": "method", "name": "destroyMeasurement", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6895,7 +6961,7 @@ "return": null }, { - "__docId__": 450, + "__docId__": 452, "kind": "method", "name": "setLabelsShown", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6921,7 +6987,7 @@ "return": null }, { - "__docId__": 451, + "__docId__": 453, "kind": "method", "name": "clear", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6936,7 +7002,7 @@ "return": null }, { - "__docId__": 452, + "__docId__": 454, "kind": "method", "name": "destroy", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js~AngleMeasurementsPlugin", @@ -6951,18 +7017,18 @@ "return": null }, { - "__docId__": 453, + "__docId__": 455, "kind": "file", "name": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", - "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {PointerCircle} from \"../../extras/PointerCircle/PointerCircle.js\";\nimport {AngleMeasurementsControl} from \"./AngleMeasurementsControl.js\";\n\n\nconst WAITING_FOR_ORIGIN_TOUCH_START = 0;\nconst WAITING_FOR_ORIGIN_QUICK_TOUCH_END = 1;\nconst WAITING_FOR_ORIGIN_LONG_TOUCH_END = 2;\n\nconst WAITING_FOR_CORNER_TOUCH_START = 3;\nconst WAITING_FOR_CORNER_QUICK_TOUCH_END = 4;\nconst WAITING_FOR_CORNER_LONG_TOUCH_END = 5;\n\nconst WAITING_FOR_TARGET_TOUCH_START = 6;\nconst WAITING_FOR_TARGET_QUICK_TOUCH_END = 7;\nconst WAITING_FOR_TARGET_LONG_TOUCH_END = 8;\n\nconst TOUCH_CANCELING = 7;\n\n/**\n * Creates {@link AngleMeasurement}s from touch input.\n *\n * See {@link AngleMeasurementsPlugin} for more info.\n *\n */\nexport class AngleMeasurementsTouchControl extends AngleMeasurementsControl {\n\n /**\n * Creates a AngleMeasurementsTouchControl bound to the given AngleMeasurementsPlugin.\n */\n constructor(angleMeasurementsPlugin, cfg = {}) {\n\n super(angleMeasurementsPlugin.viewer.scene);\n\n this.pointerLens = cfg.pointerLens;\n this.pointerCircle = new PointerCircle(angleMeasurementsPlugin.viewer);\n\n this._active = false;\n\n const markerDiv = document.createElement('div');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.margin = \"-200px -200px\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n\n this._currentAngleMeasurement = null;\n\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._longTouchTimeoutMs = 300;\n this._snapping = cfg.snapping !== false;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n this._attachPlugin(angleMeasurementsPlugin, cfg);\n }\n\n _attachPlugin(angleMeasurementsPlugin) {\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsTouchControl.\n * @type {AngleMeasurementsPlugin}\n */\n this.angleMeasurementsPlugin = angleMeasurementsPlugin;\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsTouchControl.\n * @type {AngleMeasurementsPlugin}\n */\n this.plugin = angleMeasurementsPlugin;\n }\n\n /** Gets if this AngleMeasurementsTouchControl is currently active, where it is responding to input.\n *\n * @returns {Boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this AngleMeasurementsTouchControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n const plugin = this.plugin;\n const scene = this.scene;\n const canvas = scene.canvas.canvas;\n const pointerLens = plugin.pointerLens;\n const pointerWorldPos = math.vec3();\n\n const touchTolerance = 20;\n\n let longTouchTimeout = null;\n\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n const touchStartCanvasPos = math.vec2();\n const touchMoveCanvasPos = math.vec2();\n const touchEndCanvasPos = math.vec2();\n\n let touchId = null;\n\n const disableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = false;\n }\n\n const enableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = true;\n }\n\n const cancel = () => {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n enableCameraNavigation();\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n }\n\n canvas.addEventListener(\"touchstart\", this._onCanvasTouchStart = (event) => {\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n touchStartCanvasPos.set([touchX, touchY]);\n touchMoveCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_TOUCH_START:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n cancel();\n return;\n }\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n pointerWorldPos.set(snapPickResult.worldPos);\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n pointerWorldPos.set(pickResult.worldPos);\n this.pointerCircle.start(pickResult.canvasPos);\n } else {\n return;\n }\n }\n longTouchTimeout = setTimeout(() => {\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n return; // Has moved\n }\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.cursorPos = touchStartCanvasPos;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n this.pointerLens.snapped = false;\n }\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.canvasPos;\n this.pointerLens.snapped = true;\n }\n // pointerWorldPos.set(snapPickResult.worldPos);\n if (!this._currentAngleMeasurement) {\n this._currentAngleMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n corner: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n } else {\n this._currentAngleMeasurement.origin.worldPos = pointerWorldPos;\n }\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n // if (this.pointerLens) {\n // this.pointerLens.cursorPos = pickResult.canvasPos;\n // this.pointerLens.snapped = false;\n // }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n disableCameraNavigation();\n }, this._longTouchTimeoutMs);\n this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;\n //console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END\")\n\n touchId = touch.identifier;\n\n break;\n\n case WAITING_FOR_CORNER_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.corner.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.corner.entity = snapPickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.corner.entity = pickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_CORNER_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n case WAITING_FOR_TARGET_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.target.entity = snapPickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.target.entity = pickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_TARGET_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n\n default:\n if (longTouchTimeout !== null) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchstart: this._touchState= default -> TOUCH_CANCELING\")\n return;\n }\n\n }, {passive: true});\n\n\n canvas.addEventListener(\"touchmove\", (event) => {\n\n this.pointerCircle.stop();\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1 || event.changedTouches.length !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n touchMoveCanvasPos.set([touchX, touchY]);\n\n let snapPickResult;\n let pickResult;\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && (snapPickResult.snapped)) {\n if (this.pointerLens) {\n this.pointerLens.snappedCanvasPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.origin.worldPos = snapPickResult.worldPos;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.origin.worldPos = pickResult.worldPos;\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n }\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n break;\n\n case WAITING_FOR_CORNER_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_CORNER -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentAngleMeasurement.corner.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n }\n }\n this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;\n break;\n\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentAngleMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n break;\n\n default:\n break;\n }\n }, {passive: true});\n\n canvas.addEventListener(\"touchend\", this._onCanvasTouchEnd = (event) => {\n\n this.pointerCircle.stop();\n\n const numChangedTouches = event.changedTouches.length;\n\n if (numChangedTouches !== 1) {\n return;\n }\n\n const touch = event.changedTouches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n\n touchEndCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos\n },\n corner: {\n worldPos: pickResult.worldPos\n },\n target: {\n worldPos: pickResult.worldPos\n }\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_CORNER_TOUCH_START\")\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentAngleMeasurement) {\n if (this.pointerLens) {\n this.pointerLens.snapped = false;\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (no measurement) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_CORNER_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_CORNER_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentAngleMeasurement || !this._currentAngleMeasurement.targetVisible) {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._currentAngleMeasurement.clickable = true;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n }\n\n }, {passive: true});\n\n this._active = true;\n }\n\n /**\n * Deactivates this AngleMeasurementsTouchControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.plugin.pointerLens) {\n this.plugin.pointerLens.visible = false;\n }\n this.reset();\n const canvas = this.plugin.viewer.scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._onCanvasTouchStart);\n canvas.removeEventListener(\"touchend\", this._onCanvasTouchEnd);\n if (this._currentAngleMeasurement) {\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._active = false;\n this.plugin.viewer.cameraControl.active = true;\n }\n\n /**\n * Resets this AngleMeasurementsTouchControl.\n *\n * Destroys any {@link AngleMeasurement} under construction.\n *\n * Does nothing if the AngleMeasurementsTouchControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n if (this._currentAngleMeasurement) {\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n }\n\n /**\n * Destroys this AngleMeasurementsTouchControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", + "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {PointerCircle} from \"../../extras/PointerCircle/PointerCircle.js\";\nimport {AngleMeasurementsControl} from \"./AngleMeasurementsControl.js\";\n\n\nconst WAITING_FOR_ORIGIN_TOUCH_START = 0;\nconst WAITING_FOR_ORIGIN_QUICK_TOUCH_END = 1;\nconst WAITING_FOR_ORIGIN_LONG_TOUCH_END = 2;\n\nconst WAITING_FOR_CORNER_TOUCH_START = 3;\nconst WAITING_FOR_CORNER_QUICK_TOUCH_END = 4;\nconst WAITING_FOR_CORNER_LONG_TOUCH_END = 5;\n\nconst WAITING_FOR_TARGET_TOUCH_START = 6;\nconst WAITING_FOR_TARGET_QUICK_TOUCH_END = 7;\nconst WAITING_FOR_TARGET_LONG_TOUCH_END = 8;\n\nconst TOUCH_CANCELING = 7;\n\n/**\n * Creates {@link AngleMeasurement}s from touch input.\n *\n * See {@link AngleMeasurementsPlugin} for more info.\n *\n */\nexport class AngleMeasurementsTouchControl extends AngleMeasurementsControl {\n\n /**\n * Creates a AngleMeasurementsTouchControl bound to the given AngleMeasurementsPlugin.\n */\n constructor(angleMeasurementsPlugin, cfg = {}) {\n\n super(angleMeasurementsPlugin.viewer.scene);\n\n this.pointerLens = cfg.pointerLens;\n this.pointerCircle = new PointerCircle(angleMeasurementsPlugin.viewer);\n\n this._active = false;\n\n const markerDiv = document.createElement('div');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.margin = \"-200px -200px\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n\n this._currentAngleMeasurement = null;\n\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._longTouchTimeoutMs = 300;\n this._snapping = cfg.snapping !== false;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n this._attachPlugin(angleMeasurementsPlugin, cfg);\n }\n\n _attachPlugin(angleMeasurementsPlugin) {\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsTouchControl.\n * @type {AngleMeasurementsPlugin}\n */\n this.angleMeasurementsPlugin = angleMeasurementsPlugin;\n\n /**\n * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsTouchControl.\n * @type {AngleMeasurementsPlugin}\n */\n this.plugin = angleMeasurementsPlugin;\n }\n\n /** Gets if this AngleMeasurementsTouchControl is currently active, where it is responding to input.\n *\n * @returns {Boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that\n * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this AngleMeasurementsTouchControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n const plugin = this.plugin;\n const scene = this.scene;\n const canvas = scene.canvas.canvas;\n const pointerLens = plugin.pointerLens;\n const pointerWorldPos = math.vec3();\n\n const touchTolerance = 20;\n\n let longTouchTimeout = null;\n\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n const touchStartCanvasPos = math.vec2();\n const touchMoveCanvasPos = math.vec2();\n const touchEndCanvasPos = math.vec2();\n\n let touchId = null;\n\n const disableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = false;\n }\n\n const enableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = true;\n }\n\n const cancel = () => {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n enableCameraNavigation();\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n }\n\n canvas.addEventListener(\"touchstart\", this._onCanvasTouchStart = (event) => {\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n touchStartCanvasPos.set([touchX, touchY]);\n touchMoveCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_TOUCH_START:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n cancel();\n return;\n }\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n pointerWorldPos.set(snapPickResult.worldPos);\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n pointerWorldPos.set(pickResult.worldPos);\n this.pointerCircle.start(pickResult.canvasPos);\n } else {\n return;\n }\n }\n longTouchTimeout = setTimeout(() => {\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n return; // Has moved\n }\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.cursorPos = touchStartCanvasPos;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n this.pointerLens.snapped = false;\n }\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.canvasPos;\n this.pointerLens.snapped = true;\n }\n // pointerWorldPos.set(snapPickResult.worldPos);\n if (!this._currentAngleMeasurement) {\n this._currentAngleMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n corner: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n } else {\n this._currentAngleMeasurement.origin.worldPos = pointerWorldPos;\n }\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n // if (this.pointerLens) {\n // this.pointerLens.cursorPos = pickResult.canvasPos;\n // this.pointerLens.snapped = false;\n // }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n disableCameraNavigation();\n }, this._longTouchTimeoutMs);\n this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;\n //console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END\")\n\n touchId = touch.identifier;\n\n break;\n\n case WAITING_FOR_CORNER_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.corner.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.corner.entity = snapPickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.corner.entity = pickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_CORNER_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n case WAITING_FOR_TARGET_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.target.entity = snapPickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.target.entity = pickResult.entity;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementStart\", this._currentAngleMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_TARGET_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n\n default:\n if (longTouchTimeout !== null) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchstart: this._touchState= default -> TOUCH_CANCELING\")\n return;\n }\n\n }, {passive: true});\n\n\n canvas.addEventListener(\"touchmove\", (event) => {\n\n this.pointerCircle.stop();\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1 || event.changedTouches.length !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n touchMoveCanvasPos.set([touchX, touchY]);\n\n let snapPickResult;\n let pickResult;\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && (snapPickResult.snapped)) {\n if (this.pointerLens) {\n this.pointerLens.snappedCanvasPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentAngleMeasurement.origin.worldPos = snapPickResult.worldPos;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n pointerWorldPos.set(pickResult.worldPos);\n this._currentAngleMeasurement.origin.worldPos = pickResult.worldPos;\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n }\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n break;\n\n case WAITING_FOR_CORNER_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_CORNER -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentAngleMeasurement.corner.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n }\n }\n this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;\n break;\n\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentAngleMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n break;\n\n default:\n break;\n }\n }, {passive: true});\n\n canvas.addEventListener(\"touchend\", this._onCanvasTouchEnd = (event) => {\n\n this.pointerCircle.stop();\n\n const numChangedTouches = event.changedTouches.length;\n\n if (numChangedTouches !== 1) {\n return;\n }\n\n const touch = event.changedTouches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n\n touchEndCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos\n },\n corner: {\n worldPos: pickResult.worldPos\n },\n target: {\n worldPos: pickResult.worldPos\n }\n });\n this._currentAngleMeasurement.clickable = false;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = false;\n this._currentAngleMeasurement.cornerVisible = false;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_CORNER_TOUCH_START\")\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentAngleMeasurement) {\n if (this.pointerLens) {\n this.pointerLens.snapped = false;\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (no measurement) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_CORNER_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_CORNER_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = false;\n this._currentAngleMeasurement.targetVisible = false;\n this._currentAngleMeasurement.targetWireVisible = false;\n this._currentAngleMeasurement.angleVisible = false;\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_CORNER_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;\n this._currentAngleMeasurement.originVisible = true;\n this._currentAngleMeasurement.originWireVisible = true;\n this._currentAngleMeasurement.cornerVisible = true;\n this._currentAngleMeasurement.cornerWireVisible = true;\n this._currentAngleMeasurement.targetVisible = true;\n this._currentAngleMeasurement.targetWireVisible = true;\n this._currentAngleMeasurement.angleVisible = true;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n } else {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentAngleMeasurement || !this._currentAngleMeasurement.targetVisible) {\n if (this._currentAngleMeasurement) {\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._currentAngleMeasurement.clickable = true;\n this.angleMeasurementsPlugin.fire(\"measurementEnd\", this._currentAngleMeasurement);\n this._currentAngleMeasurement = null;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n }\n\n }, {passive: true});\n\n this._active = true;\n }\n\n /**\n * Deactivates this AngleMeasurementsTouchControl, making it unresponsive to input.\n *\n * Destroys any {@link AngleMeasurement} under construction.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.plugin.pointerLens) {\n this.plugin.pointerLens.visible = false;\n }\n this.reset();\n const canvas = this.plugin.viewer.scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._onCanvasTouchStart);\n canvas.removeEventListener(\"touchend\", this._onCanvasTouchEnd);\n if (this._currentAngleMeasurement) {\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n this._active = false;\n this.plugin.viewer.cameraControl.active = true;\n }\n\n /**\n * Resets this AngleMeasurementsTouchControl.\n *\n * Destroys any {@link AngleMeasurement} under construction.\n *\n * Does nothing if the AngleMeasurementsTouchControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n if (this._currentAngleMeasurement) {\n this.angleMeasurementsPlugin.fire(\"measurementCancel\", this._currentAngleMeasurement);\n this._currentAngleMeasurement.destroy();\n this._currentAngleMeasurement = null;\n }\n }\n\n /**\n * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.\n *\n * @returns {null|AngleMeasurement}\n */\n get currentMeasurement() {\n return this._currentAngleMeasurement;\n }\n\n /**\n * Destroys this AngleMeasurementsTouchControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 454, + "__docId__": 456, "kind": "variable", "name": "WAITING_FOR_ORIGIN_TOUCH_START", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -6983,7 +7049,7 @@ "ignore": true }, { - "__docId__": 455, + "__docId__": 457, "kind": "variable", "name": "WAITING_FOR_ORIGIN_QUICK_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7004,7 +7070,7 @@ "ignore": true }, { - "__docId__": 456, + "__docId__": 458, "kind": "variable", "name": "WAITING_FOR_ORIGIN_LONG_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7025,7 +7091,7 @@ "ignore": true }, { - "__docId__": 457, + "__docId__": 459, "kind": "variable", "name": "WAITING_FOR_CORNER_TOUCH_START", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7046,7 +7112,7 @@ "ignore": true }, { - "__docId__": 458, + "__docId__": 460, "kind": "variable", "name": "WAITING_FOR_CORNER_QUICK_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7067,7 +7133,7 @@ "ignore": true }, { - "__docId__": 459, + "__docId__": 461, "kind": "variable", "name": "WAITING_FOR_CORNER_LONG_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7088,7 +7154,7 @@ "ignore": true }, { - "__docId__": 460, + "__docId__": 462, "kind": "variable", "name": "WAITING_FOR_TARGET_TOUCH_START", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7109,7 +7175,7 @@ "ignore": true }, { - "__docId__": 461, + "__docId__": 463, "kind": "variable", "name": "WAITING_FOR_TARGET_QUICK_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7130,7 +7196,7 @@ "ignore": true }, { - "__docId__": 462, + "__docId__": 464, "kind": "variable", "name": "WAITING_FOR_TARGET_LONG_TOUCH_END", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7151,7 +7217,7 @@ "ignore": true }, { - "__docId__": 463, + "__docId__": 465, "kind": "variable", "name": "TOUCH_CANCELING", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7172,7 +7238,7 @@ "ignore": true }, { - "__docId__": 464, + "__docId__": 466, "kind": "class", "name": "AngleMeasurementsTouchControl", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js", @@ -7190,7 +7256,7 @@ ] }, { - "__docId__": 465, + "__docId__": 467, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7203,7 +7269,7 @@ "lineNumber": 31 }, { - "__docId__": 466, + "__docId__": 468, "kind": "member", "name": "pointerLens", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7220,7 +7286,7 @@ } }, { - "__docId__": 467, + "__docId__": 469, "kind": "member", "name": "pointerCircle", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7237,7 +7303,7 @@ } }, { - "__docId__": 468, + "__docId__": 470, "kind": "member", "name": "_active", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7255,7 +7321,7 @@ } }, { - "__docId__": 469, + "__docId__": 471, "kind": "member", "name": "markerDiv", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7272,7 +7338,7 @@ } }, { - "__docId__": 470, + "__docId__": 472, "kind": "member", "name": "_currentAngleMeasurement", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7290,7 +7356,7 @@ } }, { - "__docId__": 471, + "__docId__": 473, "kind": "member", "name": "_onCanvasTouchStart", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7308,7 +7374,7 @@ } }, { - "__docId__": 472, + "__docId__": 474, "kind": "member", "name": "_onCanvasTouchEnd", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7326,7 +7392,7 @@ } }, { - "__docId__": 473, + "__docId__": 475, "kind": "member", "name": "_longTouchTimeoutMs", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7344,7 +7410,7 @@ } }, { - "__docId__": 474, + "__docId__": 476, "kind": "member", "name": "_snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7362,7 +7428,7 @@ } }, { - "__docId__": 475, + "__docId__": 477, "kind": "member", "name": "_touchState", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7380,7 +7446,7 @@ } }, { - "__docId__": 476, + "__docId__": 478, "kind": "method", "name": "_attachPlugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7404,7 +7470,7 @@ "return": null }, { - "__docId__": 477, + "__docId__": 479, "kind": "member", "name": "angleMeasurementsPlugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7423,7 +7489,7 @@ } }, { - "__docId__": 478, + "__docId__": 480, "kind": "member", "name": "plugin", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7442,7 +7508,7 @@ } }, { - "__docId__": 479, + "__docId__": 481, "kind": "get", "name": "active", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7474,7 +7540,7 @@ } }, { - "__docId__": 480, + "__docId__": 482, "kind": "set", "name": "snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7499,7 +7565,7 @@ ] }, { - "__docId__": 483, + "__docId__": 485, "kind": "get", "name": "snapping", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7531,7 +7597,7 @@ } }, { - "__docId__": 484, + "__docId__": 486, "kind": "method", "name": "activate", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7546,7 +7612,7 @@ "return": null }, { - "__docId__": 522, + "__docId__": 524, "kind": "method", "name": "deactivate", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7561,7 +7627,7 @@ "return": null }, { - "__docId__": 525, + "__docId__": 527, "kind": "method", "name": "reset", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7576,7 +7642,40 @@ "return": null }, { - "__docId__": 527, + "__docId__": 529, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.", + "lineNumber": 916, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|AngleMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "AngleMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 530, "kind": "method", "name": "destroy", "memberof": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl", @@ -7586,34 +7685,34 @@ "longname": "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl#destroy", "access": "public", "description": "Destroys this AngleMeasurementsTouchControl.", - "lineNumber": 914, + "lineNumber": 923, "params": [], "return": null }, { - "__docId__": 528, + "__docId__": 531, "kind": "file", "name": "src/plugins/AngleMeasurementsPlugin/index.js", "content": "export * from \"./AngleMeasurementsPlugin.js\";\nexport * from \"./AngleMeasurementsControl.js\";\nexport * from \"./AngleMeasurementsMouseControl.js\";\nexport * from \"./AngleMeasurementsTouchControl.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AngleMeasurementsPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AngleMeasurementsPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 529, + "__docId__": 532, "kind": "file", "name": "src/plugins/AnnotationsPlugin/Annotation.js", "content": "import {Marker} from \"../../viewer/scene/marker/Marker.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\n\n/**\n * A {@link Marker} with an HTML label attached to it, managed by an {@link AnnotationsPlugin}.\n *\n * See {@link AnnotationsPlugin} for more info.\n */\nclass Annotation extends Marker {\n\n /**\n * @private\n */\n constructor(owner, cfg) {\n\n super(owner, cfg);\n\n /**\n * The {@link AnnotationsPlugin} this Annotation was created by.\n * @type {AnnotationsPlugin}\n */\n this.plugin = cfg.plugin;\n\n this._container = cfg.container;\n if (!this._container) {\n throw \"config missing: container\";\n }\n\n if ((!cfg.markerElement) && (!cfg.markerHTML)) {\n throw \"config missing: need either markerElement or markerHTML\";\n }\n if ((!cfg.labelElement) && (!cfg.labelHTML)) {\n throw \"config missing: need either labelElement or labelHTML\";\n }\n\n this._htmlDirty = false;\n\n if (cfg.markerElement) {\n this._marker = cfg.markerElement;\n this._marker.addEventListener(\"click\", this._onMouseClickedExternalMarker = () => {\n this.plugin.fire(\"markerClicked\", this);\n });\n this._marker.addEventListener(\"mouseenter\", this._onMouseEnterExternalMarker = () => {\n this.plugin.fire(\"markerMouseEnter\", this);\n });\n this._marker.addEventListener(\"mouseleave\", this._onMouseLeaveExternalMarker = () => {\n this.plugin.fire(\"markerMouseLeave\", this);\n });\n this._markerExternal = true; // Don't destroy marker when destroying Annotation\n } else {\n this._markerHTML = cfg.markerHTML;\n this._htmlDirty = true;\n this._markerExternal = false;\n }\n\n if (cfg.labelElement) {\n this._label = cfg.labelElement;\n this._labelExternal = true; // Don't destroy marker when destroying Annotation\n } else {\n this._labelHTML = cfg.labelHTML;\n this._htmlDirty = true;\n this._labelExternal = false;\n }\n\n this._markerShown = !!cfg.markerShown;\n this._labelShown = !!cfg.labelShown;\n this._values = cfg.values || {};\n this._layoutDirty = true;\n this._visibilityDirty = true;\n\n this._buildHTML();\n\n this._onTick = this.scene.on(\"tick\", () => {\n if (this._htmlDirty) {\n this._buildHTML();\n this._htmlDirty = false;\n this._layoutDirty = true;\n this._visibilityDirty = true;\n }\n if (this._layoutDirty || this._visibilityDirty) {\n if (this._markerShown || this._labelShown) {\n this._updatePosition();\n this._layoutDirty = false;\n }\n }\n if (this._visibilityDirty) {\n this._marker.style.visibility = (this.visible && this._markerShown) ? \"visible\" : \"hidden\";\n this._label.style.visibility = (this.visible && this._markerShown && this._labelShown) ? \"visible\" : \"hidden\";\n this._visibilityDirty = false;\n }\n });\n\n this.on(\"canvasPos\", () => {\n this._layoutDirty = true;\n });\n\n this.on(\"visible\", () => {\n this._visibilityDirty = true;\n });\n\n this.setMarkerShown(cfg.markerShown !== false);\n this.setLabelShown(cfg.labelShown);\n\n /**\n * Optional World-space position for {@link Camera#eye}, used when this Annotation is associated with a {@link Camera} position.\n *\n * Undefined by default.\n *\n * @type {Number[]} Eye position.\n */\n this.eye = cfg.eye ? cfg.eye.slice() : null;\n\n /**\n * Optional World-space position for {@link Camera#look}, used when this Annotation is associated with a {@link Camera} position.\n *\n * Undefined by default.\n *\n * @type {Number[]} The \"look\" vector.\n */\n this.look = cfg.look ? cfg.look.slice() : null;\n\n /**\n * Optional World-space position for {@link Camera#up}, used when this Annotation is associated with a {@link Camera} position.\n *\n * Undefined by default.\n *\n * @type {Number[]} The \"up\" vector.\n */\n this.up = cfg.up ? cfg.up.slice() : null;\n\n /**\n * Optional projection type for {@link Camera#projection}, used when this Annotation is associated with a {@link Camera} position.\n *\n * Undefined by default.\n *\n * @type {String} The projection type - \"perspective\" or \"ortho\"..\n */\n this.projection = cfg.projection;\n }\n\n /**\n * @private\n */\n _buildHTML() {\n if (!this._markerExternal) {\n if (this._marker) {\n this._container.removeChild(this._marker);\n this._marker = null;\n }\n let markerHTML = this._markerHTML || \"

\"; // Make marker\n if (utils.isArray(markerHTML)) {\n markerHTML = markerHTML.join(\"\");\n }\n markerHTML = this._renderTemplate(markerHTML.trim());\n const markerFragment = document.createRange().createContextualFragment(markerHTML);\n this._marker = markerFragment.firstChild;\n this._container.appendChild(this._marker);\n this._marker.style.visibility = this._markerShown ? \"visible\" : \"hidden\";\n this._marker.addEventListener(\"click\", () => {\n this.plugin.fire(\"markerClicked\", this);\n });\n this._marker.addEventListener(\"mouseenter\", () => {\n this.plugin.fire(\"markerMouseEnter\", this);\n });\n this._marker.addEventListener(\"mouseleave\", () => {\n this.plugin.fire(\"markerMouseLeave\", this);\n });\n this._marker.addEventListener('wheel', (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel', event));\n });\n }\n if (!this._labelExternal) {\n if (this._label) {\n this._container.removeChild(this._label);\n this._label = null;\n }\n let labelHTML = this._labelHTML || \"

\"; // Make label\n if (utils.isArray(labelHTML)) {\n labelHTML = labelHTML.join(\"\");\n }\n labelHTML = this._renderTemplate(labelHTML.trim());\n const labelFragment = document.createRange().createContextualFragment(labelHTML);\n this._label = labelFragment.firstChild;\n this._container.appendChild(this._label);\n this._label.style.visibility = (this._markerShown && this._labelShown) ? \"visible\" : \"hidden\";\n this._label.addEventListener('wheel', (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel', event));\n });\n }\n }\n\n /**\n * @private\n */\n _updatePosition() {\n const boundary = this.scene.canvas.boundary;\n const left = boundary[0];\n const top = boundary[1];\n const canvasPos = this.canvasPos;\n this._marker.style.left = (Math.floor(left + canvasPos[0]) - 12) + \"px\";\n this._marker.style.top = (Math.floor(top + canvasPos[1]) - 12) + \"px\";\n this._marker.style[\"z-index\"] = 90005 + Math.floor(this._viewPos[2]) + 1;\n const offsetX = 20;\n const offsetY = -17;\n this._label.style.left = 20 + Math.floor(left + canvasPos[0] + offsetX) + \"px\";\n this._label.style.top = Math.floor(top + canvasPos[1] + offsetY) + \"px\";\n this._label.style[\"z-index\"] = 90005 + Math.floor(this._viewPos[2]) + 1;\n }\n\n /**\n * @private\n */\n _renderTemplate(template) {\n for (var key in this._values) {\n if (this._values.hasOwnProperty(key)) {\n const value = this._values[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n }\n }\n return template;\n }\n\n /**\n * Sets whether or not to show this Annotation's marker.\n *\n * The marker shows the Annotation's position.\n *\n * The marker is only visible when both this property and {@link Annotation#visible} are ````true````.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @param {Boolean} shown Whether to show the marker.\n */\n setMarkerShown(shown) {\n shown = !!shown;\n if (this._markerShown === shown) {\n return;\n }\n this._markerShown = shown;\n this._visibilityDirty = true;\n }\n\n /**\n * Gets whether or not to show this Annotation's marker.\n *\n * The marker shows the Annotation's position.\n *\n * The marker is only visible when both this property and {@link Annotation#visible} are ````true````.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @returns {Boolean} Whether to show the marker.\n */\n getMarkerShown() {\n return this._markerShown;\n }\n\n /**\n * Sets whether or not to show this Annotation's label.\n *\n * The label is only visible when both this property and {@link Annotation#visible} are ````true````.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @param {Boolean} shown Whether to show the label.\n */\n setLabelShown(shown) {\n shown = !!shown;\n if (this._labelShown === shown) {\n return;\n }\n this._labelShown = shown;\n this._visibilityDirty = true;\n }\n\n /**\n * Gets whether or not to show this Annotation's label.\n *\n * The label is only visible when both this property and {@link Annotation#visible} are ````true````.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @returns {Boolean} Whether to show the label.\n */\n getLabelShown() {\n return this._labelShown;\n }\n\n /**\n * Sets the value of a field within the HTML templates for either the Annotation's marker or label.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @param {String} key Identifies the field.\n * @param {String} value The field's value.\n */\n setField(key, value) {\n this._values[key] = value || \"\";\n this._htmlDirty = true;\n }\n\n /**\n * Gets the value of a field within the HTML templates for either the Annotation's marker or label.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @param {String} key Identifies the field.\n * @returns {String} The field's value.\n */\n getField(key) {\n return this._values[key];\n }\n\n /**\n * Sets values for multiple placeholders within the Annotation's HTML templates for marker and label.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @param {{String:(String|Number)}} values Map of field values.\n */\n setValues(values) {\n for (var key in values) {\n if (values.hasOwnProperty(key)) {\n const value = values[key];\n this.setField(key, value);\n }\n }\n }\n\n /**\n * Gets the values that were set for the placeholders within this Annotation's HTML marker and label templates.\n *\n * See {@link AnnotationsPlugin} for more info.\n *\n * @RETURNS {{String:(String|Number)}} Map of field values.\n */\n getValues() {\n return this._values;\n }\n\n /**\n * Destroys this Annotation.\n *\n * You can also call {@link AnnotationsPlugin#destroyAnnotation}.\n */\n destroy() {\n if (this._marker) {\n if (!this._markerExternal) {\n this._marker.parentNode.removeChild(this._marker);\n } else {\n this._marker.removeEventListener(\"click\", this._onMouseClickedExternalMarker);\n this._marker.removeEventListener(\"mouseenter\", this._onMouseEnterExternalMarker);\n this._marker.removeEventListener(\"mouseleave\", this._onMouseLeaveExternalMarker);\n this._marker = null;\n }\n }\n if (this._label) {\n if (!this._labelExternal) {\n this._label.parentNode.removeChild(this._label);\n }\n this._label = null;\n }\n this.scene.off(this._onTick);\n super.destroy();\n }\n}\n\nexport {Annotation};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AnnotationsPlugin/Annotation.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AnnotationsPlugin/Annotation.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 530, + "__docId__": 533, "kind": "class", "name": "Annotation", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js", @@ -7631,7 +7730,7 @@ ] }, { - "__docId__": 531, + "__docId__": 534, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7645,7 +7744,7 @@ "ignore": true }, { - "__docId__": 532, + "__docId__": 535, "kind": "member", "name": "plugin", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7664,7 +7763,7 @@ } }, { - "__docId__": 533, + "__docId__": 536, "kind": "member", "name": "_container", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7682,7 +7781,7 @@ } }, { - "__docId__": 534, + "__docId__": 537, "kind": "member", "name": "_htmlDirty", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7700,7 +7799,7 @@ } }, { - "__docId__": 535, + "__docId__": 538, "kind": "member", "name": "_marker", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7718,7 +7817,7 @@ } }, { - "__docId__": 536, + "__docId__": 539, "kind": "member", "name": "_markerExternal", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7736,7 +7835,7 @@ } }, { - "__docId__": 537, + "__docId__": 540, "kind": "member", "name": "_markerHTML", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7754,7 +7853,7 @@ } }, { - "__docId__": 540, + "__docId__": 543, "kind": "member", "name": "_label", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7772,7 +7871,7 @@ } }, { - "__docId__": 541, + "__docId__": 544, "kind": "member", "name": "_labelExternal", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7790,7 +7889,7 @@ } }, { - "__docId__": 542, + "__docId__": 545, "kind": "member", "name": "_labelHTML", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7808,7 +7907,7 @@ } }, { - "__docId__": 545, + "__docId__": 548, "kind": "member", "name": "_markerShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7826,7 +7925,7 @@ } }, { - "__docId__": 546, + "__docId__": 549, "kind": "member", "name": "_labelShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7844,7 +7943,7 @@ } }, { - "__docId__": 547, + "__docId__": 550, "kind": "member", "name": "_values", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7862,7 +7961,7 @@ } }, { - "__docId__": 548, + "__docId__": 551, "kind": "member", "name": "_layoutDirty", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7880,7 +7979,7 @@ } }, { - "__docId__": 549, + "__docId__": 552, "kind": "member", "name": "_visibilityDirty", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7898,7 +7997,7 @@ } }, { - "__docId__": 550, + "__docId__": 553, "kind": "member", "name": "_onTick", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7916,7 +8015,7 @@ } }, { - "__docId__": 558, + "__docId__": 561, "kind": "member", "name": "eye", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7935,7 +8034,7 @@ } }, { - "__docId__": 559, + "__docId__": 562, "kind": "member", "name": "look", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7954,7 +8053,7 @@ } }, { - "__docId__": 560, + "__docId__": 563, "kind": "member", "name": "up", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7973,7 +8072,7 @@ } }, { - "__docId__": 561, + "__docId__": 564, "kind": "member", "name": "projection", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -7992,7 +8091,7 @@ } }, { - "__docId__": 562, + "__docId__": 565, "kind": "method", "name": "_buildHTML", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8008,7 +8107,7 @@ "return": null }, { - "__docId__": 567, + "__docId__": 570, "kind": "method", "name": "_updatePosition", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8024,7 +8123,7 @@ "return": null }, { - "__docId__": 568, + "__docId__": 571, "kind": "method", "name": "_renderTemplate", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8051,7 +8150,7 @@ } }, { - "__docId__": 569, + "__docId__": 572, "kind": "method", "name": "setMarkerShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8077,7 +8176,7 @@ "return": null }, { - "__docId__": 572, + "__docId__": 575, "kind": "method", "name": "getMarkerShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8105,7 +8204,7 @@ "params": [] }, { - "__docId__": 573, + "__docId__": 576, "kind": "method", "name": "setLabelShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8131,7 +8230,7 @@ "return": null }, { - "__docId__": 576, + "__docId__": 579, "kind": "method", "name": "getLabelShown", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8159,7 +8258,7 @@ "params": [] }, { - "__docId__": 577, + "__docId__": 580, "kind": "method", "name": "setField", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8195,7 +8294,7 @@ "return": null }, { - "__docId__": 579, + "__docId__": 582, "kind": "method", "name": "getField", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8234,7 +8333,7 @@ } }, { - "__docId__": 580, + "__docId__": 583, "kind": "method", "name": "setValues", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8260,7 +8359,7 @@ "return": null }, { - "__docId__": 581, + "__docId__": 584, "kind": "method", "name": "getValues", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8285,7 +8384,7 @@ } }, { - "__docId__": 582, + "__docId__": 585, "kind": "method", "name": "destroy", "memberof": "src/plugins/AnnotationsPlugin/Annotation.js~Annotation", @@ -8300,18 +8399,18 @@ "return": null }, { - "__docId__": 585, + "__docId__": 588, "kind": "file", "name": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {Annotation} from \"./Annotation.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\n\n/**\n * {@link Viewer} plugin that creates {@link Annotation}s.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_clickFlyToPosition)\n *\n * * [[Example 1: Create annotations with mouse](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_createWithMouse)]\n * * [[Example 2: Click annotations to toggle labels](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_clickShowLabels)]\n * * [[Example 3: Hover annotations to show labels](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_hoverShowLabels)]\n * * [[Example 4: Click annotations to fly to viewpoint](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_clickFlyToPosition)]\n * * [[Example 5: Create Annotations with externally-created elements](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_externalElements)]\n *\n * ## Overview\n *\n * * An {@link Annotation} is a 3D position with a label attached.\n * * Annotations render themselves with HTML elements that float over the canvas; customize the appearance of\n * individual Annotations using HTML template; configure default appearance by setting templates on the AnnotationsPlugin.\n * * Dynamically insert data values into each Annotation's HTML templates; configure default values on the AnnotationsPlugin.\n * * Optionally configure Annotation with externally-created DOM elements for markers and labels; these override templates and data values.\n * * Optionally configure Annotations to hide themselves whenever occluded by {@link Entity}s.\n * * Optionally configure each Annotation with a position we can jump or fly the {@link Camera} to.\n *\n * ## Example 1: Loading a model and creating an annotation\n *\n * In the example below, we'll use an {@link XKTLoaderPlugin} to load a model, and an AnnotationsPlugin\n * to create an {@link Annotation} on it.\n *\n * We'll configure the AnnotationsPlugin with default HTML templates for each Annotation's position (its \"marker\") and\n * label, along with some default data values to insert into them.\n *\n * When we create our Annotation, we'll give it some specific data values to insert into the templates, overriding some of\n * the defaults we configured on the plugin. Note the correspondence between the placeholders in the templates\n * and the keys in the values map.\n *\n * We'll also configure the Annotation to hide itself whenever it's position is occluded by any {@link Entity}s (this is default behavior). The\n * {@link Scene} periodically occlusion-tests all Annotations on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * Finally, we'll query the Annotation's position occlusion/visibility status, and subscribe to change events on those properties.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_clickShowLabels)]\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin,AnnotationsPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const annotations = new AnnotationsPlugin(viewer, {\n *\n * // Default HTML template for marker position\n * markerHTML: \"
{{glyph}}
\",\n *\n * // Default HTML template for label\n * labelHTML: \"
\" +\n * \"
{{title}}
{{description}}
\",\n *\n * // Default values to insert into the marker and label templates\n * values: {\n * markerBGColor: \"red\",\n * labelBGColor: \"red\",\n * glyph: \"X\",\n * title: \"Untitled\",\n * description: \"No description\"\n * }\n * });\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/geometry.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * const entity = viewer.scene.meshes[\"\"];\n *\n * // Create an annotation\n * const myAnnotation1 = annotations.createAnnotation({\n *\n * id: \"myAnnotation\",\n *\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"], // Optional, associate with an Entity\n *\n * worldPos: [0, 0, 0], // 3D World-space position\n *\n * occludable: true, // Optional, default, makes Annotation invisible when occluded by Entities\n * markerShown: true, // Optional, default is true, makes position visible (when not occluded)\n * labelShown: true // Optional, default is false, makes label visible (when not occluded)\n *\n * values: { // Optional, overrides AnnotationPlugin's defaults\n * glyph: \"A\",\n * title: \"My Annotation\",\n * description: \"This is my annotation.\"\n * }\n * });\n *\n * // Listen for change of the Annotation's 3D World-space position\n *\n * myAnnotation1.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Annotation's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n *\n * myAnnotation1.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Annotation's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n *\n * myAnnotation1.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Annotation visibility. The Annotation becomes invisible when it falls outside the canvas,\n * // or its position is occluded by some Entity. Note that, when not occluded, the position is only\n * // shown when Annotation#markerShown is true, and the label is only shown when Annotation#labelShown is true.\n *\n * myAnnotation1.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Annotation is visible\");\n * } else {\n * this.log(\"Annotation is invisible\");\n * }\n * });\n *\n * // Listen for destruction of the Annotation\n *\n * myAnnotation1.on(\"destroyed\", () => {\n * //...\n * });\n * });\n * ````\n *\n * Let's query our {@link Annotation}'s current position in the World, View and Canvas coordinate systems:\n *\n * ````javascript\n * const worldPos = myAnnotation.worldPos; // [x,y,z]\n * const viewPos = myAnnotation.viewPos; // [x,y,z]\n * const canvasPos = myAnnotation.canvasPos; // [x,y]\n * ````\n *\n * We can query it's current visibility, which is ````false```` when its position is occluded by some {@link Entity}:\n *\n * ````\n * const visible = myAnnotation1.visible;\n * ````\n *\n * To listen for change events on our Annotation's position and visibility:\n *\n * ````javascript\n * // World-space position changes when we assign a new value to Annotation#worldPos\n * myAnnotation1.on(\"worldPos\", (worldPos) => {\n * //...\n * });\n *\n * // View-space position changes when either worldPos was updated or the Camera was moved\n * myAnnotation1.on(\"viewPos\", (viewPos) => {\n * //...\n * });\n *\n * // Canvas-space position changes when worldPos or viewPos was updated, or Camera's projection was updated\n * myAnnotation1.on(\"canvasPos\", (canvasPos) => {\n * //...\n * });\n *\n * // Annotation is invisible when its position falls off the canvas or is occluded by some Entity\n * myAnnotation1.on(\"visible\", (visible) => {\n * //...\n * });\n * ````\n *\n * Finally, let's dynamically update the values for a couple of placeholders in our Annotation's label:\n *\n * ```` javascript\n * myAnnotation1.setValues({\n * title: \"Here's a new title\",\n * description: \"Here's a new description\"\n * });\n * ````\n *\n *\n * ## Example 2: Creating an Annotation with a unique appearance\n *\n * Now let's create a second {@link Annotation}, this time with its own custom HTML label template, which includes\n * an image. In the Annotation's values, we'll also provide a new title and description, custom colors for the marker\n * and label, plus a URL for the image in the label template. To render its marker, the Annotation will fall back\n * on the AnnotationPlugin's default marker template.\n *\n * ````javascript\n * const myAnnotation2 = annotations.createAnnotation({\n *\n * id: \"myAnnotation2\",\n *\n * worldPos: [-0.163, 1.810, 7.977],\n *\n * occludable: true,\n * markerShown: true,\n * labelShown: true,\n *\n * // Custom label template is the same as the Annotation's, with the addition of an image element\n * labelHTML: \"
\\\n *
{{title}}
\\\n *
{{description}}
\\\n *
myImage\\\n *
\",\n *\n * // Custom template values override all the AnnotationPlugin's defaults, and includes an additional value\n * // for the image element's URL\n * values: {\n * glyph: \"A3\",\n * title: \"The West wall\",\n * description: \"Annotations can contain
custom HTML like this
image:\",\n * markerBGColor: \"green\",\n * labelBGColor: \"green\",\n * imageSrc: \"https://xeokit.io/img/docs/BIMServerLoaderPlugin/schependomlaan.png\"\n * }\n * });\n * ````\n *\n * ## Example 3: Creating an Annotation with a camera position\n *\n * We can optionally configure each {@link Annotation} with a position to fly or jump the {@link Camera} to.\n *\n * Let's create another Annotation, this time providing it with ````eye````, ````look```` and ````up```` properties\n * indicating a viewpoint on whatever it's annotating:\n *\n * ````javascript\n * const myAnnotation3 = annotations.createAnnotation({\n *\n * id: \"myAnnotation3\",\n *\n * worldPos: [-0.163, 3.810, 7.977],\n *\n * eye: [0,0,-10],\n * look: [-0.163, 3.810, 7.977],\n * up: [0,1,0];\n *\n * occludable: true,\n * markerShown: true,\n * labelShown: true,\n *\n * labelHTML: \"
\\\n *
{{title}}
\\\n *
{{description}}
\\\n *
myImage\\\n *
\",\n *\n * values: {\n * glyph: \"A3\",\n * title: \"The West wall\",\n * description: \"Annotations can contain
custom HTML like this
image:\",\n * markerBGColor: \"green\",\n * labelBGColor: \"green\",\n * imageSrc: \"https://xeokit.io/img/docs/BIMServerLoaderPlugin/schependomlaan.png\"\n * }\n * });\n * ````\n *\n * Now we can fly the {@link Camera} to the Annotation's viewpoint, like this:\n *\n * ````javascript\n * viewer.cameraFlight.flyTo(myAnnotation3);\n * ````\n *\n * Or jump the Camera, like this:\n *\n * ````javascript\n * viewer.cameraFlight.jumpTo(myAnnotation3);\n * ````\n *\n * ## Example 4: Creating an Annotation using externally-created DOM elements\n *\n * Now let's create another {@link Annotation}, this time providing it with pre-existing DOM elements for its marker\n * and label. Note that AnnotationsPlugin will ignore any ````markerHTML````, ````labelHTML````\n * or ````values```` properties when provide ````markerElementId```` or ````labelElementId````.\n *\n * ````javascript\n * const myAnnotation2 = annotations.createAnnotation({\n *\n * id: \"myAnnotation2\",\n *\n * worldPos: [-0.163, 1.810, 7.977],\n *\n * occludable: true,\n * markerShown: true,\n * labelShown: true,\n *\n * markerElementId: \"myMarkerElement\",\n * labelElementId: \"myLabelElement\"\n * });\n * ````\n *\n * ## Example 5: Creating annotations by clicking on objects\n *\n * AnnotationsPlugin makes it easy to create {@link Annotation}s on the surfaces of {@link Entity}s as we click on them.\n *\n * The {@link AnnotationsPlugin#createAnnotation} method can accept a {@link PickResult} returned\n * by {@link Scene#pick}, from which it initializes the {@link Annotation}'s {@link Annotation#worldPos} and\n * {@link Annotation#entity}. Note that this only works when {@link Scene#pick} was configured to perform a 3D\n * surface-intersection pick (see {@link Scene#pick} for more info).\n *\n * Let's now extend our example to create an Annotation wherever we click on the surface of of our model:\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#annotations_createWithMouse)]\n *\n * ````javascript\n * var i = 1; // Used to create unique Annotation IDs\n *\n * viewer.scene.input.on(\"mouseclicked\", (coords) => {\n *\n * var pickRecord = viewer.scene.pick({\n * canvasPos: coords,\n * pickSurface: true // <<------ This causes picking to find the intersection point on the entity\n * });\n *\n * if (pickRecord) {\n *\n * const annotation = annotations.createAnnotation({\n * id: \"myAnnotationOnClick\" + i,\n * pickRecord: pickRecord,\n * occludable: true, // Optional, default is true\n * markerShown: true, // Optional, default is true\n * labelShown: true, // Optional, default is true\n * values: { // HTML template values\n * glyph: \"A\" + i,\n * title: \"My annotation \" + i,\n * description: \"My description \" + i\n * },\n });\n *\n * i++;\n * }\n * });\n * ````\n *\n * Note that when the Annotation is occludable, there is potential for the {@link Annotation#worldPos} to become\n * visually embedded within the surface of its Entity when viewed from a distance. This happens as a result of limited\n * GPU accuracy GPU accuracy, especially when the near and far view-space clipping planes, specified by {@link Perspective#near}\n * and {@link Perspective#far}, or {@link Ortho#near} and {@link Perspective#far}, are far away from each other.\n *\n * To prevent this, we can offset Annotations from their Entity surfaces by an amount that we set\n * on {@link AnnotationsPlugin#surfaceOffset}:\n *\n * ````javascript\n * annotations.surfaceOffset = 0.3; // Default value\n * ````\n *\n * Annotations subsequently created with {@link AnnotationsPlugin#createAnnotation} using a {@link PickResult} will then\n * be offset by that amount.\n *\n * Another thing we can do to prevent this unwanted occlusion is keep the distance between the view-space clipping\n * planes to a minimum, which improves the accuracy of the Annotation occlusion test. In general, a good default\n * value for ````Perspective#far```` and ````Ortho#far```` is around ````2.000````.\n */\nclass AnnotationsPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"Annotations\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````
````. Ignored on {@link Annotation}s configured with a ````markerElementId````.\n * @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````
````. Ignored on {@link Annotation}s configured with a ````labelElementId````.\n * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.\n * @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.\n * @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of\n * its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.\n */\n constructor(viewer, cfg) {\n\n super(\"Annotations\", viewer);\n\n this._labelHTML = cfg.labelHTML || \"
\";\n this._markerHTML = cfg.markerHTML || \"
\";\n this._container = cfg.container || document.body;\n this._values = cfg.values || {};\n\n /**\n * The {@link Annotation}s created by {@link AnnotationsPlugin#createAnnotation}, each mapped to its {@link Annotation#id}.\n * @type {{String:Annotation}}\n */\n this.annotations = {};\n\n this.surfaceOffset = cfg.surfaceOffset;\n }\n\n /**\n * Gets the plugin's HTML container element, if any.\n * @returns {*|HTMLElement|HTMLElement}\n */\n getContainerElement() {\n return this._container;\n }\n\n /**\n * @private\n */\n send(name, value) {\n switch (name) {\n case \"clearAnnotations\":\n this.clear();\n break;\n }\n }\n\n /**\n * Sets the amount by which each {@link Annotation} is offset from the surface of its {@link Entity}, when we\n * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.\n *\n * See the class comments for more info.\n *\n * This is ````0.3```` by default.\n *\n * @param {Number} surfaceOffset The surface offset.\n */\n set surfaceOffset(surfaceOffset) {\n if (surfaceOffset === undefined || surfaceOffset === null) {\n surfaceOffset = 0.3;\n }\n this._surfaceOffset = surfaceOffset;\n }\n\n /**\n * Gets the amount by which an {@link Annotation} is offset from the surface of its {@link Entity} when\n * created by {@link AnnotationsPlugin#createAnnotation}, when we\n * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.\n *\n * This is ````0.3```` by default.\n *\n * @returns {Number} The surface offset.\n */\n get surfaceOffset() {\n return this._surfaceOffset;\n }\n\n /**\n * Creates an {@link Annotation}.\n *\n * The Annotation is then registered by {@link Annotation#id} in {@link AnnotationsPlugin#annotations}.\n *\n * @param {Object} params Annotation configuration.\n * @param {String} params.id Unique ID to assign to {@link Annotation#id}. The Annotation will be registered by this in {@link AnnotationsPlugin#annotations} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.\n * @param {String} [params.markerElementId] ID of pre-existing DOM element to render the marker. This overrides ````markerHTML```` and does not support ````values```` (data is baked into the label DOM element).\n * @param {String} [params.labelElementId] ID of pre-existing DOM element to render the label. This overrides ````labelHTML```` and does not support ````values```` (data is baked into the label DOM element).\n * @param {String} [params.markerHTML] HTML text template for the Annotation marker. Defaults to the marker HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````markerElementId````.\n * @param {String} [params.labelHTML] HTML text template for the Annotation label. Defaults to the label HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````labelElementId````.\n * @param {Number[]} [params.worldPos=[0,0,0]] World-space position of the Annotation marker, assigned to {@link Annotation#worldPos}.\n * @param {Entity} [params.entity] Optional {@link Entity} to associate the Annotation with. Causes {@link Annotation#visible} to be ````false```` whenever {@link Entity#visible} is also ````false````.\n * @param {PickResult} [params.pickResult] Sets the Annotation's World-space position and direction vector from the given {@link PickResult}'s {@link PickResult#worldPos} and {@link PickResult#worldNormal}, and the Annotation's Entity from {@link PickResult#entity}. Causes ````worldPos```` and ````entity```` parameters to be ignored, if they are also given.\n * @param {Boolean} [params.occludable=false] Indicates whether or not the {@link Annotation} marker and label are hidden whenever the marker occluded by {@link Entity}s in the {@link Scene}. The\n * {@link Scene} periodically occlusion-tests all Annotations on every 20th \"tick\" (which represents a rendered frame). We can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n * @param {{String:(String|Number)}} [params.values={}] Map of values to insert into the HTML templates for the marker and label. These will be inserted in addition to any values given to the AnnotationsPlugin constructor.\n * @param {Boolean} [params.markerShown=true] Whether to initially show the {@link Annotation} marker.\n * @param {Boolean} [params.labelShown=false] Whether to initially show the {@link Annotation} label.\n * @param {Number[]} [params.eye] Optional World-space position for {@link Camera#eye}, used when this Annotation is associated with a {@link Camera} position.\n * @param {Number[]} [params.look] Optional World-space position for {@link Camera#look}, used when this Annotation is associated with a {@link Camera} position.\n * @param {Number[]} [params.up] Optional World-space position for {@link Camera#up}, used when this Annotation is associated with a {@link Camera} position.\n * @param {String} [params.projection] Optional projection type for {@link Camera#projection}, used when this Annotation is associated with a {@link Camera} position.\n * @returns {Annotation} The new {@link Annotation}.\n */\n createAnnotation(params) {\n if (this.viewer.scene.components[params.id]) {\n this.error(\"Viewer component with this ID already exists: \" + params.id);\n delete params.id;\n }\n var worldPos;\n var entity;\n params.pickResult = params.pickResult || params.pickRecord;\n if (params.pickResult) {\n const pickResult = params.pickResult;\n if (!pickResult.worldPos || !pickResult.worldNormal) {\n this.error(\"Param 'pickResult' does not have both worldPos and worldNormal\");\n } else {\n const normalizedWorldNormal = math.normalizeVec3(pickResult.worldNormal, tempVec3a);\n const offsetVec = math.mulVec3Scalar(normalizedWorldNormal, this._surfaceOffset, tempVec3b);\n const offsetWorldPos = math.addVec3(pickResult.worldPos, offsetVec, tempVec3c);\n worldPos = offsetWorldPos;\n entity = pickResult.entity;\n }\n } else {\n worldPos = params.worldPos;\n entity = params.entity;\n }\n\n var markerElement = null;\n if (params.markerElementId) {\n markerElement = document.getElementById(params.markerElementId);\n if (!markerElement) {\n this.error(\"Can't find DOM element for 'markerElementId' value '\" + params.markerElementId + \"' - defaulting to internally-generated empty DIV\");\n }\n }\n\n var labelElement = null;\n if (params.labelElementId) {\n labelElement = document.getElementById(params.labelElementId);\n if (!labelElement) {\n this.error(\"Can't find DOM element for 'labelElementId' value '\" + params.labelElementId + \"' - defaulting to internally-generated empty DIV\");\n }\n }\n\n const annotation = new Annotation(this.viewer.scene, {\n id: params.id,\n plugin: this,\n entity: entity,\n worldPos: worldPos,\n container: this._container,\n markerElement: markerElement,\n labelElement: labelElement,\n markerHTML: params.markerHTML || this._markerHTML,\n labelHTML: params.labelHTML || this._labelHTML,\n occludable: params.occludable,\n values: utils.apply(params.values, utils.apply(this._values, {})),\n markerShown: params.markerShown,\n labelShown: params.labelShown,\n eye: params.eye,\n look: params.look,\n up: params.up,\n projection: params.projection,\n visible: (params.visible !== false)\n });\n this.annotations[annotation.id] = annotation;\n annotation.on(\"destroyed\", () => {\n delete this.annotations[annotation.id];\n this.fire(\"annotationDestroyed\", annotation.id);\n });\n this.fire(\"annotationCreated\", annotation.id);\n return annotation;\n }\n\n /**\n * Destroys an {@link Annotation}.\n *\n * @param {String} id ID of Annotation to destroy.\n */\n destroyAnnotation(id) {\n var annotation = this.annotations[id];\n if (!annotation) {\n this.log(\"Annotation not found: \" + id);\n return;\n }\n annotation.destroy();\n }\n\n /**\n * Destroys all {@link Annotation}s.\n */\n clear() {\n const ids = Object.keys(this.annotations);\n for (var i = 0, len = ids.length; i < len; i++) {\n this.destroyAnnotation(ids[i]);\n }\n }\n\n /**\n * Destroys this AnnotationsPlugin.\n *\n * Destroys all {@link Annotation}s first.\n */\n destroy() {\n this.clear();\n super.destroy();\n }\n}\n\nexport {AnnotationsPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 586, + "__docId__": 589, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", @@ -8332,7 +8431,7 @@ "ignore": true }, { - "__docId__": 587, + "__docId__": 590, "kind": "variable", "name": "tempVec3b", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", @@ -8353,7 +8452,7 @@ "ignore": true }, { - "__docId__": 588, + "__docId__": 591, "kind": "variable", "name": "tempVec3c", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", @@ -8374,7 +8473,7 @@ "ignore": true }, { - "__docId__": 589, + "__docId__": 592, "kind": "class", "name": "AnnotationsPlugin", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js", @@ -8392,7 +8491,7 @@ ] }, { - "__docId__": 590, + "__docId__": 593, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8499,7 +8598,7 @@ ] }, { - "__docId__": 591, + "__docId__": 594, "kind": "member", "name": "_labelHTML", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8517,7 +8616,7 @@ } }, { - "__docId__": 592, + "__docId__": 595, "kind": "member", "name": "_markerHTML", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8535,7 +8634,7 @@ } }, { - "__docId__": 593, + "__docId__": 596, "kind": "member", "name": "_container", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8553,7 +8652,7 @@ } }, { - "__docId__": 594, + "__docId__": 597, "kind": "member", "name": "_values", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8571,7 +8670,7 @@ } }, { - "__docId__": 595, + "__docId__": 598, "kind": "member", "name": "annotations", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8590,7 +8689,7 @@ } }, { - "__docId__": 597, + "__docId__": 600, "kind": "method", "name": "getContainerElement", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8620,7 +8719,7 @@ "params": [] }, { - "__docId__": 598, + "__docId__": 601, "kind": "method", "name": "send", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8649,7 +8748,7 @@ "return": null }, { - "__docId__": 599, + "__docId__": 602, "kind": "set", "name": "surfaceOffset", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8674,7 +8773,7 @@ ] }, { - "__docId__": 600, + "__docId__": 603, "kind": "member", "name": "_surfaceOffset", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8692,7 +8791,7 @@ } }, { - "__docId__": 601, + "__docId__": 604, "kind": "get", "name": "surfaceOffset", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8724,7 +8823,7 @@ } }, { - "__docId__": 602, + "__docId__": 605, "kind": "method", "name": "createAnnotation", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8937,7 +9036,7 @@ } }, { - "__docId__": 603, + "__docId__": 606, "kind": "method", "name": "destroyAnnotation", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8963,7 +9062,7 @@ "return": null }, { - "__docId__": 604, + "__docId__": 607, "kind": "method", "name": "clear", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8978,7 +9077,7 @@ "return": null }, { - "__docId__": 605, + "__docId__": 608, "kind": "method", "name": "destroy", "memberof": "src/plugins/AnnotationsPlugin/AnnotationsPlugin.js~AnnotationsPlugin", @@ -8993,29 +9092,29 @@ "return": null }, { - "__docId__": 606, + "__docId__": 609, "kind": "file", "name": "src/plugins/AnnotationsPlugin/index.js", "content": "export * from \"./AnnotationsPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AnnotationsPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AnnotationsPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 607, + "__docId__": 610, "kind": "file", "name": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {Scene} from \"../../viewer/scene/scene/Scene.js\";\nimport {AmbientLight} from \"../../viewer/scene/lights/AmbientLight.js\";\nimport {DirLight} from \"../../viewer/scene/lights/DirLight.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {buildCylinderGeometry} from \"../../viewer/scene/geometry/builders/buildCylinderGeometry.js\";\nimport {buildSphereGeometry} from \"../../viewer/scene/geometry/builders/buildSphereGeometry.js\";\nimport {buildVectorTextGeometry} from \"../../viewer/scene/geometry/builders/buildVectorTextGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\n\n/**\n * {@link Viewer} plugin that shows the axii of the World-space coordinate system.\n *\n * ## Usage\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_AxisGizmoPlugin)]\n *\n * ````JavaScript````\n * import {Viewer, XKTLoaderPlugin, AxisGizmoPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * new AxisGizmoPlugin(viewer, {\n * canvasId: \"myAxisGizmoCanvas\"\n * });\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n * ````\n */\nclass AxisGizmoPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"AxisGizmo\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.canvasId] ID of an existing HTML canvas to display the AxisGizmo - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas to display the AxisGizmo - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.\n */\n constructor(viewer, cfg) {\n\n cfg = cfg || {};\n\n super(\"AxisGizmo\", viewer, cfg);\n\n const camera = viewer.scene.camera;\n\n if (!cfg.canvasId && !cfg.canvasElement) {\n this.error(\"Config expected: either 'canvasId' or 'canvasElement'\");\n }\n\n try {\n this._axisGizmoScene = new Scene(viewer, {\n canvasId: cfg.canvasId,\n canvasElement: cfg.canvasElement,\n transparent: true\n });\n } catch (error) {\n this.error(error);\n return;\n }\n\n const axisGizmoScene = this._axisGizmoScene;\n\n axisGizmoScene.clearLights();\n\n new AmbientLight(axisGizmoScene, {color: [0.45, 0.45, 0.5], intensity: 0.9});\n new DirLight(axisGizmoScene, {dir: [-0.5, 0.5, -0.6], color: [0.8, 0.8, 0.7], intensity: 1.0, space: \"view\"});\n new DirLight(axisGizmoScene, {dir: [0.5, -0.5, -0.6], color: [0.8, 0.8, 0.8], intensity: 1.0, space: \"view\"});\n\n // Rotate helper in synch with target camera\n\n const helperCamera = axisGizmoScene.camera;\n\n camera.on(\"matrix\", function () {\n\n const eye = camera.eye;\n const look = camera.look;\n const up = camera.up;\n\n const eyeLook = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, [])), 22);\n\n helperCamera.look = [0, 0, 0];\n helperCamera.eye = eyeLook;\n helperCamera.up = up;\n });\n\n // ----------------- Components that are shared among more than one mesh ---------------\n\n const arrowHead = new ReadableGeometry(axisGizmoScene, buildCylinderGeometry({\n radiusTop: 0.01,\n radiusBottom: 0.6,\n height: 1.7,\n radialSegments: 20,\n heightSegments: 1,\n openEnded: false\n }));\n\n const arrowShaft = new ReadableGeometry(axisGizmoScene, buildCylinderGeometry({\n radiusTop: 0.2,\n radiusBottom: 0.2,\n height: 4.5,\n radialSegments: 20,\n heightSegments: 1,\n openEnded: false\n }));\n\n const xAxisMaterial = new PhongMaterial(axisGizmoScene, { // Red by convention\n diffuse: [1, 0.3, 0.3],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const xAxisLabelMaterial = new PhongMaterial(axisGizmoScene, { // Red by convention\n emissive: [1, 0.3, 0.3],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const yAxisMaterial = new PhongMaterial(axisGizmoScene, { // Green by convention\n diffuse: [0.3, 1, 0.3],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const yAxisLabelMaterial = new PhongMaterial(axisGizmoScene, { // Green by convention\n emissive: [0.3, 1, 0.3],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const zAxisMaterial = new PhongMaterial(axisGizmoScene, { // Blue by convention\n diffuse: [0.3, 0.3, 1],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const zAxisLabelMaterial = new PhongMaterial(axisGizmoScene, {\n emissive: [0.3, 0.3, 1],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n const ballMaterial = new PhongMaterial(axisGizmoScene, {\n diffuse: [0.5, 0.5, 0.5],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n });\n\n // ----------------- Meshes ------------------------------\n\n this._meshes = [\n\n // Sphere behind gnomon\n\n new Mesh(axisGizmoScene, {\n geometry: new ReadableGeometry(axisGizmoScene, buildSphereGeometry({\n radius: 9.0,\n heightSegments: 60,\n widthSegments: 60\n })),\n material: new PhongMaterial(axisGizmoScene, {\n diffuse: [0.0, 0.0, 0.0],\n emissive: [0.1, 0.1, 0.1],\n ambient: [0.1, 0.1, 0.2],\n specular: [0, 0, 0],\n alpha: 0.4,\n alphaMode: \"blend\",\n frontface: \"cw\"\n }),\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false\n }),\n\n // Ball at center of axis\n\n new Mesh(axisGizmoScene, { // Arrow\n geometry: new ReadableGeometry(axisGizmoScene, buildSphereGeometry({\n radius: 1.0\n })),\n material: ballMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false\n }),\n\n // X-axis arrow, shaft and label\n\n new Mesh(axisGizmoScene, { // Arrow\n geometry: arrowHead,\n material: xAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [5, 0, 0],\n rotation: [0, 0, -90]\n }),\n\n new Mesh(axisGizmoScene, { // Shaft\n geometry: arrowShaft,\n material: xAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [2, 0, 0],\n rotation: [0, 0, 90]\n }),\n\n new Mesh(axisGizmoScene, { // Label\n geometry: new ReadableGeometry(axisGizmoScene, buildVectorTextGeometry({text: \"X\", size: 1.5})),\n material: xAxisLabelMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [7, 0, 0],\n billboard: \"spherical\"\n }),\n\n // Y-axis arrow, shaft and label\n\n new Mesh(axisGizmoScene, { // Arrow\n geometry: arrowHead,\n material: yAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 5, 0]\n }),\n\n new Mesh(axisGizmoScene, { // Shaft\n geometry: arrowShaft,\n material: yAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 2, 0]\n }),\n\n new Mesh(axisGizmoScene, { // Label\n geometry: new ReadableGeometry(axisGizmoScene, buildVectorTextGeometry({text: \"Y\", size: 1.5})),\n material: yAxisLabelMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 7, 0],\n billboard: \"spherical\"\n }),\n\n // Z-axis arrow, shaft and label\n\n new Mesh(axisGizmoScene, { // Arrow\n geometry: arrowHead,\n material: zAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 0, 5],\n rotation: [90, 0, 0]\n }),\n\n new Mesh(axisGizmoScene, { // Shaft\n geometry: arrowShaft,\n material: zAxisMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 0, 2],\n rotation: [90, 0, 0]\n }),\n\n new Mesh(axisGizmoScene, { // Label\n geometry: new ReadableGeometry(axisGizmoScene, buildVectorTextGeometry({text: \"Z\", size: 1.5})),\n material: zAxisLabelMaterial,\n pickable: false,\n collidable: false,\n visible: cfg.visible !== false,\n position: [0, 0, 7],\n billboard: \"spherical\"\n })\n ];\n }\n\n /** Shows or hides this AxisGizmoPlugin.\n *\n * @param visible\n */\n setVisible(visible) {\n for (let i = 0; i < this._meshes.length; i++) {\n this._meshes[i].visible = visible;\n }\n }\n\n /**\n * Destroys this AxisGizmoPlugin.\n */\n destroy() {\n this._axisGizmoCanvas = null;\n this._axisGizmoScene.destroy();\n this._axisGizmoScene = null;\n super.destroy();\n }\n}\n\nexport {AxisGizmoPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 608, + "__docId__": 611, "kind": "class", "name": "AxisGizmoPlugin", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js", @@ -9033,7 +9132,7 @@ ] }, { - "__docId__": 609, + "__docId__": 612, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9106,7 +9205,7 @@ ] }, { - "__docId__": 610, + "__docId__": 613, "kind": "member", "name": "_axisGizmoScene", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9124,7 +9223,7 @@ } }, { - "__docId__": 611, + "__docId__": 614, "kind": "member", "name": "_meshes", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9142,7 +9241,7 @@ } }, { - "__docId__": 612, + "__docId__": 615, "kind": "method", "name": "setVisible", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9168,7 +9267,7 @@ "return": null }, { - "__docId__": 613, + "__docId__": 616, "kind": "method", "name": "destroy", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9183,7 +9282,7 @@ "return": null }, { - "__docId__": 614, + "__docId__": 617, "kind": "member", "name": "_axisGizmoCanvas", "memberof": "src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js~AxisGizmoPlugin", @@ -9201,29 +9300,29 @@ } }, { - "__docId__": 616, + "__docId__": 619, "kind": "file", "name": "src/plugins/AxisGizmoPlugin/index.js", "content": "export * from \"./AxisGizmoPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/AxisGizmoPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/AxisGizmoPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 617, + "__docId__": 620, "kind": "file", "name": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {SectionPlane} from \"../../viewer/scene/sectionPlane/SectionPlane.js\";\nimport {Bitmap} from \"../../viewer/scene/Bitmap/index.js\";\nimport {LineSet} from \"../../viewer/scene/LineSet/index.js\";\n\nimport {math} from \"../../viewer/scene/math/math.js\";\n\nconst tempVec3 = math.vec3();\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\n\n/**\n * {@link Viewer} plugin that saves and loads BCF viewpoints as JSON objects.\n *\n * [](/examples/index.html#BCF_SaveViewpoint)\n *\n * * [[Example 1: Saving viewer state to a BCF viewpoint](https://xeokit.github.io/xeokit-sdk/examples/index.html#BCF_SaveViewpoint)]\n * * [[Example 2: Loading viewer state from a BCF viewpoint](https://xeokit.github.io/xeokit-sdk/examples/index.html#BCF_LoadViewpoint)]\n *\n * ## Overview\n *\n * BCF is an open standard that enables workflow communications between BIM software tools. An XML schema, called\n * Building Collaboration Format (BCF), encodes messages that inform one BIM tool of issues found by another.\n *\n * A BCF viewpoint captures a viewpoint of a model that highlights an issue. The viewpoint can then be loaded by another\n * viewer to examine the issue.\n *\n * Using this plugin, a xeokit {@link Viewer} can exchange BCF-encoded viewpoints with other BIM software,\n * allowing us to use the Viewer to report and view issues in BIM models.\n *\n * This plugin's viewpoints conform to the BCF Version 2.1 specification.\n *\n * ## Supported BCF Elements\n *\n * BCFViewpointsPlugin saves and loads the following state in BCF viewpoints:\n *\n * * {@link Camera} position, orientation and projection\n * * {@link Entity} visibilities and selection states\n * * {@link SectionPlane}s to slice the model\n * * {@link LineSet}s to show 3D lines\n * * {@link Bitmap}s to show images\n *\n * ## Saving a BCF Viewpoint\n *\n * In the example below we'll create a {@link Viewer}, load an ````.XKT```` model into it using an {@link XKTLoaderPlugin},\n * slice the model in half using a {@link SectionPlanesPlugin}, create a grid ground plane using a {@link LineSet} and a 2D\n * plan view using a {@link Bitmap}, then use a {@link BCFViewpointsPlugin#getViewpoint}\n * to save a viewpoint to JSON, which we'll log to the JavaScript developer console.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#BCF_SaveViewpoint)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, SectionPlanesPlugin,\n * LineSet, Bitmap, buildGridGeometry, BCFViewpointsPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * // Set camera position and orientation\n * viewer.scene.camera.eye = [-48.93, 54.54, 50.41];\n * viewer.scene.camera.look = [0.55, -0.61, -0.55];\n * viewer.scene.camera.up = [0, -1, 0];\n * viewer.scene.camera.perspective.fov = 60;\n *\n * // Add a XKTLoaderPlugin\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * // Add a SectionPlanesPlugin\n * const sectionPlanes = new SectionPlanesPlugin(viewer);\n *\n * // Add a BCFViewpointsPlugin\n * const bcfViewpoints = new BCFViewpointsPlugin(viewer);\n *\n * // Load an .XKT model\n * const modelNode = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true // Emphasise edges\n * });\n *\n * // Slice it in half\n * sectionPlanes.createSectionPlane({\n * id: \"myClip\",\n * pos: [0, 0, 0],\n * dir: [0.5, 0.0, 0.5]\n * });\n *\n * // Create a bitmap\n * const bitmap = new Bitmap(viewer.scene, {\n * src: \"../assets/images/schependomlaanPlanView.png\",\n * visible: true,\n * height: 24.0,\n * pos: [-15, 0, -10],\n * normal: [0, -1, 0],\n * up: [0, 0, 1],\n * collidable: false,\n * opacity: 1.0,\n * clippable: false,\n * pickable: true\n * });\n *\n * // Create a grid ground plane\n * const geometryArrays = buildGridGeometry({\n * size: 60,\n * divisions: 10\n * });\n *\n * new LineSet(viewer.scene, {\n * positions: geometryArrays.positions,\n * indices: geometryArrays.indices,\n * position: [10,0,10],\n * clippable: false\n * });\n *\n * // When model is loaded, select some objects and capture a BCF viewpoint to the console\n * modelNode.on(\"loaded\", () => {\n *\n * const scene = viewer.scene;\n *\n * scene.setObjectsSelected([\n * \"3b2U496P5Ebhz5FROhTwFH\",\n * \"2MGtJUm9nD$Re1_MDIv0g2\",\n * \"3IbuwYOm5EV9Q6cXmwVWqd\",\n * \"3lhisrBxL8xgLCRdxNG$2v\",\n * \"1uDn0xT8LBkP15zQc9MVDW\"\n * ], true);\n *\n * const viewpoint = bcfViewpoints.getViewpoint();\n * const viewpointStr = JSON.stringify(viewpoint, null, 4);\n *\n * console.log(viewpointStr);\n * });\n * ````\n *\n * The saved BCF viewpoint would look something like below. Note that some elements are truncated for brevity.\n *\n * ````json\n * {\n * \"perspective_camera\": {\n * \"camera_view_point\": { \"x\": -48.93, \"y\": 54.54, \"z\": 50.41 },\n * \"camera_direction\": { \"x\": 0.55, \"y\": -0.61, \"z\": -0.55},\n * \"camera_up_vector\": { \"x\": 0.37, \"y\": -0.41, \"z\": 0.83 },\n * \"field_of_view\": 60.0\n * },\n * \"lines\": [{\n * \"start_point\": { \"x\": 1.0, \"y\": 1.0, \"z\": 1.0 },\n * \"end_point\": { \"x\": 0.0, \"y\": 0.0, \"z\": 0.0 },\n * //...(truncated)\n * }],\n * \"bitmaps\": [{\n * \"bitmap_type\": \"png\",\n * \"bitmap_data\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB9AAAAdp...\", //...(truncated)\n * \"location\": { \"x\": -15, \"y\": 10, \"z\": 0 },\n * \"normal\": { \"x\": 0, \"y\": 0, \"z\": -1 },\n * \"up\": { \"x\": 0, \"y\": -1, \"z\": 0 },\n * \"height\": 24\n * }],\n * \"clipping_planes\": [{\n * \"location\": { \"x\": 0.0, \"y\": 0.0, \"z\": 0.0 },\n * \"direction\": { \"x\": 0.5, \"y\": 0.0, \"z\": 0.5 }\n * }],\n * \"snapshot\": {\n * \"snapshot_type\": \"png\",\n * \"snapshot_data\": \"data:image/png;base64,......\"\n * },\n * \"components\": {\n * \"visibility\": {\n * \"default_visibility\": false,\n * \"exceptions\": [{\n * \"ifc_guid\": \"4$cshxZO9AJBebsni$z9Yk\",\n * \"originating_system\": \"xeokit.io\",\n * \"authoring_tool_id\": \"xeokit/v3.2\"\n * },\n * //...\n * ]\n * },\n * \"selection\": [{\n * \"ifc_guid\": \"4$cshxZO9AJBebsni$z9Yk\",\n * },\n * //...\n * ]\n * }\n * }\n * ````\n *\n * ## Saving View Setup Hints\n *\n * BCFViewpointsPlugin can optionally save hints in the viewpoint, which indicate how to set up the view when\n * loading it again.\n *\n * Here's the {@link BCFViewpointsPlugin#getViewpoint} call again, this time saving some hints:\n *\n * ````javascript\n * const viewpoint = bcfViewpoints.getViewpoint({ // Options\n * spacesVisible: true, // Force IfcSpace types visible in the viewpoint (default is false)\n * spaceBoundariesVisible: false, // Show IfcSpace boundaries in the viewpoint (default is false)\n * openingsVisible: true // Force IfcOpening types visible in the viewpoint (default is false)\n * });\n * ````\n *\n * ## Loading a BCF Viewpoint\n *\n * Assuming that we have our BCF viewpoint in a JSON object, let's now restore it with {@link BCFViewpointsPlugin#setViewpoint}:\n *\n * ````javascript\n * bcfViewpoints.setViewpoint(viewpoint);\n * ````\n *\n * ## Handling BCF Incompatibility with xeokit's Camera\n *\n * xeokit's {@link Camera#look} is the current 3D *point-of-interest* (POI).\n *\n * A BCF viewpoint, however, has a direction vector instead of a POI, and so {@link BCFViewpointsPlugin#getViewpoint} saves\n * xeokit's POI as a normalized vector from {@link Camera#eye} to {@link Camera#look}, which unfortunately loses\n * that positional information. Loading the viewpoint with {@link BCFViewpointsPlugin#setViewpoint} will restore {@link Camera#look} to\n * the viewpoint's camera position, offset by the normalized vector.\n *\n * As shown below, providing a ````rayCast```` option to ````setViewpoint```` will set {@link Camera#look} to the closest\n * surface intersection on the direction vector. Internally, ````setViewpoint```` supports this option by firing a ray\n * along the vector, and if that hits an {@link Entity}, sets {@link Camera#look} to ray's intersection point with the\n * Entity's surface.\n *\n * ````javascript\n * bcfViewpoints.setViewpoint(viewpoint, {\n * rayCast: true // <<--------------- Attempt to set Camera#look to surface intersection point (default)\n * });\n * ````\n *\n * ## Dealing With Loaded Models that are not in the Viewpoint\n *\n * If, for example, we load model \"duplex\", hide some objects, then save a BCF viewpoint with\n * ````BCFViewpointsPlugin#getViewpoint````, then load another model, \"schependomlaan\", then load the viewpoint again\n * with ````BCFViewpointsPlugin#setViewpoint````, then sometimes all of the objects in model \"schependomlaan\" become\n * visible, along with the visible objects in the viewpoint, which belong to model \"duplex\".\n *\n * The reason is that, when saving a BCF viewpoint, BCF logic works like the following pseudo code:\n *\n * ````\n * If numVisibleObjects < numInvisibleObjects\n * save IDs of visible objects in BCF\n * exceptions = \"visible objects\"\n * else\n * save IDS of invisible objects in BCF\n * exceptions = \"invisible objects\"\n * ````\n *\n * When loading the viewpoint again:\n *\n * ````\n * If exceptions = \"visible objects\"\n * hide all objects\n * show visible objects in BCF\n * else\n * show all objects\n * hide invisible objects in BCF\n * ````\n *\n * When the exception is \"visible objects\", loading the viewpoint shows all the objects in the first, which includes\n * objects in \"schependomlaan\", which can be confusing, because those were not even loaded when we first\n * saved the viewpoint..\n *\n * To solve this, we can supply a ````defaultInvisible```` option to {@link BCFViewpointsPlugin#getViewpoint}, which\n * will force the plugin to save the IDs of all visible objects while making invisible objects the exception.\n *\n * That way, when we load the viewpoint again, after loading model \"schependomlaan\", the plugin will hide all objects\n * in the scene first (which will include objects belonging to model \"schependomlaan\"), then make the objects in the\n * viewpoint visible (which will only be those of object \"duplex\").\n *\n * ````javascript\n * const viewpoint = bcfViewpoints.getViewpoint({ // Options\n * //..\n * defaultInvisible: true\n * });\n * ````\n *\n * [[Run an example](/examples/index.html#BCF_LoadViewpoint_defaultInvisible)]\n *\n * ## Behaviour with XKTLoaderPlugin globalizeObjectIds\n *\n * Whenever we use {@link XKTLoaderPlugin} to load duplicate copies of the same model, after configuring\n * {@link XKTLoaderPlugin#globalizeObjectIds} ````true```` to avoid ````Entity```` ID clashes, this has consequences\n * for BCF viewpoints created by {@link BCFViewpointsPlugin#getViewpoint}.\n *\n * When no duplicate copies of a model are loaded like this, viewpoints created by {@link BCFViewpointsPlugin#getViewpoint} will\n * continue to load as usual in other BIM viewers. Conversely, a viewpoint created for a single model in other BIM viewers\n * will continue to load as usual with ````BCFViewpointsPlugin````.\n *\n * When duplicate copies of a model are loaded, however, viewpoints created by {@link BCFViewpointsPlugin#getViewpoint}\n * will contain certain changes that will affect the viewpoint's portability, however. Such viewpoints will\n * use ````authoring_tool_id```` fields to save the globalized ````Entity#id```` values, which enables the viewpoints to\n * capture the states of the individual ````Entitys```` that represent the duplicate IFC elements. Take a look at the\n * following two examples to learn more.\n *\n * * [Example: Saving a BCF viewpoint containing duplicate models](https://xeokit.github.io/xeokit-sdk/examples/index.html#BCF_SaveViewpoint_MultipleModels)\n * * [Example: Loading a BCF viewpoint containing duplicate models](https://xeokit.github.io/xeokit-sdk/examples/index.html#BCF_LoadViewpoint_MultipleModels)\n *\n * **Caveat:** when loading a BCF viewpoint, we always assume that we have loaded in our target BIM viewer the same models that were\n * loaded in the viewpoint's original authoring application when the viewpoint was created. In the case of multi-model\n * viewpoints, the target BIM viewer, whether it be xeokit or another BIM viewer, will need to first have those exact\n * models loaded, with their objects having globalized IDs, following the same prefixing scheme we're using in\n * xeokit. Then, the viewpoint's ````authoring_tool_id```` fields will be able to resolve to their objects within the\n * target viewer.\n *\n * @class BCFViewpointsPlugin\n */\nclass BCFViewpointsPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"BCFViewpoints\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.\n * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"BCFViewpoints\", viewer, cfg);\n\n /**\n * Identifies the originating system to include in BCF viewpoints saved by this plugin.\n * @property originatingSystem\n * @type {string}\n */\n this.originatingSystem = cfg.originatingSystem || \"xeokit.io\";\n\n /**\n * Identifies the authoring tool to include in BCF viewpoints saved by this plugin.\n * @property authoringTool\n * @type {string}\n */\n this.authoringTool = cfg.authoringTool || \"xeokit.io\";\n }\n\n /**\n * Saves viewer state to a BCF viewpoint.\n *\n * See ````BCFViewpointsPlugin```` class comments for more info.\n *\n * @param {*} [options] Options for getting the viewpoint.\n * @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.\n * @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.\n * @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.\n * @param {Boolean} [options.spacesTranslucent=false] Indicates whether ````IfcSpace```` types should be forced translucent in the viewpoint.\n * @param {Boolean} [options.spaceBoundariesTranslucent=false] Indicates whether the boundaries of ````IfcSpace```` types should be forced translucent in the viewpoint.\n * @param {Boolean} [options.openingsTranslucent=true] Indicates whether ````IfcOpening```` types should be forced translucent in the viewpoint.\n * @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.\n * @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects\n * as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that\n * were not saved in the viewpoint, those models will be hidden when we load the viewpoint, and that only the\n * objects in the viewpoint will be visible.\n * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)\n * @returns {*} BCF JSON viewpoint object\n */\n getViewpoint(options = {}) {\n const scene = this.viewer.scene;\n const camera = scene.camera;\n const realWorldOffset = scene.realWorldOffset;\n const reverseClippingPlanes = (options.reverseClippingPlanes === true);\n let bcfViewpoint = {};\n\n // Camera\n let lookDirection = math.normalizeVec3(math.subVec3(camera.look, camera.eye, math.vec3()));\n let eye = camera.eye;\n let up = camera.up;\n\n if (camera.yUp) {\n // BCF is Z up\n lookDirection = YToZ(lookDirection);\n eye = YToZ(eye);\n up = YToZ(up);\n }\n\n const camera_view_point = xyzArrayToObject(math.addVec3(eye, realWorldOffset));\n\n if (camera.projection === \"ortho\") {\n bcfViewpoint.orthogonal_camera = {\n camera_view_point: camera_view_point,\n camera_direction: xyzArrayToObject(lookDirection),\n camera_up_vector: xyzArrayToObject(up),\n view_to_world_scale: camera.ortho.scale,\n };\n } else {\n bcfViewpoint.perspective_camera = {\n camera_view_point: camera_view_point,\n camera_direction: xyzArrayToObject(lookDirection),\n camera_up_vector: xyzArrayToObject(up),\n field_of_view: camera.perspective.fov,\n };\n }\n\n // Section planes\n\n const sectionPlanes = scene.sectionPlanes;\n for (let id in sectionPlanes) {\n if (sectionPlanes.hasOwnProperty(id)) {\n let sectionPlane = sectionPlanes[id];\n if (!sectionPlane.active) {\n continue;\n }\n let location = sectionPlane.pos;\n\n let direction;\n if (reverseClippingPlanes) {\n direction = math.negateVec3(sectionPlane.dir, math.vec3());\n } else {\n direction = sectionPlane.dir;\n }\n\n if (camera.yUp) {\n // BCF is Z up\n location = YToZ(location);\n direction = YToZ(direction);\n }\n math.addVec3(location, realWorldOffset);\n\n location = xyzArrayToObject(location);\n direction = xyzArrayToObject(direction);\n if (!bcfViewpoint.clipping_planes) {\n bcfViewpoint.clipping_planes = [];\n }\n bcfViewpoint.clipping_planes.push({location, direction});\n }\n }\n\n // Lines\n\n const lineSets = scene.lineSets;\n for (let id in lineSets) {\n if (lineSets.hasOwnProperty(id)) {\n const lineSet = lineSets[id];\n if (!bcfViewpoint.lines) {\n bcfViewpoint.lines = [];\n }\n const positions = lineSet.positions;\n const indices = lineSet.indices;\n for (let i = 0, len = indices.length / 2; i < len; i++) {\n const a = indices[i * 2];\n const b = indices[(i * 2) + 1];\n bcfViewpoint.lines.push({\n start_point: {\n x: positions[a * 3 + 0],\n y: positions[a * 3 + 1],\n z: positions[a * 3 + 2]\n },\n end_point: {\n x: positions[b * 3 + 0],\n y: positions[b * 3 + 1],\n z: positions[b * 3 + 2]\n }\n });\n }\n\n }\n }\n\n // Bitmaps\n\n const bitmaps = scene.bitmaps;\n for (let id in bitmaps) {\n if (bitmaps.hasOwnProperty(id)) {\n let bitmap = bitmaps[id];\n let location = bitmap.pos;\n let normal = bitmap.normal;\n let up = bitmap.up;\n if (camera.yUp) {\n // BCF is Z up\n location = YToZ(location);\n normal = YToZ(normal);\n up = YToZ(up);\n }\n math.addVec3(location, realWorldOffset);\n if (!bcfViewpoint.bitmaps) {\n bcfViewpoint.bitmaps = [];\n }\n bcfViewpoint.bitmaps.push({\n bitmap_type: bitmap.type,\n bitmap_data: bitmap.imageData,\n location: xyzArrayToObject(location),\n normal: xyzArrayToObject(normal),\n up: xyzArrayToObject(up),\n height: bitmap.height\n });\n }\n }\n\n // Entity states\n\n bcfViewpoint.components = {\n visibility: {\n view_setup_hints: {\n spaces_visible: !!options.spacesVisible,\n space_boundaries_visible: !!options.spaceBoundariesVisible,\n openings_visible: !!options.openingsVisible,\n spaces_translucent: !!options.spaces_translucent,\n space_boundaries_translucent: !!options.space_boundaries_translucent,\n openings_translucent: !!options.openings_translucent\n }\n }\n };\n\n const opacityObjectIds = new Set(scene.opacityObjectIds);\n const xrayedObjectIds = new Set(scene.xrayedObjectIds);\n const colorizedObjectIds = new Set(scene.colorizedObjectIds);\n\n const coloringMap = Object.values(scene.objects)\n .filter(entity => opacityObjectIds.has(entity.id) || colorizedObjectIds.has(entity.id) || xrayedObjectIds.has(entity.id))\n .reduce((coloringMap, entity) => {\n\n let color = colorizeToRGB(entity.colorize);\n let alpha;\n\n if (entity.xrayed) {\n if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {\n // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity\n alpha = 0.1;\n } else {\n alpha = scene.xrayMaterial.fillAlpha;\n }\n alpha = Math.round(alpha * 255).toString(16).padStart(2, \"0\");\n color = alpha + color;\n } else if (opacityObjectIds.has(entity.id)) {\n alpha = Math.round(entity.opacity * 255).toString(16).padStart(2, \"0\");\n color = alpha + color;\n }\n\n if (!coloringMap[color]) {\n coloringMap[color] = [];\n }\n\n const objectId = entity.id;\n const originalSystemId = entity.originalSystemId;\n const component = {\n ifc_guid: originalSystemId,\n originating_system: this.originatingSystem\n };\n if (originalSystemId !== objectId) {\n component.authoring_tool_id = objectId;\n }\n\n coloringMap[color].push(component);\n\n return coloringMap;\n\n }, {});\n\n const coloringArray = Object.entries(coloringMap).map(([color, components]) => {\n return {color, components};\n });\n\n bcfViewpoint.components.coloring = coloringArray;\n\n const objectIds = scene.objectIds;\n const visibleObjects = scene.visibleObjects;\n const visibleObjectIds = scene.visibleObjectIds;\n const invisibleObjectIds = objectIds.filter(id => !visibleObjects[id]);\n const selectedObjectIds = scene.selectedObjectIds;\n\n if (options.defaultInvisible || visibleObjectIds.length < invisibleObjectIds.length) {\n bcfViewpoint.components.visibility.exceptions = this._createBCFComponents(visibleObjectIds);\n bcfViewpoint.components.visibility.default_visibility = false;\n } else {\n bcfViewpoint.components.visibility.exceptions = this._createBCFComponents(invisibleObjectIds);\n bcfViewpoint.components.visibility.default_visibility = true;\n }\n\n bcfViewpoint.components.selection = this._createBCFComponents(selectedObjectIds);\n\n bcfViewpoint.components.translucency = this._createBCFComponents(scene.xrayedObjectIds);\n\n if (options.snapshot !== false) {\n bcfViewpoint.snapshot = {\n snapshot_type: \"png\",\n snapshot_data: this.viewer.getSnapshot({format: \"png\"})\n };\n }\n\n return bcfViewpoint;\n }\n\n _createBCFComponents(objectIds) {\n const scene = this.viewer.scene;\n const components = [];\n for (let i = 0, len = objectIds.length; i < len; i++) {\n const objectId = objectIds[i];\n const entity = scene.objects[objectId];\n if (entity) {\n const component = {\n ifc_guid: entity.originalSystemId,\n originating_system: this.originatingSystem\n };\n if (entity.originalSystemId !== objectId) {\n component.authoring_tool_id = objectId;\n }\n components.push(component);\n }\n }\n return components;\n }\n\n /**\n * Sets viewer state to the given BCF viewpoint.\n *\n * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a\n * direction vector. Therefore, when loading a BCF viewpoint, we set {@link Camera#look} to the absolute position\n * obtained by offsetting the BCF ````camera_view_point```` along ````camera_direction````.\n *\n * When loading a viewpoint, we also have the option to find {@link Camera#look} as the closest point of intersection\n * (on the surface of any visible and pickable {@link Entity}) with a 3D ray fired from ````camera_view_point```` in\n * the direction of ````camera_direction````.\n *\n * @param {*} bcfViewpoint BCF JSON viewpoint object,\n * shows default visible entities and restores camera to initial default position.\n * @param {*} [options] Options for setting the viewpoint.\n * @param {Boolean} [options.rayCast=true] When ````true```` (default), will attempt to set {@link Camera#look} to the closest\n * point of surface intersection with a ray fired from the BCF ````camera_view_point```` in the direction of ````camera_direction````.\n * @param {Boolean} [options.immediate=true] When ````true```` (default), immediately set camera position.\n * @param {Boolean} [options.duration] Flight duration in seconds. Overrides {@link CameraFlightAnimation#duration}. Only applies when ````immediate```` is ````false````.\n * @param {Boolean} [options.reset=true] When ````true```` (default), set {@link Entity#xrayed} and {@link Entity#highlighted} ````false```` on all scene objects.\n * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)\n * @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),\n * then this method will apply the updates to objects within those composites.\n */\n setViewpoint(bcfViewpoint, options = {}) {\n if (!bcfViewpoint) {\n return;\n }\n\n const viewer = this.viewer;\n const scene = viewer.scene;\n const camera = scene.camera;\n const rayCast = (options.rayCast !== false);\n const immediate = (options.immediate !== false);\n const reset = (options.reset !== false);\n const realWorldOffset = scene.realWorldOffset;\n const reverseClippingPlanes = (options.reverseClippingPlanes === true);\n\n scene.clearSectionPlanes();\n\n if (bcfViewpoint.clipping_planes && bcfViewpoint.clipping_planes.length > 0) {\n bcfViewpoint.clipping_planes.forEach(function (e) {\n let pos = xyzObjectToArray(e.location, tempVec3);\n let dir = xyzObjectToArray(e.direction, tempVec3);\n\n if (reverseClippingPlanes) {\n math.negateVec3(dir);\n }\n math.subVec3(pos, realWorldOffset);\n\n if (camera.yUp) {\n pos = ZToY(pos);\n dir = ZToY(dir);\n }\n new SectionPlane(scene, {pos, dir});\n });\n }\n\n scene.clearLines();\n\n if (bcfViewpoint.lines && bcfViewpoint.lines.length > 0) {\n const positions = [];\n const indices = [];\n let i = 0;\n bcfViewpoint.lines.forEach((e) => {\n if (!e.start_point) {\n return;\n }\n if (!e.end_point) {\n return;\n }\n positions.push(e.start_point.x);\n positions.push(e.start_point.y);\n positions.push(e.start_point.z);\n positions.push(e.end_point.x);\n positions.push(e.end_point.y);\n positions.push(e.end_point.z);\n indices.push(i++);\n indices.push(i++);\n });\n new LineSet(scene, {\n positions,\n indices,\n clippable: false,\n collidable: true\n });\n }\n\n scene.clearBitmaps();\n\n if (bcfViewpoint.bitmaps && bcfViewpoint.bitmaps.length > 0) {\n bcfViewpoint.bitmaps.forEach(function (e) {\n const bitmap_type = e.bitmap_type || \"jpg\"; // \"jpg\" | \"png\"\n const bitmap_data = e.bitmap_data; // base64\n let location = xyzObjectToArray(e.location, tempVec3a);\n let normal = xyzObjectToArray(e.normal, tempVec3b);\n let up = xyzObjectToArray(e.up, tempVec3c);\n let height = e.height || 1;\n if (!bitmap_type) {\n return;\n }\n if (!bitmap_data) {\n return;\n }\n if (!location) {\n return;\n }\n if (!normal) {\n return;\n }\n if (!up) {\n return;\n }\n if (camera.yUp) {\n location = ZToY(location);\n normal = ZToY(normal);\n up = ZToY(up);\n }\n new Bitmap(scene, {\n src: bitmap_data,\n type: bitmap_type,\n pos: location,\n normal: normal,\n up: up,\n clippable: false,\n collidable: true,\n height\n });\n });\n }\n\n if (reset) {\n scene.setObjectsXRayed(scene.xrayedObjectIds, false);\n scene.setObjectsHighlighted(scene.highlightedObjectIds, false);\n scene.setObjectsSelected(scene.selectedObjectIds, false);\n }\n\n if (bcfViewpoint.components) {\n\n if (bcfViewpoint.components.visibility) {\n\n if (!bcfViewpoint.components.visibility.default_visibility) {\n scene.setObjectsVisible(scene.objectIds, false);\n if (bcfViewpoint.components.visibility.exceptions) {\n bcfViewpoint.components.visibility.exceptions.forEach((component) => this._withBCFComponent(options, component, entity => entity.visible = true));\n }\n } else {\n scene.setObjectsVisible(scene.objectIds, true);\n if (bcfViewpoint.components.visibility.exceptions) {\n bcfViewpoint.components.visibility.exceptions.forEach((component) => this._withBCFComponent(options, component, entity => entity.visible = false));\n }\n }\n\n const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;\n if (view_setup_hints) {\n if (view_setup_hints.spaces_visible === false) {\n scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType(\"IfcSpace\"), false);\n }\n if (view_setup_hints.spaces_translucent !== undefined) {\n scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType(\"IfcSpace\"), true);\n }\n if (view_setup_hints.space_boundaries_visible !== undefined) {\n\n }\n if (view_setup_hints.openings_visible === false) {\n scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType(\"IfcOpening\"), true);\n }\n if (view_setup_hints.space_boundaries_translucent !== undefined) {\n\n }\n if (view_setup_hints.openings_translucent !== undefined) {\n scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType(\"IfcOpening\"), true);\n }\n }\n }\n\n if (bcfViewpoint.components.selection) {\n scene.setObjectsSelected(scene.selectedObjectIds, false);\n bcfViewpoint.components.selection.forEach(component => this._withBCFComponent(options, component, entity => entity.selected = true));\n\n }\n\n if (bcfViewpoint.components.translucency) {\n scene.setObjectsXRayed(scene.xrayedObjectIds, false);\n bcfViewpoint.components.translucency.forEach(component => this._withBCFComponent(options, component, entity => entity.xrayed = true));\n }\n\n if (bcfViewpoint.components.coloring) {\n bcfViewpoint.components.coloring.forEach(coloring => {\n\n let color = coloring.color;\n let alpha = 0;\n let alphaDefined = false;\n\n if (color.length === 8) {\n alpha = parseInt(color.substring(0, 2), 16) / 256;\n if (alpha <= 1.0 && alpha >= 0.95) {\n alpha = 1.0;\n }\n color = color.substring(2);\n alphaDefined = true;\n }\n\n const colorize = [\n parseInt(color.substring(0, 2), 16) / 256,\n parseInt(color.substring(2, 4), 16) / 256,\n parseInt(color.substring(4, 6), 16) / 256\n ];\n\n coloring.components.map(component =>\n this._withBCFComponent(options, component, entity => {\n entity.colorize = colorize;\n if (alphaDefined) {\n entity.opacity = alpha;\n }\n }));\n });\n }\n }\n\n if (bcfViewpoint.perspective_camera || bcfViewpoint.orthogonal_camera) {\n let eye;\n let look;\n let up;\n let projection;\n\n if (bcfViewpoint.perspective_camera) {\n eye = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point, tempVec3);\n look = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction, tempVec3);\n up = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector, tempVec3);\n\n camera.perspective.fov = bcfViewpoint.perspective_camera.field_of_view;\n\n projection = \"perspective\";\n } else {\n eye = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point, tempVec3);\n look = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction, tempVec3);\n up = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector, tempVec3);\n\n camera.ortho.scale = bcfViewpoint.orthogonal_camera.view_to_world_scale;\n\n projection = \"ortho\";\n }\n\n math.subVec3(eye, realWorldOffset);\n\n if (camera.yUp) {\n eye = ZToY(eye);\n look = ZToY(look);\n up = ZToY(up);\n }\n\n if (rayCast) {\n const hit = scene.pick({\n pickSurface: true, // <<------ This causes picking to find the intersection point on the entity\n origin: eye,\n direction: look\n });\n look = (hit ? hit.worldPos : math.addVec3(eye, look, tempVec3));\n } else {\n look = math.addVec3(eye, look, tempVec3);\n }\n\n if (immediate) {\n camera.eye = eye;\n camera.look = look;\n camera.up = up;\n camera.projection = projection;\n } else {\n viewer.cameraFlight.flyTo({eye, look, up, duration: options.duration, projection});\n }\n }\n }\n\n _withBCFComponent(options, component, callback) {\n\n const viewer = this.viewer;\n const scene = viewer.scene;\n\n if (component.authoring_tool_id && component.originating_system === this.originatingSystem) {\n\n const id = component.authoring_tool_id;\n const entity = scene.objects[id];\n\n if (entity) {\n callback(entity);\n return\n }\n\n if (options.updateCompositeObjects) {\n const metaObject = viewer.metaScene.metaObjects[id];\n if (metaObject) {\n scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id), callback);\n return;\n }\n }\n }\n\n if (component.ifc_guid) {\n\n const originalSystemId = component.ifc_guid;\n const entity = scene.objects[originalSystemId];\n\n if (entity) {\n callback(entity);\n return;\n }\n\n if (options.updateCompositeObjects) {\n const metaObject = viewer.metaScene.metaObjects[originalSystemId];\n if (metaObject) {\n scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId), callback);\n return;\n }\n }\n\n Object.keys(scene.models).forEach((modelId) => {\n\n const id = math.globalizeObjectId(modelId, originalSystemId);\n const entity = scene.objects[id];\n\n if (entity) {\n callback(entity);\n return;\n }\n\n if (options.updateCompositeObjects) {\n const metaObject = viewer.metaScene.metaObjects[id];\n if (metaObject) {\n scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id), callback);\n\n }\n }\n });\n }\n }\n\n /**\n * Destroys this BCFViewpointsPlugin.\n */\n destroy() {\n super.destroy();\n }\n}\n\nfunction xyzArrayToObject(arr) {\n return {\"x\": arr[0], \"y\": arr[1], \"z\": arr[2]};\n}\n\nfunction xyzObjectToArray(xyz, arry) {\n arry = new Float64Array(3);\n arry[0] = xyz.x;\n arry[1] = xyz.y;\n arry[2] = xyz.z;\n return arry;\n}\n\nfunction YToZ(vec) {\n return new Float64Array([vec[0], -vec[2], vec[1]]);\n}\n\nfunction ZToY(vec) {\n return new Float64Array([vec[0], vec[2], -vec[1]]);\n}\n\nfunction colorizeToRGB(color) {\n let rgb = \"\";\n rgb += Math.round(color[0] * 255).toString(16).padStart(2, \"0\");\n rgb += Math.round(color[1] * 255).toString(16).padStart(2, \"0\");\n rgb += Math.round(color[2] * 255).toString(16).padStart(2, \"0\");\n return rgb;\n}\n\nexport {BCFViewpointsPlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 618, + "__docId__": 621, "kind": "variable", "name": "tempVec3", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9244,7 +9343,7 @@ "ignore": true }, { - "__docId__": 619, + "__docId__": 622, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9265,7 +9364,7 @@ "ignore": true }, { - "__docId__": 620, + "__docId__": 623, "kind": "variable", "name": "tempVec3b", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9286,7 +9385,7 @@ "ignore": true }, { - "__docId__": 621, + "__docId__": 624, "kind": "variable", "name": "tempVec3c", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9307,7 +9406,7 @@ "ignore": true }, { - "__docId__": 622, + "__docId__": 625, "kind": "function", "name": "xyzArrayToObject", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9338,7 +9437,7 @@ "ignore": true }, { - "__docId__": 623, + "__docId__": 626, "kind": "function", "name": "xyzObjectToArray", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9375,7 +9474,7 @@ "ignore": true }, { - "__docId__": 624, + "__docId__": 627, "kind": "function", "name": "YToZ", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9406,7 +9505,7 @@ "ignore": true }, { - "__docId__": 625, + "__docId__": 628, "kind": "function", "name": "ZToY", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9437,7 +9536,7 @@ "ignore": true }, { - "__docId__": 626, + "__docId__": 629, "kind": "function", "name": "colorizeToRGB", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9468,7 +9567,7 @@ "ignore": true }, { - "__docId__": 627, + "__docId__": 630, "kind": "class", "name": "BCFViewpointsPlugin", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js", @@ -9492,7 +9591,7 @@ ] }, { - "__docId__": 628, + "__docId__": 631, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9565,7 +9664,7 @@ ] }, { - "__docId__": 629, + "__docId__": 632, "kind": "member", "name": "originatingSystem", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9596,7 +9695,7 @@ } }, { - "__docId__": 630, + "__docId__": 633, "kind": "member", "name": "authoringTool", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9627,7 +9726,7 @@ } }, { - "__docId__": 631, + "__docId__": 634, "kind": "method", "name": "getViewpoint", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9774,7 +9873,7 @@ } }, { - "__docId__": 632, + "__docId__": 635, "kind": "method", "name": "_createBCFComponents", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9802,7 +9901,7 @@ } }, { - "__docId__": 633, + "__docId__": 636, "kind": "method", "name": "setViewpoint", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9908,7 +10007,7 @@ "return": null }, { - "__docId__": 634, + "__docId__": 637, "kind": "method", "name": "_withBCFComponent", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9944,7 +10043,7 @@ "return": null }, { - "__docId__": 635, + "__docId__": 638, "kind": "method", "name": "destroy", "memberof": "src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js~BCFViewpointsPlugin", @@ -9959,29 +10058,29 @@ "return": null }, { - "__docId__": 636, + "__docId__": 639, "kind": "file", "name": "src/plugins/BCFViewpointsPlugin/index.js", "content": "export * from \"./BCFViewpointsPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/BCFViewpointsPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/BCFViewpointsPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 637, + "__docId__": 640, "kind": "file", "name": "src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js", "content": "import {utils} from \"../../viewer/index.js\";\n\n/**\n * Default data access strategy for {@link CityJSONLoaderPlugin}.\n */\nclass CityJSONDefaultDataSource {\n\n constructor() {\n }\n\n /**\n * Gets the contents of the given CityJSON file.\n *\n * @param {String|Number} src Path or ID of an CityJSON file.\n * @param {Function} ok Callback fired on success, argument is the CityJSON JSON.\n * @param {Function} error Callback fired on error.\n */\n getCityJSON(src, ok, error) {\n utils.loadJSON(src,\n (json) => {\n ok(json);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n}\n\nexport {CityJSONDefaultDataSource};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 638, + "__docId__": 641, "kind": "class", "name": "CityJSONDefaultDataSource", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js", @@ -9996,7 +10095,7 @@ "interface": false }, { - "__docId__": 639, + "__docId__": 642, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js~CityJSONDefaultDataSource", @@ -10010,7 +10109,7 @@ "undocument": true }, { - "__docId__": 640, + "__docId__": 643, "kind": "method", "name": "getCityJSON", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js~CityJSONDefaultDataSource", @@ -10057,18 +10156,18 @@ "return": null }, { - "__docId__": 641, + "__docId__": 644, "kind": "file", "name": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", "content": "import {math, Plugin, SceneModel, utils} from \"../../viewer/index.js\";\nimport {CityJSONDefaultDataSource} from \"./CityJSONDefaultDataSource.js\";\n\nimport {earcut} from '../lib/earcut.js';\n\nconst tempVec2a = math.vec2();\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\n\n/**\n * {@link Viewer} plugin that loads models from CityJSON files.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_CityJSONLoaderPlugin_Railway)]\n *\n * ## Overview\n *\n * * Loads small-to-medium sized models directly from [CityJSON 1.0.0](https://www.cityjson.org/specs/1.0.0/) files.\n * * Loads double-precision coordinates, enabling models to be viewed at global coordinates without accuracy loss.\n * * Allows to set the position, scale and rotation of each model as you load it.\n * * Not recommended for large models. For best performance with large CityJSON datasets, we recommend\n * converting them to ````.xkt```` format (eg. using [convert2xkt](https://github.com/xeokit/xeokit-convert)), then loading\n * the ````.xkt```` using {@link XKTLoaderPlugin}.\n *\n * ## Limitations\n *\n * Loading and parsing huge CityJSON files can be slow, and can overwhelm the browser, however. To view your\n * largest CityJSON models, we recommend instead pre-converting those to xeokit's compressed native .XKT format, then\n * loading them with {@link XKTLoaderPlugin} instead.

\n *\n * ## Scene representation\n *\n * When loading a model, CityJSONLoaderPlugin creates an {@link Entity} that represents the model, which\n * will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id}\n * in {@link Scene#models}. The CityJSONLoaderPlugin also creates an {@link Entity} for each object within the\n * model. Those Entities will have {@link Entity#isObject} set ````true```` and will be registered\n * by {@link Entity#id} in {@link Scene#objects}.\n *\n * ## Metadata\n *\n * When loading a model, CityJSONLoaderPlugin also creates a {@link MetaModel} that represents the model, which contains\n * a tree of {@link MetaObject}s that represent the CityJSON objects. .\n *\n * ## Usage\n *\n * In the example below we'll load the LOD 3 Railway model from\n * a [CityJSON file](https://github.com/xeokit/xeokit-sdk/tree/master/assets/models/cityjson/LoD3_Railway.json). Within\n * our {@link Viewer}, this will create a bunch of {@link Entity}s that represents the model and its objects, along with\n * a {@link MetaModel} and {@link MetaObject}s that hold their metadata.\n *\n * We'll also scale our model to half its size, rotate it 90 degrees about its local X-axis, then\n * translate it 100 units along its X axis.\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_CityJSONLoaderPlugin_Railway)]\n *\n * ````javascript\n * import {Viewer, CityJSONLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [14.915582703146043, 14.396781491179095, 5.431098754133695];\n * viewer.scene.camera.look = [6.599999999999998, 8.34099990051474, -4.159999575600315];\n * viewer.scene.camera.up = [-0.2820584034861215, 0.9025563895259413, -0.3253229483893775];\n *\n * const cityJSONLoader = new CityJSONLoaderPlugin(viewer);\n *\n * const model = cityJSONLoader.load({ // Returns an Entity that represents the model\n * id: \"myModel1\",\n * src: \"../assets/models/cityjson/LoD3_Railway.json\",\n * saoEnabled: true,\n * edges: false,\n * rotation: [-90,0,0],\n * scale: [0.5, 0.5, 0.5],\n * origin: [100, 0, 0]\n * });\n * ````\n *\n * ## Configuring a custom data source\n *\n * By default, CityJSONLoaderPlugin will load CityJSON files over HTTP.\n *\n * In the example below, we'll customize the way CityJSONLoaderPlugin loads the files by configuring it with our own data source\n * object. For simplicity, our custom data source example also uses HTTP, using a couple of xeokit utility functions.\n *\n * ````javascript\n * import {utils} from \"xeokit-sdk.es.js\";\n *\n * class MyDataSource {\n *\n * constructor() {\n * }\n *\n * getCityJSON(src, ok, error) {\n * console.log(\"MyDataSource#getCityJSON(\" + CityJSONSrc + \", ... )\");\n * utils.loadJSON(src,\n * (cityJSON) => {\n * ok(cityJSON);\n * },\n * function (errMsg) {\n * error(errMsg);\n * });\n * }\n * }\n * ````\n *\n * @class CityJSONLoaderPlugin\n * @since 2.0.13\n */\nclass CityJSONLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"cityJSONLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Object} [cfg.dataSource] A custom data source through which the CityJSONLoaderPlugin can load model and\n * metadata files. Defaults to an instance of {@link CityJSONDefaultDataSource}, which loads over HTTP.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"cityJSONLoader\", viewer, cfg);\n\n this.dataSource = cfg.dataSource;\n }\n\n /**\n * Gets the custom data source through which the CityJSONLoaderPlugin can load CityJSON files.\n *\n * Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Sets a custom data source through which the CityJSONLoaderPlugin can load CityJSON files.\n *\n * Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new CityJSONDefaultDataSource();\n }\n\n /**\n * Loads an ````CityJSON```` model into this CityJSONLoaderPlugin's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @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.\n * @param {String} [params.src] Path to a CityJSON file, as an alternative to the ````cityJSON```` parameter.\n * @param {ArrayBuffer} [params.cityJSON] The CityJSON file data, as an alternative to the ````src```` parameter.\n * @param {Boolean} [params.loadMetadata=true] Whether to load metadata on CityJSON objects.\n * @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.\n * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @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.\n * @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````.\n * @param {Object} [params.stats] Collects model statistics.\n * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to\n * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable\n * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point\n * primitives. Only works while {@link DTX#enabled} is also ````true````.\n * @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}.\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {\n isModel: true,\n edges: true\n }));\n\n if (!params.src && !params.cityJSON) {\n this.error(\"load() param expected: src or cityJSON\");\n return sceneModel; // Return new empty model\n }\n\n const options = {};\n\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel);\n } else {\n const spinner = this.viewer.scene.canvas.spinner;\n spinner.processes++;\n this._parseModel(params.cityJSON, params, options, sceneModel);\n spinner.processes--;\n }\n\n return sceneModel;\n }\n\n _loadModel(src, params, options, sceneModel) {\n const spinner = this.viewer.scene.canvas.spinner;\n spinner.processes++;\n this._dataSource.getCityJSON(params.src, (data) => {\n this._parseModel(data, params, options, sceneModel);\n spinner.processes--;\n },\n (errMsg) => {\n spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n });\n }\n\n _parseModel(data, params, options, sceneModel) {\n\n if (sceneModel.destroyed) {\n return;\n }\n\n const vertices = data.transform ? this._transformVertices(data.vertices, data.transform, options.rotateX) : data.vertices;\n\n const stats = params.stats || {};\n stats.sourceFormat = data.type || \"CityJSON\";\n stats.schemaVersion = data.version || \"\";\n stats.title = \"\";\n stats.author = \"\";\n stats.created = \"\";\n stats.numMetaObjects = 0;\n stats.numPropertySets = 0;\n stats.numObjects = 0;\n stats.numGeometries = 0;\n stats.numTriangles = 0;\n stats.numVertices = 0;\n\n const loadMetadata = (params.loadMetadata !== false);\n\n const rootMetaObject = loadMetadata ? {\n id: math.createUUID(),\n name: \"Model\",\n type: \"Model\"\n } : null;\n\n const metadata = loadMetadata ? {\n id: \"\",\n projectId: \"\",\n author: \"\",\n createdAt: \"\",\n schema: data.version || \"\",\n creatingApplication: \"\",\n metaObjects: [rootMetaObject],\n propertySets: []\n } : null;\n\n const ctx = {\n data,\n vertices,\n sceneModel,\n loadMetadata,\n metadata,\n rootMetaObject,\n nextId: 0,\n stats\n };\n\n this._parseCityJSON(ctx)\n\n sceneModel.finalize();\n\n if (loadMetadata) {\n const metaModelId = sceneModel.id;\n this.viewer.metaScene.createMetaModel(metaModelId, ctx.metadata, options);\n }\n\n sceneModel.scene.once(\"tick\", () => {\n if (sceneModel.destroyed) {\n return;\n }\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false); // Don't forget the event, for late subscribers\n });\n }\n\n _transformVertices(vertices, transform, rotateX) {\n const transformedVertices = [];\n const scale = transform.scale || math.vec3([1, 1, 1]);\n const translate = transform.translate || math.vec3([0, 0, 0]);\n for (let i = 0, j = 0; i < vertices.length; i++, j += 3) {\n const x = (vertices[i][0] * scale[0]) + translate[0];\n const y = (vertices[i][1] * scale[1]) + translate[1];\n const z = (vertices[i][2] * scale[2]) + translate[2];\n if (rotateX) {\n transformedVertices.push([x, z, y]);\n } else {\n transformedVertices.push([x, y, z]);\n }\n }\n return transformedVertices;\n }\n\n _parseCityJSON(ctx) {\n const data = ctx.data;\n const cityObjects = data.CityObjects;\n for (const objectId in cityObjects) {\n if (cityObjects.hasOwnProperty(objectId)) {\n const cityObject = cityObjects[objectId];\n this._parseCityObject(ctx, cityObject, objectId);\n }\n }\n }\n\n _parseCityObject(ctx, cityObject, objectId) {\n\n const sceneModel = ctx.sceneModel;\n const data = ctx.data;\n\n if (ctx.loadMetadata) {\n\n const metaObjectId = objectId;\n const metaObjectType = cityObject.type;\n const metaObjectName = metaObjectType + \" : \" + objectId;\n const parentMetaObjectId = cityObject.parents ? cityObject.parents[0] : ctx.rootMetaObject.id;\n\n ctx.metadata.metaObjects.push({\n id: metaObjectId,\n name: metaObjectName,\n type: metaObjectType,\n parent: parentMetaObjectId\n });\n }\n\n ctx.stats.numMetaObjects++;\n\n if (!(cityObject.geometry && cityObject.geometry.length > 0)) {\n return;\n }\n\n const meshIds = [];\n\n for (let i = 0, len = cityObject.geometry.length; i < len; i++) {\n\n const geometry = cityObject.geometry[i];\n\n let objectMaterial;\n let surfaceMaterials;\n\n const appearance = data.appearance;\n if (appearance) {\n const materials = appearance.materials;\n if (materials) {\n const geometryMaterial = geometry.material;\n if (geometryMaterial) {\n const themeIds = Object.keys(geometryMaterial);\n if (themeIds.length > 0) {\n const themeId = themeIds[0];\n const theme = geometryMaterial[themeId];\n if (theme.value !== undefined) {\n objectMaterial = materials[theme.value];\n } else {\n const values = theme.values;\n if (values) {\n surfaceMaterials = [];\n for (let j = 0, lenj = values.length; j < lenj; j++) {\n const value = values[i];\n const surfaceMaterial = materials[value];\n surfaceMaterials.push(surfaceMaterial);\n }\n }\n }\n }\n }\n }\n }\n\n if (surfaceMaterials) {\n this._parseGeometrySurfacesWithOwnMaterials(ctx, geometry, surfaceMaterials, meshIds);\n\n } else {\n this._parseGeometrySurfacesWithSharedMaterial(ctx, geometry, objectMaterial, meshIds);\n }\n }\n\n if (meshIds.length > 0) {\n sceneModel.createEntity({\n id: objectId,\n meshIds: meshIds,\n isObject: true\n });\n\n ctx.stats.numObjects++;\n }\n }\n\n _parseGeometrySurfacesWithOwnMaterials(ctx, geometry, surfaceMaterials, meshIds) {\n\n const geomType = geometry.type;\n\n switch (geomType) {\n\n case \"MultiPoint\":\n break;\n\n case \"MultiLineString\":\n break;\n\n case \"MultiSurface\":\n\n case \"CompositeSurface\":\n const surfaces = geometry.boundaries;\n this._parseSurfacesWithOwnMaterials(ctx, surfaceMaterials, surfaces, meshIds);\n break;\n\n case \"Solid\":\n const shells = geometry.boundaries;\n for (let j = 0; j < shells.length; j++) {\n const surfaces = shells[j];\n this._parseSurfacesWithOwnMaterials(ctx, surfaceMaterials, surfaces, meshIds);\n }\n break;\n\n case \"MultiSolid\":\n\n case \"CompositeSolid\":\n const solids = geometry.boundaries;\n for (let j = 0; j < solids.length; j++) {\n for (let k = 0; k < solids[j].length; k++) {\n const surfaces = solids[j][k];\n this._parseSurfacesWithOwnMaterials(ctx, surfaceMaterials, surfaces, meshIds);\n }\n }\n break;\n\n case \"GeometryInstance\":\n break;\n }\n }\n\n _parseSurfacesWithOwnMaterials(ctx, surfaceMaterials, surfaces, meshIds) {\n\n const vertices = ctx.vertices;\n const sceneModel = ctx.sceneModel;\n\n for (let i = 0; i < surfaces.length; i++) {\n\n const surface = surfaces[i];\n const surfaceMaterial = surfaceMaterials[i] || {diffuseColor: [0.8, 0.8, 0.8], transparency: 1.0};\n\n const face = [];\n const holes = [];\n\n const sharedIndices = [];\n\n const geometryCfg = {\n positions: [],\n indices: []\n };\n\n for (let j = 0; j < surface.length; j++) {\n\n if (face.length > 0) {\n holes.push(face.length);\n }\n\n const newFace = this._extractLocalIndices(ctx, surface[j], sharedIndices, geometryCfg);\n\n face.push(...newFace);\n }\n\n if (face.length === 3) { // Triangle\n\n geometryCfg.indices.push(face[0]);\n geometryCfg.indices.push(face[1]);\n geometryCfg.indices.push(face[2]);\n\n } else if (face.length > 3) { // Polygon\n\n // Prepare to triangulate\n\n const pList = [];\n\n for (let k = 0; k < face.length; k++) {\n pList.push({\n x: vertices[sharedIndices[face[k]]][0],\n y: vertices[sharedIndices[face[k]]][1],\n z: vertices[sharedIndices[face[k]]][2]\n });\n }\n\n const normal = this._getNormalOfPositions(pList, math.vec3());\n\n // Convert to 2D\n\n let pv = [];\n\n for (let k = 0; k < pList.length; k++) {\n\n this._to2D(pList[k], normal, tempVec2a);\n\n pv.unshift(tempVec2a[0]);\n pv.unshift(tempVec2a[1]);\n }\n\n // Triangulate\n\n const tr = earcut(pv, holes, 2);\n\n // Create triangles\n\n for (let k = 0; k < tr.length; k += 3) {\n geometryCfg.indices.unshift(face[tr[k]]);\n geometryCfg.indices.unshift(face[tr[k + 1]]);\n geometryCfg.indices.unshift(face[tr[k + 2]]);\n }\n }\n\n const meshId = \"\" + ctx.nextId++;\n\n sceneModel.createMesh({\n id: meshId,\n primitive: \"triangles\",\n positions: geometryCfg.positions,\n indices: geometryCfg.indices,\n color: (surfaceMaterial && surfaceMaterial.diffuseColor) ? surfaceMaterial.diffuseColor : [0.8, 0.8, 0.8],\n opacity: (surfaceMaterial && surfaceMaterial.transparency !== undefined) ? (1.0 - surfaceMaterial.transparency) : 1.0\n });\n\n meshIds.push(meshId);\n\n ctx.stats.numGeometries++;\n ctx.stats.numVertices += geometryCfg.positions.length / 3;\n ctx.stats.numTriangles += geometryCfg.indices.length / 3;\n }\n }\n\n _parseGeometrySurfacesWithSharedMaterial(ctx, geometry, objectMaterial, meshIds) {\n\n const sceneModel = ctx.sceneModel;\n const sharedIndices = [];\n const geometryCfg = {\n positions: [],\n indices: []\n };\n\n const geomType = geometry.type;\n\n switch (geomType) {\n case \"MultiPoint\":\n break;\n\n case \"MultiLineString\":\n break;\n\n case \"MultiSurface\":\n case \"CompositeSurface\":\n const surfaces = geometry.boundaries;\n this._parseSurfacesWithSharedMaterial(ctx, surfaces, sharedIndices, geometryCfg);\n break;\n\n case \"Solid\":\n const shells = geometry.boundaries;\n for (let j = 0; j < shells.length; j++) {\n const surfaces = shells[j];\n this._parseSurfacesWithSharedMaterial(ctx, surfaces, sharedIndices, geometryCfg);\n }\n break;\n\n case \"MultiSolid\":\n case \"CompositeSolid\":\n const solids = geometry.boundaries;\n for (let j = 0; j < solids.length; j++) {\n for (let k = 0; k < solids[j].length; k++) {\n const surfaces = solids[j][k];\n this._parseSurfacesWithSharedMaterial(ctx, surfaces, sharedIndices, geometryCfg);\n }\n }\n break;\n\n case \"GeometryInstance\":\n break;\n }\n\n if (geometryCfg.positions.length > 0 && geometryCfg.indices.length > 0) {\n\n const meshId = \"\" + ctx.nextId++;\n\n sceneModel.createMesh({\n id: meshId,\n primitive: \"triangles\",\n positions: geometryCfg.positions,\n indices: geometryCfg.indices,\n color: (objectMaterial && objectMaterial.diffuseColor) ? objectMaterial.diffuseColor : [0.8, 0.8, 0.8],\n opacity: 1.0\n //opacity: (objectMaterial && objectMaterial.transparency !== undefined) ? (1.0 - objectMaterial.transparency) : 1.0\n });\n\n meshIds.push(meshId);\n\n ctx.stats.numGeometries++;\n ctx.stats.numVertices += geometryCfg.positions.length / 3;\n ctx.stats.numTriangles += geometryCfg.indices.length / 3;\n }\n }\n\n _parseSurfacesWithSharedMaterial(ctx, surfaces, sharedIndices, primitiveCfg) {\n\n const vertices = ctx.vertices;\n\n for (let i = 0; i < surfaces.length; i++) {\n\n let boundary = [];\n let holes = [];\n\n for (let j = 0; j < surfaces[i].length; j++) {\n if (boundary.length > 0) {\n holes.push(boundary.length);\n }\n const newBoundary = this._extractLocalIndices(ctx, surfaces[i][j], sharedIndices, primitiveCfg);\n boundary.push(...newBoundary);\n }\n\n if (boundary.length === 3) { // Triangle\n\n primitiveCfg.indices.push(boundary[0]);\n primitiveCfg.indices.push(boundary[1]);\n primitiveCfg.indices.push(boundary[2]);\n\n } else if (boundary.length > 3) { // Polygon\n\n let pList = [];\n\n for (let k = 0; k < boundary.length; k++) {\n pList.push({\n x: vertices[sharedIndices[boundary[k]]][0],\n y: vertices[sharedIndices[boundary[k]]][1],\n z: vertices[sharedIndices[boundary[k]]][2]\n });\n }\n\n const normal = this._getNormalOfPositions(pList, math.vec3());\n let pv = [];\n\n for (let k = 0; k < pList.length; k++) {\n this._to2D(pList[k], normal, tempVec2a);\n pv.unshift(tempVec2a[0]);\n pv.unshift(tempVec2a[1]);\n }\n\n const tr = earcut(pv, holes, 2);\n\n for (let k = 0; k < tr.length; k += 3) {\n primitiveCfg.indices.unshift(boundary[tr[k]]);\n primitiveCfg.indices.unshift(boundary[tr[k + 1]]);\n primitiveCfg.indices.unshift(boundary[tr[k + 2]]);\n }\n }\n }\n }\n\n _extractLocalIndices(ctx, boundary, sharedIndices, geometryCfg) {\n\n const vertices = ctx.vertices;\n const newBoundary = []\n\n for (let i = 0, len = boundary.length; i < len; i++) {\n\n const index = boundary[i];\n\n if (sharedIndices.includes(index)) {\n const vertexIndex = sharedIndices.indexOf(index);\n newBoundary.push(vertexIndex);\n\n } else {\n geometryCfg.positions.push(vertices[index][0]);\n geometryCfg.positions.push(vertices[index][1]);\n geometryCfg.positions.push(vertices[index][2]);\n\n newBoundary.push(sharedIndices.length);\n\n sharedIndices.push(index);\n }\n }\n\n return newBoundary\n }\n\n _getNormalOfPositions(positions, normal) {\n\n for (let i = 0; i < positions.length; i++) {\n\n let nexti = i + 1;\n if (nexti === positions.length) {\n nexti = 0;\n }\n\n normal[0] += ((positions[i].y - positions[nexti].y) * (positions[i].z + positions[nexti].z));\n normal[1] += ((positions[i].z - positions[nexti].z) * (positions[i].x + positions[nexti].x));\n normal[2] += ((positions[i].x - positions[nexti].x) * (positions[i].y + positions[nexti].y));\n }\n\n return math.normalizeVec3(normal);\n }\n\n _to2D(_p, _n, re) {\n\n const p = tempVec3a;\n const n = tempVec3b;\n const x3 = tempVec3c;\n\n p[0] = _p.x;\n p[1] = _p.y;\n p[2] = _p.z;\n\n n[0] = _n.x;\n n[1] = _n.y;\n n[2] = _n.z;\n\n x3[0] = 1.1;\n x3[1] = 1.1;\n x3[2] = 1.1;\n\n const dist = math.lenVec3(math.subVec3(x3, n));\n\n if (dist < 0.01) {\n x3[0] += 1.0;\n x3[1] += 2.0;\n x3[2] += 3.0;\n }\n\n const dot = math.dotVec3(x3, n);\n const tmp2 = math.mulVec3Scalar(n, dot, math.vec3());\n\n x3[0] -= tmp2[0];\n x3[1] -= tmp2[1];\n x3[2] -= tmp2[2];\n\n math.normalizeVec3(x3);\n\n const y3 = math.cross3Vec3(n, x3, math.vec3());\n const x = math.dotVec3(p, x3);\n const y = math.dotVec3(p, y3);\n\n re[0] = x;\n re[1] = y;\n }\n}\n\nexport {CityJSONLoaderPlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 642, + "__docId__": 645, "kind": "variable", "name": "tempVec2a", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", @@ -10089,7 +10188,7 @@ "ignore": true }, { - "__docId__": 643, + "__docId__": 646, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", @@ -10110,7 +10209,7 @@ "ignore": true }, { - "__docId__": 644, + "__docId__": 647, "kind": "variable", "name": "tempVec3b", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", @@ -10131,7 +10230,7 @@ "ignore": true }, { - "__docId__": 645, + "__docId__": 648, "kind": "variable", "name": "tempVec3c", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", @@ -10152,7 +10251,7 @@ "ignore": true }, { - "__docId__": 646, + "__docId__": 649, "kind": "class", "name": "CityJSONLoaderPlugin", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js", @@ -10177,7 +10276,7 @@ ] }, { - "__docId__": 647, + "__docId__": 650, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10240,7 +10339,7 @@ ] }, { - "__docId__": 649, + "__docId__": 652, "kind": "get", "name": "dataSource", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10261,7 +10360,7 @@ } }, { - "__docId__": 650, + "__docId__": 653, "kind": "set", "name": "dataSource", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10282,7 +10381,7 @@ } }, { - "__docId__": 651, + "__docId__": 654, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10300,7 +10399,7 @@ } }, { - "__docId__": 652, + "__docId__": 655, "kind": "method", "name": "load", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10496,7 +10595,7 @@ } }, { - "__docId__": 653, + "__docId__": 656, "kind": "method", "name": "_loadModel", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10538,7 +10637,7 @@ "return": null }, { - "__docId__": 654, + "__docId__": 657, "kind": "method", "name": "_parseModel", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10580,7 +10679,7 @@ "return": null }, { - "__docId__": 655, + "__docId__": 658, "kind": "method", "name": "_transformVertices", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10620,7 +10719,7 @@ } }, { - "__docId__": 656, + "__docId__": 659, "kind": "method", "name": "_parseCityJSON", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10644,7 +10743,7 @@ "return": null }, { - "__docId__": 657, + "__docId__": 660, "kind": "method", "name": "_parseCityObject", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10680,7 +10779,7 @@ "return": null }, { - "__docId__": 658, + "__docId__": 661, "kind": "method", "name": "_parseGeometrySurfacesWithOwnMaterials", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10722,7 +10821,7 @@ "return": null }, { - "__docId__": 659, + "__docId__": 662, "kind": "method", "name": "_parseSurfacesWithOwnMaterials", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10764,7 +10863,7 @@ "return": null }, { - "__docId__": 660, + "__docId__": 663, "kind": "method", "name": "_parseGeometrySurfacesWithSharedMaterial", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10806,7 +10905,7 @@ "return": null }, { - "__docId__": 661, + "__docId__": 664, "kind": "method", "name": "_parseSurfacesWithSharedMaterial", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10848,7 +10947,7 @@ "return": null }, { - "__docId__": 662, + "__docId__": 665, "kind": "method", "name": "_extractLocalIndices", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10894,7 +10993,7 @@ } }, { - "__docId__": 663, + "__docId__": 666, "kind": "method", "name": "_getNormalOfPositions", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10928,7 +11027,7 @@ } }, { - "__docId__": 664, + "__docId__": 667, "kind": "method", "name": "_to2D", "memberof": "src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin", @@ -10964,29 +11063,29 @@ "return": null }, { - "__docId__": 665, + "__docId__": 668, "kind": "file", "name": "src/plugins/CityJSONLoaderPlugin/index.js", "content": "export * from \"./CityJSONLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/CityJSONLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/CityJSONLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 666, + "__docId__": 669, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", "content": "import {Marker} from \"../../viewer/scene/marker/Marker.js\";\nimport {Wire} from \"../lib/html/Wire.js\";\nimport {Dot} from \"../lib/html/Dot.js\";\nimport {Label} from \"../lib/html/Label.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {Component} from \"../../viewer/scene/Component.js\";\n\n\nconst distVec3 = math.vec3();\n\nconst lengthWire = (x1, y1, x2, y2) => {\n var a = x1 - x2;\n var b = y1 - y2;\n return Math.sqrt(a * a + b * b);\n};\n\n/**\n * @desc Measures the distance between two 3D points.\n *\n * See {@link DistanceMeasurementsPlugin} for more info.\n */\nclass DistanceMeasurement extends Component {\n\n /**\n * @private\n */\n constructor(plugin, cfg = {}) {\n\n super(plugin.viewer.scene, cfg);\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.\n * @type {DistanceMeasurementsPlugin}\n */\n this.plugin = plugin;\n\n this._container = cfg.container;\n if (!this._container) {\n throw \"config missing: container\";\n }\n\n this._eventSubs = {};\n\n var scene = this.plugin.viewer.scene;\n\n this._originMarker = new Marker(scene, cfg.origin);\n this._targetMarker = new Marker(scene, cfg.target);\n\n this._originWorld = math.vec3();\n this._targetWorld = math.vec3();\n\n this._wp = new Float64Array(24);\n this._vp = new Float64Array(24);\n this._pp = new Float64Array(24);\n this._cp = new Float64Array(8);\n\n this._xAxisLabelCulled = false;\n this._yAxisLabelCulled = false;\n this._zAxisLabelCulled = false;\n\n this._color = cfg.color || this.plugin.defaultColor;\n\n const onMouseOver = cfg.onMouseOver ? (event) => {\n cfg.onMouseOver(event, this);\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover', event));\n } : null;\n\n const onMouseLeave = cfg.onMouseLeave ? (event) => {\n cfg.onMouseLeave(event, this);\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave', event));\n } : null;\n\n const onMouseDown = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown', event));\n } ;\n\n const onMouseUp = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup', event));\n };\n\n const onMouseMove = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove', event));\n };\n\n const onContextMenu = cfg.onContextMenu ? (event) => {\n cfg.onContextMenu(event, this);\n } : null;\n\n const onMouseWheel = (event) => {\n this.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel', event));\n };\n\n this._originDot = new Dot(this._container, {\n fillColor: this._color,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._targetDot = new Dot(this._container, {\n fillColor: this._color,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 2 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._lengthWire = new Wire(this._container, {\n color: this._color,\n thickness: 2,\n thicknessClickable: 6,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._xAxisWire = new Wire(this._container, {\n color: \"#FF0000\",\n thickness: 1,\n thicknessClickable: 6,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._yAxisWire = new Wire(this._container, {\n color: \"green\",\n thickness: 1,\n thicknessClickable: 6,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._zAxisWire = new Wire(this._container, {\n color: \"blue\",\n thickness: 1,\n thicknessClickable: 6,\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 1 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._lengthLabel = new Label(this._container, {\n fillColor: this._color,\n prefix: \"\",\n text: \"\",\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 4 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._xAxisLabel = new Label(this._container, {\n fillColor: \"red\",\n prefix: \"X\",\n text: \"\",\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._yAxisLabel = new Label(this._container, {\n fillColor: \"green\",\n prefix: \"Y\",\n text: \"\",\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._zAxisLabel = new Label(this._container, {\n fillColor: \"blue\",\n prefix: \"Z\",\n text: \"\",\n zIndex: plugin.zIndex !== undefined ? plugin.zIndex + 3 : undefined,\n onMouseOver,\n onMouseLeave,\n onMouseWheel,\n onMouseDown,\n onMouseUp,\n onMouseMove,\n onContextMenu\n });\n\n this._wpDirty = false;\n this._vpDirty = false;\n this._cpDirty = false;\n this._sectionPlanesDirty = true;\n\n this._visible = false;\n this._originVisible = false;\n this._targetVisible = false;\n this._wireVisible = false;\n this._axisVisible = false;\n this._xAxisVisible = false;\n this._yAxisVisible = false;\n this._zAxisVisible = false;\n this._axisEnabled = true;\n this._labelsVisible = false;\n this._labelsOnWires = false;\n this._clickable = false;\n\n this._originMarker.on(\"worldPos\", (value) => {\n this._originWorld.set(value || [0, 0, 0]);\n this._wpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._targetMarker.on(\"worldPos\", (value) => {\n this._targetWorld.set(value || [0, 0, 0]);\n this._wpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onViewMatrix = scene.camera.on(\"viewMatrix\", () => {\n this._vpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onProjMatrix = scene.camera.on(\"projMatrix\", () => {\n this._cpDirty = true;\n this._needUpdate();\n });\n\n this._onCanvasBoundary = scene.canvas.on(\"boundary\", () => {\n this._cpDirty = true;\n this._needUpdate(0); // No lag\n });\n\n this._onMetricsUnits = scene.metrics.on(\"units\", () => {\n this._cpDirty = true;\n this._needUpdate();\n });\n\n this._onMetricsScale = scene.metrics.on(\"scale\", () => {\n this._cpDirty = true;\n this._needUpdate();\n });\n\n this._onMetricsOrigin = scene.metrics.on(\"origin\", () => {\n this._cpDirty = true;\n this._needUpdate();\n });\n\n this._onSectionPlaneUpdated = scene.on(\"sectionPlaneUpdated\", () =>{\n this._sectionPlanesDirty = true;\n this._needUpdate();\n });\n\n this.approximate = cfg.approximate;\n this.visible = cfg.visible;\n this.originVisible = cfg.originVisible;\n this.targetVisible = cfg.targetVisible;\n this.wireVisible = cfg.wireVisible;\n this.axisVisible = cfg.axisVisible;\n this.xAxisVisible = cfg.xAxisVisible;\n this.yAxisVisible = cfg.yAxisVisible;\n this.zAxisVisible = cfg.zAxisVisible;\n this.labelsVisible = cfg.labelsVisible;\n this.labelsOnWires = cfg.labelsOnWires;\n }\n\n _update() {\n\n if (!this._visible) {\n return;\n }\n\n const scene = this.plugin.viewer.scene;\n\n if (this._wpDirty) {\n\n this._wp[0] = this._originWorld[0];\n this._wp[1] = this._originWorld[1];\n this._wp[2] = this._originWorld[2];\n this._wp[3] = 1.0;\n\n this._wp[4] = this._targetWorld[0];\n this._wp[5] = this._originWorld[1];\n this._wp[6] = this._originWorld[2];\n this._wp[7] = 1.0;\n\n this._wp[8] = this._targetWorld[0];\n this._wp[9] = this._targetWorld[1];\n this._wp[10] = this._originWorld[2];\n this._wp[11] = 1.0;\n\n this._wp[12] = this._targetWorld[0];\n this._wp[13] = this._targetWorld[1];\n this._wp[14] = this._targetWorld[2];\n this._wp[15] = 1.0;\n\n this._wpDirty = false;\n this._vpDirty = true;\n }\n\n if (this._vpDirty) {\n\n math.transformPositions4(scene.camera.viewMatrix, this._wp, this._vp);\n\n this._vp[3] = 1.0;\n this._vp[7] = 1.0;\n this._vp[11] = 1.0;\n this._vp[15] = 1.0;\n\n this._vpDirty = false;\n this._cpDirty = true;\n }\n\n if (this._sectionPlanesDirty) {\n\n if (this._isSliced(this._originWorld) || this._isSliced(this._targetWorld)) {\n this._xAxisLabel.setCulled(true);\n this._yAxisLabel.setCulled(true);\n this._zAxisLabel.setCulled(true);\n this._lengthLabel.setCulled(true);\n this._xAxisWire.setCulled(true);\n this._yAxisWire.setCulled(true);\n this._zAxisWire.setCulled(true);\n this._lengthWire.setCulled(true);\n this._originDot.setCulled(true);\n this._targetDot.setCulled(true);\n return;\n } else {\n this._xAxisLabel.setCulled(false);\n this._yAxisLabel.setCulled(false);\n this._zAxisLabel.setCulled(false);\n this._lengthLabel.setCulled(false);\n this._xAxisWire.setCulled(false);\n this._yAxisWire.setCulled(false);\n this._zAxisWire.setCulled(false);\n this._lengthWire.setCulled(false);\n this._originDot.setCulled(false);\n this._targetDot.setCulled(false);\n }\n\n this._sectionPlanesDirty = true;\n }\n\n const near = -0.3;\n const vpz1 = this._originMarker.viewPos[2];\n const vpz2 = this._targetMarker.viewPos[2];\n\n if (vpz1 > near || vpz2 > near) {\n\n this._xAxisLabel.setCulled(true);\n this._yAxisLabel.setCulled(true);\n this._zAxisLabel.setCulled(true);\n this._lengthLabel.setCulled(true);\n\n this._xAxisWire.setVisible(false);\n this._yAxisWire.setVisible(false);\n this._zAxisWire.setVisible(false);\n this._lengthWire.setVisible(false);\n\n this._originDot.setVisible(false);\n this._targetDot.setVisible(false);\n\n return;\n }\n\n if (this._cpDirty) {\n\n math.transformPositions4(scene.camera.project.matrix, this._vp, this._pp);\n\n var pp = this._pp;\n var cp = this._cp;\n\n var canvas = scene.canvas.canvas;\n var offsets = canvas.getBoundingClientRect();\n const containerOffsets = this._container.getBoundingClientRect();\n var top = offsets.top - containerOffsets.top;\n var left = offsets.left - containerOffsets.left;\n var aabb = scene.canvas.boundary;\n var canvasWidth = aabb[2];\n var canvasHeight = aabb[3];\n var j = 0;\n\n const metrics = this.plugin.viewer.scene.metrics;\n const scale = metrics.scale;\n const units = metrics.units;\n const unitInfo = metrics.unitsInfo[units];\n const unitAbbrev = unitInfo.abbrev;\n\n for (var i = 0, len = pp.length; i < len; i += 4) {\n cp[j] = left + Math.floor((1 + pp[i + 0] / pp[i + 3]) * canvasWidth / 2);\n cp[j + 1] = top + Math.floor((1 - pp[i + 1] / pp[i + 3]) * canvasHeight / 2);\n j += 2;\n }\n\n this._originDot.setPos(cp[0], cp[1]);\n this._targetDot.setPos(cp[6], cp[7]);\n\n this._lengthWire.setStartAndEnd(cp[0], cp[1], cp[6], cp[7]);\n\n this._xAxisWire.setStartAndEnd(cp[0], cp[1], cp[2], cp[3]);\n this._yAxisWire.setStartAndEnd(cp[2], cp[3], cp[4], cp[5]);\n this._zAxisWire.setStartAndEnd(cp[4], cp[5], cp[6], cp[7]);\n\n if (!this.labelsVisible) {\n\n this._lengthLabel.setCulled(true);\n\n this._xAxisLabel.setCulled(true);\n this._yAxisLabel.setCulled(true);\n this._zAxisLabel.setCulled(true);\n\n } else {\n\n this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);\n\n if (this.labelsOnWires) {\n this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);\n this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);\n this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);\n } else {\n const labelOffset = 35;\n let currentLabelOffset = labelOffset;\n this._xAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);\n currentLabelOffset += labelOffset;\n this._yAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);\n currentLabelOffset += labelOffset;\n this._zAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);\n }\n\n const tilde = this._approximate ? \" ~ \" : \" = \";\n\n this._length = Math.abs(math.lenVec3(math.subVec3(this._targetWorld, this._originWorld, distVec3)))\n this._lengthLabel.setText(tilde + (this._length * scale).toFixed(2) + unitAbbrev);\n\n const xAxisCanvasLength = Math.abs(lengthWire(cp[0], cp[1], cp[2], cp[3]));\n const yAxisCanvasLength = Math.abs(lengthWire(cp[2], cp[3], cp[4], cp[5]));\n const zAxisCanvasLength = Math.abs(lengthWire(cp[4], cp[5], cp[6], cp[7]));\n\n const labelMinAxisLength = this.plugin.labelMinAxisLength;\n\n if (this.labelsOnWires){\n this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);\n this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);\n this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);\n } else {\n this._xAxisLabelCulled = false;\n this._yAxisLabelCulled = false;\n this._zAxisLabelCulled = false;\n }\n\n if (!this._xAxisLabelCulled) {\n this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);\n this._xAxisLabel.setCulled(!this.axisVisible);\n } else {\n this._xAxisLabel.setCulled(true);\n }\n\n if (!this._yAxisLabelCulled) {\n this._yAxisLabel.setText(tilde + Math.abs((this._targetWorld[1] - this._originWorld[1]) * scale).toFixed(2) + unitAbbrev);\n this._yAxisLabel.setCulled(!this.axisVisible);\n } else {\n this._yAxisLabel.setCulled(true);\n }\n\n if (!this._zAxisLabelCulled) {\n this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);\n this._zAxisLabel.setCulled(!this.axisVisible);\n } else {\n this._zAxisLabel.setCulled(true);\n }\n }\n\n // this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);\n // this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);\n // this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);\n // this._lengthLabel.setVisible(false);\n\n this._originDot.setVisible(this._visible && this._originVisible);\n this._targetDot.setVisible(this._visible && this._targetVisible);\n\n this._xAxisWire.setVisible(this.axisVisible && this.xAxisVisible);\n this._yAxisWire.setVisible(this.axisVisible && this.yAxisVisible);\n this._zAxisWire.setVisible(this.axisVisible && this.zAxisVisible);\n\n this._lengthWire.setVisible(this.wireVisible);\n this._lengthLabel.setCulled(!this.wireVisible);\n\n this._cpDirty = false;\n }\n }\n\n _isSliced(positions) {\n const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = sectionPlanes.length; i < len; i++) {\n const sectionPlane = sectionPlanes[i];\n if (math.planeClipsPositions3(sectionPlane.pos, sectionPlane.dir, positions, 4)) {\n return true\n }\n }\n return false;\n }\n\n /**\n * Sets whether this DistanceMeasurement indicates that its measurement is approximate.\n *\n * This is ````true```` by default.\n *\n * @type {Boolean}\n */\n set approximate(approximate) {\n approximate = approximate !== false;\n if (this._approximate === approximate) {\n return;\n }\n this._approximate = approximate;\n this._cpDirty = true;\n this._needUpdate(0);\n }\n\n /**\n * Gets whether this DistanceMeasurement indicates that its measurement is approximate.\n *\n * This is ````true```` by default.\n *\n * @type {Boolean}\n */\n get approximate() {\n return this._approximate;\n }\n\n /**\n * Gets the origin {@link Marker}.\n *\n * @type {Marker}\n */\n get origin() {\n return this._originMarker;\n }\n\n /**\n * Gets the target {@link Marker}.\n *\n * @type {Marker}\n */\n get target() {\n return this._targetMarker;\n }\n\n /**\n * Gets the World-space direct point-to-point distance between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n *\n * @type {Number}\n */\n get length() {\n this._update();\n const scale = this.plugin.viewer.scene.metrics.scale;\n return this._length * scale;\n }\n\n get color() {\n return this._color;\n }\n\n set color(value) {\n this._color = value;\n this._originDot.setFillColor(value);\n this._targetDot.setFillColor(value);\n this._lengthWire.setColor(value);\n this._lengthLabel.setFillColor(value);\n }\n\n /**\n * Sets whether this DistanceMeasurement is visible or not.\n *\n * @type {Boolean}\n */\n set visible(value) {\n\n value = value !== undefined ? Boolean(value) : this.plugin.defaultVisible;\n\n this._visible = value;\n\n this._originDot.setVisible(this._visible && this._originVisible);\n this._targetDot.setVisible(this._visible && this._targetVisible);\n this._lengthWire.setVisible(this._visible && this._wireVisible);\n this._lengthLabel.setVisible(this._visible && this._wireVisible);\n\n const xAxisVisible = this._visible && this._axisVisible && this._xAxisVisible;\n const yAxisVisible = this._visible && this._axisVisible && this._yAxisVisible;\n const zAxisVisible = this._visible && this._axisVisible && this._zAxisVisible;\n\n this._xAxisWire.setVisible(xAxisVisible);\n this._yAxisWire.setVisible(yAxisVisible);\n this._zAxisWire.setVisible(zAxisVisible);\n\n this._xAxisLabel.setVisible(xAxisVisible && !this._xAxisLabelCulled);\n this._yAxisLabel.setVisible(yAxisVisible && !this._yAxisLabelCulled);\n this._zAxisLabel.setVisible(zAxisVisible && !this._zAxisLabelCulled);\n\n this._cpDirty = true;\n\n this._needUpdate();\n }\n\n /**\n * Gets whether this DistanceMeasurement is visible or not.\n *\n * @type {Boolean}\n */\n get visible() {\n return this._visible;\n }\n\n /**\n * Sets if the origin {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n set originVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultOriginVisible;\n this._originVisible = value;\n this._originDot.setVisible(this._visible && this._originVisible);\n }\n\n /**\n * Gets if the origin {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n get originVisible() {\n return this._originVisible;\n }\n\n /**\n * Sets if the target {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n set targetVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultTargetVisible;\n this._targetVisible = value;\n this._targetDot.setVisible(this._visible && this._targetVisible);\n }\n\n /**\n * Gets if the target {@link Marker} is visible.\n *\n * @type {Boolean}\n */\n get targetVisible() {\n return this._targetVisible;\n }\n\n /**\n * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n set axisEnabled(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;\n this._axisEnabled = value;\n var axisVisible = this._visible && this._axisVisible && this._axisEnabled;\n this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);\n this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);\n this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);\n this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);\n this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._xAxisVisible);\n this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._xAxisVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are enabled.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n get axisEnabled() {\n return this._axisEnabled;\n }\n\n /**\n * Sets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n set axisVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;\n this._axisVisible = value;\n var axisVisible = this._visible && this._axisVisible && this._axisEnabled;\n this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);\n this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);\n this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);\n this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);\n this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._yAxisVisible);\n this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._zAxisVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n get axisVisible() {\n return this._axisVisible;\n }\n\n /**\n * Sets if the X-axis-aligned wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n set xAxisVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;\n this._xAxisVisible = value;\n const axisVisible = this._visible && this._axisVisible && this._xAxisVisible && this._axisEnabled;\n this._xAxisWire.setVisible(axisVisible);\n this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n get xAxisVisible() {\n return this._xAxisVisible;\n }\n\n /**\n * Sets if the Y-axis-aligned wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n set yAxisVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;\n this._yAxisVisible = value;\n const axisVisible = this._visible && this._axisVisible && this._yAxisVisible && this._axisEnabled;\n this._yAxisWire.setVisible(axisVisible);\n this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n get yAxisVisible() {\n return this._yAxisVisible;\n }\n\n /**\n * Sets if the Z-axis-aligned wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n set zAxisVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;\n this._zAxisVisible = value;\n const axisVisible = this._visible && this._axisVisible && this._zAxisVisible && this._axisEnabled;\n this._zAxisWire.setVisible(axisVisible);\n this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.\n *\n * Wires are only shown if enabled and visible.\n *\n * @type {Boolean}\n */\n get zAxisVisible() {\n return this._zAxisVisible;\n }\n\n /**\n * Sets if the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.\n *\n * @type {Boolean}\n */\n set wireVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultWireVisible;\n this._wireVisible = value;\n var wireVisible = this._visible && this._wireVisible;\n this._lengthLabel.setVisible(wireVisible);\n this._lengthWire.setVisible(wireVisible);\n }\n\n /**\n * Gets if the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} is visible.\n *\n * @type {Boolean}\n */\n get wireVisible() {\n return this._wireVisible;\n }\n\n /**\n * Sets if the labels are visible.\n *\n * @type {Boolean}\n */\n set labelsVisible(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;\n this._labelsVisible = value;\n var labelsVisible = this._visible && this._labelsVisible;\n this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled);\n this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled);\n this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled);\n this._lengthLabel.setVisible(labelsVisible);\n this._cpDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets if the labels are visible.\n *\n * @type {Boolean}\n */\n get labelsVisible() {\n return this._labelsVisible;\n }\n\n /**\n * Sets if labels should be positioned on the wires.\n *\n * @type {Boolean}\n */\n set labelsOnWires(value) {\n value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsOnWires;\n this._labelsOnWires = value;\n }\n\n /**\n * Gets if labels should be positioned on the wires.\n *\n * @type {Boolean}\n */\n get labelsOnWires() {\n return this._labelsOnWires;\n }\n\n /**\n * Sets if this DistanceMeasurement appears highlighted.\n * @param highlighted\n */\n setHighlighted(highlighted) {\n this._originDot.setHighlighted(highlighted);\n this._targetDot.setHighlighted(highlighted);\n this._xAxisWire.setHighlighted(highlighted);\n this._yAxisWire.setHighlighted(highlighted);\n this._zAxisWire.setHighlighted(highlighted);\n this._xAxisLabel.setHighlighted(highlighted);\n this._yAxisLabel.setHighlighted(highlighted);\n this._zAxisLabel.setHighlighted(highlighted);\n this._lengthWire.setHighlighted(highlighted);\n this._lengthLabel.setHighlighted(highlighted);\n }\n\n /**\n * Sets if the wires, dots ad labels will fire \"mouseOver\" \"mouseLeave\" and \"contextMenu\" events, or ignore mouse events altogether.\n *\n * @type {Boolean}\n */\n set clickable(value) {\n value = !!value;\n this._clickable = value;\n this._originDot.setClickable(this._clickable);\n this._targetDot.setClickable(this._clickable);\n this._xAxisWire.setClickable(this._clickable);\n this._yAxisWire.setClickable(this._clickable);\n this._zAxisWire.setClickable(this._clickable);\n this._lengthWire.setClickable(this._clickable);\n this._xAxisLabel.setClickable(this._clickable);\n this._yAxisLabel.setClickable(this._clickable);\n this._zAxisLabel.setClickable(this._clickable);\n this._lengthLabel.setClickable(this._clickable);\n }\n\n /**\n * Gets if the wires, dots ad labels will fire \"mouseOver\" \"mouseLeave\" and \"contextMenu\" events.\n *\n * @type {Boolean}\n */\n get clickable() {\n return this._clickable;\n }\n\n /**\n * @private\n */\n destroy() {\n\n const scene = this.plugin.viewer.scene;\n const metrics = scene.metrics;\n\n if (this._onViewMatrix) {\n scene.camera.off(this._onViewMatrix);\n }\n if (this._onProjMatrix) {\n scene.camera.off(this._onProjMatrix);\n }\n if (this._onCanvasBoundary) {\n scene.canvas.off(this._onCanvasBoundary);\n }\n if (this._onMetricsUnits) {\n metrics.off(this._onMetricsUnits);\n }\n if (this._onMetricsScale) {\n metrics.off(this._onMetricsScale);\n }\n if (this._onMetricsOrigin) {\n metrics.off(this._onMetricsOrigin);\n }\n if (this._onSectionPlaneUpdated) {\n scene.off(this._onSectionPlaneUpdated);\n }\n\n this._originDot.destroy();\n this._targetDot.destroy();\n this._xAxisWire.destroy();\n this._yAxisWire.destroy();\n this._zAxisWire.destroy();\n this._lengthLabel.destroy();\n this._xAxisLabel.destroy();\n this._yAxisLabel.destroy();\n this._zAxisLabel.destroy();\n this._lengthWire.destroy();\n\n super.destroy();\n }\n}\n\nexport {DistanceMeasurement};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 667, + "__docId__": 670, "kind": "variable", "name": "distVec3", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", @@ -11007,7 +11106,7 @@ "ignore": true }, { - "__docId__": 668, + "__docId__": 671, "kind": "function", "name": "lengthWire", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", @@ -11056,7 +11155,7 @@ "ignore": true }, { - "__docId__": 669, + "__docId__": 672, "kind": "class", "name": "DistanceMeasurement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js", @@ -11074,7 +11173,7 @@ ] }, { - "__docId__": 670, + "__docId__": 673, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11088,7 +11187,7 @@ "ignore": true }, { - "__docId__": 671, + "__docId__": 674, "kind": "member", "name": "plugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11107,7 +11206,7 @@ } }, { - "__docId__": 672, + "__docId__": 675, "kind": "member", "name": "_container", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11125,7 +11224,7 @@ } }, { - "__docId__": 673, + "__docId__": 676, "kind": "member", "name": "_eventSubs", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11143,7 +11242,7 @@ } }, { - "__docId__": 674, + "__docId__": 677, "kind": "member", "name": "_originMarker", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11161,7 +11260,7 @@ } }, { - "__docId__": 675, + "__docId__": 678, "kind": "member", "name": "_targetMarker", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11179,7 +11278,7 @@ } }, { - "__docId__": 676, + "__docId__": 679, "kind": "member", "name": "_originWorld", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11197,7 +11296,7 @@ } }, { - "__docId__": 677, + "__docId__": 680, "kind": "member", "name": "_targetWorld", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11215,7 +11314,7 @@ } }, { - "__docId__": 678, + "__docId__": 681, "kind": "member", "name": "_wp", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11233,7 +11332,7 @@ } }, { - "__docId__": 679, + "__docId__": 682, "kind": "member", "name": "_vp", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11251,7 +11350,7 @@ } }, { - "__docId__": 680, + "__docId__": 683, "kind": "member", "name": "_pp", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11269,7 +11368,7 @@ } }, { - "__docId__": 681, + "__docId__": 684, "kind": "member", "name": "_cp", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11287,7 +11386,7 @@ } }, { - "__docId__": 682, + "__docId__": 685, "kind": "member", "name": "_xAxisLabelCulled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11305,7 +11404,7 @@ } }, { - "__docId__": 683, + "__docId__": 686, "kind": "member", "name": "_yAxisLabelCulled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11323,7 +11422,7 @@ } }, { - "__docId__": 684, + "__docId__": 687, "kind": "member", "name": "_zAxisLabelCulled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11341,7 +11440,7 @@ } }, { - "__docId__": 685, + "__docId__": 688, "kind": "member", "name": "_color", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11359,7 +11458,7 @@ } }, { - "__docId__": 686, + "__docId__": 689, "kind": "member", "name": "_originDot", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11377,7 +11476,7 @@ } }, { - "__docId__": 687, + "__docId__": 690, "kind": "member", "name": "_targetDot", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11395,7 +11494,7 @@ } }, { - "__docId__": 688, + "__docId__": 691, "kind": "member", "name": "_lengthWire", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11413,7 +11512,7 @@ } }, { - "__docId__": 689, + "__docId__": 692, "kind": "member", "name": "_xAxisWire", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11431,7 +11530,7 @@ } }, { - "__docId__": 690, + "__docId__": 693, "kind": "member", "name": "_yAxisWire", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11449,7 +11548,7 @@ } }, { - "__docId__": 691, + "__docId__": 694, "kind": "member", "name": "_zAxisWire", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11467,7 +11566,7 @@ } }, { - "__docId__": 692, + "__docId__": 695, "kind": "member", "name": "_lengthLabel", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11485,7 +11584,7 @@ } }, { - "__docId__": 693, + "__docId__": 696, "kind": "member", "name": "_xAxisLabel", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11503,7 +11602,7 @@ } }, { - "__docId__": 694, + "__docId__": 697, "kind": "member", "name": "_yAxisLabel", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11521,7 +11620,7 @@ } }, { - "__docId__": 695, + "__docId__": 698, "kind": "member", "name": "_zAxisLabel", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11539,7 +11638,7 @@ } }, { - "__docId__": 696, + "__docId__": 699, "kind": "member", "name": "_wpDirty", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11557,7 +11656,7 @@ } }, { - "__docId__": 697, + "__docId__": 700, "kind": "member", "name": "_vpDirty", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11575,7 +11674,7 @@ } }, { - "__docId__": 698, + "__docId__": 701, "kind": "member", "name": "_cpDirty", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11593,7 +11692,7 @@ } }, { - "__docId__": 699, + "__docId__": 702, "kind": "member", "name": "_sectionPlanesDirty", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11611,7 +11710,7 @@ } }, { - "__docId__": 700, + "__docId__": 703, "kind": "member", "name": "_visible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11629,7 +11728,7 @@ } }, { - "__docId__": 701, + "__docId__": 704, "kind": "member", "name": "_originVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11647,7 +11746,7 @@ } }, { - "__docId__": 702, + "__docId__": 705, "kind": "member", "name": "_targetVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11665,7 +11764,7 @@ } }, { - "__docId__": 703, + "__docId__": 706, "kind": "member", "name": "_wireVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11683,7 +11782,7 @@ } }, { - "__docId__": 704, + "__docId__": 707, "kind": "member", "name": "_axisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11701,7 +11800,7 @@ } }, { - "__docId__": 705, + "__docId__": 708, "kind": "member", "name": "_xAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11719,7 +11818,7 @@ } }, { - "__docId__": 706, + "__docId__": 709, "kind": "member", "name": "_yAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11737,7 +11836,7 @@ } }, { - "__docId__": 707, + "__docId__": 710, "kind": "member", "name": "_zAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11755,7 +11854,7 @@ } }, { - "__docId__": 708, + "__docId__": 711, "kind": "member", "name": "_axisEnabled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11773,7 +11872,7 @@ } }, { - "__docId__": 709, + "__docId__": 712, "kind": "member", "name": "_labelsVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11791,7 +11890,7 @@ } }, { - "__docId__": 710, + "__docId__": 713, "kind": "member", "name": "_labelsOnWires", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11809,7 +11908,7 @@ } }, { - "__docId__": 711, + "__docId__": 714, "kind": "member", "name": "_clickable", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11827,7 +11926,7 @@ } }, { - "__docId__": 714, + "__docId__": 717, "kind": "member", "name": "_onViewMatrix", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11845,7 +11944,7 @@ } }, { - "__docId__": 716, + "__docId__": 719, "kind": "member", "name": "_onProjMatrix", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11863,7 +11962,7 @@ } }, { - "__docId__": 718, + "__docId__": 721, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11881,7 +11980,7 @@ } }, { - "__docId__": 720, + "__docId__": 723, "kind": "member", "name": "_onMetricsUnits", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11899,7 +11998,7 @@ } }, { - "__docId__": 722, + "__docId__": 725, "kind": "member", "name": "_onMetricsScale", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11917,7 +12016,7 @@ } }, { - "__docId__": 724, + "__docId__": 727, "kind": "member", "name": "_onMetricsOrigin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11935,7 +12034,7 @@ } }, { - "__docId__": 726, + "__docId__": 729, "kind": "member", "name": "_onSectionPlaneUpdated", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11953,7 +12052,7 @@ } }, { - "__docId__": 739, + "__docId__": 742, "kind": "method", "name": "_update", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11970,7 +12069,7 @@ "return": null }, { - "__docId__": 745, + "__docId__": 748, "kind": "member", "name": "_length", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -11988,7 +12087,7 @@ } }, { - "__docId__": 753, + "__docId__": 756, "kind": "method", "name": "_isSliced", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12016,7 +12115,7 @@ } }, { - "__docId__": 754, + "__docId__": 757, "kind": "set", "name": "approximate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12037,7 +12136,7 @@ } }, { - "__docId__": 755, + "__docId__": 758, "kind": "member", "name": "_approximate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12055,7 +12154,7 @@ } }, { - "__docId__": 757, + "__docId__": 760, "kind": "get", "name": "approximate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12076,7 +12175,7 @@ } }, { - "__docId__": 758, + "__docId__": 761, "kind": "get", "name": "origin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12097,7 +12196,7 @@ } }, { - "__docId__": 759, + "__docId__": 762, "kind": "get", "name": "target", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12118,7 +12217,7 @@ } }, { - "__docId__": 760, + "__docId__": 763, "kind": "get", "name": "length", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12139,7 +12238,7 @@ } }, { - "__docId__": 761, + "__docId__": 764, "kind": "get", "name": "color", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12158,7 +12257,7 @@ } }, { - "__docId__": 762, + "__docId__": 765, "kind": "set", "name": "color", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12172,7 +12271,7 @@ "undocument": true }, { - "__docId__": 764, + "__docId__": 767, "kind": "set", "name": "visible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12193,7 +12292,7 @@ } }, { - "__docId__": 767, + "__docId__": 770, "kind": "get", "name": "visible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12214,7 +12313,7 @@ } }, { - "__docId__": 768, + "__docId__": 771, "kind": "set", "name": "originVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12235,7 +12334,7 @@ } }, { - "__docId__": 770, + "__docId__": 773, "kind": "get", "name": "originVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12256,7 +12355,7 @@ } }, { - "__docId__": 771, + "__docId__": 774, "kind": "set", "name": "targetVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12277,7 +12376,7 @@ } }, { - "__docId__": 773, + "__docId__": 776, "kind": "get", "name": "targetVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12298,7 +12397,7 @@ } }, { - "__docId__": 774, + "__docId__": 777, "kind": "set", "name": "axisEnabled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12319,7 +12418,7 @@ } }, { - "__docId__": 777, + "__docId__": 780, "kind": "get", "name": "axisEnabled", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12340,7 +12439,7 @@ } }, { - "__docId__": 778, + "__docId__": 781, "kind": "set", "name": "axisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12361,7 +12460,7 @@ } }, { - "__docId__": 781, + "__docId__": 784, "kind": "get", "name": "axisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12382,7 +12481,7 @@ } }, { - "__docId__": 782, + "__docId__": 785, "kind": "set", "name": "xAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12403,7 +12502,7 @@ } }, { - "__docId__": 785, + "__docId__": 788, "kind": "get", "name": "xAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12424,7 +12523,7 @@ } }, { - "__docId__": 786, + "__docId__": 789, "kind": "set", "name": "yAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12445,7 +12544,7 @@ } }, { - "__docId__": 789, + "__docId__": 792, "kind": "get", "name": "yAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12466,7 +12565,7 @@ } }, { - "__docId__": 790, + "__docId__": 793, "kind": "set", "name": "zAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12487,7 +12586,7 @@ } }, { - "__docId__": 793, + "__docId__": 796, "kind": "get", "name": "zAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12508,7 +12607,7 @@ } }, { - "__docId__": 794, + "__docId__": 797, "kind": "set", "name": "wireVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12529,7 +12628,7 @@ } }, { - "__docId__": 796, + "__docId__": 799, "kind": "get", "name": "wireVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12550,7 +12649,7 @@ } }, { - "__docId__": 797, + "__docId__": 800, "kind": "set", "name": "labelsVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12571,7 +12670,7 @@ } }, { - "__docId__": 800, + "__docId__": 803, "kind": "get", "name": "labelsVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12592,7 +12691,7 @@ } }, { - "__docId__": 801, + "__docId__": 804, "kind": "set", "name": "labelsOnWires", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12613,7 +12712,7 @@ } }, { - "__docId__": 803, + "__docId__": 806, "kind": "get", "name": "labelsOnWires", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12634,7 +12733,7 @@ } }, { - "__docId__": 804, + "__docId__": 807, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12660,7 +12759,7 @@ "return": null }, { - "__docId__": 805, + "__docId__": 808, "kind": "set", "name": "clickable", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12681,7 +12780,7 @@ } }, { - "__docId__": 807, + "__docId__": 810, "kind": "get", "name": "clickable", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12702,7 +12801,7 @@ } }, { - "__docId__": 808, + "__docId__": 811, "kind": "method", "name": "destroy", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js~DistanceMeasurement", @@ -12718,18 +12817,18 @@ "return": null }, { - "__docId__": 809, + "__docId__": 812, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js", - "content": "import {Component} from \"../../viewer/scene/Component.js\";\n\n/**\n * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from user input.\n *\n * @interface\n * @abstract\n */\nexport class DistanceMeasurementsControl extends Component {\n\n /**\n * Gets if this DistanceMeasurementsControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this DistanceMeasurementsControl is active.\n * @abstract\n */\n get active() {\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsControl.\n */\n set snapping(snapping) {\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n */\n get snapping() {\n return true;\n }\n\n /**\n * Activates this DistanceMeasurementsControl, ready to respond to input.\n *\n * @abstract\n */\n activate() {\n }\n\n /**\n * Deactivates this DistanceMeasurementsControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n */\n deactivate() {\n }\n\n /**\n * Resets this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * Does nothing if the DistanceMeasurementsControl is not active.\n *\n * @abstract\n */\n reset() {\n }\n\n /**\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n */\n destroy() {\n }\n}", + "content": "import {Component} from \"../../viewer/scene/Component.js\";\n\n/**\n * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from user input.\n *\n * @interface\n * @abstract\n */\nexport class DistanceMeasurementsControl extends Component {\n\n /**\n * Gets if this DistanceMeasurementsControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this DistanceMeasurementsControl is active.\n * @abstract\n */\n get active() {\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsControl.\n */\n set snapping(snapping) {\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.\n */\n get snapping() {\n return true;\n }\n\n /**\n * Activates this DistanceMeasurementsControl, ready to respond to input.\n *\n * @abstract\n */\n activate() {\n }\n\n /**\n * Deactivates this DistanceMeasurementsControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n */\n deactivate() {\n }\n\n /**\n * Resets this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * Does nothing if the DistanceMeasurementsControl is not active.\n *\n * @abstract\n */\n reset() {\n }\n\n /**\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n */\n get currentMeasurement() {\n return null;\n }\n\n /**\n * Destroys this DistanceMeasurementsControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.\n *\n * @abstract\n */\n destroy() {\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 810, + "__docId__": 813, "kind": "class", "name": "DistanceMeasurementsControl", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js", @@ -12748,7 +12847,7 @@ ] }, { - "__docId__": 811, + "__docId__": 814, "kind": "get", "name": "active", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12777,7 +12876,7 @@ "type": null }, { - "__docId__": 812, + "__docId__": 815, "kind": "set", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12802,7 +12901,7 @@ ] }, { - "__docId__": 813, + "__docId__": 816, "kind": "get", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12834,7 +12933,7 @@ } }, { - "__docId__": 814, + "__docId__": 817, "kind": "method", "name": "activate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12850,7 +12949,7 @@ "return": null }, { - "__docId__": 815, + "__docId__": 818, "kind": "method", "name": "deactivate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12866,7 +12965,7 @@ "return": null }, { - "__docId__": 816, + "__docId__": 819, "kind": "method", "name": "reset", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12882,7 +12981,40 @@ "return": null }, { - "__docId__": 817, + "__docId__": 820, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.", + "lineNumber": 80, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|DistanceMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "DistanceMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 821, "kind": "method", "name": "destroy", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl", @@ -12892,24 +13024,24 @@ "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl#destroy", "access": "public", "description": "Destroys this DistanceMeasurementsControl.\n\nDestroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.", - "lineNumber": 82, + "lineNumber": 91, "abstract": true, "params": [], "return": null }, { - "__docId__": 818, + "__docId__": 822, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", - "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {DistanceMeasurementsControl} from \"./DistanceMeasurementsControl.js\";\n\nconst MOUSE_FIRST_CLICK_EXPECTED = 0;\nconst MOUSE_SECOND_CLICK_EXPECTED = 1;\n\n/**\n * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from mouse input.\n *\n * ## Usage\n *\n * [[Run example](/examples/measurement/#distance_createWithMouse_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin, DistanceMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"Duplex.xkt\"\n * });\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const distanceMeasurementsControl = new DistanceMeasurementsMouseControl(DistanceMeasurements, {\n * pointerLens: new PointerLens(viewer)\n * })\n *\n * distanceMeasurementsControl.snapping = true;\n *\n * distanceMeasurementsControl.activate();\n * ````\n */\nexport class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {\n\n /**\n * Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.\n *\n * @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.\n * @param [cfg] Configuration\n * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.\n * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.\n * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.\n */\n constructor(distanceMeasurementsPlugin, cfg = {}) {\n\n super(distanceMeasurementsPlugin.viewer.scene);\n\n this._canvasToPagePos = cfg.canvasToPagePos;\n\n this.pointerLens = cfg.pointerLens;\n\n this._active = false;\n\n this._currentDistanceMeasurement = null;\n\n this._currentDistanceMeasurementInitState = {\n wireVisible: null,\n axisVisible: null,\n xAxisVisible: null,\n yaxisVisible: null,\n zAxisVisible: null,\n targetVisible: null,\n }\n\n this._initMarkerDiv()\n\n this._onCameraControlHoverSnapOrSurface = null;\n this._onCameraControlHoverSnapOrSurfaceOff = null;\n this._onMouseDown = null;\n this._onMouseUp = null;\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._snapping = cfg.snapping !== false;\n this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;\n\n this._attachPlugin(distanceMeasurementsPlugin, cfg);\n }\n\n _initMarkerDiv() {\n const markerDiv = document.createElement('div');\n markerDiv.setAttribute('id', 'myMarkerDiv');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.top = \"-200px\";\n markerDiv.style.left = \"-200px\";\n markerDiv.style.margin = \"0 0\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this._markerDiv = markerDiv;\n }\n\n _destroyMarkerDiv() {\n if (this._markerDiv) {\n const element = document.getElementById('myMarkerDiv')\n element.parentNode.removeChild(element)\n this._markerDiv = null\n }\n }\n\n _attachPlugin(distanceMeasurementsPlugin, cfg = {}) {\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.distanceMeasurementsPlugin = distanceMeasurementsPlugin;\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.plugin = distanceMeasurementsPlugin;\n }\n\n /**\n * Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this DistanceMeasurementsMouseControl is active.\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param snapping\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.\n *\n * This is `true` by default.\n * @returns {*}\n */\n get snapping() {\n return this._snapping;\n }\n \n /**\n * Activates this DistanceMeasurementsMouseControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n if (!this._markerDiv) {\n this._initMarkerDiv()\n }\n\n this.fire(\"activated\", true);\n\n const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;\n const scene = this.scene;\n const cameraControl = distanceMeasurementsPlugin.viewer.cameraControl;\n const canvas = scene.canvas.canvas;\n const input = scene.input;\n let mouseHovering = false;\n const pointerWorldPos = math.vec3();\n const pointerCanvasPos = math.vec2();\n let pointerDownCanvasX;\n let pointerDownCanvasY;\n const clickTolerance = 20;\n let hoveredEntity = null;\n\n this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;\n\n const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));\n const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));\n\n const pagePos = math.vec2();\n \n this._onCameraControlHoverSnapOrSurface = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurface\"\n : \"hoverSurface\", event => {\n const canvasPos = event.snappedCanvasPos || event.canvasPos;\n mouseHovering = true;\n pointerWorldPos.set(event.worldPos);\n pointerCanvasPos.set(event.canvasPos);\n if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {\n\n if (this._canvasToPagePos) {\n this._canvasToPagePos(canvas, canvasPos, pagePos);\n this._markerDiv.style.left = `${pagePos[0] - 5}px`;\n this._markerDiv.style.top = `${pagePos[1] - 5}px`;\n } else {\n this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;\n this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;\n }\n\n this._markerDiv.style.background = \"pink\";\n if (event.snappedToVertex || event.snappedToEdge) {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n this.pointerLens.snapped = true;\n }\n this._markerDiv.style.background = \"greenyellow\";\n this._markerDiv.style.border = \"2px solid green\";\n } else {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._markerDiv.style.background = \"pink\";\n this._markerDiv.style.border = \"2px solid red\";\n }\n hoveredEntity = event.entity;\n } else {\n this._markerDiv.style.left = `-10000px`;\n this._markerDiv.style.top = `-10000px`;\n }\n canvas.style.cursor = \"pointer\";\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.wireVisible = this._currentDistanceMeasurementInitState.wireVisible;\n this._currentDistanceMeasurement.axisVisible = this._currentDistanceMeasurementInitState.axisVisible && this.distanceMeasurementsPlugin.defaultAxisVisible;\n this._currentDistanceMeasurement.xAxisVisible = this._currentDistanceMeasurementInitState.xAxisVisible && this.distanceMeasurementsPlugin.defaultXAxisVisible;\n this._currentDistanceMeasurement.yAxisVisible = this._currentDistanceMeasurementInitState.yAxisVisible && this.distanceMeasurementsPlugin.defaultYAxisVisible;\n this._currentDistanceMeasurement.zAxisVisible = this._currentDistanceMeasurementInitState.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;\n this._currentDistanceMeasurement.targetVisible = this._currentDistanceMeasurementInitState.targetVisible;\n this._currentDistanceMeasurement.target.worldPos = pointerWorldPos.slice();\n this._markerDiv.style.left = `-10000px`;\n this._markerDiv.style.top = `-10000px`;\n }\n });\n\n canvas.addEventListener('mousedown', this._onMouseDown = (e) => {\n if (e.which !== 1) {\n return;\n }\n pointerDownCanvasX = e.clientX;\n pointerDownCanvasY = e.clientY;\n });\n\n canvas.addEventListener(\"mouseup\", this._onMouseUp = (e) => {\n if (e.which !== 1) {\n return;\n }\n if (e.clientX > pointerDownCanvasX + clickTolerance ||\n e.clientX < pointerDownCanvasX - clickTolerance ||\n e.clientY > pointerDownCanvasY + clickTolerance ||\n e.clientY < pointerDownCanvasY - clickTolerance) {\n return;\n }\n if (this._currentDistanceMeasurement) {\n if (mouseHovering) {\n this._currentDistanceMeasurement.target.entity = hoveredEntity;\n hoveredEntity = null;\n this._currentDistanceMeasurement.clickable = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n } else {\n this._currentDistanceMeasurement.destroy();\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n hoveredEntity = null;\n }\n } else {\n if (mouseHovering) {\n this._currentDistanceMeasurement = distanceMeasurementsPlugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pointerWorldPos.slice(),\n entity: hoveredEntity\n },\n target: {\n worldPos: pointerWorldPos.slice(),\n entity: hoveredEntity\n },\n approximate: true\n });\n this._currentDistanceMeasurementInitState.axisVisible = this._currentDistanceMeasurement.axisVisible && this.distanceMeasurementsPlugin.defaultAxisVisible;\n this._currentDistanceMeasurementInitState.xAxisVisible = this._currentDistanceMeasurement.xAxisVisible && this.distanceMeasurementsPlugin.defaultXAxisVisible;\n this._currentDistanceMeasurementInitState.yAxisVisible = this._currentDistanceMeasurement.yAxisVisible && this.distanceMeasurementsPlugin.defaultYAxisVisible;\n this._currentDistanceMeasurementInitState.zAxisVisible = this._currentDistanceMeasurement.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;\n this._currentDistanceMeasurementInitState.wireVisible = this._currentDistanceMeasurement.wireVisible;\n this._currentDistanceMeasurementInitState.targetVisible = this._currentDistanceMeasurement.targetVisible;\n this._currentDistanceMeasurement.clickable = false;\n this._currentDistanceMeasurement.origin.entity = hoveredEntity;\n hoveredEntity = null;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n }\n }\n });\n\n this._onCameraControlHoverSnapOrSurfaceOff = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurfaceOff\"\n : \"hoverOff\", event => {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n }\n mouseHovering = false;\n this._markerDiv.style.left = `-100px`;\n this._markerDiv.style.top = `-100px`;\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.axisVisible = false;\n }\n canvas.style.cursor = \"default\";\n });\n\n this._active = true;\n }\n\n /**\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n\n this.fire(\"activated\", false);\n\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (this._markerDiv) {\n this._destroyMarkerDiv()\n }\n this.reset();\n const canvas = this.scene.canvas.canvas;\n canvas.removeEventListener(\"mousedown\", this._onMouseDown);\n canvas.removeEventListener(\"mouseup\", this._onMouseUp);\n const cameraControl = this.distanceMeasurementsPlugin.viewer.cameraControl;\n cameraControl.off(this._onCameraControlHoverSnapOrSurface);\n cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._active = false;\n }\n\n /**\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n\n this._destroyMarkerDiv()\n this._initMarkerDiv()\n\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n }\n\n /**\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", + "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {DistanceMeasurementsControl} from \"./DistanceMeasurementsControl.js\";\n\nconst MOUSE_FIRST_CLICK_EXPECTED = 0;\nconst MOUSE_SECOND_CLICK_EXPECTED = 1;\n\n/**\n * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from mouse input.\n *\n * ## Usage\n *\n * [[Run example](/examples/measurement/#distance_createWithMouse_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin, DistanceMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"Duplex.xkt\"\n * });\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const distanceMeasurementsControl = new DistanceMeasurementsMouseControl(DistanceMeasurements, {\n * pointerLens: new PointerLens(viewer)\n * })\n *\n * distanceMeasurementsControl.snapping = true;\n *\n * distanceMeasurementsControl.activate();\n * ````\n */\nexport class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {\n\n /**\n * Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.\n *\n * @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.\n * @param [cfg] Configuration\n * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.\n * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.\n * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.\n */\n constructor(distanceMeasurementsPlugin, cfg = {}) {\n\n super(distanceMeasurementsPlugin.viewer.scene);\n\n this._canvasToPagePos = cfg.canvasToPagePos;\n\n this.pointerLens = cfg.pointerLens;\n\n this._active = false;\n\n this._currentDistanceMeasurement = null;\n\n this._currentDistanceMeasurementInitState = {\n wireVisible: null,\n axisVisible: null,\n xAxisVisible: null,\n yaxisVisible: null,\n zAxisVisible: null,\n targetVisible: null,\n }\n\n this._initMarkerDiv()\n\n this._onCameraControlHoverSnapOrSurface = null;\n this._onCameraControlHoverSnapOrSurfaceOff = null;\n this._onMouseDown = null;\n this._onMouseUp = null;\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._snapping = cfg.snapping !== false;\n this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;\n\n this._attachPlugin(distanceMeasurementsPlugin, cfg);\n }\n\n _initMarkerDiv() {\n const markerDiv = document.createElement('div');\n markerDiv.setAttribute('id', 'myMarkerDiv');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.top = \"-200px\";\n markerDiv.style.left = \"-200px\";\n markerDiv.style.margin = \"0 0\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this._markerDiv = markerDiv;\n }\n\n _destroyMarkerDiv() {\n if (this._markerDiv) {\n const element = document.getElementById('myMarkerDiv')\n element.parentNode.removeChild(element)\n this._markerDiv = null\n }\n }\n\n _attachPlugin(distanceMeasurementsPlugin, cfg = {}) {\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.distanceMeasurementsPlugin = distanceMeasurementsPlugin;\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.plugin = distanceMeasurementsPlugin;\n }\n\n /**\n * Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.\n *\n * @returns {boolean} True if this DistanceMeasurementsMouseControl is active.\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param snapping\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.\n *\n * This is `true` by default.\n * @returns {*}\n */\n get snapping() {\n return this._snapping;\n }\n \n /**\n * Activates this DistanceMeasurementsMouseControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n if (!this._markerDiv) {\n this._initMarkerDiv()\n }\n\n this.fire(\"activated\", true);\n\n const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;\n const scene = this.scene;\n const cameraControl = distanceMeasurementsPlugin.viewer.cameraControl;\n const canvas = scene.canvas.canvas;\n const input = scene.input;\n let mouseHovering = false;\n const pointerWorldPos = math.vec3();\n const pointerCanvasPos = math.vec2();\n let pointerDownCanvasX;\n let pointerDownCanvasY;\n const clickTolerance = 20;\n let hoveredEntity = null;\n\n this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;\n\n const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));\n const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));\n\n const pagePos = math.vec2();\n \n this._onCameraControlHoverSnapOrSurface = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurface\"\n : \"hoverSurface\", event => {\n const canvasPos = event.snappedCanvasPos || event.canvasPos;\n mouseHovering = true;\n pointerWorldPos.set(event.worldPos);\n pointerCanvasPos.set(event.canvasPos);\n if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {\n\n if (this._canvasToPagePos) {\n this._canvasToPagePos(canvas, canvasPos, pagePos);\n this._markerDiv.style.left = `${pagePos[0] - 5}px`;\n this._markerDiv.style.top = `${pagePos[1] - 5}px`;\n } else {\n this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;\n this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;\n }\n\n this._markerDiv.style.background = \"pink\";\n if (event.snappedToVertex || event.snappedToEdge) {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n this.pointerLens.snapped = true;\n }\n this._markerDiv.style.background = \"greenyellow\";\n this._markerDiv.style.border = \"2px solid green\";\n } else {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._markerDiv.style.background = \"pink\";\n this._markerDiv.style.border = \"2px solid red\";\n }\n hoveredEntity = event.entity;\n } else {\n this._markerDiv.style.left = `-10000px`;\n this._markerDiv.style.top = `-10000px`;\n }\n canvas.style.cursor = \"pointer\";\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.wireVisible = this._currentDistanceMeasurementInitState.wireVisible;\n this._currentDistanceMeasurement.axisVisible = this._currentDistanceMeasurementInitState.axisVisible && this.distanceMeasurementsPlugin.defaultAxisVisible;\n this._currentDistanceMeasurement.xAxisVisible = this._currentDistanceMeasurementInitState.xAxisVisible && this.distanceMeasurementsPlugin.defaultXAxisVisible;\n this._currentDistanceMeasurement.yAxisVisible = this._currentDistanceMeasurementInitState.yAxisVisible && this.distanceMeasurementsPlugin.defaultYAxisVisible;\n this._currentDistanceMeasurement.zAxisVisible = this._currentDistanceMeasurementInitState.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;\n this._currentDistanceMeasurement.targetVisible = this._currentDistanceMeasurementInitState.targetVisible;\n this._currentDistanceMeasurement.target.worldPos = pointerWorldPos.slice();\n this._markerDiv.style.left = `-10000px`;\n this._markerDiv.style.top = `-10000px`;\n }\n });\n\n canvas.addEventListener('mousedown', this._onMouseDown = (e) => {\n if (e.which !== 1) {\n return;\n }\n pointerDownCanvasX = e.clientX;\n pointerDownCanvasY = e.clientY;\n });\n\n canvas.addEventListener(\"mouseup\", this._onMouseUp = (e) => {\n if (e.which !== 1) {\n return;\n }\n if (e.clientX > pointerDownCanvasX + clickTolerance ||\n e.clientX < pointerDownCanvasX - clickTolerance ||\n e.clientY > pointerDownCanvasY + clickTolerance ||\n e.clientY < pointerDownCanvasY - clickTolerance) {\n return;\n }\n if (this._currentDistanceMeasurement) {\n if (mouseHovering) {\n this._currentDistanceMeasurement.target.entity = hoveredEntity;\n hoveredEntity = null;\n this._currentDistanceMeasurement.clickable = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n } else {\n this._currentDistanceMeasurement.destroy();\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n hoveredEntity = null;\n }\n } else {\n if (mouseHovering) {\n this._currentDistanceMeasurement = distanceMeasurementsPlugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pointerWorldPos.slice(),\n entity: hoveredEntity\n },\n target: {\n worldPos: pointerWorldPos.slice(),\n entity: hoveredEntity\n },\n approximate: true\n });\n this._currentDistanceMeasurementInitState.axisVisible = this._currentDistanceMeasurement.axisVisible && this.distanceMeasurementsPlugin.defaultAxisVisible;\n this._currentDistanceMeasurementInitState.xAxisVisible = this._currentDistanceMeasurement.xAxisVisible && this.distanceMeasurementsPlugin.defaultXAxisVisible;\n this._currentDistanceMeasurementInitState.yAxisVisible = this._currentDistanceMeasurement.yAxisVisible && this.distanceMeasurementsPlugin.defaultYAxisVisible;\n this._currentDistanceMeasurementInitState.zAxisVisible = this._currentDistanceMeasurement.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;\n this._currentDistanceMeasurementInitState.wireVisible = this._currentDistanceMeasurement.wireVisible;\n this._currentDistanceMeasurementInitState.targetVisible = this._currentDistanceMeasurement.targetVisible;\n this._currentDistanceMeasurement.clickable = false;\n this._currentDistanceMeasurement.origin.entity = hoveredEntity;\n hoveredEntity = null;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n }\n }\n });\n\n this._onCameraControlHoverSnapOrSurfaceOff = cameraControl.on(\n this._snapping\n ? \"hoverSnapOrSurfaceOff\"\n : \"hoverOff\", event => {\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = event.canvasPos;\n this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;\n }\n mouseHovering = false;\n this._markerDiv.style.left = `-100px`;\n this._markerDiv.style.top = `-100px`;\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.axisVisible = false;\n }\n canvas.style.cursor = \"default\";\n });\n\n this._active = true;\n }\n\n /**\n * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n\n this.fire(\"activated\", false);\n\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (this._markerDiv) {\n this._destroyMarkerDiv()\n }\n this.reset();\n const canvas = this.scene.canvas.canvas;\n canvas.removeEventListener(\"mousedown\", this._onMouseDown);\n canvas.removeEventListener(\"mouseup\", this._onMouseUp);\n const cameraControl = this.distanceMeasurementsPlugin.viewer.cameraControl;\n cameraControl.off(this._onCameraControlHoverSnapOrSurface);\n cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._active = false;\n }\n\n /**\n * Resets this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n *\n * Does nothing if the DistanceMeasurementsMouseControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n\n this._destroyMarkerDiv()\n this._initMarkerDiv()\n\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n\n this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;\n }\n\n /**\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n */\n get currentMeasurement() {\n return this._currentDistanceMeasurement;\n }\n\n /**\n * Destroys this DistanceMeasurementsMouseControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 819, + "__docId__": 823, "kind": "variable", "name": "MOUSE_FIRST_CLICK_EXPECTED", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", @@ -12930,7 +13062,7 @@ "ignore": true }, { - "__docId__": 820, + "__docId__": 824, "kind": "variable", "name": "MOUSE_SECOND_CLICK_EXPECTED", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", @@ -12951,7 +13083,7 @@ "ignore": true }, { - "__docId__": 821, + "__docId__": 825, "kind": "class", "name": "DistanceMeasurementsMouseControl", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js", @@ -12969,7 +13101,7 @@ ] }, { - "__docId__": 822, + "__docId__": 826, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13036,7 +13168,7 @@ ] }, { - "__docId__": 823, + "__docId__": 827, "kind": "member", "name": "_canvasToPagePos", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13054,7 +13186,7 @@ } }, { - "__docId__": 824, + "__docId__": 828, "kind": "member", "name": "pointerLens", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13071,7 +13203,7 @@ } }, { - "__docId__": 825, + "__docId__": 829, "kind": "member", "name": "_active", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13089,7 +13221,7 @@ } }, { - "__docId__": 826, + "__docId__": 830, "kind": "member", "name": "_currentDistanceMeasurement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13107,7 +13239,7 @@ } }, { - "__docId__": 827, + "__docId__": 831, "kind": "member", "name": "_currentDistanceMeasurementInitState", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13125,7 +13257,7 @@ } }, { - "__docId__": 828, + "__docId__": 832, "kind": "member", "name": "_onCameraControlHoverSnapOrSurface", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13143,7 +13275,7 @@ } }, { - "__docId__": 829, + "__docId__": 833, "kind": "member", "name": "_onCameraControlHoverSnapOrSurfaceOff", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13161,7 +13293,7 @@ } }, { - "__docId__": 830, + "__docId__": 834, "kind": "member", "name": "_onMouseDown", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13179,7 +13311,7 @@ } }, { - "__docId__": 831, + "__docId__": 835, "kind": "member", "name": "_onMouseUp", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13197,7 +13329,7 @@ } }, { - "__docId__": 832, + "__docId__": 836, "kind": "member", "name": "_onCanvasTouchStart", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13215,7 +13347,7 @@ } }, { - "__docId__": 833, + "__docId__": 837, "kind": "member", "name": "_onCanvasTouchEnd", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13233,7 +13365,7 @@ } }, { - "__docId__": 834, + "__docId__": 838, "kind": "member", "name": "_snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13251,7 +13383,7 @@ } }, { - "__docId__": 835, + "__docId__": 839, "kind": "member", "name": "_mouseState", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13269,7 +13401,7 @@ } }, { - "__docId__": 836, + "__docId__": 840, "kind": "method", "name": "_initMarkerDiv", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13286,7 +13418,7 @@ "return": null }, { - "__docId__": 837, + "__docId__": 841, "kind": "member", "name": "_markerDiv", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13304,7 +13436,7 @@ } }, { - "__docId__": 838, + "__docId__": 842, "kind": "method", "name": "_destroyMarkerDiv", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13321,7 +13453,7 @@ "return": null }, { - "__docId__": 840, + "__docId__": 844, "kind": "method", "name": "_attachPlugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13354,7 +13486,7 @@ "return": null }, { - "__docId__": 841, + "__docId__": 845, "kind": "member", "name": "distanceMeasurementsPlugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13373,7 +13505,7 @@ } }, { - "__docId__": 842, + "__docId__": 846, "kind": "member", "name": "plugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13392,7 +13524,7 @@ } }, { - "__docId__": 843, + "__docId__": 847, "kind": "get", "name": "active", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13424,7 +13556,7 @@ } }, { - "__docId__": 844, + "__docId__": 848, "kind": "set", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13449,7 +13581,7 @@ ] }, { - "__docId__": 847, + "__docId__": 851, "kind": "get", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13481,7 +13613,7 @@ } }, { - "__docId__": 848, + "__docId__": 852, "kind": "method", "name": "activate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13496,7 +13628,7 @@ "return": null }, { - "__docId__": 856, + "__docId__": 860, "kind": "method", "name": "deactivate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13511,7 +13643,7 @@ "return": null }, { - "__docId__": 859, + "__docId__": 863, "kind": "method", "name": "reset", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13526,7 +13658,40 @@ "return": null }, { - "__docId__": 861, + "__docId__": 866, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.", + "lineNumber": 409, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|DistanceMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "DistanceMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 867, "kind": "method", "name": "destroy", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl", @@ -13536,23 +13701,23 @@ "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl#destroy", "access": "public", "description": "Destroys this DistanceMeasurementsMouseControl.\n\nDestroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.", - "lineNumber": 407, + "lineNumber": 418, "params": [], "return": null }, { - "__docId__": 862, + "__docId__": 868, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {DistanceMeasurement} from \"./DistanceMeasurement.js\";\nimport {DistanceMeasurementsMouseControl} from \"./DistanceMeasurementsMouseControl.js\";\n\n/**\n * {@link Viewer} plugin for measuring point-to-point distances.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_distance_createWithMouse)\n *\n * * [[Example 1: Model with distance measurements](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_distance_modelWithMeasurements)]\n * * [[Example 2: Create distance measurements with mouse](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_createWithMouse_snapping)]\n * * [[Example 3: Configuring units and scale](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_unitsAndScale)\n *\n * ## Overview\n *\n * * A {@link DistanceMeasurement} represents a point-to-point measurement between two 3D points on one or two {@link Entity}s.\n * * As shown on the screen capture above, a DistanceMeasurement has one wire (light blue) that shows the direct point-to-point measurement,\n * and three more wires (red, green and blue) that show the distance on each of the World-space X, Y and Z axis.\n * * Create DistanceMeasurements programmatically with {@link DistanceMeasurementsPlugin#createMeasurement}.\n * * Create DistanceMeasurements interactively using a {@link DistanceMeasurementsControl}.\n * * Existing DistanceMeasurements are registered by ID in {@link DistanceMeasurementsPlugin#measurements}.\n * * Destroy DistanceMeasurements using {@link DistanceMeasurementsPlugin#destroyMeasurement}.\n * * Configure global measurement units and scale via {@link Metrics}, located at {@link Scene#metrics}.\n *\n * ## Example 1: Creating DistanceMeasurements Programmatically\n *\n * In our first example, we'll use an {@link XKTLoaderPlugin} to load a model, and then use a DistanceMeasurementsPlugin to programmatically create two {@link DistanceMeasurement}s.\n *\n * Note how each DistanceMeasurement has ````origin```` and ````target```` endpoints, which each indicate a 3D World-space\n * position on the surface of an {@link Entity}. The endpoints can be attached to the same Entity, or to different Entitys.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_modelWithMeasurements)]\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * const myMeasurement1 = distanceMeasurements.createMeasurement({\n * id: \"distanceMeasurement1\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [0.044, 5.998, 17.767]\n * },\n * target: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [4.738, 3.172, 17.768]\n * },\n * visible: true,\n * wireVisible: true\n * });\n *\n * const myMeasurement2 = distanceMeasurements.createMeasurement({\n * id: \"distanceMeasurement2\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNr2\"],\n * worldPos: [0.457, 2.532, 17.766]\n * },\n * target: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [0.436, 0.001, 22.135]\n * },\n * visible: true,\n * wireVisible: true\n * });\n * });\n * ````\n *\n * ## Example 2: Creating DistanceMeasurements with Mouse Input\n *\n * In our second example, we'll use an {@link XKTLoaderPlugin} to load a model, then we'll use a\n * {@link DistanceMeasurementsMouseControl} to interactively create {@link DistanceMeasurement}s with mouse input.\n *\n * After we've activated the DistanceMeasurementsMouseControl, the first click on any {@link Entity} begins constructing a DistanceMeasurement, fixing its\n * origin to that Entity. The next click on any Entity will complete the DistanceMeasurement, fixing its target to that second Entity.\n *\n * The DistanceMeasurementsMouseControl will then wait for the next click on any Entity, to begin constructing\n * another DistanceMeasurement, and so on, until deactivated again.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_createWithMouse_snapping)]\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin, DistanceMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const distanceMeasurementsControl = new DistanceMeasurementsMouseControl(distanceMeasurements, {\n * pointerLens : new PointerLens(viewer)\n * })\n *\n * distanceMeasurementsControl.snapToVertex = true;\n * distanceMeasurementsControl.snapToEdge = true;\n *\n * distanceMeasurementsControl.activate();\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n * ````\n *\n * ## Example 3: Configuring Measurement Units and Scale\n *\n * In our third example, we'll use the {@link Scene}'s {@link Metrics} to set the global unit of measurement to ````\"meters\"````. We'll also specify that a unit within the World-space coordinate system represents ten meters.\n *\n * The wires belonging to our DistanceMeasurements show their lengths in Real-space coordinates, in the current unit of measurement. They will dynamically update as we set these configurations.\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_distance_unitsAndScale)]\n *\n * ````JavaScript\n * const metrics = viewer.scene.metrics;\n\n * metrics.units = \"meters\";\n * metrics.scale = 10.0;\n * ````\n *\n * ## Example 4: Attaching Mouse Handlers\n *\n * In our fourth example, we'll attach event handlers to our plugin, to catch when the user\n * hovers or right-clicks over our measurements.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#measurements_distance_modelWithMeasurements)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin, DistanceMeasurementsMouseControl, PointerLens} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const distanceMeasurementsControl = new DistanceMeasurementsMouseControl(distanceMeasurements, {\n * pointerLens : new PointerLens(viewer)\n * })\n *\n * distanceMeasurementsControl.snapToVertex = true;\n * distanceMeasurementsControl.snapToEdge = true;\n *\n * distanceMeasurementsControl.activate();\n *\n * distanceMeasurements.on(\"mouseOver\", (e) => {\n * e.measurement.setHighlighted(true);\n * });\n *\n * distanceMeasurements.on(\"mouseLeave\", (e) => {\n * e.measurement.setHighlighted(false);\n * });\n *\n * distanceMeasurements.on(\"contextMenu\", (e) => {\n * // Show context menu\n * e.event.preventDefault();\n * });\n *\n * const model = xktLoader.load({\n * src: \"Duplex.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * const myMeasurement1 = distanceMeasurements.createMeasurement({\n * id: \"distanceMeasurement1\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [0.044, 5.998, 17.767]\n * },\n * target: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FLOH\"],\n * worldPos: [4.738, 3.172, 17.768]\n * },\n * visible: true,\n * wireVisible: true\n * });\n *\n * const myMeasurement2 = distanceMeasurements.createMeasurement({\n * id: \"distanceMeasurement2\",\n * origin: {\n * entity: viewer.scene.objects[\"2O2Fr$t4X7Zf8NOew3FNr2\"],\n * worldPos: [0.457, 2.532, 17.766]\n * },\n * target: {\n * entity: viewer.scene.objects[\"1CZILmCaHETO8tf3SgGEXu\"],\n * worldPos: [0.436, 0.001, 22.135]\n * },\n * visible: true,\n * wireVisible: true\n * });\n * });\n * ````\n *\n * ## Example 5: Creating DistanceMeasurements with Touch Input\n *\n * In our fifth example, we'll show how to create distance measurements with touch input, with snapping\n * to the nearest vertex or edge. While creating the measurements, a long-touch when setting the\n * start or end point will cause the point to snap to the nearest vertex or edge. A quick\n * touch-release will immediately set the point at the tapped position on the object surface.\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/measurement/#distance_createWithTouch_snapping)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);\n *\n * const distanceMeasurementsTouchControl = new DistanceMeasurementsTouchControl(distanceMeasurements, {\n * pointerLens : new PointerLens(viewer),\n * snapToVertex: true,\n * snapToEdge: true\n * })\n *\n * distanceMeasurementsTouchControl.activate();\n * ````\n */\nclass DistanceMeasurementsPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} [cfg] Plugin configuration.\n * @param {String} [cfg.id=\"DistanceMeasurements\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.\n * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.\n * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.\n * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.\n * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.\n * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.\n * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.\n * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.\n * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.\n * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.\n * @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.\n * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.\n * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).\n * @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.\n * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"DistanceMeasurements\", viewer);\n\n this._pointerLens = cfg.pointerLens;\n\n this._container = cfg.container || document.body;\n\n this._defaultControl = null;\n\n this._measurements = {};\n\n this.labelMinAxisLength = cfg.labelMinAxisLength;\n\n this.defaultVisible = cfg.defaultVisible !== false;\n this.defaultOriginVisible = cfg.defaultOriginVisible !== false;\n this.defaultTargetVisible = cfg.defaultTargetVisible !== false;\n this.defaultWireVisible = cfg.defaultWireVisible !== false;\n this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;\n this.defaultAxisVisible = cfg.defaultAxisVisible !== false;\n this.defaultXAxisVisible = cfg.defaultXAxisVisible !== false;\n this.defaultYAxisVisible = cfg.defaultYAxisVisible !== false;\n this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;\n this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : \"#00BBFF\";\n this.zIndex = cfg.zIndex || 10000;\n this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;\n\n this._onMouseOver = (event, measurement) => {\n this.fire(\"mouseOver\", {\n plugin: this,\n distanceMeasurement: measurement,\n measurement,\n event\n });\n }\n\n this._onMouseLeave = (event, measurement) => {\n this.fire(\"mouseLeave\", {\n plugin: this,\n distanceMeasurement: measurement,\n measurement,\n event\n });\n };\n\n this._onContextMenu = (event, measurement) => {\n this.fire(\"contextMenu\", {\n plugin: this,\n distanceMeasurement: measurement,\n measurement,\n event\n });\n };\n }\n\n /**\n * Gets the plugin's HTML container element, if any.\n * @returns {*|HTMLElement|HTMLElement}\n */\n getContainerElement() {\n return this._container;\n }\n\n /**\n * @private\n */\n send(name, value) {\n\n }\n\n /**\n * Gets the PointerLens attached to this DistanceMeasurementsPlugin.\n * @returns {PointerCircle}\n */\n get pointerLens() {\n return this._pointerLens;\n }\n\n /**\n * Gets the default {@link DistanceMeasurementsControl}.\n *\n * @type {DistanceMeasurementsControl}\n * @deprecated\n */\n get control() {\n if (!this._defaultControl) {\n this._defaultControl = new DistanceMeasurementsMouseControl(this, {});\n }\n return this._defaultControl;\n }\n\n /**\n * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.\n *\n * @type {{String:DistanceMeasurement}}\n */\n get measurements() {\n return this._measurements;\n }\n\n /**\n * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.\n *\n * The axis wire's label is not shown when its length is less than this value.\n *\n * This is ````25```` pixels by default.\n *\n * Must not be less than ````1````.\n *\n * @type {number}\n */\n set labelMinAxisLength(labelMinAxisLength) {\n if (labelMinAxisLength < 1) {\n this.error(\"labelMinAxisLength must be >= 1; defaulting to 25\");\n labelMinAxisLength = 25;\n }\n this._labelMinAxisLength = labelMinAxisLength || 25;\n }\n\n /**\n * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.\n * @returns {number}\n */\n get labelMinAxisLength() {\n return this._labelMinAxisLength;\n }\n\n /**\n * Creates a {@link DistanceMeasurement}.\n *\n * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.\n *\n * @param {Object} params {@link DistanceMeasurement} configuration.\n * @param {String} params.id Unique ID to assign to {@link DistanceMeasurement#id}. The DistanceMeasurement will be registered by this in {@link DistanceMeasurementsPlugin#measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.\n * @param {Number[]} params.origin.worldPos Origin World-space 3D position.\n * @param {Entity} params.origin.entity Origin Entity.\n * @param {Number[]} params.target.worldPos Target World-space 3D position.\n * @param {Entity} params.target.entity Target Entity.\n * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.\n * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.\n * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.\n * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.\n * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.\n * @param {string} [params.color] The color of the length dot, wire and label.\n * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.\n * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.\n */\n createMeasurement(params = {}) {\n if (this.viewer.scene.components[params.id]) {\n this.error(\"Viewer scene component with this ID already exists: \" + params.id);\n delete params.id;\n }\n const origin = params.origin;\n const target = params.target;\n const measurement = new DistanceMeasurement(this, {\n id: params.id,\n plugin: this,\n container: this._container,\n origin: {\n entity: origin.entity,\n worldPos: origin.worldPos\n },\n target: {\n entity: target.entity,\n worldPos: target.worldPos\n },\n visible: params.visible,\n wireVisible: params.wireVisible,\n axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,\n xAxisVisible: params.xAxisVisible !== false && this.defaultXAxisVisible !== false,\n yAxisVisible: params.yAxisVisible !== false && this.defaultYAxisVisible !== false,\n zAxisVisible: params.zAxisVisible !== false && this.defaultZAxisVisible !== false,\n labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,\n originVisible: params.originVisible,\n targetVisible: params.targetVisible,\n color: params.color,\n labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,\n onMouseOver: this._onMouseOver,\n onMouseLeave: this._onMouseLeave,\n onContextMenu: this._onContextMenu\n });\n this._measurements[measurement.id] = measurement;\n measurement.on(\"destroyed\", () => {\n delete this._measurements[measurement.id];\n });\n this.fire(\"measurementCreated\", measurement);\n return measurement;\n }\n\n /**\n * Destroys a {@link DistanceMeasurement}.\n *\n * @param {String} id ID of DistanceMeasurement to destroy.\n */\n destroyMeasurement(id) {\n const measurement = this._measurements[id];\n if (!measurement) {\n this.log(\"DistanceMeasurement not found: \" + id);\n return;\n }\n measurement.destroy();\n this.fire(\"measurementDestroyed\", measurement);\n }\n\n /**\n * Shows all or hides the distance label of each {@link DistanceMeasurement}.\n *\n * @param {Boolean} labelsShown Whether or not to show the labels.\n */\n setLabelsShown(labelsShown) {\n for (const [key, measurement] of Object.entries(this.measurements)) {\n measurement.labelShown = labelsShown;\n }\n }\n\n /**\n * Shows all or hides the axis wires of each {@link DistanceMeasurement}.\n *\n * @param {Boolean} labelsShown Whether or not to show the axis wires.\n */\n setAxisVisible(axisVisible) {\n for (const [key, measurement] of Object.entries(this.measurements)) {\n measurement.axisVisible = axisVisible;\n }\n this.defaultAxisVisible = axisVisible;\n }\n\n /**\n * Gets if the axis wires of each {@link DistanceMeasurement} are visible.\n *\n * @returns {Boolean} Whether or not the axis wires are visible.\n */\n getAxisVisible() {\n return this.defaultAxisVisible;\n }\n\n /**\n * Destroys all {@link DistanceMeasurement}s.\n */\n clear() {\n const ids = Object.keys(this._measurements);\n for (var i = 0, len = ids.length; i < len; i++) {\n this.destroyMeasurement(ids[i]);\n }\n }\n\n /**\n * Destroys this DistanceMeasurementsPlugin.\n *\n * Destroys all {@link DistanceMeasurement}s first.\n */\n destroy() {\n this.clear();\n super.destroy();\n }\n}\n\nexport {DistanceMeasurementsPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 863, + "__docId__": 869, "kind": "class", "name": "DistanceMeasurementsPlugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js", @@ -13570,7 +13735,7 @@ ] }, { - "__docId__": 864, + "__docId__": 870, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13797,7 +13962,7 @@ ] }, { - "__docId__": 865, + "__docId__": 871, "kind": "member", "name": "_pointerLens", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13815,7 +13980,7 @@ } }, { - "__docId__": 866, + "__docId__": 872, "kind": "member", "name": "_container", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13833,7 +13998,7 @@ } }, { - "__docId__": 867, + "__docId__": 873, "kind": "member", "name": "_defaultControl", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13851,7 +14016,7 @@ } }, { - "__docId__": 868, + "__docId__": 874, "kind": "member", "name": "_measurements", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13869,7 +14034,7 @@ } }, { - "__docId__": 870, + "__docId__": 876, "kind": "member", "name": "defaultVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13886,7 +14051,7 @@ } }, { - "__docId__": 871, + "__docId__": 877, "kind": "member", "name": "defaultOriginVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13903,7 +14068,7 @@ } }, { - "__docId__": 872, + "__docId__": 878, "kind": "member", "name": "defaultTargetVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13920,7 +14085,7 @@ } }, { - "__docId__": 873, + "__docId__": 879, "kind": "member", "name": "defaultWireVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13937,7 +14102,7 @@ } }, { - "__docId__": 874, + "__docId__": 880, "kind": "member", "name": "defaultLabelsVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13954,7 +14119,7 @@ } }, { - "__docId__": 875, + "__docId__": 881, "kind": "member", "name": "defaultAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13971,7 +14136,7 @@ } }, { - "__docId__": 876, + "__docId__": 882, "kind": "member", "name": "defaultXAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -13988,7 +14153,7 @@ } }, { - "__docId__": 877, + "__docId__": 883, "kind": "member", "name": "defaultYAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14005,7 +14170,7 @@ } }, { - "__docId__": 878, + "__docId__": 884, "kind": "member", "name": "defaultZAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14022,7 +14187,7 @@ } }, { - "__docId__": 879, + "__docId__": 885, "kind": "member", "name": "defaultColor", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14039,7 +14204,7 @@ } }, { - "__docId__": 880, + "__docId__": 886, "kind": "member", "name": "zIndex", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14056,7 +14221,7 @@ } }, { - "__docId__": 881, + "__docId__": 887, "kind": "member", "name": "defaultLabelsOnWires", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14073,7 +14238,7 @@ } }, { - "__docId__": 882, + "__docId__": 888, "kind": "member", "name": "_onMouseOver", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14091,7 +14256,7 @@ } }, { - "__docId__": 883, + "__docId__": 889, "kind": "member", "name": "_onMouseLeave", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14109,7 +14274,7 @@ } }, { - "__docId__": 884, + "__docId__": 890, "kind": "member", "name": "_onContextMenu", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14127,7 +14292,7 @@ } }, { - "__docId__": 885, + "__docId__": 891, "kind": "method", "name": "getContainerElement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14157,7 +14322,7 @@ "params": [] }, { - "__docId__": 886, + "__docId__": 892, "kind": "method", "name": "send", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14186,7 +14351,7 @@ "return": null }, { - "__docId__": 887, + "__docId__": 893, "kind": "get", "name": "pointerLens", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14218,7 +14383,7 @@ } }, { - "__docId__": 888, + "__docId__": 894, "kind": "get", "name": "control", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14240,7 +14405,7 @@ } }, { - "__docId__": 890, + "__docId__": 896, "kind": "get", "name": "measurements", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14261,7 +14426,7 @@ } }, { - "__docId__": 891, + "__docId__": 897, "kind": "set", "name": "labelMinAxisLength", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14282,7 +14447,7 @@ } }, { - "__docId__": 892, + "__docId__": 898, "kind": "member", "name": "_labelMinAxisLength", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14300,7 +14465,7 @@ } }, { - "__docId__": 893, + "__docId__": 899, "kind": "get", "name": "labelMinAxisLength", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14332,7 +14497,7 @@ } }, { - "__docId__": 894, + "__docId__": 900, "kind": "method", "name": "createMeasurement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14551,7 +14716,7 @@ } }, { - "__docId__": 895, + "__docId__": 901, "kind": "method", "name": "destroyMeasurement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14577,7 +14742,7 @@ "return": null }, { - "__docId__": 896, + "__docId__": 902, "kind": "method", "name": "setLabelsShown", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14603,7 +14768,7 @@ "return": null }, { - "__docId__": 897, + "__docId__": 903, "kind": "method", "name": "setAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14629,7 +14794,7 @@ "return": null }, { - "__docId__": 899, + "__docId__": 905, "kind": "method", "name": "getAxisVisible", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14657,7 +14822,7 @@ "params": [] }, { - "__docId__": 900, + "__docId__": 906, "kind": "method", "name": "clear", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14672,7 +14837,7 @@ "return": null }, { - "__docId__": 901, + "__docId__": 907, "kind": "method", "name": "destroy", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js~DistanceMeasurementsPlugin", @@ -14687,18 +14852,18 @@ "return": null }, { - "__docId__": 902, + "__docId__": 908, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", - "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {PointerCircle} from \"../../extras/PointerCircle/PointerCircle.js\";\nimport {DistanceMeasurementsControl} from \"./DistanceMeasurementsControl.js\";\n\n\nconst WAITING_FOR_ORIGIN_TOUCH_START = 0;\nconst WAITING_FOR_ORIGIN_QUICK_TOUCH_END = 1;\nconst WAITING_FOR_ORIGIN_LONG_TOUCH_END = 2;\n\nconst WAITING_FOR_TARGET_TOUCH_START = 3;\nconst WAITING_FOR_TARGET_QUICK_TOUCH_END = 4;\nconst WAITING_FOR_TARGET_LONG_TOUCH_END = 5;\n\nconst TOUCH_CANCELING = 7;\n\n/**\n * Creates {@link DistanceMeasurement}s from touch input.\n *\n * See {@link DistanceMeasurementsPlugin} for more info.\n *\n */\nexport class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {\n\n /**\n * Creates a DistanceMeasurementsTouchControl bound to the given DistanceMeasurementsPlugin.\n */\n constructor(distanceMeasurementsPlugin, cfg = {}) {\n\n super(distanceMeasurementsPlugin.viewer.scene);\n\n this.pointerLens = cfg.pointerLens;\n this.pointerCircle = new PointerCircle(distanceMeasurementsPlugin.viewer);\n\n this._active = false;\n\n const markerDiv = document.createElement('div');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.margin = \"-200px -200px\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n\n this._currentDistanceMeasurement = null;\n\n this._currentDistanceMeasurementInitState = {\n wireVisible: null,\n axisVisible: null,\n xAxisVisible: null,\n yaxisVisible: null,\n zAxisVisible: null,\n targetVisible: null,\n }\n\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._longTouchTimeoutMs = 300;\n this._snapping = cfg.snapping !== false;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n this._attachPlugin(distanceMeasurementsPlugin, cfg);\n }\n\n _attachPlugin(distanceMeasurementsPlugin) {\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.distanceMeasurementsPlugin = distanceMeasurementsPlugin;\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.plugin = distanceMeasurementsPlugin;\n }\n\n /** Gets if this DistanceMeasurementsTouchControl is currently active, where it is responding to input.\n *\n * @returns {Boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this DistanceMeasurementsTouchControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n const plugin = this.plugin;\n const scene = this.scene;\n const canvas = scene.canvas.canvas;\n const pointerLens = plugin.pointerLens;\n const pointerWorldPos = math.vec3();\n\n const touchTolerance = 20;\n\n let longTouchTimeout = null;\n\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n const touchStartCanvasPos = math.vec2();\n const touchMoveCanvasPos = math.vec2();\n const touchEndCanvasPos = math.vec2();\n\n let touchId = null;\n\n const disableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = false;\n }\n\n const enableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = true;\n }\n\n const cancel = () => {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n enableCameraNavigation();\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n }\n\n canvas.addEventListener(\"touchstart\", this._onCanvasTouchStart = (event) => {\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n touchStartCanvasPos.set([touchX, touchY]);\n touchMoveCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_TOUCH_START:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n cancel();\n return;\n }\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapping: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n pointerWorldPos.set(snapPickResult.worldPos);\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n pointerWorldPos.set(pickResult.worldPos);\n this.pointerCircle.start(pickResult.canvasPos);\n } else {\n return;\n }\n }\n longTouchTimeout = setTimeout(() => {\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n return; // Has moved\n }\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.cursorPos = touchStartCanvasPos;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n this.pointerLens.snapped = false;\n }\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.canvasPos;\n this.pointerLens.snapped = true;\n }\n // pointerWorldPos.set(snapPickResult.snappedWorldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pointerWorldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: pointerWorldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = pointerWorldPos;\n }\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n // if (this.pointerLens) {\n // this.pointerLens.cursorPos = pickResult.canvasPos;\n // this.pointerLens.snapped = false;\n // }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n disableCameraNavigation();\n }, this._longTouchTimeoutMs);\n this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END\")\n\n touchId = touch.identifier;\n\n break;\n\n\n case WAITING_FOR_TARGET_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = snapPickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_TARGET_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n default:\n if (longTouchTimeout !== null) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchstart: this._touchState= default -> TOUCH_CANCELING\")\n return;\n }\n\n }, {passive: true});\n\n\n canvas.addEventListener(\"touchmove\", (event) => {\n\n this.pointerCircle.stop();\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1 || event.changedTouches.length !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n touchMoveCanvasPos.set([touchX, touchY]);\n\n let snapPickResult;\n let pickResult;\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && (snapPickResult.snapped)) {\n if (this.pointerLens) {\n this.pointerLens.snappedCanvasPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n pointerWorldPos.set(snapPickResult.worldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = snapPickResult.worldPos;\n }\n\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n pointerWorldPos.set(pickResult.worldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n },\n target: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = pickResult.worldPos;\n }\n\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n }\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n break;\n\n // case WAITING_FOR_TARGET_TOUCH_START:\n // this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_TOUCH_START\")\n // break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = snapPickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n break;\n\n default:\n break;\n }\n }, {passive: true});\n\n canvas.addEventListener(\"touchend\", this._onCanvasTouchEnd = (event) => {\n\n this.pointerCircle.stop();\n\n const numChangedTouches = event.changedTouches.length;\n\n if (numChangedTouches !== 1) {\n return;\n }\n\n const touch = event.changedTouches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n\n touchEndCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n },\n target: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentDistanceMeasurement) {\n if (this.pointerLens) {\n this.pointerLens.snapped = false;\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (no measurement) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n } else {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentDistanceMeasurement || !this._currentDistanceMeasurement.targetVisible) {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._currentDistanceMeasurement.clickable = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n }\n\n }, {passive: true});\n\n this._active = true;\n }\n\n /**\n * Deactivates this DistanceMeasurementsTouchControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.plugin.pointerLens) {\n this.plugin.pointerLens.visible = false;\n }\n this.reset();\n const canvas = this.plugin.viewer.scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._onCanvasTouchStart);\n canvas.removeEventListener(\"touchend\", this._onCanvasTouchEnd);\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._active = false;\n this.plugin.viewer.cameraControl.active = true;\n }\n\n /**\n * Resets this DistanceMeasurementsTouchControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction.\n *\n * Does nothing if the DistanceMeasurementsTouchControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n }\n\n /**\n * Destroys this DistanceMeasurementsTouchControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", + "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {PointerCircle} from \"../../extras/PointerCircle/PointerCircle.js\";\nimport {DistanceMeasurementsControl} from \"./DistanceMeasurementsControl.js\";\n\n\nconst WAITING_FOR_ORIGIN_TOUCH_START = 0;\nconst WAITING_FOR_ORIGIN_QUICK_TOUCH_END = 1;\nconst WAITING_FOR_ORIGIN_LONG_TOUCH_END = 2;\n\nconst WAITING_FOR_TARGET_TOUCH_START = 3;\nconst WAITING_FOR_TARGET_QUICK_TOUCH_END = 4;\nconst WAITING_FOR_TARGET_LONG_TOUCH_END = 5;\n\nconst TOUCH_CANCELING = 7;\n\n/**\n * Creates {@link DistanceMeasurement}s from touch input.\n *\n * See {@link DistanceMeasurementsPlugin} for more info.\n *\n */\nexport class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {\n\n /**\n * Creates a DistanceMeasurementsTouchControl bound to the given DistanceMeasurementsPlugin.\n */\n constructor(distanceMeasurementsPlugin, cfg = {}) {\n\n super(distanceMeasurementsPlugin.viewer.scene);\n\n this.pointerLens = cfg.pointerLens;\n this.pointerCircle = new PointerCircle(distanceMeasurementsPlugin.viewer);\n\n this._active = false;\n\n const markerDiv = document.createElement('div');\n const canvas = this.scene.canvas.canvas;\n canvas.parentNode.insertBefore(markerDiv, canvas);\n\n markerDiv.style.background = \"black\";\n markerDiv.style.border = \"2px solid blue\";\n markerDiv.style.borderRadius = \"10px\";\n markerDiv.style.width = \"5px\";\n markerDiv.style.height = \"5px\";\n markerDiv.style.margin = \"-200px -200px\";\n markerDiv.style.zIndex = \"100\";\n markerDiv.style.position = \"absolute\";\n markerDiv.style.pointerEvents = \"none\";\n\n this.markerDiv = markerDiv;\n\n this._currentDistanceMeasurement = null;\n\n this._currentDistanceMeasurementInitState = {\n wireVisible: null,\n axisVisible: null,\n xAxisVisible: null,\n yaxisVisible: null,\n zAxisVisible: null,\n targetVisible: null,\n }\n\n this._onCanvasTouchStart = null;\n this._onCanvasTouchEnd = null;\n this._longTouchTimeoutMs = 300;\n this._snapping = cfg.snapping !== false;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n this._attachPlugin(distanceMeasurementsPlugin, cfg);\n }\n\n _attachPlugin(distanceMeasurementsPlugin) {\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.distanceMeasurementsPlugin = distanceMeasurementsPlugin;\n\n /**\n * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.\n * @type {DistanceMeasurementsPlugin}\n */\n this.plugin = distanceMeasurementsPlugin;\n }\n\n /** Gets if this DistanceMeasurementsTouchControl is currently active, where it is responding to input.\n *\n * @returns {Boolean}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n *\n * This is `true` by default.\n *\n * Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that\n * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds\n * and rebinds various input handlers.\n *\n * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.\n */\n set snapping(snapping) {\n if (snapping !== this._snapping) {\n this._snapping = snapping;\n this.deactivate();\n this.activate();\n } else {\n this._snapping = snapping;\n }\n }\n\n /**\n * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n *\n * This is `true` by default.\n *\n * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.\n */\n get snapping() {\n return this._snapping;\n }\n\n /**\n * Activates this DistanceMeasurementsTouchControl, ready to respond to input.\n */\n activate() {\n\n if (this._active) {\n return;\n }\n\n const plugin = this.plugin;\n const scene = this.scene;\n const canvas = scene.canvas.canvas;\n const pointerLens = plugin.pointerLens;\n const pointerWorldPos = math.vec3();\n\n const touchTolerance = 20;\n\n let longTouchTimeout = null;\n\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n\n const touchStartCanvasPos = math.vec2();\n const touchMoveCanvasPos = math.vec2();\n const touchEndCanvasPos = math.vec2();\n\n let touchId = null;\n\n const disableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = false;\n }\n\n const enableCameraNavigation = () => {\n this.plugin.viewer.cameraControl.active = true;\n }\n\n const cancel = () => {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n enableCameraNavigation();\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n }\n\n canvas.addEventListener(\"touchstart\", this._onCanvasTouchStart = (event) => {\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n touchStartCanvasPos.set([touchX, touchY]);\n touchMoveCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_TOUCH_START:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n cancel();\n return;\n }\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapping: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n pointerWorldPos.set(snapPickResult.worldPos);\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n pointerWorldPos.set(pickResult.worldPos);\n this.pointerCircle.start(pickResult.canvasPos);\n } else {\n return;\n }\n }\n longTouchTimeout = setTimeout(() => {\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n return; // Has moved\n }\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.cursorPos = touchStartCanvasPos;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n this.pointerLens.snapped = false;\n }\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.canvasPos;\n this.pointerLens.snapped = true;\n }\n // pointerWorldPos.set(snapPickResult.snappedWorldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pointerWorldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: pointerWorldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = pointerWorldPos;\n }\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n // if (this.pointerLens) {\n // this.pointerLens.cursorPos = pickResult.canvasPos;\n // this.pointerLens.snapped = false;\n // }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n disableCameraNavigation();\n }, this._longTouchTimeoutMs);\n this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END\")\n\n touchId = touch.identifier;\n\n break;\n\n\n case WAITING_FOR_TARGET_TOUCH_START:\n\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n return;\n }\n if (currentNumTouches === 1) { // One finger down\n longTouchTimeout = setTimeout(() => {\n longTouchTimeout = null;\n if (currentNumTouches !== 1 ||\n touchMoveCanvasPos[0] > touchStartCanvasPos[0] + touchTolerance ||\n touchMoveCanvasPos[0] < touchStartCanvasPos[0] - touchTolerance ||\n touchMoveCanvasPos[1] > touchStartCanvasPos[1] + touchTolerance ||\n touchMoveCanvasPos[1] < touchStartCanvasPos[1] - touchTolerance) {\n // Has moved\n return;\n }\n\n // Long touch\n if (this.pointerLens) {\n this.pointerLens.visible = true;\n this.pointerLens.canvasPos = touchStartCanvasPos;\n this.pointerLens.snapped = false;\n }\n\n const snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.snapped) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this.pointerCircle.start(snapPickResult.snappedCanvasPos);\n pointerWorldPos.set(snapPickResult.worldPos);\n this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = snapPickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this.pointerCircle.start(pickResult.canvasPos);\n pointerWorldPos.set(pickResult.worldPos);\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n\n }\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END\")\n\n disableCameraNavigation();\n\n }, this._longTouchTimeoutMs);\n\n this._touchState = WAITING_FOR_TARGET_QUICK_TOUCH_END;\n // console.log(\"touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END\")\n }\n\n touchId = touch.identifier;\n\n break;\n\n default:\n if (longTouchTimeout !== null) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchstart: this._touchState= default -> TOUCH_CANCELING\")\n return;\n }\n\n }, {passive: true});\n\n\n canvas.addEventListener(\"touchmove\", (event) => {\n\n this.pointerCircle.stop();\n\n const currentNumTouches = event.touches.length;\n\n if (currentNumTouches !== 1 || event.changedTouches.length !== 1) {\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n return;\n }\n\n const touch = event.touches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n touchMoveCanvasPos.set([touchX, touchY]);\n\n let snapPickResult;\n let pickResult;\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && (snapPickResult.snapped)) {\n if (this.pointerLens) {\n this.pointerLens.snappedCanvasPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n pointerWorldPos.set(snapPickResult.worldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n },\n target: {\n worldPos: snapPickResult.worldPos,\n entity: snapPickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = snapPickResult.worldPos;\n }\n\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n pointerWorldPos.set(pickResult.worldPos);\n if (!this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n },\n target: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n } else {\n this._currentDistanceMeasurement.origin.worldPos = pickResult.worldPos;\n }\n\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n } else {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = null;\n this.pointerLens.snapped = false;\n }\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END\")\n break;\n\n // case WAITING_FOR_TARGET_TOUCH_START:\n // this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchmove: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_TOUCH_START\")\n // break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (currentNumTouches !== 1 && longTouchTimeout !== null) { // Two or more fingers down\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n this._touchState = TOUCH_CANCELING;\n // console.log(\"touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING\")\n return;\n }\n if (this.pointerLens) {\n this.pointerLens.canvasPos = touchMoveCanvasPos;\n }\n snapPickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n snapToVertex: this._snapping,\n snapToEdge: this._snapping\n });\n if (snapPickResult && snapPickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = snapPickResult.snappedCanvasPos;\n this.pointerLens.snapped = true;\n }\n this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = snapPickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n } else {\n pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n })\n if (pickResult && pickResult.worldPos) {\n if (this.pointerLens) {\n this.pointerLens.cursorPos = pickResult.canvasPos;\n this.pointerLens.snapped = false;\n }\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n\n }\n }\n this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;\n break;\n\n default:\n break;\n }\n }, {passive: true});\n\n canvas.addEventListener(\"touchend\", this._onCanvasTouchEnd = (event) => {\n\n this.pointerCircle.stop();\n\n const numChangedTouches = event.changedTouches.length;\n\n if (numChangedTouches !== 1) {\n return;\n }\n\n const touch = event.changedTouches[0];\n const touchX = touch.clientX;\n const touchY = touch.clientY;\n\n if (touch.identifier !== touchId) {\n return;\n }\n\n if (longTouchTimeout) {\n clearTimeout(longTouchTimeout);\n longTouchTimeout = null;\n }\n\n touchEndCanvasPos.set([touchX, touchY]);\n\n switch (this._touchState) {\n\n case WAITING_FOR_ORIGIN_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentDistanceMeasurement = plugin.createMeasurement({\n id: math.createUUID(),\n origin: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n },\n target: {\n worldPos: pickResult.worldPos,\n entity: pickResult.entity\n }\n });\n this._currentDistanceMeasurement.labelsVisible = false;\n this._currentDistanceMeasurement.xAxisVisible = false;\n this._currentDistanceMeasurement.yAxisVisible = false;\n this._currentDistanceMeasurement.zAxisVisible = false;\n this._currentDistanceMeasurement.wireVisible = false;\n this._currentDistanceMeasurement.originVisible = true;\n this._currentDistanceMeasurement.targetVisible = false;\n this._currentDistanceMeasurement.clickable = false;\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n this.distanceMeasurementsPlugin.fire(\"measurementStart\", this._currentDistanceMeasurement);\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_ORIGIN_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentDistanceMeasurement) {\n if (this.pointerLens) {\n this.pointerLens.snapped = false;\n this.pointerLens.visible = false;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (no measurement) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_QUICK_TOUCH_END: {\n if (numChangedTouches !== 1 ||\n touchX > touchStartCanvasPos[0] + touchTolerance ||\n touchX < touchStartCanvasPos[0] - touchTolerance ||\n touchY > touchStartCanvasPos[1] + touchTolerance ||\n touchY < touchStartCanvasPos[1] - touchTolerance) {\n this._touchState = WAITING_FOR_TARGET_TOUCH_START;\n return;\n }\n const pickResult = scene.pick({\n canvasPos: touchMoveCanvasPos,\n pickSurface: true\n });\n if (pickResult && pickResult.worldPos) {\n this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;\n this._currentDistanceMeasurement.target.entity = pickResult.entity;\n this._currentDistanceMeasurement.targetVisible = true;\n this._currentDistanceMeasurement.wireVisible = true;\n this._currentDistanceMeasurement.labelsVisible = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n } else {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n\n case WAITING_FOR_TARGET_LONG_TOUCH_END:\n if (this.pointerLens) {\n this.pointerLens.visible = false;\n }\n if (!this._currentDistanceMeasurement || !this._currentDistanceMeasurement.targetVisible) {\n if (this._currentDistanceMeasurement) {\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START\")\n } else {\n this._currentDistanceMeasurement.clickable = true;\n this.distanceMeasurementsPlugin.fire(\"measurementEnd\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement = null;\n this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;\n // console.log(\"touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START\")\n }\n enableCameraNavigation();\n break;\n }\n\n }, {passive: true});\n\n this._active = true;\n }\n\n /**\n * Deactivates this DistanceMeasurementsTouchControl, making it unresponsive to input.\n *\n * Destroys any {@link DistanceMeasurement} under construction.\n */\n deactivate() {\n if (!this._active) {\n return;\n }\n if (this.plugin.pointerLens) {\n this.plugin.pointerLens.visible = false;\n }\n this.reset();\n const canvas = this.plugin.viewer.scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._onCanvasTouchStart);\n canvas.removeEventListener(\"touchend\", this._onCanvasTouchEnd);\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._active = false;\n this.plugin.viewer.cameraControl.active = true;\n }\n\n /**\n * Resets this DistanceMeasurementsTouchControl.\n *\n * Destroys any {@link DistanceMeasurement} under construction.\n *\n * Does nothing if the DistanceMeasurementsTouchControl is not active.\n */\n reset() {\n if (!this._active) {\n return;\n }\n if (this._currentDistanceMeasurement) {\n this.distanceMeasurementsPlugin.fire(\"measurementCancel\", this._currentDistanceMeasurement);\n this._currentDistanceMeasurement.destroy();\n this._currentDistanceMeasurement = null;\n }\n this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START;\n }\n\n /**\n * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.\n *\n * @returns {null|DistanceMeasurement}\n */\n get currentMeasurement() {\n return this._currentDistanceMeasurement;\n }\n\n /**\n * Destroys this DistanceMeasurementsTouchControl.\n */\n destroy() {\n this.deactivate();\n super.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 903, + "__docId__": 909, "kind": "variable", "name": "WAITING_FOR_ORIGIN_TOUCH_START", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14719,7 +14884,7 @@ "ignore": true }, { - "__docId__": 904, + "__docId__": 910, "kind": "variable", "name": "WAITING_FOR_ORIGIN_QUICK_TOUCH_END", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14740,7 +14905,7 @@ "ignore": true }, { - "__docId__": 905, + "__docId__": 911, "kind": "variable", "name": "WAITING_FOR_ORIGIN_LONG_TOUCH_END", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14761,7 +14926,7 @@ "ignore": true }, { - "__docId__": 906, + "__docId__": 912, "kind": "variable", "name": "WAITING_FOR_TARGET_TOUCH_START", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14782,7 +14947,7 @@ "ignore": true }, { - "__docId__": 907, + "__docId__": 913, "kind": "variable", "name": "WAITING_FOR_TARGET_QUICK_TOUCH_END", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14803,7 +14968,7 @@ "ignore": true }, { - "__docId__": 908, + "__docId__": 914, "kind": "variable", "name": "WAITING_FOR_TARGET_LONG_TOUCH_END", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14824,7 +14989,7 @@ "ignore": true }, { - "__docId__": 909, + "__docId__": 915, "kind": "variable", "name": "TOUCH_CANCELING", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14845,7 +15010,7 @@ "ignore": true }, { - "__docId__": 910, + "__docId__": 916, "kind": "class", "name": "DistanceMeasurementsTouchControl", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js", @@ -14863,7 +15028,7 @@ ] }, { - "__docId__": 911, + "__docId__": 917, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14876,7 +15041,7 @@ "lineNumber": 27 }, { - "__docId__": 912, + "__docId__": 918, "kind": "member", "name": "pointerLens", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14893,7 +15058,7 @@ } }, { - "__docId__": 913, + "__docId__": 919, "kind": "member", "name": "pointerCircle", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14910,7 +15075,7 @@ } }, { - "__docId__": 914, + "__docId__": 920, "kind": "member", "name": "_active", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14928,7 +15093,7 @@ } }, { - "__docId__": 915, + "__docId__": 921, "kind": "member", "name": "markerDiv", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14945,7 +15110,7 @@ } }, { - "__docId__": 916, + "__docId__": 922, "kind": "member", "name": "_currentDistanceMeasurement", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14963,7 +15128,7 @@ } }, { - "__docId__": 917, + "__docId__": 923, "kind": "member", "name": "_currentDistanceMeasurementInitState", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14981,7 +15146,7 @@ } }, { - "__docId__": 918, + "__docId__": 924, "kind": "member", "name": "_onCanvasTouchStart", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -14999,7 +15164,7 @@ } }, { - "__docId__": 919, + "__docId__": 925, "kind": "member", "name": "_onCanvasTouchEnd", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15017,7 +15182,7 @@ } }, { - "__docId__": 920, + "__docId__": 926, "kind": "member", "name": "_longTouchTimeoutMs", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15035,7 +15200,7 @@ } }, { - "__docId__": 921, + "__docId__": 927, "kind": "member", "name": "_snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15053,7 +15218,7 @@ } }, { - "__docId__": 922, + "__docId__": 928, "kind": "member", "name": "_touchState", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15071,7 +15236,7 @@ } }, { - "__docId__": 923, + "__docId__": 929, "kind": "method", "name": "_attachPlugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15095,7 +15260,7 @@ "return": null }, { - "__docId__": 924, + "__docId__": 930, "kind": "member", "name": "distanceMeasurementsPlugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15114,7 +15279,7 @@ } }, { - "__docId__": 925, + "__docId__": 931, "kind": "member", "name": "plugin", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15133,7 +15298,7 @@ } }, { - "__docId__": 926, + "__docId__": 932, "kind": "get", "name": "active", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15165,7 +15330,7 @@ } }, { - "__docId__": 927, + "__docId__": 933, "kind": "set", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15190,7 +15355,7 @@ ] }, { - "__docId__": 930, + "__docId__": 936, "kind": "get", "name": "snapping", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15222,7 +15387,7 @@ } }, { - "__docId__": 931, + "__docId__": 937, "kind": "method", "name": "activate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15237,7 +15402,7 @@ "return": null }, { - "__docId__": 961, + "__docId__": 967, "kind": "method", "name": "deactivate", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15252,7 +15417,7 @@ "return": null }, { - "__docId__": 964, + "__docId__": 970, "kind": "method", "name": "reset", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15267,7 +15432,58 @@ "return": null }, { - "__docId__": 966, + "__docId__": 972, + "kind": "member", + "name": "_mouseState", + "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", + "static": false, + "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl#_mouseState", + "access": "private", + "description": null, + "lineNumber": 751, + "undocument": true, + "ignore": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 973, + "kind": "get", + "name": "currentMeasurement", + "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", + "generator": false, + "async": false, + "static": false, + "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl#currentMeasurement", + "access": "public", + "description": "Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.", + "lineNumber": 759, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{null|DistanceMeasurement}" + } + ], + "return": { + "nullable": null, + "types": [ + "null", + "DistanceMeasurement" + ], + "spread": false, + "description": "" + }, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 974, "kind": "method", "name": "destroy", "memberof": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl", @@ -15277,34 +15493,34 @@ "longname": "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl#destroy", "access": "public", "description": "Destroys this DistanceMeasurementsTouchControl.", - "lineNumber": 756, + "lineNumber": 766, "params": [], "return": null }, { - "__docId__": 967, + "__docId__": 975, "kind": "file", "name": "src/plugins/DistanceMeasurementsPlugin/index.js", "content": "export * from \"./DistanceMeasurementsPlugin.js\";\nexport * from \"./DistanceMeasurementsControl.js\";\nexport * from \"./DistanceMeasurementsMouseControl.js\";\nexport * from \"./DistanceMeasurementsTouchControl.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/DistanceMeasurementsPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/DistanceMeasurementsPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 968, + "__docId__": 976, "kind": "file", "name": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\n\nimport {buildCylinderGeometry} from \"../../viewer/scene/geometry/builders/buildCylinderGeometry.js\";\nimport {buildTorusGeometry} from \"../../viewer/scene/geometry/builders/buildTorusGeometry.js\";\n\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {EmphasisMaterial} from \"../../viewer/scene/materials/EmphasisMaterial.js\";\nimport {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {buildSphereGeometry} from \"../../viewer/scene/geometry/builders/buildSphereGeometry.js\";\nimport {worldToRTCPos} from \"../../viewer/scene/math/rtcCoords.js\";\n\nconst zeroVec = new Float64Array([0, 0, 1]);\nconst quat = new Float64Array(4);\n\n/**\n * Controls a {@link SectionPlane} with mouse and touch input.\n */\nexport class FaceAlignedSectionPlanesControl {\n\n /** @private */\n constructor(plugin) {\n\n /**\n * ID of this FaceAlignedSectionPlanesControl.\n *\n * FaceAlignedSectionPlanesControl are mapped by this ID in {@link FaceAlignedSectionPlanesPlugin#controls}.\n *\n * @property id\n * @type {String|Number}\n */\n this.id = null;\n\n this._viewer = plugin.viewer;\n this._plugin = plugin;\n this._visible = false;\n this._pos = math.vec3(); // Full-precision position of the center of the FaceAlignedSectionPlanesControl\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n\n this._baseDir = math.vec3(); // Saves direction of clip plane when we start dragging an arrow or ring.\n this._rootNode = null; // Root of Node graph that represents this control in the 3D scene\n this._displayMeshes = null; // Meshes that are always visible\n this._affordanceMeshes = null; // Meshes displayed momentarily for affordance\n\n this._ignoreNextSectionPlaneDirUpdate = false;\n\n this._createNodes();\n this._bindEvents();\n }\n\n /**\n * Called by FaceAlignedSectionPlanesPlugin to assign this FaceAlignedSectionPlanesControl to a SectionPlane.\n * FaceAlignedSectionPlanesPlugin keeps FaceAlignedSectionPlanesControls in a reuse pool.\n * Call with a null or undefined value to disconnect the FaceAlignedSectionPlanesControl ffrom whatever SectionPlane it was assigned to.\n * @private\n */\n _setSectionPlane(sectionPlane) {\n if (this._sectionPlane) {\n this._sectionPlane.off(this._onSectionPlanePos);\n this._sectionPlane.off(this._onSectionPlaneDir);\n this._onSectionPlanePos = null;\n this._onSectionPlaneDir = null;\n this._sectionPlane = null;\n }\n if (sectionPlane) {\n this.id = sectionPlane.id;\n this._setPos(sectionPlane.pos);\n this._setDir(sectionPlane.dir);\n this._sectionPlane = sectionPlane;\n this._onSectionPlanePos = sectionPlane.on(\"pos\", () => {\n this._setPos(this._sectionPlane.pos);\n });\n this._onSectionPlaneDir = sectionPlane.on(\"dir\", () => {\n if (!this._ignoreNextSectionPlaneDirUpdate) {\n this._setDir(this._sectionPlane.dir);\n } else {\n this._ignoreNextSectionPlaneDirUpdate = false;\n }\n });\n }\n }\n\n /**\n * Gets the {@link SectionPlane} controlled by this FaceAlignedSectionPlanesControl.\n * @returns {SectionPlane} The SectionPlane.\n */\n get sectionPlane() {\n return this._sectionPlane;\n }\n\n /** @private */\n _setPos(xyz) {\n\n this._pos.set(xyz);\n\n worldToRTCPos(this._pos, this._origin, this._rtcPos);\n\n this._rootNode.origin = this._origin;\n this._rootNode.position = this._rtcPos;\n }\n\n /** @private */\n _setDir(xyz) {\n this._baseDir.set(xyz);\n this._rootNode.quaternion = math.vec3PairToQuaternion(zeroVec, xyz, quat);\n }\n\n _setSectionPlaneDir(dir) {\n if (this._sectionPlane) {\n this._ignoreNextSectionPlaneDirUpdate = true;\n this._sectionPlane.dir = dir;\n }\n }\n\n /**\n * Sets if this FaceAlignedSectionPlanesControl is visible.\n *\n * @type {Boolean}\n */\n setVisible(visible = true) {\n if (this._visible === visible) {\n return;\n }\n this._visible = visible;\n var id;\n for (id in this._displayMeshes) {\n if (this._displayMeshes.hasOwnProperty(id)) {\n this._displayMeshes[id].visible = visible;\n }\n }\n if (!visible) {\n for (id in this._affordanceMeshes) {\n if (this._affordanceMeshes.hasOwnProperty(id)) {\n this._affordanceMeshes[id].visible = visible;\n }\n }\n }\n }\n\n /**\n * Gets if this FaceAlignedSectionPlanesControl is visible.\n *\n * @type {Boolean}\n */\n getVisible() {\n return this._visible;\n }\n\n /**\n * Sets if this FaceAlignedSectionPlanesControl is culled. This is called by FaceAlignedSectionPlanesPlugin to\n * temporarily hide the FaceAlignedSectionPlanesControl while a snapshot is being taken by Viewer#getSnapshot().\n * @param culled\n */\n setCulled(culled) {\n var id;\n for (id in this._displayMeshes) {\n if (this._displayMeshes.hasOwnProperty(id)) {\n this._displayMeshes[id].culled = culled;\n }\n }\n if (!culled) {\n for (id in this._affordanceMeshes) {\n if (this._affordanceMeshes.hasOwnProperty(id)) {\n this._affordanceMeshes[id].culled = culled;\n }\n }\n }\n }\n\n /**\n * Builds the Entities that represent this FaceAlignedSectionPlanesControl.\n * @private\n */\n _createNodes() {\n\n const NO_STATE_INHERIT = false;\n const scene = this._viewer.scene;\n const radius = 1.0;\n const handleTubeRadius = 0.06;\n const hoopRadius = radius - 0.2;\n const tubeRadius = 0.01;\n const arrowRadius = 0.07;\n\n this._rootNode = new Node(scene, {\n position: [0, 0, 0],\n scale: [5, 5, 5]\n });\n\n const rootNode = this._rootNode;\n\n const shapes = {// Reusable geometries\n\n arrowHead: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: arrowRadius,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.2,\n openEnded: false\n })),\n\n arrowHeadBig: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: 0.09,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.25,\n openEnded: false\n })),\n\n axis: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: tubeRadius,\n radiusBottom: tubeRadius,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n }))\n };\n\n const materials = { // Reusable materials\n\n red: new PhongMaterial(rootNode, {\n diffuse: [1, 0.0, 0.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n green: new PhongMaterial(rootNode, {\n diffuse: [0, 1.0, 0.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n blue: new PhongMaterial(rootNode, {\n diffuse: [0, 0.0, 1.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightRed: new EmphasisMaterial(rootNode, { // Emphasis for red rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [1, 0, 0],\n fillAlpha: 0.6\n })\n };\n\n this._displayMeshes = {\n\n plane: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, {\n primitive: \"triangles\",\n positions: [\n 0.5, 0.5, 0.0, 0.5, -0.5, 0.0, // 0\n -0.5, -0.5, 0.0, -0.5, 0.5, 0.0, // 1\n 0.5, 0.5, -0.0, 0.5, -0.5, -0.0, // 2\n -0.5, -0.5, -0.0, -0.5, 0.5, -0.0 // 3\n ],\n indices: [0, 1, 2, 2, 3, 0]\n }),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0.0, 0],\n diffuse: [0, 0, 0],\n backfaces: true\n }),\n opacity: 0.6,\n ghosted: true,\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n scale: [2.4, 2.4, 1]\n }), NO_STATE_INHERIT),\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 1.7,\n tube: tubeRadius * 2,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0, 0],\n diffuse: [0, 0, 0],\n specular: [0, 0, 0],\n shininess: 0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, .1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n center: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildSphereGeometry({\n radius: 0.05\n })),\n material: materials.center,\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: false,\n collidable: true,\n visible: false\n }), NO_STATE_INHERIT)\n };\n\n this._affordanceMeshes = {\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 2,\n tube: tubeRadius,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n ambient: [1, 1, 1],\n diffuse: [0, 0, 0],\n emissive: [1, 1, 0]\n }),\n highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, 1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT)\n };\n }\n\n _bindEvents() {\n\n const rootNode = this._rootNode;\n\n var nextDragAction = null; // As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.\n var dragAction = null; // Action we're doing while we drag an arrow or hoop.\n const lastCanvasPos = math.vec2();\n const camera = this._viewer.camera;\n const scene = this._viewer.scene;\n\n let deltaUpdate = 0;\n let waitForTick = false;\n\n { // Keep gizmo screen size constant\n\n const tempVec3a = math.vec3([0, 0, 0]);\n\n let distDirty = true;\n let lastDist = -1;\n\n this._onCameraViewMatrix = scene.camera.on(\"viewMatrix\", () => {\n distDirty = true;\n });\n\n this._onCameraProjMatrix = scene.camera.on(\"projMatrix\", () => {\n distDirty = true;\n });\n\n this._onSceneTick = scene.on(\"tick\", () => {\n\n waitForTick = false;\n const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));\n\n if (dist !== lastDist) {\n if (camera.projection === \"perspective\") {\n const worldSize = (Math.tan(camera.perspective.fov * math.DEGTORAD)) * dist;\n const size = 0.07 * worldSize;\n rootNode.scale = [size, size, size];\n lastDist = dist;\n }\n }\n\n if (camera.projection === \"ortho\") {\n const worldSize = camera.ortho.scale / 10;\n const size = worldSize;\n rootNode.scale = [size, size, size];\n lastDist = dist;\n }\n\n if (deltaUpdate !== 0) {\n moveSectionPlane(deltaUpdate);\n deltaUpdate = 0;\n }\n });\n }\n\n const getClickCoordsWithinElement = (function () {\n const canvasPos = new Float64Array(2);\n return function (event) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n var element = event.target;\n var totalOffsetLeft = 0;\n var totalOffsetTop = 0;\n\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n canvasPos[0] = event.pageX - totalOffsetLeft;\n canvasPos[1] = event.pageY - totalOffsetTop;\n }\n return canvasPos;\n };\n })();\n\n const moveSectionPlane = (delta) => {\n const pos = this._sectionPlane.pos;\n const dir = this._sectionPlane.dir;\n math.addVec3(pos, math.mulVec3Scalar(dir, 0.1 * delta * this._plugin.getDragSensitivity(), math.vec3()));\n this._sectionPlane.pos = pos;\n }\n\n {\n let mouseDownLeft;\n let mouseDownMiddle;\n let mouseDownRight;\n let down = false;\n\n this._plugin._controlElement.addEventListener(\"mousedown\", this._canvasMouseDownListener = (e) => {\n e.preventDefault();\n if (!this._visible) {\n return;\n }\n this._viewer.cameraControl.pointerEnabled = false;\n switch (e.which) {\n case 1: // Left button\n mouseDownLeft = true;\n down = true;\n var canvasPos = getClickCoordsWithinElement(e);\n dragAction = nextDragAction;\n lastCanvasPos[0] = canvasPos[0];\n lastCanvasPos[1] = canvasPos[1];\n break;\n default:\n break;\n }\n });\n\n this._plugin._controlElement.addEventListener(\"mousemove\", this._canvasMouseMoveListener = (e) => {\n if (!this._visible) {\n return;\n }\n if (!down) {\n return;\n }\n if (waitForTick) { // Limit changes detection to one per frame\n return;\n }\n var canvasPos = getClickCoordsWithinElement(e);\n const x = canvasPos[0];\n const y = canvasPos[1];\n moveSectionPlane(y - lastCanvasPos[1]);\n lastCanvasPos[0] = x;\n lastCanvasPos[1] = y;\n });\n\n this._plugin._controlElement.addEventListener(\"mouseup\", this._canvasMouseUpListener = (e) => {\n if (!this._visible) {\n return;\n }\n this._viewer.cameraControl.pointerEnabled = true;\n if (!down) {\n return;\n }\n switch (e.which) {\n case 1: // Left button\n mouseDownLeft = false;\n break;\n case 2: // Middle/both buttons\n mouseDownMiddle = false;\n break;\n case 3: // Right button\n mouseDownRight = false;\n break;\n default:\n break;\n }\n down = false;\n });\n\n this._plugin._controlElement.addEventListener(\"wheel\", this._canvasWheelListener = (e) => {\n if (!this._visible) {\n return;\n }\n deltaUpdate += Math.max(-1, Math.min(1, -e.deltaY * 40));\n });\n }\n\n {\n let touchStartY, touchEndY;\n let lastTouchY = null;\n\n this._plugin._controlElement.addEventListener(\"touchstart\", this._handleTouchStart = (e) => {\n e.stopPropagation();\n e.preventDefault();\n if (!this._visible) {\n return;\n }\n touchStartY = e.touches[0].clientY;\n lastTouchY = touchStartY;\n deltaUpdate = 0;\n });\n\n this._plugin._controlElement.addEventListener(\"touchmove\", this._handleTouchMove = (e) => {\n e.stopPropagation();\n e.preventDefault();\n if (!this._visible) {\n return;\n }\n if (waitForTick) { // Limit changes detection to one per frame\n return;\n }\n waitForTick = true;\n touchEndY = e.touches[0].clientY;\n if (lastTouchY !== null) {\n deltaUpdate += touchEndY - lastTouchY;\n }\n lastTouchY = touchEndY;\n });\n\n this._plugin._controlElement.addEventListener(\"touchend\", this._handleTouchEnd = (e) => {\n e.stopPropagation();\n e.preventDefault();\n if (!this._visible) {\n return;\n }\n touchStartY = null;\n touchEndY = null;\n deltaUpdate = 0;\n });\n }\n }\n\n _destroy() {\n this._unbindEvents();\n this._destroyNodes();\n }\n\n _unbindEvents() {\n\n const viewer = this._viewer;\n const scene = viewer.scene;\n const canvas = scene.canvas.canvas;\n const camera = viewer.camera;\n const controlElement = this._plugin._controlElement;\n\n scene.off(this._onSceneTick);\n\n canvas.removeEventListener(\"mousedown\", this._canvasMouseDownListener);\n canvas.removeEventListener(\"mousemove\", this._canvasMouseMoveListener);\n canvas.removeEventListener(\"mouseup\", this._canvasMouseUpListener);\n canvas.removeEventListener(\"wheel\", this._canvasWheelListener);\n\n controlElement.removeEventListener(\"touchstart\", this._handleTouchStart);\n controlElement.removeEventListener(\"touchmove\", this._handleTouchMove);\n controlElement.removeEventListener(\"touchend\", this._handleTouchEnd);\n\n camera.off(this._onCameraViewMatrix);\n camera.off(this._onCameraProjMatrix);\n }\n\n _destroyNodes() {\n this._setSectionPlane(null);\n this._rootNode.destroy();\n this._displayMeshes = {};\n this._affordanceMeshes = {};\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 969, + "__docId__": 977, "kind": "variable", "name": "zeroVec", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", @@ -15325,7 +15541,7 @@ "ignore": true }, { - "__docId__": 970, + "__docId__": 978, "kind": "variable", "name": "quat", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", @@ -15346,7 +15562,7 @@ "ignore": true }, { - "__docId__": 971, + "__docId__": 979, "kind": "class", "name": "FaceAlignedSectionPlanesControl", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js", @@ -15361,7 +15577,7 @@ "interface": false }, { - "__docId__": 972, + "__docId__": 980, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15375,7 +15591,7 @@ "ignore": true }, { - "__docId__": 973, + "__docId__": 981, "kind": "member", "name": "id", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15407,7 +15623,7 @@ } }, { - "__docId__": 974, + "__docId__": 982, "kind": "member", "name": "_viewer", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15425,7 +15641,7 @@ } }, { - "__docId__": 975, + "__docId__": 983, "kind": "member", "name": "_plugin", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15443,7 +15659,7 @@ } }, { - "__docId__": 976, + "__docId__": 984, "kind": "member", "name": "_visible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15461,7 +15677,7 @@ } }, { - "__docId__": 977, + "__docId__": 985, "kind": "member", "name": "_pos", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15479,7 +15695,7 @@ } }, { - "__docId__": 978, + "__docId__": 986, "kind": "member", "name": "_origin", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15497,7 +15713,7 @@ } }, { - "__docId__": 979, + "__docId__": 987, "kind": "member", "name": "_rtcPos", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15515,7 +15731,7 @@ } }, { - "__docId__": 980, + "__docId__": 988, "kind": "member", "name": "_baseDir", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15533,7 +15749,7 @@ } }, { - "__docId__": 981, + "__docId__": 989, "kind": "member", "name": "_rootNode", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15551,7 +15767,7 @@ } }, { - "__docId__": 982, + "__docId__": 990, "kind": "member", "name": "_displayMeshes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15569,7 +15785,7 @@ } }, { - "__docId__": 983, + "__docId__": 991, "kind": "member", "name": "_affordanceMeshes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15587,7 +15803,7 @@ } }, { - "__docId__": 984, + "__docId__": 992, "kind": "member", "name": "_ignoreNextSectionPlaneDirUpdate", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15605,7 +15821,7 @@ } }, { - "__docId__": 985, + "__docId__": 993, "kind": "method", "name": "_setSectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15628,7 +15844,7 @@ "return": null }, { - "__docId__": 986, + "__docId__": 994, "kind": "member", "name": "_onSectionPlanePos", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15646,7 +15862,7 @@ } }, { - "__docId__": 987, + "__docId__": 995, "kind": "member", "name": "_onSectionPlaneDir", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15664,7 +15880,7 @@ } }, { - "__docId__": 988, + "__docId__": 996, "kind": "member", "name": "_sectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15682,7 +15898,7 @@ } }, { - "__docId__": 994, + "__docId__": 1002, "kind": "get", "name": "sectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15714,7 +15930,7 @@ } }, { - "__docId__": 995, + "__docId__": 1003, "kind": "method", "name": "_setPos", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15737,7 +15953,7 @@ "return": null }, { - "__docId__": 996, + "__docId__": 1004, "kind": "method", "name": "_setDir", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15760,7 +15976,7 @@ "return": null }, { - "__docId__": 997, + "__docId__": 1005, "kind": "method", "name": "_setSectionPlaneDir", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15784,7 +16000,7 @@ "return": null }, { - "__docId__": 999, + "__docId__": 1007, "kind": "method", "name": "setVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15817,7 +16033,7 @@ "return": null }, { - "__docId__": 1001, + "__docId__": 1009, "kind": "method", "name": "getVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15844,7 +16060,7 @@ } }, { - "__docId__": 1002, + "__docId__": 1010, "kind": "method", "name": "setCulled", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15870,7 +16086,7 @@ "return": null }, { - "__docId__": 1003, + "__docId__": 1011, "kind": "method", "name": "_createNodes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15886,7 +16102,7 @@ "return": null }, { - "__docId__": 1007, + "__docId__": 1015, "kind": "method", "name": "_bindEvents", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15903,7 +16119,7 @@ "return": null }, { - "__docId__": 1008, + "__docId__": 1016, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15921,7 +16137,7 @@ } }, { - "__docId__": 1009, + "__docId__": 1017, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15939,7 +16155,7 @@ } }, { - "__docId__": 1010, + "__docId__": 1018, "kind": "member", "name": "_onSceneTick", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15957,7 +16173,7 @@ } }, { - "__docId__": 1011, + "__docId__": 1019, "kind": "method", "name": "_destroy", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15974,7 +16190,7 @@ "return": null }, { - "__docId__": 1012, + "__docId__": 1020, "kind": "method", "name": "_unbindEvents", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -15991,7 +16207,7 @@ "return": null }, { - "__docId__": 1013, + "__docId__": 1021, "kind": "method", "name": "_destroyNodes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js~FaceAlignedSectionPlanesControl", @@ -16008,18 +16224,18 @@ "return": null }, { - "__docId__": 1016, + "__docId__": 1024, "kind": "file", "name": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {SectionPlane} from \"../../viewer/scene/sectionPlane/SectionPlane.js\";\nimport {FaceAlignedSectionPlanesControl} from \"./FaceAlignedSectionPlanesControl.js\";\nimport {Overview} from \"./Overview.js\";\n\nconst tempAABB = math.AABB3();\nconst tempVec3 = math.vec3();\n\n/**\n * FaceAlignedSectionPlanesPlugin is a {@link Viewer} plugin that creates and edits face-aligned {@link SectionPlane}s.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_FaceAlignedSectionPlanesPlugin)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/#FaceAlignedSectionPlanesPlugin)]\n *\n * ## Overview\n *\n * * Use the FaceAlignedSectionPlanesPlugin to\n * create and edit {@link SectionPlane}s to slice portions off your models and reveal internal structures.\n *\n * * As shown in the screen capture above, FaceAlignedSectionPlanesPlugin shows an overview of all your SectionPlanes (on the right, in\n * this example).\n * * Click a plane in the overview to activate a 3D control with which you can interactively\n * reposition its SectionPlane in the main canvas.\n * * Configure the plugin with an HTML element that the user can click-and-drag on to reposition the SectionPlane for which the control is active.\n * * Use {@link BCFViewpointsPlugin} to save and load SectionPlanes in BCF viewpoints.\n *\n * ## Usage\n *\n * In the example below, we'll use a {@link GLTFLoaderPlugin} to load a model, and a FaceAlignedSectionPlanesPlugin\n * to slice it open with two {@link SectionPlane}s. We'll show the overview in the bottom right of the Viewer\n * canvas. Finally, we'll programmatically activate the 3D editing control, so that we can use it to interactively\n * reposition our second SectionPlane.\n *\n * ````JavaScript\n * import {Viewer, GLTFLoaderPlugin, FaceAlignedSectionPlanesPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange its Camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [-5.02, 2.22, 15.09];\n * viewer.camera.look = [4.97, 2.79, 9.89];\n * viewer.camera.up = [-0.05, 0.99, 0.02];\n *\n * // Add a GLTFLoaderPlugin\n *\n * const gltfLoader = new GLTFLoaderPlugin(viewer);\n *\n * // Add a FaceAlignedSectionPlanesPlugin, with overview visible\n *\n * const faceAlignedSectionPlanes = new FaceAlignedSectionPlanesPlugin(viewer, {\n * overviewCanvasID: \"myOverviewCanvas\",\n * overviewVisible: true,\n * controlElementId: \"myControlElement\", // ID of element to capture drag events that move the SectionPlane\n * dragSensitivity: 1 // Sensitivity factor that governs the rate at which dragging moves the SectionPlane\n * });\n *\n * // Load a model\n *\n * const model = gltfLoader.load({\n * id: \"myModel\",\n * src: \"./models/gltf/schependomlaan/scene.glb\"\n * });\n *\n * // Create a couple of section planes\n * // These will be shown in the overview\n *\n * faceAlignedSectionPlanes.createSectionPlane({\n * id: \"mySectionPlane\",\n * pos: [1.04, 1.95, 9.74],\n * dir: [1.0, 0.0, 0.0]\n * });\n *\n * faceAlignedSectionPlanes.createSectionPlane({\n * id: \"mySectionPlane2\",\n * pos: [2.30, 4.46, 14.93],\n * dir: [0.0, -0.09, -0.79]\n * });\n *\n * // Show the FaceAlignedSectionPlanesPlugin's 3D editing gizmo,\n * // to interactively reposition one of our SectionPlanes\n *\n * faceAlignedSectionPlanes.showControl(\"mySectionPlane2\");\n *\n * const mySectionPlane2 = faceAlignedSectionPlanes.sectionPlanes[\"mySectionPlane2\"];\n *\n * // Programmatically reposition one of our SectionPlanes\n * // This also updates its position as shown in the overview gizmo\n *\n * mySectionPlane2.pos = [11.0, 6.0, -12];\n * mySectionPlane2.dir = [0.4, 0.0, 0.5];\n * ````\n */\nexport class FaceAlignedSectionPlanesPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"SectionPlanes\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.\n * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.\n * @param {String} cfg.controlElementId ID of an HTML element that catches drag events to move the active SectionPlane.\n * @param {Number} [cfg.dragSensitivity=1] Sensitivity factor that governs the rate at which dragging on the control element moves SectionPlane.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"FaceAlignedSectionPlanesPlugin\", viewer);\n\n this._freeControls = [];\n this._sectionPlanes = viewer.scene.sectionPlanes;\n this._controls = {};\n this._shownControlId = null;\n this._dragSensitivity = cfg.dragSensitivity || 1;\n\n if (cfg.overviewCanvasId !== null && cfg.overviewCanvasId !== undefined) {\n\n const overviewCanvas = document.getElementById(cfg.overviewCanvasId);\n\n if (!overviewCanvas) {\n this.warn(\"Can't find overview canvas: '\" + cfg.overviewCanvasId + \"' - will create plugin without overview\");\n\n } else {\n\n this._overview = new Overview(this, {\n overviewCanvas: overviewCanvas,\n visible: cfg.overviewVisible,\n\n onHoverEnterPlane: ((id) => {\n this._overview.setPlaneHighlighted(id, true);\n }),\n\n onHoverLeavePlane: ((id) => {\n this._overview.setPlaneHighlighted(id, false);\n }),\n\n onClickedPlane: ((id) => {\n if (this.getShownControl() === id) {\n this.hideControl();\n return;\n }\n this.showControl(id);\n const sectionPlane = this.sectionPlanes[id];\n const sectionPlanePos = sectionPlane.pos;\n tempAABB.set(this.viewer.scene.aabb);\n math.getAABB3Center(tempAABB, tempVec3);\n tempAABB[0] += sectionPlanePos[0] - tempVec3[0];\n tempAABB[1] += sectionPlanePos[1] - tempVec3[1];\n tempAABB[2] += sectionPlanePos[2] - tempVec3[2];\n tempAABB[3] += sectionPlanePos[0] - tempVec3[0];\n tempAABB[4] += sectionPlanePos[1] - tempVec3[1];\n tempAABB[5] += sectionPlanePos[2] - tempVec3[2];\n this.viewer.cameraFlight.flyTo({\n aabb: tempAABB,\n fitFOV: 65\n });\n }),\n\n onClickedNothing: (() => {\n this.hideControl();\n })\n });\n }\n }\n\n if (cfg.controlElementId === null || cfg.controlElementId === undefined) {\n this.error(\"Parameter expected: controlElementId\");\n } else {\n this._controlElement = document.getElementById(cfg.controlElementId);\n if (!this._controlElement) {\n this.warn(\"Can't find control element: '\" + cfg.controlElementId + \"' - will create plugin without control element\");\n\n }\n }\n\n this._onSceneSectionPlaneCreated = viewer.scene.on(\"sectionPlaneCreated\", (sectionPlane) => {\n\n // SectionPlane created, either via FaceAlignedSectionPlanesPlugin#createSectionPlane(), or by directly\n // instantiating a SectionPlane independently of FaceAlignedSectionPlanesPlugin, which can be done\n // by BCFViewpointsPlugin#loadViewpoint().\n\n this._sectionPlaneCreated(sectionPlane);\n });\n }\n\n /**\n * Sets the factor that governs how fast a SectionPlane moves as we drag on the control element.\n *\n * @param {Number} dragSensitivity The dragging sensitivity factor.\n */\n setDragSensitivity(dragSensitivity) {\n this._dragSensitivity = dragSensitivity || 1;\n }\n\n /**\n * Gets the factor that governs how fast a SectionPlane moves as we drag on the control element.\n *\n * @return {Number} The dragging sensitivity factor.\n */\n getDragSensitivity() {\n return this._dragSensitivity;\n }\n\n /**\n * Sets if the overview canvas is visible.\n *\n * @param {Boolean} visible Whether or not the overview canvas is visible.\n */\n setOverviewVisible(visible) {\n if (this._overview) {\n this._overview.setVisible(visible);\n }\n }\n\n /**\n * Gets if the overview canvas is visible.\n *\n * @return {Boolean} True when the overview canvas is visible.\n */\n getOverviewVisible() {\n if (this._overview) {\n return this._overview.getVisible();\n }\n }\n\n /**\n * Returns a map of the {@link SectionPlane}s created by this FaceAlignedSectionPlanesPlugin.\n *\n * @returns {{String:SectionPlane}} A map containing the {@link SectionPlane}s, each mapped to its {@link SectionPlane#id}.\n */\n get sectionPlanes() {\n return this._sectionPlanes;\n }\n\n /**\n * Creates a {@link SectionPlane}.\n *\n * The {@link SectionPlane} will be registered by {@link SectionPlane#id} in {@link FaceAlignedSectionPlanesPlugin#sectionPlanes}.\n *\n * @param {Object} params {@link SectionPlane} configuration.\n * @param {String} [params.id] Unique ID to assign to the {@link SectionPlane}. Must be unique among all components in the {@link Viewer}'s {@link Scene}. Auto-generated when omitted.\n * @param {Number[]} [params.pos=[0,0,0]] World-space position of the {@link SectionPlane}.\n * @param {Number[]} [params.dir=[0,0,-1]] World-space vector indicating the orientation of the {@link SectionPlane}.\n * @param {Boolean} [params.active=true] Whether the {@link SectionPlane} is initially active. Only clips while this is true.\n * @returns {SectionPlane} The new {@link SectionPlane}.\n */\n createSectionPlane(params = {}) {\n\n if (params.id !== undefined && params.id !== null && this.viewer.scene.components[params.id]) {\n this.error(\"Viewer component with this ID already exists: \" + params.id);\n delete params.id;\n }\n\n // Note that SectionPlane constructor fires \"sectionPlaneCreated\" on the Scene,\n // which FaceAlignedSectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.\n\n const sectionPlane = new SectionPlane(this.viewer.scene, {\n id: params.id,\n pos: params.pos,\n dir: params.dir,\n active: true || params.active\n });\n return sectionPlane;\n }\n\n _sectionPlaneCreated(sectionPlane) {\n const control = (this._freeControls.length > 0) ? this._freeControls.pop() : new FaceAlignedSectionPlanesControl(this);\n control._setSectionPlane(sectionPlane);\n control.setVisible(false);\n this._controls[sectionPlane.id] = control;\n if (this._overview) {\n this._overview.addSectionPlane(sectionPlane);\n }\n sectionPlane.once(\"destroyed\", () => {\n this._sectionPlaneDestroyed(sectionPlane);\n });\n }\n\n /**\n * Inverts the direction of {@link SectionPlane#dir} on every existing SectionPlane.\n *\n * Inverts all SectionPlanes, including those that were not created with FaceAlignedSectionPlanesPlugin.\n */\n flipSectionPlanes() {\n const sectionPlanes = this.viewer.scene.sectionPlanes;\n for (let id in sectionPlanes) {\n const sectionPlane = sectionPlanes[id];\n sectionPlane.flipDir();\n }\n }\n\n /**\n * Shows the 3D editing gizmo for a {@link SectionPlane}.\n *\n * @param {String} id ID of the {@link SectionPlane}.\n */\n showControl(id) {\n const control = this._controls[id];\n if (!control) {\n this.error(\"Control not found: \" + id);\n return;\n }\n this.hideControl();\n control.setVisible(true);\n if (this._overview) {\n this._overview.setPlaneSelected(id, true);\n }\n this._shownControlId = id;\n }\n\n /**\n * Gets the ID of the {@link SectionPlane} that the 3D editing gizmo is shown for.\n *\n * Returns ````null```` when the editing gizmo is not shown.\n *\n * @returns {String} ID of the the {@link SectionPlane} that the 3D editing gizmo is shown for, if shown, else ````null````.\n */\n getShownControl() {\n return this._shownControlId;\n }\n\n /**\n * Hides the 3D {@link SectionPlane} editing gizmo if shown.\n */\n hideControl() {\n for (let id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setVisible(false);\n if (this._overview) {\n this._overview.setPlaneSelected(id, false);\n }\n }\n }\n this._shownControlId = null;\n }\n\n /**\n * Destroys a {@link SectionPlane} created by this FaceAlignedSectionPlanesPlugin.\n *\n * @param {String} id ID of the {@link SectionPlane}.\n */\n destroySectionPlane(id) {\n let sectionPlane = this.viewer.scene.sectionPlanes[id];\n if (!sectionPlane) {\n this.error(\"SectionPlane not found: \" + id);\n return;\n }\n this._sectionPlaneDestroyed(sectionPlane);\n sectionPlane.destroy();\n\n if (id === this._shownControlId) {\n this._shownControlId = null;\n }\n }\n\n _sectionPlaneDestroyed(sectionPlane) {\n if (this._overview) {\n this._overview.removeSectionPlane(sectionPlane);\n }\n const control = this._controls[sectionPlane.id];\n if (!control) {\n return;\n }\n control.setVisible(false);\n control._setSectionPlane(null);\n delete this._controls[sectionPlane.id];\n this._freeControls.push(control);\n }\n\n /**\n * Destroys all {@link SectionPlane}s created by this FaceAlignedSectionPlanesPlugin.\n */\n clear() {\n const ids = Object.keys(this._sectionPlanes);\n for (let i = 0, len = ids.length; i < len; i++) {\n this.destroySectionPlane(ids[i]);\n }\n }\n\n /**\n * @private\n */\n send(name, value) {\n switch (name) {\n\n case \"snapshotStarting\": // Viewer#getSnapshot() about to take snapshot - hide controls\n for (let id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setCulled(true);\n }\n }\n break;\n\n case \"snapshotFinished\": // Viewer#getSnapshot() finished taking snapshot - show controls again\n for (let id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setCulled(false);\n }\n }\n break;\n\n case \"clearSectionPlanes\":\n this.clear();\n break;\n }\n }\n\n /**\n * Destroys this FaceAlignedSectionPlanesPlugin.\n *\n * Also destroys each {@link SectionPlane} created by this FaceAlignedSectionPlanesPlugin.\n *\n * Does not destroy the canvas the FaceAlignedSectionPlanesPlugin was configured with.\n */\n destroy() {\n this.clear();\n if (this._overview) {\n this._overview.destroy();\n }\n this._destroyFreeControls();\n super.destroy();\n }\n\n _destroyFreeControls() {\n let control = this._freeControls.pop();\n while (control) {\n control._destroy();\n control = this._freeControls.pop();\n }\n this.viewer.scene.off(this._onSceneSectionPlaneCreated);\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1017, + "__docId__": 1025, "kind": "variable", "name": "tempAABB", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", @@ -16040,7 +16256,7 @@ "ignore": true }, { - "__docId__": 1018, + "__docId__": 1026, "kind": "variable", "name": "tempVec3", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", @@ -16061,7 +16277,7 @@ "ignore": true }, { - "__docId__": 1019, + "__docId__": 1027, "kind": "class", "name": "FaceAlignedSectionPlanesPlugin", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js", @@ -16079,7 +16295,7 @@ ] }, { - "__docId__": 1020, + "__docId__": 1028, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16176,7 +16392,7 @@ ] }, { - "__docId__": 1021, + "__docId__": 1029, "kind": "member", "name": "_freeControls", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16194,7 +16410,7 @@ } }, { - "__docId__": 1022, + "__docId__": 1030, "kind": "member", "name": "_sectionPlanes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16212,7 +16428,7 @@ } }, { - "__docId__": 1023, + "__docId__": 1031, "kind": "member", "name": "_controls", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16230,7 +16446,7 @@ } }, { - "__docId__": 1024, + "__docId__": 1032, "kind": "member", "name": "_shownControlId", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16248,7 +16464,7 @@ } }, { - "__docId__": 1025, + "__docId__": 1033, "kind": "member", "name": "_dragSensitivity", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16266,7 +16482,7 @@ } }, { - "__docId__": 1026, + "__docId__": 1034, "kind": "member", "name": "_overview", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16284,7 +16500,7 @@ } }, { - "__docId__": 1027, + "__docId__": 1035, "kind": "member", "name": "_controlElement", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16302,7 +16518,7 @@ } }, { - "__docId__": 1028, + "__docId__": 1036, "kind": "member", "name": "_onSceneSectionPlaneCreated", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16320,7 +16536,7 @@ } }, { - "__docId__": 1029, + "__docId__": 1037, "kind": "method", "name": "setDragSensitivity", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16346,7 +16562,7 @@ "return": null }, { - "__docId__": 1031, + "__docId__": 1039, "kind": "method", "name": "getDragSensitivity", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16368,7 +16584,7 @@ "params": [] }, { - "__docId__": 1032, + "__docId__": 1040, "kind": "method", "name": "setOverviewVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16394,7 +16610,7 @@ "return": null }, { - "__docId__": 1033, + "__docId__": 1041, "kind": "method", "name": "getOverviewVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16416,7 +16632,7 @@ "params": [] }, { - "__docId__": 1034, + "__docId__": 1042, "kind": "get", "name": "sectionPlanes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16448,7 +16664,7 @@ } }, { - "__docId__": 1035, + "__docId__": 1043, "kind": "method", "name": "createSectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16541,7 +16757,7 @@ } }, { - "__docId__": 1036, + "__docId__": 1044, "kind": "method", "name": "_sectionPlaneCreated", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16565,7 +16781,7 @@ "return": null }, { - "__docId__": 1037, + "__docId__": 1045, "kind": "method", "name": "flipSectionPlanes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16580,7 +16796,7 @@ "return": null }, { - "__docId__": 1038, + "__docId__": 1046, "kind": "method", "name": "showControl", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16606,7 +16822,7 @@ "return": null }, { - "__docId__": 1040, + "__docId__": 1048, "kind": "method", "name": "getShownControl", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16634,7 +16850,7 @@ "params": [] }, { - "__docId__": 1041, + "__docId__": 1049, "kind": "method", "name": "hideControl", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16649,7 +16865,7 @@ "return": null }, { - "__docId__": 1043, + "__docId__": 1051, "kind": "method", "name": "destroySectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16675,7 +16891,7 @@ "return": null }, { - "__docId__": 1045, + "__docId__": 1053, "kind": "method", "name": "_sectionPlaneDestroyed", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16699,7 +16915,7 @@ "return": null }, { - "__docId__": 1046, + "__docId__": 1054, "kind": "method", "name": "clear", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16714,7 +16930,7 @@ "return": null }, { - "__docId__": 1047, + "__docId__": 1055, "kind": "method", "name": "send", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16743,7 +16959,7 @@ "return": null }, { - "__docId__": 1048, + "__docId__": 1056, "kind": "method", "name": "destroy", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16758,7 +16974,7 @@ "return": null }, { - "__docId__": 1049, + "__docId__": 1057, "kind": "method", "name": "_destroyFreeControls", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js~FaceAlignedSectionPlanesPlugin", @@ -16775,18 +16991,18 @@ "return": null }, { - "__docId__": 1050, + "__docId__": 1058, "kind": "file", "name": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Scene} from \"../../viewer/scene/scene/Scene.js\";\nimport {DirLight} from \"./../../viewer/scene/lights/DirLight.js\";\nimport {Plane} from \"./Plane.js\";\n\n/**\n * @desc An interactive 3D overview for navigating the {@link SectionPlane}s created by its {@link FaceAlignedSectionPlanesPlugin}.\n *\n * * Located at {@link FaceAlignedSectionPlanesPlugin#overview}.\n * * Renders the overview on a separate canvas at a corner of the {@link Viewer}'s {@link Scene} {@link Canvas}.\n * * The overview shows a 3D plane object for each {@link SectionPlane} in the {@link Scene}.\n * * Click a plane object in the overview to toggle the visibility of a 3D gizmo to edit the position and orientation of its {@link SectionPlane}.\n *\n * @private\n */\nexport class Overview {\n\n /**\n * @private\n */\n constructor(plugin, cfg) {\n\n if (!cfg.onHoverEnterPlane || !cfg.onHoverLeavePlane || !cfg.onClickedNothing || !cfg.onClickedPlane) {\n throw \"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane\";\n }\n\n /**\n * The {@link FaceAlignedSectionPlanesPlugin} that owns this SectionPlanesOverview.\n *\n * @type {FaceAlignedSectionPlanesPlugin}\n */\n this.plugin = plugin;\n\n this._viewer = plugin.viewer;\n\n this._onHoverEnterPlane = cfg.onHoverEnterPlane;\n this._onHoverLeavePlane = cfg.onHoverLeavePlane;\n this._onClickedNothing = cfg.onClickedNothing;\n this._onClickedPlane = cfg.onClickedPlane;\n this._visible = true;\n\n this._planes = {};\n\n //--------------------------------------------------------------------------------------------------------------\n // Init canvas\n //--------------------------------------------------------------------------------------------------------------\n\n this._canvas = cfg.overviewCanvas;\n\n //--------------------------------------------------------------------------------------------------------------\n // Init scene\n //--------------------------------------------------------------------------------------------------------------\n\n this._scene = new Scene(this._viewer, {\n canvasId: this._canvas.id,\n transparent: true\n });\n this._scene.clearLights();\n new DirLight(this._scene, {\n dir: [0.4, -0.4, 0.8],\n color: [0.8, 1.0, 1.0],\n intensity: 1.0,\n space: \"view\"\n });\n new DirLight(this._scene, {\n dir: [-0.8, -0.3, -0.4],\n color: [0.8, 0.8, 0.8],\n intensity: 1.0,\n space: \"view\"\n });\n new DirLight(this._scene, {\n dir: [0.8, -0.6, -0.8],\n color: [1.0, 1.0, 1.0],\n intensity: 1.0,\n space: \"view\"\n });\n\n this._scene.camera;\n this._scene.camera.perspective.fov = 70;\n\n this._zUp = false;\n\n //--------------------------------------------------------------------------------------------------------------\n // Synchronize overview scene camera with viewer camera\n //--------------------------------------------------------------------------------------------------------------\n\n {\n const camera = this._scene.camera;\n const matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);\n const eyeLookVec = math.vec3();\n const eyeLookVecOverview = math.vec3();\n const upOverview = math.vec3();\n\n this._synchCamera = () => {\n const eye = this._viewer.camera.eye;\n const look = this._viewer.camera.look;\n const up = this._viewer.camera.up;\n math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, eyeLookVec)), 7);\n if (this._zUp) { // +Z up\n math.transformVec3(matrix, eyeLookVec, eyeLookVecOverview);\n math.transformVec3(matrix, up, upOverview);\n camera.look = [0, 0, 0];\n camera.eye = math.transformVec3(matrix, eyeLookVec, eyeLookVecOverview);\n camera.up = math.transformPoint3(matrix, up, upOverview);\n } else { // +Y up\n camera.look = [0, 0, 0];\n camera.eye = eyeLookVec;\n camera.up = up;\n }\n };\n }\n\n this._onViewerCameraMatrix = this._viewer.camera.on(\"matrix\", this._synchCamera);\n\n this._onViewerCameraWorldAxis = this._viewer.camera.on(\"worldAxis\", this._synchCamera);\n\n this._onViewerCameraFOV = this._viewer.camera.perspective.on(\"fov\", (fov) => {\n this._scene.camera.perspective.fov = fov;\n });\n\n //--------------------------------------------------------------------------------------------------------------\n // Bind overview canvas events\n //--------------------------------------------------------------------------------------------------------------\n\n {\n var hoveredEntity = null;\n\n this._onInputMouseMove = this._scene.input.on(\"mousemove\", (coords) => {\n const hit = this._scene.pick({\n canvasPos: coords\n });\n if (hit) {\n if (!hoveredEntity || hit.entity.id !== hoveredEntity.id) {\n if (hoveredEntity) {\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onHoverLeavePlane(hoveredEntity.id);\n }\n }\n hoveredEntity = hit.entity;\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onHoverEnterPlane(hoveredEntity.id);\n }\n }\n } else {\n if (hoveredEntity) {\n this._onHoverLeavePlane(hoveredEntity.id);\n hoveredEntity = null;\n }\n }\n });\n\n this._scene.canvas.canvas.addEventListener(\"mouseup\", this._onCanvasMouseUp = () => {\n if (hoveredEntity) {\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onClickedPlane(hoveredEntity.id);\n }\n } else {\n this._onClickedNothing();\n }\n });\n\n this._scene.canvas.canvas.addEventListener(\"mouseout\", this._onCanvasMouseOut = () => {\n if (hoveredEntity) {\n this._onHoverLeavePlane(hoveredEntity.id);\n hoveredEntity = null;\n }\n });\n }\n\n //--------------------------------------------------------------------------------------------------------------\n // Configure overview\n //--------------------------------------------------------------------------------------------------------------\n\n this.setVisible(cfg.overviewVisible);\n }\n\n /** Called by SectionPlanesPlugin#createSectionPlane()\n * @private\n */\n addSectionPlane(sectionPlane) {\n this._planes[sectionPlane.id] = new Plane(this, this._scene, sectionPlane);\n }\n\n /** @private\n */\n setPlaneHighlighted(id, highlighted) {\n const plane = this._planes[id];\n if (plane) {\n plane.setHighlighted(highlighted);\n }\n }\n\n /** @private\n */\n setPlaneSelected(id, selected) {\n const plane = this._planes[id];\n if (plane) {\n plane.setSelected(selected);\n }\n }\n\n /** @private\n */\n removeSectionPlane(sectionPlane) {\n const plane = this._planes[sectionPlane.id];\n if (plane) {\n plane.destroy();\n delete this._planes[sectionPlane.id];\n }\n }\n\n /**\n * Sets if this SectionPlanesOverview is visible.\n *\n * @param {Boolean} visible Whether or not this SectionPlanesOverview is visible.\n */\n setVisible(visible = true) {\n this._visible = visible;\n this._canvas.style.visibility = visible ? \"visible\" : \"hidden\";\n }\n\n /**\n * Gets if this SectionPlanesOverview is visible.\n *\n * @return {Boolean} True when this SectionPlanesOverview is visible.\n */\n getVisible() {\n return this._visible;\n }\n\n /** @private\n */\n destroy() {\n this._viewer.camera.off(this._onViewerCameraMatrix);\n this._viewer.camera.off(this._onViewerCameraWorldAxis);\n this._viewer.camera.perspective.off(this._onViewerCameraFOV);\n\n this._scene.input.off(this._onInputMouseMove);\n this._scene.canvas.canvas.removeEventListener(\"mouseup\", this._onCanvasMouseUp);\n this._scene.canvas.canvas.removeEventListener(\"mouseout\", this._onCanvasMouseOut);\n this._scene.destroy();\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1051, + "__docId__": 1059, "kind": "class", "name": "Overview", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js", @@ -16802,7 +17018,7 @@ "ignore": true }, { - "__docId__": 1052, + "__docId__": 1060, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16816,7 +17032,7 @@ "ignore": true }, { - "__docId__": 1053, + "__docId__": 1061, "kind": "member", "name": "plugin", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16835,7 +17051,7 @@ } }, { - "__docId__": 1054, + "__docId__": 1062, "kind": "member", "name": "_viewer", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16853,7 +17069,7 @@ } }, { - "__docId__": 1055, + "__docId__": 1063, "kind": "member", "name": "_onHoverEnterPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16871,7 +17087,7 @@ } }, { - "__docId__": 1056, + "__docId__": 1064, "kind": "member", "name": "_onHoverLeavePlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16889,7 +17105,7 @@ } }, { - "__docId__": 1057, + "__docId__": 1065, "kind": "member", "name": "_onClickedNothing", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16907,7 +17123,7 @@ } }, { - "__docId__": 1058, + "__docId__": 1066, "kind": "member", "name": "_onClickedPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16925,7 +17141,7 @@ } }, { - "__docId__": 1059, + "__docId__": 1067, "kind": "member", "name": "_visible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16943,7 +17159,7 @@ } }, { - "__docId__": 1060, + "__docId__": 1068, "kind": "member", "name": "_planes", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16961,7 +17177,7 @@ } }, { - "__docId__": 1061, + "__docId__": 1069, "kind": "member", "name": "_canvas", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16979,7 +17195,7 @@ } }, { - "__docId__": 1062, + "__docId__": 1070, "kind": "member", "name": "_scene", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -16997,7 +17213,7 @@ } }, { - "__docId__": 1063, + "__docId__": 1071, "kind": "member", "name": "_zUp", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17015,7 +17231,7 @@ } }, { - "__docId__": 1064, + "__docId__": 1072, "kind": "member", "name": "_synchCamera", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17033,7 +17249,7 @@ } }, { - "__docId__": 1065, + "__docId__": 1073, "kind": "member", "name": "_onViewerCameraMatrix", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17051,7 +17267,7 @@ } }, { - "__docId__": 1066, + "__docId__": 1074, "kind": "member", "name": "_onViewerCameraWorldAxis", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17069,7 +17285,7 @@ } }, { - "__docId__": 1067, + "__docId__": 1075, "kind": "member", "name": "_onViewerCameraFOV", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17087,7 +17303,7 @@ } }, { - "__docId__": 1068, + "__docId__": 1076, "kind": "member", "name": "_onInputMouseMove", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17105,7 +17321,7 @@ } }, { - "__docId__": 1069, + "__docId__": 1077, "kind": "method", "name": "addSectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17128,7 +17344,7 @@ "return": null }, { - "__docId__": 1070, + "__docId__": 1078, "kind": "method", "name": "setPlaneHighlighted", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17156,7 +17372,7 @@ "return": null }, { - "__docId__": 1071, + "__docId__": 1079, "kind": "method", "name": "setPlaneSelected", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17184,7 +17400,7 @@ "return": null }, { - "__docId__": 1072, + "__docId__": 1080, "kind": "method", "name": "removeSectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17207,7 +17423,7 @@ "return": null }, { - "__docId__": 1073, + "__docId__": 1081, "kind": "method", "name": "setVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17233,7 +17449,7 @@ "return": null }, { - "__docId__": 1075, + "__docId__": 1083, "kind": "method", "name": "getVisible", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17255,7 +17471,7 @@ "params": [] }, { - "__docId__": 1076, + "__docId__": 1084, "kind": "method", "name": "destroy", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js~Overview", @@ -17270,18 +17486,18 @@ "return": null }, { - "__docId__": 1077, + "__docId__": 1085, "kind": "file", "name": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {buildBoxGeometry} from \"../../viewer/scene/geometry/builders/buildBoxGeometry.js\";\nimport {EdgeMaterial} from \"../../viewer/scene/materials/EdgeMaterial.js\";\nimport {EmphasisMaterial} from \"../../viewer/scene/materials/EmphasisMaterial.js\";\n\n\n/**\n * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.\n *\n * @private\n */\nexport class Plane {\n\n /** @private */\n constructor(overview, overviewScene, sectionPlane) {\n\n /**\n * The ID of this SectionPlanesOverviewPlane.\n *\n * @type {String}\n */\n this.id = sectionPlane.id;\n\n /**\n * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.\n *\n * @type {SectionPlane}\n */\n this._sectionPlane = sectionPlane;\n\n this._mesh = new Mesh(overviewScene, {\n id: sectionPlane.id,\n geometry: new ReadableGeometry(overviewScene, buildBoxGeometry({\n xSize: .5,\n ySize: .5,\n zSize: .001\n })),\n material: new PhongMaterial(overviewScene, {\n emissive: [1, 1, 1],\n diffuse: [0, 0, 0],\n backfaces: false\n }),\n edgeMaterial: new EdgeMaterial(overviewScene, {\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n highlightMaterial: new EmphasisMaterial(overviewScene, {\n fill: true,\n fillColor: [0.5, 1, 0.5],\n fillAlpha: 0.7,\n edges: true,\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n selectedMaterial: new EmphasisMaterial(overviewScene, {\n fill: true,\n fillColor: [0, 0, 1],\n fillAlpha: 0.7,\n edges: true,\n edgeColor: [1.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n highlighted: true,\n scale: [3, 3, 3],\n position: [0, 0, 0],\n rotation: [0, 0, 0],\n opacity: 0.3,\n edges: true\n });\n\n\n {\n const vec = math.vec3([0, 0, 0]);\n const pos2 = math.vec3();\n const zeroVec = math.vec3([0, 0, 1]);\n const quat = math.vec4(4);\n const pos3 = math.vec3();\n\n const update = () => {\n\n const origin = this._sectionPlane.scene.center;\n\n const negDir = [-this._sectionPlane.dir[0], -this._sectionPlane.dir[1], -this._sectionPlane.dir[2]];\n math.subVec3(origin, this._sectionPlane.pos, vec);\n const dist = -math.dotVec3(negDir, vec);\n\n math.normalizeVec3(negDir);\n math.mulVec3Scalar(negDir, dist, pos2);\n const quaternion = math.vec3PairToQuaternion(zeroVec, this._sectionPlane.dir, quat);\n\n pos3[0] = pos2[0] * 0.1;\n pos3[1] = pos2[1] * 0.1;\n pos3[2] = pos2[2] * 0.1;\n\n this._mesh.quaternion = quaternion;\n this._mesh.position = pos3;\n };\n\n this._onSectionPlanePos = this._sectionPlane.on(\"pos\", update);\n this._onSectionPlaneDir = this._sectionPlane.on(\"dir\", update);\n\n // update();\n }\n\n this._highlighted = false;\n this._selected = false;\n }\n\n /**\n * Sets if this SectionPlanesOverviewPlane is highlighted.\n *\n * @type {Boolean}\n * @private\n */\n setHighlighted(highlighted) {\n this._highlighted = !!highlighted;\n this._mesh.highlighted = this._highlighted;\n this._mesh.highlightMaterial.fillColor = highlighted ? [0, 0.7, 0] : [0, 0, 0];\n // this._selectedMesh.highlighted = true;\n }\n\n /**\n * Gets if this SectionPlanesOverviewPlane is highlighted.\n *\n * @type {Boolean}\n * @private\n */\n getHighlighted() {\n return this._highlighted;\n }\n\n /**\n * Sets if this SectionPlanesOverviewPlane is selected.\n *\n * @type {Boolean}\n * @private\n */\n setSelected(selected) {\n this._selected = !!selected;\n this._mesh.edgeMaterial.edgeWidth = selected ? 3 : 1;\n this._mesh.highlightMaterial.edgeWidth = selected ? 3 : 1;\n\n }\n\n /**\n * Gets if this SectionPlanesOverviewPlane is selected.\n *\n * @type {Boolean}\n * @private\n */\n getSelected() {\n return this._selected;\n }\n\n /** @private */\n destroy() {\n this._sectionPlane.off(this._onSectionPlanePos);\n this._sectionPlane.off(this._onSectionPlaneDir);\n this._mesh.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1078, + "__docId__": 1086, "kind": "class", "name": "Plane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js", @@ -17297,7 +17513,7 @@ "ignore": true }, { - "__docId__": 1079, + "__docId__": 1087, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17311,7 +17527,7 @@ "ignore": true }, { - "__docId__": 1080, + "__docId__": 1088, "kind": "member", "name": "id", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17330,7 +17546,7 @@ } }, { - "__docId__": 1081, + "__docId__": 1089, "kind": "member", "name": "_sectionPlane", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17350,7 +17566,7 @@ "ignore": true }, { - "__docId__": 1082, + "__docId__": 1090, "kind": "member", "name": "_mesh", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17368,7 +17584,7 @@ } }, { - "__docId__": 1083, + "__docId__": 1091, "kind": "member", "name": "_onSectionPlanePos", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17386,7 +17602,7 @@ } }, { - "__docId__": 1084, + "__docId__": 1092, "kind": "member", "name": "_onSectionPlaneDir", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17404,7 +17620,7 @@ } }, { - "__docId__": 1085, + "__docId__": 1093, "kind": "member", "name": "_highlighted", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17422,7 +17638,7 @@ } }, { - "__docId__": 1086, + "__docId__": 1094, "kind": "member", "name": "_selected", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17440,7 +17656,7 @@ } }, { - "__docId__": 1087, + "__docId__": 1095, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17471,7 +17687,7 @@ "return": null }, { - "__docId__": 1089, + "__docId__": 1097, "kind": "method", "name": "getHighlighted", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17499,7 +17715,7 @@ } }, { - "__docId__": 1090, + "__docId__": 1098, "kind": "method", "name": "setSelected", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17530,7 +17746,7 @@ "return": null }, { - "__docId__": 1092, + "__docId__": 1100, "kind": "method", "name": "getSelected", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17558,7 +17774,7 @@ } }, { - "__docId__": 1093, + "__docId__": 1101, "kind": "method", "name": "destroy", "memberof": "src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js~Plane", @@ -17574,29 +17790,29 @@ "return": null }, { - "__docId__": 1094, + "__docId__": 1102, "kind": "file", "name": "src/plugins/FaceAlignedSectionPlanesPlugin/index.js", "content": "export * from \"./FaceAlignedSectionPlanesPlugin.js\";\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FaceAlignedSectionPlanesPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FaceAlignedSectionPlanesPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1095, + "__docId__": 1103, "kind": "file", "name": "src/plugins/FastNavPlugin/FastNavPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\n\n/**\n * {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching\n * the Viewer to faster, lower-quality rendering modes whenever we interact.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#performance_FastNavPlugin)\n *\n * FastNavPlugin works by hiding specified Viewer rendering features, and optionally scaling the Viewer's canvas\n * resolution, whenever we interact with the Viewer. Then, once we've finished interacting, FastNavPlugin restores those\n * rendering features and the original canvas scale, after a configured delay.\n *\n * Depending on how we configure FastNavPlugin, we essentially switch to a smooth-rendering low-quality view while\n * interacting, then return to the normal higher-quality view after we stop, following an optional delay.\n *\n * Down-scaling the canvas resolution gives particularly good results. For example, scaling by ````0.5```` means that\n * we're rendering a quarter of the pixels while interacting, which can make the Viewer noticeably smoother with big models.\n *\n * The screen capture above shows FastNavPlugin in action. In this example, whenever we move the Camera or resize the Canvas,\n * FastNavPlugin switches off enhanced edges and ambient shadows (SAO), and down-scales the canvas, making it slightly\n * blurry. When ````0.5```` seconds passes with no interaction, the plugin shows edges and SAO again, and restores the\n * original canvas scale.\n *\n * # Usage\n *\n * In the example below, we'll create a {@link Viewer}, add a {@link FastNavPlugin}, then use an {@link XKTLoaderPlugin} to load a model.\n *\n * Whenever we interact with the Viewer, our FastNavPlugin will:\n *\n * * hide edges,\n * * hide ambient shadows (SAO),\n * * hide physically-based materials (switching to non-PBR),\n * * hide transparent objects, and\n * * scale the canvas resolution by 0.5, causing the GPU to render 75% less pixels.\n *
\n *\n * We'll also configure a 0.5 second delay before we transition back to high-quality each time we stop ineracting, so that we're\n * not continually flipping between low and high quality as we interact. Since we're only rendering ambient shadows when not interacting, we'll also treat ourselves\n * to expensive, high-quality SAO settings, that we wouldn't normally configure for an interactive SAO effect.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#performance_FastNavPlugin)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, FastNavPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer with PBR and SAO enabled\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true,\n * pbr: true, // Enable physically-based rendering for Viewer\n * sao: true // Enable ambient shadows for Viewer\n * });\n *\n * viewer.scene.camera.eye = [-66.26, 105.84, -281.92];\n * viewer.scene.camera.look = [42.45, 49.62, -43.59];\n * viewer.scene.camera.up = [0.05, 0.95, 0.15];\n *\n * // Higher-quality SAO settings\n *\n * viewer.scene.sao.enabled = true;\n * viewer.scene.sao.numSamples = 60;\n * viewer.scene.sao.kernelRadius = 170;\n *\n * // Install a FastNavPlugin\n *\n * new FastNavPlugin(viewer, {\n * hideEdges: true, // Don't show edges while we interact (default is true)\n * hideSAO: true, // Don't show ambient shadows while we interact (default is true)\n * hideColorTexture: true, // No color textures while we interact (default is true)\n * hidePBR: true, // No physically-based rendering while we interact (default is true)\n * hideTransparentObjects: true, // Hide transparent objects while we interact (default is false)\n * scaleCanvasResolution: true, // Scale canvas resolution while we interact (default is false)\n * defaultScaleCanvasResolutionFactor: 1.0, // Factor by which we scale canvas resolution when we stop interacting (default is 1.0)\n * scaleCanvasResolutionFactor: 0.5, // Factor by which we scale canvas resolution when we interact (default is 0.6)\n * delayBeforeRestore: true, // When we stop interacting, delay before restoring normal render (default is true)\n * delayBeforeRestoreSeconds: 0.5 // The delay duration, in seconds (default is 0.5)\n * });\n *\n * // Load a BIM model from XKT\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/HolterTower.xkt\",\n * sao: true, // Enable ambient shadows for this model\n * pbr: true // Enable physically-based rendering for this model\n * });\n * ````\n *\n * @class FastNavPlugin\n */\nclass FastNavPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg FastNavPlugin configuration.\n * @param {String} [cfg.id=\"FastNav\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Boolean} [cfg.hideColorTexture=true] Whether to temporarily hide color textures whenever we interact with the Viewer.\n * @param {Boolean} [cfg.hidePBR=true] Whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.\n * @param {Boolean} [cfg.hideSAO=true] Whether to temporarily hide scalable ambient occlusion (SAO) whenever we interact with the Viewer.\n * @param {Boolean} [cfg.hideEdges=true] Whether to temporarily hide edges whenever we interact with the Viewer.\n * @param {Boolean} [cfg.hideTransparentObjects=false] Whether to temporarily hide transparent objects whenever we interact with the Viewer.\n * @param {Number} [cfg.scaleCanvasResolution=false] Whether to temporarily down-scale the canvas resolution whenever we interact with the Viewer.\n * @param {Number} [cfg.defaultScaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we stop interacting with the Viewer.\n * @param {Number} [cfg.scaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we interact with the Viewer.\n * @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.\n * @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"FastNav\", viewer);\n\n this._hideColorTexture = cfg.hideColorTexture !== false;\n this._hidePBR = cfg.hidePBR !== false;\n this._hideSAO = cfg.hideSAO !== false;\n this._hideEdges = cfg.hideEdges !== false;\n this._hideTransparentObjects = !!cfg.hideTransparentObjects;\n this._scaleCanvasResolution = !!cfg.scaleCanvasResolution;\n this._defaultScaleCanvasResolutionFactor = cfg.defaultScaleCanvasResolutionFactor || 1.0;\n this._scaleCanvasResolutionFactor = cfg.scaleCanvasResolutionFactor || 0.6;\n this._delayBeforeRestore = (cfg.delayBeforeRestore !== false);\n this._delayBeforeRestoreSeconds = cfg.delayBeforeRestoreSeconds || 0.5;\n\n let timer = this._delayBeforeRestoreSeconds * 1000;\n let fastMode = false;\n\n const switchToLowQuality = () => {\n timer = (this._delayBeforeRestoreSeconds * 1000);\n if (!fastMode) {\n viewer.scene._renderer.setColorTextureEnabled(!this._hideColorTexture);\n viewer.scene._renderer.setPBREnabled(!this._hidePBR);\n viewer.scene._renderer.setSAOEnabled(!this._hideSAO);\n viewer.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects);\n viewer.scene._renderer.setEdgesEnabled(!this._hideEdges);\n if (this._scaleCanvasResolution) {\n viewer.scene.canvas.resolutionScale = this._scaleCanvasResolutionFactor;\n } else {\n viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;\n }\n fastMode = true;\n }\n };\n\n const switchToHighQuality = () => {\n viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;\n viewer.scene._renderer.setEdgesEnabled(true);\n viewer.scene._renderer.setColorTextureEnabled(true);\n viewer.scene._renderer.setPBREnabled(true);\n viewer.scene._renderer.setSAOEnabled(true);\n viewer.scene._renderer.setTransparentEnabled(true);\n fastMode = false;\n };\n\n this._onCanvasBoundary = viewer.scene.canvas.on(\"boundary\", switchToLowQuality);\n this._onCameraMatrix = viewer.scene.camera.on(\"matrix\", switchToLowQuality);\n\n this._onSceneTick = viewer.scene.on(\"tick\", (tickEvent) => {\n if (!fastMode) {\n return;\n }\n timer -= tickEvent.deltaTime;\n if ((!this._delayBeforeRestore) || timer <= 0) {\n switchToHighQuality();\n }\n });\n\n let down = false;\n\n this._onSceneMouseDown = viewer.scene.input.on(\"mousedown\", () => {\n down = true;\n });\n\n this._onSceneMouseUp = viewer.scene.input.on(\"mouseup\", () => {\n down = false;\n });\n\n this._onSceneMouseMove = viewer.scene.input.on(\"mousemove\", () => {\n if (!down) {\n return;\n }\n switchToLowQuality();\n });\n }\n\n /**\n * Gets whether to temporarily hide color textures whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @return {Boolean} ````true```` if hiding color textures.\n */\n get hideColorTexture() {\n return this._hideColorTexture;\n }\n\n /**\n * Sets whether to temporarily hide color textures whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @param {Boolean} hideColorTexture ````true```` to hide color textures.\n */\n set hideColorTexture(hideColorTexture) {\n this._hideColorTexture = hideColorTexture;\n }\n \n /**\n * Gets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @return {Boolean} ````true```` if hiding PBR.\n */\n get hidePBR() {\n return this._hidePBR;\n }\n\n /**\n * Sets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @param {Boolean} hidePBR ````true```` to hide PBR.\n */\n set hidePBR(hidePBR) {\n this._hidePBR = hidePBR;\n }\n\n /**\n * Gets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @return {Boolean} ````true```` if hiding SAO.\n */\n get hideSAO() {\n return this._hideSAO;\n }\n\n /**\n * Sets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @param {Boolean} hideSAO ````true```` to hide SAO.\n */\n set hideSAO(hideSAO) {\n this._hideSAO = hideSAO;\n }\n\n /**\n * Gets whether to temporarily hide edges whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @return {Boolean} ````true```` if hiding edges.\n */\n get hideEdges() {\n return this._hideEdges;\n }\n\n /**\n * Sets whether to temporarily hide edges whenever we interact with the Viewer.\n *\n * Default is ````true````.\n *\n * @param {Boolean} hideEdges ````true```` to hide edges.\n */\n set hideEdges(hideEdges) {\n this._hideEdges = hideEdges;\n }\n\n /**\n * Gets whether to temporarily hide transparent objects whenever we interact with the Viewer.\n *\n * Does not hide X-rayed, selected, highlighted objects.\n *\n * Default is ````false````.\n *\n * @return {Boolean} ````true```` if hiding transparent objects.\n */\n get hideTransparentObjects() {\n return this._hideTransparentObjects\n }\n\n /**\n * Sets whether to temporarily hide transparent objects whenever we interact with the Viewer.\n *\n * Does not hide X-rayed, selected, highlighted objects.\n *\n * Default is ````false````.\n *\n * @param {Boolean} hideTransparentObjects ````true```` to hide transparent objects.\n */\n set hideTransparentObjects(hideTransparentObjects) {\n this._hideTransparentObjects = (hideTransparentObjects !== false);\n }\n\n /**\n * Gets whether to temporarily scale the canvas resolution whenever we interact with the Viewer.\n *\n * Default is ````false````.\n *\n * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.\n *\n * @return {Boolean} ````true```` if scaling the canvas resolution.\n */\n get scaleCanvasResolution() {\n return this._scaleCanvasResolution;\n }\n\n /**\n * Sets the factor to which we restore the canvas resolution scale when we stop interacting with the viewer.\n *\n * Default is ````false````.\n *\n * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.\n *\n * @param {Boolean} scaleCanvasResolution ````true```` to scale the canvas resolution.\n */\n set scaleCanvasResolution(scaleCanvasResolution) {\n this._scaleCanvasResolution = scaleCanvasResolution;\n }\n\n /**\n * Gets the factor to which we restore the canvas resolution scale when we stop interacting with the viewer.\n *\n * Default is ````1.0````.\n *\n * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.\n *\n * @return {Number} Factor by scale canvas resolution when we stop interacting with the viewer.\n */\n get defaultScaleCanvasResolutionFactor() {\n return this._defaultScaleCanvasResolutionFactor;\n }\n\n /**\n * Sets the factor to which we restore the canvas resolution scale when we stop interacting with the viewer.\n *\n * Accepted range is ````[0.0 .. 1.0]````.\n *\n * Default is ````1.0````.\n *\n * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.\n *\n * @param {Number} defaultScaleCanvasResolutionFactor Factor by scale canvas resolution when we stop interacting with the viewer.\n */\n set defaultScaleCanvasResolutionFactor(defaultScaleCanvasResolutionFactor) {\n this._defaultScaleCanvasResolutionFactor = defaultScaleCanvasResolutionFactor || 1.0;\n }\n\n /**\n * Gets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.\n *\n * Default is ````0.6````.\n *\n * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.\n *\n * @return {Number} Factor by which we scale the canvas resolution.\n */\n get scaleCanvasResolutionFactor() {\n return this._scaleCanvasResolutionFactor;\n }\n\n /**\n * Sets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.\n *\n * Accepted range is ````[0.0 .. 1.0]````.\n *\n * Default is ````0.6````.\n *\n * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.\n *\n * @param {Number} scaleCanvasResolutionFactor Factor by which we scale the canvas resolution.\n */\n set scaleCanvasResolutionFactor(scaleCanvasResolutionFactor) {\n this._scaleCanvasResolutionFactor = scaleCanvasResolutionFactor || 0.6;\n }\n\n /**\n * Gets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.\n *\n * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.\n *\n * Default is ````true````.\n *\n * @return {Boolean} Whether to have a delay.\n */\n get delayBeforeRestore() {\n return this._delayBeforeRestore;\n }\n\n /**\n * Sets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.\n *\n * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.\n *\n * Default is ````true````.\n *\n * @param {Boolean} delayBeforeRestore Whether to have a delay.\n */\n set delayBeforeRestore(delayBeforeRestore) {\n this._delayBeforeRestore = delayBeforeRestore;\n }\n\n /**\n * Gets the delay before restoring normal rendering after we stop interacting with the Viewer.\n *\n * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.\n *\n * Default is ````0.5```` seconds.\n *\n * @return {Number} Delay in seconds.\n */\n get delayBeforeRestoreSeconds() {\n return this._delayBeforeRestoreSeconds;\n }\n\n /**\n * Sets the delay before restoring normal rendering after we stop interacting with the Viewer.\n *\n * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.\n *\n * Default is ````0.5```` seconds.\n *\n * @param {Number} delayBeforeRestoreSeconds Delay in seconds.\n */\n set delayBeforeRestoreSeconds(delayBeforeRestoreSeconds) {\n this._delayBeforeRestoreSeconds = delayBeforeRestoreSeconds !== null && delayBeforeRestoreSeconds !== undefined ? delayBeforeRestoreSeconds : 0.5;\n }\n\n /**\n * @private\n */\n send(name, value) {\n switch (name) {\n case \"clear\":\n break;\n }\n }\n\n /**\n * Destroys this plugin.\n */\n destroy() {\n this.viewer.scene.camera.off(this._onCameraMatrix);\n this.viewer.scene.canvas.off(this._onCanvasBoundary);\n this.viewer.scene.input.off(this._onSceneMouseDown);\n this.viewer.scene.input.off(this._onSceneMouseUp);\n this.viewer.scene.input.off(this._onSceneMouseMove);\n this.viewer.scene.off(this._onSceneTick);\n super.destroy();\n }\n}\n\nexport {FastNavPlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FastNavPlugin/FastNavPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FastNavPlugin/FastNavPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1096, + "__docId__": 1104, "kind": "class", "name": "FastNavPlugin", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js", @@ -17620,7 +17836,7 @@ ] }, { - "__docId__": 1097, + "__docId__": 1105, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17793,7 +18009,7 @@ ] }, { - "__docId__": 1098, + "__docId__": 1106, "kind": "member", "name": "_hideColorTexture", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17811,7 +18027,7 @@ } }, { - "__docId__": 1099, + "__docId__": 1107, "kind": "member", "name": "_hidePBR", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17829,7 +18045,7 @@ } }, { - "__docId__": 1100, + "__docId__": 1108, "kind": "member", "name": "_hideSAO", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17847,7 +18063,7 @@ } }, { - "__docId__": 1101, + "__docId__": 1109, "kind": "member", "name": "_hideEdges", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17865,7 +18081,7 @@ } }, { - "__docId__": 1102, + "__docId__": 1110, "kind": "member", "name": "_hideTransparentObjects", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17883,7 +18099,7 @@ } }, { - "__docId__": 1103, + "__docId__": 1111, "kind": "member", "name": "_scaleCanvasResolution", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17901,7 +18117,7 @@ } }, { - "__docId__": 1104, + "__docId__": 1112, "kind": "member", "name": "_defaultScaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17919,7 +18135,7 @@ } }, { - "__docId__": 1105, + "__docId__": 1113, "kind": "member", "name": "_scaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17937,7 +18153,7 @@ } }, { - "__docId__": 1106, + "__docId__": 1114, "kind": "member", "name": "_delayBeforeRestore", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17955,7 +18171,7 @@ } }, { - "__docId__": 1107, + "__docId__": 1115, "kind": "member", "name": "_delayBeforeRestoreSeconds", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17973,7 +18189,7 @@ } }, { - "__docId__": 1108, + "__docId__": 1116, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -17991,7 +18207,7 @@ } }, { - "__docId__": 1109, + "__docId__": 1117, "kind": "member", "name": "_onCameraMatrix", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18009,7 +18225,7 @@ } }, { - "__docId__": 1110, + "__docId__": 1118, "kind": "member", "name": "_onSceneTick", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18027,7 +18243,7 @@ } }, { - "__docId__": 1111, + "__docId__": 1119, "kind": "member", "name": "_onSceneMouseDown", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18045,7 +18261,7 @@ } }, { - "__docId__": 1112, + "__docId__": 1120, "kind": "member", "name": "_onSceneMouseUp", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18063,7 +18279,7 @@ } }, { - "__docId__": 1113, + "__docId__": 1121, "kind": "member", "name": "_onSceneMouseMove", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18081,7 +18297,7 @@ } }, { - "__docId__": 1114, + "__docId__": 1122, "kind": "get", "name": "hideColorTexture", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18107,7 +18323,7 @@ } }, { - "__docId__": 1115, + "__docId__": 1123, "kind": "set", "name": "hideColorTexture", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18132,7 +18348,7 @@ ] }, { - "__docId__": 1117, + "__docId__": 1125, "kind": "get", "name": "hidePBR", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18158,7 +18374,7 @@ } }, { - "__docId__": 1118, + "__docId__": 1126, "kind": "set", "name": "hidePBR", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18183,7 +18399,7 @@ ] }, { - "__docId__": 1120, + "__docId__": 1128, "kind": "get", "name": "hideSAO", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18209,7 +18425,7 @@ } }, { - "__docId__": 1121, + "__docId__": 1129, "kind": "set", "name": "hideSAO", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18234,7 +18450,7 @@ ] }, { - "__docId__": 1123, + "__docId__": 1131, "kind": "get", "name": "hideEdges", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18260,7 +18476,7 @@ } }, { - "__docId__": 1124, + "__docId__": 1132, "kind": "set", "name": "hideEdges", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18285,7 +18501,7 @@ ] }, { - "__docId__": 1126, + "__docId__": 1134, "kind": "get", "name": "hideTransparentObjects", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18311,7 +18527,7 @@ } }, { - "__docId__": 1127, + "__docId__": 1135, "kind": "set", "name": "hideTransparentObjects", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18336,7 +18552,7 @@ ] }, { - "__docId__": 1129, + "__docId__": 1137, "kind": "get", "name": "scaleCanvasResolution", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18362,7 +18578,7 @@ } }, { - "__docId__": 1130, + "__docId__": 1138, "kind": "set", "name": "scaleCanvasResolution", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18387,7 +18603,7 @@ ] }, { - "__docId__": 1132, + "__docId__": 1140, "kind": "get", "name": "defaultScaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18413,7 +18629,7 @@ } }, { - "__docId__": 1133, + "__docId__": 1141, "kind": "set", "name": "defaultScaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18438,7 +18654,7 @@ ] }, { - "__docId__": 1135, + "__docId__": 1143, "kind": "get", "name": "scaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18464,7 +18680,7 @@ } }, { - "__docId__": 1136, + "__docId__": 1144, "kind": "set", "name": "scaleCanvasResolutionFactor", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18489,7 +18705,7 @@ ] }, { - "__docId__": 1138, + "__docId__": 1146, "kind": "get", "name": "delayBeforeRestore", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18515,7 +18731,7 @@ } }, { - "__docId__": 1139, + "__docId__": 1147, "kind": "set", "name": "delayBeforeRestore", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18540,7 +18756,7 @@ ] }, { - "__docId__": 1141, + "__docId__": 1149, "kind": "get", "name": "delayBeforeRestoreSeconds", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18566,7 +18782,7 @@ } }, { - "__docId__": 1142, + "__docId__": 1150, "kind": "set", "name": "delayBeforeRestoreSeconds", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18591,7 +18807,7 @@ ] }, { - "__docId__": 1144, + "__docId__": 1152, "kind": "method", "name": "send", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18620,7 +18836,7 @@ "return": null }, { - "__docId__": 1145, + "__docId__": 1153, "kind": "method", "name": "destroy", "memberof": "src/plugins/FastNavPlugin/FastNavPlugin.js~FastNavPlugin", @@ -18635,29 +18851,29 @@ "return": null }, { - "__docId__": 1146, + "__docId__": 1154, "kind": "file", "name": "src/plugins/FastNavPlugin/index.js", "content": "export * from \"./FastNavPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/FastNavPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/FastNavPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1147, + "__docId__": 1155, "kind": "file", "name": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", "content": "import {utils} from \"../../viewer/scene/utils.js\";\nimport {core} from \"../../viewer/scene/core.js\";\n\n/**\n * Default data access strategy for {@link GLTFLoaderPlugin}.\n *\n * This just loads assets using XMLHttpRequest.\n */\nclass GLTFDefaultDataSource {\n\n constructor() {\n }\n\n /**\n * Gets metamodel JSON.\n *\n * @param {String|Number} metaModelSrc Identifies the metamodel JSON asset.\n * @param {Function} ok Fired on successful loading of the metamodel JSON asset.\n * @param {Function} error Fired on error while loading the metamodel JSON asset.\n */\n getMetaModel(metaModelSrc, ok, error) {\n utils.loadJSON(metaModelSrc,\n (json) => {\n ok(json);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n\n /**\n * Gets glTF JSON.\n *\n * @param {String|Number} glTFSrc Identifies the glTF JSON asset.\n * @param {Function} ok Fired on successful loading of the glTF JSON asset.\n * @param {Function} error Fired on error while loading the glTF JSON asset.\n */\n getGLTF(glTFSrc, ok, error) {\n utils.loadArraybuffer(glTFSrc,\n (gltf) => {\n ok(gltf);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n\n /**\n * Gets binary glTF file.\n *\n * @param {String|Number} glbSrc Identifies the .glb asset.\n * @param {Function} ok Fired on successful loading of the .glb asset.\n * @param {Function} error Fired on error while loading the .glb asset.\n */\n getGLB(glbSrc, ok, error) {\n utils.loadArraybuffer(glbSrc,\n (arraybuffer) => {\n ok(arraybuffer);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n\n /**\n * Gets glTF binary attachment.\n *\n * Note that this method requires the source of the glTF JSON asset. This is because the binary attachment\n * source could be relative to the glTF source, IE. it may not be a global ID.\n *\n * @param {String|Number} glTFSrc Identifies the glTF JSON asset.\n * @param {String|Number} binarySrc Identifies the glTF binary asset.\n * @param {Function} ok Fired on successful loading of the glTF binary asset.\n * @param {Function} error Fired on error while loading the glTF binary asset.\n */\n getArrayBuffer(glTFSrc, binarySrc, ok, error) {\n loadArraybuffer(glTFSrc, binarySrc,\n (arrayBuffer) => {\n ok(arrayBuffer);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n}\n\nfunction loadArraybuffer(glTFSrc, binarySrc, ok, err) {\n // Check for data: URI\n var defaultCallback = () => {\n };\n ok = ok || defaultCallback;\n err = err || defaultCallback;\n const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n const dataUriRegexResult = binarySrc.match(dataUriRegex);\n if (dataUriRegexResult) { // Safari can't handle data URIs through XMLHttpRequest\n const isBase64 = !!dataUriRegexResult[2];\n var data = dataUriRegexResult[3];\n data = window.decodeURIComponent(data);\n if (isBase64) {\n data = window.atob(data);\n }\n try {\n const buffer = new ArrayBuffer(data.length);\n const view = new Uint8Array(buffer);\n for (var i = 0; i < data.length; i++) {\n view[i] = data.charCodeAt(i);\n }\n core.scheduleTask(function () {\n ok(buffer);\n });\n } catch (error) {\n core.scheduleTask(function () {\n err(error);\n });\n }\n } else {\n const basePath = getBasePath(glTFSrc);\n const url = basePath + binarySrc;\n const request = new XMLHttpRequest();\n request.open('GET', url, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n err('loadArrayBuffer error : ' + request.response);\n }\n }\n };\n request.send(null);\n }\n}\n\nfunction getBasePath(src) {\n var i = src.lastIndexOf(\"/\");\n return (i !== 0) ? src.substring(0, i + 1) : \"\";\n}\n\nexport {GLTFDefaultDataSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1148, + "__docId__": 1156, "kind": "function", "name": "loadArraybuffer", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", @@ -18702,7 +18918,7 @@ "ignore": true }, { - "__docId__": 1149, + "__docId__": 1157, "kind": "function", "name": "getBasePath", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", @@ -18733,7 +18949,7 @@ "ignore": true }, { - "__docId__": 1150, + "__docId__": 1158, "kind": "class", "name": "GLTFDefaultDataSource", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js", @@ -18748,7 +18964,7 @@ "interface": false }, { - "__docId__": 1151, + "__docId__": 1159, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js~GLTFDefaultDataSource", @@ -18762,7 +18978,7 @@ "undocument": true }, { - "__docId__": 1152, + "__docId__": 1160, "kind": "method", "name": "getMetaModel", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js~GLTFDefaultDataSource", @@ -18809,7 +19025,7 @@ "return": null }, { - "__docId__": 1153, + "__docId__": 1161, "kind": "method", "name": "getGLTF", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js~GLTFDefaultDataSource", @@ -18856,7 +19072,7 @@ "return": null }, { - "__docId__": 1154, + "__docId__": 1162, "kind": "method", "name": "getGLB", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js~GLTFDefaultDataSource", @@ -18903,7 +19119,7 @@ "return": null }, { - "__docId__": 1155, + "__docId__": 1163, "kind": "method", "name": "getArrayBuffer", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js~GLTFDefaultDataSource", @@ -18961,18 +19177,18 @@ "return": null }, { - "__docId__": 1156, + "__docId__": 1164, "kind": "file", "name": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js", "content": "import {Plugin, SceneModel, utils} from \"../../viewer/index.js\"\nimport {GLTFSceneModelLoader} from \"./GLTFSceneModelLoader.js\";\n\nimport {GLTFDefaultDataSource} from \"./GLTFDefaultDataSource.js\";\nimport {IFCObjectDefaults} from \"../../viewer/metadata/IFCObjectDefaults.js\";\n\n/**\n * {@link Viewer} plugin that loads models from [glTF](https://www.khronos.org/gltf/).\n *\n * * Loads all glTF formats, including embedded and binary formats.\n * * Loads physically-based materials and textures.\n * * Creates an {@link Entity} representing each model it loads, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.\n * * Creates an {@link Entity} for each object within the model, which is indicated by each glTF ````node```` that has a ````name```` attribute. Those Entities will have {@link Entity#isObject} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.\n * * When loading, can set the World-space position, scale and rotation of each model within World space, along with initial properties for all the model's {@link Entity}s.\n * * Not recommended for large models. For best performance with large glTF datasets, we recommend first converting them\n * to ````.xkt```` format (eg. using [convert2xkt](https://github.com/xeokit/xeokit-convert)), then loading\n * the ````.xkt```` using {@link XKTLoaderPlugin}.\n *\n * ## Metadata\n *\n * GLTFLoaderPlugin can also load an accompanying JSON metadata file with each model, which creates a {@link MetaModel} corresponding\n * to the model {@link Entity} and a {@link MetaObject} corresponding to each object {@link Entity}.\n *\n * Each {@link MetaObject} has a {@link MetaObject#type}, which indicates the classification of its corresponding {@link Entity}. When loading\n * metadata, we can also provide GLTFLoaderPlugin with a custom lookup table of initial values to set on the properties of each type of {@link Entity}. By default, GLTFLoaderPlugin\n * uses its own map of default colors and visibilities for IFC element types.\n *\n * ## Usage\n *\n * In the example below we'll load a house plan model from a [binary glTF file](/examples/models/gltf/schependomlaan/), along\n * with an accompanying JSON [IFC metadata file](/examples/metaModels/schependomlaan/).\n *\n * This will create a bunch of {@link Entity}s that represents the model and its objects, along with a {@link MetaModel} and {@link MetaObject}s\n * that hold their metadata.\n *\n * Since this model contains IFC types, the GLTFLoaderPlugin will set the initial colors of object {@link Entity}s according\n * to the standard IFC element colors in the GLTFModel's current map. Override that with your own map via property {@link GLTFLoaderPlugin#objectDefaults}.\n *\n * Read more about this example in the user guide on [Viewing BIM Models Offline](https://www.notion.so/xeokit/Viewing-an-IFC-Model-with-xeokit-c373e48bc4094ff5b6e5c5700ff580ee).\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a Viewer,\n * // 2. Arrange the camera,\n * // 3. Tweak the selection material (tone it down a bit)\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * // 2\n * viewer.camera.orbitPitch(20);\n * viewer.camera.orbitYaw(-45);\n *\n * // 3\n * viewer.scene.selectedMaterial.fillAlpha = 0.1;\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a glTF loader plugin,\n * // 2. Load a glTF building model and JSON IFC metadata\n * // 3. Emphasis the edges to make it look nice\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const gltfLoader = new GLTFLoaderPlugin(viewer);\n *\n * // 2\n * var model = gltfLoader.load({ // Returns an Entity that represents the model\n * id: \"myModel\",\n * src: \"./models/gltf/OTCConferenceCenter/scene.gltf\",\n * metaModelSrc: \"./models/gltf/OTCConferenceCenter/metaModel.json\", // Creates a MetaModel (see below)\n * edges: true\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * //--------------------------------------------------------------------------------------------------------------\n * // 1. Find metadata on the third storey\n * // 2. Select all the objects in the building's third storey\n * // 3. Fit the camera to all the objects on the third storey\n * //--------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const metaModel = viewer.metaScene.metaModels[\"myModel\"]; // MetaModel with ID \"myModel\"\n * const metaObject\n * = viewer.metaScene.metaObjects[\"0u4wgLe6n0ABVaiXyikbkA\"]; // MetaObject with ID \"0u4wgLe6n0ABVaiXyikbkA\"\n *\n * const name = metaObject.name; // \"01 eerste verdieping\"\n * const type = metaObject.type; // \"IfcBuildingStorey\"\n * const parent = metaObject.parent; // MetaObject with type \"IfcBuilding\"\n * const children = metaObject.children; // Array of child MetaObjects\n * const objectId = metaObject.id; // \"0u4wgLe6n0ABVaiXyikbkA\"\n * const objectIds = viewer.metaScene.getObjectIDsInSubtree(objectId); // IDs of leaf sub-objects\n * const aabb = viewer.scene.getAABB(objectIds); // Axis-aligned boundary of the leaf sub-objects\n *\n * // 2\n * viewer.scene.setObjectsSelected(objectIds, true);\n *\n * // 3\n * viewer.cameraFlight.flyTo(aabb);\n * });\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Destroy the model\n * model.destroy();\n * ````\n *\n * ## Transforming\n *\n * We have the option to rotate, scale and translate each *````.glTF````* model as we load it.\n *\n * This lets us load multiple models, or even multiple copies of the same model, and position them apart from each other.\n *\n * In the example below, we'll scale our model to half its size, rotate it 90 degrees about its local X-axis, then\n * translate it 100 units along its X axis.\n *\n * ````javascript\n * const model = gltfLoader.load({\n * src: \"./models/gltf/Duplex/scene.gltf\",\n * metaModelSrc: \"./models/gltf/Duplex/Duplex.json\",\n * rotation: [90,0,0],\n * scale: [0.5, 0.5, 0.5],\n * position: [100, 0, 0]\n * });\n * ````\n *\n * ## Including and excluding IFC types\n *\n * We can also load only those objects that have the specified IFC types. In the example below, we'll load only the\n * objects that represent walls.\n *\n * ````javascript\n * const model = gltfLoader.load({\n * id: \"myModel\",\n * src: \"./models/gltf/OTCConferenceCenter/scene.gltf\",\n * metaModelSrc: \"./models/gltf/OTCConferenceCenter/metaModel.json\",\n * includeTypes: [\"IfcWallStandardCase\"]\n * });\n * ````\n *\n * We can also load only those objects that **don't** have the specified IFC types. In the example below, we'll load only the\n * objects that do not represent empty space.\n *\n * ````javascript\n * const model = gltfLoader.load({\n * id: \"myModel\",\n * src: \"./models/gltf/OTCConferenceCenter/scene.gltf\",\n * metaModelSrc: \"./models/gltf/OTCConferenceCenter/metaModel.json\",\n * excludeTypes: [\"IfcSpace\"]\n * });\n * ````\n * @class GLTFLoaderPlugin\n */\nclass GLTFLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"GLTFLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {Object} [cfg.dataSource] A custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link GLTFDefaultDataSource}, which loads over HTTP.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"GLTFLoader\", viewer, cfg);\n\n this._sceneModelLoader = new GLTFSceneModelLoader(this, cfg);\n\n this.dataSource = cfg.dataSource;\n this.objectDefaults = cfg.objectDefaults;\n }\n\n /**\n * Sets a custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.\n *\n * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new GLTFDefaultDataSource();\n }\n\n /**\n * Gets the custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.\n *\n * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Sets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n set objectDefaults(value) {\n this._objectDefaults = value || IFCObjectDefaults;\n }\n\n /**\n * Gets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n get objectDefaults() {\n return this._objectDefaults;\n }\n\n /**\n * Loads a glTF model from a file into this GLTFLoaderPlugin's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @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.\n * @param {String} [params.src] Path to a glTF file, as an alternative to the ````gltf```` parameter.\n * @param {*} [params.gltf] glTF JSON, as an alternative to the ````src```` parameter.\n * @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelJSON```` parameter.\n * @param {*} [params.metaModelJSON] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.\n * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {Boolean} [params.edges=false] Whether or not xeokit renders the model with edges emphasized.\n * @param {Number[]} [params.origin=[0,0,0]] The double-precision World-space origin of the model's coordinates.\n * @param {Number[]} [params.position=[0,0,0]] The single-precision position, relative to ````origin````.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @param {Number[]} [params.rotation=[0,0,0]] The model's orientation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @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````.\n * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) is enabled for the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````\n * @param {Boolean} [params.pbrEnabled=true] Indicates if physically-based rendering (PBR) is enabled for the model. Overrides ````colorTextureEnabled````. Only works when {@link Scene#pbrEnabled} is also ````true````.\n * @param {Boolean} [params.colorTextureEnabled=true] Indicates if base color texture rendering is enabled for the model. Overridden by ````pbrEnabled````. Only works when {@link Scene#colorTextureEnabled} is also ````true````.\n * @param {Boolean} [params.backfaces=true] When true, always show backfaces, even on objects for which the glTF material is single-sided. When false, only show backfaces on geometries whenever the glTF material is double-sided.\n * @param {Number} [params.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to\n * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable\n * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point\n * primitives. Only works while {@link DTX#enabled} is also ````true````.\n * @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}\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {\n isModel: true,\n dtxEnabled: params.dtxEnabled\n }));\n\n const modelId = sceneModel.id; // In case ID was auto-generated\n\n if (!params.src && !params.gltf) {\n this.error(\"load() param expected: src or gltf\");\n return sceneModel; // Return new empty model\n }\n\n if (params.metaModelSrc || params.metaModelJSON) {\n\n const objectDefaults = params.objectDefaults || this._objectDefaults || IFCObjectDefaults;\n\n const processMetaModelJSON = (metaModelJSON) => {\n\n this.viewer.metaScene.createMetaModel(modelId, metaModelJSON, {\n includeTypes: params.includeTypes,\n excludeTypes: params.excludeTypes\n });\n\n this.viewer.scene.canvas.spinner.processes--;\n\n let includeTypes;\n if (params.includeTypes) {\n includeTypes = {};\n for (let i = 0, len = params.includeTypes.length; i < len; i++) {\n includeTypes[params.includeTypes[i]] = true;\n }\n }\n\n let excludeTypes;\n if (params.excludeTypes) {\n excludeTypes = {};\n if (!includeTypes) {\n includeTypes = {};\n }\n for (let i = 0, len = params.excludeTypes.length; i < len; i++) {\n includeTypes[params.excludeTypes[i]] = true;\n }\n }\n\n params.readableGeometry = false;\n\n params.handleGLTFNode = (modelId, glTFNode, actions) => {\n\n const name = glTFNode.name;\n\n if (!name) {\n return true; // Continue descending this node subtree\n }\n\n const nodeId = name;\n const metaObject = this.viewer.metaScene.metaObjects[nodeId];\n const type = (metaObject ? metaObject.type : \"DEFAULT\") || \"DEFAULT\";\n\n actions.createEntity = {\n id: nodeId,\n isObject: true // Registers the Entity in Scene#objects\n };\n\n const props = objectDefaults[type];\n\n if (props) { // Set Entity's initial rendering state for recognized type\n\n if (props.visible === false) {\n actions.createEntity.visible = false;\n }\n\n if (props.colorize) {\n actions.createEntity.colorize = props.colorize;\n }\n\n if (props.pickable === false) {\n actions.createEntity.pickable = false;\n }\n\n if (props.opacity !== undefined && props.opacity !== null) {\n actions.createEntity.opacity = props.opacity;\n }\n }\n\n return true; // Continue descending this glTF node subtree\n };\n\n if (params.src) {\n this._sceneModelLoader.load(this, params.src, metaModelJSON, params, sceneModel);\n } else {\n this._sceneModelLoader.parse(this, params.gltf, metaModelJSON, params, sceneModel);\n }\n };\n\n if (params.metaModelSrc) {\n\n const metaModelSrc = params.metaModelSrc;\n\n this.viewer.scene.canvas.spinner.processes++;\n\n this._dataSource.getMetaModel(metaModelSrc, (metaModelJSON) => {\n\n this.viewer.scene.canvas.spinner.processes--;\n\n processMetaModelJSON(metaModelJSON);\n\n }, (errMsg) => {\n this.error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - ${errMsg}`);\n this.viewer.scene.canvas.spinner.processes--;\n });\n\n } else if (params.metaModelJSON) {\n\n processMetaModelJSON(params.metaModelJSON);\n }\n\n } else {\n\n params.handleGLTFNode = (modelId, glTFNode, actions) => {\n\n const name = glTFNode.name;\n\n if (!name) {\n return true; // Continue descending this node subtree\n }\n\n const id = name;\n\n actions.createEntity = { // Create an Entity for this glTF scene node\n id: id,\n isObject: true // Registers the Entity in Scene#objects\n };\n\n return true; // Continue descending this glTF node subtree\n };\n\n\n if (params.src) {\n this._sceneModelLoader.load(this, params.src, null, params, sceneModel);\n } else {\n this._sceneModelLoader.parse(this, params.gltf, null, params, sceneModel);\n }\n }\n\n sceneModel.once(\"destroyed\", () => {\n this.viewer.metaScene.destroyMetaModel(modelId);\n });\n\n return sceneModel;\n }\n\n /**\n * Destroys this GLTFLoaderPlugin.\n */\n destroy() {\n super.destroy();\n }\n}\n\nexport {GLTFLoaderPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1157, + "__docId__": 1165, "kind": "class", "name": "GLTFLoaderPlugin", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js", @@ -18996,7 +19212,7 @@ ] }, { - "__docId__": 1158, + "__docId__": 1166, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19069,7 +19285,7 @@ ] }, { - "__docId__": 1159, + "__docId__": 1167, "kind": "member", "name": "_sceneModelLoader", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19087,7 +19303,7 @@ } }, { - "__docId__": 1162, + "__docId__": 1170, "kind": "set", "name": "dataSource", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19108,7 +19324,7 @@ } }, { - "__docId__": 1163, + "__docId__": 1171, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19126,7 +19342,7 @@ } }, { - "__docId__": 1164, + "__docId__": 1172, "kind": "get", "name": "dataSource", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19147,7 +19363,7 @@ } }, { - "__docId__": 1165, + "__docId__": 1173, "kind": "set", "name": "objectDefaults", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19168,7 +19384,7 @@ } }, { - "__docId__": 1166, + "__docId__": 1174, "kind": "member", "name": "_objectDefaults", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19186,7 +19402,7 @@ } }, { - "__docId__": 1167, + "__docId__": 1175, "kind": "get", "name": "objectDefaults", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19207,7 +19423,7 @@ } }, { - "__docId__": 1168, + "__docId__": 1176, "kind": "method", "name": "load", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19503,7 +19719,7 @@ } }, { - "__docId__": 1169, + "__docId__": 1177, "kind": "method", "name": "destroy", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin", @@ -19518,18 +19734,18 @@ "return": null }, { - "__docId__": 1170, + "__docId__": 1178, "kind": "file", "name": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\nimport {core} from \"../../viewer/scene/core.js\";\nimport {sRGBEncoding} from \"../../viewer/scene/constants/constants.js\";\nimport {worldToRTCPositions} from \"../../viewer/scene/math/rtcCoords.js\";\nimport {parse} from '@loaders.gl/core';\nimport {GLTFLoader} from '@loaders.gl/gltf/dist/esm/gltf-loader.js';\nimport {\n ClampToEdgeWrapping,\n LinearFilter,\n LinearMipMapLinearFilter,\n LinearMipMapNearestFilter,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipMapLinearFilter,\n NearestMipMapNearestFilter,\n RepeatWrapping\n} from \"../../viewer/scene/constants/constants.js\";\n\n/**\n * @private\n */\nclass GLTFSceneModelLoader {\n\n constructor(cfg) {\n cfg = cfg || {};\n }\n\n load(plugin, src, metaModelJSON, options, sceneModel, ok, error) {\n options = options || {};\n loadGLTF(plugin, src, metaModelJSON, options, sceneModel, function () {\n core.scheduleTask(function () {\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false);\n });\n if (ok) {\n ok();\n }\n },\n function (msg) {\n plugin.error(msg);\n if (error) {\n error(msg);\n }\n sceneModel.fire(\"error\", msg);\n });\n }\n\n parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {\n options = options || {};\n parseGLTF(plugin, \"\", gltf, metaModelJSON, options, sceneModel, function () {\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false);\n if (ok) {\n ok();\n }\n },\n function (msg) {\n sceneModel.error(msg);\n sceneModel.fire(\"error\", msg);\n if (error) {\n error(msg);\n }\n });\n }\n}\n\nfunction getMetaModelCorrections(metaModelJSON) {\n const eachRootStats = {};\n const eachChildRoot = {};\n const metaObjects = metaModelJSON.metaObjects || [];\n const metaObjectsMap = {};\n for (let i = 0, len = metaObjects.length; i < len; i++) {\n const metaObject = metaObjects[i];\n metaObjectsMap[metaObject.id] = metaObject;\n }\n for (let i = 0, len = metaObjects.length; i < len; i++) {\n const metaObject = metaObjects[i];\n if (metaObject.parent !== undefined && metaObject.parent !== null) {\n const metaObjectParent = metaObjectsMap[metaObject.parent];\n if (metaObject.type === metaObjectParent.type) {\n let rootMetaObject = metaObjectParent;\n while (rootMetaObject.parent && metaObjectsMap[rootMetaObject.parent].type === rootMetaObject.type) {\n rootMetaObject = metaObjectsMap[rootMetaObject.parent];\n }\n const rootStats = eachRootStats[rootMetaObject.id] || (eachRootStats[rootMetaObject.id] = {\n numChildren: 0,\n countChildren: 0\n });\n rootStats.numChildren++;\n eachChildRoot[metaObject.id] = rootMetaObject;\n } else {\n\n }\n }\n }\n return {\n metaObjectsMap,\n eachRootStats,\n eachChildRoot\n };\n}\n\nfunction loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {\n const spinner = plugin.viewer.scene.canvas.spinner;\n spinner.processes++;\n const isGLB = (src.split('.').pop() === \"glb\");\n if (isGLB) {\n plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK\n options.basePath = getBasePath(src);\n parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok, error);\n spinner.processes--;\n },\n (err) => {\n spinner.processes--;\n error(err);\n });\n } else {\n plugin.dataSource.getGLTF(src, (gltf) => { // OK\n options.basePath = getBasePath(src);\n parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, error);\n spinner.processes--;\n },\n (err) => {\n spinner.processes--;\n error(err);\n });\n }\n}\n\nfunction getBasePath(src) {\n const i = src.lastIndexOf(\"/\");\n return (i !== 0) ? src.substring(0, i + 1) : \"\";\n}\n\nfunction parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {\n const spinner = plugin.viewer.scene.canvas.spinner;\n spinner.processes++;\n parse(gltf, GLTFLoader, {\n baseUri: options.basePath\n }).then((gltfData) => {\n const ctx = {\n src: src,\n metaModelCorrections: metaModelJSON ? getMetaModelCorrections(metaModelJSON) : null,\n loadBuffer: options.loadBuffer,\n basePath: options.basePath,\n handlenode: options.handlenode,\n backfaces: !!options.backfaces,\n gltfData: gltfData,\n scene: sceneModel.scene,\n plugin: plugin,\n sceneModel: sceneModel,\n //geometryCreated: {},\n numObjects: 0,\n nodes: [],\n nextId: 0,\n log: (msg) => {\n plugin.log(msg);\n }\n };\n loadTextures(ctx);\n loadMaterials(ctx);\n loadDefaultScene(ctx);\n sceneModel.finalize();\n spinner.processes--;\n ok();\n });\n}\n\nfunction loadTextures(ctx) {\n const gltfData = ctx.gltfData;\n const textures = gltfData.textures;\n if (textures) {\n for (let i = 0, len = textures.length; i < len; i++) {\n loadTexture(ctx, textures[i]);\n }\n }\n}\n\nfunction loadTexture(ctx, texture) {\n if (!texture.source || !texture.source.image) {\n return;\n }\n const textureId = `texture-${ctx.nextId++}`;\n\n let minFilter = NearestMipMapLinearFilter;\n switch (texture.sampler.minFilter) {\n case 9728:\n minFilter = NearestFilter;\n break;\n case 9729:\n minFilter = LinearFilter;\n break;\n case 9984:\n minFilter = NearestMipMapNearestFilter;\n break;\n case 9985:\n minFilter = LinearMipMapNearestFilter;\n break;\n case 9986:\n minFilter = NearestMipMapLinearFilter;\n break;\n case 9987:\n minFilter = LinearMipMapLinearFilter;\n break;\n }\n\n let magFilter = LinearFilter;\n switch (texture.sampler.magFilter) {\n case 9728:\n magFilter = NearestFilter;\n break;\n case 9729:\n magFilter = LinearFilter;\n break;\n }\n\n let wrapS = RepeatWrapping;\n switch (texture.sampler.wrapS) {\n case 33071:\n wrapS = ClampToEdgeWrapping;\n break;\n case 33648:\n wrapS = MirroredRepeatWrapping;\n break;\n case 10497:\n wrapS = RepeatWrapping;\n break;\n }\n\n let wrapT = RepeatWrapping;\n switch (texture.sampler.wrapT) {\n case 33071:\n wrapT = ClampToEdgeWrapping;\n break;\n case 33648:\n wrapT = MirroredRepeatWrapping;\n break;\n case 10497:\n wrapT = RepeatWrapping;\n break;\n }\n\n let wrapR = RepeatWrapping;\n switch (texture.sampler.wrapR) {\n case 33071:\n wrapR = ClampToEdgeWrapping;\n break;\n case 33648:\n wrapR = MirroredRepeatWrapping;\n break;\n case 10497:\n wrapR = RepeatWrapping;\n break;\n }\n ctx.sceneModel.createTexture({\n id: textureId,\n image: texture.source.image,\n flipY: !!texture.flipY,\n minFilter,\n magFilter,\n wrapS,\n wrapT,\n wrapR,\n encoding: sRGBEncoding\n });\n texture._textureId = textureId;\n}\n\nfunction loadMaterials(ctx) {\n const gltfData = ctx.gltfData;\n const materials = gltfData.materials;\n if (materials) {\n for (let i = 0, len = materials.length; i < len; i++) {\n const material = materials[i];\n material._textureSetId = loadTextureSet(ctx, material);\n material._attributes = loadMaterialAttributes(ctx, material);\n }\n }\n}\n\nfunction loadTextureSet(ctx, material) {\n const textureSetCfg = {};\n if (material.normalTexture) {\n textureSetCfg.normalTextureId = material.normalTexture.texture._textureId;\n }\n if (material.occlusionTexture) {\n textureSetCfg.occlusionTextureId = material.occlusionTexture.texture._textureId;\n }\n if (material.emissiveTexture) {\n textureSetCfg.emissiveTextureId = material.emissiveTexture.texture._textureId;\n }\n // const alphaMode = material.alphaMode;\n // switch (alphaMode) {\n // case \"NORMAL_OPAQUE\":\n // materialCfg.alphaMode = \"opaque\";\n // break;\n // case \"MASK\":\n // materialCfg.alphaMode = \"mask\";\n // break;\n // case \"BLEND\":\n // materialCfg.alphaMode = \"blend\";\n // break;\n // default:\n // }\n // const alphaCutoff = material.alphaCutoff;\n // if (alphaCutoff !== undefined) {\n // materialCfg.alphaCutoff = alphaCutoff;\n // }\n const metallicPBR = material.pbrMetallicRoughness;\n if (material.pbrMetallicRoughness) {\n const pbrMetallicRoughness = material.pbrMetallicRoughness;\n const baseColorTexture = pbrMetallicRoughness.baseColorTexture || pbrMetallicRoughness.colorTexture;\n if (baseColorTexture) {\n if (baseColorTexture.texture) {\n textureSetCfg.colorTextureId = baseColorTexture.texture._textureId;\n } else {\n textureSetCfg.colorTextureId = ctx.gltfData.textures[baseColorTexture.index]._textureId;\n }\n }\n if (metallicPBR.metallicRoughnessTexture) {\n textureSetCfg.metallicRoughnessTextureId = metallicPBR.metallicRoughnessTexture.texture._textureId;\n }\n }\n const extensions = material.extensions;\n if (extensions) {\n const specularPBR = extensions[\"KHR_materials_pbrSpecularGlossiness\"];\n if (specularPBR) {\n const specularTexture = specularPBR.specularTexture;\n if (specularTexture !== null && specularTexture !== undefined) {\n // textureSetCfg.colorTextureId = ctx.gltfData.textures[specularColorTexture.index]._textureId;\n }\n const specularColorTexture = specularPBR.specularColorTexture;\n if (specularColorTexture !== null && specularColorTexture !== undefined) {\n textureSetCfg.colorTextureId = ctx.gltfData.textures[specularColorTexture.index]._textureId;\n }\n }\n }\n if (textureSetCfg.normalTextureId !== undefined ||\n textureSetCfg.occlusionTextureId !== undefined ||\n textureSetCfg.emissiveTextureId !== undefined ||\n textureSetCfg.colorTextureId !== undefined ||\n textureSetCfg.metallicRoughnessTextureId !== undefined) {\n textureSetCfg.id = `textureSet-${ctx.nextId++};`\n ctx.sceneModel.createTextureSet(textureSetCfg);\n return textureSetCfg.id;\n }\n return null;\n}\n\nfunction loadMaterialAttributes(ctx, material) { // Substitute RGBA for material, to use fast flat shading instead\n const extensions = material.extensions;\n const materialAttributes = {\n color: new Float32Array([1, 1, 1, 1]),\n opacity: 1,\n metallic: 0,\n roughness: 1,\n doubleSided : true\n };\n if (extensions) {\n const specularPBR = extensions[\"KHR_materials_pbrSpecularGlossiness\"];\n if (specularPBR) {\n const diffuseFactor = specularPBR.diffuseFactor;\n if (diffuseFactor !== null && diffuseFactor !== undefined) {\n materialAttributes.color.set(diffuseFactor);\n }\n }\n const common = extensions[\"KHR_materials_common\"];\n if (common) {\n const technique = common.technique;\n const values = common.values || {};\n const blinn = technique === \"BLINN\";\n const phong = technique === \"PHONG\";\n const lambert = technique === \"LAMBERT\";\n const diffuse = values.diffuse;\n if (diffuse && (blinn || phong || lambert)) {\n if (!utils.isString(diffuse)) {\n materialAttributes.color.set(diffuse);\n }\n }\n const transparency = values.transparency;\n if (transparency !== null && transparency !== undefined) {\n materialAttributes.opacity = transparency;\n }\n const transparent = values.transparent;\n if (transparent !== null && transparent !== undefined) {\n materialAttributes.opacity = transparent;\n }\n }\n }\n const metallicPBR = material.pbrMetallicRoughness;\n if (metallicPBR) {\n const baseColorFactor = metallicPBR.baseColorFactor;\n if (baseColorFactor) {\n materialAttributes.color[0] = baseColorFactor[0];\n materialAttributes.color[1] = baseColorFactor[1];\n materialAttributes.color[2] = baseColorFactor[2];\n materialAttributes.opacity = baseColorFactor[3];\n }\n const metallicFactor = metallicPBR.metallicFactor;\n if (metallicFactor !== null && metallicFactor !== undefined) {\n materialAttributes.metallic = metallicFactor;\n }\n const roughnessFactor = metallicPBR.roughnessFactor;\n if (roughnessFactor !== null && roughnessFactor !== undefined) {\n materialAttributes.roughness = roughnessFactor;\n }\n }\n materialAttributes.doubleSided = (material.doubleSided !== false);\n return materialAttributes;\n}\n\nfunction loadDefaultScene(ctx) {\n const gltfData = ctx.gltfData;\n const scene = gltfData.scene || gltfData.scenes[0];\n if (!scene) {\n error(ctx, \"glTF has no default scene\");\n return;\n }\n loadScene(ctx, scene);\n}\n\nfunction loadScene(ctx, scene) {\n const nodes = scene.nodes;\n if (!nodes) {\n return;\n }\n for (let i = 0, len = nodes.length; i < len; i++) {\n const node = nodes[i];\n countMeshUsage(ctx, node);\n }\n for (let i = 0, len = nodes.length; i < len; i++) {\n const node = nodes[i];\n loadNode(ctx, node, 0, null);\n }\n}\n\nfunction countMeshUsage(ctx, node) {\n const mesh = node.mesh;\n if (mesh) {\n mesh.instances = mesh.instances ? mesh.instances + 1 : 1;\n }\n if (node.children) {\n const children = node.children;\n for (let i = 0, len = children.length; i < len; i++) {\n const childNode = children[i];\n if (!childNode) {\n error(ctx, \"Node not found: \" + i);\n continue;\n }\n countMeshUsage(ctx, childNode);\n }\n }\n}\n\nconst deferredMeshIds = [];\n\nfunction loadNode(ctx, node, depth, matrix) {\n const gltfData = ctx.gltfData;\n let localMatrix;\n if (node.matrix) {\n localMatrix = node.matrix;\n if (matrix) {\n matrix = math.mulMat4(matrix, localMatrix, math.mat4());\n } else {\n matrix = localMatrix;\n }\n }\n if (node.translation) {\n localMatrix = math.translationMat4v(node.translation);\n if (matrix) {\n matrix = math.mulMat4(matrix, localMatrix, math.mat4());\n } else {\n matrix = localMatrix;\n }\n }\n if (node.rotation) {\n localMatrix = math.quaternionToMat4(node.rotation);\n if (matrix) {\n matrix = math.mulMat4(matrix, localMatrix, math.mat4());\n } else {\n matrix = localMatrix;\n }\n }\n if (node.scale) {\n localMatrix = math.scalingMat4v(node.scale);\n if (matrix) {\n matrix = math.mulMat4(matrix, localMatrix, math.mat4());\n } else {\n matrix = localMatrix;\n }\n }\n\n const sceneModel = ctx.sceneModel;\n if (node.mesh) {\n const mesh = node.mesh;\n let createEntity;\n if (ctx.handlenode) {\n const actions = {};\n if (!ctx.handlenode(ctx.sceneModel.id, node, actions)) {\n return;\n }\n if (actions.createEntity) {\n createEntity = actions.createEntity;\n }\n }\n const worldMatrix = matrix ? matrix.slice() : math.identityMat4();\n const numPrimitives = mesh.primitives.length;\n\n if (numPrimitives > 0) {\n\n for (let i = 0; i < numPrimitives; i++) {\n\n const primitive = mesh.primitives[i];\n if (primitive.mode < 4) {\n continue;\n }\n\n const meshCfg = {\n id: sceneModel.id + \".\" + ctx.numObjects++\n };\n\n const material = primitive.material;\n if (material) {\n meshCfg.textureSetId = material._textureSetId;\n meshCfg.color = material._attributes.color;\n meshCfg.opacity = material._attributes.opacity;\n meshCfg.metallic = material._attributes.metallic;\n meshCfg.roughness = material._attributes.roughness;\n } else {\n meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);\n meshCfg.opacity = 1.0;\n }\n\n const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));\n\n switch (primitive.mode) {\n case 0: // POINTS\n meshCfg.primitive = \"points\";\n break;\n case 1: // LINES\n meshCfg.primitive = \"lines\";\n break;\n case 2: // LINE_LOOP\n meshCfg.primitive = \"lines\";\n break;\n case 3: // LINE_STRIP\n meshCfg.primitive = \"lines\";\n break;\n case 4: // TRIANGLES\n meshCfg.primitive = backfaces ? \"triangles\" : \"solid\";\n break;\n case 5: // TRIANGLE_STRIP\n meshCfg.primitive = backfaces ? \"triangles\" : \"solid\";\n break;\n case 6: // TRIANGLE_FAN\n meshCfg.primitive = backfaces ? \"triangles\" : \"solid\";\n break;\n default:\n meshCfg.primitive = backfaces ? \"triangles\" : \"solid\";\n }\n\n const POSITION = primitive.attributes.POSITION;\n if (!POSITION) {\n continue;\n }\n meshCfg.localPositions = POSITION.value;\n meshCfg.positions = new Float64Array(meshCfg.localPositions.length);\n\n if (primitive.attributes.NORMAL) {\n meshCfg.normals = primitive.attributes.NORMAL.value;\n }\n\n if (primitive.attributes.TEXCOORD_0) {\n meshCfg.uv = primitive.attributes.TEXCOORD_0.value;\n }\n\n if (primitive.indices) {\n meshCfg.indices = primitive.indices.value;\n }\n\n math.transformPositions3(worldMatrix, meshCfg.localPositions, meshCfg.positions);\n const origin = math.vec3();\n const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy\n if (rtcNeeded) {\n meshCfg.origin = origin;\n }\n\n // if (createEntity) {\n // if (createEntity.colorize) {\n // meshCfg.color = createEntity.colorize;\n // }\n // if (createEntity.opacity !== undefined && createEntity.opacity !== null) {\n // meshCfg.opacity = createEntity.opacity;\n // }\n // }\n\n sceneModel.createMesh(meshCfg);\n deferredMeshIds.push(meshCfg.id);\n }\n // if (createEntity) {\n // sceneModel.createEntity(utils.apply(createEntity, {\n // meshIds: deferredMeshIds,\n // isObject: true\n // }));\n // } else {\n // sceneModel.createEntity({\n // meshIds: deferredMeshIds,\n // isObject: true\n // });\n // }\n }\n }\n\n if (node.children) {\n const children = node.children;\n for (let i = 0, len = children.length; i < len; i++) {\n const childNode = children[i];\n loadNode(ctx, childNode, depth + 1, matrix);\n }\n }\n\n // Post-order visit scene node\n\n const nodeName = node.name;\n if (((nodeName !== undefined && nodeName !== null) || depth === 0) && deferredMeshIds.length > 0) {\n if (nodeName === undefined || nodeName === null) {\n ctx.log(`Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT`);\n }\n let entityId = nodeName; // Fall back on generated ID when `name` not found on glTF scene node(s)\n // if (!!entityId && sceneModel.entities[entityId]) {\n // ctx.log(`Warning: Two or more glTF nodes found with same 'name' attribute: '${nodeName} - will randomly-generating an object ID in XKT`);\n // }\n // while (!entityId || sceneModel.entities[entityId]) {\n // entityId = \"entity-\" + ctx.nextId++;\n // }\n if (ctx.metaModelCorrections) {\n // Merging meshes into XKTObjects that map to metaobjects\n const rootMetaObject = ctx.metaModelCorrections.eachChildRoot[entityId];\n if (rootMetaObject) {\n const rootMetaObjectStats = ctx.metaModelCorrections.eachRootStats[rootMetaObject.id];\n rootMetaObjectStats.countChildren++;\n if (rootMetaObjectStats.countChildren >= rootMetaObjectStats.numChildren) {\n sceneModel.createEntity({\n id: rootMetaObject.id,\n meshIds: deferredMeshIds\n });\n deferredMeshIds.length = 0;\n }\n } else {\n const metaObject = ctx.metaModelCorrections.metaObjectsMap[entityId];\n if (metaObject) {\n sceneModel.createEntity({\n id: entityId,\n meshIds: deferredMeshIds\n });\n deferredMeshIds.length = 0;\n }\n }\n } else {\n // Create an XKTObject from the meshes at each named glTF node, don't care about metaobjects\n sceneModel.createEntity({\n id: entityId,\n meshIds: deferredMeshIds\n });\n deferredMeshIds.length = 0;\n }\n }\n}\n\nfunction error(ctx, msg) {\n ctx.plugin.error(msg);\n}\n\nexport {GLTFSceneModelLoader};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1171, + "__docId__": 1179, "kind": "function", "name": "getMetaModelCorrections", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19560,7 +19776,7 @@ "ignore": true }, { - "__docId__": 1172, + "__docId__": 1180, "kind": "function", "name": "loadGLTF", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19623,7 +19839,7 @@ "ignore": true }, { - "__docId__": 1173, + "__docId__": 1181, "kind": "function", "name": "getBasePath", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19654,7 +19870,7 @@ "ignore": true }, { - "__docId__": 1174, + "__docId__": 1182, "kind": "function", "name": "parseGLTF", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19717,7 +19933,7 @@ "ignore": true }, { - "__docId__": 1175, + "__docId__": 1183, "kind": "function", "name": "loadTextures", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19744,7 +19960,7 @@ "ignore": true }, { - "__docId__": 1176, + "__docId__": 1184, "kind": "function", "name": "loadTexture", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19777,7 +19993,7 @@ "ignore": true }, { - "__docId__": 1177, + "__docId__": 1185, "kind": "function", "name": "loadMaterials", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19804,7 +20020,7 @@ "ignore": true }, { - "__docId__": 1178, + "__docId__": 1186, "kind": "function", "name": "loadTextureSet", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19841,7 +20057,7 @@ "ignore": true }, { - "__docId__": 1179, + "__docId__": 1187, "kind": "function", "name": "loadMaterialAttributes", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19878,7 +20094,7 @@ "ignore": true }, { - "__docId__": 1180, + "__docId__": 1188, "kind": "function", "name": "loadDefaultScene", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19905,7 +20121,7 @@ "ignore": true }, { - "__docId__": 1181, + "__docId__": 1189, "kind": "function", "name": "loadScene", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19938,7 +20154,7 @@ "ignore": true }, { - "__docId__": 1182, + "__docId__": 1190, "kind": "function", "name": "countMeshUsage", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19971,7 +20187,7 @@ "ignore": true }, { - "__docId__": 1183, + "__docId__": 1191, "kind": "variable", "name": "deferredMeshIds", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -19992,7 +20208,7 @@ "ignore": true }, { - "__docId__": 1184, + "__docId__": 1192, "kind": "function", "name": "loadNode", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -20037,7 +20253,7 @@ "ignore": true }, { - "__docId__": 1185, + "__docId__": 1193, "kind": "function", "name": "error", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -20070,7 +20286,7 @@ "ignore": true }, { - "__docId__": 1186, + "__docId__": 1194, "kind": "class", "name": "GLTFSceneModelLoader", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js", @@ -20086,7 +20302,7 @@ "ignore": true }, { - "__docId__": 1187, + "__docId__": 1195, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js~GLTFSceneModelLoader", @@ -20100,7 +20316,7 @@ "undocument": true }, { - "__docId__": 1188, + "__docId__": 1196, "kind": "method", "name": "load", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js~GLTFSceneModelLoader", @@ -20159,7 +20375,7 @@ "return": null }, { - "__docId__": 1189, + "__docId__": 1197, "kind": "method", "name": "parse", "memberof": "src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js~GLTFSceneModelLoader", @@ -20218,29 +20434,29 @@ "return": null }, { - "__docId__": 1190, + "__docId__": 1198, "kind": "file", "name": "src/plugins/GLTFLoaderPlugin/index.js", "content": "export * from \"./GLTFDefaultDataSource.js\";\nexport * from \"./GLTFLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/GLTFLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/GLTFLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1191, + "__docId__": 1199, "kind": "file", "name": "src/plugins/LASLoaderPlugin/LASDefaultDataSource.js", "content": "/**\n * Default data access strategy for {@link LASLoaderPlugin}.\n */\nclass LASDefaultDataSource {\n\n constructor() {\n }\n\n /**\n * Gets the contents of the given LAS file in an arraybuffer.\n *\n * @param {String|Number} src Path or ID of an LAS file.\n * @param {Function} ok Callback fired on success, argument is the LAS file in an arraybuffer.\n * @param {Function} error Callback fired on error.\n */\n getLAS(src, ok, error) {\n var defaultCallback = () => {\n };\n ok = ok || defaultCallback;\n error = error || defaultCallback;\n const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n const dataUriRegexResult = src.match(dataUriRegex);\n if (dataUriRegexResult) { // Safari can't handle data URIs through XMLHttpRequest\n const isBase64 = !!dataUriRegexResult[2];\n var data = dataUriRegexResult[3];\n data = window.decodeURIComponent(data);\n if (isBase64) {\n data = window.atob(data);\n }\n try {\n const buffer = new ArrayBuffer(data.length);\n const view = new Uint8Array(buffer);\n for (var i = 0; i < data.length; i++) {\n view[i] = data.charCodeAt(i);\n }\n ok(buffer);\n } catch (errMsg) {\n error(errMsg);\n }\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', src, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n error('getXKT error : ' + request.response);\n }\n }\n };\n request.send(null);\n }\n }\n}\n\nexport {LASDefaultDataSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1192, + "__docId__": 1200, "kind": "class", "name": "LASDefaultDataSource", "memberof": "src/plugins/LASLoaderPlugin/LASDefaultDataSource.js", @@ -20255,7 +20471,7 @@ "interface": false }, { - "__docId__": 1193, + "__docId__": 1201, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/LASLoaderPlugin/LASDefaultDataSource.js~LASDefaultDataSource", @@ -20269,7 +20485,7 @@ "undocument": true }, { - "__docId__": 1194, + "__docId__": 1202, "kind": "method", "name": "getLAS", "memberof": "src/plugins/LASLoaderPlugin/LASDefaultDataSource.js~LASDefaultDataSource", @@ -20316,18 +20532,18 @@ "return": null }, { - "__docId__": 1195, + "__docId__": 1203, "kind": "file", "name": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", "content": "import {utils} from \"../../viewer/scene/utils.js\";\nimport {SceneModel} from \"../../viewer/scene/model/index.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {LASDefaultDataSource} from \"./LASDefaultDataSource.js\";\nimport {math} from \"../../viewer/index.js\";\nimport {parse} from '@loaders.gl/core';\nimport {LASLoader} from '@loaders.gl/las/dist/esm/las-loader.js';\nimport {loadLASHeader} from \"./loadLASHeader\";\n\nconst MAX_VERTICES = 500000; // TODO: Rough estimate\n\n/**\n * {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_LASLoaderPlugin_Autzen)]\n *\n * ## Summary\n *\n * * Loads [LAS Formats](https://www.asprs.org/divisions-committees/lidar-division/laser-las-file-format-exchange-activities) up to v1.3 from both *.las* and *.laz* files. It does not support LAS v1.4.\n * * Loads lidar point cloud positions, colors and intensities.\n * * Supports 32 and 64-bit positions.\n * * Supports 8 and 16-bit color depths.\n * * Option to load every *n* points.\n * * Does not (yet) load [point classifications](https://www.usna.edu/Users/oceano/pguth/md_help/html/las_format_classification_codes.htm).\n *\n * ## Performance\n *\n * If you need faster loading, consider pre-converting your LAS files to XKT format using [xeokit-convert](https://github.com/xeokit/xeokit-convert), then loading them\n * with {@link XKTLoaderPlugin}.\n *\n * ## Scene and metadata representation\n *\n * When LASLoaderPlugin loads a LAS file, it creates two {@link Entity}s, a {@link MetaModel} and a {@link MetaObject}.\n *\n * The first Entity represents the file as a model within the Viewer's {@link Scene}. To indicate that it represents a model,\n * this Entity will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.\n *\n * The second Entity represents the the point cloud itself, as an object within the Scene. To indicate that it\n * represents an object, this Entity will have {@link Entity#isObject} set ````true```` and will be registered\n * by {@link Entity#id} in {@link Scene#objects}.\n *\n * The MetaModel registers the LAS file as a model within the Viewer's {@link MetaScene}. The MetaModel will be registered\n * by {@link MetaModel#id} in {@link MetaScene#metaModels} .\n *\n * Finally, the MetaObject registers the point cloud as an object within the {@link MetaScene}. The MetaObject will be registered\n * by {@link MetaObject#id} in {@link MetaScene#metaObjects}.\n *\n * ## Usage\n *\n * In the example below we'll load the Autzen model from\n * a [LAS file](/assets/models/las/). Once the model has\n * loaded, we'll then find its {@link MetaModel}, and the {@link MetaObject} and {@link Entity} that represent its point cloud.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_LASLoaderPlugin_Autzen)]\n *\n * ````javascript\n * import {Viewer, LASLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const lasLoader = new LASLoaderPlugin(viewer, {\n * colorDepth: 8, // Default\n * fp64: false, // Default\n * skip: 1 // Default\n * });\n *\n * const modelEntity = lasLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/las/autzen.laz\"\n * });\n *\n * modelEntity.on(\"loaded\", () => {\n *\n * const metaModel = viewer.metaScene.metaModels[modelEntity.id];\n * const pointCloudMetaObject = metaModel.rootMetaObject;\n *\n * const pointCloudEntity = viewer.scene.objects[pointCloudMetaObject.id];\n *\n * //...\n * });\n * ````\n *\n * ## Transforming\n *\n * We have the option to rotate, scale and translate each LAS model as we load it.\n *\n * In the example below, we'll scale our model to half its size, rotate it 90 degrees about its local X-axis, then\n * position it at [1842022, 10, -5173301] within xeokit's world coordinate system.\n *\n * ````javascript\n * const modelEntity = lasLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/las/autzen.laz\"\n * rotation: [90,0,0],\n * scale: [0.5, 0.5, 0.5],\n * origin: [1842022, 10, -5173301]\n * });\n * ````\n *\n * ## Configuring a custom data source\n *\n * By default, LASLoaderPlugin will load LAS files over HTTP.\n *\n * In the example below, we'll customize the way LASLoaderPlugin loads the files by configuring it with our own data source\n * object. For simplicity, our custom data source example also uses HTTP, using a couple of xeokit utility functions.\n *\n * ````javascript\n * import {utils} from \"xeokit-sdk.es.js\";\n *\n * class MyDataSource {\n *\n * constructor() {\n * }\n *\n * // Gets the contents of the given LAS file in an arraybuffer\n * getLAS(src, ok, error) {\n * utils.loadArraybuffer(src,\n * (arraybuffer) => {\n * ok(arraybuffer);\n * },\n * (errMsg) => {\n * error(errMsg);\n * });\n * }\n * }\n *\n * const lasLoader = new LASLoaderPlugin(viewer, {\n * dataSource: new MyDataSource()\n * });\n *\n * const modelEntity = lasLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/las/autzen.laz\"\n * });\n * ````\n *\n * @class LASLoaderPlugin\n * @since 2.0.17\n */\nclass LASLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"lasLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @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.\n * @param {Number} [cfg.skip=1] Configures LASLoaderPlugin to load every **n** points.\n * @param {Number} [cfg.fp64=false] Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.\n * @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\".\n */\n constructor(viewer, cfg = {}) {\n\n super(\"lasLoader\", viewer, cfg);\n\n this.dataSource = cfg.dataSource;\n this.skip = cfg.skip;\n this.fp64 = cfg.fp64;\n this.colorDepth = cfg.colorDepth;\n }\n\n /**\n * Gets the custom data source through which the LASLoaderPlugin can load LAS files.\n *\n * Default value is {@link LASDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Sets a custom data source through which the LASLoaderPlugin can load LAS files.\n *\n * Default value is {@link LASDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new LASDefaultDataSource();\n }\n\n /**\n * When LASLoaderPlugin is configured to load every **n** points, returns the value of **n**.\n *\n * Default value is ````1````.\n *\n * @returns {Number} The **n**th point that LASLoaderPlugin will read.\n */\n get skip() {\n return this._skip;\n }\n\n /**\n * Configures LASLoaderPlugin to load every **n** points.\n *\n * Default value is ````1````.\n *\n * @param {Number} value The **n**th point that LASLoaderPlugin will read.\n */\n set skip(value) {\n this._skip = value || 1;\n }\n\n /**\n * Gets if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.\n *\n * Default value is ````false````.\n *\n * @returns {Boolean} True if LASLoaderPlugin assumes that positions are stored in 64-bit floats instead of 32-bit.\n */\n get fp64() {\n return this._fp64;\n }\n\n /**\n * Configures if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.\n *\n * Default value is ````false````.\n *\n * @param {Boolean} value True if LASLoaderPlugin assumes that positions are stored in 64-bit floats instead of 32-bit.\n */\n set fp64(value) {\n this._fp64 = !!value;\n }\n\n /**\n * Gets whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits.\n *\n * Default value is ````8````.\n *\n * Note: LAS specification recommends 16 bits.\n *\n * @returns {Number|String} Possible returned values are 8, 16 and \"auto\".\n */\n get colorDepth() {\n return this._colorDepth;\n }\n\n /**\n * Configures whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits.\n *\n * Default value is ````8````.\n *\n * Note: LAS specification recommends 16 bits.\n *\n * @param {Number|String} value Valid values are 8, 16 and \"auto\".\n */\n set colorDepth(value) {\n this._colorDepth = value || \"auto\";\n }\n\n /**\n * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @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.\n * @param {String} [params.src] Path to a LAS file, as an alternative to the ````las```` parameter.\n * @param {ArrayBuffer} [params.las] The LAS file data, as an alternative to the ````src```` parameter.\n * @param {Boolean} [params.loadMetadata=true] Whether to load metadata for the LAS model.\n * @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.\n * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @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.\n * @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````.\n * @param {Object} [params.stats] Collects model statistics.\n * @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}.\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {\n isModel: true\n }));\n\n if (!params.src && !params.las) {\n this.error(\"load() param expected: src or las\");\n return sceneModel; // Return new empty model\n }\n\n const options = {\n las: {\n skip: this._skip,\n fp64: this._fp64,\n colorDepth: this._colorDepth\n }\n };\n\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel);\n } else {\n const spinner = this.viewer.scene.canvas.spinner;\n spinner.processes++;\n this._parseModel(params.las, params, options, sceneModel).then(() => {\n spinner.processes--;\n }, (errMsg) => {\n spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n });\n }\n\n return sceneModel;\n }\n\n _loadModel(src, params, options, sceneModel) {\n const spinner = this.viewer.scene.canvas.spinner;\n spinner.processes++;\n this._dataSource.getLAS(params.src, (arrayBuffer) => {\n this._parseModel(arrayBuffer, params, options, sceneModel).then(() => {\n spinner.processes--;\n }, (errMsg) => {\n spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n });\n },\n (errMsg) => {\n spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n });\n }\n\n _parseModel(arrayBuffer, params, options, sceneModel) {\n\n function readPositions(attributesPosition) {\n const positionsValue = attributesPosition.value;\n if (params.rotateX) {\n if (positionsValue) {\n for (let i = 0, len = positionsValue.length; i < len; i += 3) {\n const temp = positionsValue[i + 1];\n positionsValue[i + 1] = positionsValue[i + 2];\n positionsValue[i + 2] = temp;\n }\n }\n }\n return positionsValue;\n }\n\n function readColorsAndIntensities(attributesColor, attributesIntensity) {\n const colors = attributesColor.value;\n const colorSize = attributesColor.size;\n const intensities = attributesIntensity.value;\n const colorsCompressedSize = intensities.length * 4;\n const colorsCompressed = new Uint8Array(colorsCompressedSize);\n for (let i = 0, j = 0, k = 0, len = intensities.length; i < len; i++, k += colorSize, j += 4) {\n colorsCompressed[j + 0] = colors[k + 0];\n colorsCompressed[j + 1] = colors[k + 1];\n colorsCompressed[j + 2] = colors[k + 2];\n colorsCompressed[j + 3] = Math.round((intensities[i] / 65536) * 255);\n }\n return colorsCompressed;\n }\n\n function readIntensities(attributesIntensity) {\n const intensities = attributesIntensity.intensity;\n const colorsCompressedSize = intensities.length * 4;\n const colorsCompressed = new Uint8Array(colorsCompressedSize);\n for (let i = 0, j = 0, k = 0, len = intensities.length; i < len; i++, k += 3, j += 4) {\n colorsCompressed[j + 0] = 0;\n colorsCompressed[j + 1] = 0;\n colorsCompressed[j + 2] = 0;\n colorsCompressed[j + 3] = Math.round((intensities[i] / 65536) * 255);\n }\n return colorsCompressed;\n }\n\n return new Promise((resolve, reject) => {\n\n if (sceneModel.destroyed) {\n reject();\n return;\n }\n\n const stats = params.stats || {};\n stats.sourceFormat = \"LAS\";\n stats.schemaVersion = \"\";\n stats.title = \"\";\n stats.author = \"\";\n stats.created = \"\";\n stats.numMetaObjects = 0;\n stats.numPropertySets = 0;\n stats.numObjects = 0;\n stats.numGeometries = 0;\n stats.numTriangles = 0;\n stats.numVertices = 0;\n\n try {\n\n const lasHeader = loadLASHeader(arrayBuffer);\n\n parse(arrayBuffer, LASLoader, options).then((parsedData) => {\n\n const attributes = parsedData.attributes;\n const loaderData = parsedData.loaderData;\n const pointsFormatId = loaderData.pointsFormatId !== undefined ? loaderData.pointsFormatId : -1;\n\n if (!attributes.POSITION) {\n sceneModel.finalize();\n reject(\"No positions found in file\");\n return;\n }\n\n let positionsValue\n let colorsCompressed;\n\n switch (pointsFormatId) {\n case 0:\n positionsValue = readPositions(attributes.POSITION);\n colorsCompressed = readIntensities(attributes.intensity);\n break;\n case 1:\n if (!attributes.intensity) {\n sceneModel.finalize();\n reject(\"No positions found in file\");\n return;\n }\n positionsValue = readPositions(attributes.POSITION);\n colorsCompressed = readIntensities(attributes.intensity);\n break;\n case 2:\n if (!attributes.intensity) {\n sceneModel.finalize();\n reject(\"No positions found in file\");\n return;\n }\n positionsValue = readPositions(attributes.POSITION);\n colorsCompressed = readColorsAndIntensities(attributes.COLOR_0, attributes.intensity);\n break;\n case 3:\n if (!attributes.intensity) {\n sceneModel.finalize();\n reject(\"No positions found in file\");\n return;\n }\n positionsValue = readPositions(attributes.POSITION);\n colorsCompressed = readColorsAndIntensities(attributes.COLOR_0, attributes.intensity);\n break;\n }\n\n const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);\n const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);\n const meshIds = [];\n\n for (let i = 0, len = pointsChunks.length; i < len; i++) {\n const meshId = `pointsMesh${i}`;\n meshIds.push(meshId);\n sceneModel.createMesh({\n id: meshId,\n primitive: \"points\",\n positions: pointsChunks[i],\n colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null\n });\n }\n /*\n const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);\n const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);\n const meshIds = [];\n\n for (let i = 0, len = pointsChunks.length; i < len; i++) {\n\n const geometryId = `geometryMesh${i}`;\n const meshId = `pointsMesh${i}`;\n meshIds.push(meshId);\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: \"points\",\n positions: pointsChunks[i],\n colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null\n });\n\n sceneModel.createMesh({\n id: meshId,\n geometryId\n });\n }\n */\n\n const pointsObjectId = math.createUUID();\n\n sceneModel.createEntity({\n id: pointsObjectId,\n meshIds,\n isObject: true\n });\n\n sceneModel.finalize();\n\n if (params.loadMetadata !== false) {\n const rootMetaObjectId = math.createUUID();\n const metadata = {\n projectId: \"\",\n author: \"\",\n createdAt: \"\",\n schema: \"\",\n creatingApplication: \"\",\n metaObjects: [\n {\n id: rootMetaObjectId,\n name: \"Model\",\n type: \"Model\"\n },\n {\n id: pointsObjectId,\n name: \"PointCloud (LAS)\",\n type: \"PointCloud\",\n parent: rootMetaObjectId,\n attributes: lasHeader || {}\n }\n ],\n propertySets: []\n };\n const metaModelId = sceneModel.id;\n this.viewer.metaScene.createMetaModel(metaModelId, metadata, options);\n }\n\n sceneModel.scene.once(\"tick\", () => {\n if (sceneModel.destroyed) {\n return;\n }\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false); // Don't forget the event, for late subscribers\n });\n\n resolve();\n });\n } catch (e) {\n sceneModel.finalize();\n reject(e);\n }\n });\n }\n}\n\nfunction chunkArray(array, chunkSize) {\n if (chunkSize >= array.length) {\n return array;\n }\n let result = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n result.push(array.slice(i, i + chunkSize));\n }\n return result;\n}\n\nexport {LASLoaderPlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1196, + "__docId__": 1204, "kind": "variable", "name": "MAX_VERTICES", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", @@ -20348,7 +20564,7 @@ "ignore": true }, { - "__docId__": 1197, + "__docId__": 1205, "kind": "function", "name": "chunkArray", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", @@ -20385,7 +20601,7 @@ "ignore": true }, { - "__docId__": 1198, + "__docId__": 1206, "kind": "class", "name": "LASLoaderPlugin", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js", @@ -20410,7 +20626,7 @@ ] }, { - "__docId__": 1199, + "__docId__": 1207, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20509,7 +20725,7 @@ ] }, { - "__docId__": 1204, + "__docId__": 1212, "kind": "get", "name": "dataSource", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20530,7 +20746,7 @@ } }, { - "__docId__": 1205, + "__docId__": 1213, "kind": "set", "name": "dataSource", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20551,7 +20767,7 @@ } }, { - "__docId__": 1206, + "__docId__": 1214, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20569,7 +20785,7 @@ } }, { - "__docId__": 1207, + "__docId__": 1215, "kind": "get", "name": "skip", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20601,7 +20817,7 @@ } }, { - "__docId__": 1208, + "__docId__": 1216, "kind": "set", "name": "skip", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20626,7 +20842,7 @@ ] }, { - "__docId__": 1209, + "__docId__": 1217, "kind": "member", "name": "_skip", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20644,7 +20860,7 @@ } }, { - "__docId__": 1210, + "__docId__": 1218, "kind": "get", "name": "fp64", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20676,7 +20892,7 @@ } }, { - "__docId__": 1211, + "__docId__": 1219, "kind": "set", "name": "fp64", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20701,7 +20917,7 @@ ] }, { - "__docId__": 1212, + "__docId__": 1220, "kind": "member", "name": "_fp64", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20719,7 +20935,7 @@ } }, { - "__docId__": 1213, + "__docId__": 1221, "kind": "get", "name": "colorDepth", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20752,7 +20968,7 @@ } }, { - "__docId__": 1214, + "__docId__": 1222, "kind": "set", "name": "colorDepth", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20778,7 +20994,7 @@ ] }, { - "__docId__": 1215, + "__docId__": 1223, "kind": "member", "name": "_colorDepth", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20796,7 +21012,7 @@ } }, { - "__docId__": 1216, + "__docId__": 1224, "kind": "method", "name": "load", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -20980,7 +21196,7 @@ } }, { - "__docId__": 1217, + "__docId__": 1225, "kind": "method", "name": "_loadModel", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -21022,7 +21238,7 @@ "return": null }, { - "__docId__": 1218, + "__docId__": 1226, "kind": "method", "name": "_parseModel", "memberof": "src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin", @@ -21068,29 +21284,29 @@ } }, { - "__docId__": 1219, + "__docId__": 1227, "kind": "file", "name": "src/plugins/LASLoaderPlugin/index.js", "content": "export * from \"./LASLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/LASLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/LASLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1220, + "__docId__": 1228, "kind": "file", "name": "src/plugins/NavCubePlugin/CubeTextureCanvas.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\n\n/**\n * @private\n */\nfunction CubeTextureCanvas(viewer, navCubeScene, cfg = {}) {\n\n const cubeColor = \"lightgrey\";\n const cubeHighlightColor = cfg.hoverColor || \"rgba(0,0,0,0.4)\";\n const textColor = cfg.textColor || \"black\";\n\n const height = 500;\n const width = height + (height / 3);\n const scale = width / 24;\n\n const facesZUp = [\n {boundary: [6, 6, 6, 6], color: cfg.frontColor || cfg.color || \"#55FF55\"},\n {boundary: [18, 6, 6, 6], color: cfg.backColor || cfg.color || \"#55FF55\"},\n {boundary: [12, 6, 6, 6], color: cfg.rightColor || cfg.color || \"#FF5555\"},\n {boundary: [0, 6, 6, 6], color: cfg.leftColor || cfg.color || \"#FF5555\"},\n {boundary: [6, 0, 6, 6], color: cfg.topColor || cfg.color || \"#7777FF\"},\n {boundary: [6, 12, 6, 6], color: cfg.bottomColor || cfg.color || \"#7777FF\"}\n ];\n\n const areasZUp = [\n {label: \"NavCube.front\", boundaries: [[7, 7, 4, 4]], dir: [0, 1, 0], up: [0, 0, 1]},\n {label: \"NavCube.back\", boundaries: [[19, 7, 4, 4]], dir: [0, -1, 0], up: [0, 0, 1]},\n {label: \"NavCube.right\", boundaries: [[13, 7, 4, 4]], dir: [-1, 0, 0], up: [0, 0, 1]},\n {label: \"NavCube.left\", boundaries: [[1, 7, 4, 4]], dir: [1, 0, 0], up: [0, 0, 1]},\n {label: \"NavCube.top\", boundaries: [[7, 1, 4, 4]], dir: [0, 0, -1], up: [0, 1, 0]},\n {label: \"NavCube.bottom\", boundaries: [[7, 13, 4, 4]], dir: [0, 0, 1], up: [0, -1, 0]},\n {boundaries: [[7, 5, 4, 2]], dir: [0, 1, -1], up: [0, 1, 1]},\n {boundaries: [[1, 6, 4, 1], [6, 1, 1, 4]], dir: [1, 0, -1], up: [1, 0, 1]},\n {boundaries: [[7, 0, 4, 1], [19, 6, 4, 1]], dir: [0, -1, -1], up: [0, -1, 1]},\n {boundaries: [[13, 6, 4, 1], [11, 1, 1, 4]], dir: [-1, 0, -1], up: [-1, 0, 1]},\n {boundaries: [[7, 11, 4, 2]], dir: [0, 1, 1], up: [0, -1, 1]},\n {boundaries: [[1, 11, 4, 1], [6, 13, 1, 4]], dir: [1, 0, 1], up: [-1, 0, 1]},\n {boundaries: [[7, 17, 4, 1], [19, 11, 4, 1]], dir: [0, -1, 1], up: [0, 1, 1]},\n {boundaries: [[13, 11, 4, 1], [11, 13, 1, 4]], dir: [-1, 0, 1], up: [1, 0, 1]},\n {boundaries: [[5, 7, 2, 4]], dir: [1, 1, 0], up: [0, 0, 1]},\n {boundaries: [[11, 7, 2, 4]], dir: [-1, 1, 0], up: [0, 0, 1]},\n {boundaries: [[17, 7, 2, 4]], dir: [-1, -1, 0], up: [0, 0, 1]},\n {boundaries: [[0, 7, 1, 4], [23, 7, 1, 4]], dir: [1, -1, 0], up: [0, 0, 1]},\n {boundaries: [[5, 11, 2, 2]], dir: [1, 1, 1], up: [-1, -1, 1]},\n {boundaries: [[23, 11, 1, 1], [6, 17, 1, 1], [0, 11, 1, 1]], dir: [1, -1, 1], up: [-1, 1, 1]},\n {boundaries: [[5, 5, 2, 2]], dir: [1, 1, -1], up: [1, 1, 1]},\n {boundaries: [[11, 17, 1, 1], [17, 11, 2, 1]], dir: [-1, -1, 1], up: [1, 1, 1]},\n {boundaries: [[17, 6, 2, 1], [11, 0, 1, 1]], dir: [-1, -1, -1], up: [-1, -1, 1]},\n {boundaries: [[11, 11, 2, 2]], dir: [-1, 1, 1], up: [1, -1, 1]},\n {boundaries: [[0, 6, 1, 1], [6, 0, 1, 1], [23, 6, 1, 1]], dir: [1, -1, -1], up: [1, -1, 1]},\n {boundaries: [[11, 5, 2, 2]], dir: [-1, 1, -1], up: [-1, 1, 1]}\n ];\n\n const facesYUp = [\n {boundary: [6, 6, 6, 6], color: cfg.frontColor || cfg.color || \"#55FF55\"},\n {boundary: [18, 6, 6, 6], color: cfg.backColor || cfg.color || \"#55FF55\"},\n {boundary: [12, 6, 6, 6], color: cfg.rightColor || cfg.color || \"#FF5555\"},\n {boundary: [0, 6, 6, 6], color: cfg.leftColor || cfg.color || \"#FF5555\"},\n {boundary: [6, 0, 6, 6], color: cfg.topColor || cfg.color || \"#7777FF\"},\n {boundary: [6, 12, 6, 6], color: cfg.bottomColor || cfg.color || \"#7777FF\"}\n ];\n\n const areasYUp = [\n\n // Faces\n\n {yUp: \"\", label: \"NavCube.front\", boundaries: [[7, 7, 4, 4]], dir: [0, 0, -1], up: [0, 1, 0]},\n {label: \"NavCube.back\", boundaries: [[19, 7, 4, 4]], dir: [0, 0, 1], up: [0, 1, 0]},\n {label: \"NavCube.right\", boundaries: [[13, 7, 4, 4]], dir: [-1, 0, 0], up: [0, 1, 0]},\n {label: \"NavCube.left\", boundaries: [[1, 7, 4, 4]], dir: [1, 0, 0], up: [0, 1, 0]},\n {label: \"NavCube.top\", boundaries: [[7, 1, 4, 4]], dir: [0, -1, 0], up: [0, 0, -1]},\n {label: \"NavCube.bottom\", boundaries: [[7, 13, 4, 4]], dir: [0, 1, 0], up: [0, 0, 1]},\n {boundaries: [[7, 5, 4, 2]], dir: [0, -0.7071, -0.7071], up: [0, 0.7071, -0.7071]}, // Top-front edge\n {boundaries: [[1, 6, 4, 1], [6, 1, 1, 4]], dir: [1, -1, 0], up: [1, 1, 0]}, // Top-left edge\n {boundaries: [[7, 0, 4, 1], [19, 6, 4, 1]], dir: [0, -0.7071, 0.7071], up: [0, 0.7071, 0.7071]}, // Top-back edge\n {boundaries: [[13, 6, 4, 1], [11, 1, 1, 4]], dir: [-1, -1, 0], up: [-1, 1, 0]}, // Top-right edge\n {boundaries: [[7, 11, 4, 2]], dir: [0, 1, -1], up: [0, 1, 1]}, // Bottom-front edge\n {boundaries: [[1, 11, 4, 1], [6, 13, 1, 4]], dir: [1, 1, 0], up: [-1, 1, 0]}, // Bottom-left edge\n {boundaries: [[7, 17, 4, 1], [19, 11, 4, 1]], dir: [0, 1, 1], up: [0, 1, -1]}, // Bottom-back edge\n {boundaries: [[13, 11, 4, 1], [11, 13, 1, 4]], dir: [-1, 1, 0], up: [1, 1, 0]}, // Bottom-right edge\n {boundaries: [[5, 7, 2, 4]], dir: [1, 0, -1], up: [0, 1, 0]},// Front-left edge\n {boundaries: [[11, 7, 2, 4]], dir: [-1, 0, -1], up: [0, 1, 0]}, // Front-right edge\n {boundaries: [[17, 7, 2, 4]], dir: [-1, 0, 1], up: [0, 1, 0]},// Back-right edge\n {boundaries: [[0, 7, 1, 4], [23, 7, 1, 4]], dir: [1, 0, 1], up: [0, 1, 0]},// Back-left edge\n {boundaries: [[5, 11, 2, 2]], \"dir\": [0.5, 0.7071, -0.5], \"up\": [-0.5, 0.7071, 0.5]}, // Bottom-left-front corner\n {boundaries: [[23, 11, 1, 1], [6, 17, 1, 1], [0, 11, 1, 1]],\"dir\": [0.5, 0.7071, 0.5],\"up\": [-0.5, 0.7071, -0.5]},// Bottom-back-left corner\n {boundaries: [[5, 5, 2, 2]], \"dir\": [0.5, -0.7071, -0.5], \"up\": [0.5, 0.7071, -0.5]}, // Left-front-top corner\n {boundaries: [[11, 17, 1, 1], [17, 11, 2, 1]], \"dir\": [-0.5, 0.7071, 0.5], \"up\": [0.5, 0.7071, -0.5]}, // Bottom-back-right corner\n {boundaries: [[17, 6, 2, 1], [11, 0, 1, 1]], \"dir\": [-0.5, -0.7071, 0.5], \"up\": [-0.5, 0.7071, 0.5]}, // Top-back-right corner\n {boundaries: [[11, 11, 2, 2]], \"dir\": [-0.5, 0.7071, -0.5], \"up\": [0.5, 0.7071, 0.5]}, // Bottom-front-right corner\n {boundaries: [[0, 6, 1, 1], [6, 0, 1, 1], [23, 6, 1, 1]], \"dir\": [0.5, -0.7071, 0.5], \"up\": [0.5, 0.7071, 0.5]},// Top-back-left corner\n {boundaries: [[11, 5, 2, 2]], \"dir\": [-0.5, -0.7071, -0.5], \"up\": [-0.5, 0.7071, -0.5]}// Top-front-right corner\n ];\n\n for (let i = 0, len = areasZUp.length; i < len; i++) {\n math.normalizeVec3(areasZUp[i].dir, areasZUp[i].dir);\n math.normalizeVec3(areasZUp[i].up, areasZUp[i].up);\n }\n\n for (let i = 0, len = areasYUp.length; i < len; i++) {\n math.normalizeVec3(areasYUp[i].dir, areasYUp[i].dir);\n math.normalizeVec3(areasYUp[i].up, areasYUp[i].up);\n }\n\n var faces = facesYUp;\n var areas = areasYUp;\n\n this._textureCanvas = document.createElement('canvas');\n this._textureCanvas.width = width;\n this._textureCanvas.height = height;\n this._textureCanvas.style.width = width + \"px\";\n this._textureCanvas.style.height = height + \"px\";\n this._textureCanvas.style.padding = \"0\";\n this._textureCanvas.style.margin = \"0\";\n this._textureCanvas.style.top = \"0\";\n this._textureCanvas.style.background = cubeColor;\n this._textureCanvas.style.position = \"absolute\";\n this._textureCanvas.style.opacity = \"1.0\";\n this._textureCanvas.style.visibility = \"hidden\";\n this._textureCanvas.style[\"z-index\"] = 2000000;\n\n const body = document.getElementsByTagName(\"body\")[0];\n body.appendChild(this._textureCanvas);\n\n const context = this._textureCanvas.getContext(\"2d\");\n\n let zUp = false;\n\n function paint() {\n\n for (let i = 0, len = facesZUp.length; i < len; i++) {\n const face = facesZUp[i];\n const boundary = face.boundary;\n const xmin = Math.round(boundary[0] * scale);\n const ymin = Math.round(boundary[1] * scale);\n const width = Math.round(boundary[2] * scale);\n const height = Math.round(boundary[3] * scale);\n context.fillStyle = face.color;\n context.fillRect(xmin, ymin, width, height);\n }\n\n for (let i = 0, len = areas.length; i < len; i++) {\n let xmin;\n let ymin;\n let width;\n let height;\n const area = areas[i];\n\n const boundaries = area.boundaries;\n for (var j = 0, lenj = boundaries.length; j < lenj; j++) {\n const boundary = boundaries[j];\n xmin = Math.round(boundary[0] * scale);\n ymin = Math.round(boundary[1] * scale);\n width = Math.round(boundary[2] * scale);\n height = Math.round(boundary[3] * scale);\n if (area.highlighted) {\n context.fillStyle = area.highlighted ? cubeHighlightColor : (area.color || cubeColor);\n context.fillRect(xmin, ymin, width, height);\n }\n }\n if (area.label) {\n context.fillStyle = textColor;\n context.font = '60px sans-serif';\n context.textAlign = \"center\";\n var xcenter = xmin + (width * 0.5);\n var ycenter = ymin + (height * 0.7);\n context.fillText(translateLabel(area.label), xcenter, ycenter, 80);\n }\n }\n\n navCubeScene.glRedraw();\n }\n\n const translateLabel = (function () {\n\n const swizzleYUp = {\n \"NavCube.front\": \"NavCube.front\",\n \"NavCube.back\": \"NavCube.back\",\n \"NavCube.right\": \"NavCube.right\",\n \"NavCube.left\": \"NavCube.left\",\n \"NavCube.top\": \"NavCube.top\",\n \"NavCube.bottom\": \"NavCube.bottom\"\n };\n\n const swizzleZUp = {\n \"NavCube.front\": \"NavCube.front\",\n \"NavCube.back\": \"NavCube.back\",\n \"NavCube.right\": \"NavCube.right\",\n \"NavCube.left\": \"NavCube.left\",\n \"NavCube.top\": \"NavCube.top\",\n \"NavCube.bottom\": \"NavCube.bottom\"\n };\n\n const defaultLabels = {\n \"NavCube.front\": \"FRONT\",\n \"NavCube.back\": \"BACK\",\n \"NavCube.right\": \"RIGHT\",\n \"NavCube.left\": \"LEFT\",\n \"NavCube.top\": \"TOP\",\n \"NavCube.bottom\": \"BOTTOM\"\n };\n\n return function (key) {\n const swizzle = zUp ? swizzleZUp : swizzleYUp;\n const swizzledKey = swizzle ? swizzle[key] : null;\n if (swizzledKey) {\n return viewer.localeService.translate(swizzledKey) || defaultLabels[swizzledKey] || swizzledKey;\n }\n return key;\n };\n })();\n\n this.setZUp = function () {\n zUp = true;\n faces = facesZUp;\n areas = areasZUp;\n this.clear();\n };\n\n this.setYUp = function () {\n zUp = false;\n faces = facesYUp;\n areas = areasYUp;\n this.clear();\n };\n\n this.clear = function () {\n context.fillStyle = cubeColor;\n context.fillRect(0, 0, width, height);\n for (var i = 0, len = areas.length; i < len; i++) {\n const area = areas[i];\n area.highlighted = false;\n }\n paint();\n };\n\n this.getArea = function (uv) {\n const s = uv[0] * width;\n const t = height - (uv[1] * height); // Correct for our texture Y-flipping\n for (var i = 0, len = areas.length; i < len; i++) {\n const area = areas[i];\n const boundaries = area.boundaries;\n for (var j = 0, lenj = boundaries.length; j < lenj; j++) {\n const boundary = boundaries[j];\n if (s >= (boundary[0] * scale) && s <= ((boundary[0] + boundary[2]) * scale) && t >= (boundary[1] * scale) && t <= ((boundary[1] + boundary[3]) * scale)) {\n return i;\n }\n }\n }\n return -1;\n };\n\n this.setAreaHighlighted = function (areaId, highlighted) {\n var area = areas[areaId];\n if (!area) {\n throw \"Area not found: \" + areaId;\n }\n area.highlighted = !!highlighted;\n paint();\n };\n\n this.getAreaDir = function (areaId) {\n var area = areas[areaId];\n if (!area) {\n throw \"Unknown area: \" + areaId;\n }\n return area.dir;\n };\n\n this.getAreaUp = function (areaId) {\n var area = areas[areaId];\n if (!area) {\n throw \"Unknown area: \" + areaId;\n }\n return area.up;\n };\n\n this.getImage = function () {\n return this._textureCanvas;\n };\n\n this.destroy = function () {\n if (this._textureCanvas) {\n this._textureCanvas.parentNode.removeChild(this._textureCanvas);\n this._textureCanvas = null;\n }\n };\n}\n\nexport {CubeTextureCanvas};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/NavCubePlugin/CubeTextureCanvas.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/NavCubePlugin/CubeTextureCanvas.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1221, + "__docId__": 1229, "kind": "function", "name": "CubeTextureCanvas", "memberof": "src/plugins/NavCubePlugin/CubeTextureCanvas.js", @@ -21131,18 +21347,18 @@ "return": null }, { - "__docId__": 1222, + "__docId__": 1230, "kind": "file", "name": "src/plugins/NavCubePlugin/NavCubePlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {Scene} from \"../../viewer/scene/scene/Scene.js\";\nimport {DirLight} from \"./../../viewer/scene/lights/DirLight.js\";\nimport {Mesh} from \"./../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {Texture} from \"../../viewer/scene/materials/Texture.js\";\nimport {buildCylinderGeometry} from \"../../viewer/scene/geometry/builders/buildCylinderGeometry.js\";\nimport {CubeTextureCanvas} from \"./CubeTextureCanvas.js\";\nimport {ClampToEdgeWrapping} from \"../../viewer/scene/constants/constants.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * {@link Viewer} plugin that lets us look at the entire {@link Scene} from along a chosen axis or diagonal.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_NavCubePlugin)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_NavCubePlugin)]\n *\n * ## Overview\n *\n * * Rotating the NavCube causes the Viewer's {@link Camera} to orbit its current\n * point-of-interest. Conversely, orbiting the Camera causes the NavCube to rotate accordingly.\n * * The faces of the NavCube are aligned with the Viewer's {@link Scene}'s World-space coordinate axis. Clicking on a face moves\n * the Camera to look at the entire Scene along the corresponding axis. Clicking on an edge or a corner looks at\n * the entire Scene along a diagonal.\n * * The NavCube can be configured to either jump or fly the Camera to each new position. We can configure how tightly the\n * NavCube fits the Scene to view, and when flying, we can configure how fast it flies. We can also configure whether the\n * NavCube fits all objects to view, or just the currently visible objects. See below for a usage example.\n * * Clicking the NavCube also sets {@link CameraControl#pivotPos} to the center of the fitted objects.\n *\n * ## Usage\n *\n * In the example below, we'll create a Viewer and add a NavCubePlugin, which will create a NavCube gizmo in the canvas\n * with the given ID. Then we'll use the {@link XKTLoaderPlugin} to load a model into the Viewer's Scene. We can then\n * use the NavCube to look at the model along each axis or diagonal.\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin, NavCubePlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.03];\n *\n * const navCube = new NavCubePlugin(viewer, {\n *\n * canvasID: \"myNavCubeCanvas\",\n *\n * visible: true, // Initially visible (default)\n *\n * cameraFly: true, // Fly camera to each selected axis/diagonal\n * cameraFitFOV: 45, // How much field-of-view the scene takes once camera has fitted it to view\n * cameraFlyDuration: 0.5,// How long (in seconds) camera takes to fly to each new axis/diagonal\n *\n * fitVisible: false, // Fit whole scene, including invisible objects (default)\n *\n * synchProjection: false // Keep NavCube in perspective projection, even when camera switches to ortho (default)\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Duplex.ifc.xkt\",\n * edges: true\n * });\n * ````\n */\nclass NavCubePlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg NavCubePlugin configuration.\n * @param {String} [cfg.id=\"NavCube\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.canvasId] ID of an existing HTML canvas to display the NavCube - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas to display the NavCube - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {Boolean} [cfg.visible=true] Initial visibility.\n * @param {Boolean} [cfg.shadowVisible=true] Whether the shadow of the cube is visible.\n * @param {String} [cfg.cameraFly=true] Whether the {@link Camera} flies or jumps to each selected axis or diagonal.\n * @param {String} [cfg.cameraFitFOV=45] How much of the field-of-view, in degrees, that the 3D scene should fill the {@link Canvas} when the {@link Camera} moves to an axis or diagonal.\n * @param {String} [cfg.cameraFlyDuration=0.5] When flying the {@link Camera} to each new axis or diagonal, how long, in seconds, that the Camera takes to get there.\n * @param {String} [cfg.color=\"lightgrey\"] Custom uniform color for the faces of the NavCube.\n * @param {String} [cfg.frontColor=\"#55FF55\"] Custom color for the front face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.backColor=\"#55FF55\"] Custom color for the back face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.leftColor=\"#FF5555\"] Custom color for the left face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.rightColor=\"#FF5555\"] Custom color for the right face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.topColor=\"#5555FF\"] Custom color for the top face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.bottomColor=\"#5555FF\"] Custom color for the bottom face of the NavCube. Overrides ````color````.\n * @param {String} [cfg.hoverColor=\"rgba(0,0,0,0.4)\"] Custom color for highlighting regions on the NavCube as we hover the pointer over them.\n * @param {String} [cfg.textColor=\"black\"] Custom text color for labels of the NavCube.\n * @param {Boolean} [cfg.fitVisible=false] Sets whether the axis, corner and edge-aligned views will fit the\n * view to the entire {@link Scene} or just to visible object-{@link Entity}s. Entitys are visible objects when {@link Entity#isObject} and {@link Entity#visible} are both ````true````.\n * @param {Boolean} [cfg.synchProjection=false] Sets whether the NavCube switches between perspective and orthographic projections in synchrony with the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection.\n * @param {Boolean} [cfg.isProjectNorth] sets whether the NavCube switches between true north and project north - using the project north offset angle.\n * @param {number} [cfg.projectNorthOffsetAngle] sets the NavCube project north offset angle - when the {@link isProjectNorth} is true.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"NavCube\", viewer, cfg);\n\n viewer.navCube = this;\n\n var visible = true;\n\n try {\n this._navCubeScene = new Scene(viewer, {\n canvasId: cfg.canvasId,\n canvasElement: cfg.canvasElement,\n transparent: true\n });\n\n this._navCubeCanvas = this._navCubeScene.canvas.canvas;\n\n this._navCubeScene.input.keyboardEnabled = false; // Don't want keyboard input in the NavCube\n\n } catch (error) {\n this.error(error);\n return;\n }\n\n const navCubeScene = this._navCubeScene;\n\n navCubeScene.clearLights();\n\n new DirLight(navCubeScene, {dir: [0.4, -0.4, 0.8], color: [0.8, 1.0, 1.0], intensity: 1.0, space: \"view\"});\n new DirLight(navCubeScene, {dir: [-0.8, -0.3, -0.4], color: [0.8, 0.8, 0.8], intensity: 1.0, space: \"view\"});\n new DirLight(navCubeScene, {dir: [0.8, -0.6, -0.8], color: [1.0, 1.0, 1.0], intensity: 1.0, space: \"view\"});\n\n this._navCubeCamera = navCubeScene.camera;\n this._navCubeCamera.ortho.scale = 7.0;\n this._navCubeCamera.ortho.near = 0.1;\n this._navCubeCamera.ortho.far = 2000;\n\n navCubeScene.edgeMaterial.edgeColor = [0.2, 0.2, 0.2];\n navCubeScene.edgeMaterial.edgeAlpha = 0.6;\n\n this._zUp = Boolean(viewer.camera.zUp);\n\n var self = this;\n\n this.setIsProjectNorth(cfg.isProjectNorth);\n this.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);\n\n const rotateTrueNorth = (function () {\n const trueNorthMatrix = math.mat4();\n return function (dir, vec, dest) {\n math.identityMat4(trueNorthMatrix);\n math.rotationMat4v(dir * self._projectNorthOffsetAngle * math.DEGTORAD, [0, 1, 0], trueNorthMatrix);\n return math.transformVec3(trueNorthMatrix, vec, dest)\n }\n }())\n\n this._synchCamera = (function () {\n var matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);\n var eyeLookVec = math.vec3();\n var eyeLookVecCube = math.vec3();\n var upCube = math.vec3();\n return function () {\n var eye = viewer.camera.eye;\n var look = viewer.camera.look;\n var up = viewer.camera.up;\n eyeLookVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, eyeLookVec)), 5);\n\n if (self._isProjectNorth && self._projectNorthOffsetAngle) {\n eyeLookVec = rotateTrueNorth(-1, eyeLookVec, tempVec3a);\n up = rotateTrueNorth(-1, up, tempVec3b);\n }\n\n if (self._zUp) { // +Z up\n math.transformVec3(matrix, eyeLookVec, eyeLookVecCube);\n math.transformVec3(matrix, up, upCube);\n self._navCubeCamera.look = [0, 0, 0];\n self._navCubeCamera.eye = math.transformVec3(matrix, eyeLookVec, eyeLookVecCube);\n self._navCubeCamera.up = math.transformPoint3(matrix, up, upCube);\n } else { // +Y up\n self._navCubeCamera.look = [0, 0, 0];\n self._navCubeCamera.eye = eyeLookVec;\n self._navCubeCamera.up = up;\n }\n };\n }());\n\n this._cubeTextureCanvas = new CubeTextureCanvas(viewer, navCubeScene, cfg);\n\n this._cubeSampler = new Texture(navCubeScene, {\n image: this._cubeTextureCanvas.getImage(),\n flipY: true,\n wrapS: ClampToEdgeWrapping,\n wrapT: ClampToEdgeWrapping\n });\n\n this._cubeMesh = new Mesh(navCubeScene, {\n geometry: new ReadableGeometry(navCubeScene, {\n primitive: \"triangles\",\n normals: [\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,\n 0, 1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1,\n 0, 0, -1, 0, 0, -1, 0, 0, -1\n ],\n positions: [\n 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1,\n 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1,\n 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1\n ],\n uv: [\n 0.5, 0.6666, 0.25, 0.6666, 0.25, 0.3333, 0.5, 0.3333, 0.5, 0.6666, 0.5, 0.3333, 0.75, 0.3333, 0.75, 0.6666,\n 0.5, 0.6666, 0.5, 1, 0.25, 1, 0.25, 0.6666, 0.25, 0.6666, 0.0, 0.6666, 0.0, 0.3333, 0.25, 0.3333,\n 0.25, 0, 0.50, 0, 0.50, 0.3333, 0.25, 0.3333, 0.75, 0.3333, 1.0, 0.3333, 1.0, 0.6666, 0.75, 0.6666\n ],\n indices: [\n 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16,\n 18, 19, 20, 21, 22, 20, 22, 23\n ]\n }),\n material: new PhongMaterial(navCubeScene, {\n diffuse: [0.4, 0.4, 0.4],\n specular: [0.4, 0.4, 0.4],\n emissive: [.6, .6, .6],\n diffuseMap: this._cubeSampler,\n emissiveMap: this._cubeSampler\n }),\n visible: !!visible,\n edges: true\n });\n\n this._shadow = cfg.shadowVisible === false ? null : new Mesh(navCubeScene, {\n geometry: new ReadableGeometry(navCubeScene, buildCylinderGeometry({\n center: [0, 0, 0],\n radiusTop: 0.001,\n radiusBottom: 1.4,\n height: 0.01,\n radialSegments: 20,\n heightSegments: 1,\n openEnded: true\n })),\n material: new PhongMaterial(navCubeScene, {\n diffuse: [0.0, 0.0, 0.0], specular: [0, 0, 0], emissive: [0.0, 0.0, 0.0], alpha: 0.5\n }),\n position: [0, -1.5, 0],\n visible: !!visible,\n pickable: false,\n backfaces: false\n });\n\n this._onCameraMatrix = viewer.camera.on(\"matrix\", this._synchCamera);\n this._onCameraWorldAxis = viewer.camera.on(\"worldAxis\", () => {\n if (viewer.camera.zUp) {\n this._zUp = true;\n this._cubeTextureCanvas.setZUp();\n this._repaint();\n this._synchCamera();\n } else if (viewer.camera.yUp) {\n this._zUp = false;\n this._cubeTextureCanvas.setYUp();\n this._repaint();\n this._synchCamera();\n }\n });\n this._onCameraFOV = viewer.camera.perspective.on(\"fov\", (fov) => {\n if (this._synchProjection) {\n this._navCubeCamera.perspective.fov = fov;\n }\n });\n this._onCameraProjection = viewer.camera.on(\"projection\", (projection) => {\n if (this._synchProjection) {\n this._navCubeCamera.projection = (projection === \"ortho\" || projection === \"perspective\") ? projection : \"perspective\";\n }\n });\n\n var lastAreaId = -1;\n\n function actionMove(posX, posY) {\n var yawInc = (posX - lastX) * -sensitivity;\n var pitchInc = (posY - lastY) * -sensitivity;\n yaw -= yawInc;\n pitch -= pitchInc;\n if (minPitch !== undefined && pitch < minPitch) {\n pitch = minPitch;\n }\n if (maxPitch !== undefined && pitch > maxPitch) {\n pitch = maxPitch;\n }\n viewer.camera.orbitYaw(yawInc);\n viewer.camera.orbitPitch(-pitchInc);\n lastX = posX;\n lastY = posY;\n }\n\n function getCoordsWithinElement(event) {\n var coords = [0, 0];\n if (!event) {\n event = window.event;\n coords[0] = event.x;\n coords[1] = event.y;\n } else {\n var element = event.target;\n var totalOffsetLeft = 0;\n var totalOffsetTop = 0;\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n coords[0] = event.pageX - totalOffsetLeft;\n coords[1] = event.pageY - totalOffsetTop;\n }\n return coords;\n }\n\n {\n var downX = null;\n var downY = null;\n var down = false;\n var over = false;\n\n var yaw = 0;\n var pitch = 0;\n var minPitch = null;\n var maxPitch = null;\n var sensitivity = 0.5;\n\n var lastX;\n var lastY;\n\n\n self._navCubeCanvas.addEventListener(\"mouseenter\", self._onMouseEnter = function (e) {\n over = true;\n });\n\n\n self._navCubeCanvas.addEventListener(\"mouseleave\", self._onMouseLeave = function (e) {\n over = false;\n });\n\n self._navCubeCanvas.addEventListener(\"mousedown\", self._onMouseDown = function (e) {\n if (e.which !== 1) {\n return;\n }\n downX = e.x;\n downY = e.y;\n lastX = e.clientX;\n lastY = e.clientY;\n var canvasPos = getCoordsWithinElement(e);\n var hit = navCubeScene.pick({\n canvasPos: canvasPos\n });\n if (hit) {\n down = true;\n\n } else {\n down = false;\n }\n });\n\n document.addEventListener(\"mouseup\", self._onMouseUp = function (e) {\n if (e.which !== 1) {// Left button\n return;\n }\n down = false;\n if (downX === null) {\n return;\n }\n var canvasPos = getCoordsWithinElement(e);\n var hit = navCubeScene.pick({\n canvasPos: canvasPos,\n pickSurface: true\n });\n if (hit) {\n if (hit.uv) {\n var areaId = self._cubeTextureCanvas.getArea(hit.uv);\n if (areaId >= 0) {\n document.body.style.cursor = \"pointer\";\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n self._repaint();\n lastAreaId = -1;\n }\n if (areaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(areaId, true);\n lastAreaId = areaId;\n self._repaint();\n if (e.x < (downX - 3) || e.x > (downX + 3) || e.y < (downY - 3) || e.y > (downY + 3)) {\n return;\n }\n var dir = self._cubeTextureCanvas.getAreaDir(areaId);\n if (dir) {\n var up = self._cubeTextureCanvas.getAreaUp(areaId);\n if (self._isProjectNorth && self._projectNorthOffsetAngle) {\n dir = rotateTrueNorth(+1, dir, tempVec3a);\n up = rotateTrueNorth(+1, up, tempVec3b);\n }\n flyTo(dir, up, function () {\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n self._repaint();\n lastAreaId = -1;\n }\n document.body.style.cursor = \"pointer\";\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n self._repaint();\n lastAreaId = -1;\n }\n if (areaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(areaId, false);\n lastAreaId = -1;\n self._repaint();\n }\n });\n }\n }\n }\n }\n }\n });\n\n document.addEventListener(\"mousemove\", self._onMouseMove = function (e) {\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n self._repaint();\n lastAreaId = -1;\n }\n if (e.buttons === 1 && !down) {\n return;\n }\n if (down) {\n var posX = e.clientX;\n var posY = e.clientY;\n document.body.style.cursor = \"move\";\n actionMove(posX, posY);\n return;\n }\n if (!over) {\n return;\n }\n var canvasPos = getCoordsWithinElement(e);\n var hit = navCubeScene.pick({\n canvasPos: canvasPos,\n pickSurface: true\n });\n if (hit) {\n if (hit.uv) {\n document.body.style.cursor = \"pointer\";\n var areaId = self._cubeTextureCanvas.getArea(hit.uv);\n if (areaId === lastAreaId) {\n return;\n }\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n }\n if (areaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(areaId, true);\n self._repaint();\n lastAreaId = areaId;\n }\n }\n } else {\n document.body.style.cursor = \"default\";\n if (lastAreaId >= 0) {\n self._cubeTextureCanvas.setAreaHighlighted(lastAreaId, false);\n self._repaint();\n lastAreaId = -1;\n }\n }\n });\n\n var flyTo = (function () {\n var center = math.vec3();\n return function (dir, up, ok) {\n var aabb = self._fitVisible ? viewer.scene.getAABB(viewer.scene.visibleObjectIds) : viewer.scene.aabb;\n var diag = math.getAABB3Diag(aabb);\n math.getAABB3Center(aabb, center);\n var dist = Math.abs(diag / Math.tan(self._cameraFitFOV * math.DEGTORAD));\n viewer.cameraControl.pivotPos = center;\n if (self._cameraFly) {\n viewer.cameraFlight.flyTo({\n look: center,\n eye: [center[0] - (dist * dir[0]), center[1] - (dist * dir[1]), center[2] - (dist * dir[2])],\n up: up || [0, 1, 0],\n orthoScale: diag * 1.1,\n fitFOV: self._cameraFitFOV,\n duration: self._cameraFlyDuration\n }, ok);\n } else {\n viewer.cameraFlight.jumpTo({\n look: center,\n eye: [center[0] - (dist * dir[0]), center[1] - (dist * dir[1]), center[2] - (dist * dir[2])],\n up: up || [0, 1, 0],\n orthoScale: diag * 1.1,\n fitFOV: self._cameraFitFOV\n }, ok);\n }\n };\n })();\n }\n\n this._onUpdated = viewer.localeService.on(\"updated\", () => {\n this._cubeTextureCanvas.clear();\n this._repaint();\n });\n\n this.setVisible(cfg.visible);\n this.setCameraFitFOV(cfg.cameraFitFOV);\n this.setCameraFly(cfg.cameraFly);\n this.setCameraFlyDuration(cfg.cameraFlyDuration);\n this.setFitVisible(cfg.fitVisible);\n this.setSynchProjection(cfg.synchProjection);\n }\n\n send(name, value) {\n switch (name) {\n case \"language\":\n this._cubeTextureCanvas.clear();\n this._repaint(); // CubeTextureCanvas gets language from Viewer\n break;\n }\n }\n\n _repaint() {\n const image = this._cubeTextureCanvas.getImage();\n this._cubeMesh.material.diffuseMap.image = image;\n this._cubeMesh.material.emissiveMap.image = image;\n }\n\n /**\n * Sets if the NavCube is visible.\n *\n * @param {Boolean} visible Whether or not the NavCube is visible.\n */\n setVisible(visible = true) {\n if (!this._navCubeCanvas) {\n return;\n }\n this._cubeMesh.visible = visible;\n if (this._shadow) {\n this._shadow.visible = visible;\n }\n this._navCubeCanvas.style.visibility = visible ? \"visible\" : \"hidden\";\n }\n\n /**\n * Gets if the NavCube is visible.\n *\n * @return {Boolean} True when the NavCube is visible.\n */\n getVisible() {\n if (!this._navCubeCanvas) {\n return false;\n }\n return this._cubeMesh.visible;\n }\n\n\n /**\n * Sets whether the axis, corner and edge-aligned views will fit the\n * view to the entire {@link Scene} or just to visible object-{@link Entity}s.\n *\n * Entitys are visible objects when {@link Entity#isObject} and {@link Entity#visible} are both ````true````.\n *\n * @param {Boolean} fitVisible Set ````true```` to fit only visible object-Entitys.\n */\n setFitVisible(fitVisible = false) {\n this._fitVisible = fitVisible;\n }\n\n /**\n * Gets whether the axis, corner and edge-aligned views will fit the\n * view to the entire {@link Scene} or just to visible object-{@link Entity}s.\n *\n * Entitys are visible objects when {@link Entity#isObject} and {@link Entity#visible} are both ````true````.\n *\n * @return {Boolean} True when fitting only visible object-Entitys.\n */\n getFitVisible() {\n return this._fitVisible;\n }\n\n /**\n * Sets whether the {@link Camera} flies or jumps to each selected axis or diagonal.\n *\n * Default is ````true````, to fly.\n *\n * @param {Boolean} cameraFly Set ````true```` to fly, else ````false```` to jump.\n */\n setCameraFly(cameraFly = true) {\n this._cameraFly = cameraFly;\n }\n\n /**\n * Gets whether the {@link Camera} flies or jumps to each selected axis or diagonal.\n *\n * Default is ````true````, to fly.\n *\n * @returns {Boolean} Returns ````true```` to fly, else ````false```` to jump.\n */\n getCameraFly() {\n return this._cameraFly;\n }\n\n /**\n * Sets how much of the field-of-view, in degrees, that the {@link Scene} should\n * fill the canvas when flying or jumping the {@link Camera} to each selected axis or diagonal.\n *\n * Default value is ````45````.\n *\n * @param {Number} cameraFitFOV New FOV value.\n */\n setCameraFitFOV(cameraFitFOV = 45) {\n this._cameraFitFOV = cameraFitFOV;\n }\n\n /**\n * Gets how much of the field-of-view, in degrees, that the {@link Scene} should\n * fill the canvas when flying or jumping the {@link Camera} to each selected axis or diagonal.\n *\n * Default value is ````45````.\n *\n * @returns {Number} Current FOV value.\n */\n getCameraFitFOV() {\n return this._cameraFitFOV;\n }\n\n /**\n * When flying the {@link Camera} to each new axis or diagonal, sets how long, in seconds, that the Camera takes to get there.\n *\n * Default is ````0.5````.\n *\n * @param {Boolean} cameraFlyDuration Camera flight duration in seconds.\n */\n setCameraFlyDuration(cameraFlyDuration = 0.5) {\n this._cameraFlyDuration = cameraFlyDuration;\n }\n\n /**\n * When flying the {@link Camera} to each new axis or diagonal, gets how long, in seconds, that the Camera takes to get there.\n *\n * Default is ````0.5````.\n *\n * @returns {Boolean} Camera flight duration in seconds.\n */\n getCameraFlyDuration() {\n return this._cameraFlyDuration;\n }\n\n /**\n * Sets whether the NavCube switches between perspective and orthographic projections in synchrony with\n * the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection.\n *\n * @param {Boolean} synchProjection Set ````true```` to keep NavCube projection synchronized with {@link Camera#projection}.\n */\n setSynchProjection(synchProjection = false) {\n this._synchProjection = synchProjection;\n }\n\n /**\n * Gets whether the NavCube switches between perspective and orthographic projections in synchrony with\n * the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection.\n *\n * @return {Boolean} True when NavCube projection is synchronized with {@link Camera#projection}.\n */\n getSynchProjection() {\n return this._synchProjection;\n }\n\n /**\n * Sets whether the NavCube switches between project north and true north\n *\n * @param {Boolean} isProjectNorth Set ````true```` to use project north offset\n */\n setIsProjectNorth(isProjectNorth = false) {\n this._isProjectNorth = isProjectNorth;\n }\n\n /**\n * Gets whether the NavCube switches between project north and true north\n *\n * @return {Boolean} isProjectNorth when ````true```` - use project north offset\n */\n getIsProjectNorth() {\n return this._isProjectNorth;\n }\n\n /**\n * Sets the NavCube project north offset angle (used when {@link isProjectNorth} is ````true````\n *\n * @param {number} projectNorthOffsetAngle Set the vector offset for project north\n */\n setProjectNorthOffsetAngle(projectNorthOffsetAngle) {\n this._projectNorthOffsetAngle = projectNorthOffsetAngle;\n }\n\n /**\n * Gets the offset angle between project north and true north\n *\n * @return {number} projectNorthOffsetAngle\n */\n getProjectNorthOffsetAngle() {\n return this._projectNorthOffsetAngle;\n }\n\n /**\n * Destroys this NavCubePlugin.\n *\n * Does not destroy the canvas the NavCubePlugin was configured with.\n */\n destroy() {\n\n if (this._navCubeCanvas) {\n\n this.viewer.localeService.off(this._onUpdated);\n this.viewer.camera.off(this._onCameraMatrix);\n this.viewer.camera.off(this._onCameraWorldAxis);\n this.viewer.camera.perspective.off(this._onCameraFOV);\n this.viewer.camera.off(this._onCameraProjection);\n\n this._navCubeCanvas.removeEventListener(\"mouseenter\", this._onMouseEnter);\n this._navCubeCanvas.removeEventListener(\"mouseleave\", this._onMouseLeave);\n this._navCubeCanvas.removeEventListener(\"mousedown\", this._onMouseDown);\n\n document.removeEventListener(\"mousemove\", this._onMouseMove);\n document.removeEventListener(\"mouseup\", this._onMouseUp);\n\n this._navCubeCanvas = null;\n this._cubeTextureCanvas.destroy();\n this._cubeTextureCanvas = null;\n\n this._onMouseEnter = null;\n this._onMouseLeave = null;\n this._onMouseDown = null;\n this._onMouseMove = null;\n this._onMouseUp = null;\n }\n\n this._navCubeScene.destroy();\n this._navCubeScene = null;\n this._cubeMesh = null;\n this._shadow = null;\n\n super.destroy();\n }\n}\n\nexport {NavCubePlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/NavCubePlugin/NavCubePlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/NavCubePlugin/NavCubePlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1223, + "__docId__": 1231, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js", @@ -21163,7 +21379,7 @@ "ignore": true }, { - "__docId__": 1224, + "__docId__": 1232, "kind": "variable", "name": "tempVec3b", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js", @@ -21184,7 +21400,7 @@ "ignore": true }, { - "__docId__": 1225, + "__docId__": 1233, "kind": "variable", "name": "tempMat4a", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js", @@ -21205,7 +21421,7 @@ "ignore": true }, { - "__docId__": 1226, + "__docId__": 1234, "kind": "class", "name": "NavCubePlugin", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js", @@ -21223,7 +21439,7 @@ ] }, { - "__docId__": 1227, + "__docId__": 1235, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21508,7 +21724,7 @@ ] }, { - "__docId__": 1228, + "__docId__": 1236, "kind": "member", "name": "_navCubeScene", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21526,7 +21742,7 @@ } }, { - "__docId__": 1229, + "__docId__": 1237, "kind": "member", "name": "_navCubeCanvas", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21544,7 +21760,7 @@ } }, { - "__docId__": 1230, + "__docId__": 1238, "kind": "member", "name": "_navCubeCamera", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21562,7 +21778,7 @@ } }, { - "__docId__": 1231, + "__docId__": 1239, "kind": "member", "name": "_zUp", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21580,7 +21796,7 @@ } }, { - "__docId__": 1232, + "__docId__": 1240, "kind": "member", "name": "_synchCamera", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21598,7 +21814,7 @@ } }, { - "__docId__": 1233, + "__docId__": 1241, "kind": "member", "name": "_cubeTextureCanvas", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21616,7 +21832,7 @@ } }, { - "__docId__": 1234, + "__docId__": 1242, "kind": "member", "name": "_cubeSampler", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21634,7 +21850,7 @@ } }, { - "__docId__": 1235, + "__docId__": 1243, "kind": "member", "name": "_cubeMesh", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21652,7 +21868,7 @@ } }, { - "__docId__": 1236, + "__docId__": 1244, "kind": "member", "name": "_shadow", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21670,7 +21886,7 @@ } }, { - "__docId__": 1237, + "__docId__": 1245, "kind": "member", "name": "_onCameraMatrix", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21688,7 +21904,7 @@ } }, { - "__docId__": 1238, + "__docId__": 1246, "kind": "member", "name": "_onCameraWorldAxis", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21706,7 +21922,7 @@ } }, { - "__docId__": 1241, + "__docId__": 1249, "kind": "member", "name": "_onCameraFOV", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21724,7 +21940,7 @@ } }, { - "__docId__": 1242, + "__docId__": 1250, "kind": "member", "name": "_onCameraProjection", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21742,7 +21958,7 @@ } }, { - "__docId__": 1243, + "__docId__": 1251, "kind": "member", "name": "_onUpdated", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21760,7 +21976,7 @@ } }, { - "__docId__": 1244, + "__docId__": 1252, "kind": "method", "name": "send", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21789,7 +22005,7 @@ "return": null }, { - "__docId__": 1245, + "__docId__": 1253, "kind": "method", "name": "_repaint", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21806,7 +22022,7 @@ "return": null }, { - "__docId__": 1246, + "__docId__": 1254, "kind": "method", "name": "setVisible", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21832,7 +22048,7 @@ "return": null }, { - "__docId__": 1247, + "__docId__": 1255, "kind": "method", "name": "getVisible", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21854,7 +22070,7 @@ "params": [] }, { - "__docId__": 1248, + "__docId__": 1256, "kind": "method", "name": "setFitVisible", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21880,7 +22096,7 @@ "return": null }, { - "__docId__": 1249, + "__docId__": 1257, "kind": "member", "name": "_fitVisible", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21898,7 +22114,7 @@ } }, { - "__docId__": 1250, + "__docId__": 1258, "kind": "method", "name": "getFitVisible", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21920,7 +22136,7 @@ "params": [] }, { - "__docId__": 1251, + "__docId__": 1259, "kind": "method", "name": "setCameraFly", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21946,7 +22162,7 @@ "return": null }, { - "__docId__": 1252, + "__docId__": 1260, "kind": "member", "name": "_cameraFly", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21964,7 +22180,7 @@ } }, { - "__docId__": 1253, + "__docId__": 1261, "kind": "method", "name": "getCameraFly", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -21992,7 +22208,7 @@ "params": [] }, { - "__docId__": 1254, + "__docId__": 1262, "kind": "method", "name": "setCameraFitFOV", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22018,7 +22234,7 @@ "return": null }, { - "__docId__": 1255, + "__docId__": 1263, "kind": "member", "name": "_cameraFitFOV", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22036,7 +22252,7 @@ } }, { - "__docId__": 1256, + "__docId__": 1264, "kind": "method", "name": "getCameraFitFOV", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22064,7 +22280,7 @@ "params": [] }, { - "__docId__": 1257, + "__docId__": 1265, "kind": "method", "name": "setCameraFlyDuration", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22090,7 +22306,7 @@ "return": null }, { - "__docId__": 1258, + "__docId__": 1266, "kind": "member", "name": "_cameraFlyDuration", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22108,7 +22324,7 @@ } }, { - "__docId__": 1259, + "__docId__": 1267, "kind": "method", "name": "getCameraFlyDuration", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22136,7 +22352,7 @@ "params": [] }, { - "__docId__": 1260, + "__docId__": 1268, "kind": "method", "name": "setSynchProjection", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22162,7 +22378,7 @@ "return": null }, { - "__docId__": 1261, + "__docId__": 1269, "kind": "member", "name": "_synchProjection", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22180,7 +22396,7 @@ } }, { - "__docId__": 1262, + "__docId__": 1270, "kind": "method", "name": "getSynchProjection", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22202,7 +22418,7 @@ "params": [] }, { - "__docId__": 1263, + "__docId__": 1271, "kind": "method", "name": "setIsProjectNorth", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22228,7 +22444,7 @@ "return": null }, { - "__docId__": 1264, + "__docId__": 1272, "kind": "member", "name": "_isProjectNorth", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22246,7 +22462,7 @@ } }, { - "__docId__": 1265, + "__docId__": 1273, "kind": "method", "name": "getIsProjectNorth", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22268,7 +22484,7 @@ "params": [] }, { - "__docId__": 1266, + "__docId__": 1274, "kind": "method", "name": "setProjectNorthOffsetAngle", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22294,7 +22510,7 @@ "return": null }, { - "__docId__": 1267, + "__docId__": 1275, "kind": "member", "name": "_projectNorthOffsetAngle", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22312,7 +22528,7 @@ } }, { - "__docId__": 1268, + "__docId__": 1276, "kind": "method", "name": "getProjectNorthOffsetAngle", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22334,7 +22550,7 @@ "params": [] }, { - "__docId__": 1269, + "__docId__": 1277, "kind": "method", "name": "destroy", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22349,7 +22565,7 @@ "return": null }, { - "__docId__": 1272, + "__docId__": 1280, "kind": "member", "name": "_onMouseEnter", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22367,7 +22583,7 @@ } }, { - "__docId__": 1273, + "__docId__": 1281, "kind": "member", "name": "_onMouseLeave", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22385,7 +22601,7 @@ } }, { - "__docId__": 1274, + "__docId__": 1282, "kind": "member", "name": "_onMouseDown", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22403,7 +22619,7 @@ } }, { - "__docId__": 1275, + "__docId__": 1283, "kind": "member", "name": "_onMouseMove", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22421,7 +22637,7 @@ } }, { - "__docId__": 1276, + "__docId__": 1284, "kind": "member", "name": "_onMouseUp", "memberof": "src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin", @@ -22439,29 +22655,29 @@ } }, { - "__docId__": 1280, + "__docId__": 1288, "kind": "file", "name": "src/plugins/NavCubePlugin/index.js", "content": "export * from \"./NavCubePlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/NavCubePlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/NavCubePlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1281, + "__docId__": 1289, "kind": "file", "name": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\nimport {OBJSceneGraphLoader} from \"./OBJSceneGraphLoader.js\";\n\n/**\n * {@link Viewer} plugin that loads models from [OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file) files.\n *\n * * Creates an {@link Entity} representing each model it loads, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.\n * * Creates an {@link Entity} for each object within the model, which will have {@link Entity#isObject} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.\n * * When loading, can set the World-space position, scale and rotation of each model within World space, along with initial properties for all the model's {@link Entity}s.\n *\n * ## Metadata\n *\n * OBJLoaderPlugin can also load an accompanying JSON metadata file with each model, which creates a {@link MetaModel} corresponding\n * to the model {@link Entity} and a {@link MetaObject} corresponding to each object {@link Entity}.\n *\n * Each {@link MetaObject} has a {@link MetaObject#type}, which indicates the classification of its corresponding {@link Entity}. When loading\n * metadata, we can also provide GLTFModelLoaderPlugin with a custom lookup table of initial values to set on the properties of each type of {@link Entity}. By default, OBJLoaderPlugin\n * uses its own map of standard default colors, visibilities and opacities for IFC element types.\n\n *\n * ## Usage\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/cad/#OBJ_SportsCar_ExplodeModel)]\n *\n * ````javascript\n * import {Viewer, OBJLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a xeokit Viewer and arrange the camera\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.orbitPitch(20);\n *\n * // Add an OBJLoaderPlugin to the Viewer\n * const objLoader = new OBJLoaderPlugin(viewer);\n *\n * // Load an OBJ model\n * var model = objLoader.load({ // Model is an Entity\n * id: \"myModel\",\n * src: \"./models/obj/sportsCar/sportsCar.obj\",\n * edges: true\n * });\n *\n * // When the model has loaded, fit it to view\n * model.on(\"loaded\", () => {\n * viewer.cameraFlight.flyTo(model);\n * })\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Update properties of the model Entity\n * model.highlight = [1,0,0];\n *\n * // Destroy the model\n * model.destroy();\n * ````\n * @class OBJLoaderPlugin\n */\nclass OBJLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"OBJLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n */\n constructor(viewer, cfg) {\n\n super(\"OBJLoader\", viewer, cfg);\n\n /**\n * @private\n */\n this._sceneGraphLoader = new OBJSceneGraphLoader();\n }\n\n /**\n * Loads an OBJ model from a file into this OBJLoader's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @param {String} params.id ID to assign to the model's root {@link Entity}, unique among all components in the Viewer's {@link Scene}.\n * @param {String} params.src Path to an OBJ file.\n * @param {String} [params.metaModelSrc] Path to an optional metadata file.\n * @param {Number[]} [params.position=[0,0,0]] The model World-space 3D position.\n * @param {Number[]} [params.scale=[1,1,1]] The model's World-space scale.\n * @param {Number[]} [params.rotation=[0,0,0]] The model's World-space rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @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.\n * @param {Number} [params.edgeThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @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}\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n var modelNode = new Node(this.viewer.scene, utils.apply(params, {\n isModel: true\n }));\n\n const modelId = modelNode.id; // In case ID was auto-generated\n const src = params.src;\n\n if (!src) {\n this.error(\"load() param expected: src\");\n return modelNode;\n }\n\n if (params.metaModelSrc) {\n const metaModelSrc = params.metaModelSrc;\n utils.loadJSON(metaModelSrc,\n (modelMetadata) => {\n this.viewer.metaScene.createMetaModel(modelId, modelMetadata);\n this._sceneGraphLoader.load(modelNode, src, params);\n },\n (errMsg) => {\n this.error(`load(): Failed to load model modelMetadata for model '${modelId} from '${metaModelSrc}' - ${errMsg}`);\n });\n } else {\n this._sceneGraphLoader.load(modelNode, src, params);\n }\n\n modelNode.once(\"destroyed\", () => {\n this.viewer.metaScene.destroyMetaModel(modelId);\n });\n\n return modelNode;\n }\n\n /**\n * Destroys this OBJLoaderPlugin.\n */\n destroy() {\n super.destroy();\n }\n}\n\nexport {OBJLoaderPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1282, + "__docId__": 1290, "kind": "class", "name": "OBJLoaderPlugin", "memberof": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js", @@ -22485,7 +22701,7 @@ ] }, { - "__docId__": 1283, + "__docId__": 1291, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js~OBJLoaderPlugin", @@ -22538,7 +22754,7 @@ ] }, { - "__docId__": 1284, + "__docId__": 1292, "kind": "member", "name": "_sceneGraphLoader", "memberof": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js~OBJLoaderPlugin", @@ -22555,7 +22771,7 @@ } }, { - "__docId__": 1285, + "__docId__": 1293, "kind": "method", "name": "load", "memberof": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js~OBJLoaderPlugin", @@ -22713,7 +22929,7 @@ } }, { - "__docId__": 1286, + "__docId__": 1294, "kind": "method", "name": "destroy", "memberof": "src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js~OBJLoaderPlugin", @@ -22728,18 +22944,18 @@ "return": null }, { - "__docId__": 1287, + "__docId__": 1295, "kind": "file", "name": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", "content": "import {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {Texture} from \"../../viewer/scene/materials/Texture.js\";\nimport {core} from \"../../viewer/scene/core.js\";\nimport {worldToRTCPositions} from \"../../viewer/scene/math/rtcCoords.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nclass OBJSceneGraphLoader {\n\n /**\n * Loads OBJ and MTL from file(s) into a {@link Node}.\n *\n * @static\n * @param {Node} modelNode Node to load into.\n * @param {String} src Path to OBJ file.\n * @param {Object} params Loading options.\n */\n load(modelNode, src, params = {}) {\n\n var spinner = modelNode.scene.canvas.spinner;\n spinner.processes++;\n\n loadOBJ(modelNode, src, function (state) {\n loadMTLs(modelNode, state, function () {\n\n createMeshes(modelNode, state);\n\n spinner.processes--;\n\n core.scheduleTask(function () {\n modelNode.fire(\"loaded\", true, false);\n });\n });\n });\n }\n\n /**\n * Parses OBJ and MTL text strings into a {@link Node}.\n *\n * @static\n * @param {Node} modelNode Node to load into.\n * @param {String} objText OBJ text string.\n * @param {String} [mtlText] MTL text string.\n * @param {String} [basePath] Base path for external resources.\n */\n parse(modelNode, objText, mtlText, basePath) {\n if (!objText) {\n this.warn(\"load() param expected: objText\");\n return;\n }\n var state = parseOBJ(modelNode, objText, null);\n if (mtlText) {\n parseMTL(modelNode, mtlText, basePath);\n }\n createMeshes(modelNode, state);\n modelNode.src = null;\n modelNode.fire(\"loaded\", true, false);\n }\n}\n\n//--------------------------------------------------------------------------------------------\n// Loads OBJ\n//\n// Parses OBJ into an intermediate state object. The object will contain geometry data\n// and material IDs from which meshes can be created later. The object will also\n// contain a list of filenames of the MTL files referenced by the OBJ, is any.\n//\n// Originally based on the THREE.js OBJ and MTL loaders:\n//\n// https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/OBJLoader.js\n// https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/MTLLoader.js\n//--------------------------------------------------------------------------------------------\n\nvar loadOBJ = function (modelNode, url, ok) {\n loadFile(url, function (text) {\n var state = parseOBJ(modelNode, text, url);\n ok(state);\n },\n function (error) {\n modelNode.error(error);\n });\n};\n\nvar parseOBJ = (function () {\n\n const regexp = {\n // v float float float\n vertex_pattern: /^v\\s+([\\d|\\.|\\+|\\-|e|E]+)\\s+([\\d|\\.|\\+|\\-|e|E]+)\\s+([\\d|\\.|\\+|\\-|e|E]+)/,\n // vn float float float\n normal_pattern: /^vn\\s+([\\d|\\.|\\+|\\-|e|E]+)\\s+([\\d|\\.|\\+|\\-|e|E]+)\\s+([\\d|\\.|\\+|\\-|e|E]+)/,\n // vt float float\n uv_pattern: /^vt\\s+([\\d|\\.|\\+|\\-|e|E]+)\\s+([\\d|\\.|\\+|\\-|e|E]+)/,\n // f vertex vertex vertex\n face_vertex: /^f\\s+(-?\\d+)\\s+(-?\\d+)\\s+(-?\\d+)(?:\\s+(-?\\d+))?/,\n // f vertex/uv vertex/uv vertex/uv\n face_vertex_uv: /^f\\s+(-?\\d+)\\/(-?\\d+)\\s+(-?\\d+)\\/(-?\\d+)\\s+(-?\\d+)\\/(-?\\d+)(?:\\s+(-?\\d+)\\/(-?\\d+))?/,\n // f vertex/uv/normal vertex/uv/normal vertex/uv/normal\n face_vertex_uv_normal: /^f\\s+(-?\\d+)\\/(-?\\d+)\\/(-?\\d+)\\s+(-?\\d+)\\/(-?\\d+)\\/(-?\\d+)\\s+(-?\\d+)\\/(-?\\d+)\\/(-?\\d+)(?:\\s+(-?\\d+)\\/(-?\\d+)\\/(-?\\d+))?/,\n // f vertex//normal vertex//normal vertex//normal\n face_vertex_normal: /^f\\s+(-?\\d+)\\/\\/(-?\\d+)\\s+(-?\\d+)\\/\\/(-?\\d+)\\s+(-?\\d+)\\/\\/(-?\\d+)(?:\\s+(-?\\d+)\\/\\/(-?\\d+))?/,\n // o object_name | g group_name\n object_pattern: /^[og]\\s*(.+)?/,\n // s boolean\n smoothing_pattern: /^s\\s+(\\d+|on|off)/,\n // mtllib file_reference\n material_library_pattern: /^mtllib /,\n // usemtl material_name\n material_use_pattern: /^usemtl /\n };\n\n return function (modelNode, text, url) {\n\n url = url || \"\";\n\n var state = {\n src: url,\n basePath: getBasePath(url),\n objects: [],\n object: {},\n positions: [],\n normals: [],\n uv: [],\n materialLibraries: {}\n };\n\n startObject(state, \"\", false);\n\n // Parts of this parser logic are derived from the THREE.js OBJ loader:\n // https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/OBJLoader.js\n\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace('\\r\\n', '\\n');\n }\n\n var lines = text.split('\\n');\n var line = '', lineFirstChar = '', lineSecondChar = '';\n var lineLength = 0;\n var result = [];\n\n // Faster to just trim left side of the line. Use if available.\n var trimLeft = (typeof ''.trimLeft === 'function');\n\n for (var i = 0, l = lines.length; i < l; i++) {\n\n line = lines[i];\n\n line = trimLeft ? line.trimLeft() : line.trim();\n\n lineLength = line.length;\n\n if (lineLength === 0) {\n continue;\n }\n\n lineFirstChar = line.charAt(0);\n\n if (lineFirstChar === '#') {\n continue;\n }\n\n if (lineFirstChar === 'v') {\n\n lineSecondChar = line.charAt(1);\n\n if (lineSecondChar === ' ' && (result = regexp.vertex_pattern.exec(line)) !== null) {\n\n // 0 1 2 3\n // ['v 1.0 2.0 3.0', '1.0', '2.0', '3.0']\n\n state.positions.push(\n parseFloat(result[1]),\n parseFloat(result[2]),\n parseFloat(result[3])\n );\n\n } else if (lineSecondChar === 'n' && (result = regexp.normal_pattern.exec(line)) !== null) {\n\n // 0 1 2 3\n // ['vn 1.0 2.0 3.0', '1.0', '2.0', '3.0']\n\n state.normals.push(\n parseFloat(result[1]),\n parseFloat(result[2]),\n parseFloat(result[3])\n );\n\n } else if (lineSecondChar === 't' && (result = regexp.uv_pattern.exec(line)) !== null) {\n\n // 0 1 2\n // ['vt 0.1 0.2', '0.1', '0.2']\n\n state.uv.push(\n parseFloat(result[1]),\n parseFloat(result[2])\n );\n\n } else {\n\n modelNode.error('Unexpected vertex/normal/uv line: \\'' + line + '\\'');\n return;\n }\n\n } else if (lineFirstChar === 'f') {\n\n if ((result = regexp.face_vertex_uv_normal.exec(line)) !== null) {\n\n // f vertex/uv/normal vertex/uv/normal vertex/uv/normal\n // 0 1 2 3 4 5 6 7 8 9 10 11 12\n // ['f 1/1/1 2/2/2 3/3/3', '1', '1', '1', '2', '2', '2', '3', '3', '3', undefined, undefined, undefined]\n\n addFace(state,\n result[1], result[4], result[7], result[10],\n result[2], result[5], result[8], result[11],\n result[3], result[6], result[9], result[12]\n );\n\n } else if ((result = regexp.face_vertex_uv.exec(line)) !== null) {\n\n // f vertex/uv vertex/uv vertex/uv\n // 0 1 2 3 4 5 6 7 8\n // ['f 1/1 2/2 3/3', '1', '1', '2', '2', '3', '3', undefined, undefined]\n\n addFace(state,\n result[1], result[3], result[5], result[7],\n result[2], result[4], result[6], result[8]\n );\n\n } else if ((result = regexp.face_vertex_normal.exec(line)) !== null) {\n\n // f vertex//normal vertex//normal vertex//normal\n // 0 1 2 3 4 5 6 7 8\n // ['f 1//1 2//2 3//3', '1', '1', '2', '2', '3', '3', undefined, undefined]\n\n addFace(state,\n result[1], result[3], result[5], result[7],\n undefined, undefined, undefined, undefined,\n result[2], result[4], result[6], result[8]\n );\n\n } else if ((result = regexp.face_vertex.exec(line)) !== null) {\n\n // f vertex vertex vertex\n // 0 1 2 3 4\n // ['f 1 2 3', '1', '2', '3', undefined]\n\n addFace(state, result[1], result[2], result[3], result[4]);\n } else {\n modelNode.error('Unexpected face line: \\'' + line + '\\'');\n return;\n }\n\n } else if (lineFirstChar === 'l') {\n\n var lineParts = line.substring(1).trim().split(' ');\n var lineVertices = [], lineUVs = [];\n\n if (line.indexOf('/') === -1) {\n\n lineVertices = lineParts;\n\n } else {\n for (var li = 0, llen = lineParts.length; li < llen; li++) {\n var parts = lineParts[li].split('/');\n if (parts[0] !== '') {\n lineVertices.push(parts[0]);\n }\n if (parts[1] !== '') {\n lineUVs.push(parts[1]);\n }\n }\n }\n addLineGeometry(state, lineVertices, lineUVs);\n\n } else if ((result = regexp.object_pattern.exec(line)) !== null) {\n\n // o object_name\n // or\n // g group_name\n\n var id = result[0].substr(1).trim();\n startObject(state, id, true);\n\n } else if (regexp.material_use_pattern.test(line)) {\n\n // material\n\n var id = line.substring(7).trim();\n state.object.material.id = id;\n\n } else if (regexp.material_library_pattern.test(line)) {\n\n // mtl file\n\n state.materialLibraries[line.substring(7).trim()] = true;\n\n } else if ((result = regexp.smoothing_pattern.exec(line)) !== null) {\n\n // smooth shading\n\n var value = result[1].trim().toLowerCase();\n state.object.material.smooth = (value === '1' || value === 'on');\n\n } else {\n\n // Handle null terminated files without exception\n if (line === '\\0') {\n continue;\n }\n\n modelNode.error('Unexpected line: \\'' + line + '\\'');\n return;\n }\n }\n\n return state;\n };\n\n function getBasePath(src) {\n var n = src.lastIndexOf('/');\n return (n === -1) ? src : src.substring(0, n + 1);\n }\n\n function startObject(state, id, fromDeclaration) {\n if (state.object && state.object.fromDeclaration === false) {\n state.object.id = id;\n state.object.fromDeclaration = (fromDeclaration !== false);\n return;\n }\n state.object = {\n id: id || '',\n geometry: {\n positions: [],\n normals: [],\n uv: []\n },\n material: {\n id: '',\n smooth: true\n },\n fromDeclaration: (fromDeclaration !== false)\n };\n state.objects.push(state.object);\n }\n\n function parseVertexIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n }\n\n function parseNormalIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n }\n\n function parseUVIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 2) * 2;\n }\n\n function addVertex(state, a, b, c) {\n var src = state.positions;\n var dst = state.object.geometry.positions;\n dst.push(src[a + 0]);\n dst.push(src[a + 1]);\n dst.push(src[a + 2]);\n dst.push(src[b + 0]);\n dst.push(src[b + 1]);\n dst.push(src[b + 2]);\n dst.push(src[c + 0]);\n dst.push(src[c + 1]);\n dst.push(src[c + 2]);\n }\n\n function addVertexLine(state, a) {\n var src = state.positions;\n var dst = state.object.geometry.positions;\n dst.push(src[a + 0]);\n dst.push(src[a + 1]);\n dst.push(src[a + 2]);\n }\n\n function addNormal(state, a, b, c) {\n var src = state.normals;\n var dst = state.object.geometry.normals;\n dst.push(src[a + 0]);\n dst.push(src[a + 1]);\n dst.push(src[a + 2]);\n dst.push(src[b + 0]);\n dst.push(src[b + 1]);\n dst.push(src[b + 2]);\n dst.push(src[c + 0]);\n dst.push(src[c + 1]);\n dst.push(src[c + 2]);\n }\n\n function addUV(state, a, b, c) {\n var src = state.uv;\n var dst = state.object.geometry.uv;\n dst.push(src[a + 0]);\n dst.push(src[a + 1]);\n dst.push(src[b + 0]);\n dst.push(src[b + 1]);\n dst.push(src[c + 0]);\n dst.push(src[c + 1]);\n }\n\n function addUVLine(state, a) {\n var src = state.uv;\n var dst = state.object.geometry.uv;\n dst.push(src[a + 0]);\n dst.push(src[a + 1]);\n }\n\n function addFace(state, a, b, c, d, ua, ub, uc, ud, na, nb, nc, nd) {\n var vLen = state.positions.length;\n var ia = parseVertexIndex(a, vLen);\n var ib = parseVertexIndex(b, vLen);\n var ic = parseVertexIndex(c, vLen);\n var id;\n if (d === undefined) {\n addVertex(state, ia, ib, ic);\n\n } else {\n id = parseVertexIndex(d, vLen);\n addVertex(state, ia, ib, id);\n addVertex(state, ib, ic, id);\n }\n\n if (ua !== undefined) {\n\n var uvLen = state.uv.length;\n\n ia = parseUVIndex(ua, uvLen);\n ib = parseUVIndex(ub, uvLen);\n ic = parseUVIndex(uc, uvLen);\n\n if (d === undefined) {\n addUV(state, ia, ib, ic);\n\n } else {\n id = parseUVIndex(ud, uvLen);\n addUV(state, ia, ib, id);\n addUV(state, ib, ic, id);\n }\n }\n\n if (na !== undefined) {\n\n // Normals are many times the same. If so, skip function call and parseInt.\n\n var nLen = state.normals.length;\n\n ia = parseNormalIndex(na, nLen);\n ib = na === nb ? ia : parseNormalIndex(nb, nLen);\n ic = na === nc ? ia : parseNormalIndex(nc, nLen);\n\n if (d === undefined) {\n addNormal(state, ia, ib, ic);\n\n } else {\n\n id = parseNormalIndex(nd, nLen);\n addNormal(state, ia, ib, id);\n addNormal(state, ib, ic, id);\n }\n }\n }\n\n function addLineGeometry(state, positions, uv) {\n\n state.object.geometry.type = 'Line';\n\n var vLen = state.positions.length;\n var uvLen = state.uv.length;\n\n for (var vi = 0, l = positions.length; vi < l; vi++) {\n addVertexLine(state, parseVertexIndex(positions[vi], vLen));\n }\n\n for (var uvi = 0, uvl = uv.length; uvi < uvl; uvi++) {\n addUVLine(state, parseUVIndex(uv[uvi], uvLen));\n }\n }\n})();\n\n//--------------------------------------------------------------------------------------------\n// Loads MTL files listed in parsed state\n//--------------------------------------------------------------------------------------------\n\nfunction loadMTLs(modelNode, state, ok) {\n var basePath = state.basePath;\n var srcList = Object.keys(state.materialLibraries);\n var numToLoad = srcList.length;\n for (var i = 0, len = numToLoad; i < len; i++) {\n loadMTL(modelNode, basePath, basePath + srcList[i], function () {\n if (--numToLoad === 0) {\n ok();\n }\n });\n }\n}\n\n//--------------------------------------------------------------------------------------------\n// Loads an MTL file\n//--------------------------------------------------------------------------------------------\n\nvar loadMTL = function (modelNode, basePath, src, ok) {\n loadFile(src, function (text) {\n parseMTL(modelNode, text, basePath);\n ok();\n },\n function (error) {\n modelNode.error(error);\n ok();\n });\n};\n\nvar parseMTL = (function () {\n\n var delimiter_pattern = /\\s+/;\n\n return function (modelNode, mtlText, basePath) {\n\n var lines = mtlText.split('\\n');\n var materialCfg = {\n id: \"Default\"\n };\n var needCreate = false;\n var line;\n var pos;\n var key;\n var value;\n var alpha;\n\n basePath = basePath || \"\";\n\n for (var i = 0; i < lines.length; i++) {\n\n line = lines[i].trim();\n\n if (line.length === 0 || line.charAt(0) === '#') { // Blank line or comment ignore\n continue;\n }\n\n pos = line.indexOf(' ');\n\n key = (pos >= 0) ? line.substring(0, pos) : line;\n key = key.toLowerCase();\n\n value = (pos >= 0) ? line.substring(pos + 1) : '';\n value = value.trim();\n\n switch (key.toLowerCase()) {\n\n case \"newmtl\": // New material\n //if (needCreate) {\n createMaterial(modelNode, materialCfg);\n //}\n materialCfg = {\n id: value\n };\n needCreate = true;\n break;\n\n case 'ka':\n materialCfg.ambient = parseRGB(value);\n break;\n\n case 'kd':\n materialCfg.diffuse = parseRGB(value);\n break;\n\n case 'ks':\n materialCfg.specular = parseRGB(value);\n break;\n\n case 'map_kd':\n if (!materialCfg.diffuseMap) {\n materialCfg.diffuseMap = createTexture(modelNode, basePath, value, \"sRGB\");\n }\n break;\n\n case 'map_ks':\n if (!materialCfg.specularMap) {\n materialCfg.specularMap = createTexture(modelNode, basePath, value, \"linear\");\n }\n break;\n\n case 'map_bump':\n case 'bump':\n if (!materialCfg.normalMap) {\n materialCfg.normalMap = createTexture(modelNode, basePath, value);\n }\n break;\n\n case 'ns':\n materialCfg.shininess = parseFloat(value);\n break;\n\n case 'd':\n alpha = parseFloat(value);\n if (alpha < 1) {\n materialCfg.alpha = alpha;\n materialCfg.alphaMode = \"blend\";\n }\n break;\n\n case 'tr':\n alpha = parseFloat(value);\n if (alpha > 0) {\n materialCfg.alpha = 1 - alpha;\n materialCfg.alphaMode = \"blend\";\n }\n break;\n\n default:\n // modelNode.error(\"Unrecognized token: \" + key);\n }\n }\n\n if (needCreate) {\n createMaterial(modelNode, materialCfg);\n }\n };\n\n function createTexture(modelNode, basePath, value, encoding) {\n var textureCfg = {};\n var items = value.split(/\\s+/);\n var pos = items.indexOf('-bm');\n if (pos >= 0) {\n //matParams.bumpScale = parseFloat(items[pos + 1]);\n items.splice(pos, 2);\n }\n pos = items.indexOf('-s');\n if (pos >= 0) {\n textureCfg.scale = [parseFloat(items[pos + 1]), parseFloat(items[pos + 2])];\n items.splice(pos, 4); // we expect 3 parameters here!\n }\n pos = items.indexOf('-o');\n if (pos >= 0) {\n textureCfg.translate = [parseFloat(items[pos + 1]), parseFloat(items[pos + 2])];\n items.splice(pos, 4); // we expect 3 parameters here!\n }\n textureCfg.src = basePath + items.join(' ').trim();\n textureCfg.flipY = true;\n textureCfg.encoding = encoding || \"linear\";\n //textureCfg.wrapS = self.wrap;\n //textureCfg.wrapT = self.wrap;\n var texture = new Texture(modelNode, textureCfg);\n return texture.id;\n }\n\n function createMaterial(modelNode, materialCfg) {\n new PhongMaterial(modelNode, materialCfg);\n }\n\n function parseRGB(value) {\n var ss = value.split(delimiter_pattern, 3);\n return [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])];\n }\n\n})();\n//--------------------------------------------------------------------------------------------\n// Creates meshes from parsed state\n//--------------------------------------------------------------------------------------------\n\n\nfunction createMeshes(modelNode, state) {\n\n for (var j = 0, k = state.objects.length; j < k; j++) {\n\n var object = state.objects[j];\n var geometry = object.geometry;\n var isLine = (geometry.type === 'Line');\n\n if (geometry.positions.length === 0) {\n // Skip o/g line declarations that did not follow with any faces\n continue;\n }\n\n var geometryCfg = {\n primitive: \"triangles\",\n compressGeometry: false\n };\n\n geometryCfg.positions = geometry.positions;\n\n if (geometry.normals.length > 0) {\n geometryCfg.normals = geometry.normals;\n }\n\n if (geometry.uv.length > 0) {\n geometryCfg.uv = geometry.uv;\n }\n\n var indices = new Array(geometryCfg.positions.length / 3); // Triangle soup\n for (var idx = 0; idx < indices.length; idx++) {\n indices[idx] = idx;\n }\n geometryCfg.indices = indices;\n\n const origin = tempVec3a;\n\n worldToRTCPositions(geometry.positions, geometry.positions, origin);\n\n var readableGeometry = new ReadableGeometry(modelNode, geometryCfg);\n\n var materialId = object.material.id;\n var material;\n if (materialId && materialId !== \"\") {\n material = modelNode.scene.components[materialId];\n if (!material) {\n modelNode.error(\"Material not found: \" + materialId);\n }\n } else {\n material = new PhongMaterial(modelNode, {\n //emissive: [0.6, 0.6, 0.0],\n diffuse: [0.6, 0.6, 0.6],\n backfaces: true\n });\n\n }\n\n // material.emissive = [Math.random(), Math.random(), Math.random()];\n\n var mesh = new Mesh(modelNode, {\n id: modelNode.id + \"#\" + object.id,\n origin: (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0) ? origin : null,\n isObject: true,\n geometry: readableGeometry,\n material: material,\n pickable: true\n });\n\n modelNode.addChild(mesh);\n }\n}\n\nfunction loadFile(url, ok, err) {\n var request = new XMLHttpRequest();\n request.open('GET', url, true);\n request.addEventListener('load', function (event) {\n var response = event.target.response;\n if (this.status === 200) {\n if (ok) {\n ok(response);\n }\n } else if (this.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n console.warn('loadFile: HTTP Status 0 received.');\n if (ok) {\n ok(response);\n }\n } else {\n if (err) {\n err(event);\n }\n }\n }, false);\n\n request.addEventListener('error', function (event) {\n if (err) {\n err(event);\n }\n }, false);\n request.send(null);\n}\n\nexport {OBJSceneGraphLoader};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1288, + "__docId__": 1296, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22760,7 +22976,7 @@ "ignore": true }, { - "__docId__": 1289, + "__docId__": 1297, "kind": "function", "name": "loadOBJ", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22799,7 +23015,7 @@ "ignore": true }, { - "__docId__": 1290, + "__docId__": 1298, "kind": "variable", "name": "parseOBJ", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22820,7 +23036,7 @@ "ignore": true }, { - "__docId__": 1291, + "__docId__": 1299, "kind": "function", "name": "loadMTLs", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22859,7 +23075,7 @@ "ignore": true }, { - "__docId__": 1292, + "__docId__": 1300, "kind": "function", "name": "loadMTL", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22904,7 +23120,7 @@ "ignore": true }, { - "__docId__": 1293, + "__docId__": 1301, "kind": "variable", "name": "parseMTL", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22925,7 +23141,7 @@ "ignore": true }, { - "__docId__": 1294, + "__docId__": 1302, "kind": "function", "name": "createMeshes", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22958,7 +23174,7 @@ "ignore": true }, { - "__docId__": 1295, + "__docId__": 1303, "kind": "function", "name": "loadFile", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -22997,7 +23213,7 @@ "ignore": true }, { - "__docId__": 1296, + "__docId__": 1304, "kind": "class", "name": "OBJSceneGraphLoader", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js", @@ -23013,7 +23229,7 @@ "ignore": true }, { - "__docId__": 1297, + "__docId__": 1305, "kind": "method", "name": "load", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js~OBJSceneGraphLoader", @@ -23059,7 +23275,7 @@ "return": null }, { - "__docId__": 1298, + "__docId__": 1306, "kind": "method", "name": "parse", "memberof": "src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js~OBJSceneGraphLoader", @@ -23115,29 +23331,29 @@ "return": null }, { - "__docId__": 1299, + "__docId__": 1307, "kind": "file", "name": "src/plugins/OBJLoaderPlugin/index.js", "content": "export * from \"./OBJLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/OBJLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/OBJLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1300, + "__docId__": 1308, "kind": "file", "name": "src/plugins/STLLoaderPlugin/STLDefaultDataSource.js", "content": "/**\n * Default data access strategy for {@link STLLoaderPlugin}.\n *\n * This implementation simply loads STL files using XMLHttpRequest.\n */\nclass STLDefaultDataSource {\n\n /**\n * Gets STL data.\n *\n * @param {String|Number} src Identifies the STL file.\n * @param {Function} ok Fired on successful loading of the STL file.\n * @param {Function} error Fired on error while loading the STL file.\n */\n getSTL(src, ok, error) {\n const request = new XMLHttpRequest();\n request.overrideMimeType(\"application/json\");\n request.open('GET', src, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n error(request.statusText);\n }\n }\n };\n request.send(null);\n }\n}\n\nexport {STLDefaultDataSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1301, + "__docId__": 1309, "kind": "class", "name": "STLDefaultDataSource", "memberof": "src/plugins/STLLoaderPlugin/STLDefaultDataSource.js", @@ -23152,7 +23368,7 @@ "interface": false }, { - "__docId__": 1302, + "__docId__": 1310, "kind": "method", "name": "getSTL", "memberof": "src/plugins/STLLoaderPlugin/STLDefaultDataSource.js~STLDefaultDataSource", @@ -23199,18 +23415,18 @@ "return": null }, { - "__docId__": 1303, + "__docId__": 1311, "kind": "file", "name": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js", "content": "import {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {STLSceneGraphLoader} from \"./STLSceneGraphLoader.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\nimport {STLDefaultDataSource} from \"./STLDefaultDataSource.js\";\n\n/**\n * {@link Viewer} plugin that loads models from STL files.\n *\n * ## Overview\n *\n * * Creates an {@link Entity} representing each model it loads, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.\n * * Creates an {@link Entity} for each object within the model, which will have {@link Entity#isObject} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.\n * * When loading, can set the World-space position, scale and rotation of each model within World space, along with initial properties for all the model's {@link Entity}s.\n * * Supports both binary and ASCII formats.\n * * Supports double-precision vertex positions.\n * * Supports custom data source configuration.\n *\n * ## Smoothing STL Normals\n *\n * STL models are normally flat-shaded, however providing a ````smoothNormals```` parameter when loading gives a smooth\n * appearance. Triangles in STL are disjoint, where each triangle has its own separate vertex positions, normals and\n * (optionally) colors. This means that you can have gaps between triangles in an STL model. Normals for each triangle\n * are perpendicular to the triangle's surface, which gives the model a faceted appearance by default.\n *\n * The ```smoothNormals``` parameter causes the plugin to recalculate the STL normals, so that each normal's direction is\n * the average of the orientations of the triangles adjacent to its vertex. When smoothing, each vertex normal is set to\n * the average of the orientations of all other triangles that have a vertex at the same position, excluding those triangles\n * whose direction deviates from the direction of the vertice's triangle by a threshold given in\n * the ````smoothNormalsAngleThreshold```` loading parameter. This makes smoothing robust for hard edges.\n *\n * ## Creating Entities for Objects\n *\n * An STL model is normally a single mesh, however providing a ````splitMeshes```` parameter when loading\n * will create a separate object {@link Entity} for each group of faces that share the same vertex colors. This option\n * only works with binary STL files.\n *\n * See the {@link STLLoaderPlugin#load} method for more info on loading options.\n *\n * ## Usage\n *\n * In the example below, we'll use an STLLoaderPlugin to load an STL model of a spur gear. When the model has loaded,\n * we'll use the {@link CameraFlightAnimation} to fly the {@link Camera} to look at boundary of the model. We'll\n * then get the model's {@link Entity} from the {@link Scene} and highlight the whole model.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_STL_SpurGear)]\n *\n * ````javascript\n * // Create a xeokit Viewer\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Add an STLLoaderPlugin to the Viewer\n * var plugin = new STLLoaderPlugin(viewer);\n *\n * // Load the STL model\n * var model = plugin.load({ // Model is an Entity\n * id: \"myModel\",\n * src: \"./models/stl/binary/spurGear.stl\",\n * scale: [0.1, 0.1, 0.1],\n * rotate: [90, 0, 0],\n * translate: [100,0,0],\n * edges: true,\n * smoothNormals: true, // Default\n * smoothNormalsAngleThreshold: 20, // Default\n * splitMeshes: true // Default\n * });\n *\n * // When the model has loaded, fit it to view\n * model.on(\"loaded\", function() { // Model is an Entity\n * viewer.cameraFlight.flyTo(model);\n * });\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Update properties of the model Entity\n * model.highlight = [1,0,0];\n *\n * // Destroy the model Entity\n * model.destroy();\n * ````\n *\n * ## Loading from a Pre-Loaded STL File\n *\n * If we already have our STL file in memory (perhaps pre-loaded, or even generated in-client), then we can just pass that\n * file data straight into the {@link STLLoaderPlugin#load} method. In the example below, to show how it's done, we'll pre-load\n * our STL file data, then pass it straight into that method.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_STL_dataAsParam)]\n *\n * ````javascript\n * loadSTL(\"./models/stl/binary/spurGear.stl\", (stlData) =>{\n *\n * const model = stlLoader.load({\n * id: \"myModel\",\n * stl: stlData,\n * smoothNormals: true\n * });\n *\n * model.on(\"loaded\", () => {\n * viewer.cameraFlight.jumpTo(model);\n * viewer.scene.on(\"tick\", () => {\n * viewer.camera.orbitYaw(0.4);\n * })\n * });\n * })\n *\n * function loadSTL(src, ok, error) {\n * const request = new XMLHttpRequest();\n * request.overrideMimeType(\"application/json\");\n * request.open('GET', src, true);\n * request.responseType = 'arraybuffer';\n * request.onreadystatechange = function () {\n * if (request.readyState === 4) {\n * if (request.status === 200) {\n * ok(request.response);\n * } else if (error) {\n * error(request.statusText);\n * }\n * }\n * };\n * request.send(null);\n * }\n *````\n *\n * ## Configuring a Custom Data Source\n *\n * In the example below, we'll create the STLLoaderPlugin again, this time configuring it with a\n * custom data source object, through which it can load STL files. For this example, our data source just loads\n * them via HTTP, for simplicity. Once we've created the STLLoaderPlugin, we'll load our STL file as before.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_STL_dataSource)]\n *\n * ````javascript\n * // Our custom STL data access strategy - implementation happens to be the same as STLDefaultDataSource\n *\n * class MyDataSource {\n * getSTL(src, ok, error) {\n * const request = new XMLHttpRequest();\n * request.overrideMimeType(\"application/json\");\n * request.open('GET', src, true);\n * request.responseType = 'arraybuffer';\n * request.onreadystatechange = function () {\n * if (request.readyState === 4) {\n * if (request.status === 200) {\n * ok(request.response);\n * } else {\n * error(request.statusText);\n * }\n * }\n * };\n * request.send(null);\n * }\n * }\n *\n * const stlLoader = new STLLoaderPlugin(viewer, {\n * dataSource: new MyDataSource()\n * });\n *\n * // Load the STL model as before\n * var model = plugin.load({\n * id: \"myModel\",\n * src: \"./models/stl/binary/spurGear.stl\",\n * scale: [0.1, 0.1, 0.1],\n * rotate: [90, 0, 0],\n * translate: [100,0,0],\n * edges: true,\n * smoothNormals: true, // Default\n * smoothNormalsAngleThreshold: 20, // Default\n * splitMeshes: true // Default\n * });\n *\n * //...\n *````\n *\n * @class STLLoaderPlugin\n */\nclass STLLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} [cfg] Plugin configuration.\n * @param {String} [cfg.id=\"STLLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Object} [cfg.dataSource] A custom data source through which the STLLoaderPlugin can load STL files. Defaults to an instance of {@link STLDefaultDataSource}, which loads over HTTP.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"STLLoader\", viewer, cfg);\n\n /**\n * @private\n */\n this._sceneGraphLoader = new STLSceneGraphLoader();\n\n this.dataSource = cfg.dataSource;\n }\n\n /**\n * Sets a custom data source through which the STLLoaderPlugin can load STL files.\n *\n * Default value is {@link STLDefaultDataSource}, which loads via an XMLHttpRequest.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new STLDefaultDataSource();\n }\n\n /**\n * Gets the custom data source through which the STLLoaderPlugin can load STL files.\n *\n * Default value is {@link STLDefaultDataSource}, which loads via an XMLHttpRequest.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Loads an STL model from a file into this STLLoaderPlugin's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @param {String} params.id ID to assign to the model's root {@link Entity}, unique among all components in the Viewer's {@link Scene}.\n * @param {String} [params.src] Path to an STL file. Overrides the ````stl```` parameter.\n * @param {String} [params.stl] Contents of an STL file, either binary of ASCII. Overridden by the ````src```` parameter.\n * @param {Boolean} [params.edges=false] Whether or not to renders the model with edges emphasized.\n * @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.\n * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @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.\n * @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````.\n * @param {Boolean} [params.backfaces=false] When true, allows visible backfaces, wherever specified in the STL. When false, ignores backfaces.\n * @param {Boolean} [params.smoothNormals=true] When true, automatically converts face-oriented normals to vertex normals for a smooth appearance.\n * @param {Number} [params.smoothNormalsAngleThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @param {Number} [params.edgeThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @param {Boolean} [params.splitMeshes=true] When true, creates a separate {@link Mesh} for each group of faces that share the same vertex colors. Only works with binary STL.\n * @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}\n */\n load(params) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const modelNode = new Node(this.viewer.scene, utils.apply(params, {\n isModel: true\n }));\n\n const src = params.src;\n const stl = params.stl;\n\n if (!src && !stl) {\n this.error(\"load() param expected: either 'src' or 'stl'\");\n return modelNode;\n }\n\n if (src) {\n this._sceneGraphLoader.load(this, modelNode, src, params);\n } else {\n this._sceneGraphLoader.parse(this, modelNode, stl, params);\n }\n\n return modelNode;\n }\n}\n\n\nexport {STLLoaderPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1304, + "__docId__": 1312, "kind": "class", "name": "STLLoaderPlugin", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js", @@ -23234,7 +23450,7 @@ ] }, { - "__docId__": 1305, + "__docId__": 1313, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23297,7 +23513,7 @@ ] }, { - "__docId__": 1306, + "__docId__": 1314, "kind": "member", "name": "_sceneGraphLoader", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23314,7 +23530,7 @@ } }, { - "__docId__": 1308, + "__docId__": 1316, "kind": "set", "name": "dataSource", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23335,7 +23551,7 @@ } }, { - "__docId__": 1309, + "__docId__": 1317, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23353,7 +23569,7 @@ } }, { - "__docId__": 1310, + "__docId__": 1318, "kind": "get", "name": "dataSource", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23374,7 +23590,7 @@ } }, { - "__docId__": 1311, + "__docId__": 1319, "kind": "method", "name": "load", "memberof": "src/plugins/STLLoaderPlugin/STLLoaderPlugin.js~STLLoaderPlugin", @@ -23608,18 +23824,18 @@ } }, { - "__docId__": 1312, + "__docId__": 1320, "kind": "file", "name": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", "content": "import {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {MetallicMaterial} from \"../../viewer/scene/materials/MetallicMaterial.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {worldToRTCPositions} from \"../../viewer/scene/math/rtcCoords.js\";\nimport {core} from \"../../viewer/scene/core.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nclass STLSceneGraphLoader {\n\n load(plugin, modelNode, src, options, ok, error) {\n\n options = options || {};\n\n const spinner = plugin.viewer.scene.canvas.spinner;\n spinner.processes++;\n\n plugin.dataSource.getSTL(src, function (data) { // OK\n parse(plugin, modelNode, data, options);\n try {\n const binData = ensureBinary(data);\n if (isBinary(binData)) {\n parseBinary(plugin, binData, modelNode, options);\n } else {\n parseASCII(plugin, ensureString(data), modelNode, options);\n }\n spinner.processes--;\n core.scheduleTask(function () {\n modelNode.fire(\"loaded\", true, false);\n });\n if (ok) {\n ok();\n }\n } catch (e) {\n spinner.processes--;\n plugin.error(e);\n if (error) {\n error(e);\n }\n modelNode.fire(\"error\", e);\n }\n },\n function (msg) {\n spinner.processes--;\n plugin.error(msg);\n if (error) {\n error(msg);\n }\n modelNode.fire(\"error\", msg);\n });\n }\n\n parse(plugin, modelNode, data, options) {\n const spinner = plugin.viewer.scene.canvas.spinner;\n spinner.processes++;\n try {\n const binData = ensureBinary(data);\n if (isBinary(binData)) {\n parseBinary(plugin, binData, modelNode, options);\n } else {\n parseASCII(plugin, ensureString(data), modelNode, options);\n }\n spinner.processes--;\n core.scheduleTask(function () {\n modelNode.fire(\"loaded\", true, false);\n });\n } catch (e) {\n spinner.processes--;\n modelNode.fire(\"error\", e);\n }\n }\n}\n\nfunction parse(plugin, modelNode, data, options) {\n try {\n const binData = ensureBinary(data);\n if (isBinary(binData)) {\n parseBinary(plugin, binData, modelNode, options);\n } else {\n parseASCII(plugin, ensureString(data), modelNode, options);\n }\n } catch (e) {\n modelNode.fire(\"error\", e);\n }\n}\n\nfunction isBinary(data) {\n const reader = new DataView(data);\n const numFaces = reader.getUint32(80, true);\n const faceSize = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);\n const numExpectedBytes = 80 + (32 / 8) + (numFaces * faceSize);\n if (numExpectedBytes === reader.byteLength) {\n return true;\n }\n const solid = [115, 111, 108, 105, 100];\n for (var i = 0; i < 5; i++) {\n if (solid[i] !== reader.getUint8(i, false)) {\n return true;\n }\n }\n return false;\n}\n\nfunction parseBinary(plugin, data, modelNode, options) {\n const reader = new DataView(data);\n const faces = reader.getUint32(80, true);\n let r;\n let g;\n let b;\n let hasColors = false;\n let colors;\n let defaultR;\n let defaultG;\n let defaultB;\n let lastR = null;\n let lastG = null;\n let lastB = null;\n let newMesh = false;\n let alpha;\n for (let index = 0; index < 80 - 10; index++) {\n if ((reader.getUint32(index, false) === 0x434F4C4F /*COLO*/) &&\n (reader.getUint8(index + 4) === 0x52 /*'R'*/) &&\n (reader.getUint8(index + 5) === 0x3D /*'='*/)) {\n hasColors = true;\n colors = [];\n defaultR = reader.getUint8(index + 6) / 255;\n defaultG = reader.getUint8(index + 7) / 255;\n defaultB = reader.getUint8(index + 8) / 255;\n alpha = reader.getUint8(index + 9) / 255;\n }\n }\n const material = new MetallicMaterial(modelNode, { // Share material with all meshes\n roughness: 0.5\n });\n // var material = new PhongMaterial(modelNode, { // Share material with all meshes\n // diffuse: [0.4, 0.4, 0.4],\n // reflectivity: 1,\n // specular: [0.5, 0.5, 1.0]\n // });\n let dataOffset = 84;\n let faceLength = 12 * 4 + 2;\n let positions = [];\n let normals = [];\n let splitMeshes = options.splitMeshes;\n for (let face = 0; face < faces; face++) {\n let start = dataOffset + face * faceLength;\n let normalX = reader.getFloat32(start, true);\n let normalY = reader.getFloat32(start + 4, true);\n let normalZ = reader.getFloat32(start + 8, true);\n if (hasColors) {\n let packedColor = reader.getUint16(start + 48, true);\n if ((packedColor & 0x8000) === 0) {\n r = (packedColor & 0x1F) / 31;\n g = ((packedColor >> 5) & 0x1F) / 31;\n b = ((packedColor >> 10) & 0x1F) / 31;\n } else {\n r = defaultR;\n g = defaultG;\n b = defaultB;\n }\n if (splitMeshes && r !== lastR || g !== lastG || b !== lastB) {\n if (lastR !== null) {\n newMesh = true;\n }\n lastR = r;\n lastG = g;\n lastB = b;\n }\n }\n for (let i = 1; i <= 3; i++) {\n let vertexstart = start + i * 12;\n positions.push(reader.getFloat32(vertexstart, true));\n positions.push(reader.getFloat32(vertexstart + 4, true));\n positions.push(reader.getFloat32(vertexstart + 8, true));\n normals.push(normalX, normalY, normalZ);\n if (hasColors) {\n colors.push(r, g, b, 1); // TODO: handle alpha\n }\n }\n if (splitMeshes && newMesh) {\n addMesh(modelNode, positions, normals, colors, material, options);\n positions = [];\n normals = [];\n colors = colors ? [] : null;\n newMesh = false;\n }\n }\n if (positions.length > 0) {\n addMesh(modelNode, positions, normals, colors, material, options);\n }\n}\n\nfunction parseASCII(plugin, data, modelNode, options) {\n const faceRegex = /facet([\\s\\S]*?)endfacet/g;\n let faceCounter = 0;\n const floatRegex = /[\\s]+([+-]?(?:\\d+.\\d+|\\d+.|\\d+|.\\d+)(?:[eE][+-]?\\d+)?)/.source;\n const vertexRegex = new RegExp('vertex' + floatRegex + floatRegex + floatRegex, 'g');\n const normalRegex = new RegExp('normal' + floatRegex + floatRegex + floatRegex, 'g');\n const positions = [];\n const normals = [];\n const colors = null;\n let normalx;\n let normaly;\n let normalz;\n let result;\n let verticesPerFace;\n let normalsPerFace;\n let text;\n while ((result = faceRegex.exec(data)) !== null) {\n verticesPerFace = 0;\n normalsPerFace = 0;\n text = result[0];\n while ((result = normalRegex.exec(text)) !== null) {\n normalx = parseFloat(result[1]);\n normaly = parseFloat(result[2]);\n normalz = parseFloat(result[3]);\n normalsPerFace++;\n }\n while ((result = vertexRegex.exec(text)) !== null) {\n positions.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\n normals.push(normalx, normaly, normalz);\n verticesPerFace++;\n }\n if (normalsPerFace !== 1) {\n plugin.error(\"Error in normal of face \" + faceCounter);\n }\n if (verticesPerFace !== 3) {\n plugin.error(\"Error in positions of face \" + faceCounter);\n }\n faceCounter++;\n }\n const material = new MetallicMaterial(modelNode, {\n roughness: 0.5\n });\n // var material = new PhongMaterial(modelNode, {\n // diffuse: [0.4, 0.4, 0.4],\n // reflectivity: 1,\n // specular: [0.5, 0.5, 1.0]\n // });\n addMesh(modelNode, positions, normals, colors, material, options);\n}\n\nfunction addMesh(modelNode, positions, normals, colors, material, options) {\n\n const indices = new Int32Array(positions.length / 3);\n for (let ni = 0, len = indices.length; ni < len; ni++) {\n indices[ni] = ni;\n }\n\n normals = normals && normals.length > 0 ? normals : null;\n colors = colors && colors.length > 0 ? colors : null;\n\n if (options.smoothNormals) {\n math.faceToVertexNormals(positions, normals, options);\n }\n\n const origin = tempVec3a;\n\n worldToRTCPositions(positions, positions, origin);\n\n const geometry = new ReadableGeometry(modelNode, {\n primitive: \"triangles\",\n positions: positions,\n normals: normals,\n colors: colors,\n indices: indices\n });\n\n const mesh = new Mesh(modelNode, {\n origin: (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0) ? origin : null,\n geometry: geometry,\n material: material,\n edges: options.edges\n });\n\n modelNode.addChild(mesh);\n}\n\nfunction ensureString(buffer) {\n if (typeof buffer !== 'string') {\n return decodeText(new Uint8Array(buffer));\n }\n return buffer;\n}\n\nfunction ensureBinary(buffer) {\n if (typeof buffer === 'string') {\n const arrayBuffer = new Uint8Array(buffer.length);\n for (let i = 0; i < buffer.length; i++) {\n arrayBuffer[i] = buffer.charCodeAt(i) & 0xff; // implicitly assumes little-endian\n }\n return arrayBuffer.buffer || arrayBuffer;\n } else {\n return buffer;\n }\n}\n\nfunction decodeText(array) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(array);\n }\n let s = '';\n for (let i = 0, il = array.length; i < il; i++) {\n s += String.fromCharCode(array[i]); // Implicitly assumes little-endian.\n }\n return decodeURIComponent(escape(s));\n}\n\nexport {STLSceneGraphLoader}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1313, + "__docId__": 1321, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23640,7 +23856,7 @@ "ignore": true }, { - "__docId__": 1314, + "__docId__": 1322, "kind": "function", "name": "parse", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23685,7 +23901,7 @@ "ignore": true }, { - "__docId__": 1315, + "__docId__": 1323, "kind": "function", "name": "isBinary", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23716,7 +23932,7 @@ "ignore": true }, { - "__docId__": 1316, + "__docId__": 1324, "kind": "function", "name": "parseBinary", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23761,7 +23977,7 @@ "ignore": true }, { - "__docId__": 1317, + "__docId__": 1325, "kind": "function", "name": "parseASCII", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23806,7 +24022,7 @@ "ignore": true }, { - "__docId__": 1318, + "__docId__": 1326, "kind": "function", "name": "addMesh", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23863,7 +24079,7 @@ "ignore": true }, { - "__docId__": 1319, + "__docId__": 1327, "kind": "function", "name": "ensureString", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23894,7 +24110,7 @@ "ignore": true }, { - "__docId__": 1320, + "__docId__": 1328, "kind": "function", "name": "ensureBinary", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23925,7 +24141,7 @@ "ignore": true }, { - "__docId__": 1321, + "__docId__": 1329, "kind": "function", "name": "decodeText", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23956,7 +24172,7 @@ "ignore": true }, { - "__docId__": 1322, + "__docId__": 1330, "kind": "class", "name": "STLSceneGraphLoader", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js", @@ -23972,7 +24188,7 @@ "ignore": true }, { - "__docId__": 1323, + "__docId__": 1331, "kind": "method", "name": "load", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js~STLSceneGraphLoader", @@ -24025,7 +24241,7 @@ "return": null }, { - "__docId__": 1324, + "__docId__": 1332, "kind": "method", "name": "parse", "memberof": "src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js~STLSceneGraphLoader", @@ -24066,29 +24282,29 @@ "return": null }, { - "__docId__": 1325, + "__docId__": 1333, "kind": "file", "name": "src/plugins/STLLoaderPlugin/index.js", "content": "export * from \"./STLDefaultDataSource.js\";\nexport * from \"./STLLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/STLLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/STLLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1326, + "__docId__": 1334, "kind": "file", "name": "src/plugins/SectionPlanesPlugin/Control.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\n\nimport {buildCylinderGeometry} from \"../../viewer/scene/geometry/builders/buildCylinderGeometry.js\";\nimport {buildTorusGeometry} from \"../../viewer/scene/geometry/builders/buildTorusGeometry.js\";\n\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {EmphasisMaterial} from \"../../viewer/scene/materials/EmphasisMaterial.js\";\nimport {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {buildSphereGeometry} from \"../../viewer/scene/geometry/builders/buildSphereGeometry.js\";\nimport {worldToRTCPos} from \"../../viewer/scene/math/rtcCoords.js\";\n\nconst zeroVec = new Float64Array([0, 0, 1]);\nconst quat = new Float64Array(4);\n\n/**\n * Controls a {@link SectionPlane} with mouse and touch input.\n *\n * @private\n */\nclass Control {\n\n /** @private */\n constructor(plugin) {\n\n /**\n * ID of this Control.\n *\n * SectionPlaneControls are mapped by this ID in {@link SectionPlanesPlugin#sectionPlaneControls}.\n *\n * @property id\n * @type {String|Number}\n */\n this.id = null;\n\n this._viewer = plugin.viewer;\n\n this._visible = false;\n this._pos = math.vec3(); // Full-precision position of the center of the Control\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n\n this._baseDir = math.vec3(); // Saves direction of clip plane when we start dragging an arrow or ring.\n this._rootNode = null; // Root of Node graph that represents this control in the 3D scene\n this._displayMeshes = null; // Meshes that are always visible\n this._affordanceMeshes = null; // Meshes displayed momentarily for affordance\n\n this._ignoreNextSectionPlaneDirUpdate = false;\n\n this._createNodes();\n this._bindEvents();\n }\n\n /**\n * Called by SectionPlanesPlugin to assign this Control to a SectionPlane.\n * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.\n * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.\n * @private\n */\n _setSectionPlane(sectionPlane) {\n if (this._sectionPlane) {\n this._sectionPlane.off(this._onSectionPlanePos);\n this._sectionPlane.off(this._onSectionPlaneDir);\n this._onSectionPlanePos = null;\n this._onSectionPlaneDir = null;\n this._sectionPlane = null;\n }\n if (sectionPlane) {\n this.id = sectionPlane.id;\n this._setPos(sectionPlane.pos);\n this._setDir(sectionPlane.dir);\n this._sectionPlane = sectionPlane;\n this._onSectionPlanePos = sectionPlane.on(\"pos\", () => {\n this._setPos(this._sectionPlane.pos);\n });\n this._onSectionPlaneDir = sectionPlane.on(\"dir\", () => {\n if (!this._ignoreNextSectionPlaneDirUpdate) {\n this._setDir(this._sectionPlane.dir);\n } else {\n this._ignoreNextSectionPlaneDirUpdate = false;\n }\n });\n }\n }\n\n /**\n * Gets the {@link SectionPlane} controlled by this Control.\n * @returns {SectionPlane} The SectionPlane.\n */\n get sectionPlane() {\n return this._sectionPlane;\n }\n\n /** @private */\n _setPos(xyz) {\n\n this._pos.set(xyz);\n\n worldToRTCPos(this._pos, this._origin, this._rtcPos);\n\n this._rootNode.origin = this._origin;\n this._rootNode.position = this._rtcPos;\n }\n\n /** @private */\n _setDir(xyz) {\n this._baseDir.set(xyz);\n this._rootNode.quaternion = math.vec3PairToQuaternion(zeroVec, xyz, quat);\n }\n\n _setSectionPlaneDir(dir) {\n if (this._sectionPlane) {\n this._ignoreNextSectionPlaneDirUpdate = true;\n this._sectionPlane.dir = dir;\n }\n }\n\n /**\n * Sets if this Control is visible.\n *\n * @type {Boolean}\n */\n setVisible(visible = true) {\n if (this._visible === visible) {\n return;\n }\n this._visible = visible;\n var id;\n for (id in this._displayMeshes) {\n if (this._displayMeshes.hasOwnProperty(id)) {\n this._displayMeshes[id].visible = visible;\n }\n }\n if (!visible) {\n for (id in this._affordanceMeshes) {\n if (this._affordanceMeshes.hasOwnProperty(id)) {\n this._affordanceMeshes[id].visible = visible;\n }\n }\n }\n }\n\n /**\n * Gets if this Control is visible.\n *\n * @type {Boolean}\n */\n getVisible() {\n return this._visible;\n }\n\n /**\n * Sets if this Control is culled. This is called by SectionPlanesPlugin to\n * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().\n * @param culled\n */\n setCulled(culled) {\n var id;\n for (id in this._displayMeshes) {\n if (this._displayMeshes.hasOwnProperty(id)) {\n this._displayMeshes[id].culled = culled;\n }\n }\n if (!culled) {\n for (id in this._affordanceMeshes) {\n if (this._affordanceMeshes.hasOwnProperty(id)) {\n this._affordanceMeshes[id].culled = culled;\n }\n }\n }\n }\n\n /**\n * Builds the Entities that represent this Control.\n * @private\n */\n _createNodes() {\n\n const NO_STATE_INHERIT = false;\n const scene = this._viewer.scene;\n const radius = 1.0;\n const handleTubeRadius = 0.06;\n const hoopRadius = radius - 0.2;\n const tubeRadius = 0.01;\n const arrowRadius = 0.07;\n\n this._rootNode = new Node(scene, {\n position: [0, 0, 0],\n scale: [5, 5, 5],\n isObject: false\n });\n\n const rootNode = this._rootNode;\n\n const shapes = {// Reusable geometries\n\n arrowHead: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: arrowRadius,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.2,\n openEnded: false\n })),\n\n arrowHeadBig: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: 0.09,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.25,\n openEnded: false\n })),\n\n arrowHeadHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.09,\n radiusBottom: 0.09,\n radialSegments: 8,\n heightSegments: 1,\n height: 0.37,\n openEnded: false\n })),\n\n curve: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n curveHandle: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: handleTubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n hoop: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 8,\n arc: (Math.PI * 2.0)\n })),\n\n axis: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: tubeRadius,\n radiusBottom: tubeRadius,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n })),\n\n axisHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.08,\n radiusBottom: 0.08,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n }))\n };\n\n const materials = { // Reusable materials\n\n pickable: new PhongMaterial(rootNode, { // Invisible material for pickable handles, which define a pickable 3D area\n diffuse: [1, 1, 0],\n alpha: 0, // Invisible\n alphaMode: \"blend\"\n }),\n\n red: new PhongMaterial(rootNode, {\n diffuse: [1, 0.0, 0.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightRed: new EmphasisMaterial(rootNode, { // Emphasis for red rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [1, 0, 0],\n fillAlpha: 0.6\n }),\n\n green: new PhongMaterial(rootNode, {\n diffuse: [0.0, 1, 0.0],\n emissive: [0.0, 1, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightGreen: new EmphasisMaterial(rootNode, { // Emphasis for green rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 1, 0],\n fillAlpha: 0.6\n }),\n\n blue: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 1],\n emissive: [0.0, 0.0, 1],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightBlue: new EmphasisMaterial(rootNode, { // Emphasis for blue rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 0, 1],\n fillAlpha: 0.2\n }),\n\n center: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 0.0],\n emissive: [0, 0, 0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80\n }),\n\n highlightBall: new EmphasisMaterial(rootNode, {\n edges: false,\n fill: true,\n fillColor: [0.5, 0.5, 0.5],\n fillAlpha: 0.5,\n vertices: false\n }),\n\n highlightPlane: new EmphasisMaterial(rootNode, {\n edges: true,\n edgeWidth: 3,\n fill: false,\n fillColor: [0.5, 0.5, .5],\n fillAlpha: 0.5,\n vertices: false\n })\n };\n\n this._displayMeshes = {\n\n plane: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, {\n primitive: \"triangles\",\n positions: [\n 0.5, 0.5, 0.0, 0.5, -0.5, 0.0, // 0\n -0.5, -0.5, 0.0, -0.5, 0.5, 0.0, // 1\n 0.5, 0.5, -0.0, 0.5, -0.5, -0.0, // 2\n -0.5, -0.5, -0.0, -0.5, 0.5, -0.0 // 3\n ],\n indices: [0, 1, 2, 2, 3, 0]\n }),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0.0, 0],\n diffuse: [0, 0, 0],\n backfaces: true\n }),\n opacity: 0.6,\n ghosted: true,\n ghostMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n edgeColor: [0, 0, 0],\n fillAlpha: 0.1,\n backfaces: true\n }),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n scale: [2.4, 2.4, 1],\n isObject: false\n }), NO_STATE_INHERIT),\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 1.7,\n tube: tubeRadius * 2,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0, 0],\n diffuse: [0, 0, 0],\n specular: [0, 0, 0],\n shininess: 0\n }),\n //highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n edgeColor: [0.0, 0.0, 0.0],\n filled: true,\n fillColor: [0.8, 0.8, 0.8],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, .1],\n rotation: [0, 0, 45],\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xCurve: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curve,\n material: materials.red,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xCurveHandle: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yCurve: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curve,\n material: materials.green,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n rotation: [-90, 0, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zCurve: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.curve,\n material: materials.blue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zCurveCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n return math.mulMat4(translate, scale, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n center: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildSphereGeometry({\n radius: 0.05\n })),\n material: materials.center,\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xAxis: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n opacity: 0.2,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.green,\n position: [0, -radius / 2, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yShaftHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n position: [0, -radius / 2, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n\n zShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: false,\n collidable: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: true,\n collidable: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT)\n };\n\n this._affordanceMeshes = {\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 2,\n tube: tubeRadius,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n ambient: [1, 1, 1],\n diffuse: [0, 0, 0],\n emissive: [1, 1, 0]\n }),\n highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, 1],\n rotation: [0, 0, 45],\n isObject: false\n }), NO_STATE_INHERIT),\n\n xHoop: rootNode.addChild(new Mesh(rootNode, { // Full\n geometry: shapes.hoop,\n material: materials.red,\n highlighted: true,\n highlightMaterial: materials.highlightRed,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yHoop: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.hoop,\n material: materials.green,\n highlighted: true,\n highlightMaterial: materials.highlightGreen,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zHoop: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.hoop,\n material: materials.blue,\n highlighted: true,\n highlightMaterial: materials.highlightBlue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT),\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n isObject: false\n }), NO_STATE_INHERIT)\n };\n }\n\n _bindEvents() {\n\n const self = this;\n\n var grabbed = false;\n\n const DRAG_ACTIONS = {\n none: -1,\n xTranslate: 0,\n yTranslate: 1,\n zTranslate: 2,\n xRotate: 3,\n yRotate: 4,\n zRotate: 5\n };\n\n const rootNode = this._rootNode;\n\n var nextDragAction = null; // As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.\n var dragAction = null; // Action we're doing while we drag an arrow or hoop.\n const lastCanvasPos = math.vec2();\n\n const xBaseAxis = math.vec3([1, 0, 0]);\n const yBaseAxis = math.vec3([0, 1, 0]);\n const zBaseAxis = math.vec3([0, 0, 1]);\n\n const canvas = this._viewer.scene.canvas.canvas;\n const camera = this._viewer.camera;\n const scene = this._viewer.scene;\n\n { // Keep gizmo screen size constant\n\n const tempVec3a = math.vec3([0, 0, 0]);\n\n let distDirty = true;\n let lastDist = -1;\n\n this._onCameraViewMatrix = scene.camera.on(\"viewMatrix\", () => {\n distDirty = true;\n });\n\n this._onCameraProjMatrix = scene.camera.on(\"projMatrix\", () => {\n distDirty = true;\n });\n\n this._onSceneTick = scene.on(\"tick\", () => {\n\n const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));\n\n if (dist !== lastDist) {\n if (camera.projection === \"perspective\") {\n const worldSize = (Math.tan(camera.perspective.fov * math.DEGTORAD)) * dist;\n const size = 0.07 * worldSize;\n rootNode.scale = [size, size, size];\n lastDist = dist;\n }\n }\n\n if (camera.projection === \"ortho\") {\n const worldSize = camera.ortho.scale / 10;\n const size = worldSize;\n rootNode.scale = [size, size, size];\n lastDist = dist;\n }\n });\n }\n\n const getClickCoordsWithinElement = (function () {\n const canvasPos = new Float64Array(2);\n return function (event) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n var element = event.target;\n var totalOffsetLeft = 0;\n var totalOffsetTop = 0;\n\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n canvasPos[0] = event.pageX - totalOffsetLeft;\n canvasPos[1] = event.pageY - totalOffsetTop;\n }\n return canvasPos;\n };\n })();\n\n const localToWorldVec = (function () {\n const mat = math.mat4();\n return function (localVec, worldVec) {\n math.quaternionToMat4(self._rootNode.quaternion, mat);\n math.transformVec3(mat, localVec, worldVec);\n math.normalizeVec3(worldVec);\n return worldVec;\n };\n })();\n\n var getTranslationPlane = (function () {\n const planeNormal = math.vec3();\n return function (worldAxis) {\n const absX = Math.abs(worldAxis[0]);\n if (absX > Math.abs(worldAxis[1]) && absX > Math.abs(worldAxis[2])) {\n math.cross3Vec3(worldAxis, [0, 1, 0], planeNormal);\n } else {\n math.cross3Vec3(worldAxis, [1, 0, 0], planeNormal);\n }\n math.cross3Vec3(planeNormal, worldAxis, planeNormal);\n math.normalizeVec3(planeNormal);\n return planeNormal;\n }\n })();\n\n const dragTranslateSectionPlane = (function () {\n const p1 = math.vec3();\n const p2 = math.vec3();\n const worldAxis = math.vec4();\n return function (baseAxis, fromMouse, toMouse) {\n localToWorldVec(baseAxis, worldAxis);\n const planeNormal = getTranslationPlane(worldAxis, fromMouse, toMouse);\n getPointerPlaneIntersect(fromMouse, planeNormal, p1);\n getPointerPlaneIntersect(toMouse, planeNormal, p2);\n math.subVec3(p2, p1);\n const dot = math.dotVec3(p2, worldAxis);\n self._pos[0] += worldAxis[0] * dot;\n self._pos[1] += worldAxis[1] * dot;\n self._pos[2] += worldAxis[2] * dot;\n self._rootNode.position = self._pos;\n if (self._sectionPlane) {\n self._sectionPlane.pos = self._pos;\n }\n }\n })();\n\n var dragRotateSectionPlane = (function () {\n const p1 = math.vec4();\n const p2 = math.vec4();\n const c = math.vec4();\n const worldAxis = math.vec4();\n return function (baseAxis, fromMouse, toMouse) {\n localToWorldVec(baseAxis, worldAxis);\n const hasData = getPointerPlaneIntersect(fromMouse, worldAxis, p1) && getPointerPlaneIntersect(toMouse, worldAxis, p2);\n if (!hasData) { // Find intersections with view plane and project down to origin\n const planeNormal = getTranslationPlane(worldAxis, fromMouse, toMouse);\n getPointerPlaneIntersect(fromMouse, planeNormal, p1, 1); // Ensure plane moves closer to camera so angles become workable\n getPointerPlaneIntersect(toMouse, planeNormal, p2, 1);\n var dot = math.dotVec3(p1, worldAxis);\n p1[0] -= dot * worldAxis[0];\n p1[1] -= dot * worldAxis[1];\n p1[2] -= dot * worldAxis[2];\n dot = math.dotVec3(p2, worldAxis);\n p2[0] -= dot * worldAxis[0];\n p2[1] -= dot * worldAxis[1];\n p2[2] -= dot * worldAxis[2];\n }\n math.normalizeVec3(p1);\n math.normalizeVec3(p2);\n dot = math.dotVec3(p1, p2);\n dot = math.clamp(dot, -1.0, 1.0); // Rounding errors cause dot to exceed allowed range\n var incDegrees = Math.acos(dot) * math.RADTODEG;\n math.cross3Vec3(p1, p2, c);\n if (math.dotVec3(c, worldAxis) < 0.0) {\n incDegrees = -incDegrees;\n }\n self._rootNode.rotate(baseAxis, incDegrees);\n rotateSectionPlane();\n }\n })();\n\n var getPointerPlaneIntersect = (function () {\n const dir = math.vec4([0, 0, 0, 1]);\n const matrix = math.mat4();\n return function (mouse, axis, dest, offset) {\n offset = offset || 0;\n dir[0] = mouse[0] / canvas.width * 2.0 - 1.0;\n dir[1] = -(mouse[1] / canvas.height * 2.0 - 1.0);\n dir[2] = 0.0;\n dir[3] = 1.0;\n math.mulMat4(camera.projMatrix, camera.viewMatrix, matrix); // Unproject norm device coords to view coords\n math.inverseMat4(matrix);\n math.transformVec4(matrix, dir, dir);\n math.mulVec4Scalar(dir, 1.0 / dir[3]); // This is now point A on the ray in world space\n var rayO = camera.eye; // The direction\n math.subVec4(dir, rayO, dir);\n const origin = self._sectionPlane.pos; // Plane origin:\n var d = -math.dotVec3(origin, axis) - offset;\n var dot = math.dotVec3(axis, dir);\n if (Math.abs(dot) > 0.005) {\n var t = -(math.dotVec3(axis, rayO) + d) / dot;\n math.mulVec3Scalar(dir, t, dest);\n math.addVec3(dest, rayO);\n math.subVec3(dest, origin, dest);\n return true;\n }\n return false;\n }\n })();\n\n const rotateSectionPlane = (function () {\n const dir = math.vec3();\n const mat = math.mat4();\n return function () {\n if (self.sectionPlane) {\n math.quaternionToMat4(rootNode.quaternion, mat); // << ---\n math.transformVec3(mat, [0, 0, 1], dir);\n self._setSectionPlaneDir(dir);\n }\n };\n })();\n\n {\n var mouseDownLeft;\n var mouseDownMiddle;\n var mouseDownRight;\n var down = false;\n var lastAffordanceMesh;\n\n this._onCameraControlHover = this._viewer.cameraControl.on(\"hoverEnter\", (hit) => {\n if (!this._visible) {\n return;\n }\n if (down) {\n return;\n }\n grabbed = false;\n if (lastAffordanceMesh) {\n lastAffordanceMesh.visible = false;\n }\n var affordanceMesh;\n const meshId = hit.entity.id;\n switch (meshId) {\n\n case this._displayMeshes.xAxisArrowHandle.id:\n affordanceMesh = this._affordanceMeshes.xAxisArrow;\n nextDragAction = DRAG_ACTIONS.xTranslate;\n break;\n\n case this._displayMeshes.xAxisHandle.id:\n affordanceMesh = this._affordanceMeshes.xAxisArrow;\n nextDragAction = DRAG_ACTIONS.xTranslate;\n break;\n\n case this._displayMeshes.yAxisArrowHandle.id:\n affordanceMesh = this._affordanceMeshes.yAxisArrow;\n nextDragAction = DRAG_ACTIONS.yTranslate;\n break;\n\n case this._displayMeshes.yShaftHandle.id:\n affordanceMesh = this._affordanceMeshes.yAxisArrow;\n nextDragAction = DRAG_ACTIONS.yTranslate;\n break;\n\n case this._displayMeshes.zAxisArrowHandle.id:\n affordanceMesh = this._affordanceMeshes.zAxisArrow;\n nextDragAction = DRAG_ACTIONS.zTranslate;\n break;\n\n case this._displayMeshes.zAxisHandle.id:\n affordanceMesh = this._affordanceMeshes.zAxisArrow;\n nextDragAction = DRAG_ACTIONS.zTranslate;\n break;\n\n case this._displayMeshes.xCurveHandle.id:\n affordanceMesh = this._affordanceMeshes.xHoop;\n nextDragAction = DRAG_ACTIONS.xRotate;\n break;\n\n case this._displayMeshes.yCurveHandle.id:\n affordanceMesh = this._affordanceMeshes.yHoop;\n nextDragAction = DRAG_ACTIONS.yRotate;\n break;\n\n case this._displayMeshes.zCurveHandle.id:\n affordanceMesh = this._affordanceMeshes.zHoop;\n nextDragAction = DRAG_ACTIONS.zRotate;\n break;\n\n default:\n nextDragAction = DRAG_ACTIONS.none;\n return; // Not clicked an arrow or hoop\n }\n if (affordanceMesh) {\n affordanceMesh.visible = true;\n }\n lastAffordanceMesh = affordanceMesh;\n grabbed = true;\n });\n\n this._onCameraControlHoverLeave = this._viewer.cameraControl.on(\"hoverOutEntity\", (hit) => {\n if (!this._visible) {\n return;\n }\n if (lastAffordanceMesh) {\n lastAffordanceMesh.visible = false;\n }\n lastAffordanceMesh = null;\n nextDragAction = DRAG_ACTIONS.none;\n });\n\n canvas.addEventListener(\"mousedown\", this._canvasMouseDownListener = (e) => {\n e.preventDefault();\n if (!this._visible) {\n return;\n }\n if (!grabbed) {\n return;\n }\n this._viewer.cameraControl.pointerEnabled = false;\n switch (e.which) {\n case 1: // Left button\n mouseDownLeft = true;\n down = true;\n var canvasPos = getClickCoordsWithinElement(e);\n dragAction = nextDragAction;\n lastCanvasPos[0] = canvasPos[0];\n lastCanvasPos[1] = canvasPos[1];\n break;\n\n default:\n break;\n }\n });\n\n canvas.addEventListener(\"mousemove\", this._canvasMouseMoveListener = (e) => {\n if (!this._visible) {\n return;\n }\n if (!down) {\n return;\n }\n var canvasPos = getClickCoordsWithinElement(e);\n const x = canvasPos[0];\n const y = canvasPos[1];\n\n switch (dragAction) {\n case DRAG_ACTIONS.xTranslate:\n dragTranslateSectionPlane(xBaseAxis, lastCanvasPos, canvasPos);\n break;\n case DRAG_ACTIONS.yTranslate:\n dragTranslateSectionPlane(yBaseAxis, lastCanvasPos, canvasPos);\n break;\n case DRAG_ACTIONS.zTranslate:\n dragTranslateSectionPlane(zBaseAxis, lastCanvasPos, canvasPos);\n break;\n case DRAG_ACTIONS.xRotate:\n dragRotateSectionPlane(xBaseAxis, lastCanvasPos, canvasPos);\n break;\n case DRAG_ACTIONS.yRotate:\n dragRotateSectionPlane(yBaseAxis, lastCanvasPos, canvasPos);\n break;\n case DRAG_ACTIONS.zRotate:\n dragRotateSectionPlane(zBaseAxis, lastCanvasPos, canvasPos);\n break;\n }\n\n lastCanvasPos[0] = x;\n lastCanvasPos[1] = y;\n });\n\n canvas.addEventListener(\"mouseup\", this._canvasMouseUpListener = (e) => {\n if (!this._visible) {\n return;\n }\n this._viewer.cameraControl.pointerEnabled = true;\n if (!down) {\n return;\n }\n switch (e.which) {\n case 1: // Left button\n mouseDownLeft = false;\n break;\n case 2: // Middle/both buttons\n mouseDownMiddle = false;\n break;\n case 3: // Right button\n mouseDownRight = false;\n break;\n default:\n break;\n }\n down = false;\n grabbed = false;\n });\n\n canvas.addEventListener(\"wheel\", this._canvasWheelListener = (e) => {\n if (!this._visible) {\n return;\n }\n var delta = Math.max(-1, Math.min(1, -e.deltaY * 40));\n if (delta === 0) {\n return;\n }\n });\n }\n }\n\n _destroy() {\n this._unbindEvents();\n this._destroyNodes();\n }\n\n _unbindEvents() {\n\n const viewer = this._viewer;\n const scene = viewer.scene;\n const canvas = scene.canvas.canvas;\n const camera = viewer.camera;\n const cameraControl = viewer.cameraControl;\n\n scene.off(this._onSceneTick);\n\n canvas.removeEventListener(\"mousedown\", this._canvasMouseDownListener);\n canvas.removeEventListener(\"mousemove\", this._canvasMouseMoveListener);\n canvas.removeEventListener(\"mouseup\", this._canvasMouseUpListener);\n canvas.removeEventListener(\"wheel\", this._canvasWheelListener);\n\n camera.off(this._onCameraViewMatrix);\n camera.off(this._onCameraProjMatrix);\n\n cameraControl.off(this._onCameraControlHover);\n cameraControl.off(this._onCameraControlHoverLeave);\n }\n\n _destroyNodes() {\n this._setSectionPlane(null);\n this._rootNode.destroy();\n this._displayMeshes = {};\n this._affordanceMeshes = {};\n }\n}\n\nexport {Control};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SectionPlanesPlugin/Control.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SectionPlanesPlugin/Control.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1327, + "__docId__": 1335, "kind": "variable", "name": "zeroVec", "memberof": "src/plugins/SectionPlanesPlugin/Control.js", @@ -24109,7 +24325,7 @@ "ignore": true }, { - "__docId__": 1328, + "__docId__": 1336, "kind": "variable", "name": "quat", "memberof": "src/plugins/SectionPlanesPlugin/Control.js", @@ -24130,7 +24346,7 @@ "ignore": true }, { - "__docId__": 1329, + "__docId__": 1337, "kind": "class", "name": "Control", "memberof": "src/plugins/SectionPlanesPlugin/Control.js", @@ -24146,7 +24362,7 @@ "ignore": true }, { - "__docId__": 1330, + "__docId__": 1338, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24160,7 +24376,7 @@ "ignore": true }, { - "__docId__": 1331, + "__docId__": 1339, "kind": "member", "name": "id", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24192,7 +24408,7 @@ } }, { - "__docId__": 1332, + "__docId__": 1340, "kind": "member", "name": "_viewer", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24210,7 +24426,7 @@ } }, { - "__docId__": 1333, + "__docId__": 1341, "kind": "member", "name": "_visible", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24228,7 +24444,7 @@ } }, { - "__docId__": 1334, + "__docId__": 1342, "kind": "member", "name": "_pos", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24246,7 +24462,7 @@ } }, { - "__docId__": 1335, + "__docId__": 1343, "kind": "member", "name": "_origin", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24264,7 +24480,7 @@ } }, { - "__docId__": 1336, + "__docId__": 1344, "kind": "member", "name": "_rtcPos", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24282,7 +24498,7 @@ } }, { - "__docId__": 1337, + "__docId__": 1345, "kind": "member", "name": "_baseDir", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24300,7 +24516,7 @@ } }, { - "__docId__": 1338, + "__docId__": 1346, "kind": "member", "name": "_rootNode", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24318,7 +24534,7 @@ } }, { - "__docId__": 1339, + "__docId__": 1347, "kind": "member", "name": "_displayMeshes", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24336,7 +24552,7 @@ } }, { - "__docId__": 1340, + "__docId__": 1348, "kind": "member", "name": "_affordanceMeshes", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24354,7 +24570,7 @@ } }, { - "__docId__": 1341, + "__docId__": 1349, "kind": "member", "name": "_ignoreNextSectionPlaneDirUpdate", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24372,7 +24588,7 @@ } }, { - "__docId__": 1342, + "__docId__": 1350, "kind": "method", "name": "_setSectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24395,7 +24611,7 @@ "return": null }, { - "__docId__": 1343, + "__docId__": 1351, "kind": "member", "name": "_onSectionPlanePos", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24413,7 +24629,7 @@ } }, { - "__docId__": 1344, + "__docId__": 1352, "kind": "member", "name": "_onSectionPlaneDir", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24431,7 +24647,7 @@ } }, { - "__docId__": 1345, + "__docId__": 1353, "kind": "member", "name": "_sectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24449,7 +24665,7 @@ } }, { - "__docId__": 1351, + "__docId__": 1359, "kind": "get", "name": "sectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24481,7 +24697,7 @@ } }, { - "__docId__": 1352, + "__docId__": 1360, "kind": "method", "name": "_setPos", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24504,7 +24720,7 @@ "return": null }, { - "__docId__": 1353, + "__docId__": 1361, "kind": "method", "name": "_setDir", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24527,7 +24743,7 @@ "return": null }, { - "__docId__": 1354, + "__docId__": 1362, "kind": "method", "name": "_setSectionPlaneDir", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24551,7 +24767,7 @@ "return": null }, { - "__docId__": 1356, + "__docId__": 1364, "kind": "method", "name": "setVisible", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24584,7 +24800,7 @@ "return": null }, { - "__docId__": 1358, + "__docId__": 1366, "kind": "method", "name": "getVisible", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24611,7 +24827,7 @@ } }, { - "__docId__": 1359, + "__docId__": 1367, "kind": "method", "name": "setCulled", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24637,7 +24853,7 @@ "return": null }, { - "__docId__": 1360, + "__docId__": 1368, "kind": "method", "name": "_createNodes", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24653,7 +24869,7 @@ "return": null }, { - "__docId__": 1364, + "__docId__": 1372, "kind": "method", "name": "_bindEvents", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24670,7 +24886,7 @@ "return": null }, { - "__docId__": 1365, + "__docId__": 1373, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24688,7 +24904,7 @@ } }, { - "__docId__": 1366, + "__docId__": 1374, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24706,7 +24922,7 @@ } }, { - "__docId__": 1367, + "__docId__": 1375, "kind": "member", "name": "_onSceneTick", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24724,7 +24940,7 @@ } }, { - "__docId__": 1368, + "__docId__": 1376, "kind": "member", "name": "_onCameraControlHover", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24742,7 +24958,7 @@ } }, { - "__docId__": 1369, + "__docId__": 1377, "kind": "member", "name": "_onCameraControlHoverLeave", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24760,7 +24976,7 @@ } }, { - "__docId__": 1370, + "__docId__": 1378, "kind": "method", "name": "_destroy", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24777,7 +24993,7 @@ "return": null }, { - "__docId__": 1371, + "__docId__": 1379, "kind": "method", "name": "_unbindEvents", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24794,7 +25010,7 @@ "return": null }, { - "__docId__": 1372, + "__docId__": 1380, "kind": "method", "name": "_destroyNodes", "memberof": "src/plugins/SectionPlanesPlugin/Control.js~Control", @@ -24811,18 +25027,18 @@ "return": null }, { - "__docId__": 1375, + "__docId__": 1383, "kind": "file", "name": "src/plugins/SectionPlanesPlugin/Overview.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Scene} from \"../../viewer/scene/scene/Scene.js\";\nimport {DirLight} from \"./../../viewer/scene/lights/DirLight.js\";\nimport {Plane} from \"./Plane.js\";\n\n/**\n * @desc An interactive 3D overview for navigating the {@link SectionPlane}s created by its {@link SectionPlanesPlugin}.\n *\n * * Located at {@link SectionPlanesPlugin#overview}.\n * * Renders the overview on a separate canvas at a corner of the {@link Viewer}'s {@link Scene} {@link Canvas}.\n * * The overview shows a 3D plane object for each {@link SectionPlane} in the {@link Scene}.\n * * Click a plane object in the overview to toggle the visibility of a 3D gizmo to edit the position and orientation of its {@link SectionPlane}.\n *\n * @private\n */\nclass Overview {\n\n /**\n * @private\n */\n constructor(plugin, cfg) {\n\n if (!cfg.onHoverEnterPlane || !cfg.onHoverLeavePlane || !cfg.onClickedNothing || !cfg.onClickedPlane) {\n throw \"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane\";\n }\n\n /**\n * The {@link SectionPlanesPlugin} that owns this SectionPlanesOverview.\n *\n * @type {SectionPlanesPlugin}\n */\n this.plugin = plugin;\n\n this._viewer = plugin.viewer;\n\n this._onHoverEnterPlane = cfg.onHoverEnterPlane;\n this._onHoverLeavePlane = cfg.onHoverLeavePlane;\n this._onClickedNothing = cfg.onClickedNothing;\n this._onClickedPlane = cfg.onClickedPlane;\n this._visible = true;\n\n this._planes = {};\n\n //--------------------------------------------------------------------------------------------------------------\n // Init canvas\n //--------------------------------------------------------------------------------------------------------------\n\n this._canvas = cfg.overviewCanvas;\n\n //--------------------------------------------------------------------------------------------------------------\n // Init scene\n //--------------------------------------------------------------------------------------------------------------\n\n this._scene = new Scene(this._viewer, {\n canvasId: this._canvas.id,\n transparent: true\n });\n this._scene.clearLights();\n new DirLight(this._scene, {\n dir: [0.4, -0.4, 0.8],\n color: [0.8, 1.0, 1.0],\n intensity: 1.0,\n space: \"view\"\n });\n new DirLight(this._scene, {\n dir: [-0.8, -0.3, -0.4],\n color: [0.8, 0.8, 0.8],\n intensity: 1.0,\n space: \"view\"\n });\n new DirLight(this._scene, {\n dir: [0.8, -0.6, -0.8],\n color: [1.0, 1.0, 1.0],\n intensity: 1.0,\n space: \"view\"\n });\n\n this._scene.camera;\n this._scene.camera.perspective.fov = 70;\n\n this._zUp = false;\n\n //--------------------------------------------------------------------------------------------------------------\n // Synchronize overview scene camera with viewer camera\n //--------------------------------------------------------------------------------------------------------------\n\n {\n const camera = this._scene.camera;\n const matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);\n const eyeLookVec = math.vec3();\n const eyeLookVecOverview = math.vec3();\n const upOverview = math.vec3();\n\n this._synchCamera = () => {\n const eye = this._viewer.camera.eye;\n const look = this._viewer.camera.look;\n const up = this._viewer.camera.up;\n math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, eyeLookVec)), 7);\n if (this._zUp) { // +Z up\n math.transformVec3(matrix, eyeLookVec, eyeLookVecOverview);\n math.transformVec3(matrix, up, upOverview);\n camera.look = [0, 0, 0];\n camera.eye = math.transformVec3(matrix, eyeLookVec, eyeLookVecOverview);\n camera.up = math.transformPoint3(matrix, up, upOverview);\n } else { // +Y up\n camera.look = [0, 0, 0];\n camera.eye = eyeLookVec;\n camera.up = up;\n }\n };\n }\n\n this._onViewerCameraMatrix = this._viewer.camera.on(\"matrix\", this._synchCamera);\n\n this._onViewerCameraWorldAxis = this._viewer.camera.on(\"worldAxis\", this._synchCamera);\n\n this._onViewerCameraFOV = this._viewer.camera.perspective.on(\"fov\", (fov) => {\n this._scene.camera.perspective.fov = fov;\n });\n\n //--------------------------------------------------------------------------------------------------------------\n // Bind overview canvas events\n //--------------------------------------------------------------------------------------------------------------\n\n {\n var hoveredEntity = null;\n\n this._onInputMouseMove = this._scene.input.on(\"mousemove\", (coords) => {\n const hit = this._scene.pick({\n canvasPos: coords\n });\n if (hit) {\n if (!hoveredEntity || hit.entity.id !== hoveredEntity.id) {\n if (hoveredEntity) {\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onHoverLeavePlane(hoveredEntity.id);\n }\n }\n hoveredEntity = hit.entity;\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onHoverEnterPlane(hoveredEntity.id);\n }\n }\n } else {\n if (hoveredEntity) {\n this._onHoverLeavePlane(hoveredEntity.id);\n hoveredEntity = null;\n }\n }\n });\n\n this._scene.canvas.canvas.addEventListener(\"mouseup\", this._onCanvasMouseUp = () => {\n if (hoveredEntity) {\n const plane = this._planes[hoveredEntity.id];\n if (plane) {\n this._onClickedPlane(hoveredEntity.id);\n }\n } else {\n this._onClickedNothing();\n }\n });\n\n this._scene.canvas.canvas.addEventListener(\"mouseout\", this._onCanvasMouseOut = () => {\n if (hoveredEntity) {\n this._onHoverLeavePlane(hoveredEntity.id);\n hoveredEntity = null;\n }\n });\n }\n\n //--------------------------------------------------------------------------------------------------------------\n // Configure overview\n //--------------------------------------------------------------------------------------------------------------\n\n this.setVisible(cfg.overviewVisible);\n }\n\n /** Called by SectionPlanesPlugin#createSectionPlane()\n * @private\n */\n addSectionPlane(sectionPlane) {\n this._planes[sectionPlane.id] = new Plane(this, this._scene, sectionPlane);\n }\n\n /** @private\n */\n setPlaneHighlighted(id, highlighted) {\n const plane = this._planes[id];\n if (plane) {\n plane.setHighlighted(highlighted);\n }\n }\n\n /** @private\n */\n setPlaneSelected(id, selected) {\n const plane = this._planes[id];\n if (plane) {\n plane.setSelected(selected);\n }\n }\n\n /** @private\n */\n removeSectionPlane(sectionPlane) {\n const plane = this._planes[sectionPlane.id];\n if (plane) {\n plane.destroy();\n delete this._planes[sectionPlane.id];\n }\n }\n\n /**\n * Sets if this SectionPlanesOverview is visible.\n *\n * @param {Boolean} visible Whether or not this SectionPlanesOverview is visible.\n */\n setVisible(visible = true) {\n this._visible = visible;\n this._canvas.style.visibility = visible ? \"visible\" : \"hidden\";\n }\n\n /**\n * Gets if this SectionPlanesOverview is visible.\n *\n * @return {Boolean} True when this SectionPlanesOverview is visible.\n */\n getVisible() {\n return this._visible;\n }\n\n /** @private\n */\n destroy() {\n this._viewer.camera.off(this._onViewerCameraMatrix);\n this._viewer.camera.off(this._onViewerCameraWorldAxis);\n this._viewer.camera.perspective.off(this._onViewerCameraFOV);\n\n this._scene.input.off(this._onInputMouseMove);\n this._scene.canvas.canvas.removeEventListener(\"mouseup\", this._onCanvasMouseUp);\n this._scene.canvas.canvas.removeEventListener(\"mouseout\", this._onCanvasMouseOut);\n this._scene.destroy();\n }\n}\n\nexport {Overview};\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SectionPlanesPlugin/Overview.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SectionPlanesPlugin/Overview.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1376, + "__docId__": 1384, "kind": "class", "name": "Overview", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js", @@ -24838,7 +25054,7 @@ "ignore": true }, { - "__docId__": 1377, + "__docId__": 1385, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24852,7 +25068,7 @@ "ignore": true }, { - "__docId__": 1378, + "__docId__": 1386, "kind": "member", "name": "plugin", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24871,7 +25087,7 @@ } }, { - "__docId__": 1379, + "__docId__": 1387, "kind": "member", "name": "_viewer", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24889,7 +25105,7 @@ } }, { - "__docId__": 1380, + "__docId__": 1388, "kind": "member", "name": "_onHoverEnterPlane", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24907,7 +25123,7 @@ } }, { - "__docId__": 1381, + "__docId__": 1389, "kind": "member", "name": "_onHoverLeavePlane", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24925,7 +25141,7 @@ } }, { - "__docId__": 1382, + "__docId__": 1390, "kind": "member", "name": "_onClickedNothing", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24943,7 +25159,7 @@ } }, { - "__docId__": 1383, + "__docId__": 1391, "kind": "member", "name": "_onClickedPlane", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24961,7 +25177,7 @@ } }, { - "__docId__": 1384, + "__docId__": 1392, "kind": "member", "name": "_visible", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24979,7 +25195,7 @@ } }, { - "__docId__": 1385, + "__docId__": 1393, "kind": "member", "name": "_planes", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -24997,7 +25213,7 @@ } }, { - "__docId__": 1386, + "__docId__": 1394, "kind": "member", "name": "_canvas", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25015,7 +25231,7 @@ } }, { - "__docId__": 1387, + "__docId__": 1395, "kind": "member", "name": "_scene", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25033,7 +25249,7 @@ } }, { - "__docId__": 1388, + "__docId__": 1396, "kind": "member", "name": "_zUp", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25051,7 +25267,7 @@ } }, { - "__docId__": 1389, + "__docId__": 1397, "kind": "member", "name": "_synchCamera", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25069,7 +25285,7 @@ } }, { - "__docId__": 1390, + "__docId__": 1398, "kind": "member", "name": "_onViewerCameraMatrix", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25087,7 +25303,7 @@ } }, { - "__docId__": 1391, + "__docId__": 1399, "kind": "member", "name": "_onViewerCameraWorldAxis", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25105,7 +25321,7 @@ } }, { - "__docId__": 1392, + "__docId__": 1400, "kind": "member", "name": "_onViewerCameraFOV", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25123,7 +25339,7 @@ } }, { - "__docId__": 1393, + "__docId__": 1401, "kind": "member", "name": "_onInputMouseMove", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25141,7 +25357,7 @@ } }, { - "__docId__": 1394, + "__docId__": 1402, "kind": "method", "name": "addSectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25164,7 +25380,7 @@ "return": null }, { - "__docId__": 1395, + "__docId__": 1403, "kind": "method", "name": "setPlaneHighlighted", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25192,7 +25408,7 @@ "return": null }, { - "__docId__": 1396, + "__docId__": 1404, "kind": "method", "name": "setPlaneSelected", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25220,7 +25436,7 @@ "return": null }, { - "__docId__": 1397, + "__docId__": 1405, "kind": "method", "name": "removeSectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25243,7 +25459,7 @@ "return": null }, { - "__docId__": 1398, + "__docId__": 1406, "kind": "method", "name": "setVisible", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25269,7 +25485,7 @@ "return": null }, { - "__docId__": 1400, + "__docId__": 1408, "kind": "method", "name": "getVisible", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25291,7 +25507,7 @@ "params": [] }, { - "__docId__": 1401, + "__docId__": 1409, "kind": "method", "name": "destroy", "memberof": "src/plugins/SectionPlanesPlugin/Overview.js~Overview", @@ -25306,18 +25522,18 @@ "return": null }, { - "__docId__": 1402, + "__docId__": 1410, "kind": "file", "name": "src/plugins/SectionPlanesPlugin/Plane.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {buildBoxGeometry} from \"../../viewer/scene/geometry/builders/buildBoxGeometry.js\";\nimport {EdgeMaterial} from \"../../viewer/scene/materials/EdgeMaterial.js\";\nimport {EmphasisMaterial} from \"../../viewer/scene/materials/EmphasisMaterial.js\";\n\n\n/**\n * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.\n *\n * @private\n */\nclass Plane {\n\n /** @private */\n constructor(overview, overviewScene, sectionPlane) {\n\n /**\n * The ID of this SectionPlanesOverviewPlane.\n *\n * @type {String}\n */\n this.id = sectionPlane.id;\n\n /**\n * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.\n *\n * @type {SectionPlane}\n */\n this._sectionPlane = sectionPlane;\n\n this._mesh = new Mesh(overviewScene, {\n id: sectionPlane.id,\n geometry: new ReadableGeometry(overviewScene, buildBoxGeometry({\n xSize: .5,\n ySize: .5,\n zSize: .001\n })),\n material: new PhongMaterial(overviewScene, {\n emissive: [1, 1, 1],\n diffuse: [0, 0, 0],\n backfaces: false\n }),\n edgeMaterial: new EdgeMaterial(overviewScene, {\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n highlightMaterial: new EmphasisMaterial(overviewScene, {\n fill: true,\n fillColor: [0.5, 1, 0.5],\n fillAlpha: 0.7,\n edges: true,\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n selectedMaterial: new EmphasisMaterial(overviewScene, {\n fill: true,\n fillColor: [0, 0, 1],\n fillAlpha: 0.7,\n edges: true,\n edgeColor: [1.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }),\n highlighted: true,\n scale: [3, 3, 3],\n position: [0, 0, 0],\n rotation: [0, 0, 0],\n opacity: 0.3,\n edges: true\n });\n\n\n {\n const vec = math.vec3([0, 0, 0]);\n const pos2 = math.vec3();\n const zeroVec = math.vec3([0, 0, 1]);\n const quat = math.vec4(4);\n const pos3 = math.vec3();\n\n const update = () => {\n\n const origin = this._sectionPlane.scene.center;\n\n const negDir = [-this._sectionPlane.dir[0], -this._sectionPlane.dir[1], -this._sectionPlane.dir[2]];\n math.subVec3(origin, this._sectionPlane.pos, vec);\n const dist = -math.dotVec3(negDir, vec);\n\n math.normalizeVec3(negDir);\n math.mulVec3Scalar(negDir, dist, pos2);\n const quaternion = math.vec3PairToQuaternion(zeroVec, this._sectionPlane.dir, quat);\n\n pos3[0] = pos2[0] * 0.1;\n pos3[1] = pos2[1] * 0.1;\n pos3[2] = pos2[2] * 0.1;\n\n this._mesh.quaternion = quaternion;\n this._mesh.position = pos3;\n };\n\n this._onSectionPlanePos = this._sectionPlane.on(\"pos\", update);\n this._onSectionPlaneDir = this._sectionPlane.on(\"dir\", update);\n\n // update();\n }\n\n this._highlighted = false;\n this._selected = false;\n }\n\n /**\n * Sets if this SectionPlanesOverviewPlane is highlighted.\n *\n * @type {Boolean}\n * @private\n */\n setHighlighted(highlighted) {\n this._highlighted = !!highlighted;\n this._mesh.highlighted = this._highlighted;\n this._mesh.highlightMaterial.fillColor = highlighted ? [0, 0.7, 0] : [0, 0, 0];\n // this._selectedMesh.highlighted = true;\n }\n\n /**\n * Gets if this SectionPlanesOverviewPlane is highlighted.\n *\n * @type {Boolean}\n * @private\n */\n getHighlighted() {\n return this._highlighted;\n }\n\n /**\n * Sets if this SectionPlanesOverviewPlane is selected.\n *\n * @type {Boolean}\n * @private\n */\n setSelected(selected) {\n this._selected = !!selected;\n this._mesh.edgeMaterial.edgeWidth = selected ? 3 : 1;\n this._mesh.highlightMaterial.edgeWidth = selected ? 3 : 1;\n\n }\n\n /**\n * Gets if this SectionPlanesOverviewPlane is selected.\n *\n * @type {Boolean}\n * @private\n */\n getSelected() {\n return this._selected;\n }\n\n /** @private */\n destroy() {\n this._sectionPlane.off(this._onSectionPlanePos);\n this._sectionPlane.off(this._onSectionPlaneDir);\n this._mesh.destroy();\n }\n}\n\nexport {Plane};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SectionPlanesPlugin/Plane.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SectionPlanesPlugin/Plane.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1403, + "__docId__": 1411, "kind": "class", "name": "Plane", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js", @@ -25333,7 +25549,7 @@ "ignore": true }, { - "__docId__": 1404, + "__docId__": 1412, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25347,7 +25563,7 @@ "ignore": true }, { - "__docId__": 1405, + "__docId__": 1413, "kind": "member", "name": "id", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25366,7 +25582,7 @@ } }, { - "__docId__": 1406, + "__docId__": 1414, "kind": "member", "name": "_sectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25386,7 +25602,7 @@ "ignore": true }, { - "__docId__": 1407, + "__docId__": 1415, "kind": "member", "name": "_mesh", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25404,7 +25620,7 @@ } }, { - "__docId__": 1408, + "__docId__": 1416, "kind": "member", "name": "_onSectionPlanePos", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25422,7 +25638,7 @@ } }, { - "__docId__": 1409, + "__docId__": 1417, "kind": "member", "name": "_onSectionPlaneDir", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25440,7 +25656,7 @@ } }, { - "__docId__": 1410, + "__docId__": 1418, "kind": "member", "name": "_highlighted", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25458,7 +25674,7 @@ } }, { - "__docId__": 1411, + "__docId__": 1419, "kind": "member", "name": "_selected", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25476,7 +25692,7 @@ } }, { - "__docId__": 1412, + "__docId__": 1420, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25507,7 +25723,7 @@ "return": null }, { - "__docId__": 1414, + "__docId__": 1422, "kind": "method", "name": "getHighlighted", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25535,7 +25751,7 @@ } }, { - "__docId__": 1415, + "__docId__": 1423, "kind": "method", "name": "setSelected", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25566,7 +25782,7 @@ "return": null }, { - "__docId__": 1417, + "__docId__": 1425, "kind": "method", "name": "getSelected", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25594,7 +25810,7 @@ } }, { - "__docId__": 1418, + "__docId__": 1426, "kind": "method", "name": "destroy", "memberof": "src/plugins/SectionPlanesPlugin/Plane.js~Plane", @@ -25610,18 +25826,18 @@ "return": null }, { - "__docId__": 1419, + "__docId__": 1427, "kind": "file", "name": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", "content": "import {math} from \"../../viewer/scene/math/math.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {SectionPlane} from \"../../viewer/scene/sectionPlane/SectionPlane.js\";\nimport {Control} from \"./Control.js\";\nimport {Overview} from \"./Overview.js\";\n\nconst tempAABB = math.AABB3();\nconst tempVec3 = math.vec3();\n\n/**\n * SectionPlanesPlugin is a {@link Viewer} plugin that manages {@link SectionPlane}s.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_SectionPlanesPlugin)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#gizmos_SectionPlanesPlugin)]\n *\n * ## Overview\n *\n * * Use the SectionPlanesPlugin to\n * create and edit {@link SectionPlane}s to slice portions off your models and reveal internal structures.\n * * As shown in the screen capture above, SectionPlanesPlugin shows an overview of all your SectionPlanes (on the right, in\n * this example).\n * * Click a plane in the overview to activate a 3D control with which you can interactively\n * reposition its SectionPlane in the main canvas.\n * * Use {@lin BCFViewpointsPlugin} to save and load SectionPlanes in BCF viewpoints.\n *\n * ## Usage\n *\n * In the example below, we'll use a {@link GLTFLoaderPlugin} to load a model, and a SectionPlanesPlugin\n * to slice it open with two {@link SectionPlane}s. We'll show the overview in the bottom right of the Viewer\n * canvas. Finally, we'll programmatically activate the 3D editing control, so that we can use it to interactively\n * reposition our second SectionPlane.\n *\n * ````JavaScript\n * import {Viewer, GLTFLoaderPlugin, SectionPlanesPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange its Camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [-5.02, 2.22, 15.09];\n * viewer.camera.look = [4.97, 2.79, 9.89];\n * viewer.camera.up = [-0.05, 0.99, 0.02];\n *\n *\n * // Add a GLTFLoaderPlugin\n *\n * const gltfLoader = new GLTFLoaderPlugin(viewer);\n *\n * // Add a SectionPlanesPlugin, with overview visible\n *\n * const sectionPlanes = new SectionPlanesPlugin(viewer, {\n * overviewCanvasID: \"myOverviewCanvas\",\n * overviewVisible: true\n * });\n *\n * // Load a model\n *\n * const model = gltfLoader.load({\n * id: \"myModel\",\n * src: \"./models/gltf/schependomlaan/scene.gltf\"\n * });\n *\n * // Create a couple of section planes\n * // These will be shown in the overview\n *\n * sectionPlanes.createSectionPlane({\n * id: \"mySectionPlane\",\n * pos: [1.04, 1.95, 9.74],\n * dir: [1.0, 0.0, 0.0]\n * });\n *\n * sectionPlanes.createSectionPlane({\n * id: \"mySectionPlane2\",\n * pos: [2.30, 4.46, 14.93],\n * dir: [0.0, -0.09, -0.79]\n * });\n *\n * // Show the SectionPlanePlugin's 3D editing gizmo,\n * // to interactively reposition one of our SectionPlanes\n *\n * sectionPlanes.showControl(\"mySectionPlane2\");\n *\n * const mySectionPlane2 = sectionPlanes.sectionPlanes[\"mySectionPlane2\"];\n *\n * // Programmatically reposition one of our SectionPlanes\n * // This also updates its position as shown in the overview gizmo\n *\n * mySectionPlane2.pos = [11.0, 6.0, -12];\n * mySectionPlane2.dir = [0.4, 0.0, 0.5];\n * ````\n */\nclass SectionPlanesPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"SectionPlanes\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.\n * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"SectionPlanes\", viewer);\n\n this._freeControls = [];\n this._sectionPlanes = viewer.scene.sectionPlanes;\n this._controls = {};\n this._shownControlId = null;\n\n if (cfg.overviewCanvasId !== null && cfg.overviewCanvasId !== undefined) {\n\n const overviewCanvas = document.getElementById(cfg.overviewCanvasId);\n\n if (!overviewCanvas) {\n this.warn(\"Can't find overview canvas: '\" + cfg.overviewCanvasId + \"' - will create plugin without overview\");\n\n } else {\n\n this._overview = new Overview(this, {\n overviewCanvas: overviewCanvas,\n visible: cfg.overviewVisible,\n\n onHoverEnterPlane: ((id) => {\n this._overview.setPlaneHighlighted(id, true);\n }),\n\n onHoverLeavePlane: ((id) => {\n this._overview.setPlaneHighlighted(id, false);\n }),\n\n onClickedPlane: ((id) => {\n if (this.getShownControl() === id) {\n this.hideControl();\n return;\n }\n this.showControl(id);\n const sectionPlane = this.sectionPlanes[id];\n const sectionPlanePos = sectionPlane.pos;\n tempAABB.set(this.viewer.scene.aabb);\n math.getAABB3Center(tempAABB, tempVec3);\n tempAABB[0] += sectionPlanePos[0] - tempVec3[0];\n tempAABB[1] += sectionPlanePos[1] - tempVec3[1];\n tempAABB[2] += sectionPlanePos[2] - tempVec3[2];\n tempAABB[3] += sectionPlanePos[0] - tempVec3[0];\n tempAABB[4] += sectionPlanePos[1] - tempVec3[1];\n tempAABB[5] += sectionPlanePos[2] - tempVec3[2];\n this.viewer.cameraFlight.flyTo({\n aabb: tempAABB,\n fitFOV: 65\n });\n }),\n\n onClickedNothing: (() => {\n this.hideControl();\n })\n });\n }\n }\n\n this._onSceneSectionPlaneCreated = viewer.scene.on(\"sectionPlaneCreated\", (sectionPlane) => {\n\n // SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly\n // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done\n // by BCFViewpointsPlugin#loadViewpoint().\n\n this._sectionPlaneCreated(sectionPlane);\n });\n }\n\n /**\n * Sets if the overview canvas is visible.\n *\n * @param {Boolean} visible Whether or not the overview canvas is visible.\n */\n setOverviewVisible(visible) {\n if (this._overview) {\n this._overview.setVisible(visible);\n }\n }\n\n /**\n * Gets if the overview canvas is visible.\n *\n * @return {Boolean} True when the overview canvas is visible.\n */\n getOverviewVisible() {\n if (this._overview) {\n return this._overview.getVisible();\n }\n }\n\n /**\n * Returns a map of the {@link SectionPlane}s created by this SectionPlanesPlugin.\n *\n * @returns {{String:SectionPlane}} A map containing the {@link SectionPlane}s, each mapped to its {@link SectionPlane#id}.\n */\n get sectionPlanes() {\n return this._sectionPlanes;\n }\n\n /**\n * Creates a {@link SectionPlane}.\n *\n * The {@link SectionPlane} will be registered by {@link SectionPlane#id} in {@link SectionPlanesPlugin#sectionPlanes}.\n *\n * @param {Object} params {@link SectionPlane} configuration.\n * @param {String} [params.id] Unique ID to assign to the {@link SectionPlane}. Must be unique among all components in the {@link Viewer}'s {@link Scene}. Auto-generated when omitted.\n * @param {Number[]} [params.pos=[0,0,0]] World-space position of the {@link SectionPlane}.\n * @param {Number[]} [params.dir=[0,0,-1]] World-space vector indicating the orientation of the {@link SectionPlane}.\n * @param {Boolean} [params.active=true] Whether the {@link SectionPlane} is initially active. Only clips while this is true.\n * @returns {SectionPlane} The new {@link SectionPlane}.\n */\n createSectionPlane(params = {}) {\n\n if (params.id !== undefined && params.id !== null && this.viewer.scene.components[params.id]) {\n this.error(\"Viewer component with this ID already exists: \" + params.id);\n delete params.id;\n }\n\n // Note that SectionPlane constructor fires \"sectionPlaneCreated\" on the Scene,\n // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.\n\n const sectionPlane = new SectionPlane(this.viewer.scene, {\n id: params.id,\n pos: params.pos,\n dir: params.dir,\n active: true || params.active\n });\n return sectionPlane;\n }\n\n _sectionPlaneCreated(sectionPlane) {\n const control = (this._freeControls.length > 0) ? this._freeControls.pop() : new Control(this);\n control._setSectionPlane(sectionPlane);\n control.setVisible(false);\n this._controls[sectionPlane.id] = control;\n if (this._overview) {\n this._overview.addSectionPlane(sectionPlane);\n }\n sectionPlane.once(\"destroyed\", () => {\n this._sectionPlaneDestroyed(sectionPlane);\n });\n }\n\n /**\n * Inverts the direction of {@link SectionPlane#dir} on every existing SectionPlane.\n *\n * Inverts all SectionPlanes, including those that were not created with SectionPlanesPlugin.\n */\n flipSectionPlanes() {\n const sectionPlanes = this.viewer.scene.sectionPlanes;\n for (let id in sectionPlanes) {\n const sectionPlane = sectionPlanes[id];\n sectionPlane.flipDir();\n }\n }\n\n /**\n * Shows the 3D editing gizmo for a {@link SectionPlane}.\n *\n * @param {String} id ID of the {@link SectionPlane}.\n */\n showControl(id) {\n const control = this._controls[id];\n if (!control) {\n this.error(\"Control not found: \" + id);\n return;\n }\n this.hideControl();\n control.setVisible(true);\n if (this._overview) {\n this._overview.setPlaneSelected(id, true);\n }\n this._shownControlId = id;\n }\n\n /**\n * Gets the ID of the {@link SectionPlane} that the 3D editing gizmo is shown for.\n *\n * Returns ````null```` when the editing gizmo is not shown.\n *\n * @returns {String} ID of the the {@link SectionPlane} that the 3D editing gizmo is shown for, if shown, else ````null````.\n */\n getShownControl() {\n return this._shownControlId;\n }\n\n /**\n * Hides the 3D {@link SectionPlane} editing gizmo if shown.\n */\n hideControl() {\n for (var id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setVisible(false);\n if (this._overview) {\n this._overview.setPlaneSelected(id, false);\n }\n }\n }\n this._shownControlId = null;\n }\n\n /**\n * Destroys a {@link SectionPlane} created by this SectionPlanesPlugin.\n *\n * @param {String} id ID of the {@link SectionPlane}.\n */\n destroySectionPlane(id) {\n var sectionPlane = this.viewer.scene.sectionPlanes[id];\n if (!sectionPlane) {\n this.error(\"SectionPlane not found: \" + id);\n return;\n }\n this._sectionPlaneDestroyed(sectionPlane);\n sectionPlane.destroy();\n\n if (id === this._shownControlId) {\n this._shownControlId = null;\n }\n }\n\n _sectionPlaneDestroyed(sectionPlane) {\n if (this._overview) {\n this._overview.removeSectionPlane(sectionPlane);\n }\n const control = this._controls[sectionPlane.id];\n if (!control) {\n return;\n }\n control.setVisible(false);\n control._setSectionPlane(null);\n delete this._controls[sectionPlane.id];\n this._freeControls.push(control);\n }\n\n /**\n * Destroys all {@link SectionPlane}s created by this SectionPlanesPlugin.\n */\n clear() {\n const ids = Object.keys(this._sectionPlanes);\n for (var i = 0, len = ids.length; i < len; i++) {\n this.destroySectionPlane(ids[i]);\n }\n }\n\n /**\n * @private\n */\n send(name, value) {\n switch (name) {\n\n case \"snapshotStarting\": // Viewer#getSnapshot() about to take snapshot - hide controls\n for (let id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setCulled(true);\n }\n }\n break;\n\n case \"snapshotFinished\": // Viewer#getSnapshot() finished taking snapshot - show controls again\n for (let id in this._controls) {\n if (this._controls.hasOwnProperty(id)) {\n this._controls[id].setCulled(false);\n }\n }\n break;\n\n case \"clearSectionPlanes\":\n this.clear();\n break;\n }\n }\n\n /**\n * Destroys this SectionPlanesPlugin.\n *\n * Also destroys each {@link SectionPlane} created by this SectionPlanesPlugin.\n *\n * Does not destroy the canvas the SectionPlanesPlugin was configured with.\n */\n destroy() {\n this.clear();\n if (this._overview) {\n this._overview.destroy();\n }\n this._destroyFreeControls();\n super.destroy();\n }\n\n _destroyFreeControls() {\n var control = this._freeControls.pop();\n while (control) {\n control._destroy();\n control = this._freeControls.pop();\n }\n this.viewer.scene.off(this._onSceneSectionPlaneCreated);\n }\n}\n\nexport {SectionPlanesPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1420, + "__docId__": 1428, "kind": "variable", "name": "tempAABB", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", @@ -25642,7 +25858,7 @@ "ignore": true }, { - "__docId__": 1421, + "__docId__": 1429, "kind": "variable", "name": "tempVec3", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", @@ -25663,7 +25879,7 @@ "ignore": true }, { - "__docId__": 1422, + "__docId__": 1430, "kind": "class", "name": "SectionPlanesPlugin", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js", @@ -25681,7 +25897,7 @@ ] }, { - "__docId__": 1423, + "__docId__": 1431, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25756,7 +25972,7 @@ ] }, { - "__docId__": 1424, + "__docId__": 1432, "kind": "member", "name": "_freeControls", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25774,7 +25990,7 @@ } }, { - "__docId__": 1425, + "__docId__": 1433, "kind": "member", "name": "_sectionPlanes", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25792,7 +26008,7 @@ } }, { - "__docId__": 1426, + "__docId__": 1434, "kind": "member", "name": "_controls", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25810,7 +26026,7 @@ } }, { - "__docId__": 1427, + "__docId__": 1435, "kind": "member", "name": "_shownControlId", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25828,7 +26044,7 @@ } }, { - "__docId__": 1428, + "__docId__": 1436, "kind": "member", "name": "_overview", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25846,7 +26062,7 @@ } }, { - "__docId__": 1429, + "__docId__": 1437, "kind": "member", "name": "_onSceneSectionPlaneCreated", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25864,7 +26080,7 @@ } }, { - "__docId__": 1430, + "__docId__": 1438, "kind": "method", "name": "setOverviewVisible", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25890,7 +26106,7 @@ "return": null }, { - "__docId__": 1431, + "__docId__": 1439, "kind": "method", "name": "getOverviewVisible", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25912,7 +26128,7 @@ "params": [] }, { - "__docId__": 1432, + "__docId__": 1440, "kind": "get", "name": "sectionPlanes", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -25944,7 +26160,7 @@ } }, { - "__docId__": 1433, + "__docId__": 1441, "kind": "method", "name": "createSectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26037,7 +26253,7 @@ } }, { - "__docId__": 1434, + "__docId__": 1442, "kind": "method", "name": "_sectionPlaneCreated", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26061,7 +26277,7 @@ "return": null }, { - "__docId__": 1435, + "__docId__": 1443, "kind": "method", "name": "flipSectionPlanes", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26076,7 +26292,7 @@ "return": null }, { - "__docId__": 1436, + "__docId__": 1444, "kind": "method", "name": "showControl", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26102,7 +26318,7 @@ "return": null }, { - "__docId__": 1438, + "__docId__": 1446, "kind": "method", "name": "getShownControl", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26130,7 +26346,7 @@ "params": [] }, { - "__docId__": 1439, + "__docId__": 1447, "kind": "method", "name": "hideControl", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26145,7 +26361,7 @@ "return": null }, { - "__docId__": 1441, + "__docId__": 1449, "kind": "method", "name": "destroySectionPlane", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26171,7 +26387,7 @@ "return": null }, { - "__docId__": 1443, + "__docId__": 1451, "kind": "method", "name": "_sectionPlaneDestroyed", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26195,7 +26411,7 @@ "return": null }, { - "__docId__": 1444, + "__docId__": 1452, "kind": "method", "name": "clear", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26210,7 +26426,7 @@ "return": null }, { - "__docId__": 1445, + "__docId__": 1453, "kind": "method", "name": "send", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26239,7 +26455,7 @@ "return": null }, { - "__docId__": 1446, + "__docId__": 1454, "kind": "method", "name": "destroy", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26254,7 +26470,7 @@ "return": null }, { - "__docId__": 1447, + "__docId__": 1455, "kind": "method", "name": "_destroyFreeControls", "memberof": "src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js~SectionPlanesPlugin", @@ -26271,29 +26487,29 @@ "return": null }, { - "__docId__": 1448, + "__docId__": 1456, "kind": "file", "name": "src/plugins/SectionPlanesPlugin/index.js", "content": "export * from \"./SectionPlanesPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SectionPlanesPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SectionPlanesPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1449, + "__docId__": 1457, "kind": "file", "name": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {Skybox} from \"../../viewer/scene/skybox/Skybox.js\"\n\n/**\n * {@link Viewer} plugin that manages skyboxes\n *\n * @example\n *\n * // Create a Viewer\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Add a GLTFModelsPlugin\n * var gltfLoaderPlugin = new GLTFModelsPlugin(viewer, {\n * id: \"GLTFModels\" // Default value\n * });\n *\n * // Add a SkyboxesPlugin\n * var skyboxesPlugin = new SkyboxesPlugin(viewer, {\n * id: \"Skyboxes\" // Default value\n * });\n *\n * // Load a glTF model\n * const model = gltfLoaderPlugin.load({\n * id: \"myModel\",\n * src: \"./models/gltf/mygltfmodel.gltf\"\n * });\n *\n * // Create three directional World-space lights. \"World\" means that they will appear as if part\n * // of the world, instead of \"View\", where they move with the user's head.\n *\n * skyboxesPlugin.createLight({\n * id: \"keyLight\",\n * dir: [0.8, -0.6, -0.8],\n * color: [1.0, 0.3, 0.3],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * skyboxesPlugin.createLight({\n * id: \"fillLight\",\n * dir: [-0.8, -0.4, -0.4],\n * color: [0.3, 1.0, 0.3],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * skyboxesPlugin.createDirLight({\n * id: \"rimLight\",\n * dir: [0.2, -0.8, 0.8],\n * color: [0.6, 0.6, 0.6],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * @class SkyboxesPlugin\n */\nclass SkyboxesPlugin extends Plugin {\n\n constructor(viewer) {\n super(\"skyboxes\", viewer);\n this.skyboxes = {};\n }\n\n /**\n * @private\n */\n send(name, value) {\n switch (name) {\n case \"clear\":\n this.clear();\n break;\n }\n }\n\n /**\n Creates a skybox.\n\n @param {String} id Unique ID to assign to the skybox.\n @param {Object} params Skybox configuration.\n @param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.\n @returns {Skybox} The new skybox.\n */\n createSkybox(id, params) {\n if (this.viewer.scene.components[id]) {\n this.error(\"Component with this ID already exists: \" + id);\n return this;\n }\n var skybox = new Skybox(this.viewer.scene, {\n id: id,\n pos: params.pos,\n dir: params.dir,\n active: true || params.active\n });\n this.skyboxes[id] = skybox;\n return skybox;\n }\n\n /**\n Destroys a skybox.\n @param id\n */\n destroySkybox(id) {\n var skybox = this.skyboxes[id];\n if (!skybox) {\n this.error(\"Skybox not found: \" + id);\n return;\n }\n skybox.destroy();\n }\n\n /**\n Destroys all skyboxes.\n */\n clear() {\n var ids = Object.keys(this.viewer.scene.skyboxes);\n for (var i = 0, len = ids.length; i < len; i++) {\n this.destroySkybox(ids[i]);\n }\n }\n\n /**\n * Destroys this plugin.\n *\n * Clears skyboxes from the Viewer first.\n */\n destroy() {\n this.clear();\n super.clear();\n }\n}\n\nexport {SkyboxesPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1450, + "__docId__": 1458, "kind": "class", "name": "SkyboxesPlugin", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js", @@ -26320,7 +26536,7 @@ ] }, { - "__docId__": 1451, + "__docId__": 1459, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26334,7 +26550,7 @@ "undocument": true }, { - "__docId__": 1452, + "__docId__": 1460, "kind": "member", "name": "skyboxes", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26351,7 +26567,7 @@ } }, { - "__docId__": 1453, + "__docId__": 1461, "kind": "method", "name": "send", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26380,7 +26596,7 @@ "return": null }, { - "__docId__": 1454, + "__docId__": 1462, "kind": "method", "name": "createSkybox", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26441,7 +26657,7 @@ } }, { - "__docId__": 1455, + "__docId__": 1463, "kind": "method", "name": "destroySkybox", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26467,7 +26683,7 @@ "return": null }, { - "__docId__": 1456, + "__docId__": 1464, "kind": "method", "name": "clear", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26482,7 +26698,7 @@ "return": null }, { - "__docId__": 1457, + "__docId__": 1465, "kind": "method", "name": "destroy", "memberof": "src/plugins/SkyboxesPlugin/SkyboxesPlugin.js~SkyboxesPlugin", @@ -26497,29 +26713,29 @@ "return": null }, { - "__docId__": 1458, + "__docId__": 1466, "kind": "file", "name": "src/plugins/SkyboxesPlugin/index.js", "content": "export * from \"./SkyboxesPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/SkyboxesPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/SkyboxesPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1459, + "__docId__": 1467, "kind": "file", "name": "src/plugins/StoreyViewsPlugin/Storey.js", "content": "/**\n * @desc Information about an ````IfcBuildingStorey````.\n *\n * These are provided by a {@link StoreyViewsPlugin}.\n */\nclass Storey {\n\n /**\n * @private\n */\n constructor(plugin, modelAABB, storeyAABB, modelId, storeyId, numObjects) {\n\n /**\n * The {@link StoreyViewsPlugin} this Storey belongs to.\n *\n * @property plugin\n * @type {StoreyViewsPlugin}\n */\n this.plugin = plugin;\n\n /**\n * ID of the IfcBuildingStorey.\n *\n * This matches IDs of the IfcBuildingStorey's {@link MetaObject} and {@link Entity}.\n *\n * @property storeyId\n * @type {String}\n */\n this.storeyId = storeyId;\n\n /**\n * ID of the model.\n *\n * This matches the ID of the {@link MetaModel} that contains the IfcBuildingStorey's {@link MetaObject}.\n *\n * @property modelId\n * @type {String|Number}\n */\n this.modelId = modelId;\n\n /**\n * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.\n *\n * The boundary is a six-element Float32Array containing the min/max extents of the\n * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````\n *\n * @property storeyAABB\n * @type {Number[]}\n */\n this.storeyAABB = storeyAABB.slice();\n\n /**\n * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.\n *\n * The boundary is a six-element Float32Array containing the min/max extents of the\n * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````\n *\n * @deprecated\n * @property storeyAABB\n * @type {Number[]}\n */\n this.aabb = this.storeyAABB;\n\n /**\n * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.\n *\n * The boundary is a six-element Float32Array containing the min/max extents of the\n * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````\n *\n * @property modelAABB\n * @type {Number[]}\n */\n this.modelAABB = modelAABB.slice();\n\n /** Number of {@link Entity}s within the IfcBuildingStorey.\n *\n * @property numObjects\n * @type {Number}\n */\n this.numObjects = numObjects;\n }\n}\n\nexport {Storey};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/StoreyViewsPlugin/Storey.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/StoreyViewsPlugin/Storey.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1460, + "__docId__": 1468, "kind": "class", "name": "Storey", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js", @@ -26534,7 +26750,7 @@ "interface": false }, { - "__docId__": 1461, + "__docId__": 1469, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26548,7 +26764,7 @@ "ignore": true }, { - "__docId__": 1462, + "__docId__": 1470, "kind": "member", "name": "plugin", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26579,7 +26795,7 @@ } }, { - "__docId__": 1463, + "__docId__": 1471, "kind": "member", "name": "storeyId", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26610,7 +26826,7 @@ } }, { - "__docId__": 1464, + "__docId__": 1472, "kind": "member", "name": "modelId", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26642,7 +26858,7 @@ } }, { - "__docId__": 1465, + "__docId__": 1473, "kind": "member", "name": "storeyAABB", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26673,7 +26889,7 @@ } }, { - "__docId__": 1466, + "__docId__": 1474, "kind": "member", "name": "aabb", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26705,7 +26921,7 @@ } }, { - "__docId__": 1467, + "__docId__": 1475, "kind": "member", "name": "modelAABB", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26736,7 +26952,7 @@ } }, { - "__docId__": 1468, + "__docId__": 1476, "kind": "member", "name": "numObjects", "memberof": "src/plugins/StoreyViewsPlugin/Storey.js~Storey", @@ -26767,18 +26983,18 @@ } }, { - "__docId__": 1469, + "__docId__": 1477, "kind": "file", "name": "src/plugins/StoreyViewsPlugin/StoreyMap.js", "content": "/**\n * @desc A 2D plan view image of an ````IfcBuildingStorey````.\n *\n * These are created by a {@link StoreyViewsPlugin}.\n */\nclass StoreyMap {\n\n /**\n * @private\n */\n constructor(storeyId, imageData, format, width, height, padding) {\n\n /**\n * ID of the IfcBuildingStorey.\n *\n * This matches IDs of the IfcBuildingStorey's {@link MetaObject} and {@link Entity}.\n *\n * @property storeyId\n * @type {String}\n */\n this.storeyId = storeyId;\n\n /**\n * Base64-encoded plan view image.\n *\n * @property imageData\n * @type {String}\n */\n this.imageData = imageData;\n\n /**\n * The image format - \"png\" or \"jpeg\".\n *\n * @property format\n * @type {String}\n */\n this.format = format;\n\n /**\n * Width of the image, in pixels.\n *\n * @property width\n * @type {Number}\n */\n this.width = width;\n\n /**\n * Height of the image, in pixels.\n *\n * @property height\n * @type {Number}\n */\n this.height = height;\n }\n}\n\nexport {StoreyMap};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/StoreyViewsPlugin/StoreyMap.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/StoreyViewsPlugin/StoreyMap.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1470, + "__docId__": 1478, "kind": "class", "name": "StoreyMap", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js", @@ -26793,7 +27009,7 @@ "interface": false }, { - "__docId__": 1471, + "__docId__": 1479, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26807,7 +27023,7 @@ "ignore": true }, { - "__docId__": 1472, + "__docId__": 1480, "kind": "member", "name": "storeyId", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26838,7 +27054,7 @@ } }, { - "__docId__": 1473, + "__docId__": 1481, "kind": "member", "name": "imageData", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26869,7 +27085,7 @@ } }, { - "__docId__": 1474, + "__docId__": 1482, "kind": "member", "name": "format", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26900,7 +27116,7 @@ } }, { - "__docId__": 1475, + "__docId__": 1483, "kind": "member", "name": "width", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26931,7 +27147,7 @@ } }, { - "__docId__": 1476, + "__docId__": 1484, "kind": "member", "name": "height", "memberof": "src/plugins/StoreyViewsPlugin/StoreyMap.js~StoreyMap", @@ -26962,18 +27178,18 @@ } }, { - "__docId__": 1477, + "__docId__": 1485, "kind": "file", "name": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {Storey} from \"./Storey.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {ObjectsMemento} from \"../../viewer/scene/mementos/ObjectsMemento.js\";\nimport {CameraMemento} from \"../../viewer/scene/mementos/CameraMemento.js\";\nimport {StoreyMap} from \"./StoreyMap.js\";\nimport {utils} from \"../../viewer/scene/utils.js\";\n\nconst tempVec3a = math.vec3();\nconst tempMat4 = math.mat4();\n\nconst EMPTY_IMAGE = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==\";\n\n\n/**\n * @desc A {@link Viewer} plugin that provides methods for visualizing IfcBuildingStoreys.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/navigation/#StoreyViewsPlugin_recipe3)]\n *\n * ## Overview\n *\n * StoreyViewsPlugin provides a flexible set of methods for visualizing building storeys in 3D and 2D.\n *\n * Use the first two methods to set up 3D views of storeys:\n *\n * * [showStoreyObjects](#instance-method-showStoreyObjects) - shows the {@link Entity}s within a storey, and\n * * [gotoStoreyCamera](#instance-method-gotoStoreyCamera) - positions the {@link Camera} for a plan view of the Entitys within a storey.\n *

\n *\n * Use the second two methods to create 2D plan view mini-map images:\n *\n * * [createStoreyMap](#instance-method-createStoreyMap) - creates a 2D plan view image of a storey, and\n * * [pickStoreyMap](#instance-method-pickStoreyMap) - picks the {@link Entity} at the given 2D pixel coordinates within a plan view image.\n *\n * ## Usage\n *\n * Let's start by creating a {@link Viewer} with a StoreyViewsPlugin and an {@link XKTLoaderPlugin}.\n *\n * Then we'll load a BIM building model from an ```.xkt``` file.\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, StoreyViewsPlugin} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer, arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * // Add an XKTLoaderPlugin\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * // Add a StoreyViewsPlugin\n *\n * const storeyViewsPlugin = new StoreyViewsPlugin(viewer);\n *\n * // Load a BIM model from .xkt format\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n * ````\n *\n * ## Finding Storeys\n *\n * Getting information on a storey in our model:\n *\n * ````javascript\n * const storey = storeyViewsPlugin.storeys[\"2SWZMQPyD9pfT9q87pgXa1\"]; // ID of the IfcBuildingStorey\n *\n * const modelId = storey.modelId; // \"myModel\"\n * const storeyId = storey.storeyId; // \"2SWZMQPyD9pfT9q87pgXa1\"\n * const aabb = storey.aabb; // Axis-aligned 3D World-space boundary of the IfcBuildingStorey\n * ````\n *\n * We can also get a \"storeys\" event every time the set of storeys changes, ie. every time a storey is created or destroyed:\n *\n * ````javascript\n * storeyViewsPlugin.on(\"storeys\", ()=> {\n * const storey = storeyViewsPlugin.storeys[\"2SWZMQPyD9pfT9q87pgXa1\"];\n * //...\n * });\n * ````\n *\n * ## Showing Entitys within Storeys\n *\n * Showing the {@link Entity}s within a storey:\n *\n * ````javascript\n * storeyViewsPlugin.showStoreyObjects(\"2SWZMQPyD9pfT9q87pgXa1\");\n * ````\n *\n * Showing **only** the Entitys in a storey, hiding all others:\n *\n * ````javascript\n * storeyViewsPlugin.showStoreyObjects(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * hideOthers: true\n * });\n * ````\n * Showing only the storey Entitys:\n *\n * ````javascript\n * storeyViewsPlugin.showStoreyObjects(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * hideOthers: true\n * });\n * ````\n *\n * When using this option, at some point later you'll probably want to restore all Entitys to their original visibilities and\n * appearances.\n *\n * To do that, save their visibility and appearance states in an {@link ObjectsMemento} beforehand, from\n * which you can restore them later:\n *\n * ````javascript\n * const objectsMemento = new ObjectsMemento();\n *\n * // Save all Entity visibility and appearance states\n *\n * objectsMemento.saveObjects(viewer.scene);\n *\n * // Show storey view Entitys\n *\n * storeyViewsPlugin.showStoreyObjects(\"2SWZMQPyD9pfT9q87pgXa1\");\n *\n * //...\n *\n * // Later, restore all Entitys to their saved visibility and appearance states\n * objectsMemento.restoreObjects(viewer.scene);\n * ````\n *\n * ## Arranging the Camera for Storey Plan Views\n *\n * The {@link StoreyViewsPlugin#gotoStoreyCamera} method positions the {@link Camera} for a plan view of\n * the {@link Entity}s within the given storey.\n *\n * Let's fly the {@link Camera} to a downward-looking orthographic view of the Entitys within our storey.\n *\n * ````javascript\n * storeyViewsPlugin.gotoStoreyCamera(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * projection: \"ortho\", // Orthographic projection\n * duration: 2.5, // 2.5 second transition\n * done: () => {\n * viewer.cameraControl.planView = true; // Disable rotation\n * }\n * });\n * ````\n *\n * Note that we also set {@link CameraControl#planView} ````true````, which prevents the CameraControl from rotating\n * or orbiting. In orthographic mode, this effectively makes the {@link Viewer} behave as if it were a 2D viewer, with\n * picking, panning and zooming still enabled.\n *\n * If you need to be able to restore the Camera to its previous state, you can save it to a {@link CameraMemento}\n * beforehand, from which you can restore it later:\n *\n * ````javascript\n * const cameraMemento = new CameraMemento();\n *\n * // Save camera state\n *\n * cameraMemento.saveCamera(viewer.scene);\n *\n * // Position camera for a downward-looking orthographic view of our storey\n *\n * storeyViewsPlugin.gotoStoreyCamera(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * projection: \"ortho\",\n * duration: 2.5,\n * done: () => {\n * viewer.cameraControl.planView = true; // Disable rotation\n * }\n * });\n *\n * //...\n *\n * // Later, restore the Camera to its saved state\n * cameraMemento.restoreCamera(viewer.scene);\n * ````\n *\n * ## Creating StoreyMaps\n *\n * The {@link StoreyViewsPlugin#createStoreyMap} method creates a 2D orthographic plan image of the given storey.\n *\n * This method creates a {@link StoreyMap}, which provides the plan image as a Base64-encoded string.\n *\n * Let's create a 2D plan image of our building storey:\n *\n * ````javascript\n * const storeyMap = storeyViewsPlugin.createStoreyMap(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * width: 300,\n * format: \"png\"\n * });\n *\n * const imageData = storeyMap.imageData; // Base64-encoded image data string\n * const width = storeyMap.width; // 300\n * const height = storeyMap.height; // Automatically derived from width\n * const format = storeyMap.format; // \"png\"\n * ````\n *\n * We can also specify a ````height```` for the plan image, as an alternative to ````width````:\n *\n * ````javascript\n * const storeyMap = storeyViewsPlugin.createStoreyMap(\"2SWZMQPyD9pfT9q87pgXa1\", {\n * height: 200,\n * format: \"png\"\n * });\n * ````\n *\n * ## Picking Entities in StoreyMaps\n *\n * We can use {@link StoreyViewsPlugin#pickStoreyMap} to pick Entities in our building storey, using 2D coordinates from mouse or touch events on our {@link StoreyMap}'s 2D plan image.\n *\n * Let's programmatically pick the Entity at the given 2D pixel coordinates within our image:\n *\n * ````javascript\n * const mouseCoords = [65, 120]; // Mouse coords within the image extents\n *\n * const pickResult = storeyViewsPlugin.pickStoreyMap(storeyMap, mouseCoords);\n *\n * if (pickResult && pickResult.entity) {\n * pickResult.entity.highlighted = true;\n * }\n * ````\n */\nclass StoreyViewsPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"StoreyViews\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Boolean} [cfg.fitStoreyMaps=false] If enabled, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different floor map images. If disabled, each floor map image will display the model's extents, ensuring a consistent scale across all images.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"StoreyViews\", viewer);\n\n this._objectsMemento = new ObjectsMemento();\n this._cameraMemento = new CameraMemento();\n\n /**\n * A {@link Storey} for each ````IfcBuildingStorey```.\n *\n * There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals \"IfcBuildingStorey\".\n *\n * These are created and destroyed automatically as models are loaded and destroyed.\n *\n * @type {{String:Storey}}\n */\n this.storeys = {};\n\n /**\n * A set of {@link Storey}s for each {@link MetaModel}.\n *\n * These are created and destroyed automatically as models are loaded and destroyed.\n *\n * @type {{String: {String:Storey}}}\n */\n this.modelStoreys = {};\n\n this._fitStoreyMaps = (!!cfg.fitStoreyMaps);\n\n this._onModelLoaded = this.viewer.scene.on(\"modelLoaded\", (modelId) => {\n this._registerModelStoreys(modelId);\n this.fire(\"storeys\", this.storeys);\n });\n }\n\n _registerModelStoreys(modelId) {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const metaScene = viewer.metaScene;\n const metaModel = metaScene.metaModels[modelId];\n const model = scene.models[modelId];\n if (!metaModel || !metaModel.rootMetaObjects) {\n return;\n }\n const rootMetaObjects = metaModel.rootMetaObjects;\n for (let j = 0, lenj = rootMetaObjects.length; j < lenj; j++) {\n const storeyIds = rootMetaObjects[j].getObjectIDsInSubtreeByType([\"IfcBuildingStorey\"]);\n for (let i = 0, len = storeyIds.length; i < len; i++) {\n const storeyId = storeyIds[i];\n const metaObject = metaScene.metaObjects[storeyId];\n const childObjectIds = metaObject.getObjectIDsInSubtree();\n const storeyAABB = scene.getAABB(childObjectIds);\n const numObjects = (Math.random() > 0.5) ? childObjectIds.length : 0;\n const storey = new Storey(this, model.aabb, storeyAABB, modelId, storeyId, numObjects);\n storey._onModelDestroyed = model.once(\"destroyed\", () => {\n this._deregisterModelStoreys(modelId);\n this.fire(\"storeys\", this.storeys);\n });\n this.storeys[storeyId] = storey;\n if (!this.modelStoreys[modelId]) {\n this.modelStoreys[modelId] = {};\n }\n this.modelStoreys[modelId][storeyId] = storey;\n }\n }\n }\n\n _deregisterModelStoreys(modelId) {\n const storeys = this.modelStoreys[modelId];\n if (storeys) {\n const scene = this.viewer.scene;\n for (let storyObjectId in storeys) {\n if (storeys.hasOwnProperty(storyObjectId)) {\n const storey = storeys[storyObjectId];\n const model = scene.models[storey.modelId];\n if (model) {\n model.off(storey._onModelDestroyed);\n }\n delete this.storeys[storyObjectId];\n }\n }\n delete this.modelStoreys[modelId];\n }\n }\n\n /**\n * When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different\n * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.\n * @returns {*|boolean}\n */\n get fitStoreyMaps() {\n return this._fitStoreyMaps;\n }\n\n /**\n * Arranges the {@link Camera} for a 3D orthographic view of the {@link Entity}s within the given storey.\n *\n * See also: {@link CameraMemento}, which saves and restores the state of the {@link Scene}'s {@link Camera}\n *\n * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.\n * @param {*} [options] Options for arranging the Camera.\n * @param {String} [options.projection] Projection type to transition the Camera to. Accepted values are \"perspective\" and \"ortho\".\n * @param {Function} [options.done] Callback to fire when the Camera has arrived. When provided, causes an animated flight to the saved state. Otherwise jumps to the saved state.\n */\n gotoStoreyCamera(storeyId, options = {}) {\n\n const storey = this.storeys[storeyId];\n\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n if (options.done) {\n options.done();\n }\n return;\n }\n\n const viewer = this.viewer;\n const scene = viewer.scene;\n const camera = scene.camera;\n const storeyAABB = storey.storeyAABB;\n\n if (storeyAABB[3] < storeyAABB[0] || storeyAABB[4] < storeyAABB[1] || storeyAABB[5] < storeyAABB[2]) { // Don't fly to an inverted boundary\n if (options.done) {\n options.done();\n }\n return;\n }\n if (storeyAABB[3] === storeyAABB[0] && storeyAABB[4] === storeyAABB[1] && storeyAABB[5] === storeyAABB[2]) { // Don't fly to an empty boundary\n if (options.done) {\n options.done();\n }\n return;\n }\n const look2 = math.getAABB3Center(storeyAABB);\n const diag = math.getAABB3Diag(storeyAABB);\n const fitFOV = 45; // fitFOV;\n const sca = Math.abs(diag / Math.tan(fitFOV * math.DEGTORAD));\n\n const orthoScale2 = diag * 1.3;\n\n const eye2 = tempVec3a;\n\n eye2[0] = look2[0] + (camera.worldUp[0] * sca);\n eye2[1] = look2[1] + (camera.worldUp[1] * sca);\n eye2[2] = look2[2] + (camera.worldUp[2] * sca);\n\n const up2 = camera.worldForward;\n\n if (options.done) {\n\n viewer.cameraFlight.flyTo(utils.apply(options, {\n eye: eye2,\n look: look2,\n up: up2,\n orthoScale: orthoScale2\n }), () => {\n options.done();\n });\n\n } else {\n\n viewer.cameraFlight.jumpTo(utils.apply(options, {\n eye: eye2,\n look: look2,\n up: up2,\n orthoScale: orthoScale2\n }));\n\n viewer.camera.ortho.scale = orthoScale2;\n }\n }\n\n /**\n * Shows the {@link Entity}s within the given storey.\n *\n * Optionally hides all other Entitys.\n *\n * See also: {@link ObjectsMemento}, which saves and restores a memento of the visual state\n * of the {@link Entity}'s that represent objects within a {@link Scene}.\n *\n * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.\n * @param {*} [options] Options for showing the Entitys within the storey.\n * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.\n */\n showStoreyObjects(storeyId, options = {}) {\n\n const storey = this.storeys[storeyId];\n\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n return;\n }\n\n const viewer = this.viewer;\n const scene = viewer.scene;\n const metaScene = viewer.metaScene;\n const storeyMetaObject = metaScene.metaObjects[storeyId];\n\n if (!storeyMetaObject) {\n return;\n }\n\n if (options.hideOthers) {\n scene.setObjectsVisible(viewer.scene.visibleObjectIds, false);\n }\n\n this.withStoreyObjects(storeyId, (entity, metaObject) => {\n if (entity) {\n entity.visible = true;\n }\n });\n }\n\n /**\n * Executes a callback on each of the objects within the given storey.\n *\n * ## Usage\n *\n * In the example below, we'll show all the {@link Entity}s, within the given ````IfcBuildingStorey````,\n * that have {@link MetaObject}s with type ````IfcSpace````. Note that the callback will only be given\n * an {@link Entity} when one exists for the given {@link MetaObject}.\n *\n * ````JavaScript\n * myStoreyViewsPlugin.withStoreyObjects(storeyId, (entity, metaObject) => {\n * if (entity && metaObject && metaObject.type === \"IfcSpace\") {\n * entity.visible = true;\n * }\n * });\n * ````\n *\n * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.\n * @param {Function} callback The callback.\n */\n withStoreyObjects(storeyId, callback) {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const metaScene = viewer.metaScene;\n const rootMetaObject = metaScene.metaObjects[storeyId];\n if (!rootMetaObject) {\n return;\n }\n const storeySubObjects = rootMetaObject.getObjectIDsInSubtree();\n for (var i = 0, len = storeySubObjects.length; i < len; i++) {\n const objectId = storeySubObjects[i];\n const metaObject = metaScene.metaObjects[objectId];\n const entity = scene.objects[objectId];\n if (entity) {\n callback(entity, metaObject);\n }\n }\n }\n\n /**\n * Creates a 2D map of the given storey.\n *\n * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.\n * @param {*} [options] Options for creating the image.\n * @param {Number} [options.width=300] Image width in pixels. Height will be automatically determined from this, if not given.\n * @param {Number} [options.height=300] Image height in pixels, as an alternative to width. Width will be automatically determined from this, if not given.\n * @param {String} [options.format=\"png\"] Image format. Accepted values are \"png\" and \"jpeg\".\n * @returns {StoreyMap} The StoreyMap.\n */\n createStoreyMap(storeyId, options = {}) {\n\n const storey = this.storeys[storeyId];\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n return EMPTY_IMAGE;\n }\n\n const viewer = this.viewer;\n const scene = viewer.scene;\n const format = options.format || \"png\";\n const aabb = (this._fitStoreyMaps) ? storey.storeyAABB : storey.modelAABB;\n const aspect = Math.abs((aabb[5] - aabb[2]) / (aabb[3] - aabb[0]));\n const padding = options.padding || 0;\n\n let width;\n let height;\n\n if (options.width && options.height) {\n width = options.width;\n height = options.height;\n\n } else if (options.height) {\n height = options.height;\n width = Math.round(height / aspect);\n\n } else if (options.width) {\n width = options.width;\n height = Math.round(width * aspect);\n\n } else {\n width = 300;\n height = Math.round(width * aspect);\n }\n\n this._objectsMemento.saveObjects(scene);\n this._cameraMemento.saveCamera(scene);\n\n this.showStoreyObjects(storeyId, utils.apply(options, {\n hideOthers: true\n }));\n\n this._arrangeStoreyMapCamera(storey);\n\n const src = viewer.getSnapshot({\n width: width,\n height: height,\n format: format,\n });\n\n this._objectsMemento.restoreObjects(scene);\n this._cameraMemento.restoreCamera(scene);\n\n return new StoreyMap(storeyId, src, format, width, height, padding);\n }\n\n _arrangeStoreyMapCamera(storey) {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const camera = scene.camera;\n const aabb = (this._fitStoreyMaps) ? storey.storeyAABB : storey.modelAABB;\n const look = math.getAABB3Center(aabb);\n const sca = 0.5;\n const eye = tempVec3a;\n eye[0] = look[0] + (camera.worldUp[0] * sca);\n eye[1] = look[1] + (camera.worldUp[1] * sca);\n eye[2] = look[2] + (camera.worldUp[2] * sca);\n const up = camera.worldForward;\n viewer.cameraFlight.jumpTo({eye: eye, look: look, up: up});\n const xHalfSize = (aabb[3] - aabb[0]) / 2;\n const yHalfSize = (aabb[4] - aabb[1]) / 2;\n const zHalfSize = (aabb[5] - aabb[2]) / 2;\n const xmin = -xHalfSize;\n const xmax = +xHalfSize;\n const ymin = -yHalfSize;\n const ymax = +yHalfSize;\n const zmin = -zHalfSize;\n const zmax = +zHalfSize;\n viewer.camera.customProjection.matrix = math.orthoMat4c(xmin, xmax, zmin, zmax, ymin, ymax, tempMat4);\n viewer.camera.projection = \"customProjection\";\n }\n\n /**\n * Attempts to pick an {@link Entity} at the given pixel coordinates within a StoreyMap image.\n *\n * @param {StoreyMap} storeyMap The StoreyMap.\n * @param {Number[]} imagePos 2D pixel coordinates within the bounds of {@link StoreyMap#imageData}.\n * @param {*} [options] Picking options.\n * @param {Boolean} [options.pickSurface=false] Whether to return the picked position on the surface of the Entity.\n * @returns {PickResult} The pick result, if an Entity was successfully picked, else null.\n */\n pickStoreyMap(storeyMap, imagePos, options = {}) {\n\n const storeyId = storeyMap.storeyId;\n const storey = this.storeys[storeyId];\n\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n return null\n }\n\n const normX = 1.0 - (imagePos[0] / storeyMap.width);\n const normZ = 1.0 - (imagePos[1] / storeyMap.height);\n\n const aabb = (this._fitStoreyMaps) ? storey.storeyAABB : storey.modelAABB;\n\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n const xmax = aabb[3];\n const ymax = aabb[4];\n const zmax = aabb[5];\n\n const xWorldSize = xmax - xmin;\n const yWorldSize = ymax - ymin;\n const zWorldSize = zmax - zmin;\n\n const origin = math.vec3([xmin + (xWorldSize * normX), ymin + (yWorldSize * 0.5), zmin + (zWorldSize * normZ)]);\n const direction = math.vec3([0, -1, 0]);\n const look = math.addVec3(origin, direction, tempVec3a);\n const worldForward = this.viewer.camera.worldForward;\n const matrix = math.lookAtMat4v(origin, look, worldForward, tempMat4);\n\n const pickResult = this.viewer.scene.pick({ // Picking with arbitrarily-positioned ray\n pickSurface: options.pickSurface,\n pickInvisible: true,\n matrix\n });\n\n return pickResult;\n }\n\n storeyMapToWorldPos(storeyMap, imagePos, options = {}) {\n\n const storeyId = storeyMap.storeyId;\n const storey = this.storeys[storeyId];\n\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n return null\n }\n\n const normX = 1.0 - (imagePos[0] / storeyMap.width);\n const normZ = 1.0 - (imagePos[1] / storeyMap.height);\n\n const aabb = (this._fitStoreyMaps) ? storey.storeyAABB : storey.modelAABB;\n\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n const xmax = aabb[3];\n const ymax = aabb[4];\n const zmax = aabb[5];\n\n const xWorldSize = xmax - xmin;\n const yWorldSize = ymax - ymin;\n const zWorldSize = zmax - zmin;\n\n const origin = math.vec3([xmin + (xWorldSize * normX), ymin + (yWorldSize * 0.5), zmin + (zWorldSize * normZ)]);\n\n return origin;\n }\n\n\n /**\n * Gets the ID of the storey that contains the given 3D World-space position.\n *.\n * @param {Number[]} worldPos 3D World-space position.\n * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.\n */\n getStoreyContainingWorldPos(worldPos) {\n for (var storeyId in this.storeys) {\n const storey = this.storeys[storeyId];\n if (math.point3AABB3Intersect(storey.storeyAABB, worldPos)) {\n return storeyId;\n }\n }\n return null;\n }\n\n /**\n * Converts a 3D World-space position to a 2D position within a StoreyMap image.\n *\n * Use {@link StoreyViewsPlugin#pickStoreyMap} to convert 2D image positions to 3D world-space.\n *\n * @param {StoreyMap} storeyMap The StoreyMap.\n * @param {Number[]} worldPos 3D World-space position within the storey.\n * @param {Number[]} imagePos 2D pixel position within the {@link StoreyMap#imageData}.\n * @returns {Boolean} True if ````imagePos```` is within the bounds of the {@link StoreyMap#imageData}, else ````false```` if it falls outside.\n */\n worldPosToStoreyMap(storeyMap, worldPos, imagePos) {\n\n const storeyId = storeyMap.storeyId;\n const storey = this.storeys[storeyId];\n\n if (!storey) {\n this.error(\"IfcBuildingStorey not found with this ID: \" + storeyId);\n return false\n }\n\n const aabb = (this._fitStoreyMaps) ? storey.storeyAABB : storey.modelAABB;\n\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n\n const xmax = aabb[3];\n const ymax = aabb[4];\n const zmax = aabb[5];\n\n const xWorldSize = xmax - xmin;\n const yWorldSize = ymax - ymin;\n const zWorldSize = zmax - zmin;\n\n const camera = this.viewer.camera;\n const worldUp = camera.worldUp;\n\n const xUp = worldUp[0] > worldUp[1] && worldUp[0] > worldUp[2];\n const yUp = !xUp && worldUp[1] > worldUp[0] && worldUp[1] > worldUp[2];\n const zUp = !xUp && !yUp && worldUp[2] > worldUp[0] && worldUp[2] > worldUp[1];\n\n const ratioX = (storeyMap.width / xWorldSize);\n const ratioY = yUp ? (storeyMap.height / zWorldSize) : (storeyMap.height / yWorldSize); // Assuming either Y or Z is \"up\", but never X\n\n imagePos[0] = Math.floor(storeyMap.width - ((worldPos[0] - xmin) * ratioX));\n imagePos[1] = Math.floor(storeyMap.height - ((worldPos[2] - zmin) * ratioY));\n\n return (imagePos[0] >= 0 && imagePos[0] < storeyMap.width && imagePos[1] >= 0 && imagePos[1] <= storeyMap.height);\n }\n\n /**\n * Converts a 3D World-space direction vector to a 2D vector within a StoreyMap image.\n *\n * @param {StoreyMap} storeyMap The StoreyMap.\n * @param {Number[]} worldDir 3D World-space direction vector.\n * @param {Number[]} imageDir Normalized 2D direction vector.\n */\n worldDirToStoreyMap(storeyMap, worldDir, imageDir) {\n const camera = this.viewer.camera;\n const eye = camera.eye;\n const look = camera.look;\n const eyeLookDir = math.subVec3(look, eye, tempVec3a);\n const worldUp = camera.worldUp;\n const xUp = worldUp[0] > worldUp[1] && worldUp[0] > worldUp[2];\n const yUp = !xUp && worldUp[1] > worldUp[0] && worldUp[1] > worldUp[2];\n const zUp = !xUp && !yUp && worldUp[2] > worldUp[0] && worldUp[2] > worldUp[1];\n if (xUp) {\n imageDir[0] = eyeLookDir[1];\n imageDir[1] = eyeLookDir[2];\n } else if (yUp) {\n imageDir[0] = eyeLookDir[0];\n imageDir[1] = eyeLookDir[2];\n } else {\n imageDir[0] = eyeLookDir[0];\n imageDir[1] = eyeLookDir[1];\n }\n math.normalizeVec2(imageDir);\n }\n\n /**\n * Destroys this StoreyViewsPlugin.\n */\n destroy() {\n this.viewer.scene.off(this._onModelLoaded);\n super.destroy();\n }\n}\n\nexport {StoreyViewsPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1478, + "__docId__": 1486, "kind": "variable", "name": "tempVec3a", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", @@ -26994,7 +27210,7 @@ "ignore": true }, { - "__docId__": 1479, + "__docId__": 1487, "kind": "variable", "name": "tempMat4", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", @@ -27015,7 +27231,7 @@ "ignore": true }, { - "__docId__": 1480, + "__docId__": 1488, "kind": "variable", "name": "EMPTY_IMAGE", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", @@ -27036,7 +27252,7 @@ "ignore": true }, { - "__docId__": 1481, + "__docId__": 1489, "kind": "class", "name": "StoreyViewsPlugin", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js", @@ -27054,7 +27270,7 @@ ] }, { - "__docId__": 1482, + "__docId__": 1490, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27119,7 +27335,7 @@ ] }, { - "__docId__": 1483, + "__docId__": 1491, "kind": "member", "name": "_objectsMemento", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27137,7 +27353,7 @@ } }, { - "__docId__": 1484, + "__docId__": 1492, "kind": "member", "name": "_cameraMemento", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27155,7 +27371,7 @@ } }, { - "__docId__": 1485, + "__docId__": 1493, "kind": "member", "name": "storeys", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27174,7 +27390,7 @@ } }, { - "__docId__": 1486, + "__docId__": 1494, "kind": "member", "name": "modelStoreys", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27193,7 +27409,7 @@ } }, { - "__docId__": 1487, + "__docId__": 1495, "kind": "member", "name": "_fitStoreyMaps", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27211,7 +27427,7 @@ } }, { - "__docId__": 1488, + "__docId__": 1496, "kind": "member", "name": "_onModelLoaded", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27229,7 +27445,7 @@ } }, { - "__docId__": 1489, + "__docId__": 1497, "kind": "method", "name": "_registerModelStoreys", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27253,7 +27469,7 @@ "return": null }, { - "__docId__": 1490, + "__docId__": 1498, "kind": "method", "name": "_deregisterModelStoreys", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27277,7 +27493,7 @@ "return": null }, { - "__docId__": 1491, + "__docId__": 1499, "kind": "get", "name": "fitStoreyMaps", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27310,7 +27526,7 @@ } }, { - "__docId__": 1492, + "__docId__": 1500, "kind": "method", "name": "gotoStoreyCamera", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27366,7 +27582,7 @@ "return": null }, { - "__docId__": 1493, + "__docId__": 1501, "kind": "method", "name": "showStoreyObjects", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27414,7 +27630,7 @@ "return": null }, { - "__docId__": 1494, + "__docId__": 1502, "kind": "method", "name": "withStoreyObjects", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27450,7 +27666,7 @@ "return": null }, { - "__docId__": 1495, + "__docId__": 1503, "kind": "method", "name": "createStoreyMap", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27535,7 +27751,7 @@ } }, { - "__docId__": 1496, + "__docId__": 1504, "kind": "method", "name": "_arrangeStoreyMapCamera", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27559,7 +27775,7 @@ "return": null }, { - "__docId__": 1497, + "__docId__": 1505, "kind": "method", "name": "pickStoreyMap", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27630,7 +27846,7 @@ } }, { - "__docId__": 1498, + "__docId__": 1506, "kind": "method", "name": "storeyMapToWorldPos", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27672,7 +27888,7 @@ } }, { - "__docId__": 1499, + "__docId__": 1507, "kind": "method", "name": "getStoreyContainingWorldPos", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27711,7 +27927,7 @@ } }, { - "__docId__": 1500, + "__docId__": 1508, "kind": "method", "name": "worldPosToStoreyMap", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27770,7 +27986,7 @@ } }, { - "__docId__": 1501, + "__docId__": 1509, "kind": "method", "name": "worldDirToStoreyMap", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27816,7 +28032,7 @@ "return": null }, { - "__docId__": 1502, + "__docId__": 1510, "kind": "method", "name": "destroy", "memberof": "src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js~StoreyViewsPlugin", @@ -27831,29 +28047,29 @@ "return": null }, { - "__docId__": 1503, + "__docId__": 1511, "kind": "file", "name": "src/plugins/StoreyViewsPlugin/index.js", "content": "export * from \"./StoreyViewsPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/StoreyViewsPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/StoreyViewsPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1504, + "__docId__": 1512, "kind": "file", "name": "src/plugins/TreeViewPlugin/RenderService.js", "content": "/**\n * @desc A {@link TreeViewPlugin} render class.\n * \n */\nexport class RenderService {\n\n /*\n * Creates the root node of the tree.\n * @return {HTMLElement} The root node of the tree.\n */\n createRootNode() {\n return document.createElement('ul')\n }\n\n /*\n * Creates node of the tree.\n * @param {Object} node The node to create.\n\n * @return {HTMLElement} The html element for the node.\n */\n createNodeElement(node, expandHandler, checkHandler, contextmenuHandler, titleClickHandler) {\n const nodeElement = document.createElement('li');\n nodeElement.id = node.nodeId;\n\n if (node.xrayed) {\n nodeElement.classList.add('xrayed-node');\n }\n \n if (node.children.length > 0) {\n const switchElement = document.createElement('a');\n switchElement.href = '#';\n switchElement.id = `switch-${node.nodeId}`;\n switchElement.textContent = '+';\n switchElement.classList.add('plus');\n if (expandHandler) switchElement.addEventListener('click', expandHandler);\n nodeElement.appendChild(switchElement);\n }\n \n const checkbox = document.createElement('input');\n checkbox.id = `checkbox-${node.nodeId}`;\n checkbox.type = \"checkbox\";\n checkbox.checked = node.checked;\n checkbox.style[\"pointer-events\"] = \"all\";\n if (checkHandler) checkbox.addEventListener(\"change\", checkHandler);\n nodeElement.appendChild(checkbox);\n \n const span = document.createElement('span');\n span.textContent = node.title;\n nodeElement.appendChild(span);\n\n if (contextmenuHandler) {\n span.oncontextmenu = contextmenuHandler;\n }\n\n if (titleClickHandler) {\n span.onclick = titleClickHandler;\n }\n\n return nodeElement;\n }\n\n createDisabledNodeElement(rootName) {\n const li = document.createElement('li');\n\n const switchElement = document.createElement('a');\n switchElement.href = '#';\n switchElement.textContent = '!';\n switchElement.classList.add('warn');\n switchElement.classList.add('warning');\n li.appendChild(switchElement);\n \n const span = document.createElement('span');\n span.textContent = rootName;\n li.appendChild(span);\n\n return li;\n }\n\n addChildren(element, nodes) {\n const ul = document.createElement('ul');\n nodes.forEach((nodeElement) => {\n ul.appendChild(nodeElement);\n });\n\n element.parentElement.appendChild(ul);\n }\n\n expand(element, expandHandler, collapseHandler) {\n element.classList.remove('plus');\n element.classList.add('minus');\n element.textContent = '-';\n element.removeEventListener('click', expandHandler);\n element.addEventListener('click', collapseHandler);\n }\n\n collapse(element, expandHandler, collapseHandler) {\n if (!element) {\n return;\n }\n const parent = element.parentElement;\n if (!parent) {\n return;\n }\n const ul = parent.querySelector('ul');\n if (!ul) {\n return;\n }\n parent.removeChild(ul);\n element.classList.remove('minus');\n element.classList.add('plus');\n element.textContent = '+';\n element.removeEventListener('click', collapseHandler);\n element.addEventListener('click', expandHandler);\n }\n\n isExpanded(element) {\n const parentElement = element.parentElement;\n return parentElement.getElementsByTagName('li')[0] !== undefined;\n }\n\n getId(element) {\n const parentElement = element.parentElement;\n return parentElement.id;\n }\n\n getIdFromCheckbox(element) {\n return element.id.replace('checkbox-', '');\n }\n\n getSwitchElement(nodeId) {\n return document.getElementById(`switch-${nodeId}`);\n }\n\n isChecked(element) {\n return element.checked;\n }\n\n setCheckbox(nodeId, checked) {\n const checkbox = document.getElementById(`checkbox-${nodeId}`);\n if (checkbox) {\n if (checked !== checkbox.checked) {\n checkbox.checked = checked;\n }\n }\n }\n\n setXRayed(nodeId, xrayed) {\n const treeNode = document.getElementById(nodeId);\n if (treeNode) {\n if (xrayed) {\n treeNode.classList.add('xrayed-node');\n } else {\n treeNode.classList.remove('xrayed-node');\n }\n }\n }\n\n setHighlighted(nodeId, highlighted) { \n const treeNode = document.getElementById(nodeId);\n if (treeNode) {\n if (highlighted) {\n treeNode.scrollIntoView({block: \"center\"});\n treeNode.classList.add('highlighted-node');\n } else {\n treeNode.classList.remove('highlighted-node');\n }\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/TreeViewPlugin/RenderService.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/TreeViewPlugin/RenderService.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1505, + "__docId__": 1513, "kind": "class", "name": "RenderService", "memberof": "src/plugins/TreeViewPlugin/RenderService.js", @@ -27868,7 +28084,7 @@ "interface": false }, { - "__docId__": 1506, + "__docId__": 1514, "kind": "method", "name": "createRootNode", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -27888,7 +28104,7 @@ } }, { - "__docId__": 1507, + "__docId__": 1515, "kind": "method", "name": "createNodeElement", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -27939,7 +28155,7 @@ } }, { - "__docId__": 1508, + "__docId__": 1516, "kind": "method", "name": "createDisabledNodeElement", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -27966,7 +28182,7 @@ } }, { - "__docId__": 1509, + "__docId__": 1517, "kind": "method", "name": "addChildren", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -27995,7 +28211,7 @@ "return": null }, { - "__docId__": 1510, + "__docId__": 1518, "kind": "method", "name": "expand", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28030,7 +28246,7 @@ "return": null }, { - "__docId__": 1511, + "__docId__": 1519, "kind": "method", "name": "collapse", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28065,7 +28281,7 @@ "return": null }, { - "__docId__": 1512, + "__docId__": 1520, "kind": "method", "name": "isExpanded", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28092,7 +28308,7 @@ } }, { - "__docId__": 1513, + "__docId__": 1521, "kind": "method", "name": "getId", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28119,7 +28335,7 @@ } }, { - "__docId__": 1514, + "__docId__": 1522, "kind": "method", "name": "getIdFromCheckbox", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28146,7 +28362,7 @@ } }, { - "__docId__": 1515, + "__docId__": 1523, "kind": "method", "name": "getSwitchElement", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28173,7 +28389,7 @@ } }, { - "__docId__": 1516, + "__docId__": 1524, "kind": "method", "name": "isChecked", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28200,7 +28416,7 @@ } }, { - "__docId__": 1517, + "__docId__": 1525, "kind": "method", "name": "setCheckbox", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28229,7 +28445,7 @@ "return": null }, { - "__docId__": 1518, + "__docId__": 1526, "kind": "method", "name": "setXRayed", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28258,7 +28474,7 @@ "return": null }, { - "__docId__": 1519, + "__docId__": 1527, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/TreeViewPlugin/RenderService.js~RenderService", @@ -28287,18 +28503,18 @@ "return": null }, { - "__docId__": 1520, + "__docId__": 1528, "kind": "file", "name": "src/plugins/TreeViewPlugin/TreeViewNode.js", "content": "/**\n * @desc A node within a {@link TreeViewPlugin}.\n *\n * These are provided by {@link TreeViewPlugin#withNodeTree} and the\n * [contextmenu](https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event) event fired by\n * TreeViewPlugin whenever we right-click on a tree node.\n *\n * @interface\n * @abstract\n */\nclass TreeViewNode {\n\n /**\n * Globally unique node ID.\n *\n * @type {String}\n * @abstract\n */\n get nodeId() {\n }\n\n /**\n * Title of the TreeViewNode.\n *\n * @type {String}\n * @abstract\n */\n get title() {\n }\n\n /** Type of the corresponding {@link MetaObject}.\n *\n * @type {String}\n * @abstract\n */\n get type() {\n }\n\n /**\n * ID of the corresponding {@link MetaObject}.\n *\n * This is only defined if the TreeViewNode represents an object.\n *\n * @type {String}\n * @abstract\n */\n get objectId() {\n }\n\n /**\n * The child TreeViewNodes.\n *\n * @type {Array}\n * @abstract\n */\n get children() {\n }\n\n /** The parent TreeViewNode.\n *\n * @type {TreeViewNode}\n * @abstract\n */\n get parent() {\n }\n\n /** The number of {@link Entity}s within the subtree of this TreeViewNode.\n *\n * @type {Number}\n * @abstract\n */\n get numEntities() {\n\n }\n\n /** The number of {@link Entity}s that are currently visible within the subtree of this TreeViewNode.\n *\n * @type {Number}\n * @abstract\n */\n get numVisibleEntities() {\n }\n\n /** Whether or not the TreeViewNode is currently checked.\n *\n * @type {Boolean}\n * @abstract\n */\n get checked() {\n }\n\n /** Whether or not the TreeViewNode is currently xrayed.\n *\n * @type {Boolean}\n * @abstract\n */\n get xrayed() {\n }\n}\n\nexport {TreeViewNode};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/TreeViewPlugin/TreeViewNode.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/TreeViewPlugin/TreeViewNode.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1521, + "__docId__": 1529, "kind": "class", "name": "TreeViewNode", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js", @@ -28314,7 +28530,7 @@ "interface": true }, { - "__docId__": 1522, + "__docId__": 1530, "kind": "get", "name": "nodeId", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28336,7 +28552,7 @@ "abstract": true }, { - "__docId__": 1523, + "__docId__": 1531, "kind": "get", "name": "title", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28358,7 +28574,7 @@ "abstract": true }, { - "__docId__": 1524, + "__docId__": 1532, "kind": "get", "name": "type", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28380,7 +28596,7 @@ "abstract": true }, { - "__docId__": 1525, + "__docId__": 1533, "kind": "get", "name": "objectId", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28402,7 +28618,7 @@ "abstract": true }, { - "__docId__": 1526, + "__docId__": 1534, "kind": "get", "name": "children", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28424,7 +28640,7 @@ "abstract": true }, { - "__docId__": 1527, + "__docId__": 1535, "kind": "get", "name": "parent", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28446,7 +28662,7 @@ "abstract": true }, { - "__docId__": 1528, + "__docId__": 1536, "kind": "get", "name": "numEntities", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28468,7 +28684,7 @@ "abstract": true }, { - "__docId__": 1529, + "__docId__": 1537, "kind": "get", "name": "numVisibleEntities", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28490,7 +28706,7 @@ "abstract": true }, { - "__docId__": 1530, + "__docId__": 1538, "kind": "get", "name": "checked", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28512,7 +28728,7 @@ "abstract": true }, { - "__docId__": 1531, + "__docId__": 1539, "kind": "get", "name": "xrayed", "memberof": "src/plugins/TreeViewPlugin/TreeViewNode.js~TreeViewNode", @@ -28534,18 +28750,18 @@ "abstract": true }, { - "__docId__": 1532, + "__docId__": 1540, "kind": "file", "name": "src/plugins/TreeViewPlugin/TreeViewPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {RenderService} from \"./RenderService.js\";\n\nconst treeViews = [];\n\n/**\n * @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.\n *
\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_XKT_WestRiverSideHospital)]\n *\n * ## Overview\n *\n * * A fast HTML tree view, with zero external dependencies, that works with huge numbers of objects.\n * * Each tree node has a checkbox to control the visibility of its object.\n * * Has three hierarchy modes: \"containment\", \"types\" and \"storeys\".\n * * Automatically contains all models (that have metadata) that are currently in the {@link Scene}.\n * * Sorts tree nodes by default - spatially, from top-to-bottom for ````IfcBuildingStorey```` nodes, and alphanumerically for other nodes.\n * * Allows custom CSS styling.\n * * Use {@link ContextMenu} to create a context menu for the tree nodes.\n *\n * ## Credits\n *\n * TreeViewPlugin is based on techniques described in [*Super Fast Tree View in JavaScript*](https://chrissmith.xyz/super-fast-tree-view-in-javascript/) by [Chris Smith](https://twitter.com/chris22smith).\n *\n * ## Usage\n *\n * In the example below, we'll add a TreeViewPlugin which, by default, will automatically show the structural\n * hierarchy of the IFC elements in each model we load.\n *\n * Then we'll use an {@link XKTLoaderPlugin} to load the Schependomlaan model from an\n * [.xkt file](https://github.com/xeokit/xeokit-sdk/tree/master/examples/models/xkt/schependomlaan).\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/navigation/#TreeViewPlugin_Containment)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, TreeViewPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\")\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n * ````\n *\n * ## Manually Adding Models\n *\n * Instead of adding models automatically, we can control which models appear in our TreeViewPlugin by adding them manually.\n *\n * In the next example, we'll configure the TreeViewPlugin to not add models automatically. Then, once the model\n * has loaded, we'll add it manually using {@link TreeViewPlugin#addModel}.\n *\n * ````javascript\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\"),\n * autoAddModels: false // <<---------------- Don't auto-add models\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n *\n * model.on(\"loaded\", () => {\n * treeView.addModel(model.id);\n * });\n * ````\n *\n * Adding models manually also allows us to set some options for the model. For example, the ````rootName```` option allows us to provide a custom name for\n * the root node, which is sometimes desirable when the model's \"IfcProject\" element's name is not suitable:\n *\n * ````javascript\n * model.on(\"loaded\", () => {\n * treeView.addModel(model.id, {\n * rootName: \"Schependomlaan Model\"\n * });\n * });\n * ````\n *\n * ## Initially Expanding the Hierarchy\n *\n * We can also configure TreeViewPlugin to initially expand each model's nodes to a given depth.\n *\n * Let's automatically expand the first three nodes from the root, for every model added:\n *\n * ````javascript\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\"),\n * autoExpandDepth: 3\n * });\n * ````\n *\n * ## Showing a Node by ID\n *\n * We can show a given node using its ID. This causes the TreeViewPlugin to collapse, then expand and scroll the node into view, then highlight the node.\n *\n * See the documentation for the {@link TreeViewPlugin#showNode} method for more information, including how to define a custom highlighted appearance for the node using CSS.\n *\n * Let's make the TreeViewPlugin show the node corresponding to whatever object {@link Entity} that we pick:\n *\n * ````javascript\n * viewer.cameraControl.on(\"picked\", function (e) {\n * var objectId = e.entity.id;\n * treeView.showNode(objectId);\n * });\n * ````\n *\n * This will de-highlight any node that was previously shown by this method.\n *\n * Note that this method only works if the picked {@link Entity} is an object that belongs to a model that's represented in the TreeViewPlugin.\n *\n * ## Customizing Appearance\n *\n * We can customize the appearance of our TreeViewPlugin by defining custom CSS for its HTML\n * elements. See our example's [source code](https://github.com/xeokit/xeokit-sdk/blob/master/examples/BIMOffline_XKT_Schependomlaan.html)\n * for an example of custom CSS rules.\n *\n * ## Model Hierarchies\n *\n * TreeViewPlugin has three hierarchies for organizing its nodes:\n *\n * * \"containment\" - organizes the tree nodes to indicate the containment hierarchy of the {@link MetaObject}s.\n * * \"types\" - groups nodes by their IFC types.\n * * \"storeys\" - groups nodes within their ````IfcBuildingStoreys````, and sub-groups them by their IFC types.\n *\n *
\n * The table below shows what the hierarchies look like:\n *
\n *\n * | 1. Containment Hierarchy | 2. Types Hierarchy | 3. Storeys Hierarchy |\n * |---|---|---|\n * | | | |\n *
\n *\n * Let's create a TreeViewPlugin that groups nodes by their building stories and IFC types:\n *\n * ````javascript\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\"),\n * hierarchy: \"stories\"\n * });\n * ````\n *\n * ## Sorting Nodes\n *\n * TreeViewPlugin sorts its tree nodes by default. For a \"storeys\" hierarchy, it orders ````IfcBuildingStorey```` nodes\n * spatially, with the node for the highest story at the top, down to the lowest at the bottom.\n *\n * For all the hierarchy types (\"containment\", \"classes\" and \"storeys\"), TreeViewPlugin sorts the other node types\n * alphanumerically on their titles.\n *\n * If for some reason you need to prevent sorting, create your TreeViewPlugin with the option disabled, like so:\n *\n * ````javascript\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\"),\n * hierarchy: \"stories\",\n * sortNodes: false // <<------ Disable node sorting\n * });\n * ````\n *\n * Note that, for all hierarchy modes, node sorting is only done for each model at the time that it is added to the TreeViewPlugin, and will not\n * update dynamically if we later transform the {@link Entity}s corresponding to the nodes.\n *\n * ## Pruning empty nodes\n *\n * Sometimes a model contains subtrees of objects that don't have any geometry. These are models whose\n * {@link MetaModel} contains trees of {@link MetaObject}s that don't have any {@link Entity}s in the {@link Scene}.\n *\n * For these models, the tree view would contain nodes that don't do anything in the Scene when we interact with them,\n * which is undesirable.\n *\n * By default, TreeViewPlugin will not create nodes for those objects. However, we can override that behaviour if we want\n * to have nodes for those objects (perhaps for debugging the model):\n *\n * ````javascript\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\"),\n * hierarchy: \"stories\",\n * pruneEmptyNodes: false // <<------ Create nodes for object subtrees without geometry\n * });\n * ````\n *\n * ## Context Menu\n *\n * TreeViewPlugin fires a \"contextmenu\" event whenever we right-click on a tree node.\n *\n * The event contains:\n *\n * * ````event```` - the original [contextmenu](https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event) [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent)\n * * ````viewer```` - the {@link Viewer}\n * * ````treeViewPlugin```` - the TreeViewPlugin\n * * ````treeViewNode```` - the {@link TreeViewNode} representing the tree node\n *

\n *\n * Let's use {@link ContextMenu} to show a simple context menu for the node we clicked.\n *\n * [[Run an example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_Canvas_TreeViewPlugin_Custom)]\n *\n * ````javascript\n * import {ContextMenu} from \"../src/extras/ContextMenu/ContextMenu.js\";\n *\n * const treeViewContextMenu = new ContextMenu({\n * items: [\n * [\n * [\n * {\n * title: \"Hide\",\n * doAction: function (context) {\n * context.treeViewPlugin.withNodeTree(context.treeViewNode, (treeViewNode) => {\n * if (treeViewNode.objectId) {\n * const entity = context.viewer.scene.objects[treeViewNode.objectId];\n * if (entity) {\n * entity.visible = false;\n * }\n * }\n * });\n * }\n * },\n * {\n * title: \"Hide all\",\n * doAction: function (context) {\n * context.viewer.scene.setObjectsVisible(context.viewer.scene.visibleObjectIds, false);\n * }\n * }\n * ],\n * [\n * {\n * title: \"Show\",\n * doAction: function (context) {\n * context.treeViewPlugin.withNodeTree(context.treeViewNode, (treeViewNode) => {\n * if (treeViewNode.objectId) {\n * const entity = context.viewer.scene.objects[treeViewNode.objectId];\n * if (entity) {\n * entity.visible = true;\n * entity.xrayed = false;\n * entity.selected = false;\n * }\n * }\n * });\n * }\n * },\n * {\n * title: \"Show all\",\n * doAction: function (context) {\n * const scene = context.viewer.scene;\n * scene.setObjectsVisible(scene.objectIds, true);\n * scene.setObjectsXRayed(scene.xrayedObjectIds, false);\n * scene.setObjectsSelected(scene.selectedObjectIds, false);\n * }\n * }\n * ]\n * ]\n * ]\n * });\n *\n * treeView.on(\"contextmenu\", (e) => {\n *\n * const event = e.event; // MouseEvent\n * const viewer = e.viewer; // Viewer\n * const treeViewPlugin = e.treeViewPlugin; // TreeViewPlugin\n * const treeViewNode = e.treeViewNode; // TreeViewNode\n *\n * treeViewContextMenu.show(e.event.pageX, e.event.pageY);\n *\n * treeViewContextMenu.context = {\n * viewer: e.viewer,\n * treeViewPlugin: e.treeViewPlugin,\n * treeViewNode: e.treeViewNode\n * };\n * });\n * ````\n *\n * ## Clicking Node Titles\n *\n * TreeViewPlugin fires a \"nodeTitleClicked\" event whenever we left-click on a tree node.\n *\n * Like the \"contextmenu\" event, this event contains:\n *\n * * ````event```` - the original [click](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent)\n * * ````viewer```` - the {@link Viewer}\n * * ````treeViewPlugin```` - the TreeViewPlugin\n * * ````treeViewNode```` - the {@link TreeViewNode} representing the tree node\n *

\n *\n * Let's register a callback to isolate and fit-to-view the {@link Entity}(s) represented by the node. This callback is\n * going to X-ray all the other Entitys, fly the camera to fit the Entity(s) for the clicked node, then hide the other Entitys.\n *\n * [[Run an example](https://xeokit.github.io/xeokit-sdk/examples/index.html#ContextMenu_Canvas_TreeViewPlugin_Custom)]\n *\n * ````javascript\n * treeView.on(\"nodeTitleClicked\", (e) => {\n * const scene = viewer.scene;\n * const objectIds = [];\n * e.treeViewPlugin.withNodeTree(e.treeViewNode, (treeViewNode) => {\n * if (treeViewNode.objectId) {\n * objectIds.push(treeViewNode.objectId);\n * }\n * });\n * scene.setObjectsXRayed(scene.objectIds, true);\n * scene.setObjectsVisible(scene.objectIds, true);\n * scene.setObjectsXRayed(objectIds, false);\n * viewer.cameraFlight.flyTo({\n * aabb: scene.getAABB(objectIds),\n * duration: 0.5\n * }, () => {\n * setTimeout(function () {\n * scene.setObjectsVisible(scene.xrayedObjectIds, false);\n * scene.setObjectsXRayed(scene.xrayedObjectIds, false);\n * }, 500);\n * });\n * });\n * ````\n *\n * To make the cursor change to a pointer when we hover over the node titles, and also to make the titles change to blue, we'll also define this CSS for the ```````` elements\n * that represent the titles of our TreeViewPlugin nodes:\n *\n * ````css\n * #treeViewContainer ul li span:hover {\n * color: blue;\n * cursor: pointer;\n * }\n * ````\n *\n * @class TreeViewPlugin\n */\nexport class TreeViewPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {*} cfg Plugin configuration.\n * @param {String} [cfg.containerElementId] ID of an existing HTML element to contain the TreeViewPlugin - either this or containerElement is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLElement} cfg.containerElement DOM element to contain the TreeViewPlugin.\n * @param {Boolean} [cfg.autoAddModels=true] When ````true```` (default), will automatically add each model as it's created. Set this ````false```` if you want to manually add models using {@link TreeViewPlugin#addModel} instead.\n * @param {Number} [cfg.autoExpandDepth] Optional depth to which to initially expand the tree.\n * @param {String} [cfg.hierarchy=\"containment\"] How to organize the tree nodes: \"containment\", \"storeys\" or \"types\". See the class documentation for details.\n * @param {Boolean} [cfg.sortNodes=true] When true, will sort the children of each node. For a \"storeys\" hierarchy, the\n * ````IfcBuildingStorey```` nodes will be ordered spatially, from the highest storey down to the lowest, on the\n * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.\n * @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.\n * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"TreeViewPlugin\", viewer);\n\n /**\n * Contains messages for any errors found while last rebuilding this TreeView.\n * @type {String[]}\n */\n this.errors = [];\n\n /**\n * True if errors were found generating this TreeView.\n * @type {boolean}\n */\n this.valid = true;\n\n const containerElement = cfg.containerElement || document.getElementById(cfg.containerElementId);\n\n if (!(containerElement instanceof HTMLElement)) {\n this.error(\"Mandatory config expected: valid containerElementId or containerElement\");\n return;\n }\n\n for (let i = 0; ; i++) {\n if (!treeViews[i]) {\n treeViews[i] = this;\n this._index = i;\n this._id = `tree-${i}`;\n break;\n }\n }\n\n\n this._containerElement = containerElement;\n this._metaModels = {};\n this._autoAddModels = (cfg.autoAddModels !== false);\n this._autoExpandDepth = (cfg.autoExpandDepth || 0);\n this._sortNodes = (cfg.sortNodes !== false);\n this._viewer = viewer;\n this._rootElement = null;\n this._muteSceneEvents = false;\n this._muteTreeEvents = false;\n this._rootNodes = [];\n this._objectNodes = {}; // Object ID -> Node\n this._nodeNodes = {}; // Node ID -> Node\n this._rootNames = {}; // Node ID -> Root name\n this._sortNodes = cfg.sortNodes;\n this._pruneEmptyNodes = cfg.pruneEmptyNodes;\n this._showListItemElementId = null;\n this._renderService = cfg.renderService || new RenderService();\n\n if (!this._renderService) {\n throw new Error('TreeViewPlugin: no render service set');\n }\n\n this._containerElement.oncontextmenu = (e) => {\n e.preventDefault();\n };\n\n this._onObjectVisibility = this._viewer.scene.on(\"objectVisibility\", (entity) => {\n if (this._muteSceneEvents) {\n return;\n }\n const objectId = entity.id;\n const node = this._objectNodes[objectId];\n if (!node) {\n return; // Not in this tree\n }\n const visible = entity.visible;\n const updated = (visible !== node.checked);\n if (!updated) {\n return;\n }\n this._muteTreeEvents = true;\n node.checked = visible;\n if (visible) {\n node.numVisibleEntities++;\n } else {\n node.numVisibleEntities--;\n }\n\n this._renderService.setCheckbox(node.nodeId, visible);\n\n let parent = node.parent;\n while (parent) {\n parent.checked = visible;\n if (visible) {\n parent.numVisibleEntities++;\n } else {\n parent.numVisibleEntities--;\n }\n\n this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));\n\n parent = parent.parent;\n }\n\n this._muteTreeEvents = false;\n });\n\n this._onObjectXrayed = this._viewer.scene.on('objectXRayed', (entity) => {\n if (this._muteSceneEvents) {\n return;\n }\n const objectId = entity.id;\n const node = this._objectNodes[objectId];\n if (!node) {\n return; // Not in this tree\n }\n this._muteTreeEvents = true;\n const xrayed = entity.xrayed;\n const updated = (xrayed !== node.xrayed);\n if (!updated) {\n return;\n }\n node.xrayed = xrayed;\n\n this._renderService.setXRayed(node.nodeId, xrayed);\n this._muteTreeEvents = false;\n });\n\n this._switchExpandHandler = (event) => {\n event.preventDefault();\n event.stopPropagation();\n const switchElement = event.target;\n this._expandSwitchElement(switchElement);\n };\n\n this._switchCollapseHandler = (event) => {\n event.preventDefault();\n event.stopPropagation();\n const switchElement = event.target;\n this._collapseSwitchElement(switchElement);\n };\n\n this._checkboxChangeHandler = (event) => {\n if (this._muteTreeEvents) {\n return;\n }\n this._muteSceneEvents = true;\n const checkbox = event.target;\n const visible = this._renderService.isChecked(checkbox);\n const nodeId = this._renderService.getIdFromCheckbox(checkbox);\n\n const checkedNode = this._nodeNodes[nodeId];\n const objects = this._viewer.scene.objects;\n let numUpdated = 0;\n \n this._withNodeTree(checkedNode, (node) => {\n const objectId = node.objectId;\n const entity = objects[objectId];\n const isLeaf = (node.children.length === 0);\n node.numVisibleEntities = visible ? node.numEntities : 0;\n if (isLeaf && (visible !== node.checked)) {\n numUpdated++;\n }\n node.checked = visible;\n\n this._renderService.setCheckbox(node.nodeId, visible);\n \n if (entity) {\n entity.visible = visible;\n }\n });\n\n let parent = checkedNode.parent;\n while (parent) {\n parent.checked = visible;\n \n if (visible) {\n parent.numVisibleEntities += numUpdated;\n } else {\n parent.numVisibleEntities -= numUpdated;\n }\n\n this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));\n \n parent = parent.parent;\n }\n this._muteSceneEvents = false;\n };\n\n this._hierarchy = cfg.hierarchy || \"containment\";\n this._autoExpandDepth = cfg.autoExpandDepth || 0;\n\n if (this._autoAddModels) {\n const modelIds = Object.keys(this.viewer.metaScene.metaModels);\n for (let i = 0, len = modelIds.length; i < len; i++) {\n const modelId = modelIds[i];\n const metaModel = this.viewer.metaScene.metaModels[modelId];\n if (metaModel.finalized) {\n this.addModel(modelId);\n }\n }\n this.viewer.scene.on(\"modelLoaded\", (modelId) => {\n if (this.viewer.metaScene.metaModels[modelId]) {\n this.addModel(modelId);\n }\n });\n }\n\n this.hierarchy = cfg.hierarchy;\n }\n\n /**\n * Sets how the nodes are organized within this tree view.\n *\n * Accepted values are:\n *\n * * \"containment\" - organizes the nodes to indicate the containment hierarchy of the IFC objects.\n * * \"types\" - groups the nodes within their IFC types.\n * * \"storeys\" - groups the nodes within ````IfcBuildingStoreys```` and sub-groups them by their IFC types.\n *\n *
\n * This can be updated dynamically.\n *\n * Default value is \"containment\".\n *\n * @type {String}\n */\n set hierarchy(hierarchy) {\n hierarchy = hierarchy || \"containment\";\n if (hierarchy !== \"containment\" && hierarchy !== \"storeys\" && hierarchy !== \"types\") {\n this.error(\"Unsupported value for `hierarchy' - defaulting to 'containment'\");\n hierarchy = \"containment\";\n }\n if (this._hierarchy === hierarchy) {\n return;\n }\n this._hierarchy = hierarchy;\n this._createNodes();\n }\n\n /**\n * Gets how the nodes are organized within this tree view.\n *\n * @type {String}\n */\n get hierarchy() {\n return this._hierarchy;\n }\n\n /**\n * Adds a model to this tree view.\n *\n * The model will be automatically removed when destroyed.\n *\n * To automatically add each model as it's created, instead of manually calling this method each time,\n * provide a ````autoAddModels: true```` to the TreeViewPlugin constructor.\n *\n * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.\n * @param {Object} [options] Options for model in the tree view.\n * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for \"containment\"\n * and \"storeys\" hierarchy types, the tree would derive the root node name from the model's \"IfcProject\" element\n * name. This option allows to override that name when it is not suitable as a display name.\n */\n addModel(modelId, options = {}) {\n if (!this._containerElement) {\n return;\n }\n const model = this.viewer.scene.models[modelId];\n if (!model) {\n throw \"Model not found: \" + modelId;\n }\n const metaModel = this.viewer.metaScene.metaModels[modelId];\n if (!metaModel) {\n this.error(\"MetaModel not found: \" + modelId);\n return;\n }\n if (this._metaModels[modelId]) {\n this.warn(\"Model already added: \" + modelId);\n return;\n }\n this._metaModels[modelId] = metaModel;\n\n if (options && options.rootName) {\n this._rootNames[modelId] = options.rootName;\n }\n \n model.on(\"destroyed\", () => {\n this.removeModel(model.id);\n });\n this._createNodes();\n }\n\n /**\n * Removes a model from this tree view.\n *\n * Does nothing if model not currently in tree view.\n *\n * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.\n */\n removeModel(modelId) {\n if (!this._containerElement) {\n return;\n }\n const metaModel = this._metaModels[modelId];\n if (!metaModel) {\n return;\n }\n\n if (this._rootNames[modelId]) {\n delete this._rootNames[modelId];\n }\n\n delete this._metaModels[modelId];\n this._createNodes();\n }\n\n /**\n * Highlights the tree view node that represents the given object {@link Entity}.\n *\n * This causes the tree view to collapse, then expand to reveal the node, then highlight the node.\n *\n * If a node is previously highlighted, de-highlights that node and collapses the tree first.\n *\n * Note that if the TreeViewPlugin was configured with ````pruneEmptyNodes: true```` (default configuration), then the\n * node won't exist in the tree if it has no Entitys in the {@link Scene}. in that case, nothing will happen.\n *\n * Within the DOM, the node is represented by an ````
  • ```` element. This method will add a ````.highlighted-node```` class to\n * the element to make it appear highlighted, removing that class when de-highlighting it again. See the CSS rules\n * in the TreeViewPlugin examples for an example of that class.\n *\n * @param {String} objectId ID of the {@link Entity}.\n */\n showNode(objectId) {\n this.unShowNode();\n\n const node = this._objectNodes[objectId];\n if (!node) {\n return; // Node may not exist for the given object if (this._pruneEmptyNodes == true)\n }\n\n const nodeId = node.nodeId;\n\n const switchElement = this._renderService.getSwitchElement(nodeId);\n if (switchElement) {\n this._expandSwitchElement(switchElement);\n switchElement.scrollIntoView();\n return true;\n }\n \n const path = [];\n path.unshift(node);\n let parent = node.parent;\n while (parent) {\n path.unshift(parent);\n parent = parent.parent;\n }\n\n for (let i = 0, len = path.length; i < len; i++) {\n const switchElement = this._renderService.getSwitchElement(path[i].nodeId);\n if (switchElement) {\n this._expandSwitchElement(switchElement);\n }\n }\n\n this._renderService.setHighlighted(nodeId, true);\n\n this._showListItemElementId = nodeId;\n }\n\n /**\n * De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.\n *\n * Does nothing if no node is currently shown.\n *\n * If the node is currently scrolled into view, keeps the node in view.\n */\n unShowNode() {\n if (!this._showListItemElementId) {\n return;\n }\n\n this._renderService.setHighlighted(this._showListItemElementId, false)\n \n this._showListItemElementId = null;\n }\n\n /**\n * Expands the tree to the given depth.\n *\n * Collapses the tree first.\n *\n * @param {Number} depth Depth to expand to.\n */\n expandToDepth(depth) {\n this.collapse();\n const expand = (node, countDepth) => {\n if (countDepth === depth) {\n return;\n }\n\n const switchElement = this._renderService.getSwitchElement(node.nodeId);\n if (switchElement) {\n this._expandSwitchElement(switchElement);\n const childNodes = node.children;\n for (var i = 0, len = childNodes.length; i < len; i++) {\n const childNode = childNodes[i];\n expand(childNode, countDepth + 1);\n }\n }\n };\n for (let i = 0, len = this._rootNodes.length; i < len; i++) {\n const rootNode = this._rootNodes[i];\n expand(rootNode, 0);\n }\n }\n\n /**\n * Closes all the nodes in the tree.\n */\n collapse() {\n for (let i = 0, len = this._rootNodes.length; i < len; i++) {\n const rootNode = this._rootNodes[i];\n const objectId = rootNode.objectId;\n this._collapseNode(objectId);\n }\n }\n\n /**\n * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each\n * node in depth-first pre-order.\n *\n * @param {TreeViewNode} node Root of the subtree.\n * @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.\n */\n withNodeTree(node, callback) {\n callback(node);\n const children = node.children;\n if (!children) {\n return;\n }\n for (let i = 0, len = children.length; i < len; i++) {\n this.withNodeTree(children[i], callback);\n }\n }\n\n /**\n * Destroys this TreeViewPlugin.\n */\n destroy() {\n if (!this._containerElement) {\n return;\n }\n this._metaModels = {};\n if (this._rootElement && !this._destroyed) {\n this._rootElement.parentNode.removeChild(this._rootElement);\n this._viewer.scene.off(this._onObjectVisibility);\n this._destroyed = true;\n }\n delete treeViews[this._index];\n super.destroy();\n }\n\n _createNodes() {\n if (this._rootElement) {\n this._rootElement.parentNode.removeChild(this._rootElement);\n this._rootElement = null;\n }\n\n this._rootNodes = [];\n this._objectNodes = {};\n this._nodeNodes = {};\n this._validate();\n if (this.valid || (this._hierarchy !== \"storeys\")) {\n this._createEnabledNodes();\n } else {\n this._createDisabledNodes();\n }\n }\n\n _validate() {\n this.errors = [];\n switch (this._hierarchy) {\n case \"storeys\":\n this.valid = this._validateMetaModelForStoreysHierarchy();\n break;\n case \"types\":\n this.valid = (this._rootNodes.length > 0);\n break;\n case \"containment\":\n default:\n this.valid = (this._rootNodes.length > 0);\n break;\n }\n return this.valid;\n }\n\n _validateMetaModelForStoreysHierarchy(level = 0, ctx, buildingNode) {\n // ctx = ctx || {\n // foundIFCBuildingStoreys: false\n // };\n // const metaObjectType = metaObject.type;\n // const children = metaObject.children;\n // if (metaObjectType === \"IfcBuilding\") {\n // buildingNode = true;\n // } else if (metaObjectType === \"IfcBuildingStorey\") {\n // if (!buildingNode) {\n // errors.push(\"Can't build storeys hierarchy: IfcBuildingStorey found without parent IfcBuilding\");\n // return false;\n // }\n // ctx.foundIFCBuildingStoreys = true;\n // }\n // if (children) {\n // for (let i = 0, len = children.length; i < len; i++) {\n // const childMetaObject = children[i];\n // if (!this._validateMetaModelForStoreysHierarchy(childMetaObject, errors, level + 1, ctx, buildingNode)) {\n // return false;\n // }\n // }\n // }\n // if (level === 0) {\n // if (!ctx.foundIFCBuildingStoreys) {\n // // errors.push(\"Can't build storeys hierarchy: no IfcBuildingStoreys found\");\n // }\n // }\n return true;\n }\n\n _createEnabledNodes() {\n if (this._pruneEmptyNodes) {\n this._findEmptyNodes();\n }\n switch (this._hierarchy) {\n case \"storeys\":\n this._createStoreysNodes();\n if (this._rootNodes.length === 0) {\n this.error(\"Failed to build storeys hierarchy\");\n }\n break;\n case \"types\":\n this._createTypesNodes();\n break;\n case \"containment\":\n default:\n this._createContainmentNodes();\n }\n if (this._sortNodes) {\n this._doSortNodes();\n }\n this._synchNodesToEntities();\n this._createTrees();\n this.expandToDepth(this._autoExpandDepth);\n }\n\n _createDisabledNodes() {\n\n const rootNode = this._renderService.createRootNode();\n this._rootElement = rootNode;\n this._containerElement.appendChild(rootNode);\n\n const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;\n\n for (let objectId in rootMetaObjects) {\n const rootMetaObject = rootMetaObjects[objectId];\n const metaObjectType = rootMetaObject.type;\n const metaObjectName = rootMetaObject.name;\n const rootName = ((metaObjectName && metaObjectName !== \"\"\n && metaObjectName !== \"Undefined\"\n && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType);\n\n const childNode = this._renderService.createDisabledNodeElement(rootName);\n rootNode.appendChild(childNode);\n }\n }\n\n\n _findEmptyNodes() {\n const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;\n for (let objectId in rootMetaObjects) {\n this._findEmptyNodes2(rootMetaObjects[objectId]);\n }\n }\n\n _findEmptyNodes2(metaObject, countEntities = 0) {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const children = metaObject.children;\n const objectId = metaObject.id;\n const entity = scene.objects[objectId];\n metaObject._countEntities = 0;\n if (entity) {\n metaObject._countEntities++;\n }\n if (children) {\n for (let i = 0, len = children.length; i < len; i++) {\n const childMetaObject = children[i];\n childMetaObject._countEntities = this._findEmptyNodes2(childMetaObject);\n metaObject._countEntities += childMetaObject._countEntities;\n }\n }\n return metaObject._countEntities;\n }\n\n _createStoreysNodes() {\n const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;\n for (let id in rootMetaObjects) {\n this._createStoreysNodes2(rootMetaObjects[id], null, null, null);\n }\n }\n\n _createStoreysNodes2(metaObject, buildingNode, storeyNode, typeNodes) {\n if (this._pruneEmptyNodes && (metaObject._countEntities === 0)) {\n return;\n }\n const metaObjectType = metaObject.type;\n const metaObjectName = metaObject.name;\n const children = metaObject.children;\n const objectId = metaObject.id;\n if (metaObjectType === \"IfcBuilding\") {\n buildingNode = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: (metaObject.metaModels.length === 0) ? \"na\" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Undefined\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType),\n type: metaObjectType,\n parent: null,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n this._rootNodes.push(buildingNode);\n this._objectNodes[buildingNode.objectId] = buildingNode;\n this._nodeNodes[buildingNode.nodeId] = buildingNode;\n } else if (metaObjectType === \"IfcBuildingStorey\") {\n if (!buildingNode) {\n this.error(\"Failed to build storeys hierarchy for model '\" + this.metaModel.id + \"' - model does not have an IfcBuilding object, or is not an IFC model\");\n return;\n }\n storeyNode = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: (metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Undefined\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType,\n type: metaObjectType,\n parent: buildingNode,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n buildingNode.children.push(storeyNode);\n this._objectNodes[storeyNode.objectId] = storeyNode;\n this._nodeNodes[storeyNode.nodeId] = storeyNode;\n typeNodes = {};\n } else {\n if (storeyNode) {\n const objects = this._viewer.scene.objects;\n const object = objects[objectId];\n if (object) {\n typeNodes = typeNodes || {};\n let typeNode = typeNodes[metaObjectType];\n if (!typeNode) {\n typeNode = {\n nodeId: `${this._id}-${storeyNode.objectId}-${metaObjectType}`,\n objectId: `${storeyNode.objectId}-${metaObjectType}`,\n title: metaObjectType,\n type: metaObjectType,\n parent: storeyNode,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n storeyNode.children.push(typeNode);\n this._objectNodes[typeNode.objectId] = typeNode;\n this._nodeNodes[typeNode.nodeId] = typeNode;\n typeNodes[metaObjectType] = typeNode;\n }\n const node = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: (metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Undefined\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType,\n type: metaObjectType,\n parent: typeNode,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n typeNode.children.push(node);\n this._objectNodes[node.objectId] = node;\n this._nodeNodes[node.nodeId] = node;\n }\n }\n }\n if (children) {\n for (let i = 0, len = children.length; i < len; i++) {\n const childMetaObject = children[i];\n this._createStoreysNodes2(childMetaObject, buildingNode, storeyNode, typeNodes);\n }\n }\n }\n\n _createTypesNodes() {\n const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;\n for (let id in rootMetaObjects) {\n this._createTypesNodes2(rootMetaObjects[id], null, null);\n }\n }\n\n _createTypesNodes2(metaObject, rootNode, typeNodes) {\n if (this._pruneEmptyNodes && (metaObject._countEntities === 0)) {\n return;\n }\n const metaObjectType = metaObject.type;\n const metaObjectName = metaObject.name;\n const children = metaObject.children;\n const objectId = metaObject.id;\n if (!metaObject.parent) {\n rootNode = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: metaObject.metaModels.length === 0 ? \"na\" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Undefined\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType),\n type: metaObjectType,\n parent: null,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n this._rootNodes.push(rootNode);\n this._objectNodes[rootNode.objectId] = rootNode;\n this._nodeNodes[rootNode.nodeId] = rootNode;\n typeNodes = {};\n } else {\n if (rootNode) {\n const objects = this._viewer.scene.objects;\n const object = objects[objectId];\n if (object) {\n let typeNode = typeNodes[metaObjectType];\n if (!typeNode) {\n typeNode = {\n nodeId: `${this._id}-${rootNode.objectId}-${metaObjectType}`,\n objectId: `${rootNode.objectId}-${metaObjectType}`,\n title: metaObjectType,\n type: metaObjectType,\n parent: rootNode,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n rootNode.children.push(typeNode);\n this._objectNodes[typeNode.objectId] = typeNode;\n this._nodeNodes[typeNode.nodeId] = typeNode;\n typeNodes[metaObjectType] = typeNode;\n }\n const node = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: (metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType,\n type: metaObjectType,\n parent: typeNode,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n typeNode.children.push(node);\n this._objectNodes[node.objectId] = node;\n this._nodeNodes[node.nodeId] = node;\n }\n }\n }\n if (children) {\n for (let i = 0, len = children.length; i < len; i++) {\n const childMetaObject = children[i];\n this._createTypesNodes2(childMetaObject, rootNode, typeNodes);\n }\n }\n }\n\n _createContainmentNodes() {\n const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;\n for (let id in rootMetaObjects) {\n this._createContainmentNodes2(rootMetaObjects[id], null);\n }\n }\n\n _createContainmentNodes2(metaObject, parent) {\n if (this._pruneEmptyNodes && (metaObject._countEntities === 0)) {\n return;\n }\n const metaObjectType = metaObject.type;\n const metaObjectName = metaObject.name || metaObjectType;\n const children = metaObject.children;\n const objectId = metaObject.id;\n const node = {\n nodeId: `${this._id}-${objectId}`,\n objectId: objectId,\n title: (!parent) ? metaObject.metaModels.length === 0 ? \"na\" : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== \"\" && metaObjectName !== \"Undefined\" && metaObjectName !== \"Default\") ? metaObjectName : metaObjectType,\n type: metaObjectType,\n parent: parent,\n numEntities: 0,\n numVisibleEntities: 0,\n checked: false,\n xrayed: false,\n children: []\n };\n if (parent) {\n parent.children.push(node);\n } else {\n this._rootNodes.push(node);\n }\n this._objectNodes[node.objectId] = node;\n this._nodeNodes[node.nodeId] = node;\n if (children) {\n for (let i = 0, len = children.length; i < len; i++) {\n const childMetaObject = children[i];\n this._createContainmentNodes2(childMetaObject, node);\n }\n }\n }\n\n _doSortNodes() {\n for (let i = 0, len = this._rootNodes.length; i < len; i++) {\n const rootNode = this._rootNodes[i];\n this._sortChildren(rootNode);\n }\n }\n\n _sortChildren(node) {\n const children = node.children;\n if (!children || children.length === 0) {\n return;\n }\n if (this._hierarchy === \"storeys\" && node.type === \"IfcBuilding\") {\n // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys\n children.sort(this._getSpatialSortFunc());\n } else {\n children.sort(this._alphaSortFunc);\n }\n for (let i = 0, len = children.length; i < len; i++) {\n const node = children[i];\n this._sortChildren(node);\n }\n }\n\n _getSpatialSortFunc() { // Creates cached sort func with Viewer in scope\n const viewer = this.viewer;\n const scene = viewer.scene;\n const camera = scene.camera;\n const metaScene = viewer.metaScene;\n return this._spatialSortFunc || (this._spatialSortFunc = (node1, node2) => {\n if (!node1.aabb || !node2.aabb) {\n // Sorting on lowest point of the AABB is likely more more robust when objects could overlap storeys\n if (!node1.aabb) {\n node1.aabb = scene.getAABB(metaScene.getObjectIDsInSubtree(node1.objectId));\n }\n if (!node2.aabb) {\n node2.aabb = scene.getAABB(metaScene.getObjectIDsInSubtree(node2.objectId));\n }\n }\n let idx = 0;\n if (camera.xUp) {\n idx = 0;\n } else if (camera.yUp) {\n idx = 1;\n } else {\n idx = 2;\n }\n if (node1.aabb[idx] > node2.aabb[idx]) {\n return -1;\n }\n if (node1.aabb[idx] < node2.aabb[idx]) {\n return 1;\n }\n return 0;\n });\n }\n\n _alphaSortFunc(node1, node2) {\n const title1 = node1.title.toUpperCase(); // FIXME: Should be case sensitive?\n const title2 = node2.title.toUpperCase();\n if (title1 < title2) {\n return -1;\n }\n if (title1 > title2) {\n return 1;\n }\n return 0;\n }\n\n _synchNodesToEntities() {\n const objectIds = Object.keys(this.viewer.metaScene.metaObjects);\n const metaObjects = this._viewer.metaScene.metaObjects;\n const objects = this._viewer.scene.objects;\n for (let i = 0, len = objectIds.length; i < len; i++) {\n const objectId = objectIds[i];\n const metaObject = metaObjects[objectId];\n if (metaObject) {\n const node = this._objectNodes[objectId];\n if (node) {\n const entity = objects[objectId];\n if (entity) {\n const visible = entity.visible;\n node.numEntities = 1;\n node.xrayed = entity.xrayed;\n if (visible) {\n node.numVisibleEntities = 1;\n node.checked = true;\n } else {\n node.numVisibleEntities = 0;\n node.checked = false;\n }\n let parent = node.parent; // Synch parents\n while (parent) {\n parent.numEntities++;\n if (visible) {\n parent.numVisibleEntities++;\n parent.checked = true;\n }\n parent = parent.parent;\n }\n }\n }\n }\n }\n }\n\n _withNodeTree(node, callback) {\n callback(node);\n const children = node.children;\n if (!children) {\n return;\n }\n for (let i = 0, len = children.length; i < len; i++) {\n this._withNodeTree(children[i], callback);\n }\n }\n\n _createTrees() {\n if (this._rootNodes.length === 0) {\n return;\n }\n const rootNodeElements = this._rootNodes.map((rootNode) => {\n return this._createNodeElement(rootNode);\n });\n\n const rootNode = this._renderService.createRootNode();\n rootNodeElements.forEach((nodeElement) => {\n rootNode.appendChild(nodeElement);\n });\n\n this._containerElement.appendChild(rootNode);\n this._rootElement = rootNode;\n }\n\n _createNodeElement(node) {\n const contextmenuHandler = (event) =>{\n this.fire(\"contextmenu\", {\n event: event,\n viewer: this._viewer,\n treeViewPlugin: this,\n treeViewNode: node\n });\n event.preventDefault();\n };\n const onclickHandler = (event) => {\n this.fire(\"nodeTitleClicked\", {\n event: event,\n viewer: this._viewer,\n treeViewPlugin: this,\n treeViewNode: node\n });\n event.preventDefault();\n };\n\n return this._renderService.createNodeElement(node, this._switchExpandHandler, this._checkboxChangeHandler, contextmenuHandler, onclickHandler);\n }\n\n _expandSwitchElement(switchElement) {\n const expanded = this._renderService.isExpanded(switchElement); \n if (expanded) {\n return;\n }\n\n const nodeId = this._renderService.getId(switchElement);\n\n const nodeElements = this._nodeNodes[nodeId].children.map((node) => {\n return this._createNodeElement(node);\n });\n\n this._renderService.addChildren(switchElement, nodeElements)\n\n this._renderService.expand(switchElement, this._switchExpandHandler, this._switchCollapseHandler);\n }\n\n _collapseNode(nodeId) {\n const switchElement = this._renderService.getSwitchElement(nodeId);\n this._collapseSwitchElement(switchElement);\n }\n\n _collapseSwitchElement(switchElement) {\n this._renderService.collapse(switchElement, this._switchExpandHandler, this._switchCollapseHandler);\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/TreeViewPlugin/TreeViewPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/TreeViewPlugin/TreeViewPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1533, + "__docId__": 1541, "kind": "variable", "name": "treeViews", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js", @@ -28566,7 +28782,7 @@ "ignore": true }, { - "__docId__": 1534, + "__docId__": 1542, "kind": "class", "name": "TreeViewPlugin", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js", @@ -28590,7 +28806,7 @@ ] }, { - "__docId__": 1535, + "__docId__": 1543, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28719,7 +28935,7 @@ ] }, { - "__docId__": 1536, + "__docId__": 1544, "kind": "member", "name": "errors", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28738,7 +28954,7 @@ } }, { - "__docId__": 1537, + "__docId__": 1545, "kind": "member", "name": "valid", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28757,7 +28973,7 @@ } }, { - "__docId__": 1538, + "__docId__": 1546, "kind": "member", "name": "_index", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28775,7 +28991,7 @@ } }, { - "__docId__": 1539, + "__docId__": 1547, "kind": "member", "name": "_id", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28793,7 +29009,7 @@ } }, { - "__docId__": 1540, + "__docId__": 1548, "kind": "member", "name": "_containerElement", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28811,7 +29027,7 @@ } }, { - "__docId__": 1541, + "__docId__": 1549, "kind": "member", "name": "_metaModels", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28829,7 +29045,7 @@ } }, { - "__docId__": 1542, + "__docId__": 1550, "kind": "member", "name": "_autoAddModels", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28847,7 +29063,7 @@ } }, { - "__docId__": 1543, + "__docId__": 1551, "kind": "member", "name": "_autoExpandDepth", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28865,7 +29081,7 @@ } }, { - "__docId__": 1544, + "__docId__": 1552, "kind": "member", "name": "_sortNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28883,7 +29099,7 @@ } }, { - "__docId__": 1545, + "__docId__": 1553, "kind": "member", "name": "_viewer", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28901,7 +29117,7 @@ } }, { - "__docId__": 1546, + "__docId__": 1554, "kind": "member", "name": "_rootElement", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28919,7 +29135,7 @@ } }, { - "__docId__": 1547, + "__docId__": 1555, "kind": "member", "name": "_muteSceneEvents", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28937,7 +29153,7 @@ } }, { - "__docId__": 1548, + "__docId__": 1556, "kind": "member", "name": "_muteTreeEvents", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28955,7 +29171,7 @@ } }, { - "__docId__": 1549, + "__docId__": 1557, "kind": "member", "name": "_rootNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28973,7 +29189,7 @@ } }, { - "__docId__": 1550, + "__docId__": 1558, "kind": "member", "name": "_objectNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -28991,7 +29207,7 @@ } }, { - "__docId__": 1551, + "__docId__": 1559, "kind": "member", "name": "_nodeNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29009,7 +29225,7 @@ } }, { - "__docId__": 1552, + "__docId__": 1560, "kind": "member", "name": "_rootNames", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29027,7 +29243,7 @@ } }, { - "__docId__": 1554, + "__docId__": 1562, "kind": "member", "name": "_pruneEmptyNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29045,7 +29261,7 @@ } }, { - "__docId__": 1555, + "__docId__": 1563, "kind": "member", "name": "_showListItemElementId", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29063,7 +29279,7 @@ } }, { - "__docId__": 1556, + "__docId__": 1564, "kind": "member", "name": "_renderService", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29081,7 +29297,7 @@ } }, { - "__docId__": 1557, + "__docId__": 1565, "kind": "member", "name": "_onObjectVisibility", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29099,7 +29315,7 @@ } }, { - "__docId__": 1560, + "__docId__": 1568, "kind": "member", "name": "_onObjectXrayed", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29117,7 +29333,7 @@ } }, { - "__docId__": 1563, + "__docId__": 1571, "kind": "member", "name": "_switchExpandHandler", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29135,7 +29351,7 @@ } }, { - "__docId__": 1564, + "__docId__": 1572, "kind": "member", "name": "_switchCollapseHandler", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29153,7 +29369,7 @@ } }, { - "__docId__": 1565, + "__docId__": 1573, "kind": "member", "name": "_checkboxChangeHandler", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29171,7 +29387,7 @@ } }, { - "__docId__": 1568, + "__docId__": 1576, "kind": "member", "name": "_hierarchy", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29189,7 +29405,7 @@ } }, { - "__docId__": 1571, + "__docId__": 1579, "kind": "set", "name": "hierarchy", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29210,7 +29426,7 @@ } }, { - "__docId__": 1573, + "__docId__": 1581, "kind": "get", "name": "hierarchy", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29231,7 +29447,7 @@ } }, { - "__docId__": 1574, + "__docId__": 1582, "kind": "method", "name": "addModel", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29277,7 +29493,7 @@ "return": null }, { - "__docId__": 1575, + "__docId__": 1583, "kind": "method", "name": "removeModel", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29303,7 +29519,7 @@ "return": null }, { - "__docId__": 1576, + "__docId__": 1584, "kind": "method", "name": "showNode", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29333,7 +29549,7 @@ } }, { - "__docId__": 1578, + "__docId__": 1586, "kind": "method", "name": "unShowNode", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29348,7 +29564,7 @@ "return": null }, { - "__docId__": 1580, + "__docId__": 1588, "kind": "method", "name": "expandToDepth", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29374,7 +29590,7 @@ "return": null }, { - "__docId__": 1581, + "__docId__": 1589, "kind": "method", "name": "collapse", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29389,7 +29605,7 @@ "return": null }, { - "__docId__": 1582, + "__docId__": 1590, "kind": "method", "name": "withNodeTree", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29425,7 +29641,7 @@ "return": null }, { - "__docId__": 1583, + "__docId__": 1591, "kind": "method", "name": "destroy", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29440,7 +29656,7 @@ "return": null }, { - "__docId__": 1585, + "__docId__": 1593, "kind": "member", "name": "_destroyed", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29458,7 +29674,7 @@ } }, { - "__docId__": 1586, + "__docId__": 1594, "kind": "method", "name": "_createNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29475,7 +29691,7 @@ "return": null }, { - "__docId__": 1591, + "__docId__": 1599, "kind": "method", "name": "_validate", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29496,7 +29712,7 @@ } }, { - "__docId__": 1596, + "__docId__": 1604, "kind": "method", "name": "_validateMetaModelForStoreysHierarchy", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29539,7 +29755,7 @@ } }, { - "__docId__": 1597, + "__docId__": 1605, "kind": "method", "name": "_createEnabledNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29556,7 +29772,7 @@ "return": null }, { - "__docId__": 1598, + "__docId__": 1606, "kind": "method", "name": "_createDisabledNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29573,7 +29789,7 @@ "return": null }, { - "__docId__": 1600, + "__docId__": 1608, "kind": "method", "name": "_findEmptyNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29590,7 +29806,7 @@ "return": null }, { - "__docId__": 1601, + "__docId__": 1609, "kind": "method", "name": "_findEmptyNodes2", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29627,7 +29843,7 @@ } }, { - "__docId__": 1602, + "__docId__": 1610, "kind": "method", "name": "_createStoreysNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29644,7 +29860,7 @@ "return": null }, { - "__docId__": 1603, + "__docId__": 1611, "kind": "method", "name": "_createStoreysNodes2", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29686,7 +29902,7 @@ "return": null }, { - "__docId__": 1604, + "__docId__": 1612, "kind": "method", "name": "_createTypesNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29703,7 +29919,7 @@ "return": null }, { - "__docId__": 1605, + "__docId__": 1613, "kind": "method", "name": "_createTypesNodes2", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29739,7 +29955,7 @@ "return": null }, { - "__docId__": 1606, + "__docId__": 1614, "kind": "method", "name": "_createContainmentNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29756,7 +29972,7 @@ "return": null }, { - "__docId__": 1607, + "__docId__": 1615, "kind": "method", "name": "_createContainmentNodes2", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29786,7 +30002,7 @@ "return": null }, { - "__docId__": 1608, + "__docId__": 1616, "kind": "method", "name": "_doSortNodes", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29803,7 +30019,7 @@ "return": null }, { - "__docId__": 1609, + "__docId__": 1617, "kind": "method", "name": "_sortChildren", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29827,7 +30043,7 @@ "return": null }, { - "__docId__": 1610, + "__docId__": 1618, "kind": "method", "name": "_getSpatialSortFunc", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29848,7 +30064,7 @@ } }, { - "__docId__": 1611, + "__docId__": 1619, "kind": "method", "name": "_alphaSortFunc", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29882,7 +30098,7 @@ } }, { - "__docId__": 1612, + "__docId__": 1620, "kind": "method", "name": "_synchNodesToEntities", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29899,7 +30115,7 @@ "return": null }, { - "__docId__": 1613, + "__docId__": 1621, "kind": "method", "name": "_withNodeTree", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29929,7 +30145,7 @@ "return": null }, { - "__docId__": 1614, + "__docId__": 1622, "kind": "method", "name": "_createTrees", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29946,7 +30162,7 @@ "return": null }, { - "__docId__": 1616, + "__docId__": 1624, "kind": "method", "name": "_createNodeElement", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29974,7 +30190,7 @@ } }, { - "__docId__": 1617, + "__docId__": 1625, "kind": "method", "name": "_expandSwitchElement", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -29998,7 +30214,7 @@ "return": null }, { - "__docId__": 1618, + "__docId__": 1626, "kind": "method", "name": "_collapseNode", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -30022,7 +30238,7 @@ "return": null }, { - "__docId__": 1619, + "__docId__": 1627, "kind": "method", "name": "_collapseSwitchElement", "memberof": "src/plugins/TreeViewPlugin/TreeViewPlugin.js~TreeViewPlugin", @@ -30046,29 +30262,29 @@ "return": null }, { - "__docId__": 1620, + "__docId__": 1628, "kind": "file", "name": "src/plugins/TreeViewPlugin/index.js", "content": "export * from \"./TreeViewPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/TreeViewPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/TreeViewPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1621, + "__docId__": 1629, "kind": "file", "name": "src/plugins/ViewCullPlugin/ViewCullPlugin.js", "content": "import {Plugin} from \"../../viewer/Plugin.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\nimport {Frustum, frustumIntersectsAABB3, setFrustum} from \"../../viewer/scene/math/Frustum.js\";\nimport {getObjectCullStates} from \"../lib/culling/ObjectCullStates.js\";\n\nconst MAX_KD_TREE_DEPTH = 8; // Increase if greater precision needed\n\nconst kdTreeDimLength = new Float32Array(3);\n\n/**\n * {@link Viewer} plugin that performs view frustum culling to accelerate rendering performance.\n *\n * For each {@link Entity} that represents an object, ````ViewCullPlugin```` will automatically\n * set {@link Entity#culled}````false```` whenever it falls outside our field of view.\n *\n * When culled, an ````Entity```` is not processed by xeokit's renderer.\n *\n * Internally, ````ViewCullPlugin```` organizes {@link Entity}s in\n * a [bounding volume hierarchy](https://en.wikipedia.org/wiki/Bounding_volume_hierarchy), implemented as\n * a [kd-tree](https://en.wikipedia.org/wiki/K-d_tree).\n *\n * On each {@link Scene} \"tick\" event, ````ViewCullPlugin```` searches the kd-tree using a frustum generated from\n * the {@link Camera}, marking each ````Entity```` **culled** if it falls outside the frustum.\n *\n * Use ````ViewCullPlugin```` by simply adding it to your ````Viewer````:\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * const viewCullPlugin = new ViewCullPlugin(viewer, {\n * maxTreeDepth: 20\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/OTCConferenceCenter.xkt\"\n * });\n * ````\n */\nclass ViewCullPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"ViewCull\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"ViewCull\", viewer);\n\n this._objectCullStates = getObjectCullStates(viewer.scene); // Combines updates from multiple culling systems for its Scene's Entities\n\n this._maxTreeDepth = cfg.maxTreeDepth || MAX_KD_TREE_DEPTH;\n this._modelInfos = {};\n this._frustum = new Frustum();\n this._kdRoot = null;\n\n this._frustumDirty = false;\n this._kdTreeDirty = false;\n\n this._onViewMatrix = viewer.scene.camera.on(\"viewMatrix\", () => {\n this._frustumDirty = true;\n });\n\n this._onProjMatrix = viewer.scene.camera.on(\"projMatMatrix\", () => {\n this._frustumDirty = true;\n });\n\n this._onModelLoaded = viewer.scene.on(\"modelLoaded\", (modelId) => {\n const model = this.viewer.scene.models[modelId];\n if (model) {\n this._addModel(model);\n }\n });\n\n this._onSceneTick = viewer.scene.on(\"tick\", () => {\n this._doCull();\n });\n }\n\n /**\n * Sets whether view culling is enabled.\n *\n * @param {Boolean} enabled Whether to enable view culling.\n */\n set enabled(enabled) {\n this._enabled = enabled;\n }\n\n /**\n * Gets whether view culling is enabled.\n *\n * @retutns {Boolean} Whether view culling is enabled.\n */\n get enabled() {\n return this._enabled;\n }\n\n _addModel(model) {\n const modelInfo = {\n model: model,\n onDestroyed: model.on(\"destroyed\", () => {\n this._removeModel(model);\n })\n };\n this._modelInfos[model.id] = modelInfo;\n this._kdTreeDirty = true;\n }\n\n _removeModel(model) {\n const modelInfo = this._modelInfos[model.id];\n if (modelInfo) {\n modelInfo.model.off(modelInfo.onDestroyed);\n delete this._modelInfos[model.id];\n this._kdTreeDirty = true;\n }\n }\n\n _doCull() {\n const cullDirty = (this._frustumDirty || this._kdTreeDirty);\n if (this._frustumDirty) {\n this._buildFrustum();\n }\n if (this._kdTreeDirty) {\n this._buildKDTree();\n }\n if (cullDirty) {\n const kdNode = this._kdRoot;\n if (kdNode) {\n this._visitKDNode(kdNode);\n }\n }\n }\n\n _buildFrustum() {\n const camera = this.viewer.scene.camera;\n setFrustum(this._frustum, camera.viewMatrix, camera.projMatrix);\n this._frustumDirty = false;\n }\n\n _buildKDTree() {\n const viewer = this.viewer;\n const scene = viewer.scene;\n const depth = 0;\n if (this._kdRoot) {\n // TODO: uncull all objects with respect to this frustum culling plugin?\n\n }\n this._kdRoot = {\n aabb: scene.getAABB(),\n intersection: Frustum.INTERSECT\n };\n for (let objectIdx = 0, len = this._objectCullStates.numObjects; objectIdx < len; objectIdx++) {\n const entity = this._objectCullStates.objects[objectIdx];\n this._insertEntityIntoKDTree(this._kdRoot, entity, objectIdx, depth + 1);\n }\n this._kdTreeDirty = false;\n }\n\n _insertEntityIntoKDTree(kdNode, entity, objectIdx, depth) {\n\n const entityAABB = entity.aabb;\n\n if (depth >= this._maxTreeDepth) {\n kdNode.objects = kdNode.objects || [];\n kdNode.objects.push(objectIdx);\n math.expandAABB3(kdNode.aabb, entityAABB);\n return;\n }\n\n if (kdNode.left) {\n if (math.containsAABB3(kdNode.left.aabb, entityAABB)) {\n this._insertEntityIntoKDTree(kdNode.left, entity, objectIdx, depth + 1);\n return;\n }\n }\n\n if (kdNode.right) {\n if (math.containsAABB3(kdNode.right.aabb, entityAABB)) {\n this._insertEntityIntoKDTree(kdNode.right, entity, objectIdx, depth + 1);\n return;\n }\n }\n\n const nodeAABB = kdNode.aabb;\n\n kdTreeDimLength[0] = nodeAABB[3] - nodeAABB[0];\n kdTreeDimLength[1] = nodeAABB[4] - nodeAABB[1];\n kdTreeDimLength[2] = nodeAABB[5] - nodeAABB[2];\n\n let dim = 0;\n\n if (kdTreeDimLength[1] > kdTreeDimLength[dim]) {\n dim = 1;\n }\n\n if (kdTreeDimLength[2] > kdTreeDimLength[dim]) {\n dim = 2;\n }\n\n if (!kdNode.left) {\n const aabbLeft = nodeAABB.slice();\n aabbLeft[dim + 3] = ((nodeAABB[dim] + nodeAABB[dim + 3]) / 2.0);\n kdNode.left = {\n aabb: aabbLeft,\n intersection: Frustum.INTERSECT\n };\n if (math.containsAABB3(aabbLeft, entityAABB)) {\n this._insertEntityIntoKDTree(kdNode.left, entity, objectIdx, depth + 1);\n return;\n }\n }\n\n if (!kdNode.right) {\n const aabbRight = nodeAABB.slice();\n aabbRight[dim] = ((nodeAABB[dim] + nodeAABB[dim + 3]) / 2.0);\n kdNode.right = {\n aabb: aabbRight,\n intersection: Frustum.INTERSECT\n };\n if (math.containsAABB3(aabbRight, entityAABB)) {\n this._insertEntityIntoKDTree(kdNode.right, entity, objectIdx, depth + 1);\n return;\n }\n }\n\n kdNode.objects = kdNode.objects || [];\n kdNode.objects.push(objectIdx);\n\n math.expandAABB3(kdNode.aabb, entityAABB);\n }\n\n _visitKDNode(kdNode, intersects = Frustum.INTERSECT) {\n if (intersects !== Frustum.INTERSECT && kdNode.intersects === intersects) {\n return;\n }\n if (intersects === Frustum.INTERSECT) {\n intersects = frustumIntersectsAABB3(this._frustum, kdNode.aabb);\n kdNode.intersects = intersects;\n }\n const culled = (intersects === Frustum.OUTSIDE);\n const objects = kdNode.objects;\n if (objects && objects.length > 0) {\n for (let i = 0, len = objects.length; i < len; i++) {\n const objectIdx = objects[i];\n this._objectCullStates.setObjectViewCulled(objectIdx, culled);\n }\n }\n if (kdNode.left) {\n this._visitKDNode(kdNode.left, intersects);\n }\n if (kdNode.right) {\n this._visitKDNode(kdNode.right, intersects);\n }\n }\n\n /**\n * @private\n */\n send(name, value) {\n }\n\n /**\n * Destroys this ViewCullPlugin.\n */\n destroy() {\n super.destroy();\n this._clear();\n const scene = this.viewer.scene;\n const camera = scene.camera;\n scene.off(this._onModelLoaded);\n scene.off(this._onSceneTick);\n camera.off(this._onViewMatrix);\n camera.off(this._onProjMatrix);\n }\n\n _clear() {\n for (let modelId in this._modelInfos) {\n const modelInfo = this._modelInfos[modelId];\n modelInfo.model.off(modelInfo.onDestroyed);\n }\n this._modelInfos = {};\n this._kdRoot = null;\n this._kdTreeDirty = true;\n }\n}\n\nexport {ViewCullPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/ViewCullPlugin/ViewCullPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/ViewCullPlugin/ViewCullPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1622, + "__docId__": 1630, "kind": "variable", "name": "MAX_KD_TREE_DEPTH", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js", @@ -30089,7 +30305,7 @@ "ignore": true }, { - "__docId__": 1623, + "__docId__": 1631, "kind": "variable", "name": "kdTreeDimLength", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js", @@ -30110,7 +30326,7 @@ "ignore": true }, { - "__docId__": 1624, + "__docId__": 1632, "kind": "class", "name": "ViewCullPlugin", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js", @@ -30128,7 +30344,7 @@ ] }, { - "__docId__": 1625, + "__docId__": 1633, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30193,7 +30409,7 @@ ] }, { - "__docId__": 1626, + "__docId__": 1634, "kind": "member", "name": "_objectCullStates", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30211,7 +30427,7 @@ } }, { - "__docId__": 1627, + "__docId__": 1635, "kind": "member", "name": "_maxTreeDepth", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30229,7 +30445,7 @@ } }, { - "__docId__": 1628, + "__docId__": 1636, "kind": "member", "name": "_modelInfos", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30247,7 +30463,7 @@ } }, { - "__docId__": 1629, + "__docId__": 1637, "kind": "member", "name": "_frustum", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30265,7 +30481,7 @@ } }, { - "__docId__": 1630, + "__docId__": 1638, "kind": "member", "name": "_kdRoot", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30283,7 +30499,7 @@ } }, { - "__docId__": 1631, + "__docId__": 1639, "kind": "member", "name": "_frustumDirty", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30301,7 +30517,7 @@ } }, { - "__docId__": 1632, + "__docId__": 1640, "kind": "member", "name": "_kdTreeDirty", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30319,7 +30535,7 @@ } }, { - "__docId__": 1633, + "__docId__": 1641, "kind": "member", "name": "_onViewMatrix", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30337,7 +30553,7 @@ } }, { - "__docId__": 1635, + "__docId__": 1643, "kind": "member", "name": "_onProjMatrix", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30355,7 +30571,7 @@ } }, { - "__docId__": 1637, + "__docId__": 1645, "kind": "member", "name": "_onModelLoaded", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30373,7 +30589,7 @@ } }, { - "__docId__": 1638, + "__docId__": 1646, "kind": "member", "name": "_onSceneTick", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30391,7 +30607,7 @@ } }, { - "__docId__": 1639, + "__docId__": 1647, "kind": "set", "name": "enabled", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30416,7 +30632,7 @@ ] }, { - "__docId__": 1640, + "__docId__": 1648, "kind": "member", "name": "_enabled", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30434,7 +30650,7 @@ } }, { - "__docId__": 1641, + "__docId__": 1649, "kind": "get", "name": "enabled", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30458,7 +30674,7 @@ } }, { - "__docId__": 1642, + "__docId__": 1650, "kind": "method", "name": "_addModel", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30482,7 +30698,7 @@ "return": null }, { - "__docId__": 1644, + "__docId__": 1652, "kind": "method", "name": "_removeModel", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30506,7 +30722,7 @@ "return": null }, { - "__docId__": 1646, + "__docId__": 1654, "kind": "method", "name": "_doCull", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30523,7 +30739,7 @@ "return": null }, { - "__docId__": 1647, + "__docId__": 1655, "kind": "method", "name": "_buildFrustum", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30540,7 +30756,7 @@ "return": null }, { - "__docId__": 1649, + "__docId__": 1657, "kind": "method", "name": "_buildKDTree", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30557,7 +30773,7 @@ "return": null }, { - "__docId__": 1652, + "__docId__": 1660, "kind": "method", "name": "_insertEntityIntoKDTree", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30599,7 +30815,7 @@ "return": null }, { - "__docId__": 1653, + "__docId__": 1661, "kind": "method", "name": "_visitKDNode", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30630,7 +30846,7 @@ "return": null }, { - "__docId__": 1654, + "__docId__": 1662, "kind": "method", "name": "send", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30659,7 +30875,7 @@ "return": null }, { - "__docId__": 1655, + "__docId__": 1663, "kind": "method", "name": "destroy", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30674,7 +30890,7 @@ "return": null }, { - "__docId__": 1656, + "__docId__": 1664, "kind": "method", "name": "_clear", "memberof": "src/plugins/ViewCullPlugin/ViewCullPlugin.js~ViewCullPlugin", @@ -30691,29 +30907,29 @@ "return": null }, { - "__docId__": 1660, + "__docId__": 1668, "kind": "file", "name": "src/plugins/ViewCullPlugin/index.js", "content": "export * from \"./ViewCullPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/ViewCullPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/ViewCullPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1661, + "__docId__": 1669, "kind": "file", "name": "src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js", "content": "/**\n * Default data access strategy for {@link WebIFCLoaderPlugin}.\n */\nclass WebIFCDefaultDataSource {\n\n constructor() {\n }\n\n /**\n * Gets the contents of the given IFC file in an arraybuffer.\n *\n * @param {String|Number} src Path or ID of an IFC file.\n * @param {Function} ok Callback fired on success, argument is the IFC file in an arraybuffer.\n * @param {Function} error Callback fired on error.\n */\n getIFC(src, ok, error) {\n var defaultCallback = () => {\n };\n ok = ok || defaultCallback;\n error = error || defaultCallback;\n const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n const dataUriRegexResult = src.match(dataUriRegex);\n if (dataUriRegexResult) { // Safari can't handle data URIs through XMLHttpRequest\n const isBase64 = !!dataUriRegexResult[2];\n var data = dataUriRegexResult[3];\n data = window.decodeURIComponent(data);\n if (isBase64) {\n data = window.atob(data);\n }\n try {\n const buffer = new ArrayBuffer(data.length);\n const view = new Uint8Array(buffer);\n for (var i = 0; i < data.length; i++) {\n view[i] = data.charCodeAt(i);\n }\n ok(buffer);\n } catch (errMsg) {\n error(errMsg);\n }\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', src, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n error('getXKT error : ' + request.response);\n }\n }\n };\n request.send(null);\n }\n }\n}\n\nexport {WebIFCDefaultDataSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1662, + "__docId__": 1670, "kind": "class", "name": "WebIFCDefaultDataSource", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js", @@ -30728,7 +30944,7 @@ "interface": false }, { - "__docId__": 1663, + "__docId__": 1671, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js~WebIFCDefaultDataSource", @@ -30742,7 +30958,7 @@ "undocument": true }, { - "__docId__": 1664, + "__docId__": 1672, "kind": "method", "name": "getIFC", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js~WebIFCDefaultDataSource", @@ -30789,18 +31005,18 @@ "return": null }, { - "__docId__": 1665, + "__docId__": 1673, "kind": "file", "name": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js", "content": "import {utils} from \"../../viewer/scene/utils.js\"\nimport {SceneModel} from \"../../viewer/scene/model/index.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {WebIFCDefaultDataSource} from \"./WebIFCDefaultDataSource.js\";\nimport {IFCObjectDefaults} from \"../../viewer/metadata/IFCObjectDefaults.js\";\nimport {math} from \"../../viewer/index.js\";\nimport {worldToRTCPositions} from \"../../viewer/scene/math/rtcCoords.js\";\n\n/**\n * {@link Viewer} plugin that uses [web-ifc](https://github.com/tomvandig/web-ifc) to load BIM models directly from IFC files.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_WebIFCLoaderPlugin_Duplex)]\n *\n * ## Overview\n *\n * * Loads small-to-medium sized BIM models directly from IFC files.\n * * Uses [web-ifc](https://github.com/tomvandig/web-ifc) to parse IFC files in the browser.\n * * Loads IFC geometry, element structure metadata, and property sets.\n * * Not for large models. For best performance with large models, we recommend using {@link XKTLoaderPlugin}.\n * * Loads double-precision coordinates, enabling models to be viewed at global coordinates without accuracy loss.\n * * Allows to set the position, scale and rotation of each model as you load it.\n * * Filter which IFC types get loaded.\n * * Configure initial appearances of specified IFC types.\n * * Set a custom data source for IFC files.\n * * Load multiple copies of the same model.\n *\n * ## Limitations\n *\n * Loading and parsing huge IFC STEP files can be slow, and can overwhelm the browser, however. To view your\n * largest IFC models, we recommend instead pre-converting those to xeokit's compressed native .XKT format, then\n * loading them with {@link XKTLoaderPlugin} instead.

    \n *\n * ## Scene representation\n *\n * When loading a model, WebIFCLoaderPlugin creates an {@link Entity} that represents the model, which\n * will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id}\n * in {@link Scene#models}. The WebIFCLoaderPlugin also creates an {@link Entity} for each object within the\n * model. Those Entities will have {@link Entity#isObject} set ````true```` and will be registered\n * by {@link Entity#id} in {@link Scene#objects}.\n *\n * ## Metadata\n *\n * When loading a model, WebIFCLoaderPlugin also creates a {@link MetaModel} that represents the model, which contains\n * a {@link MetaObject} for each IFC element, plus a {@link PropertySet} for each IFC property set. Loading metadata can be very slow, so we can also optionally disable it if we\n * don't need it.\n *\n * ## Usage\n *\n * In the example below we'll load the Duplex BIM model from\n * an [IFC file](https://github.com/xeokit/xeokit-sdk/tree/master/assets/models/ifc). Within our {@link Viewer}, this will create a bunch of {@link Entity}s that represents the model and its objects, along with a {@link MetaModel}, {@link MetaObject}s and {@link PropertySet}s\n * that hold their metadata.\n *\n * Since this model contains IFC types, the WebIFCLoaderPlugin will set the initial appearance of each object\n * {@link Entity} according to its IFC type in {@link WebIFCLoaderPlugin#objectDefaults}.\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_WebIFCLoaderPlugin_isolateStorey)]\n *\n * ````javascript\n * import {Viewer, WebIFCLoaderPlugin} from \"xeokit-sdk.es.js\";\n * import * as WebIFC from \"https://cdn.jsdelivr.net/npm/web-ifc@0.0.51/web-ifc-api.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a Viewer,\n * // 2. Arrange the camera\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * // 2\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a web-ifc API, which will parse IFC for our WebIFCLoaderPlugin\n * // 2. Connect the API to the web-ifc WASM module, which powers the parsing\n * // 3. Initialize the web-ifc API\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n *\n * const IfcAPI = new this._webIFC.IfcAPI();\n *\n * // 2\n *\n * IfcAPI.SetWasmPath(\"https://cdn.jsdelivr.net/npm/web-ifc@0.0.51/\");\n *\n * // 3\n *\n * IfcAPI.Init().then(() => {\n *\n * //------------------------------------------------------------------------------------------------------------\n * // 1. Create a WebIFCLoaderPlugin, configured with the web-ifc module and a web-ifc API instance\n * // 2. Load a BIM model fom an IFC file, excluding its IfcSpace elements, and highlighting edges\n * //------------------------------------------------------------------------------------------------------------\n *\n * const ifcLoader = new WebIFCLoaderPlugin(viewer, {\n * WebIFC,\n * IfcAPI\n * });\n *\n * // 2\n * const model = ifcLoader.load({ // Returns an Entity that represents the model\n * id: \"myModel\",\n * src: \"../assets/models/ifc/Duplex.ifc\",\n * excludeTypes: [\"IfcSpace\"],\n * edges: true\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * //----------------------------------------------------------------------------------------------------------\n * // 1. Find metadata on the bottom storey\n * // 2. X-ray all the objects except for the bottom storey\n * // 3. Fit the bottom storey in view\n * //----------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const metaModel = viewer.metaScene.metaModels[\"myModel\"]; // MetaModel with ID \"myModel\"\n * const metaObject\n * = viewer.metaScene.metaObjects[\"1xS3BCk291UvhgP2dvNsgp\"]; // MetaObject with ID \"1xS3BCk291UvhgP2dvNsgp\"\n *\n * const name = metaObject.name; // \"01 eerste verdieping\"\n * const type = metaObject.type; // \"IfcBuildingStorey\"\n * const parent = metaObject.parent; // MetaObject with type \"IfcBuilding\"\n * const children = metaObject.children; // Array of child MetaObjects\n * const objectId = metaObject.id; // \"1xS3BCk291UvhgP2dvNsgp\"\n * const objectIds = viewer.metaScene.getObjectIDsInSubtree(objectId); // IDs of leaf sub-objects\n * const aabb = viewer.scene.getAABB(objectIds); // Axis-aligned boundary of the leaf sub-objects\n *\n * // 2\n * viewer.scene.setObjectsXRayed(viewer.scene.objectIds, true);\n * viewer.scene.setObjectsXRayed(objectIds, false);\n *\n * // 3\n * viewer.cameraFlight.flyTo(aabb);\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Destroy the model\n * model.destroy();\n * });\n * });\n * ````\n *\n * ## Transforming\n *\n * We have the option to rotate, scale and translate each IFC model as we load it.\n *\n * This lets us load multiple models, or even multiple copies of the same model, and position them apart from each other.\n *\n * In the example below, we'll scale our model to half its size, rotate it 90 degrees about its local X-axis, then\n * translate it 100 units along its X axis.\n *\n * ````javascript\n * ifcLoader.load({\n * src: \"../assets/models/ifc/Duplex.ifc\",\n * rotation: [90,0,0],\n * scale: [0.5, 0.5, 0.5],\n * origin: [100, 0, 0]\n * });\n * ````\n *\n * ## Including and excluding IFC types\n *\n * We can also load only those objects that have the specified IFC types.\n *\n * In the example below, we'll load only the objects that represent walls.\n *\n * ````javascript\n * const model2 = ifcLoader.load({\n * id: \"myModel2\",\n * src: \"../assets/models/ifc/Duplex.ifc\",\n * includeTypes: [\"IfcWallStandardCase\"]\n * });\n * ````\n *\n * We can also load only those objects that **don't** have the specified IFC types.\n *\n * In the example below, we'll load only the objects that do not represent empty space.\n *\n * ````javascript\n * const model3 = ifcLoader.load({\n * id: \"myModel3\",\n * src: \"../assets/models/ifc/Duplex.ifc\",\n * excludeTypes: [\"IfcSpace\"]\n * });\n * ````\n *\n * ## Configuring initial IFC object appearances\n *\n * We can specify the custom initial appearance of loaded objects according to their IFC types.\n *\n * This is useful for things like:\n *\n * * setting the colors to our objects according to their IFC types,\n * * automatically hiding ````IfcSpace```` objects, and\n * * ensuring that ````IfcWindow```` objects are always transparent.\n *
    \n * In the example below, we'll load a model, while configuring ````IfcSpace```` elements to be always initially invisible,\n * and ````IfcWindow```` types to be always translucent blue.\n *\n * ````javascript\n * const myObjectDefaults = {\n *\n * IfcSpace: {\n * visible: false\n * },\n * IfcWindow: {\n * colorize: [0.337255, 0.303922, 0.870588], // Blue\n * opacity: 0.3\n * },\n *\n * //...\n *\n * DEFAULT: {\n * colorize: [0.5, 0.5, 0.5]\n * }\n * };\n *\n * const model4 = ifcLoader.load({\n * id: \"myModel4\",\n * src: \"../assets/models/ifc/Duplex.ifc\",\n * objectDefaults: myObjectDefaults // Use our custom initial default states for object Entities\n * });\n * ````\n *\n * When we don't customize the appearance of IFC types, as just above, then IfcSpace elements tend to obscure other\n * elements, which can be confusing.\n *\n * It's often helpful to make IfcSpaces transparent and unpickable, like this:\n *\n * ````javascript\n * const ifcLoader = new WebIFCLoaderPlugin(viewer, {\n * wasmPath: \"../dist/\",\n * objectDefaults: {\n * IfcSpace: {\n * pickable: false,\n * opacity: 0.2\n * }\n * }\n * });\n * ````\n *\n * Alternatively, we could just make IfcSpaces invisible, which also makes them unpickable:\n *\n * ````javascript\n * const ifcLoader = new WebIFCLoaderPlugin(viewer, {\n * wasmPath: \"../dist/\",\n * objectDefaults: {\n * IfcSpace: {\n * visible: false\n * }\n * }\n * });\n * ````\n *\n * ## Configuring a custom data source\n *\n * By default, WebIFCLoaderPlugin will load IFC files over HTTP.\n *\n * In the example below, we'll customize the way WebIFCLoaderPlugin loads the files by configuring it with our own data source\n * object. For simplicity, our custom data source example also uses HTTP, using a couple of xeokit utility functions.\n *\n * ````javascript\n * import {utils} from \"xeokit-sdk.es.js\";\n *\n * class MyDataSource {\n *\n * constructor() {\n * }\n *\n * // Gets the contents of the given IFC file in an arraybuffer\n * getIFC(src, ok, error) {\n * console.log(\"MyDataSource#getIFC(\" + IFCSrc + \", ... )\");\n * utils.loadArraybuffer(src,\n * (arraybuffer) => {\n * ok(arraybuffer);\n * },\n * function (errMsg) {\n * error(errMsg);\n * });\n * }\n * }\n *\n * const ifcLoader2 = new WebIFCLoaderPlugin(viewer, {\n * dataSource: new MyDataSource()\n * });\n *\n * const model5 = ifcLoader2.load({\n * id: \"myModel5\",\n * src: \"../assets/models/ifc/Duplex.ifc\"\n * });\n * ````\n *\n * ## Loading multiple copies of a model, without object ID clashes\n *\n * Sometimes we need to load two or more instances of the same model, without having clashes\n * between the IDs of the equivalent objects in the model instances.\n *\n * As shown in the example below, we do this by setting {@link WebIFCLoaderPlugin#globalizeObjectIds} ````true```` before we load our models.\n *\n * ````javascript\n * ifcLoader.globalizeObjectIds = true;\n *\n * const model = ifcLoader.load({\n * id: \"model1\",\n * src: \"../assets/models/ifc/Duplex.ifc\"\n * });\n *\n * const model2 = ifcLoader.load({\n * id: \"model2\",\n * src: \"../assets/models/ifc/Duplex.ifc\"\n * });\n * ````\n *\n * For each {@link Entity} loaded by these two calls, {@link Entity#id} and {@link MetaObject#id} will get prefixed by\n * the ID of their model, in order to avoid ID clashes between the two models.\n *\n * An Entity belonging to the first model will get an ID like this:\n *\n * ````\n * myModel1#0BTBFw6f90Nfh9rP1dlXrb\n * ````\n *\n * The equivalent Entity in the second model will get an ID like this:\n *\n * ````\n * myModel2#0BTBFw6f90Nfh9rP1dlXrb\n * ````\n *\n * Now, to update the visibility of both of those Entities collectively, using {@link Scene#setObjectsVisible}, we can\n * supply just the IFC product ID part to that method:\n *\n * ````javascript\n * myViewer.scene.setObjectVisibilities(\"0BTBFw6f90Nfh9rP1dlXrb\", true);\n * ````\n *\n * The method, along with {@link Scene#setObjectsXRayed}, {@link Scene#setObjectsHighlighted} etc, will internally expand\n * the given ID to refer to the instances of that Entity in both models.\n *\n * We can also, of course, reference each Entity directly, using its globalized ID:\n *\n * ````javascript\n * myViewer.scene.setObjectVisibilities(\"myModel1#0BTBFw6f90Nfh9rP1dlXrb\", true);\n *````\n *\n * @class WebIFCLoaderPlugin\n * @since 2.0.13\n */\nclass WebIFCLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"ifcLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Object} cfg.WebIFC The web-ifc module, required by WebIFCLoaderPlugin. WebIFCLoaderPlugin uses various IFC type constants defined on this module.\n * @param {Object} cfg.IfcAPI A pre-initialized instance of the web-ifc API. WebIFCLoaderPlugin uses this to parse IFC. * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {Object} [cfg.dataSource] A custom data source through which the WebIFCLoaderPlugin can load model and metadata files. Defaults to an instance of {@link WebIFCDefaultDataSource}, which loads over HTTP.\n * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"ifcLoader\", viewer, cfg);\n\n this.dataSource = cfg.dataSource;\n this.objectDefaults = cfg.objectDefaults;\n this.includeTypes = cfg.includeTypes;\n this.excludeTypes = cfg.excludeTypes;\n this.excludeUnclassifiedObjects = cfg.excludeUnclassifiedObjects;\n\n if (!cfg.WebIFC) {\n throw \"Parameter expected: WebIFC\";\n }\n \n if (!cfg.IfcAPI) {\n throw \"Parameter expected: IfcAPI\";\n }\n\n this._webIFC = cfg.WebIFC;\n \n this._ifcAPI = cfg.IfcAPI;\n }\n\n /**\n * Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.\n * @returns {string[]}\n */\n get supportedVersions() {\n return [\"2x3\", \"4\"];\n }\n\n /**\n * Gets the custom data source through which the WebIFCLoaderPlugin can load IFC files.\n *\n * Default value is {@link WebIFCDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Sets a custom data source through which the WebIFCLoaderPlugin can load IFC files.\n *\n * Default value is {@link WebIFCDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new WebIFCDefaultDataSource();\n }\n\n /**\n * Gets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n get objectDefaults() {\n return this._objectDefaults;\n }\n\n /**\n * Sets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n set objectDefaults(value) {\n this._objectDefaults = value || IFCObjectDefaults;\n }\n\n /**\n * Gets the whitelist of the IFC types loaded by this WebIFCLoaderPlugin.\n *\n * When loading IFC models, causes this WebIFCLoaderPlugin to only load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n get includeTypes() {\n return this._includeTypes;\n }\n\n /**\n * Sets the whitelist of the IFC types loaded by this WebIFCLoaderPlugin.\n *\n * When loading IFC models, causes this WebIFCLoaderPlugin to only load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n set includeTypes(value) {\n this._includeTypes = value;\n }\n\n /**\n * Gets the blacklist of IFC types that are never loaded by this WebIFCLoaderPlugin.\n *\n * When loading IFC models, causes this WebIFCLoaderPlugin to **not** load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n get excludeTypes() {\n return this._excludeTypes;\n }\n\n /**\n * Sets the blacklist of IFC types that are never loaded by this WebIFCLoaderPlugin.\n *\n * When IFC models, causes this WebIFCLoaderPlugin to **not** load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n set excludeTypes(value) {\n this._excludeTypes = value;\n }\n\n /**\n * Gets whether we load objects that don't have IFC types.\n *\n * When loading IFC models and this is ````true````, WebIFCLoaderPlugin will not load objects\n * that don't have IFC types.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get excludeUnclassifiedObjects() {\n return this._excludeUnclassifiedObjects;\n }\n\n /**\n * Sets whether we load objects that don't have IFC types.\n *\n * When loading IFC models and this is ````true````, WebIFCLoaderPlugin will not load objects\n * that don't have IFC types.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set excludeUnclassifiedObjects(value) {\n this._excludeUnclassifiedObjects = !!value;\n }\n\n /**\n * Gets whether WebIFCLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get globalizeObjectIds() {\n return this._globalizeObjectIds;\n }\n\n /**\n * Sets whether WebIFCLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.\n *\n * Set this ````true```` when you need to load multiple instances of the same model, to avoid ID clashes\n * between the objects in the different instances.\n *\n * When we load a model with this set ````true````, then each {@link Entity#id} and {@link MetaObject#id} will be\n * prefixed by the ID of the model, ie. ````#````.\n *\n * {@link Entity#originalSystemId} and {@link MetaObject#originalSystemId} will always hold the original, un-prefixed, ID values.\n *\n * Default value is ````false````.\n *\n * See the main {@link WebIFCLoaderPlugin} class documentation for usage info.\n *\n * @type {Boolean}\n */\n set globalizeObjectIds(value) {\n this._globalizeObjectIds = !!value;\n }\n\n /**\n * Loads an ````IFC```` model into this WebIFCLoaderPlugin's {@link Viewer}.\n *\n * @param {*} params Loading parameters.\n * @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.\n * @param {String} [params.src] Path to a IFC file, as an alternative to the ````ifc```` parameter.\n * @param {ArrayBuffer} [params.ifc] The IFC file data, as an alternative to the ````src```` parameter.\n * @param {Boolean} [params.loadMetadata=true] Whether to load IFC metadata (metaobjects and property sets).\n * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {Boolean} [params.edges=false] Whether or not xeokit renders the model with edges emphasized.\n * @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.\n * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @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.\n * @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````.\n * @param {Boolean} [params.edges=false] Indicates if the model's edges are initially emphasized.\n * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````\n * @param {Boolean} [params.pbrEnabled=false] Indicates if physically-based rendering (PBR) will apply to the model. Only works when {@link Scene#pbrEnabled} is also ````true````.\n * @param {Number} [params.backfaces=false] When we set this ````true````, then we force rendering of backfaces for the model. When we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.\n * @param {Boolean} [params.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.\n * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models. See {@link WebIFCLoaderPlugin#globalizeObjectIds} for more info.\n * @param {Object} [params.stats] Collects model statistics.\n * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to\n * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable\n * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point\n * primitives. Only works while {@link DTX#enabled} is also ````true````.\n * @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}.\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {\n isModel: true\n }));\n\n if (!params.src && !params.ifc) {\n this.error(\"load() param expected: src or IFC\");\n return sceneModel; // Return new empty model\n }\n\n const options = {\n autoNormals: true\n };\n\n if (params.loadMetadata !== false) {\n\n const includeTypes = params.includeTypes || this._includeTypes;\n const excludeTypes = params.excludeTypes || this._excludeTypes;\n const objectDefaults = params.objectDefaults || this._objectDefaults;\n\n if (includeTypes) {\n options.includeTypesMap = {};\n for (let i = 0, len = includeTypes.length; i < len; i++) {\n options.includeTypesMap[includeTypes[i]] = true;\n }\n }\n\n if (excludeTypes) {\n options.excludeTypesMap = {};\n for (let i = 0, len = excludeTypes.length; i < len; i++) {\n options.excludeTypesMap[excludeTypes[i]] = true;\n }\n }\n\n if (objectDefaults) {\n options.objectDefaults = objectDefaults;\n }\n\n options.excludeUnclassifiedObjects = (params.excludeUnclassifiedObjects !== undefined) ? (!!params.excludeUnclassifiedObjects) : this._excludeUnclassifiedObjects;\n options.globalizeObjectIds = (params.globalizeObjectIds !== undefined) ? (!!params.globalizeObjectIds) : this._globalizeObjectIds;\n }\n\n try {\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel);\n } else {\n this._parseModel(params.ifc, params, options, sceneModel);\n }\n } catch (e) {\n this.error(e);\n sceneModel.fire(\"error\", e);\n }\n\n return sceneModel;\n }\n\n _loadModel(src, params, options, sceneModel) {\n const spinner = this.viewer.scene.canvas.spinner;\n spinner.processes++;\n this._dataSource.getIFC(params.src, (arrayBuffer) => {\n this._parseModel(arrayBuffer, params, options, sceneModel);\n spinner.processes--;\n },\n (errMsg) => {\n spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n });\n }\n\n _parseModel(arrayBuffer, params, options, sceneModel) {\n if (sceneModel.destroyed) {\n return;\n }\n const stats = params.stats || {};\n stats.sourceFormat = \"IFC\";\n stats.schemaVersion = \"\";\n stats.title = \"\";\n stats.author = \"\";\n stats.created = \"\";\n stats.numMetaObjects = 0;\n stats.numPropertySets = 0;\n stats.numObjects = 0;\n stats.numGeometries = 0;\n stats.numTriangles = 0;\n stats.numVertices = 0;\n\n if (!this._ifcAPI) {\n throw \"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor\";\n }\n\n const dataArray = new Uint8Array(arrayBuffer);\n const modelID = this._ifcAPI.OpenModel(dataArray);\n const modelSchema = this._ifcAPI.GetModelSchema(modelID);\n\n const lines = this._ifcAPI.GetLineIDsWithType(modelID, this._webIFC.IFCPROJECT);\n const ifcProjectId = lines.get(0);\n\n const loadMetadata = (params.loadMetadata !== false);\n\n const metadata = loadMetadata ? {\n id: \"\",\n projectId: \"\" + ifcProjectId,\n author: \"\",\n createdAt: \"\",\n schema: \"\",\n creatingApplication: \"\",\n metaObjects: [],\n propertySets: []\n } : null;\n\n const ctx = {\n modelID,\n modelSchema,\n sceneModel,\n loadMetadata,\n metadata,\n metaObjects: {},\n options,\n log: function (msg) {\n },\n nextId: 0,\n stats\n };\n\n if (loadMetadata) {\n\n if (options.includeTypes) {\n ctx.includeTypes = {};\n for (let i = 0, len = options.includeTypes.length; i < len; i++) {\n ctx.includeTypes[options.includeTypes[i]] = true;\n }\n }\n\n if (options.excludeTypes) {\n ctx.excludeTypes = {};\n for (let i = 0, len = options.excludeTypes.length; i < len; i++) {\n ctx.excludeTypes[options.excludeTypes[i]] = true;\n }\n }\n\n this._parseMetaObjects(ctx);\n this._parsePropertySets(ctx);\n }\n\n this._parseGeometry(ctx);\n\n sceneModel.finalize();\n\n if (loadMetadata) {\n const metaModelId = sceneModel.id;\n this.viewer.metaScene.createMetaModel(metaModelId, ctx.metadata, options);\n }\n\n sceneModel.scene.once(\"tick\", () => {\n if (sceneModel.destroyed) {\n return;\n }\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false); // Don't forget the event, for late subscribers\n });\n }\n\n _parseMetaObjects(ctx) {\n const lines = this._ifcAPI.GetLineIDsWithType(ctx.modelID, this._webIFC.IFCPROJECT);\n const ifcProjectId = lines.get(0);\n const ifcProject = this._ifcAPI.GetLine(ctx.modelID, ifcProjectId);\n this._parseSpatialChildren(ctx, ifcProject);\n }\n\n _parseSpatialChildren(ctx, ifcElement, parentMetaObjectId) {\n const metaObjectType = this._ifcAPI.GetNameFromTypeCode(ifcElement.type);\n if (ctx.includeTypes && (!ctx.includeTypes[metaObjectType])) {\n return;\n }\n if (ctx.excludeTypes && ctx.excludeTypes[metaObjectType]) {\n return;\n }\n this._createMetaObject(ctx, ifcElement, parentMetaObjectId);\n const metaObjectId = ifcElement.GlobalId.value;\n this._parseRelatedItemsOfType(ctx, ifcElement.expressID, 'RelatingObject', 'RelatedObjects', this._webIFC.IFCRELAGGREGATES, metaObjectId);\n this._parseRelatedItemsOfType(ctx, ifcElement.expressID, 'RelatingStructure', 'RelatedElements', this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE, metaObjectId);\n }\n\n _createMetaObject(ctx, ifcElement, parentMetaObjectId) {\n const id = ifcElement.GlobalId.value;\n const metaObjectType = this._ifcAPI.GetNameFromTypeCode(ifcElement.type);\n const metaObjectName = (ifcElement.Name && ifcElement.Name.value !== \"\") ? ifcElement.Name.value : metaObjectType;\n const metaObject = {\n id: id,\n name: metaObjectName,\n type: metaObjectType,\n parent: parentMetaObjectId\n };\n ctx.metadata.metaObjects.push(metaObject);\n ctx.metaObjects[id] = metaObject;\n ctx.stats.numMetaObjects++;\n }\n\n _parseRelatedItemsOfType(ctx, id, relation, related, type, parentMetaObjectId) {\n const lines = this._ifcAPI.GetLineIDsWithType(ctx.modelID, type);\n for (let i = 0; i < lines.size(); i++) {\n const relID = lines.get(i);\n const rel = this._ifcAPI.GetLine(ctx.modelID, relID);\n const relatedItems = rel[relation];\n let foundElement = false;\n if (Array.isArray(relatedItems)) {\n const values = relatedItems.map((item) => item.value);\n foundElement = values.includes(id);\n } else {\n foundElement = (relatedItems.value === id);\n }\n if (foundElement) {\n const element = rel[related];\n if (!Array.isArray(element)) {\n const ifcElement = this._ifcAPI.GetLine(ctx.modelID, element.value);\n this._parseSpatialChildren(ctx, ifcElement, parentMetaObjectId);\n } else {\n element.forEach((element2) => {\n const ifcElement = this._ifcAPI.GetLine(ctx.modelID, element2.value);\n this._parseSpatialChildren(ctx, ifcElement, parentMetaObjectId);\n });\n }\n }\n }\n }\n\n _parsePropertySets(ctx) {\n const lines = this._ifcAPI.GetLineIDsWithType(ctx.modelID, this._webIFC.IFCRELDEFINESBYPROPERTIES);\n for (let i = 0; i < lines.size(); i++) {\n let relID = lines.get(i);\n let rel = this._ifcAPI.GetLine(ctx.modelID, relID, true);\n if (rel) {\n const relatingPropertyDefinition = rel.RelatingPropertyDefinition;\n if (!relatingPropertyDefinition) {\n continue;\n }\n const propertySetId = relatingPropertyDefinition.GlobalId.value;\n const props = relatingPropertyDefinition.HasProperties;\n if (props && props.length > 0) {\n const propertySetType = \"Default\";\n const propertySetName = relatingPropertyDefinition.Name.value;\n const properties = [];\n for (let i = 0, len = props.length; i < len; i++) {\n const prop = props[i];\n const name = prop.Name;\n const nominalValue = prop.NominalValue;\n if (name && nominalValue) {\n const property = {\n name: name.value,\n type: nominalValue.type,\n value: nominalValue.value,\n valueType: nominalValue.valueType\n };\n if (prop.Description) {\n property.description = prop.Description.value;\n } else if (nominalValue.description) {\n property.description = nominalValue.description;\n }\n properties.push(property);\n }\n }\n const propertySet = {\n id: propertySetId,\n type: propertySetType,\n name: propertySetName,\n properties: properties\n };\n ctx.metadata.propertySets.push(propertySet);\n ctx.stats.numPropertySets++;\n const relatedObjects = rel.RelatedObjects;\n if (!relatedObjects || relatedObjects.length === 0) {\n return;\n }\n for (let i = 0, len = relatedObjects.length; i < len; i++) {\n const relatedObject = relatedObjects[i];\n const metaObjectId = relatedObject.GlobalId.value;\n const metaObject = ctx.metaObjects[metaObjectId];\n if (metaObject) {\n if (!metaObject.propertySetIds) {\n metaObject.propertySetIds = [];\n }\n metaObject.propertySetIds.push(propertySetId);\n }\n }\n }\n }\n }\n }\n\n _parseGeometry(ctx) {\n this._ifcAPI.StreamAllMeshes(ctx.modelID, (flatMesh) => {\n // TODO: Can we do geometry reuse with web-ifc?\n const flatMeshExpressID = flatMesh.expressID;\n const placedGeometries = flatMesh.geometries;\n const meshIds = [];\n const properties = this._ifcAPI.GetLine(ctx.modelID, flatMeshExpressID);\n const globalId = properties.GlobalId.value;\n if (ctx.loadMetadata) {\n const metaObjectId = globalId;\n const metaObject = ctx.metaObjects[metaObjectId];\n if (ctx.includeTypes && (!metaObject || (!ctx.includeTypes[metaObject.type]))) {\n return;\n }\n if (ctx.excludeTypes && (!metaObject || ctx.excludeTypes[metaObject.type])) {\n return;\n }\n }\n const matrix = math.mat4();\n const origin = math.vec3();\n for (let j = 0, lenj = placedGeometries.size(); j < lenj; j++) {\n const placedGeometry = placedGeometries.get(j);\n const geometry = this._ifcAPI.GetGeometry(ctx.modelID, placedGeometry.geometryExpressID);\n const vertexData = this._ifcAPI.GetVertexArray(geometry.GetVertexData(), geometry.GetVertexDataSize());\n const indices = this._ifcAPI.GetIndexArray(geometry.GetIndexData(), geometry.GetIndexDataSize());\n // De-interleave vertex arrays\n const positions = new Float64Array(vertexData.length / 2);\n const normals = new Float32Array(vertexData.length / 2);\n for (let k = 0, l = 0, lenk = vertexData.length / 6; k < lenk; k++, l += 3) {\n positions[l + 0] = vertexData[k * 6 + 0];\n positions[l + 1] = vertexData[k * 6 + 1];\n positions[l + 2] = vertexData[k * 6 + 2];\n }\n matrix.set(placedGeometry.flatTransformation);\n math.transformPositions3(matrix, positions);\n const rtcNeeded = worldToRTCPositions(positions, positions, origin);\n if (!ctx.options.autoNormals) {\n for (let k = 0, l = 0, lenk = vertexData.length / 6; k < lenk; k++, l += 3) {\n normals[l + 0] = vertexData[k * 6 + 3];\n normals[l + 1] = vertexData[k * 6 + 4];\n normals[l + 2] = vertexData[k * 6 + 5];\n }\n }\n ctx.stats.numGeometries++;\n ctx.stats.numVertices += (positions.length / 3);\n ctx.stats.numTriangles += (indices.length / 3);\n const meshId = (\"mesh\" + ctx.nextId++);\n ctx.sceneModel.createMesh({\n id: meshId,\n primitive: \"triangles\", // TODO\n origin: rtcNeeded ? origin : null,\n positions: positions,\n normals: ctx.options.autoNormals ? null : normals,\n indices: indices,\n color: [placedGeometry.color.x, placedGeometry.color.y, placedGeometry.color.z],\n opacity: placedGeometry.color.w\n });\n meshIds.push(meshId);\n }\n const entityId = ctx.options.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, globalId) : globalId;\n ctx.sceneModel.createEntity({\n id: entityId,\n meshIds: meshIds,\n isObject: true\n });\n ctx.stats.numObjects++;\n });\n }\n}\n\nexport {WebIFCLoaderPlugin};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1666, + "__docId__": 1674, "kind": "class", "name": "WebIFCLoaderPlugin", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js", @@ -30825,7 +31041,7 @@ ] }, { - "__docId__": 1667, + "__docId__": 1675, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -30940,7 +31156,7 @@ ] }, { - "__docId__": 1673, + "__docId__": 1681, "kind": "member", "name": "_webIFC", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -30958,7 +31174,7 @@ } }, { - "__docId__": 1674, + "__docId__": 1682, "kind": "member", "name": "_ifcAPI", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -30976,7 +31192,7 @@ } }, { - "__docId__": 1675, + "__docId__": 1683, "kind": "get", "name": "supportedVersions", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31008,7 +31224,7 @@ } }, { - "__docId__": 1676, + "__docId__": 1684, "kind": "get", "name": "dataSource", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31029,7 +31245,7 @@ } }, { - "__docId__": 1677, + "__docId__": 1685, "kind": "set", "name": "dataSource", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31050,7 +31266,7 @@ } }, { - "__docId__": 1678, + "__docId__": 1686, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31068,7 +31284,7 @@ } }, { - "__docId__": 1679, + "__docId__": 1687, "kind": "get", "name": "objectDefaults", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31089,7 +31305,7 @@ } }, { - "__docId__": 1680, + "__docId__": 1688, "kind": "set", "name": "objectDefaults", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31110,7 +31326,7 @@ } }, { - "__docId__": 1681, + "__docId__": 1689, "kind": "member", "name": "_objectDefaults", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31128,7 +31344,7 @@ } }, { - "__docId__": 1682, + "__docId__": 1690, "kind": "get", "name": "includeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31149,7 +31365,7 @@ } }, { - "__docId__": 1683, + "__docId__": 1691, "kind": "set", "name": "includeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31170,7 +31386,7 @@ } }, { - "__docId__": 1684, + "__docId__": 1692, "kind": "member", "name": "_includeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31188,7 +31404,7 @@ } }, { - "__docId__": 1685, + "__docId__": 1693, "kind": "get", "name": "excludeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31209,7 +31425,7 @@ } }, { - "__docId__": 1686, + "__docId__": 1694, "kind": "set", "name": "excludeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31230,7 +31446,7 @@ } }, { - "__docId__": 1687, + "__docId__": 1695, "kind": "member", "name": "_excludeTypes", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31248,7 +31464,7 @@ } }, { - "__docId__": 1688, + "__docId__": 1696, "kind": "get", "name": "excludeUnclassifiedObjects", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31269,7 +31485,7 @@ } }, { - "__docId__": 1689, + "__docId__": 1697, "kind": "set", "name": "excludeUnclassifiedObjects", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31290,7 +31506,7 @@ } }, { - "__docId__": 1690, + "__docId__": 1698, "kind": "member", "name": "_excludeUnclassifiedObjects", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31308,7 +31524,7 @@ } }, { - "__docId__": 1691, + "__docId__": 1699, "kind": "get", "name": "globalizeObjectIds", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31329,7 +31545,7 @@ } }, { - "__docId__": 1692, + "__docId__": 1700, "kind": "set", "name": "globalizeObjectIds", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31350,7 +31566,7 @@ } }, { - "__docId__": 1693, + "__docId__": 1701, "kind": "member", "name": "_globalizeObjectIds", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31368,7 +31584,7 @@ } }, { - "__docId__": 1694, + "__docId__": 1702, "kind": "method", "name": "load", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31678,7 +31894,7 @@ } }, { - "__docId__": 1695, + "__docId__": 1703, "kind": "method", "name": "_loadModel", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31720,7 +31936,7 @@ "return": null }, { - "__docId__": 1696, + "__docId__": 1704, "kind": "method", "name": "_parseModel", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31762,7 +31978,7 @@ "return": null }, { - "__docId__": 1697, + "__docId__": 1705, "kind": "method", "name": "_parseMetaObjects", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31786,7 +32002,7 @@ "return": null }, { - "__docId__": 1698, + "__docId__": 1706, "kind": "method", "name": "_parseSpatialChildren", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31822,7 +32038,7 @@ "return": null }, { - "__docId__": 1699, + "__docId__": 1707, "kind": "method", "name": "_createMetaObject", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31858,7 +32074,7 @@ "return": null }, { - "__docId__": 1700, + "__docId__": 1708, "kind": "method", "name": "_parseRelatedItemsOfType", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31912,7 +32128,7 @@ "return": null }, { - "__docId__": 1701, + "__docId__": 1709, "kind": "method", "name": "_parsePropertySets", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31936,7 +32152,7 @@ "return": null }, { - "__docId__": 1702, + "__docId__": 1710, "kind": "method", "name": "_parseGeometry", "memberof": "src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin", @@ -31960,29 +32176,29 @@ "return": null }, { - "__docId__": 1703, + "__docId__": 1711, "kind": "file", "name": "src/plugins/WebIFCLoaderPlugin/index.js", "content": "export * from \"./WebIFCLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/WebIFCLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/WebIFCLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1704, + "__docId__": 1712, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js", "content": "import {utils} from \"../../viewer/scene/utils.js\";\n\n/**\n * Default data access strategy for {@link XKTLoaderPlugin}.\n */\nclass XKTDefaultDataSource {\n\n constructor() {\n }\n\n /**\n * Gets manifest JSON.\n *\n * @param {String|Number} manifestSrc Identifies the manifest JSON asset.\n * @param {Function} ok Fired on successful loading of the manifest JSON asset.\n * @param {Function} error Fired on error while loading the manifest JSON asset.\n */\n getManifest(manifestSrc, ok, error) {\n utils.loadJSON(manifestSrc,\n (json) => {\n ok(json);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n\n /**\n * Gets metamodel JSON.\n *\n * @param {String|Number} metaModelSrc Identifies the metamodel JSON asset.\n * @param {Function} ok Fired on successful loading of the metamodel JSON asset.\n * @param {Function} error Fired on error while loading the metamodel JSON asset.\n */\n getMetaModel(metaModelSrc, ok, error) {\n utils.loadJSON(metaModelSrc,\n (json) => {\n ok(json);\n },\n function (errMsg) {\n error(errMsg);\n });\n }\n\n /**\n * Gets the contents of the given ````.xkt```` file in an arraybuffer.\n *\n * @param {String|Number} src Path or ID of an ````.xkt```` file.\n * @param {Function} ok Callback fired on success, argument is the ````.xkt```` file in an arraybuffer.\n * @param {Function} error Callback fired on error.\n */\n getXKT(src, ok, error) {\n var defaultCallback = () => {\n };\n ok = ok || defaultCallback;\n error = error || defaultCallback;\n const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n const dataUriRegexResult = src.match(dataUriRegex);\n if (dataUriRegexResult) { // Safari can't handle data URIs through XMLHttpRequest\n const isBase64 = !!dataUriRegexResult[2];\n var data = dataUriRegexResult[3];\n data = window.decodeURIComponent(data);\n if (isBase64) {\n data = window.atob(data);\n }\n try {\n const buffer = new ArrayBuffer(data.length);\n const view = new Uint8Array(buffer);\n for (var i = 0; i < data.length; i++) {\n view[i] = data.charCodeAt(i);\n }\n ok(buffer);\n } catch (errMsg) {\n error(errMsg);\n }\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', src, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n error('getXKT error : ' + request.response);\n }\n }\n };\n request.send(null);\n }\n }\n}\n\n\nexport {XKTDefaultDataSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1705, + "__docId__": 1713, "kind": "class", "name": "XKTDefaultDataSource", "memberof": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js", @@ -31997,7 +32213,7 @@ "interface": false }, { - "__docId__": 1706, + "__docId__": 1714, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js~XKTDefaultDataSource", @@ -32011,7 +32227,7 @@ "undocument": true }, { - "__docId__": 1707, + "__docId__": 1715, "kind": "method", "name": "getManifest", "memberof": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js~XKTDefaultDataSource", @@ -32058,7 +32274,7 @@ "return": null }, { - "__docId__": 1708, + "__docId__": 1716, "kind": "method", "name": "getMetaModel", "memberof": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js~XKTDefaultDataSource", @@ -32105,7 +32321,7 @@ "return": null }, { - "__docId__": 1709, + "__docId__": 1717, "kind": "method", "name": "getXKT", "memberof": "src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js~XKTDefaultDataSource", @@ -32152,18 +32368,18 @@ "return": null }, { - "__docId__": 1710, + "__docId__": 1718, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", "content": "import {utils} from \"../../viewer/scene/utils.js\"\nimport {SceneModel} from \"../../viewer/scene/model/index.js\";\nimport {MetaModel} from \"../../viewer/metadata/MetaModel.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {XKTDefaultDataSource} from \"./XKTDefaultDataSource.js\";\nimport {IFCObjectDefaults} from \"../../viewer/metadata/IFCObjectDefaults.js\";\n\nimport {ParserV1} from \"./parsers/ParserV1.js\";\nimport {ParserV2} from \"./parsers/ParserV2.js\";\nimport {ParserV3} from \"./parsers/ParserV3.js\";\nimport {ParserV4} from \"./parsers/ParserV4.js\";\nimport {ParserV5} from \"./parsers/ParserV5.js\";\nimport {ParserV6} from \"./parsers/ParserV6.js\";\nimport {ParserV7} from \"./parsers/ParserV7.js\";\nimport {ParserV8} from \"./parsers/ParserV8.js\";\nimport {ParserV9} from \"./parsers/ParserV9.js\";\nimport {ParserV10} from \"./parsers/ParserV10.js\";\n\n\nconst parsers = {};\n\nparsers[ParserV1.version] = ParserV1;\nparsers[ParserV2.version] = ParserV2;\nparsers[ParserV3.version] = ParserV3;\nparsers[ParserV4.version] = ParserV4;\nparsers[ParserV5.version] = ParserV5;\nparsers[ParserV6.version] = ParserV6;\nparsers[ParserV7.version] = ParserV7;\nparsers[ParserV8.version] = ParserV8;\nparsers[ParserV9.version] = ParserV9;\nparsers[ParserV10.version] = ParserV10;\n\n/**\n * {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_XKT_OTCConferenceCenter)]\n *\n * # Overview\n *\n * * XKTLoaderPlugin is the most efficient way to load high-detail models into xeokit.\n * * An *````.XKT````* file is a single BLOB containing a model, compressed using geometry quantization\n * and [pako](https://nodeca.github.io/pako/).\n * * Supports double-precision coordinates.\n * * Supports compressed textures.\n * * Set the position, scale and rotation of each model as you load it.\n * * Filter which IFC types get loaded.\n * * Configure initial default appearances for IFC types.\n * * Set a custom data source for *````.XKT````* and IFC metadata files.\n * * Option to load multiple copies of the same model, without object ID clashes.\n *\n * # Creating *````.XKT````* Files and Metadata\n *\n * We have several sways to convert your files into XKT. See these tutorials for more info:\n *\n * * [Converting Models to XKT with convert2xkt](https://www.notion.so/xeokit/Converting-Models-to-XKT-with-convert2xkt-fa567843313f4db8a7d6535e76da9380) - how to convert various file formats (glTF, IFC, CityJSON, LAS/LAZ...) to XKT using our nodejs-based converter.\n * * [Converting IFC Models to XKT using 3rd-Party Open Source Tools](https://www.notion.so/xeokit/Converting-IFC-Models-to-XKT-using-3rd-Party-Open-Source-Tools-c373e48bc4094ff5b6e5c5700ff580ee) - how to convert IFC files to XKT using 3rd-party open source CLI tools.\n *\n * # Scene representation\n *\n * When loading a model, XKTLoaderPlugin creates an {@link Entity} that represents the model, which\n * will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id}\n * in {@link Scene#models}. The XKTLoaderPlugin also creates an {@link Entity} for each object within the\n * model. Those Entities will have {@link Entity#isObject} set ````true```` and will be registered\n * by {@link Entity#id} in {@link Scene#objects}.\n *\n * # Metadata\n *\n * Since XKT V8, model metadata is included in the XKT file. If the XKT file has metadata, then loading it creates\n * model metadata components within the Viewer, namely a {@link MetaModel} corresponding to the model {@link Entity},\n * and a {@link MetaObject} for each object {@link Entity}.\n *\n * Each {@link MetaObject} has a {@link MetaObject#type}, which indicates the classification of its corresponding\n * {@link Entity}. When loading metadata, we can also configure XKTLoaderPlugin with a custom lookup table of initial\n * values to set on the properties of each type of {@link Entity}. By default, XKTLoaderPlugin uses its own map of\n * default colors and visibilities for IFC element types.\n *\n * For XKT versions prior to V8, we provided the metadata to XKTLoaderPlugin as an accompanying JSON file to load. We can\n * still do that for all XKT versions, and for XKT V8+ it will override any metadata provided within the XKT file.\n *\n * # Usage\n *\n * In the example below we'll load the Schependomlaan model from a [.XKT file](https://github.com/xeokit/xeokit-sdk/tree/master/examples/models/xkt/schependomlaan).\n *\n * This will create a bunch of {@link Entity}s that represents the model and its objects, along with a {@link MetaModel} and {@link MetaObject}s\n * that hold their metadata.\n *\n * Since this model contains IFC types, the XKTLoaderPlugin will set the initial appearance of each object\n * {@link Entity} according to its IFC type in {@link XKTLoaderPlugin#objectDefaults}.\n *\n * Read more about this example in the user guide on [Viewing BIM Models Offline](https://www.notion.so/xeokit/Viewing-an-IFC-Model-with-xeokit-c373e48bc4094ff5b6e5c5700ff580ee).\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_XKT_metadata_Schependomlaan)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a Viewer,\n * // 2. Arrange the camera\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * // 2\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // 1. Create a XKTLoaderPlugin,\n * // 2. Load a building model and JSON IFC metadata\n * //------------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * // 2\n * const model = xktLoader.load({ // Returns an Entity that represents the model\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * //--------------------------------------------------------------------------------------------------------------\n * // 1. Find metadata on the third storey\n * // 2. Select all the objects in the building's third storey\n * // 3. Fit the camera to all the objects on the third storey\n * //--------------------------------------------------------------------------------------------------------------\n *\n * // 1\n * const metaModel = viewer.metaScene.metaModels[\"myModel\"]; // MetaModel with ID \"myModel\"\n * const metaObject\n * = viewer.metaScene.metaObjects[\"0u4wgLe6n0ABVaiXyikbkA\"]; // MetaObject with ID \"0u4wgLe6n0ABVaiXyikbkA\"\n *\n * const name = metaObject.name; // \"01 eerste verdieping\"\n * const type = metaObject.type; // \"IfcBuildingStorey\"\n * const parent = metaObject.parent; // MetaObject with type \"IfcBuilding\"\n * const children = metaObject.children; // Array of child MetaObjects\n * const objectId = metaObject.id; // \"0u4wgLe6n0ABVaiXyikbkA\"\n * const objectIds = viewer.metaScene.getObjectIDsInSubtree(objectId); // IDs of leaf sub-objects\n * const aabb = viewer.scene.getAABB(objectIds); // Axis-aligned boundary of the leaf sub-objects\n *\n * // 2\n * viewer.scene.setObjectsSelected(objectIds, true);\n *\n * // 3\n * viewer.cameraFlight.flyTo(aabb);\n * });\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Destroy the model\n * model.destroy();\n * ````\n *\n * # Loading XKT files containing textures\n *\n * XKTLoaderPlugin uses a {@link KTX2TextureTranscoder} to load textures in XKT files (XKT v10+). An XKTLoaderPlugin has its own\n * default KTX2TextureTranscoder, configured to load the Basis Codec from the CDN. If we wish, we can override that with our own\n * KTX2TextureTranscoder instance that's configured to load the Codec locally.\n *\n * In the example below, we'll create a {@link Viewer} and add an XKTLoaderPlugin\n * configured with a KTX2TextureTranscoder that finds the Codec in our local file system. Then we'll use the\n * XKTLoaderPlugin to load an XKT file that contains KTX2 textures, which the plugin will transcode using\n * its KTX2TextureTranscoder.\n *\n * We'll configure our KTX2TextureTranscoder to load the Basis Codec from a local directory. If we were happy with loading the\n * Codec from our CDN (ie. our app will always have an Internet connection) then we could just leave out the\n * KTX2TextureTranscoder altogether, and let the XKTLoaderPlugin use its internal default KTX2TextureTranscoder, which is configured to\n * load the Codec from the CDN. We'll stick with loading our own Codec, in case we want to run our app without an Internet connection.\n *\n * \n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_vbo_textures_HousePlan)]\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to Basis Universal transcoder\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer, {\n * textureTranscoder // <<------------- Transcodes KTX2 textures in XKT files\n * });\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"./HousePlan.xkt\" // <<------ XKT file with KTX2 textures\n * });\n * ````\n *\n * # Transforming\n *\n * We have the option to rotate, scale and translate each *````.XKT````* model as we load it.\n *\n * This lets us load multiple models, or even multiple copies of the same model, and position them apart from each other.\n *\n * In the example below, we'll scale our model to half its size, rotate it 90 degrees about its local X-axis, then\n * translate it 100 units along its X axis.\n *\n * ````javascript\n * xktLoader.load({\n * src: \"./models/xkt/Duplex.ifc.xkt\",\n * rotation: [90,0,0],\n * scale: [0.5, 0.5, 0.5],\n * position: [100, 0, 0]\n * });\n * ````\n *\n * # Including and excluding IFC types\n *\n * We can also load only those objects that have the specified IFC types.\n *\n * In the example below, we'll load only the objects that represent walls.\n *\n * ````javascript\n * const model2 = xktLoader.load({\n * id: \"myModel2\",\n * src: \"./models/xkt/OTCConferenceCenter.xkt\",\n * includeTypes: [\"IfcWallStandardCase\"]\n * });\n * ````\n *\n * We can also load only those objects that **don't** have the specified IFC types.\n *\n * In the example below, we'll load only the objects that do not represent empty space.\n *\n * ````javascript\n * const model3 = xktLoader.load({\n * id: \"myModel3\",\n * src: \"./models/xkt/OTCConferenceCenter.xkt\",\n * excludeTypes: [\"IfcSpace\"]\n * });\n * ````\n *\n * # Configuring initial IFC object appearances\n *\n * We can specify the custom initial appearance of loaded objects according to their IFC types.\n *\n * This is useful for things like:\n *\n * * setting the colors to our objects according to their IFC types,\n * * automatically hiding ````IfcSpace```` objects, and\n * * ensuring that ````IfcWindow```` objects are always transparent.\n *
    \n * In the example below, we'll load a model, while configuring ````IfcSpace```` elements to be always initially invisible,\n * and ````IfcWindow```` types to be always translucent blue.\n *\n * ````javascript\n * const myObjectDefaults = {\n *\n * IfcSpace: {\n * visible: false\n * },\n * IfcWindow: {\n * colorize: [0.337255, 0.303922, 0.870588], // Blue\n * opacity: 0.3\n * },\n *\n * //...\n *\n * DEFAULT: {\n * colorize: [0.5, 0.5, 0.5]\n * }\n * };\n *\n * const model4 = xktLoader.load({\n * id: \"myModel4\",\n * src: \"./models/xkt/Duplex.ifc.xkt\",\n * objectDefaults: myObjectDefaults // Use our custom initial default states for object Entities\n * });\n * ````\n *\n * When we don't customize the appearance of IFC types, as just above, then IfcSpace elements tend to obscure other\n * elements, which can be confusing.\n *\n * It's often helpful to make IfcSpaces transparent and unpickable, like this:\n *\n * ````javascript\n * const xktLoader = new XKTLoaderPlugin(viewer, {\n * objectDefaults: {\n * IfcSpace: {\n * pickable: false,\n * opacity: 0.2\n * }\n * }\n * });\n * ````\n *\n * Alternatively, we could just make IfcSpaces invisible, which also makes them unpickable:\n *\n * ````javascript\n * const xktLoader = new XKTLoaderPlugin(viewer, {\n * objectDefaults: {\n * IfcSpace: {\n * visible: false\n * }\n * }\n * });\n * ````\n *\n * # Configuring a custom data source\n *\n * By default, XKTLoaderPlugin will load *````.XKT````* files and metadata JSON over HTTP.\n *\n * In the example below, we'll customize the way XKTLoaderPlugin loads the files by configuring it with our own data source\n * object. For simplicity, our custom data source example also uses HTTP, using a couple of xeokit utility functions.\n *\n * ````javascript\n * import {utils} from \"xeokit-sdk.es.js\";\n *\n * class MyDataSource {\n *\n * constructor() {\n * }\n *\n * // Gets metamodel JSON\n * getMetaModel(metaModelSrc, ok, error) {\n * console.log(\"MyDataSource#getMetaModel(\" + metaModelSrc + \", ... )\");\n * utils.loadJSON(metaModelSrc,\n * (json) => {\n * ok(json);\n * },\n * function (errMsg) {\n * error(errMsg);\n * });\n * }\n *\n * // Gets the contents of the given .XKT file in an arraybuffer\n * getXKT(src, ok, error) {\n * console.log(\"MyDataSource#getXKT(\" + xKTSrc + \", ... )\");\n * utils.loadArraybuffer(src,\n * (arraybuffer) => {\n * ok(arraybuffer);\n * },\n * function (errMsg) {\n * error(errMsg);\n * });\n * }\n * }\n *\n * const xktLoader2 = new XKTLoaderPlugin(viewer, {\n * dataSource: new MyDataSource()\n * });\n *\n * const model5 = xktLoader2.load({\n * id: \"myModel5\",\n * src: \"./models/xkt/Duplex.ifc.xkt\"\n * });\n * ````\n *\n * # Loading multiple copies of a model, without object ID clashes\n *\n * Sometimes we need to load two or more instances of the same model, without having clashes\n * between the IDs of the equivalent objects in the model instances.\n *\n * As shown in the example below, we do this by setting {@link XKTLoaderPlugin#globalizeObjectIds} ````true```` before we load our models.\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#TreeViewPlugin_Containment_MultipleModels)]\n *\n * ````javascript\n * xktLoader.globalizeObjectIds = true;\n *\n * const model = xktLoader.load({\n * id: \"model1\",\n * src: \"./models/xkt/Schependomlaan.xkt\"\n * });\n *\n * const model2 = xktLoader.load({\n * id: \"model2\",\n * src: \"./models/xkt/Schependomlaan.xkt\"\n * });\n * ````\n *\n * For each {@link Entity} loaded by these two calls, {@link Entity#id} and {@link MetaObject#id} will get prefixed by\n * the ID of their model, in order to avoid ID clashes between the two models.\n *\n * An Entity belonging to the first model will get an ID like this:\n *\n * ````\n * myModel1#0BTBFw6f90Nfh9rP1dlXrb\n * ````\n *\n * The equivalent Entity in the second model will get an ID like this:\n *\n * ````\n * myModel2#0BTBFw6f90Nfh9rP1dlXrb\n * ````\n *\n * Now, to update the visibility of both of those Entities collectively, using {@link Scene#setObjectsVisible}, we can\n * supply just the IFC product ID part to that method:\n *\n * ````javascript\n * myViewer.scene.setObjectVisibilities(\"0BTBFw6f90Nfh9rP1dlXrb\", true);\n * ````\n *\n * The method, along with {@link Scene#setObjectsXRayed}, {@link Scene#setObjectsHighlighted} etc, will internally expand\n * the given ID to refer to the instances of that Entity in both models.\n *\n * We can also, of course, reference each Entity directly, using its globalized ID:\n *\n * ````javascript\n * myViewer.scene.setObjectVisibilities(\"myModel1#0BTBFw6f90Nfh9rP1dlXrb\", true);\n *````\n *\n * We can also provide an HTTP URL to the XKT file:\n *\n * ````javascript\n * const sceneModel = xktLoader.load({\n * manifestSrc: \"https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt\",\n * id: \"myModel\",\n * });\n * ````\n *\n * # Loading a model from a manifest of XKT files\n *\n * The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to\n * split its output into multiple pairs of glTF and JSON files, accompanied by a JSON manifest that lists the files.\n *\n * To integrate with that option, the `convert2xkt` tool, which converts glTF geometry and JSON metadata files into XKT files,\n * also has the option to batch-convert the glTF+JSON files in the manifest, in one invocation.\n *\n * When we use this option, convert2xkt will output a bunch of XKT files, along with a JSON manifest file that lists those XKT files.\n *\n * Working down the pipeline, the XKTLoaderPlugin has the option batch-load all XKT files listed in that manifest\n * into a xeokit Viewer in one load operation, combining the XKT files into a single SceneModel and MetaModel.\n *\n * You can learn more about this conversion and loading process, with splitting, batch converting and batch loading,\n * in [this tutorial](https://www.notion.so/xeokit/Importing-Huge-IFC-Models-as-Multiple-XKT-Files-165fc022e94742cf966ee50003572259).\n *\n * To show how to use XKTLoaderPlugin to load a manifest of XKT files, let's imagine that we have a set of such XKT files. As\n * described in the tutorial, they were converted by `ifc2gltf` from an IFC file into a set of glTF+JSON files, that were\n * then converted by convert2xkt into this set of XKT files and a manifest, as shown below.\n *\n * ````bash\n * ./\n * ├── model_1.xkt\n * ├── model_2.xkt\n * ├── model_3.xkt\n * ├── model_4..xkt\n * └── model.xkt.manifest.json\n * ````\n *\n * The `model.xkt.manifest.json` XKT manifest would look something like this:\n *\n * ````json\n * {\n * \"inputFile\": null,\n * \"converterApplication\": \"convert2xkt\",\n * \"converterApplicationVersion\": \"v1.1.9\",\n * \"conversionDate\": \"10-08-2023- 02-05-01\",\n * \"outputDir\": null,\n * \"xktFiles\": [\n * \"model_1.xkt\",\n * \"model_2.xkt\",\n * \"model_3.xkt\",\n * \"model_4.xkt\"\n * ]\n * }\n * ````\n *\n * Now, to load all those XKT files into a single SceneModel and MetaModel in one operation, we pass a path to the XKT\n * manifest to `XKTLoaderPlugin.load`, as shown in the example below:\n *\n * * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_manifest_KarhumakiBridge)]\n *\n * ````javascript\n * import {\n * Viewer,\n * XKTLoaderPlugin,\n * TreeViewPlugin,\n * } from \"xeokit-sdk.es.js\";\n *\n * constviewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [26.54, 29.29, 36.20,];\n * viewer.scene.camera.look = [-23.51, -8.26, -21.65,];\n * viewer.scene.camera.up = [-0.2, 0.89, -0.33,];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sceneModel = xktLoader.load({\n * manifestSrc: \"model.xkt.manifest.json\",\n * id: \"myModel\",\n * });\n *\n * const metaModel = viewer.metaScene.metaModels[sceneModel.id];\n *\n * // Then when we need to, we can destroy the SceneModel\n * // and MetaModel in one shot, like so:\n *\n * sceneModel.destroy();\n * metaModel.destroy();\n * ````\n *\n * The main advantage here, of splitting IFC files like this within the conversion and import pipeline,\n * is to reduce the memory pressure on each of the `ifc2gltf`, `convert2xkt` and XKTLoaderPlugin components.\n * They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where\n * they have less trouble allocating the system memory they need for conversion and parsing.\n *\n * We can also provide an HTTP URL to the manifest:\n *\n * ````javascript\n * const sceneModel = xktLoader.load({\n * manifestSrc: \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json\",\n * id: \"myModel\",\n * });\n * ````\n *\n * We can also provide the manifest as parameter object:\n *\n * ````javascript\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * manifest: {\n * inputFile: \"assets/models/gltf/Karhumaki/model.glb.manifest.json\",\n * converterApplication: \"convert2xkt\",\n * converterApplicationVersion: \"v1.1.10\",\n * conversionDate\": \"09-11-2023- 18-29-01\",\n * xktFiles: [\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt\",\n * \"../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt\"\n * ]\n * }\n * });\n * ````\n *\n * We can also provide the paths to the XKT files as HTTP URLs:\n *\n * ````javascript\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * manifest: {\n * inputFile: \"assets/models/gltf/Karhumaki/model.glb.manifest.json\",\n * converterApplication: \"convert2xkt\",\n * converterApplicationVersion: \"v1.1.10\",\n * conversionDate\": \"09-11-2023- 18-29-01\",\n * xktFiles: [\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt\",\n * \"https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt\"\n * ]\n * }\n * });\n * ````\n *\n * @class XKTLoaderPlugin\n */\nclass XKTLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n *\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"XKTLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {Object} [cfg.dataSource] A custom data source through which the XKTLoaderPlugin can load model and metadata files. Defaults to an instance of {@link XKTDefaultDataSource}, which loads uover HTTP.\n * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.\n * @param {Boolean} [cfg.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to internally expand\n * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly\n * improve Viewer performance for models that have a lot of geometry reuse, but may also increase the amount of\n * browser and GPU memory they require. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.\n * @param {Number} [cfg.maxGeometryBatchSize=50000000] Maximum geometry batch size, as number of vertices. This is optionally supplied\n * to limit the size of the batched geometry arrays that {@link SceneModel} internally creates for batched geometries.\n * A low value means less heap allocation/de-allocation while loading batched geometries, but more draw calls and\n * slower rendering speed. A high value means larger heap allocation/de-allocation while loading, but less draw calls\n * and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.\n * @param {KTX2TextureTranscoder} [cfg.textureTranscoder] Transcoder used internally to transcode KTX2\n * textures within the XKT. Only required when the XKT is version 10 or later, and contains KTX2 textures.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"XKTLoader\", viewer, cfg);\n\n this._maxGeometryBatchSize = cfg.maxGeometryBatchSize;\n\n this.textureTranscoder = cfg.textureTranscoder;\n this.dataSource = cfg.dataSource;\n this.objectDefaults = cfg.objectDefaults;\n this.includeTypes = cfg.includeTypes;\n this.excludeTypes = cfg.excludeTypes;\n this.excludeUnclassifiedObjects = cfg.excludeUnclassifiedObjects;\n this.reuseGeometries = cfg.reuseGeometries;\n }\n\n /**\n * Gets the ````.xkt```` format versions supported by this XKTLoaderPlugin/\n * @returns {string[]}\n */\n get supportedVersions() {\n return Object.keys(parsers);\n }\n\n /**\n * Gets the texture transcoder.\n *\n * @type {TextureTranscoder}\n */\n get textureTranscoder() {\n return this._textureTranscoder;\n }\n\n /**\n * Sets the texture transcoder.\n *\n * @type {TextureTranscoder}\n */\n set textureTranscoder(textureTranscoder) {\n this._textureTranscoder = textureTranscoder;\n }\n\n /**\n * Gets the custom data source through which the XKTLoaderPlugin can load models and metadata.\n *\n * Default value is {@link XKTDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n get dataSource() {\n return this._dataSource;\n }\n\n /**\n * Sets a custom data source through which the XKTLoaderPlugin can load models and metadata.\n *\n * Default value is {@link XKTDefaultDataSource}, which loads via HTTP.\n *\n * @type {Object}\n */\n set dataSource(value) {\n this._dataSource = value || new XKTDefaultDataSource();\n }\n\n /**\n * Gets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n get objectDefaults() {\n return this._objectDefaults;\n }\n\n /**\n * Sets map of initial default states for each loaded {@link Entity} that represents an object.\n *\n * Default value is {@link IFCObjectDefaults}.\n *\n * @type {{String: Object}}\n */\n set objectDefaults(value) {\n this._objectDefaults = value || IFCObjectDefaults;\n }\n\n /**\n * Gets the whitelist of the IFC types loaded by this XKTLoaderPlugin.\n *\n * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n get includeTypes() {\n return this._includeTypes;\n }\n\n /**\n * Sets the whitelist of the IFC types loaded by this XKTLoaderPlugin.\n *\n * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n set includeTypes(value) {\n this._includeTypes = value;\n }\n\n /**\n * Gets the blacklist of IFC types that are never loaded by this XKTLoaderPlugin.\n *\n * When loading models with metadata, causes this XKTLoaderPlugin to **not** load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n get excludeTypes() {\n return this._excludeTypes;\n }\n\n /**\n * Sets the blacklist of IFC types that are never loaded by this XKTLoaderPlugin.\n *\n * When loading models with metadata, causes this XKTLoaderPlugin to **not** load objects whose types are in this\n * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.\n *\n * Default value is ````undefined````.\n *\n * @type {String[]}\n */\n set excludeTypes(value) {\n this._excludeTypes = value;\n }\n\n /**\n * Gets whether we load objects that don't have IFC types.\n *\n * When loading models with metadata and this is ````true````, XKTLoaderPlugin will not load objects\n * that don't have IFC types.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get excludeUnclassifiedObjects() {\n return this._excludeUnclassifiedObjects;\n }\n\n /**\n * Sets whether we load objects that don't have IFC types.\n *\n * When loading models with metadata and this is ````true````, XKTLoaderPlugin will not load objects\n * that don't have IFC types.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set excludeUnclassifiedObjects(value) {\n this._excludeUnclassifiedObjects = !!value;\n }\n\n /**\n * Gets whether XKTLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get globalizeObjectIds() {\n return this._globalizeObjectIds;\n }\n\n /**\n * Sets whether XKTLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.\n *\n * Set this ````true```` when you need to load multiple instances of the same model, to avoid ID clashes\n * between the objects in the different instances.\n *\n * When we load a model with this set ````true````, then each {@link Entity#id} and {@link MetaObject#id} will be\n * prefixed by the ID of the model, ie. ````#````.\n *\n * {@link Entity#originalSystemId} and {@link MetaObject#originalSystemId} will always hold the original, un-prefixed, ID values.\n *\n * Default value is ````false````.\n *\n * See the main {@link XKTLoaderPlugin} class documentation for usage info.\n *\n * @type {Boolean}\n */\n set globalizeObjectIds(value) {\n this._globalizeObjectIds = !!value;\n }\n\n /**\n * Gets whether XKTLoaderPlugin enables geometry reuse when loading models.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n get reuseGeometries() {\n return this._reuseGeometries;\n }\n\n /**\n * Sets whether XKTLoaderPlugin enables geometry reuse when loading models.\n *\n * Default value is ````true````.\n *\n * Geometry reuse saves memory, but can impact Viewer performance when there are many reused geometries. For\n * this reason, we can set this ````false```` to disable geometry reuse for models loaded by this XKTLoaderPlugin\n * (which will then \"expand\" the geometry instances into batches instead).\n *\n * The result will be be less WebGL draw calls (which are expensive), at the cost of increased memory footprint.\n *\n * See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.\n *\n * @type {Boolean}\n */\n set reuseGeometries(value) {\n this._reuseGeometries = value !== false;\n }\n\n /**\n * Loads an ````.xkt```` model into this XKTLoaderPlugin's {@link Viewer}.\n *\n * Since xeokit/xeokit-sdk 1.9.0, XKTLoaderPlugin has supported XKT 8, which bundles the metamodel\n * data (eg. an IFC element hierarchy) in the XKT file itself. For XKT 8, we therefore no longer need to\n * load the metamodel data from a separate accompanying JSON file, as we did with previous XKT versions.\n * However, if we do choose to specify a separate metamodel JSON file to load (eg. for backward compatibility\n * in data pipelines), then that metamodel will be loaded and the metamodel in the XKT 8 file will be ignored.\n *\n * @param {*} params Loading parameters.\n * @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.\n * @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.\n * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.\n * @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.\n * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.\n * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into\n * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.\n * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into\n * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.\n * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.\n * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.\n * @param {Boolean} [params.edges=false] Whether or not xeokit renders the model with edges emphasized.\n * @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.\n * @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.\n * @param {Number[]} [params.scale=[1,1,1]] The model's scale.\n * @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.\n * @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````.\n * @param {Boolean} [params.edges=false] Indicates if the model's edges are initially emphasized.\n * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) is enabled for the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````\n * @param {Boolean} [params.pbrEnabled=true] Indicates if physically-based rendering (PBR) is enabled for the model. Overrides ````colorTextureEnabled````. Only works when {@link Scene#pbrEnabled} is also ````true````.\n * @param {Boolean} [params.colorTextureEnabled=true] Indicates if base color texture rendering is enabled for the model. Overridden by ````pbrEnabled````. Only works when {@link Scene#colorTextureEnabled} is also ````true````.\n * @param {Number} [params.backfaces=false] When we set this ````true````, then we force rendering of backfaces for the model. When\n * we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the\n * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.\n * @param {Boolean} [params.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.\n * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models. See {@link XKTLoaderPlugin#globalizeObjectIds} for more info.\n * @param {Boolean} [params.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to expand\n * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly\n * improve Viewer performance for models that have excessive geometry reuse, but may also increases the amount of\n * browser and GPU memory used by the model. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.\n * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to\n * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable\n * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point\n * primitives. Only works while {@link DTX#enabled} is also ````true````.\n * @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}.\n */\n load(params = {}) {\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {\n this.error(\"load() param expected: src, xkt, manifestSrc or manifestData\");\n return sceneModel; // Return new empty model\n }\n\n const options = {};\n const includeTypes = params.includeTypes || this._includeTypes;\n const excludeTypes = params.excludeTypes || this._excludeTypes;\n const objectDefaults = params.objectDefaults || this._objectDefaults;\n\n options.reuseGeometries = (params.reuseGeometries !== null && params.reuseGeometries !== undefined) ? params.reuseGeometries : (this._reuseGeometries !== false);\n\n if (includeTypes) {\n options.includeTypesMap = {};\n for (let i = 0, len = includeTypes.length; i < len; i++) {\n options.includeTypesMap[includeTypes[i]] = true;\n }\n }\n\n if (excludeTypes) {\n options.excludeTypesMap = {};\n for (let i = 0, len = excludeTypes.length; i < len; i++) {\n options.excludeTypesMap[excludeTypes[i]] = true;\n }\n }\n\n if (objectDefaults) {\n options.objectDefaults = objectDefaults;\n }\n\n options.excludeUnclassifiedObjects = (params.excludeUnclassifiedObjects !== undefined) ? (!!params.excludeUnclassifiedObjects) : this._excludeUnclassifiedObjects;\n options.globalizeObjectIds = (params.globalizeObjectIds !== undefined && params.globalizeObjectIds !== null) ? (!!params.globalizeObjectIds) : this._globalizeObjectIds;\n\n const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {\n isModel: true,\n textureTranscoder: this._textureTranscoder,\n maxGeometryBatchSize: this._maxGeometryBatchSize,\n origin: params.origin,\n disableVertexWelding: params.disableVertexWelding || false,\n disableIndexRebucketing: params.disableIndexRebucketing || false,\n dtxEnabled: params.dtxEnabled\n }));\n\n const modelId = sceneModel.id; // In case ID was auto-generated\n\n const metaModel = new MetaModel({\n metaScene: this.viewer.metaScene,\n id: modelId\n });\n\n this.viewer.scene.canvas.spinner.processes++;\n\n const finish = () => {\n // this._createDefaultMetaModelIfNeeded(sceneModel, params, options);\n sceneModel.finalize();\n metaModel.finalize();\n this.viewer.scene.canvas.spinner.processes--;\n sceneModel.once(\"destroyed\", () => {\n this.viewer.metaScene.destroyMetaModel(metaModel.id);\n });\n this.scheduleTask(() => {\n if (sceneModel.destroyed) {\n return;\n }\n sceneModel.scene.fire(\"modelLoaded\", sceneModel.id); // FIXME: Assumes listeners know order of these two events\n sceneModel.fire(\"loaded\", true, false); // Don't forget the event, for late subscribers\n });\n }\n\n const error = (errMsg) => {\n this.viewer.scene.canvas.spinner.processes--;\n this.error(errMsg);\n sceneModel.fire(\"error\", errMsg);\n }\n\n let nextId = 0;\n const manifestCtx = {\n getNextId: () => {\n return `${modelId}.${nextId++}`;\n }\n };\n\n if (params.metaModelSrc || params.metaModelData) {\n\n if (params.metaModelSrc) {\n\n const metaModelSrc = params.metaModelSrc;\n\n this._dataSource.getMetaModel(metaModelSrc, (metaModelData) => {\n if (sceneModel.destroyed) {\n return;\n }\n metaModel.loadData(metaModelData, {\n includeTypes: includeTypes,\n excludeTypes: excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n });\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);\n } else {\n this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);\n finish();\n }\n }, (errMsg) => {\n error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - ${errMsg}`);\n });\n\n } else if (params.metaModelData) {\n metaModel.loadData(params.metaModelData, {\n includeTypes: includeTypes,\n excludeTypes: excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n });\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel, null, manifestCtx, finish, error);\n } else {\n this._parseModel(params.xkt, params, options, sceneModel, null, manifestCtx);\n finish();\n }\n }\n\n\n } else {\n\n if (params.src) {\n this._loadModel(params.src, params, options, sceneModel, metaModel, manifestCtx, finish, error);\n } else if (params.xkt) {\n this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);\n finish();\n } else if (params.manifestSrc || params.manifest) {\n const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : \"\";\n const loadJSONs = (metaDataFiles, done, error) => {\n let i = 0;\n const loadNext = () => {\n if (i >= metaDataFiles.length) {\n done();\n } else {\n this._dataSource.getMetaModel(`${baseDir}${metaDataFiles[i]}`, (metaModelData) => {\n metaModel.loadData(metaModelData, {\n includeTypes: includeTypes,\n excludeTypes: excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n });\n i++;\n this.scheduleTask(loadNext, 100);\n }, error);\n }\n }\n loadNext();\n }\n const loadXKTs_excludeTheirMetaModels = (xktFiles, done, error) => { // Load XKTs, ignore metamodels in the XKT\n let i = 0;\n const loadNext = () => {\n if (i >= xktFiles.length) {\n done();\n } else {\n this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {\n this._parseModel(arrayBuffer, params, options, sceneModel, null /* Ignore metamodel in XKT */, manifestCtx);\n i++;\n this.scheduleTask(loadNext, 100);\n }, error);\n }\n }\n loadNext();\n };\n const loadXKTs_includeTheirMetaModels = (xktFiles, done, error) => { // Load XKTs, parse metamodels from the XKT\n let i = 0;\n const loadNext = () => {\n if (i >= xktFiles.length) {\n done();\n } else {\n this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {\n this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);\n i++;\n this.scheduleTask(loadNext, 100);\n }, error);\n }\n }\n loadNext();\n };\n if (params.manifest) {\n const manifestData = params.manifest;\n const xktFiles = manifestData.xktFiles;\n if (!xktFiles || xktFiles.length === 0) {\n error(`load(): Failed to load model manifest - manifest not valid`);\n return;\n }\n const metaModelFiles = manifestData.metaModelFiles;\n if (metaModelFiles) {\n loadJSONs(metaModelFiles, () => {\n loadXKTs_excludeTheirMetaModels(xktFiles, finish, error);\n }, error);\n } else {\n loadXKTs_includeTheirMetaModels(xktFiles, finish, error);\n }\n } else {\n this._dataSource.getManifest(params.manifestSrc, (manifestData) => {\n if (sceneModel.destroyed) {\n return;\n }\n const xktFiles = manifestData.xktFiles;\n if (!xktFiles || xktFiles.length === 0) {\n error(`load(): Failed to load model manifest - manifest not valid`);\n return;\n }\n const metaModelFiles = manifestData.metaModelFiles;\n if (metaModelFiles) {\n loadJSONs(metaModelFiles, () => {\n loadXKTs_excludeTheirMetaModels(xktFiles, finish, error);\n }, error);\n } else {\n loadXKTs_includeTheirMetaModels(xktFiles, finish, error);\n }\n }, error);\n }\n }\n }\n\n return sceneModel;\n }\n\n _loadModel(src, params, options, sceneModel, metaModel, manifestCtx, done, error) {\n this._dataSource.getXKT(params.src, (arrayBuffer) => {\n this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);\n done();\n }, error);\n }\n\n _parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx) {\n if (sceneModel.destroyed) {\n return;\n }\n const dataView = new DataView(arrayBuffer);\n const dataArray = new Uint8Array(arrayBuffer);\n const xktVersion = dataView.getUint32(0, true);\n const parser = parsers[xktVersion];\n if (!parser) {\n this.error(\"Unsupported .XKT file version: \" + xktVersion + \" - this XKTLoaderPlugin supports versions \" + Object.keys(parsers));\n return;\n }\n this.log(\"Loading .xkt V\" + xktVersion);\n const numElements = dataView.getUint32(4, true);\n const elements = [];\n let byteOffset = (numElements + 2) * 4;\n for (let i = 0; i < numElements; i++) {\n const elementSize = dataView.getUint32((i + 2) * 4, true);\n elements.push(dataArray.subarray(byteOffset, byteOffset + elementSize));\n byteOffset += elementSize;\n }\n parser.parse(this.viewer, options, elements, sceneModel, metaModel, manifestCtx);\n }\n}\n\nfunction getBaseDirectory(filePath) {\n const pathArray = filePath.split('/');\n pathArray.pop(); // Remove the file name or the last segment of the path\n return pathArray.join('/') + '/';\n}\n\nexport {XKTLoaderPlugin}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1711, + "__docId__": 1719, "kind": "variable", "name": "parsers", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", @@ -32184,7 +32400,7 @@ "ignore": true }, { - "__docId__": 1712, + "__docId__": 1720, "kind": "function", "name": "getBaseDirectory", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", @@ -32215,7 +32431,7 @@ "ignore": true }, { - "__docId__": 1713, + "__docId__": 1721, "kind": "class", "name": "XKTLoaderPlugin", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js", @@ -32239,7 +32455,7 @@ ] }, { - "__docId__": 1714, + "__docId__": 1722, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32378,7 +32594,7 @@ ] }, { - "__docId__": 1715, + "__docId__": 1723, "kind": "member", "name": "_maxGeometryBatchSize", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32396,7 +32612,7 @@ } }, { - "__docId__": 1723, + "__docId__": 1731, "kind": "get", "name": "supportedVersions", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32428,7 +32644,7 @@ } }, { - "__docId__": 1724, + "__docId__": 1732, "kind": "get", "name": "textureTranscoder", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32449,7 +32665,7 @@ } }, { - "__docId__": 1725, + "__docId__": 1733, "kind": "set", "name": "textureTranscoder", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32470,7 +32686,7 @@ } }, { - "__docId__": 1726, + "__docId__": 1734, "kind": "member", "name": "_textureTranscoder", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32488,7 +32704,7 @@ } }, { - "__docId__": 1727, + "__docId__": 1735, "kind": "get", "name": "dataSource", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32509,7 +32725,7 @@ } }, { - "__docId__": 1728, + "__docId__": 1736, "kind": "set", "name": "dataSource", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32530,7 +32746,7 @@ } }, { - "__docId__": 1729, + "__docId__": 1737, "kind": "member", "name": "_dataSource", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32548,7 +32764,7 @@ } }, { - "__docId__": 1730, + "__docId__": 1738, "kind": "get", "name": "objectDefaults", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32569,7 +32785,7 @@ } }, { - "__docId__": 1731, + "__docId__": 1739, "kind": "set", "name": "objectDefaults", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32590,7 +32806,7 @@ } }, { - "__docId__": 1732, + "__docId__": 1740, "kind": "member", "name": "_objectDefaults", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32608,7 +32824,7 @@ } }, { - "__docId__": 1733, + "__docId__": 1741, "kind": "get", "name": "includeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32629,7 +32845,7 @@ } }, { - "__docId__": 1734, + "__docId__": 1742, "kind": "set", "name": "includeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32650,7 +32866,7 @@ } }, { - "__docId__": 1735, + "__docId__": 1743, "kind": "member", "name": "_includeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32668,7 +32884,7 @@ } }, { - "__docId__": 1736, + "__docId__": 1744, "kind": "get", "name": "excludeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32689,7 +32905,7 @@ } }, { - "__docId__": 1737, + "__docId__": 1745, "kind": "set", "name": "excludeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32710,7 +32926,7 @@ } }, { - "__docId__": 1738, + "__docId__": 1746, "kind": "member", "name": "_excludeTypes", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32728,7 +32944,7 @@ } }, { - "__docId__": 1739, + "__docId__": 1747, "kind": "get", "name": "excludeUnclassifiedObjects", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32749,7 +32965,7 @@ } }, { - "__docId__": 1740, + "__docId__": 1748, "kind": "set", "name": "excludeUnclassifiedObjects", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32770,7 +32986,7 @@ } }, { - "__docId__": 1741, + "__docId__": 1749, "kind": "member", "name": "_excludeUnclassifiedObjects", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32788,7 +33004,7 @@ } }, { - "__docId__": 1742, + "__docId__": 1750, "kind": "get", "name": "globalizeObjectIds", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32809,7 +33025,7 @@ } }, { - "__docId__": 1743, + "__docId__": 1751, "kind": "set", "name": "globalizeObjectIds", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32830,7 +33046,7 @@ } }, { - "__docId__": 1744, + "__docId__": 1752, "kind": "member", "name": "_globalizeObjectIds", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32848,7 +33064,7 @@ } }, { - "__docId__": 1745, + "__docId__": 1753, "kind": "get", "name": "reuseGeometries", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32869,7 +33085,7 @@ } }, { - "__docId__": 1746, + "__docId__": 1754, "kind": "set", "name": "reuseGeometries", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32890,7 +33106,7 @@ } }, { - "__docId__": 1747, + "__docId__": 1755, "kind": "member", "name": "_reuseGeometries", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -32908,7 +33124,7 @@ } }, { - "__docId__": 1748, + "__docId__": 1756, "kind": "method", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -33260,7 +33476,7 @@ } }, { - "__docId__": 1749, + "__docId__": 1757, "kind": "method", "name": "_loadModel", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -33326,7 +33542,7 @@ "return": null }, { - "__docId__": 1750, + "__docId__": 1758, "kind": "method", "name": "_parseModel", "memberof": "src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin", @@ -33380,29 +33596,29 @@ "return": null }, { - "__docId__": 1751, + "__docId__": 1759, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/index.js", "content": "export * from \"./XKTDefaultDataSource.js\";\nexport * from \"./XKTLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1752, + "__docId__": 1760, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", "content": "/*\n\n Parser for .XKT Format V1\n\n.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format\n\n DEPRECATED\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nconst decompressColor = (function () {\n const color2 = new Float32Array(3);\n return function (color) {\n color2[0] = color[0] / 255.0;\n color2[1] = color[1] / 255.0;\n color2[2] = color[2] / 255.0;\n return color2;\n };\n})();\n\nfunction extract(elements) {\n return {\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n meshPositions: elements[4],\n meshIndices: elements[5],\n meshEdgesIndices: elements[6],\n meshColors: elements[7],\n entityIDs: elements[8],\n entityMeshes: elements[9],\n entityIsObjects: elements[10],\n positionsDecodeMatrix: elements[11]\n };\n}\n\nfunction inflate(deflatedData) {\n return {\n positions: new Uint16Array(pako.inflate(deflatedData.positions).buffer),\n normals: new Int8Array(pako.inflate(deflatedData.normals).buffer),\n indices: new Uint32Array(pako.inflate(deflatedData.indices).buffer),\n edgeIndices: new Uint32Array(pako.inflate(deflatedData.edgeIndices).buffer),\n meshPositions: new Uint32Array(pako.inflate(deflatedData.meshPositions).buffer),\n meshIndices: new Uint32Array(pako.inflate(deflatedData.meshIndices).buffer),\n meshEdgesIndices: new Uint32Array(pako.inflate(deflatedData.meshEdgesIndices).buffer),\n meshColors: new Uint8Array(pako.inflate(deflatedData.meshColors).buffer),\n entityIDs: pako.inflate(deflatedData.entityIDs, {to: 'string'}),\n entityMeshes: new Uint32Array(pako.inflate(deflatedData.entityMeshes).buffer),\n entityIsObjects: new Uint8Array(pako.inflate(deflatedData.entityIsObjects).buffer),\n positionsDecodeMatrix: new Float32Array(pako.inflate(deflatedData.positionsDecodeMatrix).buffer)\n };\n}\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n sceneModel.positionsCompression = \"precompressed\";\n sceneModel.normalsCompression = \"precompressed\";\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const meshPositions = inflatedData.meshPositions;\n const meshIndices = inflatedData.meshIndices;\n const meshEdgesIndices = inflatedData.meshEdgesIndices;\n const meshColors = inflatedData.meshColors;\n const entityIDs = JSON.parse(inflatedData.entityIDs);\n const entityMeshes = inflatedData.entityMeshes;\n const entityIsObjects = inflatedData.entityIsObjects;\n const numMeshes = meshPositions.length;\n const numEntities = entityMeshes.length;\n\n for (let i = 0; i < numEntities; i++) {\n\n const xktEntityId = entityIDs [i];\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n }\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n const lastEntity = (i === numEntities - 1);\n const meshIds = [];\n\n for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshes.length : entityMeshes [i + 1]; j < jlen; j++) {\n\n const lastMesh = (j === (numMeshes - 1));\n const meshId = entityId + \".mesh.\" + j;\n\n const color = decompressColor(meshColors.subarray((j * 4), (j * 4) + 3));\n const opacity = meshColors[(j * 4) + 3] / 255.0;\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n primitive: \"triangles\",\n positionsCompressed: positions.subarray(meshPositions [j], lastMesh ? positions.length : meshPositions [j + 1]),\n normalsCompressed: normals.subarray(meshPositions [j], lastMesh ? positions.length : meshPositions [j + 1]),\n indices: indices.subarray(meshIndices [j], lastMesh ? indices.length : meshIndices [j + 1]),\n edgeIndices: edgeIndices.subarray(meshEdgesIndices [j], lastMesh ? edgeIndices.length : meshEdgesIndices [j + 1]),\n positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,\n color: color,\n opacity: opacity\n }));\n\n meshIds.push(meshId);\n }\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: (entityIsObjects [i] === 1),\n meshIds: meshIds\n }));\n }\n}\n\n/** @private */\nconst ParserV1 = {\n version: 1,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV1};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1753, + "__docId__": 1761, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33423,7 +33639,7 @@ "ignore": true }, { - "__docId__": 1754, + "__docId__": 1762, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33444,7 +33660,7 @@ "ignore": true }, { - "__docId__": 1755, + "__docId__": 1763, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33475,7 +33691,7 @@ "ignore": true }, { - "__docId__": 1756, + "__docId__": 1764, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33506,7 +33722,7 @@ "ignore": true }, { - "__docId__": 1757, + "__docId__": 1765, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33563,7 +33779,7 @@ "ignore": true }, { - "__docId__": 1758, + "__docId__": 1766, "kind": "variable", "name": "ParserV1", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV1.js", @@ -33583,18 +33799,18 @@ } }, { - "__docId__": 1759, + "__docId__": 1767, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", "content": "/*\n Parser for .XKT Format V10\n*/\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\nimport {geometryCompressionUtils} from \"../../../viewer/scene/math/geometryCompressionUtils.js\";\nimport {JPEGMediaType, PNGMediaType} from \"../../../viewer/scene/constants/constants.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\n\nconst NUM_TEXTURE_ATTRIBUTES = 9;\n\nfunction extract(elements) {\n\n let i = 0;\n\n return {\n metadata: elements[i++],\n textureData: elements[i++],\n eachTextureDataPortion: elements[i++],\n eachTextureAttributes: elements[i++],\n positions: elements[i++],\n normals: elements[i++],\n colors: elements[i++],\n uvs: elements[i++],\n indices: elements[i++],\n edgeIndices: elements[i++],\n eachTextureSetTextures: elements[i++],\n matrices: elements[i++],\n reusedGeometriesDecodeMatrix: elements[i++],\n eachGeometryPrimitiveType: elements[i++],\n eachGeometryPositionsPortion: elements[i++],\n eachGeometryNormalsPortion: elements[i++],\n eachGeometryColorsPortion: elements[i++],\n eachGeometryUVsPortion: elements[i++],\n eachGeometryIndicesPortion: elements[i++],\n eachGeometryEdgeIndicesPortion: elements[i++],\n eachMeshGeometriesPortion: elements[i++],\n eachMeshMatricesPortion: elements[i++],\n eachMeshTextureSet: elements[i++],\n eachMeshMaterialAttributes: elements[i++],\n eachEntityId: elements[i++],\n eachEntityMeshesPortion: elements[i++],\n eachTileAABB: elements[i++],\n eachTileEntitiesPortion: elements[i++]\n };\n}\n\nfunction inflate(deflatedData) {\n\n function inflate(array, options) {\n return (array.length === 0) ? [] : pako.inflate(array, options).buffer;\n }\n\n return {\n metadata: JSON.parse(pako.inflate(deflatedData.metadata, {to: 'string'})),\n textureData: new Uint8Array(inflate(deflatedData.textureData)), // <<----------------------------- ??? ZIPPing to blame?\n eachTextureDataPortion: new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),\n eachTextureAttributes: new Uint16Array(inflate(deflatedData.eachTextureAttributes)),\n positions: new Uint16Array(inflate(deflatedData.positions)),\n normals: new Int8Array(inflate(deflatedData.normals)),\n colors: new Uint8Array(inflate(deflatedData.colors)),\n uvs: new Float32Array(inflate(deflatedData.uvs)),\n indices: new Uint32Array(inflate(deflatedData.indices)),\n edgeIndices: new Uint32Array(inflate(deflatedData.edgeIndices)),\n eachTextureSetTextures: new Int32Array(inflate(deflatedData.eachTextureSetTextures)),\n matrices: new Float32Array(inflate(deflatedData.matrices)),\n reusedGeometriesDecodeMatrix: new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),\n eachGeometryPrimitiveType: new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),\n eachGeometryPositionsPortion: new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),\n eachGeometryNormalsPortion: new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),\n eachGeometryColorsPortion: new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),\n eachGeometryUVsPortion: new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),\n eachGeometryIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),\n eachGeometryEdgeIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),\n eachMeshGeometriesPortion: new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),\n eachMeshMatricesPortion: new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),\n eachMeshTextureSet: new Int32Array(inflate(deflatedData.eachMeshTextureSet)), // Can be -1\n eachMeshMaterialAttributes: new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),\n eachEntityId: JSON.parse(pako.inflate(deflatedData.eachEntityId, {to: 'string'})),\n eachEntityMeshesPortion: new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),\n eachTileAABB: new Float64Array(inflate(deflatedData.eachTileAABB)),\n eachTileEntitiesPortion: new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion)),\n };\n}\n\nconst decompressColor = (function () {\n const floatColor = new Float32Array(3);\n return function (intColor) {\n floatColor[0] = intColor[0] / 255.0;\n floatColor[1] = intColor[1] / 255.0;\n floatColor[2] = intColor[2] / 255.0;\n return floatColor;\n };\n})();\n\nconst imagDataToImage = (function () {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n return function (imagedata) {\n canvas.width = imagedata.width;\n canvas.height = imagedata.height;\n context.putImageData(imagedata, 0, 0);\n return canvas.toDataURL();\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n const metadata = inflatedData.metadata;\n const textureData = inflatedData.textureData;\n const eachTextureDataPortion = inflatedData.eachTextureDataPortion;\n const eachTextureAttributes = inflatedData.eachTextureAttributes;\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const colors = inflatedData.colors;\n const uvs = inflatedData.uvs;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const eachTextureSetTextures = inflatedData.eachTextureSetTextures;\n const matrices = inflatedData.matrices;\n const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;\n const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;\n const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;\n const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;\n const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;\n const eachGeometryUVsPortion = inflatedData.eachGeometryUVsPortion;\n const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;\n const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;\n const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;\n const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;\n const eachMeshTextureSet = inflatedData.eachMeshTextureSet;\n const eachMeshMaterialAttributes = inflatedData.eachMeshMaterialAttributes;\n const eachEntityId = inflatedData.eachEntityId;\n const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;\n const eachTileAABB = inflatedData.eachTileAABB;\n const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;\n\n const numTextures = eachTextureDataPortion.length;\n const numTextureSets = eachTextureSetTextures.length / 5;\n const numGeometries = eachGeometryPositionsPortion.length;\n const numMeshes = eachMeshGeometriesPortion.length;\n const numEntities = eachEntityMeshesPortion.length;\n const numTiles = eachTileEntitiesPortion.length;\n\n if (metaModel) {\n metaModel.loadData(metadata, {\n includeTypes: options.includeTypes,\n excludeTypes: options.excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n }); // Can be empty\n }\n\n // Create textures\n\n for (let textureIndex = 0; textureIndex < numTextures; textureIndex++) {\n const atLastTexture = (textureIndex === (numTextures - 1));\n const textureDataPortionStart = eachTextureDataPortion[textureIndex];\n const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]);\n\n const textureDataPortionSize = textureDataPortionEnd - textureDataPortionStart;\n const textureDataPortionExists = (textureDataPortionSize > 0);\n\n const textureAttrBaseIdx = (textureIndex * NUM_TEXTURE_ATTRIBUTES);\n\n const compressed = (eachTextureAttributes[textureAttrBaseIdx + 0] === 1);\n const mediaType = eachTextureAttributes[textureAttrBaseIdx + 1];\n const width = eachTextureAttributes[textureAttrBaseIdx + 2];\n const height = eachTextureAttributes[textureAttrBaseIdx + 3];\n const minFilter = eachTextureAttributes[textureAttrBaseIdx + 4];\n const magFilter = eachTextureAttributes[textureAttrBaseIdx + 5]; // LinearFilter | NearestFilter\n const wrapS = eachTextureAttributes[textureAttrBaseIdx + 6]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping\n const wrapT = eachTextureAttributes[textureAttrBaseIdx + 7]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping\n const wrapR = eachTextureAttributes[textureAttrBaseIdx + 8]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping\n\n if (textureDataPortionExists) {\n\n const imageDataSubarray = new Uint8Array(textureData.subarray(textureDataPortionStart, textureDataPortionEnd));\n const arrayBuffer = imageDataSubarray.buffer;\n const textureId = `${modelPartId}-texture-${textureIndex}`;\n\n if (compressed) {\n\n sceneModel.createTexture({\n id: textureId,\n buffers: [arrayBuffer],\n minFilter,\n magFilter,\n wrapS,\n wrapT,\n wrapR\n });\n\n } else {\n\n const mimeType = mediaType === JPEGMediaType ? \"image/jpeg\" : (mediaType === PNGMediaType ? \"image/png\" : \"image/gif\");\n const blob = new Blob([arrayBuffer], {type: mimeType});\n const urlCreator = window.URL || window.webkitURL;\n const imageUrl = urlCreator.createObjectURL(blob);\n const img = document.createElement('img');\n img.src = imageUrl;\n\n sceneModel.createTexture({\n id: textureId,\n image: img,\n //mediaType,\n minFilter,\n magFilter,\n wrapS,\n wrapT,\n wrapR\n });\n }\n }\n }\n\n // Create texture sets\n\n for (let textureSetIndex = 0; textureSetIndex < numTextureSets; textureSetIndex++) {\n const eachTextureSetTexturesIndex = textureSetIndex * 5;\n const textureSetId = `${modelPartId}-textureSet-${textureSetIndex}`;\n const colorTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 0];\n const metallicRoughnessTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 1];\n const normalsTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 2];\n const emissiveTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 3];\n const occlusionTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 4];\n sceneModel.createTextureSet({\n id: textureSetId,\n colorTextureId: colorTextureIndex >= 0 ? `${modelPartId}-texture-${colorTextureIndex}` : null,\n normalsTextureId: normalsTextureIndex >= 0 ? `${modelPartId}-texture-${normalsTextureIndex}` : null,\n metallicRoughnessTextureId: metallicRoughnessTextureIndex >= 0 ? `${modelPartId}-texture-${metallicRoughnessTextureIndex}` : null,\n emissiveTextureId: emissiveTextureIndex >= 0 ? `${modelPartId}-texture-${emissiveTextureIndex}` : null,\n occlusionTextureId: occlusionTextureIndex >= 0 ? `${modelPartId}-texture-${occlusionTextureIndex}` : null\n });\n }\n\n // Count instances of each geometry\n\n const geometryReuseCounts = new Uint32Array(numGeometries);\n\n for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n if (geometryReuseCounts[geometryIndex] !== undefined) {\n geometryReuseCounts[geometryIndex]++;\n } else {\n geometryReuseCounts[geometryIndex] = 1;\n }\n }\n\n // Iterate over tiles\n\n const tileCenter = math.vec3();\n const rtcAABB = math.AABB3();\n\n const geometryArraysCache = {};\n\n for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {\n\n const lastTileIndex = (numTiles - 1);\n\n const atLastTile = (tileIndex === lastTileIndex);\n\n const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];\n const lastTileEntityIndex = atLastTile ? (numEntities - 1) : (eachTileEntitiesPortion[tileIndex + 1] - 1);\n\n const tileAABBIndex = tileIndex * 6;\n const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);\n\n math.getAABB3Center(tileAABB, tileCenter);\n\n rtcAABB[0] = tileAABB[0] - tileCenter[0];\n rtcAABB[1] = tileAABB[1] - tileCenter[1];\n rtcAABB[2] = tileAABB[2] - tileCenter[2];\n rtcAABB[3] = tileAABB[3] - tileCenter[0];\n rtcAABB[4] = tileAABB[4] - tileCenter[1];\n rtcAABB[5] = tileAABB[5] - tileCenter[2];\n\n const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);\n\n const geometryCreatedInTile = {};\n\n // Iterate over each tile's entities\n\n for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex <= lastTileEntityIndex; tileEntityIndex++) {\n\n const xktEntityId = eachEntityId[tileEntityIndex];\n\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n\n const finalTileEntityIndex = (numEntities - 1);\n const atLastTileEntity = (tileEntityIndex === finalTileEntityIndex);\n const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];\n const lastMeshIndex = atLastTileEntity ? (eachMeshGeometriesPortion.length - 1) : (eachEntityMeshesPortion[tileEntityIndex + 1] - 1);\n\n const meshIds = [];\n\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n // Mask loading of object types\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n // Get initial property values for object types\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n if (props.metallic !== undefined && props.metallic !== null) {\n meshDefaults.metallic = props.metallic;\n }\n if (props.roughness !== undefined && props.roughness !== null) {\n meshDefaults.roughness = props.roughness;\n }\n }\n\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n // Iterate each entity's meshes\n\n for (let meshIndex = firstMeshIndex; meshIndex <= lastMeshIndex; meshIndex++) {\n\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n const geometryReuseCount = geometryReuseCounts[geometryIndex];\n const isReusedGeometry = (geometryReuseCount > 1);\n\n const atLastGeometry = (geometryIndex === (numGeometries - 1));\n\n const textureSetIndex = eachMeshTextureSet[meshIndex];\n\n const textureSetId = (textureSetIndex >= 0) ? `${modelPartId}-textureSet-${textureSetIndex}` : null;\n\n const meshColor = decompressColor(eachMeshMaterialAttributes.subarray((meshIndex * 6), (meshIndex * 6) + 3));\n const meshOpacity = eachMeshMaterialAttributes[(meshIndex * 6) + 3] / 255.0;\n const meshMetallic = eachMeshMaterialAttributes[(meshIndex * 6) + 4] / 255.0;\n const meshRoughness = eachMeshMaterialAttributes[(meshIndex * 6) + 5] / 255.0;\n\n const meshId = manifestCtx.getNextId();\n\n if (isReusedGeometry) {\n\n // Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry\n\n const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];\n const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);\n\n const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel\n\n let geometryArrays = geometryArraysCache[geometryId];\n\n if (!geometryArrays) {\n geometryArrays = {\n batchThisMesh: (!options.reuseGeometries)\n };\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n let geometryValid = false;\n switch (primitiveType) {\n case 0:\n geometryArrays.primitiveName = \"solid\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 1:\n geometryArrays.primitiveName = \"surface\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 2:\n geometryArrays.primitiveName = \"points\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0);\n break;\n case 3:\n geometryArrays.primitiveName = \"lines\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 4:\n geometryArrays.primitiveName = \"lines\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = lineStripToLines(\n geometryArrays.geometryPositions,\n indices.subarray(eachGeometryIndicesPortion [geometryIndex],\n atLastGeometry\n ? indices.length\n : eachGeometryIndicesPortion [geometryIndex + 1]));\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (!geometryValid) {\n geometryArrays = null;\n }\n\n if (geometryArrays) {\n if (geometryReuseCount > 1000) { // TODO: Heuristic to force batching of instanced geometry beyond a certain reuse count (or budget)?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.geometryPositions.length > 1000) { // TODO: Heuristic to force batching on instanced geometry above certain vertex size?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.batchThisMesh) {\n geometryArrays.decompressedPositions = new Float32Array(geometryArrays.geometryPositions.length);\n geometryArrays.transformedAndRecompressedPositions = new Uint16Array(geometryArrays.geometryPositions.length)\n const geometryPositions = geometryArrays.geometryPositions;\n const decompressedPositions = geometryArrays.decompressedPositions;\n for (let i = 0, len = geometryPositions.length; i < len; i += 3) {\n decompressedPositions[i + 0] = geometryPositions[i + 0] * reusedGeometriesDecodeMatrix[0] + reusedGeometriesDecodeMatrix[12];\n decompressedPositions[i + 1] = geometryPositions[i + 1] * reusedGeometriesDecodeMatrix[5] + reusedGeometriesDecodeMatrix[13];\n decompressedPositions[i + 2] = geometryPositions[i + 2] * reusedGeometriesDecodeMatrix[10] + reusedGeometriesDecodeMatrix[14];\n }\n geometryArrays.geometryPositions = null;\n geometryArraysCache[geometryId] = geometryArrays;\n }\n }\n }\n\n if (geometryArrays) {\n\n if (geometryArrays.batchThisMesh) {\n\n const decompressedPositions = geometryArrays.decompressedPositions;\n const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;\n\n for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {\n tempVec4a[0] = decompressedPositions[i + 0];\n tempVec4a[1] = decompressedPositions[i + 1];\n tempVec4a[2] = decompressedPositions[i + 2];\n tempVec4a[3] = 1;\n math.transformVec4(meshMatrix, tempVec4a, tempVec4b);\n geometryCompressionUtils.compressPosition(tempVec4b, rtcAABB, tempVec4a)\n transformedAndRecompressedPositions[i + 0] = tempVec4a[0];\n transformedAndRecompressedPositions[i + 1] = tempVec4a[1];\n transformedAndRecompressedPositions[i + 2] = tempVec4a[2];\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n textureSetId,\n origin: tileCenter,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: transformedAndRecompressedPositions,\n normalsCompressed: geometryArrays.geometryNormals,\n uv: geometryArrays.geometryUVs,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n if (!geometryCreatedInTile[geometryId]) {\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: geometryArrays.geometryPositions,\n normalsCompressed: geometryArrays.geometryNormals,\n uv: geometryArrays.geometryUVs,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: reusedGeometriesDecodeMatrix\n });\n\n geometryCreatedInTile[geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId,\n textureSetId,\n matrix: meshMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity,\n origin: tileCenter\n }));\n\n meshIds.push(meshId);\n }\n }\n\n } else { // Do not reuse geometry\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let primitiveName;\n let geometryPositions;\n let geometryNormals;\n let geometryUVs;\n let geometryColors;\n let geometryIndices;\n let geometryEdgeIndices;\n let geometryValid = false;\n\n switch (primitiveType) {\n case 0:\n primitiveName = \"solid\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 1:\n primitiveName = \"surface\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 2:\n primitiveName = \"points\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0);\n break;\n case 3:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 4:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = lineStripToLines(\n geometryPositions,\n indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry\n ? indices.length\n : eachGeometryIndicesPortion [geometryIndex + 1]));\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (geometryValid) {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n textureSetId,\n origin: tileCenter,\n primitive: primitiveName,\n positionsCompressed: geometryPositions,\n normalsCompressed: geometryNormals,\n uv: geometryUVs && geometryUVs.length > 0 ? geometryUVs : null,\n colorsCompressed: geometryColors,\n indices: geometryIndices,\n edgeIndices: geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n }\n\n if (meshIds.length > 0) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true,\n meshIds: meshIds\n }));\n }\n }\n }\n}\n\nfunction lineStripToLines(positions, indices) {\n const linesIndices = [];\n if (indices.length > 1) {\n for (let i = 0, len = indices.length - 1; i < len; i++) {\n linesIndices.push(indices[i]);\n linesIndices.push(indices[i + 1]);\n }\n } else if (positions.length > 1) {\n for (let i = 0, len = (positions.length / 3) - 1; i < len; i++) {\n linesIndices.push(i);\n linesIndices.push(i + 1);\n }\n }\n return linesIndices;\n}\n\n/** @private */\nconst ParserV10 = {\n version: 10,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV10};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1760, + "__docId__": 1768, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33615,7 +33831,7 @@ "ignore": true }, { - "__docId__": 1761, + "__docId__": 1769, "kind": "variable", "name": "tempVec4a", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33636,7 +33852,7 @@ "ignore": true }, { - "__docId__": 1762, + "__docId__": 1770, "kind": "variable", "name": "tempVec4b", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33657,7 +33873,7 @@ "ignore": true }, { - "__docId__": 1763, + "__docId__": 1771, "kind": "variable", "name": "NUM_TEXTURE_ATTRIBUTES", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33678,7 +33894,7 @@ "ignore": true }, { - "__docId__": 1764, + "__docId__": 1772, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33709,7 +33925,7 @@ "ignore": true }, { - "__docId__": 1765, + "__docId__": 1773, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33740,7 +33956,7 @@ "ignore": true }, { - "__docId__": 1766, + "__docId__": 1774, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33761,7 +33977,7 @@ "ignore": true }, { - "__docId__": 1767, + "__docId__": 1775, "kind": "variable", "name": "imagDataToImage", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33782,7 +33998,7 @@ "ignore": true }, { - "__docId__": 1768, + "__docId__": 1776, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33839,7 +34055,7 @@ "ignore": true }, { - "__docId__": 1769, + "__docId__": 1777, "kind": "function", "name": "lineStripToLines", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33876,7 +34092,7 @@ "ignore": true }, { - "__docId__": 1770, + "__docId__": 1778, "kind": "variable", "name": "ParserV10", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV10.js", @@ -33896,18 +34112,18 @@ } }, { - "__docId__": 1771, + "__docId__": 1779, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", "content": "/*\n\nParser for .XKT Format V2\n\nDEPRECATED\n\n.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n return {\n\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n\n meshPositions: elements[4],\n meshIndices: elements[5],\n meshEdgesIndices: elements[6],\n meshColors: elements[7],\n\n entityIDs: elements[8],\n entityMeshes: elements[9],\n entityIsObjects: elements[10],\n\n positionsDecodeMatrix: elements[11],\n\n entityMeshIds: elements[12],\n entityMatrices: elements[13],\n entityUsesInstancing: elements[14]\n };\n}\n\nfunction inflate(deflatedData) {\n return {\n positions: new Uint16Array(pako.inflate(deflatedData.positions).buffer),\n normals: new Int8Array(pako.inflate(deflatedData.normals).buffer),\n indices: new Uint32Array(pako.inflate(deflatedData.indices).buffer),\n edgeIndices: new Uint32Array(pako.inflate(deflatedData.edgeIndices).buffer),\n\n meshPositions: new Uint32Array(pako.inflate(deflatedData.meshPositions).buffer),\n meshIndices: new Uint32Array(pako.inflate(deflatedData.meshIndices).buffer),\n meshEdgesIndices: new Uint32Array(pako.inflate(deflatedData.meshEdgesIndices).buffer),\n meshColors: new Uint8Array(pako.inflate(deflatedData.meshColors).buffer),\n\n entityIDs: pako.inflate(deflatedData.entityIDs, {to: 'string'}),\n entityMeshes: new Uint32Array(pako.inflate(deflatedData.entityMeshes).buffer),\n entityIsObjects: new Uint8Array(pako.inflate(deflatedData.entityIsObjects).buffer),\n\n positionsDecodeMatrix: new Float32Array(pako.inflate(deflatedData.positionsDecodeMatrix).buffer),\n\n entityMeshIds: new Uint32Array(pako.inflate(deflatedData.entityMeshIds).buffer),\n entityMatrices: new Float32Array(pako.inflate(deflatedData.entityMatrices).buffer),\n entityUsesInstancing: new Uint8Array(pako.inflate(deflatedData.entityUsesInstancing).buffer)\n };\n}\n\nconst decompressColor = (function () {\n const color2 = new Float32Array(3);\n return function (color) {\n color2[0] = color[0] / 255.0;\n color2[1] = color[1] / 255.0;\n color2[2] = color[2] / 255.0;\n return color2;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n sceneModel.positionsCompression = \"precompressed\";\n sceneModel.normalsCompression = \"precompressed\";\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const meshPositions = inflatedData.meshPositions;\n const meshIndices = inflatedData.meshIndices;\n const meshEdgesIndices = inflatedData.meshEdgesIndices;\n const meshColors = inflatedData.meshColors;\n const entityIDs = JSON.parse(inflatedData.entityIDs);\n const entityMeshes = inflatedData.entityMeshes;\n const entityIsObjects = inflatedData.entityIsObjects;\n const entityMeshIds = inflatedData.entityMeshIds;\n const entityMatrices = inflatedData.entityMatrices;\n const entityUsesInstancing = inflatedData.entityUsesInstancing;\n\n const numMeshes = meshPositions.length;\n const numEntities = entityMeshes.length;\n\n const alreadyCreatedGeometries = {};\n\n for (let i = 0; i < numEntities; i++) {\n\n const xktEntityId = entityIDs [i];\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);\n\n if (metaObject) {\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n }\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n const lastEntity = (i === numEntities - 1);\n\n const meshIds = [];\n\n for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {\n\n const jj = entityMeshIds [j];\n\n const lastMesh = (jj === (numMeshes - 1));\n const meshId = manifestCtx.getNextId();\n\n const color = decompressColor(meshColors.subarray((jj * 4), (jj * 4) + 3));\n const opacity = meshColors[(jj * 4) + 3] / 255.0;\n\n const tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);\n const tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);\n const tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);\n const tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);\n\n if (entityUsesInstancing [i] === 1) {\n\n const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;\n\n if (!(geometryId in alreadyCreatedGeometries)) {\n\n sceneModel.createGeometry({\n id: geometryId,\n positionsCompressed: tmpPositions,\n normalsCompressed: tmpNormals,\n indices: tmpIndices,\n edgeIndices: tmpEdgeIndices,\n primitive: \"triangles\",\n positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,\n });\n\n alreadyCreatedGeometries [geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n color: color,\n opacity: opacity,\n matrix: entityMatrix,\n geometryId,\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n primitive: \"triangles\",\n positionsCompressed: tmpPositions,\n normalsCompressed: tmpNormals,\n indices: tmpIndices,\n edgeIndices: tmpEdgeIndices,\n positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,\n color: color,\n opacity: opacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n if (meshIds.length) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: (entityIsObjects [i] === 1),\n meshIds: meshIds\n }));\n }\n }\n}\n\n/** @private */\nconst ParserV2 = {\n version: 2,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV2};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1772, + "__docId__": 1780, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -33928,7 +34144,7 @@ "ignore": true }, { - "__docId__": 1773, + "__docId__": 1781, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -33959,7 +34175,7 @@ "ignore": true }, { - "__docId__": 1774, + "__docId__": 1782, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -33990,7 +34206,7 @@ "ignore": true }, { - "__docId__": 1775, + "__docId__": 1783, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -34011,7 +34227,7 @@ "ignore": true }, { - "__docId__": 1776, + "__docId__": 1784, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -34068,7 +34284,7 @@ "ignore": true }, { - "__docId__": 1777, + "__docId__": 1785, "kind": "variable", "name": "ParserV2", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV2.js", @@ -34088,18 +34304,18 @@ } }, { - "__docId__": 1778, + "__docId__": 1786, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", "content": "/*\n\nParser for .XKT Format V3\n\n.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n return {\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n meshPositions: elements[4],\n meshIndices: elements[5],\n meshEdgesIndices: elements[6],\n meshColors: elements[7],\n entityIDs: elements[8],\n entityMeshes: elements[9],\n entityIsObjects: elements[10],\n instancedPositionsDecodeMatrix: elements[11],\n batchedPositionsDecodeMatrix: elements[12],\n entityMeshIds: elements[13],\n entityMatrices: elements[14],\n entityUsesInstancing: elements[15]\n };\n}\n\nfunction inflate(deflatedData) {\n return {\n positions: new Uint16Array(pako.inflate(deflatedData.positions).buffer),\n normals: new Int8Array(pako.inflate(deflatedData.normals).buffer),\n indices: new Uint32Array(pako.inflate(deflatedData.indices).buffer),\n edgeIndices: new Uint32Array(pako.inflate(deflatedData.edgeIndices).buffer),\n meshPositions: new Uint32Array(pako.inflate(deflatedData.meshPositions).buffer),\n meshIndices: new Uint32Array(pako.inflate(deflatedData.meshIndices).buffer),\n meshEdgesIndices: new Uint32Array(pako.inflate(deflatedData.meshEdgesIndices).buffer),\n meshColors: new Uint8Array(pako.inflate(deflatedData.meshColors).buffer),\n entityIDs: pako.inflate(deflatedData.entityIDs, {to: 'string'}),\n entityMeshes: new Uint32Array(pako.inflate(deflatedData.entityMeshes).buffer),\n entityIsObjects: new Uint8Array(pako.inflate(deflatedData.entityIsObjects).buffer),\n instancedPositionsDecodeMatrix: new Float32Array(pako.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),\n batchedPositionsDecodeMatrix: new Float32Array(pako.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),\n entityMeshIds: new Uint32Array(pako.inflate(deflatedData.entityMeshIds).buffer),\n entityMatrices: new Float32Array(pako.inflate(deflatedData.entityMatrices).buffer),\n entityUsesInstancing: new Uint8Array(pako.inflate(deflatedData.entityUsesInstancing).buffer)\n };\n}\n\nconst decompressColor = (function () {\n const color2 = new Float32Array(3);\n return function (color) {\n color2[0] = color[0] / 255.0;\n color2[1] = color[1] / 255.0;\n color2[2] = color[2] / 255.0;\n return color2;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n sceneModel.positionsCompression = \"precompressed\";\n sceneModel.normalsCompression = \"precompressed\";\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const meshPositions = inflatedData.meshPositions;\n const meshIndices = inflatedData.meshIndices;\n const meshEdgesIndices = inflatedData.meshEdgesIndices;\n const meshColors = inflatedData.meshColors;\n const entityIDs = JSON.parse(inflatedData.entityIDs);\n const entityMeshes = inflatedData.entityMeshes;\n const entityIsObjects = inflatedData.entityIsObjects;\n const entityMeshIds = inflatedData.entityMeshIds;\n const entityMatrices = inflatedData.entityMatrices;\n const entityUsesInstancing = inflatedData.entityUsesInstancing;\n\n const numMeshes = meshPositions.length;\n const numEntities = entityMeshes.length;\n\n const _alreadyCreatedGeometries = {};\n\n for (let i = 0; i < numEntities; i++) {\n\n const xktEntityId = entityIDs [i];\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);\n\n if (metaObject) {\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n }\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n const lastEntity = (i === numEntities - 1);\n\n const meshIds = [];\n\n for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {\n var jj = entityMeshIds [j];\n\n const lastMesh = (jj === (numMeshes - 1));\n const meshId = `${modelPartId}.${entityId}.mesh.${jj}`;\n\n const color = decompressColor(meshColors.subarray((jj * 4), (jj * 4) + 3));\n const opacity = meshColors[(jj * 4) + 3] / 255.0;\n\n var tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);\n var tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);\n var tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);\n var tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);\n\n if (entityUsesInstancing [i] === 1) {\n\n const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;\n\n if (!(geometryId in _alreadyCreatedGeometries)) {\n\n sceneModel.createGeometry({\n id: geometryId,\n positionsCompressed: tmpPositions,\n normalsCompressed: tmpNormals,\n indices: tmpIndices,\n edgeIndices: tmpEdgeIndices,\n primitive: \"triangles\",\n positionsDecodeMatrix: inflatedData.instancedPositionsDecodeMatrix\n });\n\n _alreadyCreatedGeometries [geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n color: color,\n opacity: opacity,\n matrix: entityMatrix,\n geometryId,\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n primitive: \"triangles\",\n positionsCompressed: tmpPositions,\n normalsCompressed: tmpNormals,\n indices: tmpIndices,\n edgeIndices: tmpEdgeIndices,\n positionsDecodeMatrix: inflatedData.batchedPositionsDecodeMatrix,\n color: color,\n opacity: opacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n if (meshIds.length) {\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: (entityIsObjects [i] === 1),\n meshIds: meshIds\n }));\n }\n }\n}\n\n/** @private */\nconst ParserV3 = {\n version: 3,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV3};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1779, + "__docId__": 1787, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34120,7 +34336,7 @@ "ignore": true }, { - "__docId__": 1780, + "__docId__": 1788, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34151,7 +34367,7 @@ "ignore": true }, { - "__docId__": 1781, + "__docId__": 1789, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34182,7 +34398,7 @@ "ignore": true }, { - "__docId__": 1782, + "__docId__": 1790, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34203,7 +34419,7 @@ "ignore": true }, { - "__docId__": 1783, + "__docId__": 1791, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34260,7 +34476,7 @@ "ignore": true }, { - "__docId__": 1784, + "__docId__": 1792, "kind": "variable", "name": "ParserV3", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV3.js", @@ -34280,18 +34496,18 @@ } }, { - "__docId__": 1785, + "__docId__": 1793, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", "content": "/*\n\nParser for .XKT Format V4\n\n.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n return {\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n decodeMatrices: elements[4],\n matrices: elements[5],\n eachPrimitivePositionsAndNormalsPortion: elements[6],\n eachPrimitiveIndicesPortion: elements[7],\n eachPrimitiveEdgeIndicesPortion: elements[8],\n eachPrimitiveDecodeMatricesPortion: elements[9],\n eachPrimitiveColor: elements[10],\n primitiveInstances: elements[11],\n eachEntityId: elements[12],\n eachEntityPrimitiveInstancesPortion: elements[13],\n eachEntityMatricesPortion: elements[14],\n eachEntityMatrix: elements[15]\n };\n}\n\nfunction inflate(deflatedData) {\n return {\n positions: new Uint16Array(pako.inflate(deflatedData.positions).buffer),\n normals: new Int8Array(pako.inflate(deflatedData.normals).buffer),\n indices: new Uint32Array(pako.inflate(deflatedData.indices).buffer),\n edgeIndices: new Uint32Array(pako.inflate(deflatedData.edgeIndices).buffer),\n decodeMatrices: new Float32Array(pako.inflate(deflatedData.decodeMatrices).buffer),\n matrices: new Float32Array(pako.inflate(deflatedData.matrices).buffer),\n eachPrimitivePositionsAndNormalsPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),\n eachPrimitiveIndicesPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),\n eachPrimitiveEdgeIndicesPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),\n eachPrimitiveDecodeMatricesPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitiveDecodeMatricesPortion).buffer),\n eachPrimitiveColor: new Uint8Array(pako.inflate(deflatedData.eachPrimitiveColor).buffer),\n primitiveInstances: new Uint32Array(pako.inflate(deflatedData.primitiveInstances).buffer),\n eachEntityId: pako.inflate(deflatedData.eachEntityId, {to: 'string'}),\n eachEntityPrimitiveInstancesPortion: new Uint32Array(pako.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),\n eachEntityMatricesPortion: new Uint32Array(pako.inflate(deflatedData.eachEntityMatricesPortion).buffer)\n };\n}\n\nconst decompressColor = (function () {\n const color2 = new Float32Array(3);\n return function (color) {\n color2[0] = color[0] / 255.0;\n color2[1] = color[1] / 255.0;\n color2[2] = color[2] / 255.0;\n return color2;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n sceneModel.positionsCompression = \"precompressed\";\n sceneModel.normalsCompression = \"precompressed\";\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const decodeMatrices = inflatedData.decodeMatrices;\n const matrices = inflatedData.matrices;\n\n const eachPrimitivePositionsAndNormalsPortion = inflatedData.eachPrimitivePositionsAndNormalsPortion;\n const eachPrimitiveIndicesPortion = inflatedData.eachPrimitiveIndicesPortion;\n const eachPrimitiveEdgeIndicesPortion = inflatedData.eachPrimitiveEdgeIndicesPortion;\n const eachPrimitiveDecodeMatricesPortion = inflatedData.eachPrimitiveDecodeMatricesPortion;\n const eachPrimitiveColor = inflatedData.eachPrimitiveColor;\n\n const primitiveInstances = inflatedData.primitiveInstances;\n\n const eachEntityId = JSON.parse(inflatedData.eachEntityId);\n const eachEntityPrimitiveInstancesPortion = inflatedData.eachEntityPrimitiveInstancesPortion;\n const eachEntityMatricesPortion = inflatedData.eachEntityMatricesPortion;\n\n const numPrimitives = eachPrimitivePositionsAndNormalsPortion.length;\n const numPrimitiveInstances = primitiveInstances.length;\n const primitiveInstanceCounts = new Uint8Array(numPrimitives); // For each mesh, how many times it is instanced\n const orderedPrimitiveIndexes = new Uint32Array(numPrimitives); // For each mesh, its index sorted into runs that share the same decode matrix\n\n const numEntities = eachEntityId.length;\n\n // Get lookup that orders primitives into runs that share the same decode matrices;\n // this is used to create meshes in batches that use the same decode matrix\n\n for (let primitiveIndex = 0; primitiveIndex < numPrimitives; primitiveIndex++) {\n orderedPrimitiveIndexes[primitiveIndex] = primitiveIndex;\n }\n\n orderedPrimitiveIndexes.sort((i1, i2) => {\n if (eachPrimitiveDecodeMatricesPortion[i1] < eachPrimitiveDecodeMatricesPortion[i2]) {\n return -1;\n }\n if (eachPrimitiveDecodeMatricesPortion[i1] > eachPrimitiveDecodeMatricesPortion[i2]) {\n return 1;\n }\n return 0;\n });\n\n // Count instances of each primitive\n\n for (let primitiveInstanceIndex = 0; primitiveInstanceIndex < numPrimitiveInstances; primitiveInstanceIndex++) {\n const primitiveIndex = primitiveInstances[primitiveInstanceIndex];\n primitiveInstanceCounts[primitiveIndex]++;\n }\n\n // Map batched primitives to the entities that will use them\n\n const batchedPrimitiveEntityIndexes = {};\n\n for (let entityIndex = 0; entityIndex < numEntities; entityIndex++) {\n\n const lastEntityIndex = (numEntities - 1);\n const atLastEntity = (entityIndex === lastEntityIndex);\n const firstEntityPrimitiveInstanceIndex = eachEntityPrimitiveInstancesPortion [entityIndex];\n const lastEntityPrimitiveInstanceIndex = atLastEntity ? eachEntityPrimitiveInstancesPortion[lastEntityIndex] : eachEntityPrimitiveInstancesPortion[entityIndex + 1];\n\n for (let primitiveInstancesIndex = firstEntityPrimitiveInstanceIndex; primitiveInstancesIndex < lastEntityPrimitiveInstanceIndex; primitiveInstancesIndex++) {\n\n const primitiveIndex = primitiveInstances[primitiveInstancesIndex];\n const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n if (!isInstancedPrimitive) {\n batchedPrimitiveEntityIndexes[primitiveIndex] = entityIndex;\n }\n }\n }\n\n var countGeometries = 0;\n\n // Create 1) geometries for instanced primitives, and 2) meshes for batched primitives. We create all the\n // batched meshes now, before we create entities, because we're creating the batched meshes in runs that share\n // the same decode matrices. Each run of meshes with the same decode matrix will end up in the same\n // BatchingLayer; the SceneModel#createMesh() method starts a new BatchingLayer each time the decode\n // matrix has changed since the last invocation of that method, hence why we need to order batched meshes\n // in runs like this.\n\n for (let primitiveIndex = 0; primitiveIndex < numPrimitives; primitiveIndex++) {\n\n const orderedPrimitiveIndex = orderedPrimitiveIndexes[primitiveIndex];\n\n const atLastPrimitive = (orderedPrimitiveIndex === (numPrimitives - 1));\n\n const primitiveInstanceCount = primitiveInstanceCounts[orderedPrimitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n const color = decompressColor(eachPrimitiveColor.subarray((orderedPrimitiveIndex * 4), (orderedPrimitiveIndex * 4) + 3));\n const opacity = eachPrimitiveColor[(orderedPrimitiveIndex * 4) + 3] / 255.0;\n\n const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex + 1]);\n const primitiveNormals = normals.subarray(eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex], atLastPrimitive ? normals.length : eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex + 1]);\n const primitiveIndices = indices.subarray(eachPrimitiveIndicesPortion [orderedPrimitiveIndex], atLastPrimitive ? indices.length : eachPrimitiveIndicesPortion [orderedPrimitiveIndex + 1]);\n const primitiveEdgeIndices = edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion [orderedPrimitiveIndex], atLastPrimitive ? edgeIndices.length : eachPrimitiveEdgeIndicesPortion [orderedPrimitiveIndex + 1]);\n const primitiveDecodeMatrix = decodeMatrices.subarray(eachPrimitiveDecodeMatricesPortion [orderedPrimitiveIndex], eachPrimitiveDecodeMatricesPortion [orderedPrimitiveIndex] + 16);\n\n if (isInstancedPrimitive) {\n\n // Primitive instanced by more than one entity, and has positions in Model-space\n\n const geometryId = `${modelPartId}-geometry.${orderedPrimitiveIndex}`; // These IDs are local to the SceneModel\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices,\n positionsDecodeMatrix: primitiveDecodeMatrix\n });\n\n countGeometries++;\n\n } else {\n\n // Primitive is used only by one entity, and has positions pre-transformed into World-space\n\n const meshId = `${modelPartId}-${orderedPrimitiveIndex}`;\n\n const entityIndex = batchedPrimitiveEntityIndexes[orderedPrimitiveIndex];\n const entityId = eachEntityId[entityIndex];\n\n const meshDefaults = {}; // TODO: get from lookup from entity IDs\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices,\n positionsDecodeMatrix: primitiveDecodeMatrix,\n color: color,\n opacity: opacity\n }));\n }\n }\n\n let countInstances = 0;\n\n for (let entityIndex = 0; entityIndex < numEntities; entityIndex++) {\n\n const lastEntityIndex = (numEntities - 1);\n const atLastEntity = (entityIndex === lastEntityIndex);\n const entityId = eachEntityId[entityIndex];\n const firstEntityPrimitiveInstanceIndex = eachEntityPrimitiveInstancesPortion [entityIndex];\n const lastEntityPrimitiveInstanceIndex = atLastEntity ? eachEntityPrimitiveInstancesPortion[lastEntityIndex] : eachEntityPrimitiveInstancesPortion[entityIndex + 1];\n\n const meshIds = [];\n\n for (let primitiveInstancesIndex = firstEntityPrimitiveInstanceIndex; primitiveInstancesIndex < lastEntityPrimitiveInstanceIndex; primitiveInstancesIndex++) {\n\n const primitiveIndex = primitiveInstances[primitiveInstancesIndex];\n const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n if (isInstancedPrimitive) {\n\n const meshDefaults = {}; // TODO: get from lookup from entity IDs\n\n const meshId = `${modelPartId}-instance.${countInstances++}`;\n const geometryId = `${modelPartId}-geometry.${primitiveIndex}`; // These IDs are local to the SceneModel\n\n const matricesIndex = (eachEntityMatricesPortion [entityIndex]) * 16;\n const matrix = matrices.subarray(matricesIndex, matricesIndex + 16);\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n matrix: matrix\n }));\n\n meshIds.push(meshId);\n\n } else {\n const meshId = `${modelPartId}-${primitiveIndex}`;\n meshIds.push(primitiveIndex);\n }\n }\n\n if (meshIds.length > 0) {\n\n const entityDefaults = {}; // TODO: get from lookup from entity IDs\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true, ///////////////// TODO: If metaobject exists\n meshIds: meshIds\n }));\n }\n }\n}\n\n/** @private */\nconst ParserV4 = {\n version: 4,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV4};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1786, + "__docId__": 1794, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34312,7 +34528,7 @@ "ignore": true }, { - "__docId__": 1787, + "__docId__": 1795, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34343,7 +34559,7 @@ "ignore": true }, { - "__docId__": 1788, + "__docId__": 1796, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34374,7 +34590,7 @@ "ignore": true }, { - "__docId__": 1789, + "__docId__": 1797, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34395,7 +34611,7 @@ "ignore": true }, { - "__docId__": 1790, + "__docId__": 1798, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34452,7 +34668,7 @@ "ignore": true }, { - "__docId__": 1791, + "__docId__": 1799, "kind": "variable", "name": "ParserV4", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV4.js", @@ -34472,18 +34688,18 @@ } }, { - "__docId__": 1792, + "__docId__": 1800, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", "content": "/*\n\n Parser for .XKT Format V5\n\n.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n return {\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n matrices: elements[4],\n eachPrimitivePositionsAndNormalsPortion: elements[5],\n eachPrimitiveIndicesPortion: elements[6],\n eachPrimitiveEdgeIndicesPortion: elements[7],\n eachPrimitiveColor: elements[8],\n primitiveInstances: elements[9],\n eachEntityId: elements[10],\n eachEntityPrimitiveInstancesPortion: elements[11],\n eachEntityMatricesPortion: elements[12]\n };\n}\n\nfunction inflate(deflatedData) {\n return {\n positions: new Float32Array(pako.inflate(deflatedData.positions).buffer),\n normals: new Int8Array(pako.inflate(deflatedData.normals).buffer),\n indices: new Uint32Array(pako.inflate(deflatedData.indices).buffer),\n edgeIndices: new Uint32Array(pako.inflate(deflatedData.edgeIndices).buffer),\n matrices: new Float32Array(pako.inflate(deflatedData.matrices).buffer),\n eachPrimitivePositionsAndNormalsPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),\n eachPrimitiveIndicesPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),\n eachPrimitiveEdgeIndicesPortion: new Uint32Array(pako.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),\n eachPrimitiveColor: new Uint8Array(pako.inflate(deflatedData.eachPrimitiveColor).buffer),\n primitiveInstances: new Uint32Array(pako.inflate(deflatedData.primitiveInstances).buffer),\n eachEntityId: pako.inflate(deflatedData.eachEntityId, {to: 'string'}),\n eachEntityPrimitiveInstancesPortion: new Uint32Array(pako.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),\n eachEntityMatricesPortion: new Uint32Array(pako.inflate(deflatedData.eachEntityMatricesPortion).buffer)\n };\n}\n\nconst decompressColor = (function () {\n const color2 = new Float32Array(3);\n return function (color) {\n color2[0] = color[0] / 255.0;\n color2[1] = color[1] / 255.0;\n color2[2] = color[2] / 255.0;\n return color2;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n sceneModel.positionsCompression = \"disabled\"; // Positions in XKT V4 are floats, which we never quantize, for precision with big models\n sceneModel.normalsCompression = \"precompressed\"; // Normals are oct-encoded though\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n const matrices = inflatedData.matrices;\n\n const eachPrimitivePositionsAndNormalsPortion = inflatedData.eachPrimitivePositionsAndNormalsPortion;\n const eachPrimitiveIndicesPortion = inflatedData.eachPrimitiveIndicesPortion;\n const eachPrimitiveEdgeIndicesPortion = inflatedData.eachPrimitiveEdgeIndicesPortion;\n const eachPrimitiveColor = inflatedData.eachPrimitiveColor;\n\n const primitiveInstances = inflatedData.primitiveInstances;\n\n const eachEntityId = JSON.parse(inflatedData.eachEntityId);\n const eachEntityPrimitiveInstancesPortion = inflatedData.eachEntityPrimitiveInstancesPortion;\n const eachEntityMatricesPortion = inflatedData.eachEntityMatricesPortion;\n\n const numPrimitives = eachPrimitivePositionsAndNormalsPortion.length;\n const numPrimitiveInstances = primitiveInstances.length;\n const primitiveInstanceCounts = new Uint8Array(numPrimitives); // For each mesh, how many times it is instanced\n\n const numEntities = eachEntityId.length;\n\n // Count instances of each primitive\n\n for (let primitiveInstanceIndex = 0; primitiveInstanceIndex < numPrimitiveInstances; primitiveInstanceIndex++) {\n const primitiveIndex = primitiveInstances[primitiveInstanceIndex];\n primitiveInstanceCounts[primitiveIndex]++;\n }\n\n // Map batched primitives to the entities that will use them\n\n const batchedPrimitiveEntityIndexes = {};\n\n for (let entityIndex = 0; entityIndex < numEntities; entityIndex++) {\n\n const lastEntityIndex = (numEntities - 1);\n const atLastEntity = (entityIndex === lastEntityIndex);\n const firstEntityPrimitiveInstanceIndex = eachEntityPrimitiveInstancesPortion [entityIndex];\n const lastEntityPrimitiveInstanceIndex = atLastEntity ? eachEntityPrimitiveInstancesPortion[lastEntityIndex] : eachEntityPrimitiveInstancesPortion[entityIndex + 1];\n\n for (let primitiveInstancesIndex = firstEntityPrimitiveInstanceIndex; primitiveInstancesIndex < lastEntityPrimitiveInstanceIndex; primitiveInstancesIndex++) {\n\n const primitiveIndex = primitiveInstances[primitiveInstancesIndex];\n const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n if (!isInstancedPrimitive) {\n batchedPrimitiveEntityIndexes[primitiveIndex] = entityIndex;\n }\n }\n }\n\n var countGeometries = 0;\n\n // Create geometries for instanced primitives and meshes for batched primitives.\n\n for (let primitiveIndex = 0; primitiveIndex < numPrimitives; primitiveIndex++) {\n\n const atLastPrimitive = (primitiveIndex === (numPrimitives - 1));\n\n const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n const color = decompressColor(eachPrimitiveColor.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));\n const opacity = eachPrimitiveColor[(primitiveIndex * 4) + 3] / 255.0;\n\n const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);\n const primitiveNormals = normals.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? normals.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);\n const primitiveIndices = indices.subarray(eachPrimitiveIndicesPortion [primitiveIndex], atLastPrimitive ? indices.length : eachPrimitiveIndicesPortion [primitiveIndex + 1]);\n const primitiveEdgeIndices = edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion [primitiveIndex], atLastPrimitive ? edgeIndices.length : eachPrimitiveEdgeIndicesPortion [primitiveIndex + 1]);\n\n if (isInstancedPrimitive) {\n\n // Primitive instanced by more than one entity, and has positions in Model-space\n\n const geometryId = `${modelPartId}-geometry.${primitiveIndex}`; // These IDs are local to the SceneModel\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices\n });\n\n countGeometries++;\n\n } else {\n\n // Primitive is used only by one entity, and has positions pre-transformed into World-space\n\n const meshId = primitiveIndex; // These IDs are local to the SceneModel\n\n const entityIndex = batchedPrimitiveEntityIndexes[primitiveIndex];\n const entityId = eachEntityId[entityIndex];\n\n const meshDefaults = {}; // TODO: get from lookup from entity IDs\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices,\n color: color,\n opacity: opacity\n }));\n }\n }\n\n let countInstances = 0;\n\n for (let entityIndex = 0; entityIndex < numEntities; entityIndex++) {\n\n const lastEntityIndex = (numEntities - 1);\n const atLastEntity = (entityIndex === lastEntityIndex);\n const entityId = eachEntityId[entityIndex];\n const firstEntityPrimitiveInstanceIndex = eachEntityPrimitiveInstancesPortion [entityIndex];\n const lastEntityPrimitiveInstanceIndex = atLastEntity ? eachEntityPrimitiveInstancesPortion[lastEntityIndex] : eachEntityPrimitiveInstancesPortion[entityIndex + 1];\n\n const meshIds = [];\n\n for (let primitiveInstancesIndex = firstEntityPrimitiveInstanceIndex; primitiveInstancesIndex < lastEntityPrimitiveInstanceIndex; primitiveInstancesIndex++) {\n\n const primitiveIndex = primitiveInstances[primitiveInstancesIndex];\n const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];\n const isInstancedPrimitive = (primitiveInstanceCount > 1);\n\n if (isInstancedPrimitive) {\n\n const meshDefaults = {}; // TODO: get from lookup from entity IDs\n\n const meshId = \"instance.\" + countInstances++;\n const geometryId = \"geometry\" + primitiveIndex;\n const matricesIndex = (eachEntityMatricesPortion [entityIndex]) * 16;\n const matrix = matrices.subarray(matricesIndex, matricesIndex + 16);\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n matrix: matrix\n }));\n\n meshIds.push(meshId);\n\n } else {\n meshIds.push(primitiveIndex);\n }\n }\n\n if (meshIds.length > 0) {\n\n const entityDefaults = {}; // TODO: get from lookup from entity IDs\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true, ///////////////// TODO: If metaobject exists\n meshIds: meshIds\n }));\n }\n }\n}\n\n/** @private */\nconst ParserV5 = {\n version: 5,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV5};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1793, + "__docId__": 1801, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34504,7 +34720,7 @@ "ignore": true }, { - "__docId__": 1794, + "__docId__": 1802, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34535,7 +34751,7 @@ "ignore": true }, { - "__docId__": 1795, + "__docId__": 1803, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34566,7 +34782,7 @@ "ignore": true }, { - "__docId__": 1796, + "__docId__": 1804, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34587,7 +34803,7 @@ "ignore": true }, { - "__docId__": 1797, + "__docId__": 1805, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34644,7 +34860,7 @@ "ignore": true }, { - "__docId__": 1798, + "__docId__": 1806, "kind": "variable", "name": "ParserV5", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV5.js", @@ -34664,18 +34880,18 @@ } }, { - "__docId__": 1799, + "__docId__": 1807, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", "content": "/*\n\n Parser for .XKT Format V6\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\nimport {geometryCompressionUtils} from \"../../../viewer/scene/math/geometryCompressionUtils.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n\n return {\n positions: elements[0],\n normals: elements[1],\n indices: elements[2],\n edgeIndices: elements[3],\n matrices: elements[4],\n reusedPrimitivesDecodeMatrix: elements[5],\n eachPrimitivePositionsAndNormalsPortion: elements[6],\n eachPrimitiveIndicesPortion: elements[7],\n eachPrimitiveEdgeIndicesPortion: elements[8],\n eachPrimitiveColorAndOpacity: elements[9],\n primitiveInstances: elements[10],\n eachEntityId: elements[11],\n eachEntityPrimitiveInstancesPortion: elements[12],\n eachEntityMatricesPortion: elements[13],\n eachTileAABB: elements[14],\n eachTileEntitiesPortion: elements[15]\n };\n}\n\nfunction inflate(deflatedData) {\n\n function inflate(array, options) {\n return (array.length === 0) ? [] : pako.inflate(array, options).buffer;\n }\n\n return {\n positions: new Uint16Array(inflate(deflatedData.positions)),\n normals: new Int8Array(inflate(deflatedData.normals)),\n indices: new Uint32Array(inflate(deflatedData.indices)),\n edgeIndices: new Uint32Array(inflate(deflatedData.edgeIndices)),\n matrices: new Float32Array(inflate(deflatedData.matrices)),\n reusedPrimitivesDecodeMatrix: new Float32Array(inflate(deflatedData.reusedPrimitivesDecodeMatrix)),\n eachPrimitivePositionsAndNormalsPortion: new Uint32Array(inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion)),\n eachPrimitiveIndicesPortion: new Uint32Array(inflate(deflatedData.eachPrimitiveIndicesPortion)),\n eachPrimitiveEdgeIndicesPortion: new Uint32Array(inflate(deflatedData.eachPrimitiveEdgeIndicesPortion)),\n eachPrimitiveColorAndOpacity: new Uint8Array(inflate(deflatedData.eachPrimitiveColorAndOpacity)),\n primitiveInstances: new Uint32Array(inflate(deflatedData.primitiveInstances)),\n eachEntityId: pako.inflate(deflatedData.eachEntityId, {to: 'string'}),\n eachEntityPrimitiveInstancesPortion: new Uint32Array(inflate(deflatedData.eachEntityPrimitiveInstancesPortion)),\n eachEntityMatricesPortion: new Uint32Array(inflate(deflatedData.eachEntityMatricesPortion)),\n eachTileAABB: new Float64Array(inflate(deflatedData.eachTileAABB)),\n eachTileEntitiesPortion: new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))\n };\n}\n\nconst decompressColor = (function () {\n const floatColor = new Float32Array(3);\n return function (intColor) {\n floatColor[0] = intColor[0] / 255.0;\n floatColor[1] = intColor[1] / 255.0;\n floatColor[2] = intColor[2] / 255.0;\n return floatColor;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n\n const matrices = inflatedData.matrices;\n\n const reusedPrimitivesDecodeMatrix = inflatedData.reusedPrimitivesDecodeMatrix;\n\n const eachPrimitivePositionsAndNormalsPortion = inflatedData.eachPrimitivePositionsAndNormalsPortion;\n const eachPrimitiveIndicesPortion = inflatedData.eachPrimitiveIndicesPortion;\n const eachPrimitiveEdgeIndicesPortion = inflatedData.eachPrimitiveEdgeIndicesPortion;\n const eachPrimitiveColorAndOpacity = inflatedData.eachPrimitiveColorAndOpacity;\n\n const primitiveInstances = inflatedData.primitiveInstances;\n\n const eachEntityId = JSON.parse(inflatedData.eachEntityId);\n const eachEntityPrimitiveInstancesPortion = inflatedData.eachEntityPrimitiveInstancesPortion;\n const eachEntityMatricesPortion = inflatedData.eachEntityMatricesPortion;\n\n const eachTileAABB = inflatedData.eachTileAABB;\n const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;\n\n const numPrimitives = eachPrimitivePositionsAndNormalsPortion.length;\n const numPrimitiveInstances = primitiveInstances.length;\n const numEntities = eachEntityId.length;\n const numTiles = eachTileEntitiesPortion.length;\n\n // Count instances of each primitive\n\n const primitiveReuseCounts = new Uint32Array(numPrimitives);\n\n for (let primitiveInstanceIndex = 0; primitiveInstanceIndex < numPrimitiveInstances; primitiveInstanceIndex++) {\n const primitiveIndex = primitiveInstances[primitiveInstanceIndex];\n if (primitiveReuseCounts[primitiveIndex] !== undefined) {\n primitiveReuseCounts[primitiveIndex]++;\n } else {\n primitiveReuseCounts[primitiveIndex] = 1;\n }\n }\n\n // Iterate over tiles\n\n const tileCenter = math.vec3();\n const rtcAABB = math.AABB3();\n\n for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {\n\n const lastTileIndex = (numTiles - 1);\n\n const atLastTile = (tileIndex === lastTileIndex);\n\n const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];\n const lastTileEntityIndex = atLastTile ? numEntities : eachTileEntitiesPortion[tileIndex + 1];\n\n const tileAABBIndex = tileIndex * 6;\n const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);\n\n math.getAABB3Center(tileAABB, tileCenter);\n\n rtcAABB[0] = tileAABB[0] - tileCenter[0];\n rtcAABB[1] = tileAABB[1] - tileCenter[1];\n rtcAABB[2] = tileAABB[2] - tileCenter[2];\n rtcAABB[3] = tileAABB[3] - tileCenter[0];\n rtcAABB[4] = tileAABB[4] - tileCenter[1];\n rtcAABB[5] = tileAABB[5] - tileCenter[2];\n\n const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);\n\n const geometryCreated = {};\n\n // Iterate over each tile's entities\n\n for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex < lastTileEntityIndex; tileEntityIndex++) {\n\n const xktEntityId = eachEntityId[tileEntityIndex];\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n\n const entityMatrixIndex = eachEntityMatricesPortion[tileEntityIndex];\n const entityMatrix = matrices.slice(entityMatrixIndex, entityMatrixIndex + 16);\n\n const lastTileEntityIndex = (numEntities - 1);\n const atLastTileEntity = (tileEntityIndex === lastTileEntityIndex);\n const firstPrimitiveInstanceIndex = eachEntityPrimitiveInstancesPortion [tileEntityIndex];\n const lastPrimitiveInstanceIndex = atLastTileEntity ? primitiveInstances.length : eachEntityPrimitiveInstancesPortion[tileEntityIndex + 1];\n\n const meshIds = [];\n\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n // Mask loading of object types\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n // Get initial property values for object types\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n }\n\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n // Iterate each entity's primitive instances\n\n for (let primitiveInstancesIndex = firstPrimitiveInstanceIndex; primitiveInstancesIndex < lastPrimitiveInstanceIndex; primitiveInstancesIndex++) {\n\n const primitiveIndex = primitiveInstances[primitiveInstancesIndex];\n const primitiveReuseCount = primitiveReuseCounts[primitiveIndex];\n const isReusedPrimitive = (primitiveReuseCount > 1);\n\n const atLastPrimitive = (primitiveIndex === (numPrimitives - 1));\n\n const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);\n const primitiveNormals = normals.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? normals.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);\n const primitiveIndices = indices.subarray(eachPrimitiveIndicesPortion [primitiveIndex], atLastPrimitive ? indices.length : eachPrimitiveIndicesPortion [primitiveIndex + 1]);\n const primitiveEdgeIndices = edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion [primitiveIndex], atLastPrimitive ? edgeIndices.length : eachPrimitiveEdgeIndicesPortion [primitiveIndex + 1]);\n\n const color = decompressColor(eachPrimitiveColorAndOpacity.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));\n const opacity = eachPrimitiveColorAndOpacity[(primitiveIndex * 4) + 3] / 255.0;\n\n const meshId = manifestCtx.getNextId();\n\n if (isReusedPrimitive) {\n\n // Create mesh for multi-use primitive - create (or reuse) geometry, create mesh using that geometry\n\n const geometryId = `${modelPartId}-geometry.${tileIndex}.${primitiveIndex}`; // These IDs are local to the SceneModel\n\n if (!geometryCreated[geometryId]) {\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n // normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices,\n positionsDecodeMatrix: reusedPrimitivesDecodeMatrix\n });\n\n geometryCreated[geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n origin: tileCenter,\n matrix: entityMatrix,\n color: color,\n opacity: opacity\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: \"triangles\",\n positionsCompressed: primitivePositions,\n normalsCompressed: primitiveNormals,\n indices: primitiveIndices,\n edgeIndices: primitiveEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: color,\n opacity: opacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n if (meshIds.length > 0) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true,\n meshIds: meshIds\n }));\n }\n }\n }\n}\n\n/** @private */\nconst ParserV6 = {\n version: 6,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV6};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1800, + "__docId__": 1808, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34696,7 +34912,7 @@ "ignore": true }, { - "__docId__": 1801, + "__docId__": 1809, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34727,7 +34943,7 @@ "ignore": true }, { - "__docId__": 1802, + "__docId__": 1810, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34758,7 +34974,7 @@ "ignore": true }, { - "__docId__": 1803, + "__docId__": 1811, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34779,7 +34995,7 @@ "ignore": true }, { - "__docId__": 1804, + "__docId__": 1812, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34836,7 +35052,7 @@ "ignore": true }, { - "__docId__": 1805, + "__docId__": 1813, "kind": "variable", "name": "ParserV6", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV6.js", @@ -34856,18 +35072,18 @@ } }, { - "__docId__": 1806, + "__docId__": 1814, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", "content": "/*\n\n Parser for .XKT Format V7\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\nimport {geometryCompressionUtils} from \"../../../viewer/scene/math/geometryCompressionUtils.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nfunction extract(elements) {\n\n return {\n\n // Vertex attributes\n\n positions: elements[0],\n normals: elements[1],\n colors: elements[2],\n\n // Indices\n\n indices: elements[3],\n edgeIndices: elements[4],\n\n // Transform matrices\n\n matrices: elements[5],\n\n reusedGeometriesDecodeMatrix: elements[6],\n\n // Geometries\n\n eachGeometryPrimitiveType: elements[7],\n eachGeometryPositionsPortion: elements[8],\n eachGeometryNormalsPortion: elements[9],\n eachGeometryColorsPortion: elements[10],\n eachGeometryIndicesPortion: elements[11],\n eachGeometryEdgeIndicesPortion: elements[12],\n\n // Meshes are grouped in runs that are shared by the same entities\n\n eachMeshGeometriesPortion: elements[13],\n eachMeshMatricesPortion: elements[14],\n eachMeshMaterial: elements[15],\n\n // Entity elements in the following arrays are grouped in runs that are shared by the same tiles\n\n eachEntityId: elements[16],\n eachEntityMeshesPortion: elements[17],\n\n eachTileAABB: elements[18],\n eachTileEntitiesPortion: elements[19]\n };\n}\n\nfunction inflate(deflatedData) {\n\n function inflate(array, options) {\n return (array.length === 0) ? [] : pako.inflate(array, options).buffer;\n }\n\n return {\n positions: new Uint16Array(inflate(deflatedData.positions)),\n normals: new Int8Array(inflate(deflatedData.normals)),\n colors: new Uint8Array(inflate(deflatedData.colors)),\n\n indices: new Uint32Array(inflate(deflatedData.indices)),\n edgeIndices: new Uint32Array(inflate(deflatedData.edgeIndices)),\n\n matrices: new Float32Array(inflate(deflatedData.matrices)),\n\n reusedGeometriesDecodeMatrix: new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),\n\n eachGeometryPrimitiveType: new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),\n eachGeometryPositionsPortion: new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),\n eachGeometryNormalsPortion: new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),\n eachGeometryColorsPortion: new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),\n eachGeometryIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),\n eachGeometryEdgeIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),\n\n eachMeshGeometriesPortion: new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),\n eachMeshMatricesPortion: new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),\n eachMeshMaterial: new Uint8Array(inflate(deflatedData.eachMeshMaterial)),\n\n eachEntityId: pako.inflate(deflatedData.eachEntityId, {to: 'string'}),\n eachEntityMeshesPortion: new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),\n\n eachTileAABB: new Float64Array(inflate(deflatedData.eachTileAABB)),\n eachTileEntitiesPortion: new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion)),\n };\n}\n\nconst decompressColor = (function () {\n const floatColor = new Float32Array(3);\n return function (intColor) {\n floatColor[0] = intColor[0] / 255.0;\n floatColor[1] = intColor[1] / 255.0;\n floatColor[2] = intColor[2] / 255.0;\n return floatColor;\n };\n})();\n\nfunction convertColorsRGBToRGBA(colorsRGB) {\n const colorsRGBA = [];\n for (let i = 0, len = colorsRGB.length; i < len; i+=3) {\n colorsRGBA.push(colorsRGB[i]);\n colorsRGBA.push(colorsRGB[i+1]);\n colorsRGBA.push(colorsRGB[i+2]);\n colorsRGBA.push(1.0);\n }\n return colorsRGBA;\n}\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const colors = inflatedData.colors;\n\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n\n const matrices = inflatedData.matrices;\n\n const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;\n\n const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;\n const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;\n const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;\n const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;\n const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;\n const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;\n\n const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;\n const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;\n const eachMeshMaterial = inflatedData.eachMeshMaterial;\n\n const eachEntityId = JSON.parse(inflatedData.eachEntityId);\n const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;\n\n const eachTileAABB = inflatedData.eachTileAABB;\n const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;\n\n const numGeometries = eachGeometryPositionsPortion.length;\n const numMeshes = eachMeshGeometriesPortion.length;\n const numEntities = eachEntityId.length;\n const numTiles = eachTileEntitiesPortion.length;\n\n let nextMeshId = 0;\n\n // Count instances of each geometry\n\n const geometryReuseCounts = new Uint32Array(numGeometries);\n\n for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n if (geometryReuseCounts[geometryIndex] !== undefined) {\n geometryReuseCounts[geometryIndex]++;\n } else {\n geometryReuseCounts[geometryIndex] = 1;\n }\n }\n\n // Iterate over tiles\n\n const tileCenter = math.vec3();\n const rtcAABB = math.AABB3();\n\n for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {\n\n const lastTileIndex = (numTiles - 1);\n\n const atLastTile = (tileIndex === lastTileIndex);\n\n const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];\n const lastTileEntityIndex = atLastTile ? numEntities : eachTileEntitiesPortion[tileIndex + 1];\n\n const tileAABBIndex = tileIndex * 6;\n const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);\n\n math.getAABB3Center(tileAABB, tileCenter);\n\n rtcAABB[0] = tileAABB[0] - tileCenter[0];\n rtcAABB[1] = tileAABB[1] - tileCenter[1];\n rtcAABB[2] = tileAABB[2] - tileCenter[2];\n rtcAABB[3] = tileAABB[3] - tileCenter[0];\n rtcAABB[4] = tileAABB[4] - tileCenter[1];\n rtcAABB[5] = tileAABB[5] - tileCenter[2];\n\n const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);\n\n const geometryCreated = {};\n\n // Iterate over each tile's entities\n\n for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex < lastTileEntityIndex; tileEntityIndex++) {\n\n const xktEntityId = eachEntityId[tileEntityIndex];\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n\n const lastTileEntityIndex = (numEntities - 1);\n const atLastTileEntity = (tileEntityIndex === lastTileEntityIndex);\n const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];\n const lastMeshIndex = atLastTileEntity ? eachMeshGeometriesPortion.length : eachEntityMeshesPortion[tileEntityIndex + 1];\n\n const meshIds = [];\n\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n // Mask loading of object types\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n // Get initial property values for object types\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n if (props.metallic !== undefined && props.metallic !== null) {\n meshDefaults.metallic = props.metallic;\n }\n if (props.roughness !== undefined && props.roughness !== null) {\n meshDefaults.roughness = props.roughness;\n }\n }\n\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n // Iterate each entity's meshes\n\n for (let meshIndex = firstMeshIndex; meshIndex < lastMeshIndex; meshIndex++) {\n\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n const geometryReuseCount = geometryReuseCounts[geometryIndex];\n const isReusedGeometry = (geometryReuseCount > 1);\n\n const atLastGeometry = (geometryIndex === (numGeometries - 1));\n\n const meshColor = decompressColor(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));\n const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;\n const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;\n const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;\n\n const meshId = manifestCtx.getNextId();\n\n if (isReusedGeometry) {\n\n // Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry\n\n const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];\n const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);\n\n const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel\n\n if (!geometryCreated[geometryId]) {\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let primitiveName;\n let geometryPositions;\n let geometryNormals;\n let geometryColors;\n let geometryIndices;\n let geometryEdgeIndices;\n\n switch (primitiveType) {\n case 0:\n primitiveName = \"solid\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n break;\n case 1:\n primitiveName = \"surface\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n break;\n case 2:\n primitiveName = \"points\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryColors = convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]));\n break;\n case 3:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n break;\n default:\n continue;\n }\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: primitiveName,\n positionsCompressed: geometryPositions,\n normalsCompressed: geometryNormals,\n colors: geometryColors,\n indices: geometryIndices,\n edgeIndices: geometryEdgeIndices,\n positionsDecodeMatrix: reusedGeometriesDecodeMatrix\n });\n\n geometryCreated[geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n origin: tileCenter,\n matrix: meshMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let primitiveName;\n let geometryPositions;\n let geometryNormals;\n let geometryColors;\n let geometryIndices;\n let geometryEdgeIndices;\n\n switch (primitiveType) {\n case 0:\n primitiveName = \"solid\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n break;\n case 1:\n primitiveName = \"surface\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n break;\n case 2:\n primitiveName = \"points\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryColors = convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]));\n break;\n case 3:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n break;\n default:\n continue;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: primitiveName,\n positionsCompressed: geometryPositions,\n normalsCompressed: geometryNormals,\n colors: geometryColors,\n indices: geometryIndices,\n edgeIndices: geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n if (meshIds.length > 0) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true,\n meshIds: meshIds\n }));\n }\n }\n }\n}\n\n/** @private */\nconst ParserV7 = {\n version: 7,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV7};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1807, + "__docId__": 1815, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -34888,7 +35104,7 @@ "ignore": true }, { - "__docId__": 1808, + "__docId__": 1816, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -34919,7 +35135,7 @@ "ignore": true }, { - "__docId__": 1809, + "__docId__": 1817, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -34950,7 +35166,7 @@ "ignore": true }, { - "__docId__": 1810, + "__docId__": 1818, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -34971,7 +35187,7 @@ "ignore": true }, { - "__docId__": 1811, + "__docId__": 1819, "kind": "function", "name": "convertColorsRGBToRGBA", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -35002,7 +35218,7 @@ "ignore": true }, { - "__docId__": 1812, + "__docId__": 1820, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -35059,7 +35275,7 @@ "ignore": true }, { - "__docId__": 1813, + "__docId__": 1821, "kind": "variable", "name": "ParserV7", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV7.js", @@ -35079,18 +35295,18 @@ } }, { - "__docId__": 1814, + "__docId__": 1822, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", "content": "/*\n\n Parser for .XKT Format V8\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\nimport {geometryCompressionUtils} from \"../../../viewer/scene/math/geometryCompressionUtils.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\n\nfunction extract(elements) {\n\n return {\n\n // Vertex attributes\n\n types: elements[0],\n eachMetaObjectId: elements[1],\n eachMetaObjectType: elements[2],\n eachMetaObjectName: elements[3],\n eachMetaObjectParent: elements[4],\n\n positions: elements[5],\n normals: elements[6],\n colors: elements[7],\n indices: elements[8],\n edgeIndices: elements[9],\n\n // Transform matrices\n\n matrices: elements[10],\n reusedGeometriesDecodeMatrix: elements[11],\n\n // Geometries\n\n eachGeometryPrimitiveType: elements[12],\n eachGeometryPositionsPortion: elements[13],\n eachGeometryNormalsPortion: elements[14],\n eachGeometryColorsPortion: elements[15],\n eachGeometryIndicesPortion: elements[16],\n eachGeometryEdgeIndicesPortion: elements[17],\n\n // Meshes are grouped in runs that are shared by the same entities\n\n eachMeshGeometriesPortion: elements[18],\n eachMeshMatricesPortion: elements[19],\n eachMeshMaterial: elements[20],\n\n // Entity elements in the following arrays are grouped in runs that are shared by the same tiles\n\n eachEntityMetaObject: elements[21],\n eachEntityMeshesPortion: elements[22],\n\n eachTileAABB: elements[23],\n eachTileEntitiesPortion: elements[24]\n };\n}\n\nfunction inflate(deflatedData) {\n\n function inflate(array, options) {\n return (array.length === 0) ? [] : pako.inflate(array, options).buffer;\n }\n\n return {\n\n types: pako.inflate(deflatedData.types, {to: 'string'}),\n eachMetaObjectId: pako.inflate(deflatedData.eachMetaObjectId, {to: 'string'}),\n eachMetaObjectType: new Uint32Array(inflate(deflatedData.eachMetaObjectType)),\n eachMetaObjectName: pako.inflate(deflatedData.eachMetaObjectName, {to: 'string'}),\n eachMetaObjectParent: new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),\n\n positions: new Uint16Array(inflate(deflatedData.positions)),\n normals: new Int8Array(inflate(deflatedData.normals)),\n colors: new Uint8Array(inflate(deflatedData.colors)),\n indices: new Uint32Array(inflate(deflatedData.indices)),\n edgeIndices: new Uint32Array(inflate(deflatedData.edgeIndices)),\n\n matrices: new Float32Array(inflate(deflatedData.matrices)),\n reusedGeometriesDecodeMatrix: new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),\n\n eachGeometryPrimitiveType: new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),\n eachGeometryPositionsPortion: new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),\n eachGeometryNormalsPortion: new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),\n eachGeometryColorsPortion: new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),\n eachGeometryIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),\n eachGeometryEdgeIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),\n\n eachMeshGeometriesPortion: new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),\n eachMeshMatricesPortion: new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),\n eachMeshMaterial: new Uint8Array(inflate(deflatedData.eachMeshMaterial)),\n\n eachEntityMetaObject: new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),\n eachEntityMeshesPortion: new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),\n\n eachTileAABB: new Float64Array(inflate(deflatedData.eachTileAABB)),\n eachTileEntitiesPortion: new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion)),\n };\n}\n\nconst decompressColor = (function () {\n const floatColor = new Float32Array(3);\n return function (intColor) {\n floatColor[0] = intColor[0] / 255.0;\n floatColor[1] = intColor[1] / 255.0;\n floatColor[2] = intColor[2] / 255.0;\n return floatColor;\n };\n})();\n\nfunction convertColorsRGBToRGBA(colorsRGB) {\n const colorsRGBA = [];\n for (let i = 0, len = colorsRGB.length; i < len; i += 3) {\n colorsRGBA.push(colorsRGB[i]);\n colorsRGBA.push(colorsRGB[i + 1]);\n colorsRGBA.push(colorsRGB[i + 2]);\n colorsRGBA.push(1.0);\n }\n return colorsRGBA;\n}\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n const types = JSON.parse(inflatedData.types);\n const eachMetaObjectId = JSON.parse(inflatedData.eachMetaObjectId);\n const eachMetaObjectType = inflatedData.eachMetaObjectType;\n const eachMetaObjectName = JSON.parse(inflatedData.eachMetaObjectName);\n const eachMetaObjectParent = inflatedData.eachMetaObjectParent;\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const colors = inflatedData.colors;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n\n const matrices = inflatedData.matrices;\n const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;\n\n const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;\n const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;\n const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;\n const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;\n const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;\n const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;\n\n const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;\n const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;\n const eachMeshMaterial = inflatedData.eachMeshMaterial;\n\n const eachEntityMetaObject = inflatedData.eachEntityMetaObject;\n const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;\n\n const eachTileAABB = inflatedData.eachTileAABB;\n const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;\n\n const numMetaObjects = eachMetaObjectId.length;\n const numGeometries = eachGeometryPositionsPortion.length;\n const numMeshes = eachMeshGeometriesPortion.length;\n const numEntities = eachEntityMetaObject.length;\n const numTiles = eachTileEntitiesPortion.length;\n\n if (metaModel) {\n const metaModelData = {\n metaObjects: []\n };\n for (let metaObjectIndex = 0; metaObjectIndex < numMetaObjects; metaObjectIndex++) {\n const metaObjectId = eachMetaObjectId[metaObjectIndex];\n const typeIndex = eachMetaObjectType[metaObjectIndex];\n const metaObjectType = types[typeIndex] || \"default\";\n const metaObjectName = eachMetaObjectName[metaObjectIndex];\n const metaObjectParentIndex = eachMetaObjectParent[metaObjectIndex];\n const metaObjectParentId = (metaObjectParentIndex !== metaObjectIndex) ? eachMetaObjectId[metaObjectParentIndex] : null;\n metaModelData.metaObjects.push({\n id: metaObjectId,\n type: metaObjectType,\n name: metaObjectName,\n parent: metaObjectParentId\n });\n }\n metaModel.loadData(metaModelData, {\n includeTypes: options.includeTypes,\n excludeTypes: options.excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n });\n }\n\n // Count instances of each geometry\n\n const geometryReuseCounts = new Uint32Array(numGeometries);\n\n for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n if (geometryReuseCounts[geometryIndex] !== undefined) {\n geometryReuseCounts[geometryIndex]++;\n } else {\n geometryReuseCounts[geometryIndex] = 1;\n }\n }\n\n // Iterate over tiles\n\n const tileCenter = math.vec3();\n const rtcAABB = math.AABB3();\n\n const geometryArraysCache = {};\n\n for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {\n\n const lastTileIndex = (numTiles - 1);\n\n const atLastTile = (tileIndex === lastTileIndex);\n\n const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];\n const lastTileEntityIndex = atLastTile ? numEntities : eachTileEntitiesPortion[tileIndex + 1];\n\n const tileAABBIndex = tileIndex * 6;\n const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);\n\n math.getAABB3Center(tileAABB, tileCenter);\n\n rtcAABB[0] = tileAABB[0] - tileCenter[0];\n rtcAABB[1] = tileAABB[1] - tileCenter[1];\n rtcAABB[2] = tileAABB[2] - tileCenter[2];\n rtcAABB[3] = tileAABB[3] - tileCenter[0];\n rtcAABB[4] = tileAABB[4] - tileCenter[1];\n rtcAABB[5] = tileAABB[5] - tileCenter[2];\n\n const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);\n\n const geometryCreatedInTile = {};\n\n // Iterate over each tile's entities\n\n for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex < lastTileEntityIndex; tileEntityIndex++) {\n\n const xktMetaObjectIndex = eachEntityMetaObject[tileEntityIndex];\n const xktMetaObjectId = eachMetaObjectId[xktMetaObjectIndex];\n const xktEntityId = xktMetaObjectId;\n\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n\n const lastTileEntityIndex = (numEntities - 1);\n const atLastTileEntity = (tileEntityIndex === lastTileEntityIndex);\n const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];\n const lastMeshIndex = atLastTileEntity ? eachMeshGeometriesPortion.length : eachEntityMeshesPortion[tileEntityIndex + 1];\n\n const meshIds = [];\n\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n // Mask loading of object types\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n // Get initial property values for object types\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n if (props.metallic !== undefined && props.metallic !== null) {\n meshDefaults.metallic = props.metallic;\n }\n if (props.roughness !== undefined && props.roughness !== null) {\n meshDefaults.roughness = props.roughness;\n }\n }\n\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n // Iterate each entity's meshes\n\n for (let meshIndex = firstMeshIndex; meshIndex < lastMeshIndex; meshIndex++) {\n\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n const geometryReuseCount = geometryReuseCounts[geometryIndex];\n const isReusedGeometry = (geometryReuseCount > 1);\n\n const atLastGeometry = (geometryIndex === (numGeometries - 1));\n\n const meshColor = decompressColor(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));\n const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;\n const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;\n const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;\n\n const meshId = manifestCtx.getNextId();\n\n if (isReusedGeometry) {\n\n // Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry\n\n const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];\n const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);\n\n const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel\n\n let geometryArrays = geometryArraysCache[geometryId];\n\n if (!geometryArrays) {\n\n geometryArrays = {\n batchThisMesh: (!options.reuseGeometries)\n };\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let geometryValid = false;\n\n switch (primitiveType) {\n case 0:\n geometryArrays.primitiveName = \"solid\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 1:\n geometryArrays.primitiveName = \"surface\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 2:\n geometryArrays.primitiveName = \"points\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryColors = convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]));\n geometryValid = (geometryArrays.geometryPositions.length > 0);\n break;\n case 3:\n geometryArrays.primitiveName = \"lines\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (!geometryValid) {\n geometryArrays = null;\n }\n\n if (geometryArrays) {\n if (geometryReuseCount > 1000) { // TODO: Heuristic to force batching of instanced geometry beyond a certain reuse count (or budget)?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.geometryPositions.length > 1000) { // TODO: Heuristic to force batching on instanced geometry above certain vertex size?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.batchThisMesh) {\n geometryArrays.decompressedPositions = new Float32Array(geometryArrays.geometryPositions.length);\n const geometryPositions = geometryArrays.geometryPositions;\n const decompressedPositions = geometryArrays.decompressedPositions;\n for (let i = 0, len = geometryPositions.length; i < len; i += 3) {\n decompressedPositions[i + 0] = geometryPositions[i + 0] * reusedGeometriesDecodeMatrix[0] + reusedGeometriesDecodeMatrix[12];\n decompressedPositions[i + 1] = geometryPositions[i + 1] * reusedGeometriesDecodeMatrix[5] + reusedGeometriesDecodeMatrix[13];\n decompressedPositions[i + 2] = geometryPositions[i + 2] * reusedGeometriesDecodeMatrix[10] + reusedGeometriesDecodeMatrix[14];\n }\n geometryArrays.geometryPositions = null;\n geometryArraysCache[geometryId] = geometryArrays;\n }\n }\n }\n\n if (geometryArrays) {\n\n if (geometryArrays.batchThisMesh) {\n\n const decompressedPositions = geometryArrays.decompressedPositions;\n const positions = new Uint16Array(decompressedPositions.length);\n for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {\n tempVec4a[0] = decompressedPositions[i + 0];\n tempVec4a[1] = decompressedPositions[i + 1];\n tempVec4a[2] = decompressedPositions[i + 2];\n tempVec4a[3] = 1;\n math.transformVec4(meshMatrix, tempVec4a, tempVec4b);\n geometryCompressionUtils.compressPosition(tempVec4b, rtcAABB, tempVec4a)\n positions[i + 0] = tempVec4a[0];\n positions[i + 1] = tempVec4a[1];\n positions[i + 2] = tempVec4a[2];\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: positions,\n normalsCompressed: geometryArrays.geometryNormals,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n if (!geometryCreatedInTile[geometryId]) {\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: geometryArrays.geometryPositions,\n normalsCompressed: geometryArrays.geometryNormals,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: reusedGeometriesDecodeMatrix\n });\n\n geometryCreatedInTile[geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n origin: tileCenter,\n matrix: meshMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n } else {\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let primitiveName;\n let geometryPositions;\n let geometryNormals;\n let geometryColors;\n let geometryIndices;\n let geometryEdgeIndices;\n let geometryValid = false;\n\n switch (primitiveType) {\n case 0:\n primitiveName = \"solid\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 1:\n primitiveName = \"surface\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 2:\n primitiveName = \"points\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryColors = convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]));\n geometryValid = (geometryPositions.length > 0);\n break;\n case 3:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (geometryValid) {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: primitiveName,\n positionsCompressed: geometryPositions,\n normalsCompressed: geometryNormals,\n colorsCompressed: geometryColors,\n indices: geometryIndices,\n edgeIndices: geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n }\n\n if (meshIds.length > 0) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true,\n meshIds: meshIds\n }));\n }\n }\n }\n}\n\n/** @private */\nconst ParserV8 = {\n version: 8,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV8};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1815, + "__docId__": 1823, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35111,7 +35327,7 @@ "ignore": true }, { - "__docId__": 1816, + "__docId__": 1824, "kind": "variable", "name": "tempVec4a", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35132,7 +35348,7 @@ "ignore": true }, { - "__docId__": 1817, + "__docId__": 1825, "kind": "variable", "name": "tempVec4b", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35153,7 +35369,7 @@ "ignore": true }, { - "__docId__": 1818, + "__docId__": 1826, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35184,7 +35400,7 @@ "ignore": true }, { - "__docId__": 1819, + "__docId__": 1827, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35215,7 +35431,7 @@ "ignore": true }, { - "__docId__": 1820, + "__docId__": 1828, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35236,7 +35452,7 @@ "ignore": true }, { - "__docId__": 1821, + "__docId__": 1829, "kind": "function", "name": "convertColorsRGBToRGBA", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35267,7 +35483,7 @@ "ignore": true }, { - "__docId__": 1822, + "__docId__": 1830, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35324,7 +35540,7 @@ "ignore": true }, { - "__docId__": 1823, + "__docId__": 1831, "kind": "variable", "name": "ParserV8", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV8.js", @@ -35344,18 +35560,18 @@ } }, { - "__docId__": 1824, + "__docId__": 1832, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", "content": "/*\n\n Parser for .XKT Format V9\n\n */\n\nimport {utils} from \"../../../viewer/scene/utils.js\";\nimport * as p from \"./lib/pako.js\";\nimport {math} from \"../../../viewer/scene/math/math.js\";\nimport {geometryCompressionUtils} from \"../../../viewer/scene/math/geometryCompressionUtils.js\";\n\nlet pako = window.pako || p;\nif (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97\n pako = pako.default;\n}\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\n\nfunction extract(elements) {\n\n return {\n\n // Metadata\n\n metadata: elements[0],\n\n positions: elements[1],\n normals: elements[2],\n colors: elements[3],\n indices: elements[4],\n edgeIndices: elements[5],\n\n // Transform matrices\n\n matrices: elements[6],\n reusedGeometriesDecodeMatrix: elements[7],\n\n // Geometries\n\n eachGeometryPrimitiveType: elements[8],\n eachGeometryPositionsPortion: elements[9],\n eachGeometryNormalsPortion: elements[10],\n eachGeometryColorsPortion: elements[11],\n eachGeometryIndicesPortion: elements[12],\n eachGeometryEdgeIndicesPortion: elements[13],\n\n // Meshes are grouped in runs that are shared by the same entities\n\n eachMeshGeometriesPortion: elements[14],\n eachMeshMatricesPortion: elements[15],\n eachMeshMaterial: elements[16],\n\n // Entity elements in the following arrays are grouped in runs that are shared by the same tiles\n\n eachEntityId: elements[17],\n eachEntityMeshesPortion: elements[18],\n\n eachTileAABB: elements[19],\n eachTileEntitiesPortion: elements[20]\n };\n}\n\nfunction inflate(deflatedData) {\n\n function inflate(array, options) {\n return (array.length === 0) ? [] : pako.inflate(array, options).buffer;\n }\n\n return {\n\n metadata: JSON.parse(pako.inflate(deflatedData.metadata, {to: 'string'})),\n\n positions: new Uint16Array(inflate(deflatedData.positions)),\n normals: new Int8Array(inflate(deflatedData.normals)),\n colors: new Uint8Array(inflate(deflatedData.colors)),\n indices: new Uint32Array(inflate(deflatedData.indices)),\n edgeIndices: new Uint32Array(inflate(deflatedData.edgeIndices)),\n\n matrices: new Float32Array(inflate(deflatedData.matrices)),\n reusedGeometriesDecodeMatrix: new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),\n\n eachGeometryPrimitiveType: new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),\n eachGeometryPositionsPortion: new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),\n eachGeometryNormalsPortion: new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),\n eachGeometryColorsPortion: new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),\n eachGeometryIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),\n eachGeometryEdgeIndicesPortion: new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),\n\n eachMeshGeometriesPortion: new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),\n eachMeshMatricesPortion: new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),\n eachMeshMaterial: new Uint8Array(inflate(deflatedData.eachMeshMaterial)),\n\n eachEntityId: JSON.parse(pako.inflate(deflatedData.eachEntityId, {to: 'string'})),\n eachEntityMeshesPortion: new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),\n\n eachTileAABB: new Float64Array(inflate(deflatedData.eachTileAABB)),\n eachTileEntitiesPortion: new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion)),\n };\n}\n\nconst decompressColor = (function () {\n const floatColor = new Float32Array(3);\n return function (intColor) {\n floatColor[0] = intColor[0] / 255.0;\n floatColor[1] = intColor[1] / 255.0;\n floatColor[2] = intColor[2] / 255.0;\n return floatColor;\n };\n})();\n\nfunction load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {\n\n const modelPartId = manifestCtx.getNextId();\n\n const metadata = inflatedData.metadata;\n\n const positions = inflatedData.positions;\n const normals = inflatedData.normals;\n const colors = inflatedData.colors;\n const indices = inflatedData.indices;\n const edgeIndices = inflatedData.edgeIndices;\n\n const matrices = inflatedData.matrices;\n const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;\n\n const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;\n const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;\n const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;\n const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;\n const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;\n const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;\n\n const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;\n const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;\n const eachMeshMaterial = inflatedData.eachMeshMaterial;\n\n const eachEntityId = inflatedData.eachEntityId;\n const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;\n\n const eachTileAABB = inflatedData.eachTileAABB;\n const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;\n\n const numGeometries = eachGeometryPositionsPortion.length;\n const numMeshes = eachMeshGeometriesPortion.length;\n const numEntities = eachEntityMeshesPortion.length;\n const numTiles = eachTileEntitiesPortion.length;\n\n if (metaModel) {\n metaModel.loadData(metadata, {\n includeTypes: options.includeTypes,\n excludeTypes: options.excludeTypes,\n globalizeObjectIds: options.globalizeObjectIds\n }); // Can be empty\n }\n\n // Count instances of each geometry\n\n const geometryReuseCounts = new Uint32Array(numGeometries);\n\n for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n if (geometryReuseCounts[geometryIndex] !== undefined) {\n geometryReuseCounts[geometryIndex]++;\n } else {\n geometryReuseCounts[geometryIndex] = 1;\n }\n }\n\n // Iterate over tiles\n\n const tileCenter = math.vec3();\n const rtcAABB = math.AABB3();\n\n const geometryArraysCache = {};\n\n for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {\n\n const lastTileIndex = (numTiles - 1);\n\n const atLastTile = (tileIndex === lastTileIndex);\n\n const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];\n const lastTileEntityIndex = atLastTile ? (numEntities - 1) : (eachTileEntitiesPortion[tileIndex + 1] - 1);\n\n const tileAABBIndex = tileIndex * 6;\n const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);\n\n math.getAABB3Center(tileAABB, tileCenter);\n\n rtcAABB[0] = tileAABB[0] - tileCenter[0];\n rtcAABB[1] = tileAABB[1] - tileCenter[1];\n rtcAABB[2] = tileAABB[2] - tileCenter[2];\n rtcAABB[3] = tileAABB[3] - tileCenter[0];\n rtcAABB[4] = tileAABB[4] - tileCenter[1];\n rtcAABB[5] = tileAABB[5] - tileCenter[2];\n\n const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);\n\n const geometryCreatedInTile = {};\n\n // Iterate over each tile's entities\n\n for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex <= lastTileEntityIndex; tileEntityIndex++) {\n\n const xktEntityId = eachEntityId[tileEntityIndex];\n\n const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;\n\n const finalTileEntityIndex = (numEntities - 1);\n const atLastTileEntity = (tileEntityIndex === finalTileEntityIndex);\n const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];\n const lastMeshIndex = atLastTileEntity ? (eachMeshGeometriesPortion.length - 1) : (eachEntityMeshesPortion[tileEntityIndex + 1] - 1);\n\n const meshIds = [];\n\n const metaObject = viewer.metaScene.metaObjects[entityId];\n const entityDefaults = {};\n const meshDefaults = {};\n\n if (metaObject) {\n\n // Mask loading of object types\n\n if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {\n continue;\n }\n\n if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {\n continue;\n }\n\n // Get initial property values for object types\n\n const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults[\"DEFAULT\"] : null;\n\n if (props) {\n if (props.visible === false) {\n entityDefaults.visible = false;\n }\n if (props.pickable === false) {\n entityDefaults.pickable = false;\n }\n if (props.colorize) {\n meshDefaults.color = props.colorize;\n }\n if (props.opacity !== undefined && props.opacity !== null) {\n meshDefaults.opacity = props.opacity;\n }\n if (props.metallic !== undefined && props.metallic !== null) {\n meshDefaults.metallic = props.metallic;\n }\n if (props.roughness !== undefined && props.roughness !== null) {\n meshDefaults.roughness = props.roughness;\n }\n }\n\n } else {\n if (options.excludeUnclassifiedObjects) {\n continue;\n }\n }\n\n // Iterate each entity's meshes\n\n for (let meshIndex = firstMeshIndex; meshIndex <= lastMeshIndex; meshIndex++) {\n\n const geometryIndex = eachMeshGeometriesPortion[meshIndex];\n const geometryReuseCount = geometryReuseCounts[geometryIndex];\n const isReusedGeometry = (geometryReuseCount > 1);\n\n const atLastGeometry = (geometryIndex === (numGeometries - 1));\n\n const meshColor = decompressColor(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));\n const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;\n const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;\n const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;\n\n const meshId = manifestCtx.getNextId();\n\n if (isReusedGeometry) {\n\n // Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry\n\n const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];\n const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);\n\n const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel\n\n let geometryArrays = geometryArraysCache[geometryId];\n\n if (!geometryArrays) {\n geometryArrays = {\n batchThisMesh: (!options.reuseGeometries)\n };\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n let geometryValid = false;\n switch (primitiveType) {\n case 0:\n geometryArrays.primitiveName = \"solid\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 1:\n geometryArrays.primitiveName = \"surface\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n case 2:\n geometryArrays.primitiveName = \"points\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0);\n break;\n case 3:\n geometryArrays.primitiveName = \"lines\";\n geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (!geometryValid) {\n geometryArrays = null;\n }\n\n if (geometryArrays) {\n if (geometryReuseCount > 1000) { // TODO: Heuristic to force batching of instanced geometry beyond a certain reuse count (or budget)?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.geometryPositions.length > 1000) { // TODO: Heuristic to force batching on instanced geometry above certain vertex size?\n // geometryArrays.batchThisMesh = true;\n }\n if (geometryArrays.batchThisMesh) {\n geometryArrays.decompressedPositions = new Float32Array(geometryArrays.geometryPositions.length);\n geometryArrays.transformedAndRecompressedPositions = new Uint16Array(geometryArrays.geometryPositions.length)\n const geometryPositions = geometryArrays.geometryPositions;\n const decompressedPositions = geometryArrays.decompressedPositions;\n for (let i = 0, len = geometryPositions.length; i < len; i += 3) {\n decompressedPositions[i + 0] = geometryPositions[i + 0] * reusedGeometriesDecodeMatrix[0] + reusedGeometriesDecodeMatrix[12];\n decompressedPositions[i + 1] = geometryPositions[i + 1] * reusedGeometriesDecodeMatrix[5] + reusedGeometriesDecodeMatrix[13];\n decompressedPositions[i + 2] = geometryPositions[i + 2] * reusedGeometriesDecodeMatrix[10] + reusedGeometriesDecodeMatrix[14];\n }\n geometryArrays.geometryPositions = null;\n geometryArraysCache[geometryId] = geometryArrays;\n }\n }\n }\n\n if (geometryArrays) {\n\n if (geometryArrays.batchThisMesh) {\n\n const decompressedPositions = geometryArrays.decompressedPositions;\n const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;\n\n for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {\n tempVec4a[0] = decompressedPositions[i + 0];\n tempVec4a[1] = decompressedPositions[i + 1];\n tempVec4a[2] = decompressedPositions[i + 2];\n tempVec4a[3] = 1;\n math.transformVec4(meshMatrix, tempVec4a, tempVec4b);\n geometryCompressionUtils.compressPosition(tempVec4b, rtcAABB, tempVec4a)\n transformedAndRecompressedPositions[i + 0] = tempVec4a[0];\n transformedAndRecompressedPositions[i + 1] = tempVec4a[1];\n transformedAndRecompressedPositions[i + 2] = tempVec4a[2];\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: transformedAndRecompressedPositions,\n normalsCompressed: geometryArrays.geometryNormals,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n\n } else {\n\n if (!geometryCreatedInTile[geometryId]) {\n\n sceneModel.createGeometry({\n id: geometryId,\n primitive: geometryArrays.primitiveName,\n positionsCompressed: geometryArrays.geometryPositions,\n normalsCompressed: geometryArrays.geometryNormals,\n colorsCompressed: geometryArrays.geometryColors,\n indices: geometryArrays.geometryIndices,\n edgeIndices: geometryArrays.geometryEdgeIndices,\n positionsDecodeMatrix: reusedGeometriesDecodeMatrix\n });\n\n geometryCreatedInTile[geometryId] = true;\n }\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n geometryId: geometryId,\n origin: tileCenter,\n matrix: meshMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n\n } else {\n\n const primitiveType = eachGeometryPrimitiveType[geometryIndex];\n\n let primitiveName;\n let geometryPositions;\n let geometryNormals;\n let geometryColors;\n let geometryIndices;\n let geometryEdgeIndices;\n let geometryValid = false;\n\n switch (primitiveType) {\n case 0:\n primitiveName = \"solid\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 1:\n primitiveName = \"surface\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n case 2:\n primitiveName = \"points\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0);\n break;\n case 3:\n primitiveName = \"lines\";\n geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);\n geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);\n geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);\n break;\n default:\n continue;\n }\n\n if (geometryValid) {\n\n sceneModel.createMesh(utils.apply(meshDefaults, {\n id: meshId,\n origin: tileCenter,\n primitive: primitiveName,\n positionsCompressed: geometryPositions,\n normalsCompressed: geometryNormals,\n colorsCompressed: geometryColors,\n indices: geometryIndices,\n edgeIndices: geometryEdgeIndices,\n positionsDecodeMatrix: tileDecodeMatrix,\n color: meshColor,\n metallic: meshMetallic,\n roughness: meshRoughness,\n opacity: meshOpacity\n }));\n\n meshIds.push(meshId);\n }\n }\n }\n\n if (meshIds.length > 0) {\n\n sceneModel.createEntity(utils.apply(entityDefaults, {\n id: entityId,\n isObject: true,\n meshIds: meshIds\n }));\n }\n }\n }\n}\n\n/** @private */\nconst ParserV9 = {\n version: 9,\n parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {\n const deflatedData = extract(elements);\n const inflatedData = inflate(deflatedData);\n load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);\n }\n};\n\nexport {ParserV9};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1825, + "__docId__": 1833, "kind": "variable", "name": "pako", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35376,7 +35592,7 @@ "ignore": true }, { - "__docId__": 1826, + "__docId__": 1834, "kind": "variable", "name": "tempVec4a", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35397,7 +35613,7 @@ "ignore": true }, { - "__docId__": 1827, + "__docId__": 1835, "kind": "variable", "name": "tempVec4b", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35418,7 +35634,7 @@ "ignore": true }, { - "__docId__": 1828, + "__docId__": 1836, "kind": "function", "name": "extract", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35449,7 +35665,7 @@ "ignore": true }, { - "__docId__": 1829, + "__docId__": 1837, "kind": "function", "name": "inflate", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35480,7 +35696,7 @@ "ignore": true }, { - "__docId__": 1830, + "__docId__": 1838, "kind": "variable", "name": "decompressColor", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35501,7 +35717,7 @@ "ignore": true }, { - "__docId__": 1831, + "__docId__": 1839, "kind": "function", "name": "load", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35558,7 +35774,7 @@ "ignore": true }, { - "__docId__": 1832, + "__docId__": 1840, "kind": "variable", "name": "ParserV9", "memberof": "src/plugins/XKTLoaderPlugin/parsers/ParserV9.js", @@ -35578,29 +35794,29 @@ } }, { - "__docId__": 1833, + "__docId__": 1841, "kind": "file", "name": "src/plugins/XKTLoaderPlugin/parsers/lib/pako.js", "content": "/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],e):e((t=\"undefined\"!=typeof globalThis?globalThis:t||self).pako={})}(this,(function(t){\"use strict\";function e(t){let e=t.length;for(;--e>=0;)t[e]=0}const a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);const _=new Array(60);e(_);const f=new Array(512);e(f);const c=new Array(256);e(c);const u=new Array(29);e(u);const w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}let b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(w);const v=t=>t<256?f[t]:f[256+(t>>>7)],y=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},x=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<{x(t,a[2*e],a[2*e+1])},A=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},E=(t,e,a)=>{const i=new Array(16);let n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=A(i[e]++,e))}},R=t=>{let e;for(e=0;e{t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},U=(t,e,a,i)=>{const n=2*e,s=2*a;return t[n]{const i=t.heap[a];let n=a<<1;for(;n<=t.heap_len&&(n{let n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)))}while(d{const a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;let d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--)}})(t,e),E(a,d,t.bl_count)},O=(t,e,a)=>{let i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o{let i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o{x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a};var N=(t,e,i,n)=>{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),((t,e,a,i)=>{let n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n{F||((()=>{let t,e,a,h,k;const v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<>=7;h(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{x(t,2,3),z(t,256,d),(t=>{16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var C=(t,e,a,i)=>{let n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0}while(--r);n%=65521,s%=65521}return n|s<<16|0};const M=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var H=(t,e,a,i)=>{const n=M,s=i+a;t^=-1;for(let a=i;a>>8^n[255&(t^e[a])];return-1^t},j={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:P,_tr_stored_block:Y,_tr_flush_block:G,_tr_tally:X,_tr_align:W}=B,{Z_NO_FLUSH:q,Z_PARTIAL_FLUSH:J,Z_FULL_FLUSH:Q,Z_FINISH:V,Z_BLOCK:$,Z_OK:tt,Z_STREAM_END:et,Z_STREAM_ERROR:at,Z_DATA_ERROR:it,Z_BUF_ERROR:nt,Z_DEFAULT_COMPRESSION:st,Z_FILTERED:rt,Z_HUFFMAN_ONLY:ot,Z_RLE:lt,Z_FIXED:ht,Z_DEFAULT_STRATEGY:dt,Z_UNKNOWN:_t,Z_DEFLATED:ft}=K,ct=258,ut=262,wt=42,mt=113,bt=666,gt=(t,e)=>(t.msg=j[e],e),pt=t=>2*t-(t>4?9:0),kt=t=>{let e=t.length;for(;--e>=0;)t[e]=0},vt=t=>{let e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0}while(--e)};let yt=(t,e,a)=>(e<{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},zt=(t,e)=>{G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm)},At=(t,e)=>{t.pending_buf[t.pending++]=e},Et=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Rt=(t,e,a,i)=>{let n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n)},Zt=(t,e)=>{let a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;let c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&sr){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r]}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead},Ut=t=>{const e=t.w_size;let a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_outi+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a)}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_watern&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1)},Dt=(t,e)=>{let a,i;for(;;){if(t.lookahead=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3)if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2},Tt=(t,e)=>{let a,i,n;for(;;){if(t.lookahead=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n}const It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Lt=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0},Nt=t=>{if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt},Bt=t=>{const e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e},Ct=(t,e,a,i,n,s)=>{if(!t)return at;let r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);const o=new Ft;return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<Ct(t,e,ft,15,8,dt),deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:(t,e)=>Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt),deflate:(t,e)=>{if(Lt(t)||e>$||e<0)return t?gt(t,at):at;const a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);const i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){let e=ft+(a.w_bits-8<<4)<<8,i=-1;if(i=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,e|=i<<6,0!==a.strstart&&(e|=32),e+=31-e%31,Et(a,e),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){let e=a.pending,i=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+i>a.pending_buf_size;){let n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>e&&(t.adler=H(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex+=n,xt(t),0!==a.pending)return a.last_flush=-1,tt;e=0,i-=n}let n=new Uint8Array(a.gzhead.extra);a.pending_buf.set(n.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending+=i,a.gzhead.hcrc&&a.pending>e&&(t.adler=H(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let e,i=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>i&&(t.adler=H(t.adler,a.pending_buf,a.pending-i,i)),xt(t),0!==a.pending)return a.last_flush=-1,tt;i=0}e=a.gzindexi&&(t.adler=H(t.adler,a.pending_buf,a.pending-i,i)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let e,i=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>i&&(t.adler=H(t.adler,a.pending_buf,a.pending-i,i)),xt(t),0!==a.pending)return a.last_flush=-1,tt;i=0}e=a.gzindexi&&(t.adler=H(t.adler,a.pending_buf,a.pending-i,i))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){let i=0===a.level?St(a,e):a.strategy===ot?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2})(a,e):a.strategy===lt?((t,e)=>{let a,i,n,s;const r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2})(a,e):It[a.level].func(a,e);if(3!==i&&4!==i||(a.status=bt),1===i||3===i)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===i&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et)},deflateEnd:t=>{if(Lt(t))return at;const e=t.state.status;return t.state=null,e===mt?gt(t,it):tt},deflateSetDictionary:(t,e)=>{let a=e.length;if(Lt(t))return at;const i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(a-i.w_size,a),0),e=t,a=i.w_size}const s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Ut(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt},deflateInfo:\"pako deflate (from Nodeca project)\"};const Ht=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var jt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if(\"object\"!=typeof a)throw new TypeError(a+\"must be non-object\");for(const e in a)Ht(a,e)&&(t[e]=a[e])}}return t},Kt=t=>{let e=0;for(let a=0,i=t.length;a=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Yt[254]=Yt[254]=1;var Gt=t=>{if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,i,n,s,r=t.length,o=0;for(n=0;n>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e},Xt=(t,e)=>{const a=e||t.length;if(\"function\"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,n;const s=new Array(2*a);for(n=0,i=0;i4)s[n++]=65533,i+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&i1?s[n++]=65533:e<65536?s[n++]=e:(e-=65536,s[n++]=55296|e>>10&1023,s[n++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a=\"\";for(let i=0;i{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e};var qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0};const Jt=Object.prototype.toString,{Z_NO_FLUSH:Qt,Z_SYNC_FLUSH:Vt,Z_FULL_FLUSH:$t,Z_FINISH:te,Z_OK:ee,Z_STREAM_END:ae,Z_DEFAULT_COMPRESSION:ie,Z_DEFAULT_STRATEGY:ne,Z_DEFLATED:se}=K;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new qt,this.strm.avail_out=0;let a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t=\"string\"==typeof e.dictionary?Gt(e.dictionary):\"[object ArrayBuffer]\"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,t),a!==ee)throw new Error(j[a]);this._dict_set=!0}}function oe(t,e){const a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result}re.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,\"string\"==typeof t?a.input=Gt(t):\"[object ArrayBuffer]\"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},re.prototype.onData=function(t){this.chunks.push(t)},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var le={Deflate:re,deflate:oe,deflateRaw:function(t,e){return(e=e||{}).raw=!0,oe(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,oe(t,e)},constants:K};const he=16209;var de=function(t,e){let a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;const E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<>>=p,c-=p),c<15&&(f+=z[a++]<>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<o){t.msg=\"invalid distance too far back\",E.mode=he;break t}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg=\"invalid distance too far back\",E.mode=he;break t}if(y=0,x=_,0===d){if(y+=l-p,p2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]))}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]))}break}}break}}while(a>3,a-=k,c-=k<<3,f&=(1<{const l=o.bits;let h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;const E=new Uint16Array(16),R=new Uint16Array(16);let Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<>v)+d]=Z<<24|U<<16|S|0}while(0!==d);for(h=1<>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]]}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0};const{Z_FINISH:be,Z_BLOCK:ge,Z_TREES:pe,Z_OK:ke,Z_STREAM_END:ve,Z_NEED_DICT:ye,Z_STREAM_ERROR:xe,Z_DATA_ERROR:ze,Z_MEM_ERROR:Ae,Z_BUF_ERROR:Ee,Z_DEFLATED:Re}=K,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ce=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},Me=t=>{if(Ce(t))return xe;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg=\"\",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke},He=t=>{if(Ce(t))return xe;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t)},je=(t,e)=>{let a;if(Ce(t))return xe;const i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t))},Ke=(t,e)=>{if(!t)return xe;const a=new Be;t.state=a,a.strm=t,a.window=null,a.mode=Ze;const i=je(t,e);return i!==ke&&(t.state=null),i};let Pe,Ye,Ge=!0;const Xe=t=>{if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5},We=(t,e,a,i)=>{let n;const s=t.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveKe(t,15),inflateInit2:Ke,inflate:(t,e)=>{let a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;const A=new Uint8Array(4);let E,R;const Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg=\"incorrect header check\",a.mode=Le;break}if((15&h)!==Re){t.msg=\"unknown compression method\",a.mode=Le;break}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg=\"invalid window size\",a.mode=Le;break}a.dmax=1<>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y))}while(y&&c>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<>>=7&d,d-=7&d,a.mode=Fe;break}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t}break;case 2:a.mode=16196;break;case 3:t.msg=\"invalid block type\",a.mode=Le}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<>>16^65535)){t.msg=\"invalid stored block lengths\",a.mode=Le;break}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg=\"too many length or distance symbols\",a.mode=Le;break}a.have=0,a.mode=16197;case 16197:for(;a.have>>=3,d-=3}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg=\"invalid code lengths set\",a.mode=Le;break}a.have=0,a.mode=16198;case 16198:for(;a.have>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d>>=m,d-=m,0===a.have){t.msg=\"invalid bit length repeat\",a.mode=Le;break}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2}else if(17===g){for(R=m+3;d>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3}else{for(R=m+7;d>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7}if(a.have+c>a.nlen+a.ndist){t.msg=\"invalid bit length repeat\",a.mode=Le;break}for(;c--;)a.lens[a.have++]=y}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg=\"invalid code -- missing end-of-block\",a.mode=Le;break}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg=\"invalid literal/lengths set\",a.mode=Le;break}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg=\"invalid distances set\",a.mode=Le;break}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break}for(a.back=0;z=a.lencode[h&(1<>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<>>=p,d-=p,a.back+=p}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break}if(32&b){a.back=-1,a.mode=Se;break}if(64&b){t.msg=\"invalid literal/length code\",a.mode=Le;break}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<>>=p,d-=p,a.back+=p}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg=\"invalid distance code\",a.mode=Le;break}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg=\"invalid distance too far back\",a.mode=Le;break}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg=\"invalid distance too far back\",a.mode=Le;break}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++]}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<{if(Ce(t))return xe;let e=t.state;return e.window&&(e.window=null),t.state=null,ke},inflateGetHeader:(t,e)=>{if(Ce(t))return xe;const a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke)},inflateSetDictionary:(t,e)=>{const a=e.length;let i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)))},inflateInfo:\"pako inflate (from Nodeca project)\"};var Je=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=\"\",this.comment=\"\",this.hcrc=0,this.done=!1};const Qe=Object.prototype.toString,{Z_NO_FLUSH:Ve,Z_FINISH:$e,Z_OK:ta,Z_STREAM_END:ea,Z_NEED_DICT:aa,Z_STREAM_ERROR:ia,Z_DATA_ERROR:na,Z_MEM_ERROR:sa}=K;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:\"\"},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new qt,this.strm.avail_out=0;let a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je,qe.inflateGetHeader(this.strm,this.header),e.dictionary&&(\"string\"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):\"[object ArrayBuffer]\"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a])}function oa(t,e){const a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result}ra.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,\"[object ArrayBuffer]\"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if(\"string\"===this.options.to){let t=Wt(a.output,a.next_out),e=a.next_out-t,n=Xt(a.output,t);a.next_out=e,a.avail_out=i-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},ra.prototype.onData=function(t){this.chunks.push(t)},ra.prototype.onEnd=function(t){t===ta&&(\"string\"===this.options.to?this.result=this.chunks.join(\"\"):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var la={Inflate:ra,inflate:oa,inflateRaw:function(t,e){return(e=e||{}).raw=!0,oa(t,e)},ungzip:oa,constants:K};const{Deflate:ha,deflate:da,deflateRaw:_a,gzip:fa}=le,{Inflate:ca,inflate:ua,inflateRaw:wa,ungzip:ma}=la;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t.default=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,\"__esModule\",{value:!0})}));", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1834, + "__docId__": 1842, "kind": "file", "name": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js", "content": "import {utils} from \"../../viewer/scene/utils.js\"\nimport {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {Plugin} from \"../../viewer/Plugin.js\";\nimport {XML3DSceneGraphLoader} from \"./XML3DSceneGraphLoader.js\";\n\n/**\n * {@link Viewer} plugin that loads models from [3DXML](https://en.wikipedia.org/wiki/3DXML) files.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_TreeView)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_TreeView)]\n *\n * ## Overview\n *\n * * Currently supports 3DXML V4.2.\n * * Creates an {@link Entity} representing each model it loads, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.\n * * Creates an {@link Entity} for each object within the model, which will have {@link Entity#isObject} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.\n * * When loading, can set the World-space position, scale and rotation of each model within World space, along with initial properties for all the model's {@link Entity}s.\n * * Can optionally load a {@link MetaModel} to classify the objects within the model, from which you can create a tree view using the {@link TreeViewPlugin}.\n *
    \n * Note that the name of this plugin is intentionally munged to \"XML3D\" because a JavaScript class name cannot begin with a numeral.\n *\n * An 3DXML model is a zip archive that bundles multiple XML files and assets. Internally, the XML3DLoaderPlugin uses the\n * [zip.js](https://gildas-lormeau.github.io/zip.js/) library to unzip them before loading. The zip.js library uses\n * [Web workers](https://www.w3.org/TR/workers/) for fast unzipping, so XML3DLoaderPlugin requires that we configure it\n * with a ````workerScriptsPath```` property specifying the directory where zip.js keeps its Web worker script. See\n * the example for how to do that.\n *\n * ## Usage\n *\n * In the example below, we'll use an XML3DLoaderPlugin to load a 3DXML model. When the model has loaded,\n * we'll use the {@link CameraFlightAnimation} to fly the {@link Camera} to look at boundary of the model. We'll\n * then get the model's {@link Entity} from the {@link Scene} and highlight the whole model.\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_Widget)]\n *\n * ````javascript\n * // Create a xeokit Viewer\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Add an XML3DLoaderPlugin to the Viewer\n * var plugin = new XML3DLoaderPlugin(viewer, {\n * id: \"XML3DLoader\", // Default value\n * workerScriptsPath : \"../../src/plugins/XML3DLoader/zipjs/\" // Path to zip.js workers dir\n * });\n *\n * // Load the 3DXML model\n * var model = plugin.load({ // Model is an Entity\n * id: \"myModel\",\n * src: \"./models/xml3d/3dpreview.3dxml\",\n * scale: [0.1, 0.1, 0.1],\n * rotate: [90, 0, 0],\n * translate: [100,0,0],\n * edges: true\n * });\n *\n * // When the model has loaded, fit it to view\n * model.on(\"loaded\", function() {\n * viewer.cameraFlight.flyTo(model);\n * });\n *\n * // Update properties of the model via the entity\n * model.highlighted = true;\n *\n * // Find the model Entity by ID\n * model = viewer.scene.models[\"myModel\"];\n *\n * // Destroy the model\n * model.destroy();\n * ````\n * ## Loading MetaModels\n *\n * We have the option to load a {@link MetaModel} that contains a hierarchy of {@link MetaObject}s that classifes the objects within\n * our 3DXML model.\n *\n * This is useful for building a tree view to navigate the objects, using {@link TreeViewPlugin}.\n *\n * Let's load the model again, this time creating a MetaModel:\n *\n * ````javascript\n * var model = plugin.load({\n * id: \"myModel\",\n * src: \"./models/xml3d/3dpreview.3dxml\",\n * scale: [0.1, 0.1, 0.1],\n * rotate: [90, 0, 0],\n * translate: [100,0,0],\n * edges: true,\n *\n * createMetaModel: true // <<-------- Create a MetaModel\n * });\n * ````\n *\n * The MetaModel can then be found on the {@link Viewer}'s {@link MetaScene}, using the model's ID:\n *\n * ````javascript\n * const metaModel = viewer.metaScene.metaModels[\"myModel\"];\n * ````\n *\n * Now we can use {@link TreeViewPlugin} to create a tree view to navigate our model's objects:\n *\n * ````javascript\n * import {TreeViewPlugin} from \"xeokit-sdk.es.js\"\"xeokit-sdk.es.js\";\n *\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"myTreeViewContainer\")\n * });\n *\n * const treeView = new TreeViewPlugin(viewer, {\n * containerElement: document.getElementById(\"treeViewContainer\"),\n * autoExpandDepth: 3, // Initially expand tree three storeys deep\n * hierarchy: \"containment\",\n * autoAddModels: false\n * });\n *\n * model.on(\"loaded\", () => {\n * treeView.addModel(model.id);\n * });\n * ````\n *\n * Note that only the TreeViewPlugin \"containment\" hierarchy makes sense for an XML3D model. A \"types\" hierarchy\n * does not make sense because XML3DLoaderPlugin will set each {@link MetaObject#type} to \"Default\", and \"storeys\"\n * does not make sense because that requires some of the MetaObject#type values to be \"IfcBuildingStorey\".\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_TreeView)]\n *\n * ## Material Type\n *\n * Although 3DXML only supports Phong materials, XML3DLoaderPlugin is able to convert them to physically-based materials.\n *\n * The plugin supports three material types:\n *\n * | Material Type | Material Components Loaded | Description | Example |\n * |:--------:|:----:|:-----:|:-----:|\n * | \"PhongMaterial\" (default) | {@link PhongMaterial} | Non-physically-correct Blinn-Phong shading model | [Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_materialType_Phong) |\n * | \"MetallicMaterial\" | {@link MetallicMaterial} | Physically-accurate specular-glossiness shading model | [Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_materialType_Metallic) |\n * | \"SpecularMaterial\" | {@link SpecularMaterial} | Physically-accurate metallic-roughness shading model | [Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_materialType_Specular) |\n *\n *
    \n * Let's load our model again, this time converting the 3DXML Blinn-Phong materials to {@link SpecularMaterial}s:\n *\n * ````javascript\n * var model = plugin.load({ // Model is an Entity\n * id: \"myModel\",\n * src: \"./models/xml3d/3dpreview.3dxml\",\n * materialtype: \"SpecularMaterial\": true\"\n * });\n * ````\n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#loading_3DXML_materialType_Specular)]\n *\n * @class XML3DLoaderPlugin\n */\n\nclass XML3DLoaderPlugin extends Plugin {\n\n /**\n * @constructor\n * @param {Viewer} viewer The Viewer.\n * @param {Object} cfg Plugin configuration.\n * @param {String} [cfg.id=\"XML3DLoader\"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.\n * @param {String} cfg.workerScriptsPath Path to the directory that contains the\n * bundled [zip.js](https://gildas-lormeau.github.io/zip.js/) archive, which is a dependency of this plugin. This directory\n * contains the script that is used by zip.js to instantiate Web workers, which assist with unzipping the 3DXML, which is a ZIP archive.\n * @param {String} [cfg.materialType=\"PhongMaterial\"] What type of materials to create while loading: \"MetallicMaterial\" to create {@link MetallicMaterial}s, \"SpecularMaterial\" to create {@link SpecularMaterial}s or \"PhongMaterial\" to create {@link PhongMaterial}s. As it loads XML3D's Phong materials, the XMLLoaderPlugin will do its best approximate conversion of those to the specified workflow.\n * @param {Boolean} [cfg.createMetaModel=false] When true, will create a {@link MetaModel} for the model in {@link MetaScene#metaModels}.\n */\n constructor(viewer, cfg = {}) {\n\n super(\"XML3DLoader\", viewer, cfg);\n\n if (!cfg.workerScriptsPath) {\n this.error(\"Config expected: workerScriptsPath\");\n return\n }\n\n this._workerScriptsPath = cfg.workerScriptsPath;\n\n /**\n * @private\n */\n this._loader = new XML3DSceneGraphLoader(this, cfg);\n\n /**\n * Supported 3DXML schema versions\n * @property supportedSchemas\n * @type {string[]}\n */\n this.supportedSchemas = this._loader.supportedSchemas;\n }\n\n /**\n * Loads a 3DXML model from a file into this XML3DLoaderPlugin's {@link Viewer}.\n *\n * Creates a tree of {@link Entity}s within the Viewer's {@link Scene} that represents the model.\n *\n * @param {*} params Loading parameters.\n * @param {String} params.id ID to assign to the model's root {@link Entity}, unique among all components in the Viewer's {@link Scene}.\n * @param {String} [params.src] Path to a 3DXML file.\n * @param {Boolean} [params.edges=false] Whether or not xeokit renders the {@link Entity} with edges emphasized.\n * @param {Number[]} [params.position=[0,0,0]] The model's World-space 3D position.\n * @param {Number[]} [params.scale=[1,1,1]] The model's World-space scale.\n * @param {Number[]} [params.rotation=[0,0,0]] The model's World-space rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @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.\n * @param {Boolean} [params.backfaces=false] When true, allows visible backfaces, wherever specified in the 3DXML. When false, ignores backfaces.\n * @param {Number} [params.edgeThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @param {String} [params.materialType=\"PhongMaterial\"] What type of materials to create while loading: \"MetallicMaterial\" to create {@link MetallicMaterial}s, \"SpecularMaterial\" to create {@link SpecularMaterial}s or \"PhongMaterial\" to create {@link PhongMaterial}s. As it loads XML3D's Phong materials, the XMLLoaderPlugin will do its best approximate conversion of those to the specified workflow.\n * @param {Boolean} [params.createMetaModel=false] When true, will create a {@link MetaModel} for the model in {@link MetaScene#metaModels}.\n * @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}\n */\n load(params = {}) {\n\n params.workerScriptsPath = this._workerScriptsPath;\n\n if (params.id && this.viewer.scene.components[params.id]) {\n this.error(\"Component with this ID already exists in viewer: \" + params.id + \" - will autogenerate this ID\");\n delete params.id;\n }\n\n const modelNode = new Node(this.viewer.scene, utils.apply(params, {\n isModel: true\n }));\n\n const src = params.src;\n\n if (!src) {\n this.error(\"load() param expected: src\");\n return modelNode; // Return new empty model\n }\n\n this._loader.load(this, modelNode, src, params);\n\n return modelNode;\n }\n}\n\nexport {XML3DLoaderPlugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1835, + "__docId__": 1843, "kind": "class", "name": "XML3DLoaderPlugin", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js", @@ -35624,7 +35840,7 @@ ] }, { - "__docId__": 1836, + "__docId__": 1844, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js~XML3DLoaderPlugin", @@ -35711,7 +35927,7 @@ ] }, { - "__docId__": 1837, + "__docId__": 1845, "kind": "member", "name": "_workerScriptsPath", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js~XML3DLoaderPlugin", @@ -35729,7 +35945,7 @@ } }, { - "__docId__": 1838, + "__docId__": 1846, "kind": "member", "name": "_loader", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js~XML3DLoaderPlugin", @@ -35746,7 +35962,7 @@ } }, { - "__docId__": 1839, + "__docId__": 1847, "kind": "member", "name": "supportedSchemas", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js~XML3DLoaderPlugin", @@ -35777,7 +35993,7 @@ } }, { - "__docId__": 1840, + "__docId__": 1848, "kind": "method", "name": "load", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js~XML3DLoaderPlugin", @@ -35973,18 +36189,18 @@ } }, { - "__docId__": 1841, + "__docId__": 1849, "kind": "file", "name": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", "content": "import {Node} from \"../../viewer/scene/nodes/Node.js\";\nimport {Mesh} from \"../../viewer/scene/mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../../viewer/scene/geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../../viewer/scene/materials/PhongMaterial.js\";\nimport {MetallicMaterial} from \"../../viewer/scene/materials/MetallicMaterial.js\";\nimport {SpecularMaterial} from \"../../viewer/scene/materials/SpecularMaterial.js\";\nimport {LambertMaterial} from \"../../viewer/scene/materials/LambertMaterial.js\";\nimport {math} from \"../../viewer/scene/math/math.js\";\n\nimport {zipLib} from \"./zipjs/zip.js\";\nimport {zipExt} from \"./zipjs/zip-ext.js\";\n\nconst zip = zipLib.zip;\nzipExt(zip);\n\nconst supportedSchemas = [\"4.2\"];\n\n/**\n * @private\n */\nclass XML3DSceneGraphLoader {\n\n constructor(plugin, cfg = {}) {\n\n /**\n * Supported 3DXML schema versions\n * @property supportedSchemas\n * @type {string[]}\n */\n this.supportedSchemas = supportedSchemas;\n\n this._xrayOpacity = 0.7;\n this._src = null;\n this._options = cfg;\n\n /**\n * Default viewpoint, containing eye, look and up vectors.\n * Only defined if found in the 3DXML file.\n * @property viewpoint\n * @type {Number[]}\n */\n this.viewpoint = null;\n\n if (!cfg.workerScriptsPath) {\n plugin.error(\"Config expected: workerScriptsPath\");\n return\n }\n zip.workerScriptsPath = cfg.workerScriptsPath;\n\n this.src = cfg.src;\n this.xrayOpacity = 0.7;\n this.displayEffect = cfg.displayEffect;\n this.createMetaModel = cfg.createMetaModel;\n }\n\n load(plugin, modelNode, src, options, ok, error) {\n\n switch (options.materialType) {\n case \"MetallicMaterial\":\n modelNode._defaultMaterial = new MetallicMaterial(modelNode, {\n baseColor: [1, 1, 1],\n metallic: 0.6,\n roughness: 0.6\n });\n break;\n\n case \"SpecularMaterial\":\n modelNode._defaultMaterial = new SpecularMaterial(modelNode, {\n diffuse: [1, 1, 1],\n specular: math.vec3([1.0, 1.0, 1.0]),\n glossiness: 0.5\n });\n break;\n\n default:\n modelNode._defaultMaterial = new PhongMaterial(modelNode, {\n reflectivity: 0.75,\n shiness: 100,\n diffuse: [1, 1, 1]\n });\n }\n\n modelNode._wireframeMaterial = new LambertMaterial(modelNode, {\n color: [0, 0, 0],\n lineWidth: 2\n });\n\n var spinner = modelNode.scene.canvas.spinner;\n spinner.processes++;\n\n load3DXML(plugin, modelNode, src, options, function () {\n spinner.processes--;\n if (ok) {\n ok();\n }\n modelNode.fire(\"loaded\", true, false);\n },\n function (msg) {\n spinner.processes--;\n modelNode.error(msg);\n if (error) {\n error(msg);\n }\n /**\n Fired whenever this XML3D fails to load the 3DXML file\n specified by {@link XML3D/src}.\n @event error\n @param msg {String} Description of the error\n */\n modelNode.fire(\"error\", msg);\n },\n function (err) {\n console.log(\"Error, Will Robinson: \" + err);\n });\n }\n}\n\nvar load3DXML = (function () {\n return function (plugin, modelNode, src, options, ok, error) {\n loadZIP(src, function (zip) { // OK\n parse3DXML(plugin, zip, options, modelNode, ok, error);\n },\n error);\n };\n})();\n\nvar parse3DXML = (function () {\n return function (plugin, zip, options, modelNode, ok) {\n var ctx = {\n plugin: plugin,\n zip: zip,\n edgeThreshold: 30, // Guess at degrees of normal deviation between adjacent tris below which we remove edge between them\n materialType: options.materialType,\n scene: modelNode.scene,\n modelNode: modelNode,\n info: {\n references: {}\n },\n materials: {}\n };\n\n if (options.createMetaModel) {\n ctx.metaModelData = {\n modelId: modelNode.id,\n metaObjects: [{\n name: modelNode.id,\n type: \"Default\",\n id: modelNode.id\n }]\n };\n }\n modelNode.scene.loading++; // Disables (re)compilation\n\n parseDocument(ctx, function () {\n if (ctx.metaModelData) {\n plugin.viewer.metaScene.createMetaModel(modelNode.id, ctx.metaModelData);\n }\n modelNode.scene.loading--; // Re-enables (re)compilation\n ok();\n });\n };\n\n function parseDocument(ctx, ok) {\n ctx.zip.getFile(\"Manifest.xml\", function (xmlDoc, json) {\n var node = json;\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Manifest\":\n parseManifest(ctx, child, ok);\n break;\n }\n }\n });\n }\n\n function parseManifest(ctx, manifest, ok) {\n var children = manifest.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Root\":\n var rootFileSrc = child.children[0];\n ctx.zip.getFile(rootFileSrc, function (xmlDoc, json) {\n parseRoot(ctx, json, ok);\n });\n break;\n }\n }\n }\n\n function parseRoot(ctx, node, ok) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Model_3dxml\":\n parseModel(ctx, child, ok);\n break;\n }\n }\n }\n\n function parseModel(ctx, node, ok) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Header\":\n parseHeader(ctx, child);\n break;\n case \"ProductStructure\":\n parseProductStructure(ctx, child, ok);\n break;\n case \"DefaultView\":\n parseDefaultView(ctx, child);\n break;\n }\n }\n }\n\n function parseHeader(ctx, node) {\n var children = node.children;\n var metaData = {};\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"SchemaVersion\":\n metaData.schemaVersion = child.children[0];\n if (!isSchemaVersionSupported(ctx, metaData.schemaVersion)) {\n ctx.plugin.error(\"Schema version not supported: \" + metaData.schemaVersion + \" - supported versions are: \" + supportedSchemas.join(\",\"));\n } else {\n //ctx.plugin.log(\"Parsing schema version: \" + metaData.schemaVersion);\n }\n break;\n case \"Title\":\n metaData.title = child.children[0];\n break;\n case \"Author\":\n metaData.author = child.children[0];\n break;\n case \"Created\":\n metaData.created = child.children[0];\n break;\n }\n }\n ctx.modelNode.meta = metaData;\n }\n\n function isSchemaVersionSupported(ctx, schemaVersion) {\n for (var i = 0, len = supportedSchemas.length; i < len; i++) {\n if (schemaVersion === supportedSchemas[i]) {\n return true;\n }\n }\n return false;\n }\n\n function parseProductStructure(ctx, productStructureNode, ok) {\n\n parseReferenceReps(ctx, productStructureNode, function (referenceReps) {\n\n // Parse out an intermediate scene DAG representation, that we can then\n // recursive descend through to build a xeokit Object hierarchy.\n\n var children = productStructureNode.children;\n\n var reference3Ds = {};\n var instanceReps = {};\n var instance3Ds = {};\n\n var rootNode;\n var nodes = {};\n\n // Map all the elements\n\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n\n case \"Reference3D\":\n reference3Ds[child.id] = {\n type: \"Reference3D\",\n id: child.id,\n name: child.name,\n instance3Ds: {},\n instanceReps: {}\n };\n break;\n\n case \"InstanceRep\":\n var isAggregatedBy;\n var isInstanceOf;\n var relativeMatrix;\n for (var j = 0, lenj = child.children.length; j < lenj; j++) {\n var child2 = child.children[j];\n switch (child2.type) {\n case \"IsAggregatedBy\":\n isAggregatedBy = child2.children[0];\n break;\n case \"IsInstanceOf\":\n isInstanceOf = child2.children[0];\n break;\n }\n }\n instanceReps[child.id] = {\n type: \"InstanceRep\",\n id: child.id,\n name: child.name,\n isAggregatedBy: isAggregatedBy,\n isInstanceOf: isInstanceOf,\n referenceReps: {}\n };\n break;\n\n case \"Instance3D\":\n var isAggregatedBy;\n var isInstanceOf;\n var relativeMatrix;\n for (var j = 0, lenj = child.children.length; j < lenj; j++) {\n var child2 = child.children[j];\n switch (child2.type) {\n case \"IsAggregatedBy\":\n isAggregatedBy = child2.children[0];\n break;\n case \"IsInstanceOf\":\n isInstanceOf = child2.children[0];\n break;\n case \"RelativeMatrix\":\n relativeMatrix = child2.children[0];\n break;\n }\n }\n instance3Ds[child.id] = {\n type: \"Instance3D\",\n id: child.id,\n name: child.name,\n isAggregatedBy: isAggregatedBy,\n isInstanceOf: isInstanceOf,\n relativeMatrix: relativeMatrix,\n reference3Ds: {}\n };\n break;\n }\n }\n\n // Connect Reference3Ds to the Instance3Ds they aggregate\n\n for (var id in instance3Ds) {\n var instance3D = instance3Ds[id];\n var reference3D = reference3Ds[instance3D.isAggregatedBy];\n if (reference3D) {\n reference3D.instance3Ds[instance3D.id] = instance3D;\n } else {\n alert(\"foo\")\n }\n }\n\n // Connect Instance3Ds to the Reference3Ds they instantiate\n\n for (var id in instance3Ds) {\n var instance3D = instance3Ds[id];\n var reference3D = reference3Ds[instance3D.isInstanceOf];\n instance3D.reference3Ds[reference3D.id] = reference3D;\n reference3D.instance3D = instance3D;\n }\n\n // Connect InstanceReps to the ReferenceReps they instantiate\n\n for (var id in instanceReps) {\n var instanceRep = instanceReps[id];\n var referenceRep = referenceReps[instanceRep.isInstanceOf];\n if (referenceRep) {\n instanceRep.referenceReps[referenceRep.id] = referenceRep;\n }\n }\n\n // Connect Reference3Ds to the InstanceReps they aggregate\n\n for (var id in instanceReps) {\n var instanceRep = instanceReps[id];\n var reference3D = reference3Ds[instanceRep.isAggregatedBy];\n if (reference3D) {\n reference3D.instanceReps[instanceRep.id] = instanceRep;\n }\n }\n\n function parseReference3D(ctx, reference3D, group) {\n //ctx.plugin.log(\"parseReference3D( \" + reference3D.id + \" )\");\n for (var id in reference3D.instance3Ds) {\n parseInstance3D(ctx, reference3D.instance3Ds[id], group);\n }\n for (var id in reference3D.instanceReps) {\n parseInstanceRep(ctx, reference3D.instanceReps[id], group);\n }\n }\n\n function parseInstance3D(ctx, instance3D, group) {\n //ctx.plugin.log(\"parseInstance3D( \" + instance3D.id + \" )\");\n\n if (instance3D.relativeMatrix) {\n var matrix = parseFloatArray(instance3D.relativeMatrix, 12);\n var translate = [matrix[9], matrix[10], matrix[11]];\n var mat3 = matrix.slice(0, 9); // Rotation matrix\n var mat4 = math.mat3ToMat4(mat3, math.identityMat4()); // Convert rotation matrix to 4x4\n var childGroup = new Node(ctx.modelNode, {\n position: translate\n });\n if (ctx.metaModelData) {\n ctx.metaModelData.metaObjects.push({\n id: childGroup.id,\n type: \"Default\",\n name: instance3D.name,\n parent: group ? group.id : ctx.modelNode.id\n });\n }\n if (group) {\n group.addChild(childGroup, true);\n } else {\n ctx.modelNode.addChild(childGroup, true);\n }\n group = childGroup;\n childGroup = new Node(ctx.modelNode, {\n matrix: mat4\n });\n if (ctx.metaModelData) {\n ctx.metaModelData.metaObjects.push({\n id: childGroup.id,\n type: \"Default\",\n name: instance3D.name,\n parent: group ? group.id : ctx.modelNode.id\n });\n }\n group.addChild(childGroup, true);\n group = childGroup;\n } else {\n var childGroup = new Node(ctx.modelNode, {});\n if (ctx.metaModelData) {\n ctx.metaModelData.metaObjects.push({\n id: childGroup.id,\n type: \"Default\",\n name: instance3D.name,\n parent: group ? group.id : ctx.modelNode.id\n });\n }\n if (group) {\n group.addChild(childGroup, true);\n } else {\n ctx.modelNode.addChild(childGroup, true);\n }\n group = childGroup;\n }\n for (var id in instance3D.reference3Ds) {\n parseReference3D(ctx, instance3D.reference3Ds[id], group);\n }\n }\n\n function parseInstanceRep(ctx, instanceRep, group) {\n //ctx.plugin.log(\"parseInstanceRep( \" + instanceRep.id + \" )\");\n if (instanceRep.referenceReps) {\n for (var id in instanceRep.referenceReps) {\n var referenceRep = instanceRep.referenceReps[id];\n for (var id2 in referenceRep) {\n if (id2 === \"id\") {\n continue; // HACK\n }\n var meshCfg = referenceRep[id2];\n var lines = meshCfg.geometry.primitive === \"lines\";\n var material = lines ? ctx.modelNode._wireframeMaterial : (meshCfg.materialId ? ctx.materials[meshCfg.materialId] : null);\n var colorize = meshCfg.color;\n var mesh = new Mesh(ctx.modelNode, {\n isObject: true,\n geometry: meshCfg.geometry,\n material: material || ctx.modelNode._defaultMaterial,\n colorize: colorize,\n backfaces: false\n });\n if (ctx.metaModelData) {\n ctx.metaModelData.metaObjects.push({\n id: mesh.id,\n type: \"Default\",\n name: instanceRep.name,\n parent: group ? group.id : ctx.modelNode.id\n });\n }\n if (group) {\n group.addChild(mesh, true);\n } else {\n ctx.modelNode.addChild(mesh, true);\n }\n mesh.colorize = colorize; // HACK: Mesh has inherited modelNode's colorize state, so we need to restore it (we'd better not modify colorize on the modelNode).\n }\n }\n }\n }\n\n // Find the root Reference3D\n\n for (var id in reference3Ds) {\n var reference3D = reference3Ds[id];\n if (!reference3D.instance3D) {\n parseReference3D(ctx, reference3D, null); // HACK: Assuming that root has id == \"1\"\n ok();\n return;\n }\n }\n\n alert(\"No root Reference3D element found in this modelNode - can't load.\");\n\n ok();\n });\n }\n\n function parseIntArray(str) {\n var parts = str.trim().split(\" \");\n var result = new Int32Array(parts.length);\n for (var i = 0; i < parts.length; i++) {\n result[i] = parseInt(parts[i]);\n }\n return result;\n }\n\n function parseReferenceReps(ctx, node, ok) {\n var referenceReps = {};\n var children = node.children;\n var numToLoad = 0;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n if (child.type === \"ReferenceRep\") {\n numToLoad++;\n }\n }\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"ReferenceRep\":\n if (child.associatedFile) {\n var src = stripURN(child.associatedFile);\n (function () {\n var childId = child.id;\n ctx.zip.getFile(src, function (xmlDoc, json) {\n\n var materialIds = xmlDoc.getElementsByTagName(\"MaterialId\");\n\n loadCATMaterialRefDocuments(ctx, materialIds, function () {\n\n // ctx.plugin.log(\"reference loaded: \" + src);\n var referenceRep = {\n id: childId\n };\n parse3DRepDocument(ctx, json, referenceRep);\n referenceReps[childId] = referenceRep;\n if (--numToLoad === 0) {\n ok(referenceReps);\n }\n });\n },\n function (error) {\n // TODO:\n });\n })();\n }\n break;\n }\n }\n }\n\n\n function parseDefaultView(ctx, node) {\n // ctx.plugin.log(\"parseDefaultView\");\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Viewpoint\":\n var children2 = child.children;\n ctx.modelNode.viewpoint = {};\n for (var i2 = 0, len2 = children2.length; i2 < len2; i2++) {\n var child2 = children2[i];\n switch (child2.type) {\n case \"Position\":\n ctx.modelNode.viewpoint.eye = parseFloatArray(child2.children[0], 3);\n break;\n case \"Sight\":\n ctx.modelNode.viewpoint.look = parseFloatArray(child2.children[0], 3);\n break;\n case \"Up\":\n ctx.modelNode.viewpoint.up = parseFloatArray(child2.children[0], 3);\n break;\n }\n }\n break;\n case \"DefaultViewProperty\":\n break;\n }\n }\n }\n\n function parse3DRepDocument(ctx, node, result) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"XMLRepresentation\":\n parseXMLRepresentation(ctx, child, result);\n break;\n }\n }\n }\n\n function parseXMLRepresentation(ctx, node, result) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Root\":\n parse3DRepRoot(ctx, child, result);\n break;\n }\n }\n }\n\n function parse3DRepRoot(ctx, node, result) {\n switch (node[\"xsi:type\"]) {\n case \"BagRepType\":\n break;\n case \"PolygonalRepType\":\n break;\n }\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Rep\":\n parse3DRepRep(ctx, child, result);\n break;\n }\n }\n }\n\n function parse3DRepRep(ctx, node, result) {\n switch (node[\"xsi:type\"]) {\n case \"BagRepType\":\n break;\n case \"PolygonalRepType\":\n break;\n }\n var meshesResult = {\n edgeThreshold: ctx.edgeThreshold || 30,\n compressGeometry: true\n };\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Rep\":\n parse3DRepRep(ctx, child, result);\n break;\n case \"Edges\":\n // Ignoring edges because we auto-generate our own using xeokit\n break;\n case \"Faces\":\n meshesResult.primitive = \"triangles\";\n parseFaces(ctx, child, meshesResult);\n break;\n case \"VertexBuffer\":\n parseVertexBuffer(ctx, child, meshesResult);\n break;\n case \"SurfaceAttributes\":\n parseSurfaceAttributes(ctx, child, meshesResult);\n break;\n }\n }\n if (meshesResult.positions) {\n var geometry = new ReadableGeometry(ctx.modelNode, meshesResult);\n result[geometry.id] = {\n geometry: geometry,\n color: meshesResult.color || [1.0, 1.0, 1.0, 1.0],\n materialId: meshesResult.materialId\n };\n }\n }\n\n function parseEdges(ctx, node, result) {\n result.positions = [];\n result.indices = [];\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Polyline\":\n parsePolyline(ctx, child, result);\n break;\n }\n }\n }\n\n function parsePolyline(ctx, node, result) {\n var vertices = node.vertices;\n if (vertices) {\n var positions = parseFloatArray(vertices, 3);\n if (positions.length > 0) {\n var positionsOffset = result.positions.length / 3;\n for (var i = 0, len = positions.length; i < len; i++) {\n result.positions.push(positions[i]);\n }\n for (var i = 0, len = (positions.length / 3) - 1; i < len; i++) {\n result.indices.push(positionsOffset + i);\n result.indices.push(positionsOffset + i + 1);\n }\n }\n }\n }\n\n function parseFaces(ctx, node, result) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Face\":\n parseFace(ctx, child, result);\n break;\n }\n }\n }\n\n function parseFace(ctx, node, result) {\n var strips = node.strips;\n if (strips) {\n // Triangle strips\n var arrays = parseIntArrays(strips);\n if (arrays.length > 0) {\n result.primitive = \"triangles\";\n var indices = [];\n for (var i = 0, len = arrays.length; i < len; i++) {\n var array = convertTriangleStrip(arrays[i]);\n for (var j = 0, lenj = array.length; j < lenj; j++) {\n indices.push(array[j]);\n }\n }\n result.indices = indices; // TODO\n }\n } else {\n // Triangle meshes\n var triangles = node.triangles;\n if (triangles) {\n result.primitive = \"triangles\";\n result.indices = parseIntArray(triangles);\n }\n }\n // Material\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"SurfaceAttributes\":\n parseSurfaceAttributes(ctx, child, result);\n break;\n }\n }\n }\n\n function convertTriangleStrip(indices) {\n var ccw = false;\n var indices2 = [];\n for (var i = 0, len = indices.length; i < len - 2; i++) {\n if (ccw) {\n if (i & 1) { //\n indices2.push(indices[i]);\n indices2.push(indices[i + 1]);\n indices2.push(indices[i + 2]);\n } else {\n indices2.push(indices[i]);\n indices2.push(indices[i + 2]);\n indices2.push(indices[i + 1]);\n }\n } else {\n if (i & 1) { //\n indices2.push(indices[i]);\n indices2.push(indices[i + 2]);\n indices2.push(indices[i + 1]);\n } else {\n indices2.push(indices[i]);\n indices2.push(indices[i + 1]);\n indices2.push(indices[i + 2]);\n }\n }\n }\n return indices2;\n }\n\n function parseVertexBuffer(ctx, node, result) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Positions\":\n result.positions = parseFloatArray(child.children[0], 3);\n break;\n case \"Normals\":\n result.normals = parseFloatArray(child.children[0], 3);\n break;\n case \"TextureCoordinates\": // TODO: Support dimension and channel?\n result.uv = parseFloatArray(child.children[0], 2);\n break;\n }\n }\n }\n\n function parseIntArrays(str) {\n var coordStrings = str.split(\",\");\n var array = [];\n for (var i = 0, len = coordStrings.length; i < len; i++) {\n var coordStr = coordStrings[i].trim();\n if (coordStr.length > 0) {\n var elemStrings = coordStr.trim().split(\" \");\n var arr = new Int16Array(elemStrings.length);\n var arrIdx = 0;\n for (var j = 0, lenj = elemStrings.length; j < lenj; j++) {\n if (elemStrings[j] !== \"\") {\n arr[arrIdx++] = parseInt(elemStrings[j]);\n }\n }\n array.push(arr);\n }\n }\n return array;\n }\n\n function parseFloatArray(str, numElems) {\n str = str.split(\",\");\n var arr = new Float32Array(str.length * numElems);\n var arrIdx = 0;\n for (var i = 0, len = str.length; i < len; i++) {\n var value = str[i];\n value = value.split(\" \");\n for (var j = 0, lenj = value.length; j < lenj; j++) {\n if (value[j] !== \"\") {\n arr[arrIdx++] = parseFloat(value[j]);\n }\n }\n }\n return arr;\n }\n\n function parseIntArray(str) {\n str = str.trim().split(\" \");\n var arr = new Int32Array(str.length);\n var arrIdx = 0;\n for (var i = 0, len = str.length; i < len; i++) {\n var value = str[i];\n arr[i] = parseInt(value);\n }\n return arr;\n }\n\n function parseSurfaceAttributes(ctx, node, result) {\n result.color = [1, 1, 1, 1];\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Color\":\n result.color[0] = child.red;\n result.color[1] = child.green;\n result.color[2] = child.blue;\n result.color[3] = child.alpha;\n break;\n case \"MaterialApplication\":\n var children2 = child.children;\n for (var j = 0, lenj = children2.length; j < lenj; j++) {\n var child2 = children2[j];\n switch (child2.type) {\n case \"MaterialId\":\n var materialId = getIDFromURI(child2.id);\n var material = ctx.materials[materialId];\n if (!material) {\n ctx.plugin.error(\"material not found: \" + materialId);\n }\n result.materialId = materialId;\n break;\n }\n }\n break;\n }\n }\n }\n})();\n\nfunction loadCATMaterialRefDocuments(ctx, materialIds, ok) {\n var loaded = {};\n\n function load(i, done) {\n if (i >= materialIds.length) {\n ok();\n return;\n }\n var materialId = materialIds[i];\n var src = materialId.id;\n var colonIdx = src.lastIndexOf(\":\");\n if (colonIdx > 0) {\n src = src.substring(colonIdx + 1);\n }\n var hashIdx = src.lastIndexOf(\"#\");\n if (hashIdx > 0) {\n src = src.substring(0, hashIdx);\n }\n if (!loaded[src]) {\n loadCATMaterialRefDocument(ctx, src, function () {\n loaded[src] = true;\n load(i + 1, done);\n });\n } else {\n load(i + 1, done);\n }\n }\n\n load(0, ok);\n}\n\nfunction loadCATMaterialRefDocument(ctx, src, ok) { // Loads CATMaterialRef.3dxml\n ctx.zip.getFile(src, function (xmlDoc, json) {\n parseCATMaterialRefDocument(ctx, json, ok);\n });\n}\n\nfunction parseCATMaterialRefDocument(ctx, node, ok) { // Parse CATMaterialRef.3dxml\n // ctx.plugin.log(\"parseCATMaterialRefDocument\");\n var children = node.children;\n var child;\n for (var i = 0, len = children.length; i < len; i++) {\n child = children[i];\n if (child.type === \"Model_3dxml\") {\n parseModel_3dxml(ctx, child, ok);\n }\n }\n}\n\nfunction parseModel_3dxml(ctx, node, ok) { // Parse CATMaterialRef.3dxml\n // ctx.plugin.log(\"parseModel_3dxml\");\n var children = node.children;\n var child;\n for (var i = 0, len = children.length; i < len; i++) {\n child = children[i];\n if (child.type === \"CATMaterialRef\") {\n parseCATMaterialRef(ctx, child, ok);\n }\n }\n}\n\nfunction parseCATMaterialRef(ctx, node, ok) {\n var domainToReferenceMap = {};\n var materials = {};\n var result = {};\n var children = node.children;\n var child;\n var numToLoad = 0;\n for (var j = 0, lenj = children.length; j < lenj; j++) {\n var child2 = children[j];\n switch (child2.type) {\n case \"MaterialDomainInstance\":\n var isAggregatedBy;\n var isInstanceOf;\n for (var k = 0, lenk = child2.children.length; k < lenk; k++) {\n var child3 = child2.children[k];\n switch (child3.type) {\n case \"IsAggregatedBy\":\n isAggregatedBy = child3.children[0];\n break;\n case \"IsInstanceOf\":\n isInstanceOf = child3.children[0];\n break;\n }\n }\n domainToReferenceMap[isInstanceOf] = isAggregatedBy;\n break;\n }\n }\n for (var j = 0, lenj = children.length; j < lenj; j++) {\n var child2 = children[j];\n switch (child2.type) {\n case \"MaterialDomain\":\n numToLoad++;\n break;\n }\n }\n // Now load them\n for (var j = 0, lenj = children.length; j < lenj; j++) {\n var child2 = children[j];\n switch (child2.type) {\n case \"MaterialDomain\":\n if (child2.associatedFile) {\n (function () {\n var childId = child2.id;\n var src = stripURN(child2.associatedFile);\n ctx.zip.getFile(src, function (xmlDoc, json) {\n // ctx.plugin.log(\"Material def loaded: \" + src);\n ctx.materials[domainToReferenceMap[childId]] = parseMaterialDefDocument(ctx, json);\n\n if (--numToLoad === 0) {\n // console.log(\"All ReferenceReps loaded.\");\n ok();\n }\n },\n function (error) {\n // TODO:\n });\n })();\n }\n break;\n }\n }\n}\n\nfunction parseMaterialDefDocument(ctx, node) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"Osm\":\n return parseMaterialDefDocumentOsm(ctx, child);\n break;\n }\n }\n}\n\nfunction parseMaterialDefDocumentOsm(ctx, node) {\n var children = node.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n switch (child.type) {\n case \"RenderingRootFeature\":\n //..\n break;\n case \"Feature\":\n\n if (child.Alias === \"RenderingFeature\") {\n // Parse the coefficients, then parse the colors, scaling those by their coefficients.\n var coeffs = {};\n var materialCfg = {};\n var children2 = child.children;\n var j;\n var lenj;\n var child2;\n for (j = 0, lenj = children2.length; j < lenj; j++) {\n child2 = children2[j];\n switch (child2.Name) {\n case \"AmbientCoef\":\n coeffs.ambient = parseFloat(child2.Value);\n break;\n case \"DiffuseCoef\":\n coeffs.diffuse = parseFloat(child2.Value);\n break;\n case \"EmissiveCoef\":\n coeffs.emissive = parseFloat(child2.Value);\n break;\n case \"SpecularExponent\":\n coeffs.specular = parseFloat(child2.Value);\n break;\n }\n }\n for (j = 0, lenj = children2.length; j < lenj; j++) {\n child2 = children2[j];\n switch (child2.Name) {\n case \"AmbientColor\":\n materialCfg.ambient = parseRGB(child2.Value, coeffs.ambient);\n break;\n case \"DiffuseColor\":\n materialCfg.diffuse = parseRGB(child2.Value, coeffs.diffuse);\n break;\n case \"EmissiveColor\":\n materialCfg.emissive = parseRGB(child2.Value, coeffs.emissive);\n break;\n case \"SpecularColor\":\n materialCfg.specular = parseRGB(child2.Value, coeffs.specular);\n break;\n case \"Transparency\":\n var alpha = 1.0 - parseFloat(child2.Value); // GOTCHA: Degree of transparency, not degree of opacity\n if (alpha < 1.0) {\n materialCfg.alpha = alpha;\n materialCfg.alphaMode = \"blend\";\n }\n break;\n }\n }\n\n var material;\n\n switch (ctx.materialType) {\n case \"MetallicMaterial\":\n material = new MetallicMaterial(ctx.modelNode, {\n baseColor: materialCfg.diffuse,\n metallic: 0.7,\n roughness: 0.5,\n emissive: materialCfg.emissive,\n alpha: materialCfg.alpha,\n alphaMode: materialCfg.alphaMode\n });\n break;\n\n case \"SpecularMaterial\":\n material = new SpecularMaterial(ctx.modelNode, {\n diffuse: materialCfg.diffuse,\n specular: materialCfg.specular,\n glossiness: 0.5,\n emissive: materialCfg.emissive,\n alpha: materialCfg.alpha,\n alphaMode: materialCfg.alphaMode\n });\n break;\n\n default:\n material = new PhongMaterial(ctx.modelNode, {\n reflectivity: 0.5,\n ambient: materialCfg.ambient,\n diffuse: materialCfg.diffuse,\n specular: materialCfg.specular,\n // shininess: node.shine,\n emissive: materialCfg.emissive,\n alphaMode: materialCfg.alphaMode,\n alpha: node.alpha\n });\n }\n return material;\n }\n break;\n }\n }\n}\n\nfunction parseRGB(str, coeff) {\n coeff = (coeff !== undefined) ? coeff : 0.5;\n var openBracketIndex = str.indexOf(\"[\");\n var closeBracketIndex = str.indexOf(\"]\");\n str = str.substring(openBracketIndex + 1, closeBracketIndex - openBracketIndex);\n str = str.split(\",\");\n var arr = new Float32Array(str.length);\n var arrIdx = 0;\n for (var i = 0, len = str.length; i < len; i++) {\n var value = str[i];\n value = value.trim().split(\" \");\n for (var j = 0, lenj = value.length; j < lenj; j++) {\n if (value[j] !== \"\") {\n arr[arrIdx++] = parseFloat(value[j]) * coeff;\n }\n }\n }\n return arr;\n}\n\n\n//----------------------------------------------------------------------------------------------------\n\n/**\n * Wraps zip.js to provide an in-memory ZIP archive representing the 3DXML file bundle.\n *\n * Allows us to pluck each file from it as XML and JSON.\n *\n * @constructor\n */\nvar ZIP = function () {\n\n var reader;\n var files = {};\n\n /**\n Loads this ZIP\n\n @param src\n @param ok\n @param error\n */\n this.load = function (src, ok, error) {\n var self = this;\n zip.createReader(new zip.HttpReader(src), function (reader) {\n reader.getEntries(function (entries) {\n if (entries.length > 0) {\n for (var i = 0, len = entries.length; i < len; i++) {\n var entry = entries[i];\n files[entry.filename] = entry;\n }\n }\n ok();\n });\n }, error);\n };\n\n /**\n Gets a file as XML and JSON from this ZIP\n @param src\n @param ok\n @param error\n */\n this.getFile = function (src, ok, error) {\n var entry = files[src];\n if (!entry) {\n var errMsg = \"ZIP entry not found: \" + src;\n console.error(errMsg);\n if (error) {\n error(errMsg);\n }\n return;\n }\n entry.getData(new zip.TextWriter(), function (text) {\n\n // Parse to XML\n var parser = new DOMParser();\n var xmlDoc = parser.parseFromString(text, \"text/xml\");\n\n // Parse to JSON\n var json = xmlToJSON(xmlDoc, {});\n\n ok(xmlDoc, json);\n });\n };\n\n function xmlToJSON(node, attributeRenamer) {\n if (node.nodeType === node.TEXT_NODE) {\n var v = node.nodeValue;\n if (v.match(/^\\s+$/) === null) {\n return v;\n }\n } else if (node.nodeType === node.ELEMENT_NODE ||\n node.nodeType === node.DOCUMENT_NODE) {\n var json = {type: node.nodeName, children: []};\n if (node.nodeType === node.ELEMENT_NODE) {\n for (var j = 0; j < node.attributes.length; j++) {\n var attribute = node.attributes[j];\n var nm = attributeRenamer[attribute.nodeName] || attribute.nodeName;\n json[nm] = attribute.nodeValue;\n }\n }\n for (var i = 0; i < node.childNodes.length; i++) {\n var item = node.childNodes[i];\n var j = xmlToJSON(item, attributeRenamer);\n if (j) json.children.push(j);\n }\n return json;\n }\n }\n\n /**\n Disposes of this ZIP\n */\n this.destroy = function () {\n reader.close(function () {\n // onclose callback\n });\n };\n};\n\nfunction\n\nloadZIP(src, ok, err) {\n var zip = new ZIP();\n zip.load(src, function () {\n ok(zip);\n }, function (errMsg) {\n err(\"Error loading ZIP archive: \" + errMsg);\n })\n}\n\nfunction\n\nstripURN(str) {\n var subStr = \"urn:3DXML:\";\n return (str.indexOf(subStr) === 0) ? str.substring(subStr.length) : str;\n}\n\n\nfunction\n\ngetIDFromURI(str) {\n var hashIdx = str.lastIndexOf(\"#\");\n return hashIdx !== -1 ? str.substring(hashIdx + 1) : str;\n}\n\nexport {XML3DSceneGraphLoader};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1842, + "__docId__": 1850, "kind": "variable", "name": "zip", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36005,7 +36221,7 @@ "ignore": true }, { - "__docId__": 1843, + "__docId__": 1851, "kind": "variable", "name": "supportedSchemas", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36026,7 +36242,7 @@ "ignore": true }, { - "__docId__": 1844, + "__docId__": 1852, "kind": "variable", "name": "load3DXML", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36047,7 +36263,7 @@ "ignore": true }, { - "__docId__": 1845, + "__docId__": 1853, "kind": "variable", "name": "parse3DXML", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36068,7 +36284,7 @@ "ignore": true }, { - "__docId__": 1846, + "__docId__": 1854, "kind": "function", "name": "loadCATMaterialRefDocuments", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36107,7 +36323,7 @@ "ignore": true }, { - "__docId__": 1847, + "__docId__": 1855, "kind": "function", "name": "loadCATMaterialRefDocument", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36146,7 +36362,7 @@ "ignore": true }, { - "__docId__": 1848, + "__docId__": 1856, "kind": "function", "name": "parseCATMaterialRefDocument", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36185,7 +36401,7 @@ "ignore": true }, { - "__docId__": 1849, + "__docId__": 1857, "kind": "function", "name": "parseModel_3dxml", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36224,7 +36440,7 @@ "ignore": true }, { - "__docId__": 1850, + "__docId__": 1858, "kind": "function", "name": "parseCATMaterialRef", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36263,7 +36479,7 @@ "ignore": true }, { - "__docId__": 1851, + "__docId__": 1859, "kind": "function", "name": "parseMaterialDefDocument", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36300,7 +36516,7 @@ "ignore": true }, { - "__docId__": 1852, + "__docId__": 1860, "kind": "function", "name": "parseMaterialDefDocumentOsm", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36337,7 +36553,7 @@ "ignore": true }, { - "__docId__": 1853, + "__docId__": 1861, "kind": "function", "name": "parseRGB", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36374,7 +36590,7 @@ "ignore": true }, { - "__docId__": 1854, + "__docId__": 1862, "kind": "function", "name": "ZIP", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36399,7 +36615,7 @@ "ignore": true }, { - "__docId__": 1855, + "__docId__": 1863, "kind": "function", "name": "loadZIP", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36438,7 +36654,7 @@ "ignore": true }, { - "__docId__": 1856, + "__docId__": 1864, "kind": "function", "name": "stripURN", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36469,7 +36685,7 @@ "ignore": true }, { - "__docId__": 1857, + "__docId__": 1865, "kind": "function", "name": "getIDFromURI", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36500,7 +36716,7 @@ "ignore": true }, { - "__docId__": 1858, + "__docId__": 1866, "kind": "class", "name": "XML3DSceneGraphLoader", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js", @@ -36516,7 +36732,7 @@ "ignore": true }, { - "__docId__": 1859, + "__docId__": 1867, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36530,7 +36746,7 @@ "undocument": true }, { - "__docId__": 1860, + "__docId__": 1868, "kind": "member", "name": "supportedSchemas", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36561,7 +36777,7 @@ } }, { - "__docId__": 1861, + "__docId__": 1869, "kind": "member", "name": "_xrayOpacity", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36579,7 +36795,7 @@ } }, { - "__docId__": 1862, + "__docId__": 1870, "kind": "member", "name": "_src", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36597,7 +36813,7 @@ } }, { - "__docId__": 1863, + "__docId__": 1871, "kind": "member", "name": "_options", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36615,7 +36831,7 @@ } }, { - "__docId__": 1864, + "__docId__": 1872, "kind": "member", "name": "viewpoint", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36646,7 +36862,7 @@ } }, { - "__docId__": 1865, + "__docId__": 1873, "kind": "member", "name": "src", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36663,7 +36879,7 @@ } }, { - "__docId__": 1866, + "__docId__": 1874, "kind": "member", "name": "xrayOpacity", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36680,7 +36896,7 @@ } }, { - "__docId__": 1867, + "__docId__": 1875, "kind": "member", "name": "displayEffect", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36697,7 +36913,7 @@ } }, { - "__docId__": 1868, + "__docId__": 1876, "kind": "member", "name": "createMetaModel", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36714,7 +36930,7 @@ } }, { - "__docId__": 1869, + "__docId__": 1877, "kind": "method", "name": "load", "memberof": "src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js~XML3DSceneGraphLoader", @@ -36767,40 +36983,40 @@ "return": null }, { - "__docId__": 1870, + "__docId__": 1878, "kind": "file", "name": "src/plugins/XML3DLoaderPlugin/index.js", "content": "export * from \"./XML3DLoaderPlugin.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/XML3DLoaderPlugin/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/XML3DLoaderPlugin/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1871, + "__docId__": 1879, "kind": "file", "name": "src/plugins/index.js", "content": "export * from \"./AngleMeasurementsPlugin/index.js\";\nexport * from \"./AnnotationsPlugin/index.js\";\nexport * from \"./AxisGizmoPlugin/index.js\";\nexport * from \"./BCFViewpointsPlugin/index.js\";\nexport * from \"./DistanceMeasurementsPlugin/index.js\";\nexport * from \"./FastNavPlugin/index.js\";\nexport * from \"./GLTFLoaderPlugin/index.js\";\nexport * from \"./NavCubePlugin/index.js\";\nexport * from \"./OBJLoaderPlugin/index.js\";\nexport * from \"./SectionPlanesPlugin/index.js\";\nexport * from \"./StoreyViewsPlugin/index.js\";\nexport * from \"./FaceAlignedSectionPlanesPlugin/index.js\";\nexport * from \"./SkyboxesPlugin/index.js\";\nexport * from \"./STLLoaderPlugin/index.js\";\nexport * from \"./TreeViewPlugin/index.js\";\nexport * from \"./ViewCullPlugin/index.js\";\nexport * from \"./XKTLoaderPlugin/index.js\";\nexport * from \"./XML3DLoaderPlugin/index.js\";\nexport * from \"./WebIFCLoaderPlugin/index.js\";\nexport * from \"./LASLoaderPlugin/index.js\";\nexport * from \"./CityJSONLoaderPlugin/index.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1872, + "__docId__": 1880, "kind": "file", "name": "src/plugins/lib/culling/ObjectCullStates.js", "content": "/**\n * For each Entity in its Scene, efficiently combines updates from multiple culling systems into a single \"culled\" state.\n *\n * Two culling systems are supported:\n *\n * * View culling - culls Entities when they fall outside the current view frustum, and\n * * Detail culling - momentarily culls less visually-significant Entities while we are moving the camera.\n *\n * @private\n */\nclass ObjectCullStates {\n\n /**\n * @private\n * @param scene\n */\n constructor(scene) {\n\n this._scene = scene;\n\n this._objects = []; // Array of all Entity instances that represent objects\n this._objectsViewCulled = []; // A flag for each object to indicate its view-cull status\n this._objectsDetailCulled = []; // A flag for each object to indicate its detail-cull status\n this._objectsChanged = []; // A flag for each object, set whenever its cull status has changed since last _applyChanges()\n this._objectsChangedList = []; // A list of objects whose cull status has changed, applied and cleared by _applyChanges()\n\n this._modelInfos = {};\n\n this._numObjects = 0;\n this._lenObjectsChangedList = 0;\n\n this._dirty = true;\n\n this._onModelLoaded = scene.on(\"modelLoaded\", (modelId) => {\n const model = scene.models[modelId];\n if (model) {\n this._addModel(model);\n }\n });\n\n this._onTick = scene.on(\"tick\", () => {\n if (this._dirty) {\n this._build();\n }\n this._applyChanges();\n });\n }\n\n _addModel(model) {\n const modelInfo = {\n model: model,\n onDestroyed: model.on(\"destroyed\", () => {\n this._removeModel(model);\n })\n };\n this._modelInfos[model.id] = modelInfo;\n this._dirty = true;\n }\n\n _removeModel(model) {\n const modelInfo = this._modelInfos[model.id];\n if (modelInfo) {\n modelInfo.model.off(modelInfo.onDestroyed);\n delete this._modelInfos[model.id];\n this._dirty = true;\n }\n }\n\n _build() {\n if (!this._dirty) {\n return;\n }\n this._applyChanges();\n const objects = this._scene.objects;\n for (let i = 0; i < this._numObjects; i++) {\n this._objects[i] = null;\n }\n this._numObjects = 0;\n for (let objectId in objects) {\n const entity = objects[objectId];\n this._objects[this._numObjects++] = entity;\n }\n this._lenObjectsChangedList = 0;\n this._dirty = false;\n }\n\n _applyChanges() {\n if (this._lenObjectsChangedList > 0) {\n for (let i = 0; i < this._lenObjectsChangedList; i++) {\n const objectIdx = this._objectsChangedList[i];\n const object = this._objects[objectIdx];\n const viewCulled = this._objectsViewCulled[objectIdx];\n const detailCulled = this._objectsDetailCulled[objectIdx];\n const culled = (viewCulled || detailCulled);\n object.culled = culled;\n this._objectsChanged[objectIdx] = false;\n }\n this._lenObjectsChangedList = 0;\n }\n }\n\n /**\n * Array of {@link Entity} instances that represent objects in the {@link Scene}.\n *\n * ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.\n *\n * @returns {Entity[]}\n */\n get objects() {\n if (this._dirty) {\n this._build();\n }\n return this._objects;\n }\n\n /**\n * Number of objects in {@link ObjectCullStates#objects},\n *\n * Updated whenever ````Scene```` fires a ````modelLoaded```` event.\n *\n * @returns {Number}\n */\n get numObjects() {\n if (this._dirty) {\n this._build();\n }\n return this._numObjects;\n }\n\n /**\n * Updates an object's view-cull status.\n *\n * @param {Number} objectIdx Index of the object in {@link ObjectCullStates#objects}\n * @param {boolean} culled Whether to view-cull or not.\n */\n setObjectViewCulled(objectIdx, culled) {\n if (this._dirty) {\n this._build();\n }\n if (this._objectsViewCulled[objectIdx] === culled) {\n return;\n }\n this._objectsViewCulled[objectIdx] = culled;\n if (!this._objectsChanged[objectIdx]) {\n this._objectsChanged[objectIdx] = true;\n this._objectsChangedList[this._lenObjectsChangedList++] = objectIdx;\n }\n }\n\n /**\n * Updates an object's detail-cull status.\n *\n * @param {Number} objectIdx Index of the object in {@link ObjectCullStates#objects}\n * @param {boolean} culled Whether to detail-cull or not.\n */\n setObjectDetailCulled(objectIdx, culled) {\n if (this._dirty) {\n this._build();\n }\n if (this._objectsDetailCulled[objectIdx] === culled) {\n return;\n }\n this._objectsDetailCulled[objectIdx] = culled;\n if (!this._objectsChanged[objectIdx]) {\n this._objectsChanged[objectIdx] = true;\n this._objectsChangedList[this._lenObjectsChangedList++] = objectIdx;\n }\n }\n\n /**\n * Destroys this ObjectCullStAtes.\n */\n _destroy() {\n this._clear();\n this._scene.off(this._onModelLoaded);\n this._scene.off(this._onTick);\n }\n\n _clear() {\n for (let modelId in this._modelInfos) {\n const modelInfo = this._modelInfos[modelId];\n modelInfo.model.off(modelInfo.onDestroyed);\n }\n this._modelInfos = {};\n this._dirty = true;\n }\n}\n\nconst sceneObjectCullStates = {};\n\n/**\n * @private\n */\nfunction getObjectCullStates(scene) {\n const sceneId = scene.id;\n let objectCullStates = sceneObjectCullStates[sceneId];\n if (!objectCullStates) {\n objectCullStates = new ObjectCullStates(scene);\n sceneObjectCullStates[sceneId] = objectCullStates;\n scene.on(\"destroyed\", () => {\n delete sceneObjectCullStates[sceneId];\n objectCullStates._destroy();\n });\n }\n return objectCullStates;\n}\n\nexport {getObjectCullStates};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/lib/culling/ObjectCullStates.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/lib/culling/ObjectCullStates.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1873, + "__docId__": 1881, "kind": "class", "name": "ObjectCullStates", "memberof": "src/plugins/lib/culling/ObjectCullStates.js", @@ -36816,7 +37032,7 @@ "ignore": true }, { - "__docId__": 1874, + "__docId__": 1882, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36842,7 +37058,7 @@ "ignore": true }, { - "__docId__": 1875, + "__docId__": 1883, "kind": "member", "name": "_scene", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36860,7 +37076,7 @@ } }, { - "__docId__": 1876, + "__docId__": 1884, "kind": "member", "name": "_objects", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36878,7 +37094,7 @@ } }, { - "__docId__": 1877, + "__docId__": 1885, "kind": "member", "name": "_objectsViewCulled", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36896,7 +37112,7 @@ } }, { - "__docId__": 1878, + "__docId__": 1886, "kind": "member", "name": "_objectsDetailCulled", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36914,7 +37130,7 @@ } }, { - "__docId__": 1879, + "__docId__": 1887, "kind": "member", "name": "_objectsChanged", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36932,7 +37148,7 @@ } }, { - "__docId__": 1880, + "__docId__": 1888, "kind": "member", "name": "_objectsChangedList", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36950,7 +37166,7 @@ } }, { - "__docId__": 1881, + "__docId__": 1889, "kind": "member", "name": "_modelInfos", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36968,7 +37184,7 @@ } }, { - "__docId__": 1882, + "__docId__": 1890, "kind": "member", "name": "_numObjects", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -36986,7 +37202,7 @@ } }, { - "__docId__": 1883, + "__docId__": 1891, "kind": "member", "name": "_lenObjectsChangedList", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37004,7 +37220,7 @@ } }, { - "__docId__": 1884, + "__docId__": 1892, "kind": "member", "name": "_dirty", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37022,7 +37238,7 @@ } }, { - "__docId__": 1885, + "__docId__": 1893, "kind": "member", "name": "_onModelLoaded", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37040,7 +37256,7 @@ } }, { - "__docId__": 1886, + "__docId__": 1894, "kind": "member", "name": "_onTick", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37058,7 +37274,7 @@ } }, { - "__docId__": 1887, + "__docId__": 1895, "kind": "method", "name": "_addModel", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37082,7 +37298,7 @@ "return": null }, { - "__docId__": 1889, + "__docId__": 1897, "kind": "method", "name": "_removeModel", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37106,7 +37322,7 @@ "return": null }, { - "__docId__": 1891, + "__docId__": 1899, "kind": "method", "name": "_build", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37123,7 +37339,7 @@ "return": null }, { - "__docId__": 1895, + "__docId__": 1903, "kind": "method", "name": "_applyChanges", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37140,7 +37356,7 @@ "return": null }, { - "__docId__": 1897, + "__docId__": 1905, "kind": "get", "name": "objects", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37172,7 +37388,7 @@ } }, { - "__docId__": 1898, + "__docId__": 1906, "kind": "get", "name": "numObjects", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37204,7 +37420,7 @@ } }, { - "__docId__": 1899, + "__docId__": 1907, "kind": "method", "name": "setObjectViewCulled", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37240,7 +37456,7 @@ "return": null }, { - "__docId__": 1900, + "__docId__": 1908, "kind": "method", "name": "setObjectDetailCulled", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37276,7 +37492,7 @@ "return": null }, { - "__docId__": 1901, + "__docId__": 1909, "kind": "method", "name": "_destroy", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37292,7 +37508,7 @@ "return": null }, { - "__docId__": 1902, + "__docId__": 1910, "kind": "method", "name": "_clear", "memberof": "src/plugins/lib/culling/ObjectCullStates.js~ObjectCullStates", @@ -37309,7 +37525,7 @@ "return": null }, { - "__docId__": 1905, + "__docId__": 1913, "kind": "variable", "name": "sceneObjectCullStates", "memberof": "src/plugins/lib/culling/ObjectCullStates.js", @@ -37330,7 +37546,7 @@ "ignore": true }, { - "__docId__": 1906, + "__docId__": 1914, "kind": "function", "name": "getObjectCullStates", "memberof": "src/plugins/lib/culling/ObjectCullStates.js", @@ -37360,18 +37576,18 @@ } }, { - "__docId__": 1907, + "__docId__": 1915, "kind": "file", "name": "src/plugins/lib/earcut.js", "content": "/** @private */\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n\nexport {earcut};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/lib/earcut.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/lib/earcut.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1908, + "__docId__": 1916, "kind": "function", "name": "linkedList", "memberof": "src/plugins/lib/earcut.js", @@ -37426,7 +37642,7 @@ "ignore": true }, { - "__docId__": 1909, + "__docId__": 1917, "kind": "function", "name": "filterPoints", "memberof": "src/plugins/lib/earcut.js", @@ -37463,7 +37679,7 @@ "ignore": true }, { - "__docId__": 1910, + "__docId__": 1918, "kind": "function", "name": "earcutLinked", "memberof": "src/plugins/lib/earcut.js", @@ -37526,7 +37742,7 @@ "ignore": true }, { - "__docId__": 1911, + "__docId__": 1919, "kind": "function", "name": "isEar", "memberof": "src/plugins/lib/earcut.js", @@ -37557,7 +37773,7 @@ "ignore": true }, { - "__docId__": 1912, + "__docId__": 1920, "kind": "function", "name": "isEarHashed", "memberof": "src/plugins/lib/earcut.js", @@ -37606,7 +37822,7 @@ "ignore": true }, { - "__docId__": 1913, + "__docId__": 1921, "kind": "function", "name": "cureLocalIntersections", "memberof": "src/plugins/lib/earcut.js", @@ -37649,7 +37865,7 @@ "ignore": true }, { - "__docId__": 1914, + "__docId__": 1922, "kind": "function", "name": "splitEarcut", "memberof": "src/plugins/lib/earcut.js", @@ -37706,7 +37922,7 @@ "ignore": true }, { - "__docId__": 1915, + "__docId__": 1923, "kind": "function", "name": "eliminateHoles", "memberof": "src/plugins/lib/earcut.js", @@ -37755,7 +37971,7 @@ "ignore": true }, { - "__docId__": 1916, + "__docId__": 1924, "kind": "function", "name": "compareX", "memberof": "src/plugins/lib/earcut.js", @@ -37792,7 +38008,7 @@ "ignore": true }, { - "__docId__": 1917, + "__docId__": 1925, "kind": "function", "name": "eliminateHole", "memberof": "src/plugins/lib/earcut.js", @@ -37825,7 +38041,7 @@ "ignore": true }, { - "__docId__": 1918, + "__docId__": 1926, "kind": "function", "name": "findHoleBridge", "memberof": "src/plugins/lib/earcut.js", @@ -37862,7 +38078,7 @@ "ignore": true }, { - "__docId__": 1919, + "__docId__": 1927, "kind": "function", "name": "sectorContainsSector", "memberof": "src/plugins/lib/earcut.js", @@ -37899,7 +38115,7 @@ "ignore": true }, { - "__docId__": 1920, + "__docId__": 1928, "kind": "function", "name": "indexCurve", "memberof": "src/plugins/lib/earcut.js", @@ -37944,7 +38160,7 @@ "ignore": true }, { - "__docId__": 1921, + "__docId__": 1929, "kind": "function", "name": "sortLinked", "memberof": "src/plugins/lib/earcut.js", @@ -37975,7 +38191,7 @@ "ignore": true }, { - "__docId__": 1922, + "__docId__": 1930, "kind": "function", "name": "zOrder", "memberof": "src/plugins/lib/earcut.js", @@ -38030,7 +38246,7 @@ "ignore": true }, { - "__docId__": 1923, + "__docId__": 1931, "kind": "function", "name": "getLeftmost", "memberof": "src/plugins/lib/earcut.js", @@ -38061,7 +38277,7 @@ "ignore": true }, { - "__docId__": 1924, + "__docId__": 1932, "kind": "function", "name": "pointInTriangle", "memberof": "src/plugins/lib/earcut.js", @@ -38134,7 +38350,7 @@ "ignore": true }, { - "__docId__": 1925, + "__docId__": 1933, "kind": "function", "name": "isValidDiagonal", "memberof": "src/plugins/lib/earcut.js", @@ -38171,7 +38387,7 @@ "ignore": true }, { - "__docId__": 1926, + "__docId__": 1934, "kind": "function", "name": "area", "memberof": "src/plugins/lib/earcut.js", @@ -38214,7 +38430,7 @@ "ignore": true }, { - "__docId__": 1927, + "__docId__": 1935, "kind": "function", "name": "equals", "memberof": "src/plugins/lib/earcut.js", @@ -38251,7 +38467,7 @@ "ignore": true }, { - "__docId__": 1928, + "__docId__": 1936, "kind": "function", "name": "intersects", "memberof": "src/plugins/lib/earcut.js", @@ -38300,7 +38516,7 @@ "ignore": true }, { - "__docId__": 1929, + "__docId__": 1937, "kind": "function", "name": "onSegment", "memberof": "src/plugins/lib/earcut.js", @@ -38343,7 +38559,7 @@ "ignore": true }, { - "__docId__": 1930, + "__docId__": 1938, "kind": "function", "name": "sign", "memberof": "src/plugins/lib/earcut.js", @@ -38374,7 +38590,7 @@ "ignore": true }, { - "__docId__": 1931, + "__docId__": 1939, "kind": "function", "name": "intersectsPolygon", "memberof": "src/plugins/lib/earcut.js", @@ -38411,7 +38627,7 @@ "ignore": true }, { - "__docId__": 1932, + "__docId__": 1940, "kind": "function", "name": "locallyInside", "memberof": "src/plugins/lib/earcut.js", @@ -38448,7 +38664,7 @@ "ignore": true }, { - "__docId__": 1933, + "__docId__": 1941, "kind": "function", "name": "middleInside", "memberof": "src/plugins/lib/earcut.js", @@ -38485,7 +38701,7 @@ "ignore": true }, { - "__docId__": 1934, + "__docId__": 1942, "kind": "function", "name": "splitPolygon", "memberof": "src/plugins/lib/earcut.js", @@ -38522,7 +38738,7 @@ "ignore": true }, { - "__docId__": 1935, + "__docId__": 1943, "kind": "function", "name": "insertNode", "memberof": "src/plugins/lib/earcut.js", @@ -38571,7 +38787,7 @@ "ignore": true }, { - "__docId__": 1936, + "__docId__": 1944, "kind": "function", "name": "removeNode", "memberof": "src/plugins/lib/earcut.js", @@ -38598,7 +38814,7 @@ "ignore": true }, { - "__docId__": 1937, + "__docId__": 1945, "kind": "function", "name": "Node", "memberof": "src/plugins/lib/earcut.js", @@ -38637,7 +38853,7 @@ "ignore": true }, { - "__docId__": 1938, + "__docId__": 1946, "kind": "function", "name": "deviation", "memberof": "src/plugins/lib/earcut.js", @@ -38686,7 +38902,7 @@ "ignore": true }, { - "__docId__": 1939, + "__docId__": 1947, "kind": "function", "name": "signedArea", "memberof": "src/plugins/lib/earcut.js", @@ -38735,7 +38951,7 @@ "ignore": true }, { - "__docId__": 1940, + "__docId__": 1948, "kind": "function", "name": "flatten", "memberof": "src/plugins/lib/earcut.js", @@ -38766,7 +38982,7 @@ "ignore": true }, { - "__docId__": 1941, + "__docId__": 1949, "kind": "function", "name": "earcut", "memberof": "src/plugins/lib/earcut.js", @@ -38808,18 +39024,18 @@ } }, { - "__docId__": 1942, + "__docId__": 1950, "kind": "file", "name": "src/plugins/lib/html/Dot.js", "content": "/** @private */\nclass Dot {\n\n constructor(parentElement, cfg = {}) {\n\n this._highlightClass = \"viewer-ruler-dot-highlighted\";\n\n this._x = 0;\n this._y = 0;\n\n this._dot = document.createElement('div');\n this._dot.className += this._dot.className ? ' viewer-ruler-dot' : 'viewer-ruler-dot';\n\n this._dotClickable = document.createElement('div');\n this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';\n\n this._visible = !!cfg.visible;\n this._culled = false;\n\n var dot = this._dot;\n var dotStyle = dot.style;\n dotStyle[\"border-radius\"] = 25 + \"px\";\n dotStyle.border = \"solid 2px white\";\n dotStyle.background = \"lightgreen\";\n dotStyle.position = \"absolute\";\n dotStyle[\"z-index\"] = cfg.zIndex === undefined ? \"40000005\" : cfg.zIndex ;\n dotStyle.width = 8 + \"px\";\n dotStyle.height = 8 + \"px\";\n dotStyle.visibility = cfg.visible !== false ? \"visible\" : \"hidden\";\n dotStyle.top = 0 + \"px\";\n dotStyle.left = 0 + \"px\";\n dotStyle[\"box-shadow\"] = \"0 2px 5px 0 #182A3D;\";\n dotStyle[\"opacity\"] = 1.0;\n dotStyle[\"pointer-events\"] = \"none\";\n if (cfg.onContextMenu) {\n // dotStyle[\"cursor\"] = \"context-menu\";\n }\n parentElement.appendChild(dot);\n\n var dotClickable = this._dotClickable;\n var dotClickableStyle = dotClickable.style;\n dotClickableStyle[\"border-radius\"] = 35 + \"px\";\n dotClickableStyle.border = \"solid 10px white\";\n dotClickableStyle.position = \"absolute\";\n dotClickableStyle[\"z-index\"] = cfg.zIndex === undefined ? \"40000007\" : (cfg.zIndex + 1);\n dotClickableStyle.width = 8 + \"px\";\n dotClickableStyle.height = 8 + \"px\";\n dotClickableStyle.visibility = \"visible\";\n dotClickableStyle.top = 0 + \"px\";\n dotClickableStyle.left = 0 + \"px\";\n dotClickableStyle[\"opacity\"] = 0.0;\n dotClickableStyle[\"pointer-events\"] = \"none\";\n if (cfg.onContextMenu) {\n // dotClickableStyle[\"cursor\"] = \"context-menu\";\n }\n parentElement.appendChild(dotClickable);\n\n dotClickable.addEventListener('click', (event) => {\n parentElement.dispatchEvent(new MouseEvent('mouseover', event));\n });\n\n if (cfg.onMouseOver) {\n dotClickable.addEventListener('mouseover', (event) => {\n cfg.onMouseOver(event, this);\n parentElement.dispatchEvent(new MouseEvent('mouseover', event));\n });\n }\n\n if (cfg.onMouseLeave) {\n dotClickable.addEventListener('mouseleave', (event) => {\n cfg.onMouseLeave(event, this);\n });\n }\n\n if (cfg.onMouseWheel) {\n dotClickable.addEventListener('wheel', (event) => {\n cfg.onMouseWheel(event, this);\n });\n }\n\n if (cfg.onMouseDown) {\n dotClickable.addEventListener('mousedown', (event) => {\n cfg.onMouseDown(event, this);\n });\n }\n\n if (cfg.onMouseUp) {\n dotClickable.addEventListener('mouseup', (event) => {\n cfg.onMouseUp(event, this);\n });\n }\n\n if (cfg.onMouseMove) {\n dotClickable.addEventListener('mousemove', (event) => {\n cfg.onMouseMove(event, this);\n });\n }\n\n if (cfg.onContextMenu) {\n dotClickable.addEventListener('contextmenu', (event) => {\n cfg.onContextMenu(event, this);\n event.preventDefault();\n event.stopPropagation();\n });\n }\n \n this.setPos(cfg.x || 0, cfg.y || 0);\n this.setFillColor(cfg.fillColor);\n this.setBorderColor(cfg.borderColor);\n }\n\n setPos(x, y) {\n this._x = x;\n this._y = y;\n var dotStyle = this._dot.style;\n dotStyle[\"left\"] = (Math.round(x) - 4) + 'px';\n dotStyle[\"top\"] = (Math.round(y) - 4) + 'px';\n\n var dotClickableStyle = this._dotClickable.style;\n dotClickableStyle[\"left\"] = (Math.round(x) - 9) + 'px';\n dotClickableStyle[\"top\"] = (Math.round(y) - 9) + 'px';\n }\n\n setFillColor(color) {\n this._dot.style.background = color || \"lightgreen\";\n }\n\n setBorderColor(color) {\n this._dot.style.border = \"solid 2px\" + (color || \"black\");\n }\n\n setOpacity(opacity) {\n this._dot.style.opacity = opacity;\n }\n\n setVisible(visible) {\n if (this._visible === visible) {\n return;\n }\n this._visible = !!visible;\n this._dot.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setCulled(culled) {\n if (this._culled === culled) {\n return;\n }\n this._culled = !!culled;\n this._dot.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setClickable(clickable) {\n this._dotClickable.style[\"pointer-events\"] = (!!clickable) ? \"all\" : \"none\";\n }\n\n setHighlighted(highlighted) {\n if (this._highlighted === highlighted) {\n return;\n }\n this._highlighted = !!highlighted;\n if (this._highlighted) {\n this._dot.classList.add(this._highlightClass);\n } else {\n this._dot.classList.remove(this._highlightClass);\n }\n }\n \n destroy() {\n this.setVisible(false);\n if (this._dot.parentElement) {\n this._dot.parentElement.removeChild(this._dot);\n }\n if (this._dotClickable.parentElement) {\n this._dotClickable.parentElement.removeChild(this._dotClickable);\n }\n }\n}\n\nexport {Dot};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/lib/html/Dot.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/lib/html/Dot.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1943, + "__docId__": 1951, "kind": "class", "name": "Dot", "memberof": "src/plugins/lib/html/Dot.js", @@ -38835,7 +39051,7 @@ "ignore": true }, { - "__docId__": 1944, + "__docId__": 1952, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38849,7 +39065,7 @@ "undocument": true }, { - "__docId__": 1945, + "__docId__": 1953, "kind": "member", "name": "_highlightClass", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38867,7 +39083,7 @@ } }, { - "__docId__": 1946, + "__docId__": 1954, "kind": "member", "name": "_x", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38885,7 +39101,7 @@ } }, { - "__docId__": 1947, + "__docId__": 1955, "kind": "member", "name": "_y", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38903,7 +39119,7 @@ } }, { - "__docId__": 1948, + "__docId__": 1956, "kind": "member", "name": "_dot", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38921,7 +39137,7 @@ } }, { - "__docId__": 1949, + "__docId__": 1957, "kind": "member", "name": "_dotClickable", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38939,7 +39155,7 @@ } }, { - "__docId__": 1950, + "__docId__": 1958, "kind": "member", "name": "_visible", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38957,7 +39173,7 @@ } }, { - "__docId__": 1951, + "__docId__": 1959, "kind": "member", "name": "_culled", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -38975,7 +39191,7 @@ } }, { - "__docId__": 1952, + "__docId__": 1960, "kind": "method", "name": "setPos", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39004,7 +39220,7 @@ "return": null }, { - "__docId__": 1955, + "__docId__": 1963, "kind": "method", "name": "setFillColor", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39027,7 +39243,7 @@ "return": null }, { - "__docId__": 1956, + "__docId__": 1964, "kind": "method", "name": "setBorderColor", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39050,7 +39266,7 @@ "return": null }, { - "__docId__": 1957, + "__docId__": 1965, "kind": "method", "name": "setOpacity", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39073,7 +39289,7 @@ "return": null }, { - "__docId__": 1958, + "__docId__": 1966, "kind": "method", "name": "setVisible", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39096,7 +39312,7 @@ "return": null }, { - "__docId__": 1960, + "__docId__": 1968, "kind": "method", "name": "setCulled", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39119,7 +39335,7 @@ "return": null }, { - "__docId__": 1962, + "__docId__": 1970, "kind": "method", "name": "setClickable", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39142,7 +39358,7 @@ "return": null }, { - "__docId__": 1963, + "__docId__": 1971, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39165,7 +39381,7 @@ "return": null }, { - "__docId__": 1964, + "__docId__": 1972, "kind": "member", "name": "_highlighted", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39183,7 +39399,7 @@ } }, { - "__docId__": 1965, + "__docId__": 1973, "kind": "method", "name": "destroy", "memberof": "src/plugins/lib/html/Dot.js~Dot", @@ -39199,18 +39415,18 @@ "return": null }, { - "__docId__": 1966, + "__docId__": 1974, "kind": "file", "name": "src/plugins/lib/html/Label.js", "content": "/** @private */\nclass Label {\n\n constructor(parentElement, cfg = {}) {\n\n this._highlightClass = \"viewer-ruler-label-highlighted\";\n\n this._prefix = cfg.prefix || \"\";\n this._x = 0;\n this._y = 0;\n this._visible = true;\n this._culled = false;\n\n this._label = document.createElement('div');\n this._label.className += this._label.className ? ' viewer-ruler-label' : 'viewer-ruler-label';\n\n var label = this._label;\n var style = label.style;\n\n style[\"border-radius\"] = 5 + \"px\";\n style.color = \"white\";\n style.padding = \"4px\";\n style.border = \"solid 1px\";\n style.background = \"lightgreen\";\n style.position = \"absolute\";\n style[\"z-index\"] = cfg.zIndex === undefined ? \"5000005\" : cfg.zIndex;\n style.width = \"auto\";\n style.height = \"auto\";\n style.visibility = \"visible\";\n style.top = 0 + \"px\";\n style.left = 0 + \"px\";\n style[\"pointer-events\"] = \"all\";\n style[\"opacity\"] = 1.0;\n if (cfg.onContextMenu) {\n // style[\"cursor\"] = \"context-menu\";\n }\n label.innerText = \"\";\n\n parentElement.appendChild(label);\n\n this.setPos(cfg.x || 0, cfg.y || 0);\n this.setFillColor(cfg.fillColor);\n this.setBorderColor(cfg.fillColor);\n this.setText(cfg.text);\n\n if (cfg.onMouseOver) {\n label.addEventListener('mouseover', (event) => {\n cfg.onMouseOver(event, this);\n event.preventDefault();\n });\n }\n\n if (cfg.onMouseLeave) {\n label.addEventListener('mouseleave', (event) => {\n cfg.onMouseLeave(event, this);\n event.preventDefault();\n });\n }\n\n if (cfg.onMouseWheel) {\n label.addEventListener('wheel', (event) => {\n cfg.onMouseWheel(event, this);\n });\n }\n\n if (cfg.onMouseDown) {\n label.addEventListener('mousedown', (event) => {\n cfg.onMouseDown(event, this);\n event.stopPropagation();\n });\n }\n\n if (cfg.onMouseUp) {\n label.addEventListener('mouseup', (event) => {\n cfg.onMouseUp(event, this);\n event.stopPropagation();\n });\n }\n\n if (cfg.onMouseMove) {\n label.addEventListener('mousemove', (event) => {\n cfg.onMouseMove(event, this);\n });\n }\n\n if (cfg.onContextMenu) {\n label.addEventListener('contextmenu', (event) => {\n cfg.onContextMenu(event, this);\n event.preventDefault();\n event.stopPropagation();\n console.log(\"Label context menu\")\n });\n }\n }\n\n setPos(x, y) {\n this._x = x;\n this._y = y;\n var style = this._label.style;\n style[\"left\"] = (Math.round(x) - 20) + 'px';\n style[\"top\"] = (Math.round(y) - 12) + 'px';\n }\n\n setPosOnWire(x1, y1, x2, y2) {\n var x = x1 + ((x2 - x1) * 0.5);\n var y = y1 + ((y2 - y1) * 0.5);\n var style = this._label.style;\n style[\"left\"] = (Math.round(x) - 20) + 'px';\n style[\"top\"] = (Math.round(y) - 12) + 'px';\n }\n\n setPosBetweenWires(x1, y1, x2, y2, x3, y3) {\n var x = (x1 + x2 + x3) / 3;\n var y = (y1 + y2 + y3) / 3;\n var style = this._label.style;\n style[\"left\"] = (Math.round(x) - 20) + 'px';\n style[\"top\"] = (Math.round(y) - 12) + 'px';\n }\n\n setText(text) {\n this._label.innerHTML = this._prefix + (text || \"\");\n }\n\n setFillColor(color) {\n this._fillColor = color || \"lightgreen\";\n this._label.style.background =this._fillColor;\n }\n\n setBorderColor(color) {\n this._borderColor = color || \"black\";\n this._label.style.border = \"solid 1px \" + this._borderColor;\n }\n\n setOpacity(opacity) {\n this._label.style.opacity = opacity;\n }\n\n setVisible(visible) {\n if (this._visible === visible) {\n return;\n }\n this._visible = !!visible;\n this._label.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setCulled(culled) {\n if (this._culled === culled) {\n return;\n }\n this._culled = !!culled;\n this._label.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setHighlighted(highlighted) {\n if (this._highlighted === highlighted) {\n return;\n }\n this._highlighted = !!highlighted;\n if (this._highlighted) {\n this._label.classList.add(this._highlightClass);\n } else {\n this._label.classList.remove(this._highlightClass);\n }\n }\n\n setClickable(clickable) {\n this._label.style[\"pointer-events\"] = (!!clickable) ? \"all\" : \"none\";\n }\n\n destroy() {\n if (this._label.parentElement) {\n this._label.parentElement.removeChild(this._label);\n }\n }\n}\n\nexport {Label};\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/lib/html/Label.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/lib/html/Label.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1967, + "__docId__": 1975, "kind": "class", "name": "Label", "memberof": "src/plugins/lib/html/Label.js", @@ -39226,7 +39442,7 @@ "ignore": true }, { - "__docId__": 1968, + "__docId__": 1976, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39240,7 +39456,7 @@ "undocument": true }, { - "__docId__": 1969, + "__docId__": 1977, "kind": "member", "name": "_highlightClass", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39258,7 +39474,7 @@ } }, { - "__docId__": 1970, + "__docId__": 1978, "kind": "member", "name": "_prefix", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39276,7 +39492,7 @@ } }, { - "__docId__": 1971, + "__docId__": 1979, "kind": "member", "name": "_x", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39294,7 +39510,7 @@ } }, { - "__docId__": 1972, + "__docId__": 1980, "kind": "member", "name": "_y", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39312,7 +39528,7 @@ } }, { - "__docId__": 1973, + "__docId__": 1981, "kind": "member", "name": "_visible", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39330,7 +39546,7 @@ } }, { - "__docId__": 1974, + "__docId__": 1982, "kind": "member", "name": "_culled", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39348,7 +39564,7 @@ } }, { - "__docId__": 1975, + "__docId__": 1983, "kind": "member", "name": "_label", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39366,7 +39582,7 @@ } }, { - "__docId__": 1976, + "__docId__": 1984, "kind": "method", "name": "setPos", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39395,7 +39611,7 @@ "return": null }, { - "__docId__": 1979, + "__docId__": 1987, "kind": "method", "name": "setPosOnWire", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39436,7 +39652,7 @@ "return": null }, { - "__docId__": 1980, + "__docId__": 1988, "kind": "method", "name": "setPosBetweenWires", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39489,7 +39705,7 @@ "return": null }, { - "__docId__": 1981, + "__docId__": 1989, "kind": "method", "name": "setText", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39512,7 +39728,7 @@ "return": null }, { - "__docId__": 1982, + "__docId__": 1990, "kind": "method", "name": "setFillColor", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39535,7 +39751,7 @@ "return": null }, { - "__docId__": 1983, + "__docId__": 1991, "kind": "member", "name": "_fillColor", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39553,7 +39769,7 @@ } }, { - "__docId__": 1984, + "__docId__": 1992, "kind": "method", "name": "setBorderColor", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39576,7 +39792,7 @@ "return": null }, { - "__docId__": 1985, + "__docId__": 1993, "kind": "member", "name": "_borderColor", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39594,7 +39810,7 @@ } }, { - "__docId__": 1986, + "__docId__": 1994, "kind": "method", "name": "setOpacity", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39617,7 +39833,7 @@ "return": null }, { - "__docId__": 1987, + "__docId__": 1995, "kind": "method", "name": "setVisible", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39640,7 +39856,7 @@ "return": null }, { - "__docId__": 1989, + "__docId__": 1997, "kind": "method", "name": "setCulled", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39663,7 +39879,7 @@ "return": null }, { - "__docId__": 1991, + "__docId__": 1999, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39686,7 +39902,7 @@ "return": null }, { - "__docId__": 1992, + "__docId__": 2000, "kind": "member", "name": "_highlighted", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39704,7 +39920,7 @@ } }, { - "__docId__": 1993, + "__docId__": 2001, "kind": "method", "name": "setClickable", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39727,7 +39943,7 @@ "return": null }, { - "__docId__": 1994, + "__docId__": 2002, "kind": "method", "name": "destroy", "memberof": "src/plugins/lib/html/Label.js~Label", @@ -39743,18 +39959,18 @@ "return": null }, { - "__docId__": 1995, + "__docId__": 2003, "kind": "file", "name": "src/plugins/lib/html/Wire.js", "content": "/** @private */\nclass Wire {\n\n constructor(parentElement, cfg = {}) {\n\n this._color = cfg.color || \"black\";\n this._highlightClass = \"viewer-ruler-wire-highlighted\";\n\n this._wire = document.createElement('div');\n this._wire.className += this._wire.className ? ' viewer-ruler-wire' : 'viewer-ruler-wire';\n\n this._wireClickable = document.createElement('div');\n this._wireClickable.className += this._wireClickable.className ? ' viewer-ruler-wire-clickable' : 'viewer-ruler-wire-clickable';\n\n this._thickness = cfg.thickness || 1.0;\n this._thicknessClickable = cfg.thicknessClickable || 6.0;\n\n this._visible = true;\n this._culled = false;\n\n var wire = this._wire;\n var wireStyle = wire.style;\n\n wireStyle.border = \"solid \" + this._thickness + \"px \" + this._color\n wireStyle.position = \"absolute\";\n wireStyle[\"z-index\"] = cfg.zIndex === undefined ? \"2000001\" : cfg.zIndex;\n wireStyle.width = 0 + \"px\";\n wireStyle.height = 0 + \"px\";\n wireStyle.visibility = \"visible\";\n wireStyle.top = 0 + \"px\";\n wireStyle.left = 0 + \"px\";\n wireStyle['-webkit-transform-origin'] = \"0 0\";\n wireStyle['-moz-transform-origin'] = \"0 0\";\n wireStyle['-ms-transform-origin'] = \"0 0\";\n wireStyle['-o-transform-origin'] = \"0 0\";\n wireStyle['transform-origin'] = \"0 0\";\n wireStyle['-webkit-transform'] = 'rotate(0deg)';\n wireStyle['-moz-transform'] = 'rotate(0deg)';\n wireStyle['-ms-transform'] = 'rotate(0deg)';\n wireStyle['-o-transform'] = 'rotate(0deg)';\n wireStyle['transform'] = 'rotate(0deg)';\n wireStyle[\"opacity\"] = 1.0;\n wireStyle[\"pointer-events\"] = \"none\";\n if (cfg.onContextMenu) {\n // wireStyle[\"cursor\"] = \"context-menu\";\n }\n\n parentElement.appendChild(wire);\n\n var wireClickable = this._wireClickable;\n var wireClickableStyle = wireClickable.style;\n\n wireClickableStyle.border = \"solid \" + this._thicknessClickable + \"px \" + this._color;\n wireClickableStyle.position = \"absolute\";\n wireClickableStyle[\"z-index\"] = cfg.zIndex === undefined ? \"2000002\" : (cfg.zIndex + 1);\n wireClickableStyle.width = 0 + \"px\";\n wireClickableStyle.height = 0 + \"px\";\n wireClickableStyle.visibility = \"visible\";\n wireClickableStyle.top = 0 + \"px\";\n wireClickableStyle.left = 0 + \"px\";\n // wireClickableStyle[\"pointer-events\"] = \"none\";\n wireClickableStyle['-webkit-transform-origin'] = \"0 0\";\n wireClickableStyle['-moz-transform-origin'] = \"0 0\";\n wireClickableStyle['-ms-transform-origin'] = \"0 0\";\n wireClickableStyle['-o-transform-origin'] = \"0 0\";\n wireClickableStyle['transform-origin'] = \"0 0\";\n wireClickableStyle['-webkit-transform'] = 'rotate(0deg)';\n wireClickableStyle['-moz-transform'] = 'rotate(0deg)';\n wireClickableStyle['-ms-transform'] = 'rotate(0deg)';\n wireClickableStyle['-o-transform'] = 'rotate(0deg)';\n wireClickableStyle['transform'] = 'rotate(0deg)';\n wireClickableStyle[\"opacity\"] = 0.0;\n wireClickableStyle[\"pointer-events\"] = \"none\";\n if (cfg.onContextMenu) {\n //wireClickableStyle[\"cursor\"] = \"context-menu\";\n }\n\n parentElement.appendChild(wireClickable);\n\n if (cfg.onMouseOver) {\n wireClickable.addEventListener('mouseover', (event) => {\n cfg.onMouseOver(event, this);\n });\n }\n\n if (cfg.onMouseLeave) {\n wireClickable.addEventListener('mouseleave', (event) => {\n cfg.onMouseLeave(event, this);\n });\n }\n\n if (cfg.onMouseWheel) {\n wireClickable.addEventListener('wheel', (event) => {\n cfg.onMouseWheel(event, this);\n });\n }\n\n if (cfg.onMouseDown) {\n wireClickable.addEventListener('mousedown', (event) => {\n cfg.onMouseDown(event, this);\n });\n }\n\n if (cfg.onMouseUp) {\n wireClickable.addEventListener('mouseup', (event) => {\n cfg.onMouseUp(event, this);\n });\n }\n\n if (cfg.onMouseMove) {\n wireClickable.addEventListener('mousemove', (event) => {\n cfg.onMouseMove(event, this);\n });\n }\n\n if (cfg.onContextMenu) {\n wireClickable.addEventListener('contextmenu', (event) => {\n cfg.onContextMenu(event, this);\n event.preventDefault();\n event.stopPropagation();\n });\n }\n\n this._x1 = 0;\n this._y1 = 0;\n this._x2 = 0;\n this._y2 = 0;\n\n this._update();\n }\n\n get visible() {\n return this._wire.style.visibility === \"visible\";\n }\n\n _update() {\n\n var length = Math.abs(Math.sqrt((this._x1 - this._x2) * (this._x1 - this._x2) + (this._y1 - this._y2) * (this._y1 - this._y2)));\n var angle = Math.atan2(this._y2 - this._y1, this._x2 - this._x1) * 180.0 / Math.PI;\n\n var wireStyle = this._wire.style;\n wireStyle[\"width\"] = Math.round(length) + 'px';\n wireStyle[\"left\"] = Math.round(this._x1) + 'px';\n wireStyle[\"top\"] = Math.round(this._y1) + 'px';\n wireStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';\n wireStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';\n wireStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';\n wireStyle['-o-transform'] = 'rotate(' + angle + 'deg)';\n wireStyle['transform'] = 'rotate(' + angle + 'deg)';\n\n var wireClickableStyle = this._wireClickable.style;\n wireClickableStyle[\"width\"] = Math.round(length) + 'px';\n wireClickableStyle[\"left\"] = Math.round(this._x1) + 'px';\n wireClickableStyle[\"top\"] = Math.round(this._y1) + 'px';\n wireClickableStyle['-webkit-transform'] = 'rotate(' + angle + 'deg)';\n wireClickableStyle['-moz-transform'] = 'rotate(' + angle + 'deg)';\n wireClickableStyle['-ms-transform'] = 'rotate(' + angle + 'deg)';\n wireClickableStyle['-o-transform'] = 'rotate(' + angle + 'deg)';\n wireClickableStyle['transform'] = 'rotate(' + angle + 'deg)';\n }\n\n setStartAndEnd(x1, y1, x2, y2) {\n this._x1 = x1;\n this._y1 = y1;\n this._x2 = x2;\n this._y2 = y2;\n this._update();\n }\n\n setColor(color) {\n this._color = color || \"black\";\n this._wire.style.border = \"solid \" + this._thickness + \"px \" + this._color;\n }\n\n setOpacity(opacity) {\n this._wire.style.opacity = opacity;\n }\n\n setVisible(visible) {\n if (this._visible === visible) {\n return;\n }\n this._visible = !!visible;\n this._wire.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setCulled(culled) {\n if (this._culled === culled) {\n return;\n }\n this._culled = !!culled;\n this._wire.style.visibility = this._visible && !this._culled ? \"visible\" : \"hidden\";\n }\n\n setClickable(clickable) {\n this._wireClickable.style[\"pointer-events\"] = (!!clickable) ? \"all\" : \"none\";\n }\n\n setHighlighted(highlighted) {\n if (this._highlighted === highlighted) {\n return;\n }\n this._highlighted = !!highlighted;\n if (this._highlighted) {\n this._wire.classList.add(this._highlightClass);\n } else {\n this._wire.classList.remove(this._highlightClass);\n }\n }\n\n destroy(visible) {\n if (this._wire.parentElement) {\n this._wire.parentElement.removeChild(this._wire);\n }\n if (this._wireClickable.parentElement) {\n this._wireClickable.parentElement.removeChild(this._wireClickable);\n }\n }\n}\n\nexport {Wire};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/plugins/lib/html/Wire.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/plugins/lib/html/Wire.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 1996, + "__docId__": 2004, "kind": "class", "name": "Wire", "memberof": "src/plugins/lib/html/Wire.js", @@ -39770,7 +39986,7 @@ "ignore": true }, { - "__docId__": 1997, + "__docId__": 2005, "kind": "constructor", "name": "constructor", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39784,7 +40000,7 @@ "undocument": true }, { - "__docId__": 1998, + "__docId__": 2006, "kind": "member", "name": "_color", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39802,7 +40018,7 @@ } }, { - "__docId__": 1999, + "__docId__": 2007, "kind": "member", "name": "_highlightClass", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39820,7 +40036,7 @@ } }, { - "__docId__": 2000, + "__docId__": 2008, "kind": "member", "name": "_wire", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39838,7 +40054,7 @@ } }, { - "__docId__": 2001, + "__docId__": 2009, "kind": "member", "name": "_wireClickable", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39856,7 +40072,7 @@ } }, { - "__docId__": 2002, + "__docId__": 2010, "kind": "member", "name": "_thickness", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39874,7 +40090,7 @@ } }, { - "__docId__": 2003, + "__docId__": 2011, "kind": "member", "name": "_thicknessClickable", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39892,7 +40108,7 @@ } }, { - "__docId__": 2004, + "__docId__": 2012, "kind": "member", "name": "_visible", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39910,7 +40126,7 @@ } }, { - "__docId__": 2005, + "__docId__": 2013, "kind": "member", "name": "_culled", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39928,7 +40144,7 @@ } }, { - "__docId__": 2006, + "__docId__": 2014, "kind": "member", "name": "_x1", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39946,7 +40162,7 @@ } }, { - "__docId__": 2007, + "__docId__": 2015, "kind": "member", "name": "_y1", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39964,7 +40180,7 @@ } }, { - "__docId__": 2008, + "__docId__": 2016, "kind": "member", "name": "_x2", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -39982,7 +40198,7 @@ } }, { - "__docId__": 2009, + "__docId__": 2017, "kind": "member", "name": "_y2", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40000,7 +40216,7 @@ } }, { - "__docId__": 2010, + "__docId__": 2018, "kind": "get", "name": "visible", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40019,7 +40235,7 @@ } }, { - "__docId__": 2011, + "__docId__": 2019, "kind": "method", "name": "_update", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40036,7 +40252,7 @@ "return": null }, { - "__docId__": 2012, + "__docId__": 2020, "kind": "method", "name": "setStartAndEnd", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40077,7 +40293,7 @@ "return": null }, { - "__docId__": 2017, + "__docId__": 2025, "kind": "method", "name": "setColor", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40100,7 +40316,7 @@ "return": null }, { - "__docId__": 2019, + "__docId__": 2027, "kind": "method", "name": "setOpacity", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40123,7 +40339,7 @@ "return": null }, { - "__docId__": 2020, + "__docId__": 2028, "kind": "method", "name": "setVisible", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40146,7 +40362,7 @@ "return": null }, { - "__docId__": 2022, + "__docId__": 2030, "kind": "method", "name": "setCulled", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40169,7 +40385,7 @@ "return": null }, { - "__docId__": 2024, + "__docId__": 2032, "kind": "method", "name": "setClickable", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40192,7 +40408,7 @@ "return": null }, { - "__docId__": 2025, + "__docId__": 2033, "kind": "method", "name": "setHighlighted", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40215,7 +40431,7 @@ "return": null }, { - "__docId__": 2026, + "__docId__": 2034, "kind": "member", "name": "_highlighted", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40233,7 +40449,7 @@ } }, { - "__docId__": 2027, + "__docId__": 2035, "kind": "method", "name": "destroy", "memberof": "src/plugins/lib/html/Wire.js~Wire", @@ -40256,18 +40472,18 @@ "return": null }, { - "__docId__": 2028, + "__docId__": 2036, "kind": "file", "name": "src/viewer/Configs.js", "content": "import {math} from \"./scene/math/math.js\";\n\nlet maxDataTextureHeight = 1 << 16;\nlet maxGeometryBatchSize = 5000000\n\n/**\n * Manages global configurations for all {@link Viewer}s.\n *\n * ## Example\n *\n * In the example below, we'll disable xeokit's double-precision support, which gives a performance and memory boost\n * on low-power devices, but also means that we can no longer render double-precision models without jittering.\n *\n * That's OK if we know that we're not going to view models that are geographically vast, or offset far from the World coordinate origin.\n *\n * [[Run this example](/examples/index.html#Configs_disableDoublePrecisionAndRAF)]\n *\n * ````javascript\n * import {Configs, Viewer, XKTLoaderPlugin} from \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js\";\n *\n * // Access xeoit-sdk global configs.\n * // We typically set configs only before we create any Viewers.\n * const configs = new Configs();\n *\n * // Disable 64-bit precision for extra speed.\n * // Only set this config once, before you create any Viewers.\n * configs.doublePrecisionEnabled = false;\n *\n * // Create a Viewer, to which our configs apply\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [-3.933, 2.855, 27.018];\n * viewer.camera.look = [4.400, 3.724, 8.899];\n * viewer.camera.up = [-0.018, 0.999, 0.039];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"../assets/models/xkt/v8/ifc/Duplex.ifc.xkt\"\n * });\n * ````\n */\nexport class Configs {\n\n /**\n * Creates a Configs.\n */\n constructor() {\n\n }\n\n /**\n * Sets whether double precision mode is enabled for Viewers.\n *\n * When double precision mode is enabled (default), Viewers will accurately render models that contain\n * double-precision coordinates, without jittering.\n *\n * Internally, double precision incurs extra performance and memory overhead, so if we're certain that\n * we're not going to render models that rely on double-precision coordinates, then it's a good idea to disable\n * it, especially on low-power devices.\n *\n * This should only be set once, before creating any Viewers.\n *\n * @returns {Boolean}\n */\n set doublePrecisionEnabled(doublePrecision) {\n math.setDoublePrecisionEnabled(doublePrecision);\n }\n\n /**\n * Gets whether double precision mode is enabled for all Viewers.\n *\n * @returns {Boolean}\n */\n get doublePrecisionEnabled() {\n return math.getDoublePrecisionEnabled();\n }\n\n /**\n * Sets the maximum data texture height.\n *\n * Should be a multiple of 1024. Default is 4096, which is the maximum allowed value.\n */\n set maxDataTextureHeight(value) {\n value = Math.ceil(value / 1024) * 1024;\n if (value > 4096) {\n value = 4096;\n } else if (value < 1024) {\n value = 1024;\n }\n maxDataTextureHeight = value;\n }\n\n /**\n * Sets maximum data texture height.\n * @returns {*|number}\n */\n get maxDataTextureHeight() {\n return maxDataTextureHeight;\n }\n\n /**\n * Sets the maximum batched geometry VBO size.\n *\n * Default value is 5000000, which is the maximum size.\n *\n * Minimum size is 100000.\n */\n set maxGeometryBatchSize(value) {\n if (value < 100000) {\n value = 100000;\n } else if (value > 5000000) {\n value = 5000000;\n }\n maxGeometryBatchSize = value;\n }\n\n /**\n * Gets the maximum batched geometry VBO size.\n */\n get maxGeometryBatchSize() {\n return maxGeometryBatchSize;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/Configs.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/Configs.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2029, + "__docId__": 2037, "kind": "variable", "name": "maxDataTextureHeight", "memberof": "src/viewer/Configs.js", @@ -40288,7 +40504,7 @@ "ignore": true }, { - "__docId__": 2030, + "__docId__": 2038, "kind": "variable", "name": "maxGeometryBatchSize", "memberof": "src/viewer/Configs.js", @@ -40309,7 +40525,7 @@ "ignore": true }, { - "__docId__": 2031, + "__docId__": 2039, "kind": "class", "name": "Configs", "memberof": "src/viewer/Configs.js", @@ -40324,7 +40540,7 @@ "interface": false }, { - "__docId__": 2032, + "__docId__": 2040, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/Configs.js~Configs", @@ -40337,7 +40553,7 @@ "lineNumber": 50 }, { - "__docId__": 2033, + "__docId__": 2041, "kind": "set", "name": "doublePrecisionEnabled", "memberof": "src/viewer/Configs.js~Configs", @@ -40364,7 +40580,7 @@ } }, { - "__docId__": 2034, + "__docId__": 2042, "kind": "get", "name": "doublePrecisionEnabled", "memberof": "src/viewer/Configs.js~Configs", @@ -40396,7 +40612,7 @@ } }, { - "__docId__": 2035, + "__docId__": 2043, "kind": "set", "name": "maxDataTextureHeight", "memberof": "src/viewer/Configs.js~Configs", @@ -40409,7 +40625,7 @@ "lineNumber": 86 }, { - "__docId__": 2036, + "__docId__": 2044, "kind": "get", "name": "maxDataTextureHeight", "memberof": "src/viewer/Configs.js~Configs", @@ -40442,7 +40658,7 @@ } }, { - "__docId__": 2037, + "__docId__": 2045, "kind": "set", "name": "maxGeometryBatchSize", "memberof": "src/viewer/Configs.js~Configs", @@ -40455,7 +40671,7 @@ "lineNumber": 111 }, { - "__docId__": 2038, + "__docId__": 2046, "kind": "get", "name": "maxGeometryBatchSize", "memberof": "src/viewer/Configs.js~Configs", @@ -40473,18 +40689,18 @@ } }, { - "__docId__": 2039, + "__docId__": 2047, "kind": "file", "name": "src/viewer/Plugin.js", "content": "import {Map} from \"./scene/utils/Map.js\";\nimport {core} from \"./scene/core.js\";\n\n/**\n @desc Base class for {@link Viewer} plugin classes.\n */\nclass Plugin {\n\n /**\n * Creates this Plugin and installs it into the given {@link Viewer}.\n *\n * @param {string} id ID for this plugin, unique among all plugins in the viewer.\n * @param {Viewer} viewer The viewer.\n * @param {Object} [cfg] Options\n */\n constructor(id, viewer, cfg) {\n\n /**\n * ID for this Plugin, unique within its {@link Viewer}.\n *\n * @type {string}\n */\n this.id = (cfg && cfg.id) ? cfg.id : id;\n\n /**\n * The Viewer that contains this Plugin.\n *\n * @type {Viewer}\n */\n this.viewer = viewer;\n\n this._subIdMap = null; // Subscription subId pool\n this._subIdEvents = null; // Subscription subIds mapped to event names\n this._eventSubs = null; // Event names mapped to subscribers\n this._eventSubsNum = null;\n this._events = null; // Maps names to events\n this._eventCallDepth = 0; // Helps us catch stack overflows from recursive events\n\n viewer.addPlugin(this);\n }\n\n /**\n * Schedule a task to perform on the next browser interval\n * @param task\n */\n scheduleTask(task) {\n core.scheduleTask(task, null);\n }\n\n /**\n * Fires an event on this Plugin.\n *\n * Notifies existing subscribers to the event, optionally retains the event to give to\n * any subsequent notifications on the event as they are made.\n *\n * @param {String} event The event type name\n * @param {Object} value The event parameters\n * @param {Boolean} [forget=false] When true, does not retain for subsequent subscribers\n */\n fire(event, value, forget) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n this._eventSubsNum = {};\n }\n if (forget !== true) {\n this._events[event] = value || true; // Save notification\n }\n const subs = this._eventSubs[event];\n let sub;\n if (subs) { // Notify subscriptions\n for (const subId in subs) {\n if (subs.hasOwnProperty(subId)) {\n sub = subs[subId];\n this._eventCallDepth++;\n if (this._eventCallDepth < 300) {\n sub.callback.call(sub.scope, value);\n } else {\n this.error(\"fire: potential stack overflow from recursive event '\" + event + \"' - dropping this event\");\n }\n this._eventCallDepth--;\n }\n }\n }\n }\n\n /**\n * Subscribes to an event on this Plugin.\n *\n * The callback is be called with this Plugin as scope.\n *\n * @param {String} event The event\n * @param {Function} callback Called fired on the event\n * @param {Object} [scope=this] Scope for the callback\n * @return {String} Handle to the subscription, which may be used to unsubscribe with {@link #off}.\n */\n on(event, callback, scope) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._subIdMap) {\n this._subIdMap = new Map(); // Subscription subId pool\n }\n if (!this._subIdEvents) {\n this._subIdEvents = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n }\n if (!this._eventSubsNum) {\n this._eventSubsNum = {};\n }\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = {};\n this._eventSubs[event] = subs;\n this._eventSubsNum[event] = 1;\n } else {\n this._eventSubsNum[event]++;\n }\n const subId = this._subIdMap.addItem(); // Create unique subId\n subs[subId] = {\n callback: callback,\n scope: scope || this\n };\n this._subIdEvents[subId] = event;\n const value = this._events[event];\n if (value !== undefined) { // A publication exists, notify callback immediately\n callback.call(scope || this, value);\n }\n return subId;\n }\n\n /**\n * Cancels an event subscription that was previously made with {@link Plugin#on} or {@link Plugin#once}.\n *\n * @param {String} subId Subscription ID\n */\n off(subId) {\n if (subId === undefined || subId === null) {\n return;\n }\n if (!this._subIdEvents) {\n return;\n }\n const event = this._subIdEvents[subId];\n if (event) {\n delete this._subIdEvents[subId];\n const subs = this._eventSubs[event];\n if (subs) {\n delete subs[subId];\n this._eventSubsNum[event]--;\n }\n this._subIdMap.removeItem(subId); // Release subId\n }\n }\n\n /**\n * Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.\n *\n * This is equivalent to calling {@link Plugin#on}, and then calling {@link Plugin#off} inside the callback function.\n *\n * @param {String} event Data event to listen to\n * @param {Function} callback Called when fresh data is available at the event\n * @param {Object} [scope=this] Scope for the callback\n */\n once(event, callback, scope) {\n const self = this;\n const subId = this.on(event,\n function (value) {\n self.off(subId);\n callback.call(scope || this, value);\n },\n scope);\n }\n\n /**\n * Returns true if there are any subscribers to the given event on this Plugin.\n *\n * @param {String} event The event\n * @return {Boolean} True if there are any subscribers to the given event on this Plugin.\n */\n hasSubs(event) {\n return (this._eventSubsNum && (this._eventSubsNum[event] > 0));\n }\n\n /**\n * Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.\n *\n * @param {String} msg The error message\n */\n log(msg) {\n console.log(`[xeokit plugin ${this.id}]: ${msg}`);\n }\n\n /**\n * Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.\n *\n * @param {String} msg The error message\n */\n warn(msg) {\n console.warn(`[xeokit plugin ${this.id}]: ${msg}`);\n }\n\n /**\n * Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.\n *\n * @param {String} msg The error message\n */\n error(msg) {\n console.error(`[xeokit plugin ${this.id}]: ${msg}`);\n }\n\n /**\n * Sends a message to this Plugin.\n *\n * @private\n */\n send(name, value) {\n //...\n }\n\n /**\n * Destroys this Plugin and removes it from its {@link Viewer}.\n */\n destroy() {\n this.viewer.removePlugin(this);\n }\n}\n\nexport {Plugin}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/Plugin.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/Plugin.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2040, + "__docId__": 2048, "kind": "class", "name": "Plugin", "memberof": "src/viewer/Plugin.js", @@ -40499,7 +40715,7 @@ "interface": false }, { - "__docId__": 2041, + "__docId__": 2049, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40544,7 +40760,7 @@ ] }, { - "__docId__": 2042, + "__docId__": 2050, "kind": "member", "name": "id", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40563,7 +40779,7 @@ } }, { - "__docId__": 2043, + "__docId__": 2051, "kind": "member", "name": "viewer", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40582,7 +40798,7 @@ } }, { - "__docId__": 2044, + "__docId__": 2052, "kind": "member", "name": "_subIdMap", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40600,7 +40816,7 @@ } }, { - "__docId__": 2045, + "__docId__": 2053, "kind": "member", "name": "_subIdEvents", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40618,7 +40834,7 @@ } }, { - "__docId__": 2046, + "__docId__": 2054, "kind": "member", "name": "_eventSubs", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40636,7 +40852,7 @@ } }, { - "__docId__": 2047, + "__docId__": 2055, "kind": "member", "name": "_eventSubsNum", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40654,7 +40870,7 @@ } }, { - "__docId__": 2048, + "__docId__": 2056, "kind": "member", "name": "_events", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40672,7 +40888,7 @@ } }, { - "__docId__": 2049, + "__docId__": 2057, "kind": "member", "name": "_eventCallDepth", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40690,7 +40906,7 @@ } }, { - "__docId__": 2050, + "__docId__": 2058, "kind": "method", "name": "scheduleTask", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40716,7 +40932,7 @@ "return": null }, { - "__docId__": 2051, + "__docId__": 2059, "kind": "method", "name": "fire", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40764,7 +40980,7 @@ "return": null }, { - "__docId__": 2055, + "__docId__": 2063, "kind": "method", "name": "on", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40819,7 +41035,7 @@ } }, { - "__docId__": 2061, + "__docId__": 2069, "kind": "method", "name": "off", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40845,7 +41061,7 @@ "return": null }, { - "__docId__": 2062, + "__docId__": 2070, "kind": "method", "name": "once", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40893,7 +41109,7 @@ "return": null }, { - "__docId__": 2063, + "__docId__": 2071, "kind": "method", "name": "hasSubs", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40926,7 +41142,7 @@ } }, { - "__docId__": 2064, + "__docId__": 2072, "kind": "method", "name": "log", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40952,7 +41168,7 @@ "return": null }, { - "__docId__": 2065, + "__docId__": 2073, "kind": "method", "name": "warn", "memberof": "src/viewer/Plugin.js~Plugin", @@ -40978,7 +41194,7 @@ "return": null }, { - "__docId__": 2066, + "__docId__": 2074, "kind": "method", "name": "error", "memberof": "src/viewer/Plugin.js~Plugin", @@ -41004,7 +41220,7 @@ "return": null }, { - "__docId__": 2067, + "__docId__": 2075, "kind": "method", "name": "send", "memberof": "src/viewer/Plugin.js~Plugin", @@ -41033,7 +41249,7 @@ "return": null }, { - "__docId__": 2068, + "__docId__": 2076, "kind": "method", "name": "destroy", "memberof": "src/viewer/Plugin.js~Plugin", @@ -41048,18 +41264,18 @@ "return": null }, { - "__docId__": 2069, + "__docId__": 2077, "kind": "file", "name": "src/viewer/Viewer.js", "content": "import {Scene} from \"./scene/scene/Scene.js\";\nimport {CameraFlightAnimation} from \"./scene/camera/CameraFlightAnimation.js\";\nimport {CameraControl} from \"./scene/CameraControl/CameraControl.js\";\nimport {MetaScene} from \"./metadata/MetaScene.js\";\nimport {LocaleService} from \"./localization/LocaleService.js\";\nimport html2canvas from 'html2canvas/dist/html2canvas.esm.js';\n\n/**\n * The 3D Viewer at the heart of the xeokit SDK.\n *\n * * A Viewer wraps a single {@link Scene}\n * * Add {@link Plugin}s to a Viewer to extend its functionality.\n * * {@link Viewer#metaScene} holds metadata about models in the\n * Viewer's {@link MetaScene}.\n * * Use {@link Viewer#cameraFlight} to fly or jump the {@link Scene}'s\n * {@link Camera} to target positions, boundaries or {@link Entity}s.\n *\n * @public\n */\nclass Viewer {\n\n /**\n * @constructor\n * @param {Object} cfg Viewer configuration.\n * @param {String} [cfg.id] Optional ID for this Viewer, defaults to the ID of {@link Viewer#scene}, which xeokit automatically generates.\n * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Viewer#scene} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Viewer#scene} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.\n * @param {String} [cfg.spinnerElementId] ID of existing HTML element to show the {@link Spinner} - internally creates a default element automatically if this is omitted.\n * @param {Number} [cfg.passes=1] The number of times the {@link Viewer#scene} renders per frame.\n * @param {Boolean} [cfg.clearEachPass=false] When doing multiple passes per frame, specifies if to clear the canvas before each pass (true) or just before the first pass (false).\n * @param {Boolean} [cfg.preserveDrawingBuffer=true] Whether or not to preserve the WebGL drawing buffer. This needs to be ````true```` for {@link Viewer#getSnapshot} to work.\n * @param {Boolean} [cfg.transparent=true] Whether or not the canvas is transparent.\n * @param {Boolean} [cfg.premultipliedAlpha=false] Whether or not you want alpha composition with premultiplied alpha. Highlighting and selection works best when this is ````false````.\n * @param {Boolean} [cfg.gammaInput=true] When true, expects that all textures and colors are premultiplied gamma.\n * @param {Boolean} [cfg.gammaOutput=false] Whether or not to render with pre-multiplied gama.\n * @param {Number} [cfg.gammaFactor=2.2] The gamma factor to use when rendering with pre-multiplied gamma.\n * @param {Number[]} [cfg.backgroundColor=[1,1,1]] Sets the canvas background color to use when ````transparent```` is false.\n * @param {Boolean} [cfg.backgroundColorFromAmbientLight=true] When ````transparent```` is false, set this ````true````\n * to derive the canvas background color from {@link AmbientLight#color}, or ````false```` to set the canvas background to ````backgroundColor````.\n * @param {String} [cfg.units=\"meters\"] The measurement unit type. Accepted values are ````\"meters\"````, ````\"metres\"````, , ````\"centimeters\"````, ````\"centimetres\"````, ````\"millimeters\"````, ````\"millimetres\"````, ````\"yards\"````, ````\"feet\"```` and ````\"inches\"````.\n * @param {Number} [cfg.scale=1] The number of Real-space units in each World-space coordinate system unit.\n * @param {Number[]} [cfg.origin=[0,0,0]] The Real-space 3D origin, in current measurement units, at which the World-space coordinate origin ````[0,0,0]```` sits.\n * @param {Boolean} [cfg.saoEnabled=false] Whether to enable Scalable Ambient Obscurance (SAO) effect. See {@link SAO} for more info.\n * @param {Boolean} [cfg.antialias=true] Whether to enable anti-aliasing.\n * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.\n * @param {Boolean} [cfg.alphaDepthMask=true] Whether writing into the depth buffer is enabled or disabled when rendering transparent objects.\n * @param {Boolean} [cfg.entityOffsetsEnabled=false] Whether to enable {@link Entity#offset}. For best performance, only set this ````true```` when you need to use {@link Entity#offset}.\n * @param {Boolean} [cfg.pickSurfacePrecisionEnabled=false] Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer. The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.\n * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=false] Whether to enable logarithmic depth buffer. When this is true,\n * you can set huge values for {@link Perspective#far} and {@link Ortho#far}, to push the far clipping plane back so\n * that it does not clip huge models.\n * @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.\n * @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.\n * @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.\n * @param {Boolean} [cfg.dtxEnabled=false] Whether to enable data texture-based (DTX) scene representation within the Viewer. When this is true, the Viewer will use data textures to\n * store geometry on the GPU for triangle meshes that don't have textures. This gives a much lower memory footprint for these types of model element. This mode may not perform well on low-end GPUs that are optimized\n * to use textures to hold geometry data. Works great on most medium/high-end GPUs found in desktop computers, including the nVIDIA and Intel HD chipsets. Set this false to use the default vertex buffer object (VBO)\n * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.\n * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity\n * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally\n * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing\n * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with\n * your expected usage.\n */\n constructor(cfg) {\n\n /**\n * The Viewer's current language setting.\n * @property language\n * @deprecated\n * @type {String}\n */\n this.language = \"en\";\n\n /**\n * The viewer's locale service.\n *\n * This is configured via the Viewer's constructor.\n *\n * By default, this service will be an instance of {@link LocaleService}, which will just return\n * null translations for all given strings and phrases.\n *\n * @property localeService\n * @type {LocaleService}\n * @since 2.0\n */\n this.localeService = cfg.localeService || new LocaleService();\n\n /**\n * The Viewer's {@link Scene}.\n * @property scene\n * @type {Scene}\n */\n this.scene = new Scene(this, {\n canvasId: cfg.canvasId,\n canvasElement: cfg.canvasElement,\n keyboardEventsElement: cfg.keyboardEventsElement,\n contextAttr: {\n preserveDrawingBuffer: cfg.preserveDrawingBuffer !== false,\n premultipliedAlpha: (!!cfg.premultipliedAlpha),\n antialias: (cfg.antialias !== false)\n },\n spinnerElementId: cfg.spinnerElementId,\n transparent: (cfg.transparent !== false),\n gammaInput: true,\n gammaOutput: false,\n backgroundColor: cfg.backgroundColor,\n backgroundColorFromAmbientLight: cfg.backgroundColorFromAmbientLight,\n ticksPerRender: 1,\n ticksPerOcclusionTest: 20,\n units: cfg.units,\n scale: cfg.scale,\n origin: cfg.origin,\n saoEnabled: cfg.saoEnabled,\n alphaDepthMask: (cfg.alphaDepthMask !== false),\n entityOffsetsEnabled: (!!cfg.entityOffsetsEnabled),\n pickSurfacePrecisionEnabled: (!!cfg.pickSurfacePrecisionEnabled),\n logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),\n pbrEnabled: (!!cfg.pbrEnabled),\n colorTextureEnabled: (cfg.colorTextureEnabled !== false),\n dtxEnabled: (!!cfg.dtxEnabled),\n numCachedSectionPlanes: cfg.numCachedSectionPlanes\n });\n\n /**\n * Metadata about the {@link Scene} and the models and objects within it.\n * @property metaScene\n * @type {MetaScene}\n * @readonly\n */\n this.metaScene = new MetaScene(this, this.scene);\n\n /**\n * The Viewer's ID.\n * @property id\n *\n * @type {String|Number}\n */\n this.id = cfg.id || this.scene.id;\n\n /**\n * The Viewer's {@link Camera}. This is also found on {@link Scene#camera}.\n * @property camera\n * @type {Camera}\n */\n this.camera = this.scene.camera;\n\n /**\n * The Viewer's {@link CameraFlightAnimation}, which\n * is used to fly the {@link Scene}'s {@link Camera} to given targets.\n * @property cameraFlight\n * @type {CameraFlightAnimation}\n */\n this.cameraFlight = new CameraFlightAnimation(this.scene, {\n duration: 0.5\n });\n\n /**\n * The Viewer's {@link CameraControl}, which\n * controls the {@link Scene}'s {@link Camera} with mouse, touch and keyboard input.\n * @property cameraControl\n * @type {CameraControl}\n */\n this.cameraControl = new CameraControl(this.scene, {\n // panToPointer: true,\n doublePickFlyTo: true\n });\n\n this._plugins = [];\n\n /**\n * Subscriptions to events sent with {@link fire}.\n * @private\n */\n this._eventSubs = {};\n }\n\n /**\n * Returns the capabilities of this Viewer.\n *\n * @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}\n */\n get capabilities() {\n return this.scene.capabilities;\n }\n\n /**\n * Subscribes to an event fired at this Viewer.\n *\n * @param {String} event The event\n * @param {Function} callback Callback fired on the event\n */\n on(event, callback) {\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = [];\n this._eventSubs[event] = subs;\n }\n subs.push(callback);\n }\n\n /**\n * Fires an event at this Viewer.\n *\n * @param {String} event Event name\n * @param {Object} value Event parameters\n */\n fire(event, value) {\n const subs = this._eventSubs[event];\n if (subs) {\n for (let i = 0, len = subs.length; i < len; i++) {\n subs[i](value);\n }\n }\n }\n\n /**\n * Unsubscribes from an event fired at this Viewer.\n * @param event\n */\n off(event) { // TODO\n\n }\n\n /**\n * Logs a message to the JavaScript developer console, prefixed with the ID of this Viewer.\n *\n * @param {String} msg The message\n */\n log(msg) {\n console.log(`[xeokit viewer ${this.id}]: ${msg}`);\n }\n\n /**\n * Logs an error message to the JavaScript developer console, prefixed with the ID of this Viewer.\n *\n * @param {String} msg The error message\n */\n error(msg) {\n console.error(`[xeokit viewer ${this.id}]: ${msg}`);\n }\n\n /**\n * Installs a Plugin.\n *\n * @private\n */\n addPlugin(plugin) {\n this._plugins.push(plugin);\n }\n\n /**\n * Uninstalls a Plugin, clearing content from it first.\n *\n * @private\n */\n removePlugin(plugin) {\n for (let i = 0, len = this._plugins.length; i < len; i++) {\n const p = this._plugins[i];\n if (p === plugin) {\n if (p.clear) {\n p.clear();\n }\n this._plugins.splice(i, 1);\n return;\n }\n }\n }\n\n /**\n * Sends a message to installed Plugins.\n *\n * The message can optionally be accompanied by a value.\n * @private\n */\n sendToPlugins(name, value) {\n for (let i = 0, len = this._plugins.length; i < len; i++) {\n const p = this._plugins[i];\n if (p.send) {\n p.send(name, value);\n }\n }\n }\n\n /**\n * @private\n * @deprecated\n */\n clear() {\n throw \"Viewer#clear() no longer implemented - use '#sendToPlugins(\\\"clear\\\") instead\";\n }\n\n /**\n * @private\n * @deprecated\n */\n resetView() {\n throw \"Viewer#resetView() no longer implemented - use CameraMemento & ObjectsMemento classes instead\";\n }\n\n /**\n * Enter snapshot mode.\n *\n * Switches rendering to a hidden snapshot canvas.\n *\n * Exit snapshot mode using {@link Viewer#endSnapshot}.\n */\n beginSnapshot() {\n if (this._snapshotBegun) {\n return;\n }\n this.scene._renderer.beginSnapshot();\n this._snapshotBegun = true;\n }\n\n /**\n * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image.\n *\n * #### Usage:\n *\n * ````javascript\n * const imageData = viewer.getSnapshot({\n * width: 500,\n * height: 500,\n * format: \"png\"\n * });\n * ````\n * @param {*} [params] Capture options.\n * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.\n * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.\n * @param {String} [params.format=\"jpeg\"] Desired format; \"jpeg\", \"png\" or \"bmp\".\n * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.\n * @returns {String} String-encoded image data URI.\n */\n getSnapshot(params = {}) {\n\n const needFinishSnapshot = (!this._snapshotBegun);\n const resize = (params.width !== undefined && params.height !== undefined);\n const canvas = this.scene.canvas.canvas;\n const saveWidth = canvas.clientWidth;\n const saveHeight = canvas.clientHeight;\n const width = params.width ? Math.floor(params.width) : canvas.width;\n const height = params.height ? Math.floor(params.height) : canvas.height;\n\n if (resize) {\n canvas.width = width;\n canvas.height = height;\n }\n\n if (!this._snapshotBegun) {\n this.beginSnapshot({\n width,\n height\n });\n }\n\n if (!params.includeGizmos) {\n this.sendToPlugins(\"snapshotStarting\"); // Tells plugins to hide things that shouldn't be in snapshot\n }\n\n const captured = {};\n for (let i = 0, len = this._plugins.length; i < len; i++) {\n const plugin = this._plugins[i];\n if (plugin.getContainerElement) {\n const container = plugin.getContainerElement();\n if (container !== document.body) {\n if (!captured[container.id]) {\n captured[container.id] = true;\n html2canvas(container).then(function (canvas) {\n document.body.appendChild(canvas);\n });\n }\n }\n }\n }\n\n this.scene._renderer.renderSnapshot();\n\n const imageDataURI = this.scene._renderer.readSnapshot(params);\n\n if (resize) {\n canvas.width = saveWidth;\n canvas.height = saveHeight;\n\n this.scene.glRedraw();\n }\n\n if (!params.includeGizmos) {\n this.sendToPlugins(\"snapshotFinished\");\n }\n\n if (needFinishSnapshot) {\n this.endSnapshot();\n }\n\n return imageDataURI;\n }\n\n /**\n * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes\n * the HTML elements created by various plugins.\n *\n * The snapshot image is composed of an image of the viewer canvas, overlaid with an image\n * of the HTML container element belonging to each installed Viewer plugin. Each container\n * element is only rendered once, so it's OK for plugins to share the same container.\n *\n * #### Usage:\n *\n * ````javascript\n * viewer.getSnapshotWithPlugins({\n * width: 500,\n * height: 500,\n * format: \"png\"\n * }).then((imageData)=>{\n *\n * });\n * ````\n * @param {*} [params] Capture options.\n * @param {Number} [params.width] Desired width of result in pixels - defaults to width of canvas.\n * @param {Number} [params.height] Desired height of result in pixels - defaults to height of canvas.\n * @param {String} [params.format=\"jpeg\"] Desired format; \"jpeg\", \"png\" or \"bmp\".\n * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.\n * @returns {Promise} Promise which returns a string-encoded image data URI.\n */\n async getSnapshotWithPlugins(params = {}) {\n\n // We use gl.readPixels to get the WebGL canvas snapshot in a new\n // HTMLCanvas element, scaled to the target snapshot size, then\n // use html2canvas to render each plugin's container element into\n // that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.\n\n // We don't rely on html2canvas to up-scale our WebGL canvas\n // when we want a higher-resolution snapshot, which would cause\n // blurring. Instead, we manage the scale and redraw of the WebGL\n // canvas ourselves, in order to allow the Viewer to render the\n // right amount of pixels, for a sharper image.\n\n\n const needFinishSnapshot = (!this._snapshotBegun);\n const resize = (params.width !== undefined && params.height !== undefined);\n const canvas = this.scene.canvas.canvas;\n const saveWidth = canvas.clientWidth;\n const saveHeight = canvas.clientHeight;\n const snapshotWidth = params.width ? Math.floor(params.width) : canvas.width;\n const snapshotHeight = params.height ? Math.floor(params.height) : canvas.height;\n\n if (resize) {\n canvas.width = snapshotWidth;\n canvas.height = snapshotHeight;\n }\n\n if (!this._snapshotBegun) {\n this.beginSnapshot();\n }\n\n if (!params.includeGizmos) {\n this.sendToPlugins(\"snapshotStarting\"); // Tells plugins to hide things that shouldn't be in snapshot\n }\n\n this.scene._renderer.renderSnapshot();\n\n const snapshotCanvas = this.scene._renderer.readSnapshotAsCanvas();\n\n if (resize) {\n canvas.width = saveWidth;\n canvas.height = saveHeight;\n this.scene.glRedraw();\n }\n\n const pluginToCapture = {};\n const pluginContainerElements = [];\n\n for (let i = 0, len = this._plugins.length; i < len; i++) { // Find plugin container elements\n const plugin = this._plugins[i];\n if (plugin.getContainerElement) {\n const containerElement = plugin.getContainerElement();\n if (containerElement !== document.body) {\n if (!pluginToCapture[containerElement.id]) {\n pluginToCapture[containerElement.id] = true;\n pluginContainerElements.push(containerElement);\n }\n }\n }\n }\n\n for (let i = 0, len = pluginContainerElements.length; i < len; i++) {\n const containerElement = pluginContainerElements[i];\n await html2canvas(containerElement, {\n canvas: snapshotCanvas,\n backgroundColor: null,\n scale: snapshotCanvas.width / containerElement.clientWidth\n });\n }\n if (!params.includeGizmos) {\n this.sendToPlugins(\"snapshotFinished\");\n }\n if (needFinishSnapshot) {\n this.endSnapshot();\n }\n let format = params.format || \"png\";\n if (format !== \"jpeg\" && format !== \"png\" && format !== \"bmp\") {\n console.error(\"Unsupported image format: '\" + format + \"' - supported types are 'jpeg', 'bmp' and 'png' - defaulting to 'png'\");\n format = \"png\";\n }\n if (!params.includeGizmos) {\n this.sendToPlugins(\"snapshotFinished\");\n }\n if (needFinishSnapshot) {\n this.endSnapshot();\n }\n return snapshotCanvas.toDataURL(`image/${format}`);\n }\n\n /**\n * Exits snapshot mode.\n *\n * Switches rendering back to the main canvas.\n *\n */\n endSnapshot() {\n if (!this._snapshotBegun) {\n return;\n }\n this.scene._renderer.endSnapshot();\n this.scene._renderer.render({force: true});\n this._snapshotBegun = false;\n }\n\n /** Destroys this Viewer.\n */\n destroy() {\n const plugins = this._plugins.slice(); // Array will modify as we delete plugins\n for (let i = 0, len = plugins.length; i < len; i++) {\n const plugin = plugins[i];\n plugin.destroy();\n }\n this.scene.destroy();\n }\n}\n\nexport {Viewer}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/Viewer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/Viewer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2070, + "__docId__": 2078, "kind": "class", "name": "Viewer", "memberof": "src/viewer/Viewer.js", @@ -41074,7 +41290,7 @@ "interface": false }, { - "__docId__": 2071, + "__docId__": 2079, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41459,7 +41675,7 @@ ] }, { - "__docId__": 2072, + "__docId__": 2080, "kind": "member", "name": "language", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41491,7 +41707,7 @@ } }, { - "__docId__": 2073, + "__docId__": 2081, "kind": "member", "name": "localeService", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41523,7 +41739,7 @@ } }, { - "__docId__": 2074, + "__docId__": 2082, "kind": "member", "name": "scene", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41554,7 +41770,7 @@ } }, { - "__docId__": 2075, + "__docId__": 2083, "kind": "member", "name": "metaScene", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41591,7 +41807,7 @@ } }, { - "__docId__": 2076, + "__docId__": 2084, "kind": "member", "name": "id", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41623,7 +41839,7 @@ } }, { - "__docId__": 2077, + "__docId__": 2085, "kind": "member", "name": "camera", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41654,7 +41870,7 @@ } }, { - "__docId__": 2078, + "__docId__": 2086, "kind": "member", "name": "cameraFlight", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41685,7 +41901,7 @@ } }, { - "__docId__": 2079, + "__docId__": 2087, "kind": "member", "name": "cameraControl", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41716,7 +41932,7 @@ } }, { - "__docId__": 2080, + "__docId__": 2088, "kind": "member", "name": "_plugins", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41734,7 +41950,7 @@ } }, { - "__docId__": 2081, + "__docId__": 2089, "kind": "member", "name": "_eventSubs", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41751,7 +41967,7 @@ } }, { - "__docId__": 2082, + "__docId__": 2090, "kind": "get", "name": "capabilities", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41783,7 +41999,7 @@ } }, { - "__docId__": 2083, + "__docId__": 2091, "kind": "method", "name": "on", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41819,7 +42035,7 @@ "return": null }, { - "__docId__": 2084, + "__docId__": 2092, "kind": "method", "name": "fire", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41855,7 +42071,7 @@ "return": null }, { - "__docId__": 2085, + "__docId__": 2093, "kind": "method", "name": "off", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41881,7 +42097,7 @@ "return": null }, { - "__docId__": 2086, + "__docId__": 2094, "kind": "method", "name": "log", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41907,7 +42123,7 @@ "return": null }, { - "__docId__": 2087, + "__docId__": 2095, "kind": "method", "name": "error", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41933,7 +42149,7 @@ "return": null }, { - "__docId__": 2088, + "__docId__": 2096, "kind": "method", "name": "addPlugin", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41956,7 +42172,7 @@ "return": null }, { - "__docId__": 2089, + "__docId__": 2097, "kind": "method", "name": "removePlugin", "memberof": "src/viewer/Viewer.js~Viewer", @@ -41979,7 +42195,7 @@ "return": null }, { - "__docId__": 2090, + "__docId__": 2098, "kind": "method", "name": "sendToPlugins", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42008,7 +42224,7 @@ "return": null }, { - "__docId__": 2091, + "__docId__": 2099, "kind": "method", "name": "clear", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42025,7 +42241,7 @@ "return": null }, { - "__docId__": 2092, + "__docId__": 2100, "kind": "method", "name": "resetView", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42042,7 +42258,7 @@ "return": null }, { - "__docId__": 2093, + "__docId__": 2101, "kind": "method", "name": "beginSnapshot", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42057,7 +42273,7 @@ "return": null }, { - "__docId__": 2094, + "__docId__": 2102, "kind": "member", "name": "_snapshotBegun", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42075,7 +42291,7 @@ } }, { - "__docId__": 2095, + "__docId__": 2103, "kind": "method", "name": "getSnapshot", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42158,7 +42374,7 @@ } }, { - "__docId__": 2096, + "__docId__": 2104, "kind": "method", "name": "getSnapshotWithPlugins", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42241,7 +42457,7 @@ } }, { - "__docId__": 2097, + "__docId__": 2105, "kind": "method", "name": "endSnapshot", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42256,7 +42472,7 @@ "return": null }, { - "__docId__": 2099, + "__docId__": 2107, "kind": "method", "name": "destroy", "memberof": "src/viewer/Viewer.js~Viewer", @@ -42271,29 +42487,29 @@ "return": null }, { - "__docId__": 2100, + "__docId__": 2108, "kind": "file", "name": "src/viewer/index.js", "content": "export * from \"./localization/LocaleService.js\";\nexport * from \"./scene/index.js\";\nexport * from \"./Plugin.js\";\nexport * from \"./Viewer.js\";\nexport * from \"./Configs.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2101, + "__docId__": 2109, "kind": "file", "name": "src/viewer/localization/LocaleService.js", "content": "import {Map} from \"./../scene/utils/Map.js\";\n\n/**\n * @desc Localization service for a {@link Viewer}.\n *\n * * A LocaleService is a container of string translations (\"messages\") for various locales.\n * * A {@link Viewer} has its own default LocaleService at {@link Viewer#localeService}.\n * * We can replace that with our own LocaleService, or a custom subclass, via the Viewer's constructor.\n * * Viewer plugins that need localized translations will attempt to them for the currently active locale from the LocaleService.\n * * Whenever we switch the LocaleService to a different locale, plugins will automatically refresh their translations for that locale.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Viewer} that uses an {@link XKTLoaderPlugin} to load a BIM model, and a\n * {@link NavCubePlugin}, which shows a camera navigation cube in the corner of the canvas.\n *\n * We'll also configure our Viewer with our own LocaleService instance, configured with English, Māori and French\n * translations for our NavCubePlugin.\n *\n * We could instead have just used the Viewer's default LocaleService, but this example demonstrates how we might\n * configure the Viewer our own custom LocaleService subclass.\n *\n * The translations fetched by our NavCubePlugin will be:\n *\n * * \"NavCube.front\"\n * * \"NavCube.back\"\n * * \"NavCube.top\"\n * * \"NavCube.bottom\"\n * * \"NavCube.left\"\n * * \"NavCube.right\"\n *\n *
    \n * These are paths that resolve to our translations for the currently active locale, and are hard-coded within\n * the NavCubePlugin.\n *\n * For example, if the LocaleService's locale is set to \"fr\", then the path \"NavCube.back\" will drill down\n * into ````messages->fr->NavCube->front```` and fetch \"Arrière\".\n *\n * If we didn't provide that particular translation in our LocaleService, or any translations for that locale,\n * then the NavCubePlugin will just fall back on its own default hard-coded translation, which in this case is \"BACK\".\n *\n * [[Run example](https://xeokit.github.io/xeokit-sdk/examples/index.html#localization_NavCubePlugin)]\n *\n * ````javascript\n * import {Viewer, LocaleService, NavCubePlugin, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n *\n * canvasId: \"myCanvas\",\n *\n * localeService: new LocaleService({\n * messages: {\n * \"en\": { // English\n * \"NavCube\": {\n * \"front\": \"Front\",\n * \"back\": \"Back\",\n * \"top\": \"Top\",\n * \"bottom\": \"Bottom\",\n * \"left\": \"Left\",\n * \"right\": \"Right\"\n * }\n * },\n * \"mi\": { // Māori\n * \"NavCube\": {\n * \"front\": \"Mua\",\n * \"back\": \"Tuarā\",\n * \"top\": \"Runga\",\n * \"bottom\": \"Raro\",\n * \"left\": \"Mauī\",\n * \"right\": \"Tika\"\n * }\n * },\n * \"fr\": { // Francais\n * \"NavCube\": {\n * \"front\": \"Avant\",\n * \"back\": \"Arrière\",\n * \"top\": \"Supérieur\",\n * \"bottom\": \"Inférieur\",\n * \"left\": \"Gauche\",\n * \"right\": \"Droit\"\n * }\n * }\n * },\n * locale: \"en\"\n * })\n * });\n *\n * viewer.camera.eye = [-3.93, 2.85, 27.01];\n * viewer.camera.look = [4.40, 3.72, 8.89];\n * viewer.camera.up = [-0.01, 0.99, 0.03];\n *\n * const navCubePlugin = new NavCubePlugin(viewer, {\n * canvasID: \"myNavCubeCanvas\"\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Duplex.ifc.xkt\",\n * edges: true\n * });\n * ````\n *\n * We can dynamically switch our Viewer to a different locale at any time, which will update the text on the\n * faces of our NavCube:\n *\n * ````javascript\n * viewer.localeService.locale = \"mi\"; // Switch to Māori\n * ````\n *\n * We can load new translations at any time:\n *\n * ````javascript\n * viewer.localeService.loadMessages({\n * \"jp\": { // Japanese\n * \"NavCube\": {\n * \"front\": \"前部\",\n * \"back\": \"裏\",\n * \"top\": \"上\",\n * \"bottom\": \"底\",\n * \"left\": \"左\",\n * \"right\": \"右\"\n * }\n * }\n * });\n * ````\n *\n * And we can clear the translations if needed:\n *\n * ````javascript\n * viewer.localeService.clearMessages();\n * ````\n *\n * We can get an \"updated\" event from the LocaleService whenever we switch locales or load messages, which is useful\n * for triggering UI elements to refresh themselves with updated translations. Internally, our {@link NavCubePlugin}\n * subscribes to this event, fetching new strings for itself via {@link LocaleService#translate} each time the\n * event is fired.\n *\n * ````javascript\n * viewer.localeService.on(\"updated\", () => {\n * console.log( viewer.localeService.translate(\"NavCube.left\") );\n * });\n * ````\n * @since 2.0\n */\nclass LocaleService {\n\n /**\n * Constructs a LocaleService.\n *\n * @param {*} [params={}]\n * @param {JSON} [params.messages]\n * @param {String} [params.locale]\n */\n constructor(params = {}) {\n\n this._eventSubIDMap = null;\n this._eventSubEvents = null;\n this._eventSubs = null;\n this._events = null;\n\n this._locale = \"en\";\n this._messages = {};\n this._locales = [];\n this._locale = \"en\";\n\n this.messages = params.messages;\n this.locale = params.locale;\n }\n\n /**\n * Replaces the current set of locale translations.\n *\n * * Fires an \"updated\" event when done.\n * * Automatically refreshes any plugins that depend on the translations.\n * * Does not change the current locale.\n *\n * ## Usage\n *\n * ````javascript\n * viewer.localeService.setMessages({\n * messages: {\n * \"en\": { // English\n * \"NavCube\": {\n * \"front\": \"Front\",\n * \"back\": \"Back\",\n * \"top\": \"Top\",\n * \"bottom\": \"Bottom\",\n * \"left\": \"Left\",\n * \"right\": \"Right\"\n * }\n * },\n * \"mi\": { // Māori\n * \"NavCube\": {\n * \"front\": \"Mua\",\n * \"back\": \"Tuarā\",\n * \"top\": \"Runga\",\n * \"bottom\": \"Raro\",\n * \"left\": \"Mauī\",\n * \"right\": \"Tika\"\n * }\n * }\n * }\n * });\n * ````\n *\n * @param {*} messages The new translations.\n */\n set messages(messages) {\n this._messages = messages || {};\n this._locales = Object.keys(this._messages);\n this.fire(\"updated\", this);\n }\n\n /**\n * Loads a new set of locale translations, adding them to the existing translations.\n *\n * * Fires an \"updated\" event when done.\n * * Automatically refreshes any plugins that depend on the translations.\n * * Does not change the current locale.\n *\n * ## Usage\n *\n * ````javascript\n * viewer.localeService.loadMessages({\n * \"jp\": { // Japanese\n * \"NavCube\": {\n * \"front\": \"前部\",\n * \"back\": \"裏\",\n * \"top\": \"上\",\n * \"bottom\": \"底\",\n * \"left\": \"左\",\n * \"right\": \"右\"\n * }\n * }\n * });\n * ````\n *\n * @param {*} messages The new translations.\n */\n loadMessages(messages = {}) {\n for (let locale in messages) {\n this._messages[locale] = messages[locale];\n }\n this.messages = this._messages;\n }\n\n /**\n * Clears all locale translations.\n *\n * * Fires an \"updated\" event when done.\n * * Does not change the current locale.\n * * Automatically refreshes any plugins that depend on the translations, which will cause those\n * plugins to fall back on their internal hard-coded text values, since this method removes all\n * our translations.\n */\n clearMessages() {\n this.messages = {};\n }\n\n /**\n * Gets the list of available locales.\n *\n * These are derived from the currently configured set of translations.\n *\n * @returns {String[]} The list of available locales.\n */\n get locales() {\n return this._locales;\n }\n\n /**\n * Sets the current locale.\n *\n * * Fires an \"updated\" event when done.\n * * The given locale does not need to be in the list of available locales returned by {@link LocaleService#locales}, since\n * this method assumes that you may want to load the locales at a later point.\n * * Automatically refreshes any plugins that depend on the translations.\n * * We can then get translations for the locale, if translations have been loaded for it, via {@link LocaleService#translate} and {@link LocaleService#translatePlurals}.\n *\n * @param {String} locale The new current locale.\n */\n set locale(locale) {\n locale = locale || \"de\";\n if (this._locale === locale) {\n return;\n }\n this._locale = locale;\n this.fire(\"updated\", locale);\n }\n\n /**\n * Gets the current locale.\n *\n * @returns {String} The current locale.\n */\n get locale() {\n return this._locale;\n }\n\n /**\n * Translates the given string according to the current locale.\n *\n * Returns null if no translation can be found.\n *\n * @param {String} msg String to translate.\n * @param {*} [args] Extra parameters.\n * @returns {String|null} Translated string if found, else null.\n */\n translate(msg, args) {\n const localeMessages = this._messages[this._locale];\n if (!localeMessages) {\n return null;\n }\n const localeMessage = resolvePath(msg, localeMessages);\n if (localeMessage) {\n if (args) {\n return vsprintf(localeMessage, args);\n }\n return localeMessage;\n }\n return null;\n }\n\n /**\n * Translates the given phrase according to the current locale.\n *\n * Returns null if no translation can be found.\n *\n * @param {String} msg Phrase to translate.\n * @param {Number} count The plural number.\n * @param {*} [args] Extra parameters.\n * @returns {String|null} Translated string if found, else null.\n */\n translatePlurals(msg, count, args) {\n const localeMessages = this._messages[this._locale];\n if (!localeMessages) {\n return null;\n }\n let localeMessage = resolvePath(msg, localeMessages);\n count = parseInt(\"\" + count, 10);\n if (count === 0) {\n localeMessage = localeMessage.zero;\n } else {\n localeMessage = (count > 1) ? localeMessage.other : localeMessage.one;\n }\n if (!localeMessage) {\n return null;\n }\n localeMessage = vsprintf(localeMessage, [count]);\n if (args) {\n localeMessage = vsprintf(localeMessage, args);\n }\n return localeMessage;\n }\n\n /**\n * Fires an event on this LocaleService.\n *\n * Notifies existing subscribers to the event, optionally retains the event to give to\n * any subsequent notifications on the event as they are made.\n *\n * @param {String} event The event type name.\n * @param {Object} value The event parameters.\n * @param {Boolean} [forget=false] When true, does not retain for subsequent subscribers.\n */\n fire(event, value, forget) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n }\n if (forget !== true) {\n this._events[event] = value || true; // Save notification\n }\n const subs = this._eventSubs[event];\n if (subs) {\n for (const subId in subs) {\n if (subs.hasOwnProperty(subId)) {\n const sub = subs[subId];\n sub.callback(value);\n }\n }\n }\n }\n\n /**\n * Subscribes to an event on this LocaleService.\n *\n * @param {String} event The event\n * @param {Function} callback Callback fired on the event\n * @return {String} Handle to the subscription, which may be used to unsubscribe with {@link #off}.\n */\n on(event, callback) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._eventSubIDMap) {\n this._eventSubIDMap = new Map(); // Subscription subId pool\n }\n if (!this._eventSubEvents) {\n this._eventSubEvents = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n }\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = {};\n this._eventSubs[event] = subs;\n }\n const subId = this._eventSubIDMap.addItem(); // Create unique subId\n subs[subId] = {\n callback: callback\n };\n this._eventSubEvents[subId] = event;\n const value = this._events[event];\n if (value !== undefined) {\n callback(value);\n }\n return subId;\n }\n\n /**\n * Cancels an event subscription that was previously made with {@link LocaleService#on}.\n *\n * @param {String} subId Subscription ID\n */\n off(subId) {\n if (subId === undefined || subId === null) {\n return;\n }\n if (!this._eventSubEvents) {\n return;\n }\n const event = this._eventSubEvents[subId];\n if (event) {\n delete this._eventSubEvents[subId];\n const subs = this._eventSubs[event];\n if (subs) {\n delete subs[subId];\n }\n this._eventSubIDMap.removeItem(subId); // Release subId\n }\n }\n}\n\nfunction resolvePath(key, json) {\n if (json[key]) {\n return json[key];\n }\n const parts = key.split(\".\");\n let obj = json;\n for (let i = 0, len = parts.length; obj && (i < len); i++) {\n const part = parts[i];\n obj = obj[part];\n }\n return obj;\n}\n\nfunction vsprintf(msg, args = []) {\n return msg.replace(/\\{\\{|\\}\\}|\\{(\\d+)\\}/g, function (m, n) {\n if (m === \"{{\") {\n return \"{\";\n }\n if (m === \"}}\") {\n return \"}\";\n }\n return args[n];\n });\n}\n\nexport {LocaleService};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/localization/LocaleService.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/localization/LocaleService.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2102, + "__docId__": 2110, "kind": "function", "name": "resolvePath", "memberof": "src/viewer/localization/LocaleService.js", @@ -42330,7 +42546,7 @@ "ignore": true }, { - "__docId__": 2103, + "__docId__": 2111, "kind": "function", "name": "vsprintf", "memberof": "src/viewer/localization/LocaleService.js", @@ -42370,7 +42586,7 @@ "ignore": true }, { - "__docId__": 2104, + "__docId__": 2112, "kind": "class", "name": "LocaleService", "memberof": "src/viewer/localization/LocaleService.js", @@ -42386,7 +42602,7 @@ "interface": false }, { - "__docId__": 2105, + "__docId__": 2113, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42433,7 +42649,7 @@ ] }, { - "__docId__": 2106, + "__docId__": 2114, "kind": "member", "name": "_eventSubIDMap", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42451,7 +42667,7 @@ } }, { - "__docId__": 2107, + "__docId__": 2115, "kind": "member", "name": "_eventSubEvents", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42469,7 +42685,7 @@ } }, { - "__docId__": 2108, + "__docId__": 2116, "kind": "member", "name": "_eventSubs", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42487,7 +42703,7 @@ } }, { - "__docId__": 2109, + "__docId__": 2117, "kind": "member", "name": "_events", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42505,7 +42721,7 @@ } }, { - "__docId__": 2110, + "__docId__": 2118, "kind": "member", "name": "_locale", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42523,7 +42739,7 @@ } }, { - "__docId__": 2111, + "__docId__": 2119, "kind": "member", "name": "_messages", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42541,7 +42757,7 @@ } }, { - "__docId__": 2112, + "__docId__": 2120, "kind": "member", "name": "_locales", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42559,7 +42775,7 @@ } }, { - "__docId__": 2116, + "__docId__": 2124, "kind": "set", "name": "messages", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42584,7 +42800,7 @@ ] }, { - "__docId__": 2119, + "__docId__": 2127, "kind": "method", "name": "loadMessages", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42610,7 +42826,7 @@ "return": null }, { - "__docId__": 2121, + "__docId__": 2129, "kind": "method", "name": "clearMessages", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42625,7 +42841,7 @@ "return": null }, { - "__docId__": 2123, + "__docId__": 2131, "kind": "get", "name": "locales", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42657,7 +42873,7 @@ } }, { - "__docId__": 2124, + "__docId__": 2132, "kind": "set", "name": "locale", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42682,7 +42898,7 @@ ] }, { - "__docId__": 2126, + "__docId__": 2134, "kind": "get", "name": "locale", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42714,7 +42930,7 @@ } }, { - "__docId__": 2127, + "__docId__": 2135, "kind": "method", "name": "translate", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42764,7 +42980,7 @@ } }, { - "__docId__": 2128, + "__docId__": 2136, "kind": "method", "name": "translatePlurals", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42824,7 +43040,7 @@ } }, { - "__docId__": 2129, + "__docId__": 2137, "kind": "method", "name": "fire", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42872,7 +43088,7 @@ "return": null }, { - "__docId__": 2132, + "__docId__": 2140, "kind": "method", "name": "on", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42915,7 +43131,7 @@ } }, { - "__docId__": 2137, + "__docId__": 2145, "kind": "method", "name": "off", "memberof": "src/viewer/localization/LocaleService.js~LocaleService", @@ -42941,18 +43157,18 @@ "return": null }, { - "__docId__": 2138, + "__docId__": 2146, "kind": "file", "name": "src/viewer/metadata/IFCObjectDefaultColors.js", "content": "/**\n * @desc Initial properties for {@link Entity}s loaded from IFC models accompanied by metadata.\n *\n * When loading a model, plugins such as {@link XKTLoaderPlugin} create\n * a tree of {@link Entity}s that represent the model. These loaders can optionally load metadata, to create\n * a {@link MetaModel} corresponding to the root {@link Entity}, with a {@link MetaObject} corresponding to each\n * object {@link Entity} within the tree.\n *\n * @type {{String:Object}}\n */\nconst IFCObjectDefaultColors = {\n\n // Priority 0\n\n IfcRoof: {\n colorize: [0.837255, 0.203922, 0.270588]\n },\n IfcSlab: {\n colorize: [0.637255, 0.603922, 0.670588]\n },\n IfcWall: {\n colorize: [0.537255, 0.337255, 0.237255]\n },\n IfcWallStandardCase: {\n colorize: [0.537255, 0.337255, 0.237255]\n },\n IfcCovering: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n // Priority 1\n\n IfcDoor: {\n colorize: [0.637255, 0.603922, 0.670588]\n },\n\n // Priority 2\n\n\n IfcStair: {\n colorize: [0.637255, 0.603922, 0.670588]\n },\n IfcStairFlight: {\n colorize: [0.637255, 0.603922, 0.670588]\n },\n IfcProxy: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcRamp: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n // Priority 3\n\n IfcColumn: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcBeam: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcCurtainWall: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcPlate: {\n colorize: [0.8470588235, 0.427450980392, 0, 0.5],\n opacity: 0.3\n },\n IfcTransportElement: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcFooting: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n // Priority 4\n\n IfcRailing: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcFurnishingElement: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcFurniture: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcSystemFurnitureElement: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n // Priority 5\n\n IfcFlowSegment: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcFlowitting: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcFlowTerminal: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n IfcFlowController: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcFlowFitting: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcDuctSegment: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcDistributionFlowElement: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcDuctFitting: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n IfcLightFixture: {\n colorize: [0.8470588235, 0.8470588235, 0.870588]\n },\n\n // Priority 6\n\n IfcAirTerminal: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n IfcOpeningElement: {\n colorize: [0.137255, 0.403922, 0.870588],\n pickable: false,\n visible: false\n },\n IfcSpace: {\n colorize: [0.137255, 0.403922, 0.870588],\n pickable: false,\n visible: false,\n opacity: 0.5\n },\n\n IfcWindow: {\n colorize: [0.137255, 0.403922, 0.870588],\n pickable: true,\n opacity: 0.1\n },\n\n //\n\n IfcBuildingElementProxy: {\n colorize: [0.5, 0.5, 0.5]\n },\n\n IfcSite: {\n colorize: [0.137255, 0.403922, 0.870588]\n },\n\n IfcMember: {\n colorize: [0.8470588235, 0.427450980392, 0]\n },\n\n DEFAULT: {\n colorize: [0.5, 0.5, 0.5]\n }\n};\n\nexport {IFCObjectDefaultColors}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/IFCObjectDefaultColors.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/IFCObjectDefaultColors.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2139, + "__docId__": 2147, "kind": "variable", "name": "IFCObjectDefaultColors", "memberof": "src/viewer/metadata/IFCObjectDefaultColors.js", @@ -42974,18 +43190,18 @@ } }, { - "__docId__": 2140, + "__docId__": 2148, "kind": "file", "name": "src/viewer/metadata/IFCObjectDefaults.js", "content": "/**\n * @desc Default initial properties for {@link Entity}s loaded from models accompanied by metadata.\n *\n * When loading a model, plugins such as {@link XKTLoaderPlugin} create\n * a tree of {@link Entity}s that represent the model. These loaders can optionally load metadata, to create\n * a {@link MetaModel} corresponding to the root {@link Entity}, with a {@link MetaObject} corresponding to each\n * object {@link Entity} within the tree.\n *\n * @type {{String:Object}}\n */\nconst IFCObjectDefaults = {\n\n DEFAULT: {\n }\n};\n\nexport {IFCObjectDefaults}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/IFCObjectDefaults.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/IFCObjectDefaults.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2141, + "__docId__": 2149, "kind": "variable", "name": "IFCObjectDefaults", "memberof": "src/viewer/metadata/IFCObjectDefaults.js", @@ -43007,18 +43223,18 @@ } }, { - "__docId__": 2142, + "__docId__": 2150, "kind": "file", "name": "src/viewer/metadata/MetaModel.js", "content": "import {PropertySet} from \"./PropertySet.js\";\nimport {MetaObject} from \"./MetaObject.js\";\nimport {math} from \"../scene/math/math.js\";\n\n/**\n * @desc Metadata corresponding to an {@link Entity} that represents a model.\n *\n * An {@link Entity} represents a model when {@link Entity#isModel} is ````true````\n *\n * A MetaModel corresponds to an {@link Entity} by having the same {@link MetaModel#id} as the {@link Entity#id}.\n *\n * A MetaModel is created by {@link MetaScene#createMetaModel} and belongs to a {@link MetaScene}.\n *\n * Each MetaModel is registered by {@link MetaModel#id} in {@link MetaScene#metaModels}.\n *\n * A {@link MetaModel} represents its object structure with a tree of {@link MetaObject}s, with {@link MetaModel#rootMetaObject} referencing the root {@link MetaObject}.\n *\n * @class MetaModel\n */\nclass MetaModel {\n\n /**\n * Creates a new, unfinalized MetaModel.\n *\n * * The MetaModel is immediately registered by {@link MetaModel#id} in {@link MetaScene#metaModels}, even though it's not yet populated.\n * * The MetaModel then needs to be populated with one or more calls to {@link metaModel#loadData}.\n * * As we populate it, the MetaModel will create {@link MetaObject}s and {@link PropertySet}s in itself, and in the MetaScene.\n * * When populated, call {@link MetaModel#finalize} to finish it off, which causes MetaScene to fire a \"metaModelCreated\" event.\n */\n constructor(params) {\n\n /**\n * Globally-unique ID.\n *\n * MetaModels are registered by ID in {@link MetaScene#metaModels}.\n *\n * When this MetaModel corresponds to an {@link Entity} then this ID will match the {@link Entity#id}.\n *\n * @property id\n * @type {String|Number}\n */\n this.id = params.id;\n\n /**\n * The project ID\n * @property projectId\n * @type {String|Number}\n */\n this.projectId = params.projectId;\n\n /**\n * The revision ID, if available.\n *\n * Will be undefined if not available.\n *\n * @property revisionId\n * @type {String|Number}\n */\n this.revisionId = params.revisionId;\n\n /**\n * The model author, if available.\n *\n * Will be undefined if not available.\n *\n * @property author\n * @type {String}\n */\n this.author = params.author;\n\n /**\n * The date the model was created, if available.\n *\n * Will be undefined if not available.\n *\n * @property createdAt\n * @type {String}\n */\n this.createdAt = params.createdAt;\n\n /**\n * The application that created the model, if available.\n *\n * Will be undefined if not available.\n *\n * @property creatingApplication\n * @type {String}\n */\n this.creatingApplication = params.creatingApplication;\n\n /**\n * The model schema version, if available.\n *\n * Will be undefined if not available.\n *\n * @property schema\n * @type {String}\n */\n this.schema = params.schema;\n\n /**\n * Metadata on the {@link Scene}.\n *\n * @property metaScene\n * @type {MetaScene}\n */\n this.metaScene = params.metaScene;\n\n /**\n * The {@link PropertySet}s in this MetaModel.\n *\n * @property propertySets\n * @type {PropertySet[]}\n */\n this.propertySets = [];\n\n /**\n * The root {@link MetaObject}s in this MetaModel's composition structure hierarchy.\n *\n * @property rootMetaObject\n * @type {MetaObject[]}\n */\n this.rootMetaObjects = [];\n\n /**\n * The {@link MetaObject}s in this MetaModel, each mapped to its ID.\n *\n * @property metaObjects\n * @type {MetaObject[]}\n */\n this.metaObjects = [];\n\n /**\n * Connectivity graph.\n * @type {{}}\n */\n this.graph = params.graph || {};\n\n this.metaScene.metaModels[this.id] = this;\n\n /**\n * True when this MetaModel has been finalized.\n * @type {boolean}\n */\n this.finalized = false;\n }\n\n /**\n * Backwards compatibility with the model having a single root MetaObject.\n *\n * @property rootMetaObject\n * @type {MetaObject|null}\n */\n get rootMetaObject() {\n if (this.rootMetaObjects.length == 1) {\n return this.rootMetaObjects[0];\n }\n return null;\n }\n\n /**\n * Load metamodel data into this MetaModel.\n * @param metaModelData\n */\n loadData(metaModelData, options = {}) {\n\n if (this.finalized) {\n throw \"MetaScene already finalized - can't add more data\";\n }\n\n this._globalizeIDs(metaModelData, options)\n\n const metaScene = this.metaScene;\n const propertyLookup = metaModelData.properties;\n\n // Create global Property Sets\n\n if (metaModelData.propertySets) {\n for (let i = 0, len = metaModelData.propertySets.length; i < len; i++) {\n const propertySetData = metaModelData.propertySets[i];\n if (!propertySetData.properties) { // HACK: https://github.com/Creoox/creoox-ifc2gltfcxconverter/issues/8\n propertySetData.properties = [];\n }\n let propertySet = metaScene.propertySets[propertySetData.id];\n if (!propertySet) {\n if (propertyLookup) {\n this._decompressProperties(propertyLookup, propertySetData.properties);\n }\n propertySet = new PropertySet({\n id: propertySetData.id,\n originalSystemId: propertySetData.originalSystemId || propertySetData.id,\n type: propertySetData.type,\n name: propertySetData.name,\n properties: propertySetData.properties\n });\n metaScene.propertySets[propertySet.id] = propertySet;\n }\n propertySet.metaModels.push(this);\n this.propertySets.push(propertySet);\n }\n }\n\n if (metaModelData.metaObjects) {\n for (let i = 0, len = metaModelData.metaObjects.length; i < len; i++) {\n const metaObjectData = metaModelData.metaObjects[i];\n const id = metaObjectData.id;\n let metaObject = metaScene.metaObjects[id];\n if (!metaObject) {\n const type = metaObjectData.type;\n const originalSystemId = metaObjectData.originalSystemId;\n const propertySetIds = metaObjectData.propertySets || metaObjectData.propertySetIds;\n metaObject = new MetaObject({\n id,\n originalSystemId,\n parentId: metaObjectData.parent,\n type,\n name: metaObjectData.name,\n attributes: metaObjectData.attributes,\n propertySetIds,\n external: metaObjectData.external,\n });\n this.metaScene.metaObjects[id] = metaObject;\n metaObject.metaModels = [];\n }\n this.metaObjects.push(metaObject);\n if (!metaObjectData.parent) {\n this.rootMetaObjects.push(metaObject);\n metaScene.rootMetaObjects[id] = metaObject;\n }\n }\n }\n }\n\n _decompressProperties(propertyLookup, properties) {\n for (let i = 0, len = properties.length; i < len; i++) {\n const property = properties[i];\n if (Number.isInteger(property)) {\n const lookupProperty = propertyLookup[property];\n if (lookupProperty) {\n properties[i] = lookupProperty;\n }\n }\n }\n }\n\n finalize() {\n\n if (this.finalized) {\n throw \"MetaScene already finalized - can't re-finalize\";\n }\n\n // Re-link MetaScene's entire MetaObject parent/child hierarchy\n\n const metaScene = this.metaScene;\n\n for (let objectId in metaScene.metaObjects) {\n const metaObject = metaScene.metaObjects[objectId];\n if (metaObject.children) {\n metaObject.children = [];\n }\n\n // Re-link each MetaObject's property sets\n\n if (metaObject.propertySets) {\n metaObject.propertySets = [];\n }\n if (metaObject.propertySetIds) {\n for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {\n const propertySetId = metaObject.propertySetIds[i];\n const propertySet = metaScene.propertySets[propertySetId];\n metaObject.propertySets.push(propertySet);\n }\n }\n }\n\n for (let objectId in metaScene.metaObjects) {\n const metaObject = metaScene.metaObjects[objectId];\n if (metaObject.parentId) {\n const parentMetaObject = metaScene.metaObjects[metaObject.parentId];\n if (parentMetaObject) {\n metaObject.parent = parentMetaObject;\n (parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);\n }\n }\n }\n\n // Relink MetaObjects to their MetaModels\n\n for (let objectId in metaScene.metaObjects) {\n const metaObject = metaScene.metaObjects[objectId];\n metaObject.metaModels = [];\n }\n\n for (let modelId in metaScene.metaModels) {\n const metaModel = metaScene.metaModels[modelId];\n for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {\n const metaObject = metaModel.metaObjects[i];\n metaObject.metaModels.push(metaModel);\n }\n }\n\n // Rebuild MetaScene's MetaObjects-by-type lookup\n\n metaScene.metaObjectsByType = {};\n for (let objectId in metaScene.metaObjects) {\n const metaObject = metaScene.metaObjects[objectId];\n const type = metaObject.type;\n (metaScene.metaObjectsByType[type] || (metaScene.metaObjectsByType[type] = {}))[objectId] = metaObject;\n }\n\n this.finalized = true;\n\n this.metaScene.fire(\"metaModelCreated\", this.id);\n }\n\n /**\n * Gets this MetaModel as JSON.\n * @returns {{schema: (String|string|*), createdAt: (String|string|*), metaObjects: *[], author: (String|string|*), id: (String|Number|string|number|*), creatingApplication: (String|string|*), projectId: (String|Number|string|number|*), propertySets: *[]}}\n */\n getJSON() {\n const json = {\n id: this.id,\n projectId: this.projectId,\n author: this.author,\n createdAt: this.createdAt,\n schema: this.schema,\n creatingApplication: this.creatingApplication,\n metaObjects: [],\n propertySets: []\n };\n for (let i = 0, len = this.metaObjects.length; i < len; i++) {\n const metaObject = this.metaObjects[i];\n const metaObjectCfg = {\n id: metaObject.id,\n originalSystemId: metaObject.originalSystemId,\n extId: metaObject.extId,\n type: metaObject.type,\n name: metaObject.name\n };\n if (metaObject.parent) {\n metaObjectCfg.parent = metaObject.parent.id;\n }\n if (metaObject.attributes) {\n metaObjectCfg.attributes = metaObject.attributes;\n }\n if (metaObject.propertySetIds) {\n metaObjectCfg.propertySetIds = metaObject.propertySetIds;\n }\n json.metaObjects.push(metaObjectCfg);\n }\n for (let i = 0, len = this.propertySets.length; i < len; i++) {\n const propertySet = this.propertySets[i];\n const propertySetCfg = {\n id: propertySet.id,\n originalSystemId: propertySet.originalSystemId,\n extId: propertySet.extId,\n type: propertySet.type,\n name: propertySet.name,\n propertyies: []\n };\n for (let j = 0, lenj = propertySet.properties.length; j < lenj; j++) {\n const property = propertySet.properties[j];\n const propertyCfg = {\n id: property.id,\n description: property.description,\n type: property.type,\n name: property.name,\n value: property.value,\n valueType: property.valueType\n };\n propertySetCfg.properties.push(propertyCfg);\n }\n json.propertySets.push(propertySetCfg);\n }\n return json;\n }\n\n _globalizeIDs(metaModelData, options) {\n\n const globalize = !!options.globalizeObjectIds;\n\n if (metaModelData.metaObjects) {\n for (let i = 0, len = metaModelData.metaObjects.length; i < len; i++) {\n const metaObjectData = metaModelData.metaObjects[i];\n\n // Globalize MetaObject IDs and parent IDs\n\n metaObjectData.originalSystemId = metaObjectData.id;\n if (metaObjectData.parent) {\n metaObjectData.originalParentSystemId = metaObjectData.parent;\n }\n if (globalize) {\n metaObjectData.id = math.globalizeObjectId(this.id, metaObjectData.id);\n if (metaObjectData.parent) {\n metaObjectData.parent = math.globalizeObjectId(this.id, metaObjectData.parent);\n }\n }\n\n // Globalize MetaObject property set IDs\n\n if (globalize) {\n const propertySetIds = metaObjectData.propertySetIds;\n if (propertySetIds) {\n const propertySetGlobalIds = [];\n for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {\n propertySetGlobalIds.push(math.globalizeObjectId(this.id, propertySetIds[j]));\n }\n metaObjectData.propertySetIds = propertySetGlobalIds;\n metaObjectData.originalSystemPropertySetIds = propertySetIds;\n }\n } else {\n metaObjectData.originalSystemPropertySetIds = metaObjectData.propertySetIds;\n }\n }\n }\n\n // Globalize global PropertySet IDs\n\n if (metaModelData.propertySets) {\n for (let i = 0, len = metaModelData.propertySets.length; i < len; i++) {\n const propertySet = metaModelData.propertySets[i];\n propertySet.originalSystemId = propertySet.id;\n if (globalize) {\n propertySet.id = math.globalizeObjectId(this.id, propertySet.id);\n }\n }\n }\n }\n}\n\n\nexport {MetaModel};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/MetaModel.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/MetaModel.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2143, + "__docId__": 2151, "kind": "class", "name": "MetaModel", "memberof": "src/viewer/metadata/MetaModel.js", @@ -43039,7 +43255,7 @@ "interface": false }, { - "__docId__": 2144, + "__docId__": 2152, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43052,7 +43268,7 @@ "lineNumber": 30 }, { - "__docId__": 2145, + "__docId__": 2153, "kind": "member", "name": "id", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43084,7 +43300,7 @@ } }, { - "__docId__": 2146, + "__docId__": 2154, "kind": "member", "name": "projectId", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43116,7 +43332,7 @@ } }, { - "__docId__": 2147, + "__docId__": 2155, "kind": "member", "name": "revisionId", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43148,7 +43364,7 @@ } }, { - "__docId__": 2148, + "__docId__": 2156, "kind": "member", "name": "author", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43179,7 +43395,7 @@ } }, { - "__docId__": 2149, + "__docId__": 2157, "kind": "member", "name": "createdAt", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43210,7 +43426,7 @@ } }, { - "__docId__": 2150, + "__docId__": 2158, "kind": "member", "name": "creatingApplication", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43241,7 +43457,7 @@ } }, { - "__docId__": 2151, + "__docId__": 2159, "kind": "member", "name": "schema", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43272,7 +43488,7 @@ } }, { - "__docId__": 2152, + "__docId__": 2160, "kind": "member", "name": "metaScene", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43303,7 +43519,7 @@ } }, { - "__docId__": 2153, + "__docId__": 2161, "kind": "member", "name": "propertySets", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43334,7 +43550,7 @@ } }, { - "__docId__": 2154, + "__docId__": 2162, "kind": "member", "name": "rootMetaObjects", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43365,7 +43581,7 @@ } }, { - "__docId__": 2155, + "__docId__": 2163, "kind": "member", "name": "metaObjects", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43396,7 +43612,7 @@ } }, { - "__docId__": 2156, + "__docId__": 2164, "kind": "member", "name": "graph", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43415,7 +43631,7 @@ } }, { - "__docId__": 2157, + "__docId__": 2165, "kind": "member", "name": "finalized", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43434,7 +43650,7 @@ } }, { - "__docId__": 2158, + "__docId__": 2166, "kind": "get", "name": "rootMetaObject", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43468,7 +43684,7 @@ } }, { - "__docId__": 2159, + "__docId__": 2167, "kind": "method", "name": "loadData", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43494,7 +43710,7 @@ "return": null }, { - "__docId__": 2160, + "__docId__": 2168, "kind": "method", "name": "_decompressProperties", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43524,7 +43740,7 @@ "return": null }, { - "__docId__": 2161, + "__docId__": 2169, "kind": "method", "name": "finalize", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43540,7 +43756,7 @@ "return": null }, { - "__docId__": 2163, + "__docId__": 2171, "kind": "method", "name": "getJSON", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43568,7 +43784,7 @@ "params": [] }, { - "__docId__": 2164, + "__docId__": 2172, "kind": "method", "name": "_globalizeIDs", "memberof": "src/viewer/metadata/MetaModel.js~MetaModel", @@ -43598,18 +43814,18 @@ "return": null }, { - "__docId__": 2165, + "__docId__": 2173, "kind": "file", "name": "src/viewer/metadata/MetaObject.js", "content": "/**\n * @desc Metadata corresponding to an {@link Entity} that represents an object.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````\n *\n * A MetaObject corresponds to an {@link Entity} by having the same {@link MetaObject#id} as the {@link Entity#id}.\n *\n * A MetaObject is created within {@link MetaScene#createMetaModel} and belongs to a {@link MetaModel}.\n *\n * Each MetaObject is registered by {@link MetaObject#id} in {@link MetaScene#metaObjects}.\n *\n * A {@link MetaModel} represents its object structure with a tree of MetaObjects, with {@link MetaModel#rootMetaObject} referencing\n * the root MetaObject.\n *\n * @class MetaObject\n */\nclass MetaObject {\n\n /**\n * @private\n */\n constructor(params) {\n\n /**\n * The MetaModels that share this MetaObject.\n * @type {MetaModel[]}\n */\n this.metaModels = [];\n\n /**\n * Globally-unique ID.\n *\n * MetaObject instances are registered by this ID in {@link MetaScene#metaObjects}.\n *\n * @property id\n * @type {String|Number}\n */\n this.id = params.id;\n\n /**\n * ID of the parent MetaObject.\n * @type {String|Number}\n */\n this.parentId = params.parentId;\n\n /**\n * The parent MetaObject.\n * @type {MetaObject | null}\n */\n this.parent = null;\n\n /**\n * ID of the corresponding object within the originating system, if any.\n *\n * @type {String}\n * @abstract\n */\n this.originalSystemId = params.originalSystemId;\n\n /**\n * Human-readable name.\n *\n * @property name\n * @type {String}\n */\n this.name = params.name;\n\n /**\n * Type - often an IFC product type.\n *\n * @property type\n * @type {String}\n */\n this.type = params.type;\n\n /**\n * IDs of PropertySets associated with this MetaObject.\n * @type {[]|*}\n */\n this.propertySetIds = params.propertySetIds;\n\n /**\n * The {@link PropertySet}s associated with this MetaObject.\n *\n * @property propertySets\n * @type {PropertySet[]}\n */\n this.propertySets = [];\n\n /**\n * The attributes of this MetaObject.\n * @type {{}}\n */\n this.attributes = params.attributes || {};\n\n if (params.external !== undefined && params.external !== null) {\n \n /**\n * External application-specific metadata\n *\n * Undefined when there are is no external application-specific metadata.\n *\n * @property external\n * @type {*}\n */\n this.external = params.external;\n }\n }\n\n /**\n * Backwards compatibility with the object belonging to a single MetaModel.\n * \n * @property metaModel\n * @type {MetaModel|null}\n **/\n get metaModel() {\n if (this.metaModels.length == 1) {\n return this.metaModels[0];\n }\n\n return null;\n }\n\n /**\n * Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the subtree.\n *\n * @returns {String[]} Array of {@link MetaObject#id}s.\n */\n getObjectIDsInSubtree() {\n const objectIds = [];\n\n function visit(metaObject) {\n if (!metaObject) {\n return;\n }\n objectIds.push(metaObject.id);\n const children = metaObject.children;\n if (children) {\n for (var i = 0, len = children.length; i < len; i++) {\n visit(children[i]);\n }\n }\n }\n\n visit(this);\n return objectIds;\n }\n\n\n /**\n * Iterates over the {@link MetaObject}s within the subtree.\n *\n * @param {Function} callback Callback fired at each {@link MetaObject}.\n */\n withMetaObjectsInSubtree(callback) {\n\n function visit(metaObject) {\n if (!metaObject) {\n return;\n }\n callback(metaObject);\n const children = metaObject.children;\n if (children) {\n for (var i = 0, len = children.length; i < len; i++) {\n visit(children[i]);\n }\n }\n }\n\n visit(this);\n }\n\n /**\n * Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the subtree that have the given {@link MetaObject#type}s.\n *\n * @param {String[]} types {@link MetaObject#type} values.\n * @returns {String[]} Array of {@link MetaObject#id}s.\n */\n getObjectIDsInSubtreeByType(types) {\n const mask = {};\n for (var i = 0, len = types.length; i < len; i++) {\n mask[types[i]] = types[i];\n }\n const objectIds = [];\n\n function visit(metaObject) {\n if (!metaObject) {\n return;\n }\n if (mask[metaObject.type]) {\n objectIds.push(metaObject.id);\n }\n const children = metaObject.children;\n if (children) {\n for (var i = 0, len = children.length; i < len; i++) {\n visit(children[i]);\n }\n }\n }\n\n visit(this);\n return objectIds;\n }\n\n /**\n * Returns properties of this MeteObject as JSON.\n *\n * @returns {{id: (String|Number), type: String, name: String, parent: (String|Number|Undefined)}}\n */\n getJSON() {\n var json = {\n id: this.id,\n type: this.type,\n name: this.name\n };\n if (this.parent) {\n json.parent = this.parent.id\n }\n return json;\n }\n}\n\nexport {MetaObject};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/MetaObject.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/MetaObject.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2166, + "__docId__": 2174, "kind": "class", "name": "MetaObject", "memberof": "src/viewer/metadata/MetaObject.js", @@ -43630,7 +43846,7 @@ "interface": false }, { - "__docId__": 2167, + "__docId__": 2175, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43644,7 +43860,7 @@ "ignore": true }, { - "__docId__": 2168, + "__docId__": 2176, "kind": "member", "name": "metaModels", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43663,7 +43879,7 @@ } }, { - "__docId__": 2169, + "__docId__": 2177, "kind": "member", "name": "id", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43695,7 +43911,7 @@ } }, { - "__docId__": 2170, + "__docId__": 2178, "kind": "member", "name": "parentId", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43715,7 +43931,7 @@ } }, { - "__docId__": 2171, + "__docId__": 2179, "kind": "member", "name": "parent", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43735,7 +43951,7 @@ } }, { - "__docId__": 2172, + "__docId__": 2180, "kind": "member", "name": "originalSystemId", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43755,7 +43971,7 @@ "abstract": true }, { - "__docId__": 2173, + "__docId__": 2181, "kind": "member", "name": "name", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43786,7 +44002,7 @@ } }, { - "__docId__": 2174, + "__docId__": 2182, "kind": "member", "name": "type", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43817,7 +44033,7 @@ } }, { - "__docId__": 2175, + "__docId__": 2183, "kind": "member", "name": "propertySetIds", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43837,7 +44053,7 @@ } }, { - "__docId__": 2176, + "__docId__": 2184, "kind": "member", "name": "propertySets", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43868,7 +44084,7 @@ } }, { - "__docId__": 2177, + "__docId__": 2185, "kind": "member", "name": "attributes", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43887,7 +44103,7 @@ } }, { - "__docId__": 2178, + "__docId__": 2186, "kind": "member", "name": "external", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43918,7 +44134,7 @@ } }, { - "__docId__": 2179, + "__docId__": 2187, "kind": "get", "name": "metaModel", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43952,7 +44168,7 @@ } }, { - "__docId__": 2180, + "__docId__": 2188, "kind": "method", "name": "getObjectIDsInSubtree", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -43980,7 +44196,7 @@ "params": [] }, { - "__docId__": 2181, + "__docId__": 2189, "kind": "method", "name": "withMetaObjectsInSubtree", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -44006,7 +44222,7 @@ "return": null }, { - "__docId__": 2182, + "__docId__": 2190, "kind": "method", "name": "getObjectIDsInSubtreeByType", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -44045,7 +44261,7 @@ } }, { - "__docId__": 2183, + "__docId__": 2191, "kind": "method", "name": "getJSON", "memberof": "src/viewer/metadata/MetaObject.js~MetaObject", @@ -44073,18 +44289,18 @@ "params": [] }, { - "__docId__": 2184, + "__docId__": 2192, "kind": "file", "name": "src/viewer/metadata/MetaScene.js", "content": "import {MetaModel} from \"./MetaModel.js\";\nimport {MetaObject} from \"./MetaObject.js\";\nimport {PropertySet} from \"./PropertySet.js\";\nimport {math} from \"../scene/math/math.js\";\n\n/**\n * @desc Metadata corresponding to a {@link Scene}.\n *\n * * Located in {@link Viewer#metaScene}.\n * * Contains {@link MetaModel}s and {@link MetaObject}s.\n * * [Scene graph example with metadata](http://xeokit.github.io/xeokit-sdk/examples/index.html#sceneRepresentation_SceneGraph_metadata)\n */\nclass MetaScene {\n\n /**\n * @private\n */\n constructor(viewer, scene) {\n\n /**\n * The {@link Viewer}.\n * @property viewer\n * @type {Viewer}\n */\n this.viewer = viewer;\n\n /**\n * The {@link Scene}.\n * @property scene\n * @type {Scene}\n */\n this.scene = scene;\n\n /**\n * The {@link MetaModel}s belonging to this MetaScene, each mapped to its {@link MetaModel#modelId}.\n *\n * @type {{String:MetaModel}}\n */\n this.metaModels = {};\n\n /**\n * The {@link PropertySet}s belonging to this MetaScene, each mapped to its {@link PropertySet#id}.\n *\n * @type {{String:PropertySet}}\n */\n this.propertySets = {};\n\n /**\n * The {@link MetaObject}s belonging to this MetaScene, each mapped to its {@link MetaObject#id}.\n *\n * @type {{String:MetaObject}}\n */\n this.metaObjects = {};\n\n /**\n * The {@link MetaObject}s belonging to this MetaScene, each mapped to its {@link MetaObject#type}.\n *\n * @type {{String:MetaObject}}\n */\n this.metaObjectsByType = {};\n\n /**\n * The root {@link MetaObject}s belonging to this MetaScene, each mapped to its {@link MetaObject#id}.\n *\n * @type {{String:MetaObject}}\n */\n this.rootMetaObjects = {};\n\n /**\n * Subscriptions to events sent with {@link fire}.\n * @private\n */\n this._eventSubs = {};\n }\n\n /**\n * Subscribes to an event fired at this Viewer.\n *\n * @param {String} event The event\n * @param {Function} callback Callback fired on the event\n */\n on(event, callback) {\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = [];\n this._eventSubs[event] = subs;\n }\n subs.push(callback);\n }\n\n /**\n * Fires an event at this Viewer.\n *\n * @param {String} event Event name\n * @param {Object} value Event parameters\n */\n fire(event, value) {\n const subs = this._eventSubs[event];\n if (subs) {\n for (let i = 0, len = subs.length; i < len; i++) {\n subs[i](value);\n }\n }\n }\n\n /**\n * Unsubscribes from an event fired at this Viewer.\n * @param event\n */\n off(event) { // TODO\n\n }\n\n /**\n * Creates a {@link MetaModel} in this MetaScene.\n *\n * The MetaModel will contain a hierarchy of {@link MetaObject}s, created from the\n * meta objects in ````metaModelData````.\n *\n * The meta object hierarchy in ````metaModelData```` is expected to be non-cyclic, with a single root. If the meta\n * objects are cyclic, then this method will log an error and attempt to recover by creating a dummy root MetaObject\n * of type \"Model\" and connecting all other MetaObjects as its direct children. If the meta objects contain multiple\n * roots, then this method similarly attempts to recover by creating a dummy root MetaObject of type \"Model\" and\n * connecting all the root MetaObjects as its children.\n *\n * @param {String} modelId ID for the new {@link MetaModel}, which will have {@link MetaModel#id} set to this value.\n * @param {Object} metaModelData Data for the {@link MetaModel}.\n * @param {Object} [options] Options for creating the {@link MetaModel}.\n * @param {Object} [options.includeTypes] When provided, only create {@link MetaObject}s with types in this list.\n * @param {Object} [options.excludeTypes] When provided, never create {@link MetaObject}s with types in this list.\n * @param {Boolean} [options.globalizeObjectIds=false] Whether to globalize each {@link MetaObject#id}. Set this ````true```` when you need to load multiple instances of the same meta model, to avoid ID clashes between the meta objects in the different instances.\n * @returns {MetaModel} The new MetaModel.\n */\n createMetaModel(modelId, metaModelData, options = {}) {\n\n const metaModel = new MetaModel({ // Registers MetaModel in #metaModels\n metaScene: this,\n id: modelId,\n projectId: metaModelData.projectId || \"none\",\n revisionId: metaModelData.revisionId || \"none\",\n author: metaModelData.author || \"none\",\n createdAt: metaModelData.createdAt || \"none\",\n creatingApplication: metaModelData.creatingApplication || \"none\",\n schema: metaModelData.schema || \"none\",\n propertySets: []\n });\n\n metaModel.loadData(metaModelData);\n\n metaModel.finalize();\n\n return metaModel;\n }\n\n /**\n * Removes a {@link MetaModel} from this MetaScene.\n *\n * Fires a \"metaModelDestroyed\" event with the value of the {@link MetaModel#id}.\n *\n * @param {String} metaModelId ID of the target {@link MetaModel}.\n */\n destroyMetaModel(metaModelId) {\n\n const metaModel = this.metaModels[metaModelId];\n if (!metaModel) {\n return;\n }\n\n // Remove global PropertySets\n\n if (metaModel.propertySets) {\n for (let i = 0, len = metaModel.propertySets.length; i < len; i++) {\n const propertySet = metaModel.propertySets[i];\n if (propertySet.metaModels.length === 1 && propertySet.metaModels[0].id === metaModelId) { // Property set owned only by this model, delete\n delete this.propertySets[propertySet.id];\n } else {\n const newMetaModels = [];\n for (let j = 0, lenj = propertySet.metaModels.length; j < lenj; j++) {\n if (propertySet.metaModels[j].id !== metaModelId) {\n newMetaModels.push(propertySet.metaModels[j]);\n }\n }\n propertySet.metaModels = newMetaModels;\n }\n }\n }\n\n // Remove MetaObjects\n\n if (metaModel.metaObjects) {\n for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {\n const metaObject = metaModel.metaObjects[i];\n const type = metaObject.type;\n const id = metaObject.id;\n if (metaObject.metaModels.length === 1&& metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete\n delete this.metaObjects[id];\n if (!metaObject.parent) {\n delete this.rootMetaObjects[id];\n }\n }\n }\n }\n\n // Re-link entire MetaObject parent/child hierarchy\n\n for (let objectId in this.metaObjects) {\n const metaObject = this.metaObjects[objectId];\n if (metaObject.children) {\n metaObject.children = [];\n }\n\n // Re-link each MetaObject's property sets\n\n if (metaObject.propertySets) {\n metaObject.propertySets = [];\n }\n if (metaObject.propertySetIds) {\n for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {\n const propertySetId = metaObject.propertySetIds[i];\n const propertySet = this.propertySets[propertySetId];\n metaObject.propertySets.push(propertySet);\n }\n }\n }\n\n this.metaObjectsByType = {};\n\n for (let objectId in this.metaObjects) {\n const metaObject = this.metaObjects[objectId];\n const type = metaObject.type;\n if (metaObject.children) {\n metaObject.children = null;\n }\n (this.metaObjectsByType[type] || (this.metaObjectsByType[type] = {}))[objectId] = metaObject;\n }\n\n for (let objectId in this.metaObjects) {\n const metaObject = this.metaObjects[objectId];\n if (metaObject.parentId) {\n const parentMetaObject = this.metaObjects[metaObject.parentId];\n if (parentMetaObject) {\n metaObject.parent = parentMetaObject;\n (parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);\n }\n }\n }\n\n delete this.metaModels[metaModelId];\n\n // Relink MetaObjects to their MetaModels\n\n for (let objectId in this.metaObjects) {\n const metaObject = this.metaObjects[objectId];\n metaObject.metaModels = [];\n }\n\n for (let modelId in this.metaModels) {\n const metaModel = this.metaModels[modelId];\n for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {\n const metaObject = metaModel.metaObjects[i];\n metaObject.metaModels.push(metaModel);\n }\n }\n\n this.fire(\"metaModelDestroyed\", metaModelId);\n }\n\n /**\n * Gets the {@link MetaObject#id}s of the {@link MetaObject}s that have the given {@link MetaObject#type}.\n *\n * @param {String} type The type.\n * @returns {String[]} Array of {@link MetaObject#id}s.\n */\n getObjectIDsByType(type) {\n const metaObjects = this.metaObjectsByType[type];\n return metaObjects ? Object.keys(metaObjects) : [];\n }\n\n /**\n * Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the given subtree.\n *\n * @param {String} id ID of the root {@link MetaObject} of the given subtree.\n * @param {String[]} [includeTypes] Optional list of types to include.\n * @param {String[]} [excludeTypes] Optional list of types to exclude.\n * @returns {String[]} Array of {@link MetaObject#id}s.\n */\n getObjectIDsInSubtree(id, includeTypes, excludeTypes) {\n\n const list = [];\n const metaObject = this.metaObjects[id];\n const includeMask = (includeTypes && includeTypes.length > 0) ? arrayToMap(includeTypes) : null;\n const excludeMask = (excludeTypes && excludeTypes.length > 0) ? arrayToMap(excludeTypes) : null;\n\n const visit = (metaObject) => {\n if (!metaObject) {\n return;\n }\n var include = true;\n if (excludeMask && excludeMask[metaObject.type]) {\n include = false;\n } else if (includeMask && (!includeMask[metaObject.type])) {\n include = false;\n }\n if (include) {\n list.push(metaObject.id);\n }\n const children = metaObject.children;\n if (children) {\n for (var i = 0, len = children.length; i < len; i++) {\n visit(children[i]);\n }\n }\n }\n\n visit(metaObject);\n return list;\n }\n\n /**\n * Iterates over the {@link MetaObject}s within the subtree.\n *\n * @param {String} id ID of root {@link MetaObject}.\n * @param {Function} callback Callback fired at each {@link MetaObject}.\n */\n withMetaObjectsInSubtree(id, callback) {\n const metaObject = this.metaObjects[id];\n if (!metaObject) {\n return;\n }\n metaObject.withMetaObjectsInSubtree(callback);\n }\n}\n\nfunction arrayToMap(array) {\n const map = {};\n for (var i = 0, len = array.length; i < len; i++) {\n map[array[i]] = true;\n }\n return map;\n}\n\nexport {MetaScene};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/MetaScene.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/MetaScene.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2185, + "__docId__": 2193, "kind": "function", "name": "arrayToMap", "memberof": "src/viewer/metadata/MetaScene.js", @@ -44115,7 +44331,7 @@ "ignore": true }, { - "__docId__": 2186, + "__docId__": 2194, "kind": "class", "name": "MetaScene", "memberof": "src/viewer/metadata/MetaScene.js", @@ -44130,7 +44346,7 @@ "interface": false }, { - "__docId__": 2187, + "__docId__": 2195, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44144,7 +44360,7 @@ "ignore": true }, { - "__docId__": 2188, + "__docId__": 2196, "kind": "member", "name": "viewer", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44175,7 +44391,7 @@ } }, { - "__docId__": 2189, + "__docId__": 2197, "kind": "member", "name": "scene", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44206,7 +44422,7 @@ } }, { - "__docId__": 2190, + "__docId__": 2198, "kind": "member", "name": "metaModels", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44225,7 +44441,7 @@ } }, { - "__docId__": 2191, + "__docId__": 2199, "kind": "member", "name": "propertySets", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44244,7 +44460,7 @@ } }, { - "__docId__": 2192, + "__docId__": 2200, "kind": "member", "name": "metaObjects", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44263,7 +44479,7 @@ } }, { - "__docId__": 2193, + "__docId__": 2201, "kind": "member", "name": "metaObjectsByType", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44282,7 +44498,7 @@ } }, { - "__docId__": 2194, + "__docId__": 2202, "kind": "member", "name": "rootMetaObjects", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44301,7 +44517,7 @@ } }, { - "__docId__": 2195, + "__docId__": 2203, "kind": "member", "name": "_eventSubs", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44318,7 +44534,7 @@ } }, { - "__docId__": 2196, + "__docId__": 2204, "kind": "method", "name": "on", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44354,7 +44570,7 @@ "return": null }, { - "__docId__": 2197, + "__docId__": 2205, "kind": "method", "name": "fire", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44390,7 +44606,7 @@ "return": null }, { - "__docId__": 2198, + "__docId__": 2206, "kind": "method", "name": "off", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44416,7 +44632,7 @@ "return": null }, { - "__docId__": 2199, + "__docId__": 2207, "kind": "method", "name": "createMetaModel", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44507,7 +44723,7 @@ } }, { - "__docId__": 2200, + "__docId__": 2208, "kind": "method", "name": "destroyMetaModel", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44533,7 +44749,7 @@ "return": null }, { - "__docId__": 2202, + "__docId__": 2210, "kind": "method", "name": "getObjectIDsByType", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44572,7 +44788,7 @@ } }, { - "__docId__": 2203, + "__docId__": 2211, "kind": "method", "name": "getObjectIDsInSubtree", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44631,7 +44847,7 @@ } }, { - "__docId__": 2204, + "__docId__": 2212, "kind": "method", "name": "withMetaObjectsInSubtree", "memberof": "src/viewer/metadata/MetaScene.js~MetaScene", @@ -44667,18 +44883,18 @@ "return": null }, { - "__docId__": 2205, + "__docId__": 2213, "kind": "file", "name": "src/viewer/metadata/Property.js", "content": "/**\n * @desc A property within a {@link PropertySet}.\n *\n * @class Property\n */\nclass Property {\n\n /**\n * @private\n */\n constructor(name, value, type, valueType, description) {\n\n /**\n * The name of this property.\n *\n * @property name\n * @type {String}\n */\n this.name = name;\n\n /**\n * The type of this property.\n *\n * @property type\n * @type {Number|String}\n */\n this.type = type\n\n /**\n * The value of this property.\n *\n * @property value\n * @type {*}\n */\n this.value = value\n\n /**\n * The type of this property's value.\n *\n * @property valueType\n * @type {Number|String}\n */\n this.valueType = valueType;\n\n /**\n * Informative text to explain the property.\n *\n * @property name\n * @type {String}\n */\n this.description = description;\n }\n}\n\nexport {Property};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/Property.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/Property.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2206, + "__docId__": 2214, "kind": "class", "name": "Property", "memberof": "src/viewer/metadata/Property.js", @@ -44699,7 +44915,7 @@ "interface": false }, { - "__docId__": 2207, + "__docId__": 2215, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44713,7 +44929,7 @@ "ignore": true }, { - "__docId__": 2208, + "__docId__": 2216, "kind": "member", "name": "name", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44744,7 +44960,7 @@ } }, { - "__docId__": 2209, + "__docId__": 2217, "kind": "member", "name": "type", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44776,7 +44992,7 @@ } }, { - "__docId__": 2210, + "__docId__": 2218, "kind": "member", "name": "value", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44807,7 +45023,7 @@ } }, { - "__docId__": 2211, + "__docId__": 2219, "kind": "member", "name": "valueType", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44839,7 +45055,7 @@ } }, { - "__docId__": 2212, + "__docId__": 2220, "kind": "member", "name": "description", "memberof": "src/viewer/metadata/Property.js~Property", @@ -44870,18 +45086,18 @@ } }, { - "__docId__": 2213, + "__docId__": 2221, "kind": "file", "name": "src/viewer/metadata/PropertySet.js", "content": "import {Property} from \"./Property.js\";\n\n/**\n * @desc A set of properties associated with one or more {@link MetaObject}s.\n *\n * A PropertySet is created within {@link MetaScene#createMetaModel} and belongs to a {@link MetaModel}.\n *\n * Each PropertySet is registered by {@link PropertySet#id} in {@link MetaScene#propertySets} and {@link MetaModel#propertySets}.\n *\n * @class PropertySet\n */\nclass PropertySet {\n\n /**\n * @private\n */\n constructor(params) {\n\n /**\n * Globally-unique ID for this PropertySet.\n *\n * PropertySet instances are registered by this ID in {@link MetaScene#propertySets} and {@link MetaModel#propertySets}.\n *\n * @property id\n * @type {String}\n */\n this.id = params.id;\n\n /**\n * ID of the corresponding object within the originating system, if any.\n *\n * @type {String}\n * @abstract\n */\n this.originalSystemId = params.originalSystemId;\n\n /**\n * The MetaModels that share this PropertySet.\n * @type {MetaModel[]}\n */\n this.metaModels = [];\n\n /**\n * Human-readable name of this PropertySet.\n *\n * @property name\n * @type {String}\n */\n this.name = params.name;\n\n /**\n * Type of this PropertySet.\n *\n * @property type\n * @type {String}\n */\n this.type = params.type;\n\n /**\n * Properties within this PropertySet.\n *\n * @property properties\n * @type {Property[]}\n */\n this.properties = [];\n\n if (params.properties) {\n const properties = params.properties;\n for (let i = 0, len = properties.length; i < len; i++) {\n const property = properties[i];\n this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));\n }\n }\n }\n}\n\nexport {PropertySet};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/metadata/PropertySet.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/metadata/PropertySet.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2214, + "__docId__": 2222, "kind": "class", "name": "PropertySet", "memberof": "src/viewer/metadata/PropertySet.js", @@ -44902,7 +45118,7 @@ "interface": false }, { - "__docId__": 2215, + "__docId__": 2223, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -44916,7 +45132,7 @@ "ignore": true }, { - "__docId__": 2216, + "__docId__": 2224, "kind": "member", "name": "id", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -44947,7 +45163,7 @@ } }, { - "__docId__": 2217, + "__docId__": 2225, "kind": "member", "name": "originalSystemId", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -44967,7 +45183,7 @@ "abstract": true }, { - "__docId__": 2218, + "__docId__": 2226, "kind": "member", "name": "metaModels", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -44986,7 +45202,7 @@ } }, { - "__docId__": 2219, + "__docId__": 2227, "kind": "member", "name": "name", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -45017,7 +45233,7 @@ } }, { - "__docId__": 2220, + "__docId__": 2228, "kind": "member", "name": "type", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -45048,7 +45264,7 @@ } }, { - "__docId__": 2221, + "__docId__": 2229, "kind": "member", "name": "properties", "memberof": "src/viewer/metadata/PropertySet.js~PropertySet", @@ -45079,18 +45295,18 @@ } }, { - "__docId__": 2222, + "__docId__": 2230, "kind": "file", "name": "src/viewer/scene/Bitmap/Bitmap.js", "content": "import {Component} from '../Component.js';\nimport {Mesh} from \"../mesh/Mesh.js\";\nimport {Node} from \"../nodes/Node.js\";\nimport {PhongMaterial, Texture} from \"../materials/index.js\";\nimport {buildPlaneGeometry, ReadableGeometry} from \"../geometry/index.js\";\nimport {math} from \"../math/math.js\";\n\n/**\n * A plane-shaped 3D object containing a bitmap image.\n *\n * * Creates a 3D quad containing our bitmap, located and oriented using ````pos````, ````normal```` and ````up```` vectors.\n * * Registered by {@link Bitmap#id} in {@link Scene#bitmaps}.\n * * {@link BCFViewpointsPlugin} will save and load Bitmaps in BCF viewpoints.\n *\n * ## Usage\n *\n * In the example below, we'll load the Schependomlaan model, then use\n * an ````Bitmap```` to show a storey plan next to the model.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)]\n *\n * ````javascript\n * import {Viewer, Bitmap, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-24.65, 21.69, 8.16];\n * viewer.camera.look = [-14.62, 2.16, -1.38];\n * viewer.camera.up = [0.59, 0.57, -0.56];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true\n * });\n *\n * new Bitmap(viewer.scene, {\n * src: \"./images/schependomlaanPlanView.png\",\n * visible: true, // Show the Bitmap\n * height: 24.0, // Height of Bitmap\n * pos: [-15, 0, -10], // World-space position of Bitmap's center\n * normal: [0, -1, 0], // Vector perpendicular to Bitmap\n * up: [0, 0, 1], // Direction of Bitmap \"up\"\n * collidable: false, // Bitmap does not contribute to Scene boundary\n * clippable: true, // Bitmap can be clipped by SectionPlanes\n * pickable: true // Allow the ground plane to be picked\n * });\n * ````\n */\nclass Bitmap extends Component {\n\n /**\n * Creates a new Bitmap.\n *\n * Registers the Bitmap in {@link Scene#bitmaps}; causes Scene to fire a \"bitmapCreated\" event.\n *\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this ````Bitmap```` as well.\n * @param {*} [cfg] ````Bitmap```` configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````Bitmap```` is visible.\n * @param {Number[]} [cfg.pos=[0,0,0]] World-space position of the ````Bitmap````.\n * @param {Number[]} [cfg.normal=[0,0,1]] Normal vector indicating the direction the ````Bitmap```` faces.\n * @param {Number[]} [cfg.up=[0,1,0]] Direction of \"up\" for the ````Bitmap````.\n * @param {Number[]} [cfg.height=1] World-space height of the ````Bitmap````.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Modelling transform matrix for the ````Bitmap````. Overrides the ````position````, ````height```, ````rotation```` and ````normal```` parameters.\n * @param {Boolean} [cfg.collidable=true] Indicates if the ````Bitmap```` is initially included in boundary calculations.\n * @param {Boolean} [cfg.clippable=true] Indicates if the ````Bitmap```` is initially clippable.\n * @param {Boolean} [cfg.pickable=true] Indicates if the ````Bitmap```` is initially pickable.\n * @param {Number} [cfg.opacity=1.0] ````Bitmap````'s initial opacity factor, multiplies by the rendered fragment alpha.\n * @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.\n * @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.\n * @param {String} [cfg.imageData] Image data as a base64 encoded string.\n * @param {String} [cfg.type=\"jpg\"] Image MIME type. Accepted values are \"jpg\" and \"png\". Default is \"jpg\". Normally only needed with ````image```` or ````imageData````. Automatically inferred from file extension of ````src````, if the file has a recognized extension.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._type = cfg.type || (cfg.src ? cfg.src.split('.').pop() : null) || \"jpg\";\n this._pos = math.vec3(cfg.pos || [0, 0, 0]);\n this._up = math.vec3(cfg.up || [0, 1, 0]);\n this._normal = math.vec3(cfg.normal || [0, 0, 1]);\n this._height = cfg.height || 1.0;\n\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n this._imageSize = math.vec2();\n\n this._texture = new Texture(this, {\n flipY: true\n });\n\n this._image = new Image();\n\n if (this._type !== \"jpg\" && this._type !== \"png\") {\n this.error(`Unsupported type - defaulting to \"jpg\"`);\n this._type = \"jpg\";\n }\n\n this._node = new Node(this, {\n matrix: math.inverseMat4(\n math.lookAtMat4v(this._pos, math.subVec3(this._pos, this._normal, math.mat4()),\n this._up,\n math.mat4())),\n children: [\n\n this._bitmapMesh = new Mesh(this, {\n scale: [1, 1, 1],\n rotation: [-90, 0, 0],\n collidable: cfg.collidable,\n pickable: cfg.pickable,\n opacity: cfg.opacity,\n clippable: cfg.clippable,\n\n geometry: new ReadableGeometry(this, buildPlaneGeometry({\n center: [0, 0, 0],\n xSize: 1,\n zSize: 1,\n xSegments: 2,\n zSegments: 2\n })),\n\n material: new PhongMaterial(this, {\n diffuse: [0, 0, 0],\n ambient: [0, 0, 0],\n specular: [0, 0, 0],\n diffuseMap: this._texture,\n emissiveMap: this._texture,\n backfaces: true\n })\n })\n ]\n });\n\n if (cfg.image) {\n this.image = cfg.image;\n } else if (cfg.src) {\n this.src = cfg.src;\n } else if (cfg.imageData) {\n this.imageData = cfg.imageData;\n }\n\n this.scene._bitmapCreated(this);\n }\n\n /**\n * Sets if this ````Bitmap```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} visible Set ````true```` to make this ````Bitmap```` visible.\n */\n set visible(visible) {\n this._bitmapMesh.visible = visible;\n }\n\n /**\n * Gets if this ````Bitmap```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if visible.\n */\n get visible() {\n return this._bitmapMesh.visible;\n }\n\n /**\n * Sets an ````HTMLImageElement```` to source the image from.\n *\n * Sets {@link Texture#src} null.\n *\n * You may also need to set {@link Bitmap#type}, if you want to read the image data with {@link Bitmap#imageData}.\n *\n * @type {HTMLImageElement}\n */\n set image(image) {\n this._image = image;\n if (this._image) {\n this._texture.image = this._image;\n this._imageSize[0] = this._image.width;\n this._imageSize[1] = this._image.height;\n this._updateBitmapMeshScale();\n }\n }\n\n /**\n * Gets the ````HTMLImageElement```` the ````Bitmap````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {HTMLImageElement}\n */\n get image() {\n return this._image;\n }\n\n /**\n * Sets an image file path that the ````Bitmap````'s image is sourced from.\n *\n * If the file extension is a recognized MIME type, also sets {@link Bitmap#type} to that MIME type.\n *\n * Accepted file types are PNG and JPEG.\n *\n * @type {String}\n */\n set src(src) {\n if (src) {\n this._image.onload = () => {\n this._texture.image = this._image;\n this._imageSize[0] = this._image.width;\n this._imageSize[1] = this._image.height;\n this._updateBitmapMeshScale();\n };\n this._image.src = src;\n const ext = src.split('.').pop();\n switch (ext) {\n case \"jpeg\":\n case \"jpg\":\n this._type = \"jpg\";\n break;\n case \"png\":\n this._type = \"png\";\n }\n }\n }\n\n /**\n * Gets the image file path that the ````Bitmap````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {String}\n */\n get src() {\n return this._image.src;\n }\n\n /**\n * Sets an image file path that the ````Bitmap````'s image is sourced from.\n *\n * Accepted file types are PNG and JPEG.\n *\n * Sets {@link Texture#image} null.\n *\n * You may also need to set {@link Bitmap#type}, if you want to read the image data with {@link Bitmap#imageData}.\n *\n * @type {String}\n */\n set imageData(imageData) {\n this._image.onload = () => {\n this._texture.image = image;\n this._imageSize[0] = image.width;\n this._imageSize[1] = image.height;\n this._updateBitmapMeshScale();\n };\n this._image.src = imageData;\n }\n\n /**\n * Gets the image file path that the ````Bitmap````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {String}\n */\n get imageData() {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = this._image.width;\n canvas.height = this._image.height;\n context.drawImage(this._image, 0, 0);\n return canvas.toDataURL(this._type === \"jpg\" ? 'image/jpeg' : 'image/png');\n }\n\n /**\n * Sets the MIME type of this Bitmap.\n *\n * This is used by ````Bitmap```` when getting image data with {@link Bitmap#imageData}.\n *\n * Supported values are \"jpg\" and \"png\",\n *\n * Default is \"jpg\".\n *\n * @type {String}\n */\n set type(type) {\n type = type || \"jpg\";\n if (type !== \"png\" || type !== \"jpg\") {\n this.error(\"Unsupported value for `type` - supported types are `jpg` and `png` - defaulting to `jpg`\");\n type = \"jpg\";\n }\n this._type = type;\n }\n\n /**\n * Gets the MIME type of this Bitmap.\n *\n * @type {String}\n */\n get type() {\n return this._type;\n }\n\n /**\n * Gets the World-space position of this ````Bitmap````.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @returns {Number[]} Current position.\n */\n get pos() {\n return this._pos;\n }\n\n /**\n * Gets the direction of the normal vector that is perpendicular to this ````Bitmap````.\n *\n * @returns {Number[]} value Current normal direction.\n */\n get normal() {\n return this._normal;\n }\n\n /**\n * Gets the \"up\" direction of this ````Bitmap````.\n *\n * @returns {Number[]} value Current \"up\" direction.\n */\n get up() {\n return this._up;\n }\n\n /**\n * Sets the World-space height of the ````Bitmap````.\n *\n * Default value is ````1.0````.\n *\n * @param {Number} height New World-space height of the ````Bitmap````.\n */\n set height(height) {\n this._height = (height === undefined || height === null) ? 1.0 : height;\n if (this._image) {\n this._updateBitmapMeshScale();\n }\n }\n\n /**\n * Gets the World-space height of the ````Bitmap````.\n *\n * Returns {Number} World-space height of the ````Bitmap````.\n */\n get height() {\n return this._height;\n }\n\n /**\n * Sets if this ````Bitmap```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set collidable(value) {\n this._bitmapMesh.collidable = (value !== false);\n }\n\n /**\n * Gets if this ````Bitmap```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._bitmapMesh.collidable;\n }\n\n /**\n * Sets if this ````Bitmap```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set clippable(value) {\n this._bitmapMesh.clippable = (value !== false);\n }\n\n /**\n * Gets if this ````Bitmap```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._bitmapMesh.clippable;\n }\n\n /**\n * Sets if this ````Bitmap```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set pickable(value) {\n this._bitmapMesh.pickable = (value !== false);\n }\n\n /**\n * Gets if this ````Bitmap```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._bitmapMesh.pickable;\n }\n\n /**\n * Sets the opacity factor for this ````Bitmap````.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n this._bitmapMesh.opacity = opacity;\n }\n\n /**\n * Gets this ````Bitmap````'s opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n return this._bitmapMesh.opacity;\n }\n\n /**\n * Destroys this ````Bitmap````.\n *\n * Removes the ```Bitmap```` from {@link Scene#bitmaps}; causes Scene to fire a \"bitmapDestroyed\" event.\n */\n destroy() {\n super.destroy();\n this.scene._bitmapDestroyed(this);\n }\n\n _updateBitmapMeshScale() {\n const aspect = this._imageSize[1] / this._imageSize[0];\n this._bitmapMesh.scale = [this._height / aspect, 1.0, this._height];\n }\n}\n\nexport {Bitmap};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/Bitmap/Bitmap.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/Bitmap/Bitmap.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2223, + "__docId__": 2231, "kind": "class", "name": "Bitmap", "memberof": "src/viewer/scene/Bitmap/Bitmap.js", @@ -45108,7 +45324,7 @@ ] }, { - "__docId__": 2224, + "__docId__": 2232, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45350,7 +45566,7 @@ ] }, { - "__docId__": 2225, + "__docId__": 2233, "kind": "member", "name": "_type", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45368,7 +45584,7 @@ } }, { - "__docId__": 2226, + "__docId__": 2234, "kind": "member", "name": "_pos", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45386,7 +45602,7 @@ } }, { - "__docId__": 2227, + "__docId__": 2235, "kind": "member", "name": "_up", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45404,7 +45620,7 @@ } }, { - "__docId__": 2228, + "__docId__": 2236, "kind": "member", "name": "_normal", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45422,7 +45638,7 @@ } }, { - "__docId__": 2229, + "__docId__": 2237, "kind": "member", "name": "_height", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45440,7 +45656,7 @@ } }, { - "__docId__": 2230, + "__docId__": 2238, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45458,7 +45674,7 @@ } }, { - "__docId__": 2231, + "__docId__": 2239, "kind": "member", "name": "_rtcPos", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45476,7 +45692,7 @@ } }, { - "__docId__": 2232, + "__docId__": 2240, "kind": "member", "name": "_imageSize", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45494,7 +45710,7 @@ } }, { - "__docId__": 2233, + "__docId__": 2241, "kind": "member", "name": "_texture", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45512,7 +45728,7 @@ } }, { - "__docId__": 2234, + "__docId__": 2242, "kind": "member", "name": "_image", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45530,7 +45746,7 @@ } }, { - "__docId__": 2236, + "__docId__": 2244, "kind": "member", "name": "_node", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45548,7 +45764,7 @@ } }, { - "__docId__": 2240, + "__docId__": 2248, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45573,7 +45789,7 @@ ] }, { - "__docId__": 2241, + "__docId__": 2249, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45605,7 +45821,7 @@ } }, { - "__docId__": 2242, + "__docId__": 2250, "kind": "set", "name": "image", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45626,7 +45842,7 @@ } }, { - "__docId__": 2244, + "__docId__": 2252, "kind": "get", "name": "image", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45647,7 +45863,7 @@ } }, { - "__docId__": 2245, + "__docId__": 2253, "kind": "set", "name": "src", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45668,7 +45884,7 @@ } }, { - "__docId__": 2248, + "__docId__": 2256, "kind": "get", "name": "src", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45689,7 +45905,7 @@ } }, { - "__docId__": 2249, + "__docId__": 2257, "kind": "set", "name": "imageData", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45710,7 +45926,7 @@ } }, { - "__docId__": 2250, + "__docId__": 2258, "kind": "get", "name": "imageData", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45731,7 +45947,7 @@ } }, { - "__docId__": 2251, + "__docId__": 2259, "kind": "set", "name": "type", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45752,7 +45968,7 @@ } }, { - "__docId__": 2253, + "__docId__": 2261, "kind": "get", "name": "type", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45773,7 +45989,7 @@ } }, { - "__docId__": 2254, + "__docId__": 2262, "kind": "get", "name": "pos", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45805,7 +46021,7 @@ } }, { - "__docId__": 2255, + "__docId__": 2263, "kind": "get", "name": "normal", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45837,7 +46053,7 @@ } }, { - "__docId__": 2256, + "__docId__": 2264, "kind": "get", "name": "up", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45869,7 +46085,7 @@ } }, { - "__docId__": 2257, + "__docId__": 2265, "kind": "set", "name": "height", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45894,7 +46110,7 @@ ] }, { - "__docId__": 2259, + "__docId__": 2267, "kind": "get", "name": "height", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45912,7 +46128,7 @@ } }, { - "__docId__": 2260, + "__docId__": 2268, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45933,7 +46149,7 @@ } }, { - "__docId__": 2261, + "__docId__": 2269, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45954,7 +46170,7 @@ } }, { - "__docId__": 2262, + "__docId__": 2270, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45975,7 +46191,7 @@ } }, { - "__docId__": 2263, + "__docId__": 2271, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -45996,7 +46212,7 @@ } }, { - "__docId__": 2264, + "__docId__": 2272, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46017,7 +46233,7 @@ } }, { - "__docId__": 2265, + "__docId__": 2273, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46038,7 +46254,7 @@ } }, { - "__docId__": 2266, + "__docId__": 2274, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46059,7 +46275,7 @@ } }, { - "__docId__": 2267, + "__docId__": 2275, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46080,7 +46296,7 @@ } }, { - "__docId__": 2268, + "__docId__": 2276, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46095,7 +46311,7 @@ "return": null }, { - "__docId__": 2269, + "__docId__": 2277, "kind": "method", "name": "_updateBitmapMeshScale", "memberof": "src/viewer/scene/Bitmap/Bitmap.js~Bitmap", @@ -46112,29 +46328,29 @@ "return": null }, { - "__docId__": 2270, + "__docId__": 2278, "kind": "file", "name": "src/viewer/scene/Bitmap/index.js", "content": "export * from \"./Bitmap.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/Bitmap/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/Bitmap/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2271, + "__docId__": 2279, "kind": "file", "name": "src/viewer/scene/CameraControl/CameraControl.js", "content": "import {Component} from '../Component.js';\n\nimport {CameraFlightAnimation} from './../camera/CameraFlightAnimation.js';\nimport {PanController} from \"./lib/controllers/PanController.js\";\nimport {PivotController} from \"./lib/controllers/PivotController.js\";\nimport {PickController} from \"./lib/controllers/PickController.js\";\nimport {MousePanRotateDollyHandler} from \"./lib/handlers/MousePanRotateDollyHandler.js\";\nimport {KeyboardAxisViewHandler} from \"./lib/handlers/KeyboardAxisViewHandler.js\";\nimport {MousePickHandler} from \"./lib/handlers/MousePickHandler.js\";\nimport {KeyboardPanRotateDollyHandler} from \"./lib/handlers/KeyboardPanRotateDollyHandler.js\";\nimport {CameraUpdater} from \"./lib/CameraUpdater.js\";\nimport {MouseMiscHandler} from \"./lib/handlers/MouseMiscHandler.js\";\nimport {TouchPanRotateAndDollyHandler} from \"./lib/handlers/TouchPanRotateAndDollyHandler.js\";\nimport {utils} from \"../utils.js\";\nimport {math} from \"../math/math.js\";\nimport {TouchPickHandler} from \"./lib/handlers/TouchPickHandler.js\";\n\nconst DEFAULT_SNAP_PICK_RADIUS = 30;\nconst DEFAULT_SNAP_VERTEX = true;\nconst DEFAULT_SNAP_EDGE = true;\n\n/**\n * @desc Controls the {@link Camera} with user input, and fires events when the user interacts with pickable {@link Entity}s.\n *\n * # Contents\n *\n * * [Overview](#overview)\n * * [Examples](#examples)\n * * [Orbit Mode](#orbit-mode)\n * + [Following the Pointer in Orbit Mode](#--following-the-pointer-in-orbit-mode--)\n * + [Showing the Pivot Position](#--showing-the-pivot-position--)\n * + [Axis-Aligned Views in Orbit Mode](#--axis-aligned-views-in-orbit-mode--)\n * + [View-Fitting Entitys in Orbit Mode](#--view-fitting-entitys-in-orbit-mode--)\n * * [First-Person Mode](#first-person-mode)\n * + [Following the Pointer in First-Person Mode](#--following-the-pointer-in-first-person-mode--)\n * + [Constraining Vertical Position in First-Person Mode](#--constraining-vertical-position-in-first-person-mode--)\n * + [Axis-Aligned Views in First-Person Mode](#--axis-aligned-views-in-first-person-mode--)\n * + [View-Fitting Entitys in First-Person Mode](#--view-fitting-entitys-in-first-person-mode--)\n * * [Plan-View Mode](#plan-view-mode)\n * + [Following the Pointer in Plan-View Mode](#--following-the-pointer-in-plan-view-mode--)\n * + [Axis-Aligned Views in Plan-View Mode](#--axis-aligned-views-in-plan-view-mode--)\n * * [CameraControl Events](#cameracontrol-events)\n * + [\"hover\"](#---hover---)\n * + [\"hoverOff\"](#---hoveroff---)\n * + [\"hoverEnter\"](#---hoverenter---)\n * + [\"hoverOut\"](#---hoverout---)\n * + [\"picked\"](#---picked---)\n * + [\"pickedSurface\"](#---pickedsurface---)\n * + [\"pickedNothing\"](#---pickednothing---)\n * + [\"doublePicked\"](#---doublepicked---)\n * + [\"doublePickedSurface\"](#---doublepickedsurface---)\n * + [\"doublePickedNothing\"](#---doublepickednothing---)\n * + [\"rightClick\"](#---rightclick---)\n * * [Custom Keyboard Mappings](#custom-keyboard-mappings)\n *\n *

    \n *\n * # Overview\n *\n * * Each {@link Viewer} has a ````CameraControl````, located at {@link Viewer#cameraControl}.\n * * {@link CameraControl#navMode} selects the navigation mode:\n * * ````\"orbit\"```` rotates the {@link Camera} position about the target.\n * * ````\"firstPerson\"```` rotates the World about the Camera position.\n * * ````\"planView\"```` never rotates, but still allows to pan and dolly, typically for an axis-aligned view.\n * * {@link CameraControl#followPointer} makes the Camera follow the mouse or touch pointer.\n * * {@link CameraControl#constrainVertical} locks the Camera to its current height when in first-person mode.\n * * ````CameraControl```` fires pick events when we hover, click or tap on an {@link Entity}.\n *

    \n *\n * # Examples\n *\n * * [Orbit Navigation - Duplex Model](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_orbit_Duplex)\n * * [Orbit Navigation - Holter Tower Model](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_orbit_HolterTower)\n * * [First-Person Navigation - Duplex Model](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_firstPerson_Duplex)\n * * [First-Person Navigation - Holter Tower Model](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_firstPerson_HolterTower)\n * * [Plan-view Navigation - Schependomlaan Model](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_planView_Schependomlaan)\n * * [Custom Keyboard Mapping](https://xeokit.github.io/xeokit-sdk/examples/index.html#CameraControl_keyMap)\n *

    \n *\n * # Orbit Mode\n *\n * In orbit mode, ````CameraControl```` orbits the {@link Camera} about the target.\n *\n * To enable orbit mode:\n *\n * ````javascript\n * const cameraControl = myViewer.cameraControl;\n * cameraControl.navMode = \"orbit\";\n * ````\n *\n * Then orbit by:\n *\n * * left-dragging the mouse,\n * * tap-dragging the touch pad, and\n * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.\n *

    \n *\n * Dolly forwards and backwards by:\n *\n * * spinning the mouse wheel,\n * * pinching on the touch pad, and\n * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.\n *

    \n *\n * Pan horizontally and vertically by:\n *\n * * right-dragging the mouse,\n * * left-dragging the mouse with the SHIFT key down,\n * * tap-dragging the touch pad with SHIFT down,\n * * pressing the ````A````, ````D````, ````Z```` and ````X```` keys on a QWERTY keyboard, and\n * * pressing the ````Q````, ````D````, ````W```` and ````X```` keys on an AZERTY keyboard,\n *

    \n *\n * ## Following the Pointer in Orbit Mode\n *\n * When {@link CameraControl#followPointer} is ````true````in orbiting mode, the mouse or touch pointer will dynamically\n * indicate the target that the {@link Camera} will orbit, as well as dolly to and from.\n *\n * Lets ensure that we're in orbit mode, then enable the {@link Camera} to follow the pointer:\n *\n * ````javascript\n * cameraControl.navMode = \"orbit\";\n * cameraControl.followPointer = true;\n * ````\n *\n * ## Smart Pivoting\n *\n * TODO\n *\n * ## Showing the Pivot Position\n *\n * We can configure {@link CameraControl#pivotElement} with an HTML element to indicate the current\n * pivot position. The indicator will appear momentarily each time we move the {@link Camera} while in orbit mode with\n * {@link CameraControl#followPointer} set ````true````.\n *\n * First we'll define some CSS to style our pivot indicator as a black dot with a white border:\n *\n * ````css\n * .camera-pivot-marker {\n * color: #ffffff;\n * position: absolute;\n * width: 25px;\n * height: 25px;\n * border-radius: 15px;\n * border: 2px solid #ebebeb;\n * background: black;\n * visibility: hidden;\n * box-shadow: 5px 5px 15px 1px #000000;\n * z-index: 10000;\n * pointer-events: none;\n * }\n * ````\n *\n * Then we'll attach our pivot indicator's HTML element to the ````CameraControl````:\n *\n * ````javascript\n * const pivotElement = document.createRange().createContextualFragment(\"
    \").firstChild;\n *\n * document.body.appendChild(pivotElement);\n *\n * cameraControl.pivotElement = pivotElement;\n * ````\n *\n * ## Axis-Aligned Views in Orbit Mode\n *\n * In orbit mode, we can use keys 1-6 to position the {@link Camera} to look at the center of the {@link Scene} from along each of the\n * six World-space axis. Pressing one of these keys will fly the {@link Camera} to the corresponding axis-aligned view.\n *\n * ## View-Fitting Entitys in Orbit Mode\n *\n * When {@link CameraControl#doublePickFlyTo} is ````true````, we can left-double-click or\n * double-tap (ie. \"double-pick\") an {@link Entity} to fit it to view. This will cause the {@link Camera}\n * to fly to that Entity. Our target then becomes the center of that Entity. If we are currently pivoting,\n * then our pivot position is then also set to the Entity center.\n *\n * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.\n *\n * # First-Person Mode\n *\n * In first-person mode, ````CameraControl```` rotates the World about the {@link Camera} position.\n *\n * To enable first-person mode:\n *\n * ````javascript\n * cameraControl.navMode = \"firstPerson\";\n * ````\n *\n * Then rotate by:\n *\n * * left-dragging the mouse,\n * * tap-dragging the touch pad,\n * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.\n *

    \n *\n * Dolly forwards and backwards by:\n *\n * * spinning the mouse wheel,\n * * pinching on the touch pad, and\n * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.\n *

    \n *\n * Pan left, right, up and down by:\n *\n * * left-dragging or right-dragging the mouse, and\n * * tap-dragging the touch pad with SHIFT down.\n *\n * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,\n * or ````WSQDWX```` keys on an AZERTY keyboard.\n *

    \n *\n * ## Following the Pointer in First-Person Mode\n *\n * When {@link CameraControl#followPointer} is ````true```` in first-person mode, the mouse or touch pointer will dynamically\n * indicate the target to which the {@link Camera} will dolly to and from. In first-person mode, however, the World will always rotate\n * about the {@link Camera} position.\n *\n * Lets ensure that we're in first-person mode, then enable the {@link Camera} to follow the pointer:\n *\n * ````javascript\n * cameraControl.navMode = \"firstPerson\";\n * cameraControl.followPointer = true;\n * ````\n *\n * When the pointer is over empty space, the target will remain the last object that the pointer was over.\n *\n * ## Constraining Vertical Position in First-Person Mode\n *\n * In first-person mode, we can lock the {@link Camera} to its current position on the vertical World axis, which is useful for walk-through navigation:\n *\n * ````javascript\n * cameraControl.constrainVertical = true;\n * ````\n *\n * ## Axis-Aligned Views in First-Person Mode\n *\n * In first-person mode we can use keys 1-6 to position the {@link Camera} to look at the center of\n * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the\n * corresponding axis-aligned view.\n *\n * ## View-Fitting Entitys in First-Person Mode\n *\n * As in orbit mode, when in first-person mode and {@link CameraControl#doublePickFlyTo} is ````true````, we can double-click\n * or double-tap an {@link Entity} (ie. \"double-picking\") to fit it in view. This will cause the {@link Camera} to fly to\n * that Entity. Our target then becomes the center of that Entity.\n *\n * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.\n *\n * # Plan-View Mode\n *\n * In plan-view mode, ````CameraControl```` pans and rotates the {@link Camera}, without rotating it.\n *\n * To enable plan-view mode:\n *\n * ````javascript\n * cameraControl.navMode = \"planView\";\n * ````\n *\n * Dolly forwards and backwards by:\n *\n * * spinning the mouse wheel,\n * * pinching on the touch pad, and\n * * pressing the ````+```` and ````-```` keys.\n *\n *
    \n * Pan left, right, up and down by:\n *\n * * left-dragging or right-dragging the mouse, and\n * * tap-dragging the touch pad with SHIFT down.\n *\n * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,\n * or ````WSQDWX```` keys on an AZERTY keyboard.\n *

    \n *\n * ## Following the Pointer in Plan-View Mode\n *\n * When {@link CameraControl#followPointer} is ````true```` in plan-view mode, the mouse or touch pointer will dynamically\n * indicate the target to which the {@link Camera} will dolly to and from. In plan-view mode, however, the {@link Camera} cannot rotate.\n *\n * Lets ensure that we're in plan-view mode, then enable the {@link Camera} to follow the pointer:\n *\n * ````javascript\n * cameraControl.navMode = \"planView\";\n * cameraControl.followPointer = true; // Default\n * ````\n *\n * When the pointer is over empty space, the target will remain the last object that the pointer was over.\n *\n * ## Axis-Aligned Views in Plan-View Mode\n *\n * As in orbit and first-person modes, in plan-view mode we can use keys 1-6 to position the {@link Camera} to look at the center of\n * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the\n * corresponding axis-aligned view.\n *\n * # CameraControl Events\n *\n * ````CameraControl```` fires events as we interact with {@link Entity}s using mouse or touch input.\n *\n * The following examples demonstrate how to subscribe to those events.\n *\n * The first example shows how to save a handle to a subscription, which we can later use to unsubscribe.\n *\n * ## \"hover\"\n *\n * Event fired when the pointer moves while hovering over an Entity.\n *\n * ````javascript\n * const onHover = cameraControl.on(\"hover\", (e) => {\n * const entity = e.entity; // Entity\n * const canvasPos = e.canvasPos; // 2D canvas position\n * });\n * ````\n *\n * To unsubscribe from the event:\n *\n * ````javascript\n * cameraControl.off(onHover);\n * ````\n *\n * ## \"hoverOff\"\n *\n * Event fired when the pointer moves while hovering over empty space.\n *\n * ````javascript\n * cameraControl.on(\"hoverOff\", (e) => {\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"hoverEnter\"\n *\n * Event fired when the pointer moves onto an Entity.\n *\n * ````javascript\n * cameraControl.on(\"hoverEnter\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"hoverOut\"\n *\n * Event fired when the pointer moves off an Entity.\n *\n * ````javascript\n * cameraControl.on(\"hoverOut\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"picked\"\n *\n * Event fired when we left-click or tap on an Entity.\n *\n * ````javascript\n * cameraControl.on(\"picked\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"pickedSurface\"\n *\n * Event fired when we left-click or tap on the surface of an Entity.\n *\n * ````javascript\n * cameraControl.on(\"picked\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * const worldPos = e.worldPos; // 3D World-space position\n * const viewPos = e.viewPos; // 3D View-space position\n * const worldNormal = e.worldNormal; // 3D World-space normal vector\n * });\n * ````\n *\n * ## \"pickedNothing\"\n *\n * Event fired when we left-click or tap on empty space.\n *\n * ````javascript\n * cameraControl.on(\"pickedNothing\", (e) => {\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"doublePicked\"\n *\n * Event fired wwhen we left-double-click or double-tap on an Entity.\n *\n * ````javascript\n * cameraControl.on(\"doublePicked\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"doublePickedSurface\"\n *\n * Event fired when we left-double-click or double-tap on the surface of an Entity.\n *\n * ````javascript\n * cameraControl.on(\"doublePickedSurface\", (e) => {\n * const entity = e.entity;\n * const canvasPos = e.canvasPos;\n * const worldPos = e.worldPos;\n * const viewPos = e.viewPos;\n * const worldNormal = e.worldNormal;\n * });\n * ````\n *\n * ## \"doublePickedNothing\"\n *\n * Event fired when we left-double-click or double-tap on empty space.\n *\n * ````javascript\n * cameraControl.on(\"doublePickedNothing\", (e) => {\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## \"rightClick\"\n *\n * Event fired when we right-click on the canvas.\n *\n * ````javascript\n * cameraControl.on(\"rightClick\", (e) => {\n * const event = e.event; // Mouse event\n * const canvasPos = e.canvasPos;\n * });\n * ````\n *\n * ## Custom Keyboard Mappings\n *\n * We can customize````CameraControl```` key bindings as shown below.\n *\n * In this example, we'll just set the default bindings for a QWERTY keyboard.\n *\n * ````javascript\n * const input = myViewer.scene.input;\n *\n * cameraControl.navMode = \"orbit\";\n * cameraControl.followPointer = true;\n *\n * const keyMap = {};\n *\n * keyMap[cameraControl.PAN_LEFT] = [input.KEY_A];\n * keyMap[cameraControl.PAN_RIGHT] = [input.KEY_D];\n * keyMap[cameraControl.PAN_UP] = [input.KEY_Z];\n * keyMap[cameraControl.PAN_DOWN] = [input.KEY_X];\n * keyMap[cameraControl.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];\n * keyMap[cameraControl.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];\n * keyMap[cameraControl.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];\n * keyMap[cameraControl.ROTATE_X_NEG] = [input.KEY_UP_ARROW];\n * keyMap[cameraControl.ROTATE_Y_POS] = [input.KEY_LEFT_ARROW];\n * keyMap[cameraControl.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];\n * keyMap[cameraControl.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];\n * keyMap[cameraControl.AXIS_VIEW_BACK] = [input.KEY_NUM_2];\n * keyMap[cameraControl.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];\n * keyMap[cameraControl.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];\n * keyMap[cameraControl.AXIS_VIEW_TOP] = [input.KEY_NUM_5];\n * keyMap[cameraControl.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];\n *\n * cameraControl.keyMap = keyMap;\n * ````\n *\n * We can also just configure default bindings for a specified keyboard layout, like this:\n *\n * ````javascript\n * cameraControl.keyMap = \"qwerty\";\n * ````\n *\n * Then, ````CameraControl```` will internally set {@link CameraControl#keyMap} to the default key map for the QWERTY\n * layout (which is the same set of mappings we set in the previous example). In other words, if we subsequently\n * read {@link CameraControl#keyMap}, it will now be a key map, instead of the \"qwerty\" string value we set it to.\n *\n * Supported layouts are, so far:\n *\n * * ````\"qwerty\"````\n * * ````\"azerty\"````\n */\nclass CameraControl extends Component {\n\n /**\n * @private\n * @constructor\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_LEFT = 0;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_RIGHT = 1;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_UP = 2;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_DOWN = 3;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_FORWARDS = 4;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.PAN_BACKWARDS = 5;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.ROTATE_X_POS = 6;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.ROTATE_X_NEG = 7;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.ROTATE_Y_POS = 8;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.ROTATE_Y_NEG = 9;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.DOLLY_FORWARDS = 10;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.DOLLY_BACKWARDS = 11;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_RIGHT = 12;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_BACK = 13;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_LEFT = 14;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_FRONT = 15;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_TOP = 16;\n\n /**\n * Identifies the XX action.\n * @final\n * @type {Number}\n */\n this.AXIS_VIEW_BOTTOM = 17;\n\n this._keyMap = {}; // Maps key codes to the above actions\n\n this.scene.canvas.canvas.oncontextmenu = (e) => {\n e.preventDefault();\n };\n\n // User-settable CameraControl configurations\n\n this._configs = {\n\n // Private\n\n longTapTimeout: 600, // Millisecs\n longTapRadius: 5, // Pixels\n\n // General\n\n active: true,\n keyboardLayout: \"qwerty\",\n navMode: \"orbit\",\n planView: false,\n firstPerson: false,\n followPointer: true,\n doublePickFlyTo: true,\n panRightClick: true,\n showPivot: false,\n pointerEnabled: true,\n constrainVertical: false,\n smartPivot: false,\n doubleClickTimeFrame: 250,\n \n snapToVertex: DEFAULT_SNAP_VERTEX,\n snapToEdge: DEFAULT_SNAP_EDGE,\n snapRadius: DEFAULT_SNAP_PICK_RADIUS,\n\n // Rotation\n\n dragRotationRate: 360.0,\n keyboardRotationRate: 90.0,\n rotationInertia: 0.0,\n\n // Panning\n\n keyboardPanRate: 1.0,\n touchPanRate: 1.0,\n panInertia: 0.5,\n\n // Dollying\n\n keyboardDollyRate: 10,\n mouseWheelDollyRate: 100,\n touchDollyRate: 0.2,\n dollyInertia: 0,\n dollyProximityThreshold: 30.0,\n dollyMinSpeed: 0.04\n };\n\n // Current runtime state of the CameraControl\n\n this._states = {\n pointerCanvasPos: math.vec2(),\n mouseover: false,\n followPointerDirty: true,\n mouseDownClientX: 0,\n mouseDownClientY: 0,\n mouseDownCursorX: 0,\n mouseDownCursorY: 0,\n touchStartTime: null,\n activeTouches: [],\n tapStartPos: math.vec2(),\n tapStartTime: -1,\n lastTapTime: -1,\n longTouchTimeout: null\n };\n\n // Updates for CameraUpdater to process on next Scene \"tick\" event\n\n this._updates = {\n rotateDeltaX: 0,\n rotateDeltaY: 0,\n panDeltaX: 0,\n panDeltaY: 0,\n panDeltaZ: 0,\n dollyDelta: 0\n };\n\n // Controllers to assist input event handlers with controlling the Camera\n\n const scene = this.scene;\n\n this._controllers = {\n cameraControl: this,\n pickController: new PickController(this, this._configs),\n pivotController: new PivotController(scene, this._configs),\n panController: new PanController(scene),\n cameraFlight: new CameraFlightAnimation(this, {\n duration: 0.5\n })\n };\n\n // Input event handlers\n\n this._handlers = [\n new MouseMiscHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new TouchPanRotateAndDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new MousePanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new KeyboardAxisViewHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new MousePickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new TouchPickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),\n new KeyboardPanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates)\n ];\n\n // Applies scheduled updates to the Camera on each Scene \"tick\" event\n\n this._cameraUpdater = new CameraUpdater(this.scene, this._controllers, this._configs, this._states, this._updates);\n\n // Set initial user configurations\n\n this.navMode = cfg.navMode;\n if (cfg.planView) {\n this.planView = cfg.planView;\n }\n this.constrainVertical = cfg.constrainVertical;\n if (cfg.keyboardLayout) {\n this.keyboardLayout = cfg.keyboardLayout; // Deprecated\n } else {\n this.keyMap = cfg.keyMap;\n }\n this.doublePickFlyTo = cfg.doublePickFlyTo;\n this.panRightClick = cfg.panRightClick;\n this.active = cfg.active;\n this.followPointer = cfg.followPointer;\n this.rotationInertia = cfg.rotationInertia;\n this.keyboardPanRate = cfg.keyboardPanRate;\n this.touchPanRate = cfg.touchPanRate;\n this.keyboardRotationRate = cfg.keyboardRotationRate;\n this.dragRotationRate = cfg.dragRotationRate;\n this.touchDollyRate = cfg.touchDollyRate;\n this.dollyInertia = cfg.dollyInertia;\n this.dollyProximityThreshold = cfg.dollyProximityThreshold;\n this.dollyMinSpeed = cfg.dollyMinSpeed;\n this.panInertia = cfg.panInertia;\n this.pointerEnabled = true;\n this.keyboardDollyRate = cfg.keyboardDollyRate;\n this.mouseWheelDollyRate = cfg.mouseWheelDollyRate;\n }\n\n /**\n * Sets custom mappings of keys to ````CameraControl```` actions.\n *\n * See class docs for usage.\n *\n * @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,\n * which causes ````CameraControl```` to use the default key mappings for that layout.\n */\n set keyMap(value) {\n value = value || \"qwerty\";\n if (utils.isString(value)) {\n const input = this.scene.input;\n const keyMap = {};\n\n switch (value) {\n\n default:\n this.error(\"Unsupported value for 'keyMap': \" + value + \" defaulting to 'qwerty'\");\n // Intentional fall-through to \"qwerty\"\n case \"qwerty\":\n keyMap[this.PAN_LEFT] = [input.KEY_A];\n keyMap[this.PAN_RIGHT] = [input.KEY_D];\n keyMap[this.PAN_UP] = [input.KEY_Z];\n keyMap[this.PAN_DOWN] = [input.KEY_X];\n keyMap[this.PAN_BACKWARDS] = [];\n keyMap[this.PAN_FORWARDS] = [];\n keyMap[this.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];\n keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];\n keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];\n keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];\n keyMap[this.ROTATE_Y_POS] = [input.KEY_Q, input.KEY_LEFT_ARROW];\n keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];\n keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];\n keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];\n keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];\n keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];\n keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];\n keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];\n break;\n\n case \"azerty\":\n keyMap[this.PAN_LEFT] = [input.KEY_Q];\n keyMap[this.PAN_RIGHT] = [input.KEY_D];\n keyMap[this.PAN_UP] = [input.KEY_W];\n keyMap[this.PAN_DOWN] = [input.KEY_X];\n keyMap[this.PAN_BACKWARDS] = [];\n keyMap[this.PAN_FORWARDS] = [];\n keyMap[this.DOLLY_FORWARDS] = [input.KEY_Z, input.KEY_ADD];\n keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];\n keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];\n keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];\n keyMap[this.ROTATE_Y_POS] = [input.KEY_A, input.KEY_LEFT_ARROW];\n keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];\n keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];\n keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];\n keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];\n keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];\n keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];\n keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];\n break;\n }\n\n this._keyMap = keyMap;\n } else {\n const keyMap = value;\n this._keyMap = keyMap;\n }\n }\n\n /**\n * Gets custom mappings of keys to {@link CameraControl} actions.\n *\n * @returns {{Number:Number}} Current key mappings.\n */\n get keyMap() {\n return this._keyMap;\n }\n\n /**\n * Returns true if any keys configured for the given action are down.\n * @param action\n * @param keyDownMap\n * @private\n */\n _isKeyDownForAction(action, keyDownMap) {\n const keys = this._keyMap[action];\n if (!keys) {\n return false;\n }\n if (!keyDownMap) {\n keyDownMap = this.scene.input.keyDown;\n }\n for (let i = 0, len = keys.length; i < len; i++) {\n const key = keys[i];\n if (keyDownMap[key]) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.\n *\n * See class comments for an example.\n *\n * @param {HTMLElement} element HTML element representing the pivot point.\n */\n set pivotElement(element) {\n this._controllers.pivotController.setPivotElement(element);\n }\n\n /**\n * Sets if this ````CameraControl```` is active or not.\n *\n * When inactive, the ````CameraControl```` will not react to input.\n *\n * Default is ````true````.\n *\n * @param {Boolean} value Set ````true```` to activate this ````CameraControl````.\n */\n set active(value) {\n value = value !== false;\n this._configs.active = value;\n this._handlers[1]._active = value;\n this._handlers[5]._active = value;\n }\n\n /**\n * Gets if this ````CameraControl```` is active or not.\n *\n * When inactive, the ````CameraControl```` will not react to input.\n *\n * Default is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.\n */\n get active() {\n return this._configs.active;\n }\n\n /**\n * Sets whether the pointer snap to vertex.\n *\n * @param {boolean} snapToVertex\n */\n set snapToVertex(snapToVertex) {\n this._configs.snapToVertex = !!snapToVertex;\n }\n\n /**\n * Gets whether the pointer snap to vertex.\n *\n * @returns {boolean}\n */\n get snapToVertex() {\n return this._configs.snapToVertex;\n }\n\n /**\n * Sets whether the pointer snap to edge.\n *\n * @param {boolean} snapToEdge\n */\n set snapToEdge(snapToEdge) {\n this._configs.snapToEdge = !!snapToEdge;\n }\n\n /**\n * Gets whether the pointer snap to edge.\n *\n * @returns {boolean}\n */\n get snapToEdge() {\n return this._configs.snapToEdge;\n }\n\n /**\n * Sets the current snap radius for \"hoverSnapOrSurface\" events, to specify whether the radius\n * within which the pointer snaps to the nearest vertex or the nearest edge.\n *\n * Default value is 30 pixels.\n *\n * @param {Number} snapRadius The snap radius.\n */\n set snapRadius(snapRadius) {\n snapRadius = snapRadius || DEFAULT_SNAP_PICK_RADIUS;\n this._configs.snapRadius = snapRadius;\n }\n\n /**\n * Gets the current snap radius.\n *\n * @returns {Number} The snap radius.\n */\n get snapRadius() {\n return this._configs.snapRadius;\n }\n \n /**\n * Sets the current navigation mode.\n *\n * Accepted values are:\n *\n * * \"orbit\" - rotation orbits about the current target or pivot point,\n * * \"firstPerson\" - rotation is about the current eye position,\n * * \"planView\" - rotation is disabled.\n *\n * See class comments for more info.\n *\n * @param {String} navMode The navigation mode: \"orbit\", \"firstPerson\" or \"planView\".\n */\n set navMode(navMode) {\n navMode = navMode || \"orbit\";\n if (navMode !== \"firstPerson\" && navMode !== \"orbit\" && navMode !== \"planView\") {\n this.error(\"Unsupported value for navMode: \" + navMode + \" - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'\");\n navMode = \"orbit\";\n }\n this._configs.firstPerson = (navMode === \"firstPerson\");\n this._configs.planView = (navMode === \"planView\");\n if (this._configs.firstPerson || this._configs.planView) {\n this._controllers.pivotController.hidePivot();\n this._controllers.pivotController.endPivot();\n }\n this._configs.navMode = navMode;\n }\n\n /**\n * Gets the current navigation mode.\n *\n * @returns {String} The navigation mode: \"orbit\", \"firstPerson\" or \"planView\".\n */\n get navMode() {\n return this._configs.navMode;\n }\n\n /**\n * Sets whether mouse and touch input is enabled.\n *\n * Default is ````true````.\n *\n * Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or\n * touch input to interact with some other 3D control, without disturbing the {@link Camera}.\n *\n * @param {Boolean} value Set ````true```` to enable mouse and touch input.\n */\n set pointerEnabled(value) {\n this._reset();\n this._configs.pointerEnabled = !!value;\n }\n\n _reset() {\n for (let i = 0, len = this._handlers.length; i < len; i++) {\n const handler = this._handlers[i];\n if (handler.reset) {\n handler.reset();\n }\n }\n\n this._updates.panDeltaX = 0;\n this._updates.panDeltaY = 0;\n this._updates.rotateDeltaX = 0;\n this._updates.rotateDeltaY = 0;\n this._updates.dolyDelta = 0;\n }\n\n /**\n * Gets whether mouse and touch input is enabled.\n *\n * Default is ````true````.\n *\n * Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or\n * touch input to interact with some other 3D control, without interfering with the {@link Camera}.\n *\n * @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.\n */\n get pointerEnabled() {\n return this._configs.pointerEnabled;\n }\n\n /**\n * Sets whether the {@link Camera} follows the mouse/touch pointer.\n *\n * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.\n *\n * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.\n *\n * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.\n *\n * Default is ````true````.\n *\n * See class comments for more info.\n *\n * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.\n */\n set followPointer(value) {\n this._configs.followPointer = (value !== false);\n }\n\n /**\n * Sets whether the {@link Camera} follows the mouse/touch pointer.\n *\n * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.\n *\n * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.\n *\n * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.\n *\n * Default is ````true````.\n *\n * See class comments for more info.\n *\n * @returns {Boolean} Returns ````true```` if the Camera follows the pointer.\n */\n get followPointer() {\n return this._configs.followPointer;\n }\n\n /**\n * Sets the current World-space 3D target position.\n *\n * Only applies when {@link CameraControl#followPointer} is ````true````.\n *\n * @param {Number[]} worldPos The new World-space 3D target position.\n */\n set pivotPos(worldPos) {\n this._controllers.pivotController.setPivotPos(worldPos);\n }\n\n /**\n * Gets the current World-space 3D pivot position.\n *\n * Only applies when {@link CameraControl#followPointer} is ````true````.\n *\n * @return {Number[]} worldPos The current World-space 3D pivot position.\n */\n get pivotPos() {\n return this._controllers.pivotController.getPivotPos();\n }\n\n /**\n * @deprecated\n * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.\n */\n set dollyToPointer(value) {\n this.warn(\"dollyToPointer property is deprecated - replaced with followPointer\");\n this.followPointer = value;\n }\n\n /**\n * @deprecated\n * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.\n */\n get dollyToPointer() {\n this.warn(\"dollyToPointer property is deprecated - replaced with followPointer\");\n return this.followPointer;\n }\n\n /**\n * @deprecated\n * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.\n */\n set panToPointer(value) {\n this.warn(\"panToPointer property is deprecated - replaced with followPointer\");\n }\n\n /**\n * @deprecated\n * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.\n */\n get panToPointer() {\n this.warn(\"panToPointer property is deprecated - replaced with followPointer\");\n return false;\n }\n\n /**\n * Sets whether this ````CameraControl```` is in plan-view mode.\n *\n * When in plan-view mode, rotation is disabled.\n *\n * Default is ````false````.\n *\n * Deprecated - use {@link CameraControl#navMode} instead.\n *\n * @param {Boolean} value Set ````true```` to enable plan-view mode.\n * @deprecated\n */\n set planView(value) {\n this._configs.planView = !!value;\n this._configs.firstPerson = false;\n if (this._configs.planView) {\n this._controllers.pivotController.hidePivot();\n this._controllers.pivotController.endPivot();\n }\n this.warn(\"planView property is deprecated - replaced with navMode\");\n }\n\n /**\n * Gets whether this ````CameraControl```` is in plan-view mode.\n *\n * When in plan-view mode, rotation is disabled.\n *\n * Default is ````false````.\n *\n * Deprecated - use {@link CameraControl#navMode} instead.\n *\n * @returns {Boolean} Returns ````true```` if plan-view mode is enabled.\n * @deprecated\n */\n get planView() {\n this.warn(\"planView property is deprecated - replaced with navMode\");\n return this._configs.planView;\n }\n\n /**\n * Sets whether this ````CameraControl```` is in first-person mode.\n *\n * In \"first person\" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.\n *\n * Default is ````false````.\n *\n * Deprecated - use {@link CameraControl#navMode} instead.\n *\n * @param {Boolean} value Set ````true```` to enable first-person mode.\n * @deprecated\n */\n set firstPerson(value) {\n this.warn(\"firstPerson property is deprecated - replaced with navMode\");\n this._configs.firstPerson = !!value;\n this._configs.planView = false;\n if (this._configs.firstPerson) {\n this._controllers.pivotController.hidePivot();\n this._controllers.pivotController.endPivot();\n }\n }\n\n /**\n * Gets whether this ````CameraControl```` is in first-person mode.\n *\n * In \"first person\" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.\n *\n * Default is ````false````.\n *\n * Deprecated - use {@link CameraControl#navMode} instead.\n *\n * @returns {Boolean} Returns ````true```` if first-person mode is enabled.\n * @deprecated\n */\n get firstPerson() {\n this.warn(\"firstPerson property is deprecated - replaced with navMode\");\n return this._configs.firstPerson;\n }\n\n /**\n * Sets whether to vertically constrain the {@link Camera} position for first-person navigation.\n *\n * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.\n *\n * Only applies when {@link CameraControl#navMode} is ````\"firstPerson\"````.\n *\n * Default is ````false````.\n *\n * @param {Boolean} value Set ````true```` to vertically constrain the Camera.\n */\n set constrainVertical(value) {\n this._configs.constrainVertical = !!value;\n }\n\n /**\n * Gets whether to vertically constrain the {@link Camera} position for first-person navigation.\n *\n * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.\n *\n * Only applies when {@link CameraControl#navMode} is ````\"firstPerson\"````.\n *\n * Default is ````false````.\n *\n * @returns {Boolean} ````true```` when Camera is vertically constrained.\n */\n get constrainVertical() {\n return this._configs.constrainVertical;\n }\n\n /**\n * Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.\n *\n * Default is ````false````.\n *\n * @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.\n */\n set doublePickFlyTo(value) {\n this._configs.doublePickFlyTo = value !== false;\n }\n\n /**\n * Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.\n *\n * Default is ````false````.\n *\n * @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.\n */\n get doublePickFlyTo() {\n return this._configs.doublePickFlyTo;\n }\n\n /**\n * Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.\n *\n * Default is ````true````.\n *\n * @param {Boolean} value Set ````false```` to disable pan on right-click.\n */\n set panRightClick(value) {\n this._configs.panRightClick = value !== false;\n }\n\n /**\n * Gets whether right-clicking pans the {@link Camera}.\n *\n * Default is ````true````.\n *\n * @returns {Boolean} Returns ````false```` when pan on right-click is disabled.\n */\n get panRightClick() {\n return this._configs.panRightClick;\n }\n\n /**\n * Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.\n *\n * A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,\n * while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.\n *\n * You may choose an inertia of zero when you want be able to precisely rotate the Camera,\n * without interference from inertia. Zero inertia can also mean that less frames are rendered while\n * you are rotating the Camera.\n *\n * Default is ````0.0````.\n *\n * Does not apply when {@link CameraControl#navMode} is ````\"planView\"````, which disallows rotation.\n *\n * @param {Number} rotationInertia New inertial factor.\n */\n set rotationInertia(rotationInertia) {\n this._configs.rotationInertia = (rotationInertia !== undefined && rotationInertia !== null) ? rotationInertia : 0.0;\n }\n\n /**\n * Gets the rotation inertia factor.\n *\n * Default is ````0.0````.\n *\n * Does not apply when {@link CameraControl#navMode} is ````\"planView\"````, which disallows rotation.\n *\n * @returns {Number} The inertia factor.\n */\n get rotationInertia() {\n return this._configs.rotationInertia;\n }\n\n /**\n * Sets how much the {@link Camera} pans each second with keyboard input.\n *\n * Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that\n * a panning key is depressed. See the ````CameraControl```` class documentation for which keys control\n * panning.\n *\n * Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan\n * to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards\n * and backwards, we pan along the direction the Camera is pointing.\n *\n * Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.\n *\n * @param {Number} keyboardPanRate The new keyboard pan rate.\n */\n set keyboardPanRate(keyboardPanRate) {\n this._configs.keyboardPanRate = (keyboardPanRate !== null && keyboardPanRate !== undefined) ? keyboardPanRate : 5.0;\n }\n\n\n /**\n * Sets how fast the camera pans on touch panning\n *\n * @param {Number} touchPanRate The new touch pan rate.\n */\n set touchPanRate(touchPanRate) {\n this._configs.touchPanRate = (touchPanRate !== null && touchPanRate !== undefined) ? touchPanRate : 1.0;\n }\n\n /**\n * Gets how fast the {@link Camera} pans on touch panning\n *\n * Default is ````1.0````.\n *\n * @returns {Number} The current touch pan rate.\n */\n get touchPanRate() {\n return this._configs.touchPanRate;\n }\n\n /**\n * Gets how much the {@link Camera} pans each second with keyboard input.\n *\n * Default is ````5.0````.\n *\n * @returns {Number} The current keyboard pan rate.\n */\n get keyboardPanRate() {\n return this._configs.keyboardPanRate;\n }\n\n /**\n * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.\n *\n * Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that\n * a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control\n * rotation/orbit.\n *\n * @param {Number} keyboardRotationRate The new keyboard rotation rate.\n */\n set keyboardRotationRate(keyboardRotationRate) {\n this._configs.keyboardRotationRate = (keyboardRotationRate !== null && keyboardRotationRate !== undefined) ? keyboardRotationRate : 90.0;\n }\n\n /**\n * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.\n *\n * Default is ````90.0````.\n *\n * @returns {Number} The current keyboard rotation rate.\n */\n get keyboardRotationRate() {\n return this._configs.keyboardRotationRate;\n }\n\n /**\n * Sets the current drag rotation rate.\n *\n * This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.\n *\n * For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally\n * when we sweep the entire width of the canvas.\n *\n * ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to\n * flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees\n * vertically when we sweep the entire height of the canvas.\n *\n * Default is ````360.0````.\n *\n * @param {Number} dragRotationRate The new drag rotation rate.\n */\n set dragRotationRate(dragRotationRate) {\n this._configs.dragRotationRate = (dragRotationRate !== null && dragRotationRate !== undefined) ? dragRotationRate : 360.0;\n }\n\n /**\n * Gets the current drag rotation rate.\n *\n * Default is ````360.0````.\n *\n * @returns {Number} The current drag rotation rate.\n */\n get dragRotationRate() {\n return this._configs.dragRotationRate;\n }\n\n /**\n * Sets how much the {@link Camera} dollys each second with keyboard input.\n *\n * Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down\n * the ````+```` and ````-```` keys.\n *\n * @param {Number} keyboardDollyRate The new keyboard dolly rate.\n */\n set keyboardDollyRate(keyboardDollyRate) {\n this._configs.keyboardDollyRate = (keyboardDollyRate !== null && keyboardDollyRate !== undefined) ? keyboardDollyRate : 15.0;\n }\n\n /**\n * Gets how much the {@link Camera} dollys each second with keyboard input.\n *\n * Default is ````15.0````.\n *\n * @returns {Number} The current keyboard dolly rate.\n */\n get keyboardDollyRate() {\n return this._configs.keyboardDollyRate;\n }\n\n /**\n * Sets how much the {@link Camera} dollys with touch input.\n *\n * Default is ````0.2````\n *\n * @param {Number} touchDollyRate The new touch dolly rate.\n */\n set touchDollyRate(touchDollyRate) {\n this._configs.touchDollyRate = (touchDollyRate !== null && touchDollyRate !== undefined) ? touchDollyRate : 0.2;\n }\n\n /**\n * Gets how much the {@link Camera} dollys each second with touch input.\n *\n * Default is ````0.2````.\n *\n * @returns {Number} The current touch dolly rate.\n */\n get touchDollyRate() {\n return this._configs.touchDollyRate;\n }\n\n /**\n * Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.\n *\n * Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin\n * the mouse wheel.\n *\n * @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.\n */\n set mouseWheelDollyRate(mouseWheelDollyRate) {\n this._configs.mouseWheelDollyRate = (mouseWheelDollyRate !== null && mouseWheelDollyRate !== undefined) ? mouseWheelDollyRate : 100.0;\n }\n\n /**\n * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.\n *\n * Default is ````100.0````.\n *\n * @returns {Number} The current mouseWheel dolly rate.\n */\n get mouseWheelDollyRate() {\n return this._configs.mouseWheelDollyRate;\n }\n\n /**\n * Sets the dolly inertia factor.\n *\n * This factor configures how much the {@link Camera} keeps moving after you finish dollying it.\n *\n * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,\n * ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying\n * to continue until further input stops it.\n *\n * You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,\n * without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,\n * which can improve rendering performance.\n *\n * Default is ````0````.\n *\n * @param {Number} dollyInertia New dolly inertia factor.\n */\n set dollyInertia(dollyInertia) {\n this._configs.dollyInertia = (dollyInertia !== undefined && dollyInertia !== null) ? dollyInertia : 0;\n }\n\n /**\n * Gets the dolly inertia factor.\n *\n * Default is ````0````.\n *\n * @returns {Number} The current dolly inertia factor.\n */\n get dollyInertia() {\n return this._configs.dollyInertia;\n }\n\n /**\n * Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.\n *\n * Default is ````35.0````.\n *\n * @param {Number} dollyProximityThreshold New dolly proximity threshold.\n */\n set dollyProximityThreshold(dollyProximityThreshold) {\n this._configs.dollyProximityThreshold = (dollyProximityThreshold !== undefined && dollyProximityThreshold !== null) ? dollyProximityThreshold : 35.0;\n }\n\n /**\n * Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.\n *\n * Default is ````35.0````.\n *\n * @returns {Number} The current dolly proximity threshold.\n */\n get dollyProximityThreshold() {\n return this._configs.dollyProximityThreshold;\n }\n\n /**\n * Sets the minimum dolly speed.\n *\n * Default is ````0.04````.\n *\n * @param {Number} dollyMinSpeed New dolly minimum speed.\n */\n set dollyMinSpeed(dollyMinSpeed) {\n this._configs.dollyMinSpeed = (dollyMinSpeed !== undefined && dollyMinSpeed !== null) ? dollyMinSpeed : 0.04;\n }\n\n /**\n * Gets the minimum dolly speed.\n *\n * Default is ````0.04````.\n *\n * @returns {Number} The current minimum dolly speed.\n */\n get dollyMinSpeed() {\n return this._configs.dollyMinSpeed;\n }\n\n /**\n * Sets the pan inertia factor.\n *\n * This factor configures how much the {@link Camera} keeps moving after you finish panning it.\n *\n * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,\n * ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning\n * to continue until further input stops it.\n *\n * You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,\n * without interference from inertia. This also means that xeokit renders less frames while panning the Camera,\n * wich can improve rendering performance.\n *\n * Default is ````0.5````.\n *\n * @param {Number} panInertia New pan inertia factor.\n */\n set panInertia(panInertia) {\n this._configs.panInertia = (panInertia !== undefined && panInertia !== null) ? panInertia : 0.5;\n }\n\n /**\n * Gets the pan inertia factor.\n *\n * Default is ````0.5````.\n *\n * @returns {Number} The current pan inertia factor.\n */\n get panInertia() {\n return this._configs.panInertia;\n }\n\n /**\n * Sets the keyboard layout.\n *\n * Supported layouts are:\n *\n * * ````\"qwerty\"```` (default)\n * * ````\"azerty\"````\n *\n * @deprecated\n * @param {String} value Selects the keyboard layout.\n */\n set keyboardLayout(value) {\n // this.warn(\"keyboardLayout property is deprecated - use keyMap property instead\");\n value = value || \"qwerty\";\n if (value !== \"qwerty\" && value !== \"azerty\") {\n this.error(\"Unsupported value for keyboardLayout - defaulting to 'qwerty'\");\n value = \"qwerty\";\n }\n this._configs.keyboardLayout = value;\n this.keyMap = this._configs.keyboardLayout;\n }\n\n /**\n * Gets the keyboard layout.\n *\n * Supported layouts are:\n *\n * * ````\"qwerty\"```` (default)\n * * ````\"azerty\"````\n *\n * @deprecated\n * @returns {String} The current keyboard layout.\n */\n get keyboardLayout() {\n return this._configs.keyboardLayout;\n }\n\n /**\n * Sets a sphere as the representation of the pivot position.\n *\n * @param {Object} [cfg] Sphere configuration.\n * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.\n * @param {String} [cfg.material=PhongMaterial] Optional size factor of the sphere. Defaults to a red opaque material.\n */\n enablePivotSphere(cfg = {}) {\n this._controllers.pivotController.enablePivotSphere(cfg);\n }\n\n /**\n * Remove the sphere as the representation of the pivot position.\n *\n */\n disablePivotSphere() {\n this._controllers.pivotController.disablePivotSphere();\n }\n \n /**\n * Sets whether smart default pivoting is enabled.\n *\n * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an\n * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.\n *\n * When ````false````, we'll pivot by default about {@link Camera#look}.\n *\n * Default is ````false````.\n *\n * @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.\n */\n set smartPivot(enabled) {\n this._configs.smartPivot = (enabled !== false);\n }\n\n /**\n * Gets whether smart default pivoting is enabled.\n *\n * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an\n * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.\n *\n * When ````false````, we'll pivot by default about {@link Camera#look}.\n *\n * Default is ````false````.\n *\n * @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.\n */\n get smartPivot() {\n return this._configs.smartPivot;\n }\n\n /**\n * Sets the double click time frame length in milliseconds.\n * \n * If two mouse click events occur within this time frame, it is considered a double click. \n * \n * Default is ````250````\n * \n * @param {Number} value New double click time frame.\n */\n set doubleClickTimeFrame(value) {\n this._configs.doubleClickTimeFrame = (value !== undefined && value !== null) ? value : 250;\n }\n\n /**\n * Gets the double click time frame length in milliseconds.\n * \n * Default is ````250````\n * \n * @param {Number} value Current double click time frame.\n */\n get doubleClickTimeFrame() {\n return this._configs.doubleClickTimeFrame;\n }\n\n /**\n * Destroys this ````CameraControl````.\n * @private\n */\n destroy() {\n this._destroyHandlers();\n this._destroyControllers();\n this._cameraUpdater.destroy();\n super.destroy();\n }\n\n _destroyHandlers() {\n for (let i = 0, len = this._handlers.length; i < len; i++) {\n const handler = this._handlers[i];\n if (handler.destroy) {\n handler.destroy();\n }\n }\n }\n\n _destroyControllers() {\n for (let i = 0, len = this._controllers.length; i < len; i++) {\n const controller = this._controllers[i];\n if (controller.destroy) {\n controller.destroy();\n }\n }\n }\n}\n\nexport {\n CameraControl\n};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/CameraControl.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/CameraControl.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2272, + "__docId__": 2280, "kind": "variable", "name": "DEFAULT_SNAP_PICK_RADIUS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js", @@ -46155,7 +46371,7 @@ "ignore": true }, { - "__docId__": 2273, + "__docId__": 2281, "kind": "variable", "name": "DEFAULT_SNAP_VERTEX", "memberof": "src/viewer/scene/CameraControl/CameraControl.js", @@ -46176,7 +46392,7 @@ "ignore": true }, { - "__docId__": 2274, + "__docId__": 2282, "kind": "variable", "name": "DEFAULT_SNAP_EDGE", "memberof": "src/viewer/scene/CameraControl/CameraControl.js", @@ -46197,7 +46413,7 @@ "ignore": true }, { - "__docId__": 2275, + "__docId__": 2283, "kind": "class", "name": "CameraControl", "memberof": "src/viewer/scene/CameraControl/CameraControl.js", @@ -46215,7 +46431,7 @@ ] }, { - "__docId__": 2276, + "__docId__": 2284, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46235,7 +46451,7 @@ "ignore": true }, { - "__docId__": 2277, + "__docId__": 2285, "kind": "member", "name": "PAN_LEFT", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46260,7 +46476,7 @@ } }, { - "__docId__": 2278, + "__docId__": 2286, "kind": "member", "name": "PAN_RIGHT", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46285,7 +46501,7 @@ } }, { - "__docId__": 2279, + "__docId__": 2287, "kind": "member", "name": "PAN_UP", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46310,7 +46526,7 @@ } }, { - "__docId__": 2280, + "__docId__": 2288, "kind": "member", "name": "PAN_DOWN", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46335,7 +46551,7 @@ } }, { - "__docId__": 2281, + "__docId__": 2289, "kind": "member", "name": "PAN_FORWARDS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46360,7 +46576,7 @@ } }, { - "__docId__": 2282, + "__docId__": 2290, "kind": "member", "name": "PAN_BACKWARDS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46385,7 +46601,7 @@ } }, { - "__docId__": 2283, + "__docId__": 2291, "kind": "member", "name": "ROTATE_X_POS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46410,7 +46626,7 @@ } }, { - "__docId__": 2284, + "__docId__": 2292, "kind": "member", "name": "ROTATE_X_NEG", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46435,7 +46651,7 @@ } }, { - "__docId__": 2285, + "__docId__": 2293, "kind": "member", "name": "ROTATE_Y_POS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46460,7 +46676,7 @@ } }, { - "__docId__": 2286, + "__docId__": 2294, "kind": "member", "name": "ROTATE_Y_NEG", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46485,7 +46701,7 @@ } }, { - "__docId__": 2287, + "__docId__": 2295, "kind": "member", "name": "DOLLY_FORWARDS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46510,7 +46726,7 @@ } }, { - "__docId__": 2288, + "__docId__": 2296, "kind": "member", "name": "DOLLY_BACKWARDS", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46535,7 +46751,7 @@ } }, { - "__docId__": 2289, + "__docId__": 2297, "kind": "member", "name": "AXIS_VIEW_RIGHT", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46560,7 +46776,7 @@ } }, { - "__docId__": 2290, + "__docId__": 2298, "kind": "member", "name": "AXIS_VIEW_BACK", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46585,7 +46801,7 @@ } }, { - "__docId__": 2291, + "__docId__": 2299, "kind": "member", "name": "AXIS_VIEW_LEFT", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46610,7 +46826,7 @@ } }, { - "__docId__": 2292, + "__docId__": 2300, "kind": "member", "name": "AXIS_VIEW_FRONT", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46635,7 +46851,7 @@ } }, { - "__docId__": 2293, + "__docId__": 2301, "kind": "member", "name": "AXIS_VIEW_TOP", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46660,7 +46876,7 @@ } }, { - "__docId__": 2294, + "__docId__": 2302, "kind": "member", "name": "AXIS_VIEW_BOTTOM", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46685,7 +46901,7 @@ } }, { - "__docId__": 2295, + "__docId__": 2303, "kind": "member", "name": "_keyMap", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46703,7 +46919,7 @@ } }, { - "__docId__": 2296, + "__docId__": 2304, "kind": "member", "name": "_configs", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46721,7 +46937,7 @@ } }, { - "__docId__": 2297, + "__docId__": 2305, "kind": "member", "name": "_states", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46739,7 +46955,7 @@ } }, { - "__docId__": 2298, + "__docId__": 2306, "kind": "member", "name": "_updates", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46757,7 +46973,7 @@ } }, { - "__docId__": 2299, + "__docId__": 2307, "kind": "member", "name": "_controllers", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46775,7 +46991,7 @@ } }, { - "__docId__": 2300, + "__docId__": 2308, "kind": "member", "name": "_handlers", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46793,7 +47009,7 @@ } }, { - "__docId__": 2301, + "__docId__": 2309, "kind": "member", "name": "_cameraUpdater", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46811,7 +47027,7 @@ } }, { - "__docId__": 2324, + "__docId__": 2332, "kind": "set", "name": "keyMap", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46836,7 +47052,7 @@ ] }, { - "__docId__": 2327, + "__docId__": 2335, "kind": "get", "name": "keyMap", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46868,7 +47084,7 @@ } }, { - "__docId__": 2328, + "__docId__": 2336, "kind": "method", "name": "_isKeyDownForAction", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46909,7 +47125,7 @@ } }, { - "__docId__": 2329, + "__docId__": 2337, "kind": "set", "name": "pivotElement", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46934,7 +47150,7 @@ ] }, { - "__docId__": 2330, + "__docId__": 2338, "kind": "set", "name": "active", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46959,7 +47175,7 @@ ] }, { - "__docId__": 2331, + "__docId__": 2339, "kind": "get", "name": "active", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -46991,7 +47207,7 @@ } }, { - "__docId__": 2332, + "__docId__": 2340, "kind": "set", "name": "snapToVertex", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47016,7 +47232,7 @@ ] }, { - "__docId__": 2333, + "__docId__": 2341, "kind": "get", "name": "snapToVertex", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47048,7 +47264,7 @@ } }, { - "__docId__": 2334, + "__docId__": 2342, "kind": "set", "name": "snapToEdge", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47073,7 +47289,7 @@ ] }, { - "__docId__": 2335, + "__docId__": 2343, "kind": "get", "name": "snapToEdge", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47105,7 +47321,7 @@ } }, { - "__docId__": 2336, + "__docId__": 2344, "kind": "set", "name": "snapRadius", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47130,7 +47346,7 @@ ] }, { - "__docId__": 2337, + "__docId__": 2345, "kind": "get", "name": "snapRadius", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47162,7 +47378,7 @@ } }, { - "__docId__": 2338, + "__docId__": 2346, "kind": "set", "name": "navMode", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47187,7 +47403,7 @@ ] }, { - "__docId__": 2339, + "__docId__": 2347, "kind": "get", "name": "navMode", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47219,7 +47435,7 @@ } }, { - "__docId__": 2340, + "__docId__": 2348, "kind": "set", "name": "pointerEnabled", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47244,7 +47460,7 @@ ] }, { - "__docId__": 2341, + "__docId__": 2349, "kind": "method", "name": "_reset", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47261,7 +47477,7 @@ "return": null }, { - "__docId__": 2342, + "__docId__": 2350, "kind": "get", "name": "pointerEnabled", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47293,7 +47509,7 @@ } }, { - "__docId__": 2343, + "__docId__": 2351, "kind": "set", "name": "followPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47318,7 +47534,7 @@ ] }, { - "__docId__": 2344, + "__docId__": 2352, "kind": "get", "name": "followPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47350,7 +47566,7 @@ } }, { - "__docId__": 2345, + "__docId__": 2353, "kind": "set", "name": "pivotPos", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47375,7 +47591,7 @@ ] }, { - "__docId__": 2346, + "__docId__": 2354, "kind": "get", "name": "pivotPos", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47401,7 +47617,7 @@ } }, { - "__docId__": 2347, + "__docId__": 2355, "kind": "set", "name": "dollyToPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47427,7 +47643,7 @@ ] }, { - "__docId__": 2349, + "__docId__": 2357, "kind": "get", "name": "dollyToPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47460,7 +47676,7 @@ } }, { - "__docId__": 2350, + "__docId__": 2358, "kind": "set", "name": "panToPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47486,7 +47702,7 @@ ] }, { - "__docId__": 2351, + "__docId__": 2359, "kind": "get", "name": "panToPointer", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47519,7 +47735,7 @@ } }, { - "__docId__": 2352, + "__docId__": 2360, "kind": "set", "name": "planView", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47545,7 +47761,7 @@ ] }, { - "__docId__": 2353, + "__docId__": 2361, "kind": "get", "name": "planView", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47578,7 +47794,7 @@ } }, { - "__docId__": 2354, + "__docId__": 2362, "kind": "set", "name": "firstPerson", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47604,7 +47820,7 @@ ] }, { - "__docId__": 2355, + "__docId__": 2363, "kind": "get", "name": "firstPerson", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47637,7 +47853,7 @@ } }, { - "__docId__": 2356, + "__docId__": 2364, "kind": "set", "name": "constrainVertical", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47662,7 +47878,7 @@ ] }, { - "__docId__": 2357, + "__docId__": 2365, "kind": "get", "name": "constrainVertical", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47694,7 +47910,7 @@ } }, { - "__docId__": 2358, + "__docId__": 2366, "kind": "set", "name": "doublePickFlyTo", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47719,7 +47935,7 @@ ] }, { - "__docId__": 2359, + "__docId__": 2367, "kind": "get", "name": "doublePickFlyTo", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47751,7 +47967,7 @@ } }, { - "__docId__": 2360, + "__docId__": 2368, "kind": "set", "name": "panRightClick", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47776,7 +47992,7 @@ ] }, { - "__docId__": 2361, + "__docId__": 2369, "kind": "get", "name": "panRightClick", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47808,7 +48024,7 @@ } }, { - "__docId__": 2362, + "__docId__": 2370, "kind": "set", "name": "rotationInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47833,7 +48049,7 @@ ] }, { - "__docId__": 2363, + "__docId__": 2371, "kind": "get", "name": "rotationInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47865,7 +48081,7 @@ } }, { - "__docId__": 2364, + "__docId__": 2372, "kind": "set", "name": "keyboardPanRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47890,7 +48106,7 @@ ] }, { - "__docId__": 2365, + "__docId__": 2373, "kind": "set", "name": "touchPanRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47915,7 +48131,7 @@ ] }, { - "__docId__": 2366, + "__docId__": 2374, "kind": "get", "name": "touchPanRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47947,7 +48163,7 @@ } }, { - "__docId__": 2367, + "__docId__": 2375, "kind": "get", "name": "keyboardPanRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -47979,7 +48195,7 @@ } }, { - "__docId__": 2368, + "__docId__": 2376, "kind": "set", "name": "keyboardRotationRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48004,7 +48220,7 @@ ] }, { - "__docId__": 2369, + "__docId__": 2377, "kind": "get", "name": "keyboardRotationRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48036,7 +48252,7 @@ } }, { - "__docId__": 2370, + "__docId__": 2378, "kind": "set", "name": "dragRotationRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48061,7 +48277,7 @@ ] }, { - "__docId__": 2371, + "__docId__": 2379, "kind": "get", "name": "dragRotationRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48093,7 +48309,7 @@ } }, { - "__docId__": 2372, + "__docId__": 2380, "kind": "set", "name": "keyboardDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48118,7 +48334,7 @@ ] }, { - "__docId__": 2373, + "__docId__": 2381, "kind": "get", "name": "keyboardDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48150,7 +48366,7 @@ } }, { - "__docId__": 2374, + "__docId__": 2382, "kind": "set", "name": "touchDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48175,7 +48391,7 @@ ] }, { - "__docId__": 2375, + "__docId__": 2383, "kind": "get", "name": "touchDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48207,7 +48423,7 @@ } }, { - "__docId__": 2376, + "__docId__": 2384, "kind": "set", "name": "mouseWheelDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48232,7 +48448,7 @@ ] }, { - "__docId__": 2377, + "__docId__": 2385, "kind": "get", "name": "mouseWheelDollyRate", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48264,7 +48480,7 @@ } }, { - "__docId__": 2378, + "__docId__": 2386, "kind": "set", "name": "dollyInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48289,7 +48505,7 @@ ] }, { - "__docId__": 2379, + "__docId__": 2387, "kind": "get", "name": "dollyInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48321,7 +48537,7 @@ } }, { - "__docId__": 2380, + "__docId__": 2388, "kind": "set", "name": "dollyProximityThreshold", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48346,7 +48562,7 @@ ] }, { - "__docId__": 2381, + "__docId__": 2389, "kind": "get", "name": "dollyProximityThreshold", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48378,7 +48594,7 @@ } }, { - "__docId__": 2382, + "__docId__": 2390, "kind": "set", "name": "dollyMinSpeed", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48403,7 +48619,7 @@ ] }, { - "__docId__": 2383, + "__docId__": 2391, "kind": "get", "name": "dollyMinSpeed", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48435,7 +48651,7 @@ } }, { - "__docId__": 2384, + "__docId__": 2392, "kind": "set", "name": "panInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48460,7 +48676,7 @@ ] }, { - "__docId__": 2385, + "__docId__": 2393, "kind": "get", "name": "panInertia", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48492,7 +48708,7 @@ } }, { - "__docId__": 2386, + "__docId__": 2394, "kind": "set", "name": "keyboardLayout", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48518,7 +48734,7 @@ ] }, { - "__docId__": 2388, + "__docId__": 2396, "kind": "get", "name": "keyboardLayout", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48551,7 +48767,7 @@ } }, { - "__docId__": 2389, + "__docId__": 2397, "kind": "method", "name": "enablePivotSphere", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48601,7 +48817,7 @@ "return": null }, { - "__docId__": 2390, + "__docId__": 2398, "kind": "method", "name": "disablePivotSphere", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48616,7 +48832,7 @@ "return": null }, { - "__docId__": 2391, + "__docId__": 2399, "kind": "set", "name": "smartPivot", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48641,7 +48857,7 @@ ] }, { - "__docId__": 2392, + "__docId__": 2400, "kind": "get", "name": "smartPivot", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48673,7 +48889,7 @@ } }, { - "__docId__": 2393, + "__docId__": 2401, "kind": "set", "name": "doubleClickTimeFrame", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48698,7 +48914,7 @@ ] }, { - "__docId__": 2394, + "__docId__": 2402, "kind": "get", "name": "doubleClickTimeFrame", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48728,7 +48944,7 @@ } }, { - "__docId__": 2395, + "__docId__": 2403, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48744,7 +48960,7 @@ "return": null }, { - "__docId__": 2396, + "__docId__": 2404, "kind": "method", "name": "_destroyHandlers", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48761,7 +48977,7 @@ "return": null }, { - "__docId__": 2397, + "__docId__": 2405, "kind": "method", "name": "_destroyControllers", "memberof": "src/viewer/scene/CameraControl/CameraControl.js~CameraControl", @@ -48778,18 +48994,18 @@ "return": null }, { - "__docId__": 2398, + "__docId__": 2406, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/CameraUpdater.js", "content": "import {math} from \"../../math/math.js\";\n\nconst SCALE_DOLLY_EACH_FRAME = 1; // Recalculate dolly speed for eye->target distance on each Nth frame\nconst EPSILON = 0.001;\nconst tempVec3 = math.vec3();\n\n/**\n * Handles camera updates on each \"tick\" that were scheduled by the various controllers.\n *\n * @private\n */\nclass CameraUpdater {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n const camera = scene.camera;\n const pickController = controllers.pickController;\n const pivotController = controllers.pivotController;\n const panController = controllers.panController;\n\n let countDown = SCALE_DOLLY_EACH_FRAME; // Decrements on each tick\n let dollyDistFactor = 1.0; // Calculated when countDown is zero\n let followPointerWorldPos = null; // Holds the pointer's World position when configs.followPointer is true\n \n this._onTick = scene.on(\"tick\", () => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n let cursorType = \"default\";\n\n //----------------------------------------------------------------------------------------------------------\n // Dolly decay\n //------------------------------------------------------------------------------------ ----------------------\n\n if (Math.abs(updates.dollyDelta) < EPSILON) {\n updates.dollyDelta = 0;\n }\n\n //----------------------------------------------------------------------------------------------------------\n // Rotation decay\n //----------------------------------------------------------------------------------------------------------\n\n if (Math.abs(updates.rotateDeltaX) < EPSILON) {\n updates.rotateDeltaX = 0;\n }\n\n if (Math.abs(updates.rotateDeltaY) < EPSILON) {\n updates.rotateDeltaY = 0;\n }\n\n if (updates.rotateDeltaX !== 0 || updates.rotateDeltaY !== 0) {\n updates.dollyDelta = 0;\n }\n\n //----------------------------------------------------------------------------------------------------------\n // Dolly speed eye->look scaling\n //\n // If pointer is over an object, then dolly speed is proportional to the distance to that object.\n //\n // If pointer is not over an object, then dolly speed is proportional to the distance to the last\n // object the pointer was over. This is so that we can dolly to structures that may have gaps through\n // which empty background shows, that the pointer may inadvertently be over. In these cases, we don't\n // want dolly speed wildly varying depending on how accurately the user avoids the gaps with the pointer.\n //----------------------------------------------------------------------------------------------------------\n\n if (configs.followPointer) {\n\n if (--countDown <= 0) {\n\n countDown = SCALE_DOLLY_EACH_FRAME;\n\n if (updates.dollyDelta !== 0) {\n if (updates.rotateDeltaY === 0 && updates.rotateDeltaX === 0) {\n\n if (configs.followPointer && states.followPointerDirty) {\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickSurface = true;\n pickController.update();\n\n if (pickController.pickResult && pickController.pickResult.worldPos) {\n followPointerWorldPos = pickController.pickResult.worldPos;\n \n } else {\n dollyDistFactor = 1.0;\n followPointerWorldPos = null;\n }\n\n states.followPointerDirty = false;\n }\n }\n\n if (followPointerWorldPos) {\n const dist = Math.abs(math.lenVec3(math.subVec3(followPointerWorldPos, scene.camera.eye, tempVec3)));\n dollyDistFactor = dist / configs.dollyProximityThreshold;\n }\n\n if (dollyDistFactor < configs.dollyMinSpeed) {\n dollyDistFactor = configs.dollyMinSpeed;\n }\n }\n }\n } else {\n dollyDistFactor = 1;\n followPointerWorldPos = null;\n }\n\n const dollyDeltaForDist = (updates.dollyDelta * dollyDistFactor);\n\n //----------------------------------------------------------------------------------------------------------\n // Rotation\n //----------------------------------------------------------------------------------------------------------\n\n if (updates.rotateDeltaY !== 0 || updates.rotateDeltaX !== 0) {\n\n if ((!configs.firstPerson) && configs.followPointer && pivotController.getPivoting()) {\n pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);\n pivotController.showPivot();\n\n } else {\n\n if (updates.rotateDeltaX !== 0) {\n if (configs.firstPerson) {\n camera.pitch(-updates.rotateDeltaX);\n } else {\n camera.orbitPitch(updates.rotateDeltaX);\n }\n }\n\n if (updates.rotateDeltaY !== 0) {\n if (configs.firstPerson) {\n camera.yaw(updates.rotateDeltaY);\n } else {\n camera.orbitYaw(updates.rotateDeltaY);\n }\n }\n }\n\n updates.rotateDeltaX *= configs.rotationInertia;\n updates.rotateDeltaY *= configs.rotationInertia;\n\n cursorType = \"grabbing\";\n }\n\n //----------------------------------------------------------------------------------------------------------\n // Panning\n //----------------------------------------------------------------------------------------------------------\n\n if (Math.abs(updates.panDeltaX) < EPSILON) {\n updates.panDeltaX = 0;\n }\n\n if (Math.abs(updates.panDeltaY) < EPSILON) {\n updates.panDeltaY = 0;\n }\n\n if (Math.abs(updates.panDeltaZ) < EPSILON) {\n updates.panDeltaZ = 0;\n }\n\n if (updates.panDeltaX !== 0 || updates.panDeltaY !== 0 || updates.panDeltaZ !== 0) {\n\n const vec = math.vec3();\n\n vec[0] = updates.panDeltaX;\n vec[1] = updates.panDeltaY;\n vec[2] = updates.panDeltaZ;\n\n let verticalEye;\n let verticalLook;\n\n if (configs.constrainVertical) {\n\n if (camera.xUp) {\n verticalEye = camera.eye[0];\n verticalLook = camera.look[0];\n } else if (camera.yUp) {\n verticalEye = camera.eye[1];\n verticalLook = camera.look[1];\n } else if (camera.zUp) {\n verticalEye = camera.eye[2];\n verticalLook = camera.look[2];\n }\n\n camera.pan(vec);\n\n const eye = camera.eye;\n const look = camera.look;\n\n if (camera.xUp) {\n eye[0] = verticalEye;\n look[0] = verticalLook;\n } else if (camera.yUp) {\n eye[1] = verticalEye;\n look[1] = verticalLook;\n } else if (camera.zUp) {\n eye[2] = verticalEye;\n look[2] = verticalLook;\n }\n\n camera.eye = eye;\n camera.look = look;\n\n } else {\n camera.pan(vec);\n }\n\n cursorType = \"grabbing\";\n }\n\n updates.panDeltaX *= configs.panInertia;\n updates.panDeltaY *= configs.panInertia;\n updates.panDeltaZ *= configs.panInertia;\n\n //----------------------------------------------------------------------------------------------------------\n // Dollying\n //----------------------------------------------------------------------------------------------------------\n\n if (dollyDeltaForDist !== 0) {\n\n if (dollyDeltaForDist < 0) {\n cursorType = \"zoom-in\";\n } else {\n cursorType = \"zoom-out\";\n }\n\n if (configs.firstPerson) {\n\n let verticalEye;\n let verticalLook;\n\n if (configs.constrainVertical) {\n if (camera.xUp) {\n verticalEye = camera.eye[0];\n verticalLook = camera.look[0];\n } else if (camera.yUp) {\n verticalEye = camera.eye[1];\n verticalLook = camera.look[1];\n } else if (camera.zUp) {\n verticalEye = camera.eye[2];\n verticalLook = camera.look[2];\n }\n }\n\n if (configs.followPointer) {\n const dolliedThroughSurface = panController.dollyToCanvasPos(followPointerWorldPos, states.pointerCanvasPos, -dollyDeltaForDist);\n if (dolliedThroughSurface) {\n states.followPointerDirty = true;\n }\n } else {\n camera.pan([0, 0, dollyDeltaForDist]);\n camera.ortho.scale = camera.ortho.scale - dollyDeltaForDist;\n }\n\n if (configs.constrainVertical) {\n const eye = camera.eye;\n const look = camera.look;\n if (camera.xUp) {\n eye[0] = verticalEye;\n look[0] = verticalLook;\n } else if (camera.yUp) {\n eye[1] = verticalEye;\n look[1] = verticalLook;\n } else if (camera.zUp) {\n eye[2] = verticalEye;\n look[2] = verticalLook;\n }\n camera.eye = eye;\n camera.look = look;\n }\n\n } else if (configs.planView) {\n\n if (configs.followPointer) {\n const dolliedThroughSurface = panController.dollyToCanvasPos(followPointerWorldPos, states.pointerCanvasPos, -dollyDeltaForDist);\n if (dolliedThroughSurface) {\n states.followPointerDirty = true;\n }\n } else {\n camera.ortho.scale = camera.ortho.scale + dollyDeltaForDist;\n camera.zoom(dollyDeltaForDist);\n }\n\n } else { // Orbiting\n\n if (configs.followPointer) {\n const dolliedThroughSurface = panController.dollyToCanvasPos(followPointerWorldPos, states.pointerCanvasPos, -dollyDeltaForDist);\n if (dolliedThroughSurface) {\n states.followPointerDirty = true;\n }\n } else {\n camera.ortho.scale = camera.ortho.scale + dollyDeltaForDist;\n camera.zoom(dollyDeltaForDist);\n }\n }\n\n updates.dollyDelta *= configs.dollyInertia;\n }\n\n pickController.fireEvents();\n\n document.body.style.cursor = cursorType;\n });\n }\n\n\n destroy() {\n this._scene.off(this._onTick);\n }\n}\n\nexport {CameraUpdater};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/CameraUpdater.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/CameraUpdater.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2399, + "__docId__": 2407, "kind": "variable", "name": "SCALE_DOLLY_EACH_FRAME", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js", @@ -48810,7 +49026,7 @@ "ignore": true }, { - "__docId__": 2400, + "__docId__": 2408, "kind": "variable", "name": "EPSILON", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js", @@ -48831,7 +49047,7 @@ "ignore": true }, { - "__docId__": 2401, + "__docId__": 2409, "kind": "variable", "name": "tempVec3", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js", @@ -48852,7 +49068,7 @@ "ignore": true }, { - "__docId__": 2402, + "__docId__": 2410, "kind": "class", "name": "CameraUpdater", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js", @@ -48868,7 +49084,7 @@ "ignore": true }, { - "__docId__": 2403, + "__docId__": 2411, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js~CameraUpdater", @@ -48882,7 +49098,7 @@ "undocument": true }, { - "__docId__": 2404, + "__docId__": 2412, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js~CameraUpdater", @@ -48900,7 +49116,7 @@ } }, { - "__docId__": 2405, + "__docId__": 2413, "kind": "member", "name": "_onTick", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js~CameraUpdater", @@ -48918,7 +49134,7 @@ } }, { - "__docId__": 2406, + "__docId__": 2414, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/CameraUpdater.js~CameraUpdater", @@ -48934,18 +49150,18 @@ "return": null }, { - "__docId__": 2407, + "__docId__": 2415, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", "content": "import {math} from \"../../../math/math.js\";\n\nconst screenPos = math.vec4();\nconst viewPos = math.vec4();\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\nconst tempVec4c = math.vec4();\n\n/**\n * @private\n */\nclass PanController {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n /**\n * Dollys the Camera towards the given target 2D canvas position.\n *\n * When the target's corresponding World-space position is also provided, then this function will also test if we've\n * dollied past the target, and will return ````true```` if that's the case.\n *\n * @param [optionalTargetWorldPos] Optional world position of the target\n * @param targetCanvasPos Canvas position of the target\n * @param dollyDelta Amount to dolly\n * @return True if optionalTargetWorldPos was given, and we've dollied past that position.\n */\n dollyToCanvasPos(optionalTargetWorldPos, targetCanvasPos, dollyDelta) {\n\n let dolliedThroughSurface = false;\n\n const camera = this._scene.camera;\n\n if (optionalTargetWorldPos) {\n const eyeToWorldPosVec = math.subVec3(optionalTargetWorldPos, camera.eye, tempVec3a);\n const eyeWorldPosDist = math.lenVec3(eyeToWorldPosVec);\n dolliedThroughSurface = (eyeWorldPosDist < dollyDelta);\n }\n\n if (camera.projection === \"perspective\") {\n\n camera.ortho.scale = camera.ortho.scale - dollyDelta;\n\n const unprojectedWorldPos = this._unproject(targetCanvasPos, tempVec4a);\n const offset = math.subVec3(unprojectedWorldPos, camera.eye, tempVec4c);\n const moveVec = math.mulVec3Scalar(math.normalizeVec3(offset), -dollyDelta, []);\n\n camera.eye = [camera.eye[0] - moveVec[0], camera.eye[1] - moveVec[1], camera.eye[2] - moveVec[2]];\n camera.look = [camera.look[0] - moveVec[0], camera.look[1] - moveVec[1], camera.look[2] - moveVec[2]];\n\n if (optionalTargetWorldPos) {\n\n // Subtle UX tweak - if we have a target World position, then set camera eye->look distance to\n // the same distance as from eye->target. This just gives us a better position for look,\n // if we subsequently orbit eye about look, so that we don't orbit a position that's\n // suddenly a lot closer than the point we pivoted about on the surface of the last object\n // that we click-drag-pivoted on.\n\n const eyeTargetVec = math.subVec3(optionalTargetWorldPos, camera.eye, tempVec3a);\n const lenEyeTargetVec = math.lenVec3(eyeTargetVec);\n const eyeLookVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look, camera.eye, tempVec3b)), lenEyeTargetVec);\n camera.look = [camera.eye[0] + eyeLookVec[0], camera.eye[1] + eyeLookVec[1], camera.eye[2] + eyeLookVec[2]];\n }\n\n } else if (camera.projection === \"ortho\") {\n\n // - set ortho scale, getting the unprojected targetCanvasPos before and after, get that difference in a vector;\n // - get the vector in which we're dollying;\n // - add both vectors to camera eye and look.\n\n const worldPos1 = this._unproject(targetCanvasPos, tempVec4a);\n\n camera.ortho.scale = camera.ortho.scale - dollyDelta;\n camera.ortho._update(); // HACK\n\n const worldPos2 = this._unproject(targetCanvasPos, tempVec4b);\n const offset = math.subVec3(worldPos2, worldPos1, tempVec4c);\n const eyeLookMoveVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look, camera.eye, tempVec3a)), -dollyDelta, tempVec3b);\n const moveVec = math.addVec3(offset, eyeLookMoveVec, tempVec3c);\n\n camera.eye = [camera.eye[0] - moveVec[0], camera.eye[1] - moveVec[1], camera.eye[2] - moveVec[2]];\n camera.look = [camera.look[0] - moveVec[0], camera.look[1] - moveVec[1], camera.look[2] - moveVec[2]];\n }\n\n return dolliedThroughSurface;\n }\n\n _unproject(canvasPos, worldPos) {\n\n const camera = this._scene.camera;\n const transposedProjectMat = camera.project.transposedMatrix;\n const Pt3 = transposedProjectMat.subarray(8, 12);\n const Pt4 = transposedProjectMat.subarray(12);\n const D = [0, 0, -1.0, 1];\n const screenZ = math.dotVec4(D, Pt3) / math.dotVec4(D, Pt4);\n\n camera.project.unproject(canvasPos, screenZ, screenPos, viewPos, worldPos);\n\n return worldPos;\n }\n\n destroy() {\n }\n}\n\nexport {PanController};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/controllers/PanController.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/controllers/PanController.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2408, + "__docId__": 2416, "kind": "variable", "name": "screenPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -48966,7 +49182,7 @@ "ignore": true }, { - "__docId__": 2409, + "__docId__": 2417, "kind": "variable", "name": "viewPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -48987,7 +49203,7 @@ "ignore": true }, { - "__docId__": 2410, + "__docId__": 2418, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49008,7 +49224,7 @@ "ignore": true }, { - "__docId__": 2411, + "__docId__": 2419, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49029,7 +49245,7 @@ "ignore": true }, { - "__docId__": 2412, + "__docId__": 2420, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49050,7 +49266,7 @@ "ignore": true }, { - "__docId__": 2413, + "__docId__": 2421, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49071,7 +49287,7 @@ "ignore": true }, { - "__docId__": 2414, + "__docId__": 2422, "kind": "variable", "name": "tempVec4b", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49092,7 +49308,7 @@ "ignore": true }, { - "__docId__": 2415, + "__docId__": 2423, "kind": "variable", "name": "tempVec4c", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49113,7 +49329,7 @@ "ignore": true }, { - "__docId__": 2416, + "__docId__": 2424, "kind": "class", "name": "PanController", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js", @@ -49129,7 +49345,7 @@ "ignore": true }, { - "__docId__": 2417, + "__docId__": 2425, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js~PanController", @@ -49143,7 +49359,7 @@ "undocument": true }, { - "__docId__": 2418, + "__docId__": 2426, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js~PanController", @@ -49161,7 +49377,7 @@ } }, { - "__docId__": 2419, + "__docId__": 2427, "kind": "method", "name": "dollyToCanvasPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js~PanController", @@ -49214,7 +49430,7 @@ } }, { - "__docId__": 2420, + "__docId__": 2428, "kind": "method", "name": "_unproject", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js~PanController", @@ -49248,7 +49464,7 @@ } }, { - "__docId__": 2421, + "__docId__": 2429, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PanController.js~PanController", @@ -49264,18 +49480,18 @@ "return": null }, { - "__docId__": 2422, + "__docId__": 2430, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/controllers/PickController.js", "content": "import {math} from \"../../../math/math.js\";\nimport {Scene} from \"../../../scene/Scene.js\";\nimport {PickResult} from \"../../../webgl/PickResult.js\";\n\nconst DEFAULT_SNAP_PICK_RADIUS = 45;\nconst DEFAULT_SNAP_MODE = \"vertex\";\n\n/**\n *\n * @private\n */\nclass PickController {\n\n constructor(cameraControl, configs) {\n /**\n * @type {Scene}\n */\n this._scene = cameraControl.scene;\n\n this._cameraControl = cameraControl;\n\n this._scene.canvas.canvas.oncontextmenu = function (e) {\n e.preventDefault();\n };\n\n this._configs = configs;\n\n /**\n * Set true to schedule picking of an Entity.\n * @type {boolean}\n */\n this.schedulePickEntity = false;\n\n /**\n * Set true to schedule picking of a position on teh surface of an Entity.\n * @type {boolean}\n */\n this.schedulePickSurface = false;\n\n /**\n * Set true to schedule snap-picking with surface picking as a fallback - used for measurement.\n * @type {boolean}\n */\n this.scheduleSnapOrPick = false;\n\n /**\n * The canvas position at which to do the next scheduled pick.\n * @type {Number[]}\n */\n this.pickCursorPos = math.vec2();\n\n /**\n * Will be true after picking to indicate that something was picked.\n * @type {boolean}\n */\n this.picked = false;\n\n /**\n * Will be true after picking to indicate that a position on the surface of an Entity was picked.\n * @type {boolean}\n */\n this.pickedSurface = false;\n\n /**\n * Will hold the PickResult after after picking.\n * @type {PickResult}\n */\n this.pickResult = null;\n\n this._lastPickedEntityId = null;\n\n this._lastHash = null;\n\n this._needFireEvents = 0;\n }\n\n /**\n * Immediately attempts a pick, if scheduled.\n */\n update() {\n\n if (!this._configs.pointerEnabled) {\n return;\n }\n\n if (!this.schedulePickEntity && !this.schedulePickSurface) {\n return;\n }\n\n const hash = `${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;\n if (this._lastHash === hash) {\n return;\n }\n\n this.picked = false;\n this.pickedSurface = false;\n this.snappedOrPicked = false;\n this.hoveredSnappedOrSurfaceOff = false;\n\n const hasHoverSurfaceSubs = this._cameraControl.hasSubs(\"hoverSurface\");\n\n if (this.scheduleSnapOrPick) {\n const snapPickResult = this._scene.pick({\n canvasPos: this.pickCursorPos,\n snapRadius: this._configs.snapRadius,\n snapToVertex: this._configs.snapToVertex,\n snapToEdge: this._configs.snapToEdge,\n });\n if (snapPickResult && (snapPickResult.snappedToEdge || snapPickResult.snappedToVertex)) {\n this.snapPickResult = snapPickResult;\n this.snappedOrPicked = true;\n this._needFireEvents++;\n } else {\n this.schedulePickSurface = true; // Fallback\n this.snapPickResult = null;\n }\n }\n\n if (this.schedulePickSurface) {\n if (this.pickResult && this.pickResult.worldPos) {\n const pickResultCanvasPos = this.pickResult.canvasPos;\n if (pickResultCanvasPos[0] === this.pickCursorPos[0] && pickResultCanvasPos[1] === this.pickCursorPos[1]) {\n this.picked = true;\n this.pickedSurface = true;\n this._needFireEvents += hasHoverSurfaceSubs ? 1 : 0;\n this.schedulePickEntity = false;\n this.schedulePickSurface = false;\n if (this.scheduleSnapOrPick) {\n this.snappedOrPicked = true;\n } else {\n this.hoveredSnappedOrSurfaceOff = true;\n }\n this.scheduleSnapOrPick = false;\n return;\n }\n }\n }\n\n if (this.schedulePickEntity) {\n if (this.pickResult && (this.pickResult.canvasPos || this.pickResult.snappedCanvasPos)) {\n const pickResultCanvasPos = this.pickResult.canvasPos || this.pickResult.snappedCanvasPos;\n if (pickResultCanvasPos[0] === this.pickCursorPos[0] && pickResultCanvasPos[1] === this.pickCursorPos[1]) {\n this.picked = true;\n this.pickedSurface = false;\n this.schedulePickEntity = false;\n this.schedulePickSurface = false;\n return;\n }\n }\n }\n\n if (this.schedulePickSurface || (this.scheduleSnapOrPick && !this.snapPickResult)) {\n this.pickResult = this._scene.pick({\n pickSurface: true,\n pickSurfaceNormal: false,\n canvasPos: this.pickCursorPos\n });\n if (this.pickResult) {\n this.picked = true;\n if (this.scheduleSnapOrPick) {\n this.snappedOrPicked = true;\n } else {\n this.pickedSurface = true;\n }\n this._needFireEvents++;\n } else if (this.scheduleSnapOrPick) {\n this.hoveredSnappedOrSurfaceOff = true;\n this._needFireEvents++;\n }\n\n } else { // schedulePickEntity == true\n\n this.pickResult = this._scene.pick({\n canvasPos: this.pickCursorPos\n });\n\n if (this.pickResult) {\n this.picked = true;\n this.pickedSurface = false;\n this._needFireEvents++;\n }\n }\n\n this.scheduleSnapOrPick = false;\n this.schedulePickEntity = false;\n this.schedulePickSurface = false;\n }\n\n fireEvents() {\n\n if (this._needFireEvents === 0) {\n return;\n }\n\n if (this.hoveredSnappedOrSurfaceOff) {\n this._cameraControl.fire(\"hoverSnapOrSurfaceOff\", {\n canvasPos: this.pickCursorPos,\n pointerPos : this.pickCursorPos\n }, true);\n }\n\n if (this.snappedOrPicked) {\n if (this.snapPickResult) {\n const pickResult = new PickResult();\n pickResult.entity = this.snapPickResult.entity;\n pickResult.snappedToVertex = this.snapPickResult.snappedToVertex;\n pickResult.snappedToEdge = this.snapPickResult.snappedToEdge;\n pickResult.worldPos = this.snapPickResult.worldPos;\n pickResult.canvasPos = this.pickCursorPos\n pickResult.snappedCanvasPos = this.snapPickResult.snappedCanvasPos;\n this._cameraControl.fire(\"hoverSnapOrSurface\", pickResult, true);\n this.snapPickResult = null;\n } else {\n this._cameraControl.fire(\"hoverSnapOrSurface\", this.pickResult, true);\n }\n } else {\n\n }\n\n if (this.picked && this.pickResult && (this.pickResult.entity || this.pickResult.worldPos)) {\n\n if (this.pickResult.entity) {\n\n const pickedEntityId = this.pickResult.entity.id;\n\n if (this._lastPickedEntityId !== pickedEntityId) {\n\n if (this._lastPickedEntityId !== undefined) {\n this._cameraControl.fire(\"hoverOut\", {\n entity: this._scene.objects[this._lastPickedEntityId]\n }, true);\n }\n\n this._cameraControl.fire(\"hoverEnter\", this.pickResult, true);\n this._lastPickedEntityId = pickedEntityId;\n }\n }\n\n this._cameraControl.fire(\"hover\", this.pickResult, true);\n\n if (this.pickResult.worldPos) {\n this.pickedSurface = true;\n this._cameraControl.fire(\"hoverSurface\", this.pickResult, true);\n }\n\n } else {\n\n if (this._lastPickedEntityId !== undefined) {\n this._cameraControl.fire(\"hoverOut\", {\n entity: this._scene.objects[this._lastPickedEntityId]\n }, true);\n this._lastPickedEntityId = undefined;\n }\n\n this._cameraControl.fire(\"hoverOff\", {\n canvasPos: this.pickCursorPos\n }, true);\n }\n\n this.pickResult = null;\n\n this._needFireEvents = 0;\n }\n}\n\nexport {PickController};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/controllers/PickController.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/controllers/PickController.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2423, + "__docId__": 2431, "kind": "variable", "name": "DEFAULT_SNAP_PICK_RADIUS", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js", @@ -49296,7 +49512,7 @@ "ignore": true }, { - "__docId__": 2424, + "__docId__": 2432, "kind": "variable", "name": "DEFAULT_SNAP_MODE", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js", @@ -49317,7 +49533,7 @@ "ignore": true }, { - "__docId__": 2425, + "__docId__": 2433, "kind": "class", "name": "PickController", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js", @@ -49333,7 +49549,7 @@ "ignore": true }, { - "__docId__": 2426, + "__docId__": 2434, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49347,7 +49563,7 @@ "undocument": true }, { - "__docId__": 2427, + "__docId__": 2435, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49367,7 +49583,7 @@ "ignore": true }, { - "__docId__": 2428, + "__docId__": 2436, "kind": "member", "name": "_cameraControl", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49385,7 +49601,7 @@ } }, { - "__docId__": 2429, + "__docId__": 2437, "kind": "member", "name": "_configs", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49403,7 +49619,7 @@ } }, { - "__docId__": 2430, + "__docId__": 2438, "kind": "member", "name": "schedulePickEntity", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49422,7 +49638,7 @@ } }, { - "__docId__": 2431, + "__docId__": 2439, "kind": "member", "name": "schedulePickSurface", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49441,7 +49657,7 @@ } }, { - "__docId__": 2432, + "__docId__": 2440, "kind": "member", "name": "scheduleSnapOrPick", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49460,7 +49676,7 @@ } }, { - "__docId__": 2433, + "__docId__": 2441, "kind": "member", "name": "pickCursorPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49479,7 +49695,7 @@ } }, { - "__docId__": 2434, + "__docId__": 2442, "kind": "member", "name": "picked", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49498,7 +49714,7 @@ } }, { - "__docId__": 2435, + "__docId__": 2443, "kind": "member", "name": "pickedSurface", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49517,7 +49733,7 @@ } }, { - "__docId__": 2436, + "__docId__": 2444, "kind": "member", "name": "pickResult", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49536,7 +49752,7 @@ } }, { - "__docId__": 2437, + "__docId__": 2445, "kind": "member", "name": "_lastPickedEntityId", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49554,7 +49770,7 @@ } }, { - "__docId__": 2438, + "__docId__": 2446, "kind": "member", "name": "_lastHash", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49572,7 +49788,7 @@ } }, { - "__docId__": 2439, + "__docId__": 2447, "kind": "member", "name": "_needFireEvents", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49590,7 +49806,7 @@ } }, { - "__docId__": 2440, + "__docId__": 2448, "kind": "method", "name": "update", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49605,7 +49821,7 @@ "return": null }, { - "__docId__": 2443, + "__docId__": 2451, "kind": "member", "name": "snappedOrPicked", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49622,7 +49838,7 @@ } }, { - "__docId__": 2444, + "__docId__": 2452, "kind": "member", "name": "hoveredSnappedOrSurfaceOff", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49639,7 +49855,7 @@ } }, { - "__docId__": 2445, + "__docId__": 2453, "kind": "member", "name": "snapPickResult", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49656,7 +49872,7 @@ } }, { - "__docId__": 2472, + "__docId__": 2480, "kind": "method", "name": "fireEvents", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PickController.js~PickController", @@ -49672,18 +49888,18 @@ "return": null }, { - "__docId__": 2479, + "__docId__": 2487, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", "content": "import { math } from \"../../../math/math.js\";\nimport { PhongMaterial } from \"../../../materials/PhongMaterial.js\";\nimport { Mesh } from \"../../../mesh/Mesh.js\";\nimport { VBOGeometry } from \"../../../geometry/VBOGeometry.js\";\nimport { buildSphereGeometry } from \"../../../geometry/builders/buildSphereGeometry.js\";\nimport { worldToRTCPos } from \"../../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\nconst tempVec4c = math.vec4();\n\n\n/** @private */\nclass PivotController {\n\n /**\n * @private\n */\n constructor(scene, configs) {\n\n // Pivot math by: http://www.derschmale.com/\n\n this._scene = scene;\n this._configs = configs;\n this._pivotWorldPos = math.vec3();\n this._cameraOffset = math.vec3();\n this._azimuth = 0;\n this._polar = 0;\n this._radius = 0;\n this._pivotPosSet = false; // Initially false, true as soon as _pivotWorldPos has been set to some value\n this._pivoting = false; // True while pivoting\n this._shown = false;\n\n this._pivotSphereEnabled = false;\n this._pivotSphere = null;\n this._pivotSphereSize = 1;\n this._pivotSphereGeometry = null;\n this._pivotSphereMaterial = null;\n this._rtcCenter = math.vec3();\n this._rtcPos = math.vec3();\n\n this._pivotViewPos = math.vec4();\n this._pivotProjPos = math.vec4();\n this._pivotCanvasPos = math.vec2();\n this._cameraDirty = true;\n\n this._onViewMatrix = this._scene.camera.on(\"viewMatrix\", () => {\n this._cameraDirty = true;\n });\n\n this._onProjMatrix = this._scene.camera.on(\"projMatrix\", () => {\n this._cameraDirty = true;\n });\n\n this._onTick = this._scene.on(\"tick\", () => {\n this.updatePivotElement();\n this.updatePivotSphere();\n });\n }\n\n createPivotSphere() {\n const currentPos = this.getPivotPos();\n const cameraPos = math.vec3();\n math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix, math.mat4()), cameraPos, math.vec4(), math.vec3());\n const length = math.distVec3(cameraPos, currentPos);\n let radius = (Math.tan(Math.PI / 500) * length) * this._pivotSphereSize;\n\n if (this._scene.camera.projection == \"ortho\") {\n radius /= (this._scene.camera.ortho.scale / 2);\n }\n\n worldToRTCPos(currentPos, this._rtcCenter, this._rtcPos);\n this._pivotSphereGeometry = new VBOGeometry(\n this._scene,\n buildSphereGeometry({ radius })\n );\n this._pivotSphere = new Mesh(this._scene, {\n geometry: this._pivotSphereGeometry,\n material: this._pivotSphereMaterial,\n pickable: false,\n position: this._rtcPos,\n rtcCenter: this._rtcCenter\n });\n };\n\n destroyPivotSphere() {\n if (this._pivotSphere) {\n this._pivotSphere.destroy();\n this._pivotSphere = null;\n }\n if (this._pivotSphereGeometry) {\n this._pivotSphereGeometry.destroy();\n this._pivotSphereGeometry = null;\n }\n }\n\n updatePivotElement() {\n\n const camera = this._scene.camera;\n const canvas = this._scene.canvas;\n\n if (this._pivoting && this._cameraDirty) {\n\n math.transformPoint3(camera.viewMatrix, this.getPivotPos(), this._pivotViewPos);\n this._pivotViewPos[3] = 1;\n math.transformPoint4(camera.projMatrix, this._pivotViewPos, this._pivotProjPos);\n\n const canvasAABB = canvas.boundary;\n const canvasWidth = canvasAABB[2];\n const canvasHeight = canvasAABB[3];\n\n this._pivotCanvasPos[0] = Math.floor((1 + this._pivotProjPos[0] / this._pivotProjPos[3]) * canvasWidth / 2);\n this._pivotCanvasPos[1] = Math.floor((1 - this._pivotProjPos[1] / this._pivotProjPos[3]) * canvasHeight / 2);\n\n // data-textures: avoid to do continuous DOM layout calculations \n let canvasBoundingRect = canvas._lastBoundingClientRect;\n\n if (!canvasBoundingRect || canvas._canvasSizeChanged)\n {\n const canvasElem = canvas.canvas;\n\n canvasBoundingRect = canvas._lastBoundingClientRect = canvasElem.getBoundingClientRect ();\n }\n\n if (this._pivotElement) {\n this._pivotElement.style.left = (Math.floor(canvasBoundingRect.left + this._pivotCanvasPos[0]) - (this._pivotElement.clientWidth / 2) + window.scrollX) + \"px\";\n this._pivotElement.style.top = (Math.floor(canvasBoundingRect.top + this._pivotCanvasPos[1]) - (this._pivotElement.clientHeight / 2) + window.scrollY) + \"px\";\n }\n this._cameraDirty = false;\n }\n }\n\n updatePivotSphere() {\n if (this._pivoting && this._pivotSphere) {\n worldToRTCPos(this.getPivotPos(), this._rtcCenter, this._rtcPos);\n if(!math.compareVec3(this._rtcPos, this._pivotSphere.position)) {\n this.destroyPivotSphere();\n this.createPivotSphere();\n }\n }\n }\n /**\n * Sets the HTML DOM element that will represent the pivot position.\n *\n * @param pivotElement\n */\n setPivotElement(pivotElement) {\n this._pivotElement = pivotElement;\n }\n\n /**\n * Sets a sphere as the representation of the pivot position.\n *\n * @param {Object} [cfg] Sphere configuration.\n * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.\n * @param {String} [cfg.color=Array] Optional maretial color. Defaults to a red.\n */\n enablePivotSphere(cfg = {}) {\n this.destroyPivotSphere();\n this._pivotSphereEnabled = true;\n if (cfg.size) {\n this._pivotSphereSize = cfg.size;\n }\n const color = cfg.color || [1, 0, 0];\n this._pivotSphereMaterial = new PhongMaterial(this._scene, {\n emissive: color,\n ambient: color,\n specular: [0,0,0],\n diffuse: [0,0,0],\n });\n }\n\n /**\n * Remove the sphere as the representation of the pivot position.\n *\n */\n disablePivotSphere() {\n this.destroyPivotSphere();\n this._pivotSphereEnabled = false;\n }\n\n /**\n * Begins pivoting.\n */\n startPivot() {\n\n if (this._cameraLookingDownwards()) {\n this._pivoting = false;\n return false;\n }\n\n const camera = this._scene.camera;\n\n let lookat = math.lookAtMat4v(camera.eye, camera.look, camera.worldUp);\n math.transformPoint3(lookat, this.getPivotPos(), this._cameraOffset);\n\n const pivotPos = this.getPivotPos();\n this._cameraOffset[2] += math.distVec3(camera.eye, pivotPos);\n\n lookat = math.inverseMat4(lookat);\n\n const offset = math.transformVec3(lookat, this._cameraOffset);\n const diff = math.vec3();\n\n math.subVec3(camera.eye, pivotPos, diff);\n math.addVec3(diff, offset);\n\n if (camera.zUp) {\n const t = diff[1];\n diff[1] = diff[2];\n diff[2] = t;\n }\n\n this._radius = math.lenVec3(diff);\n this._polar = Math.acos(diff[1] / this._radius);\n this._azimuth = Math.atan2(diff[0], diff[2]);\n this._pivoting = true;\n }\n\n _cameraLookingDownwards() { // Returns true if angle between camera viewing direction and World-space \"up\" axis is too small\n const camera = this._scene.camera;\n const forwardAxis = math.normalizeVec3(math.subVec3(camera.look, camera.eye, tempVec3a));\n const rightAxis = math.cross3Vec3(forwardAxis, camera.worldUp, tempVec3b);\n let rightAxisLen = math.sqLenVec3(rightAxis);\n return (rightAxisLen <= 0.0001);\n }\n\n /**\n * Returns true if we are currently pivoting.\n *\n * @returns {Boolean}\n */\n getPivoting() {\n return this._pivoting;\n }\n\n /**\n * Sets a 3D World-space position to pivot about.\n *\n * @param {Number[]} worldPos The new World-space pivot position.\n */\n setPivotPos(worldPos) {\n this._pivotWorldPos.set(worldPos);\n this._pivotPosSet = true;\n }\n\n /**\n * Sets the pivot position to the 3D projection of the given 2D canvas coordinates on a sphere centered\n * at the viewpoint. The radius of the sphere is configured via {@link CameraControl#smartPivot}.\n *\n *\n * @param canvasPos\n */\n setCanvasPivotPos(canvasPos) {\n const camera = this._scene.camera;\n const pivotShereRadius = Math.abs(math.distVec3(this._scene.center, camera.eye));\n const transposedProjectMat = camera.project.transposedMatrix;\n const Pt3 = transposedProjectMat.subarray(8, 12);\n const Pt4 = transposedProjectMat.subarray(12);\n const D = [0, 0, -1.0, 1];\n const screenZ = math.dotVec4(D, Pt3) / math.dotVec4(D, Pt4);\n const worldPos = tempVec4a;\n camera.project.unproject(canvasPos, screenZ, tempVec4b, tempVec4c, worldPos);\n const eyeWorldPosVec = math.normalizeVec3(math.subVec3(worldPos, camera.eye, tempVec3a));\n const posOnSphere = math.addVec3(camera.eye, math.mulVec3Scalar(eyeWorldPosVec, pivotShereRadius, tempVec3b), tempVec3c);\n this.setPivotPos(posOnSphere);\n }\n\n /**\n * Gets the current position we're pivoting about.\n * @returns {Number[]} The current World-space pivot position.\n */\n getPivotPos() {\n return (this._pivotPosSet) ? this._pivotWorldPos : this._scene.camera.look; // Avoid pivoting about [0,0,0] by default\n }\n\n /**\n * Continues to pivot.\n *\n * @param {Number} yawInc Yaw rotation increment.\n * @param {Number} pitchInc Pitch rotation increment.\n */\n continuePivot(yawInc, pitchInc) {\n if (!this._pivoting) {\n return;\n }\n if (yawInc === 0 && pitchInc === 0) {\n return;\n }\n const camera = this._scene.camera;\n var dx = -yawInc;\n const dy = -pitchInc;\n if (camera.worldUp[2] === 1) {\n dx = -dx;\n }\n this._azimuth += -dx * .01;\n this._polar += dy * .01;\n this._polar = math.clamp(this._polar, .001, Math.PI - .001);\n const pos = [\n this._radius * Math.sin(this._polar) * Math.sin(this._azimuth),\n this._radius * Math.cos(this._polar),\n this._radius * Math.sin(this._polar) * Math.cos(this._azimuth)\n ];\n if (camera.worldUp[2] === 1) {\n const t = pos[1];\n pos[1] = pos[2];\n pos[2] = t;\n }\n // Preserve the eye->look distance, since in xeokit \"look\" is the point-of-interest, not the direction vector.\n const eyeLookLen = math.lenVec3(math.subVec3(camera.look, camera.eye, math.vec3()));\n const pivotPos = this.getPivotPos();\n math.addVec3(pos, pivotPos);\n let lookat = math.lookAtMat4v(pos, pivotPos, camera.worldUp);\n lookat = math.inverseMat4(lookat);\n const offset = math.transformVec3(lookat, this._cameraOffset);\n lookat[12] -= offset[0];\n lookat[13] -= offset[1];\n lookat[14] -= offset[2];\n const zAxis = [lookat[8], lookat[9], lookat[10]];\n camera.eye = [lookat[12], lookat[13], lookat[14]];\n math.subVec3(camera.eye, math.mulVec3Scalar(zAxis, eyeLookLen), camera.look);\n camera.up = [lookat[4], lookat[5], lookat[6]];\n this.showPivot();\n }\n\n /**\n * Shows the pivot position.\n *\n * Only works if we set an HTML DOM element to represent the pivot position.\n */\n showPivot() {\n if (this._shown) {\n return;\n }\n if (this._pivotElement) {\n this.updatePivotElement();\n this._pivotElement.style.visibility = \"visible\";\n }\n if (this._pivotSphereEnabled) {\n this.destroyPivotSphere();\n this.createPivotSphere();\n }\n this._shown = true;\n }\n\n /**\n * Hides the pivot position.\n *\n * Only works if we set an HTML DOM element to represent the pivot position.\n */\n hidePivot() {\n if (!this._shown) {\n return;\n }\n if (this._pivotElement) {\n this._pivotElement.style.visibility = \"hidden\";\n }\n if (this._pivotSphereEnabled) {\n this.destroyPivotSphere();\n }\n this._shown = false;\n }\n\n /**\n * Finishes pivoting.\n */\n endPivot() {\n this._pivoting = false;\n }\n\n destroy() {\n this.destroyPivotSphere();\n this._scene.camera.off(this._onViewMatrix);\n this._scene.camera.off(this._onProjMatrix);\n this._scene.off(this._onTick);\n }\n}\n\n\nexport {PivotController};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/controllers/PivotController.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/controllers/PivotController.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2480, + "__docId__": 2488, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49704,7 +49920,7 @@ "ignore": true }, { - "__docId__": 2481, + "__docId__": 2489, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49725,7 +49941,7 @@ "ignore": true }, { - "__docId__": 2482, + "__docId__": 2490, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49746,7 +49962,7 @@ "ignore": true }, { - "__docId__": 2483, + "__docId__": 2491, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49767,7 +49983,7 @@ "ignore": true }, { - "__docId__": 2484, + "__docId__": 2492, "kind": "variable", "name": "tempVec4b", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49788,7 +50004,7 @@ "ignore": true }, { - "__docId__": 2485, + "__docId__": 2493, "kind": "variable", "name": "tempVec4c", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49809,7 +50025,7 @@ "ignore": true }, { - "__docId__": 2486, + "__docId__": 2494, "kind": "class", "name": "PivotController", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js", @@ -49825,7 +50041,7 @@ "ignore": true }, { - "__docId__": 2487, + "__docId__": 2495, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49839,7 +50055,7 @@ "ignore": true }, { - "__docId__": 2488, + "__docId__": 2496, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49857,7 +50073,7 @@ } }, { - "__docId__": 2489, + "__docId__": 2497, "kind": "member", "name": "_configs", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49875,7 +50091,7 @@ } }, { - "__docId__": 2490, + "__docId__": 2498, "kind": "member", "name": "_pivotWorldPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49893,7 +50109,7 @@ } }, { - "__docId__": 2491, + "__docId__": 2499, "kind": "member", "name": "_cameraOffset", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49911,7 +50127,7 @@ } }, { - "__docId__": 2492, + "__docId__": 2500, "kind": "member", "name": "_azimuth", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49929,7 +50145,7 @@ } }, { - "__docId__": 2493, + "__docId__": 2501, "kind": "member", "name": "_polar", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49947,7 +50163,7 @@ } }, { - "__docId__": 2494, + "__docId__": 2502, "kind": "member", "name": "_radius", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49965,7 +50181,7 @@ } }, { - "__docId__": 2495, + "__docId__": 2503, "kind": "member", "name": "_pivotPosSet", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -49983,7 +50199,7 @@ } }, { - "__docId__": 2496, + "__docId__": 2504, "kind": "member", "name": "_pivoting", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50001,7 +50217,7 @@ } }, { - "__docId__": 2497, + "__docId__": 2505, "kind": "member", "name": "_shown", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50019,7 +50235,7 @@ } }, { - "__docId__": 2498, + "__docId__": 2506, "kind": "member", "name": "_pivotSphereEnabled", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50037,7 +50253,7 @@ } }, { - "__docId__": 2499, + "__docId__": 2507, "kind": "member", "name": "_pivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50055,7 +50271,7 @@ } }, { - "__docId__": 2500, + "__docId__": 2508, "kind": "member", "name": "_pivotSphereSize", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50073,7 +50289,7 @@ } }, { - "__docId__": 2501, + "__docId__": 2509, "kind": "member", "name": "_pivotSphereGeometry", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50091,7 +50307,7 @@ } }, { - "__docId__": 2502, + "__docId__": 2510, "kind": "member", "name": "_pivotSphereMaterial", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50109,7 +50325,7 @@ } }, { - "__docId__": 2503, + "__docId__": 2511, "kind": "member", "name": "_rtcCenter", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50127,7 +50343,7 @@ } }, { - "__docId__": 2504, + "__docId__": 2512, "kind": "member", "name": "_rtcPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50145,7 +50361,7 @@ } }, { - "__docId__": 2505, + "__docId__": 2513, "kind": "member", "name": "_pivotViewPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50163,7 +50379,7 @@ } }, { - "__docId__": 2506, + "__docId__": 2514, "kind": "member", "name": "_pivotProjPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50181,7 +50397,7 @@ } }, { - "__docId__": 2507, + "__docId__": 2515, "kind": "member", "name": "_pivotCanvasPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50199,7 +50415,7 @@ } }, { - "__docId__": 2508, + "__docId__": 2516, "kind": "member", "name": "_cameraDirty", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50217,7 +50433,7 @@ } }, { - "__docId__": 2509, + "__docId__": 2517, "kind": "member", "name": "_onViewMatrix", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50235,7 +50451,7 @@ } }, { - "__docId__": 2511, + "__docId__": 2519, "kind": "member", "name": "_onProjMatrix", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50253,7 +50469,7 @@ } }, { - "__docId__": 2513, + "__docId__": 2521, "kind": "member", "name": "_onTick", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50271,7 +50487,7 @@ } }, { - "__docId__": 2514, + "__docId__": 2522, "kind": "method", "name": "createPivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50287,7 +50503,7 @@ "return": null }, { - "__docId__": 2517, + "__docId__": 2525, "kind": "method", "name": "destroyPivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50303,7 +50519,7 @@ "return": null }, { - "__docId__": 2520, + "__docId__": 2528, "kind": "method", "name": "updatePivotElement", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50319,7 +50535,7 @@ "return": null }, { - "__docId__": 2522, + "__docId__": 2530, "kind": "method", "name": "updatePivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50335,7 +50551,7 @@ "return": null }, { - "__docId__": 2523, + "__docId__": 2531, "kind": "method", "name": "setPivotElement", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50361,7 +50577,7 @@ "return": null }, { - "__docId__": 2524, + "__docId__": 2532, "kind": "member", "name": "_pivotElement", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50379,7 +50595,7 @@ } }, { - "__docId__": 2525, + "__docId__": 2533, "kind": "method", "name": "enablePivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50429,7 +50645,7 @@ "return": null }, { - "__docId__": 2529, + "__docId__": 2537, "kind": "method", "name": "disablePivotSphere", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50444,7 +50660,7 @@ "return": null }, { - "__docId__": 2531, + "__docId__": 2539, "kind": "method", "name": "startPivot", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50463,7 +50679,7 @@ } }, { - "__docId__": 2537, + "__docId__": 2545, "kind": "method", "name": "_cameraLookingDownwards", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50484,7 +50700,7 @@ } }, { - "__docId__": 2538, + "__docId__": 2546, "kind": "method", "name": "getPivoting", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50512,7 +50728,7 @@ "params": [] }, { - "__docId__": 2539, + "__docId__": 2547, "kind": "method", "name": "setPivotPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50538,7 +50754,7 @@ "return": null }, { - "__docId__": 2541, + "__docId__": 2549, "kind": "method", "name": "setCanvasPivotPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50564,7 +50780,7 @@ "return": null }, { - "__docId__": 2542, + "__docId__": 2550, "kind": "method", "name": "getPivotPos", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50592,7 +50808,7 @@ "params": [] }, { - "__docId__": 2543, + "__docId__": 2551, "kind": "method", "name": "continuePivot", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50628,7 +50844,7 @@ "return": null }, { - "__docId__": 2547, + "__docId__": 2555, "kind": "method", "name": "showPivot", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50643,7 +50859,7 @@ "return": null }, { - "__docId__": 2549, + "__docId__": 2557, "kind": "method", "name": "hidePivot", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50658,7 +50874,7 @@ "return": null }, { - "__docId__": 2551, + "__docId__": 2559, "kind": "method", "name": "endPivot", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50673,7 +50889,7 @@ "return": null }, { - "__docId__": 2553, + "__docId__": 2561, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/controllers/PivotController.js~PivotController", @@ -50689,18 +50905,18 @@ "return": null }, { - "__docId__": 2554, + "__docId__": 2562, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", "content": "import {math} from \"../../../math/math.js\";\n\nconst center = math.vec3();\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\n\nconst tempCameraTarget = {\n eye: math.vec3(),\n look: math.vec3(),\n up: math.vec3()\n};\n\n/**\n * @private\n */\nclass KeyboardAxisViewHandler {\n\n constructor(scene, controllers, configs, states) {\n\n this._scene = scene;\n const cameraControl = controllers.cameraControl;\n const camera = scene.camera;\n\n this._onSceneKeyDown = scene.input.on(\"keydown\", () => {\n\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n\n if (!states.mouseover) {\n return;\n }\n\n const axisViewRight = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);\n const axisViewBack = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);\n const axisViewLeft = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);\n const axisViewFront = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);\n const axisViewTop = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);\n const axisViewBottom = cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);\n\n if ((!axisViewRight) && (!axisViewBack) && (!axisViewLeft) && (!axisViewFront) && (!axisViewTop) && (!axisViewBottom)) {\n return;\n }\n\n const aabb = scene.aabb;\n const diag = math.getAABB3Diag(aabb);\n\n math.getAABB3Center(aabb, center);\n\n const perspectiveDist = Math.abs(diag / Math.tan(controllers.cameraFlight.fitFOV * math.DEGTORAD));\n const orthoScale = diag * 1.1;\n\n tempCameraTarget.orthoScale = orthoScale;\n\n if (axisViewRight) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldRight, perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(camera.worldUp);\n\n } else if (axisViewBack) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldForward, perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(camera.worldUp);\n\n } else if (axisViewLeft) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldRight, -perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(camera.worldUp);\n\n } else if (axisViewFront) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldForward, -perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(camera.worldUp);\n\n } else if (axisViewTop) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldUp, perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward, 1, tempVec3b), tempVec3c));\n\n } else if (axisViewBottom) {\n\n tempCameraTarget.eye.set(math.addVec3(center, math.mulVec3Scalar(camera.worldUp, -perspectiveDist, tempVec3a), tempVec3d));\n tempCameraTarget.look.set(center);\n tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward, -1, tempVec3b)));\n }\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.setPivotPos(center);\n }\n\n if (controllers.cameraFlight.duration > 0) {\n controllers.cameraFlight.flyTo(tempCameraTarget, () => {\n if (controllers.pivotController.getPivoting() && configs.followPointer) {\n controllers.pivotController.showPivot();\n }\n });\n\n } else {\n controllers.cameraFlight.jumpTo(tempCameraTarget);\n if (controllers.pivotController.getPivoting() && configs.followPointer) {\n controllers.pivotController.showPivot();\n }\n }\n });\n }\n\n reset() {\n }\n\n destroy() {\n this._scene.input.off(this._onSceneKeyDown);\n }\n}\n\nexport {KeyboardAxisViewHandler};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2555, + "__docId__": 2563, "kind": "variable", "name": "center", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50721,7 +50937,7 @@ "ignore": true }, { - "__docId__": 2556, + "__docId__": 2564, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50742,7 +50958,7 @@ "ignore": true }, { - "__docId__": 2557, + "__docId__": 2565, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50763,7 +50979,7 @@ "ignore": true }, { - "__docId__": 2558, + "__docId__": 2566, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50784,7 +51000,7 @@ "ignore": true }, { - "__docId__": 2559, + "__docId__": 2567, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50805,7 +51021,7 @@ "ignore": true }, { - "__docId__": 2560, + "__docId__": 2568, "kind": "variable", "name": "tempCameraTarget", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50826,7 +51042,7 @@ "ignore": true }, { - "__docId__": 2561, + "__docId__": 2569, "kind": "class", "name": "KeyboardAxisViewHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js", @@ -50842,7 +51058,7 @@ "ignore": true }, { - "__docId__": 2562, + "__docId__": 2570, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js~KeyboardAxisViewHandler", @@ -50856,7 +51072,7 @@ "undocument": true }, { - "__docId__": 2563, + "__docId__": 2571, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js~KeyboardAxisViewHandler", @@ -50874,7 +51090,7 @@ } }, { - "__docId__": 2564, + "__docId__": 2572, "kind": "member", "name": "_onSceneKeyDown", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js~KeyboardAxisViewHandler", @@ -50892,7 +51108,7 @@ } }, { - "__docId__": 2565, + "__docId__": 2573, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js~KeyboardAxisViewHandler", @@ -50908,7 +51124,7 @@ "return": null }, { - "__docId__": 2566, + "__docId__": 2574, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js~KeyboardAxisViewHandler", @@ -50924,18 +51140,18 @@ "return": null }, { - "__docId__": 2567, + "__docId__": 2575, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js", "content": "/**\n * @private\n */\nclass KeyboardPanRotateDollyHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n const input = scene.input;\n\n const keyDownMap = [];\n\n const canvas = scene.canvas.canvas;\n\n let mouseMovedSinceLastKeyboardDolly = true;\n\n this._onSceneMouseMove = input.on(\"mousemove\", () => {\n mouseMovedSinceLastKeyboardDolly = true;\n });\n\n this._onSceneKeyDown = input.on(\"keydown\", (keyCode) => {\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n if (!states.mouseover) {\n return;\n }\n keyDownMap[keyCode] = true;\n\n if (keyCode === input.KEY_SHIFT) {\n canvas.style.cursor = \"move\";\n }\n });\n\n this._onSceneKeyUp = input.on(\"keyup\", (keyCode) => {\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n keyDownMap[keyCode] = false;\n\n if (keyCode === input.KEY_SHIFT) {\n canvas.style.cursor = null;\n }\n\n if (controllers.pivotController.getPivoting()) {\n controllers.pivotController.endPivot()\n }\n });\n\n this._onTick = scene.on(\"tick\", (e) => {\n\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n\n if (!states.mouseover) {\n return;\n }\n\n const cameraControl = controllers.cameraControl;\n const elapsedSecs = (e.deltaTime / 1000.0);\n\n //-------------------------------------------------------------------------------------------------\n // Keyboard rotation\n //-------------------------------------------------------------------------------------------------\n\n if (!configs.planView) {\n\n const rotateYPos = cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS, keyDownMap);\n const rotateYNeg = cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG, keyDownMap);\n const rotateXPos = cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS, keyDownMap);\n const rotateXNeg = cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG, keyDownMap);\n\n const orbitDelta = elapsedSecs * configs.keyboardRotationRate;\n\n if (rotateYPos || rotateYNeg || rotateXPos || rotateXNeg) {\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.startPivot();\n }\n\n if (rotateYPos) {\n updates.rotateDeltaY += orbitDelta;\n\n } else if (rotateYNeg) {\n updates.rotateDeltaY -= orbitDelta;\n }\n\n if (rotateXPos) {\n updates.rotateDeltaX += orbitDelta;\n\n } else if (rotateXNeg) {\n updates.rotateDeltaX -= orbitDelta;\n }\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.startPivot();\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------\n // Keyboard panning\n //-------------------------------------------------------------------------------------------------\n\n if (!keyDownMap[input.KEY_CTRL] && !keyDownMap[input.KEY_ALT]) {\n\n const dollyBackwards = cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS, keyDownMap);\n const dollyForwards = cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS, keyDownMap);\n\n if (dollyBackwards || dollyForwards) {\n\n const dollyDelta = elapsedSecs * configs.keyboardDollyRate;\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.startPivot();\n }\n if (dollyForwards) {\n updates.dollyDelta -= dollyDelta;\n } else if (dollyBackwards) {\n updates.dollyDelta += dollyDelta;\n }\n\n if (mouseMovedSinceLastKeyboardDolly) {\n states.followPointerDirty = true;\n mouseMovedSinceLastKeyboardDolly = false;\n }\n }\n }\n\n const panForwards = cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS, keyDownMap);\n const panBackwards = cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS, keyDownMap);\n const panLeft = cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT, keyDownMap);\n const panRight = cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT, keyDownMap);\n const panUp = cameraControl._isKeyDownForAction(cameraControl.PAN_UP, keyDownMap);\n const panDown = cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN, keyDownMap);\n\n const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate\n\n if (panForwards || panBackwards || panLeft || panRight || panUp || panDown) {\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.startPivot();\n }\n\n if (panDown) {\n updates.panDeltaY += panDelta;\n\n } else if (panUp) {\n updates.panDeltaY += -panDelta;\n }\n\n if (panRight) {\n updates.panDeltaX += -panDelta;\n\n } else if (panLeft) {\n updates.panDeltaX += panDelta;\n }\n\n if (panBackwards) {\n updates.panDeltaZ += panDelta;\n\n } else if (panForwards) {\n updates.panDeltaZ += -panDelta;\n }\n }\n });\n }\n\n reset() {\n }\n\n destroy() {\n\n this._scene.off(this._onTick);\n\n this._scene.input.off(this._onSceneMouseMove);\n this._scene.input.off(this._onSceneKeyDown);\n this._scene.input.off(this._onSceneKeyUp);\n }\n}\n\nexport {KeyboardPanRotateDollyHandler};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2568, + "__docId__": 2576, "kind": "class", "name": "KeyboardPanRotateDollyHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js", @@ -50951,7 +51167,7 @@ "ignore": true }, { - "__docId__": 2569, + "__docId__": 2577, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -50965,7 +51181,7 @@ "undocument": true }, { - "__docId__": 2570, + "__docId__": 2578, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -50983,7 +51199,7 @@ } }, { - "__docId__": 2571, + "__docId__": 2579, "kind": "member", "name": "_onSceneMouseMove", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51001,7 +51217,7 @@ } }, { - "__docId__": 2572, + "__docId__": 2580, "kind": "member", "name": "_onSceneKeyDown", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51019,7 +51235,7 @@ } }, { - "__docId__": 2573, + "__docId__": 2581, "kind": "member", "name": "_onSceneKeyUp", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51037,7 +51253,7 @@ } }, { - "__docId__": 2574, + "__docId__": 2582, "kind": "member", "name": "_onTick", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51055,7 +51271,7 @@ } }, { - "__docId__": 2575, + "__docId__": 2583, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51071,7 +51287,7 @@ "return": null }, { - "__docId__": 2576, + "__docId__": 2584, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js~KeyboardPanRotateDollyHandler", @@ -51087,18 +51303,18 @@ "return": null }, { - "__docId__": 2577, + "__docId__": 2585, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js", - "content": "/**\n * @private\n */\nclass MouseMiscHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const canvas = this._scene.canvas.canvas;\n\n canvas.addEventListener(\"mouseenter\", this._mouseEnterHandler = () => {\n states.mouseover = true;\n });\n\n canvas.addEventListener(\"mouseleave\", this._mouseLeaveHandler = () => {\n states.mouseover = false;\n canvas.style.cursor = null;\n });\n\n document.addEventListener(\"mousemove\", this._mouseMoveHandler = (e) => {\n getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos);\n });\n\n canvas.addEventListener(\"mousedown\", this._mouseDownHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos);\n states.mouseover = true;\n });\n\n canvas.addEventListener(\"mouseup\", this._mouseUpHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n });\n }\n\n reset() {\n }\n\n destroy() {\n\n const canvas = this._scene.canvas.canvas;\n\n document.removeEventListener(\"mousemove\", this._mouseMoveHandler);\n canvas.removeEventListener(\"mouseenter\", this._mouseEnterHandler);\n canvas.removeEventListener(\"mouseleave\", this._mouseLeaveHandler);\n canvas.removeEventListener(\"mousedown\", this._mouseDownHandler);\n canvas.removeEventListener(\"mouseup\", this._mouseUpHandler);\n }\n}\n\nfunction getCanvasPosFromEvent(event, canvas, canvasPos) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n const { left, top } = canvas.getBoundingClientRect();\n canvasPos[0] = event.clientX - left - window.scrollX;\n canvasPos[1] = event.clientY - top - window.scrollY;\n }\n return canvasPos;\n}\n\nexport {MouseMiscHandler};\n", + "content": "/**\n * @private\n */\nclass MouseMiscHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const canvas = this._scene.canvas.canvas;\n\n canvas.addEventListener(\"mouseenter\", this._mouseEnterHandler = () => {\n states.mouseover = true;\n });\n\n canvas.addEventListener(\"mouseleave\", this._mouseLeaveHandler = () => {\n states.mouseover = false;\n canvas.style.cursor = null;\n });\n\n document.addEventListener(\"mousemove\", this._mouseMoveHandler = (e) => {\n getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos);\n });\n\n canvas.addEventListener(\"mousedown\", this._mouseDownHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n getCanvasPosFromEvent(e, canvas, states.pointerCanvasPos);\n states.mouseover = true;\n });\n\n canvas.addEventListener(\"mouseup\", this._mouseUpHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n });\n }\n\n reset() {\n }\n\n destroy() {\n\n const canvas = this._scene.canvas.canvas;\n\n document.removeEventListener(\"mousemove\", this._mouseMoveHandler);\n canvas.removeEventListener(\"mouseenter\", this._mouseEnterHandler);\n canvas.removeEventListener(\"mouseleave\", this._mouseLeaveHandler);\n canvas.removeEventListener(\"mousedown\", this._mouseDownHandler);\n canvas.removeEventListener(\"mouseup\", this._mouseUpHandler);\n }\n}\n\nfunction getCanvasPosFromEvent(event, canvas, canvasPos) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n const { left, top } = canvas.getBoundingClientRect();\n canvasPos[0] = event.clientX - left;\n canvasPos[1] = event.clientY - top;\n }\n return canvasPos;\n}\n\nexport {MouseMiscHandler};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2578, + "__docId__": 2586, "kind": "function", "name": "getCanvasPosFromEvent", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js", @@ -51141,7 +51357,7 @@ "ignore": true }, { - "__docId__": 2579, + "__docId__": 2587, "kind": "class", "name": "MouseMiscHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js", @@ -51157,7 +51373,7 @@ "ignore": true }, { - "__docId__": 2580, + "__docId__": 2588, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js~MouseMiscHandler", @@ -51171,7 +51387,7 @@ "undocument": true }, { - "__docId__": 2581, + "__docId__": 2589, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js~MouseMiscHandler", @@ -51189,7 +51405,7 @@ } }, { - "__docId__": 2582, + "__docId__": 2590, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js~MouseMiscHandler", @@ -51205,7 +51421,7 @@ "return": null }, { - "__docId__": 2583, + "__docId__": 2591, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js~MouseMiscHandler", @@ -51221,18 +51437,18 @@ "return": null }, { - "__docId__": 2584, + "__docId__": 2592, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", "content": "/**\n * @private\n */\nimport {math} from \"../../../math/math.js\";\n\nconst canvasPos = math.vec2();\n\nconst getCanvasPosFromEvent = function (event, canvasPos) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n let element = event.target;\n let totalOffsetLeft = 0;\n let totalOffsetTop = 0;\n let totalScrollX = 0;\n let totalScrollY = 0;\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n totalScrollX += element.scrollLeft;\n totalScrollY += element.scrollTop;\n element = element.offsetParent;\n }\n canvasPos[0] = event.pageX + totalScrollX - totalOffsetLeft;\n canvasPos[1] = event.pageY + totalScrollY - totalOffsetTop;\n }\n return canvasPos;\n};\n\n/**\n * @private\n */\nclass MousePanRotateDollyHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const pickController = controllers.pickController;\n\n let lastX = 0;\n let lastY = 0;\n let lastXDown = 0;\n let lastYDown = 0;\n let xRotateDelta = 0;\n let yRotateDelta = 0;\n\n let mouseDownLeft;\n let mouseDownMiddle;\n let mouseDownRight;\n\n let mouseDownPicked = false;\n const pickedWorldPos = math.vec3();\n\n let mouseMovedOnCanvasSinceLastWheel = true;\n\n const canvas = this._scene.canvas.canvas;\n\n const keyDown = [];\n\n document.addEventListener(\"keydown\", this._documentKeyDownHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n const keyCode = e.keyCode;\n keyDown[keyCode] = true;\n });\n\n document.addEventListener(\"keyup\", this._documentKeyUpHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {\n return;\n }\n const keyCode = e.keyCode;\n keyDown[keyCode] = false;\n });\n\n function setMousedownState(pick = true) {\n canvas.style.cursor = \"move\";\n setMousedownPositions();\n if (pick) {\n setMousedownPick();\n }\n }\n\n function setMousedownPositions() {\n xRotateDelta = 0;\n yRotateDelta = 0;\n\n lastX = states.pointerCanvasPos[0];\n lastY = states.pointerCanvasPos[1];\n lastXDown = states.pointerCanvasPos[0];\n lastYDown = states.pointerCanvasPos[1];\n }\n\n function setMousedownPick() {\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickSurface = true;\n pickController.update();\n\n if (pickController.picked && pickController.pickedSurface && pickController.pickResult && pickController.pickResult.worldPos) {\n mouseDownPicked = true;\n pickedWorldPos.set(pickController.pickResult.worldPos);\n } else {\n mouseDownPicked = false;\n }\n }\n\n canvas.addEventListener(\"mousedown\", this._mouseDownHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n switch (e.which) {\n\n case 1: // Left button\n\n if (keyDown[scene.input.KEY_SHIFT] || configs.planView) {\n\n mouseDownLeft = true;\n\n setMousedownState();\n\n } else {\n\n mouseDownLeft = true;\n\n setMousedownState(false);\n }\n\n break;\n\n case 2: // Middle/both buttons\n\n mouseDownMiddle = true;\n\n setMousedownState();\n\n break;\n\n case 3: // Right button\n\n mouseDownRight = true;\n\n if (configs.panRightClick) {\n\n setMousedownState();\n }\n\n break;\n\n default:\n break;\n }\n });\n\n document.addEventListener(\"mousemove\", this._documentMouseMoveHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n if (!mouseDownLeft && !mouseDownMiddle && !mouseDownRight) {\n return;\n }\n\n // Scaling drag-rotate to canvas boundary\n\n const canvasBoundary = scene.canvas.boundary;\n\n const canvasWidth = canvasBoundary[2];\n const canvasHeight = canvasBoundary[3];\n const x = states.pointerCanvasPos[0];\n const y = states.pointerCanvasPos[1];\n\n const panning = keyDown[scene.input.KEY_SHIFT] || configs.planView || (!configs.panRightClick && mouseDownMiddle) || (configs.panRightClick && mouseDownRight);\n\n const xDelta = document.pointerLockElement ? e.movementX : (x - lastX);\n const yDelta = document.pointerLockElement ? e.movementY : (y - lastY);\n\n if (panning) {\n\n const camera = scene.camera;\n\n // We use only canvasHeight here so that aspect ratio does not distort speed\n\n if (camera.projection === \"perspective\") {\n\n const depth = Math.abs(mouseDownPicked ? math.lenVec3(math.subVec3(pickedWorldPos, scene.camera.eye, [])) : scene.camera.eyeLookDist);\n const targetDistance = depth * Math.tan((camera.perspective.fov / 2) * Math.PI / 180.0);\n\n updates.panDeltaX += (1.5 * xDelta * targetDistance / canvasHeight);\n updates.panDeltaY += (1.5 * yDelta * targetDistance / canvasHeight);\n\n } else {\n\n updates.panDeltaX += 0.5 * camera.ortho.scale * (xDelta / canvasHeight);\n updates.panDeltaY += 0.5 * camera.ortho.scale * (yDelta / canvasHeight);\n }\n\n } else if (mouseDownLeft && !mouseDownMiddle && !mouseDownRight) {\n\n if (!configs.planView) { // No rotating in plan-view mode\n\n if (configs.firstPerson) {\n updates.rotateDeltaY -= (xDelta / canvasWidth) * configs.dragRotationRate / 2;\n updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate / 4);\n\n } else {\n updates.rotateDeltaY -= (xDelta / canvasWidth) * (configs.dragRotationRate * 1.5);\n updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate * 1.5);\n }\n }\n }\n\n lastX = x;\n lastY = y;\n });\n\n canvas.addEventListener(\"mousemove\", this._canvasMouseMoveHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n if (!states.mouseover) {\n return;\n }\n\n mouseMovedOnCanvasSinceLastWheel = true;\n });\n\n document.addEventListener(\"mouseup\", this._documentMouseUpHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n switch (e.which) {\n case 1: // Left button\n mouseDownLeft = false;\n mouseDownMiddle = false;\n mouseDownRight = false;\n break;\n case 2: // Middle/both buttons\n mouseDownLeft = false;\n mouseDownMiddle = false;\n mouseDownRight = false;\n break;\n case 3: // Right button\n mouseDownLeft = false;\n mouseDownMiddle = false;\n mouseDownRight = false;\n break;\n default:\n break;\n }\n xRotateDelta = 0;\n yRotateDelta = 0;\n });\n\n canvas.addEventListener(\"mouseup\", this._mouseUpHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n switch (e.which) {\n case 3: // Right button\n getCanvasPosFromEvent(e, canvasPos);\n const x = canvasPos[0];\n const y = canvasPos[1];\n if (Math.abs(x - lastXDown) < 3 && Math.abs(y - lastYDown) < 3) {\n controllers.cameraControl.fire(\"rightClick\", { // For context menus\n pagePos: [Math.round(e.pageX), Math.round(e.pageY)],\n canvasPos: canvasPos,\n event: e\n }, true);\n }\n break;\n default:\n break;\n }\n canvas.style.removeProperty(\"cursor\");\n });\n\n canvas.addEventListener(\"mouseenter\", this._mouseEnterHandler = () => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n xRotateDelta = 0;\n yRotateDelta = 0;\n });\n\n const maxElapsed = 1 / 20;\n const minElapsed = 1 / 60;\n\n let secsNowLast = null;\n\n canvas.addEventListener(\"wheel\", this._mouseWheelHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n const secsNow = performance.now() / 1000.0;\n var secsElapsed = (secsNowLast !== null) ? (secsNow - secsNowLast) : 0;\n secsNowLast = secsNow;\n if (secsElapsed > maxElapsed) {\n secsElapsed = maxElapsed;\n }\n if (secsElapsed < minElapsed) {\n secsElapsed = minElapsed;\n }\n const delta = Math.max(-1, Math.min(1, -e.deltaY * 40));\n if (delta === 0) {\n return;\n }\n const normalizedDelta = delta / Math.abs(delta);\n updates.dollyDelta += -normalizedDelta * secsElapsed * configs.mouseWheelDollyRate;\n\n if (mouseMovedOnCanvasSinceLastWheel) {\n states.followPointerDirty = true;\n mouseMovedOnCanvasSinceLastWheel = false;\n }\n\n }, {passive: true});\n }\n\n reset() {\n }\n\n destroy() {\n\n const canvas = this._scene.canvas.canvas;\n\n document.removeEventListener(\"keydown\", this._documentKeyDownHandler);\n document.removeEventListener(\"keyup\", this._documentKeyUpHandler);\n canvas.removeEventListener(\"mousedown\", this._mouseDownHandler);\n document.removeEventListener(\"mousemove\", this._documentMouseMoveHandler);\n canvas.removeEventListener(\"mousemove\", this._canvasMouseMoveHandler);\n document.removeEventListener(\"mouseup\", this._documentMouseUpHandler);\n canvas.removeEventListener(\"mouseup\", this._mouseUpHandler);\n canvas.removeEventListener(\"mouseenter\", this._mouseEnterHandler);\n canvas.removeEventListener(\"wheel\", this._mouseWheelHandler);\n }\n}\n\nexport {MousePanRotateDollyHandler};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2585, + "__docId__": 2593, "kind": "variable", "name": "canvasPos", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", @@ -51253,7 +51469,7 @@ "ignore": true }, { - "__docId__": 2586, + "__docId__": 2594, "kind": "function", "name": "getCanvasPosFromEvent", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", @@ -51290,7 +51506,7 @@ "ignore": true }, { - "__docId__": 2587, + "__docId__": 2595, "kind": "class", "name": "MousePanRotateDollyHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js", @@ -51306,7 +51522,7 @@ "ignore": true }, { - "__docId__": 2588, + "__docId__": 2596, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js~MousePanRotateDollyHandler", @@ -51320,7 +51536,7 @@ "undocument": true }, { - "__docId__": 2589, + "__docId__": 2597, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js~MousePanRotateDollyHandler", @@ -51338,7 +51554,7 @@ } }, { - "__docId__": 2590, + "__docId__": 2598, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js~MousePanRotateDollyHandler", @@ -51354,7 +51570,7 @@ "return": null }, { - "__docId__": 2591, + "__docId__": 2599, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js~MousePanRotateDollyHandler", @@ -51370,18 +51586,18 @@ "return": null }, { - "__docId__": 2592, + "__docId__": 2600, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js", "content": "import {math} from \"../../../math/math.js\";\n\n/**\n * @private\n */\nclass MousePickHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const pickController = controllers.pickController;\n const pivotController = controllers.pivotController;\n const cameraControl = controllers.cameraControl;\n\n this._clicks = 0;\n this._timeout = null;\n this._lastPickedEntityId = null;\n\n let leftDown = false;\n let rightDown = false;\n\n const canvas = this._scene.canvas.canvas;\n\n const flyCameraTo = (pickResult) => {\n let pos;\n if (pickResult && pickResult.worldPos) {\n pos = pickResult.worldPos\n }\n const aabb = pickResult && pickResult.entity ? pickResult.entity.aabb : scene.aabb;\n if (pos) { // Fly to look at point, don't change eye->look dist\n const camera = scene.camera;\n const diff = math.subVec3(camera.eye, camera.look, []);\n controllers.cameraFlight.flyTo({\n // look: pos,\n // eye: xeokit.math.addVec3(pos, diff, []),\n // up: camera.up,\n aabb: aabb\n });\n // TODO: Option to back off to fit AABB in view\n } else {// Fly to fit target boundary in view\n controllers.cameraFlight.flyTo({\n aabb: aabb\n });\n }\n };\n\n const tickifiedMouseMoveFn = scene.tickify (\n this._canvasMouseMoveHandler = (e) => {\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n if (leftDown || rightDown) {\n return;\n }\n\n const hoverSubs = cameraControl.hasSubs(\"hover\");\n const hoverEnterSubs = cameraControl.hasSubs(\"hoverEnter\");\n const hoverOutSubs = cameraControl.hasSubs(\"hoverOut\");\n const hoverOffSubs = cameraControl.hasSubs(\"hoverOff\");\n const hoverSurfaceSubs = cameraControl.hasSubs(\"hoverSurface\");\n const hoverSnapOrSurfaceSubs = cameraControl.hasSubs(\"hoverSnapOrSurface\");\n\n if (hoverSubs || hoverEnterSubs || hoverOutSubs || hoverOffSubs || hoverSurfaceSubs || hoverSnapOrSurfaceSubs) {\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickEntity = true;\n pickController.schedulePickSurface = hoverSurfaceSubs;\n pickController.scheduleSnapOrPick = hoverSnapOrSurfaceSubs\n\n pickController.update();\n\n if (pickController.pickResult) {\n\n if (pickController.pickResult.entity) {\n const pickedEntityId = pickController.pickResult.entity.id;\n\n if (this._lastPickedEntityId !== pickedEntityId) {\n\n if (this._lastPickedEntityId !== undefined) {\n\n cameraControl.fire(\"hoverOut\", { // Hovered off an entity\n entity: scene.objects[this._lastPickedEntityId]\n }, true);\n }\n\n cameraControl.fire(\"hoverEnter\", pickController.pickResult, true); // Hovering over a new entity\n\n this._lastPickedEntityId = pickedEntityId;\n }\n }\n\n cameraControl.fire(\"hover\", pickController.pickResult, true);\n\n if (pickController.pickResult.worldPos || pickController.pickResult.snappedWorldPos) { // Hovering the surface of an entity\n cameraControl.fire(\"hoverSurface\", pickController.pickResult, true);\n }\n\n } else {\n\n if (this._lastPickedEntityId !== undefined) {\n\n cameraControl.fire(\"hoverOut\", { // Hovered off an entity\n entity: scene.objects[this._lastPickedEntityId]\n }, true);\n\n this._lastPickedEntityId = undefined;\n }\n\n cameraControl.fire(\"hoverOff\", { // Not hovering on any entity\n canvasPos: pickController.pickCursorPos\n }, true);\n }\n }\n }\n );\n\n canvas.addEventListener(\"mousemove\", tickifiedMouseMoveFn);\n\n canvas.addEventListener('mousedown', this._canvasMouseDownHandler = (e) => {\n\n if (e.which === 1) {\n leftDown = true;\n }\n\n if (e.which === 3) {\n rightDown = true;\n }\n\n const leftButtonDown = (e.which === 1);\n\n if (!leftButtonDown) {\n return;\n }\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n // Left mouse button down to start pivoting\n\n states.mouseDownClientX = e.clientX;\n states.mouseDownClientY = e.clientY;\n states.mouseDownCursorX = states.pointerCanvasPos[0];\n states.mouseDownCursorY = states.pointerCanvasPos[1];\n\n if ((!configs.firstPerson) && configs.followPointer) {\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickSurface = true;\n\n pickController.update();\n\n if (e.which === 1) {// Left button\n const pickResult = pickController.pickResult;\n if (pickResult && pickResult.worldPos) {\n pivotController.setPivotPos(pickResult.worldPos);\n pivotController.startPivot();\n } else {\n if (configs.smartPivot) {\n pivotController.setCanvasPivotPos(states.pointerCanvasPos);\n } else {\n pivotController.setPivotPos(scene.camera.look);\n }\n pivotController.startPivot();\n }\n }\n }\n });\n\n document.addEventListener('mouseup', this._documentMouseUpHandler = (e) => {\n\n if (e.which === 1) {\n leftDown = false;\n }\n\n if (e.which === 3) {\n rightDown = false;\n }\n\n if (pivotController.getPivoting()) {\n pivotController.endPivot();\n }\n });\n\n canvas.addEventListener('mouseup', this._canvasMouseUpHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n const leftButtonUp = (e.which === 1);\n\n if (!leftButtonUp) {\n return;\n }\n\n // Left mouse button up to possibly pick or double-pick\n\n pivotController.hidePivot();\n\n if (Math.abs(e.clientX - states.mouseDownClientX) > 3 || Math.abs(e.clientY - states.mouseDownClientY) > 3) {\n return;\n }\n\n const pickedSubs = cameraControl.hasSubs(\"picked\");\n const pickedNothingSubs = cameraControl.hasSubs(\"pickedNothing\");\n const pickedSurfaceSubs = cameraControl.hasSubs(\"pickedSurface\");\n const doublePickedSubs = cameraControl.hasSubs(\"doublePicked\");\n const doublePickedSurfaceSubs = cameraControl.hasSubs(\"doublePickedSurface\");\n const doublePickedNothingSubs = cameraControl.hasSubs(\"doublePickedNothing\");\n\n if ((!configs.doublePickFlyTo) &&\n (!doublePickedSubs) &&\n (!doublePickedSurfaceSubs) &&\n (!doublePickedNothingSubs)) {\n\n // Avoid the single/double click differentiation timeout\n\n if (pickedSubs || pickedNothingSubs || pickedSurfaceSubs) {\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickEntity = true;\n pickController.schedulePickSurface = pickedSurfaceSubs;\n pickController.update();\n\n if (pickController.pickResult) {\n\n cameraControl.fire(\"picked\", pickController.pickResult, true);\n\n if (pickController.pickedSurface) {\n cameraControl.fire(\"pickedSurface\", pickController.pickResult, true);\n }\n } else {\n cameraControl.fire(\"pickedNothing\", {\n canvasPos: states.pointerCanvasPos\n }, true);\n }\n }\n\n this._clicks = 0;\n\n return;\n }\n\n this._clicks++;\n\n if (this._clicks === 1) { // First click\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickEntity = configs.doublePickFlyTo;\n pickController.schedulePickSurface = pickedSurfaceSubs;\n pickController.update();\n\n const firstClickPickResult = pickController.pickResult;\n const firstClickPickSurface = pickController.pickedSurface;\n\n this._timeout = setTimeout(() => {\n\n if (firstClickPickResult) {\n\n cameraControl.fire(\"picked\", firstClickPickResult, true);\n\n if (firstClickPickSurface) {\n\n cameraControl.fire(\"pickedSurface\", firstClickPickResult, true);\n\n if ((!configs.firstPerson) && configs.followPointer) {\n controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);\n if (controllers.pivotController.startPivot()) {\n controllers.pivotController.showPivot();\n }\n }\n }\n } else {\n cameraControl.fire(\"pickedNothing\", {\n canvasPos: states.pointerCanvasPos\n }, true);\n }\n\n this._clicks = 0;\n\n }, configs.doubleClickTimeFrame);\n\n } else { // Second click\n\n if (this._timeout !== null) {\n window.clearTimeout(this._timeout);\n this._timeout = null;\n }\n\n pickController.pickCursorPos = states.pointerCanvasPos;\n pickController.schedulePickEntity = configs.doublePickFlyTo || doublePickedSubs || doublePickedSurfaceSubs;\n pickController.schedulePickSurface = pickController.schedulePickEntity && doublePickedSurfaceSubs;\n pickController.update();\n\n if (pickController.pickResult) {\n\n cameraControl.fire(\"doublePicked\", pickController.pickResult, true);\n\n if (pickController.pickedSurface) {\n cameraControl.fire(\"doublePickedSurface\", pickController.pickResult, true);\n }\n\n if (configs.doublePickFlyTo) {\n\n flyCameraTo(pickController.pickResult);\n\n if ((!configs.firstPerson) && configs.followPointer) {\n\n const pickedEntityAABB = pickController.pickResult.entity.aabb;\n const pickedEntityCenterPos = math.getAABB3Center(pickedEntityAABB);\n\n controllers.pivotController.setPivotPos(pickedEntityCenterPos);\n\n if (controllers.pivotController.startPivot()) {\n controllers.pivotController.showPivot();\n }\n }\n }\n\n } else {\n\n cameraControl.fire(\"doublePickedNothing\", {\n canvasPos: states.pointerCanvasPos\n }, true);\n\n if (configs.doublePickFlyTo) {\n\n flyCameraTo();\n\n if ((!configs.firstPerson) && configs.followPointer) {\n\n const sceneAABB = scene.aabb;\n const sceneCenterPos = math.getAABB3Center(sceneAABB);\n\n controllers.pivotController.setPivotPos(sceneCenterPos);\n\n if (controllers.pivotController.startPivot()) {\n controllers.pivotController.showPivot();\n }\n }\n }\n }\n\n this._clicks = 0;\n }\n }, false);\n }\n\n reset() {\n this._clicks = 0;\n this._lastPickedEntityId = null;\n if (this._timeout) {\n window.clearTimeout(this._timeout);\n this._timeout = null;\n }\n }\n\n destroy() {\n const canvas = this._scene.canvas.canvas;\n canvas.removeEventListener(\"mousemove\", this._canvasMouseMoveHandler);\n canvas.removeEventListener(\"mousedown\", this._canvasMouseDownHandler);\n document.removeEventListener(\"mouseup\", this._documentMouseUpHandler);\n canvas.removeEventListener(\"mouseup\", this._canvasMouseUpHandler);\n if (this._timeout) {\n window.clearTimeout(this._timeout);\n this._timeout = null;\n }\n }\n}\n\n\n\nexport {MousePickHandler};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2593, + "__docId__": 2601, "kind": "class", "name": "MousePickHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js", @@ -51397,7 +51613,7 @@ "ignore": true }, { - "__docId__": 2594, + "__docId__": 2602, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51411,7 +51627,7 @@ "undocument": true }, { - "__docId__": 2595, + "__docId__": 2603, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51429,7 +51645,7 @@ } }, { - "__docId__": 2596, + "__docId__": 2604, "kind": "member", "name": "_clicks", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51447,7 +51663,7 @@ } }, { - "__docId__": 2597, + "__docId__": 2605, "kind": "member", "name": "_timeout", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51465,7 +51681,7 @@ } }, { - "__docId__": 2598, + "__docId__": 2606, "kind": "member", "name": "_lastPickedEntityId", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51483,7 +51699,7 @@ } }, { - "__docId__": 2606, + "__docId__": 2614, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51499,7 +51715,7 @@ "return": null }, { - "__docId__": 2610, + "__docId__": 2618, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js~MousePickHandler", @@ -51515,18 +51731,18 @@ "return": null }, { - "__docId__": 2612, + "__docId__": 2620, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js", "content": "import {math} from \"../../../math/math.js\";\n\nconst getCanvasPosFromEvent = function (event, canvasPos) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n let element = event.target;\n let totalOffsetLeft = 0;\n let totalOffsetTop = 0;\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n canvasPos[0] = event.pageX - totalOffsetLeft;\n canvasPos[1] = event.pageY - totalOffsetTop;\n }\n return canvasPos;\n};\n\n/**\n * @private\n */\nclass TouchPanRotateAndDollyHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const pickController = controllers.pickController;\n const pivotController = controllers.pivotController;\n\n const tapStartCanvasPos = math.vec2();\n const tapCanvasPos0 = math.vec2();\n const tapCanvasPos1 = math.vec2();\n const touch0Vec = math.vec2();\n\n const lastCanvasTouchPosList = [];\n const canvas = this._scene.canvas.canvas;\n\n let numTouches = 0;\n let tapStartTime = -1;\n let waitForTick = false;\n\n this._onTick = scene.on(\"tick\", () => {\n waitForTick = false;\n });\n\n let firstDragDeltaX = 0;\n let firstDragDeltaY = 1;\n let absorbTinyFirstDrag = false;\n\n canvas.addEventListener(\"touchstart\", this._canvasTouchStartHandler = (event) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n event.preventDefault();\n\n const touches = event.touches;\n const changedTouches = event.changedTouches;\n\n states.touchStartTime = Date.now();\n\n if (touches.length === 1 && changedTouches.length === 1) {\n\n tapStartTime = states.touchStartTime;\n\n getCanvasPosFromEvent(touches[0], tapStartCanvasPos);\n\n if (configs.followPointer) {\n\n pickController.pickCursorPos = tapStartCanvasPos;\n pickController.schedulePickSurface = true;\n pickController.update();\n\n if (!configs.planView) {\n\n if (pickController.picked && pickController.pickedSurface && pickController.pickResult && pickController.pickResult.worldPos) {\n\n pivotController.setPivotPos(pickController.pickResult.worldPos);\n\n if (!configs.firstPerson && pivotController.startPivot()) {\n pivotController.showPivot();\n }\n\n } else {\n\n if (configs.smartPivot) {\n pivotController.setCanvasPivotPos(states.pointerCanvasPos);\n } else {\n pivotController.setPivotPos(scene.camera.look);\n }\n\n if (!configs.firstPerson && pivotController.startPivot()) {\n pivotController.showPivot();\n }\n }\n }\n }\n\n } else {\n tapStartTime = -1;\n }\n\n while (lastCanvasTouchPosList.length < touches.length) {\n lastCanvasTouchPosList.push(math.vec2());\n }\n\n for (let i = 0, len = touches.length; i < len; ++i) {\n getCanvasPosFromEvent(touches[i], lastCanvasTouchPosList[i]);\n }\n\n numTouches = touches.length;\n });\n\n canvas.addEventListener(\"touchend\", this._canvasTouchEndHandler = () => {\n if (pivotController.getPivoting()) {\n pivotController.endPivot()\n }\n firstDragDeltaX = 0;\n firstDragDeltaY = 0;\n absorbTinyFirstDrag = true;\n })\n\n canvas.addEventListener(\"touchmove\", this._canvasTouchMoveHandler = (event) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n\n if (waitForTick) {\n // Limit changes detection to one per frame\n return;\n }\n\n waitForTick = true;\n\n // Scaling drag-rotate to canvas boundary\n\n const canvasBoundary = scene.canvas.boundary;\n const canvasWidth = canvasBoundary[2];\n const canvasHeight = canvasBoundary[3];\n\n const touches = event.touches;\n\n if (event.touches.length !== numTouches) {\n // Two fingers were pressed, then one of them is removed\n // We don't want to rotate in this case (weird behavior)\n return;\n }\n\n if (numTouches === 1) {\n\n getCanvasPosFromEvent(touches[0], tapCanvasPos0);\n\n //-----------------------------------------------------------------------------------------------\n // Drag rotation\n //-----------------------------------------------------------------------------------------------\n\n math.subVec2(tapCanvasPos0, lastCanvasTouchPosList[0], touch0Vec);\n\n const xPanDelta = touch0Vec[0];\n const yPanDelta = touch0Vec[1];\n\n if (states.longTouchTimeout !== null && (Math.abs(xPanDelta) > configs.longTapRadius || Math.abs(yPanDelta) > configs.longTapRadius)) {\n clearTimeout(states.longTouchTimeout);\n states.longTouchTimeout = null;\n }\n\n if (configs.planView) { // No rotating in plan-view mode\n\n const camera = scene.camera;\n\n // We use only canvasHeight here so that aspect ratio does not distort speed\n\n if (camera.projection === \"perspective\") {\n\n const touchPicked = false;\n const pickedWorldPos = [0, 0, 0];\n\n const depth = Math.abs(touchPicked ? math.lenVec3(math.subVec3(pickedWorldPos, scene.camera.eye, [])) : scene.camera.eyeLookDist);\n const targetDistance = depth * Math.tan((camera.perspective.fov / 2) * Math.PI / 180.0);\n\n updates.panDeltaX += (xPanDelta * targetDistance / canvasHeight) * configs.touchPanRate;\n updates.panDeltaY += (yPanDelta * targetDistance / canvasHeight) * configs.touchPanRate;\n\n } else {\n\n updates.panDeltaX += 0.5 * camera.ortho.scale * (xPanDelta / canvasHeight) * configs.touchPanRate;\n updates.panDeltaY += 0.5 * camera.ortho.scale * (yPanDelta / canvasHeight) * configs.touchPanRate;\n }\n\n } else {\n // if (!absorbTinyFirstDrag) {\n updates.rotateDeltaY -= (xPanDelta / canvasWidth) * (configs.dragRotationRate * 1.0); // Full horizontal rotation\n updates.rotateDeltaX += (yPanDelta / canvasHeight) * (configs.dragRotationRate * 1.5); // Half vertical rotation\n // } else {\n // firstDragDeltaY -= (xPanDelta / canvasWidth) * (configs.dragRotationRate * 1.0); // Full horizontal rotation\n // firstDragDeltaX += (yPanDelta / canvasHeight) * (configs.dragRotationRate * 1.5); // Half vertical rotation\n // if (Math.abs(firstDragDeltaX) > 5 || Math.abs(firstDragDeltaY) > 5) {\n // updates.rotateDeltaX += firstDragDeltaX;\n // updates.rotateDeltaY += firstDragDeltaY;\n // firstDragDeltaX = 0;\n // firstDragDeltaY = 0;\n // absorbTinyFirstDrag = false;\n // }\n // }\n }\n\n } else if (numTouches === 2) {\n\n const touch0 = touches[0];\n const touch1 = touches[1];\n\n getCanvasPosFromEvent(touch0, tapCanvasPos0);\n getCanvasPosFromEvent(touch1, tapCanvasPos1);\n\n const lastMiddleTouch = math.geometricMeanVec2(lastCanvasTouchPosList[0], lastCanvasTouchPosList[1]);\n const currentMiddleTouch = math.geometricMeanVec2(tapCanvasPos0, tapCanvasPos1);\n\n const touchDelta = math.vec2();\n\n math.subVec2(lastMiddleTouch, currentMiddleTouch, touchDelta);\n\n const xPanDelta = touchDelta[0];\n const yPanDelta = touchDelta[1];\n\n const camera = scene.camera;\n\n // Dollying\n\n const d1 = math.distVec2([touch0.pageX, touch0.pageY], [touch1.pageX, touch1.pageY]);\n const d2 = math.distVec2(lastCanvasTouchPosList[0], lastCanvasTouchPosList[1]);\n\n const dollyDelta = (d2 - d1) * configs.touchDollyRate;\n\n updates.dollyDelta = dollyDelta;\n\n if (Math.abs(dollyDelta) < 1.0) {\n\n // We use only canvasHeight here so that aspect ratio does not distort speed\n\n if (camera.projection === \"perspective\") {\n const pickedWorldPos = pickController.pickResult ? pickController.pickResult.worldPos : scene.center;\n\n const depth = Math.abs(math.lenVec3(math.subVec3(pickedWorldPos, scene.camera.eye, [])));\n const targetDistance = depth * Math.tan((camera.perspective.fov / 2) * Math.PI / 180.0);\n\n updates.panDeltaX -= (xPanDelta * targetDistance / canvasHeight) * configs.touchPanRate;\n updates.panDeltaY -= (yPanDelta * targetDistance / canvasHeight) * configs.touchPanRate;\n\n } else {\n\n updates.panDeltaX -= 0.5 * camera.ortho.scale * (xPanDelta / canvasHeight) * configs.touchPanRate;\n updates.panDeltaY -= 0.5 * camera.ortho.scale * (yPanDelta / canvasHeight) * configs.touchPanRate;\n }\n }\n\n\n states.pointerCanvasPos = currentMiddleTouch;\n }\n\n for (let i = 0; i < numTouches; ++i) {\n getCanvasPosFromEvent(touches[i], lastCanvasTouchPosList[i]);\n }\n });\n }\n\n reset() {\n }\n\n destroy() {\n const canvas = this._scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._canvasTouchStartHandler);\n canvas.removeEventListener(\"touchend\", this._canvasTouchEndHandler);\n canvas.removeEventListener(\"touchmove\", this._canvasTouchMoveHandler);\n this._scene.off(this._onTick);\n }\n}\n\nexport {TouchPanRotateAndDollyHandler};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2613, + "__docId__": 2621, "kind": "function", "name": "getCanvasPosFromEvent", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js", @@ -51563,7 +51779,7 @@ "ignore": true }, { - "__docId__": 2614, + "__docId__": 2622, "kind": "class", "name": "TouchPanRotateAndDollyHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js", @@ -51579,7 +51795,7 @@ "ignore": true }, { - "__docId__": 2615, + "__docId__": 2623, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js~TouchPanRotateAndDollyHandler", @@ -51593,7 +51809,7 @@ "undocument": true }, { - "__docId__": 2616, + "__docId__": 2624, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js~TouchPanRotateAndDollyHandler", @@ -51611,7 +51827,7 @@ } }, { - "__docId__": 2617, + "__docId__": 2625, "kind": "member", "name": "_onTick", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js~TouchPanRotateAndDollyHandler", @@ -51629,7 +51845,7 @@ } }, { - "__docId__": 2618, + "__docId__": 2626, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js~TouchPanRotateAndDollyHandler", @@ -51645,7 +51861,7 @@ "return": null }, { - "__docId__": 2619, + "__docId__": 2627, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js~TouchPanRotateAndDollyHandler", @@ -51661,18 +51877,18 @@ "return": null }, { - "__docId__": 2620, + "__docId__": 2628, "kind": "file", "name": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", "content": "import {math} from \"../../../math/math.js\";\n\nconst TAP_INTERVAL = 150;\nconst DBL_TAP_INTERVAL = 325;\nconst TAP_DISTANCE_THRESHOLD = 4;\n\nconst getCanvasPosFromEvent = function (event, canvasPos) {\n if (!event) {\n event = window.event;\n canvasPos[0] = event.x;\n canvasPos[1] = event.y;\n } else {\n let element = event.target;\n let totalOffsetLeft = 0;\n let totalOffsetTop = 0;\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n canvasPos[0] = event.pageX - totalOffsetLeft;\n canvasPos[1] = event.pageY - totalOffsetTop;\n }\n return canvasPos;\n};\n\n/**\n * @private\n */\nclass TouchPickHandler {\n\n constructor(scene, controllers, configs, states, updates) {\n\n this._scene = scene;\n\n const pickController = controllers.pickController;\n const cameraControl = controllers.cameraControl;\n\n let touchStartTime;\n const activeTouches = [];\n const tapStartPos = new Float32Array(2);\n let tapStartTime = -1;\n let lastTapTime = -1;\n\n const canvas = this._scene.canvas.canvas;\n\n const flyCameraTo = (pickResult) => {\n let pos;\n if (pickResult && pickResult.worldPos) {\n pos = pickResult.worldPos\n }\n const aabb = pickResult ? pickResult.entity.aabb : scene.aabb;\n if (pos) { // Fly to look at point, don't change eye->look dist\n const camera = scene.camera;\n const diff = math.subVec3(camera.eye, camera.look, []);\n controllers.cameraFlight.flyTo({\n aabb: aabb\n });\n // TODO: Option to back off to fit AABB in view\n } else {// Fly to fit target boundary in view\n controllers.cameraFlight.flyTo({\n aabb: aabb\n });\n }\n };\n\n canvas.addEventListener(\"touchstart\", this._canvasTouchStartHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n if (states.longTouchTimeout !== null) {\n clearTimeout(states.longTouchTimeout);\n states.longTouchTimeout = null;\n }\n\n const touches = e.touches;\n const changedTouches = e.changedTouches;\n\n touchStartTime = Date.now();\n\n if (touches.length === 1 && changedTouches.length === 1) {\n tapStartTime = touchStartTime;\n\n getCanvasPosFromEvent(touches[0], tapStartPos);\n\n const rightClickClientX = tapStartPos[0];\n const rightClickClientY = tapStartPos[1];\n\n const rightClickPageX = touches[0].pageX;\n const rightClickPageY = touches[0].pageY;\n\n states.longTouchTimeout = setTimeout(() => {\n controllers.cameraControl.fire(\"rightClick\", { // For context menus\n pagePos: [Math.round(rightClickPageX), Math.round(rightClickPageY)],\n canvasPos: [Math.round(rightClickClientX), Math.round(rightClickClientY)],\n event: e\n }, true);\n\n states.longTouchTimeout = null;\n }, configs.longTapTimeout);\n\n } else {\n tapStartTime = -1;\n }\n\n while (activeTouches.length < touches.length) {\n activeTouches.push(new Float32Array(2))\n }\n\n for (let i = 0, len = touches.length; i < len; ++i) {\n getCanvasPosFromEvent(touches[i], activeTouches[i]);\n }\n\n activeTouches.length = touches.length;\n\n }, {passive: true});\n\n\n canvas.addEventListener(\"touchend\", this._canvasTouchEndHandler = (e) => {\n\n if (!(configs.active && configs.pointerEnabled)) {\n return;\n }\n\n const currentTime = Date.now();\n const touches = e.touches;\n const changedTouches = e.changedTouches;\n\n const pickedSurfaceSubs = cameraControl.hasSubs(\"pickedSurface\");\n\n if (states.longTouchTimeout !== null) {\n clearTimeout(states.longTouchTimeout);\n states.longTouchTimeout = null;\n }\n\n // process tap\n\n if (touches.length === 0 && changedTouches.length === 1) {\n\n if (tapStartTime > -1 && currentTime - tapStartTime < TAP_INTERVAL) {\n\n if (lastTapTime > -1 && tapStartTime - lastTapTime < DBL_TAP_INTERVAL) {\n\n // Double-tap\n\n getCanvasPosFromEvent(changedTouches[0], pickController.pickCursorPos);\n pickController.schedulePickEntity = true;\n pickController.schedulePickSurface = pickedSurfaceSubs;\n\n pickController.update();\n\n if (pickController.pickResult) {\n\n pickController.pickResult.touchInput = true;\n\n cameraControl.fire(\"doublePicked\", pickController.pickResult);\n\n if (pickController.pickedSurface) {\n cameraControl.fire(\"doublePickedSurface\", pickController.pickResult);\n }\n\n if (configs.doublePickFlyTo) {\n flyCameraTo(pickController.pickResult);\n }\n } else {\n cameraControl.fire(\"doublePickedNothing\");\n if (configs.doublePickFlyTo) {\n flyCameraTo();\n }\n }\n\n lastTapTime = -1;\n\n } else if (math.distVec2(activeTouches[0], tapStartPos) < TAP_DISTANCE_THRESHOLD) {\n\n // Single-tap\n\n getCanvasPosFromEvent(changedTouches[0], pickController.pickCursorPos);\n pickController.schedulePickEntity = true;\n pickController.schedulePickSurface = pickedSurfaceSubs;\n\n pickController.update();\n\n if (pickController.pickResult) {\n\n pickController.pickResult.touchInput = true;\n\n cameraControl.fire(\"picked\", pickController.pickResult);\n\n if (pickController.pickedSurface) {\n cameraControl.fire(\"pickedSurface\", pickController.pickResult);\n }\n\n } else {\n cameraControl.fire(\"pickedNothing\");\n }\n\n lastTapTime = currentTime;\n }\n\n tapStartTime = -1\n }\n }\n\n activeTouches.length = touches.length;\n\n for (let i = 0, len = touches.length; i < len; ++i) {\n activeTouches[i][0] = touches[i].pageX;\n activeTouches[i][1] = touches[i].pageY;\n }\n\n // e.stopPropagation();\n\n }, {passive: true});\n\n }\n\n reset() {\n // TODO\n // tapStartTime = -1;\n // lastTapTime = -1;\n\n }\n\n destroy() {\n const canvas = this._scene.canvas.canvas;\n canvas.removeEventListener(\"touchstart\", this._canvasTouchStartHandler);\n canvas.removeEventListener(\"touchend\", this._canvasTouchEndHandler);\n }\n}\n\n\nexport {TouchPickHandler};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2621, + "__docId__": 2629, "kind": "variable", "name": "TAP_INTERVAL", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", @@ -51693,7 +51909,7 @@ "ignore": true }, { - "__docId__": 2622, + "__docId__": 2630, "kind": "variable", "name": "DBL_TAP_INTERVAL", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", @@ -51714,7 +51930,7 @@ "ignore": true }, { - "__docId__": 2623, + "__docId__": 2631, "kind": "variable", "name": "TAP_DISTANCE_THRESHOLD", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", @@ -51735,7 +51951,7 @@ "ignore": true }, { - "__docId__": 2624, + "__docId__": 2632, "kind": "function", "name": "getCanvasPosFromEvent", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", @@ -51772,7 +51988,7 @@ "ignore": true }, { - "__docId__": 2625, + "__docId__": 2633, "kind": "class", "name": "TouchPickHandler", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js", @@ -51788,7 +52004,7 @@ "ignore": true }, { - "__docId__": 2626, + "__docId__": 2634, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js~TouchPickHandler", @@ -51802,7 +52018,7 @@ "undocument": true }, { - "__docId__": 2627, + "__docId__": 2635, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js~TouchPickHandler", @@ -51820,7 +52036,7 @@ } }, { - "__docId__": 2628, + "__docId__": 2636, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js~TouchPickHandler", @@ -51836,7 +52052,7 @@ "return": null }, { - "__docId__": 2629, + "__docId__": 2637, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js~TouchPickHandler", @@ -51852,18 +52068,18 @@ "return": null }, { - "__docId__": 2630, + "__docId__": 2638, "kind": "file", "name": "src/viewer/scene/Component.js", "content": "import {core} from \"./core.js\";\nimport {utils} from './utils.js';\nimport {Map} from \"./utils/Map.js\";\n\n/**\n * @desc Base class for all xeokit components.\n *\n * ## Component IDs\n *\n * Every Component has an ID that's unique within the parent {@link Scene}. xeokit generates\n * the IDs automatically by default, however you can also specify them yourself. In the example below, we're creating a\n * scene comprised of {@link Scene}, {@link Material}, {@link ReadableGeometry} and\n * {@link Mesh} components, while letting xeokit generate its own ID for\n * the {@link ReadableGeometry}:\n *\n *````JavaScript\n * import {Viewer, Mesh, buildTorusGeometry, ReadableGeometry, PhongMaterial, Texture, Fresnel} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * id: \"myMaterial\",\n * ambient: [0.9, 0.3, 0.9],\n * shininess: 30,\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * specularFresnel: new Fresnel(viewer.scene, {\n * leftColor: [1.0, 1.0, 1.0],\n * rightColor: [0.0, 0.0, 0.0],\n * power: 4\n * })\n * })\n * });\n *````\n *\n * We can then find those components like this:\n *\n * ````javascript\n * // Find the Material\n * var material = viewer.scene.components[\"myMaterial\"];\n *\n * // Find all PhongMaterials in the Scene\n * var phongMaterials = viewer.scene.types[\"PhongMaterial\"];\n *\n * // Find our Material within the PhongMaterials\n * var materialAgain = phongMaterials[\"myMaterial\"];\n * ````\n *\n * ## Restriction on IDs\n *\n * Auto-generated IDs are of the form ````\"__0\"````, ````\"__1\"````, ````\"__2\"```` ... and so on.\n *\n * Scene maintains a map of these IDs, along with a counter that it increments each time it generates a new ID.\n *\n * If Scene has created the IDs listed above, and we then destroy the ````Component```` with ID ````\"__1\"````,\n * Scene will mark that ID as available, and will reuse it for the next default ID.\n *\n * Therefore, two restrictions your on IDs:\n *\n * * don't use IDs that begin with two underscores, and\n * * don't reuse auto-generated IDs of destroyed Components.\n *\n * ## Logging\n *\n * Components have methods to log ID-prefixed messages to the JavaScript console:\n *\n * ````javascript\n * material.log(\"Everything is fine, situation normal.\");\n * material.warn(\"Wait, whats that red light?\");\n * material.error(\"Aw, snap!\");\n * ````\n *\n * The logged messages will look like this in the console:\n *\n * ````text\n * [LOG] myMaterial: Everything is fine, situation normal.\n * [WARN] myMaterial: Wait, whats that red light..\n * [ERROR] myMaterial: Aw, snap!\n * ````\n *\n * ## Destruction\n *\n * Get notification of destruction of Components:\n *\n * ````javascript\n * material.once(\"destroyed\", function() {\n * this.log(\"Component was destroyed: \" + this.id);\n * });\n * ````\n *\n * Or get notification of destruction of any Component within its {@link Scene}:\n *\n * ````javascript\n * scene.on(\"componentDestroyed\", function(component) {\n * this.log(\"Component was destroyed: \" + component.id);\n * });\n * ````\n *\n * Then destroy a component like this:\n *\n * ````javascript\n * material.destroy();\n * ````\n */\nclass Component {\n\n /**\n @private\n */\n get type() {\n return \"Component\";\n }\n\n /**\n * @private\n */\n get isComponent() {\n return true;\n }\n\n constructor(owner = null, cfg = {}) {\n\n /**\n * The parent {@link Scene} that contains this Component.\n *\n * @property scene\n * @type {Scene}\n * @final\n */\n this.scene = null;\n\n if (this.type === \"Scene\") {\n this.scene = this;\n /**\n * The viewer that contains this Scene.\n * @property viewer\n * @type {Viewer}\n */\n this.viewer = cfg.viewer;\n } else {\n if (owner.type === \"Scene\") {\n this.scene = owner;\n } else if (owner instanceof Component) {\n this.scene = owner.scene;\n } else {\n throw \"Invalid param: owner must be a Component\"\n }\n this._owner = owner;\n }\n\n this._dontClear = !!cfg.dontClear; // Prevent Scene#clear from destroying this component\n\n this._renderer = this.scene._renderer;\n\n /**\n Arbitrary, user-defined metadata on this component.\n\n @property metadata\n @type Object\n */\n this.meta = cfg.meta || {};\n\n\n /**\n * ID of this Component, unique within the {@link Scene}.\n *\n * Components are mapped by this ID in {@link Scene#components}.\n *\n * @property id\n * @type {String|Number}\n */\n this.id = cfg.id; // Auto-generated by Scene by default\n\n /**\n True as soon as this Component has been destroyed\n\n @property destroyed\n @type {Boolean}\n */\n this.destroyed = false;\n\n this._attached = {}; // Attached components with names.\n this._attachments = null; // Attached components keyed to IDs - lazy-instantiated\n this._subIdMap = null; // Subscription subId pool\n this._subIdEvents = null; // Subscription subIds mapped to event names\n this._eventSubs = null; // Event names mapped to subscribers\n this._eventSubsNum = null;\n this._events = null; // Maps names to events\n this._eventCallDepth = 0; // Helps us catch stack overflows from recursive events\n this._ownedComponents = null; // // Components created with #create - lazy-instantiated\n\n if (this !== this.scene) { // Don't add scene to itself\n this.scene._addComponent(this); // Assigns this component an automatic ID if not yet assigned\n }\n\n this._updateScheduled = false; // True when #_update will be called on next tick\n\n if (owner) {\n owner._own(this);\n }\n }\n\n // /**\n // * Unique ID for this Component within its {@link Scene}.\n // *\n // * @property\n // * @type {String}\n // */\n // get id() {\n // return this._id;\n // }\n\n /**\n Indicates that we need to redraw the scene.\n\n This is called by certain subclasses after they have made some sort of state update that requires the\n renderer to perform a redraw.\n\n For example: a {@link Mesh} calls this on itself whenever you update its\n {@link Mesh#layer} property, which manually controls its render order in\n relation to other Meshes.\n\n If this component has a ````castsShadow```` property that's set ````true````, then this will also indicate\n that the renderer needs to redraw shadow map associated with this component. Components like\n {@link DirLight} have that property set when they produce light that creates shadows, while\n components like {@link Mesh\"}}layer{{/crossLink}} have that property set when they cast shadows.\n\n @protected\n */\n glRedraw() {\n if (!this._renderer) { // Called from a constructor\n return;\n }\n this._renderer.imageDirty();\n if (this.castsShadow) { // Light source or object\n this._renderer.shadowsDirty();\n }\n }\n\n /**\n Indicates that we need to re-sort the renderer's state-ordered drawables list.\n\n For efficiency, the renderer keeps its list of drawables ordered so that runs of the same state updates can be\n combined. This method is called by certain subclasses after they have made some sort of state update that would\n require re-ordering of the drawables list.\n\n For example: a {@link DirLight} calls this on itself whenever you update {@link DirLight#dir}.\n\n @protected\n */\n glResort() {\n if (!this._renderer) { // Called from a constructor\n return;\n }\n this._renderer.needStateSort();\n }\n\n /**\n * The {@link Component} that owns the lifecycle of this Component, if any.\n *\n * When that component is destroyed, this component will be automatically destroyed also.\n *\n * Will be null if this Component has no owner.\n *\n * @property owner\n * @type {Component}\n */\n get owner() {\n return this._owner;\n }\n\n /**\n * Tests if this component is of the given type, or is a subclass of the given type.\n * @type {Boolean}\n */\n isType(type) {\n return this.type === type;\n }\n\n /**\n * Fires an event on this component.\n *\n * Notifies existing subscribers to the event, optionally retains the event to give to\n * any subsequent notifications on the event as they are made.\n *\n * @param {String} event The event type name\n * @param {Object} value The event parameters\n * @param {Boolean} [forget=false] When true, does not retain for subsequent subscribers\n */\n fire(event, value, forget) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n this._eventSubsNum = {};\n }\n if (forget !== true) {\n this._events[event] = value || true; // Save notification\n }\n const subs = this._eventSubs[event];\n let sub;\n if (subs) { // Notify subscriptions\n for (const subId in subs) {\n if (subs.hasOwnProperty(subId)) {\n sub = subs[subId];\n this._eventCallDepth++;\n if (this._eventCallDepth < 300) {\n sub.callback.call(sub.scope, value);\n } else {\n this.error(\"fire: potential stack overflow from recursive event '\" + event + \"' - dropping this event\");\n }\n this._eventCallDepth--;\n }\n }\n }\n }\n\n /**\n * Subscribes to an event on this component.\n *\n * The callback is be called with this component as scope.\n *\n * @param {String} event The event\n * @param {Function} callback Called fired on the event\n * @param {Object} [scope=this] Scope for the callback\n * @return {String} Handle to the subscription, which may be used to unsubscribe with {@link #off}.\n */\n on(event, callback, scope) {\n if (!this._events) {\n this._events = {};\n }\n if (!this._subIdMap) {\n this._subIdMap = new Map(); // Subscription subId pool\n }\n if (!this._subIdEvents) {\n this._subIdEvents = {};\n }\n if (!this._eventSubs) {\n this._eventSubs = {};\n }\n if (!this._eventSubsNum) {\n this._eventSubsNum = {};\n }\n let subs = this._eventSubs[event];\n if (!subs) {\n subs = {};\n this._eventSubs[event] = subs;\n this._eventSubsNum[event] = 1;\n } else {\n this._eventSubsNum[event]++;\n }\n const subId = this._subIdMap.addItem(); // Create unique subId\n subs[subId] = {\n callback: callback,\n scope: scope || this\n };\n this._subIdEvents[subId] = event;\n const value = this._events[event];\n if (value !== undefined) { // A publication exists, notify callback immediately\n callback.call(scope || this, value);\n }\n return subId;\n }\n\n /**\n * Cancels an event subscription that was previously made with {@link Component#on} or {@link Component#once}.\n *\n * @param {String} subId Subscription ID\n */\n off(subId) {\n if (subId === undefined || subId === null) {\n return;\n }\n if (!this._subIdEvents) {\n return;\n }\n const event = this._subIdEvents[subId];\n if (event) {\n delete this._subIdEvents[subId];\n const subs = this._eventSubs[event];\n if (subs) {\n delete subs[subId];\n this._eventSubsNum[event]--;\n }\n this._subIdMap.removeItem(subId); // Release subId\n }\n }\n\n /**\n * Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.\n *\n * This is equivalent to calling {@link Component#on}, and then calling {@link Component#off} inside the callback function.\n *\n * @param {String} event Data event to listen to\n * @param {Function} callback Called when fresh data is available at the event\n * @param {Object} [scope=this] Scope for the callback\n */\n once(event, callback, scope) {\n const self = this;\n const subId = this.on(event,\n function (value) {\n self.off(subId);\n callback.call(scope || this, value);\n },\n scope);\n }\n\n /**\n * Returns true if there are any subscribers to the given event on this component.\n *\n * @param {String} event The event\n * @return {Boolean} True if there are any subscribers to the given event on this component.\n */\n hasSubs(event) {\n return (this._eventSubsNum && (this._eventSubsNum[event] > 0));\n }\n\n /**\n * Logs a console debugging message for this component.\n *\n * The console message will have this format: *````[LOG] [ : ````*\n *\n * Also fires the message as a \"log\" event on the parent {@link Scene}.\n *\n * @param {String} message The message to log\n */\n log(message) {\n message = \"[LOG]\" + this._message(message);\n window.console.log(message);\n this.scene.fire(\"log\", message);\n }\n\n _message(message) {\n return \" [\" + this.type + \" \" + utils.inQuotes(this.id) + \"]: \" + message;\n }\n\n /**\n * Logs a warning for this component to the JavaScript console.\n *\n * The console message will have this format: *````[WARN] [ =: ````*\n *\n * Also fires the message as a \"warn\" event on the parent {@link Scene}.\n *\n * @param {String} message The message to log\n */\n warn(message) {\n message = \"[WARN]\" + this._message(message);\n window.console.warn(message);\n this.scene.fire(\"warn\", message);\n }\n\n /**\n * Logs an error for this component to the JavaScript console.\n *\n * The console message will have this format: *````[ERROR] [ =: ````*\n *\n * Also fires the message as an \"error\" event on the parent {@link Scene}.\n *\n * @param {String} message The message to log\n */\n error(message) {\n message = \"[ERROR]\" + this._message(message);\n window.console.error(message);\n this.scene.fire(\"error\", message);\n }\n\n /**\n * Adds a child component to this.\n *\n * When component not given, attaches the scene's default instance for the given name (if any).\n * Publishes the new child component on this component, keyed to the given name.\n *\n * @param {*} params\n * @param {String} params.name component name\n * @param {Component} [params.component] The component\n * @param {String} [params.type] Optional expected type of base type of the child; when supplied, will\n * cause an exception if the given child is not the same type or a subtype of this.\n * @param {Boolean} [params.sceneDefault=false]\n * @param {Boolean} [params.sceneSingleton=false]\n * @param {Function} [params.onAttached] Optional callback called when component attached\n * @param {Function} [params.onAttached.callback] Callback function\n * @param {Function} [params.onAttached.scope] Optional scope for callback\n * @param {Function} [params.onDetached] Optional callback called when component is detached\n * @param {Function} [params.onDetached.callback] Callback function\n * @param {Function} [params.onDetached.scope] Optional scope for callback\n * @param {{String:Function}} [params.on] Callbacks to subscribe to properties on component\n * @param {Boolean} [params.recompiles=true] When true, fires \"dirty\" events on this component\n * @private\n */\n _attach(params) {\n\n const name = params.name;\n\n if (!name) {\n this.error(\"Component 'name' expected\");\n return;\n }\n\n let component = params.component;\n const sceneDefault = params.sceneDefault;\n const sceneSingleton = params.sceneSingleton;\n const type = params.type;\n const on = params.on;\n const recompiles = params.recompiles !== false;\n\n // True when child given as config object, where parent manages its instantiation and destruction\n let managingLifecycle = false;\n\n if (component) {\n\n if (utils.isNumeric(component) || utils.isString(component)) {\n\n // Component ID given\n // Both numeric and string IDs are supported\n\n const id = component;\n\n component = this.scene.components[id];\n\n if (!component) {\n\n // Quote string IDs in errors\n\n this.error(\"Component not found: \" + utils.inQuotes(id));\n return;\n }\n }\n }\n\n if (!component) {\n\n if (sceneSingleton === true) {\n\n // Using the first instance of the component type we find\n\n const instances = this.scene.types[type];\n for (const id2 in instances) {\n if (instances.hasOwnProperty) {\n component = instances[id2];\n break;\n }\n }\n\n if (!component) {\n this.error(\"Scene has no default component for '\" + name + \"'\");\n return null;\n }\n\n } else if (sceneDefault === true) {\n\n // Using a default scene component\n\n component = this.scene[name];\n\n if (!component) {\n this.error(\"Scene has no default component for '\" + name + \"'\");\n return null;\n }\n }\n }\n\n if (component) {\n\n if (component.scene.id !== this.scene.id) {\n this.error(\"Not in same scene: \" + component.type + \" \" + utils.inQuotes(component.id));\n return;\n }\n\n if (type) {\n\n if (!component.isType(type)) {\n this.error(\"Expected a \" + type + \" type or subtype: \" + component.type + \" \" + utils.inQuotes(component.id));\n return;\n }\n }\n }\n\n if (!this._attachments) {\n this._attachments = {};\n }\n\n const oldComponent = this._attached[name];\n let subs;\n let i;\n let len;\n\n if (oldComponent) {\n\n if (component && oldComponent.id === component.id) {\n\n // Reject attempt to reattach same component\n return;\n }\n\n const oldAttachment = this._attachments[oldComponent.id];\n\n // Unsubscribe from events on old component\n\n subs = oldAttachment.subs;\n\n for (i = 0, len = subs.length; i < len; i++) {\n oldComponent.off(subs[i]);\n }\n\n delete this._attached[name];\n delete this._attachments[oldComponent.id];\n\n const onDetached = oldAttachment.params.onDetached;\n if (onDetached) {\n if (utils.isFunction(onDetached)) {\n onDetached(oldComponent);\n } else {\n onDetached.scope ? onDetached.callback.call(onDetached.scope, oldComponent) : onDetached.callback(oldComponent);\n }\n }\n\n if (oldAttachment.managingLifecycle) {\n\n // Note that we just unsubscribed from all events fired by the child\n // component, so destroying it won't fire events back at us now.\n\n oldComponent.destroy();\n }\n }\n\n if (component) {\n\n // Set and publish the new component on this component\n\n const attachment = {\n params: params,\n component: component,\n subs: [],\n managingLifecycle: managingLifecycle\n };\n\n attachment.subs.push(\n component.once(\"destroyed\",\n function () {\n attachment.params.component = null;\n this._attach(attachment.params);\n },\n this));\n\n if (recompiles) {\n attachment.subs.push(\n component.on(\"dirty\",\n function () {\n this.fire(\"dirty\", this);\n },\n this));\n }\n\n this._attached[name] = component;\n this._attachments[component.id] = attachment;\n\n // Bind destruct listener to new component to remove it\n // from this component when destroyed\n\n const onAttached = params.onAttached;\n if (onAttached) {\n if (utils.isFunction(onAttached)) {\n onAttached(component);\n } else {\n onAttached.scope ? onAttached.callback.call(onAttached.scope, component) : onAttached.callback(component);\n }\n }\n\n if (on) {\n\n let event;\n let subIdr;\n let callback;\n let scope;\n\n for (event in on) {\n if (on.hasOwnProperty(event)) {\n\n subIdr = on[event];\n\n if (utils.isFunction(subIdr)) {\n callback = subIdr;\n scope = null;\n } else {\n callback = subIdr.callback;\n scope = subIdr.scope;\n }\n\n if (!callback) {\n continue;\n }\n\n attachment.subs.push(component.on(event, callback, scope));\n }\n }\n }\n }\n\n if (recompiles) {\n this.fire(\"dirty\", this); // FIXME: May trigger spurous mesh recompilations unless able to limit with param?\n }\n\n this.fire(name, component); // Component can be null\n\n return component;\n }\n\n _checkComponent(expectedType, component) {\n if (!component.isComponent) {\n if (utils.isID(component)) {\n const id = component;\n component = this.scene.components[id];\n if (!component) {\n this.error(\"Component not found: \" + id);\n return;\n }\n } else {\n this.error(\"Expected a Component or ID\");\n return;\n }\n }\n if (expectedType !== component.type) {\n this.error(\"Expected a \" + expectedType + \" Component\");\n return;\n }\n if (component.scene.id !== this.scene.id) {\n this.error(\"Not in same scene: \" + component.type);\n return;\n }\n return component;\n }\n\n _checkComponent2(expectedTypes, component) {\n if (!component.isComponent) {\n if (utils.isID(component)) {\n const id = component;\n component = this.scene.components[id];\n if (!component) {\n this.error(\"Component not found: \" + id);\n return;\n }\n } else {\n this.error(\"Expected a Component or ID\");\n return;\n }\n }\n if (component.scene.id !== this.scene.id) {\n this.error(\"Not in same scene: \" + component.type);\n return;\n }\n for (var i = 0, len = expectedTypes.length; i < len; i++) {\n if (expectedTypes[i] === component.type) {\n return component;\n }\n }\n this.error(\"Expected component types: \" + expectedTypes);\n return null;\n }\n\n _own(component) {\n if (!this._ownedComponents) {\n this._ownedComponents = {};\n }\n if (!this._ownedComponents[component.id]) {\n this._ownedComponents[component.id] = component;\n }\n component.once(\"destroyed\", () => {\n delete this._ownedComponents[component.id];\n }, this);\n }\n\n /**\n * Protected method, called by sub-classes to queue a call to _update().\n * @protected\n * @param {Number} [priority=1]\n */\n _needUpdate(priority) {\n if (!this._updateScheduled) {\n this._updateScheduled = true;\n if (priority === 0) {\n this._doUpdate();\n } else {\n core.scheduleTask(this._doUpdate, this);\n }\n }\n }\n\n /**\n * @private\n */\n _doUpdate() {\n if (this._updateScheduled) {\n this._updateScheduled = false;\n if (this._update) {\n this._update();\n }\n }\n }\n\n /**\n * Schedule a task to perform on the next browser interval\n * @param task\n */\n scheduleTask(task) {\n core.scheduleTask(task, null);\n }\n\n /**\n * Protected virtual template method, optionally implemented\n * by sub-classes to perform a scheduled task.\n *\n * @protected\n */\n _update() {\n }\n\n /**\n * Destroys all {@link Component}s that are owned by this. These are Components that were instantiated with\n * this Component as their first constructor argument.\n */\n clear() {\n if (this._ownedComponents) {\n for (var id in this._ownedComponents) {\n if (this._ownedComponents.hasOwnProperty(id)) {\n const component = this._ownedComponents[id];\n component.destroy();\n delete this._ownedComponents[id];\n }\n }\n }\n }\n\n /**\n * Destroys this component.\n */\n destroy() {\n\n if (this.destroyed) {\n return;\n }\n\n /**\n * Fired when this Component is destroyed.\n * @event destroyed\n */\n this.fire(\"destroyed\", this.destroyed = true); // Must fire before we blow away subscription maps, below\n\n // Unsubscribe from child components and destroy then\n\n let id;\n let attachment;\n let component;\n let subs;\n let i;\n let len;\n\n if (this._attachments) {\n for (id in this._attachments) {\n if (this._attachments.hasOwnProperty(id)) {\n attachment = this._attachments[id];\n component = attachment.component;\n subs = attachment.subs;\n for (i = 0, len = subs.length; i < len; i++) {\n component.off(subs[i]);\n }\n if (attachment.managingLifecycle) {\n component.destroy();\n }\n }\n }\n }\n\n if (this._ownedComponents) {\n for (id in this._ownedComponents) {\n if (this._ownedComponents.hasOwnProperty(id)) {\n component = this._ownedComponents[id];\n component.destroy();\n delete this._ownedComponents[id];\n }\n }\n }\n\n this.scene._removeComponent(this);\n\n // Memory leak avoidance\n this._attached = {};\n this._attachments = null;\n this._subIdMap = null;\n this._subIdEvents = null;\n this._eventSubs = null;\n this._events = null;\n this._eventCallDepth = 0;\n this._ownedComponents = null;\n this._updateScheduled = false;\n }\n}\n\nexport {Component};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/Component.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/Component.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2631, + "__docId__": 2639, "kind": "class", "name": "Component", "memberof": "src/viewer/scene/Component.js", @@ -51878,7 +52094,7 @@ "interface": false }, { - "__docId__": 2632, + "__docId__": 2640, "kind": "get", "name": "type", "memberof": "src/viewer/scene/Component.js~Component", @@ -51897,7 +52113,7 @@ } }, { - "__docId__": 2633, + "__docId__": 2641, "kind": "get", "name": "isComponent", "memberof": "src/viewer/scene/Component.js~Component", @@ -51916,7 +52132,7 @@ } }, { - "__docId__": 2634, + "__docId__": 2642, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/Component.js~Component", @@ -51930,7 +52146,7 @@ "undocument": true }, { - "__docId__": 2635, + "__docId__": 2643, "kind": "member", "name": "scene", "memberof": "src/viewer/scene/Component.js~Component", @@ -51967,7 +52183,7 @@ } }, { - "__docId__": 2637, + "__docId__": 2645, "kind": "member", "name": "viewer", "memberof": "src/viewer/scene/Component.js~Component", @@ -51998,7 +52214,7 @@ } }, { - "__docId__": 2640, + "__docId__": 2648, "kind": "member", "name": "_owner", "memberof": "src/viewer/scene/Component.js~Component", @@ -52016,7 +52232,7 @@ } }, { - "__docId__": 2641, + "__docId__": 2649, "kind": "member", "name": "_dontClear", "memberof": "src/viewer/scene/Component.js~Component", @@ -52034,7 +52250,7 @@ } }, { - "__docId__": 2642, + "__docId__": 2650, "kind": "member", "name": "_renderer", "memberof": "src/viewer/scene/Component.js~Component", @@ -52052,7 +52268,7 @@ } }, { - "__docId__": 2643, + "__docId__": 2651, "kind": "member", "name": "meta", "memberof": "src/viewer/scene/Component.js~Component", @@ -52083,7 +52299,7 @@ } }, { - "__docId__": 2644, + "__docId__": 2652, "kind": "member", "name": "id", "memberof": "src/viewer/scene/Component.js~Component", @@ -52115,7 +52331,7 @@ } }, { - "__docId__": 2645, + "__docId__": 2653, "kind": "member", "name": "destroyed", "memberof": "src/viewer/scene/Component.js~Component", @@ -52146,7 +52362,7 @@ } }, { - "__docId__": 2646, + "__docId__": 2654, "kind": "member", "name": "_attached", "memberof": "src/viewer/scene/Component.js~Component", @@ -52164,7 +52380,7 @@ } }, { - "__docId__": 2647, + "__docId__": 2655, "kind": "member", "name": "_attachments", "memberof": "src/viewer/scene/Component.js~Component", @@ -52182,7 +52398,7 @@ } }, { - "__docId__": 2648, + "__docId__": 2656, "kind": "member", "name": "_subIdMap", "memberof": "src/viewer/scene/Component.js~Component", @@ -52200,7 +52416,7 @@ } }, { - "__docId__": 2649, + "__docId__": 2657, "kind": "member", "name": "_subIdEvents", "memberof": "src/viewer/scene/Component.js~Component", @@ -52218,7 +52434,7 @@ } }, { - "__docId__": 2650, + "__docId__": 2658, "kind": "member", "name": "_eventSubs", "memberof": "src/viewer/scene/Component.js~Component", @@ -52236,7 +52452,7 @@ } }, { - "__docId__": 2651, + "__docId__": 2659, "kind": "member", "name": "_eventSubsNum", "memberof": "src/viewer/scene/Component.js~Component", @@ -52254,7 +52470,7 @@ } }, { - "__docId__": 2652, + "__docId__": 2660, "kind": "member", "name": "_events", "memberof": "src/viewer/scene/Component.js~Component", @@ -52272,7 +52488,7 @@ } }, { - "__docId__": 2653, + "__docId__": 2661, "kind": "member", "name": "_eventCallDepth", "memberof": "src/viewer/scene/Component.js~Component", @@ -52290,7 +52506,7 @@ } }, { - "__docId__": 2654, + "__docId__": 2662, "kind": "member", "name": "_ownedComponents", "memberof": "src/viewer/scene/Component.js~Component", @@ -52308,7 +52524,7 @@ } }, { - "__docId__": 2655, + "__docId__": 2663, "kind": "member", "name": "_updateScheduled", "memberof": "src/viewer/scene/Component.js~Component", @@ -52326,7 +52542,7 @@ } }, { - "__docId__": 2656, + "__docId__": 2664, "kind": "method", "name": "glRedraw", "memberof": "src/viewer/scene/Component.js~Component", @@ -52342,7 +52558,7 @@ "return": null }, { - "__docId__": 2657, + "__docId__": 2665, "kind": "method", "name": "glResort", "memberof": "src/viewer/scene/Component.js~Component", @@ -52358,7 +52574,7 @@ "return": null }, { - "__docId__": 2658, + "__docId__": 2666, "kind": "get", "name": "owner", "memberof": "src/viewer/scene/Component.js~Component", @@ -52391,7 +52607,7 @@ } }, { - "__docId__": 2659, + "__docId__": 2667, "kind": "method", "name": "isType", "memberof": "src/viewer/scene/Component.js~Component", @@ -52425,7 +52641,7 @@ } }, { - "__docId__": 2660, + "__docId__": 2668, "kind": "method", "name": "fire", "memberof": "src/viewer/scene/Component.js~Component", @@ -52473,7 +52689,7 @@ "return": null }, { - "__docId__": 2664, + "__docId__": 2672, "kind": "method", "name": "on", "memberof": "src/viewer/scene/Component.js~Component", @@ -52528,7 +52744,7 @@ } }, { - "__docId__": 2670, + "__docId__": 2678, "kind": "method", "name": "off", "memberof": "src/viewer/scene/Component.js~Component", @@ -52554,7 +52770,7 @@ "return": null }, { - "__docId__": 2671, + "__docId__": 2679, "kind": "method", "name": "once", "memberof": "src/viewer/scene/Component.js~Component", @@ -52602,7 +52818,7 @@ "return": null }, { - "__docId__": 2672, + "__docId__": 2680, "kind": "method", "name": "hasSubs", "memberof": "src/viewer/scene/Component.js~Component", @@ -52635,7 +52851,7 @@ } }, { - "__docId__": 2673, + "__docId__": 2681, "kind": "method", "name": "log", "memberof": "src/viewer/scene/Component.js~Component", @@ -52661,7 +52877,7 @@ "return": null }, { - "__docId__": 2674, + "__docId__": 2682, "kind": "method", "name": "_message", "memberof": "src/viewer/scene/Component.js~Component", @@ -52689,7 +52905,7 @@ } }, { - "__docId__": 2675, + "__docId__": 2683, "kind": "method", "name": "warn", "memberof": "src/viewer/scene/Component.js~Component", @@ -52715,7 +52931,7 @@ "return": null }, { - "__docId__": 2676, + "__docId__": 2684, "kind": "method", "name": "error", "memberof": "src/viewer/scene/Component.js~Component", @@ -52741,7 +52957,7 @@ "return": null }, { - "__docId__": 2677, + "__docId__": 2685, "kind": "method", "name": "_attach", "memberof": "src/viewer/scene/Component.js~Component", @@ -52908,7 +53124,7 @@ } }, { - "__docId__": 2679, + "__docId__": 2687, "kind": "method", "name": "_checkComponent", "memberof": "src/viewer/scene/Component.js~Component", @@ -52942,7 +53158,7 @@ } }, { - "__docId__": 2680, + "__docId__": 2688, "kind": "method", "name": "_checkComponent2", "memberof": "src/viewer/scene/Component.js~Component", @@ -52976,7 +53192,7 @@ } }, { - "__docId__": 2681, + "__docId__": 2689, "kind": "method", "name": "_own", "memberof": "src/viewer/scene/Component.js~Component", @@ -53000,7 +53216,7 @@ "return": null }, { - "__docId__": 2683, + "__docId__": 2691, "kind": "method", "name": "_needUpdate", "memberof": "src/viewer/scene/Component.js~Component", @@ -53029,7 +53245,7 @@ "return": null }, { - "__docId__": 2685, + "__docId__": 2693, "kind": "method", "name": "_doUpdate", "memberof": "src/viewer/scene/Component.js~Component", @@ -53045,7 +53261,7 @@ "return": null }, { - "__docId__": 2687, + "__docId__": 2695, "kind": "method", "name": "scheduleTask", "memberof": "src/viewer/scene/Component.js~Component", @@ -53071,7 +53287,7 @@ "return": null }, { - "__docId__": 2688, + "__docId__": 2696, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/Component.js~Component", @@ -53087,7 +53303,7 @@ "return": null }, { - "__docId__": 2689, + "__docId__": 2697, "kind": "method", "name": "clear", "memberof": "src/viewer/scene/Component.js~Component", @@ -53102,7 +53318,7 @@ "return": null }, { - "__docId__": 2690, + "__docId__": 2698, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/Component.js~Component", @@ -53117,18 +53333,18 @@ "return": null }, { - "__docId__": 2700, + "__docId__": 2708, "kind": "file", "name": "src/viewer/scene/Entity.js", "content": "/**\n * @desc An abstract 3D scene element that can be individually shown, hidden, selected,\n * highlighted, xrayed, culled, picked, clipped and bounded.\n *\n * Entity provides an abstract interface through which different concrete types\n * of scene element can be accessed and manipulated uniformly.\n *\n * ## Entities Representing Models\n *\n * * An Entity represents a model when {@link Entity#isModel} is ````true````.\n * * Each model-Entity is registered by {@link Entity#id} in {@link Scene#models}.\n * * Each model-Entity can also have a {@link MetaModel} with a matching {@link MetaModel#id}, by which it is registered in {@link MetaScene#metaModels}.\n *\n * ## Entities Representing Objects\n *\n * * An Entity represents an object when {@link Entity#isObject} is ````true````.\n * * Each object-Entity is registered by {@link Entity#id} in {@link Scene#objects}.\n * * Each object-Entity can also have a {@link MetaObject} with a matching {@link MetaObject#id}, by which it is registered {@link MetaScene#metaObjects}.\n *\n * ## Updating Batches of Objects\n *\n * {@link Scene} provides the following methods for updating batches of object-Entities using their {@link Entity#id}s:\n *\n * * {@link Scene#setObjectsVisible}\n * * {@link Scene#setObjectsCulled}\n * * {@link Scene#setObjectsSelected}\n * * {@link Scene#setObjectsHighlighted}\n * * {@link Scene#setObjectsXRayed}\n * * {@link Scene#setObjectsEdges}\n * * {@link Scene#setObjectsColorized}\n * * {@link Scene#setObjectsOpacity}\n *\n * @interface\n * @abstract\n */\nclass Entity {\n\n /**\n * Component ID, unique within the {@link Scene}.\n *\n * @type {Number|String}\n * @abstract\n */\n get id() {\n }\n\n /**\n * ID of the corresponding object within the originating system, if any.\n *\n * By default, this has the same value as {@link Entity#id}. When we load a model using {@link XKTLoaderPlugin#load},\n * with {@link XKTLoaderPlugin#globalizeObjectIds} set ````true````, then that plugin will prefix {@link Entity#id}\n * with the model ID, while leaving this property holding the original value of {@link Entity#id}. When loading an\n * IFC model, this property will hold the IFC product ID of the corresponding IFC element.\n *\n * @type {String}\n * @abstract\n */\n get originalSystemId() {\n }\n\n /**\n * Returns true to indicate that this is an Entity.\n *\n * @returns {Boolean}\n */\n get isEntity() {\n return true;\n }\n\n /**\n * Returns ````true```` if this Entity represents a model.\n *\n * When this is ````true````, the Entity will be registered by {@link Entity#id} in {@link Scene#models} and\n * may also have a corresponding {@link MetaModel}.\n *\n * @type {Boolean}\n * @abstract\n */\n get isModel() {\n }\n\n /**\n * Returns ````true```` if this Entity represents an object.\n *\n * When this is ````true````, the Entity will be registered by {@link Entity#id} in {@link Scene#objects} and\n * may also have a corresponding {@link MetaObject}.\n *\n * @type {Boolean}\n * @abstract\n */\n get isObject() {\n }\n\n /** Returns the parent Entity, if any. */\n get parent() {\n\n }\n\n /**\n * Sets the 3D World-space origin for this Entity.\n *\n * @type {Float64Array}\n * @abstract\n */\n set origin(origin) {\n\n }\n\n /**\n * Gets the 3D World-space origin for this Entity.\n *\n * @type {Float64Array}\n * @abstract\n */\n get origin() {\n }\n\n /**\n * World-space 3D axis-aligned bounding box (AABB) of this Entity.\n *\n * Represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @type {Float64Array}\n * @abstract\n */\n get aabb() {\n }\n\n /**\n * The approximate number of triangles in this Entity.\n *\n * @type {Number}\n * @abstract\n */\n get numTriangles() {\n }\n\n /**\n * Sets if this Entity is visible.\n *\n * Only rendered when {@link Entity#visible} is ````true```` and {@link Entity#culled} is ````false````.\n *\n * When {@link Entity#isObject} and {@link Entity#visible} are both ````true```` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n set visible(visible) {\n }\n\n /**\n * Gets if this Entity is visible.\n *\n * Only rendered when {@link Entity#visible} is ````true```` and {@link Entity#culled} is ````false````.\n *\n * When {@link Entity#isObject} and {@link Entity#visible} are both ````true```` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n get visible() {\n }\n\n /**\n * Sets if this Entity is xrayed.\n *\n * When {@link Entity#isObject} and {@link Entity#xrayed} are both ````true``` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n set xrayed(xrayed) {\n\n }\n\n /**\n * Gets if this Entity is xrayed.\n *\n * When {@link Entity#isObject} and {@link Entity#xrayed} are both ````true``` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n get xrayed() {\n\n }\n\n /**\n * Sets if this Entity is highlighted.\n *\n * When {@link Entity#isObject} and {@link Entity#highlighted} are both ````true```` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n set highlighted(highlighted) {\n\n }\n\n /**\n * Gets if this Entity is highlighted.\n *\n * When {@link Entity#isObject} and {@link Entity#highlighted} are both ````true```` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n get highlighted() {\n }\n\n /**\n * Sets if this Entity is selected.\n *\n * When {@link Entity#isObject} and {@link Entity#selected} are both ````true``` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n set selected(selected) {\n\n }\n\n /**\n * Gets if this Entity is selected.\n *\n * When {@link Entity#isObject} and {@link Entity#selected} are both ````true``` the Entity will be\n * registered by {@link Entity#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n * @abstract\n */\n get selected() {\n\n }\n\n /**\n * Sets if this Entity's edges are enhanced.\n *\n * @type {Boolean}\n * @abstract\n */\n set edges(edges) {\n\n }\n\n /**\n * Gets if this Entity's edges are enhanced.\n *\n * @type {Boolean}\n * @abstract\n */\n get edges() {\n\n }\n\n /**\n * Sets if this Entity is culled.\n *\n * Only rendered when {@link Entity#visible} is ````true```` and {@link Entity#culled} is ````false````.\n *\n * @type {Boolean}\n * @abstract\n */\n set culled(culled) {\n\n }\n\n /**\n * Gets if this Entity is culled.\n *\n * Only rendered when {@link Entity#visible} is ````true```` and {@link Entity#culled} is ````false````.\n *\n * @type {Boolean}\n * @abstract\n */\n get culled() {\n\n }\n\n /**\n * Sets if this Entity is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n * @abstract\n */\n set clippable(clippable) {\n\n }\n\n /**\n * Gets if this Entity is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n * @abstract\n */\n get clippable() {\n\n }\n\n /**\n * Sets if this Entity is included in boundary calculations.\n *\n * @type {Boolean}\n * @abstract\n */\n set collidable(collidable) {\n\n }\n\n /**\n * Gets if this Entity is included in boundary calculations.\n *\n * @type {Boolean}\n * @abstract\n */\n get collidable() {\n\n }\n\n /**\n * Sets if this Entity is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n * @abstract\n */\n set pickable(pickable) {\n\n }\n\n /**\n * Gets if this Entity is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n * @abstract\n */\n get pickable() {\n\n }\n\n /**\n * Sets the Entity's RGB colorize color, multiplies by the Entity's rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n * @abstract\n */\n set colorize(rgb) {\n\n }\n\n /**\n * Gets the Entity's RGB colorize color, multiplies by the Entity's rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n * @abstract\n */\n get colorize() {\n\n }\n\n /**\n * Sets the Entity's opacity factor, multiplies by the Entity's rendered fragment alphas.\n *\n * This is a factor in range ````[0..1]````.\n *\n * @type {Number}\n * @abstract\n */\n set opacity(opacity) {\n\n }\n\n /**\n * Gets the Entity's opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n * @abstract\n */\n get opacity() {\n\n }\n\n /**\n * Sets if this Entity casts shadows.\n *\n * @type {Boolean}\n * @abstract\n */\n set castsShadow(pickable) {\n\n }\n\n /**\n * Gets if this Entity casts shadows.\n *\n * @type {Boolean}\n * @abstract\n */\n get castsShadow() {\n\n }\n\n /**\n * Sets if to this Entity can have shadows cast upon it\n *\n * @type {Boolean}\n * @abstract\n */\n set receivesShadow(pickable) {\n\n }\n\n /**\n * Gets if this Entity can have shadows cast upon it\n *\n * @type {Boolean}\n * @abstract\n */\n get receivesShadow() {\n\n }\n\n /**\n * Gets if this Entity can have Scalable Ambient Obscurance (SAO) applied to it.\n *\n * SAO is configured by {@link SAO}.\n *\n * @type {Boolean}\n * @abstract\n */\n get saoEnabled() {\n\n }\n\n /**\n * Sets the Entity's 3D World-space offset.\n *\n * Since offsetting Entities comes with memory and rendering overhead on some systems, this feature\n * only works when {@link Viewer} is configured with ````entityOffsetsEnabled: true````.\n *\n * The offset dynamically translates the Entity in World-space, which is useful for creating\n * effects like exploding parts assemblies etc.\n *\n * Default value is ````[0,0,0]````.\n *\n * Provide a null or undefined value to reset to the default value.\n *\n * @abstract\n * @type {Number[]}\n */\n set offset(offset) {\n }\n\n /**\n * Gets the Entity's 3D World-space offset.\n *\n * Default value is ````[0,0,0]````.\n *\n * @abstract\n * @type {Number[]}\n */\n get offset() {\n }\n\n /**\n * Gets the World, View and Canvas-space positions of each vertex in a callback.\n *\n * @param callback\n */\n getEachVertex(callback) {\n }\n\n /**\n * Destroys this Entity.\n */\n destroy() {\n\n }\n}\n\nexport {Entity};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/Entity.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/Entity.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2701, + "__docId__": 2709, "kind": "class", "name": "Entity", "memberof": "src/viewer/scene/Entity.js", @@ -53144,7 +53360,7 @@ "interface": true }, { - "__docId__": 2702, + "__docId__": 2710, "kind": "get", "name": "id", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53167,7 +53383,7 @@ "abstract": true }, { - "__docId__": 2703, + "__docId__": 2711, "kind": "get", "name": "originalSystemId", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53189,7 +53405,7 @@ "abstract": true }, { - "__docId__": 2704, + "__docId__": 2712, "kind": "get", "name": "isEntity", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53221,7 +53437,7 @@ } }, { - "__docId__": 2705, + "__docId__": 2713, "kind": "get", "name": "isModel", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53243,7 +53459,7 @@ "abstract": true }, { - "__docId__": 2706, + "__docId__": 2714, "kind": "get", "name": "isObject", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53265,7 +53481,7 @@ "abstract": true }, { - "__docId__": 2707, + "__docId__": 2715, "kind": "get", "name": "parent", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53279,7 +53495,7 @@ "type": null }, { - "__docId__": 2708, + "__docId__": 2716, "kind": "set", "name": "origin", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53301,7 +53517,7 @@ "abstract": true }, { - "__docId__": 2709, + "__docId__": 2717, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53323,7 +53539,7 @@ "abstract": true }, { - "__docId__": 2710, + "__docId__": 2718, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53345,7 +53561,7 @@ "abstract": true }, { - "__docId__": 2711, + "__docId__": 2719, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53367,7 +53583,7 @@ "abstract": true }, { - "__docId__": 2712, + "__docId__": 2720, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53389,7 +53605,7 @@ "abstract": true }, { - "__docId__": 2713, + "__docId__": 2721, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53411,7 +53627,7 @@ "abstract": true }, { - "__docId__": 2714, + "__docId__": 2722, "kind": "set", "name": "xrayed", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53433,7 +53649,7 @@ "abstract": true }, { - "__docId__": 2715, + "__docId__": 2723, "kind": "get", "name": "xrayed", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53455,7 +53671,7 @@ "abstract": true }, { - "__docId__": 2716, + "__docId__": 2724, "kind": "set", "name": "highlighted", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53477,7 +53693,7 @@ "abstract": true }, { - "__docId__": 2717, + "__docId__": 2725, "kind": "get", "name": "highlighted", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53499,7 +53715,7 @@ "abstract": true }, { - "__docId__": 2718, + "__docId__": 2726, "kind": "set", "name": "selected", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53521,7 +53737,7 @@ "abstract": true }, { - "__docId__": 2719, + "__docId__": 2727, "kind": "get", "name": "selected", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53543,7 +53759,7 @@ "abstract": true }, { - "__docId__": 2720, + "__docId__": 2728, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53565,7 +53781,7 @@ "abstract": true }, { - "__docId__": 2721, + "__docId__": 2729, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53587,7 +53803,7 @@ "abstract": true }, { - "__docId__": 2722, + "__docId__": 2730, "kind": "set", "name": "culled", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53609,7 +53825,7 @@ "abstract": true }, { - "__docId__": 2723, + "__docId__": 2731, "kind": "get", "name": "culled", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53631,7 +53847,7 @@ "abstract": true }, { - "__docId__": 2724, + "__docId__": 2732, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53653,7 +53869,7 @@ "abstract": true }, { - "__docId__": 2725, + "__docId__": 2733, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53675,7 +53891,7 @@ "abstract": true }, { - "__docId__": 2726, + "__docId__": 2734, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53697,7 +53913,7 @@ "abstract": true }, { - "__docId__": 2727, + "__docId__": 2735, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53719,7 +53935,7 @@ "abstract": true }, { - "__docId__": 2728, + "__docId__": 2736, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53741,7 +53957,7 @@ "abstract": true }, { - "__docId__": 2729, + "__docId__": 2737, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53763,7 +53979,7 @@ "abstract": true }, { - "__docId__": 2730, + "__docId__": 2738, "kind": "set", "name": "colorize", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53785,7 +54001,7 @@ "abstract": true }, { - "__docId__": 2731, + "__docId__": 2739, "kind": "get", "name": "colorize", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53807,7 +54023,7 @@ "abstract": true }, { - "__docId__": 2732, + "__docId__": 2740, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53829,7 +54045,7 @@ "abstract": true }, { - "__docId__": 2733, + "__docId__": 2741, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53851,7 +54067,7 @@ "abstract": true }, { - "__docId__": 2734, + "__docId__": 2742, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53873,7 +54089,7 @@ "abstract": true }, { - "__docId__": 2735, + "__docId__": 2743, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53895,7 +54111,7 @@ "abstract": true }, { - "__docId__": 2736, + "__docId__": 2744, "kind": "set", "name": "receivesShadow", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53917,7 +54133,7 @@ "abstract": true }, { - "__docId__": 2737, + "__docId__": 2745, "kind": "get", "name": "receivesShadow", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53939,7 +54155,7 @@ "abstract": true }, { - "__docId__": 2738, + "__docId__": 2746, "kind": "get", "name": "saoEnabled", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53961,7 +54177,7 @@ "abstract": true }, { - "__docId__": 2739, + "__docId__": 2747, "kind": "set", "name": "offset", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -53983,7 +54199,7 @@ "abstract": true }, { - "__docId__": 2740, + "__docId__": 2748, "kind": "get", "name": "offset", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -54005,7 +54221,7 @@ "abstract": true }, { - "__docId__": 2741, + "__docId__": 2749, "kind": "method", "name": "getEachVertex", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -54031,7 +54247,7 @@ "return": null }, { - "__docId__": 2742, + "__docId__": 2750, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/Entity.js~Entity", @@ -54046,18 +54262,18 @@ "return": null }, { - "__docId__": 2743, + "__docId__": 2751, "kind": "file", "name": "src/viewer/scene/ImagePlane/ImagePlane.js", "content": "import {Component} from '../Component.js';\nimport {Node} from \"../nodes/Node.js\";\nimport {Mesh} from \"../mesh/Mesh.js\";\nimport {PhongMaterial} from \"../materials/PhongMaterial.js\";\nimport {buildPlaneGeometry} from \"../geometry/builders/buildPlaneGeometry.js\";\nimport {Texture} from \"../materials/Texture.js\";\nimport {buildGridGeometry} from \"../geometry/builders/buildGridGeometry.js\";\nimport {ReadableGeometry} from \"../geometry/ReadableGeometry.js\";\nimport {math} from \"../math/math.js\";\nimport {worldToRTCPos} from \"../math/rtcCoords.js\";\n\nconst tempVec3 = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst zeroVec = math.vec3([0, -1, 0]);\nconst tempQuat = math.vec4([0, 0, 0, 1]);\n\n/**\n * @desc A plane-shaped 3D object containing a bitmap image.\n *\n * Use ````ImagePlane```` to embed bitmap images in your scenes.\n *\n * As shown in the examples below, ````ImagePlane```` is useful for creating ground planes from satellite maps and embedding 2D plan\n * view images in cross-section slicing planes.\n *\n * # Example 1: Create a ground plane from a satellite image\n *\n * In our first example, we'll load the Schependomlaan model, then use\n * an ````ImagePlane```` to create a ground plane, which will contain\n * a satellite image sourced from Google Maps.\n *\n * \n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_groundPlane)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_groundPlane)]\n *\n * ````javascript\n * import {Viewer, ImagePlane, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-8.31, 42.21, 54.30];\n * viewer.camera.look = [-0.86, 15.40, 14.90];\n * viewer.camera.up = [0.10, 0.83, -0.54];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * xktLoader.load({ // Load IFC model\n * id: \"myModel\",\n * src: \"./models/xkt/Schependomlaan.xkt\",\n * edges: true,\n *\n * rotation: [0, 22, 0], // Rotate, position and scale the model to align it correctly with the ImagePlane\n * position: [-8, 0, 15],\n * scale: [1.1, 1.1, 1.1]\n * });\n *\n * new ImagePlane(viewer.scene, {\n * src: \"./images/schependomlaanSatMap.png\", // Google satellite image; accepted file types are PNG and JPEG\n * visible: true, // Show the ImagePlane\n * gridVisible: true, // Show the grid - grid is only visible when ImagePlane is also visible\n * size: 190, // Size of ImagePlane's longest edge\n * position: [0, -1, 0], // World-space position of ImagePlane's center\n * rotation: [0, 0, 0], // Euler angles for X, Y and Z\n * opacity: 1.0, // Fully opaque\n * collidable: false, // ImagePlane does not contribute to Scene boundary\n * clippable: true, // ImagePlane can be clipped by SectionPlanes\n * pickable: true // Allow the ground plane to be picked\n * });\n * ````\n *
    \n *\n * # Example 2: Embed an image in a cross-section plane\n *\n * In our second example, we'll load the Schependomlaan model again, then slice it in half with\n * a {@link SectionPlanesPlugin}, then use an ````ImagePlane```` to embed a 2D plan view image in the slicing plane.\n *\n * \n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, SectionPlanesPlugin, ImagePlane} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-9.11, 20.01, 5.13];\n * viewer.camera.look = [9.07, 0.77, -9.78];\n * viewer.camera.up = [0.47, 0.76, -0.38];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const sectionPlanes = new SectionPlanesPlugin(viewer, {\n * overviewVisible: false\n * });\n *\n * model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/schependomlaan/schependomlaan.xkt\",\n * metaModelSrc: \"./metaModels/schependomlaan/metaModel.json\",\n * edges: true,\n * });\n *\n * const sectionPlane = sectionPlanes.createSectionPlane({\n * id: \"mySectionPlane\",\n * pos: [10.95, 1.95, -10.35],\n * dir: [0.0, -1.0, 0.0]\n * });\n *\n * const imagePlane = new ImagePlane(viewer.scene, {\n * src: \"./images/schependomlaanPlanView.png\", // Plan view image; accepted file types are PNG and JPEG\n * visible: true,\n * gridVisible: true,\n * size: 23.95,\n * position: sectionPlane.pos,\n * dir: sectionPlane.dir,\n * collidable: false,\n * opacity: 0.75,\n * clippable: false, // Don't allow ImagePlane to be clipped by the SectionPlane\n * pickable: false // Don't allow ImagePlane to be picked\n * });\n * ````\n */\nclass ImagePlane extends Component {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this ````ImagePlane```` as well.\n * @param {*} [cfg] ````ImagePlane```` configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````ImagePlane```` is visible.\n * @param {Boolean} [cfg.gridVisible=true] Indicates whether or not the grid is visible. Grid is only visible when ````ImagePlane```` is also visible.\n * @param {Number[]} [cfg.position=[0,0,0]] World-space position of the ````ImagePlane````.\n * @param {Number[]} [cfg.size=1] World-space size of the longest edge of the ````ImagePlane````. Note that\n * ````ImagePlane```` sets its aspect ratio to match its image. If we set a value of ````1000````, and the image\n * has size ````400x300````, then the ````ImagePlane```` will then have size ````1000 x 750````.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation of the ````ImagePlane````, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Modelling transform matrix for the ````ImagePlane````. Overrides the ````position````, ````size```, ````rotation```` and ````dir```` parameters.\n * @param {Boolean} [cfg.collidable=true] Indicates if the ````ImagePlane```` is initially included in boundary calculations.\n * @param {Boolean} [cfg.clippable=true] Indicates if the ````ImagePlane```` is initially clippable.\n * @param {Boolean} [cfg.pickable=true] Indicates if the ````ImagePlane```` is initially pickable.\n * @param {Number} [cfg.opacity=1.0] ````ImagePlane````'s initial opacity factor, multiplies by the rendered fragment alpha.\n * @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.\n * @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._src = null;\n this._image = null;\n this._pos = math.vec3();\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n this._dir = math.vec3();\n this._size = 1.0;\n this._imageSize = math.vec2();\n\n this._texture = new Texture(this);\n\n this._plane = new Mesh(this, {\n\n geometry: new ReadableGeometry(this, buildPlaneGeometry({\n center: [0, 0, 0],\n xSize: 1,\n zSize: 1,\n xSegments: 10,\n zSegments: 10\n })),\n\n material: new PhongMaterial(this, {\n diffuse: [0, 0, 0],\n ambient: [0, 0, 0],\n specular: [0, 0, 0],\n diffuseMap: this._texture,\n emissiveMap: this._texture,\n backfaces: true\n }),\n clippable: cfg.clippable\n });\n\n this._grid = new Mesh(this, {\n geometry: new ReadableGeometry(this, buildGridGeometry({\n size: 1,\n divisions: 10\n })),\n material: new PhongMaterial(this, {\n diffuse: [0.0, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n emissive: [0.2, 0.8, 0.2]\n }),\n position: [0, 0.001, 0.0],\n clippable: cfg.clippable\n });\n\n this._node = new Node(this, {\n rotation: [0, 0, 0],\n position: [0, 0, 0],\n scale: [1, 1, 1],\n clippable: false,\n children: [\n this._plane,\n this._grid\n ]\n });\n\n this._gridVisible = false;\n\n this.visible = true;\n this.gridVisible = cfg.gridVisible;\n this.position = cfg.position;\n this.rotation = cfg.rotation;\n this.dir = cfg.dir;\n this.size = cfg.size;\n this.collidable = cfg.collidable;\n this.clippable = cfg.clippable;\n this.pickable = cfg.pickable;\n this.opacity = cfg.opacity;\n\n if (cfg.image) {\n this.image = cfg.image;\n } else {\n this.src = cfg.src;\n }\n }\n\n /**\n * Sets if this ````ImagePlane```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} visible Set ````true```` to make this ````ImagePlane```` visible.\n */\n set visible(visible) {\n this._plane.visible = visible;\n this._grid.visible = (this._gridVisible && visible);\n }\n\n /**\n * Gets if this ````ImagePlane```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if visible.\n */\n get visible() {\n return this._plane.visible;\n }\n\n /**\n * Sets if this ````ImagePlane````'s grid is visible or not.\n *\n * Default value is ````false````.\n *\n * Grid is only visible when ````ImagePlane```` is also visible.\n *\n * @param {Boolean} visible Set ````true```` to make this ````ImagePlane````'s grid visible.\n */\n set gridVisible(visible) {\n visible = (visible !== false);\n this._gridVisible = visible;\n this._grid.visible = (this._gridVisible && this.visible);\n }\n\n /**\n * Gets if this ````ImagePlane````'s grid is visible or not.\n *\n * Default value is ````false````.\n *\n * @returns {Boolean} Returns ````true```` if visible.\n */\n get gridVisible() {\n return this._gridVisible;\n }\n\n /**\n * Sets an ````HTMLImageElement```` to source the image from.\n *\n * Sets {@link Texture#src} null.\n *\n * @type {HTMLImageElement}\n */\n set image(image) {\n this._image = image;\n if (this._image) {\n this._imageSize[0] = image.width;\n this._imageSize[1] = image.height;\n this._updatePlaneSizeFromImage();\n this._src = null;\n this._texture.image = this._image;\n }\n }\n\n /**\n * Gets the ````HTMLImageElement```` the ````ImagePlane````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {HTMLImageElement}\n */\n get image() {\n return this._image;\n }\n\n /**\n * Sets an image file path that the ````ImagePlane````'s image is sourced from.\n *\n * Accepted file types are PNG and JPEG.\n *\n * Sets {@link Texture#image} null.\n *\n * @type {String}\n */\n set src(src) {\n this._src = src;\n if (this._src) {\n this._image = null;\n const image = new Image();\n image.onload = () => {\n this._texture.image = image;\n this._imageSize[0] = image.width;\n this._imageSize[1] = image.height;\n this._updatePlaneSizeFromImage();\n };\n image.src = this._src;\n }\n }\n\n /**\n * Gets the image file path that the ````ImagePlane````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {String}\n */\n get src() {\n return this._src;\n }\n\n /**\n * Sets the World-space position of this ````ImagePlane````.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @param {Number[]} value New position.\n */\n set position(value) {\n this._pos.set(value || [0, 0, 0]);\n worldToRTCPos(this._pos, this._origin, this._rtcPos);\n this._node.origin = this._origin;\n this._node.position = this._rtcPos;\n }\n\n /**\n * Gets the World-space position of this ````ImagePlane````.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @returns {Number[]} Current position.\n */\n get position() {\n return this._pos;\n }\n\n /**\n * Sets the direction of this ````ImagePlane```` using Euler angles.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @param {Number[]} value Euler angles for ````X````, ````Y```` and ````Z```` axis rotations.\n */\n set rotation(value) {\n this._node.rotation = value;\n }\n\n /**\n * Gets the direction of this ````ImagePlane```` as Euler angles.\n *\n * @returns {Number[]} Euler angles for ````X````, ````Y```` and ````Z```` axis rotations.\n */\n get rotation() {\n return this._node.rotation;\n }\n\n /**\n * Sets the World-space size of the longest edge of the ````ImagePlane````.\n *\n * Note that ````ImagePlane```` sets its aspect ratio to match its image. If we set a value of ````1000````, and\n * the image has size ````400x300````, then the ````ImagePlane```` will then have size ````1000 x 750````.\n *\n * Default value is ````1.0````.\n *\n * @param {Number} size New World-space size of the ````ImagePlane````.\n */\n set size(size) {\n this._size = (size === undefined || size === null) ? 1.0 : size;\n if (this._image) {\n this._updatePlaneSizeFromImage()\n }\n }\n\n /**\n * Gets the World-space size of the longest edge of the ````ImagePlane````.\n *\n * Returns {Number} World-space size of the ````ImagePlane````.\n */\n get size() {\n return this._size;\n }\n\n /**\n * Sets the direction of this ````ImagePlane```` as a direction vector.\n *\n * Default value is ````[0, 0, -1]````.\n *\n * @param {Number[]} dir New direction vector.\n */\n set dir(dir) {\n\n this._dir.set(dir || [0, 0, -1]);\n\n if (dir) {\n\n const origin = this.scene.center;\n const negDir = [-this._dir[0], -this._dir[1], -this._dir[2]];\n\n math.subVec3(origin, this.position, tempVec3);\n\n const dist = -math.dotVec3(negDir, tempVec3);\n\n math.normalizeVec3(negDir);\n math.mulVec3Scalar(negDir, dist, tempVec3b);\n math.vec3PairToQuaternion(zeroVec, dir, tempQuat);\n\n this._node.quaternion = tempQuat;\n }\n }\n\n /**\n * Gets the direction of this ````ImagePlane```` as a direction vector.\n *\n * @returns {Number[]} value Current direction.\n */\n get dir() {\n return this._dir;\n }\n\n /**\n * Sets if this ````ImagePlane```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set collidable(value) {\n this._node.collidable = (value !== false);\n }\n\n /**\n * Gets if this ````ImagePlane```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._node.collidable;\n }\n\n /**\n * Sets if this ````ImagePlane```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set clippable(value) {\n this._node.clippable = (value !== false);\n }\n\n /**\n * Gets if this ````ImagePlane```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._node.clippable;\n }\n\n /**\n * Sets if this ````ImagePlane```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set pickable(value) {\n this._node.pickable = (value !== false);\n }\n\n /**\n * Gets if this ````ImagePlane```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._node.pickable;\n }\n\n /**\n * Sets the opacity factor for this ````ImagePlane````.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n this._node.opacity = opacity;\n }\n\n /**\n * Gets this ````ImagePlane````'s opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n return this._node.opacity;\n }\n\n /**\n * @destroy\n */\n destroy() {\n super.destroy();\n }\n\n _updatePlaneSizeFromImage() {\n const size = this._size;\n const width = this._imageSize[0];\n const height = this._imageSize[1];\n if (width > height) {\n const aspect = height / width;\n this._node.scale = [size, 1.0, size * aspect];\n } else {\n const aspect = width / height;\n this._node.scale = [size * aspect, 1.0, size];\n }\n }\n}\n\nexport {ImagePlane};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/ImagePlane/ImagePlane.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/ImagePlane/ImagePlane.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2744, + "__docId__": 2752, "kind": "variable", "name": "tempVec3", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54078,7 +54294,7 @@ "ignore": true }, { - "__docId__": 2745, + "__docId__": 2753, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54099,7 +54315,7 @@ "ignore": true }, { - "__docId__": 2746, + "__docId__": 2754, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54120,7 +54336,7 @@ "ignore": true }, { - "__docId__": 2747, + "__docId__": 2755, "kind": "variable", "name": "zeroVec", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54141,7 +54357,7 @@ "ignore": true }, { - "__docId__": 2748, + "__docId__": 2756, "kind": "variable", "name": "tempQuat", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54162,7 +54378,7 @@ "ignore": true }, { - "__docId__": 2749, + "__docId__": 2757, "kind": "class", "name": "ImagePlane", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js", @@ -54180,7 +54396,7 @@ ] }, { - "__docId__": 2750, + "__docId__": 2758, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54396,7 +54612,7 @@ ] }, { - "__docId__": 2751, + "__docId__": 2759, "kind": "member", "name": "_src", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54414,7 +54630,7 @@ } }, { - "__docId__": 2752, + "__docId__": 2760, "kind": "member", "name": "_image", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54432,7 +54648,7 @@ } }, { - "__docId__": 2753, + "__docId__": 2761, "kind": "member", "name": "_pos", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54450,7 +54666,7 @@ } }, { - "__docId__": 2754, + "__docId__": 2762, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54468,7 +54684,7 @@ } }, { - "__docId__": 2755, + "__docId__": 2763, "kind": "member", "name": "_rtcPos", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54486,7 +54702,7 @@ } }, { - "__docId__": 2756, + "__docId__": 2764, "kind": "member", "name": "_dir", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54504,7 +54720,7 @@ } }, { - "__docId__": 2757, + "__docId__": 2765, "kind": "member", "name": "_size", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54522,7 +54738,7 @@ } }, { - "__docId__": 2758, + "__docId__": 2766, "kind": "member", "name": "_imageSize", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54540,7 +54756,7 @@ } }, { - "__docId__": 2759, + "__docId__": 2767, "kind": "member", "name": "_texture", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54558,7 +54774,7 @@ } }, { - "__docId__": 2760, + "__docId__": 2768, "kind": "member", "name": "_plane", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54576,7 +54792,7 @@ } }, { - "__docId__": 2761, + "__docId__": 2769, "kind": "member", "name": "_grid", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54594,7 +54810,7 @@ } }, { - "__docId__": 2762, + "__docId__": 2770, "kind": "member", "name": "_node", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54612,7 +54828,7 @@ } }, { - "__docId__": 2763, + "__docId__": 2771, "kind": "member", "name": "_gridVisible", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54630,7 +54846,7 @@ } }, { - "__docId__": 2776, + "__docId__": 2784, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54655,7 +54871,7 @@ ] }, { - "__docId__": 2777, + "__docId__": 2785, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54687,7 +54903,7 @@ } }, { - "__docId__": 2778, + "__docId__": 2786, "kind": "set", "name": "gridVisible", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54712,7 +54928,7 @@ ] }, { - "__docId__": 2780, + "__docId__": 2788, "kind": "get", "name": "gridVisible", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54744,7 +54960,7 @@ } }, { - "__docId__": 2781, + "__docId__": 2789, "kind": "set", "name": "image", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54765,7 +54981,7 @@ } }, { - "__docId__": 2784, + "__docId__": 2792, "kind": "get", "name": "image", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54786,7 +55002,7 @@ } }, { - "__docId__": 2785, + "__docId__": 2793, "kind": "set", "name": "src", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54807,7 +55023,7 @@ } }, { - "__docId__": 2788, + "__docId__": 2796, "kind": "get", "name": "src", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54828,7 +55044,7 @@ } }, { - "__docId__": 2789, + "__docId__": 2797, "kind": "set", "name": "position", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54853,7 +55069,7 @@ ] }, { - "__docId__": 2790, + "__docId__": 2798, "kind": "get", "name": "position", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54885,7 +55101,7 @@ } }, { - "__docId__": 2791, + "__docId__": 2799, "kind": "set", "name": "rotation", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54910,7 +55126,7 @@ ] }, { - "__docId__": 2792, + "__docId__": 2800, "kind": "get", "name": "rotation", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54942,7 +55158,7 @@ } }, { - "__docId__": 2793, + "__docId__": 2801, "kind": "set", "name": "size", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54967,7 +55183,7 @@ ] }, { - "__docId__": 2795, + "__docId__": 2803, "kind": "get", "name": "size", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -54985,7 +55201,7 @@ } }, { - "__docId__": 2796, + "__docId__": 2804, "kind": "set", "name": "dir", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55010,7 +55226,7 @@ ] }, { - "__docId__": 2797, + "__docId__": 2805, "kind": "get", "name": "dir", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55042,7 +55258,7 @@ } }, { - "__docId__": 2798, + "__docId__": 2806, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55063,7 +55279,7 @@ } }, { - "__docId__": 2799, + "__docId__": 2807, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55084,7 +55300,7 @@ } }, { - "__docId__": 2800, + "__docId__": 2808, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55105,7 +55321,7 @@ } }, { - "__docId__": 2801, + "__docId__": 2809, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55126,7 +55342,7 @@ } }, { - "__docId__": 2802, + "__docId__": 2810, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55147,7 +55363,7 @@ } }, { - "__docId__": 2803, + "__docId__": 2811, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55168,7 +55384,7 @@ } }, { - "__docId__": 2804, + "__docId__": 2812, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55189,7 +55405,7 @@ } }, { - "__docId__": 2805, + "__docId__": 2813, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55210,7 +55426,7 @@ } }, { - "__docId__": 2806, + "__docId__": 2814, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55231,7 +55447,7 @@ "return": null }, { - "__docId__": 2807, + "__docId__": 2815, "kind": "method", "name": "_updatePlaneSizeFromImage", "memberof": "src/viewer/scene/ImagePlane/ImagePlane.js~ImagePlane", @@ -55248,29 +55464,29 @@ "return": null }, { - "__docId__": 2808, + "__docId__": 2816, "kind": "file", "name": "src/viewer/scene/ImagePlane/index.js", "content": "export * from \"./ImagePlane.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/ImagePlane/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/ImagePlane/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2809, + "__docId__": 2817, "kind": "file", "name": "src/viewer/scene/LineSet/LineSet.js", "content": "import {Component} from '../Component.js';\nimport {SceneModel} from \"../model/SceneModel.js\";\n\n/**\n * A set of 3D line segments.\n *\n * * Creates a set of 3D line segments.\n * * Registered by {@link LineSet#id} in {@link Scene#lineSets}.\n * * Configure color using the {@link LinesMaterial} located at {@link Scene#linesMaterial}.\n * * {@link BCFViewpointsPlugin} will save and load Linesets in BCF viewpoints.\n *\n * ## Usage\n *\n * In the example below, we'll load the Schependomlaan model, then use\n * a ````LineSet```` to show a grid underneath the model.\n *\n * [](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#LineSet_grid)\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#LineSet_grid)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, LineSet, buildGridGeometry} from \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * const camera = viewer.camera;\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/xkt/v8/ifc/Schependomlaan.ifc.xkt\",\n * position: [0,1,0],\n * edges: true,\n * saoEnabled: true\n * });\n *\n * const geometryArrays = buildGridGeometry({\n * size: 100,\n * divisions: 30\n * });\n *\n * new LineSet(viewer.scene, {\n * positions: geometryArrays.positions,\n * indices: geometryArrays.indices\n * });\n * ````\n */\nclass LineSet extends Component {\n\n /**\n * Creates a new LineSet.\n *\n * Registers the LineSet in {@link Scene#lineSets}; causes Scene to fire a \"lineSetCreated\" event.\n *\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this ````LineSet```` as well.\n * @param {*} [cfg] ````LineSet```` configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} cfg.positions World-space 3D vertex positions.\n * @param {Number[]} [cfg.indices] Indices to connect ````positions```` into line segments. Note that these are separate line segments, not a polyline.\n * @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.\n * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.\n * @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._positions = cfg.positions || [];\n\n if (cfg.indices) {\n this._indices = cfg.indices;\n } else {\n this._indices = [];\n for (let i = 0, len = (this._positions.length / 3) - 1; i < len; i += 2) {\n this._indices.push(i);\n this._indices.push(i + 1);\n }\n }\n\n this._sceneModel = new SceneModel(this, {\n isModel: false // Don't register in Scene.models\n });\n\n this._sceneModel.createMesh({\n id: \"linesMesh\",\n primitive: \"lines\",\n positions: this._positions,\n indices: this._indices\n })\n\n this._sceneModel.createEntity({\n meshIds: [\"linesMesh\"],\n visible: cfg.visible,\n clippable: cfg.clippable,\n collidable: cfg.collidable\n });\n\n this._sceneModel.finalize();\n\n this.scene._lineSetCreated(this);\n }\n\n /**\n * Sets if this ````LineSet```` is visible.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} visible Set ````true```` to make this ````LineSet```` visible.\n */\n set visible(visible) {\n this._sceneModel.visible = visible;\n }\n\n /**\n * Gets if this ````LineSet```` is visible.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if visible.\n */\n get visible() {\n return this._sceneModel.visible;\n }\n\n /**\n * Gets the 3D World-space vertex positions of the lines in this ````LineSet````.\n *\n * @returns {Number[]}\n */\n get positions() {\n return this._positions;\n }\n\n /**\n * Gets the vertex indices of the lines in this ````LineSet````.\n *\n * @returns {Number[]}\n */\n get indices() {\n return this._indices;\n }\n\n /**\n * Destroys this ````LineSet````.\n *\n * Removes the ```LineSet```` from {@link Scene#lineSets}; causes Scene to fire a \"lineSetDestroyed\" event.\n */\n destroy() {\n super.destroy(); // destroyes _sceneModel\n this.scene._lineSetDestroyed(this);\n }\n}\n\nexport {LineSet};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/LineSet/LineSet.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/LineSet/LineSet.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2810, + "__docId__": 2818, "kind": "class", "name": "LineSet", "memberof": "src/viewer/scene/LineSet/LineSet.js", @@ -55288,7 +55504,7 @@ ] }, { - "__docId__": 2811, + "__docId__": 2819, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55399,7 +55615,7 @@ ] }, { - "__docId__": 2812, + "__docId__": 2820, "kind": "member", "name": "_positions", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55417,7 +55633,7 @@ } }, { - "__docId__": 2813, + "__docId__": 2821, "kind": "member", "name": "_indices", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55435,7 +55651,7 @@ } }, { - "__docId__": 2815, + "__docId__": 2823, "kind": "member", "name": "_sceneModel", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55453,7 +55669,7 @@ } }, { - "__docId__": 2816, + "__docId__": 2824, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55478,7 +55694,7 @@ ] }, { - "__docId__": 2817, + "__docId__": 2825, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55510,7 +55726,7 @@ } }, { - "__docId__": 2818, + "__docId__": 2826, "kind": "get", "name": "positions", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55542,7 +55758,7 @@ } }, { - "__docId__": 2819, + "__docId__": 2827, "kind": "get", "name": "indices", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55574,7 +55790,7 @@ } }, { - "__docId__": 2820, + "__docId__": 2828, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/LineSet/LineSet.js~LineSet", @@ -55589,29 +55805,29 @@ "return": null }, { - "__docId__": 2821, + "__docId__": 2829, "kind": "file", "name": "src/viewer/scene/LineSet/index.js", "content": "export * from \"./LineSet.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/LineSet/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/LineSet/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2822, + "__docId__": 2830, "kind": "file", "name": "src/viewer/scene/camera/Camera.js", "content": "import {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {Perspective} from './Perspective.js';\nimport {Ortho} from './Ortho.js';\nimport {Frustum} from './Frustum.js';\nimport {CustomProjection} from './CustomProjection.js';\n\nconst tempVec3 = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempVec3e = math.vec3();\nconst tempVec3f = math.vec3();\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\nconst tempVec4c = math.vec4();\nconst tempMat = math.mat4();\nconst tempMatb = math.mat4();\nconst eyeLookVec = math.vec3();\nconst eyeLookVecNorm = math.vec3();\nconst eyeLookOffset = math.vec3();\nconst offsetEye = math.vec3();\n\n/**\n * @desc Manages viewing and projection transforms for its {@link Scene}.\n *\n * * One Camera per {@link Scene}\n * * Scene is located at {@link Viewer#scene} and Camera is located at {@link Scene#camera}\n * * Controls viewing and projection transforms\n * * Has methods to pan, zoom and orbit (or first-person rotation)\n * * Dynamically configurable World-space axis\n * * Has {@link Perspective}, {@link Ortho} and {@link Frustum} and {@link CustomProjection}, which you can dynamically switch it between\n * * Switchable gimbal lock\n * * Can be \"flown\" to look at targets using a {@link CameraFlightAnimation}\n * * Can be animated along a path using a {@link CameraPathAnimation}\n *\n * ## Getting the Camera\n *\n * There is exactly one Camera per {@link Scene}:\n *\n * ````javascript\n * import {Viewer} from \"xeokit-sdk.es.js\";\n *\n * var camera = viewer.scene.camera;\n *\n * ````\n *\n * ## Setting the Camera Position\n *\n * Get and set the Camera's absolute position via {@link Camera#eye}, {@link Camera#look} and {@link Camera#up}:\n *\n * ````javascript\n * camera.eye = [-10,0,0];\n * camera.look = [-10,0,0];\n * camera.up = [0,1,0];\n * ````\n *\n * ## Camera View and Projection Matrices\n *\n * The Camera's view matrix transforms coordinates from World-space to View-space.\n *\n * Getting the view matrix:\n *\n * ````javascript\n * var viewMatrix = camera.viewMatrix;\n * var viewNormalMatrix = camera.normalMatrix;\n * ````\n *\n * The Camera's view normal matrix transforms normal vectors from World-space to View-space.\n *\n * Getting the view normal matrix:\n *\n * ````javascript\n * var viewNormalMatrix = camera.normalMatrix;\n * ````\n *\n * The Camera fires a ````\"viewMatrix\"```` event whenever the {@link Camera#viewMatrix} and {@link Camera#viewNormalMatrix} updates.\n *\n * Listen for view matrix updates:\n *\n * ````javascript\n * camera.on(\"viewMatrix\", function(matrix) { ... });\n * ````\n *\n * ## Rotating the Camera\n *\n * Orbiting the {@link Camera#look} position:\n *\n * ````javascript\n * camera.orbitYaw(20.0);\n * camera.orbitPitch(10.0);\n * ````\n *\n * First-person rotation, rotates {@link Camera#look} and {@link Camera#up} about {@link Camera#eye}:\n *\n * ````javascript\n * camera.yaw(5.0);\n * camera.pitch(-10.0);\n * ````\n *\n * ## Panning the Camera\n *\n * Panning along the Camera's local axis (ie. left/right, up/down, forward/backward):\n *\n * ````javascript\n * camera.pan([-20, 0, 10]);\n * ````\n *\n * ## Zooming the Camera\n *\n * Zoom to vary distance between {@link Camera#eye} and {@link Camera#look}:\n *\n * ````javascript\n * camera.zoom(-5); // Move five units closer\n * ````\n *\n * Get the current distance between {@link Camera#eye} and {@link Camera#look}:\n *\n * ````javascript\n * var distance = camera.eyeLookDist;\n * ````\n *\n * ## Projection\n *\n * The Camera has a Component to manage each projection type, which are: {@link Perspective}, {@link Ortho}\n * and {@link Frustum} and {@link CustomProjection}.\n *\n * You can configure those components at any time, regardless of which is currently active:\n *\n * The Camera has a {@link Perspective} to manage perspective\n * ````javascript\n *\n * // Set some properties on Perspective\n * camera.perspective.near = 0.4;\n * camera.perspective.fov = 45;\n *\n * // Set some properties on Ortho\n * camera.ortho.near = 0.8;\n * camera.ortho.far = 1000;\n *\n * // Set some properties on Frustum\n * camera.frustum.left = -1.0;\n * camera.frustum.right = 1.0;\n * camera.frustum.far = 1000.0;\n *\n * // Set the matrix property on CustomProjection\n * camera.customProjection.matrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n *\n * // Switch between the projection types\n * camera.projection = \"perspective\"; // Switch to perspective\n * camera.projection = \"frustum\"; // Switch to frustum\n * camera.projection = \"ortho\"; // Switch to ortho\n * camera.projection = \"customProjection\"; // Switch to custom\n * ````\n *\n * Camera provides the projection matrix for the currently active projection in {@link Camera#projMatrix}.\n *\n * Get the projection matrix:\n *\n * ````javascript\n * var projMatrix = camera.projMatrix;\n * ````\n *\n * Listen for projection matrix updates:\n *\n * ````javascript\n * camera.on(\"projMatrix\", function(matrix) { ... });\n * ````\n *\n * ## Configuring World up direction\n *\n * We can dynamically configure the directions of the World-space coordinate system.\n *\n * Setting the +Y axis as World \"up\", +X as right and -Z as forwards (convention in some modeling software):\n *\n * ````javascript\n * camera.worldAxis = [\n * 1, 0, 0, // Right\n * 0, 1, 0, // Up\n * 0, 0,-1 // Forward\n * ];\n * ````\n *\n * Setting the +Z axis as World \"up\", +X as right and -Y as \"up\" (convention in most CAD and BIM viewers):\n *\n * ````javascript\n * camera.worldAxis = [\n * 1, 0, 0, // Right\n * 0, 0, 1, // Up\n * 0,-1, 0 // Forward\n * ];\n * ````\n *\n * The Camera has read-only convenience properties that provide each axis individually:\n *\n * ````javascript\n * var worldRight = camera.worldRight;\n * var worldForward = camera.worldForward;\n * var worldUp = camera.worldUp;\n * ````\n *\n * ### Gimbal locking\n *\n * By default, the Camera locks yaw rotation to pivot about the World-space \"up\" axis. We can dynamically lock and unlock that at any time:\n *\n * ````javascript\n * camera.gimbalLock = false; // Yaw rotation now happens about Camera's local Y-axis\n * camera.gimbalLock = true; // Yaw rotation now happens about World's \"up\" axis\n * ````\n *\n * See: https://en.wikipedia.org/wiki/Gimbal_lock\n */\nclass Camera extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Camera\";\n }\n\n /**\n * @constructor\n * @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n deviceMatrix: math.mat4(),\n hasDeviceMatrix: false, // True when deviceMatrix set to other than identity\n matrix: math.mat4(),\n normalMatrix: math.mat4(),\n inverseMatrix: math.mat4()\n });\n\n this._perspective = new Perspective(this);\n this._ortho = new Ortho(this);\n this._frustum = new Frustum(this);\n this._customProjection = new CustomProjection(this);\n this._project = this._perspective;\n\n this._eye = math.vec3([0, 0, 10.0]);\n this._look = math.vec3([0, 0, 0]);\n this._up = math.vec3([0, 1, 0]);\n\n this._worldUp = math.vec3([0, 1, 0]);\n this._worldRight = math.vec3([1, 0, 0]);\n this._worldForward = math.vec3([0, 0, -1]);\n\n this.deviceMatrix = cfg.deviceMatrix;\n this.eye = cfg.eye;\n this.look = cfg.look;\n this.up = cfg.up;\n this.worldAxis = cfg.worldAxis;\n this.gimbalLock = cfg.gimbalLock;\n this.constrainPitch = cfg.constrainPitch;\n\n this.projection = cfg.projection;\n\n this._perspective.on(\"matrix\", () => {\n if (this._projectionType === \"perspective\") {\n this.fire(\"projMatrix\", this._perspective.matrix);\n }\n });\n this._ortho.on(\"matrix\", () => {\n if (this._projectionType === \"ortho\") {\n this.fire(\"projMatrix\", this._ortho.matrix);\n }\n });\n this._frustum.on(\"matrix\", () => {\n if (this._projectionType === \"frustum\") {\n this.fire(\"projMatrix\", this._frustum.matrix);\n }\n });\n this._customProjection.on(\"matrix\", () => {\n if (this._projectionType === \"customProjection\") {\n this.fire(\"projMatrix\", this._customProjection.matrix);\n }\n });\n }\n\n _update() {\n const state = this._state;\n // In ortho mode, build the view matrix with an eye position that's translated\n // well back from look, so that the front sectionPlane plane doesn't unexpectedly cut\n // the front off the view (not a problem with perspective, since objects close enough\n // to be clipped by the front plane are usually too big to see anything of their cross-sections).\n let eye;\n if (this.projection === \"ortho\") {\n math.subVec3(this._eye, this._look, eyeLookVec);\n math.normalizeVec3(eyeLookVec, eyeLookVecNorm);\n math.mulVec3Scalar(eyeLookVecNorm, 1000.0, eyeLookOffset);\n math.addVec3(this._look, eyeLookOffset, offsetEye);\n eye = offsetEye;\n } else {\n eye = this._eye;\n }\n if (state.hasDeviceMatrix) {\n math.lookAtMat4v(eye, this._look, this._up, tempMatb);\n math.mulMat4(state.deviceMatrix, tempMatb, state.matrix);\n //state.matrix.set(state.deviceMatrix);\n } else {\n math.lookAtMat4v(eye, this._look, this._up, state.matrix);\n }\n math.inverseMat4(this._state.matrix, this._state.inverseMatrix);\n math.transposeMat4(this._state.inverseMatrix, this._state.normalMatrix);\n this.glRedraw();\n this.fire(\"matrix\", this._state.matrix);\n this.fire(\"viewMatrix\", this._state.matrix);\n }\n\n /**\n * Rotates {@link Camera#eye} about {@link Camera#look}, around the {@link Camera#up} vector\n *\n * @param {Number} angleInc Angle of rotation in degrees\n */\n orbitYaw(angleInc) {\n let lookEyeVec = math.subVec3(this._eye, this._look, tempVec3);\n math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);\n lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b);\n this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c); // Set eye position as 'look' plus 'eye' vector\n this.up = math.transformPoint3(tempMat, this._up, tempVec3d); // Rotate 'up' vector\n }\n\n /**\n * Rotates {@link Camera#eye} about {@link Camera#look} around the right axis (orthogonal to {@link Camera#up} and \"look\").\n *\n * @param {Number} angleInc Angle of rotation in degrees\n */\n orbitPitch(angleInc) {\n if (this._constrainPitch) {\n angleInc = math.dotVec3(this._up, this._worldUp) / math.DEGTORAD;\n if (angleInc < 1) {\n return;\n }\n }\n let eye2 = math.subVec3(this._eye, this._look, tempVec3);\n const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b), math.normalizeVec3(this._up, tempVec3c));\n math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);\n eye2 = math.transformPoint3(tempMat, eye2, tempVec3d);\n this.up = math.transformPoint3(tempMat, this._up, tempVec3e);\n this.eye = math.addVec3(eye2, this._look, tempVec3f);\n }\n\n /**\n * Rotates {@link Camera#look} about {@link Camera#eye}, around the {@link Camera#up} vector.\n *\n * @param {Number} angleInc Angle of rotation in degrees\n */\n yaw(angleInc) {\n let look2 = math.subVec3(this._look, this._eye, tempVec3);\n math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);\n look2 = math.transformPoint3(tempMat, look2, tempVec3b);\n this.look = math.addVec3(look2, this._eye, tempVec3c);\n if (this._gimbalLock) {\n this.up = math.transformPoint3(tempMat, this._up, tempVec3d);\n }\n }\n\n /**\n * Rotates {@link Camera#look} about {@link Camera#eye}, around the right axis (orthogonal to {@link Camera#up} and \"look\").\n\n * @param {Number} angleInc Angle of rotation in degrees\n */\n pitch(angleInc) {\n if (this._constrainPitch) {\n angleInc = math.dotVec3(this._up, this._worldUp) / math.DEGTORAD;\n if (angleInc < 1) {\n return;\n }\n }\n let look2 = math.subVec3(this._look, this._eye, tempVec3);\n const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b), math.normalizeVec3(this._up, tempVec3c));\n math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);\n this.up = math.transformPoint3(tempMat, this._up, tempVec3f);\n look2 = math.transformPoint3(tempMat, look2, tempVec3d);\n this.look = math.addVec3(look2, this._eye, tempVec3e);\n }\n\n /**\n * Pans the Camera along its local X, Y and Z axis.\n *\n * @param pan The pan vector\n */\n pan(pan) {\n const eye2 = math.subVec3(this._eye, this._look, tempVec3);\n const vec = [0, 0, 0];\n let v;\n if (pan[0] !== 0) {\n const left = math.cross3Vec3(math.normalizeVec3(eye2, []), math.normalizeVec3(this._up, tempVec3b));\n v = math.mulVec3Scalar(left, pan[0]);\n vec[0] += v[0];\n vec[1] += v[1];\n vec[2] += v[2];\n }\n if (pan[1] !== 0) {\n v = math.mulVec3Scalar(math.normalizeVec3(this._up, tempVec3c), pan[1]);\n vec[0] += v[0];\n vec[1] += v[1];\n vec[2] += v[2];\n }\n if (pan[2] !== 0) {\n v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d), pan[2]);\n vec[0] += v[0];\n vec[1] += v[1];\n vec[2] += v[2];\n }\n this.eye = math.addVec3(this._eye, vec, tempVec3e);\n this.look = math.addVec3(this._look, vec, tempVec3f);\n }\n\n /**\n * Increments/decrements the Camera's zoom factor, which is the distance between {@link Camera#eye} and {@link Camera#look}.\n *\n * @param {Number} delta Zoom factor increment.\n */\n zoom(delta) {\n const vec = math.subVec3(this._eye, this._look, tempVec3);\n const lenLook = Math.abs(math.lenVec3(vec, tempVec3b));\n const newLenLook = Math.abs(lenLook + delta);\n if (newLenLook < 0.5) {\n return;\n }\n const dir = math.normalizeVec3(vec, tempVec3c);\n this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d);\n }\n\n /**\n * Sets the position of the Camera's eye.\n *\n * Default value is ````[0,0,10]````.\n *\n * @emits \"eye\" event on change, with the value of this property.\n * @type {Number[]} New eye position.\n */\n set eye(eye) {\n this._eye.set(eye || [0, 0, 10]);\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"eye\", this._eye);\n }\n\n /**\n * Gets the position of the Camera's eye.\n *\n * Default vale is ````[0,0,10]````.\n *\n * @type {Number[]} New eye position.\n */\n get eye() {\n return this._eye;\n }\n\n /**\n * Sets the position of this Camera's point-of-interest.\n *\n * Default value is ````[0,0,0]````.\n *\n * @emits \"look\" event on change, with the value of this property.\n *\n * @param {Number[]} look Camera look position.\n */\n set look(look) {\n this._look.set(look || [0, 0, 0]);\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"look\", this._look);\n }\n\n /**\n * Gets the position of this Camera's point-of-interest.\n *\n * Default value is ````[0,0,0]````.\n *\n * @returns {Number[]} Camera look position.\n */\n get look() {\n return this._look;\n }\n\n /**\n * Sets the direction of this Camera's {@link Camera#up} vector.\n *\n * @emits \"up\" event on change, with the value of this property.\n *\n * @param {Number[]} up Direction of \"up\".\n */\n set up(up) {\n this._up.set(up || [0, 1, 0]);\n this._needUpdate(0);\n this.fire(\"up\", this._up);\n }\n\n /**\n * Gets the direction of this Camera's {@link Camera#up} vector.\n *\n * @returns {Number[]} Direction of \"up\".\n */\n get up() {\n return this._up;\n }\n\n /**\n * Sets an optional matrix to premultiply into {@link Camera#matrix} matrix.\n *\n * This is intended to be used for stereo rendering with WebVR etc.\n *\n * @param {Number[]} matrix The matrix.\n */\n set deviceMatrix(matrix) {\n this._state.deviceMatrix.set(matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n this._state.hasDeviceMatrix = !!matrix;\n this._needUpdate(0);\n this.fire(\"deviceMatrix\", this._state.deviceMatrix);\n }\n\n /**\n * Gets an optional matrix to premultiply into {@link Camera#matrix} matrix.\n *\n * @returns {Number[]} The matrix.\n */\n get deviceMatrix() {\n return this._state.deviceMatrix;\n }\n\n /**\n * Sets the up, right and forward axis of the World coordinate system.\n *\n * Has format: ````[rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]````\n *\n * Default axis is ````[1, 0, 0, 0, 1, 0, 0, 0, 1]````\n *\n * @param {Number[]} axis The new Wworld coordinate axis.\n */\n set worldAxis(axis) {\n axis = axis || [1, 0, 0, 0, 1, 0, 0, 0, 1];\n if (!this._worldAxis) {\n this._worldAxis = math.vec3(axis);\n } else {\n this._worldAxis.set(axis);\n }\n this._worldRight[0] = this._worldAxis[0];\n this._worldRight[1] = this._worldAxis[1];\n this._worldRight[2] = this._worldAxis[2];\n this._worldUp[0] = this._worldAxis[3];\n this._worldUp[1] = this._worldAxis[4];\n this._worldUp[2] = this._worldAxis[5];\n this._worldForward[0] = this._worldAxis[6];\n this._worldForward[1] = this._worldAxis[7];\n this._worldForward[2] = this._worldAxis[8];\n this.fire(\"worldAxis\", this._worldAxis);\n }\n\n /**\n * Gets the up, right and forward axis of the World coordinate system.\n *\n * Has format: ````[rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]````\n *\n * Default axis is ````[1, 0, 0, 0, 1, 0, 0, 0, 1]````\n *\n * @returns {Number[]} The current World coordinate axis.\n */\n get worldAxis() {\n return this._worldAxis;\n }\n\n /**\n * Gets the direction of World-space \"up\".\n *\n * This is set by {@link Camera#worldAxis}.\n *\n * Default value is ````[0,1,0]````.\n *\n * @returns {Number[]} The \"up\" vector.\n */\n get worldUp() {\n return this._worldUp;\n }\n\n /**\n * Gets if the World-space X-axis is \"up\".\n * @returns {Boolean}\n */\n get xUp() {\n return this._worldUp[0] > this._worldUp[1] && this._worldUp[0] > this._worldUp[2];\n }\n\n /**\n * Gets if the World-space Y-axis is \"up\".\n * @returns {Boolean}\n */\n get yUp() {\n return this._worldUp[1] > this._worldUp[0] && this._worldUp[1] > this._worldUp[2];\n }\n\n /**\n * Gets if the World-space Z-axis is \"up\".\n * @returns {Boolean}\n */\n get zUp() {\n return this._worldUp[2] > this._worldUp[0] && this._worldUp[2] > this._worldUp[1];\n }\n\n /**\n * Gets the direction of World-space \"right\".\n *\n * This is set by {@link Camera#worldAxis}.\n *\n * Default value is ````[1,0,0]````.\n *\n * @returns {Number[]} The \"up\" vector.\n */\n get worldRight() {\n return this._worldRight;\n }\n\n /**\n * Gets the direction of World-space \"forwards\".\n *\n * This is set by {@link Camera#worldAxis}.\n *\n * Default value is ````[0,0,1]````.\n *\n * @returns {Number[]} The \"up\" vector.\n */\n get worldForward() {\n return this._worldForward;\n }\n\n /**\n * Sets whether to lock yaw rotation to pivot about the World-space \"up\" axis.\n *\n * Fires a {@link Camera#gimbalLock:event} event on change.\n *\n * @params {Boolean} gimbalLock Set true to lock gimbal.\n */\n set gimbalLock(value) {\n this._gimbalLock = value !== false;\n this.fire(\"gimbalLock\", this._gimbalLock);\n }\n\n /**\n * Gets whether to lock yaw rotation to pivot about the World-space \"up\" axis.\n *\n * @returns {Boolean} Returns ````true```` if gimbal is locked.\n */\n get gimbalLock() {\n return this._gimbalLock;\n }\n\n /**\n * Sets whether to prevent camera from being pitched upside down.\n *\n * The camera is upside down when the angle between {@link Camera#up} and {@link Camera#worldUp} is less than one degree.\n *\n * Fires a {@link Camera#constrainPitch:event} event on change.\n *\n * Default value is ````false````.\n *\n * @param {Boolean} value Set ````true```` to contrain pitch rotation.\n */\n set constrainPitch(value) {\n this._constrainPitch = !!value;\n this.fire(\"constrainPitch\", this._constrainPitch);\n }\n\n /**\n * Gets whether to prevent camera from being pitched upside down.\n *\n * The camera is upside down when the angle between {@link Camera#up} and {@link Camera#worldUp} is less than one degree.\n *\n * Default value is ````false````.\n *\n * @returns {Boolean} ````true```` if pitch rotation is currently constrained.\n get constrainPitch() {\n return this._constrainPitch;\n }\n\n /**\n * Gets distance from {@link Camera#look} to {@link Camera#eye}.\n *\n * @returns {Number} The distance.\n */\n get eyeLookDist() {\n return math.lenVec3(math.subVec3(this._look, this._eye, tempVec3));\n }\n\n /**\n * Gets the Camera's viewing transformation matrix.\n *\n * Fires a {@link Camera#matrix:event} event on change.\n *\n * @returns {Number[]} The viewing transform matrix.\n */\n get matrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.matrix;\n }\n\n /**\n * Gets the Camera's viewing transformation matrix.\n *\n * Fires a {@link Camera#matrix:event} event on change.\n *\n * @returns {Number[]} The viewing transform matrix.\n */\n get viewMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.matrix;\n }\n\n /**\n * The Camera's viewing normal transformation matrix.\n *\n * Fires a {@link Camera#matrix:event} event on change.\n *\n * @returns {Number[]} The viewing normal transform matrix.\n */\n get normalMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.normalMatrix;\n }\n\n /**\n * The Camera's viewing normal transformation matrix.\n *\n * Fires a {@link Camera#matrix:event} event on change.\n *\n * @returns {Number[]} The viewing normal transform matrix.\n */\n get viewNormalMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.normalMatrix;\n }\n\n /**\n * Gets the inverse of the Camera's viewing transform matrix.\n *\n * This has the same value as {@link Camera#normalMatrix}.\n *\n * @returns {Number[]} The inverse viewing transform matrix.\n */\n get inverseViewMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.inverseMatrix;\n }\n\n /**\n * Gets the Camera's projection transformation projMatrix.\n *\n * Fires a {@link Camera#projMatrix:event} event on change.\n *\n * @returns {Number[]} The projection matrix.\n */\n get projMatrix() {\n return this[this.projection].matrix;\n }\n\n /**\n * Gets the Camera's perspective projection.\n *\n * The Camera uses this while {@link Camera#projection} equals ````perspective````.\n *\n * @returns {Perspective} The Perspective component.\n */\n get perspective() {\n return this._perspective;\n }\n\n /**\n * Gets the Camera's orthographic projection.\n *\n * The Camera uses this while {@link Camera#projection} equals ````ortho````.\n *\n * @returns {Ortho} The Ortho component.\n */\n get ortho() {\n return this._ortho;\n }\n\n /**\n * Gets the Camera's frustum projection.\n *\n * The Camera uses this while {@link Camera#projection} equals ````frustum````.\n *\n * @returns {Frustum} The Ortho component.\n */\n get frustum() {\n return this._frustum;\n }\n\n /**\n * Gets the Camera's custom projection.\n *\n * This is used while {@link Camera#projection} equals \"customProjection\".\n *\n * @returns {CustomProjection} The custom projection.\n */\n get customProjection() {\n return this._customProjection;\n }\n\n /**\n * Sets the active projection type.\n *\n * Accepted values are ````\"perspective\"````, ````\"ortho\"````, ````\"frustum\"```` and ````\"customProjection\"````.\n *\n * Default value is ````\"perspective\"````.\n *\n * @param {String} value Identifies the active projection type.\n */\n set projection(value) {\n value = value || \"perspective\";\n if (this._projectionType === value) {\n return;\n }\n if (value === \"perspective\") {\n this._project = this._perspective;\n } else if (value === \"ortho\") {\n this._project = this._ortho;\n } else if (value === \"frustum\") {\n this._project = this._frustum;\n } else if (value === \"customProjection\") {\n this._project = this._customProjection;\n } else {\n this.error(\"Unsupported value for 'projection': \" + value + \" defaulting to 'perspective'\");\n this._project = this._perspective;\n value = \"perspective\";\n }\n this._project._update();\n this._projectionType = value;\n this.glRedraw();\n this._update(); // Need to rebuild lookat matrix with full eye, look & up\n this.fire(\"dirty\");\n this.fire(\"projection\", this._projectionType);\n this.fire(\"projMatrix\", this._project.matrix);\n }\n\n /**\n * Gets the active projection type.\n *\n * Possible values are ````\"perspective\"````, ````\"ortho\"````, ````\"frustum\"```` and ````\"customProjection\"````.\n *\n * Default value is ````\"perspective\"````.\n *\n * @returns {String} Identifies the active projection type.\n */\n get projection() {\n return this._projectionType;\n }\n\n /**\n * Gets the currently active projection for this Camera.\n *\n * The currently active project is selected with {@link Camera#projection}.\n *\n * @returns {Perspective|Ortho|Frustum|CustomProjection} The currently active projection is active.\n */\n get project() {\n return this._project;\n }\n\n /**\n * Get the 2D canvas position of a 3D world position.\n *\n * @param {[number, number, number]} worldPos\n * @returns {[number, number]} the canvas position\n */\n projectWorldPos(worldPos) {\n const _worldPos = tempVec4a;\n const viewPos = tempVec4b;\n const screenPos = tempVec4c;\n _worldPos[0] = worldPos[0];\n _worldPos[1] = worldPos[1];\n _worldPos[2] = worldPos[2];\n _worldPos[3] = 1;\n math.mulMat4v4(this.viewMatrix, _worldPos, viewPos);\n math.mulMat4v4(this.projMatrix, viewPos, screenPos);\n math.mulVec3Scalar(screenPos, 1.0 / screenPos[3]);\n screenPos[3] = 1.0;\n screenPos[1] *= -1;\n const canvas = this.scene.canvas.canvas;\n const halfCanvasWidth = canvas.offsetWidth / 2.0;\n const halfCanvasHeight = canvas.offsetHeight / 2.0;\n const canvasPos = [\n screenPos[0] * halfCanvasWidth + halfCanvasWidth,\n screenPos[1] * halfCanvasHeight + halfCanvasHeight,\n ]\n return canvasPos;\n }\n\n /**\n * Destroys this Camera.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {Camera};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/Camera.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/Camera.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2823, + "__docId__": 2831, "kind": "variable", "name": "tempVec3", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55632,7 +55848,7 @@ "ignore": true }, { - "__docId__": 2824, + "__docId__": 2832, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55653,7 +55869,7 @@ "ignore": true }, { - "__docId__": 2825, + "__docId__": 2833, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55674,7 +55890,7 @@ "ignore": true }, { - "__docId__": 2826, + "__docId__": 2834, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55695,7 +55911,7 @@ "ignore": true }, { - "__docId__": 2827, + "__docId__": 2835, "kind": "variable", "name": "tempVec3e", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55716,7 +55932,7 @@ "ignore": true }, { - "__docId__": 2828, + "__docId__": 2836, "kind": "variable", "name": "tempVec3f", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55737,7 +55953,7 @@ "ignore": true }, { - "__docId__": 2829, + "__docId__": 2837, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55758,7 +55974,7 @@ "ignore": true }, { - "__docId__": 2830, + "__docId__": 2838, "kind": "variable", "name": "tempVec4b", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55779,7 +55995,7 @@ "ignore": true }, { - "__docId__": 2831, + "__docId__": 2839, "kind": "variable", "name": "tempVec4c", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55800,7 +56016,7 @@ "ignore": true }, { - "__docId__": 2832, + "__docId__": 2840, "kind": "variable", "name": "tempMat", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55821,7 +56037,7 @@ "ignore": true }, { - "__docId__": 2833, + "__docId__": 2841, "kind": "variable", "name": "tempMatb", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55842,7 +56058,7 @@ "ignore": true }, { - "__docId__": 2834, + "__docId__": 2842, "kind": "variable", "name": "eyeLookVec", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55863,7 +56079,7 @@ "ignore": true }, { - "__docId__": 2835, + "__docId__": 2843, "kind": "variable", "name": "eyeLookVecNorm", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55884,7 +56100,7 @@ "ignore": true }, { - "__docId__": 2836, + "__docId__": 2844, "kind": "variable", "name": "eyeLookOffset", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55905,7 +56121,7 @@ "ignore": true }, { - "__docId__": 2837, + "__docId__": 2845, "kind": "variable", "name": "offsetEye", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55926,7 +56142,7 @@ "ignore": true }, { - "__docId__": 2838, + "__docId__": 2846, "kind": "class", "name": "Camera", "memberof": "src/viewer/scene/camera/Camera.js", @@ -55944,7 +56160,7 @@ ] }, { - "__docId__": 2839, + "__docId__": 2847, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -55963,7 +56179,7 @@ } }, { - "__docId__": 2840, + "__docId__": 2848, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -55983,7 +56199,7 @@ "ignore": true }, { - "__docId__": 2841, + "__docId__": 2849, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56001,7 +56217,7 @@ } }, { - "__docId__": 2842, + "__docId__": 2850, "kind": "member", "name": "_perspective", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56019,7 +56235,7 @@ } }, { - "__docId__": 2843, + "__docId__": 2851, "kind": "member", "name": "_ortho", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56037,7 +56253,7 @@ } }, { - "__docId__": 2844, + "__docId__": 2852, "kind": "member", "name": "_frustum", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56055,7 +56271,7 @@ } }, { - "__docId__": 2845, + "__docId__": 2853, "kind": "member", "name": "_customProjection", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56073,7 +56289,7 @@ } }, { - "__docId__": 2846, + "__docId__": 2854, "kind": "member", "name": "_project", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56091,7 +56307,7 @@ } }, { - "__docId__": 2847, + "__docId__": 2855, "kind": "member", "name": "_eye", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56109,7 +56325,7 @@ } }, { - "__docId__": 2848, + "__docId__": 2856, "kind": "member", "name": "_look", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56127,7 +56343,7 @@ } }, { - "__docId__": 2849, + "__docId__": 2857, "kind": "member", "name": "_up", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56145,7 +56361,7 @@ } }, { - "__docId__": 2850, + "__docId__": 2858, "kind": "member", "name": "_worldUp", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56163,7 +56379,7 @@ } }, { - "__docId__": 2851, + "__docId__": 2859, "kind": "member", "name": "_worldRight", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56181,7 +56397,7 @@ } }, { - "__docId__": 2852, + "__docId__": 2860, "kind": "member", "name": "_worldForward", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56199,7 +56415,7 @@ } }, { - "__docId__": 2861, + "__docId__": 2869, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56216,7 +56432,7 @@ "return": null }, { - "__docId__": 2862, + "__docId__": 2870, "kind": "method", "name": "orbitYaw", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56242,7 +56458,7 @@ "return": null }, { - "__docId__": 2865, + "__docId__": 2873, "kind": "method", "name": "orbitPitch", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56268,7 +56484,7 @@ "return": null }, { - "__docId__": 2868, + "__docId__": 2876, "kind": "method", "name": "yaw", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56294,7 +56510,7 @@ "return": null }, { - "__docId__": 2871, + "__docId__": 2879, "kind": "method", "name": "pitch", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56320,7 +56536,7 @@ "return": null }, { - "__docId__": 2874, + "__docId__": 2882, "kind": "method", "name": "pan", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56346,7 +56562,7 @@ "return": null }, { - "__docId__": 2877, + "__docId__": 2885, "kind": "method", "name": "zoom", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56372,7 +56588,7 @@ "return": null }, { - "__docId__": 2879, + "__docId__": 2887, "kind": "set", "name": "eye", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56401,7 +56617,7 @@ ] }, { - "__docId__": 2880, + "__docId__": 2888, "kind": "get", "name": "eye", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56422,7 +56638,7 @@ } }, { - "__docId__": 2881, + "__docId__": 2889, "kind": "set", "name": "look", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56455,7 +56671,7 @@ ] }, { - "__docId__": 2882, + "__docId__": 2890, "kind": "get", "name": "look", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56487,7 +56703,7 @@ } }, { - "__docId__": 2883, + "__docId__": 2891, "kind": "set", "name": "up", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56520,7 +56736,7 @@ ] }, { - "__docId__": 2884, + "__docId__": 2892, "kind": "get", "name": "up", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56552,7 +56768,7 @@ } }, { - "__docId__": 2885, + "__docId__": 2893, "kind": "set", "name": "deviceMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56577,7 +56793,7 @@ ] }, { - "__docId__": 2886, + "__docId__": 2894, "kind": "get", "name": "deviceMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56609,7 +56825,7 @@ } }, { - "__docId__": 2887, + "__docId__": 2895, "kind": "set", "name": "worldAxis", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56634,7 +56850,7 @@ ] }, { - "__docId__": 2888, + "__docId__": 2896, "kind": "member", "name": "_worldAxis", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56652,7 +56868,7 @@ } }, { - "__docId__": 2889, + "__docId__": 2897, "kind": "get", "name": "worldAxis", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56684,7 +56900,7 @@ } }, { - "__docId__": 2890, + "__docId__": 2898, "kind": "get", "name": "worldUp", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56716,7 +56932,7 @@ } }, { - "__docId__": 2891, + "__docId__": 2899, "kind": "get", "name": "xUp", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56748,7 +56964,7 @@ } }, { - "__docId__": 2892, + "__docId__": 2900, "kind": "get", "name": "yUp", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56780,7 +56996,7 @@ } }, { - "__docId__": 2893, + "__docId__": 2901, "kind": "get", "name": "zUp", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56812,7 +57028,7 @@ } }, { - "__docId__": 2894, + "__docId__": 2902, "kind": "get", "name": "worldRight", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56844,7 +57060,7 @@ } }, { - "__docId__": 2895, + "__docId__": 2903, "kind": "get", "name": "worldForward", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56876,7 +57092,7 @@ } }, { - "__docId__": 2896, + "__docId__": 2904, "kind": "set", "name": "gimbalLock", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56895,7 +57111,7 @@ ] }, { - "__docId__": 2897, + "__docId__": 2905, "kind": "member", "name": "_gimbalLock", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56913,7 +57129,7 @@ } }, { - "__docId__": 2898, + "__docId__": 2906, "kind": "get", "name": "gimbalLock", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56945,7 +57161,7 @@ } }, { - "__docId__": 2899, + "__docId__": 2907, "kind": "set", "name": "constrainPitch", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56970,7 +57186,7 @@ ] }, { - "__docId__": 2900, + "__docId__": 2908, "kind": "member", "name": "_constrainPitch", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -56988,7 +57204,7 @@ } }, { - "__docId__": 2901, + "__docId__": 2909, "kind": "get", "name": "eyeLookDist", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57024,7 +57240,7 @@ } }, { - "__docId__": 2902, + "__docId__": 2910, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57056,7 +57272,7 @@ } }, { - "__docId__": 2903, + "__docId__": 2911, "kind": "get", "name": "viewMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57088,7 +57304,7 @@ } }, { - "__docId__": 2904, + "__docId__": 2912, "kind": "get", "name": "normalMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57120,7 +57336,7 @@ } }, { - "__docId__": 2905, + "__docId__": 2913, "kind": "get", "name": "viewNormalMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57152,7 +57368,7 @@ } }, { - "__docId__": 2906, + "__docId__": 2914, "kind": "get", "name": "inverseViewMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57184,7 +57400,7 @@ } }, { - "__docId__": 2907, + "__docId__": 2915, "kind": "get", "name": "projMatrix", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57216,7 +57432,7 @@ } }, { - "__docId__": 2908, + "__docId__": 2916, "kind": "get", "name": "perspective", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57248,7 +57464,7 @@ } }, { - "__docId__": 2909, + "__docId__": 2917, "kind": "get", "name": "ortho", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57280,7 +57496,7 @@ } }, { - "__docId__": 2910, + "__docId__": 2918, "kind": "get", "name": "frustum", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57312,7 +57528,7 @@ } }, { - "__docId__": 2911, + "__docId__": 2919, "kind": "get", "name": "customProjection", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57344,7 +57560,7 @@ } }, { - "__docId__": 2912, + "__docId__": 2920, "kind": "set", "name": "projection", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57369,7 +57585,7 @@ ] }, { - "__docId__": 2918, + "__docId__": 2926, "kind": "member", "name": "_projectionType", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57387,7 +57603,7 @@ } }, { - "__docId__": 2919, + "__docId__": 2927, "kind": "get", "name": "projection", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57419,7 +57635,7 @@ } }, { - "__docId__": 2920, + "__docId__": 2928, "kind": "get", "name": "project", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57454,7 +57670,7 @@ } }, { - "__docId__": 2921, + "__docId__": 2929, "kind": "method", "name": "projectWorldPos", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57493,7 +57709,7 @@ } }, { - "__docId__": 2922, + "__docId__": 2930, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/Camera.js~Camera", @@ -57508,18 +57724,18 @@ "return": null }, { - "__docId__": 2923, + "__docId__": 2931, "kind": "file", "name": "src/viewer/scene/camera/CameraFlightAnimation.js", "content": "import {math} from '../math/math.js';\nimport {utils} from '../utils.js';\nimport {core} from '../core.js';\nimport {Component} from '../Component.js';\n\nconst tempVec3 = math.vec3();\nconst newLook = math.vec3();\nconst newEye = math.vec3();\nconst newUp = math.vec3();\nconst newLookEyeVec = math.vec3();\n\n/**\n * @desc Jumps or flies the {@link Scene}'s {@link Camera} to a given target.\n *\n * * Located at {@link Viewer#cameraFlight}\n * * Can fly or jump to its target.\n * * While flying, can be stopped, or redirected to a different target.\n * * Can also smoothly transition between ortho and perspective projections.\n *\n *\n * A CameraFlightAnimation's target can be:\n *\n * * specific ````eye````, ````look```` and ````up```` positions,\n * * an axis-aligned World-space bounding box (AABB), or\n * * an instance or ID of any {@link Component} subtype that provides a World-space AABB.\n *\n * A target can also contain a ````projection```` type to transition into. For example, if your {@link Camera#projection} is\n * currently ````\"perspective\"```` and you supply {@link CameraFlightAnimation#flyTo} with a ````projection```` property\n * equal to \"ortho\", then CameraFlightAnimation will smoothly transition the Camera into an orthographic projection.\n *\n * Configure {@link CameraFlightAnimation#fit} and {@link CameraFlightAnimation#fitFOV} to make it stop at the point\n * where the target occupies a certain amount of the field-of-view.\n *\n * ## Flying to an Entity\n *\n * Flying to an {@link Entity}:\n *\n * ````Javascript\n * var entity = new Mesh(viewer.scene);\n *\n * // Fly to the Entity's World-space AABB\n * viewer.cameraFlight.flyTo(entity);\n * ````\n * ## Flying to a Position\n *\n * Flying the CameraFlightAnimation from the previous example to specified eye, look and up positions:\n *\n * ````Javascript\n * viewer.cameraFlight.flyTo({\n * eye: [-5,-5,-5],\n * look: [0,0,0]\n * up: [0,1,0],\n * duration: 1 // Default, seconds\n * },() => {\n * // Done\n * });\n * ````\n *\n * ## Flying to an AABB\n *\n * Flying the CameraFlightAnimation from the previous two examples explicitly to the {@link Boundary3D\"}}Boundary3D's{{/crossLink}}\n * axis-aligned bounding box:\n *\n * ````Javascript\n * viewer.cameraFlight.flyTo(entity.aabb);\n * ````\n *\n * ## Transitioning Between Projections\n *\n * CameraFlightAnimation also allows us to smoothly transition between Camera projections. We can do that by itself, or\n * in addition to flying the Camera to a target.\n *\n * Let's transition the Camera to orthographic projection:\n *\n * [[Run example](/examples/index.html#camera_CameraFlightAnimation_projection)]\n *\n * ````Javascript\n * viewer.cameraFlight.flyTo({ projection: \"ortho\", () => {\n * // Done\n * });\n * ````\n *\n * Now let's transition the Camera back to perspective projection:\n *\n * ````Javascript\n * viewer.cameraFlight.flyTo({ projection: \"perspective\"}, () => {\n * // Done\n * });\n * ````\n *\n * Fly Camera to a position, while transitioning to orthographic projection:\n *\n * ````Javascript\n * viewer.cameraFlight.flyTo({\n * eye: [-100,20,2],\n * look: [0,0,-40],\n * up: [0,1,0],\n * projection: \"ortho\", () => {\n * // Done\n * });\n * ````\n */\nclass CameraFlightAnimation extends Component {\n\n /**\n * @private\n */\n get type() {\n return \"CameraFlightAnimation\";\n }\n\n /**\n @constructor\n @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._look1 = math.vec3();\n this._eye1 = math.vec3();\n this._up1 = math.vec3();\n this._look2 = math.vec3();\n this._eye2 = math.vec3();\n this._up2 = math.vec3();\n this._orthoScale1 = 1;\n this._orthoScale2 = 1;\n this._flying = false;\n this._flyEyeLookUp = false;\n this._flyingEye = false;\n this._flyingLook = false;\n this._callback = null;\n this._callbackScope = null;\n this._time1 = null;\n this._time2 = null;\n this.easing = cfg.easing !== false;\n\n this.duration = cfg.duration;\n this.fit = cfg.fit;\n this.fitFOV = cfg.fitFOV;\n this.trail = cfg.trail;\n }\n\n /**\n * Flies the {@link Camera} to a target.\n *\n * * When the target is a boundary, the {@link Camera} will fly towards the target and stop when the target fills most of the canvas.\n * * When the target is an explicit {@link Camera} position, given as ````eye````, ````look```` and ````up````, then CameraFlightAnimation will interpolate the {@link Camera} to that target and stop there.\n *\n * @param {Object|Component} [params=Scene] Either a parameters object or a {@link Component} subtype that has\n * an AABB. Defaults to the {@link Scene}, which causes the {@link Camera} to fit the Scene in view.\n * @param {Number} [params.arc=0] Factor in range ````[0..1]```` indicating how much the {@link Camera#eye} position\n * will swing away from its {@link Camera#look} position as it flies to the target.\n * @param {Number|String|Component} [params.component] ID or instance of a component to fly to. Defaults to the entire {@link Scene}.\n * @param {Number[]} [params.aabb] World-space axis-aligned bounding box (AABB) target to fly to.\n * @param {Number[]} [params.eye] Position to fly the eye position to.\n * @param {Number[]} [params.look] Position to fly the look position to.\n * @param {Number[]} [params.up] Position to fly the up vector to.\n * @param {String} [params.projection] Projection type to transition into as we fly. Can be any of the values of {@link Camera.projection}.\n * @param {Boolean} [params.fit=true] Whether to fit the target to the view volume. Overrides {@link CameraFlightAnimation#fit}.\n * @param {Number} [params.fitFOV] How much of field-of-view, in degrees, that a target {@link Entity} or its AABB should\n * fill the canvas on arrival. Overrides {@link CameraFlightAnimation#fitFOV}.\n * @param {Number} [params.duration] Flight duration in seconds. Overrides {@link CameraFlightAnimation#duration}.\n * @param {Number} [params.orthoScale] Animate the Camera's orthographic scale to this target value. See {@link Ortho#scale}.\n * @param {Function} [callback] Callback fired on arrival.\n * @param {Object} [scope] Optional scope for callback.\n */\n flyTo(params, callback, scope) {\n\n params = params || this.scene;\n\n if (this._flying) {\n this.stop();\n }\n\n this._flying = false;\n this._flyingEye = false;\n this._flyingLook = false;\n this._flyingEyeLookUp = false;\n\n this._callback = callback;\n this._callbackScope = scope;\n\n const camera = this.scene.camera;\n const flyToProjection = (!!params.projection) && (params.projection !== camera.projection);\n\n this._eye1[0] = camera.eye[0];\n this._eye1[1] = camera.eye[1];\n this._eye1[2] = camera.eye[2];\n\n this._look1[0] = camera.look[0];\n this._look1[1] = camera.look[1];\n this._look1[2] = camera.look[2];\n\n this._up1[0] = camera.up[0];\n this._up1[1] = camera.up[1];\n this._up1[2] = camera.up[2];\n\n this._orthoScale1 = camera.ortho.scale;\n this._orthoScale2 = params.orthoScale || this._orthoScale1;\n\n let aabb;\n let eye;\n let look;\n let up;\n let componentId;\n\n if (params.aabb) {\n aabb = params.aabb;\n\n } else if (params.length === 6) {\n aabb = params;\n\n } else if ((params.eye && params.look) || params.up) {\n eye = params.eye;\n look = params.look;\n up = params.up;\n\n } else if (params.eye) {\n eye = params.eye;\n\n } else if (params.look) {\n look = params.look;\n\n } else { // Argument must be an instance or ID of a Component (subtype)\n\n let component = params;\n\n if (utils.isNumeric(component) || utils.isString(component)) {\n\n componentId = component;\n component = this.scene.components[componentId];\n\n if (!component) {\n this.error(\"Component not found: \" + utils.inQuotes(componentId));\n if (callback) {\n if (scope) {\n callback.call(scope);\n } else {\n callback();\n }\n }\n return;\n }\n }\n if (!flyToProjection) {\n aabb = component.aabb || this.scene.aabb;\n }\n }\n\n const poi = params.poi;\n\n if (aabb) {\n\n if (aabb[3] < aabb[0] || aabb[4] < aabb[1] || aabb[5] < aabb[2]) { // Don't fly to an inverted boundary\n return;\n }\n\n if (aabb[3] === aabb[0] && aabb[4] === aabb[1] && aabb[5] === aabb[2]) { // Don't fly to an empty boundary\n return;\n }\n\n aabb = aabb.slice();\n const aabbCenter = math.getAABB3Center(aabb);\n\n this._look2 = poi || aabbCenter;\n\n const eyeLookVec = math.subVec3(this._eye1, this._look1, tempVec3);\n const eyeLookVecNorm = math.normalizeVec3(eyeLookVec);\n const diag = poi ? math.getAABB3DiagPoint(aabb, poi) : math.getAABB3Diag(aabb);\n const fitFOV = params.fitFOV || this._fitFOV;\n const sca = Math.abs(diag / Math.tan(fitFOV * math.DEGTORAD));\n\n this._orthoScale2 = diag * 1.1;\n\n this._eye2[0] = this._look2[0] + (eyeLookVecNorm[0] * sca);\n this._eye2[1] = this._look2[1] + (eyeLookVecNorm[1] * sca);\n this._eye2[2] = this._look2[2] + (eyeLookVecNorm[2] * sca);\n\n this._up2[0] = this._up1[0];\n this._up2[1] = this._up1[1];\n this._up2[2] = this._up1[2];\n\n this._flyingEyeLookUp = true;\n\n } else if (eye || look || up) {\n\n this._flyingEyeLookUp = !!eye && !!look && !!up;\n this._flyingEye = !!eye && !look;\n this._flyingLook = !!look && !eye;\n\n if (eye) {\n this._eye2[0] = eye[0];\n this._eye2[1] = eye[1];\n this._eye2[2] = eye[2];\n }\n\n if (look) {\n this._look2[0] = look[0];\n this._look2[1] = look[1];\n this._look2[2] = look[2];\n }\n\n if (up) {\n this._up2[0] = up[0];\n this._up2[1] = up[1];\n this._up2[2] = up[2];\n }\n }\n\n if (flyToProjection) {\n\n if (params.projection === \"ortho\" && camera.projection !== \"ortho\") {\n this._projection2 = \"ortho\";\n this._projMatrix1 = camera.projMatrix.slice();\n this._projMatrix2 = camera.ortho.matrix.slice();\n camera.projection = \"customProjection\";\n }\n\n if (params.projection === \"perspective\" && camera.projection !== \"perspective\") {\n this._projection2 = \"perspective\";\n this._projMatrix1 = camera.projMatrix.slice();\n this._projMatrix2 = camera.perspective.matrix.slice();\n camera.projection = \"customProjection\";\n }\n } else {\n this._projection2 = null;\n }\n\n this.fire(\"started\", params, true);\n\n this._time1 = Date.now();\n this._time2 = this._time1 + (params.duration ? params.duration * 1000 : this._duration);\n\n this._flying = true; // False as soon as we stop\n\n core.scheduleTask(this._update, this);\n }\n\n /**\n * Jumps the {@link Scene}'s {@link Camera} to the given target.\n *\n * * When the target is a boundary, this CameraFlightAnimation will position the {@link Camera} at where the target fills most of the canvas.\n * * When the target is an explicit {@link Camera} position, given as ````eye````, ````look```` and ````up```` vectors, then this CameraFlightAnimation will jump the {@link Camera} to that target.\n *\n * @param {*|Component} params Either a parameters object or a {@link Component} subtype that has a World-space AABB.\n * @param {Number} [params.arc=0] Factor in range [0..1] indicating how much the {@link Camera#eye} will swing away from its {@link Camera#look} as it flies to the target.\n * @param {Number|String|Component} [params.component] ID or instance of a component to fly to.\n * @param {Number[]} [params.aabb] World-space axis-aligned bounding box (AABB) target to fly to.\n * @param {Number[]} [params.eye] Position to fly the eye position to.\n * @param {Number[]} [params.look] Position to fly the look position to.\n * @param {Number[]} [params.up] Position to fly the up vector to.\n * @param {String} [params.projection] Projection type to transition into. Can be any of the values of {@link Camera.projection}.\n * @param {Number} [params.fitFOV] How much of field-of-view, in degrees, that a target {@link Entity} or its AABB should fill the canvas on arrival. Overrides {@link CameraFlightAnimation#fitFOV}.\n * @param {Boolean} [params.fit] Whether to fit the target to the view volume. Overrides {@link CameraFlightAnimation#fit}.\n */\n jumpTo(params) {\n this._jumpTo(params);\n }\n\n _jumpTo(params) {\n\n if (this._flying) {\n this.stop();\n }\n\n const camera = this.scene.camera;\n\n var aabb;\n var componentId;\n var newEye;\n var newLook;\n var newUp;\n\n if (params.aabb) { // Boundary3D\n aabb = params.aabb;\n\n } else if (params.length === 6) { // AABB\n aabb = params;\n\n } else if (params.eye || params.look || params.up) { // Camera pose\n newEye = params.eye;\n newLook = params.look;\n newUp = params.up;\n\n } else { // Argument must be an instance or ID of a Component (subtype)\n\n let component = params;\n\n if (utils.isNumeric(component) || utils.isString(component)) {\n componentId = component;\n component = this.scene.components[componentId];\n if (!component) {\n this.error(\"Component not found: \" + utils.inQuotes(componentId));\n return;\n }\n }\n aabb = component.aabb || this.scene.aabb;\n }\n\n const poi = params.poi;\n\n if (aabb) {\n\n if (aabb[3] <= aabb[0] || aabb[4] <= aabb[1] || aabb[5] <= aabb[2]) { // Don't fly to an empty boundary\n return;\n }\n\n var diag = poi ? math.getAABB3DiagPoint(aabb, poi) : math.getAABB3Diag(aabb);\n\n newLook = poi || math.getAABB3Center(aabb, newLook);\n\n if (this._trail) {\n math.subVec3(camera.look, newLook, newLookEyeVec);\n } else {\n math.subVec3(camera.eye, camera.look, newLookEyeVec);\n }\n\n math.normalizeVec3(newLookEyeVec);\n let dist;\n const fit = (params.fit !== undefined) ? params.fit : this._fit;\n\n if (fit) {\n dist = Math.abs((diag) / Math.tan((params.fitFOV || this._fitFOV) * math.DEGTORAD));\n\n } else {\n dist = math.lenVec3(math.subVec3(camera.eye, camera.look, tempVec3));\n }\n\n math.mulVec3Scalar(newLookEyeVec, dist);\n\n camera.eye = math.addVec3(newLook, newLookEyeVec, tempVec3);\n camera.look = newLook;\n\n this.scene.camera.ortho.scale = diag * 1.1;\n\n } else if (newEye || newLook || newUp) {\n\n if (newEye) {\n camera.eye = newEye;\n }\n if (newLook) {\n camera.look = newLook;\n }\n if (newUp) {\n camera.up = newUp;\n }\n }\n\n if (params.projection) {\n camera.projection = params.projection;\n }\n }\n\n _update() {\n if (!this._flying) {\n return;\n }\n const time = Date.now();\n let t = (time - this._time1) / (this._time2 - this._time1);\n const stopping = (t >= 1);\n\n if (t > 1) {\n t = 1;\n }\n\n const tFlight = this.easing ? CameraFlightAnimation._ease(t, 0, 1, 1) : t;\n const camera = this.scene.camera;\n\n if (this._flyingEye || this._flyingLook) {\n\n if (this._flyingEye) {\n math.subVec3(camera.eye, camera.look, newLookEyeVec);\n camera.eye = math.lerpVec3(tFlight, 0, 1, this._eye1, this._eye2, newEye);\n camera.look = math.subVec3(newEye, newLookEyeVec, newLook);\n } else if (this._flyingLook) {\n camera.look = math.lerpVec3(tFlight, 0, 1, this._look1, this._look2, newLook);\n camera.up = math.lerpVec3(tFlight, 0, 1, this._up1, this._up2, newUp);\n }\n\n } else if (this._flyingEyeLookUp) {\n\n camera.eye = math.lerpVec3(tFlight, 0, 1, this._eye1, this._eye2, newEye);\n camera.look = math.lerpVec3(tFlight, 0, 1, this._look1, this._look2, newLook);\n camera.up = math.lerpVec3(tFlight, 0, 1, this._up1, this._up2, newUp);\n }\n\n if (this._projection2) {\n const tProj = (this._projection2 === \"ortho\") ? CameraFlightAnimation._easeOutExpo(t, 0, 1, 1) : CameraFlightAnimation._easeInCubic(t, 0, 1, 1);\n camera.customProjection.matrix = math.lerpMat4(tProj, 0, 1, this._projMatrix1, this._projMatrix2);\n\n } else {\n camera.ortho.scale = this._orthoScale1 + (t * (this._orthoScale2 - this._orthoScale1));\n }\n\n if (stopping) {\n camera.ortho.scale = this._orthoScale2;\n this.stop();\n return;\n }\n core.scheduleTask(this._update, this); // Keep flying\n }\n\n static _ease(t, b, c, d) { // Quadratic easing out - decelerating to zero velocity http://gizma.com/easing\n t /= d;\n return -c * t * (t - 2) + b;\n }\n\n static _easeInCubic(t, b, c, d) {\n t /= d;\n return c * t * t * t + b;\n }\n\n static _easeOutExpo(t, b, c, d) {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n\n /**\n * Stops an earlier flyTo, fires arrival callback.\n */\n stop() {\n if (!this._flying) {\n return;\n }\n this._flying = false;\n this._time1 = null;\n this._time2 = null;\n if (this._projection2) {\n this.scene.camera.projection = this._projection2;\n }\n const callback = this._callback;\n if (callback) {\n this._callback = null;\n if (this._callbackScope) {\n callback.call(this._callbackScope);\n } else {\n callback();\n }\n }\n this.fire(\"stopped\", true, true);\n }\n\n /**\n * Cancels an earlier flyTo without calling the arrival callback.\n */\n cancel() {\n if (!this._flying) {\n return;\n }\n this._flying = false;\n this._time1 = null;\n this._time2 = null;\n if (this._callback) {\n this._callback = null;\n }\n this.fire(\"canceled\", true, true);\n }\n\n /**\n * Sets the flight duration, in seconds, when calling {@link CameraFlightAnimation#flyTo}.\n *\n * Stops any flight currently in progress.\n *\n * default value is ````0.5````.\n *\n * @param {Number} value New duration value.\n */\n set duration(value) {\n this._duration = value ? (value * 1000.0) : 500;\n this.stop();\n }\n\n /**\n * Gets the flight duration, in seconds, when calling {@link CameraFlightAnimation#flyTo}.\n *\n * default value is ````0.5````.\n *\n * @returns {Number} New duration value.\n */\n get duration() {\n return this._duration / 1000.0;\n }\n\n /**\n * Sets if, when CameraFlightAnimation is flying to a boundary, it will always adjust the distance between the\n * {@link Camera#eye} and {@link Camera#look} so as to ensure that the target boundary is always filling the view volume.\n *\n * When false, the eye will remain at its current distance from the look position.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} value Set ````true```` to activate this behaviour.\n */\n set fit(value) {\n this._fit = value !== false;\n }\n\n /**\n * Gets if, when CameraFlightAnimation is flying to a boundary, it will always adjust the distance between the\n * {@link Camera#eye} and {@link Camera#look} so as to ensure that the target boundary is always filling the view volume.\n *\n * When false, the eye will remain at its current distance from the look position.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} value Set ````true```` to activate this behaviour.\n */\n get fit() {\n return this._fit;\n }\n\n /**\n * Sets how much of the perspective field-of-view, in degrees, that a target {@link Entity#aabb} should\n * fill the canvas when calling {@link CameraFlightAnimation#flyTo} or {@link CameraFlightAnimation#jumpTo}.\n *\n * Default value is ````45````.\n *\n * @param {Number} value New FOV value.\n */\n set fitFOV(value) {\n this._fitFOV = value || 45;\n }\n\n /**\n * Gets how much of the perspective field-of-view, in degrees, that a target {@link Entity#aabb} should\n * fill the canvas when calling {@link CameraFlightAnimation#flyTo} or {@link CameraFlightAnimation#jumpTo}.\n *\n * Default value is ````45````.\n *\n * @returns {Number} Current FOV value.\n */\n get fitFOV() {\n return this._fitFOV;\n }\n\n /**\n * Sets if this CameraFlightAnimation to point the {@link Camera}\n * in the direction that it is travelling when flying to a target after calling {@link CameraFlightAnimation#flyTo}.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} value Set ````true```` to activate trailing behaviour.\n */\n set trail(value) {\n this._trail = !!value;\n }\n\n /**\n * Gets if this CameraFlightAnimation points the {@link Camera}\n * in the direction that it is travelling when flying to a target after calling {@link CameraFlightAnimation#flyTo}.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} True if trailing behaviour is active.\n */\n get trail() {\n return this._trail;\n }\n\n /**\n * @private\n */\n destroy() {\n this.stop();\n super.destroy();\n }\n}\n\nexport {CameraFlightAnimation};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/CameraFlightAnimation.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/CameraFlightAnimation.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 2924, + "__docId__": 2932, "kind": "variable", "name": "tempVec3", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57540,7 +57756,7 @@ "ignore": true }, { - "__docId__": 2925, + "__docId__": 2933, "kind": "variable", "name": "newLook", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57561,7 +57777,7 @@ "ignore": true }, { - "__docId__": 2926, + "__docId__": 2934, "kind": "variable", "name": "newEye", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57582,7 +57798,7 @@ "ignore": true }, { - "__docId__": 2927, + "__docId__": 2935, "kind": "variable", "name": "newUp", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57603,7 +57819,7 @@ "ignore": true }, { - "__docId__": 2928, + "__docId__": 2936, "kind": "variable", "name": "newLookEyeVec", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57624,7 +57840,7 @@ "ignore": true }, { - "__docId__": 2929, + "__docId__": 2937, "kind": "class", "name": "CameraFlightAnimation", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js", @@ -57642,7 +57858,7 @@ ] }, { - "__docId__": 2930, + "__docId__": 2938, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57661,7 +57877,7 @@ } }, { - "__docId__": 2931, + "__docId__": 2939, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57681,7 +57897,7 @@ "ignore": true }, { - "__docId__": 2932, + "__docId__": 2940, "kind": "member", "name": "_look1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57699,7 +57915,7 @@ } }, { - "__docId__": 2933, + "__docId__": 2941, "kind": "member", "name": "_eye1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57717,7 +57933,7 @@ } }, { - "__docId__": 2934, + "__docId__": 2942, "kind": "member", "name": "_up1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57735,7 +57951,7 @@ } }, { - "__docId__": 2935, + "__docId__": 2943, "kind": "member", "name": "_look2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57753,7 +57969,7 @@ } }, { - "__docId__": 2936, + "__docId__": 2944, "kind": "member", "name": "_eye2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57771,7 +57987,7 @@ } }, { - "__docId__": 2937, + "__docId__": 2945, "kind": "member", "name": "_up2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57789,7 +58005,7 @@ } }, { - "__docId__": 2938, + "__docId__": 2946, "kind": "member", "name": "_orthoScale1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57807,7 +58023,7 @@ } }, { - "__docId__": 2939, + "__docId__": 2947, "kind": "member", "name": "_orthoScale2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57825,7 +58041,7 @@ } }, { - "__docId__": 2940, + "__docId__": 2948, "kind": "member", "name": "_flying", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57843,7 +58059,7 @@ } }, { - "__docId__": 2941, + "__docId__": 2949, "kind": "member", "name": "_flyEyeLookUp", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57861,7 +58077,7 @@ } }, { - "__docId__": 2942, + "__docId__": 2950, "kind": "member", "name": "_flyingEye", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57879,7 +58095,7 @@ } }, { - "__docId__": 2943, + "__docId__": 2951, "kind": "member", "name": "_flyingLook", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57897,7 +58113,7 @@ } }, { - "__docId__": 2944, + "__docId__": 2952, "kind": "member", "name": "_callback", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57915,7 +58131,7 @@ } }, { - "__docId__": 2945, + "__docId__": 2953, "kind": "member", "name": "_callbackScope", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57933,7 +58149,7 @@ } }, { - "__docId__": 2946, + "__docId__": 2954, "kind": "member", "name": "_time1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57951,7 +58167,7 @@ } }, { - "__docId__": 2947, + "__docId__": 2955, "kind": "member", "name": "_time2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57969,7 +58185,7 @@ } }, { - "__docId__": 2948, + "__docId__": 2956, "kind": "member", "name": "easing", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -57986,7 +58202,7 @@ } }, { - "__docId__": 2953, + "__docId__": 2961, "kind": "method", "name": "flyTo", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58151,7 +58367,7 @@ "return": null }, { - "__docId__": 2957, + "__docId__": 2965, "kind": "member", "name": "_flyingEyeLookUp", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58169,7 +58385,7 @@ } }, { - "__docId__": 2968, + "__docId__": 2976, "kind": "member", "name": "_projection2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58187,7 +58403,7 @@ } }, { - "__docId__": 2969, + "__docId__": 2977, "kind": "member", "name": "_projMatrix1", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58205,7 +58421,7 @@ } }, { - "__docId__": 2970, + "__docId__": 2978, "kind": "member", "name": "_projMatrix2", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58223,7 +58439,7 @@ } }, { - "__docId__": 2978, + "__docId__": 2986, "kind": "method", "name": "jumpTo", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58344,7 +58560,7 @@ "return": null }, { - "__docId__": 2979, + "__docId__": 2987, "kind": "method", "name": "_jumpTo", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58368,7 +58584,7 @@ "return": null }, { - "__docId__": 2980, + "__docId__": 2988, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58385,7 +58601,7 @@ "return": null }, { - "__docId__": 2981, + "__docId__": 2989, "kind": "method", "name": "_ease", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58431,7 +58647,7 @@ } }, { - "__docId__": 2982, + "__docId__": 2990, "kind": "method", "name": "_easeInCubic", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58477,7 +58693,7 @@ } }, { - "__docId__": 2983, + "__docId__": 2991, "kind": "method", "name": "_easeOutExpo", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58523,7 +58739,7 @@ } }, { - "__docId__": 2984, + "__docId__": 2992, "kind": "method", "name": "stop", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58538,7 +58754,7 @@ "return": null }, { - "__docId__": 2989, + "__docId__": 2997, "kind": "method", "name": "cancel", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58553,7 +58769,7 @@ "return": null }, { - "__docId__": 2994, + "__docId__": 3002, "kind": "set", "name": "duration", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58578,7 +58794,7 @@ ] }, { - "__docId__": 2995, + "__docId__": 3003, "kind": "member", "name": "_duration", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58596,7 +58812,7 @@ } }, { - "__docId__": 2996, + "__docId__": 3004, "kind": "get", "name": "duration", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58628,7 +58844,7 @@ } }, { - "__docId__": 2997, + "__docId__": 3005, "kind": "set", "name": "fit", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58653,7 +58869,7 @@ ] }, { - "__docId__": 2998, + "__docId__": 3006, "kind": "member", "name": "_fit", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58671,7 +58887,7 @@ } }, { - "__docId__": 2999, + "__docId__": 3007, "kind": "get", "name": "fit", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58703,7 +58919,7 @@ } }, { - "__docId__": 3000, + "__docId__": 3008, "kind": "set", "name": "fitFOV", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58728,7 +58944,7 @@ ] }, { - "__docId__": 3001, + "__docId__": 3009, "kind": "member", "name": "_fitFOV", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58746,7 +58962,7 @@ } }, { - "__docId__": 3002, + "__docId__": 3010, "kind": "get", "name": "fitFOV", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58778,7 +58994,7 @@ } }, { - "__docId__": 3003, + "__docId__": 3011, "kind": "set", "name": "trail", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58803,7 +59019,7 @@ ] }, { - "__docId__": 3004, + "__docId__": 3012, "kind": "member", "name": "_trail", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58821,7 +59037,7 @@ } }, { - "__docId__": 3005, + "__docId__": 3013, "kind": "get", "name": "trail", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58853,7 +59069,7 @@ } }, { - "__docId__": 3006, + "__docId__": 3014, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/CameraFlightAnimation.js~CameraFlightAnimation", @@ -58869,18 +59085,18 @@ "return": null }, { - "__docId__": 3007, + "__docId__": 3015, "kind": "file", "name": "src/viewer/scene/camera/CameraPath.js", "content": "import {Component} from \"../Component.js\"\nimport {SplineCurve} from \"../paths/SplineCurve.js\"\nimport {math} from \"../math/math.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @desc Defines a sequence of frames along which a {@link CameraPathAnimation} can animate a {@link Camera}.\n *\n * See {@link CameraPathAnimation} for usage.\n */\nclass CameraPath extends Component {\n\n /**\n * Returns \"CameraPath\".\n *\n * @private\n *\n * @returns {string} \"CameraPath\"\n */\n get type() {\n return \"CameraPath\"\n }\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this CameraPath as well.\n * @param [cfg] {*} Configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {{t:Number, eye:Object, look:Object, up: Object}[]} [cfg.frames] Initial sequence of frames.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._frames = [];\n\n this._eyeCurve = new SplineCurve(this);\n this._lookCurve = new SplineCurve(this);\n this._upCurve = new SplineCurve(this);\n\n if (cfg.frames) {\n this.addFrames(cfg.frames);\n this.smoothFrameTimes(1);\n }\n }\n\n /**\n * Gets the camera frames in this CameraPath.\n *\n * @returns {{t:Number, eye:Object, look:Object, up: Object}[]} The frames on this CameraPath.\n */\n get frames() {\n return this._frames;\n }\n\n /**\n * Gets the {@link SplineCurve} along which {@link Camera#eye} travels.\n * @returns {SplineCurve} The SplineCurve for {@link Camera#eye}.\n */\n get eyeCurve() {\n return this._eyeCurve;\n }\n\n /**\n * Gets the {@link SplineCurve} along which {@link Camera#look} travels.\n * @returns {SplineCurve} The SplineCurve for {@link Camera#look}.\n */\n get lookCurve() {\n return this._lookCurve;\n }\n\n /**\n * Gets the {@link SplineCurve} along which {@link Camera#up} travels.\n * @returns {SplineCurve} The SplineCurve for {@link Camera#up}.\n */\n get upCurve() {\n return this._upCurve;\n }\n\n /**\n * Adds a frame to this CameraPath, given as the current position of the {@link Camera}.\n *\n * @param {Number} t Time instant for the new frame.\n */\n saveFrame(t) {\n const camera = this.scene.camera;\n this.addFrame(t, camera.eye, camera.look, camera.up);\n }\n\n /**\n * Adds a frame to this CameraPath, specified as values for eye, look and up vectors at a given time instant.\n *\n * @param {Number} t Time instant for the new frame.\n * @param {Number[]} eye A three-element vector specifying the eye position for the new frame.\n * @param {Number[]} look A three-element vector specifying the look position for the new frame.\n * @param {Number[]} up A three-element vector specifying the up vector for the new frame.\n */\n addFrame(t, eye, look, up) {\n const frame = {\n t: t,\n eye: eye.slice(0),\n look: look.slice(0),\n up: up.slice(0)\n };\n this._frames.push(frame);\n this._eyeCurve.points.push(frame.eye);\n this._lookCurve.points.push(frame.look);\n this._upCurve.points.push(frame.up);\n }\n\n /**\n * Adds multiple frames to this CameraPath, each frame specified as a set of values for eye, look and up vectors at a given time instant.\n *\n * @param {{t:Number, eye:Object, look:Object, up: Object}[]} frames Frames to add to this CameraPath.\n */\n addFrames(frames) {\n let frame;\n for (let i = 0, len = frames.length; i < len; i++) {\n frame = frames[i];\n this.addFrame(frame.t || 0, frame.eye, frame.look, frame.up);\n }\n }\n\n /**\n * Sets the position of the {@link Camera} to a position interpolated within this CameraPath at the given time instant.\n *\n * @param {Number} t Time instant.\n */\n loadFrame(t) {\n\n const camera = this.scene.camera;\n\n t = t / (this._frames[this._frames.length - 1].t - this._frames[0].t);\n t = t < 0.0 ? 0.0 : (t > 1.0 ? 1.0 : t);\n\n camera.eye = this._eyeCurve.getPoint(t, tempVec3a);\n camera.look = this._lookCurve.getPoint(t, tempVec3a);\n camera.up = this._upCurve.getPoint(t, tempVec3a);\n }\n\n /**\n * Gets eye, look and up vectors on this CameraPath at a given instant.\n *\n * @param {Number} t Time instant.\n * @param {Number[]} eye The eye position to update.\n * @param {Number[]} look The look position to update.\n * @param {Number[]} up The up vector to update.\n */\n sampleFrame(t, eye, look, up) {\n t = t < 0.0 ? 0.0 : (t > 1.0 ? 1.0 : t);\n this._eyeCurve.getPoint(t, eye);\n this._lookCurve.getPoint(t, look);\n this._upCurve.getPoint(t, up);\n }\n\n /**\n * Given a total duration (in seconds) for this CameraPath, recomputes the time instant at each frame so that,\n * when animated by {@link CameraPathAnimation}, the {@link Camera} will move along the path at a constant rate.\n *\n * @param {Number} duration The total duration for this CameraPath.\n */\n smoothFrameTimes(duration) {\n const numFrames = this._frames.length;\n if (numFrames === 0) {\n return;\n }\n const vec = math.vec3();\n var totalLen = 0;\n this._frames[0].t = 0;\n const lens = [];\n for (let i = 1, len = this._frames.length; i < len; i++) {\n var lenVec = math.lenVec3(math.subVec3(this._frames[i].eye, this._frames[i - 1].eye, vec));\n lens[i] = lenVec;\n totalLen += lenVec;\n }\n for (let i = 1, len = this._frames.length; i < len; i++) {\n const interFrameRate = (lens[i] / totalLen) * duration;\n this._frames[i].t = this._frames[i-1].t + interFrameRate;\n }\n }\n\n /**\n * Removes all frames from this CameraPath.\n */\n clearFrames() {\n this._frames = [];\n this._eyeCurve.points = [];\n this._lookCurve.points = [];\n this._upCurve.points = [];\n }\n}\n\nexport {CameraPath}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/CameraPath.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/CameraPath.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3008, + "__docId__": 3016, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/camera/CameraPath.js", @@ -58901,7 +59117,7 @@ "ignore": true }, { - "__docId__": 3009, + "__docId__": 3017, "kind": "class", "name": "CameraPath", "memberof": "src/viewer/scene/camera/CameraPath.js", @@ -58919,7 +59135,7 @@ ] }, { - "__docId__": 3010, + "__docId__": 3018, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -58952,7 +59168,7 @@ } }, { - "__docId__": 3011, + "__docId__": 3019, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59013,7 +59229,7 @@ ] }, { - "__docId__": 3012, + "__docId__": 3020, "kind": "member", "name": "_frames", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59031,7 +59247,7 @@ } }, { - "__docId__": 3013, + "__docId__": 3021, "kind": "member", "name": "_eyeCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59049,7 +59265,7 @@ } }, { - "__docId__": 3014, + "__docId__": 3022, "kind": "member", "name": "_lookCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59067,7 +59283,7 @@ } }, { - "__docId__": 3015, + "__docId__": 3023, "kind": "member", "name": "_upCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59085,7 +59301,7 @@ } }, { - "__docId__": 3016, + "__docId__": 3024, "kind": "get", "name": "frames", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59117,7 +59333,7 @@ } }, { - "__docId__": 3017, + "__docId__": 3025, "kind": "get", "name": "eyeCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59149,7 +59365,7 @@ } }, { - "__docId__": 3018, + "__docId__": 3026, "kind": "get", "name": "lookCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59181,7 +59397,7 @@ } }, { - "__docId__": 3019, + "__docId__": 3027, "kind": "get", "name": "upCurve", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59213,7 +59429,7 @@ } }, { - "__docId__": 3020, + "__docId__": 3028, "kind": "method", "name": "saveFrame", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59239,7 +59455,7 @@ "return": null }, { - "__docId__": 3021, + "__docId__": 3029, "kind": "method", "name": "addFrame", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59295,7 +59511,7 @@ "return": null }, { - "__docId__": 3022, + "__docId__": 3030, "kind": "method", "name": "addFrames", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59321,7 +59537,7 @@ "return": null }, { - "__docId__": 3023, + "__docId__": 3031, "kind": "method", "name": "loadFrame", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59347,7 +59563,7 @@ "return": null }, { - "__docId__": 3024, + "__docId__": 3032, "kind": "method", "name": "sampleFrame", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59403,7 +59619,7 @@ "return": null }, { - "__docId__": 3025, + "__docId__": 3033, "kind": "method", "name": "smoothFrameTimes", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59429,7 +59645,7 @@ "return": null }, { - "__docId__": 3026, + "__docId__": 3034, "kind": "method", "name": "clearFrames", "memberof": "src/viewer/scene/camera/CameraPath.js~CameraPath", @@ -59444,18 +59660,18 @@ "return": null }, { - "__docId__": 3028, + "__docId__": 3036, "kind": "file", "name": "src/viewer/scene/camera/CameraPathAnimation.js", "content": "import {Component} from \"../Component.js\"\nimport {CameraFlightAnimation} from \"./CameraFlightAnimation.js\"\n\n\n/**\n * @desc Animates the {@link Scene}'s's {@link Camera} along a {@link CameraPath}.\n *\n * ## Usage\n *\n * In the example below, we'll load a model using a {@link GLTFLoaderPlugin}, then animate a {@link Camera}\n * through the frames in a {@link CameraPath}.\n *\n * * [[Run this example](/examples/index.html#camera_CameraPathAnimation)]\n *\n * ````Javascript\n * import {Viewer, GLTFLoaderPlugin, CameraPath, CameraPathAnimation} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [124.86756896972656, -93.50288391113281, 173.2632598876953];\n * viewer.camera.look = [102.14186096191406, -90.24193572998047, 173.4224395751953];\n * viewer.camera.up = [0.23516440391540527, 0.9719591736793518, -0.0016466031083837152];\n *\n * // Load model\n *\n * const gltfLoader = new GLTFLoaderPlugin(viewer);\n *\n * const model = gltfLoader.load({\n * id: \"myModel\",\n * src: \"./models/gltf/modern_office/scene.gltf\",\n * edges: true,\n * edgeThreshold: 20,\n * xrayed: false\n * });\n *\n * // Create a CameraPath\n *\n * var cameraPath = new CameraPath(viewer.scene, {\n * frames: [\n * {\n * t: 0,\n * eye: [124.86, -93.50, 173.26],\n * look: [102.14, -90.24, 173.42],\n * up: [0.23, 0.97, -0.00]\n * },\n * {\n * t: 1,\n * eye: [79.75, -85.98, 226.57],\n * look: [99.24, -84.11, 238.56],\n * up: [-0.14, 0.98, -0.09]\n * },\n * // Rest of the frames omitted for brevity\n * ]\n * });\n *\n * // Create a CameraPathAnimation to play our CameraPath\n *\n * var cameraPathAnimation = new CameraPathAnimation(viewer.scene, {\n * cameraPath: cameraPath,\n * playingRate: 0.2 // Playing 0.2 time units per second\n * });\n *\n * // Once model loaded, start playing after a couple of seconds delay\n *\n * model.on(\"loaded\", function () {\n * setTimeout(function () {\n * cameraPathAnimation.play(0); // Play from the beginning of the CameraPath\n * }, 2000);\n * });\n * ````\n */\nclass CameraPathAnimation extends Component {\n\n /**\n * Returns \"CameraPathAnimation\".\n *\n * @private\n * @returns {string} \"CameraPathAnimation\"\n */\n get type() {\n return \"CameraPathAnimation\"\n }\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this CameraPathAnimation as well.\n * @param {*} [cfg] Configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {CameraPath} [cfg.eyeCurve] A {@link CameraPath} that defines the path of a {@link Camera}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._cameraFlightAnimation = new CameraFlightAnimation(this);\n this._t = 0;\n this.state = CameraPathAnimation.SCRUBBING;\n this._playingFromT = 0;\n this._playingToT = 0;\n this._playingRate = cfg.playingRate || 1.0;\n this._playingDir = 1.0;\n this._lastTime = null;\n\n this.cameraPath = cfg.cameraPath;\n\n this._tick = this.scene.on(\"tick\", this._updateT, this);\n }\n\n _updateT() {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n const f = 0.002;\n let numFrames;\n let t;\n const time = performance.now();\n const elapsedSecs = (this._lastTime) ? (time - this._lastTime) * 0.001 : 0;\n this._lastTime = time;\n if (elapsedSecs === 0) {\n return;\n }\n switch (this.state) {\n case CameraPathAnimation.SCRUBBING:\n return;\n case CameraPathAnimation.PLAYING:\n this._t += this._playingRate * elapsedSecs;\n numFrames = this._cameraPath.frames.length;\n if (numFrames === 0 || (this._playingDir < 0 && this._t <= 0) || (this._playingDir > 0 && this._t >= this._cameraPath.frames[numFrames - 1].t)) {\n this.state = CameraPathAnimation.SCRUBBING;\n this._t = this._cameraPath.frames[numFrames - 1].t;\n this.fire(\"stopped\");\n return;\n }\n cameraPath.loadFrame(this._t);\n break;\n case CameraPathAnimation.PLAYING_TO:\n t = this._t + (this._playingRate * elapsedSecs * this._playingDir);\n if ((this._playingDir < 0 && t <= this._playingToT) || (this._playingDir > 0 && t >= this._playingToT)) {\n t = this._playingToT;\n this.state = CameraPathAnimation.SCRUBBING;\n this.fire(\"stopped\");\n }\n this._t = t;\n cameraPath.loadFrame(this._t);\n break;\n }\n }\n\n /*\n * @private\n */\n _ease(t, b, c, d) {\n t /= d;\n return -c * t * (t - 2) + b;\n }\n\n /**\n * Sets the {@link CameraPath} animated by this CameraPathAnimation.\n *\n @param {CameraPath} value The new CameraPath.\n */\n set cameraPath(value) {\n this._cameraPath = value;\n }\n\n /**\n * Gets the {@link CameraPath} animated by this CameraPathAnimation.\n *\n @returns {CameraPath} The CameraPath.\n */\n get cameraPath() {\n return this._cameraPath;\n }\n\n /**\n * Sets the rate at which the CameraPathAnimation animates the {@link Camera} along the {@link CameraPath}.\n *\n * @param {Number} value The amount of progress per second.\n */\n set rate(value) {\n this._playingRate = value;\n }\n\n /**\n * Gets the rate at which the CameraPathAnimation animates the {@link Camera} along the {@link CameraPath}.\n *\n * @returns {*|number} The current playing rate.\n */\n get rate() {\n return this._playingRate;\n }\n\n /**\n * Begins animating the {@link Camera} along CameraPathAnimation's {@link CameraPath} from the beginning.\n */\n play() {\n if (!this._cameraPath) {\n return;\n }\n this._lastTime = null;\n this.state = CameraPathAnimation.PLAYING;\n }\n\n /**\n * Begins animating the {@link Camera} along CameraPathAnimation's {@link CameraPath} from the given time.\n *\n * @param {Number} t Time instant.\n */\n playToT(t) {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n this._playingFromT = this._t;\n this._playingToT = t;\n this._playingDir = (this._playingToT - this._playingFromT) < 0 ? -1 : 1;\n this._lastTime = null;\n this.state = CameraPathAnimation.PLAYING_TO;\n }\n\n /**\n * Animates the {@link Camera} along CameraPathAnimation's {@link CameraPath} to the given frame.\n *\n * @param {Number} frameIdx Index of the frame to play to.\n */\n playToFrame(frameIdx) {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n const frame = cameraPath.frames[frameIdx];\n if (!frame) {\n this.error(\"playToFrame - frame index out of range: \" + frameIdx);\n return;\n }\n this.playToT(frame.t);\n }\n\n /**\n * Flies the {@link Camera} directly to the given frame on the CameraPathAnimation's {@link CameraPath}.\n *\n * @param {Number} frameIdx Index of the frame to play to.\n * @param {Function} [ok] Callback to fire when playing is complete.\n */\n flyToFrame(frameIdx, ok) {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n const frame = cameraPath.frames[frameIdx];\n if (!frame) {\n this.error(\"flyToFrame - frame index out of range: \" + frameIdx);\n return;\n }\n this.state = CameraPathAnimation.SCRUBBING;\n this._cameraFlightAnimation.flyTo(frame, ok);\n }\n\n /**\n * Scrubs the {@link Camera} to the given time on the CameraPathAnimation's {@link CameraPath}.\n *\n * @param {Number} t Time instant.\n */\n scrubToT(t) {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n const camera = this.scene.camera;\n if (!camera) {\n return;\n }\n this._t = t;\n cameraPath.loadFrame(this._t);\n this.state = CameraPathAnimation.SCRUBBING;\n }\n\n /**\n * Scrubs the {@link Camera} to the given frame on the CameraPathAnimation's {@link CameraPath}.\n *\n * @param {Number} frameIdx Index of the frame to scrub to.\n */\n scrubToFrame(frameIdx) {\n const cameraPath = this._cameraPath;\n if (!cameraPath) {\n return;\n }\n const camera = this.scene.camera;\n if (!camera) {\n return;\n }\n const frame = cameraPath.frames[frameIdx];\n if (!frame) {\n this.error(\"playToFrame - frame index out of range: \" + frameIdx);\n return;\n }\n cameraPath.loadFrame(this._t);\n this.state = CameraPathAnimation.SCRUBBING;\n }\n\n /**\n * Stops playing this CameraPathAnimation.\n */\n stop() {\n this.state = CameraPathAnimation.SCRUBBING;\n this.fire(\"stopped\");\n }\n\n destroy() {\n super.destroy();\n this.scene.off(this._tick);\n }\n}\n\nCameraPathAnimation.STOPPED = 0;\nCameraPathAnimation.SCRUBBING = 1;\nCameraPathAnimation.PLAYING = 2;\nCameraPathAnimation.PLAYING_TO = 3;\n\nexport {CameraPathAnimation}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/CameraPathAnimation.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/CameraPathAnimation.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3029, + "__docId__": 3037, "kind": "class", "name": "CameraPathAnimation", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js", @@ -59473,7 +59689,7 @@ ] }, { - "__docId__": 3030, + "__docId__": 3038, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59506,7 +59722,7 @@ } }, { - "__docId__": 3031, + "__docId__": 3039, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59567,7 +59783,7 @@ ] }, { - "__docId__": 3032, + "__docId__": 3040, "kind": "member", "name": "_cameraFlightAnimation", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59585,7 +59801,7 @@ } }, { - "__docId__": 3033, + "__docId__": 3041, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59603,7 +59819,7 @@ } }, { - "__docId__": 3034, + "__docId__": 3042, "kind": "member", "name": "state", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59620,7 +59836,7 @@ } }, { - "__docId__": 3035, + "__docId__": 3043, "kind": "member", "name": "_playingFromT", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59638,7 +59854,7 @@ } }, { - "__docId__": 3036, + "__docId__": 3044, "kind": "member", "name": "_playingToT", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59656,7 +59872,7 @@ } }, { - "__docId__": 3037, + "__docId__": 3045, "kind": "member", "name": "_playingRate", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59674,7 +59890,7 @@ } }, { - "__docId__": 3038, + "__docId__": 3046, "kind": "member", "name": "_playingDir", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59692,7 +59908,7 @@ } }, { - "__docId__": 3039, + "__docId__": 3047, "kind": "member", "name": "_lastTime", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59710,7 +59926,7 @@ } }, { - "__docId__": 3041, + "__docId__": 3049, "kind": "member", "name": "_tick", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59728,7 +59944,7 @@ } }, { - "__docId__": 3042, + "__docId__": 3050, "kind": "method", "name": "_updateT", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59745,7 +59961,7 @@ "return": null }, { - "__docId__": 3049, + "__docId__": 3057, "kind": "method", "name": "_ease", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59791,7 +60007,7 @@ } }, { - "__docId__": 3050, + "__docId__": 3058, "kind": "set", "name": "cameraPath", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59816,7 +60032,7 @@ ] }, { - "__docId__": 3051, + "__docId__": 3059, "kind": "member", "name": "_cameraPath", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59834,7 +60050,7 @@ } }, { - "__docId__": 3052, + "__docId__": 3060, "kind": "get", "name": "cameraPath", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59866,7 +60082,7 @@ } }, { - "__docId__": 3053, + "__docId__": 3061, "kind": "set", "name": "rate", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59891,7 +60107,7 @@ ] }, { - "__docId__": 3055, + "__docId__": 3063, "kind": "get", "name": "rate", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59924,7 +60140,7 @@ } }, { - "__docId__": 3056, + "__docId__": 3064, "kind": "method", "name": "play", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59939,7 +60155,7 @@ "return": null }, { - "__docId__": 3059, + "__docId__": 3067, "kind": "method", "name": "playToT", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59965,7 +60181,7 @@ "return": null }, { - "__docId__": 3065, + "__docId__": 3073, "kind": "method", "name": "playToFrame", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -59991,7 +60207,7 @@ "return": null }, { - "__docId__": 3066, + "__docId__": 3074, "kind": "method", "name": "flyToFrame", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -60027,7 +60243,7 @@ "return": null }, { - "__docId__": 3068, + "__docId__": 3076, "kind": "method", "name": "scrubToT", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -60053,7 +60269,7 @@ "return": null }, { - "__docId__": 3071, + "__docId__": 3079, "kind": "method", "name": "scrubToFrame", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -60079,7 +60295,7 @@ "return": null }, { - "__docId__": 3073, + "__docId__": 3081, "kind": "method", "name": "stop", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -60094,7 +60310,7 @@ "return": null }, { - "__docId__": 3075, + "__docId__": 3083, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/CameraPathAnimation.js~CameraPathAnimation", @@ -60110,18 +60326,18 @@ "return": null }, { - "__docId__": 3076, + "__docId__": 3084, "kind": "file", "name": "src/viewer/scene/camera/CustomProjection.js", "content": "import {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\n/**\n * @desc Defines a custom projection for a {@link Camera} as a custom 4x4 matrix..\n *\n * Located at {@link Camera#customProjection}.\n */\nclass CustomProjection extends Component {\n\n /**\n * @private\n */\n get type() {\n return \"CustomProjection\";\n }\n\n /**\n * @constructor\n * @private\n */\n constructor(camera, cfg = {}) {\n\n super(camera, cfg);\n\n /**\n * The Camera this CustomProjection belongs to.\n *\n * @property camera\n * @type {Camera}\n * @final\n */\n this.camera = camera;\n\n this._state = new RenderState({\n matrix: math.mat4(),\n inverseMatrix: math.mat4(),\n transposedMatrix: math.mat4()\n });\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = false;\n\n this.matrix = cfg.matrix;\n }\n\n /**\n * Sets the CustomProjection's projection transform matrix.\n *\n * Fires a \"matrix\" event on change.\n\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @param {Number[]} matrix New value for the CustomProjection's matrix.\n */\n set matrix(matrix) {\n this._state.matrix.set(matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n this.glRedraw();\n this.fire(\"matrix\", this._state.matrix);\n }\n\n /**\n * Gets the CustomProjection's projection transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @return {Number[]} New value for the CustomProjection's matrix.\n */\n get matrix() {\n return this._state.matrix;\n }\n\n /**\n * Gets the inverse of {@link CustomProjection#matrix}.\n *\n * @returns {Number[]} The inverse of {@link CustomProjection#matrix}.\n */\n get inverseMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._inverseMatrixDirty) {\n math.inverseMat4(this._state.matrix, this._state.inverseMatrix);\n this._inverseMatrixDirty = false;\n }\n return this._state.inverseMatrix;\n }\n\n /**\n * Gets the transpose of {@link CustomProjection#matrix}.\n *\n * @returns {Number[]} The transpose of {@link CustomProjection#matrix}.\n */\n get transposedMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._transposedMatrixDirty) {\n math.transposeMat4(this._state.matrix, this._state.transposedMatrix);\n this._transposedMatrixDirty = false;\n }\n return this._state.transposedMatrix;\n }\n\n /**\n * Un-projects the given Canvas-space coordinates, using this CustomProjection.\n *\n * @param {Number[]} canvasPos Inputs 2D Canvas-space coordinates.\n * @param {Number} screenZ Inputs Screen-space Z coordinate.\n * @param {Number[]} screenPos Outputs 3D Screen/Clip-space coordinates.\n * @param {Number[]} viewPos Outputs un-projected 3D View-space coordinates.\n * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.\n */\n unproject(canvasPos, screenZ, screenPos, viewPos, worldPos) {\n\n const canvas = this.scene.canvas.canvas;\n\n const halfCanvasWidth = canvas.offsetWidth / 2.0;\n const halfCanvasHeight = canvas.offsetHeight / 2.0;\n\n screenPos[0] = (canvasPos[0] - halfCanvasWidth) / halfCanvasWidth;\n screenPos[1] = (canvasPos[1] - halfCanvasHeight) / halfCanvasHeight;\n screenPos[2] = screenZ;\n screenPos[3] = 1.0;\n\n math.mulMat4v4(this.inverseMatrix, screenPos, viewPos);\n math.mulVec3Scalar(viewPos, 1.0 / viewPos[3]);\n\n viewPos[3] = 1.0;\n viewPos[1] *= -1;\n\n math.mulMat4v4(this.camera.inverseViewMatrix, viewPos, worldPos);\n\n return worldPos;\n }\n\n /** @private\n *\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {CustomProjection};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/CustomProjection.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/CustomProjection.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3077, + "__docId__": 3085, "kind": "class", "name": "CustomProjection", "memberof": "src/viewer/scene/camera/CustomProjection.js", @@ -60139,7 +60355,7 @@ ] }, { - "__docId__": 3078, + "__docId__": 3086, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60158,7 +60374,7 @@ } }, { - "__docId__": 3079, + "__docId__": 3087, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60178,7 +60394,7 @@ "ignore": true }, { - "__docId__": 3080, + "__docId__": 3088, "kind": "member", "name": "camera", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60215,7 +60431,7 @@ } }, { - "__docId__": 3081, + "__docId__": 3089, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60233,7 +60449,7 @@ } }, { - "__docId__": 3082, + "__docId__": 3090, "kind": "member", "name": "_inverseMatrixDirty", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60251,7 +60467,7 @@ } }, { - "__docId__": 3083, + "__docId__": 3091, "kind": "member", "name": "_transposedMatrixDirty", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60269,7 +60485,7 @@ } }, { - "__docId__": 3085, + "__docId__": 3093, "kind": "set", "name": "matrix", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60294,7 +60510,7 @@ ] }, { - "__docId__": 3088, + "__docId__": 3096, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60320,7 +60536,7 @@ } }, { - "__docId__": 3089, + "__docId__": 3097, "kind": "get", "name": "inverseMatrix", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60352,7 +60568,7 @@ } }, { - "__docId__": 3091, + "__docId__": 3099, "kind": "get", "name": "transposedMatrix", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60384,7 +60600,7 @@ } }, { - "__docId__": 3093, + "__docId__": 3101, "kind": "method", "name": "unproject", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60454,7 +60670,7 @@ } }, { - "__docId__": 3094, + "__docId__": 3102, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/CustomProjection.js~CustomProjection", @@ -60470,18 +60686,18 @@ "return": null }, { - "__docId__": 3095, + "__docId__": 3103, "kind": "file", "name": "src/viewer/scene/camera/Frustum.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc Defines its {@link Camera}'s perspective projection as a frustum-shaped view volume.\n *\n * * Located at {@link Camera#frustum}.\n * * Allows to explicitly set the positions of the left, right, top, bottom, near and far planes, which is useful for asymmetrical view volumes, such as for stereo viewing.\n * * {@link Frustum#near} and {@link Frustum#far} specify the distances to the WebGL clipping planes.\n */\nclass Frustum extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Frustum\";\n }\n\n /**\n * @constructor\n * @private\n */\n constructor(camera, cfg = {}) {\n\n super(camera, cfg);\n\n /**\n * The Camera this Frustum belongs to.\n *\n * @property camera\n * @type {Camera}\n * @final\n */\n this.camera = camera;\n\n this._state = new RenderState({\n matrix: math.mat4(),\n inverseMatrix: math.mat4(),\n transposedMatrix: math.mat4(),\n near: 0.1,\n far: 10000.0\n });\n\n this._left = -1.0;\n this._right = 1.0;\n this._bottom = -1.0;\n this._top = 1.0;\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n // Set component properties\n\n this.left = cfg.left;\n this.right = cfg.right;\n this.bottom = cfg.bottom;\n this.top = cfg.top;\n this.near = cfg.near;\n this.far = cfg.far;\n }\n\n _update() {\n\n math.frustumMat4(this._left, this._right, this._bottom, this._top, this._state.near, this._state.far, this._state.matrix);\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n this.glRedraw();\n\n this.fire(\"matrix\", this._state.matrix);\n }\n\n /**\n * Sets the position of the Frustum's left plane on the View-space X-axis.\n *\n * Fires a {@link Frustum#left:emits} emits on change.\n *\n * @param {Number} value New left frustum plane position.\n */\n set left(value) {\n this._left = (value !== undefined && value !== null) ? value : -1.0;\n this._needUpdate(0);\n this.fire(\"left\", this._left);\n }\n\n /**\n * Gets the position of the Frustum's left plane on the View-space X-axis.\n *\n * @return {Number} Left frustum plane position.\n */\n get left() {\n return this._left;\n }\n\n /**\n * Sets the position of the Frustum's right plane on the View-space X-axis.\n *\n * Fires a {@link Frustum#right:emits} emits on change.\n *\n * @param {Number} value New right frustum plane position.\n */\n set right(value) {\n this._right = (value !== undefined && value !== null) ? value : 1.0;\n this._needUpdate(0);\n this.fire(\"right\", this._right);\n }\n\n /**\n * Gets the position of the Frustum's right plane on the View-space X-axis.\n *\n * Fires a {@link Frustum#right:emits} emits on change.\n *\n * @return {Number} Right frustum plane position.\n */\n get right() {\n return this._right;\n }\n\n /**\n * Sets the position of the Frustum's top plane on the View-space Y-axis.\n *\n * Fires a {@link Frustum#top:emits} emits on change.\n *\n * @param {Number} value New top frustum plane position.\n */\n set top(value) {\n this._top = (value !== undefined && value !== null) ? value : 1.0;\n this._needUpdate(0);\n this.fire(\"top\", this._top);\n }\n\n /**\n * Gets the position of the Frustum's top plane on the View-space Y-axis.\n *\n * Fires a {@link Frustum#top:emits} emits on change.\n *\n * @return {Number} Top frustum plane position.\n */\n get top() {\n return this._top;\n }\n\n /**\n * Sets the position of the Frustum's bottom plane on the View-space Y-axis.\n *\n * Fires a {@link Frustum#bottom:emits} emits on change.\n *\n * @emits {\"bottom\"} event with the value of this property whenever it changes.\n *\n * @param {Number} value New bottom frustum plane position.\n */\n set bottom(value) {\n this._bottom = (value !== undefined && value !== null) ? value : -1.0;\n this._needUpdate(0);\n this.fire(\"bottom\", this._bottom);\n }\n\n /**\n * Gets the position of the Frustum's bottom plane on the View-space Y-axis.\n *\n * Fires a {@link Frustum#bottom:emits} emits on change.\n *\n * @return {Number} Bottom frustum plane position.\n */\n get bottom() {\n return this._bottom;\n }\n\n /**\n * Sets the position of the Frustum's near plane on the positive View-space Z-axis.\n *\n * Fires a {@link Frustum#near:emits} emits on change.\n *\n * Default value is ````0.1````.\n *\n * @param {Number} value New Frustum near plane position.\n */\n set near(value) {\n this._state.near = (value !== undefined && value !== null) ? value : 0.1;\n this._needUpdate(0);\n this.fire(\"near\", this._state.near);\n }\n\n /**\n * Gets the position of the Frustum's near plane on the positive View-space Z-axis.\n *\n * Fires a {@link Frustum#near:emits} emits on change.\n *\n * Default value is ````0.1````.\n *\n * @return {Number} Near frustum plane position.\n */\n get near() {\n return this._state.near;\n }\n\n /**\n * Sets the position of the Frustum's far plane on the positive View-space Z-axis.\n *\n * Fires a {@link Frustum#far:emits} emits on change.\n *\n * Default value is ````10000.0````.\n *\n * @param {Number} value New far frustum plane position.\n */\n set far(value) {\n this._state.far = (value !== undefined && value !== null) ? value : 10000.0;\n this._needUpdate(0);\n this.fire(\"far\", this._state.far);\n }\n\n /**\n * Gets the position of the Frustum's far plane on the positive View-space Z-axis.\n *\n * Default value is ````10000.0````.\n *\n * @return {Number} Far frustum plane position.\n */\n get far() {\n return this._state.far;\n }\n\n /**\n * Gets the Frustum's projection transform matrix.\n *\n * Fires a {@link Frustum#matrix:emits} emits on change.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @returns {Number[]} The Frustum's projection matrix matrix.\n */\n get matrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.matrix;\n }\n\n /**\n * Gets the inverse of {@link Frustum#matrix}.\n *\n * @returns {Number[]} The inverse orthographic projection matrix.\n */\n get inverseMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._inverseMatrixDirty) {\n math.inverseMat4(this._state.matrix, this._state.inverseMatrix);\n this._inverseMatrixDirty = false;\n }\n return this._state.inverseMatrix;\n }\n\n /**\n * Gets the transpose of {@link Frustum#matrix}.\n *\n * @returns {Number[]} The transpose of {@link Frustum#matrix}.\n */\n get transposedMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._transposedMatrixDirty) {\n math.transposeMat4(this._state.matrix, this._state.transposedMatrix);\n this._transposedMatrixDirty = false;\n }\n return this._state.transposedMatrix;\n }\n\n /**\n * Un-projects the given Canvas-space coordinates, using this Frustum projection.\n *\n * @param {Number[]} canvasPos Inputs 2D Canvas-space coordinates.\n * @param {Number} screenZ Inputs Screen-space Z coordinate.\n * @param {Number[]} screenPos Outputs 3D Screen/Clip-space coordinates.\n * @param {Number[]} viewPos Outputs un-projected 3D View-space coordinates.\n * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.\n */\n unproject(canvasPos, screenZ, screenPos, viewPos, worldPos) {\n\n const canvas = this.scene.canvas.canvas;\n\n const halfCanvasWidth = canvas.offsetWidth / 2.0;\n const halfCanvasHeight = canvas.offsetHeight / 2.0;\n\n screenPos[0] = (canvasPos[0] - halfCanvasWidth) / halfCanvasWidth;\n screenPos[1] = (canvasPos[1] - halfCanvasHeight) / halfCanvasHeight;\n screenPos[2] = screenZ;\n screenPos[3] = 1.0;\n\n math.mulMat4v4(this.inverseMatrix, screenPos, viewPos);\n math.mulVec3Scalar(viewPos, 1.0 / viewPos[3]);\n\n viewPos[3] = 1.0;\n viewPos[1] *= -1;\n\n math.mulMat4v4(this.camera.inverseViewMatrix, viewPos, worldPos);\n\n return worldPos;\n }\n\n /** @private\n *\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n super.destroy();\n }\n}\n\nexport {Frustum};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/Frustum.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/Frustum.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3096, + "__docId__": 3104, "kind": "class", "name": "Frustum", "memberof": "src/viewer/scene/camera/Frustum.js", @@ -60499,7 +60715,7 @@ ] }, { - "__docId__": 3097, + "__docId__": 3105, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60518,7 +60734,7 @@ } }, { - "__docId__": 3098, + "__docId__": 3106, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60538,7 +60754,7 @@ "ignore": true }, { - "__docId__": 3099, + "__docId__": 3107, "kind": "member", "name": "camera", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60575,7 +60791,7 @@ } }, { - "__docId__": 3100, + "__docId__": 3108, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60593,7 +60809,7 @@ } }, { - "__docId__": 3101, + "__docId__": 3109, "kind": "member", "name": "_left", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60611,7 +60827,7 @@ } }, { - "__docId__": 3102, + "__docId__": 3110, "kind": "member", "name": "_right", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60629,7 +60845,7 @@ } }, { - "__docId__": 3103, + "__docId__": 3111, "kind": "member", "name": "_bottom", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60647,7 +60863,7 @@ } }, { - "__docId__": 3104, + "__docId__": 3112, "kind": "member", "name": "_top", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60665,7 +60881,7 @@ } }, { - "__docId__": 3105, + "__docId__": 3113, "kind": "member", "name": "_inverseMatrixDirty", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60683,7 +60899,7 @@ } }, { - "__docId__": 3106, + "__docId__": 3114, "kind": "member", "name": "_transposedMatrixDirty", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60701,7 +60917,7 @@ } }, { - "__docId__": 3113, + "__docId__": 3121, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60718,7 +60934,7 @@ "return": null }, { - "__docId__": 3116, + "__docId__": 3124, "kind": "set", "name": "left", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60743,7 +60959,7 @@ ] }, { - "__docId__": 3118, + "__docId__": 3126, "kind": "get", "name": "left", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60769,7 +60985,7 @@ } }, { - "__docId__": 3119, + "__docId__": 3127, "kind": "set", "name": "right", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60794,7 +61010,7 @@ ] }, { - "__docId__": 3121, + "__docId__": 3129, "kind": "get", "name": "right", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60820,7 +61036,7 @@ } }, { - "__docId__": 3122, + "__docId__": 3130, "kind": "set", "name": "top", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60845,7 +61061,7 @@ ] }, { - "__docId__": 3124, + "__docId__": 3132, "kind": "get", "name": "top", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60871,7 +61087,7 @@ } }, { - "__docId__": 3125, + "__docId__": 3133, "kind": "set", "name": "bottom", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60904,7 +61120,7 @@ ] }, { - "__docId__": 3127, + "__docId__": 3135, "kind": "get", "name": "bottom", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60930,7 +61146,7 @@ } }, { - "__docId__": 3128, + "__docId__": 3136, "kind": "set", "name": "near", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60955,7 +61171,7 @@ ] }, { - "__docId__": 3129, + "__docId__": 3137, "kind": "get", "name": "near", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -60981,7 +61197,7 @@ } }, { - "__docId__": 3130, + "__docId__": 3138, "kind": "set", "name": "far", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61006,7 +61222,7 @@ ] }, { - "__docId__": 3131, + "__docId__": 3139, "kind": "get", "name": "far", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61032,7 +61248,7 @@ } }, { - "__docId__": 3132, + "__docId__": 3140, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61064,7 +61280,7 @@ } }, { - "__docId__": 3133, + "__docId__": 3141, "kind": "get", "name": "inverseMatrix", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61096,7 +61312,7 @@ } }, { - "__docId__": 3135, + "__docId__": 3143, "kind": "get", "name": "transposedMatrix", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61128,7 +61344,7 @@ } }, { - "__docId__": 3137, + "__docId__": 3145, "kind": "method", "name": "unproject", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61198,7 +61414,7 @@ } }, { - "__docId__": 3138, + "__docId__": 3146, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/Frustum.js~Frustum", @@ -61214,18 +61430,18 @@ "return": null }, { - "__docId__": 3139, + "__docId__": 3147, "kind": "file", "name": "src/viewer/scene/camera/Ortho.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc Defines its {@link Camera}'s orthographic projection as a box-shaped view volume.\n *\n * * Located at {@link Camera#ortho}.\n * * Works like Blender's orthographic projection, where the positions of the left, right, top and bottom planes are implicitly\n * indicated with a single {@link Ortho#scale} property, which causes the frustum to be symmetrical on X and Y axis, large enough to\n * contain the number of units given by {@link Ortho#scale}.\n * * {@link Ortho#near} and {@link Ortho#far} indicated the distances to the WebGL clipping planes.\n */\nclass Ortho extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Ortho\";\n }\n\n /**\n * @constructor\n * @private\n */\n constructor(camera, cfg = {}) {\n\n super(camera, cfg);\n\n /**\n * The Camera this Ortho belongs to.\n *\n * @property camera\n * @type {Camera}\n * @final\n */\n this.camera = camera;\n\n this._state = new RenderState({\n matrix: math.mat4(),\n inverseMatrix: math.mat4(),\n transposedMatrix: math.mat4(),\n near: 0.1,\n far: 10000.0\n });\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n this.scale = cfg.scale;\n this.near = cfg.near;\n this.far = cfg.far;\n\n this._onCanvasBoundary = this.scene.canvas.on(\"boundary\", this._needUpdate, this);\n }\n\n _update() {\n\n const WIDTH_INDEX = 2;\n const HEIGHT_INDEX = 3;\n\n const scene = this.scene;\n const scale = this._scale;\n const halfSize = 0.5 * scale;\n\n const boundary = scene.canvas.boundary;\n const boundaryWidth = boundary[WIDTH_INDEX];\n const boundaryHeight = boundary[HEIGHT_INDEX];\n const aspect = boundaryWidth / boundaryHeight;\n\n let left;\n let right;\n let top;\n let bottom;\n\n if (boundaryWidth > boundaryHeight) {\n left = -halfSize;\n right = halfSize;\n top = halfSize / aspect;\n bottom = -halfSize / aspect;\n\n } else {\n left = -halfSize * aspect;\n right = halfSize * aspect;\n top = halfSize;\n bottom = -halfSize;\n }\n\n math.orthoMat4c(left, right, bottom, top, this._state.near, this._state.far, this._state.matrix);\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n this.glRedraw();\n\n this.fire(\"matrix\", this._state.matrix);\n }\n\n\n /**\n * Sets scale factor for this Ortho's extents on X and Y axis.\n *\n * Clamps to minimum value of ````0.01```.\n *\n * Fires a \"scale\" event on change.\n *\n * Default value is ````1.0````\n * @param {Number} value New scale value.\n */\n set scale(value) {\n if (value === undefined || value === null) {\n value = 1.0;\n }\n if (value <= 0) {\n value = 0.01;\n }\n this._scale = value;\n this._needUpdate(0);\n this.fire(\"scale\", this._scale);\n }\n\n /**\n * Gets scale factor for this Ortho's extents on X and Y axis.\n *\n * Clamps to minimum value of ````0.01```.\n *\n * Default value is ````1.0````\n *\n * @returns {Number} New Ortho scale value.\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the position of the Ortho's near plane on the positive View-space Z-axis.\n *\n * Fires a \"near\" emits on change.\n *\n * Default value is ````0.1````.\n *\n * @param {Number} value New Ortho near plane position.\n */\n set near(value) {\n const near = (value !== undefined && value !== null) ? value : 0.1;\n if (this._state.near === near) {\n return;\n }\n this._state.near = near;\n this._needUpdate(0);\n this.fire(\"near\", this._state.near);\n }\n\n /**\n * Gets the position of the Ortho's near plane on the positive View-space Z-axis.\n *\n * Default value is ````0.1````.\n *\n * @returns {Number} New Ortho near plane position.\n */\n get near() {\n return this._state.near;\n }\n\n /**\n * Sets the position of the Ortho's far plane on the positive View-space Z-axis.\n *\n * Fires a \"far\" event on change.\n *\n * Default value is ````10000.0````.\n *\n * @param {Number} value New far ortho plane position.\n */\n set far(value) {\n const far = (value !== undefined && value !== null) ? value : 10000.0;\n if (this._state.far === far) {\n return;\n }\n this._state.far = far;\n this._needUpdate(0);\n this.fire(\"far\", this._state.far);\n }\n\n /**\n * Gets the position of the Ortho's far plane on the positive View-space Z-axis.\n *\n * Default value is ````10000.0````.\n *\n * @returns {Number} New far ortho plane position.\n */\n get far() {\n return this._state.far;\n }\n\n /**\n * Gets the Ortho's projection transform matrix.\n *\n * Fires a \"matrix\" event on change.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @returns {Number[]} The Ortho's projection matrix.\n */\n get matrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.matrix;\n }\n\n /**\n * Gets the inverse of {@link Ortho#matrix}.\n *\n * @returns {Number[]} The inverse of {@link Ortho#matrix}.\n */\n get inverseMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._inverseMatrixDirty) {\n math.inverseMat4(this._state.matrix, this._state.inverseMatrix);\n this._inverseMatrixDirty = false;\n }\n return this._state.inverseMatrix;\n }\n\n /**\n * Gets the transpose of {@link Ortho#matrix}.\n *\n * @returns {Number[]} The transpose of {@link Ortho#matrix}.\n */\n get transposedMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._transposedMatrixDirty) {\n math.transposeMat4(this._state.matrix, this._state.transposedMatrix);\n this._transposedMatrixDirty = false;\n }\n return this._state.transposedMatrix;\n }\n\n /**\n * Un-projects the given Canvas-space coordinates, using this Ortho projection.\n *\n * @param {Number[]} canvasPos Inputs 2D Canvas-space coordinates.\n * @param {Number} screenZ Inputs Screen-space Z coordinate.\n * @param {Number[]} screenPos Outputs 3D Screen/Clip-space coordinates.\n * @param {Number[]} viewPos Outputs un-projected 3D View-space coordinates.\n * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.\n */\n unproject(canvasPos, screenZ, screenPos, viewPos, worldPos) {\n\n const canvas = this.scene.canvas.canvas;\n\n const halfCanvasWidth = canvas.offsetWidth / 2.0;\n const halfCanvasHeight = canvas.offsetHeight / 2.0;\n\n screenPos[0] = (canvasPos[0] - halfCanvasWidth) / halfCanvasWidth;\n screenPos[1] = (canvasPos[1] - halfCanvasHeight) / halfCanvasHeight;\n screenPos[2] = screenZ;\n screenPos[3] = 1.0;\n\n math.mulMat4v4(this.inverseMatrix, screenPos, viewPos);\n math.mulVec3Scalar(viewPos, 1.0 / viewPos[3]);\n\n viewPos[3] = 1.0;\n viewPos[1] *= -1;\n\n math.mulMat4v4(this.camera.inverseViewMatrix, viewPos, worldPos);\n\n return worldPos;\n }\n\n /** @private\n *\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n this.scene.canvas.off(this._onCanvasBoundary);\n }\n}\n\nexport {Ortho};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/Ortho.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/Ortho.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3140, + "__docId__": 3148, "kind": "class", "name": "Ortho", "memberof": "src/viewer/scene/camera/Ortho.js", @@ -61243,7 +61459,7 @@ ] }, { - "__docId__": 3141, + "__docId__": 3149, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61262,7 +61478,7 @@ } }, { - "__docId__": 3142, + "__docId__": 3150, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61282,7 +61498,7 @@ "ignore": true }, { - "__docId__": 3143, + "__docId__": 3151, "kind": "member", "name": "camera", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61319,7 +61535,7 @@ } }, { - "__docId__": 3144, + "__docId__": 3152, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61337,7 +61553,7 @@ } }, { - "__docId__": 3145, + "__docId__": 3153, "kind": "member", "name": "_inverseMatrixDirty", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61355,7 +61571,7 @@ } }, { - "__docId__": 3146, + "__docId__": 3154, "kind": "member", "name": "_transposedMatrixDirty", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61373,7 +61589,7 @@ } }, { - "__docId__": 3150, + "__docId__": 3158, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61391,7 +61607,7 @@ } }, { - "__docId__": 3151, + "__docId__": 3159, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61408,7 +61624,7 @@ "return": null }, { - "__docId__": 3154, + "__docId__": 3162, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61433,7 +61649,7 @@ ] }, { - "__docId__": 3155, + "__docId__": 3163, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61451,7 +61667,7 @@ } }, { - "__docId__": 3156, + "__docId__": 3164, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61483,7 +61699,7 @@ } }, { - "__docId__": 3157, + "__docId__": 3165, "kind": "set", "name": "near", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61508,7 +61724,7 @@ ] }, { - "__docId__": 3158, + "__docId__": 3166, "kind": "get", "name": "near", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61540,7 +61756,7 @@ } }, { - "__docId__": 3159, + "__docId__": 3167, "kind": "set", "name": "far", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61565,7 +61781,7 @@ ] }, { - "__docId__": 3160, + "__docId__": 3168, "kind": "get", "name": "far", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61597,7 +61813,7 @@ } }, { - "__docId__": 3161, + "__docId__": 3169, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61629,7 +61845,7 @@ } }, { - "__docId__": 3162, + "__docId__": 3170, "kind": "get", "name": "inverseMatrix", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61661,7 +61877,7 @@ } }, { - "__docId__": 3164, + "__docId__": 3172, "kind": "get", "name": "transposedMatrix", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61693,7 +61909,7 @@ } }, { - "__docId__": 3166, + "__docId__": 3174, "kind": "method", "name": "unproject", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61763,7 +61979,7 @@ } }, { - "__docId__": 3167, + "__docId__": 3175, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/Ortho.js~Ortho", @@ -61779,18 +61995,18 @@ "return": null }, { - "__docId__": 3168, + "__docId__": 3176, "kind": "file", "name": "src/viewer/scene/camera/Perspective.js", "content": "import {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\n/**\n * @desc Defines its {@link Camera}'s perspective projection using a field-of-view angle.\n *\n * * Located at {@link Camera#perspective}.\n * * Implicitly sets the left, right, top, bottom frustum planes using {@link Perspective#fov}.\n * * {@link Perspective#near} and {@link Perspective#far} specify the distances to the WebGL clipping planes.\n */\nclass Perspective extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Perspective\";\n }\n\n /**\n * @constructor\n * @private\n */\n constructor(camera, cfg = {}) {\n\n super(camera, cfg);\n\n /**\n * The Camera this Perspective belongs to.\n *\n * @property camera\n * @type {Camera}\n * @final\n */\n this.camera = camera;\n\n this._state = new RenderState({\n matrix: math.mat4(),\n inverseMatrix: math.mat4(),\n transposedMatrix: math.mat4(),\n near: 0.1,\n far: 10000.0\n });\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n this._fov = 60.0;\n\n // Recompute aspect from change in canvas size\n this._canvasResized = this.scene.canvas.on(\"boundary\", this._needUpdate, this);\n\n this.fov = cfg.fov;\n this.fovAxis = cfg.fovAxis;\n this.near = cfg.near;\n this.far = cfg.far;\n }\n\n _update() {\n\n const WIDTH_INDEX = 2;\n const HEIGHT_INDEX = 3;\n const boundary = this.scene.canvas.boundary;\n const aspect = boundary[WIDTH_INDEX] / boundary[HEIGHT_INDEX];\n const fovAxis = this._fovAxis;\n\n let fov = this._fov;\n if (fovAxis === \"x\" || (fovAxis === \"min\" && aspect < 1) || (fovAxis === \"max\" && aspect > 1)) {\n fov = fov / aspect;\n }\n fov = Math.min(fov, 120);\n\n math.perspectiveMat4(fov * (Math.PI / 180.0), aspect, this._state.near, this._state.far, this._state.matrix);\n\n this._inverseMatrixDirty = true;\n this._transposedMatrixDirty = true;\n\n this.glRedraw();\n\n this.camera._updateScheduled = true;\n\n this.fire(\"matrix\", this._state.matrix);\n }\n\n /**\n * Sets the Perspective's field-of-view angle (FOV).\n *\n * Fires an \"fov\" event on change.\n\n * Default value is ````60.0````.\n *\n * @param {Number} value New field-of-view.\n */\n set fov(value) {\n value = (value !== undefined && value !== null) ? value : 60.0;\n if (value === this._fov) {\n return;\n }\n this._fov = value;\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"fov\", this._fov);\n }\n\n /**\n * Gets the Perspective's field-of-view angle (FOV).\n *\n * Default value is ````60.0````.\n *\n * @returns {Number} Current field-of-view.\n */\n get fov() {\n return this._fov;\n }\n\n /**\n * Sets the Perspective's FOV axis.\n *\n * Options are ````\"x\"````, ````\"y\"```` or ````\"min\"````, to use the minimum axis.\n *\n * Fires an \"fovAxis\" event on change.\n\n * Default value ````\"min\"````.\n *\n * @param {String} value New FOV axis value.\n */\n set fovAxis(value) {\n value = value || \"min\";\n if (this._fovAxis === value) {\n return;\n }\n if (value !== \"x\" && value !== \"y\" && value !== \"min\") {\n this.error(\"Unsupported value for 'fovAxis': \" + value + \" - defaulting to 'min'\");\n value = \"min\";\n }\n this._fovAxis = value;\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"fovAxis\", this._fovAxis);\n }\n\n /**\n * Gets the Perspective's FOV axis.\n *\n * Options are ````\"x\"````, ````\"y\"```` or ````\"min\"````, to use the minimum axis.\n *\n * Fires an \"fovAxis\" event on change.\n\n * Default value is ````\"min\"````.\n *\n * @returns {String} The current FOV axis value.\n */\n get fovAxis() {\n return this._fovAxis;\n }\n\n /**\n * Sets the position of the Perspective's near plane on the positive View-space Z-axis.\n *\n * Fires a \"near\" event on change.\n *\n * Default value is ````0.1````.\n *\n * @param {Number} value New Perspective near plane position.\n */\n set near(value) {\n const near = (value !== undefined && value !== null) ? value : 0.1;\n if (this._state.near === near) {\n return;\n }\n this._state.near = near;\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"near\", this._state.near);\n }\n\n /**\n * Gets the position of the Perspective's near plane on the positive View-space Z-axis.\n *\n * Fires an \"emits\" emits on change.\n *\n * Default value is ````0.1````.\n *\n * @returns The Perspective's near plane position.\n */\n get near() {\n return this._state.near;\n }\n\n /**\n * Sets the position of this Perspective's far plane on the positive View-space Z-axis.\n *\n * Fires a \"far\" event on change.\n *\n * Default value is ````10000.0````.\n *\n * @param {Number} value New Perspective far plane position.\n */\n set far(value) {\n const far = (value !== undefined && value !== null) ? value : 10000.0;\n if (this._state.far === far) {\n return;\n }\n this._state.far = far;\n this._needUpdate(0); // Ensure matrix built on next \"tick\"\n this.fire(\"far\", this._state.far);\n }\n\n /**\n * Gets the position of this Perspective's far plane on the positive View-space Z-axis.\n *\n * Default value is ````10000.0````.\n *\n * @return {Number} The Perspective's far plane position.\n */\n get far() {\n return this._state.far;\n }\n\n /**\n * Gets the Perspective's projection transform matrix.\n *\n * Fires a \"matrix\" event on change.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @returns {Number[]} The Perspective's projection matrix.\n */\n get matrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n return this._state.matrix;\n }\n\n /**\n * Gets the inverse of {@link Perspective#matrix}.\n *\n * @returns {Number[]} The inverse of {@link Perspective#matrix}.\n */\n get inverseMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._inverseMatrixDirty) {\n math.inverseMat4(this._state.matrix, this._state.inverseMatrix);\n this._inverseMatrixDirty = false;\n }\n return this._state.inverseMatrix;\n }\n\n /**\n * Gets the transpose of {@link Perspective#matrix}.\n *\n * @returns {Number[]} The transpose of {@link Perspective#matrix}.\n */\n get transposedMatrix() {\n if (this._updateScheduled) {\n this._doUpdate();\n }\n if (this._transposedMatrixDirty) {\n math.transposeMat4(this._state.matrix, this._state.transposedMatrix);\n this._transposedMatrixDirty = false;\n }\n return this._state.transposedMatrix;\n }\n\n /**\n * Un-projects the given Canvas-space coordinates and Screen-space depth, using this Perspective projection.\n *\n * @param {Number[]} canvasPos Inputs 2D Canvas-space coordinates.\n * @param {Number} screenZ Inputs Screen-space Z coordinate.\n * @param {Number[]} screenPos Outputs 3D Screen/Clip-space coordinates.\n * @param {Number[]} viewPos Outputs un-projected 3D View-space coordinates.\n * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.\n */\n unproject(canvasPos, screenZ, screenPos, viewPos, worldPos) {\n\n const canvas = this.scene.canvas.canvas;\n\n const halfCanvasWidth = canvas.offsetWidth / 2.0;\n const halfCanvasHeight = canvas.offsetHeight / 2.0;\n\n screenPos[0] = (canvasPos[0] - halfCanvasWidth) / halfCanvasWidth;\n screenPos[1] = (canvasPos[1] - halfCanvasHeight) / halfCanvasHeight;\n screenPos[2] = screenZ;\n screenPos[3] = 1.0;\n\n math.mulMat4v4(this.inverseMatrix, screenPos, viewPos);\n math.mulVec3Scalar(viewPos, 1.0 / viewPos[3]);\n\n viewPos[3] = 1.0;\n viewPos[1] *= -1;\n\n math.mulMat4v4(this.camera.inverseViewMatrix, viewPos, worldPos);\n\n return worldPos;\n }\n\n /** @private\n *\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n this.scene.canvas.off(this._canvasResized);\n }\n}\n\nexport {Perspective};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/Perspective.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/Perspective.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3169, + "__docId__": 3177, "kind": "class", "name": "Perspective", "memberof": "src/viewer/scene/camera/Perspective.js", @@ -61808,7 +62024,7 @@ ] }, { - "__docId__": 3170, + "__docId__": 3178, "kind": "get", "name": "type", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61827,7 +62043,7 @@ } }, { - "__docId__": 3171, + "__docId__": 3179, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61847,7 +62063,7 @@ "ignore": true }, { - "__docId__": 3172, + "__docId__": 3180, "kind": "member", "name": "camera", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61884,7 +62100,7 @@ } }, { - "__docId__": 3173, + "__docId__": 3181, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61902,7 +62118,7 @@ } }, { - "__docId__": 3174, + "__docId__": 3182, "kind": "member", "name": "_inverseMatrixDirty", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61920,7 +62136,7 @@ } }, { - "__docId__": 3175, + "__docId__": 3183, "kind": "member", "name": "_transposedMatrixDirty", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61938,7 +62154,7 @@ } }, { - "__docId__": 3176, + "__docId__": 3184, "kind": "member", "name": "_fov", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61956,7 +62172,7 @@ } }, { - "__docId__": 3177, + "__docId__": 3185, "kind": "member", "name": "_canvasResized", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61974,7 +62190,7 @@ } }, { - "__docId__": 3182, + "__docId__": 3190, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -61991,7 +62207,7 @@ "return": null }, { - "__docId__": 3185, + "__docId__": 3193, "kind": "set", "name": "fov", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62016,7 +62232,7 @@ ] }, { - "__docId__": 3187, + "__docId__": 3195, "kind": "get", "name": "fov", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62048,7 +62264,7 @@ } }, { - "__docId__": 3188, + "__docId__": 3196, "kind": "set", "name": "fovAxis", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62073,7 +62289,7 @@ ] }, { - "__docId__": 3189, + "__docId__": 3197, "kind": "member", "name": "_fovAxis", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62091,7 +62307,7 @@ } }, { - "__docId__": 3190, + "__docId__": 3198, "kind": "get", "name": "fovAxis", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62123,7 +62339,7 @@ } }, { - "__docId__": 3191, + "__docId__": 3199, "kind": "set", "name": "near", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62148,7 +62364,7 @@ ] }, { - "__docId__": 3192, + "__docId__": 3200, "kind": "get", "name": "near", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62180,7 +62396,7 @@ } }, { - "__docId__": 3193, + "__docId__": 3201, "kind": "set", "name": "far", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62205,7 +62421,7 @@ ] }, { - "__docId__": 3194, + "__docId__": 3202, "kind": "get", "name": "far", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62231,7 +62447,7 @@ } }, { - "__docId__": 3195, + "__docId__": 3203, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62263,7 +62479,7 @@ } }, { - "__docId__": 3196, + "__docId__": 3204, "kind": "get", "name": "inverseMatrix", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62295,7 +62511,7 @@ } }, { - "__docId__": 3198, + "__docId__": 3206, "kind": "get", "name": "transposedMatrix", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62327,7 +62543,7 @@ } }, { - "__docId__": 3200, + "__docId__": 3208, "kind": "method", "name": "unproject", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62397,7 +62613,7 @@ } }, { - "__docId__": 3201, + "__docId__": 3209, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/camera/Perspective.js~Perspective", @@ -62413,29 +62629,29 @@ "return": null }, { - "__docId__": 3202, + "__docId__": 3210, "kind": "file", "name": "src/viewer/scene/camera/index.js", "content": "export * from \"./CameraPath.js\";\nexport * from \"./CameraPathAnimation.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/camera/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/camera/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3203, + "__docId__": 3211, "kind": "file", "name": "src/viewer/scene/canvas/Canvas.js", "content": "\nimport {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {Spinner} from './Spinner.js';\n\nconst WEBGL_CONTEXT_NAMES = [\n \"webgl2\",\n \"experimental-webgl\",\n \"webkit-3d\",\n \"moz-webgl\",\n \"moz-glweb20\"\n];\n\n/**\n * @desc Manages its {@link Scene}'s HTML canvas.\n *\n * * Provides the HTML canvas element in {@link Canvas#canvas}.\n * * Has a {@link Spinner}, provided at {@link Canvas#spinner}, which manages the loading progress indicator.\n */\nclass Canvas extends Component {\n\n /**\n * @constructor\n * @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._backgroundColor = math.vec3([\n cfg.backgroundColor ? cfg.backgroundColor[0] : 1,\n cfg.backgroundColor ? cfg.backgroundColor[1] : 1,\n cfg.backgroundColor ? cfg.backgroundColor[2] : 1]);\n this._backgroundColorFromAmbientLight = !!cfg.backgroundColorFromAmbientLight;\n\n /**\n * The HTML canvas.\n *\n * @property canvas\n * @type {HTMLCanvasElement}\n * @final\n */\n this.canvas = cfg.canvas;\n\n /**\n * The WebGL rendering context.\n *\n * @property gl\n * @type {WebGLRenderingContext}\n * @final\n */\n this.gl = null;\n\n /**\n * True when WebGL 2 support is enabled.\n *\n * @property webgl2\n * @type {Boolean}\n * @final\n */\n this.webgl2 = false; // Will set true in _initWebGL if WebGL is requested and we succeed in getting it.\n\n /**\n * Indicates if this Canvas is transparent.\n *\n * @property transparent\n * @type {Boolean}\n * @default {false}\n * @final\n */\n this.transparent = !!cfg.transparent;\n\n /**\n * Attributes for the WebGL context\n *\n * @type {{}|*}\n */\n this.contextAttr = cfg.contextAttr || {};\n this.contextAttr.alpha = this.transparent;\n\n this.contextAttr.preserveDrawingBuffer = !!this.contextAttr.preserveDrawingBuffer;\n this.contextAttr.stencil = false;\n this.contextAttr.premultipliedAlpha = (!!this.contextAttr.premultipliedAlpha); // False by default: https://github.com/xeokit/xeokit-sdk/issues/251\n this.contextAttr.antialias = (this.contextAttr.antialias !== false);\n\n // If the canvas uses css styles to specify the sizes make sure the basic\n // width and height attributes match or the WebGL context will use 300 x 150\n\n this.resolutionScale = cfg.resolutionScale;\n\n this.canvas.width = Math.round(this.canvas.clientWidth * this._resolutionScale);\n this.canvas.height = Math.round(this.canvas.clientHeight * this._resolutionScale);\n\n /**\n * Boundary of the Canvas in absolute browser window coordinates.\n *\n * ### Usage:\n *\n * ````javascript\n * var boundary = myScene.canvas.boundary;\n *\n * var xmin = boundary[0];\n * var ymin = boundary[1];\n * var width = boundary[2];\n * var height = boundary[3];\n * ````\n *\n * @property boundary\n * @type {Number[]}\n * @final\n */\n this.boundary = [\n this.canvas.offsetLeft, this.canvas.offsetTop,\n this.canvas.clientWidth, this.canvas.clientHeight\n ];\n\n // Get WebGL context\n\n this._initWebGL(cfg);\n\n // Bind context loss and recovery handlers\n\n const self = this;\n\n this.canvas.addEventListener(\"webglcontextlost\", this._webglcontextlostListener = function (event) {\n console.time(\"webglcontextrestored\");\n self.scene._webglContextLost();\n /**\n * Fired whenever the WebGL context has been lost\n * @event webglcontextlost\n */\n self.fire(\"webglcontextlost\");\n event.preventDefault();\n },\n false);\n\n this.canvas.addEventListener(\"webglcontextrestored\", this._webglcontextrestoredListener = function (event) {\n self._initWebGL();\n if (self.gl) {\n self.scene._webglContextRestored(self.gl);\n /**\n * Fired whenever the WebGL context has been restored again after having previously being lost\n * @event webglContextRestored\n * @param value The WebGL context object\n */\n self.fire(\"webglcontextrestored\", self.gl);\n event.preventDefault();\n }\n console.timeEnd(\"webglcontextrestored\");\n },\n false);\n\n // Attach to resize events on the canvas\n let dirtyBoundary = true; // make sure we publish the 1st boundary event\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (entry.contentBoxSize) {\n dirtyBoundary = true;\n }\n }\n });\n\n resizeObserver.observe(this.canvas);\n\n // Publish canvas size and position changes on each scene tick\n this._tick = this.scene.on(\"tick\", () => {\n // Only publish if the canvas bounds changed\n if (!dirtyBoundary) {\n return;\n }\n\n dirtyBoundary = false;\n\n // Set the real size of the canvas (the drawable w*h)\n self.canvas.width = Math.round(self.canvas.clientWidth * self._resolutionScale);\n self.canvas.height = Math.round(self.canvas.clientHeight * self._resolutionScale);\n\n // Publish the boundary change\n self.boundary[0] = self.canvas.offsetLeft;\n self.boundary[1] = self.canvas.offsetTop;\n self.boundary[2] = self.canvas.clientWidth;\n self.boundary[3] = self.canvas.clientHeight;\n\n self.fire(\"boundary\", self.boundary);\n });\n\n this._spinner = new Spinner(this.scene, {\n canvas: this.canvas,\n elementId: cfg.spinnerElementId\n });\n }\n\n /**\n @private\n */\n get type() {\n return \"Canvas\";\n }\n\n /**\n * Gets whether the canvas clear color will be derived from {@link AmbientLight} or {@link Canvas#backgroundColor}\n * when {@link Canvas#transparent} is ```true```.\n *\n * When {@link Canvas#transparent} is ```true``` and this is ````true````, then the canvas clear color will\n * be taken from the {@link Scene}'s ambient light color.\n *\n * When {@link Canvas#transparent} is ```true``` and this is ````false````, then the canvas clear color will\n * be taken from {@link Canvas#backgroundColor}.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n get backgroundColorFromAmbientLight() {\n return this._backgroundColorFromAmbientLight;\n }\n\n /**\n * Sets if the canvas background color is derived from an {@link AmbientLight}.\n *\n * This only has effect when the canvas is not transparent. When not enabled, the background color\n * will be the canvas element's HTML/CSS background color.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n set backgroundColorFromAmbientLight(backgroundColorFromAmbientLight) {\n this._backgroundColorFromAmbientLight = (backgroundColorFromAmbientLight !== false);\n this.glRedraw();\n }\n\n /**\n * Gets the canvas clear color.\n *\n * Default value is ````[1, 1, 1]````.\n *\n * @type {Number[]}\n */\n get backgroundColor() {\n return this._backgroundColor;\n }\n\n /**\n * Sets the canvas clear color.\n *\n * Default value is ````[1, 1, 1]````.\n *\n * @type {Number[]}\n */\n set backgroundColor(value) {\n if (value) {\n this._backgroundColor[0] = value[0];\n this._backgroundColor[1] = value[1];\n this._backgroundColor[2] = value[2];\n } else {\n this._backgroundColor[0] = 1.0;\n this._backgroundColor[1] = 1.0;\n this._backgroundColor[2] = 1.0;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the scale of the canvas back buffer relative to the CSS-defined size of the canvas.\n *\n * This is a common way to trade off rendering quality for speed. If the canvas size is defined in CSS, then\n * setting this to a value between ````[0..1]```` (eg ````0.5````) will render into a smaller back buffer, giving\n * a performance boost.\n *\n * @returns {*|number} The resolution scale.\n */\n get resolutionScale() {\n return this._resolutionScale;\n }\n\n /**\n * Sets the scale of the canvas back buffer relative to the CSS-defined size of the canvas.\n *\n * This is a common way to trade off rendering quality for speed. If the canvas size is defined in CSS, then\n * setting this to a value between ````[0..1]```` (eg ````0.5````) will render into a smaller back buffer, giving\n * a performance boost.\n *\n * @param {*|number} resolutionScale The resolution scale.\n */\n set resolutionScale(resolutionScale) {\n resolutionScale = resolutionScale || 1.0;\n if (resolutionScale === this._resolutionScale) {\n return;\n }\n this._resolutionScale = resolutionScale;\n const canvas = this.canvas;\n canvas.width = Math.round(canvas.clientWidth * this._resolutionScale);\n canvas.height = Math.round(canvas.clientHeight * this._resolutionScale);\n this.glRedraw();\n }\n\n /**\n * The busy {@link Spinner} for this Canvas.\n *\n * @property spinner\n * @type Spinner\n * @final\n */\n get spinner() {\n return this._spinner;\n }\n\n /**\n * Creates a default canvas in the DOM.\n * @private\n */\n _createCanvas() {\n\n const canvasId = \"xeokit-canvas-\" + math.createUUID();\n const body = document.getElementsByTagName(\"body\")[0];\n const div = document.createElement('div');\n\n const style = div.style;\n style.height = \"100%\";\n style.width = \"100%\";\n style.padding = \"0\";\n style.margin = \"0\";\n style.background = \"rgba(0,0,0,0);\";\n style.float = \"left\";\n style.left = \"0\";\n style.top = \"0\";\n style.position = \"absolute\";\n style.opacity = \"1.0\";\n style[\"z-index\"] = \"-10000\";\n\n div.innerHTML += '';\n\n body.appendChild(div);\n\n this.canvas = document.getElementById(canvasId);\n }\n\n _getElementXY(e) {\n let x = 0, y = 0;\n while (e) {\n x += (e.offsetLeft - e.scrollLeft);\n y += (e.offsetTop - e.scrollTop);\n e = e.offsetParent;\n }\n return {x: x, y: y};\n }\n\n /**\n * Initialises the WebGL context\n * @private\n */\n _initWebGL() {\n\n // Default context attribute values\n\n if (!this.gl) {\n for (let i = 0; !this.gl && i < WEBGL_CONTEXT_NAMES.length; i++) {\n try {\n this.gl = this.canvas.getContext(WEBGL_CONTEXT_NAMES[i], this.contextAttr);\n } catch (e) { // Try with next context name\n }\n }\n }\n\n if (!this.gl) {\n\n this.error('Failed to get a WebGL context');\n\n /**\n * Fired whenever the canvas failed to get a WebGL context, which probably means that WebGL\n * is either unsupported or has been disabled.\n * @event webglContextFailed\n */\n this.fire(\"webglContextFailed\", true, true);\n }\n\n // data-textures: avoid to re-bind same texture\n {\n const gl = this.gl;\n\n let lastTextureUnit = \"__\";\n\n let originalActiveTexture = gl.activeTexture;\n\n gl.activeTexture = function (arg1) {\n if (lastTextureUnit === arg1) {\n return;\n }\n\n lastTextureUnit = arg1;\n\n originalActiveTexture.call (this, arg1);\n };\n\n let lastBindTexture = {};\n\n let originalBindTexture = gl.bindTexture;\n\n let avoidedRebinds = 0;\n\n gl.bindTexture = function (arg1, arg2) {\n if (lastBindTexture[lastTextureUnit] === arg2)\n {\n avoidedRebinds++;\n return;\n }\n\n lastBindTexture[lastTextureUnit] = arg2;\n\n originalBindTexture.call (this, arg1, arg2);\n }\n\n // setInterval (\n // () => {\n // console.log (`${avoidedRebinds} avoided texture binds/sec`);\n // avoidedRebinds = 0;\n // },\n // 1000\n // );\n }\n\n if (this.gl) {\n // Setup extension (if necessary) and hints for fragment shader derivative functions\n if (this.webgl2) {\n this.gl.hint(this.gl.FRAGMENT_SHADER_DERIVATIVE_HINT, this.gl.FASTEST);\n\n // data-textures: not using standard-derivatives\n if (!(this.gl instanceof WebGL2RenderingContext)) {\n }\n }\n }\n }\n\n /**\n * @private\n * @deprecated\n */\n getSnapshot(params) {\n throw \"Canvas#getSnapshot() has been replaced by Viewer#getSnapshot() - use that method instead.\";\n }\n\n /**\n * Reads colors of pixels from the last rendered frame.\n *\n * Call this method like this:\n *\n * ````JavaScript\n *\n * // Ignore transparent pixels (default is false)\n * var opaqueOnly = true;\n *\n * var colors = new Float32Array(8);\n *\n * viewer.scene.canvas.readPixels([ 100, 22, 12, 33 ], colors, 2, opaqueOnly);\n * ````\n *\n * Then the r,g,b components of the colors will be set to the colors at those pixels.\n *\n * @param {Number[]} pixels\n * @param {Number[]} colors\n * @param {Number} size\n * @param {Boolean} opaqueOnly\n */\n readPixels(pixels, colors, size, opaqueOnly) {\n return this.scene._renderer.readPixels(pixels, colors, size, opaqueOnly);\n }\n\n /**\n * Simulates lost WebGL context.\n */\n loseWebGLContext() {\n if (this.canvas.loseContext) {\n this.canvas.loseContext();\n }\n }\n\n destroy() {\n this.scene.off(this._tick);\n this._spinner._destroy();\n // Memory leak avoidance\n this.canvas.removeEventListener(\"webglcontextlost\", this._webglcontextlostListener);\n this.canvas.removeEventListener(\"webglcontextrestored\", this._webglcontextrestoredListener);\n this.gl = null;\n super.destroy();\n }\n}\n\nexport {Canvas};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/canvas/Canvas.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/canvas/Canvas.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3204, + "__docId__": 3212, "kind": "variable", "name": "WEBGL_CONTEXT_NAMES", "memberof": "src/viewer/scene/canvas/Canvas.js", @@ -62456,7 +62672,7 @@ "ignore": true }, { - "__docId__": 3205, + "__docId__": 3213, "kind": "class", "name": "Canvas", "memberof": "src/viewer/scene/canvas/Canvas.js", @@ -62474,7 +62690,7 @@ ] }, { - "__docId__": 3206, + "__docId__": 3214, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62494,7 +62710,7 @@ "ignore": true }, { - "__docId__": 3207, + "__docId__": 3215, "kind": "member", "name": "_backgroundColor", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62512,7 +62728,7 @@ } }, { - "__docId__": 3208, + "__docId__": 3216, "kind": "member", "name": "_backgroundColorFromAmbientLight", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62530,7 +62746,7 @@ } }, { - "__docId__": 3209, + "__docId__": 3217, "kind": "member", "name": "canvas", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62567,7 +62783,7 @@ } }, { - "__docId__": 3210, + "__docId__": 3218, "kind": "member", "name": "gl", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62604,7 +62820,7 @@ } }, { - "__docId__": 3211, + "__docId__": 3219, "kind": "member", "name": "webgl2", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62641,7 +62857,7 @@ } }, { - "__docId__": 3212, + "__docId__": 3220, "kind": "member", "name": "transparent", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62682,7 +62898,7 @@ } }, { - "__docId__": 3213, + "__docId__": 3221, "kind": "member", "name": "contextAttr", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62701,7 +62917,7 @@ } }, { - "__docId__": 3215, + "__docId__": 3223, "kind": "member", "name": "boundary", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62738,7 +62954,7 @@ } }, { - "__docId__": 3216, + "__docId__": 3224, "kind": "member", "name": "_tick", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62756,7 +62972,7 @@ } }, { - "__docId__": 3217, + "__docId__": 3225, "kind": "member", "name": "_spinner", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62774,7 +62990,7 @@ } }, { - "__docId__": 3218, + "__docId__": 3226, "kind": "get", "name": "type", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62793,7 +63009,7 @@ } }, { - "__docId__": 3219, + "__docId__": 3227, "kind": "get", "name": "backgroundColorFromAmbientLight", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62814,7 +63030,7 @@ } }, { - "__docId__": 3220, + "__docId__": 3228, "kind": "set", "name": "backgroundColorFromAmbientLight", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62835,7 +63051,7 @@ } }, { - "__docId__": 3222, + "__docId__": 3230, "kind": "get", "name": "backgroundColor", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62856,7 +63072,7 @@ } }, { - "__docId__": 3223, + "__docId__": 3231, "kind": "set", "name": "backgroundColor", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62877,7 +63093,7 @@ } }, { - "__docId__": 3224, + "__docId__": 3232, "kind": "get", "name": "resolutionScale", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62910,7 +63126,7 @@ } }, { - "__docId__": 3225, + "__docId__": 3233, "kind": "set", "name": "resolutionScale", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62936,7 +63152,7 @@ ] }, { - "__docId__": 3226, + "__docId__": 3234, "kind": "member", "name": "_resolutionScale", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62954,7 +63170,7 @@ } }, { - "__docId__": 3227, + "__docId__": 3235, "kind": "get", "name": "spinner", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -62993,7 +63209,7 @@ } }, { - "__docId__": 3228, + "__docId__": 3236, "kind": "method", "name": "_createCanvas", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63009,7 +63225,7 @@ "return": null }, { - "__docId__": 3230, + "__docId__": 3238, "kind": "method", "name": "_getElementXY", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63037,7 +63253,7 @@ } }, { - "__docId__": 3231, + "__docId__": 3239, "kind": "method", "name": "_initWebGL", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63053,7 +63269,7 @@ "return": null }, { - "__docId__": 3233, + "__docId__": 3241, "kind": "method", "name": "getSnapshot", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63077,7 +63293,7 @@ "return": null }, { - "__docId__": 3234, + "__docId__": 3242, "kind": "method", "name": "readPixels", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63137,7 +63353,7 @@ } }, { - "__docId__": 3235, + "__docId__": 3243, "kind": "method", "name": "loseWebGLContext", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63152,7 +63368,7 @@ "return": null }, { - "__docId__": 3236, + "__docId__": 3244, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/canvas/Canvas.js~Canvas", @@ -63168,18 +63384,18 @@ "return": null }, { - "__docId__": 3238, + "__docId__": 3246, "kind": "file", "name": "src/viewer/scene/canvas/Spinner.js", "content": "import {Component} from '../Component.js';\n\nconst defaultCSS = \".sk-fading-circle {\\\n background: transparent;\\\n margin: 20px auto;\\\n width: 50px;\\\n height:50px;\\\n position: relative;\\\n }\\\n .sk-fading-circle .sk-circle {\\\n width: 120%;\\\n height: 120%;\\\n position: absolute;\\\n left: 0;\\\n top: 0;\\\n }\\\n .sk-fading-circle .sk-circle:before {\\\n content: '';\\\n display: block;\\\n margin: 0 auto;\\\n width: 15%;\\\n height: 15%;\\\n background-color: #ff8800;\\\n border-radius: 100%;\\\n -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;\\\n animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;\\\n }\\\n .sk-fading-circle .sk-circle2 {\\\n -webkit-transform: rotate(30deg);\\\n -ms-transform: rotate(30deg);\\\n transform: rotate(30deg);\\\n }\\\n .sk-fading-circle .sk-circle3 {\\\n -webkit-transform: rotate(60deg);\\\n -ms-transform: rotate(60deg);\\\n transform: rotate(60deg);\\\n }\\\n .sk-fading-circle .sk-circle4 {\\\n -webkit-transform: rotate(90deg);\\\n -ms-transform: rotate(90deg);\\\n transform: rotate(90deg);\\\n }\\\n .sk-fading-circle .sk-circle5 {\\\n -webkit-transform: rotate(120deg);\\\n -ms-transform: rotate(120deg);\\\n transform: rotate(120deg);\\\n }\\\n .sk-fading-circle .sk-circle6 {\\\n -webkit-transform: rotate(150deg);\\\n -ms-transform: rotate(150deg);\\\n transform: rotate(150deg);\\\n }\\\n .sk-fading-circle .sk-circle7 {\\\n -webkit-transform: rotate(180deg);\\\n -ms-transform: rotate(180deg);\\\n transform: rotate(180deg);\\\n }\\\n .sk-fading-circle .sk-circle8 {\\\n -webkit-transform: rotate(210deg);\\\n -ms-transform: rotate(210deg);\\\n transform: rotate(210deg);\\\n }\\\n .sk-fading-circle .sk-circle9 {\\\n -webkit-transform: rotate(240deg);\\\n -ms-transform: rotate(240deg);\\\n transform: rotate(240deg);\\\n }\\\n .sk-fading-circle .sk-circle10 {\\\n -webkit-transform: rotate(270deg);\\\n -ms-transform: rotate(270deg);\\\n transform: rotate(270deg);\\\n }\\\n .sk-fading-circle .sk-circle11 {\\\n -webkit-transform: rotate(300deg);\\\n -ms-transform: rotate(300deg);\\\n transform: rotate(300deg);\\\n }\\\n .sk-fading-circle .sk-circle12 {\\\n -webkit-transform: rotate(330deg);\\\n -ms-transform: rotate(330deg);\\\n transform: rotate(330deg);\\\n }\\\n .sk-fading-circle .sk-circle2:before {\\\n -webkit-animation-delay: -1.1s;\\\n animation-delay: -1.1s;\\\n }\\\n .sk-fading-circle .sk-circle3:before {\\\n -webkit-animation-delay: -1s;\\\n animation-delay: -1s;\\\n }\\\n .sk-fading-circle .sk-circle4:before {\\\n -webkit-animation-delay: -0.9s;\\\n animation-delay: -0.9s;\\\n }\\\n .sk-fading-circle .sk-circle5:before {\\\n -webkit-animation-delay: -0.8s;\\\n animation-delay: -0.8s;\\\n }\\\n .sk-fading-circle .sk-circle6:before {\\\n -webkit-animation-delay: -0.7s;\\\n animation-delay: -0.7s;\\\n }\\\n .sk-fading-circle .sk-circle7:before {\\\n -webkit-animation-delay: -0.6s;\\\n animation-delay: -0.6s;\\\n }\\\n .sk-fading-circle .sk-circle8:before {\\\n -webkit-animation-delay: -0.5s;\\\n animation-delay: -0.5s;\\\n }\\\n .sk-fading-circle .sk-circle9:before {\\\n -webkit-animation-delay: -0.4s;\\\n animation-delay: -0.4s;\\\n }\\\n .sk-fading-circle .sk-circle10:before {\\\n -webkit-animation-delay: -0.3s;\\\n animation-delay: -0.3s;\\\n }\\\n .sk-fading-circle .sk-circle11:before {\\\n -webkit-animation-delay: -0.2s;\\\n animation-delay: -0.2s;\\\n }\\\n .sk-fading-circle .sk-circle12:before {\\\n -webkit-animation-delay: -0.1s;\\\n animation-delay: -0.1s;\\\n }\\\n @-webkit-keyframes sk-circleFadeDelay {\\\n 0%, 39%, 100% { opacity: 0; }\\\n 40% { opacity: 1; }\\\n }\\\n @keyframes sk-circleFadeDelay {\\\n 0%, 39%, 100% { opacity: 0; }\\\n 40% { opacity: 1; }\\\n }\";\n\n/**\n * @desc Displays a progress animation at the center of its {@link Canvas} while things are loading or otherwise busy.\n *\n *\n * * Located at {@link Canvas#spinner}.\n * * Automatically shown while things are loading, however may also be shown by application code wanting to indicate busyness.\n * * {@link Spinner#processes} holds the count of active processes. As a process starts, it increments {@link Spinner#processes}, then decrements it on completion or failure.\n * * A Spinner is only visible while {@link Spinner#processes} is greater than zero.\n *\n * ````javascript\n * var spinner = viewer.scene.canvas.spinner;\n *\n * // Increment count of busy processes represented by the spinner;\n * // assuming the count was zero, this now shows the spinner\n * spinner.processes++;\n *\n * // Increment the count again, by some other process; spinner already visible, now requires two decrements\n * // before it becomes invisible again\n * spinner.processes++;\n *\n * // Decrement the count; count still greater than zero, so spinner remains visible\n * spinner.process--;\n *\n * // Decrement the count; count now zero, so spinner becomes invisible\n * spinner.process--;\n * ````\n */\nclass Spinner extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Spinner\";\n }\n\n /**\n @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._canvas = cfg.canvas;\n this._element = null;\n this._isCustom = false; // True when the element is custom HTML\n\n if (cfg.elementId) { // Custom spinner element supplied\n this._element = document.getElementById(cfg.elementId);\n if (!this._element) {\n this.error(\"Can't find given Spinner HTML element: '\" + cfg.elementId + \"' - will automatically create default element\");\n } else {\n this._adjustPosition();\n }\n }\n\n if (!this._element) {\n this._createDefaultSpinner();\n }\n\n this.processes = 0;\n }\n\n /** @private */\n _createDefaultSpinner() {\n this._injectDefaultCSS();\n const element = document.createElement('div');\n const style = element.style;\n style[\"z-index\"] = \"9000\";\n style.position = \"absolute\";\n element.innerHTML = '
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    \\\n
    ';\n this._canvas.parentElement.appendChild(element);\n this._element = element;\n this._isCustom = false;\n this._adjustPosition();\n }\n\n /**\n * @private\n */\n _injectDefaultCSS() {\n const elementId = \"xeokit-spinner-css\";\n if (document.getElementById(elementId)) {\n return;\n }\n const defaultCSSNode = document.createElement('style');\n defaultCSSNode.innerHTML = defaultCSS;\n defaultCSSNode.id = elementId;\n document.body.appendChild(defaultCSSNode);\n }\n\n /**\n * @private\n */\n _adjustPosition() { // (Re)positions spinner DIV over the center of the canvas - called by Canvas\n if (this._isCustom) {\n return;\n }\n const canvas = this._canvas;\n const element = this._element;\n const style = element.style;\n style[\"left\"] = (canvas.offsetLeft + (canvas.clientWidth * 0.5) - (element.clientWidth * 0.5)) + \"px\";\n style[\"top\"] = (canvas.offsetTop + (canvas.clientHeight * 0.5) - (element.clientHeight * 0.5)) + \"px\";\n }\n\n /**\n * Sets the number of processes this Spinner represents.\n *\n * The Spinner is visible while this property is greater than zero.\n *\n * Increment this property whenever you commence some process during which you want the Spinner to be visible, then decrement it again when the process is complete.\n *\n * Clamps to zero if you attempt to set to to a negative value.\n *\n * Fires a {@link Spinner#processes:event} event on change.\n\n * Default value is ````0````.\n *\n * @param {Number} value New processes count.\n */\n set processes(value) {\n value = value || 0;\n if (this._processes === value) {\n return;\n }\n if (value < 0) {\n return;\n }\n const prevValue = this._processes;\n this._processes = value;\n const element = this._element;\n if (element) {\n element.style[\"visibility\"] = (this._processes > 0) ? \"visible\" : \"hidden\";\n }\n /**\n Fired whenever this Spinner's {@link Spinner#visible} property changes.\n\n @event processes\n @param value The property's new value\n */\n this.fire(\"processes\", this._processes);\n if (this._processes === 0 && this._processes !== prevValue) {\n /**\n Fired whenever this Spinner's {@link Spinner#visible} property becomes zero.\n\n @event zeroProcesses\n */\n this.fire(\"zeroProcesses\", this._processes);\n }\n }\n\n /**\n * Gets the number of processes this Spinner represents.\n *\n * The Spinner is visible while this property is greater than zero.\n *\n * @returns {Number} Current processes count.\n */\n get processes() {\n return this._processes;\n }\n\n _destroy() {\n if (this._element && (!this._isCustom)) {\n this._element.parentNode.removeChild(this._element);\n this._element = null;\n }\n const styleElement = document.getElementById(\"xeokit-spinner-css\");\n if (styleElement) {\n styleElement.parentNode.removeChild(styleElement)\n }\n }\n}\n\nexport {Spinner};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/canvas/Spinner.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/canvas/Spinner.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3239, + "__docId__": 3247, "kind": "variable", "name": "defaultCSS", "memberof": "src/viewer/scene/canvas/Spinner.js", @@ -63200,7 +63416,7 @@ "ignore": true }, { - "__docId__": 3240, + "__docId__": 3248, "kind": "class", "name": "Spinner", "memberof": "src/viewer/scene/canvas/Spinner.js", @@ -63218,7 +63434,7 @@ ] }, { - "__docId__": 3241, + "__docId__": 3249, "kind": "get", "name": "type", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63237,7 +63453,7 @@ } }, { - "__docId__": 3242, + "__docId__": 3250, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63251,7 +63467,7 @@ "ignore": true }, { - "__docId__": 3243, + "__docId__": 3251, "kind": "member", "name": "_canvas", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63269,7 +63485,7 @@ } }, { - "__docId__": 3244, + "__docId__": 3252, "kind": "member", "name": "_element", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63287,7 +63503,7 @@ } }, { - "__docId__": 3245, + "__docId__": 3253, "kind": "member", "name": "_isCustom", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63305,7 +63521,7 @@ } }, { - "__docId__": 3248, + "__docId__": 3256, "kind": "method", "name": "_createDefaultSpinner", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63321,7 +63537,7 @@ "return": null }, { - "__docId__": 3251, + "__docId__": 3259, "kind": "method", "name": "_injectDefaultCSS", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63337,7 +63553,7 @@ "return": null }, { - "__docId__": 3252, + "__docId__": 3260, "kind": "method", "name": "_adjustPosition", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63353,7 +63569,7 @@ "return": null }, { - "__docId__": 3253, + "__docId__": 3261, "kind": "set", "name": "processes", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63378,7 +63594,7 @@ ] }, { - "__docId__": 3254, + "__docId__": 3262, "kind": "member", "name": "_processes", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63396,7 +63612,7 @@ } }, { - "__docId__": 3255, + "__docId__": 3263, "kind": "get", "name": "processes", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63428,7 +63644,7 @@ } }, { - "__docId__": 3256, + "__docId__": 3264, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/canvas/Spinner.js~Spinner", @@ -63445,18 +63661,18 @@ "return": null }, { - "__docId__": 3258, + "__docId__": 3266, "kind": "file", "name": "src/viewer/scene/constants/constants.js", "content": "/**\n * Texture wrapping mode in which the texture repeats to infinity.\n */\nexport const RepeatWrapping = 1000;\n\n/**\n * Texture wrapping mode in which the last pixel of the texture stretches to the edge of the mesh.\n */\nexport const ClampToEdgeWrapping = 1001;\n\n/**\n * Texture wrapping mode in which the texture repeats to infinity, mirroring on each repeat.\n */\nexport const MirroredRepeatWrapping = 1002;\n\n/**\n * Texture magnification and minification filter that returns the nearest texel to the given sample coordinates.\n */\nexport const NearestFilter = 1003;\n\n/**\n * Texture minification filter that chooses the mipmap that most closely matches the size of the pixel being textured and returns the nearest texel to the given sample coordinates.\n */\nexport const NearestMipMapNearestFilter = 1004;\n\n/**\n * Texture minification filter that chooses the mipmap that most closely matches the size of the pixel being textured\n * and returns the nearest texel to the given sample coordinates.\n */\nexport const NearestMipmapNearestFilter = 1004;\n\n/**\n * Texture minification filter that chooses two mipmaps that most closely match the size of the pixel being textured\n * and returns the nearest texel to the center of the pixel at the given sample coordinates.\n */\nexport const NearestMipmapLinearFilter = 1005;\n\n/**\n * Texture minification filter that chooses two mipmaps that most closely match the size of the pixel being textured\n * and returns the nearest texel to the center of the pixel at the given sample coordinates.\n */\nexport const NearestMipMapLinearFilter = 1005;\n\n/**\n * Texture magnification and minification filter that returns the weighted average of the four nearest texels to the given sample coordinates.\n */\nexport const LinearFilter = 1006;\n\n/**\n * Texture minification filter that chooses the mipmap that most closely matches the size of the pixel being textured and\n * returns the weighted average of the four nearest texels to the given sample coordinates.\n */\nexport const LinearMipmapNearestFilter = 1007;\n\n/**\n * Texture minification filter that chooses the mipmap that most closely matches the size of the pixel being textured and\n * returns the weighted average of the four nearest texels to the given sample coordinates.\n */\nexport const LinearMipMapNearestFilter = 1007;\n\n/**\n * Texture minification filter that chooses two mipmaps that most closely match the size of the pixel being textured,\n * finds within each mipmap the weighted average of the nearest texel to the center of the pixel, then returns the\n * weighted average of those two values.\n */\nexport const LinearMipmapLinearFilter = 1008;\n\n/**\n * Texture minification filter that chooses two mipmaps that most closely match the size of the pixel being textured,\n * finds within each mipmap the weighted average of the nearest texel to the center of the pixel, then returns the\n * weighted average of those two values.\n */\nexport const LinearMipMapLinearFilter = 1008;\n\n/**\n * Unsigned 8-bit integer type.\n */\nexport const UnsignedByteType = 1009;\n\n/**\n * Signed 8-bit integer type.\n */\nexport const ByteType = 1010;\n\n/**\n * Signed 16-bit integer type.\n */\nexport const ShortType = 1011;\n\n/**\n * Unsigned 16-bit integer type.\n */\nexport const UnsignedShortType = 1012;\n\n/**\n * Signed 32-bit integer type.\n */\nexport const IntType = 1013;\n\n/**\n * Unsigned 32-bit integer type.\n */\nexport const UnsignedIntType = 1014;\n\n/**\n * Signed 32-bit floating-point type.\n */\nexport const FloatType = 1015;\n\n/**\n * Signed 16-bit half-precision floating-point type.\n */\nexport const HalfFloatType = 1016;\n\n/**\n * Texture packing mode in which each ````RGBA```` channel is packed into 4 bits, for a combined total of 16 bits.\n */\nexport const UnsignedShort4444Type = 1017;\n\n/**\n * Texture packing mode in which the ````RGB```` channels are each packed into 5 bits, and the ````A```` channel is packed into 1 bit, for a combined total of 16 bits.\n */\nexport const UnsignedShort5551Type = 1018;\n\n/**\n * Unsigned integer type for 24-bit depth texture data.\n */\nexport const UnsignedInt248Type = 1020;\n\n/**\n * Texture sampling mode that discards the ````RGBA```` components and just reads the ````A```` component.\n */\nexport const AlphaFormat = 1021;\n\n/**\n * Texture sampling mode that discards the ````A```` component and reads the ````RGB```` components.\n */\nexport const RGBFormat = 1022;\n\n/**\n * Texture sampling mode that reads the ````RGBA```` components.\n */\nexport const RGBAFormat = 1023;\n\n/**\n * Texture sampling mode that reads each ````RGB```` texture component as a luminance value, converted to a float and clamped\n * to ````[0,1]````, while always reading the ````A```` channel as ````1.0````.\n */\nexport const LuminanceFormat = 1024;\n\n/**\n * Texture sampling mode that reads each of the ````RGBA```` texture components as a luminance/alpha value, converted to a float and clamped to ````[0,1]````.\n */\nexport const LuminanceAlphaFormat = 1025;\n\n/**\n * Texture sampling mode that reads each element as a single depth value, converts it to a float and clamps to ````[0,1]````.\n */\nexport const DepthFormat = 1026;\n\n/**\n * Texture sampling mode that\n */\nexport const DepthStencilFormat = 1027;\n\n/**\n * Texture sampling mode that discards the ````GBA```` components and just reads the ````R```` component.\n */\nexport const RedFormat = 1028;\n\n/**\n * Texture sampling mode that discards the ````GBA```` components and just reads the ````R```` component, as an integer instead of as a float.\n */\nexport const RedIntegerFormat = 1029;\n\n/**\n * Texture sampling mode that discards the ````A```` and ````B```` components and just reads the ````R```` and ````G```` components.\n */\nexport const RGFormat = 1030;\n\n/**\n * Texture sampling mode that discards the ````A```` and ````B```` components and just reads the ````R```` and ````G```` components, as integers instead of floats.\n */\nexport const RGIntegerFormat = 1031;\n\n/**\n * Texture sampling mode that reads the ````RGBA```` components as integers instead of floats.\n */\nexport const RGBAIntegerFormat = 1033;\n\n/**\n * Texture format mode in which the texture is formatted as a DXT1 compressed ````RGB```` image.\n */\nexport const RGB_S3TC_DXT1_Format = 33776;\n\n/**\n * Texture format mode in which the texture is formatted as a DXT1 compressed ````RGBA```` image.\n */\nexport const RGBA_S3TC_DXT1_Format = 33777;\n\n/**\n * Texture format mode in which the texture is formatted as a DXT3 compressed ````RGBA```` image.\n */\nexport const RGBA_S3TC_DXT3_Format = 33778;\n\n/**\n * Texture format mode in which the texture is formatted as a DXT5 compressed ````RGBA```` image.\n */\nexport const RGBA_S3TC_DXT5_Format = 33779;\n\n/**\n * Texture format mode in which the texture is formatted as a PVRTC compressed\n * image, with ````RGB```` compression in 4-bit mode and one block for each 4×4 pixels.\n */\nexport const RGB_PVRTC_4BPPV1_Format = 35840;\n\n/**\n * Texture format mode in which the texture is formatted as a PVRTC compressed\n * image, with ````RGB```` compression in 2-bit mode and one block for each 8×4 pixels.\n */\nexport const RGB_PVRTC_2BPPV1_Format = 35841;\n\n/**\n * Texture format mode in which the texture is formatted as a PVRTC compressed\n * image, with ````RGBA```` compression in 4-bit mode and one block for each 4×4 pixels.\n */\nexport const RGBA_PVRTC_4BPPV1_Format = 35842;\n\n/**\n * Texture format mode in which the texture is formatted as a PVRTC compressed\n * image, with ````RGBA```` compression in 2-bit mode and one block for each 8×4 pixels.\n */\nexport const RGBA_PVRTC_2BPPV1_Format = 35843;\n\n/**\n * Texture format mode in which the texture is formatted as an ETC1 compressed\n * ````RGB```` image.\n */\nexport const RGB_ETC1_Format = 36196;\n\n/**\n * Texture format mode in which the texture is formatted as an ETC2 compressed\n * ````RGB```` image.\n */\nexport const RGB_ETC2_Format = 37492;\n\n/**\n * Texture format mode in which the texture is formatted as an ETC2 compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ETC2_EAC_Format = 37496;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_4x4_Format = 37808;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_5x4_Format = 37809;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_5x5_Format = 37810;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_6x5_Format = 37811;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_6x6_Format = 37812;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_8x5_Format = 37813;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_8x6_Format = 37814;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_8x8_Format = 37815;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_10x5_Format = 37816;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_10x6_Format = 37817;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_10x8_Format = 37818;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_10x10_Format = 37819;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_12x10_Format = 37820;\n\n/**\n * Texture format mode in which the texture is formatted as an ATSC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_ASTC_12x12_Format = 37821;\n\n/**\n * Texture format mode in which the texture is formatted as an BPTC compressed\n * ````RGBA```` image.\n */\nexport const RGBA_BPTC_Format = 36492;\n\n/**\n * Texture encoding mode in which the texture image is in linear color space.\n */\nexport const LinearEncoding = 3000;\n\n/**\n * Texture encoding mode in which the texture image is in sRGB color space.\n */\nexport const sRGBEncoding = 3001;\n\n/**\n * Media type for GIF images.\n */\nexport const GIFMediaType = 10000;\n\n/**\n * Media type for JPEG images.\n */\nexport const JPEGMediaType = 10001;\n\n/**\n * Media type for PNG images.\n */\nexport const PNGMediaType = 10002;\n\n/**\n * Media type for compressed texture data.\n */\nexport const CompressedMediaType = 10003;", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/constants/constants.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/constants/constants.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3259, + "__docId__": 3267, "kind": "variable", "name": "RepeatWrapping", "memberof": "src/viewer/scene/constants/constants.js", @@ -63475,7 +63691,7 @@ } }, { - "__docId__": 3260, + "__docId__": 3268, "kind": "variable", "name": "ClampToEdgeWrapping", "memberof": "src/viewer/scene/constants/constants.js", @@ -63494,7 +63710,7 @@ } }, { - "__docId__": 3261, + "__docId__": 3269, "kind": "variable", "name": "MirroredRepeatWrapping", "memberof": "src/viewer/scene/constants/constants.js", @@ -63513,7 +63729,7 @@ } }, { - "__docId__": 3262, + "__docId__": 3270, "kind": "variable", "name": "NearestFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63532,7 +63748,7 @@ } }, { - "__docId__": 3263, + "__docId__": 3271, "kind": "variable", "name": "NearestMipMapNearestFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63551,7 +63767,7 @@ } }, { - "__docId__": 3264, + "__docId__": 3272, "kind": "variable", "name": "NearestMipmapNearestFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63570,7 +63786,7 @@ } }, { - "__docId__": 3265, + "__docId__": 3273, "kind": "variable", "name": "NearestMipmapLinearFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63589,7 +63805,7 @@ } }, { - "__docId__": 3266, + "__docId__": 3274, "kind": "variable", "name": "NearestMipMapLinearFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63608,7 +63824,7 @@ } }, { - "__docId__": 3267, + "__docId__": 3275, "kind": "variable", "name": "LinearFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63627,7 +63843,7 @@ } }, { - "__docId__": 3268, + "__docId__": 3276, "kind": "variable", "name": "LinearMipmapNearestFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63646,7 +63862,7 @@ } }, { - "__docId__": 3269, + "__docId__": 3277, "kind": "variable", "name": "LinearMipMapNearestFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63665,7 +63881,7 @@ } }, { - "__docId__": 3270, + "__docId__": 3278, "kind": "variable", "name": "LinearMipmapLinearFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63684,7 +63900,7 @@ } }, { - "__docId__": 3271, + "__docId__": 3279, "kind": "variable", "name": "LinearMipMapLinearFilter", "memberof": "src/viewer/scene/constants/constants.js", @@ -63703,7 +63919,7 @@ } }, { - "__docId__": 3272, + "__docId__": 3280, "kind": "variable", "name": "UnsignedByteType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63722,7 +63938,7 @@ } }, { - "__docId__": 3273, + "__docId__": 3281, "kind": "variable", "name": "ByteType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63741,7 +63957,7 @@ } }, { - "__docId__": 3274, + "__docId__": 3282, "kind": "variable", "name": "ShortType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63760,7 +63976,7 @@ } }, { - "__docId__": 3275, + "__docId__": 3283, "kind": "variable", "name": "UnsignedShortType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63779,7 +63995,7 @@ } }, { - "__docId__": 3276, + "__docId__": 3284, "kind": "variable", "name": "IntType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63798,7 +64014,7 @@ } }, { - "__docId__": 3277, + "__docId__": 3285, "kind": "variable", "name": "UnsignedIntType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63817,7 +64033,7 @@ } }, { - "__docId__": 3278, + "__docId__": 3286, "kind": "variable", "name": "FloatType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63836,7 +64052,7 @@ } }, { - "__docId__": 3279, + "__docId__": 3287, "kind": "variable", "name": "HalfFloatType", "memberof": "src/viewer/scene/constants/constants.js", @@ -63855,7 +64071,7 @@ } }, { - "__docId__": 3280, + "__docId__": 3288, "kind": "variable", "name": "UnsignedShort4444Type", "memberof": "src/viewer/scene/constants/constants.js", @@ -63874,7 +64090,7 @@ } }, { - "__docId__": 3281, + "__docId__": 3289, "kind": "variable", "name": "UnsignedShort5551Type", "memberof": "src/viewer/scene/constants/constants.js", @@ -63893,7 +64109,7 @@ } }, { - "__docId__": 3282, + "__docId__": 3290, "kind": "variable", "name": "UnsignedInt248Type", "memberof": "src/viewer/scene/constants/constants.js", @@ -63912,7 +64128,7 @@ } }, { - "__docId__": 3283, + "__docId__": 3291, "kind": "variable", "name": "AlphaFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -63931,7 +64147,7 @@ } }, { - "__docId__": 3284, + "__docId__": 3292, "kind": "variable", "name": "RGBFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -63950,7 +64166,7 @@ } }, { - "__docId__": 3285, + "__docId__": 3293, "kind": "variable", "name": "RGBAFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -63969,7 +64185,7 @@ } }, { - "__docId__": 3286, + "__docId__": 3294, "kind": "variable", "name": "LuminanceFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -63988,7 +64204,7 @@ } }, { - "__docId__": 3287, + "__docId__": 3295, "kind": "variable", "name": "LuminanceAlphaFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64007,7 +64223,7 @@ } }, { - "__docId__": 3288, + "__docId__": 3296, "kind": "variable", "name": "DepthFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64026,7 +64242,7 @@ } }, { - "__docId__": 3289, + "__docId__": 3297, "kind": "variable", "name": "DepthStencilFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64045,7 +64261,7 @@ } }, { - "__docId__": 3290, + "__docId__": 3298, "kind": "variable", "name": "RedFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64064,7 +64280,7 @@ } }, { - "__docId__": 3291, + "__docId__": 3299, "kind": "variable", "name": "RedIntegerFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64083,7 +64299,7 @@ } }, { - "__docId__": 3292, + "__docId__": 3300, "kind": "variable", "name": "RGFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64102,7 +64318,7 @@ } }, { - "__docId__": 3293, + "__docId__": 3301, "kind": "variable", "name": "RGIntegerFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64121,7 +64337,7 @@ } }, { - "__docId__": 3294, + "__docId__": 3302, "kind": "variable", "name": "RGBAIntegerFormat", "memberof": "src/viewer/scene/constants/constants.js", @@ -64140,7 +64356,7 @@ } }, { - "__docId__": 3295, + "__docId__": 3303, "kind": "variable", "name": "RGB_S3TC_DXT1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64159,7 +64375,7 @@ } }, { - "__docId__": 3296, + "__docId__": 3304, "kind": "variable", "name": "RGBA_S3TC_DXT1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64178,7 +64394,7 @@ } }, { - "__docId__": 3297, + "__docId__": 3305, "kind": "variable", "name": "RGBA_S3TC_DXT3_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64197,7 +64413,7 @@ } }, { - "__docId__": 3298, + "__docId__": 3306, "kind": "variable", "name": "RGBA_S3TC_DXT5_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64216,7 +64432,7 @@ } }, { - "__docId__": 3299, + "__docId__": 3307, "kind": "variable", "name": "RGB_PVRTC_4BPPV1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64235,7 +64451,7 @@ } }, { - "__docId__": 3300, + "__docId__": 3308, "kind": "variable", "name": "RGB_PVRTC_2BPPV1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64254,7 +64470,7 @@ } }, { - "__docId__": 3301, + "__docId__": 3309, "kind": "variable", "name": "RGBA_PVRTC_4BPPV1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64273,7 +64489,7 @@ } }, { - "__docId__": 3302, + "__docId__": 3310, "kind": "variable", "name": "RGBA_PVRTC_2BPPV1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64292,7 +64508,7 @@ } }, { - "__docId__": 3303, + "__docId__": 3311, "kind": "variable", "name": "RGB_ETC1_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64311,7 +64527,7 @@ } }, { - "__docId__": 3304, + "__docId__": 3312, "kind": "variable", "name": "RGB_ETC2_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64330,7 +64546,7 @@ } }, { - "__docId__": 3305, + "__docId__": 3313, "kind": "variable", "name": "RGBA_ETC2_EAC_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64349,7 +64565,7 @@ } }, { - "__docId__": 3306, + "__docId__": 3314, "kind": "variable", "name": "RGBA_ASTC_4x4_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64368,7 +64584,7 @@ } }, { - "__docId__": 3307, + "__docId__": 3315, "kind": "variable", "name": "RGBA_ASTC_5x4_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64387,7 +64603,7 @@ } }, { - "__docId__": 3308, + "__docId__": 3316, "kind": "variable", "name": "RGBA_ASTC_5x5_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64406,7 +64622,7 @@ } }, { - "__docId__": 3309, + "__docId__": 3317, "kind": "variable", "name": "RGBA_ASTC_6x5_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64425,7 +64641,7 @@ } }, { - "__docId__": 3310, + "__docId__": 3318, "kind": "variable", "name": "RGBA_ASTC_6x6_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64444,7 +64660,7 @@ } }, { - "__docId__": 3311, + "__docId__": 3319, "kind": "variable", "name": "RGBA_ASTC_8x5_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64463,7 +64679,7 @@ } }, { - "__docId__": 3312, + "__docId__": 3320, "kind": "variable", "name": "RGBA_ASTC_8x6_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64482,7 +64698,7 @@ } }, { - "__docId__": 3313, + "__docId__": 3321, "kind": "variable", "name": "RGBA_ASTC_8x8_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64501,7 +64717,7 @@ } }, { - "__docId__": 3314, + "__docId__": 3322, "kind": "variable", "name": "RGBA_ASTC_10x5_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64520,7 +64736,7 @@ } }, { - "__docId__": 3315, + "__docId__": 3323, "kind": "variable", "name": "RGBA_ASTC_10x6_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64539,7 +64755,7 @@ } }, { - "__docId__": 3316, + "__docId__": 3324, "kind": "variable", "name": "RGBA_ASTC_10x8_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64558,7 +64774,7 @@ } }, { - "__docId__": 3317, + "__docId__": 3325, "kind": "variable", "name": "RGBA_ASTC_10x10_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64577,7 +64793,7 @@ } }, { - "__docId__": 3318, + "__docId__": 3326, "kind": "variable", "name": "RGBA_ASTC_12x10_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64596,7 +64812,7 @@ } }, { - "__docId__": 3319, + "__docId__": 3327, "kind": "variable", "name": "RGBA_ASTC_12x12_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64615,7 +64831,7 @@ } }, { - "__docId__": 3320, + "__docId__": 3328, "kind": "variable", "name": "RGBA_BPTC_Format", "memberof": "src/viewer/scene/constants/constants.js", @@ -64634,7 +64850,7 @@ } }, { - "__docId__": 3321, + "__docId__": 3329, "kind": "variable", "name": "LinearEncoding", "memberof": "src/viewer/scene/constants/constants.js", @@ -64653,7 +64869,7 @@ } }, { - "__docId__": 3322, + "__docId__": 3330, "kind": "variable", "name": "sRGBEncoding", "memberof": "src/viewer/scene/constants/constants.js", @@ -64672,7 +64888,7 @@ } }, { - "__docId__": 3323, + "__docId__": 3331, "kind": "variable", "name": "GIFMediaType", "memberof": "src/viewer/scene/constants/constants.js", @@ -64691,7 +64907,7 @@ } }, { - "__docId__": 3324, + "__docId__": 3332, "kind": "variable", "name": "JPEGMediaType", "memberof": "src/viewer/scene/constants/constants.js", @@ -64710,7 +64926,7 @@ } }, { - "__docId__": 3325, + "__docId__": 3333, "kind": "variable", "name": "PNGMediaType", "memberof": "src/viewer/scene/constants/constants.js", @@ -64729,7 +64945,7 @@ } }, { - "__docId__": 3326, + "__docId__": 3334, "kind": "variable", "name": "CompressedMediaType", "memberof": "src/viewer/scene/constants/constants.js", @@ -64748,18 +64964,18 @@ } }, { - "__docId__": 3327, + "__docId__": 3335, "kind": "file", "name": "src/viewer/scene/core.js", "content": "import {Queue} from './utils/Queue.js';\nimport {Map} from './utils/Map.js';\nimport {stats} from './stats.js';\nimport {utils} from './utils.js';\n\nconst scenesRenderInfo = {}; // Used for throttling FPS for each Scene\nconst sceneIDMap = new Map(); // Ensures unique scene IDs\nconst taskQueue = new Queue(); // Task queue, which is pumped on each frame; tasks are pushed to it with calls to xeokit.schedule\nconst tickEvent = {sceneId: null, time: null, startTime: null, prevTime: null, deltaTime: null};\nconst taskBudget = 10; // Millisecs we're allowed to spend on tasks in each frame\nconst fpsSamples = [];\nconst numFPSSamples = 30;\n\nlet lastTime = 0;\nlet elapsedTime;\nlet totalFPS = 0;\n\n\n/**\n * @private\n */\nfunction Core() {\n\n /**\n Semantic version number. The value for this is set by an expression that's concatenated to\n the end of the built binary by the xeokit build script.\n @property version\n @namespace xeokit\n @type {String}\n */\n this.version = \"1.0.0\";\n\n /**\n Existing {@link Scene}s , mapped to their IDs\n @property scenes\n @namespace xeokit\n @type {Scene}\n */\n this.scenes = {};\n\n this._superTypes = {}; // For each component type, a list of its supertypes, ordered upwards in the hierarchy.\n\n /**\n * Registers a scene on xeokit.\n * This is called within the xeokit.Scene constructor.\n * @private\n */\n this._addScene = function (scene) {\n if (scene.id) { // User-supplied ID\n if (core.scenes[scene.id]) {\n console.error(`[ERROR] Scene ${utils.inQuotes(scene.id)} already exists`);\n return;\n }\n } else { // Auto-generated ID\n scene.id = sceneIDMap.addItem({});\n }\n core.scenes[scene.id] = scene;\n const ticksPerOcclusionTest = scene.ticksPerOcclusionTest;\n const ticksPerRender = scene.ticksPerRender;\n scenesRenderInfo[scene.id] = {\n ticksPerOcclusionTest: ticksPerOcclusionTest,\n ticksPerRender: ticksPerRender,\n renderCountdown: ticksPerRender\n };\n stats.components.scenes++;\n scene.once(\"destroyed\", () => { // Unregister destroyed scenes\n sceneIDMap.removeItem(scene.id);\n delete core.scenes[scene.id];\n delete scenesRenderInfo[scene.id];\n stats.components.scenes--;\n });\n };\n\n /**\n * @private\n */\n this.clear = function () {\n let scene;\n for (const id in core.scenes) {\n if (core.scenes.hasOwnProperty(id)) {\n scene = core.scenes[id];\n // Only clear the default Scene\n // but destroy all the others\n if (id === \"default.scene\") {\n scene.clear();\n } else {\n scene.destroy();\n delete core.scenes[scene.id];\n }\n }\n }\n };\n\n /**\n * Schedule a task to run at the next frame.\n *\n * Internally, this pushes the task to a FIFO queue. Within each frame interval, xeokit processes the queue\n * for a certain period of time, popping tasks and running them. After each frame interval, tasks that did not\n * get a chance to run during the task are left in the queue to be run next time.\n *\n * @param {Function} callback Callback that runs the task.\n * @param {Object} [scope] Scope for the callback.\n */\n this.scheduleTask = function (callback, scope = null) {\n taskQueue.push(callback);\n taskQueue.push(scope);\n };\n\n this.runTasks = function (until = -1) { // Pops and processes tasks in the queue, until the given number of milliseconds has elapsed.\n let time = (new Date()).getTime();\n let callback;\n let scope;\n let tasksRun = 0;\n while (taskQueue.length > 0 && (until < 0 || time < until)) {\n callback = taskQueue.shift();\n scope = taskQueue.shift();\n if (scope) {\n callback.call(scope);\n } else {\n callback();\n }\n time = (new Date()).getTime();\n tasksRun++;\n }\n return tasksRun;\n };\n\n this.getNumTasks = function () {\n return taskQueue.length;\n };\n}\n\n/**\n * @private\n * @type {Core}\n */\nconst core = new Core();\n\nconst frame = function () {\n let time = Date.now();\n elapsedTime = time - lastTime;\n if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats\n var newFPS = 1000 / elapsedTime; // Moving average of FPS\n totalFPS += newFPS;\n fpsSamples.push(newFPS);\n if (fpsSamples.length >= numFPSSamples) {\n totalFPS -= fpsSamples.shift();\n }\n stats.frame.fps = Math.round(totalFPS / fpsSamples.length);\n }\n for (let id in core.scenes) {\n core.scenes[id].compile();\n }\n runTasks(time);\n lastTime = time;\n};\n\nfunction customSetInterval(callback, interval) {\n let expected = Date.now() + interval;\n function loop() {\n const elapsed = Date.now() - expected;\n callback();\n expected += interval;\n setTimeout(loop, Math.max(0, interval - elapsed));\n }\n loop();\n return {\n cancel: function() {\n // No need to do anything, setTimeout cannot be directly cancelled\n }\n };\n}\n\ncustomSetInterval(() => {\n frame();\n}, 100);\n\nconst renderFrame = function () {\n let time = Date.now();\n elapsedTime = time - lastTime;\n if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats\n var newFPS = 1000 / elapsedTime; // Moving average of FPS\n totalFPS += newFPS;\n fpsSamples.push(newFPS);\n if (fpsSamples.length >= numFPSSamples) {\n totalFPS -= fpsSamples.shift();\n }\n stats.frame.fps = Math.round(totalFPS / fpsSamples.length);\n }\n runTasks(time);\n fireTickEvents(time);\n renderScenes();\n (window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(renderFrame);\n};\n\nrenderFrame();\n\nfunction runTasks(time) { // Process as many enqueued tasks as we can within the per-frame task budget\n const tasksRun = core.runTasks(time + taskBudget);\n const tasksScheduled = core.getNumTasks();\n stats.frame.tasksRun = tasksRun;\n stats.frame.tasksScheduled = tasksScheduled;\n stats.frame.tasksBudget = taskBudget;\n}\n\nfunction fireTickEvents(time) { // Fire tick event on each Scene\n tickEvent.time = time;\n for (var id in core.scenes) {\n if (core.scenes.hasOwnProperty(id)) {\n var scene = core.scenes[id];\n tickEvent.sceneId = id;\n tickEvent.startTime = scene.startTime;\n tickEvent.deltaTime = tickEvent.prevTime != null ? tickEvent.time - tickEvent.prevTime : 0;\n /**\n * Fired on each game loop iteration.\n *\n * @event tick\n * @param {String} sceneID The ID of this Scene.\n * @param {Number} startTime The time in seconds since 1970 that this Scene was instantiated.\n * @param {Number} time The time in seconds since 1970 of this \"tick\" event.\n * @param {Number} prevTime The time of the previous \"tick\" event from this Scene.\n * @param {Number} deltaTime The time in seconds since the previous \"tick\" event from this Scene.\n */\n scene.fire(\"tick\", tickEvent, true);\n }\n }\n tickEvent.prevTime = time;\n}\n\nfunction renderScenes() {\n const scenes = core.scenes;\n const forceRender = false;\n let scene;\n let renderInfo;\n let ticksPerOcclusionTest;\n let ticksPerRender;\n let id;\n for (id in scenes) {\n if (scenes.hasOwnProperty(id)) {\n\n scene = scenes[id];\n renderInfo = scenesRenderInfo[id];\n\n if (!renderInfo) {\n renderInfo = scenesRenderInfo[id] = {}; // FIXME\n }\n\n ticksPerOcclusionTest = scene.ticksPerOcclusionTest;\n if (renderInfo.ticksPerOcclusionTest !== ticksPerOcclusionTest) {\n renderInfo.ticksPerOcclusionTest = ticksPerOcclusionTest;\n renderInfo.renderCountdown = ticksPerOcclusionTest;\n }\n if (--scene.occlusionTestCountdown <= 0) {\n scene.doOcclusionTest();\n scene.occlusionTestCountdown = ticksPerOcclusionTest;\n }\n\n ticksPerRender = scene.ticksPerRender;\n if (renderInfo.ticksPerRender !== ticksPerRender) {\n renderInfo.ticksPerRender = ticksPerRender;\n renderInfo.renderCountdown = ticksPerRender;\n }\n if (--renderInfo.renderCountdown === 0) {\n scene.render(forceRender);\n renderInfo.renderCountdown = ticksPerRender;\n }\n }\n }\n}\n\nexport {core};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/core.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/core.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3328, + "__docId__": 3336, "kind": "variable", "name": "scenesRenderInfo", "memberof": "src/viewer/scene/core.js", @@ -64780,7 +64996,7 @@ "ignore": true }, { - "__docId__": 3329, + "__docId__": 3337, "kind": "variable", "name": "sceneIDMap", "memberof": "src/viewer/scene/core.js", @@ -64801,7 +65017,7 @@ "ignore": true }, { - "__docId__": 3330, + "__docId__": 3338, "kind": "variable", "name": "taskQueue", "memberof": "src/viewer/scene/core.js", @@ -64822,7 +65038,7 @@ "ignore": true }, { - "__docId__": 3331, + "__docId__": 3339, "kind": "variable", "name": "tickEvent", "memberof": "src/viewer/scene/core.js", @@ -64843,7 +65059,7 @@ "ignore": true }, { - "__docId__": 3332, + "__docId__": 3340, "kind": "variable", "name": "taskBudget", "memberof": "src/viewer/scene/core.js", @@ -64864,7 +65080,7 @@ "ignore": true }, { - "__docId__": 3333, + "__docId__": 3341, "kind": "variable", "name": "fpsSamples", "memberof": "src/viewer/scene/core.js", @@ -64885,7 +65101,7 @@ "ignore": true }, { - "__docId__": 3334, + "__docId__": 3342, "kind": "variable", "name": "numFPSSamples", "memberof": "src/viewer/scene/core.js", @@ -64906,7 +65122,7 @@ "ignore": true }, { - "__docId__": 3335, + "__docId__": 3343, "kind": "variable", "name": "lastTime", "memberof": "src/viewer/scene/core.js", @@ -64927,7 +65143,7 @@ "ignore": true }, { - "__docId__": 3336, + "__docId__": 3344, "kind": "variable", "name": "totalFPS", "memberof": "src/viewer/scene/core.js", @@ -64948,7 +65164,7 @@ "ignore": true }, { - "__docId__": 3337, + "__docId__": 3345, "kind": "function", "name": "Core", "memberof": "src/viewer/scene/core.js", @@ -64967,7 +65183,7 @@ "return": null }, { - "__docId__": 3338, + "__docId__": 3346, "kind": "function", "name": "frame", "memberof": "src/viewer/scene/core.js", @@ -64987,7 +65203,7 @@ "ignore": true }, { - "__docId__": 3339, + "__docId__": 3347, "kind": "function", "name": "customSetInterval", "memberof": "src/viewer/scene/core.js", @@ -65024,7 +65240,7 @@ "ignore": true }, { - "__docId__": 3340, + "__docId__": 3348, "kind": "function", "name": "renderFrame", "memberof": "src/viewer/scene/core.js", @@ -65044,7 +65260,7 @@ "ignore": true }, { - "__docId__": 3341, + "__docId__": 3349, "kind": "function", "name": "runTasks", "memberof": "src/viewer/scene/core.js", @@ -65071,7 +65287,7 @@ "ignore": true }, { - "__docId__": 3342, + "__docId__": 3350, "kind": "function", "name": "fireTickEvents", "memberof": "src/viewer/scene/core.js", @@ -65098,7 +65314,7 @@ "ignore": true }, { - "__docId__": 3343, + "__docId__": 3351, "kind": "function", "name": "renderScenes", "memberof": "src/viewer/scene/core.js", @@ -65118,7 +65334,7 @@ "ignore": true }, { - "__docId__": 3344, + "__docId__": 3352, "kind": "variable", "name": "core", "memberof": "src/viewer/scene/core.js", @@ -65141,18 +65357,18 @@ "ignore": true }, { - "__docId__": 3345, + "__docId__": 3353, "kind": "file", "name": "src/viewer/scene/geometry/Geometry.js", "content": "import {Component} from '../Component.js';\nimport {stats} from '../stats.js';\n\n/**\n * @desc Defines a shape for one or more {@link Mesh}es.\n *\n * * {@link ReadableGeometry} is a subclass that stores its data in both browser and GPU memory. Use ReadableGeometry when you need to keep the geometry arrays in browser memory.\n * * {@link VBOGeometry} is a subclass that stores its data solely in GPU memory. Use VBOGeometry when you need a lower memory footprint and don't need to keep the geometry data in browser memory.\n */\nclass Geometry extends Component {\n\n /** @private */\n get type() {\n return \"Geometry\";\n }\n\n /** @private */\n get isGeometry() {\n return true;\n }\n\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n stats.memory.meshes++;\n }\n\n destroy() {\n super.destroy();\n stats.memory.meshes--;\n }\n}\n\nexport {Geometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/Geometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/Geometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3346, + "__docId__": 3354, "kind": "class", "name": "Geometry", "memberof": "src/viewer/scene/geometry/Geometry.js", @@ -65170,7 +65386,7 @@ ] }, { - "__docId__": 3347, + "__docId__": 3355, "kind": "get", "name": "type", "memberof": "src/viewer/scene/geometry/Geometry.js~Geometry", @@ -65189,7 +65405,7 @@ } }, { - "__docId__": 3348, + "__docId__": 3356, "kind": "get", "name": "isGeometry", "memberof": "src/viewer/scene/geometry/Geometry.js~Geometry", @@ -65208,7 +65424,7 @@ } }, { - "__docId__": 3349, + "__docId__": 3357, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/geometry/Geometry.js~Geometry", @@ -65222,7 +65438,7 @@ "undocument": true }, { - "__docId__": 3350, + "__docId__": 3358, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/geometry/Geometry.js~Geometry", @@ -65238,18 +65454,18 @@ "return": null }, { - "__docId__": 3351, + "__docId__": 3359, "kind": "file", "name": "src/viewer/scene/geometry/ReadableGeometry.js", "content": "import {Geometry} from './Geometry.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {ArrayBuf} from '../webgl/ArrayBuf.js';\nimport {math} from '../math/math.js';\nimport {stats} from '../stats.js';\nimport {buildEdgeIndices} from '../math/buildEdgeIndices.js';\nimport {geometryCompressionUtils} from '../math/geometryCompressionUtils.js';\n\nconst memoryStats = stats.memory;\nconst tempAABB = math.AABB3();\n\n/**\n * @desc A {@link Geometry} that keeps its geometry data in both browser and GPU memory.\n *\n * ReadableGeometry uses more memory than {@link VBOGeometry}, which only stores its geometry data in GPU memory.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a ReadableGeometry that defines a single triangle, plus a {@link PhongMaterial} with diffuse {@link Texture}:\n *\n * [[Run this example](/examples/index.html#geometry_ReadableGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * const myMesh = new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, {\n * primitive: \"triangles\",\n * positions: [0.0, 3, 0.0, -3, -3, 0.0, 3, -3, 0.0],\n * normals: [0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0],\n * uv: [0.0, 0.0, 0.5, 1.0, 1.0, 0.0],\n * indices: [0, 1, 2]\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Get geometry data from browser memory:\n *\n * const positions = myMesh.geometry.positions; // Flat arrays\n * const normals = myMesh.geometry.normals;\n * const uv = myMesh.geometry.uv;\n * const indices = myMesh.geometry.indices;\n *\n * ````\n */\nclass ReadableGeometry extends Geometry {\n\n /**\n @private\n */\n get type() {\n return \"ReadableGeometry\";\n }\n\n /**\n * @private\n * @returns {Boolean}\n */\n get isReadableGeometry() {\n return true;\n }\n\n /**\n *\n @class ReadableGeometry\n @module xeokit\n @submodule geometry\n @constructor\n @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n @param {*} [cfg] Configs\n @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene},\n generated automatically when omitted.\n @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this Geometry.\n @param [cfg.primitive=\"triangles\"] {String} The primitive type. Accepted values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.\n @param [cfg.positions] {Number[]} Positions array.\n @param [cfg.normals] {Number[]} Vertex normal vectors array.\n @param [cfg.uv] {Number[]} UVs array.\n @param [cfg.colors] {Number[]} Vertex colors.\n @param [cfg.indices] {Number[]} Indices array.\n @param [cfg.autoVertexNormals=false] {Boolean} Set true to automatically generate normal vectors from the positions and\n indices, if those are supplied.\n @param [cfg.compressGeometry=false] {Boolean} Stores positions, colors, normals and UVs in compressGeometry and oct-encoded formats\n for reduced memory footprint and GPU bus usage.\n @param [cfg.edgeThreshold=10] {Number} When a {@link Mesh} renders this Geometry as wireframe,\n this indicates the threshold angle (in degrees) between the face normals of adjacent triangles below which the edge is discarded.\n @extends Component\n * @param owner\n * @param cfg\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({ // Arrays for emphasis effects are got from xeokit.Geometry friend methods\n compressGeometry: !!cfg.compressGeometry,\n primitive: null, // WebGL enum\n primitiveName: null, // String\n positions: null, // Uint16Array when compressGeometry == true, else Float32Array\n normals: null, // Uint8Array when compressGeometry == true, else Float32Array\n colors: null,\n uv: null, // Uint8Array when compressGeometry == true, else Float32Array\n indices: null,\n positionsDecodeMatrix: null, // Set when compressGeometry == true\n uvDecodeMatrix: null, // Set when compressGeometry == true\n positionsBuf: null,\n normalsBuf: null,\n colorsbuf: null,\n uvBuf: null,\n indicesBuf: null,\n hash: \"\"\n });\n\n this._numTriangles = 0;\n\n this._edgeThreshold = cfg.edgeThreshold || 10.0;\n\n // Lazy-generated VBOs\n\n this._edgeIndicesBuf = null;\n this._pickTrianglePositionsBuf = null;\n this._pickTriangleColorsBuf = null;\n\n // Local-space Boundary3D\n\n this._aabbDirty = true;\n\n this._boundingSphere = true;\n this._aabb = null;\n this._aabbDirty = true;\n\n this._obb = null;\n this._obbDirty = true;\n\n const state = this._state;\n const gl = this.scene.canvas.gl;\n\n // Primitive type\n\n cfg.primitive = cfg.primitive || \"triangles\";\n switch (cfg.primitive) {\n case \"points\":\n state.primitive = gl.POINTS;\n state.primitiveName = cfg.primitive;\n break;\n case \"lines\":\n state.primitive = gl.LINES;\n state.primitiveName = cfg.primitive;\n break;\n case \"line-loop\":\n state.primitive = gl.LINE_LOOP;\n state.primitiveName = cfg.primitive;\n break;\n case \"line-strip\":\n state.primitive = gl.LINE_STRIP;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangles\":\n state.primitive = gl.TRIANGLES;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangle-strip\":\n state.primitive = gl.TRIANGLE_STRIP;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangle-fan\":\n state.primitive = gl.TRIANGLE_FAN;\n state.primitiveName = cfg.primitive;\n break;\n default:\n this.error(\"Unsupported value for 'primitive': '\" + cfg.primitive +\n \"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', \" +\n \"'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'.\");\n state.primitive = gl.TRIANGLES;\n state.primitiveName = cfg.primitive;\n }\n\n if (cfg.positions) {\n if (this._state.compressGeometry) {\n const bounds = geometryCompressionUtils.getPositionsBounds(cfg.positions);\n const result = geometryCompressionUtils.compressPositions(cfg.positions, bounds.min, bounds.max);\n state.positions = result.quantized;\n state.positionsDecodeMatrix = result.decodeMatrix;\n } else {\n state.positions = cfg.positions.constructor === Float32Array ? cfg.positions : new Float32Array(cfg.positions);\n }\n }\n if (cfg.colors) {\n state.colors = cfg.colors.constructor === Float32Array ? cfg.colors : new Float32Array(cfg.colors);\n }\n if (cfg.uv) {\n if (this._state.compressGeometry) {\n const bounds = geometryCompressionUtils.getUVBounds(cfg.uv);\n const result = geometryCompressionUtils.compressUVs(cfg.uv, bounds.min, bounds.max);\n state.uv = result.quantized;\n state.uvDecodeMatrix = result.decodeMatrix;\n } else {\n state.uv = cfg.uv.constructor === Float32Array ? cfg.uv : new Float32Array(cfg.uv);\n }\n }\n if (cfg.normals) {\n if (this._state.compressGeometry) {\n state.normals = geometryCompressionUtils.compressNormals(cfg.normals);\n } else {\n state.normals = cfg.normals.constructor === Float32Array ? cfg.normals : new Float32Array(cfg.normals);\n }\n }\n if (cfg.indices) {\n state.indices = (cfg.indices.constructor === Uint32Array || cfg.indices.constructor === Uint16Array) ? cfg.indices : new Uint32Array(cfg.indices);\n if (this._state.primitiveName === \"triangles\") {\n this._numTriangles = (cfg.indices.length / 3);\n }\n }\n\n this._buildHash();\n\n memoryStats.meshes++;\n\n this._buildVBOs();\n }\n\n _buildVBOs() {\n const state = this._state;\n const gl = this.scene.canvas.gl;\n if (state.indices) {\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, state.indices, state.indices.length, 1, gl.STATIC_DRAW);\n memoryStats.indices += state.indicesBuf.numItems;\n }\n if (state.positions) {\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.positions, state.positions.length, 3, gl.STATIC_DRAW);\n memoryStats.positions += state.positionsBuf.numItems;\n }\n if (state.normals) {\n let normalized = state.compressGeometry;\n state.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.normals, state.normals.length, 3, gl.STATIC_DRAW, normalized);\n memoryStats.normals += state.normalsBuf.numItems;\n }\n if (state.colors) {\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.colors, state.colors.length, 4, gl.STATIC_DRAW);\n memoryStats.colors += state.colorsBuf.numItems;\n }\n if (state.uv) {\n state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.uv, state.uv.length, 2, gl.STATIC_DRAW);\n memoryStats.uvs += state.uvBuf.numItems;\n }\n }\n\n _buildHash() {\n const state = this._state;\n const hash = [\"/g\"];\n hash.push(\"/\" + state.primitive + \";\");\n if (state.positions) {\n hash.push(\"p\");\n }\n if (state.colors) {\n hash.push(\"c\");\n }\n if (state.normals || state.autoVertexNormals) {\n hash.push(\"n\");\n }\n if (state.uv) {\n hash.push(\"u\");\n }\n if (state.compressGeometry) {\n hash.push(\"cp\");\n }\n hash.push(\";\");\n state.hash = hash.join(\"\");\n }\n\n _getEdgeIndices() {\n if (!this._edgeIndicesBuf) {\n this._buildEdgeIndices();\n }\n return this._edgeIndicesBuf;\n }\n\n _getPickTrianglePositions() {\n if (!this._pickTrianglePositionsBuf) {\n this._buildPickTriangleVBOs();\n }\n return this._pickTrianglePositionsBuf;\n }\n\n _getPickTriangleColors() {\n if (!this._pickTriangleColorsBuf) {\n this._buildPickTriangleVBOs();\n }\n return this._pickTriangleColorsBuf;\n }\n\n _buildEdgeIndices() { // FIXME: Does not adjust indices after other objects are deleted from vertex buffer!!\n const state = this._state;\n if (!state.positions || !state.indices) {\n return;\n }\n const gl = this.scene.canvas.gl;\n const edgeIndices = buildEdgeIndices(state.positions, state.indices, state.positionsDecodeMatrix, this._edgeThreshold);\n this._edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, edgeIndices, edgeIndices.length, 1, gl.STATIC_DRAW);\n memoryStats.indices += this._edgeIndicesBuf.numItems;\n }\n\n _buildPickTriangleVBOs() { // Builds positions and indices arrays that allow each triangle to have a unique color\n const state = this._state;\n if (!state.positions || !state.indices) {\n return;\n }\n const gl = this.scene.canvas.gl;\n const arrays = math.buildPickTriangles(state.positions, state.indices, state.compressGeometry);\n const positions = arrays.positions;\n const colors = arrays.colors;\n this._pickTrianglePositionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);\n this._pickTriangleColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, colors.length, 4, gl.STATIC_DRAW, true);\n memoryStats.positions += this._pickTrianglePositionsBuf.numItems;\n memoryStats.colors += this._pickTriangleColorsBuf.numItems;\n }\n\n _buildPickVertexVBOs() {\n // var state = this._state;\n // if (!state.positions || !state.indices) {\n // return;\n // }\n // var gl = this.scene.canvas.gl;\n // var arrays = math.buildPickVertices(state.positions, state.indices, state.compressGeometry);\n // var pickVertexPositions = arrays.positions;\n // var pickColors = arrays.colors;\n // this._pickVertexPositionsBuf = new xeokit.renderer.ArrayBuf(gl, gl.ARRAY_BUFFER, pickVertexPositions, pickVertexPositions.length, 3, gl.STATIC_DRAW);\n // this._pickVertexColorsBuf = new xeokit.renderer.ArrayBuf(gl, gl.ARRAY_BUFFER, pickColors, pickColors.length, 4, gl.STATIC_DRAW, true);\n // memoryStats.positions += this._pickVertexPositionsBuf.numItems;\n // memoryStats.colors += this._pickVertexColorsBuf.numItems;\n }\n\n _webglContextLost() {\n if (this._sceneVertexBufs) {\n this._sceneVertexBufs.webglContextLost();\n }\n }\n\n _webglContextRestored() {\n if (this._sceneVertexBufs) {\n this._sceneVertexBufs.webglContextRestored();\n }\n this._buildVBOs();\n this._edgeIndicesBuf = null;\n this._pickVertexPositionsBuf = null;\n this._pickTrianglePositionsBuf = null;\n this._pickTriangleColorsBuf = null;\n this._pickVertexPositionsBuf = null;\n this._pickVertexColorsBuf = null;\n }\n\n /**\n * Gets the Geometry's primitive type.\n\n Valid types are: 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.\n\n @property primitive\n @default \"triangles\"\n @type {String}\n */\n get primitive() {\n return this._state.primitiveName;\n }\n\n /**\n Indicates if this Geometry is quantized.\n\n Compression is an internally-performed optimization which stores positions, colors, normals and UVs\n in quantized and oct-encoded formats for reduced memory footprint and GPU bus usage.\n\n Quantized geometry may not be updated.\n\n @property compressGeometry\n @default false\n @type {Boolean}\n @final\n */\n get compressGeometry() {\n return this._state.compressGeometry;\n }\n\n /**\n The Geometry's vertex positions.\n\n @property positions\n @default null\n @type {Number[]}\n */\n get positions() {\n if (!this._state.positions) {\n return null;\n }\n if (!this._state.compressGeometry) {\n return this._state.positions;\n }\n if (!this._decompressedPositions) {\n this._decompressedPositions = new Float32Array(this._state.positions.length);\n geometryCompressionUtils.decompressPositions(this._state.positions, this._state.positionsDecodeMatrix, this._decompressedPositions);\n }\n return this._decompressedPositions;\n }\n\n set positions(newPositions) {\n const state = this._state;\n const positions = state.positions;\n if (!positions) {\n this.error(\"can't update geometry positions - geometry has no positions\");\n return;\n }\n if (positions.length !== newPositions.length) {\n this.error(\"can't update geometry positions - new positions are wrong length\");\n return;\n }\n if (this._state.compressGeometry) {\n const bounds = geometryCompressionUtils.getPositionsBounds(newPositions);\n const result = geometryCompressionUtils.compressPositions(newPositions, bounds.min, bounds.max);\n newPositions = result.quantized; // TODO: Copy in-place\n state.positionsDecodeMatrix = result.decodeMatrix;\n }\n positions.set(newPositions);\n if (state.positionsBuf) {\n state.positionsBuf.setData(positions);\n }\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n The Geometry's vertex normals.\n\n @property normals\n @default null\n @type {Number[]}\n */\n get normals() {\n if (!this._state.normals) {\n return;\n }\n if (!this._state.compressGeometry) {\n return this._state.normals;\n }\n if (!this._decompressedNormals) {\n const lenCompressed = this._state.normals.length;\n const lenDecompressed = lenCompressed + (lenCompressed / 2); // 2 -> 3\n this._decompressedNormals = new Float32Array(lenDecompressed);\n geometryCompressionUtils.decompressNormals(this._state.normals, this._decompressedNormals);\n }\n return this._decompressedNormals;\n }\n\n set normals(newNormals) {\n if (this._state.compressGeometry) {\n this.error(\"can't update geometry normals - quantized geometry is immutable\"); // But will be eventually\n return;\n }\n const state = this._state;\n const normals = state.normals;\n if (!normals) {\n this.error(\"can't update geometry normals - geometry has no normals\");\n return;\n }\n if (normals.length !== newNormals.length) {\n this.error(\"can't update geometry normals - new normals are wrong length\");\n return;\n }\n normals.set(newNormals);\n if (state.normalsBuf) {\n state.normalsBuf.setData(normals);\n }\n this.glRedraw();\n }\n\n\n /**\n The Geometry's UV coordinates.\n\n @property uv\n @default null\n @type {Number[]}\n */\n get uv() {\n if (!this._state.uv) {\n return null;\n }\n if (!this._state.compressGeometry) {\n return this._state.uv;\n }\n if (!this._decompressedUV) {\n this._decompressedUV = new Float32Array(this._state.uv.length);\n geometryCompressionUtils.decompressUVs(this._state.uv, this._state.uvDecodeMatrix, this._decompressedUV);\n }\n return this._decompressedUV;\n }\n\n set uv(newUV) {\n if (this._state.compressGeometry) {\n this.error(\"can't update geometry UVs - quantized geometry is immutable\"); // But will be eventually\n return;\n }\n const state = this._state;\n const uv = state.uv;\n if (!uv) {\n this.error(\"can't update geometry UVs - geometry has no UVs\");\n return;\n }\n if (uv.length !== newUV.length) {\n this.error(\"can't update geometry UVs - new UVs are wrong length\");\n return;\n }\n uv.set(newUV);\n if (state.uvBuf) {\n state.uvBuf.setData(uv);\n }\n this.glRedraw();\n }\n\n /**\n The Geometry's vertex colors.\n\n @property colors\n @default null\n @type {Number[]}\n */\n get colors() {\n return this._state.colors;\n }\n\n set colors(newColors) {\n if (this._state.compressGeometry) {\n this.error(\"can't update geometry colors - quantized geometry is immutable\"); // But will be eventually\n return;\n }\n const state = this._state;\n const colors = state.colors;\n if (!colors) {\n this.error(\"can't update geometry colors - geometry has no colors\");\n return;\n }\n if (colors.length !== newColors.length) {\n this.error(\"can't update geometry colors - new colors are wrong length\");\n return;\n }\n colors.set(newColors);\n if (state.colorsBuf) {\n state.colorsBuf.setData(colors);\n }\n this.glRedraw();\n }\n\n /**\n The Geometry's indices.\n\n If ````xeokit.WEBGL_INFO.SUPPORTED_EXTENSIONS[\"OES_element_index_uint\"]```` is true, then this can be\n a ````Uint32Array````, otherwise it needs to be a ````Uint16Array````.\n\n @property indices\n @default null\n @type Uint16Array | Uint32Array\n @final\n */\n get indices() {\n return this._state.indices;\n }\n\n /**\n * Local-space axis-aligned 3D boundary (AABB) of this geometry.\n *\n * The AABB is represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @property aabb\n * @final\n * @type {Number[]}\n */\n get aabb() {\n if (this._aabbDirty) {\n if (!this._aabb) {\n this._aabb = math.AABB3();\n }\n math.positions3ToAABB3(this._state.positions, this._aabb, this._state.positionsDecodeMatrix);\n this._aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Local-space oriented 3D boundary (OBB) of this geometry.\n *\n * The OBB is represented by a 32-element Float64Array containing the eight vertices of the box,\n * where each vertex is a homogeneous coordinate having [x,y,z,w] elements.\n *\n * @property obb\n * @final\n * @type {Number[]}\n */\n get obb() {\n if (this._obbDirty) {\n if (!this._obb) {\n this._obb = math.OBB3();\n }\n math.positions3ToAABB3(this._state.positions, tempAABB, this._state.positionsDecodeMatrix);\n math.AABB3ToOBB3(tempAABB, this._obb);\n this._obbDirty = false;\n }\n return this._obb;\n }\n\n /**\n * Approximate number of triangles in this ReadableGeometry.\n *\n * Will be zero if {@link ReadableGeometry#primitive} is not 'triangles', 'triangle-strip' or 'triangle-fan'.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numTriangles;\n }\n\n _setAABBDirty() {\n if (this._aabbDirty) {\n return;\n }\n this._aabbDirty = true;\n this._aabbDirty = true;\n this._obbDirty = true;\n }\n\n _getState() {\n return this._state;\n }\n\n /**\n * Destroys this ReadableGeometry\n */\n destroy() {\n super.destroy();\n const state = this._state;\n if (state.indicesBuf) {\n state.indicesBuf.destroy();\n }\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n }\n if (state.normalsBuf) {\n state.normalsBuf.destroy();\n }\n if (state.uvBuf) {\n state.uvBuf.destroy();\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n }\n if (this._edgeIndicesBuf) {\n this._edgeIndicesBuf.destroy();\n }\n if (this._pickTrianglePositionsBuf) {\n this._pickTrianglePositionsBuf.destroy();\n }\n if (this._pickTriangleColorsBuf) {\n this._pickTriangleColorsBuf.destroy();\n }\n if (this._pickVertexPositionsBuf) {\n this._pickVertexPositionsBuf.destroy();\n }\n if (this._pickVertexColorsBuf) {\n this._pickVertexColorsBuf.destroy();\n }\n state.destroy();\n memoryStats.meshes--;\n }\n}\n\n\nexport {ReadableGeometry};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/ReadableGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/ReadableGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3352, + "__docId__": 3360, "kind": "variable", "name": "memoryStats", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js", @@ -65270,7 +65486,7 @@ "ignore": true }, { - "__docId__": 3353, + "__docId__": 3361, "kind": "variable", "name": "tempAABB", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js", @@ -65291,7 +65507,7 @@ "ignore": true }, { - "__docId__": 3354, + "__docId__": 3362, "kind": "class", "name": "ReadableGeometry", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js", @@ -65309,7 +65525,7 @@ ] }, { - "__docId__": 3355, + "__docId__": 3363, "kind": "get", "name": "type", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65328,7 +65544,7 @@ } }, { - "__docId__": 3356, + "__docId__": 3364, "kind": "get", "name": "isReadableGeometry", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65361,7 +65577,7 @@ } }, { - "__docId__": 3357, + "__docId__": 3365, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65556,7 +65772,7 @@ ] }, { - "__docId__": 3358, + "__docId__": 3366, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65574,7 +65790,7 @@ } }, { - "__docId__": 3359, + "__docId__": 3367, "kind": "member", "name": "_numTriangles", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65592,7 +65808,7 @@ } }, { - "__docId__": 3360, + "__docId__": 3368, "kind": "member", "name": "_edgeThreshold", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65610,7 +65826,7 @@ } }, { - "__docId__": 3361, + "__docId__": 3369, "kind": "member", "name": "_edgeIndicesBuf", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65628,7 +65844,7 @@ } }, { - "__docId__": 3362, + "__docId__": 3370, "kind": "member", "name": "_pickTrianglePositionsBuf", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65646,7 +65862,7 @@ } }, { - "__docId__": 3363, + "__docId__": 3371, "kind": "member", "name": "_pickTriangleColorsBuf", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65664,7 +65880,7 @@ } }, { - "__docId__": 3364, + "__docId__": 3372, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65682,7 +65898,7 @@ } }, { - "__docId__": 3365, + "__docId__": 3373, "kind": "member", "name": "_boundingSphere", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65700,7 +65916,7 @@ } }, { - "__docId__": 3366, + "__docId__": 3374, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65718,7 +65934,7 @@ } }, { - "__docId__": 3368, + "__docId__": 3376, "kind": "member", "name": "_obb", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65736,7 +65952,7 @@ } }, { - "__docId__": 3369, + "__docId__": 3377, "kind": "member", "name": "_obbDirty", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65754,7 +65970,7 @@ } }, { - "__docId__": 3371, + "__docId__": 3379, "kind": "method", "name": "_buildVBOs", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65771,7 +65987,7 @@ "return": null }, { - "__docId__": 3372, + "__docId__": 3380, "kind": "method", "name": "_buildHash", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65788,7 +66004,7 @@ "return": null }, { - "__docId__": 3373, + "__docId__": 3381, "kind": "method", "name": "_getEdgeIndices", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65809,7 +66025,7 @@ } }, { - "__docId__": 3374, + "__docId__": 3382, "kind": "method", "name": "_getPickTrianglePositions", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65830,7 +66046,7 @@ } }, { - "__docId__": 3375, + "__docId__": 3383, "kind": "method", "name": "_getPickTriangleColors", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65851,7 +66067,7 @@ } }, { - "__docId__": 3376, + "__docId__": 3384, "kind": "method", "name": "_buildEdgeIndices", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65868,7 +66084,7 @@ "return": null }, { - "__docId__": 3378, + "__docId__": 3386, "kind": "method", "name": "_buildPickTriangleVBOs", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65885,7 +66101,7 @@ "return": null }, { - "__docId__": 3381, + "__docId__": 3389, "kind": "method", "name": "_buildPickVertexVBOs", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65902,7 +66118,7 @@ "return": null }, { - "__docId__": 3382, + "__docId__": 3390, "kind": "method", "name": "_webglContextLost", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65919,7 +66135,7 @@ "return": null }, { - "__docId__": 3383, + "__docId__": 3391, "kind": "method", "name": "_webglContextRestored", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65936,7 +66152,7 @@ "return": null }, { - "__docId__": 3385, + "__docId__": 3393, "kind": "member", "name": "_pickVertexPositionsBuf", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65954,7 +66170,7 @@ } }, { - "__docId__": 3389, + "__docId__": 3397, "kind": "member", "name": "_pickVertexColorsBuf", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -65972,7 +66188,7 @@ } }, { - "__docId__": 3390, + "__docId__": 3398, "kind": "get", "name": "primitive", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66011,7 +66227,7 @@ } }, { - "__docId__": 3391, + "__docId__": 3399, "kind": "get", "name": "compressGeometry", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66054,7 +66270,7 @@ } }, { - "__docId__": 3392, + "__docId__": 3400, "kind": "get", "name": "positions", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66093,7 +66309,7 @@ } }, { - "__docId__": 3393, + "__docId__": 3401, "kind": "member", "name": "_decompressedPositions", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66111,7 +66327,7 @@ } }, { - "__docId__": 3394, + "__docId__": 3402, "kind": "set", "name": "positions", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66125,7 +66341,7 @@ "undocument": true }, { - "__docId__": 3395, + "__docId__": 3403, "kind": "get", "name": "normals", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66164,7 +66380,7 @@ } }, { - "__docId__": 3396, + "__docId__": 3404, "kind": "member", "name": "_decompressedNormals", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66182,7 +66398,7 @@ } }, { - "__docId__": 3397, + "__docId__": 3405, "kind": "set", "name": "normals", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66196,7 +66412,7 @@ "undocument": true }, { - "__docId__": 3398, + "__docId__": 3406, "kind": "get", "name": "uv", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66235,7 +66451,7 @@ } }, { - "__docId__": 3399, + "__docId__": 3407, "kind": "member", "name": "_decompressedUV", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66253,7 +66469,7 @@ } }, { - "__docId__": 3400, + "__docId__": 3408, "kind": "set", "name": "uv", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66267,7 +66483,7 @@ "undocument": true }, { - "__docId__": 3401, + "__docId__": 3409, "kind": "get", "name": "colors", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66306,7 +66522,7 @@ } }, { - "__docId__": 3402, + "__docId__": 3410, "kind": "set", "name": "colors", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66320,7 +66536,7 @@ "undocument": true }, { - "__docId__": 3403, + "__docId__": 3411, "kind": "get", "name": "indices", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66363,7 +66579,7 @@ } }, { - "__docId__": 3404, + "__docId__": 3412, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66402,7 +66618,7 @@ } }, { - "__docId__": 3407, + "__docId__": 3415, "kind": "get", "name": "obb", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66441,7 +66657,7 @@ } }, { - "__docId__": 3410, + "__docId__": 3418, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66462,7 +66678,7 @@ } }, { - "__docId__": 3411, + "__docId__": 3419, "kind": "method", "name": "_setAABBDirty", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66479,7 +66695,7 @@ "return": null }, { - "__docId__": 3415, + "__docId__": 3423, "kind": "method", "name": "_getState", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66500,7 +66716,7 @@ } }, { - "__docId__": 3416, + "__docId__": 3424, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/geometry/ReadableGeometry.js~ReadableGeometry", @@ -66515,18 +66731,18 @@ "return": null }, { - "__docId__": 3417, + "__docId__": 3425, "kind": "file", "name": "src/viewer/scene/geometry/VBOGeometry.js", "content": "import {Geometry} from './Geometry.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {ArrayBuf} from '../webgl/ArrayBuf.js';\nimport {math} from '../math/math.js';\nimport {stats} from '../stats.js';\nimport {buildEdgeIndices} from '../math/buildEdgeIndices.js';\nimport {geometryCompressionUtils} from '../math/geometryCompressionUtils.js';\n\nconst memoryStats = stats.memory;\nconst tempAABB = math.AABB3();\n\n/**\n * @desc A {@link Geometry} that keeps its geometry data solely in GPU memory, without retaining it in browser memory.\n *\n * VBOGeometry uses less memory than {@link ReadableGeometry}, which keeps its geometry data in both browser and GPU memory.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a VBOGeometry that defines a single triangle, plus a {@link PhongMaterial} with diffuse {@link Texture}:\n *\n * [[Run this example](/examples/index.html#geometry_VBOGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, VBOGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * new Mesh(viewer.scene, {\n * geometry: new VBOGeometry(viewer.scene, {\n * primitive: \"triangles\",\n * positions: [0.0, 3, 0.0, -3, -3, 0.0, 3, -3, 0.0],\n * normals: [0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0],\n * uv: [0.0, 0.0, 0.5, 1.0, 1.0, 0.0],\n * indices: [0, 1, 2]\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n * ````\n */\nclass VBOGeometry extends Geometry {\n\n /**\n @private\n */\n get type() {\n return \"VBOGeometry\";\n }\n\n /**\n * @private\n * @returns {Boolean}\n */\n get isVBOGeometry() {\n return true;\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {String} [cfg.primitive=\"triangles\"] The primitive type. Accepted values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.\n * @param {Number[]} [cfg.positions] Positions array.\n * @param {Number[]} [cfg.normals] Vertex normal vectors array.\n * @param {Number[]} [cfg.uv] UVs array.\n * @param {Number[]} [cfg.colors] Vertex colors.\n * @param {Number[]} [cfg.indices] Indices array.\n * @param {Number} [cfg.edgeThreshold=10] When autogenerating edges for supporting {@link Drawable#edges}, this indicates the threshold angle (in degrees) between the face normals of adjacent triangles below which the edge is discarded.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({ // Arrays for emphasis effects are got from xeokit.GeometryLite friend methods\n compressGeometry: true,\n primitive: null, // WebGL enum\n primitiveName: null, // String\n positionsDecodeMatrix: null, // Set when compressGeometry == true\n uvDecodeMatrix: null, // Set when compressGeometry == true\n positionsBuf: null,\n normalsBuf: null,\n colorsbuf: null,\n uvBuf: null,\n indicesBuf: null,\n hash: \"\"\n });\n\n this._numTriangles = 0;\n\n this._edgeThreshold = cfg.edgeThreshold || 10.0;\n this._aabb = null;\n this._obb = math.OBB3();\n\n const state = this._state;\n const gl = this.scene.canvas.gl;\n\n cfg.primitive = cfg.primitive || \"triangles\";\n switch (cfg.primitive) {\n case \"points\":\n state.primitive = gl.POINTS;\n state.primitiveName = cfg.primitive;\n break;\n case \"lines\":\n state.primitive = gl.LINES;\n state.primitiveName = cfg.primitive;\n break;\n case \"line-loop\":\n state.primitive = gl.LINE_LOOP;\n state.primitiveName = cfg.primitive;\n break;\n case \"line-strip\":\n state.primitive = gl.LINE_STRIP;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangles\":\n state.primitive = gl.TRIANGLES;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangle-strip\":\n state.primitive = gl.TRIANGLE_STRIP;\n state.primitiveName = cfg.primitive;\n break;\n case \"triangle-fan\":\n state.primitive = gl.TRIANGLE_FAN;\n state.primitiveName = cfg.primitive;\n break;\n default:\n this.error(\"Unsupported value for 'primitive': '\" + cfg.primitive +\n \"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', \" +\n \"'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'.\");\n state.primitive = gl.TRIANGLES;\n state.primitiveName = cfg.primitive;\n }\n\n if (!cfg.positions) {\n this.error(\"Config expected: positions\");\n return; // TODO: Recover?\n }\n\n if (!cfg.indices) {\n this.error(\"Config expected: indices\");\n return; // TODO: Recover?\n }\n\n var positions;\n\n {\n const positionsDecodeMatrix = cfg.positionsDecodeMatrix;\n\n if (positionsDecodeMatrix) {\n\n // Compressed positions\n\n } else {\n\n // Uncompressed positions\n\n const bounds = geometryCompressionUtils.getPositionsBounds(cfg.positions);\n const result = geometryCompressionUtils.compressPositions(cfg.positions, bounds.min, bounds.max);\n positions = result.quantized;\n state.positionsDecodeMatrix = result.decodeMatrix;\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);\n memoryStats.positions += state.positionsBuf.numItems;\n math.positions3ToAABB3(cfg.positions, this._aabb);\n math.positions3ToAABB3(positions, tempAABB, state.positionsDecodeMatrix);\n math.AABB3ToOBB3(tempAABB, this._obb);\n }\n }\n\n if (cfg.colors) {\n const colors = cfg.colors.constructor === Float32Array ? cfg.colors : new Float32Array(cfg.colors);\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, colors.length, 4, gl.STATIC_DRAW);\n memoryStats.colors += state.colorsBuf.numItems;\n }\n\n if (cfg.uv) {\n const bounds = geometryCompressionUtils.getUVBounds(cfg.uv);\n const result = geometryCompressionUtils.compressUVs(cfg.uv, bounds.min, bounds.max);\n const uv = result.quantized;\n state.uvDecodeMatrix = result.decodeMatrix;\n state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);\n memoryStats.uvs += state.uvBuf.numItems;\n }\n\n if (cfg.normals) {\n const normals = geometryCompressionUtils.compressNormals(cfg.normals);\n let normalized = state.compressGeometry;\n state.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, normals, normals.length, 3, gl.STATIC_DRAW, normalized);\n memoryStats.normals += state.normalsBuf.numItems;\n }\n\n {\n const indices = (cfg.indices.constructor === Uint32Array || cfg.indices.constructor === Uint16Array) ? cfg.indices : new Uint32Array(cfg.indices);\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, indices, indices.length, 1, gl.STATIC_DRAW);\n memoryStats.indices += state.indicesBuf.numItems;\n const edgeIndices = buildEdgeIndices(positions, indices, state.positionsDecodeMatrix, this._edgeThreshold);\n this._edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, edgeIndices, edgeIndices.length, 1, gl.STATIC_DRAW);\n\n if (this._state.primitiveName === \"triangles\") {\n this._numTriangles = (cfg.indices.length / 3);\n }\n }\n\n this._buildHash();\n\n memoryStats.meshes++;\n }\n\n _buildHash() {\n const state = this._state;\n const hash = [\"/g\"];\n hash.push(\"/\" + state.primitive + \";\");\n if (state.positionsBuf) {\n hash.push(\"p\");\n }\n if (state.colorsBuf) {\n hash.push(\"c\");\n }\n if (state.normalsBuf || state.autoVertexNormals) {\n hash.push(\"n\");\n }\n if (state.uvBuf) {\n hash.push(\"u\");\n }\n hash.push(\"cp\"); // Always compressed\n hash.push(\";\");\n state.hash = hash.join(\"\");\n }\n\n _getEdgeIndices() {\n return this._edgeIndicesBuf;\n }\n\n /**\n * Gets the primitive type.\n *\n * Possible types are: 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.\n *\n * @type {String}\n */\n get primitive() {\n return this._state.primitiveName;\n }\n\n /**\n * Gets the local-space axis-aligned 3D boundary (AABB).\n *\n * The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @type {Number[]}\n */\n get aabb() {\n return this._aabb;\n }\n\n /**\n * Gets the local-space oriented 3D boundary (OBB).\n *\n * The OBB is represented by a 32-element Float64Array containing the eight vertices of the box, where each vertex is a homogeneous coordinate having [x,y,z,w] elements.\n *\n * @type {Number[]}\n */\n get obb() {\n return this._obb;\n }\n\n /**\n * Approximate number of triangles in this VBOGeometry.\n *\n * Will be zero if {@link VBOGeometry#primitive} is not 'triangles', 'triangle-strip' or 'triangle-fan'.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numTriangles;\n }\n\n /** @private */\n _getState() {\n return this._state;\n }\n\n /**\n * Destroys this component.\n */\n destroy() {\n super.destroy();\n const state = this._state;\n if (state.indicesBuf) {\n state.indicesBuf.destroy();\n }\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n }\n if (state.normalsBuf) {\n state.normalsBuf.destroy();\n }\n if (state.uvBuf) {\n state.uvBuf.destroy();\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n }\n if (this._edgeIndicesBuf) {\n this._edgeIndicesBuf.destroy();\n }\n state.destroy();\n memoryStats.meshes--;\n }\n}\n\nexport {VBOGeometry};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/VBOGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/VBOGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3418, + "__docId__": 3426, "kind": "variable", "name": "memoryStats", "memberof": "src/viewer/scene/geometry/VBOGeometry.js", @@ -66547,7 +66763,7 @@ "ignore": true }, { - "__docId__": 3419, + "__docId__": 3427, "kind": "variable", "name": "tempAABB", "memberof": "src/viewer/scene/geometry/VBOGeometry.js", @@ -66568,7 +66784,7 @@ "ignore": true }, { - "__docId__": 3420, + "__docId__": 3428, "kind": "class", "name": "VBOGeometry", "memberof": "src/viewer/scene/geometry/VBOGeometry.js", @@ -66586,7 +66802,7 @@ ] }, { - "__docId__": 3421, + "__docId__": 3429, "kind": "get", "name": "type", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66605,7 +66821,7 @@ } }, { - "__docId__": 3422, + "__docId__": 3430, "kind": "get", "name": "isVBOGeometry", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66638,7 +66854,7 @@ } }, { - "__docId__": 3423, + "__docId__": 3431, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66763,7 +66979,7 @@ ] }, { - "__docId__": 3424, + "__docId__": 3432, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66781,7 +66997,7 @@ } }, { - "__docId__": 3425, + "__docId__": 3433, "kind": "member", "name": "_numTriangles", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66799,7 +67015,7 @@ } }, { - "__docId__": 3426, + "__docId__": 3434, "kind": "member", "name": "_edgeThreshold", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66817,7 +67033,7 @@ } }, { - "__docId__": 3427, + "__docId__": 3435, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66835,7 +67051,7 @@ } }, { - "__docId__": 3428, + "__docId__": 3436, "kind": "member", "name": "_obb", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66853,7 +67069,7 @@ } }, { - "__docId__": 3429, + "__docId__": 3437, "kind": "member", "name": "_edgeIndicesBuf", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66871,7 +67087,7 @@ } }, { - "__docId__": 3431, + "__docId__": 3439, "kind": "method", "name": "_buildHash", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66888,7 +67104,7 @@ "return": null }, { - "__docId__": 3432, + "__docId__": 3440, "kind": "method", "name": "_getEdgeIndices", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66909,7 +67125,7 @@ } }, { - "__docId__": 3433, + "__docId__": 3441, "kind": "get", "name": "primitive", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66930,7 +67146,7 @@ } }, { - "__docId__": 3434, + "__docId__": 3442, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66951,7 +67167,7 @@ } }, { - "__docId__": 3435, + "__docId__": 3443, "kind": "get", "name": "obb", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66972,7 +67188,7 @@ } }, { - "__docId__": 3436, + "__docId__": 3444, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -66993,7 +67209,7 @@ } }, { - "__docId__": 3437, + "__docId__": 3445, "kind": "method", "name": "_getState", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -67013,7 +67229,7 @@ } }, { - "__docId__": 3438, + "__docId__": 3446, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/geometry/VBOGeometry.js~VBOGeometry", @@ -67028,18 +67244,18 @@ "return": null }, { - "__docId__": 3439, + "__docId__": 3447, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildBoxGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates box-shaped {@link Geometry}.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry}.\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildBoxGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildBoxGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildBoxGeometry({\n * center: [0,0,0],\n * xSize: 1, // Half-size on each axis\n * ySize: 1,\n * zSize: 1\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildBoxGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number} [cfg.xSize=1.0] Half-size on the X-axis.\n * @param {Number} [cfg.ySize=1.0] Half-size on the Y-axis.\n * @param {Number} [cfg.zSize=1.0] Half-size on the Z-axis.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildBoxGeometry(cfg = {}) {\n\n let xSize = cfg.xSize || 1;\n if (xSize < 0) {\n console.error(\"negative xSize not allowed - will invert\");\n xSize *= -1;\n }\n\n let ySize = cfg.ySize || 1;\n if (ySize < 0) {\n console.error(\"negative ySize not allowed - will invert\");\n ySize *= -1;\n }\n\n let zSize = cfg.zSize || 1;\n if (zSize < 0) {\n console.error(\"negative zSize not allowed - will invert\");\n zSize *= -1;\n }\n\n const center = cfg.center;\n const centerX = center ? center[0] : 0;\n const centerY = center ? center[1] : 0;\n const centerZ = center ? center[2] : 0;\n\n const xmin = -xSize + centerX;\n const ymin = -ySize + centerY;\n const zmin = -zSize + centerZ;\n const xmax = xSize + centerX;\n const ymax = ySize + centerY;\n const zmax = zSize + centerZ;\n\n return utils.apply(cfg, {\n\n // The vertices - eight for our cube, each\n // one spanning three array elements for X,Y and Z\n positions: [\n\n // v0-v1-v2-v3 front\n xmax, ymax, zmax,\n xmin, ymax, zmax,\n xmin, ymin, zmax,\n xmax, ymin, zmax,\n\n // v0-v3-v4-v1 right\n xmax, ymax, zmax,\n xmax, ymin, zmax,\n xmax, ymin, zmin,\n xmax, ymax, zmin,\n\n // v0-v1-v6-v1 top\n xmax, ymax, zmax,\n xmax, ymax, zmin,\n xmin, ymax, zmin,\n xmin, ymax, zmax,\n\n // v1-v6-v7-v2 left\n xmin, ymax, zmax,\n xmin, ymax, zmin,\n xmin, ymin, zmin,\n xmin, ymin, zmax,\n\n // v7-v4-v3-v2 bottom\n xmin, ymin, zmin,\n xmax, ymin, zmin,\n xmax, ymin, zmax,\n xmin, ymin, zmax,\n\n // v4-v7-v6-v1 back\n xmax, ymin, zmin,\n xmin, ymin, zmin,\n xmin, ymax, zmin,\n xmax, ymax, zmin\n ],\n\n // Normal vectors, one for each vertex\n normals: [\n\n // v0-v1-v2-v3 front\n 0, 0, 1,\n 0, 0, 1,\n 0, 0, 1,\n 0, 0, 1,\n\n // v0-v3-v4-v5 right\n 1, 0, 0,\n 1, 0, 0,\n 1, 0, 0,\n 1, 0, 0,\n\n // v0-v5-v6-v1 top\n 0, 1, 0,\n 0, 1, 0,\n 0, 1, 0,\n 0, 1, 0,\n\n // v1-v6-v7-v2 left\n -1, 0, 0,\n -1, 0, 0,\n -1, 0, 0,\n -1, 0, 0,\n\n // v7-v4-v3-v2 bottom\n 0, -1, 0,\n 0, -1, 0,\n 0, -1, 0,\n 0, -1, 0,\n\n // v4-v7-v6-v5 back\n 0, 0, -1,\n 0, 0, -1,\n 0, 0, -1,\n 0, 0, -1\n ],\n\n // UV coords\n uv: [\n\n // v0-v1-v2-v3 front\n 1, 0,\n 0, 0,\n 0, 1,\n 1, 1,\n\n // v0-v3-v4-v1 right\n 0, 0,\n 0, 1,\n 1, 1,\n 1, 0,\n\n // v0-v1-v6-v1 top\n 1, 1,\n 1, 0,\n 0, 0,\n 0, 1,\n\n // v1-v6-v7-v2 left\n 1, 0,\n 0, 0,\n 0, 1,\n 1, 1,\n\n // v7-v4-v3-v2 bottom\n 0, 1,\n 1, 1,\n 1, 0,\n 0, 0,\n\n // v4-v7-v6-v1 back\n 0, 1,\n 1, 1,\n 1, 0,\n 0, 0\n ],\n\n // Indices - these organise the\n // positions and uv texture coordinates\n // into geometric primitives in accordance\n // with the \"primitive\" parameter,\n // in this case a set of three indices\n // for each triangle.\n //\n // Note that each triangle is specified\n // in counter-clockwise winding order.\n //\n // You can specify them in clockwise\n // order if you configure the Modes\n // node's frontFace flag as \"cw\", instead of\n // the default \"ccw\".\n indices: [\n 0, 1, 2,\n 0, 2, 3,\n // front\n 4, 5, 6,\n 4, 6, 7,\n // right\n 8, 9, 10,\n 8, 10, 11,\n // top\n 12, 13, 14,\n 12, 14, 15,\n // left\n 16, 17, 18,\n 16, 18, 19,\n // bottom\n 20, 21, 22,\n 20, 22, 23\n ]\n });\n}\n\nexport {buildBoxGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildBoxGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildBoxGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3440, + "__docId__": 3448, "kind": "function", "name": "buildBoxGeometry", "memberof": "src/viewer/scene/geometry/builders/buildBoxGeometry.js", @@ -67141,18 +67357,18 @@ } }, { - "__docId__": 3441, + "__docId__": 3449, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a box-shaped lines {@link Geometry}.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry} that has lines primitives.\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildBoxLinesGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildBoxLinesGeometry, ReadableGeometry, PhongMaterial} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometry({\n * center: [0,0,0],\n * xSize: 1, // Half-size on each axis\n * ySize: 1,\n * zSize: 1\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [0,1,0]\n * })\n * });\n * ````\n *\n * @function buildBoxLinesGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number} [cfg.xSize=1.0] Half-size on the X-axis.\n * @param {Number} [cfg.ySize=1.0] Half-size on the Y-axis.\n * @param {Number} [cfg.zSize=1.0] Half-size on the Z-axis.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildBoxLinesGeometry(cfg = {}) {\n\n let xSize = cfg.xSize || 1;\n if (xSize < 0) {\n console.error(\"negative xSize not allowed - will invert\");\n xSize *= -1;\n }\n\n let ySize = cfg.ySize || 1;\n if (ySize < 0) {\n console.error(\"negative ySize not allowed - will invert\");\n ySize *= -1;\n }\n\n let zSize = cfg.zSize || 1;\n if (zSize < 0) {\n console.error(\"negative zSize not allowed - will invert\");\n zSize *= -1;\n }\n\n const center = cfg.center;\n const centerX = center ? center[0] : 0;\n const centerY = center ? center[1] : 0;\n const centerZ = center ? center[2] : 0;\n\n const xmin = -xSize + centerX;\n const ymin = -ySize + centerY;\n const zmin = -zSize + centerZ;\n const xmax = xSize + centerX;\n const ymax = ySize + centerY;\n const zmax = zSize + centerZ;\n\n return utils.apply(cfg, {\n primitive: \"lines\",\n positions: [\n xmin, ymin, zmin,\n xmin, ymin, zmax,\n xmin, ymax, zmin,\n xmin, ymax, zmax,\n xmax, ymin, zmin,\n xmax, ymin, zmax,\n xmax, ymax, zmin,\n xmax, ymax, zmax\n ],\n indices: [\n 0, 1,\n 1, 3,\n 3, 2,\n 2, 0,\n 4, 5,\n 5, 7,\n 7, 6,\n 6, 4,\n 0, 4,\n 1, 5,\n 2, 6,\n 3, 7\n ]\n });\n}\n\n/**\n * @desc Creates a box-shaped lines {@link Geometry} from AABB.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry} that has lines primitives.\n * This box will be created from AABB of a model.\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildBoxLinesGeometryFromAABB)]\n *\n * ````javascript\n * import {Viewer, Mesh, Node, buildBoxGeometry, buildBoxLinesGeometryFromAABB, ReadableGeometry, PhongMaterial} from \"../../dist/xeokit-sdk.min.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({\n * xSize: 1,\n * ySize: 1,\n * zSize: 1\n * }));\n *\n * new Node(viewer.scene, {\n * id: \"table\",\n * isModel: true, // <--------------------- Node represents a model\n * rotation: [0, 50, 0],\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n *\n * children: [\n *\n * new Mesh(viewer.scene, { // Red table leg\n * id: \"redLeg\",\n * isObject: true, // <---------- Node represents an object\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * geometry: boxGeometry,\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1, 0.3, 0.3]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Green table leg\n * id: \"greenLeg\",\n * isObject: true, // <---------- Node represents an object\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * geometry: boxGeometry,\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 1.0, 0.3]\n * })\n * }),\n *\n * new Mesh(viewer.scene, {// Blue table leg\n * id: \"blueLeg\",\n * isObject: true, // <---------- Node represents an object\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * geometry: boxGeometry,\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 0.3, 1.0]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Yellow table leg\n * id: \"yellowLeg\",\n * isObject: true, // <---------- Node represents an object\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * geometry: boxGeometry,\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 1.0, 0.0]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Purple table top\n * id: \"tableTop\",\n * isObject: true, // <---------- Node represents an object\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * geometry: boxGeometry,\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 0.3, 1.0]\n * })\n * })\n * ]\n * });\n *\n * let aabb = viewer.scene.aabb;\n * console.log(aabb);\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometryFromAABB({\n * id: \"aabb\",\n * aabb: aabb,\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [0, 1,]\n * })\n * });\n * ````\n *\n * @function buildBoxLinesGeometryFromAABB\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.aabb] AABB for which box will be created.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildBoxLinesGeometryFromAABB(cfg = {}){\n return buildBoxLinesGeometry({\n id: cfg.id,\n center: [\n (cfg.aabb[0] + cfg.aabb[3]) / 2.0,\n (cfg.aabb[1] + cfg.aabb[4]) / 2.0,\n (cfg.aabb[2] + cfg.aabb[5]) / 2.0,\n ],\n xSize: (Math.abs(cfg.aabb[3] - cfg.aabb[0])) / 2.0,\n ySize: (Math.abs(cfg.aabb[4] - cfg.aabb[1])) / 2.0,\n zSize: (Math.abs(cfg.aabb[5] - cfg.aabb[2])) / 2.0,\n });\n}\n\nexport {buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3442, + "__docId__": 3450, "kind": "function", "name": "buildBoxLinesGeometry", "memberof": "src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js", @@ -67254,7 +67470,7 @@ } }, { - "__docId__": 3443, + "__docId__": 3451, "kind": "function", "name": "buildBoxLinesGeometryFromAABB", "memberof": "src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js", @@ -67320,18 +67536,18 @@ } }, { - "__docId__": 3444, + "__docId__": 3452, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildCylinderGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a cylinder-shaped {@link Geometry}.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a cylinder-shaped {@link ReadableGeometry} :\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildCylinderGeometry)]\n *\n * ````javascript\n *\n * import {Viewer, Mesh, buildCylinderGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildCylinderGeometry({\n * center: [0,0,0],\n * radiusTop: 2.0,\n * radiusBottom: 2.0,\n * height: 5.0,\n * radialSegments: 20,\n * heightSegments: 1,\n * openEnded: false\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildCylinderGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number} [cfg.radiusTop=1] Radius of top.\n * @param {Number} [cfg.radiusBottom=1] Radius of bottom.\n * @param {Number} [cfg.height=1] Height.\n * @param {Number} [cfg.radialSegments=60] Number of horizontal segments.\n * @param {Number} [cfg.heightSegments=1] Number of vertical segments.\n * @param {Boolean} [cfg.openEnded=false] Whether or not the cylinder has solid caps on the ends.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildCylinderGeometry(cfg = {}) {\n\n let radiusTop = cfg.radiusTop || 1;\n if (radiusTop < 0) {\n console.error(\"negative radiusTop not allowed - will invert\");\n radiusTop *= -1;\n }\n\n let radiusBottom = cfg.radiusBottom || 1;\n if (radiusBottom < 0) {\n console.error(\"negative radiusBottom not allowed - will invert\");\n radiusBottom *= -1;\n }\n\n let height = cfg.height || 1;\n if (height < 0) {\n console.error(\"negative height not allowed - will invert\");\n height *= -1;\n }\n\n let radialSegments = cfg.radialSegments || 32;\n if (radialSegments < 0) {\n console.error(\"negative radialSegments not allowed - will invert\");\n radialSegments *= -1;\n }\n if (radialSegments < 3) {\n radialSegments = 3;\n }\n\n let heightSegments = cfg.heightSegments || 1;\n if (heightSegments < 0) {\n console.error(\"negative heightSegments not allowed - will invert\");\n heightSegments *= -1;\n }\n if (heightSegments < 1) {\n heightSegments = 1;\n }\n\n const openEnded = !!cfg.openEnded;\n\n let center = cfg.center;\n const centerX = center ? center[0] : 0;\n const centerY = center ? center[1] : 0;\n const centerZ = center ? center[2] : 0;\n\n const heightHalf = height / 2;\n const heightLength = height / heightSegments;\n const radialAngle = (2.0 * Math.PI / radialSegments);\n const radialLength = 1.0 / radialSegments;\n //var nextRadius = this._radiusBottom;\n const radiusChange = (radiusTop - radiusBottom) / heightSegments;\n\n const positions = [];\n const normals = [];\n const uvs = [];\n const indices = [];\n\n let h;\n let i;\n\n let x;\n let z;\n\n let currentRadius;\n let currentHeight;\n\n let first;\n let second;\n\n let startIndex;\n let tu;\n let tv;\n\n // create vertices\n const normalY = (90.0 - (Math.atan(height / (radiusBottom - radiusTop))) * 180 / Math.PI) / 90.0;\n\n for (h = 0; h <= heightSegments; h++) {\n currentRadius = radiusTop - h * radiusChange;\n currentHeight = heightHalf - h * heightLength;\n\n for (i = 0; i <= radialSegments; i++) {\n x = Math.sin(i * radialAngle);\n z = Math.cos(i * radialAngle);\n\n normals.push(currentRadius * x);\n normals.push(normalY); //todo\n normals.push(currentRadius * z);\n\n uvs.push((i * radialLength));\n uvs.push(h * 1 / heightSegments);\n\n positions.push((currentRadius * x) + centerX);\n positions.push((currentHeight) + centerY);\n positions.push((currentRadius * z) + centerZ);\n }\n }\n\n // create faces\n for (h = 0; h < heightSegments; h++) {\n for (i = 0; i <= radialSegments; i++) {\n\n first = h * (radialSegments + 1) + i;\n second = first + radialSegments;\n\n indices.push(first);\n indices.push(second);\n indices.push(second + 1);\n\n indices.push(first);\n indices.push(second + 1);\n indices.push(first + 1);\n }\n }\n\n // create top cap\n if (!openEnded && radiusTop > 0) {\n startIndex = (positions.length / 3);\n\n // top center\n normals.push(0.0);\n normals.push(1.0);\n normals.push(0.0);\n\n uvs.push(0.5);\n uvs.push(0.5);\n\n positions.push(0 + centerX);\n positions.push(heightHalf + centerY);\n positions.push(0 + centerZ);\n\n // top triangle fan\n for (i = 0; i <= radialSegments; i++) {\n x = Math.sin(i * radialAngle);\n z = Math.cos(i * radialAngle);\n tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;\n tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;\n\n normals.push(radiusTop * x);\n normals.push(1.0);\n normals.push(radiusTop * z);\n\n uvs.push(tu);\n uvs.push(tv);\n\n positions.push((radiusTop * x) + centerX);\n positions.push((heightHalf) + centerY);\n positions.push((radiusTop * z) + centerZ);\n }\n\n for (i = 0; i < radialSegments; i++) {\n center = startIndex;\n first = startIndex + 1 + i;\n\n indices.push(first);\n indices.push(first + 1);\n indices.push(center);\n }\n }\n\n // create bottom cap\n if (!openEnded && radiusBottom > 0) {\n\n startIndex = (positions.length / 3);\n\n // top center\n normals.push(0.0);\n normals.push(-1.0);\n normals.push(0.0);\n\n uvs.push(0.5);\n uvs.push(0.5);\n\n positions.push(0 + centerX);\n positions.push(0 - heightHalf + centerY);\n positions.push(0 + centerZ);\n\n // top triangle fan\n for (i = 0; i <= radialSegments; i++) {\n\n x = Math.sin(i * radialAngle);\n z = Math.cos(i * radialAngle);\n\n tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;\n tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;\n\n normals.push(radiusBottom * x);\n normals.push(-1.0);\n normals.push(radiusBottom * z);\n\n uvs.push(tu);\n uvs.push(tv);\n\n positions.push((radiusBottom * x) + centerX);\n positions.push((0 - heightHalf) + centerY);\n positions.push((radiusBottom * z) + centerZ);\n }\n\n for (i = 0; i < radialSegments; i++) {\n\n center = startIndex;\n first = startIndex + 1 + i;\n\n indices.push(center);\n indices.push(first + 1);\n indices.push(first);\n }\n }\n\n return utils.apply(cfg, {\n positions: positions,\n normals: normals,\n uv: uvs,\n indices: indices\n });\n}\n\n\nexport {buildCylinderGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildCylinderGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildCylinderGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3445, + "__docId__": 3453, "kind": "function", "name": "buildCylinderGeometry", "memberof": "src/viewer/scene/geometry/builders/buildCylinderGeometry.js", @@ -67469,18 +67685,18 @@ } }, { - "__docId__": 3446, + "__docId__": 3454, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildGridGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a grid-shaped {@link Geometry}.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a GridGeometry and a {@link PhongMaterial}:\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildGridGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildGridGeometry, VBOGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new VBOGeometry(viewer.scene, buildGridGeometry({\n * size: 1000,\n * divisions: 500\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * color: [0.0, 0.0, 0.0],\n * emissive: [0.4, 0.4, 0.4]\n * }),\n * position: [0, -1.6, 0]\n * });\n * ````\n *\n * @function buildGridGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number} [cfg.size=1] Dimension on the X and Z-axis.\n * @param {Number} [cfg.divisions=1] Number of divisions on X and Z axis..\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildGridGeometry(cfg = {}) {\n\n let size = cfg.size || 1;\n if (size < 0) {\n console.error(\"negative size not allowed - will invert\");\n size *= -1;\n }\n\n let divisions = cfg.divisions || 1;\n if (divisions < 0) {\n console.error(\"negative divisions not allowed - will invert\");\n divisions *= -1;\n }\n if (divisions < 1) {\n divisions = 1;\n }\n\n size = size || 10;\n divisions = divisions || 10;\n\n const step = size / divisions;\n const halfSize = size / 2;\n\n const positions = [];\n const indices = [];\n let l = 0;\n\n for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) {\n\n positions.push(-halfSize);\n positions.push(0);\n positions.push(k);\n\n positions.push(halfSize);\n positions.push(0);\n positions.push(k);\n\n positions.push(k);\n positions.push(0);\n positions.push(-halfSize);\n\n positions.push(k);\n positions.push(0);\n positions.push(halfSize);\n\n indices.push(l++);\n indices.push(l++);\n indices.push(l++);\n indices.push(l++);\n }\n\n return utils.apply(cfg, {\n primitive: \"lines\",\n positions: positions,\n indices: indices\n });\n}\n\n\nexport {buildGridGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildGridGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildGridGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3447, + "__docId__": 3455, "kind": "function", "name": "buildGridGeometry", "memberof": "src/viewer/scene/geometry/builders/buildGridGeometry.js", @@ -67560,18 +67776,18 @@ } }, { - "__docId__": 3448, + "__docId__": 3456, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildPlaneGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a plane-shaped {@link Geometry}.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a PlaneGeometry and a {@link PhongMaterial} with diffuse {@link Texture}:\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#buildPlaneGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildPlaneGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPlaneGeometry({\n * center: [0,0,0],\n * xSize: 2,\n * zSize: 2,\n * xSegments: 10,\n * zSegments: 10\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildPlaneGeometry\n * @param {*} [cfg] Configs\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number} [cfg.xSize=1] Dimension on the X-axis.\n * @param {Number} [cfg.zSize=1] Dimension on the Z-axis.\n * @param {Number} [cfg.xSegments=1] Number of segments on the X-axis.\n * @param {Number} [cfg.zSegments=1] Number of segments on the Z-axis.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildPlaneGeometry(cfg = {}) {\n\n let xSize = cfg.xSize || 1;\n if (xSize < 0) {\n console.error(\"negative xSize not allowed - will invert\");\n xSize *= -1;\n }\n\n let zSize = cfg.zSize || 1;\n if (zSize < 0) {\n console.error(\"negative zSize not allowed - will invert\");\n zSize *= -1;\n }\n\n let xSegments = cfg.xSegments || 1;\n if (xSegments < 0) {\n console.error(\"negative xSegments not allowed - will invert\");\n xSegments *= -1;\n }\n if (xSegments < 1) {\n xSegments = 1;\n }\n\n let zSegments = cfg.xSegments || 1;\n if (zSegments < 0) {\n console.error(\"negative zSegments not allowed - will invert\");\n zSegments *= -1;\n }\n if (zSegments < 1) {\n zSegments = 1;\n }\n\n const center = cfg.center;\n const centerX = center ? center[0] : 0;\n const centerY = center ? center[1] : 0;\n const centerZ = center ? center[2] : 0;\n\n const halfWidth = xSize / 2;\n const halfHeight = zSize / 2;\n\n const planeX = Math.floor(xSegments) || 1;\n const planeZ = Math.floor(zSegments) || 1;\n\n const planeX1 = planeX + 1;\n const planeZ1 = planeZ + 1;\n\n const segmentWidth = xSize / planeX;\n const segmentHeight = zSize / planeZ;\n\n const positions = new Float32Array(planeX1 * planeZ1 * 3);\n const normals = new Float32Array(planeX1 * planeZ1 * 3);\n const uvs = new Float32Array(planeX1 * planeZ1 * 2);\n\n let offset = 0;\n let offset2 = 0;\n\n let iz;\n let ix;\n let x;\n let a;\n let b;\n let c;\n let d;\n\n for (iz = 0; iz < planeZ1; iz++) {\n\n const z = iz * segmentHeight - halfHeight;\n\n for (ix = 0; ix < planeX1; ix++) {\n\n x = ix * segmentWidth - halfWidth;\n\n positions[offset] = x + centerX;\n positions[offset + 1] = centerY;\n positions[offset + 2] = -z + centerZ;\n\n normals[offset + 2] = -1;\n\n uvs[offset2] = (ix) / planeX;\n uvs[offset2 + 1] = ((planeZ - iz) / planeZ);\n\n offset += 3;\n offset2 += 2;\n }\n }\n\n offset = 0;\n\n const indices = new ((positions.length / 3) > 65535 ? Uint32Array : Uint16Array)(planeX * planeZ * 6);\n\n for (iz = 0; iz < planeZ; iz++) {\n\n for (ix = 0; ix < planeX; ix++) {\n\n a = ix + planeX1 * iz;\n b = ix + planeX1 * (iz + 1);\n c = (ix + 1) + planeX1 * (iz + 1);\n d = (ix + 1) + planeX1 * iz;\n\n indices[offset] = d;\n indices[offset + 1] = b;\n indices[offset + 2] = a;\n\n indices[offset + 3] = d;\n indices[offset + 4] = c;\n indices[offset + 5] = b;\n\n offset += 6;\n }\n }\n\n return utils.apply(cfg, {\n positions: positions,\n normals: normals,\n uv: uvs,\n indices: indices\n });\n}\n\nexport {buildPlaneGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildPlaneGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildPlaneGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3449, + "__docId__": 3457, "kind": "function", "name": "buildPlaneGeometry", "memberof": "src/viewer/scene/geometry/builders/buildPlaneGeometry.js", @@ -67685,18 +67901,18 @@ } }, { - "__docId__": 3450, + "__docId__": 3458, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildPolylineGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a 3D polyline {@link Geometry}.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a polyline {@link ReadableGeometry} that has lines primitives.\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#buildPolylineGeometry)]\n *\n * ````javascript\n * //------------------------------------------------------------------------------------------------------------------\n * // Import the modules we need for this example\n * //------------------------------------------------------------------------------------------------------------------\n *\n * import {buildPolylineGeometry, Viewer, Mesh, ReadableGeometry, PhongMaterial} from \"../../dist/xeokit-sdk.min.es.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a Viewer and arrange the camera\n * //------------------------------------------------------------------------------------------------------------------\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 8];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a mesh with polyline shape\n * //------------------------------------------------------------------------------------------------------------------\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometry({\n * points: [\n * 0, 2.83654, 0,\n * -0.665144, 1.152063, 0,\n * -2.456516, 1.41827, 0,\n * -1.330288, 0, 0,\n * -2.456516, -1.41827, 0,\n * -0.665144, -1.152063, 0,\n * 0, -2.83654, 0,\n * 0.665144, -1.152063, 0,\n * 2.456516, -1.41827, 0,\n * 1.330288, 0, 0,\n * 2.456516, 1.41827, 0,\n * 0.665144, 1.152063, 0,\n * 0, 2.83654, 0,\n * ]\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [0, 1,]\n * })\n * });\n * ````\n *\n * @function buildPolylineGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.points] 3D points indicating vertices position.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildPolylineGeometry(cfg = {}) {\n\n if (cfg.points.length % 3 !== 0) {\n throw \"Size of points array for given polyline should be divisible by 3\";\n }\n let numberOfPoints = cfg.points.length / 3;\n if (numberOfPoints < 2) {\n throw \"There should be at least 2 points to create a polyline\";\n }\n let indices = [];\n for (let i = 0; i < numberOfPoints - 1; i++) {\n indices.push(i);\n indices.push(i + 1);\n }\n\n return utils.apply(cfg, {\n primitive: \"lines\",\n positions: cfg.points,\n indices: indices,\n });\n}\n\n/**\n * @desc Creates a 3D polyline from curve {@link Geometry}.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a polyline {@link ReadableGeometry} created from curves.\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#buildPolylineGeometryFromCurve)]\n *\n * ````javascript\n * //------------------------------------------------------------------------------------------------------------------\n * // Import the modules we need for this example\n * //------------------------------------------------------------------------------------------------------------------\n *\n * import {buildPolylineGeometryFromCurve, Viewer, Mesh, PhongMaterial, NavCubePlugin, CubicBezierCurve, SplineCurve, QuadraticBezierCurve, ReadableGeometry} from \"../../dist/xeokit-sdk.min.es.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a Viewer and arrange the camera\n * //------------------------------------------------------------------------------------------------------------------\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * new NavCubePlugin(viewer, {\n * canvasId: \"myNavCubeCanvas\",\n * visible: true,\n * size: 250,\n * alignment: \"bottomRight\",\n * bottomMargin: 100,\n * rightMargin: 10\n * });\n *\n * viewer.camera.eye = [0, -250, 1];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a mesh with polyline shape from Spline\n * //------------------------------------------------------------------------------------------------------------------\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({\n * id: \"SplineCurve\",\n * curve: new SplineCurve(viewer.scene, {\n * points: [\n * [-65.77614, 0, -88.881992],\n * [90.020852, 0, -61.589088],\n * [-67.766247, 0, -22.071238],\n * [93.148164, 0, -13.826507],\n * [-14.033343, 0, 3.231558],\n * [32.592034, 0, 9.20188],\n * [3.309023, 0, 22.848332],\n * [23.210098, 0, 28.818655],\n * ],\n * }),\n * divisions: 100,\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [1, 0, 0]\n * })\n * });\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a mesh with polyline shape from CubicBezier\n * //------------------------------------------------------------------------------------------------------------------\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({\n * id: \"CubicBezierCurve\",\n * curve: new CubicBezierCurve(viewer.scene, {\n * v0: [120, 0, 100],\n * v1: [120, 0, 0],\n * v2: [80, 0, 100],\n * v3: [80, 0, 0],\n * }),\n * divisions: 50,\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [0, 1, 0]\n * })\n * });\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a mesh with polyline shape from QuadraticBezier\n * //------------------------------------------------------------------------------------------------------------------\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({\n * id: \"QuadraticBezierCurve\",\n * curve: new QuadraticBezierCurve(viewer.scene, {\n * v0: [-100, 0, 100],\n * v1: [-50, 0, 150],\n * v2: [-50, 0, 0],\n * }),\n * divisions: 20,\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [0, 0, 1]\n * })\n * });\n * ````\n *\n * @function buildPolylineGeometryFromCurve\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Object} [cfg.curve] Curve for which polyline will be created.\n * @param {Number} [cfg.divisions] The number of divisions.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildPolylineGeometryFromCurve(cfg = {}) {\n\n let polylinePoints = cfg.curve.getPoints(cfg.divisions).map(a => [...a]).flat();\n return buildPolylineGeometry({\n id: cfg.id,\n points: polylinePoints\n });\n}\n\nexport {buildPolylineGeometry, buildPolylineGeometryFromCurve};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildPolylineGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildPolylineGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3451, + "__docId__": 3459, "kind": "function", "name": "buildPolylineGeometry", "memberof": "src/viewer/scene/geometry/builders/buildPolylineGeometry.js", @@ -67762,7 +67978,7 @@ } }, { - "__docId__": 3452, + "__docId__": 3460, "kind": "function", "name": "buildPolylineGeometryFromCurve", "memberof": "src/viewer/scene/geometry/builders/buildPolylineGeometry.js", @@ -67838,18 +68054,18 @@ } }, { - "__docId__": 3453, + "__docId__": 3461, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildSphereGeometry.js", "content": "import {utils} from '../../utils.js';\n\n/**\n * @desc Creates a sphere-shaped {@link Geometry}.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with a sphere-shaped {@link ReadableGeometry} :\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#buildSphereGeometry)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * center: [0,0,0],\n * radius: 1.5,\n * heightSegments: 60,\n * widthSegments: 60\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildSphereGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number} [cfg.radius=1] Radius.\n * @param {Number} [cfg.heightSegments=24] Number of latitudinal bands.\n * @param {Number} [cfg.widthSegments=18] Number of longitudinal bands.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildSphereGeometry(cfg = {}) {\n\n const lod = cfg.lod || 1;\n\n const centerX = cfg.center ? cfg.center[0] : 0;\n const centerY = cfg.center ? cfg.center[1] : 0;\n const centerZ = cfg.center ? cfg.center[2] : 0;\n\n let radius = cfg.radius || 1;\n if (radius < 0) {\n console.error(\"negative radius not allowed - will invert\");\n radius *= -1;\n }\n\n let heightSegments = cfg.heightSegments || 18;\n if (heightSegments < 0) {\n console.error(\"negative heightSegments not allowed - will invert\");\n heightSegments *= -1;\n }\n heightSegments = Math.floor(lod * heightSegments);\n if (heightSegments < 18) {\n heightSegments = 18;\n }\n\n let widthSegments = cfg.widthSegments || 18;\n if (widthSegments < 0) {\n console.error(\"negative widthSegments not allowed - will invert\");\n widthSegments *= -1;\n }\n widthSegments = Math.floor(lod * widthSegments);\n if (widthSegments < 18) {\n widthSegments = 18;\n }\n\n const positions = [];\n const normals = [];\n const uvs = [];\n const indices = [];\n\n let i;\n let j;\n\n let theta;\n let sinTheta;\n let cosTheta;\n\n let phi;\n let sinPhi;\n let cosPhi;\n\n let x;\n let y;\n let z;\n\n let u;\n let v;\n\n let first;\n let second;\n\n for (i = 0; i <= heightSegments; i++) {\n\n theta = i * Math.PI / heightSegments;\n sinTheta = Math.sin(theta);\n cosTheta = Math.cos(theta);\n\n for (j = 0; j <= widthSegments; j++) {\n\n phi = j * 2 * Math.PI / widthSegments;\n sinPhi = Math.sin(phi);\n cosPhi = Math.cos(phi);\n\n x = cosPhi * sinTheta;\n y = cosTheta;\n z = sinPhi * sinTheta;\n u = 1.0 - j / widthSegments;\n v = i / heightSegments;\n\n normals.push(x);\n normals.push(y);\n normals.push(z);\n\n uvs.push(u);\n uvs.push(v);\n\n positions.push(centerX + radius * x);\n positions.push(centerY + radius * y);\n positions.push(centerZ + radius * z);\n }\n }\n\n for (i = 0; i < heightSegments; i++) {\n for (j = 0; j < widthSegments; j++) {\n\n first = (i * (widthSegments + 1)) + j;\n second = first + widthSegments + 1;\n\n indices.push(first + 1);\n indices.push(second + 1);\n indices.push(second);\n indices.push(first + 1);\n indices.push(second);\n indices.push(first);\n }\n }\n\n return utils.apply(cfg, {\n positions: positions,\n normals: normals,\n uv: uvs,\n indices: indices\n });\n}\n\nexport {buildSphereGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildSphereGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildSphereGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3454, + "__docId__": 3462, "kind": "function", "name": "buildSphereGeometry", "memberof": "src/viewer/scene/geometry/builders/buildSphereGeometry.js", @@ -67951,18 +68167,18 @@ } }, { - "__docId__": 3455, + "__docId__": 3463, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildTorusGeometry.js", "content": "import {utils} from \"../../utils.js\";\nimport {math} from '../../math/math.js';\n\n/**\n * @desc Creates a torus-shaped {@link Geometry}.\n *\n * ## Usage\n * Creating a {@link Mesh} with a torus-shaped {@link ReadableGeometry} :\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildTorusGeometry)]\n * \n * ````javascript\n * import {Viewer, Mesh, buildTorusGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildTorusGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number} [cfg.radius=1] The overall radius.\n * @param {Number} [cfg.tube=0.3] The tube radius.\n * @param {Number} [cfg.radialSegments=32] The number of radial segments.\n * @param {Number} [cfg.tubeSegments=24] The number of tubular segments.\n * @param {Number} [cfg.arc=Math.PI*0.5] The length of the arc in radians, where Math.PI*2 is a closed torus.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildTorusGeometry(cfg = {}) {\n\n let radius = cfg.radius || 1;\n if (radius < 0) {\n console.error(\"negative radius not allowed - will invert\");\n radius *= -1;\n }\n radius *= 0.5;\n\n let tube = cfg.tube || 0.3;\n if (tube < 0) {\n console.error(\"negative tube not allowed - will invert\");\n tube *= -1;\n }\n\n let radialSegments = cfg.radialSegments || 32;\n if (radialSegments < 0) {\n console.error(\"negative radialSegments not allowed - will invert\");\n radialSegments *= -1;\n }\n if (radialSegments < 4) {\n radialSegments = 4;\n }\n\n let tubeSegments = cfg.tubeSegments || 24;\n if (tubeSegments < 0) {\n console.error(\"negative tubeSegments not allowed - will invert\");\n tubeSegments *= -1;\n }\n if (tubeSegments < 4) {\n tubeSegments = 4;\n }\n\n let arc = cfg.arc || Math.PI * 2;\n if (arc < 0) {\n console.warn(\"negative arc not allowed - will invert\");\n arc *= -1;\n }\n if (arc > 360) {\n arc = 360;\n }\n\n const center = cfg.center;\n let centerX = center ? center[0] : 0;\n let centerY = center ? center[1] : 0;\n const centerZ = center ? center[2] : 0;\n\n const positions = [];\n const normals = [];\n const uvs = [];\n const indices = [];\n\n let u;\n let v;\n let x;\n let y;\n let z;\n let vec;\n\n let i;\n let j;\n\n for (j = 0; j <= tubeSegments; j++) {\n for (i = 0; i <= radialSegments; i++) {\n\n u = i / radialSegments * arc;\n v = 0.785398 + (j / tubeSegments * Math.PI * 2);\n\n centerX = radius * Math.cos(u);\n centerY = radius * Math.sin(u);\n\n x = (radius + tube * Math.cos(v)) * Math.cos(u);\n y = (radius + tube * Math.cos(v)) * Math.sin(u);\n z = tube * Math.sin(v);\n\n positions.push(x + centerX);\n positions.push(y + centerY);\n positions.push(z + centerZ);\n\n uvs.push(1 - (i / radialSegments));\n uvs.push((j / tubeSegments));\n\n vec = math.normalizeVec3(math.subVec3([x, y, z], [centerX, centerY, centerZ], []), []);\n\n normals.push(vec[0]);\n normals.push(vec[1]);\n normals.push(vec[2]);\n }\n }\n\n let a;\n let b;\n let c;\n let d;\n\n for (j = 1; j <= tubeSegments; j++) {\n for (i = 1; i <= radialSegments; i++) {\n\n a = (radialSegments + 1) * j + i - 1;\n b = (radialSegments + 1) * (j - 1) + i - 1;\n c = (radialSegments + 1) * (j - 1) + i;\n d = (radialSegments + 1) * j + i;\n\n indices.push(a);\n indices.push(b);\n indices.push(c);\n\n indices.push(c);\n indices.push(d);\n indices.push(a);\n }\n }\n\n return utils.apply(cfg, {\n positions: positions,\n normals: normals,\n uv: uvs,\n indices: indices\n });\n}\n\nexport {buildTorusGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildTorusGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildTorusGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3456, + "__docId__": 3464, "kind": "function", "name": "buildTorusGeometry", "memberof": "src/viewer/scene/geometry/builders/buildTorusGeometry.js", @@ -68088,18 +68304,18 @@ } }, { - "__docId__": 3457, + "__docId__": 3465, "kind": "file", "name": "src/viewer/scene/geometry/builders/buildVectorTextGeometry.js", "content": "import {utils} from \"../../utils.js\";\n\nconst letters = {\n ' ': {width: 16, points: []},\n '!': {\n width: 10, points: [\n [5, 21],\n [5, 7],\n [-1, -1],\n [5, 2],\n [4, 1],\n [5, 0],\n [6, 1],\n [5, 2]\n ]\n },\n '\"': {\n width: 16, points: [\n [4, 21],\n [4, 14],\n [-1, -1],\n [12, 21],\n [12, 14]\n ]\n },\n '#': {\n width: 21, points: [\n [11, 25],\n [4, -7],\n [-1, -1],\n [17, 25],\n [10, -7],\n [-1, -1],\n [4, 12],\n [18, 12],\n [-1, -1],\n [3, 6],\n [17, 6]\n ]\n },\n '$': {\n width: 20, points: [\n [8, 25],\n [8, -4],\n [-1, -1],\n [12, 25],\n [12, -4],\n [-1, -1],\n [17, 18],\n [15, 20],\n [12, 21],\n [8, 21],\n [5, 20],\n [3, 18],\n [3, 16],\n [4, 14],\n [5, 13],\n [7, 12],\n [13, 10],\n [15, 9],\n [16, 8],\n [17, 6],\n [17, 3],\n [15, 1],\n [12, 0],\n [8, 0],\n [5, 1],\n [3, 3]\n ]\n },\n '%': {\n width: 24, points: [\n [21, 21],\n [3, 0],\n [-1, -1],\n [8, 21],\n [10, 19],\n [10, 17],\n [9, 15],\n [7, 14],\n [5, 14],\n [3, 16],\n [3, 18],\n [4, 20],\n [6, 21],\n [8, 21],\n [10, 20],\n [13, 19],\n [16, 19],\n [19, 20],\n [21, 21],\n [-1, -1],\n [17, 7],\n [15, 6],\n [14, 4],\n [14, 2],\n [16, 0],\n [18, 0],\n [20, 1],\n [21, 3],\n [21, 5],\n [19, 7],\n [17, 7]\n ]\n },\n '&': {\n width: 26, points: [\n [23, 12],\n [23, 13],\n [22, 14],\n [21, 14],\n [20, 13],\n [19, 11],\n [17, 6],\n [15, 3],\n [13, 1],\n [11, 0],\n [7, 0],\n [5, 1],\n [4, 2],\n [3, 4],\n [3, 6],\n [4, 8],\n [5, 9],\n [12, 13],\n [13, 14],\n [14, 16],\n [14, 18],\n [13, 20],\n [11, 21],\n [9, 20],\n [8, 18],\n [8, 16],\n [9, 13],\n [11, 10],\n [16, 3],\n [18, 1],\n [20, 0],\n [22, 0],\n [23, 1],\n [23, 2]\n ]\n },\n '\\'': {\n width: 10, points: [\n [5, 19],\n [4, 20],\n [5, 21],\n [6, 20],\n [6, 18],\n [5, 16],\n [4, 15]\n ]\n },\n '(': {\n width: 14, points: [\n [11, 25],\n [9, 23],\n [7, 20],\n [5, 16],\n [4, 11],\n [4, 7],\n [5, 2],\n [7, -2],\n [9, -5],\n [11, -7]\n ]\n },\n ')': {\n width: 14, points: [\n [3, 25],\n [5, 23],\n [7, 20],\n [9, 16],\n [10, 11],\n [10, 7],\n [9, 2],\n [7, -2],\n [5, -5],\n [3, -7]\n ]\n },\n '*': {\n width: 16, points: [\n [8, 21],\n [8, 9],\n [-1, -1],\n [3, 18],\n [13, 12],\n [-1, -1],\n [13, 18],\n [3, 12]\n ]\n },\n '+': {\n width: 26, points: [\n [13, 18],\n [13, 0],\n [-1, -1],\n [4, 9],\n [22, 9]\n ]\n },\n ',': {\n width: 10, points: [\n [6, 1],\n [5, 0],\n [4, 1],\n [5, 2],\n [6, 1],\n [6, -1],\n [5, -3],\n [4, -4]\n ]\n },\n '-': {\n width: 26, points: [\n [4, 9],\n [22, 9]\n ]\n },\n '.': {\n width: 10, points: [\n [5, 2],\n [4, 1],\n [5, 0],\n [6, 1],\n [5, 2]\n ]\n },\n '/': {\n width: 22, points: [\n [20, 25],\n [2, -7]\n ]\n },\n '0': {\n width: 20, points: [\n [9, 21],\n [6, 20],\n [4, 17],\n [3, 12],\n [3, 9],\n [4, 4],\n [6, 1],\n [9, 0],\n [11, 0],\n [14, 1],\n [16, 4],\n [17, 9],\n [17, 12],\n [16, 17],\n [14, 20],\n [11, 21],\n [9, 21]\n ]\n },\n '1': {\n width: 20, points: [\n [6, 17],\n [8, 18],\n [11, 21],\n [11, 0]\n ]\n },\n '2': {\n width: 20, points: [\n [4, 16],\n [4, 17],\n [5, 19],\n [6, 20],\n [8, 21],\n [12, 21],\n [14, 20],\n [15, 19],\n [16, 17],\n [16, 15],\n [15, 13],\n [13, 10],\n [3, 0],\n [17, 0]\n ]\n },\n '3': {\n width: 20, points: [\n [5, 21],\n [16, 21],\n [10, 13],\n [13, 13],\n [15, 12],\n [16, 11],\n [17, 8],\n [17, 6],\n [16, 3],\n [14, 1],\n [11, 0],\n [8, 0],\n [5, 1],\n [4, 2],\n [3, 4]\n ]\n },\n '4': {\n width: 20, points: [\n [13, 21],\n [3, 7],\n [18, 7],\n [-1, -1],\n [13, 21],\n [13, 0]\n ]\n },\n '5': {\n width: 20, points: [\n [15, 21],\n [5, 21],\n [4, 12],\n [5, 13],\n [8, 14],\n [11, 14],\n [14, 13],\n [16, 11],\n [17, 8],\n [17, 6],\n [16, 3],\n [14, 1],\n [11, 0],\n [8, 0],\n [5, 1],\n [4, 2],\n [3, 4]\n ]\n },\n '6': {\n width: 20, points: [\n [16, 18],\n [15, 20],\n [12, 21],\n [10, 21],\n [7, 20],\n [5, 17],\n [4, 12],\n [4, 7],\n [5, 3],\n [7, 1],\n [10, 0],\n [11, 0],\n [14, 1],\n [16, 3],\n [17, 6],\n [17, 7],\n [16, 10],\n [14, 12],\n [11, 13],\n [10, 13],\n [7, 12],\n [5, 10],\n [4, 7]\n ]\n },\n '7': {\n width: 20, points: [\n [17, 21],\n [7, 0],\n [-1, -1],\n [3, 21],\n [17, 21]\n ]\n },\n '8': {\n width: 20, points: [\n [8, 21],\n [5, 20],\n [4, 18],\n [4, 16],\n [5, 14],\n [7, 13],\n [11, 12],\n [14, 11],\n [16, 9],\n [17, 7],\n [17, 4],\n [16, 2],\n [15, 1],\n [12, 0],\n [8, 0],\n [5, 1],\n [4, 2],\n [3, 4],\n [3, 7],\n [4, 9],\n [6, 11],\n [9, 12],\n [13, 13],\n [15, 14],\n [16, 16],\n [16, 18],\n [15, 20],\n [12, 21],\n [8, 21]\n ]\n },\n '9': {\n width: 20, points: [\n [16, 14],\n [15, 11],\n [13, 9],\n [10, 8],\n [9, 8],\n [6, 9],\n [4, 11],\n [3, 14],\n [3, 15],\n [4, 18],\n [6, 20],\n [9, 21],\n [10, 21],\n [13, 20],\n [15, 18],\n [16, 14],\n [16, 9],\n [15, 4],\n [13, 1],\n [10, 0],\n [8, 0],\n [5, 1],\n [4, 3]\n ]\n },\n ':': {\n width: 10, points: [\n [5, 14],\n [4, 13],\n [5, 12],\n [6, 13],\n [5, 14],\n [-1, -1],\n [5, 2],\n [4, 1],\n [5, 0],\n [6, 1],\n [5, 2]\n ]\n },\n ';': {\n width: 10, points: [\n [5, 14],\n [4, 13],\n [5, 12],\n [6, 13],\n [5, 14],\n [-1, -1],\n [6, 1],\n [5, 0],\n [4, 1],\n [5, 2],\n [6, 1],\n [6, -1],\n [5, -3],\n [4, -4]\n ]\n },\n '<': {\n width: 24, points: [\n [20, 18],\n [4, 9],\n [20, 0]\n ]\n },\n '=': {\n width: 26, points: [\n [4, 12],\n [22, 12],\n [-1, -1],\n [4, 6],\n [22, 6]\n ]\n },\n '>': {\n width: 24, points: [\n [4, 18],\n [20, 9],\n [4, 0]\n ]\n },\n '?': {\n width: 18, points: [\n [3, 16],\n [3, 17],\n [4, 19],\n [5, 20],\n [7, 21],\n [11, 21],\n [13, 20],\n [14, 19],\n [15, 17],\n [15, 15],\n [14, 13],\n [13, 12],\n [9, 10],\n [9, 7],\n [-1, -1],\n [9, 2],\n [8, 1],\n [9, 0],\n [10, 1],\n [9, 2]\n ]\n },\n '@': {\n width: 27, points: [\n [18, 13],\n [17, 15],\n [15, 16],\n [12, 16],\n [10, 15],\n [9, 14],\n [8, 11],\n [8, 8],\n [9, 6],\n [11, 5],\n [14, 5],\n [16, 6],\n [17, 8],\n [-1, -1],\n [12, 16],\n [10, 14],\n [9, 11],\n [9, 8],\n [10, 6],\n [11, 5],\n [-1, -1],\n [18, 16],\n [17, 8],\n [17, 6],\n [19, 5],\n [21, 5],\n [23, 7],\n [24, 10],\n [24, 12],\n [23, 15],\n [22, 17],\n [20, 19],\n [18, 20],\n [15, 21],\n [12, 21],\n [9, 20],\n [7, 19],\n [5, 17],\n [4, 15],\n [3, 12],\n [3, 9],\n [4, 6],\n [5, 4],\n [7, 2],\n [9, 1],\n [12, 0],\n [15, 0],\n [18, 1],\n [20, 2],\n [21, 3],\n [-1, -1],\n [19, 16],\n [18, 8],\n [18, 6],\n [19, 5]\n ]\n },\n 'A': {\n width: 18, points: [\n [9, 21],\n [1, 0],\n [-1, -1],\n [9, 21],\n [17, 0],\n [-1, -1],\n [4, 7],\n [14, 7]\n ]\n },\n 'B': {\n width: 21, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [13, 21],\n [16, 20],\n [17, 19],\n [18, 17],\n [18, 15],\n [17, 13],\n [16, 12],\n [13, 11],\n [-1, -1],\n [4, 11],\n [13, 11],\n [16, 10],\n [17, 9],\n [18, 7],\n [18, 4],\n [17, 2],\n [16, 1],\n [13, 0],\n [4, 0]\n ]\n },\n 'C': {\n width: 21, points: [\n [18, 16],\n [17, 18],\n [15, 20],\n [13, 21],\n [9, 21],\n [7, 20],\n [5, 18],\n [4, 16],\n [3, 13],\n [3, 8],\n [4, 5],\n [5, 3],\n [7, 1],\n [9, 0],\n [13, 0],\n [15, 1],\n [17, 3],\n [18, 5]\n ]\n },\n 'D': {\n width: 21, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [11, 21],\n [14, 20],\n [16, 18],\n [17, 16],\n [18, 13],\n [18, 8],\n [17, 5],\n [16, 3],\n [14, 1],\n [11, 0],\n [4, 0]\n ]\n },\n 'E': {\n width: 19, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [17, 21],\n [-1, -1],\n [4, 11],\n [12, 11],\n [-1, -1],\n [4, 0],\n [17, 0]\n ]\n },\n 'F': {\n width: 18, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [17, 21],\n [-1, -1],\n [4, 11],\n [12, 11]\n ]\n },\n 'G': {\n width: 21, points: [\n [18, 16],\n [17, 18],\n [15, 20],\n [13, 21],\n [9, 21],\n [7, 20],\n [5, 18],\n [4, 16],\n [3, 13],\n [3, 8],\n [4, 5],\n [5, 3],\n [7, 1],\n [9, 0],\n [13, 0],\n [15, 1],\n [17, 3],\n [18, 5],\n [18, 8],\n [-1, -1],\n [13, 8],\n [18, 8]\n ]\n },\n 'H': {\n width: 22, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [18, 21],\n [18, 0],\n [-1, -1],\n [4, 11],\n [18, 11]\n ]\n },\n 'I': {\n width: 8, points: [\n [4, 21],\n [4, 0]\n ]\n },\n 'J': {\n width: 16, points: [\n [12, 21],\n [12, 5],\n [11, 2],\n [10, 1],\n [8, 0],\n [6, 0],\n [4, 1],\n [3, 2],\n [2, 5],\n [2, 7]\n ]\n },\n 'K': {\n width: 21, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [18, 21],\n [4, 7],\n [-1, -1],\n [9, 12],\n [18, 0]\n ]\n },\n 'L': {\n width: 17, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 0],\n [16, 0]\n ]\n },\n 'M': {\n width: 24, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [12, 0],\n [-1, -1],\n [20, 21],\n [12, 0],\n [-1, -1],\n [20, 21],\n [20, 0]\n ]\n },\n 'N': {\n width: 22, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [18, 0],\n [-1, -1],\n [18, 21],\n [18, 0]\n ]\n },\n 'O': {\n width: 22, points: [\n [9, 21],\n [7, 20],\n [5, 18],\n [4, 16],\n [3, 13],\n [3, 8],\n [4, 5],\n [5, 3],\n [7, 1],\n [9, 0],\n [13, 0],\n [15, 1],\n [17, 3],\n [18, 5],\n [19, 8],\n [19, 13],\n [18, 16],\n [17, 18],\n [15, 20],\n [13, 21],\n [9, 21]\n ]\n },\n 'P': {\n width: 21, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [13, 21],\n [16, 20],\n [17, 19],\n [18, 17],\n [18, 14],\n [17, 12],\n [16, 11],\n [13, 10],\n [4, 10]\n ]\n },\n 'Q': {\n width: 22, points: [\n [9, 21],\n [7, 20],\n [5, 18],\n [4, 16],\n [3, 13],\n [3, 8],\n [4, 5],\n [5, 3],\n [7, 1],\n [9, 0],\n [13, 0],\n [15, 1],\n [17, 3],\n [18, 5],\n [19, 8],\n [19, 13],\n [18, 16],\n [17, 18],\n [15, 20],\n [13, 21],\n [9, 21],\n [-1, -1],\n [12, 4],\n [18, -2]\n ]\n },\n 'R': {\n width: 21, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 21],\n [13, 21],\n [16, 20],\n [17, 19],\n [18, 17],\n [18, 15],\n [17, 13],\n [16, 12],\n [13, 11],\n [4, 11],\n [-1, -1],\n [11, 11],\n [18, 0]\n ]\n },\n 'S': {\n width: 20, points: [\n [17, 18],\n [15, 20],\n [12, 21],\n [8, 21],\n [5, 20],\n [3, 18],\n [3, 16],\n [4, 14],\n [5, 13],\n [7, 12],\n [13, 10],\n [15, 9],\n [16, 8],\n [17, 6],\n [17, 3],\n [15, 1],\n [12, 0],\n [8, 0],\n [5, 1],\n [3, 3]\n ]\n },\n 'T': {\n width: 16, points: [\n [8, 21],\n [8, 0],\n [-1, -1],\n [1, 21],\n [15, 21]\n ]\n },\n 'U': {\n width: 22, points: [\n [4, 21],\n [4, 6],\n [5, 3],\n [7, 1],\n [10, 0],\n [12, 0],\n [15, 1],\n [17, 3],\n [18, 6],\n [18, 21]\n ]\n },\n 'V': {\n width: 18, points: [\n [1, 21],\n [9, 0],\n [-1, -1],\n [17, 21],\n [9, 0]\n ]\n },\n 'W': {\n width: 24, points: [\n [2, 21],\n [7, 0],\n [-1, -1],\n [12, 21],\n [7, 0],\n [-1, -1],\n [12, 21],\n [17, 0],\n [-1, -1],\n [22, 21],\n [17, 0]\n ]\n },\n 'X': {\n width: 20, points: [\n [3, 21],\n [17, 0],\n [-1, -1],\n [17, 21],\n [3, 0]\n ]\n },\n 'Y': {\n width: 18, points: [\n [1, 21],\n [9, 11],\n [9, 0],\n [-1, -1],\n [17, 21],\n [9, 11]\n ]\n },\n 'Z': {\n width: 20, points: [\n [17, 21],\n [3, 0],\n [-1, -1],\n [3, 21],\n [17, 21],\n [-1, -1],\n [3, 0],\n [17, 0]\n ]\n },\n '[': {\n width: 14, points: [\n [4, 25],\n [4, -7],\n [-1, -1],\n [5, 25],\n [5, -7],\n [-1, -1],\n [4, 25],\n [11, 25],\n [-1, -1],\n [4, -7],\n [11, -7]\n ]\n },\n '\\\\': {\n width: 14, points: [\n [0, 21],\n [14, -3]\n ]\n },\n ']': {\n width: 14, points: [\n [9, 25],\n [9, -7],\n [-1, -1],\n [10, 25],\n [10, -7],\n [-1, -1],\n [3, 25],\n [10, 25],\n [-1, -1],\n [3, -7],\n [10, -7]\n ]\n },\n '^': {\n width: 16, points: [\n [6, 15],\n [8, 18],\n [10, 15],\n [-1, -1],\n [3, 12],\n [8, 17],\n [13, 12],\n [-1, -1],\n [8, 17],\n [8, 0]\n ]\n },\n '_': {\n width: 16, points: [\n [0, -2],\n [16, -2]\n ]\n },\n '`': {\n width: 10, points: [\n [6, 21],\n [5, 20],\n [4, 18],\n [4, 16],\n [5, 15],\n [6, 16],\n [5, 17]\n ]\n },\n 'a': {\n width: 19, points: [\n [15, 14],\n [15, 0],\n [-1, -1],\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'b': {\n width: 19, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 11],\n [6, 13],\n [8, 14],\n [11, 14],\n [13, 13],\n [15, 11],\n [16, 8],\n [16, 6],\n [15, 3],\n [13, 1],\n [11, 0],\n [8, 0],\n [6, 1],\n [4, 3]\n ]\n },\n 'c': {\n width: 18, points: [\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'd': {\n width: 19, points: [\n [15, 21],\n [15, 0],\n [-1, -1],\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'e': {\n width: 18, points: [\n [3, 8],\n [15, 8],\n [15, 10],\n [14, 12],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'f': {\n width: 12, points: [\n [10, 21],\n [8, 21],\n [6, 20],\n [5, 17],\n [5, 0],\n [-1, -1],\n [2, 14],\n [9, 14]\n ]\n },\n 'g': {\n width: 19, points: [\n [15, 14],\n [15, -2],\n [14, -5],\n [13, -6],\n [11, -7],\n [8, -7],\n [6, -6],\n [-1, -1],\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'h': {\n width: 19, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [4, 10],\n [7, 13],\n [9, 14],\n [12, 14],\n [14, 13],\n [15, 10],\n [15, 0]\n ]\n },\n 'i': {\n width: 8, points: [\n [3, 21],\n [4, 20],\n [5, 21],\n [4, 22],\n [3, 21],\n [-1, -1],\n [4, 14],\n [4, 0]\n ]\n },\n 'j': {\n width: 10, points: [\n [5, 21],\n [6, 20],\n [7, 21],\n [6, 22],\n [5, 21],\n [-1, -1],\n [6, 14],\n [6, -3],\n [5, -6],\n [3, -7],\n [1, -7]\n ]\n },\n 'k': {\n width: 17, points: [\n [4, 21],\n [4, 0],\n [-1, -1],\n [14, 14],\n [4, 4],\n [-1, -1],\n [8, 8],\n [15, 0]\n ]\n },\n 'l': {\n width: 8, points: [\n [4, 21],\n [4, 0]\n ]\n },\n 'm': {\n width: 30, points: [\n [4, 14],\n [4, 0],\n [-1, -1],\n [4, 10],\n [7, 13],\n [9, 14],\n [12, 14],\n [14, 13],\n [15, 10],\n [15, 0],\n [-1, -1],\n [15, 10],\n [18, 13],\n [20, 14],\n [23, 14],\n [25, 13],\n [26, 10],\n [26, 0]\n ]\n },\n 'n': {\n width: 19, points: [\n [4, 14],\n [4, 0],\n [-1, -1],\n [4, 10],\n [7, 13],\n [9, 14],\n [12, 14],\n [14, 13],\n [15, 10],\n [15, 0]\n ]\n },\n 'o': {\n width: 19, points: [\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3],\n [16, 6],\n [16, 8],\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14]\n ]\n },\n 'p': {\n width: 19, points: [\n [4, 14],\n [4, -7],\n [-1, -1],\n [4, 11],\n [6, 13],\n [8, 14],\n [11, 14],\n [13, 13],\n [15, 11],\n [16, 8],\n [16, 6],\n [15, 3],\n [13, 1],\n [11, 0],\n [8, 0],\n [6, 1],\n [4, 3]\n ]\n },\n 'q': {\n width: 19, points: [\n [15, 14],\n [15, -7],\n [-1, -1],\n [15, 11],\n [13, 13],\n [11, 14],\n [8, 14],\n [6, 13],\n [4, 11],\n [3, 8],\n [3, 6],\n [4, 3],\n [6, 1],\n [8, 0],\n [11, 0],\n [13, 1],\n [15, 3]\n ]\n },\n 'r': {\n width: 13, points: [\n [4, 14],\n [4, 0],\n [-1, -1],\n [4, 8],\n [5, 11],\n [7, 13],\n [9, 14],\n [12, 14]\n ]\n },\n 's': {\n width: 17, points: [\n [14, 11],\n [13, 13],\n [10, 14],\n [7, 14],\n [4, 13],\n [3, 11],\n [4, 9],\n [6, 8],\n [11, 7],\n [13, 6],\n [14, 4],\n [14, 3],\n [13, 1],\n [10, 0],\n [7, 0],\n [4, 1],\n [3, 3]\n ]\n },\n 't': {\n width: 12, points: [\n [5, 21],\n [5, 4],\n [6, 1],\n [8, 0],\n [10, 0],\n [-1, -1],\n [2, 14],\n [9, 14]\n ]\n },\n 'u': {\n width: 19, points: [\n [4, 14],\n [4, 4],\n [5, 1],\n [7, 0],\n [10, 0],\n [12, 1],\n [15, 4],\n [-1, -1],\n [15, 14],\n [15, 0]\n ]\n },\n 'v': {\n width: 16, points: [\n [2, 14],\n [8, 0],\n [-1, -1],\n [14, 14],\n [8, 0]\n ]\n },\n 'w': {\n width: 22, points: [\n [3, 14],\n [7, 0],\n [-1, -1],\n [11, 14],\n [7, 0],\n [-1, -1],\n [11, 14],\n [15, 0],\n [-1, -1],\n [19, 14],\n [15, 0]\n ]\n },\n 'x': {\n width: 17, points: [\n [3, 14],\n [14, 0],\n [-1, -1],\n [14, 14],\n [3, 0]\n ]\n },\n 'y': {\n width: 16, points: [\n [2, 14],\n [8, 0],\n [-1, -1],\n [14, 14],\n [8, 0],\n [6, -4],\n [4, -6],\n [2, -7],\n [1, -7]\n ]\n },\n 'z': {\n width: 17, points: [\n [14, 14],\n [3, 0],\n [-1, -1],\n [3, 14],\n [14, 14],\n [-1, -1],\n [3, 0],\n [14, 0]\n ]\n },\n '{': {\n width: 14, points: [\n [9, 25],\n [7, 24],\n [6, 23],\n [5, 21],\n [5, 19],\n [6, 17],\n [7, 16],\n [8, 14],\n [8, 12],\n [6, 10],\n [-1, -1],\n [7, 24],\n [6, 22],\n [6, 20],\n [7, 18],\n [8, 17],\n [9, 15],\n [9, 13],\n [8, 11],\n [4, 9],\n [8, 7],\n [9, 5],\n [9, 3],\n [8, 1],\n [7, 0],\n [6, -2],\n [6, -4],\n [7, -6],\n [-1, -1],\n [6, 8],\n [8, 6],\n [8, 4],\n [7, 2],\n [6, 1],\n [5, -1],\n [5, -3],\n [6, -5],\n [7, -6],\n [9, -7]\n ]\n },\n '|': {\n width: 8, points: [\n [4, 25],\n [4, -7]\n ]\n },\n '}': {\n width: 14, points: [\n [5, 25],\n [7, 24],\n [8, 23],\n [9, 21],\n [9, 19],\n [8, 17],\n [7, 16],\n [6, 14],\n [6, 12],\n [8, 10],\n [-1, -1],\n [7, 24],\n [8, 22],\n [8, 20],\n [7, 18],\n [6, 17],\n [5, 15],\n [5, 13],\n [6, 11],\n [10, 9],\n [6, 7],\n [5, 5],\n [5, 3],\n [6, 1],\n [7, 0],\n [8, -2],\n [8, -4],\n [7, -6],\n [-1, -1],\n [8, 8],\n [6, 6],\n [6, 4],\n [7, 2],\n [8, 1],\n [9, -1],\n [9, -3],\n [8, -5],\n [7, -6],\n [5, -7]\n ]\n },\n '~': {\n width: 24, points: [\n [3, 6],\n [3, 8],\n [4, 11],\n [6, 12],\n [8, 12],\n [10, 11],\n [14, 8],\n [16, 7],\n [18, 7],\n [20, 8],\n [21, 10],\n [-1, -1],\n [3, 8],\n [4, 10],\n [6, 11],\n [8, 11],\n [10, 10],\n [14, 7],\n [16, 6],\n [18, 6],\n [20, 7],\n [21, 10],\n [21, 12]\n ]\n }\n};\n\n/**\n * @desc Creates wireframe vector text {@link Geometry}.\n *\n * ## Usage\n *\n * Creating a {@link Mesh} with vector text {@link ReadableGeometry} :\n *\n * [[Run this example](/examples/index.html#geometry_builders_buildVectorTextGeometry)]\n *\n * ````javascript\n *\n * import {Viewer, Mesh, buildVectorTextGeometry, ReadableGeometry, PhongMaterial} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 100];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildVectorTextGeometry({\n * origin: [0,0,0],\n * text: \"On the other side of the screen, it all looked so easy\"\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n * ````\n *\n * @function buildVectorTextGeometry\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.center] 3D point indicating the center position.\n * @param {Number[]} [cfg.origin] 3D point indicating the top left corner.\n * @param {Number} [cfg.size=1] Size of each character.\n * @param {String} [cfg.text=\"\"] The text.\n * @returns {Object} Configuration for a {@link Geometry} subtype.\n */\nfunction buildVectorTextGeometry(cfg = {}) {\n\n var origin = cfg.origin || [0, 0, 0];\n var xOrigin = origin[0];\n var yOrigin = origin[1];\n var zOrigin = origin[2];\n var size = cfg.size || 1;\n\n var positions = [];\n var indices = [];\n var text = cfg.text;\n if (utils.isNumeric(text)) {\n text = \"\" + text;\n }\n var lines = (text || \"\").split(\"\\n\");\n var countVerts = 0;\n var y = 0;\n var x;\n var str;\n var len;\n var c;\n var mag = 1.0 / 25.0;\n var penUp;\n var p1;\n var p2;\n var needLine;\n var pointsLen;\n var a;\n\n for (var iLine = 0; iLine < lines.length; iLine++) {\n\n x = 0;\n str = lines[iLine];\n len = str.length;\n\n for (var i = 0; i < len; i++) {\n\n c = letters[str.charAt(i)];\n\n if (c === '\\n') {\n //alert(\"newline\");\n }\n\n if (!c) {\n continue;\n }\n\n penUp = 1;\n p1 = -1;\n p2 = -1;\n needLine = false;\n\n pointsLen = c.points.length;\n\n for (var j = 0; j < pointsLen; j++) {\n a = c.points[j];\n\n if (a[0] === -1 && a[1] === -1) {\n penUp = 1;\n needLine = false;\n continue;\n }\n\n positions.push((x + (a[0] * size) * mag) + xOrigin);\n positions.push((y + (a[1] * size) * mag) + yOrigin);\n positions.push(0 + zOrigin);\n\n if (p1 === -1) {\n p1 = countVerts;\n } else if (p2 === -1) {\n p2 = countVerts;\n } else {\n p1 = p2;\n p2 = countVerts;\n }\n countVerts++;\n\n if (penUp) {\n penUp = false;\n\n } else {\n indices.push(p1);\n indices.push(p2);\n }\n\n needLine = true;\n }\n x += c.width * mag * size;\n\n }\n y -= 35 * mag * size;\n }\n\n return utils.apply(cfg, {\n primitive: \"lines\",\n positions: positions,\n indices: indices\n });\n}\n\n\nexport {buildVectorTextGeometry}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3458, + "__docId__": 3466, "kind": "variable", "name": "letters", "memberof": "src/viewer/scene/geometry/builders/buildVectorTextGeometry.js", @@ -68120,7 +68336,7 @@ "ignore": true }, { - "__docId__": 3459, + "__docId__": 3467, "kind": "function", "name": "buildVectorTextGeometry", "memberof": "src/viewer/scene/geometry/builders/buildVectorTextGeometry.js", @@ -68220,51 +68436,51 @@ } }, { - "__docId__": 3460, + "__docId__": 3468, "kind": "file", "name": "src/viewer/scene/geometry/builders/index.js", "content": "export * from \"./buildBoxGeometry.js\";\nexport * from \"./buildBoxLinesGeometry.js\";\nexport * from \"./buildCylinderGeometry.js\";\nexport * from \"./buildGridGeometry.js\";\nexport * from \"./buildPlaneGeometry.js\";\nexport * from \"./buildSphereGeometry.js\";\nexport * from \"./buildTorusGeometry.js\";\nexport * from \"./buildVectorTextGeometry.js\";\nexport * from \"./buildPolylineGeometry.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/builders/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/builders/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3461, + "__docId__": 3469, "kind": "file", "name": "src/viewer/scene/geometry/index.js", "content": "export * from \"./ReadableGeometry.js\";\nexport * from \"./VBOGeometry.js\";\nexport * from \"./loaders/index.js\";\nexport * from \"./builders/index.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3462, + "__docId__": 3470, "kind": "file", "name": "src/viewer/scene/geometry/loaders/index.js", "content": "export * from \"./load3DSGeometry.js\";\nexport * from \"./loadOBJGeometry.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/loaders/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/loaders/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3463, + "__docId__": 3471, "kind": "file", "name": "src/viewer/scene/geometry/loaders/load3DSGeometry.js", "content": "import {utils} from '../../utils.js';\nimport {K3D} from '../../libs/k3d.js';\n\n/**\n * @desc Loads {@link Geometry} from 3DS.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with {@link PhongMaterial}, {@link Texture} and a {@link ReadableGeometry} loaded from 3DS.\n *\n * ````javascript\n * import {Viewer, Mesh, load3DSGeometry, ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [40.04, 23.46, 79.06];\n * viewer.scene.camera.look = [-6.48, 13.92, -0.56];\n * viewer.scene.camera.up = [-0.04, 0.98, -0.08];\n *\n * load3DSGeometry(viewer.scene, {\n * src: \"models/3ds/lexus.3ds\",\n * compressGeometry: false\n *\n * }).then(function (geometryCfg) {\n *\n * // Success\n *\n * new Mesh(viewer.scene, {\n *\n * geometry: new ReadableGeometry(viewer.scene, geometryCfg),\n *\n * material: new PhongMaterial(viewer.scene, {\n *\n * emissive: [1, 1, 1],\n * emissiveMap: new Texture({ // .3DS has no normals so relies on emissive illumination\n * src: \"models/3ds/lexus.jpg\"\n * })\n * }),\n *\n * rotation: [-90, 0, 0] // +Z is up for this particular 3DS\n * });\n * }, function () {\n * // Error\n * });\n * ````\n *\n * @function load3DSGeometry\n * @param {Scene} scene Scene we're loading the geometry for.\n * @param {*} cfg Configs, also added to the result object.\n * @param {String} [cfg.src] Path to 3DS file.\n * @returns {Object} Configuration to pass into a {@link Geometry} constructor, containing geometry arrays loaded from the OBJ file.\n */\nfunction load3DSGeometry(scene, cfg = {}) {\n\n return new Promise(function (resolve, reject) {\n\n if (!cfg.src) {\n console.error(\"load3DSGeometry: Parameter expected: src\");\n reject();\n }\n\n var spinner = scene.canvas.spinner;\n spinner.processes++;\n\n utils.loadArraybuffer(cfg.src, function (data) {\n\n if (!data.byteLength) {\n console.error(\"load3DSGeometry: no data loaded\");\n spinner.processes--;\n reject();\n }\n\n var m = K3D.parse.from3DS(data);\t// done !\n\n var mesh = m.edit.objects[0].mesh;\n var positions = mesh.vertices;\n var uv = mesh.uvt;\n var indices = mesh.indices;\n\n spinner.processes--;\n\n resolve(utils.apply(cfg, {\n primitive: \"triangles\",\n positions: positions,\n normals: null,\n uv: uv,\n indices: indices\n }));\n },\n\n function (msg) {\n console.error(\"load3DSGeometry: \" + msg);\n spinner.processes--;\n reject();\n });\n });\n}\n\nexport {load3DSGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/loaders/load3DSGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/loaders/load3DSGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3464, + "__docId__": 3472, "kind": "function", "name": "load3DSGeometry", "memberof": "src/viewer/scene/geometry/loaders/load3DSGeometry.js", @@ -68330,18 +68546,18 @@ } }, { - "__docId__": 3465, + "__docId__": 3473, "kind": "file", "name": "src/viewer/scene/geometry/loaders/loadOBJGeometry.js", "content": "import {utils} from '../../utils.js';\nimport {K3D} from '../../libs/k3d.js';\n\n/**\n * @desc Loads {@link Geometry} from OBJ.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with {@link MetallicMaterial} and {@link ReadableGeometry} loaded from OBJ.\n *\n * ````javascript\n * import {Viewer, Mesh, loadOBJGeometry, ReadableGeometry,\n * MetallicMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0.57, 1.37, 1.14];\n * viewer.scene.camera.look = [0.04, 0.58, 0.00];\n * viewer.scene.camera.up = [-0.22, 0.84, -0.48];\n *\n * loadOBJGeometry(viewer.scene, {\n *\n * src: \"models/obj/fireHydrant/FireHydrantMesh.obj\",\n * compressGeometry: false\n *\n * }).then(function (geometryCfg) {\n *\n * // Success\n *\n * new Mesh(viewer.scene, {\n *\n * geometry: new ReadableGeometry(viewer.scene, geometryCfg),\n *\n * material: new MetallicMaterial(viewer.scene, {\n *\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0,\n * \n * baseColorMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Base_Color.png\",\n * encoding: \"sRGB\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Normal_OpenGL.png\"\n * }),\n * roughnessMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Roughness.png\"\n * }),\n * metallicMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Metallic.png\"\n * }),\n * occlusionMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Mixed_AO.png\"\n * }),\n * \n * specularF0: 0.7\n * })\n * });\n * }, function () {\n * // Error\n * });\n * ````\n *\n * @function loadOBJGeometry\n * @param {Scene} scene Scene we're loading the geometry for.\n * @param {*} [cfg] Configs, also added to the result object.\n * @param {String} [cfg.src] Path to OBJ file.\n * @returns {Object} Configuration to pass into a {@link Geometry} constructor, containing geometry arrays loaded from the OBJ file.\n */\nfunction loadOBJGeometry(scene, cfg = {}) {\n\n return new Promise(function (resolve, reject) {\n\n if (!cfg.src) {\n console.error(\"loadOBJGeometry: Parameter expected: src\");\n reject();\n }\n\n var spinner = scene.canvas.spinner;\n spinner.processes++;\n\n utils.loadArraybuffer(cfg.src, function (data) {\n\n if (!data.byteLength) {\n console.error(\"loadOBJGeometry: no data loaded\");\n spinner.processes--;\n reject();\n }\n\n var m = K3D.parse.fromOBJ(data);\t// done !\n\n // unwrap simply duplicates some values, so they can be indexed with indices [0,1,2,3 ... ]\n // In some rendering engines, you can have only one index value for vertices, UVs, normals ...,\n // so \"unwrapping\" is a simple solution.\n\n var positions = K3D.edit.unwrap(m.i_verts, m.c_verts, 3);\n var normals = K3D.edit.unwrap(m.i_norms, m.c_norms, 3);\n var uv = K3D.edit.unwrap(m.i_uvt, m.c_uvt, 2);\n var indices = new Int32Array(m.i_verts.length);\n\n for (var i = 0; i < m.i_verts.length; i++) {\n indices[i] = i;\n }\n\n spinner.processes--;\n\n resolve(utils.apply(cfg, {\n primitive: \"triangles\",\n positions: positions,\n normals: normals.length > 0 ? normals : null,\n autoNormals: normals.length === 0,\n uv: uv,\n indices: indices\n }));\n },\n\n function (msg) {\n console.error(\"loadOBJGeometry: \" + msg);\n spinner.processes--;\n reject();\n });\n });\n}\n\nexport {loadOBJGeometry};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/geometry/loaders/loadOBJGeometry.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/geometry/loaders/loadOBJGeometry.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3466, + "__docId__": 3474, "kind": "function", "name": "loadOBJGeometry", "memberof": "src/viewer/scene/geometry/loaders/loadOBJGeometry.js", @@ -68407,29 +68623,29 @@ } }, { - "__docId__": 3467, + "__docId__": 3475, "kind": "file", "name": "src/viewer/scene/index.js", "content": "export * from \"./camera/index.js\";\nexport * from \"./geometry/index.js\";\nexport * from \"./ImagePlane/index.js\";\nexport * from \"./Bitmap/index.js\";\nexport * from \"./LineSet/index.js\";\nexport * from \"./lights/index.js\";\nexport * from \"./marker/index.js\";\nexport * from \"./materials/index.js\";\nexport * from \"./math/index.js\";\nexport * from \"./mementos/index.js\";\nexport * from \"./mesh/index.js\";\nexport * from \"./nodes/index.js\";\nexport * from \"./paths/index.js\";\nexport * from \"./model/index.js\";\nexport * from \"./sectionPlane/index.js\";\nexport * from \"./skybox/index.js\";\nexport * from \"./utils/index.js\";\nexport * from \"./Component.js\";\nexport * from \"./utils.js\";\nexport * from \"./stats.js\";\nexport * from \"./constants/constants.js\";\nexport * from \"./webgl/PickResult.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3468, + "__docId__": 3476, "kind": "file", "name": "src/viewer/scene/input/Input.js", "content": "import {Component} from '../Component.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc Meditates mouse, touch and keyboard events for various interaction controls.\n *\n * Ordinarily, you would only use this component as a utility to help manage input events and state for your\n * own custom input handlers.\n *\n * * Located at {@link Scene#input}\n * * Used by (at least) {@link CameraControl}\n *\n * ## Usage\n *\n * Subscribing to mouse events on the canvas:\n *\n * ````javascript\n * import {Viewer} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * const input = viewer.scene.input;\n *\n * const onMouseDown = input.on(\"mousedown\", (canvasCoords) => {\n * console.log(\"Mouse down at: x=\" + canvasCoords[0] + \", y=\" + coords[1]);\n * });\n *\n * const onMouseUp = input.on(\"mouseup\", (canvasCoords) => {\n * console.log(\"Mouse up at: x=\" + canvasCoords[0] + \", y=\" + canvasCoords[1]);\n * });\n *\n * const onMouseClicked = input.on(\"mouseclicked\", (canvasCoords) => {\n * console.log(\"Mouse clicked at: x=\" + canvasCoords[0] + \", y=\" + canvasCoords[1]);\n * });\n *\n * const onDblClick = input.on(\"dblclick\", (canvasCoords) => {\n * console.log(\"Double-click at: x=\" + canvasCoords[0] + \", y=\" + canvasCoords[1]);\n * });\n * ````\n *\n * Subscribing to keyboard events on the canvas:\n *\n * ````javascript\n * const onKeyDown = input.on(\"keydown\", (keyCode) => {\n * switch (keyCode) {\n * case this.KEY_A:\n * console.log(\"The 'A' key is down\");\n * break;\n *\n * case this.KEY_B:\n * console.log(\"The 'B' key is down\");\n * break;\n *\n * case this.KEY_C:\n * console.log(\"The 'C' key is down\");\n * break;\n *\n * default:\n * console.log(\"Some other key is down\");\n * }\n * });\n *\n * const onKeyUp = input.on(\"keyup\", (keyCode) => {\n * switch (keyCode) {\n * case this.KEY_A:\n * console.log(\"The 'A' key is up\");\n * break;\n *\n * case this.KEY_B:\n * console.log(\"The 'B' key is up\");\n * break;\n *\n * case this.KEY_C:\n * console.log(\"The 'C' key is up\");\n * break;\n *\n * default:\n * console.log(\"Some other key is up\");\n * }\n * });\n * ````\n *\n * Checking if keys are down:\n *\n * ````javascript\n * const isCtrlDown = input.ctrlDown;\n * const isAltDown = input.altDown;\n * const shiftDown = input.shiftDown;\n * //...\n *\n * const isAKeyDown = input.keyDown[input.KEY_A];\n * const isBKeyDown = input.keyDown[input.KEY_B];\n * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];\n * //...\n *\n * ````\n * Unsubscribing from events:\n *\n * ````javascript\n * input.off(onMouseDown);\n * input.off(onMouseUp);\n * //...\n * ````\n *\n * ## Disabling all events\n *\n * Event handling is enabled by default.\n *\n * To disable all events:\n *\n * ````javascript\n * myViewer.scene.input.setEnabled(false);\n * ````\n * To enable all events again:\n *\n * ````javascript\n * myViewer.scene.input.setEnabled(true);\n * ````\n *\n * ## Disabling keyboard input\n *\n * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need\n * to disable keyboard control, so that other UI elements can get those events.\n *\n * To disable keyboard events:\n *\n * ````javascript\n * myViewer.scene.input.setKeyboardEnabled(false);\n * ````\n *\n * To enable keyboard events again:\n *\n * ````javascript\n * myViewer.scene.input.setKeyboardEnabled(true)\n * ````\n */\nclass Input extends Component {\n\n /**\n * @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n /**\n * Code for the BACKSPACE key.\n * @property KEY_BACKSPACE\n * @final\n * @type {Number}\n */\n this.KEY_BACKSPACE = 8;\n\n /**\n * Code for the TAB key.\n * @property KEY_TAB\n * @final\n * @type {Number}\n */\n this.KEY_TAB = 9;\n\n /**\n * Code for the ENTER key.\n * @property KEY_ENTER\n * @final\n * @type {Number}\n */\n this.KEY_ENTER = 13;\n\n /**\n * Code for the SHIFT key.\n * @property KEY_SHIFT\n * @final\n * @type {Number}\n */\n this.KEY_SHIFT = 16;\n\n /**\n * Code for the CTRL key.\n * @property KEY_CTRL\n * @final\n * @type {Number}\n */\n this.KEY_CTRL = 17;\n\n /**\n * Code for the ALT key.\n * @property KEY_ALT\n * @final\n * @type {Number}\n */\n this.KEY_ALT = 18;\n\n /**\n * Code for the PAUSE_BREAK key.\n * @property KEY_PAUSE_BREAK\n * @final\n * @type {Number}\n */\n this.KEY_PAUSE_BREAK = 19;\n\n /**\n * Code for the CAPS_LOCK key.\n * @property KEY_CAPS_LOCK\n * @final\n * @type {Number}\n */\n this.KEY_CAPS_LOCK = 20;\n\n /**\n * Code for the ESCAPE key.\n * @property KEY_ESCAPE\n * @final\n * @type {Number}\n */\n this.KEY_ESCAPE = 27;\n\n /**\n * Code for the PAGE_UP key.\n * @property KEY_PAGE_UP\n * @final\n * @type {Number}\n */\n this.KEY_PAGE_UP = 33;\n\n /**\n * Code for the PAGE_DOWN key.\n * @property KEY_PAGE_DOWN\n * @final\n * @type {Number}\n */\n this.KEY_PAGE_DOWN = 34;\n\n /**\n * Code for the END key.\n * @property KEY_END\n * @final\n * @type {Number}\n */\n this.KEY_END = 35;\n\n /**\n * Code for the HOME key.\n * @property KEY_HOME\n * @final\n * @type {Number}\n */\n this.KEY_HOME = 36;\n\n /**\n * Code for the LEFT_ARROW key.\n * @property KEY_LEFT_ARROW\n * @final\n * @type {Number}\n */\n this.KEY_LEFT_ARROW = 37;\n\n /**\n * Code for the UP_ARROW key.\n * @property KEY_UP_ARROW\n * @final\n * @type {Number}\n */\n this.KEY_UP_ARROW = 38;\n\n /**\n * Code for the RIGHT_ARROW key.\n * @property KEY_RIGHT_ARROW\n * @final\n * @type {Number}\n */\n this.KEY_RIGHT_ARROW = 39;\n\n /**\n * Code for the DOWN_ARROW key.\n * @property KEY_DOWN_ARROW\n * @final\n * @type {Number}\n */\n this.KEY_DOWN_ARROW = 40;\n\n /**\n * Code for the INSERT key.\n * @property KEY_INSERT\n * @final\n * @type {Number}\n */\n this.KEY_INSERT = 45;\n\n /**\n * Code for the DELETE key.\n * @property KEY_DELETE\n * @final\n * @type {Number}\n */\n this.KEY_DELETE = 46;\n\n /**\n * Code for the 0 key.\n * @property KEY_NUM_0\n * @final\n * @type {Number}\n */\n this.KEY_NUM_0 = 48;\n\n /**\n * Code for the 1 key.\n * @property KEY_NUM_1\n * @final\n * @type {Number}\n */\n this.KEY_NUM_1 = 49;\n\n /**\n * Code for the 2 key.\n * @property KEY_NUM_2\n * @final\n * @type {Number}\n */\n this.KEY_NUM_2 = 50;\n\n /**\n * Code for the 3 key.\n * @property KEY_NUM_3\n * @final\n * @type {Number}\n */\n this.KEY_NUM_3 = 51;\n\n /**\n * Code for the 4 key.\n * @property KEY_NUM_4\n * @final\n * @type {Number}\n */\n this.KEY_NUM_4 = 52;\n\n /**\n * Code for the 5 key.\n * @property KEY_NUM_5\n * @final\n * @type {Number}\n */\n this.KEY_NUM_5 = 53;\n\n /**\n * Code for the 6 key.\n * @property KEY_NUM_6\n * @final\n * @type {Number}\n */\n this.KEY_NUM_6 = 54;\n\n /**\n * Code for the 7 key.\n * @property KEY_NUM_7\n * @final\n * @type {Number}\n */\n this.KEY_NUM_7 = 55;\n\n /**\n * Code for the 8 key.\n * @property KEY_NUM_8\n * @final\n * @type {Number}\n */\n this.KEY_NUM_8 = 56;\n\n /**\n * Code for the 9 key.\n * @property KEY_NUM_9\n * @final\n * @type {Number}\n */\n this.KEY_NUM_9 = 57;\n\n /**\n * Code for the A key.\n * @property KEY_A\n * @final\n * @type {Number}\n */\n this.KEY_A = 65;\n\n /**\n * Code for the B key.\n * @property KEY_B\n * @final\n * @type {Number}\n */\n this.KEY_B = 66;\n\n /**\n * Code for the C key.\n * @property KEY_C\n * @final\n * @type {Number}\n */\n this.KEY_C = 67;\n\n /**\n * Code for the D key.\n * @property KEY_D\n * @final\n * @type {Number}\n */\n this.KEY_D = 68;\n\n /**\n * Code for the E key.\n * @property KEY_E\n * @final\n * @type {Number}\n */\n this.KEY_E = 69;\n\n /**\n * Code for the F key.\n * @property KEY_F\n * @final\n * @type {Number}\n */\n this.KEY_F = 70;\n\n /**\n * Code for the G key.\n * @property KEY_G\n * @final\n * @type {Number}\n */\n this.KEY_G = 71;\n\n /**\n * Code for the H key.\n * @property KEY_H\n * @final\n * @type {Number}\n */\n this.KEY_H = 72;\n\n /**\n * Code for the I key.\n * @property KEY_I\n * @final\n * @type {Number}\n */\n this.KEY_I = 73;\n\n /**\n * Code for the J key.\n * @property KEY_J\n * @final\n * @type {Number}\n */\n this.KEY_J = 74;\n\n /**\n * Code for the K key.\n * @property KEY_K\n * @final\n * @type {Number}\n */\n this.KEY_K = 75;\n\n /**\n * Code for the L key.\n * @property KEY_L\n * @final\n * @type {Number}\n */\n this.KEY_L = 76;\n\n /**\n * Code for the M key.\n * @property KEY_M\n * @final\n * @type {Number}\n */\n this.KEY_M = 77;\n\n /**\n * Code for the N key.\n * @property KEY_N\n * @final\n * @type {Number}\n */\n this.KEY_N = 78;\n\n /**\n * Code for the O key.\n * @property KEY_O\n * @final\n * @type {Number}\n */\n this.KEY_O = 79;\n\n /**\n * Code for the P key.\n * @property KEY_P\n * @final\n * @type {Number}\n */\n this.KEY_P = 80;\n\n /**\n * Code for the Q key.\n * @property KEY_Q\n * @final\n * @type {Number}\n */\n this.KEY_Q = 81;\n\n /**\n * Code for the R key.\n * @property KEY_R\n * @final\n * @type {Number}\n */\n this.KEY_R = 82;\n\n /**\n * Code for the S key.\n * @property KEY_S\n * @final\n * @type {Number}\n */\n this.KEY_S = 83;\n\n /**\n * Code for the T key.\n * @property KEY_T\n * @final\n * @type {Number}\n */\n this.KEY_T = 84;\n\n /**\n * Code for the U key.\n * @property KEY_U\n * @final\n * @type {Number}\n */\n this.KEY_U = 85;\n\n /**\n * Code for the V key.\n * @property KEY_V\n * @final\n * @type {Number}\n */\n this.KEY_V = 86;\n\n /**\n * Code for the W key.\n * @property KEY_W\n * @final\n * @type {Number}\n */\n this.KEY_W = 87;\n\n /**\n * Code for the X key.\n * @property KEY_X\n * @final\n * @type {Number}\n */\n this.KEY_X = 88;\n\n /**\n * Code for the Y key.\n * @property KEY_Y\n * @final\n * @type {Number}\n */\n this.KEY_Y = 89;\n\n /**\n * Code for the Z key.\n * @property KEY_Z\n * @final\n * @type {Number}\n */\n this.KEY_Z = 90;\n\n /**\n * Code for the LEFT_WINDOW key.\n * @property KEY_LEFT_WINDOW\n * @final\n * @type {Number}\n */\n this.KEY_LEFT_WINDOW = 91;\n\n /**\n * Code for the RIGHT_WINDOW key.\n * @property KEY_RIGHT_WINDOW\n * @final\n * @type {Number}\n */\n this.KEY_RIGHT_WINDOW = 92;\n\n /**\n * Code for the SELECT key.\n * @property KEY_SELECT\n * @final\n * @type {Number}\n */\n this.KEY_SELECT_KEY = 93;\n\n /**\n * Code for the number pad 0 key.\n * @property KEY_NUMPAD_0\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_0 = 96;\n\n /**\n * Code for the number pad 1 key.\n * @property KEY_NUMPAD_1\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_1 = 97;\n\n /**\n * Code for the number pad 2 key.\n * @property KEY_NUMPAD 2\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_2 = 98;\n\n /**\n * Code for the number pad 3 key.\n * @property KEY_NUMPAD_3\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_3 = 99;\n\n /**\n * Code for the number pad 4 key.\n * @property KEY_NUMPAD_4\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_4 = 100;\n\n /**\n * Code for the number pad 5 key.\n * @property KEY_NUMPAD_5\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_5 = 101;\n\n /**\n * Code for the number pad 6 key.\n * @property KEY_NUMPAD_6\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_6 = 102;\n\n /**\n * Code for the number pad 7 key.\n * @property KEY_NUMPAD_7\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_7 = 103;\n\n /**\n * Code for the number pad 8 key.\n * @property KEY_NUMPAD_8\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_8 = 104;\n\n /**\n * Code for the number pad 9 key.\n * @property KEY_NUMPAD_9\n * @final\n * @type {Number}\n */\n this.KEY_NUMPAD_9 = 105;\n\n /**\n * Code for the MULTIPLY key.\n * @property KEY_MULTIPLY\n * @final\n * @type {Number}\n */\n this.KEY_MULTIPLY = 106;\n\n /**\n * Code for the ADD key.\n * @property KEY_ADD\n * @final\n * @type {Number}\n */\n this.KEY_ADD = 107;\n\n /**\n * Code for the SUBTRACT key.\n * @property KEY_SUBTRACT\n * @final\n * @type {Number}\n */\n this.KEY_SUBTRACT = 109;\n\n /**\n * Code for the DECIMAL POINT key.\n * @property KEY_DECIMAL_POINT\n * @final\n * @type {Number}\n */\n this.KEY_DECIMAL_POINT = 110;\n\n /**\n * Code for the DIVIDE key.\n * @property KEY_DIVIDE\n * @final\n * @type {Number}\n */\n this.KEY_DIVIDE = 111;\n\n /**\n * Code for the F1 key.\n * @property KEY_F1\n * @final\n * @type {Number}\n */\n this.KEY_F1 = 112;\n\n /**\n * Code for the F2 key.\n * @property KEY_F2\n * @final\n * @type {Number}\n */\n this.KEY_F2 = 113;\n\n /**\n * Code for the F3 key.\n * @property KEY_F3\n * @final\n * @type {Number}\n */\n this.KEY_F3 = 114;\n\n /**\n * Code for the F4 key.\n * @property KEY_F4\n * @final\n * @type {Number}\n */\n this.KEY_F4 = 115;\n\n /**\n * Code for the F5 key.\n * @property KEY_F5\n * @final\n * @type {Number}\n */\n this.KEY_F5 = 116;\n\n /**\n * Code for the F6 key.\n * @property KEY_F6\n * @final\n * @type {Number}\n */\n this.KEY_F6 = 117;\n\n /**\n * Code for the F7 key.\n * @property KEY_F7\n * @final\n * @type {Number}\n */\n this.KEY_F7 = 118;\n\n /**\n * Code for the F8 key.\n * @property KEY_F8\n * @final\n * @type {Number}\n */\n this.KEY_F8 = 119;\n\n /**\n * Code for the F9 key.\n * @property KEY_F9\n * @final\n * @type {Number}\n */\n this.KEY_F9 = 120;\n\n /**\n * Code for the F10 key.\n * @property KEY_F10\n * @final\n * @type {Number}\n */\n this.KEY_F10 = 121;\n\n /**\n * Code for the F11 key.\n * @property KEY_F11\n * @final\n * @type {Number}\n */\n this.KEY_F11 = 122;\n\n /**\n * Code for the F12 key.\n * @property KEY_F12\n * @final\n * @type {Number}\n */\n this.KEY_F12 = 123;\n\n /**\n * Code for the NUM_LOCK key.\n * @property KEY_NUM_LOCK\n * @final\n * @type {Number}\n */\n this.KEY_NUM_LOCK = 144;\n\n /**\n * Code for the SCROLL_LOCK key.\n * @property KEY_SCROLL_LOCK\n * @final\n * @type {Number}\n */\n this.KEY_SCROLL_LOCK = 145;\n\n /**\n * Code for the SEMI_COLON key.\n * @property KEY_SEMI_COLON\n * @final\n * @type {Number}\n */\n this.KEY_SEMI_COLON = 186;\n\n /**\n * Code for the EQUAL_SIGN key.\n * @property KEY_EQUAL_SIGN\n * @final\n * @type {Number}\n */\n this.KEY_EQUAL_SIGN = 187;\n\n /**\n * Code for the COMMA key.\n * @property KEY_COMMA\n * @final\n * @type {Number}\n */\n this.KEY_COMMA = 188;\n\n /**\n * Code for the DASH key.\n * @property KEY_DASH\n * @final\n * @type {Number}\n */\n this.KEY_DASH = 189;\n\n /**\n * Code for the PERIOD key.\n * @property KEY_PERIOD\n * @final\n * @type {Number}\n */\n this.KEY_PERIOD = 190;\n\n /**\n * Code for the FORWARD_SLASH key.\n * @property KEY_FORWARD_SLASH\n * @final\n * @type {Number}\n */\n this.KEY_FORWARD_SLASH = 191;\n\n /**\n * Code for the GRAVE_ACCENT key.\n * @property KEY_GRAVE_ACCENT\n * @final\n * @type {Number}\n */\n this.KEY_GRAVE_ACCENT = 192;\n\n /**\n * Code for the OPEN_BRACKET key.\n * @property KEY_OPEN_BRACKET\n * @final\n * @type {Number}\n */\n this.KEY_OPEN_BRACKET = 219;\n\n /**\n * Code for the BACK_SLASH key.\n * @property KEY_BACK_SLASH\n * @final\n * @type {Number}\n */\n this.KEY_BACK_SLASH = 220;\n\n /**\n * Code for the CLOSE_BRACKET key.\n * @property KEY_CLOSE_BRACKET\n * @final\n * @type {Number}\n */\n this.KEY_CLOSE_BRACKET = 221;\n\n /**\n * Code for the SINGLE_QUOTE key.\n * @property KEY_SINGLE_QUOTE\n * @final\n * @type {Number}\n */\n this.KEY_SINGLE_QUOTE = 222;\n\n /**\n * Code for the SPACE key.\n * @property KEY_SPACE\n * @final\n * @type {Number}\n */\n this.KEY_SPACE = 32;\n\n /**\n * The canvas element that mouse and keyboards are bound to.\n *\n * @final\n * @type {HTMLCanvasElement}\n */\n this.element = cfg.element;\n\n /** True whenever ALT key is down.\n *\n * @type {boolean}\n */\n this.altDown = false;\n\n /** True whenever CTRL key is down.\n *\n * @type {boolean}\n */\n this.ctrlDown = false;\n\n /** True whenever left mouse button is down.\n *\n * @type {boolean}\n */\n this.mouseDownLeft = false;\n\n /**\n * True whenever middle mouse button is down.\n *\n * @type {boolean}\n */\n this.mouseDownMiddle = false;\n\n /**\n * True whenever the right mouse button is down.\n *\n * @type {boolean}\n */\n this.mouseDownRight = false;\n\n /**\n * Flag for each key that's down.\n *\n * @type {boolean[]}\n */\n this.keyDown = [];\n\n /** True while input enabled\n *\n * @type {boolean}\n */\n this.enabled = true;\n\n /** True while keyboard input is enabled.\n *\n * Default value is ````true````.\n *\n * {@link CameraControl} will not respond to keyboard events while this is ````false````.\n *\n * @type {boolean}\n */\n this.keyboardEnabled = true;\n\n /** True while the mouse is over the canvas.\n *\n * @type {boolean}\n */\n this.mouseover = false;\n\n /**\n * Current mouse position within the canvas.\n * @type {Number[]}\n */\n this.mouseCanvasPos = math.vec2();\n\n this._keyboardEventsElement = cfg.keyboardEventsElement || document;\n\n this._bindEvents();\n }\n\n _bindEvents() {\n\n if (this._eventsBound) {\n return;\n }\n\n this._keyboardEventsElement.addEventListener(\"keydown\", this._keyDownListener = (e) => {\n if (!this.enabled || (!this.keyboardEnabled)) {\n return;\n }\n if (e.target.tagName !== \"INPUT\" && e.target.tagName !== \"TEXTAREA\") {\n if (e.keyCode === this.KEY_CTRL) {\n this.ctrlDown = true;\n } else if (e.keyCode === this.KEY_ALT) {\n this.altDown = true;\n } else if (e.keyCode === this.KEY_SHIFT) {\n this.shiftDown = true;\n }\n this.keyDown[e.keyCode] = true;\n this.fire(\"keydown\", e.keyCode, true);\n }\n }, false);\n\n this._keyboardEventsElement.addEventListener(\"keyup\", this._keyUpListener = (e) => {\n if (!this.enabled || (!this.keyboardEnabled)) {\n return;\n }\n if (e.target.tagName !== \"INPUT\" && e.target.tagName !== \"TEXTAREA\") {\n if (e.keyCode === this.KEY_CTRL) {\n this.ctrlDown = false;\n } else if (e.keyCode === this.KEY_ALT) {\n this.altDown = false;\n } else if (e.keyCode === this.KEY_SHIFT) {\n this.shiftDown = false;\n }\n this.keyDown[e.keyCode] = false;\n this.fire(\"keyup\", e.keyCode, true);\n }\n });\n\n this.element.addEventListener(\"mouseenter\", this._mouseEnterListener = (e) => {\n if (!this.enabled) {\n return;\n }\n this.mouseover = true;\n this._getMouseCanvasPos(e);\n this.fire(\"mouseenter\", this.mouseCanvasPos, true);\n });\n\n this.element.addEventListener(\"mouseleave\", this._mouseLeaveListener = (e) => {\n if (!this.enabled) {\n return;\n }\n this.mouseover = false;\n this._getMouseCanvasPos(e);\n this.fire(\"mouseleave\", this.mouseCanvasPos, true);\n });\n\n this.element.addEventListener(\"mousedown\", this._mouseDownListener = (e) => {\n if (!this.enabled) {\n return;\n }\n switch (e.which) {\n case 1:// Left button\n this.mouseDownLeft = true;\n break;\n case 2:// Middle/both buttons\n this.mouseDownMiddle = true;\n break;\n case 3:// Right button\n this.mouseDownRight = true;\n break;\n default:\n break;\n }\n this._getMouseCanvasPos(e);\n this.element.focus();\n this.fire(\"mousedown\", this.mouseCanvasPos, true);\n if (this.mouseover) {\n e.preventDefault();\n }\n });\n\n document.addEventListener(\"mouseup\", this._mouseUpListener = (e) => {\n if (!this.enabled) {\n return;\n }\n switch (e.which) {\n case 1:// Left button\n this.mouseDownLeft = false;\n break;\n case 2:// Middle/both buttons\n this.mouseDownMiddle = false;\n break;\n case 3:// Right button\n this.mouseDownRight = false;\n break;\n default:\n break;\n }\n this.fire(\"mouseup\", this.mouseCanvasPos, true);\n // if (this.mouseover) {\n // e.preventDefault();\n // }\n }, true);\n\n document.addEventListener(\"click\", this._clickListener = (e) => {\n if (!this.enabled) {\n return;\n }\n switch (e.which) {\n case 1:// Left button\n this.mouseDownLeft = false;\n this.mouseDownRight = false;\n break;\n case 2:// Middle/both buttons\n this.mouseDownMiddle = false;\n break;\n case 3:// Right button\n this.mouseDownLeft = false;\n this.mouseDownRight = false;\n break;\n default:\n break;\n }\n this._getMouseCanvasPos(e);\n this.fire(\"click\", this.mouseCanvasPos, true);\n if (this.mouseover) {\n e.preventDefault();\n }\n });\n\n document.addEventListener(\"dblclick\", this._dblClickListener = (e) => {\n if (!this.enabled) {\n return;\n }\n switch (e.which) {\n case 1:// Left button\n this.mouseDownLeft = false;\n this.mouseDownRight = false;\n break;\n case 2:// Middle/both buttons\n this.mouseDownMiddle = false;\n break;\n case 3:// Right button\n this.mouseDownLeft = false;\n this.mouseDownRight = false;\n break;\n default:\n break;\n }\n this._getMouseCanvasPos(e);\n this.fire(\"dblclick\", this.mouseCanvasPos, true);\n if (this.mouseover) {\n e.preventDefault();\n }\n });\n\n const tickifedMouseMoveFn = this.scene.tickify(\n () => this.fire(\"mousemove\", this.mouseCanvasPos, true)\n );\n\n this.element.addEventListener(\"mousemove\", this._mouseMoveListener = (e) => {\n if (!this.enabled) {\n return;\n }\n this._getMouseCanvasPos(e);\n tickifedMouseMoveFn(); \n if (this.mouseover) {\n e.preventDefault();\n }\n });\n\n const tickifiedMouseWheelFn = this.scene.tickify(\n (delta) => { this.fire(\"mousewheel\", delta, true); }\n );\n\n this.element.addEventListener(\"wheel\", this._mouseWheelListener = (e, d) => {\n if (!this.enabled) {\n return;\n }\n const delta = Math.max(-1, Math.min(1, -e.deltaY * 40));\n tickifiedMouseWheelFn(delta);\n }, {passive: true});\n\n // mouseclicked\n\n {\n let downX;\n let downY;\n // Tolerance between down and up positions for a mouse click\n const tolerance = 2;\n this.on(\"mousedown\", (params) => {\n downX = params[0];\n downY = params[1];\n });\n this.on(\"mouseup\", (params) => {\n if (downX >= (params[0] - tolerance) &&\n downX <= (params[0] + tolerance) &&\n downY >= (params[1] - tolerance) &&\n downY <= (params[1] + tolerance)) {\n this.fire(\"mouseclicked\", params, true);\n }\n });\n }\n\n this._eventsBound = true;\n }\n\n _unbindEvents() {\n if (!this._eventsBound) {\n return;\n }\n this._keyboardEventsElement.removeEventListener(\"keydown\", this._keyDownListener);\n this._keyboardEventsElement.removeEventListener(\"keyup\", this._keyUpListener);\n this.element.removeEventListener(\"mouseenter\", this._mouseEnterListener);\n this.element.removeEventListener(\"mouseleave\", this._mouseLeaveListener);\n this.element.removeEventListener(\"mousedown\", this._mouseDownListener);\n document.removeEventListener(\"mouseup\", this._mouseDownListener);\n document.removeEventListener(\"click\", this._clickListener);\n document.removeEventListener(\"dblclick\", this._dblClickListener);\n this.element.removeEventListener(\"mousemove\", this._mouseMoveListener);\n this.element.removeEventListener(\"wheel\", this._mouseWheelListener);\n if (window.OrientationChangeEvent) {\n window.removeEventListener('orientationchange', this._orientationchangedListener);\n }\n if (window.DeviceMotionEvent) {\n window.removeEventListener('devicemotion', this._deviceMotionListener);\n }\n if (window.DeviceOrientationEvent) {\n window.removeEventListener(\"deviceorientation\", this._deviceOrientListener);\n }\n this._eventsBound = false;\n }\n\n _getMouseCanvasPos(event) {\n if (!event) {\n event = window.event;\n this.mouseCanvasPos[0] = event.x;\n this.mouseCanvasPos[1] = event.y;\n } else {\n let element = event.target;\n let totalOffsetLeft = 0;\n let totalOffsetTop = 0;\n while (element.offsetParent) {\n totalOffsetLeft += element.offsetLeft;\n totalOffsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n this.mouseCanvasPos[0] = event.pageX - totalOffsetLeft;\n this.mouseCanvasPos[1] = event.pageY - totalOffsetTop;\n }\n }\n\n /**\n * Sets whether input handlers are enabled.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} enable Indicates if input handlers are enabled.\n */\n setEnabled(enable) {\n if (this.enabled !== enable) {\n this.fire(\"enabled\", this.enabled = enable);\n }\n }\n\n /**\n * Gets whether input handlers are enabled.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Indicates if input handlers are enabled.\n */\n getEnabled() {\n return this.enabled;\n }\n\n /**\n * Sets whether or not keyboard input is enabled.\n *\n * Default value is ````true````.\n *\n * {@link CameraControl} will not respond to keyboard events while this is set ````false````.\n *\n * @param {Boolean} value Indicates whether keyboard input is enabled.\n */\n setKeyboardEnabled(value) {\n this.keyboardEnabled = value;\n }\n\n /**\n * Gets whether keyboard input is enabled.\n *\n * Default value is ````true````.\n *\n * {@link CameraControl} will not respond to keyboard events while this is set ````false````.\n *\n * @returns {Boolean} Returns whether keyboard input is enabled.\n */\n getKeyboardEnabled() {\n return this.keyboardEnabled;\n }\n\n /**\n * @private\n */\n destroy() {\n super.destroy();\n this._unbindEvents();\n }\n}\n\nexport {Input};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/input/Input.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/input/Input.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3469, + "__docId__": 3477, "kind": "class", "name": "Input", "memberof": "src/viewer/scene/input/Input.js", @@ -68447,7 +68663,7 @@ ] }, { - "__docId__": 3470, + "__docId__": 3478, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68461,7 +68677,7 @@ "ignore": true }, { - "__docId__": 3471, + "__docId__": 3479, "kind": "member", "name": "KEY_BACKSPACE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68498,7 +68714,7 @@ } }, { - "__docId__": 3472, + "__docId__": 3480, "kind": "member", "name": "KEY_TAB", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68535,7 +68751,7 @@ } }, { - "__docId__": 3473, + "__docId__": 3481, "kind": "member", "name": "KEY_ENTER", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68572,7 +68788,7 @@ } }, { - "__docId__": 3474, + "__docId__": 3482, "kind": "member", "name": "KEY_SHIFT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68609,7 +68825,7 @@ } }, { - "__docId__": 3475, + "__docId__": 3483, "kind": "member", "name": "KEY_CTRL", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68646,7 +68862,7 @@ } }, { - "__docId__": 3476, + "__docId__": 3484, "kind": "member", "name": "KEY_ALT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68683,7 +68899,7 @@ } }, { - "__docId__": 3477, + "__docId__": 3485, "kind": "member", "name": "KEY_PAUSE_BREAK", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68720,7 +68936,7 @@ } }, { - "__docId__": 3478, + "__docId__": 3486, "kind": "member", "name": "KEY_CAPS_LOCK", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68757,7 +68973,7 @@ } }, { - "__docId__": 3479, + "__docId__": 3487, "kind": "member", "name": "KEY_ESCAPE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68794,7 +69010,7 @@ } }, { - "__docId__": 3480, + "__docId__": 3488, "kind": "member", "name": "KEY_PAGE_UP", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68831,7 +69047,7 @@ } }, { - "__docId__": 3481, + "__docId__": 3489, "kind": "member", "name": "KEY_PAGE_DOWN", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68868,7 +69084,7 @@ } }, { - "__docId__": 3482, + "__docId__": 3490, "kind": "member", "name": "KEY_END", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68905,7 +69121,7 @@ } }, { - "__docId__": 3483, + "__docId__": 3491, "kind": "member", "name": "KEY_HOME", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68942,7 +69158,7 @@ } }, { - "__docId__": 3484, + "__docId__": 3492, "kind": "member", "name": "KEY_LEFT_ARROW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -68979,7 +69195,7 @@ } }, { - "__docId__": 3485, + "__docId__": 3493, "kind": "member", "name": "KEY_UP_ARROW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69016,7 +69232,7 @@ } }, { - "__docId__": 3486, + "__docId__": 3494, "kind": "member", "name": "KEY_RIGHT_ARROW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69053,7 +69269,7 @@ } }, { - "__docId__": 3487, + "__docId__": 3495, "kind": "member", "name": "KEY_DOWN_ARROW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69090,7 +69306,7 @@ } }, { - "__docId__": 3488, + "__docId__": 3496, "kind": "member", "name": "KEY_INSERT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69127,7 +69343,7 @@ } }, { - "__docId__": 3489, + "__docId__": 3497, "kind": "member", "name": "KEY_DELETE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69164,7 +69380,7 @@ } }, { - "__docId__": 3490, + "__docId__": 3498, "kind": "member", "name": "KEY_NUM_0", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69201,7 +69417,7 @@ } }, { - "__docId__": 3491, + "__docId__": 3499, "kind": "member", "name": "KEY_NUM_1", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69238,7 +69454,7 @@ } }, { - "__docId__": 3492, + "__docId__": 3500, "kind": "member", "name": "KEY_NUM_2", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69275,7 +69491,7 @@ } }, { - "__docId__": 3493, + "__docId__": 3501, "kind": "member", "name": "KEY_NUM_3", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69312,7 +69528,7 @@ } }, { - "__docId__": 3494, + "__docId__": 3502, "kind": "member", "name": "KEY_NUM_4", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69349,7 +69565,7 @@ } }, { - "__docId__": 3495, + "__docId__": 3503, "kind": "member", "name": "KEY_NUM_5", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69386,7 +69602,7 @@ } }, { - "__docId__": 3496, + "__docId__": 3504, "kind": "member", "name": "KEY_NUM_6", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69423,7 +69639,7 @@ } }, { - "__docId__": 3497, + "__docId__": 3505, "kind": "member", "name": "KEY_NUM_7", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69460,7 +69676,7 @@ } }, { - "__docId__": 3498, + "__docId__": 3506, "kind": "member", "name": "KEY_NUM_8", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69497,7 +69713,7 @@ } }, { - "__docId__": 3499, + "__docId__": 3507, "kind": "member", "name": "KEY_NUM_9", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69534,7 +69750,7 @@ } }, { - "__docId__": 3500, + "__docId__": 3508, "kind": "member", "name": "KEY_A", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69571,7 +69787,7 @@ } }, { - "__docId__": 3501, + "__docId__": 3509, "kind": "member", "name": "KEY_B", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69608,7 +69824,7 @@ } }, { - "__docId__": 3502, + "__docId__": 3510, "kind": "member", "name": "KEY_C", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69645,7 +69861,7 @@ } }, { - "__docId__": 3503, + "__docId__": 3511, "kind": "member", "name": "KEY_D", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69682,7 +69898,7 @@ } }, { - "__docId__": 3504, + "__docId__": 3512, "kind": "member", "name": "KEY_E", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69719,7 +69935,7 @@ } }, { - "__docId__": 3505, + "__docId__": 3513, "kind": "member", "name": "KEY_F", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69756,7 +69972,7 @@ } }, { - "__docId__": 3506, + "__docId__": 3514, "kind": "member", "name": "KEY_G", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69793,7 +70009,7 @@ } }, { - "__docId__": 3507, + "__docId__": 3515, "kind": "member", "name": "KEY_H", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69830,7 +70046,7 @@ } }, { - "__docId__": 3508, + "__docId__": 3516, "kind": "member", "name": "KEY_I", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69867,7 +70083,7 @@ } }, { - "__docId__": 3509, + "__docId__": 3517, "kind": "member", "name": "KEY_J", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69904,7 +70120,7 @@ } }, { - "__docId__": 3510, + "__docId__": 3518, "kind": "member", "name": "KEY_K", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69941,7 +70157,7 @@ } }, { - "__docId__": 3511, + "__docId__": 3519, "kind": "member", "name": "KEY_L", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -69978,7 +70194,7 @@ } }, { - "__docId__": 3512, + "__docId__": 3520, "kind": "member", "name": "KEY_M", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70015,7 +70231,7 @@ } }, { - "__docId__": 3513, + "__docId__": 3521, "kind": "member", "name": "KEY_N", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70052,7 +70268,7 @@ } }, { - "__docId__": 3514, + "__docId__": 3522, "kind": "member", "name": "KEY_O", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70089,7 +70305,7 @@ } }, { - "__docId__": 3515, + "__docId__": 3523, "kind": "member", "name": "KEY_P", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70126,7 +70342,7 @@ } }, { - "__docId__": 3516, + "__docId__": 3524, "kind": "member", "name": "KEY_Q", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70163,7 +70379,7 @@ } }, { - "__docId__": 3517, + "__docId__": 3525, "kind": "member", "name": "KEY_R", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70200,7 +70416,7 @@ } }, { - "__docId__": 3518, + "__docId__": 3526, "kind": "member", "name": "KEY_S", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70237,7 +70453,7 @@ } }, { - "__docId__": 3519, + "__docId__": 3527, "kind": "member", "name": "KEY_T", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70274,7 +70490,7 @@ } }, { - "__docId__": 3520, + "__docId__": 3528, "kind": "member", "name": "KEY_U", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70311,7 +70527,7 @@ } }, { - "__docId__": 3521, + "__docId__": 3529, "kind": "member", "name": "KEY_V", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70348,7 +70564,7 @@ } }, { - "__docId__": 3522, + "__docId__": 3530, "kind": "member", "name": "KEY_W", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70385,7 +70601,7 @@ } }, { - "__docId__": 3523, + "__docId__": 3531, "kind": "member", "name": "KEY_X", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70422,7 +70638,7 @@ } }, { - "__docId__": 3524, + "__docId__": 3532, "kind": "member", "name": "KEY_Y", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70459,7 +70675,7 @@ } }, { - "__docId__": 3525, + "__docId__": 3533, "kind": "member", "name": "KEY_Z", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70496,7 +70712,7 @@ } }, { - "__docId__": 3526, + "__docId__": 3534, "kind": "member", "name": "KEY_LEFT_WINDOW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70533,7 +70749,7 @@ } }, { - "__docId__": 3527, + "__docId__": 3535, "kind": "member", "name": "KEY_RIGHT_WINDOW", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70570,7 +70786,7 @@ } }, { - "__docId__": 3528, + "__docId__": 3536, "kind": "member", "name": "KEY_SELECT_KEY", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70607,7 +70823,7 @@ } }, { - "__docId__": 3529, + "__docId__": 3537, "kind": "member", "name": "KEY_NUMPAD_0", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70644,7 +70860,7 @@ } }, { - "__docId__": 3530, + "__docId__": 3538, "kind": "member", "name": "KEY_NUMPAD_1", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70681,7 +70897,7 @@ } }, { - "__docId__": 3531, + "__docId__": 3539, "kind": "member", "name": "KEY_NUMPAD_2", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70718,7 +70934,7 @@ } }, { - "__docId__": 3532, + "__docId__": 3540, "kind": "member", "name": "KEY_NUMPAD_3", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70755,7 +70971,7 @@ } }, { - "__docId__": 3533, + "__docId__": 3541, "kind": "member", "name": "KEY_NUMPAD_4", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70792,7 +71008,7 @@ } }, { - "__docId__": 3534, + "__docId__": 3542, "kind": "member", "name": "KEY_NUMPAD_5", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70829,7 +71045,7 @@ } }, { - "__docId__": 3535, + "__docId__": 3543, "kind": "member", "name": "KEY_NUMPAD_6", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70866,7 +71082,7 @@ } }, { - "__docId__": 3536, + "__docId__": 3544, "kind": "member", "name": "KEY_NUMPAD_7", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70903,7 +71119,7 @@ } }, { - "__docId__": 3537, + "__docId__": 3545, "kind": "member", "name": "KEY_NUMPAD_8", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70940,7 +71156,7 @@ } }, { - "__docId__": 3538, + "__docId__": 3546, "kind": "member", "name": "KEY_NUMPAD_9", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -70977,7 +71193,7 @@ } }, { - "__docId__": 3539, + "__docId__": 3547, "kind": "member", "name": "KEY_MULTIPLY", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71014,7 +71230,7 @@ } }, { - "__docId__": 3540, + "__docId__": 3548, "kind": "member", "name": "KEY_ADD", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71051,7 +71267,7 @@ } }, { - "__docId__": 3541, + "__docId__": 3549, "kind": "member", "name": "KEY_SUBTRACT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71088,7 +71304,7 @@ } }, { - "__docId__": 3542, + "__docId__": 3550, "kind": "member", "name": "KEY_DECIMAL_POINT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71125,7 +71341,7 @@ } }, { - "__docId__": 3543, + "__docId__": 3551, "kind": "member", "name": "KEY_DIVIDE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71162,7 +71378,7 @@ } }, { - "__docId__": 3544, + "__docId__": 3552, "kind": "member", "name": "KEY_F1", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71199,7 +71415,7 @@ } }, { - "__docId__": 3545, + "__docId__": 3553, "kind": "member", "name": "KEY_F2", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71236,7 +71452,7 @@ } }, { - "__docId__": 3546, + "__docId__": 3554, "kind": "member", "name": "KEY_F3", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71273,7 +71489,7 @@ } }, { - "__docId__": 3547, + "__docId__": 3555, "kind": "member", "name": "KEY_F4", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71310,7 +71526,7 @@ } }, { - "__docId__": 3548, + "__docId__": 3556, "kind": "member", "name": "KEY_F5", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71347,7 +71563,7 @@ } }, { - "__docId__": 3549, + "__docId__": 3557, "kind": "member", "name": "KEY_F6", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71384,7 +71600,7 @@ } }, { - "__docId__": 3550, + "__docId__": 3558, "kind": "member", "name": "KEY_F7", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71421,7 +71637,7 @@ } }, { - "__docId__": 3551, + "__docId__": 3559, "kind": "member", "name": "KEY_F8", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71458,7 +71674,7 @@ } }, { - "__docId__": 3552, + "__docId__": 3560, "kind": "member", "name": "KEY_F9", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71495,7 +71711,7 @@ } }, { - "__docId__": 3553, + "__docId__": 3561, "kind": "member", "name": "KEY_F10", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71532,7 +71748,7 @@ } }, { - "__docId__": 3554, + "__docId__": 3562, "kind": "member", "name": "KEY_F11", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71569,7 +71785,7 @@ } }, { - "__docId__": 3555, + "__docId__": 3563, "kind": "member", "name": "KEY_F12", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71606,7 +71822,7 @@ } }, { - "__docId__": 3556, + "__docId__": 3564, "kind": "member", "name": "KEY_NUM_LOCK", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71643,7 +71859,7 @@ } }, { - "__docId__": 3557, + "__docId__": 3565, "kind": "member", "name": "KEY_SCROLL_LOCK", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71680,7 +71896,7 @@ } }, { - "__docId__": 3558, + "__docId__": 3566, "kind": "member", "name": "KEY_SEMI_COLON", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71717,7 +71933,7 @@ } }, { - "__docId__": 3559, + "__docId__": 3567, "kind": "member", "name": "KEY_EQUAL_SIGN", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71754,7 +71970,7 @@ } }, { - "__docId__": 3560, + "__docId__": 3568, "kind": "member", "name": "KEY_COMMA", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71791,7 +72007,7 @@ } }, { - "__docId__": 3561, + "__docId__": 3569, "kind": "member", "name": "KEY_DASH", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71828,7 +72044,7 @@ } }, { - "__docId__": 3562, + "__docId__": 3570, "kind": "member", "name": "KEY_PERIOD", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71865,7 +72081,7 @@ } }, { - "__docId__": 3563, + "__docId__": 3571, "kind": "member", "name": "KEY_FORWARD_SLASH", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71902,7 +72118,7 @@ } }, { - "__docId__": 3564, + "__docId__": 3572, "kind": "member", "name": "KEY_GRAVE_ACCENT", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71939,7 +72155,7 @@ } }, { - "__docId__": 3565, + "__docId__": 3573, "kind": "member", "name": "KEY_OPEN_BRACKET", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -71976,7 +72192,7 @@ } }, { - "__docId__": 3566, + "__docId__": 3574, "kind": "member", "name": "KEY_BACK_SLASH", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72013,7 +72229,7 @@ } }, { - "__docId__": 3567, + "__docId__": 3575, "kind": "member", "name": "KEY_CLOSE_BRACKET", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72050,7 +72266,7 @@ } }, { - "__docId__": 3568, + "__docId__": 3576, "kind": "member", "name": "KEY_SINGLE_QUOTE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72087,7 +72303,7 @@ } }, { - "__docId__": 3569, + "__docId__": 3577, "kind": "member", "name": "KEY_SPACE", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72124,7 +72340,7 @@ } }, { - "__docId__": 3570, + "__docId__": 3578, "kind": "member", "name": "element", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72149,7 +72365,7 @@ } }, { - "__docId__": 3571, + "__docId__": 3579, "kind": "member", "name": "altDown", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72168,7 +72384,7 @@ } }, { - "__docId__": 3572, + "__docId__": 3580, "kind": "member", "name": "ctrlDown", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72187,7 +72403,7 @@ } }, { - "__docId__": 3573, + "__docId__": 3581, "kind": "member", "name": "mouseDownLeft", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72206,7 +72422,7 @@ } }, { - "__docId__": 3574, + "__docId__": 3582, "kind": "member", "name": "mouseDownMiddle", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72225,7 +72441,7 @@ } }, { - "__docId__": 3575, + "__docId__": 3583, "kind": "member", "name": "mouseDownRight", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72244,7 +72460,7 @@ } }, { - "__docId__": 3576, + "__docId__": 3584, "kind": "member", "name": "keyDown", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72263,7 +72479,7 @@ } }, { - "__docId__": 3577, + "__docId__": 3585, "kind": "member", "name": "enabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72282,7 +72498,7 @@ } }, { - "__docId__": 3578, + "__docId__": 3586, "kind": "member", "name": "keyboardEnabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72301,7 +72517,7 @@ } }, { - "__docId__": 3579, + "__docId__": 3587, "kind": "member", "name": "mouseover", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72320,7 +72536,7 @@ } }, { - "__docId__": 3580, + "__docId__": 3588, "kind": "member", "name": "mouseCanvasPos", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72339,7 +72555,7 @@ } }, { - "__docId__": 3581, + "__docId__": 3589, "kind": "member", "name": "_keyboardEventsElement", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72357,7 +72573,7 @@ } }, { - "__docId__": 3582, + "__docId__": 3590, "kind": "method", "name": "_bindEvents", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72374,7 +72590,7 @@ "return": null }, { - "__docId__": 3585, + "__docId__": 3593, "kind": "member", "name": "shiftDown", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72391,7 +72607,7 @@ } }, { - "__docId__": 3607, + "__docId__": 3615, "kind": "member", "name": "_eventsBound", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72409,7 +72625,7 @@ } }, { - "__docId__": 3608, + "__docId__": 3616, "kind": "method", "name": "_unbindEvents", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72426,7 +72642,7 @@ "return": null }, { - "__docId__": 3610, + "__docId__": 3618, "kind": "method", "name": "_getMouseCanvasPos", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72450,7 +72666,7 @@ "return": null }, { - "__docId__": 3611, + "__docId__": 3619, "kind": "method", "name": "setEnabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72476,7 +72692,7 @@ "return": null }, { - "__docId__": 3612, + "__docId__": 3620, "kind": "method", "name": "getEnabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72504,7 +72720,7 @@ "params": [] }, { - "__docId__": 3613, + "__docId__": 3621, "kind": "method", "name": "setKeyboardEnabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72530,7 +72746,7 @@ "return": null }, { - "__docId__": 3615, + "__docId__": 3623, "kind": "method", "name": "getKeyboardEnabled", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72558,7 +72774,7 @@ "params": [] }, { - "__docId__": 3616, + "__docId__": 3624, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/input/Input.js~Input", @@ -72574,18 +72790,18 @@ "return": null }, { - "__docId__": 3617, + "__docId__": 3625, "kind": "file", "name": "src/viewer/scene/libs/k3d.js", "content": "/**\n * @private\n */\nvar K3D = {};\n\nK3D.load = function(path, resp)\n{\n var request = new XMLHttpRequest();\n request.open(\"GET\", path, true);\n request.responseType = \"arraybuffer\";\n request.onload = function(e){resp(e.target.response);};\n request.send();\n}\n\nK3D.save = function(buff, path)\n{\n var dataURI = \"data:application/octet-stream;base64,\" + btoa(K3D.parse._buffToStr(buff));\n window.location.href = dataURI;\n}\n\nK3D.clone = function(o)\n{\n return JSON.parse(JSON.stringify(o));\n}\n\n\n\nK3D.bin = {};\n\nK3D.bin.f = new Float32Array(1);\nK3D.bin.fb = new Uint8Array(K3D.bin.f.buffer);\n\nK3D.bin.rf\t\t= function(buff, off) { var f = K3D.bin.f, fb = K3D.bin.fb; for(var i=0; i<4; i++) fb[i] = buff[off+i]; return f[0]; }\nK3D.bin.rsl\t\t= function(buff, off) { return buff[off] | buff[off+1]<<8; }\nK3D.bin.ril\t\t= function(buff, off) { return buff[off] | buff[off+1]<<8 | buff[off+2]<<16 | buff[off+3]<<24; }\nK3D.bin.rASCII0 = function(buff, off) { var s = \"\"; while(buff[off]!=0) s += String.fromCharCode(buff[off++]); return s; }\n\n\nK3D.bin.wf\t\t= function(buff, off, v) { var f=new Float32Array(buff.buffer, off, 1); f[0]=v; }\nK3D.bin.wsl\t\t= function(buff, off, v) { buff[off]=v; buff[off+1]=v>>8; }\nK3D.bin.wil\t\t= function(buff, off, v) { buff[off]=v; buff[off+1]=v>>8; buff[off+2]=v>>16; buff[off+3]>>24; }\nK3D.parse = {};\n\nK3D.parse._buffToStr = function(buff)\n{\n var a = new Uint8Array(buff);\n var s = \"\";\n for(var i=0; imaxx) maxx = vx;\n if(vymaxy) maxy = vy;\n if(vzmaxz) maxz = vz;\n }\n return {min:{x:minx, y:miny, z:minz}, max:{x:maxx, y:maxy, z:maxz}};\n};\n\nexport {K3D};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/libs/k3d.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/libs/k3d.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3618, + "__docId__": 3626, "kind": "function", "name": "load", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72618,7 +72834,7 @@ "ignore": true }, { - "__docId__": 3619, + "__docId__": 3627, "kind": "function", "name": "save", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72651,7 +72867,7 @@ "ignore": true }, { - "__docId__": 3620, + "__docId__": 3628, "kind": "function", "name": "clone", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72682,7 +72898,7 @@ "ignore": true }, { - "__docId__": 3621, + "__docId__": 3629, "kind": "function", "name": "rf", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72719,7 +72935,7 @@ "ignore": true }, { - "__docId__": 3622, + "__docId__": 3630, "kind": "function", "name": "rsl", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72756,7 +72972,7 @@ "ignore": true }, { - "__docId__": 3623, + "__docId__": 3631, "kind": "function", "name": "ril", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72793,7 +73009,7 @@ "ignore": true }, { - "__docId__": 3624, + "__docId__": 3632, "kind": "function", "name": "rASCII0", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72830,7 +73046,7 @@ "ignore": true }, { - "__docId__": 3625, + "__docId__": 3633, "kind": "function", "name": "wf", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72869,7 +73085,7 @@ "ignore": true }, { - "__docId__": 3626, + "__docId__": 3634, "kind": "function", "name": "wsl", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72908,7 +73124,7 @@ "ignore": true }, { - "__docId__": 3627, + "__docId__": 3635, "kind": "function", "name": "wil", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72947,7 +73163,7 @@ "ignore": true }, { - "__docId__": 3628, + "__docId__": 3636, "kind": "function", "name": "_buffToStr", "memberof": "src/viewer/scene/libs/k3d.js", @@ -72978,7 +73194,7 @@ } }, { - "__docId__": 3629, + "__docId__": 3637, "kind": "function", "name": "_strToBuff", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73009,7 +73225,7 @@ } }, { - "__docId__": 3630, + "__docId__": 3638, "kind": "function", "name": "_readLine", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73046,7 +73262,7 @@ } }, { - "__docId__": 3631, + "__docId__": 3639, "kind": "function", "name": "fromJSON", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73077,7 +73293,7 @@ "ignore": true }, { - "__docId__": 3632, + "__docId__": 3640, "kind": "function", "name": "toJSON", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73108,7 +73324,7 @@ "ignore": true }, { - "__docId__": 3633, + "__docId__": 3641, "kind": "function", "name": "fromOBJ", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73139,7 +73355,7 @@ "ignore": true }, { - "__docId__": 3634, + "__docId__": 3642, "kind": "function", "name": "fromMD2", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73170,7 +73386,7 @@ "ignore": true }, { - "__docId__": 3635, + "__docId__": 3643, "kind": "function", "name": "fromCollada", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73201,7 +73417,7 @@ "ignore": true }, { - "__docId__": 3636, + "__docId__": 3644, "kind": "function", "name": "_asset", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73232,7 +73448,7 @@ } }, { - "__docId__": 3637, + "__docId__": 3645, "kind": "function", "name": "_libGeometries", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73263,7 +73479,7 @@ } }, { - "__docId__": 3638, + "__docId__": 3646, "kind": "function", "name": "_getMesh", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73294,7 +73510,7 @@ } }, { - "__docId__": 3639, + "__docId__": 3647, "kind": "function", "name": "_libImages", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73325,7 +73541,7 @@ } }, { - "__docId__": 3640, + "__docId__": 3648, "kind": "function", "name": "_libMaterials", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73356,7 +73572,7 @@ } }, { - "__docId__": 3641, + "__docId__": 3649, "kind": "function", "name": "_libEffects", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73387,7 +73603,7 @@ } }, { - "__docId__": 3642, + "__docId__": 3650, "kind": "function", "name": "from3DS", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73418,7 +73634,7 @@ "ignore": true }, { - "__docId__": 3643, + "__docId__": 3651, "kind": "function", "name": "_edit3ds", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73461,7 +73677,7 @@ } }, { - "__docId__": 3644, + "__docId__": 3652, "kind": "function", "name": "_keyf3ds", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73504,7 +73720,7 @@ } }, { - "__docId__": 3645, + "__docId__": 3653, "kind": "function", "name": "_keyf_objdes", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73547,7 +73763,7 @@ } }, { - "__docId__": 3646, + "__docId__": 3654, "kind": "function", "name": "_keyf_objhierarch", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73590,7 +73806,7 @@ } }, { - "__docId__": 3647, + "__docId__": 3655, "kind": "function", "name": "_edit_object", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73633,7 +73849,7 @@ } }, { - "__docId__": 3648, + "__docId__": 3656, "kind": "function", "name": "_obj_trimesh", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73676,7 +73892,7 @@ } }, { - "__docId__": 3649, + "__docId__": 3657, "kind": "function", "name": "_tri_vertexl", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73719,7 +73935,7 @@ } }, { - "__docId__": 3650, + "__docId__": 3658, "kind": "function", "name": "_tri_facel1", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73762,7 +73978,7 @@ } }, { - "__docId__": 3651, + "__docId__": 3659, "kind": "function", "name": "_tri_mappingcoors", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73805,7 +74021,7 @@ } }, { - "__docId__": 3652, + "__docId__": 3660, "kind": "function", "name": "_tri_local", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73848,7 +74064,7 @@ } }, { - "__docId__": 3653, + "__docId__": 3661, "kind": "function", "name": "fromBIV", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73879,7 +74095,7 @@ "ignore": true }, { - "__docId__": 3654, + "__docId__": 3662, "kind": "function", "name": "toBIV", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73910,7 +74126,7 @@ "ignore": true }, { - "__docId__": 3655, + "__docId__": 3663, "kind": "function", "name": "_readFloats", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73953,7 +74169,7 @@ } }, { - "__docId__": 3656, + "__docId__": 3664, "kind": "function", "name": "_writeFloats", "memberof": "src/viewer/scene/libs/k3d.js", @@ -73992,7 +74208,7 @@ "return": null }, { - "__docId__": 3657, + "__docId__": 3665, "kind": "function", "name": "_readInts", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74041,7 +74257,7 @@ } }, { - "__docId__": 3658, + "__docId__": 3666, "kind": "function", "name": "_writeInts", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74086,7 +74302,7 @@ "return": null }, { - "__docId__": 3659, + "__docId__": 3667, "kind": "function", "name": "Plane", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74135,7 +74351,7 @@ "ignore": true }, { - "__docId__": 3660, + "__docId__": 3668, "kind": "function", "name": "Cube", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74159,7 +74375,7 @@ "ignore": true }, { - "__docId__": 3661, + "__docId__": 3669, "kind": "function", "name": "Sphere", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74196,7 +74412,7 @@ "ignore": true }, { - "__docId__": 3662, + "__docId__": 3670, "kind": "function", "name": "scale", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74239,7 +74455,7 @@ "ignore": true }, { - "__docId__": 3663, + "__docId__": 3671, "kind": "function", "name": "translate", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74282,7 +74498,7 @@ "ignore": true }, { - "__docId__": 3664, + "__docId__": 3672, "kind": "function", "name": "rotateDeg", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74325,7 +74541,7 @@ "ignore": true }, { - "__docId__": 3665, + "__docId__": 3673, "kind": "function", "name": "rotate", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74368,7 +74584,7 @@ "ignore": true }, { - "__docId__": 3666, + "__docId__": 3674, "kind": "function", "name": "interpolate", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74413,7 +74629,7 @@ "ignore": true }, { - "__docId__": 3667, + "__docId__": 3675, "kind": "function", "name": "transform", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74446,7 +74662,7 @@ "ignore": true }, { - "__docId__": 3668, + "__docId__": 3676, "kind": "function", "name": "unwrap", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74489,7 +74705,7 @@ "ignore": true }, { - "__docId__": 3669, + "__docId__": 3677, "kind": "function", "name": "remap", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74538,7 +74754,7 @@ "ignore": true }, { - "__docId__": 3670, + "__docId__": 3678, "kind": "function", "name": "getAABB", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74569,7 +74785,7 @@ "ignore": true }, { - "__docId__": 3671, + "__docId__": 3679, "kind": "variable", "name": "K3D", "memberof": "src/viewer/scene/libs/k3d.js", @@ -74589,18 +74805,18 @@ } }, { - "__docId__": 3672, + "__docId__": 3680, "kind": "file", "name": "src/viewer/scene/lights/AmbientLight.js", "content": "import {math} from '../math/math.js';\nimport {Light} from './Light.js';\n\n/**\n * @desc An ambient light source of fixed color and intensity that illuminates all {@link Mesh}es equally.\n *\n * * {@link AmbientLight#color} multiplies by {@link PhongMaterial#ambient} at each position of each {@link ReadableGeometry} surface.\n * * {@link AmbientLight#color} multiplies by {@link LambertMaterial#color} uniformly across each triangle of each {@link ReadableGeometry} (ie. flat shaded).\n * * {@link AmbientLight}s, {@link DirLight}s and {@link PointLight}s are registered by their {@link Component#id} on {@link Scene#lights}.\n *\n * ## Usage\n *\n * In the example below we'll destroy the {@link Scene}'s default light sources then create an AmbientLight and a couple of {@link @DirLight}s:\n *\n * [[Run this example](/examples/index.html#lights_AmbientLight)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildTorusGeometry,\n * ReadableGeometry, PhongMaterial, Texture, AmbientLight} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * // Replace the Scene's default lights with a single custom AmbientLight\n *\n * viewer.scene.clearLights();\n *\n * new AmbientLight(viewer.scene, {\n * color: [0.0, 0.3, 0.7],\n * intensity: 1.0\n * });\n *\n * new DirLight(viewer.scene, {\n * id: \"keyLight\",\n * dir: [0.8, -0.6, -0.8],\n * color: [1.0, 0.3, 0.3],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n * new DirLight(viewer.scene, {\n * id: \"fillLight\",\n * dir: [-0.8, -0.4, -0.4],\n * color: [0.3, 1.0, 0.3],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n * new DirLight(viewer.scene, {\n * id: \"rimLight\",\n * dir: [0.2, -0.8, 0.8],\n * color: [0.6, 0.6, 0.6],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n * // Create a mesh with torus shape and PhongMaterial\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * ambient: [1.0, 1.0, 1.0],\n * shininess: 30,\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n *\n * // Adjust the color of our AmbientLight\n *\n * var ambientLight = viewer.scene.lights[\"myAmbientLight\"];\n * ambientLight.color = [1.0, 0.8, 0.8];\n *````\n */\nclass AmbientLight extends Light {\n\n /**\n @private\n */\n get type() {\n return \"AmbientLight\";\n }\n\n /**\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this AmbientLight as well.\n * @param {*} [cfg] AmbientLight configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.color=[0.7, 0.7, 0.8]] The color of this AmbientLight.\n * @param {Number} [cfg.intensity=[1.0]] The intensity of this AmbientLight, as a factor in range ````[0..1]````.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this._state = {\n type: \"ambient\",\n color: math.vec3([0.7, 0.7, 0.7]),\n intensity: 1.0\n };\n this.color = cfg.color;\n this.intensity = cfg.intensity;\n this.scene._lightCreated(this);\n }\n\n /**\n * Sets the RGB color of this AmbientLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @param {Number[]} color The AmbientLight's RGB color.\n */\n set color(color) {\n this._state.color.set(color || [0.7, 0.7, 0.8]);\n this.glRedraw();\n }\n\n /**\n * Gets the RGB color of this AmbientLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @returns {Number[]} The AmbientLight's RGB color.\n */\n get color() {\n return this._state.color;\n }\n\n /**\n * Sets the intensity of this AmbientLight.\n *\n * Default value is ````1.0```` for maximum intensity.\n *\n * @param {Number} intensity The AmbientLight's intensity.\n */\n set intensity(intensity) {\n this._state.intensity = intensity !== undefined ? intensity : 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the intensity of this AmbientLight.\n *\n * Default value is ````1.0```` for maximum intensity.\n *\n * @returns {Number} The AmbientLight's intensity.\n */\n get intensity() {\n return this._state.intensity;\n }\n\n /**\n * Destroys this AmbientLight.\n */\n destroy() {\n\n super.destroy();\n\n this.scene._lightDestroyed(this);\n }\n}\n\nexport {AmbientLight};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/AmbientLight.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/AmbientLight.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3673, + "__docId__": 3681, "kind": "class", "name": "AmbientLight", "memberof": "src/viewer/scene/lights/AmbientLight.js", @@ -74618,7 +74834,7 @@ ] }, { - "__docId__": 3674, + "__docId__": 3682, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74637,7 +74853,7 @@ } }, { - "__docId__": 3675, + "__docId__": 3683, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74712,7 +74928,7 @@ ] }, { - "__docId__": 3676, + "__docId__": 3684, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74730,7 +74946,7 @@ } }, { - "__docId__": 3679, + "__docId__": 3687, "kind": "set", "name": "color", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74755,7 +74971,7 @@ ] }, { - "__docId__": 3680, + "__docId__": 3688, "kind": "get", "name": "color", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74787,7 +75003,7 @@ } }, { - "__docId__": 3681, + "__docId__": 3689, "kind": "set", "name": "intensity", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74812,7 +75028,7 @@ ] }, { - "__docId__": 3682, + "__docId__": 3690, "kind": "get", "name": "intensity", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74844,7 +75060,7 @@ } }, { - "__docId__": 3683, + "__docId__": 3691, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/AmbientLight.js~AmbientLight", @@ -74859,18 +75075,18 @@ "return": null }, { - "__docId__": 3684, + "__docId__": 3692, "kind": "file", "name": "src/viewer/scene/lights/CubeTexture.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {Texture2D} from '../webgl/Texture2D.js';\nimport {stats} from '../stats.js';\nimport {ClampToEdgeWrapping, LinearEncoding, LinearFilter, LinearMipmapLinearFilter, sRGBEncoding} from \"../constants/constants.js\";\n\nfunction ensureImageSizePowerOfTwo(image) {\n if (!isPowerOfTwo(image.width) || !isPowerOfTwo(image.height)) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = nextHighestPowerOfTwo(image.width);\n canvas.height = nextHighestPowerOfTwo(image.height);\n const ctx = canvas.getContext(\"2d\");\n ctx.drawImage(image,\n 0, 0, image.width, image.height,\n 0, 0, canvas.width, canvas.height);\n image = canvas;\n }\n return image;\n}\n\nfunction isPowerOfTwo(x) {\n return (x & (x - 1)) === 0;\n}\n\nfunction nextHighestPowerOfTwo(x) {\n --x;\n for (let i = 1; i < 32; i <<= 1) {\n x = x | x >> i;\n }\n return x + 1;\n}\n\n/**\n * @desc A cube texture map.\n */\nclass CubeTexture extends Component {\n\n /**\n @private\n */\n get type() {\n return \"CubeTexture\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for this CubeTexture, unique among all components in the parent scene, generated automatically when omitted.\n * @param {String[]} [cfg.src=null] Paths to six image files to load into this CubeTexture.\n * @param {Boolean} [cfg.flipY=false] Flips this CubeTexture's source data along its vertical axis when true.\n * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n const gl = this.scene.canvas.gl;\n\n this._state = new RenderState({\n texture: new Texture2D({gl, target: gl.TEXTURE_CUBE_MAP}),\n flipY: this._checkFlipY(cfg.minFilter),\n encoding: this._checkEncoding(cfg.encoding),\n minFilter: LinearMipmapLinearFilter,\n magFilter: LinearFilter,\n wrapS: ClampToEdgeWrapping,\n wrapT: ClampToEdgeWrapping,\n mipmaps: true\n });\n\n this._src = cfg.src;\n this._images = [];\n\n this._loadSrc(cfg.src);\n\n stats.memory.textures++;\n }\n\n _checkFlipY(value) {\n return !!value;\n }\n\n _checkEncoding(value) {\n value = value || LinearEncoding;\n if (value !== LinearEncoding && value !== sRGBEncoding) {\n this.error(\"Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.\");\n value = LinearEncoding;\n }\n return value;\n }\n\n _webglContextRestored() {\n const gl = this.scene.canvas.gl;\n this._state.texture = null;\n // if (this._images.length > 0) {\n // this._state.texture = new xeokit.renderer.Texture2D(gl, gl.TEXTURE_CUBE_MAP);\n // this._state.texture.setImage(this._images, this._state);\n // this._state.texture.setProps(this._state);\n // } else\n if (this._src) {\n this._loadSrc(this._src);\n }\n }\n\n _loadSrc(src) {\n const self = this;\n const gl = this.scene.canvas.gl;\n this._images = [];\n let loadFailed = false;\n let numLoaded = 0;\n for (let i = 0; i < src.length; i++) {\n const image = new Image();\n image.onload = (function () {\n let _image = image;\n const index = i;\n return function () {\n if (loadFailed) {\n return;\n }\n _image = ensureImageSizePowerOfTwo(_image);\n self._images[index] = _image;\n numLoaded++;\n if (numLoaded === 6) {\n let texture = self._state.texture;\n if (!texture) {\n texture = new Texture2D({gl, target: gl.TEXTURE_CUBE_MAP});\n self._state.texture = texture;\n }\n texture.setImage(self._images, self._state);\n self.fire(\"loaded\", self._src, false);\n self.glRedraw();\n }\n };\n })();\n image.onerror = function () {\n loadFailed = true;\n };\n image.src = src[i];\n }\n }\n\n /**\n * Destroys this CubeTexture\n *\n */\n destroy() {\n super.destroy();\n if (this._state.texture) {\n this._state.texture.destroy();\n }\n stats.memory.textures--;\n this._state.destroy();\n }\n}\n\nexport {CubeTexture};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/CubeTexture.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/CubeTexture.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3685, + "__docId__": 3693, "kind": "function", "name": "ensureImageSizePowerOfTwo", "memberof": "src/viewer/scene/lights/CubeTexture.js", @@ -74901,7 +75117,7 @@ "ignore": true }, { - "__docId__": 3686, + "__docId__": 3694, "kind": "function", "name": "isPowerOfTwo", "memberof": "src/viewer/scene/lights/CubeTexture.js", @@ -74932,7 +75148,7 @@ "ignore": true }, { - "__docId__": 3687, + "__docId__": 3695, "kind": "function", "name": "nextHighestPowerOfTwo", "memberof": "src/viewer/scene/lights/CubeTexture.js", @@ -74963,7 +75179,7 @@ "ignore": true }, { - "__docId__": 3688, + "__docId__": 3696, "kind": "class", "name": "CubeTexture", "memberof": "src/viewer/scene/lights/CubeTexture.js", @@ -74981,7 +75197,7 @@ ] }, { - "__docId__": 3689, + "__docId__": 3697, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75000,7 +75216,7 @@ } }, { - "__docId__": 3690, + "__docId__": 3698, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75087,7 +75303,7 @@ ] }, { - "__docId__": 3691, + "__docId__": 3699, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75105,7 +75321,7 @@ } }, { - "__docId__": 3692, + "__docId__": 3700, "kind": "member", "name": "_src", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75123,7 +75339,7 @@ } }, { - "__docId__": 3693, + "__docId__": 3701, "kind": "member", "name": "_images", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75141,7 +75357,7 @@ } }, { - "__docId__": 3694, + "__docId__": 3702, "kind": "method", "name": "_checkFlipY", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75169,7 +75385,7 @@ } }, { - "__docId__": 3695, + "__docId__": 3703, "kind": "method", "name": "_checkEncoding", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75197,7 +75413,7 @@ } }, { - "__docId__": 3696, + "__docId__": 3704, "kind": "method", "name": "_webglContextRestored", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75214,7 +75430,7 @@ "return": null }, { - "__docId__": 3697, + "__docId__": 3705, "kind": "method", "name": "_loadSrc", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75238,7 +75454,7 @@ "return": null }, { - "__docId__": 3699, + "__docId__": 3707, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/CubeTexture.js~CubeTexture", @@ -75253,18 +75469,18 @@ "return": null }, { - "__docId__": 3700, + "__docId__": 3708, "kind": "file", "name": "src/viewer/scene/lights/DirLight.js", "content": "import {Light} from './Light.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {RenderBuffer} from '../webgl/RenderBuffer.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc A directional light source that illuminates all {@link Mesh}es equally from a given direction.\n *\n * * Has an emission direction vector in {@link DirLight#dir}, but no position.\n * * Defined in either *World* or *View* coordinate space. When in World-space, {@link DirLight#dir} is relative to the\n * World coordinate system, and will appear to move as the {@link Camera} moves. When in View-space, {@link DirLight#dir} is\n * relative to the View coordinate system, and will behave as if fixed to the viewer's head.\n * * {@link AmbientLight}s, {@link DirLight}s and {@link PointLight}s are registered by their {@link Component#id} on {@link Scene#lights}.\n *\n * ## Usage\n *\n * In the example below we'll replace the {@link Scene}'s default light sources with three View-space DirLights.\n *\n * [[Run this example](/examples/index.html#lights_DirLight_view)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry,\n * buildPlaneGeometry, ReadableGeometry,\n * PhongMaterial, Texture, DirLight} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * // Replace the Scene's default lights with three custom view-space DirLights\n *\n * viewer.scene.clearLights();\n *\n * new DirLight(viewer.scene, {\n * id: \"keyLight\",\n * dir: [0.8, -0.6, -0.8],\n * color: [1.0, 0.3, 0.3],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n * new DirLight(viewer.scene, {\n * id: \"fillLight\",\n * dir: [-0.8, -0.4, -0.4],\n * color: [0.3, 1.0, 0.3],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n * new DirLight(viewer.scene, {\n * id: \"rimLight\",\n * dir: [0.2, -0.8, 0.8],\n * color: [0.6, 0.6, 0.6],\n * intensity: 1.0,\n * space: \"view\"\n * });\n *\n *\n * // Create a sphere and ground plane\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.7, 0.7, 0.7],\n * specular: [1.0, 1.0, 1.0],\n * emissive: [0, 0, 0],\n * alpha: 1.0,\n * ambient: [1, 1, 0],\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n *\n * new Mesh(viewer.scene, {\n * geometry: buildPlaneGeometry(ReadableGeometry, viewer.scene, {\n * xSize: 30,\n * zSize: 30\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * }),\n * position: [0, -2.1, 0]\n * });\n * ````\n */\nclass DirLight extends Light {\n\n /**\n @private\n */\n get type() {\n return \"DirLight\";\n }\n\n /**\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this DirLight as well.\n * @param {*} [cfg] The DirLight configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.dir=[1.0, 1.0, 1.0]] A unit vector indicating the direction that the light is shining, given in either World or View space, depending on the value of the ````space```` parameter.\n * @param {Number[]} [cfg.color=[0.7, 0.7, 0.8 ]] The color of this DirLight.\n * @param {Number} [cfg.intensity=1.0] The intensity of this DirLight, as a factor in range ````[0..1]````.\n * @param {String} [cfg.space=\"view\"] The coordinate system the DirLight is defined in - ````\"view\"```` or ````\"space\"````.\n * @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this DirLight casts a castsShadow.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._shadowRenderBuf = null;\n this._shadowViewMatrix = null;\n this._shadowProjMatrix = null;\n this._shadowViewMatrixDirty = true;\n this._shadowProjMatrixDirty = true;\n\n const camera = this.scene.camera;\n const canvas = this.scene.canvas;\n\n this._onCameraViewMatrix = camera.on(\"viewMatrix\", () => {\n this._shadowViewMatrixDirty = true;\n });\n\n this._onCameraProjMatrix = camera.on(\"projMatrix\", () => {\n this._shadowProjMatrixDirty = true;\n });\n\n this._onCanvasBoundary = canvas.on(\"boundary\", () => {\n this._shadowProjMatrixDirty = true;\n });\n\n this._state = new RenderState({\n\n type: \"dir\",\n dir: math.vec3([1.0, 1.0, 1.0]),\n color: math.vec3([0.7, 0.7, 0.8]),\n intensity: 1.0,\n space: cfg.space || \"view\",\n castsShadow: false,\n\n getShadowViewMatrix: () => {\n if (this._shadowViewMatrixDirty) {\n if (!this._shadowViewMatrix) {\n this._shadowViewMatrix = math.identityMat4();\n }\n const camera = this.scene.camera;\n const dir = this._state.dir;\n const look = camera.look;\n const eye = [look[0] - dir[0], look[1] - dir[1], look[2] - dir[2]];\n const up = [0, 1, 0];\n math.lookAtMat4v(eye, look, up, this._shadowViewMatrix);\n this._shadowViewMatrixDirty = false;\n }\n return this._shadowViewMatrix;\n },\n\n getShadowProjMatrix: () => {\n if (this._shadowProjMatrixDirty) { // TODO: Set when canvas resizes\n if (!this._shadowProjMatrix) {\n this._shadowProjMatrix = math.identityMat4();\n }\n math.orthoMat4c(-40, 40, -40, 40, -40.0, 80, this._shadowProjMatrix); // left, right, bottom, top, near, far, dest\n this._shadowProjMatrixDirty = false;\n }\n return this._shadowProjMatrix;\n },\n\n getShadowRenderBuf: () => {\n if (!this._shadowRenderBuf) {\n this._shadowRenderBuf = new RenderBuffer(this.scene.canvas.canvas, this.scene.canvas.gl, {size: [1024, 1024]}); // Super old mobile devices have a limit of 1024x1024 textures\n }\n return this._shadowRenderBuf;\n }\n });\n\n this.dir = cfg.dir;\n this.color = cfg.color;\n this.intensity = cfg.intensity;\n this.castsShadow = cfg.castsShadow;\n\n this.scene._lightCreated(this);\n }\n\n /**\n * Sets the direction in which the DirLight is shining.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @param {Number[]} value The direction vector.\n */\n set dir(value) {\n this._state.dir.set(value || [1.0, 1.0, 1.0]);\n this._shadowViewMatrixDirty = true;\n this.glRedraw();\n }\n\n /**\n * Gets the direction in which the DirLight is shining.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @returns {Number[]} The direction vector.\n */\n get dir() {\n return this._state.dir;\n }\n\n /**\n * Sets the RGB color of this DirLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @param {Number[]} color The DirLight's RGB color.\n */\n set color(color) {\n this._state.color.set(color || [0.7, 0.7, 0.8]);\n this.glRedraw();\n }\n\n /**\n * Gets the RGB color of this DirLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @returns {Number[]} The DirLight's RGB color.\n */\n get color() {\n return this._state.color;\n }\n\n /**\n * Sets the intensity of this DirLight.\n *\n * Default intensity is ````1.0```` for maximum intensity.\n *\n * @param {Number} intensity The DirLight's intensity\n */\n set intensity(intensity) {\n intensity = intensity !== undefined ? intensity : 1.0;\n this._state.intensity = intensity;\n this.glRedraw();\n }\n\n /**\n * Gets the intensity of this DirLight.\n *\n * Default value is ````1.0```` for maximum intensity.\n *\n * @returns {Number} The DirLight's intensity.\n */\n get intensity() {\n return this._state.intensity;\n }\n\n /**\n * Sets if this DirLight casts a shadow.\n *\n * Default value is ````false````.\n *\n * @param {Boolean} castsShadow Set ````true```` to cast shadows.\n */\n set castsShadow(castsShadow) {\n castsShadow = !!castsShadow;\n if (this._state.castsShadow === castsShadow) {\n return;\n }\n this._state.castsShadow = castsShadow;\n this._shadowViewMatrixDirty = true;\n this.glRedraw();\n }\n\n /**\n * Gets if this DirLight casts a shadow.\n *\n * Default value is ````false````.\n *\n * @returns {Boolean} ````true```` if this DirLight casts shadows.\n */\n get castsShadow() {\n return this._state.castsShadow;\n }\n\n /**\n * Destroys this DirLight.\n */\n destroy() {\n\n const camera = this.scene.camera;\n const canvas = this.scene.canvas;\n camera.off(this._onCameraViewMatrix);\n camera.off(this._onCameraProjMatrix);\n canvas.off(this._onCanvasBoundary);\n\n super.destroy();\n this._state.destroy();\n if (this._shadowRenderBuf) {\n this._shadowRenderBuf.destroy();\n }\n this.scene._lightDestroyed(this);\n this.glRedraw();\n }\n}\n\nexport {DirLight};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/DirLight.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/DirLight.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3701, + "__docId__": 3709, "kind": "class", "name": "DirLight", "memberof": "src/viewer/scene/lights/DirLight.js", @@ -75282,7 +75498,7 @@ ] }, { - "__docId__": 3702, + "__docId__": 3710, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75301,7 +75517,7 @@ } }, { - "__docId__": 3703, + "__docId__": 3711, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75414,7 +75630,7 @@ ] }, { - "__docId__": 3704, + "__docId__": 3712, "kind": "member", "name": "_shadowRenderBuf", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75432,7 +75648,7 @@ } }, { - "__docId__": 3705, + "__docId__": 3713, "kind": "member", "name": "_shadowViewMatrix", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75450,7 +75666,7 @@ } }, { - "__docId__": 3706, + "__docId__": 3714, "kind": "member", "name": "_shadowProjMatrix", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75468,7 +75684,7 @@ } }, { - "__docId__": 3707, + "__docId__": 3715, "kind": "member", "name": "_shadowViewMatrixDirty", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75486,7 +75702,7 @@ } }, { - "__docId__": 3708, + "__docId__": 3716, "kind": "member", "name": "_shadowProjMatrixDirty", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75504,7 +75720,7 @@ } }, { - "__docId__": 3709, + "__docId__": 3717, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75522,7 +75738,7 @@ } }, { - "__docId__": 3711, + "__docId__": 3719, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75540,7 +75756,7 @@ } }, { - "__docId__": 3713, + "__docId__": 3721, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75558,7 +75774,7 @@ } }, { - "__docId__": 3715, + "__docId__": 3723, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75576,7 +75792,7 @@ } }, { - "__docId__": 3725, + "__docId__": 3733, "kind": "set", "name": "dir", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75601,7 +75817,7 @@ ] }, { - "__docId__": 3727, + "__docId__": 3735, "kind": "get", "name": "dir", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75633,7 +75849,7 @@ } }, { - "__docId__": 3728, + "__docId__": 3736, "kind": "set", "name": "color", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75658,7 +75874,7 @@ ] }, { - "__docId__": 3729, + "__docId__": 3737, "kind": "get", "name": "color", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75690,7 +75906,7 @@ } }, { - "__docId__": 3730, + "__docId__": 3738, "kind": "set", "name": "intensity", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75715,7 +75931,7 @@ ] }, { - "__docId__": 3731, + "__docId__": 3739, "kind": "get", "name": "intensity", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75747,7 +75963,7 @@ } }, { - "__docId__": 3732, + "__docId__": 3740, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75772,7 +75988,7 @@ ] }, { - "__docId__": 3734, + "__docId__": 3742, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75804,7 +76020,7 @@ } }, { - "__docId__": 3735, + "__docId__": 3743, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/DirLight.js~DirLight", @@ -75819,18 +76035,18 @@ "return": null }, { - "__docId__": 3736, + "__docId__": 3744, "kind": "file", "name": "src/viewer/scene/lights/Light.js", "content": "import {Component} from '../Component.js';\n\n/**\n * @desc A dynamic light source within a {@link Scene}.\n *\n * These are registered by {@link Light#id} in {@link Scene#lights}.\n */\nclass Light extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Light\";\n }\n\n /**\n * @private\n */\n get isLight() {\n return true;\n }\n\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n }\n}\n\nexport {Light};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/Light.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/Light.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3737, + "__docId__": 3745, "kind": "class", "name": "Light", "memberof": "src/viewer/scene/lights/Light.js", @@ -75848,7 +76064,7 @@ ] }, { - "__docId__": 3738, + "__docId__": 3746, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/Light.js~Light", @@ -75867,7 +76083,7 @@ } }, { - "__docId__": 3739, + "__docId__": 3747, "kind": "get", "name": "isLight", "memberof": "src/viewer/scene/lights/Light.js~Light", @@ -75886,7 +76102,7 @@ } }, { - "__docId__": 3740, + "__docId__": 3748, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/Light.js~Light", @@ -75900,18 +76116,18 @@ "undocument": true }, { - "__docId__": 3741, + "__docId__": 3749, "kind": "file", "name": "src/viewer/scene/lights/LightMap.js", "content": "import {CubeTexture} from './CubeTexture.js';\n\n/**\n * @desc A **LightMap** specifies a cube texture light map.\n *\n * ## Usage\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry,\n * ReadableGeometry, MetallicMaterial, LightMap} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new LightMap(viewer.scene, {\n * src: [\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PX.png\",\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NX.png\",\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PY.png\",\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NY.png\",\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PZ.png\",\n * \"textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NZ.png\"\n * ]\n * });\n *\n * // Create a sphere and ground plane\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 2.0\n * }),\n * new MetallicMaterial(viewer.scene, {\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0\n * })\n * });\n * ````\n */\nclass LightMap extends CubeTexture {\n\n /**\n @private\n */\n get type() {\n return \"LightMap\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for this LightMap, unique among all components in the parent scene, generated automatically when omitted.\n * @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this LightMap.\n * @param {String[]} [cfg.src=null] Paths to six image files to load into this LightMap.\n * @param {Boolean} [cfg.flipY=false] Flips this LightMap's source data along its vertical axis when true.\n * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.scene._lightMapCreated(this);\n }\n\n destroy() {\n super.destroy();\n this.scene._lightMapDestroyed(this);\n }\n}\n\nexport {LightMap};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/LightMap.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/LightMap.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3742, + "__docId__": 3750, "kind": "class", "name": "LightMap", "memberof": "src/viewer/scene/lights/LightMap.js", @@ -75929,7 +76145,7 @@ ] }, { - "__docId__": 3743, + "__docId__": 3751, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/LightMap.js~LightMap", @@ -75948,7 +76164,7 @@ } }, { - "__docId__": 3744, + "__docId__": 3752, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/LightMap.js~LightMap", @@ -76045,7 +76261,7 @@ ] }, { - "__docId__": 3745, + "__docId__": 3753, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/LightMap.js~LightMap", @@ -76061,18 +76277,18 @@ "return": null }, { - "__docId__": 3746, + "__docId__": 3754, "kind": "file", "name": "src/viewer/scene/lights/PointLight.js", "content": "import {Light} from './Light.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {RenderBuffer} from '../webgl/RenderBuffer.js';\nimport {math} from '../math/math.js';\n\n/**\n * A positional light source that originates from a single point and spreads outward in all directions, with optional attenuation over distance.\n *\n * * Has a position in {@link PointLight#pos}, but no direction.\n * * Defined in either *World* or *View* coordinate space. When in World-space, {@link PointLight#pos} is relative to\n * the World coordinate system, and will appear to move as the {@link Camera} moves. When in View-space,\n * {@link PointLight#pos} is relative to the View coordinate system, and will behave as if fixed to the viewer's head.\n * * Has {@link PointLight#constantAttenuation}, {@link PointLight#linearAttenuation} and {@link PointLight#quadraticAttenuation}\n * factors, which indicate how intensity attenuates over distance.\n * * {@link AmbientLight}s, {@link PointLight}s and {@link PointLight}s are registered by their {@link Component#id} on {@link Scene#lights}.\n *\n * ## Usage\n *\n * In the example below we'll replace the {@link Scene}'s default light sources with three World-space PointLights.\n *\n * [[Run this example](/examples/index.html#lights_PointLight_world)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry, buildPlaneGeometry,\n * ReadableGeometry, PhongMaterial, Texture, PointLight} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * // Replace the Scene's default lights with three custom world-space PointLights\n *\n * viewer.scene.clearLights();\n *\n * new PointLight(viewer.scene,{\n * id: \"keyLight\",\n * pos: [-80, 60, 80],\n * color: [1.0, 0.3, 0.3],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * new PointLight(viewer.scene,{\n * id: \"fillLight\",\n * pos: [80, 40, 40],\n * color: [0.3, 1.0, 0.3],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * new PointLight(viewer.scene,{\n * id: \"rimLight\",\n * pos: [-20, 80, -80],\n * color: [0.6, 0.6, 0.6],\n * intensity: 1.0,\n * space: \"world\"\n * });\n *\n * // Create a sphere and ground plane\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 1.3\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.7, 0.7, 0.7],\n * specular: [1.0, 1.0, 1.0],\n * emissive: [0, 0, 0],\n * alpha: 1.0,\n * ambient: [1, 1, 0],\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n *\n * new Mesh(viewer.scene, {\n * geometry: buildPlaneGeometry(ReadableGeometry, viewer.scene, {\n * xSize: 30,\n * zSize: 30\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * }),\n * position: [0, -2.1, 0]\n * });\n * ````\n */\nclass PointLight extends Light {\n\n /**\n @private\n */\n get type() {\n return \"PointLight\";\n }\n\n /**\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this PointLight as well.\n * @param {*} [cfg] The PointLight configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.pos=[ 1.0, 1.0, 1.0 ]] Position, in either World or View space, depending on the value of the **space** parameter.\n * @param {Number[]} [cfg.color=[0.7, 0.7, 0.8 ]] Color of this PointLight.\n * @param {Number} [cfg.intensity=1.0] Intensity of this PointLight, as a factor in range ````[0..1]````.\n * @param {Number} [cfg.constantAttenuation=0] Constant attenuation factor.\n * @param {Number} [cfg.linearAttenuation=0] Linear attenuation factor.\n * @param {Number} [cfg.quadraticAttenuation=0]Quadratic attenuation factor.\n * @param {String} [cfg.space=\"view\"]The coordinate system this PointLight is defined in - \"view\" or \"world\".\n * @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this PointLight casts a castsShadow.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n const self = this;\n\n this._shadowRenderBuf = null;\n this._shadowViewMatrix = null;\n this._shadowProjMatrix = null;\n this._shadowViewMatrixDirty = true;\n this._shadowProjMatrixDirty = true;\n\n const camera = this.scene.camera;\n const canvas = this.scene.canvas;\n\n this._onCameraViewMatrix = camera.on(\"viewMatrix\", () => {\n this._shadowViewMatrixDirty = true;\n });\n\n this._onCameraProjMatrix = camera.on(\"projMatrix\", () => {\n this._shadowProjMatrixDirty = true;\n });\n\n this._onCanvasBoundary = canvas.on(\"boundary\", () => {\n this._shadowProjMatrixDirty = true;\n });\n\n this._state = new RenderState({\n\n type: \"point\",\n pos: math.vec3([1.0, 1.0, 1.0]),\n color: math.vec3([0.7, 0.7, 0.8]),\n intensity: 1.0, attenuation: [0.0, 0.0, 0.0],\n space: cfg.space || \"view\",\n castsShadow: false,\n\n getShadowViewMatrix: () => {\n if (self._shadowViewMatrixDirty) {\n if (!self._shadowViewMatrix) {\n self._shadowViewMatrix = math.identityMat4();\n }\n const eye = self._state.pos;\n const look = camera.look;\n const up = camera.up;\n math.lookAtMat4v(eye, look, up, self._shadowViewMatrix);\n self._shadowViewMatrixDirty = false;\n }\n return self._shadowViewMatrix;\n },\n\n getShadowProjMatrix: () => {\n if (self._shadowProjMatrixDirty) { // TODO: Set when canvas resizes\n if (!self._shadowProjMatrix) {\n self._shadowProjMatrix = math.identityMat4();\n }\n const canvas = self.scene.canvas.canvas;\n math.perspectiveMat4(70 * (Math.PI / 180.0), canvas.clientWidth / canvas.clientHeight, 0.1, 500.0, self._shadowProjMatrix);\n self._shadowProjMatrixDirty = false;\n }\n return self._shadowProjMatrix;\n },\n\n getShadowRenderBuf: () => {\n if (!self._shadowRenderBuf) {\n self._shadowRenderBuf = new RenderBuffer(self.scene.canvas.canvas, self.scene.canvas.gl, {size: [1024, 1024]}); // Super old mobile devices have a limit of 1024x1024 textures\n }\n return self._shadowRenderBuf;\n }\n });\n\n this.pos = cfg.pos;\n this.color = cfg.color;\n this.intensity = cfg.intensity;\n this.constantAttenuation = cfg.constantAttenuation;\n this.linearAttenuation = cfg.linearAttenuation;\n this.quadraticAttenuation = cfg.quadraticAttenuation;\n this.castsShadow = cfg.castsShadow;\n\n this.scene._lightCreated(this);\n }\n\n /**\n * Sets the position of this PointLight.\n *\n * This will be either World- or View-space, depending on the value of {@link PointLight#space}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @param {Number[]} pos The position.\n */\n set pos(pos) {\n this._state.pos.set(pos || [1.0, 1.0, 1.0]);\n this._shadowViewMatrixDirty = true;\n this.glRedraw();\n }\n\n /**\n * Gets the position of this PointLight.\n *\n * This will be either World- or View-space, depending on the value of {@link PointLight#space}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @returns {Number[]} The position.\n */\n get pos() {\n return this._state.pos;\n }\n\n /**\n * Sets the RGB color of this PointLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @param {Number[]} color The PointLight's RGB color.\n */\n set color(color) {\n this._state.color.set(color || [0.7, 0.7, 0.8]);\n this.glRedraw();\n }\n\n /**\n * Gets the RGB color of this PointLight.\n *\n * Default value is ````[0.7, 0.7, 0.8]````.\n *\n * @returns {Number[]} The PointLight's RGB color.\n */\n get color() {\n return this._state.color;\n }\n\n /**\n * Sets the intensity of this PointLight.\n *\n * Default intensity is ````1.0```` for maximum intensity.\n *\n * @param {Number} intensity The PointLight's intensity\n */\n set intensity(intensity) {\n intensity = intensity !== undefined ? intensity : 1.0;\n this._state.intensity = intensity;\n this.glRedraw();\n }\n\n /**\n * Gets the intensity of this PointLight.\n *\n * Default value is ````1.0```` for maximum intensity.\n *\n * @returns {Number} The PointLight's intensity.\n */\n get intensity() {\n return this._state.intensity;\n }\n\n /**\n * Sets the constant attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The constant attenuation factor.\n */\n set constantAttenuation(value) {\n this._state.attenuation[0] = value || 0.0;\n this.glRedraw();\n }\n\n /**\n * Gets the constant attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The constant attenuation factor.\n */\n get constantAttenuation() {\n return this._state.attenuation[0];\n }\n\n /**\n * Sets the linear attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The linear attenuation factor.\n */\n set linearAttenuation(value) {\n this._state.attenuation[1] = value || 0.0;\n this.glRedraw();\n }\n\n /**\n * Gets the linear attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The linear attenuation factor.\n */\n get linearAttenuation() {\n return this._state.attenuation[1];\n }\n\n /**\n * Sets the quadratic attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The quadratic attenuation factor.\n */\n set quadraticAttenuation(value) {\n this._state.attenuation[2] = value || 0.0;\n this.glRedraw();\n }\n\n /**\n * Gets the quadratic attenuation factor for this PointLight.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The quadratic attenuation factor.\n */\n get quadraticAttenuation() {\n return this._state.attenuation[2];\n }\n\n /**\n * Sets if this PointLight casts a shadow.\n *\n * Default value is ````false````.\n *\n * @param {Boolean} castsShadow Set ````true```` to cast shadows.\n */\n set castsShadow(castsShadow) {\n castsShadow = !!castsShadow;\n if (this._state.castsShadow === castsShadow) {\n return;\n }\n this._state.castsShadow = castsShadow;\n this._shadowViewMatrixDirty = true;\n this.glRedraw();\n }\n\n /**\n * Gets if this PointLight casts a shadow.\n *\n * Default value is ````false````.\n *\n * @returns {Boolean} ````true```` if this PointLight casts shadows.\n */\n get castsShadow() {\n return this._state.castsShadow;\n }\n\n /**\n * Destroys this PointLight.\n */\n destroy() {\n\n const camera = this.scene.camera;\n const canvas = this.scene.canvas;\n camera.off(this._onCameraViewMatrix);\n camera.off(this._onCameraProjMatrix);\n canvas.off(this._onCanvasBoundary);\n\n super.destroy();\n\n this._state.destroy();\n if (this._shadowRenderBuf) {\n this._shadowRenderBuf.destroy();\n }\n this.scene._lightDestroyed(this);\n this.glRedraw();\n }\n}\n\nexport {PointLight};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/PointLight.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/PointLight.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3747, + "__docId__": 3755, "kind": "class", "name": "PointLight", "memberof": "src/viewer/scene/lights/PointLight.js", @@ -76090,7 +76306,7 @@ ] }, { - "__docId__": 3748, + "__docId__": 3756, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76109,7 +76325,7 @@ } }, { - "__docId__": 3749, + "__docId__": 3757, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76258,7 +76474,7 @@ ] }, { - "__docId__": 3750, + "__docId__": 3758, "kind": "member", "name": "_shadowRenderBuf", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76276,7 +76492,7 @@ } }, { - "__docId__": 3751, + "__docId__": 3759, "kind": "member", "name": "_shadowViewMatrix", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76294,7 +76510,7 @@ } }, { - "__docId__": 3752, + "__docId__": 3760, "kind": "member", "name": "_shadowProjMatrix", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76312,7 +76528,7 @@ } }, { - "__docId__": 3753, + "__docId__": 3761, "kind": "member", "name": "_shadowViewMatrixDirty", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76330,7 +76546,7 @@ } }, { - "__docId__": 3754, + "__docId__": 3762, "kind": "member", "name": "_shadowProjMatrixDirty", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76348,7 +76564,7 @@ } }, { - "__docId__": 3755, + "__docId__": 3763, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76366,7 +76582,7 @@ } }, { - "__docId__": 3757, + "__docId__": 3765, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76384,7 +76600,7 @@ } }, { - "__docId__": 3759, + "__docId__": 3767, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76402,7 +76618,7 @@ } }, { - "__docId__": 3761, + "__docId__": 3769, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76420,7 +76636,7 @@ } }, { - "__docId__": 3769, + "__docId__": 3777, "kind": "set", "name": "pos", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76445,7 +76661,7 @@ ] }, { - "__docId__": 3771, + "__docId__": 3779, "kind": "get", "name": "pos", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76477,7 +76693,7 @@ } }, { - "__docId__": 3772, + "__docId__": 3780, "kind": "set", "name": "color", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76502,7 +76718,7 @@ ] }, { - "__docId__": 3773, + "__docId__": 3781, "kind": "get", "name": "color", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76534,7 +76750,7 @@ } }, { - "__docId__": 3774, + "__docId__": 3782, "kind": "set", "name": "intensity", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76559,7 +76775,7 @@ ] }, { - "__docId__": 3775, + "__docId__": 3783, "kind": "get", "name": "intensity", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76591,7 +76807,7 @@ } }, { - "__docId__": 3776, + "__docId__": 3784, "kind": "set", "name": "constantAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76616,7 +76832,7 @@ ] }, { - "__docId__": 3777, + "__docId__": 3785, "kind": "get", "name": "constantAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76648,7 +76864,7 @@ } }, { - "__docId__": 3778, + "__docId__": 3786, "kind": "set", "name": "linearAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76673,7 +76889,7 @@ ] }, { - "__docId__": 3779, + "__docId__": 3787, "kind": "get", "name": "linearAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76705,7 +76921,7 @@ } }, { - "__docId__": 3780, + "__docId__": 3788, "kind": "set", "name": "quadraticAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76730,7 +76946,7 @@ ] }, { - "__docId__": 3781, + "__docId__": 3789, "kind": "get", "name": "quadraticAttenuation", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76762,7 +76978,7 @@ } }, { - "__docId__": 3782, + "__docId__": 3790, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76787,7 +77003,7 @@ ] }, { - "__docId__": 3784, + "__docId__": 3792, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76819,7 +77035,7 @@ } }, { - "__docId__": 3785, + "__docId__": 3793, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/PointLight.js~PointLight", @@ -76834,18 +77050,18 @@ "return": null }, { - "__docId__": 3786, + "__docId__": 3794, "kind": "file", "name": "src/viewer/scene/lights/ReflectionMap.js", "content": "import {CubeTexture} from './CubeTexture.js';\n\n/**\n * @desc A reflection cube map.\n *\n * ## Usage\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry,\n * ReadableGeometry, MetallicMaterial, ReflectionMap} from \"xeokit-sdk.es.js\";\n *\n * // Create a Viewer and arrange the camera\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new ReflectionMap(viewer.scene, {\n * src: [\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PX.png\",\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NX.png\",\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PY.png\",\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NY.png\",\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PZ.png\",\n * \"textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NZ.png\"\n * ]\n * });\n *\n * // Create a sphere and ground plane\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 2.0\n * }),\n * new MetallicMaterial(viewer.scene, {\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0\n * })\n * });\n * ````\n */\nclass ReflectionMap extends CubeTexture {\n\n /**\n @private\n */\n get type() {\n return \"ReflectionMap\";\n }\n\n /**\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for this ReflectionMap, unique among all components in the parent scene, generated automatically when omitted.\n * @param {String[]} [cfg.src=null] Paths to six image files to load into this ReflectionMap.\n * @param {Boolean} [cfg.flipY=false] Flips this ReflectionMap's source data along its vertical axis when true.\n * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.scene._lightsState.addReflectionMap(this._state);\n this.scene._reflectionMapCreated(this);\n }\n\n /**\n * Destroys this ReflectionMap.\n */\n destroy() {\n super.destroy();\n this.scene._reflectionMapDestroyed(this);\n }\n}\n\nexport {ReflectionMap};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/ReflectionMap.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/ReflectionMap.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3787, + "__docId__": 3795, "kind": "class", "name": "ReflectionMap", "memberof": "src/viewer/scene/lights/ReflectionMap.js", @@ -76863,7 +77079,7 @@ ] }, { - "__docId__": 3788, + "__docId__": 3796, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/ReflectionMap.js~ReflectionMap", @@ -76882,7 +77098,7 @@ } }, { - "__docId__": 3789, + "__docId__": 3797, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/ReflectionMap.js~ReflectionMap", @@ -76963,7 +77179,7 @@ ] }, { - "__docId__": 3790, + "__docId__": 3798, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/ReflectionMap.js~ReflectionMap", @@ -76978,18 +77194,18 @@ "return": null }, { - "__docId__": 3791, + "__docId__": 3799, "kind": "file", "name": "src/viewer/scene/lights/Shadow.js", "content": "/**\n A **Shadow** defines a shadow cast by a {@link DirLight} or a {@link SpotLight}.\n\n Work in progress!\n\n ## Overview\n\n * Shadows are attached to {@link DirLight} and {@link SpotLight} components.\n\n TODO\n\n ## Examples\n\n TODO\n\n ## Usage\n\n ```` javascript\n var mesh = new xeokit.Mesh(scene, {\n\n lights: new xeokit.Lights({\n lights: [\n\n new xeokit.SpotLight({\n pos: [0, 100, 100],\n dir: [0, -1, 0],\n color: [0.5, 0.7, 0.5],\n intensity: 1\n constantAttenuation: 0,\n linearAttenuation: 0,\n quadraticAttenuation: 0,\n space: \"view\",\n\n shadow: new xeokit.Shadow({\n resolution: [1000, 1000],\n intensity: 0.7,\n sampling: \"stratified\" // \"stratified\" | \"poisson\" | \"basic\"\n });\n })\n ]\n }),\n ,\n material: new xeokit.PhongMaterial({\n diffuse: [0.5, 0.5, 0.0]\n }),\n\n geometry: new xeokit.BoxGeometry()\n });\n ````\n\n @class Shadow\n @module xeokit\n @submodule lighting\n @constructor\n @private\n @extends Component\n @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n @param {*} [cfg] The Shadow configuration\n @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this Shadow.\n @param [cfg.resolution=[1000,1000]] {Uint16Array} Resolution of the texture map for this Shadow.\n @param [cfg.intensity=1.0] {Number} Intensity of this Shadow.\n */\nimport {Component} from '../Component.js';\nimport {math} from '../math/math.js';\n\nclass Shadow extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Shadow\";\n }\n\n constructor(owner, cfg={}) {\n\n super(owner, cfg);\n\n this._state = {\n resolution: math.vec3([1000, 1000]),\n intensity: 1.0\n };\n\n this.resolution = cfg.resolution;\n this.intensity = cfg.intensity;\n }\n\n /**\n The resolution of the texture map for this Shadow.\n\n This will be either World- or View-space, depending on the value of {@link Shadow/space}.\n\n Fires a {@link Shadow/resolution:event} event on change.\n\n @property resolution\n @default [1000, 1000]\n @type Uint16Array\n */\n set resolution(value) {\n\n this._state.resolution.set(value || [1000.0, 1000.0]);\n\n this.glRedraw();\n }\n\n get resolution() {\n return this._state.resolution;\n }\n\n /**\n The intensity of this Shadow.\n\n Fires a {@link Shadow/intensity:event} event on change.\n\n @property intensity\n @default 1.0\n @type {Number}\n */\n set intensity(value) {\n\n value = value !== undefined ? value : 1.0;\n\n this._state.intensity = value;\n\n this.glRedraw();\n }\n\n get intensity() {\n return this._state.intensity;\n }\n\n destroy() {\n super.destroy();\n //this._state.destroy();\n }\n}\n\nexport {Shadow};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/Shadow.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/Shadow.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3792, + "__docId__": 3800, "kind": "class", "name": "Shadow", "memberof": "src/viewer/scene/lights/Shadow.js", @@ -77008,7 +77224,7 @@ ] }, { - "__docId__": 3793, + "__docId__": 3801, "kind": "get", "name": "type", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77027,7 +77243,7 @@ } }, { - "__docId__": 3794, + "__docId__": 3802, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77041,7 +77257,7 @@ "undocument": true }, { - "__docId__": 3795, + "__docId__": 3803, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77059,7 +77275,7 @@ } }, { - "__docId__": 3798, + "__docId__": 3806, "kind": "set", "name": "resolution", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77098,7 +77314,7 @@ } }, { - "__docId__": 3799, + "__docId__": 3807, "kind": "get", "name": "resolution", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77117,7 +77333,7 @@ } }, { - "__docId__": 3800, + "__docId__": 3808, "kind": "set", "name": "intensity", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77156,7 +77372,7 @@ } }, { - "__docId__": 3801, + "__docId__": 3809, "kind": "get", "name": "intensity", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77175,7 +77391,7 @@ } }, { - "__docId__": 3802, + "__docId__": 3810, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/lights/Shadow.js~Shadow", @@ -77191,29 +77407,29 @@ "return": null }, { - "__docId__": 3803, + "__docId__": 3811, "kind": "file", "name": "src/viewer/scene/lights/index.js", "content": "export * from \"./AmbientLight.js\";\nexport * from \"./DirLight.js\";\nexport * from \"./PointLight.js\";\nexport * from \"./ReflectionMap.js\";\nexport * from \"./LightMap.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/lights/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/lights/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3804, + "__docId__": 3812, "kind": "file", "name": "src/viewer/scene/marker/Marker.js", - "content": "import {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {worldToRTCPos} from \"../math/rtcCoords.js\";\nimport {SceneModelEntity} from \"../model/SceneModelEntity.js\";\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\n\n\n/**\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker({\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n */\nclass Marker extends Component {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n */\n constructor(owner, cfg) {\n\n super(owner, cfg);\n\n this._entity = null;\n this._visible = null;\n this._worldPos = math.vec3();\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n this._viewPos = math.vec3();\n this._canvasPos = math.vec2();\n this._occludable = false;\n\n this._onCameraViewMatrix = this.scene.camera.on(\"matrix\", () => {\n this._viewPosDirty = true;\n this._needUpdate();\n });\n\n this._onCameraProjMatrix = this.scene.camera.on(\"projMatrix\", () => {\n this._canvasPosDirty = true;\n this._needUpdate();\n });\n\n this._onEntityDestroyed = null;\n this._onEntityModelDestroyed = null;\n\n this._renderer.addMarker(this);\n\n this.entity = cfg.entity;\n this.worldPos = cfg.worldPos;\n this.occludable = cfg.occludable;\n }\n\n _update() { // this._needUpdate() schedules this for next tick\n if (this._viewPosDirty) {\n math.transformPoint3(this.scene.camera.viewMatrix, this._worldPos, this._viewPos);\n this._viewPosDirty = false;\n this._canvasPosDirty = true;\n this.fire(\"viewPos\", this._viewPos);\n }\n if (this._canvasPosDirty) {\n tempVec4a.set(this._viewPos);\n tempVec4a[3] = 1.0;\n math.transformPoint4(this.scene.camera.projMatrix, tempVec4a, tempVec4b);\n const aabb = this.scene.canvas.boundary;\n this._canvasPos[0] = Math.floor((1 + tempVec4b[0] / tempVec4b[3]) * aabb[2] / 2);\n this._canvasPos[1] = Math.floor((1 - tempVec4b[1] / tempVec4b[3]) * aabb[3] / 2);\n this._canvasPosDirty = false;\n this.fire(\"canvasPos\", this._canvasPos);\n }\n }\n\n _setVisible(visible) { // Called by VisibilityTester and this._entity.on(\"destroyed\"..)\n if (this._visible === visible) {\n // return;\n }\n this._visible = visible;\n this.fire(\"visible\", this._visible);\n }\n\n /**\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n */\n set entity(entity) {\n if (this._entity) {\n if (this._entity === entity) {\n return;\n }\n if (this._onEntityDestroyed !== null) {\n this._entity.off(this._onEntityDestroyed);\n this._onEntityDestroyed = null;\n }\n if (this._onEntityModelDestroyed !== null) {\n this._entity.model.off(this._onEntityModelDestroyed);\n this._onEntityModelDestroyed = null;\n }\n }\n this._entity = entity;\n if (this._entity) {\n if (this._entity instanceof SceneModelEntity) {\n this._onEntityModelDestroyed = this._entity.model.on(\"destroyed\", () => { // SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel\n this._entity = null; // Marker now may become visible, if it was synched to invisible Entity\n this._onEntityModelDestroyed = null;\n });\n } else {\n this._onEntityDestroyed = this._entity.on(\"destroyed\", () => {\n this._entity = null;\n this._onEntityDestroyed = null;\n });\n }\n }\n this.fire(\"entity\", this._entity, true /* forget */);\n }\n\n /**\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n */\n get entity() {\n return this._entity;\n }\n\n /**\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n */\n set occludable(occludable) {\n occludable = !!occludable;\n if (occludable === this._occludable) {\n return;\n }\n this._occludable = occludable;\n }\n\n /**\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n */\n get occludable() {\n return this._occludable;\n }\n\n /**\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n */\n set worldPos(worldPos) {\n this._worldPos.set(worldPos || [0, 0, 0]);\n worldToRTCPos(this._worldPos, this._origin, this._rtcPos);\n if (this._occludable) {\n this._renderer.markerWorldPosUpdated(this);\n }\n this._viewPosDirty = true;\n this.fire(\"worldPos\", this._worldPos);\n this._needUpdate();\n }\n\n /**\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n */\n get worldPos() {\n return this._worldPos;\n }\n\n /**\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n */\n get origin() {\n return this._origin;\n }\n\n /**\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n */\n get rtcPos() {\n return this._rtcPos;\n }\n\n /**\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n */\n get viewPos() {\n this._update();\n return this._viewPos;\n }\n\n /**\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n */\n get canvasPos() {\n this._update();\n return this._canvasPos;\n }\n\n /**\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n */\n get visible() {\n return !!this._visible;\n }\n\n /**\n * Destroys this Marker.\n */\n destroy() {\n this.fire(\"destroyed\", true);\n this.scene.camera.off(this._onCameraViewMatrix);\n this.scene.camera.off(this._onCameraProjMatrix);\n if (this._entity) {\n if (this._onEntityDestroyed !== null) {\n this._entity.off(this._onEntityDestroyed);\n }\n if (this._onEntityModelDestroyed !== null) {\n this._entity.model.off(this._onEntityModelDestroyed);\n }\n }\n this._renderer.removeMarker(this);\n super.destroy();\n }\n}\n\nexport {Marker};\n", + "content": "import {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {worldToRTCPos} from \"../math/rtcCoords.js\";\nimport {SceneModelEntity} from \"../model/SceneModelEntity.js\";\n\nconst tempVec4a = math.vec4();\nconst tempVec4b = math.vec4();\n\n\n/**\n * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n *\n * ## Position\n *\n * A Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n *\n * * {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n * * {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n * * {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n *\n * ## Visibility\n *\n * {@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n *\n * This property will be ````false```` when:\n *\n * * {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n * * {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n * * {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n *\n * ## Usage\n *\n * In the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n *\n * We'll configure our Marker to\n * become invisible whenever it's occluded by any Entities in the canvas.\n *\n * We'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\n * Canvas coordinate systems), and how to subscribe to change events on those properties.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Create the torus Mesh\n * // Recall that a Mesh is an Entity\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0,0,0],\n * radius: 1.0,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * backfaces: true\n * })\n * });\n *\n * // Create the Marker, associated with our Mesh Entity\n * const myMarker = new Marker(viewer, {\n * entity: entity,\n * worldPos: [10,0,0],\n * occludable: true\n * });\n *\n * // Get the Marker's current World, View and Canvas coordinates\n * const worldPos = myMarker.worldPos; // 3D World-space position\n * const viewPos = myMarker.viewPos; // 3D View-space position\n * const canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n *\n * const visible = myMarker.visible;\n *\n * // Listen for change of the Marker's 3D World-space position\n * myMarker.on(\"worldPos\", function(worldPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 3D View-space position, which happens\n * // when either worldPos was updated or the Camera was moved\n * myMarker.on(\"viewPos\", function(viewPos) {\n * //...\n * });\n *\n * // Listen for change of the Marker's 2D Canvas-space position, which happens\n * // when worldPos or viewPos was updated, or Camera's projection was updated\n * myMarker.on(\"canvasPos\", function(canvasPos) {\n * //...\n * });\n *\n * // Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n * // has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\n * myMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n * if (visible) {\n * this.log(\"Marker is visible\");\n * } else {\n * this.log(\"Marker is invisible\");\n * }\n * });\n *\n * // Listen for destruction of Marker\n * myMarker.on(\"destroyed\", () => {\n * //...\n * });\n * ````\n */\nclass Marker extends Component {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.\n * @param {*} [cfg] Marker configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n */\n constructor(owner, cfg) {\n\n super(owner, cfg);\n\n this._entity = null;\n this._visible = null;\n this._worldPos = math.vec3();\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n this._viewPos = math.vec3();\n this._canvasPos = math.vec2();\n this._occludable = false;\n\n this._onCameraViewMatrix = this.scene.camera.on(\"matrix\", () => {\n this._viewPosDirty = true;\n this._needUpdate();\n });\n\n this._onCameraProjMatrix = this.scene.camera.on(\"projMatrix\", () => {\n this._canvasPosDirty = true;\n this._needUpdate();\n });\n\n this._onEntityDestroyed = null;\n this._onEntityModelDestroyed = null;\n\n this._renderer.addMarker(this);\n\n this.entity = cfg.entity;\n this.worldPos = cfg.worldPos;\n this.occludable = cfg.occludable;\n }\n\n _update() { // this._needUpdate() schedules this for next tick\n if (this._viewPosDirty) {\n math.transformPoint3(this.scene.camera.viewMatrix, this._worldPos, this._viewPos);\n this._viewPosDirty = false;\n this._canvasPosDirty = true;\n this.fire(\"viewPos\", this._viewPos);\n }\n if (this._canvasPosDirty) {\n tempVec4a.set(this._viewPos);\n tempVec4a[3] = 1.0;\n math.transformPoint4(this.scene.camera.projMatrix, tempVec4a, tempVec4b);\n const aabb = this.scene.canvas.boundary;\n this._canvasPos[0] = Math.floor((1 + tempVec4b[0] / tempVec4b[3]) * aabb[2] / 2);\n this._canvasPos[1] = Math.floor((1 - tempVec4b[1] / tempVec4b[3]) * aabb[3] / 2);\n this._canvasPosDirty = false;\n this.fire(\"canvasPos\", this._canvasPos);\n }\n }\n\n _setVisible(visible) { // Called by VisibilityTester and this._entity.on(\"destroyed\"..)\n if (this._visible === visible) {\n // return;\n }\n this._visible = visible;\n this.fire(\"visible\", this._visible);\n }\n\n /**\n * Sets the {@link Entity} this Marker is associated with.\n *\n * An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````\n * if {@link Entity#visible} is false.\n *\n * @type {Entity}\n */\n set entity(entity) {\n if (this._entity) {\n if (this._entity === entity) {\n return;\n }\n if (this._onEntityDestroyed !== null) {\n this._entity.off(this._onEntityDestroyed);\n this._onEntityDestroyed = null;\n }\n if (this._onEntityModelDestroyed !== null) {\n this._entity.model.off(this._onEntityModelDestroyed);\n this._onEntityModelDestroyed = null;\n }\n }\n this._entity = entity;\n if (this._entity) {\n if (this._entity instanceof SceneModelEntity) {\n this._onEntityModelDestroyed = this._entity.model.on(\"destroyed\", () => { // SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel\n this._entity = null; // Marker now may become visible, if it was synched to invisible Entity\n this._onEntityModelDestroyed = null;\n });\n } else {\n this._onEntityDestroyed = this._entity.on(\"destroyed\", () => {\n this._entity = null;\n this._onEntityDestroyed = null;\n });\n }\n }\n this.fire(\"entity\", this._entity, true /* forget */);\n }\n\n /**\n * Gets the {@link Entity} this Marker is associated with.\n *\n * @type {Entity}\n */\n get entity() {\n return this._entity;\n }\n\n /**\n * Sets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * The {@link Scene} periodically occlusion-tests all Markers on every 20th \"tick\" (which represents a rendered frame). We\n * can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.\n *\n * @type {Boolean}\n */\n set occludable(occludable) {\n occludable = !!occludable;\n if (occludable === this._occludable) {\n return;\n }\n this._occludable = occludable;\n }\n\n /**\n * Gets whether occlusion testing is performed for this Marker.\n *\n * When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.\n *\n * @type {Boolean}\n */\n get occludable() {\n return this._occludable;\n }\n\n /**\n * Sets the World-space 3D position of this Marker.\n *\n * Fires a \"worldPos\" event with new World position.\n *\n * @type {Number[]}\n */\n set worldPos(worldPos) {\n this._worldPos.set(worldPos || [0, 0, 0]);\n worldToRTCPos(this._worldPos, this._origin, this._rtcPos);\n if (this._occludable) {\n this._renderer.markerWorldPosUpdated(this);\n }\n this._viewPosDirty = true;\n this.fire(\"worldPos\", this._worldPos);\n this._needUpdate();\n }\n\n /**\n * Gets the World-space 3D position of this Marker.\n *\n * @type {Number[]}\n */\n get worldPos() {\n return this._worldPos;\n }\n\n /**\n * Gets the RTC center of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n */\n get origin() {\n return this._origin;\n }\n\n /**\n * Gets the RTC position of this Marker.\n *\n * This is automatically calculated from {@link Marker#worldPos}.\n *\n * @type {Number[]}\n */\n get rtcPos() {\n return this._rtcPos;\n }\n\n /**\n * View-space 3D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.\n *\n * The Marker fires a \"viewPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n */\n get viewPos() {\n this._update();\n return this._viewPos;\n }\n\n /**\n * Canvas-space 2D coordinates of this Marker.\n *\n * This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.\n *\n * The Marker fires a \"canvasPos\" event whenever this property changes.\n *\n * @type {Number[]}\n * @final\n */\n get canvasPos() {\n this._update();\n return this._canvasPos;\n }\n\n /**\n * Indicates if this Marker is currently visible.\n *\n * This is read-only and is automatically calculated.\n *\n * The Marker is **invisible** whenever:\n *\n * * {@link Marker#canvasPos} is currently outside the canvas,\n * * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or\n * * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.\n *\n * The Marker fires a \"visible\" event whenever this property changes.\n *\n * @type {Boolean}\n * @final\n */\n get visible() {\n return !!this._visible;\n }\n\n /**\n * Destroys this Marker.\n */\n destroy() {\n this.fire(\"destroyed\", true);\n this.scene.camera.off(this._onCameraViewMatrix);\n this.scene.camera.off(this._onCameraProjMatrix);\n if (this._entity) {\n if (this._onEntityDestroyed !== null) {\n this._entity.off(this._onEntityDestroyed);\n }\n if (this._onEntityModelDestroyed !== null) {\n this._entity.model.off(this._onEntityModelDestroyed);\n }\n }\n this._renderer.removeMarker(this);\n super.destroy();\n }\n}\n\nexport {Marker};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/marker/Marker.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/marker/Marker.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3805, + "__docId__": 3813, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/marker/Marker.js", @@ -77234,7 +77450,7 @@ "ignore": true }, { - "__docId__": 3806, + "__docId__": 3814, "kind": "variable", "name": "tempVec4b", "memberof": "src/viewer/scene/marker/Marker.js", @@ -77255,7 +77471,7 @@ "ignore": true }, { - "__docId__": 3807, + "__docId__": 3815, "kind": "class", "name": "Marker", "memberof": "src/viewer/scene/marker/Marker.js", @@ -77265,7 +77481,7 @@ "export": true, "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/marker/Marker.js", "importStyle": "{Marker}", - "description": "Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n\n## Position\n\nA Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n\n* {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n* {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n* {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n\n## Visibility\n\n{@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n\nThis property will be ````false```` when:\n\n* {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n* {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n* {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n\n## Usage\n\nIn the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n\nWe'll configure our Marker to\nbecome invisible whenever it's occluded by any Entities in the canvas.\n\nWe'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\nCanvas coordinate systems), and how to subscribe to change events on those properties.\n\n````javascript\nimport {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\n// Create the torus Mesh\n// Recall that a Mesh is an Entity\nnew Mesh(viewer.scene, {\n geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n center: [0,0,0],\n radius: 1.0,\n tube: 0.5,\n radialSegments: 32,\n tubeSegments: 24,\n arc: Math.PI * 2.0\n }),\n material: new PhongMaterial(viewer.scene, {\n diffuseMap: new Texture(viewer.scene, {\n src: \"textures/diffuse/uvGrid2.jpg\"\n }),\n backfaces: true\n })\n});\n\n// Create the Marker, associated with our Mesh Entity\nconst myMarker = new Marker({\n entity: entity,\n worldPos: [10,0,0],\n occludable: true\n});\n\n// Get the Marker's current World, View and Canvas coordinates\nconst worldPos = myMarker.worldPos; // 3D World-space position\nconst viewPos = myMarker.viewPos; // 3D View-space position\nconst canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n\nconst visible = myMarker.visible;\n\n// Listen for change of the Marker's 3D World-space position\nmyMarker.on(\"worldPos\", function(worldPos) {\n //...\n});\n\n// Listen for change of the Marker's 3D View-space position, which happens\n// when either worldPos was updated or the Camera was moved\nmyMarker.on(\"viewPos\", function(viewPos) {\n //...\n});\n\n// Listen for change of the Marker's 2D Canvas-space position, which happens\n// when worldPos or viewPos was updated, or Camera's projection was updated\nmyMarker.on(\"canvasPos\", function(canvasPos) {\n //...\n});\n\n// Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n// has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\nmyMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n if (visible) {\n this.log(\"Marker is visible\");\n } else {\n this.log(\"Marker is invisible\");\n }\n});\n\n// Listen for destruction of Marker\nmyMarker.on(\"destroyed\", () => {\n //...\n});\n````", + "description": "Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.\n\n## Position\n\nA Marker holds its position in the World, View and Canvas coordinate systems in three properties:\n\n* {@link Marker#worldPos} holds the Marker's 3D World-space coordinates. This property can be dynamically updated. The Marker will fire a \"worldPos\" event whenever this property changes.\n* {@link Marker#viewPos} holds the Marker's 3D View-space coordinates. This property is read-only, and is automatically updated from {@link Marker#worldPos} and the current {@link Camera} position. The Marker will fire a \"viewPos\" event whenever this property changes.\n* {@link Marker#canvasPos} holds the Marker's 2D Canvas-space coordinates. This property is read-only, and is automatically updated from {@link Marker#canvasPos} and the current {@link Camera} position and projection. The Marker will fire a \"canvasPos\" event whenever this property changes.\n\n## Visibility\n\n{@link Marker#visible} indicates if the Marker is currently visible. The Marker will fire a \"visible\" event whenever {@link Marker#visible} changes.\n\nThis property will be ````false```` when:\n\n* {@link Marker#entity} is set to an {@link Entity}, and {@link Entity#visible} is ````false````,\n* {@link Marker#occludable} is ````true```` and the Marker is occluded by some {@link Entity} in the 3D view, or\n* {@link Marker#canvasPos} is outside the boundary of the {@link Canvas}.\n\n## Usage\n\nIn the example below, we'll create a Marker that's associated with a {@link Mesh} (which a type of {@link Entity}).\n\nWe'll configure our Marker to\nbecome invisible whenever it's occluded by any Entities in the canvas.\n\nWe'll also demonstrate how to query the Marker's visibility status and position (in the World, View and\nCanvas coordinate systems), and how to subscribe to change events on those properties.\n\n````javascript\nimport {Viewer, GLTFLoaderPlugin, Marker} from \"xeokit-sdk.es.js\";\n\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\n// Create the torus Mesh\n// Recall that a Mesh is an Entity\nnew Mesh(viewer.scene, {\n geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n center: [0,0,0],\n radius: 1.0,\n tube: 0.5,\n radialSegments: 32,\n tubeSegments: 24,\n arc: Math.PI * 2.0\n }),\n material: new PhongMaterial(viewer.scene, {\n diffuseMap: new Texture(viewer.scene, {\n src: \"textures/diffuse/uvGrid2.jpg\"\n }),\n backfaces: true\n })\n});\n\n// Create the Marker, associated with our Mesh Entity\nconst myMarker = new Marker(viewer, {\n entity: entity,\n worldPos: [10,0,0],\n occludable: true\n});\n\n// Get the Marker's current World, View and Canvas coordinates\nconst worldPos = myMarker.worldPos; // 3D World-space position\nconst viewPos = myMarker.viewPos; // 3D View-space position\nconst canvasPos = myMarker.canvasPos; // 2D Canvas-space position\n\nconst visible = myMarker.visible;\n\n// Listen for change of the Marker's 3D World-space position\nmyMarker.on(\"worldPos\", function(worldPos) {\n //...\n});\n\n// Listen for change of the Marker's 3D View-space position, which happens\n// when either worldPos was updated or the Camera was moved\nmyMarker.on(\"viewPos\", function(viewPos) {\n //...\n});\n\n// Listen for change of the Marker's 2D Canvas-space position, which happens\n// when worldPos or viewPos was updated, or Camera's projection was updated\nmyMarker.on(\"canvasPos\", function(canvasPos) {\n //...\n});\n\n// Listen for change of Marker visibility. The Marker becomes invisible when it falls outside the canvas,\n// has an Entity that is also invisible, or when an Entity occludes the Marker's position in the 3D view.\nmyMarker.on(\"visible\", function(visible) { // Marker visibility has changed\n if (visible) {\n this.log(\"Marker is visible\");\n } else {\n this.log(\"Marker is invisible\");\n }\n});\n\n// Listen for destruction of Marker\nmyMarker.on(\"destroyed\", () => {\n //...\n});\n````", "lineNumber": 114, "interface": false, "extends": [ @@ -77273,7 +77489,7 @@ ] }, { - "__docId__": 3808, + "__docId__": 3816, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77362,7 +77578,7 @@ ] }, { - "__docId__": 3809, + "__docId__": 3817, "kind": "member", "name": "_entity", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77380,7 +77596,7 @@ } }, { - "__docId__": 3810, + "__docId__": 3818, "kind": "member", "name": "_visible", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77398,7 +77614,7 @@ } }, { - "__docId__": 3811, + "__docId__": 3819, "kind": "member", "name": "_worldPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77416,7 +77632,7 @@ } }, { - "__docId__": 3812, + "__docId__": 3820, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77434,7 +77650,7 @@ } }, { - "__docId__": 3813, + "__docId__": 3821, "kind": "member", "name": "_rtcPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77452,7 +77668,7 @@ } }, { - "__docId__": 3814, + "__docId__": 3822, "kind": "member", "name": "_viewPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77470,7 +77686,7 @@ } }, { - "__docId__": 3815, + "__docId__": 3823, "kind": "member", "name": "_canvasPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77488,7 +77704,7 @@ } }, { - "__docId__": 3816, + "__docId__": 3824, "kind": "member", "name": "_occludable", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77506,7 +77722,7 @@ } }, { - "__docId__": 3817, + "__docId__": 3825, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77524,7 +77740,7 @@ } }, { - "__docId__": 3818, + "__docId__": 3826, "kind": "member", "name": "_viewPosDirty", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77542,7 +77758,7 @@ } }, { - "__docId__": 3819, + "__docId__": 3827, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77560,7 +77776,7 @@ } }, { - "__docId__": 3820, + "__docId__": 3828, "kind": "member", "name": "_canvasPosDirty", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77578,7 +77794,7 @@ } }, { - "__docId__": 3821, + "__docId__": 3829, "kind": "member", "name": "_onEntityDestroyed", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77596,7 +77812,7 @@ } }, { - "__docId__": 3822, + "__docId__": 3830, "kind": "member", "name": "_onEntityModelDestroyed", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77614,7 +77830,7 @@ } }, { - "__docId__": 3826, + "__docId__": 3834, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77631,7 +77847,7 @@ "return": null }, { - "__docId__": 3830, + "__docId__": 3838, "kind": "method", "name": "_setVisible", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77655,7 +77871,7 @@ "return": null }, { - "__docId__": 3832, + "__docId__": 3840, "kind": "set", "name": "entity", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77676,7 +77892,7 @@ } }, { - "__docId__": 3842, + "__docId__": 3850, "kind": "get", "name": "entity", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77697,7 +77913,7 @@ } }, { - "__docId__": 3843, + "__docId__": 3851, "kind": "set", "name": "occludable", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77718,7 +77934,7 @@ } }, { - "__docId__": 3845, + "__docId__": 3853, "kind": "get", "name": "occludable", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77739,7 +77955,7 @@ } }, { - "__docId__": 3846, + "__docId__": 3854, "kind": "set", "name": "worldPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77760,7 +77976,7 @@ } }, { - "__docId__": 3848, + "__docId__": 3856, "kind": "get", "name": "worldPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77781,7 +77997,7 @@ } }, { - "__docId__": 3849, + "__docId__": 3857, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77802,7 +78018,7 @@ } }, { - "__docId__": 3850, + "__docId__": 3858, "kind": "get", "name": "rtcPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77823,7 +78039,7 @@ } }, { - "__docId__": 3851, + "__docId__": 3859, "kind": "get", "name": "viewPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77850,7 +78066,7 @@ } }, { - "__docId__": 3852, + "__docId__": 3860, "kind": "get", "name": "canvasPos", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77877,7 +78093,7 @@ } }, { - "__docId__": 3853, + "__docId__": 3861, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77904,7 +78120,7 @@ } }, { - "__docId__": 3854, + "__docId__": 3862, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/marker/Marker.js~Marker", @@ -77919,18 +78135,18 @@ "return": null }, { - "__docId__": 3855, + "__docId__": 3863, "kind": "file", "name": "src/viewer/scene/marker/SpriteMarker.js", "content": "import {Mesh} from \"../mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../geometry/ReadableGeometry.js\";\nimport {PhongMaterial, Texture} from \"../materials/index.js\";\nimport {math} from \"../math/math.js\";\nimport {Marker} from \"./Marker.js\";\n\n/**\n * A {@link Marker} with a billboarded and textured quad attached to it.\n *\n * * Extends {@link Marker}\n * * Keeps the quad oriented towards the viewpoint\n * * Auto-fits the quad to the texture\n * * Has a world-space position\n * * Can be configured to hide the quad whenever the position is occluded by some other object\n *\n * ## Usage\n *\n * [[Run this example](/examples/index.html#markers_SpriteMarker)]\n *\n * ```` javascript\n * import {Viewer, SpriteMarker } from \"./https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 25];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new SpriteMarker(viewer.scene, {\n * worldPos: [-10, 0, 0],\n * src: \"../assets/textures/diffuse/uvGrid2_512x1024.jpg\",\n * size: 5,\n * occludable: false\n * });\n *\n * new SpriteMarker(viewer.scene, {\n * worldPos: [+10, 0, 0],\n * src: \"../assets/textures/diffuse/uvGrid2_1024x512.jpg\",\n * size: 4,\n * occludable: false\n * });\n *````\n */\nclass SpriteMarker extends Marker {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this SpriteMarker as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for this SpriteMarker, unique among all components in the parent scene, generated automatically when omitted.\n * @param {Entity} [cfg.entity] Entity to associate this Marker with. When the SpriteMarker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.\n * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.\n * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.\n * @param {String} [cfg.src=null] Path to image file to load into this SpriteMarker. See the {@link SpriteMarker#src} property for more info.\n * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this SpriteMarker. See the {@link SpriteMarker#image} property for more info.\n * @param {Boolean} [cfg.flipY=false] Flips this SpriteMarker's texture image along its vertical axis when true.\n * @param {String} [cfg.encoding=\"linear\"] Texture encoding format. See the {@link Texture#encoding} property for more info.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, {\n entity: cfg.entity,\n occludable: cfg.occludable,\n worldPos: cfg.worldPos\n });\n\n this._occluded = false;\n this._visible = true;\n this._src = null;\n this._image = null;\n this._pos = math.vec3();\n this._origin = math.vec3();\n this._rtcPos = math.vec3();\n this._dir = math.vec3();\n this._size = 1.0;\n this._imageSize = math.vec2();\n\n this._texture = new Texture(this, {\n src: cfg.src\n });\n\n this._geometry = new ReadableGeometry(this, {\n primitive: \"triangles\",\n positions: [3, 3, 0, -3, 3, 0, -3, -3, 0, 3, -3, 0],\n normals: [-1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0],\n uv: [1, -1, 0, -1, 0, 0, 1, 0],\n indices: [0, 1, 2, 0, 2, 3] // Ensure these will be front-faces\n });\n\n this._mesh = new Mesh(this, {\n geometry: this._geometry,\n material: new PhongMaterial(this, {\n ambient: [0.9, 0.3, 0.9],\n shininess: 30,\n diffuseMap: this._texture,\n backfaces: true\n }),\n scale: [1, 1, 1], // Note: by design, scale does not work with billboard\n position: cfg.worldPos,\n rotation: [90, 0, 0],\n billboard: \"spherical\",\n occluder: false // Don't occlude SpriteMarkers or Annotations\n });\n\n this.visible = true;\n this.collidable = cfg.collidable;\n this.clippable = cfg.clippable;\n this.pickable = cfg.pickable;\n this.opacity = cfg.opacity;\n this.size = cfg.size;\n\n if (cfg.image) {\n this.image = cfg.image;\n } else {\n this.src = cfg.src;\n }\n }\n\n _setVisible(visible) { // Called by VisibilityTester and this._entity.on(\"destroyed\"..)\n this._occluded = (!visible);\n this._mesh.visible = this._visible && (!this._occluded);\n super._setVisible(visible);\n }\n\n /**\n * Sets if this ````SpriteMarker```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} visible Set ````true```` to make this ````SpriteMarker```` visible.\n */\n set visible(visible) {\n this._visible = (visible === null || visible === undefined) ? true : visible;\n this._mesh.visible = this._visible && (!this._occluded);\n }\n\n /**\n * Gets if this ````SpriteMarker```` is visible or not.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if visible.\n */\n get visible() {\n return this._visible;\n }\n\n /**\n * Sets an ````HTMLImageElement```` to source the image from.\n *\n * Sets {@link Texture#src} null.\n *\n * @type {HTMLImageElement}\n */\n set image(image) {\n this._image = image;\n if (this._image) {\n this._imageSize[0] = this._image.width;\n this._imageSize[1] = this._image.height;\n this._updatePlaneSizeFromImage();\n this._src = null;\n this._texture.image = this._image;\n }\n }\n\n /**\n * Gets the ````HTMLImageElement```` the ````SpriteMarker````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {HTMLImageElement}\n */\n get image() {\n return this._image;\n }\n\n /**\n * Sets an image file path that the ````SpriteMarker````'s image is sourced from.\n *\n * Accepted file types are PNG and JPEG.\n *\n * Sets {@link Texture#image} null.\n *\n * @type {String}\n */\n set src(src) {\n this._src = src;\n if (this._src) {\n this._image = null;\n const image = new Image();\n image.onload = () => {\n this._texture.image = image;\n this._imageSize[0] = image.width;\n this._imageSize[1] = image.height;\n this._updatePlaneSizeFromImage();\n };\n image.src = this._src;\n }\n }\n\n /**\n * Gets the image file path that the ````SpriteMarker````'s image is sourced from, if set.\n *\n * Returns null if not set.\n *\n * @type {String}\n */\n get src() {\n return this._src;\n }\n\n /**\n * Sets the World-space size of the longest edge of the ````SpriteMarker````.\n *\n * Note that ````SpriteMarker```` sets its aspect ratio to match its image. If we set a value of ````1000````, and\n * the image has size ````400x300````, then the ````SpriteMarker```` will then have size ````1000 x 750````.\n *\n * Default value is ````1.0````.\n *\n * @param {Number} size New World-space size of the ````SpriteMarker````.\n */\n set size(size) {\n this._size = (size === undefined || size === null) ? 1.0 : size;\n if (this._image) {\n this._updatePlaneSizeFromImage()\n }\n }\n\n /**\n * Gets the World-space size of the longest edge of the ````SpriteMarker````.\n *\n * Returns {Number} World-space size of the ````SpriteMarker````.\n */\n get size() {\n return this._size;\n }\n\n /**\n * Sets if this ````SpriteMarker```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set collidable(value) {\n this._mesh.collidable = (value !== false);\n }\n\n /**\n * Gets if this ````SpriteMarker```` is included in boundary calculations.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._mesh.collidable;\n }\n\n /**\n * Sets if this ````SpriteMarker```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set clippable(value) {\n this._mesh.clippable = (value !== false);\n }\n\n /**\n * Gets if this ````SpriteMarker```` is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._mesh.clippable;\n }\n\n /**\n * Sets if this ````SpriteMarker```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set pickable(value) {\n this._mesh.pickable = (value !== false);\n }\n\n /**\n * Gets if this ````SpriteMarker```` is pickable.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._mesh.pickable;\n }\n\n /**\n * Sets the opacity factor for this ````SpriteMarker````.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n this._mesh.opacity = opacity;\n }\n\n /**\n * Gets this ````SpriteMarker````'s opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n return this._mesh.opacity;\n }\n\n _updatePlaneSizeFromImage() {\n const halfSize = this._size * 0.5;\n const width = this._imageSize[0];\n const height = this._imageSize[1];\n const aspect = height / width;\n if (width > height) {\n this._geometry.positions = [\n halfSize, halfSize * aspect, 0,\n -halfSize, halfSize * aspect, 0,\n -halfSize, -halfSize * aspect, 0,\n halfSize, -halfSize * aspect, 0\n ];\n } else {\n this._geometry.positions = [\n halfSize / aspect, halfSize, 0,\n -halfSize / aspect, halfSize, 0,\n -halfSize / aspect, -halfSize, 0,\n halfSize / aspect, -halfSize, 0\n ];\n }\n }\n}\n\nexport {SpriteMarker};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/marker/SpriteMarker.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/marker/SpriteMarker.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3856, + "__docId__": 3864, "kind": "class", "name": "SpriteMarker", "memberof": "src/viewer/scene/marker/SpriteMarker.js", @@ -77948,7 +78164,7 @@ ] }, { - "__docId__": 3857, + "__docId__": 3865, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78085,7 +78301,7 @@ ] }, { - "__docId__": 3858, + "__docId__": 3866, "kind": "member", "name": "_occluded", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78103,7 +78319,7 @@ } }, { - "__docId__": 3859, + "__docId__": 3867, "kind": "member", "name": "_visible", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78121,7 +78337,7 @@ } }, { - "__docId__": 3860, + "__docId__": 3868, "kind": "member", "name": "_src", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78139,7 +78355,7 @@ } }, { - "__docId__": 3861, + "__docId__": 3869, "kind": "member", "name": "_image", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78157,7 +78373,7 @@ } }, { - "__docId__": 3862, + "__docId__": 3870, "kind": "member", "name": "_pos", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78175,7 +78391,7 @@ } }, { - "__docId__": 3863, + "__docId__": 3871, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78193,7 +78409,7 @@ } }, { - "__docId__": 3864, + "__docId__": 3872, "kind": "member", "name": "_rtcPos", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78211,7 +78427,7 @@ } }, { - "__docId__": 3865, + "__docId__": 3873, "kind": "member", "name": "_dir", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78229,7 +78445,7 @@ } }, { - "__docId__": 3866, + "__docId__": 3874, "kind": "member", "name": "_size", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78247,7 +78463,7 @@ } }, { - "__docId__": 3867, + "__docId__": 3875, "kind": "member", "name": "_imageSize", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78265,7 +78481,7 @@ } }, { - "__docId__": 3868, + "__docId__": 3876, "kind": "member", "name": "_texture", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78283,7 +78499,7 @@ } }, { - "__docId__": 3869, + "__docId__": 3877, "kind": "member", "name": "_geometry", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78301,7 +78517,7 @@ } }, { - "__docId__": 3870, + "__docId__": 3878, "kind": "member", "name": "_mesh", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78319,7 +78535,7 @@ } }, { - "__docId__": 3879, + "__docId__": 3887, "kind": "method", "name": "_setVisible", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78343,7 +78559,7 @@ "return": null }, { - "__docId__": 3881, + "__docId__": 3889, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78368,7 +78584,7 @@ ] }, { - "__docId__": 3883, + "__docId__": 3891, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78400,7 +78616,7 @@ } }, { - "__docId__": 3884, + "__docId__": 3892, "kind": "set", "name": "image", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78421,7 +78637,7 @@ } }, { - "__docId__": 3887, + "__docId__": 3895, "kind": "get", "name": "image", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78442,7 +78658,7 @@ } }, { - "__docId__": 3888, + "__docId__": 3896, "kind": "set", "name": "src", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78463,7 +78679,7 @@ } }, { - "__docId__": 3891, + "__docId__": 3899, "kind": "get", "name": "src", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78484,7 +78700,7 @@ } }, { - "__docId__": 3892, + "__docId__": 3900, "kind": "set", "name": "size", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78509,7 +78725,7 @@ ] }, { - "__docId__": 3894, + "__docId__": 3902, "kind": "get", "name": "size", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78527,7 +78743,7 @@ } }, { - "__docId__": 3895, + "__docId__": 3903, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78548,7 +78764,7 @@ } }, { - "__docId__": 3896, + "__docId__": 3904, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78569,7 +78785,7 @@ } }, { - "__docId__": 3897, + "__docId__": 3905, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78590,7 +78806,7 @@ } }, { - "__docId__": 3898, + "__docId__": 3906, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78611,7 +78827,7 @@ } }, { - "__docId__": 3899, + "__docId__": 3907, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78632,7 +78848,7 @@ } }, { - "__docId__": 3900, + "__docId__": 3908, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78653,7 +78869,7 @@ } }, { - "__docId__": 3901, + "__docId__": 3909, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78674,7 +78890,7 @@ } }, { - "__docId__": 3902, + "__docId__": 3910, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78695,7 +78911,7 @@ } }, { - "__docId__": 3903, + "__docId__": 3911, "kind": "method", "name": "_updatePlaneSizeFromImage", "memberof": "src/viewer/scene/marker/SpriteMarker.js~SpriteMarker", @@ -78712,29 +78928,29 @@ "return": null }, { - "__docId__": 3904, + "__docId__": 3912, "kind": "file", "name": "src/viewer/scene/marker/index.js", "content": "export * from \"./Marker.js\";\nexport * from \"./SpriteMarker.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/marker/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/marker/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3905, + "__docId__": 3913, "kind": "file", "name": "src/viewer/scene/materials/EdgeMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\nconst PRESETS = {\n \"default\": {\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"defaultWhiteBG\": {\n edgeColor: [0.2, 0.2, 0.2],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"defaultLightBG\": {\n edgeColor: [0.2, 0.2, 0.2],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"defaultDarkBG\": {\n edgeColor: [0.5, 0.5, 0.5],\n edgeAlpha: 1.0,\n edgeWidth: 1\n }\n};\n\n/**\n * @desc Configures the appearance of {@link Entity}s when their edges are emphasised.\n *\n * * Emphasise edges of an {@link Entity} by setting {@link Entity#edges} ````true````.\n * * When {@link Entity}s are within the subtree of a root {@link Entity}, then setting {@link Entity#edges} on the root\n * will collectively set that property on all sub-{@link Entity}s.\n * * EdgeMaterial provides several presets. Select a preset by setting {@link EdgeMaterial#preset} to the ID of a preset in {@link EdgeMaterial#presets}.\n * * By default, a {@link Mesh} uses the default EdgeMaterial in {@link Scene#edgeMaterial}, but you can assign each {@link Mesh#edgeMaterial} to a custom EdgeMaterial if required.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Mesh} with its own EdgeMaterial and set {@link Mesh#edges} ````true```` to emphasise its edges.\n *\n * Recall that {@link Mesh} is a concrete subtype of the abstract {@link Entity} base class.\n *\n * [[Run this example](/examples/index.html#materials_EdgeMaterial)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildSphereGeometry,\n * ReadableGeometry, PhongMaterial, EdgeMaterial} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n *\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 1.5,\n * heightSegments: 24,\n * widthSegments: 16,\n * edgeThreshold: 2 // Default is 10\n * })),\n *\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.4, 0.4, 1.0],\n * ambient: [0.9, 0.3, 0.9],\n * shininess: 30,\n * alpha: 0.5,\n * alphaMode: \"blend\"\n * }),\n *\n * edgeMaterial: new EdgeMaterial(viewer.scene, {\n * edgeColor: [0.0, 0.0, 1.0]\n * edgeAlpha: 1.0,\n * edgeWidth: 2\n * }),\n *\n * edges: true\n * });\n * ````\n *\n * Note the ````edgeThreshold```` configuration for the {@link ReadableGeometry} on our {@link Mesh}. EdgeMaterial configures\n * a wireframe representation of the {@link ReadableGeometry}, which will have inner edges (those edges between\n * adjacent co-planar triangles) removed for visual clarity. The ````edgeThreshold```` indicates that, for\n * this particular {@link ReadableGeometry}, an inner edge is one where the angle between the surface normals of adjacent triangles\n * is not greater than ````5```` degrees. That's set to ````2```` by default, but we can override it to tweak the effect\n * as needed for particular Geometries.\n *\n * Here's the example again, this time implicitly defaulting to the {@link Scene#edgeMaterial}. We'll also modify that EdgeMaterial\n * to customize the effect.\n *\n * ````javascript\n * new Mesh({\n * geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({\n * radius: 1.5,\n * heightSegments: 24,\n * widthSegments: 16,\n * edgeThreshold: 2 // Default is 10\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.2, 0.2, 1.0]\n * }),\n * edges: true\n * });\n *\n * var edgeMaterial = viewer.scene.edgeMaterial;\n *\n * edgeMaterial.edgeColor = [0.2, 1.0, 0.2];\n * edgeMaterial.edgeAlpha = 1.0;\n * edgeMaterial.edgeWidth = 2;\n * ````\n *\n * ## Presets\n *\n * Let's switch the {@link Scene#edgeMaterial} to one of the presets in {@link EdgeMaterial#presets}:\n *\n * ````javascript\n * viewer.edgeMaterial.preset = EdgeMaterial.presets[\"sepia\"];\n * ````\n *\n * We can also create an EdgeMaterial from a preset, while overriding properties of the preset as required:\n *\n * ````javascript\n * var myEdgeMaterial = new EdgeMaterial(viewer.scene, {\n * preset: \"sepia\",\n * edgeColor = [1.0, 0.5, 0.5]\n * });\n * ````\n */\nclass EdgeMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"EdgeMaterial\";\n }\n\n /**\n * Gets available EdgeMaterial presets.\n *\n * @type {Object}\n */\n get presets() {\n return PRESETS;\n };\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The EdgeMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.edgeColor=[0.2,0.2,0.2]] RGB edge color.\n * @param {Number} [cfg.edgeAlpha=1.0] Edge transparency. A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n * @param {Number} [cfg.edgeWidth=1] Edge width in pixels.\n * @param {String} [cfg.preset] Selects a preset EdgeMaterial configuration - see {@link EdgeMaterial#presets}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"EdgeMaterial\",\n edges: null,\n edgeColor: null,\n edgeAlpha: null,\n edgeWidth: null\n });\n\n this._preset = \"default\";\n\n if (cfg.preset) { // Apply preset then override with configs where provided\n this.preset = cfg.preset;\n if (cfg.edgeColor) {\n this.edgeColor = cfg.edgeColor;\n }\n if (cfg.edgeAlpha !== undefined) {\n this.edgeAlpha = cfg.edgeAlpha;\n }\n if (cfg.edgeWidth !== undefined) {\n this.edgeWidth = cfg.edgeWidth;\n }\n } else {\n this.edgeColor = cfg.edgeColor;\n this.edgeAlpha = cfg.edgeAlpha;\n this.edgeWidth = cfg.edgeWidth;\n }\n this.edges = (cfg.edges !== false);\n }\n\n\n /**\n * Sets if edges are visible.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set edges(value) {\n value = value !== false;\n if (this._state.edges === value) {\n return;\n }\n this._state.edges = value;\n this.glRedraw();\n }\n\n /**\n * Gets if edges are visible.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get edges() {\n return this._state.edges;\n }\n\n /**\n * Sets RGB edge color.\n *\n * Default value is ````[0.2, 0.2, 0.2]````.\n *\n * @type {Number[]}\n */\n set edgeColor(value) {\n let edgeColor = this._state.edgeColor;\n if (!edgeColor) {\n edgeColor = this._state.edgeColor = new Float32Array(3);\n } else if (value && edgeColor[0] === value[0] && edgeColor[1] === value[1] && edgeColor[2] === value[2]) {\n return;\n }\n if (value) {\n edgeColor[0] = value[0];\n edgeColor[1] = value[1];\n edgeColor[2] = value[2];\n } else {\n edgeColor[0] = 0.2;\n edgeColor[1] = 0.2;\n edgeColor[2] = 0.2;\n }\n this.glRedraw();\n }\n\n /**\n * Gets RGB edge color.\n *\n * Default value is ````[0.2, 0.2, 0.2]````.\n *\n * @type {Number[]}\n */\n get edgeColor() {\n return this._state.edgeColor;\n }\n\n /**\n * Sets edge transparency.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set edgeAlpha(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.edgeAlpha === value) {\n return;\n }\n this._state.edgeAlpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets edge transparency.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get edgeAlpha() {\n return this._state.edgeAlpha;\n }\n\n /**\n * Sets edge width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n set edgeWidth(value) {\n this._state.edgeWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets edge width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n get edgeWidth() {\n return this._state.edgeWidth;\n }\n\n /**\n * Selects a preset EdgeMaterial configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n set preset(value) {\n value = value || \"default\";\n if (this._preset === value) {\n return;\n }\n const preset = PRESETS[value];\n if (!preset) {\n this.error(\"unsupported preset: '\" + value + \"' - supported values are \" + Object.keys(PRESETS).join(\", \"));\n return;\n }\n this.edgeColor = preset.edgeColor;\n this.edgeAlpha = preset.edgeAlpha;\n this.edgeWidth = preset.edgeWidth;\n this._preset = value;\n }\n\n /**\n * The current preset EdgeMaterial configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n get preset() {\n return this._preset;\n }\n\n /**\n * Destroys this EdgeMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {EdgeMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/EdgeMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/EdgeMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3906, + "__docId__": 3914, "kind": "variable", "name": "PRESETS", "memberof": "src/viewer/scene/materials/EdgeMaterial.js", @@ -78755,7 +78971,7 @@ "ignore": true }, { - "__docId__": 3907, + "__docId__": 3915, "kind": "class", "name": "EdgeMaterial", "memberof": "src/viewer/scene/materials/EdgeMaterial.js", @@ -78773,7 +78989,7 @@ ] }, { - "__docId__": 3908, + "__docId__": 3916, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78792,7 +79008,7 @@ } }, { - "__docId__": 3909, + "__docId__": 3917, "kind": "get", "name": "presets", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78813,7 +79029,7 @@ } }, { - "__docId__": 3910, + "__docId__": 3918, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78914,7 +79130,7 @@ ] }, { - "__docId__": 3911, + "__docId__": 3919, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78932,7 +79148,7 @@ } }, { - "__docId__": 3912, + "__docId__": 3920, "kind": "member", "name": "_preset", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78950,7 +79166,7 @@ } }, { - "__docId__": 3921, + "__docId__": 3929, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78971,7 +79187,7 @@ } }, { - "__docId__": 3922, + "__docId__": 3930, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -78992,7 +79208,7 @@ } }, { - "__docId__": 3923, + "__docId__": 3931, "kind": "set", "name": "edgeColor", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79013,7 +79229,7 @@ } }, { - "__docId__": 3924, + "__docId__": 3932, "kind": "get", "name": "edgeColor", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79034,7 +79250,7 @@ } }, { - "__docId__": 3925, + "__docId__": 3933, "kind": "set", "name": "edgeAlpha", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79055,7 +79271,7 @@ } }, { - "__docId__": 3926, + "__docId__": 3934, "kind": "get", "name": "edgeAlpha", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79076,7 +79292,7 @@ } }, { - "__docId__": 3927, + "__docId__": 3935, "kind": "set", "name": "edgeWidth", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79097,7 +79313,7 @@ } }, { - "__docId__": 3928, + "__docId__": 3936, "kind": "get", "name": "edgeWidth", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79118,7 +79334,7 @@ } }, { - "__docId__": 3929, + "__docId__": 3937, "kind": "set", "name": "preset", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79139,7 +79355,7 @@ } }, { - "__docId__": 3934, + "__docId__": 3942, "kind": "get", "name": "preset", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79160,7 +79376,7 @@ } }, { - "__docId__": 3935, + "__docId__": 3943, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/EdgeMaterial.js~EdgeMaterial", @@ -79175,18 +79391,18 @@ "return": null }, { - "__docId__": 3936, + "__docId__": 3944, "kind": "file", "name": "src/viewer/scene/materials/EmphasisMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\nconst PRESETS = {\n \"default\": {\n fill: true,\n fillColor: [0.4, 0.4, 0.4],\n fillAlpha: 0.2,\n edges: true,\n edgeColor: [0.2, 0.2, 0.2],\n edgeAlpha: 0.5,\n edgeWidth: 1\n },\n \"defaultWhiteBG\": {\n fill: true,\n fillColor: [1, 1, 1],\n fillAlpha: 0.6,\n edgeColor: [0.2, 0.2, 0.2],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"defaultLightBG\": {\n fill: true,\n fillColor: [0.4, 0.4, 0.4],\n fillAlpha: 0.2,\n edges: true,\n edgeColor: [0.2, 0.2, 0.2],\n edgeAlpha: 0.5,\n edgeWidth: 1\n },\n \"defaultDarkBG\": {\n fill: true,\n fillColor: [0.4, 0.4, 0.4],\n fillAlpha: 0.2,\n edges: true,\n edgeColor: [0.5, 0.5, 0.5],\n edgeAlpha: 0.5,\n edgeWidth: 1\n },\n \"phosphorous\": {\n fill: true,\n fillColor: [0.0, 0.0, 0.0],\n fillAlpha: 0.4,\n edges: true,\n edgeColor: [0.9, 0.9, 0.9],\n edgeAlpha: 0.5,\n edgeWidth: 2\n },\n \"sunset\": {\n fill: true,\n fillColor: [0.9, 0.9, 0.6],\n fillAlpha: 0.2,\n edges: true,\n edgeColor: [0.9, 0.9, 0.9],\n edgeAlpha: 0.5,\n edgeWidth: 1\n },\n \"vectorscope\": {\n fill: true,\n fillColor: [0.0, 0.0, 0.0],\n fillAlpha: 0.7,\n edges: true,\n edgeColor: [0.2, 1.0, 0.2],\n edgeAlpha: 1,\n edgeWidth: 2\n },\n \"battlezone\": {\n fill: true,\n fillColor: [0.0, 0.0, 0.0],\n fillAlpha: 1.0,\n edges: true,\n edgeColor: [0.2, 1.0, 0.2],\n edgeAlpha: 1,\n edgeWidth: 3\n },\n \"sepia\": {\n fill: true,\n fillColor: [0.970588207244873, 0.7965892553329468, 0.6660899519920349],\n fillAlpha: 0.4,\n edges: true,\n edgeColor: [0.529411792755127, 0.4577854573726654, 0.4100345969200134],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"yellowHighlight\": {\n fill: true,\n fillColor: [1.0, 1.0, 0.0],\n fillAlpha: 0.5,\n edges: true,\n edgeColor: [1.0, 1.0, 1.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"greenSelected\": {\n fill: true,\n fillColor: [0.0, 1.0, 0.0],\n fillAlpha: 0.5,\n edges: true,\n edgeColor: [1.0, 1.0, 1.0],\n edgeAlpha: 1.0,\n edgeWidth: 1\n },\n \"gamegrid\": {\n fill: true,\n fillColor: [0.2, 0.2, 0.7],\n fillAlpha: 0.9,\n edges: true,\n edgeColor: [0.4, 0.4, 1.6],\n edgeAlpha: 0.8,\n edgeWidth: 3\n }\n};\n\n/**\n * Configures the appearance of {@link Entity}s when they are xrayed, highlighted or selected.\n *\n * * XRay an {@link Entity} by setting {@link Entity#xrayed} ````true````.\n * * Highlight an {@link Entity} by setting {@link Entity#highlighted} ````true````.\n * * Select an {@link Entity} by setting {@link Entity#selected} ````true````.\n * * When {@link Entity}s are within the subtree of a root {@link Entity}, then setting {@link Entity#xrayed}, {@link Entity#highlighted} or {@link Entity#selected}\n * on the root will collectively set those properties on all sub-{@link Entity}s.\n * * EmphasisMaterial provides several presets. Select a preset by setting {@link EmphasisMaterial#preset} to the ID of a preset in {@link EmphasisMaterial#presets}.\n * * By default, a {@link Mesh} uses the default EmphasisMaterials in {@link Scene#xrayMaterial}, {@link Scene#highlightMaterial} and {@link Scene#selectedMaterial}\n * but you can assign each {@link Mesh#xrayMaterial}, {@link Mesh#highlightMaterial} or {@link Mesh#selectedMaterial} to a custom EmphasisMaterial, if required.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Mesh} with its own XRayMaterial and set {@link Mesh#xrayed} ````true```` to xray it.\n *\n * Recall that {@link Mesh} is a concrete subtype of the abstract {@link Entity} base class.\n *\n * ````javascript\n * new Mesh(viewer.scene, {\n * geometry: new BoxGeometry(viewer.scene, {\n * edgeThreshold: 1\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.2, 0.2, 1.0]\n * }),\n * xrayMaterial: new EmphasisMaterial(viewer.scene, {\n * fill: true,\n * fillColor: [0, 0, 0],\n * fillAlpha: 0.7,\n * edges: true,\n * edgeColor: [0.2, 1.0, 0.2],\n * edgeAlpha: 1.0,\n * edgeWidth: 2\n * }),\n * xrayed: true\n * });\n * ````\n *\n * Note the ````edgeThreshold```` configuration for the {@link ReadableGeometry} on our {@link Mesh}. EmphasisMaterial configures\n * a wireframe representation of the {@link ReadableGeometry} for the selected emphasis mode, which will have inner edges (those edges between\n * adjacent co-planar triangles) removed for visual clarity. The ````edgeThreshold```` indicates that, for\n * this particular {@link ReadableGeometry}, an inner edge is one where the angle between the surface normals of adjacent triangles\n * is not greater than ````5```` degrees. That's set to ````2```` by default, but we can override it to tweak the effect\n * as needed for particular Geometries.\n *\n * Here's the example again, this time implicitly defaulting to the {@link Scene#edgeMaterial}. We'll also modify that EdgeMaterial\n * to customize the effect.\n *\n * ````javascript\n * new Mesh({\n * geometry: new TeapotGeometry(viewer.scene, {\n * edgeThreshold: 5\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.2, 0.2, 1.0]\n * }),\n * xrayed: true\n * });\n *\n * var xrayMaterial = viewer.scene.xrayMaterial;\n *\n * xrayMaterial.fillColor = [0.2, 1.0, 0.2];\n * xrayMaterial.fillAlpha = 1.0;\n * ````\n *\n * ## Presets\n *\n * Let's switch the {@link Scene#xrayMaterial} to one of the presets in {@link EmphasisMaterial#presets}:\n *\n * ````javascript\n * viewer.xrayMaterial.preset = EmphasisMaterial.presets[\"sepia\"];\n * ````\n *\n * We can also create an EmphasisMaterial from a preset, while overriding properties of the preset as required:\n *\n * ````javascript\n * var myEmphasisMaterial = new EMphasisMaterial(viewer.scene, {\n * preset: \"sepia\",\n * fillColor = [1.0, 0.5, 0.5]\n * });\n * ````\n */\nclass EmphasisMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"EmphasisMaterial\";\n }\n\n /**\n * Gets available EmphasisMaterial presets.\n *\n * @type {Object}\n */\n get presets() {\n return PRESETS;\n };\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The EmphasisMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Boolean} [cfg.fill=true] Indicates if xray surfaces are filled with color.\n * @param {Number[]} [cfg.fillColor=[0.4,0.4,0.4]] EmphasisMaterial fill color.\n * @param {Number} [cfg.fillAlpha=0.2] Transparency of filled xray faces. A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n * @param {Boolean} [cfg.edges=true] Indicates if xray edges are visible.\n * @param {Number[]} [cfg.edgeColor=[0.2,0.2,0.2]] RGB color of xray edges.\n * @param {Number} [cfg.edgeAlpha=0.5] Transparency of xray edges. A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n * @param {Number} [cfg.edgeWidth=1] Width of xray edges, in pixels.\n * @param {String} [cfg.preset] Selects a preset EmphasisMaterial configuration - see {@link EmphasisMaterial#presets}.\n * @param {Boolean} [cfg.backfaces=false] Whether to render geometry backfaces when emphasising.\n * @param {Boolean} [cfg.glowThrough=true] Whether to make the emphasized object appear to float on top of other objects, as if it were \"glowing through\" them.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"EmphasisMaterial\",\n fill: null,\n fillColor: null,\n fillAlpha: null,\n edges: null,\n edgeColor: null,\n edgeAlpha: null,\n edgeWidth: null,\n backfaces: true,\n glowThrough: true\n });\n\n this._preset = \"default\";\n\n if (cfg.preset) { // Apply preset then override with configs where provided\n this.preset = cfg.preset;\n if (cfg.fill !== undefined) {\n this.fill = cfg.fill;\n }\n if (cfg.fillColor) {\n this.fillColor = cfg.fillColor;\n }\n if (cfg.fillAlpha !== undefined) {\n this.fillAlpha = cfg.fillAlpha;\n }\n if (cfg.edges !== undefined) {\n this.edges = cfg.edges;\n }\n if (cfg.edgeColor) {\n this.edgeColor = cfg.edgeColor;\n }\n if (cfg.edgeAlpha !== undefined) {\n this.edgeAlpha = cfg.edgeAlpha;\n }\n if (cfg.edgeWidth !== undefined) {\n this.edgeWidth = cfg.edgeWidth;\n }\n if (cfg.backfaces !== undefined) {\n this.backfaces = cfg.backfaces;\n }\n if (cfg.glowThrough !== undefined) {\n this.glowThrough = cfg.glowThrough;\n }\n } else {\n this.fill = cfg.fill;\n this.fillColor = cfg.fillColor;\n this.fillAlpha = cfg.fillAlpha;\n this.edges = cfg.edges;\n this.edgeColor = cfg.edgeColor;\n this.edgeAlpha = cfg.edgeAlpha;\n this.edgeWidth = cfg.edgeWidth;\n this.backfaces = cfg.backfaces;\n this.glowThrough = cfg.glowThrough;\n }\n }\n\n /**\n * Sets if surfaces are filled with color.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set fill(value) {\n value = value !== false;\n if (this._state.fill === value) {\n return;\n }\n this._state.fill = value;\n this.glRedraw();\n }\n\n /**\n * Gets if surfaces are filled with color.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get fill() {\n return this._state.fill;\n }\n\n /**\n * Sets the RGB color of filled faces.\n *\n * Default is ````[0.4, 0.4, 0.4]````.\n *\n * @type {Number[]}\n */\n set fillColor(value) {\n let fillColor = this._state.fillColor;\n if (!fillColor) {\n fillColor = this._state.fillColor = new Float32Array(3);\n } else if (value && fillColor[0] === value[0] && fillColor[1] === value[1] && fillColor[2] === value[2]) {\n return;\n }\n if (value) {\n fillColor[0] = value[0];\n fillColor[1] = value[1];\n fillColor[2] = value[2];\n } else {\n fillColor[0] = 0.4;\n fillColor[1] = 0.4;\n fillColor[2] = 0.4;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB color of filled faces.\n *\n * Default is ````[0.4, 0.4, 0.4]````.\n *\n * @type {Number[]}\n */\n get fillColor() {\n return this._state.fillColor;\n }\n\n /**\n * Sets the transparency of filled faces.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default is ````0.2````.\n *\n * @type {Number}\n */\n set fillAlpha(value) {\n value = (value !== undefined && value !== null) ? value : 0.2;\n if (this._state.fillAlpha === value) {\n return;\n }\n this._state.fillAlpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets the transparency of filled faces.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default is ````0.2````.\n *\n * @type {Number}\n */\n get fillAlpha() {\n return this._state.fillAlpha;\n }\n\n /**\n * Sets if edges are visible.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set edges(value) {\n value = value !== false;\n if (this._state.edges === value) {\n return;\n }\n this._state.edges = value;\n this.glRedraw();\n }\n\n /**\n * Gets if edges are visible.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get edges() {\n return this._state.edges;\n }\n\n /**\n * Sets the RGB color of edges.\n *\n * Default is ```` [0.2, 0.2, 0.2]````.\n *\n * @type {Number[]}\n */\n set edgeColor(value) {\n let edgeColor = this._state.edgeColor;\n if (!edgeColor) {\n edgeColor = this._state.edgeColor = new Float32Array(3);\n } else if (value && edgeColor[0] === value[0] && edgeColor[1] === value[1] && edgeColor[2] === value[2]) {\n return;\n }\n if (value) {\n edgeColor[0] = value[0];\n edgeColor[1] = value[1];\n edgeColor[2] = value[2];\n } else {\n edgeColor[0] = 0.2;\n edgeColor[1] = 0.2;\n edgeColor[2] = 0.2;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB color of edges.\n *\n * Default is ```` [0.2, 0.2, 0.2]````.\n *\n * @type {Number[]}\n */\n get edgeColor() {\n return this._state.edgeColor;\n }\n\n /**\n * Sets the transparency of edges.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default is ````0.2````.\n *\n * @type {Number}\n */\n set edgeAlpha(value) {\n value = (value !== undefined && value !== null) ? value : 0.5;\n if (this._state.edgeAlpha === value) {\n return;\n }\n this._state.edgeAlpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets the transparency of edges.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default is ````0.2````.\n *\n * @type {Number}\n */\n get edgeAlpha() {\n return this._state.edgeAlpha;\n }\n\n /**\n * Sets edge width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n set edgeWidth(value) {\n this._state.edgeWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets edge width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n get edgeWidth() {\n return this._state.edgeWidth;\n }\n\n /**\n * Sets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n set backfaces(value) {\n value = !!value;\n if (this._state.backfaces === value) {\n return;\n }\n this._state.backfaces = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._state.backfaces;\n }\n\n /**\n * Sets whether to render emphasized objects over the top of other objects, as if they were \"glowing through\".\n *\n * Default is ````true````.\n *\n * Note: updating this property will not affect the appearance of objects that are already emphasized.\n *\n * @type {Boolean}\n */\n set glowThrough(value) {\n value = (value !== false);\n if (this._state.glowThrough === value) {\n return;\n }\n this._state.glowThrough = value;\n this.glRedraw();\n }\n\n /**\n * Sets whether to render emphasized objects over the top of other objects, as if they were \"glowing through\".\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n get glowThrough() {\n return this._state.glowThrough;\n }\n\n /**\n * Selects a preset EmphasisMaterial configuration.\n *\n * Default value is \"default\".\n *\n * @type {String}\n */\n set preset(value) {\n value = value || \"default\";\n if (this._preset === value) {\n return;\n }\n const preset = PRESETS[value];\n if (!preset) {\n this.error(\"unsupported preset: '\" + value + \"' - supported values are \" + Object.keys(PRESETS).join(\", \"));\n return;\n }\n this.fill = preset.fill;\n this.fillColor = preset.fillColor;\n this.fillAlpha = preset.fillAlpha;\n this.edges = preset.edges;\n this.edgeColor = preset.edgeColor;\n this.edgeAlpha = preset.edgeAlpha;\n this.edgeWidth = preset.edgeWidth;\n this.glowThrough = preset.glowThrough;\n this._preset = value;\n }\n\n /**\n * Gets the current preset EmphasisMaterial configuration.\n *\n * Default value is \"default\".\n *\n * @type {String}\n */\n get preset() {\n return this._preset;\n }\n\n /**\n * Destroys this EmphasisMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {EmphasisMaterial};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/EmphasisMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/EmphasisMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3937, + "__docId__": 3945, "kind": "variable", "name": "PRESETS", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js", @@ -79207,7 +79423,7 @@ "ignore": true }, { - "__docId__": 3938, + "__docId__": 3946, "kind": "class", "name": "EmphasisMaterial", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js", @@ -79225,7 +79441,7 @@ ] }, { - "__docId__": 3939, + "__docId__": 3947, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79244,7 +79460,7 @@ } }, { - "__docId__": 3940, + "__docId__": 3948, "kind": "get", "name": "presets", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79265,7 +79481,7 @@ } }, { - "__docId__": 3941, + "__docId__": 3949, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79442,7 +79658,7 @@ ] }, { - "__docId__": 3942, + "__docId__": 3950, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79460,7 +79676,7 @@ } }, { - "__docId__": 3943, + "__docId__": 3951, "kind": "member", "name": "_preset", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79478,7 +79694,7 @@ } }, { - "__docId__": 3963, + "__docId__": 3971, "kind": "set", "name": "fill", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79499,7 +79715,7 @@ } }, { - "__docId__": 3964, + "__docId__": 3972, "kind": "get", "name": "fill", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79520,7 +79736,7 @@ } }, { - "__docId__": 3965, + "__docId__": 3973, "kind": "set", "name": "fillColor", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79541,7 +79757,7 @@ } }, { - "__docId__": 3966, + "__docId__": 3974, "kind": "get", "name": "fillColor", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79562,7 +79778,7 @@ } }, { - "__docId__": 3967, + "__docId__": 3975, "kind": "set", "name": "fillAlpha", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79583,7 +79799,7 @@ } }, { - "__docId__": 3968, + "__docId__": 3976, "kind": "get", "name": "fillAlpha", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79604,7 +79820,7 @@ } }, { - "__docId__": 3969, + "__docId__": 3977, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79625,7 +79841,7 @@ } }, { - "__docId__": 3970, + "__docId__": 3978, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79646,7 +79862,7 @@ } }, { - "__docId__": 3971, + "__docId__": 3979, "kind": "set", "name": "edgeColor", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79667,7 +79883,7 @@ } }, { - "__docId__": 3972, + "__docId__": 3980, "kind": "get", "name": "edgeColor", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79688,7 +79904,7 @@ } }, { - "__docId__": 3973, + "__docId__": 3981, "kind": "set", "name": "edgeAlpha", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79709,7 +79925,7 @@ } }, { - "__docId__": 3974, + "__docId__": 3982, "kind": "get", "name": "edgeAlpha", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79730,7 +79946,7 @@ } }, { - "__docId__": 3975, + "__docId__": 3983, "kind": "set", "name": "edgeWidth", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79751,7 +79967,7 @@ } }, { - "__docId__": 3976, + "__docId__": 3984, "kind": "get", "name": "edgeWidth", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79772,7 +79988,7 @@ } }, { - "__docId__": 3977, + "__docId__": 3985, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79793,7 +80009,7 @@ } }, { - "__docId__": 3978, + "__docId__": 3986, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79814,7 +80030,7 @@ } }, { - "__docId__": 3979, + "__docId__": 3987, "kind": "set", "name": "glowThrough", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79835,7 +80051,7 @@ } }, { - "__docId__": 3980, + "__docId__": 3988, "kind": "get", "name": "glowThrough", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79856,7 +80072,7 @@ } }, { - "__docId__": 3981, + "__docId__": 3989, "kind": "set", "name": "preset", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79877,7 +80093,7 @@ } }, { - "__docId__": 3991, + "__docId__": 3999, "kind": "get", "name": "preset", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79898,7 +80114,7 @@ } }, { - "__docId__": 3992, + "__docId__": 4000, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/EmphasisMaterial.js~EmphasisMaterial", @@ -79913,18 +80129,18 @@ "return": null }, { - "__docId__": 3993, + "__docId__": 4001, "kind": "file", "name": "src/viewer/scene/materials/Fresnel.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc Configures Fresnel effects for {@link PhongMaterial}s.\n *\n * Fresnels are attached to {@link PhongMaterial}s, which are attached to {@link Mesh}es.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a {@link PhongMaterial} that applies a Fresnel to its alpha channel to give a glasss-like effect.\n *\n * [[Run this example](/examples/index.html#materials_Fresnel)]\n *\n * ````javascript\n * import {Viewer, Mesh, buildTorusGeometry,\n * ReadableGeometry, PhongMaterial, Texture, Fresnel} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * alpha: 0.9,\n * alphaMode: \"blend\",\n * ambient: [0.0, 0.0, 0.0],\n * shininess: 30,\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * alphaFresnel: new Fresnel(viewer.scene, {\nv edgeBias: 0.2,\n * centerBias: 0.8,\n * edgeColor: [1.0, 1.0, 1.0],\n * centerColor: [0.0, 0.0, 0.0],\n * power: 2\n * })\n * })\n * });\n * ````\n */\nclass Fresnel extends Component {\n\n /**\n * JavaScript class name for this Component.\n *\n * @type {String}\n */\n get type() {\n return \"Fresnel\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this Fresnel as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.\n * @param {Number[]} [cfg.edgeColor=[ 0.0, 0.0, 0.0 ]] Color used on edges.\n * @param {Number[]} [cfg.centerColor=[ 1.0, 1.0, 1.0 ]] Color used on center.\n * @param {Number} [cfg.edgeBias=0] Bias at the edge.\n * @param {Number} [cfg.centerBias=1] Bias at the center.\n * @param {Number} [cfg.power=0] The power.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n edgeColor: math.vec3([0, 0, 0]),\n centerColor: math.vec3([1, 1, 1]),\n edgeBias: 0,\n centerBias: 1,\n power: 1\n });\n\n this.edgeColor = cfg.edgeColor;\n this.centerColor = cfg.centerColor;\n this.edgeBias = cfg.edgeBias;\n this.centerBias = cfg.centerBias;\n this.power = cfg.power;\n }\n\n /**\n * Sets the Fresnel's edge color.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n set edgeColor(value) {\n this._state.edgeColor.set(value || [0.0, 0.0, 0.0]);\n this.glRedraw();\n }\n\n /**\n * Gets the Fresnel's edge color.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n get edgeColor() {\n return this._state.edgeColor;\n }\n\n /**\n * Sets the Fresnel's center color.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n set centerColor(value) {\n this._state.centerColor.set(value || [1.0, 1.0, 1.0]);\n this.glRedraw();\n }\n\n /**\n * Gets the Fresnel's center color.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n get centerColor() {\n return this._state.centerColor;\n }\n\n /**\n * Sets the Fresnel's edge bias.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n set edgeBias(value) {\n this._state.edgeBias = value || 0;\n this.glRedraw();\n }\n\n /**\n * Gets the Fresnel's edge bias.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n get edgeBias() {\n return this._state.edgeBias;\n }\n\n /**\n * Sets the Fresnel's center bias.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n set centerBias(value) {\n this._state.centerBias = (value !== undefined && value !== null) ? value : 1;\n this.glRedraw();\n }\n\n /**\n * Gets the Fresnel's center bias.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get centerBias() {\n return this._state.centerBias;\n }\n\n /**\n * Sets the Fresnel's power.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n set power(value) {\n this._state.power = (value !== undefined && value !== null) ? value : 1;\n this.glRedraw();\n }\n\n /**\n * Gets the Fresnel's power.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get power() {\n return this._state.power;\n }\n\n /**\n * Destroys this Fresnel.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {Fresnel};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/Fresnel.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/Fresnel.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 3994, + "__docId__": 4002, "kind": "class", "name": "Fresnel", "memberof": "src/viewer/scene/materials/Fresnel.js", @@ -79942,7 +80158,7 @@ ] }, { - "__docId__": 3995, + "__docId__": 4003, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -79963,7 +80179,7 @@ } }, { - "__docId__": 3996, + "__docId__": 4004, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80082,7 +80298,7 @@ ] }, { - "__docId__": 3997, + "__docId__": 4005, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80100,7 +80316,7 @@ } }, { - "__docId__": 4003, + "__docId__": 4011, "kind": "set", "name": "edgeColor", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80121,7 +80337,7 @@ } }, { - "__docId__": 4004, + "__docId__": 4012, "kind": "get", "name": "edgeColor", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80142,7 +80358,7 @@ } }, { - "__docId__": 4005, + "__docId__": 4013, "kind": "set", "name": "centerColor", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80163,7 +80379,7 @@ } }, { - "__docId__": 4006, + "__docId__": 4014, "kind": "get", "name": "centerColor", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80184,7 +80400,7 @@ } }, { - "__docId__": 4007, + "__docId__": 4015, "kind": "set", "name": "edgeBias", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80205,7 +80421,7 @@ } }, { - "__docId__": 4008, + "__docId__": 4016, "kind": "get", "name": "edgeBias", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80226,7 +80442,7 @@ } }, { - "__docId__": 4009, + "__docId__": 4017, "kind": "set", "name": "centerBias", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80247,7 +80463,7 @@ } }, { - "__docId__": 4010, + "__docId__": 4018, "kind": "get", "name": "centerBias", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80268,7 +80484,7 @@ } }, { - "__docId__": 4011, + "__docId__": 4019, "kind": "set", "name": "power", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80289,7 +80505,7 @@ } }, { - "__docId__": 4012, + "__docId__": 4020, "kind": "get", "name": "power", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80310,7 +80526,7 @@ } }, { - "__docId__": 4013, + "__docId__": 4021, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/Fresnel.js~Fresnel", @@ -80325,18 +80541,18 @@ "return": null }, { - "__docId__": 4014, + "__docId__": 4022, "kind": "file", "name": "src/viewer/scene/materials/LambertMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\n/**\n * @desc Configures the normal rendered appearance of {@link Mesh}es using the non-realistic but GPU-efficient Lambertian flat shading model for calculating reflectance.\n *\n * * Useful for efficiently rendering non-realistic objects for high-detail CAD.\n * * Use {@link PhongMaterial} when you need specular highlights.\n * * Use the physically-based {@link MetallicMaterial} or {@link SpecularMaterial} when you need more realism.\n * * For LambertMaterial, the illumination calculation is performed at each triangle vertex, and the resulting color is interpolated across the face of the triangle. For {@link PhongMaterial}, {@link MetallicMaterial} and\n * {@link SpecularMaterial}, vertex normals are interpolated across the surface of the triangle, and the illumination calculation is performed at each texel.\n *\n * ## Usage\n *\n * [[Run this example](/examples/index.html#materials_LambertMaterial)]\n *\n * In the example below we'll create a {@link Mesh} with a shape defined by a {@link buildTorusGeometry} and normal rendering appearance configured with a LambertMaterial.\n *\n * ```` javascript\n * import {Viewer, Mesh, buildTorusGeometry, ReadableGeometry, LambertMaterial} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 12,\n * tubeSegments: 8,\n * arc: Math.PI * 2.0\n * }),\n * material: new LambertMaterial(viewer.scene, {\n * ambient: [0.3, 0.3, 0.3],\n * color: [0.5, 0.5, 0.0],\n * alpha: 1.0, // Default\n * lineWidth: 1,\n * pointSize: 1,\n * backfaces: false,\n * frontFace: \"ccw\"\n * })\n * });\n * ````\n *\n * ## LambertMaterial Properties\n *\n * The following table summarizes LambertMaterial properties:\n *\n * | Property | Type | Range | Default Value | Space | Description |\n * |:--------:|:----:|:-----:|:-------------:|:-----:|:-----------:|\n * | {@link LambertMaterial#ambient} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the ambient light reflected by the material. |\n * | {@link LambertMaterial#color} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the diffuse light reflected by the material. |\n * | {@link LambertMaterial#emissive} | Array | [0, 1] for all components | [0,0,0] | linear | The RGB components of the light emitted by the material. |\n * | {@link LambertMaterial#alpha} | Number | [0, 1] | 1 | linear | The transparency of the material surface (0 fully transparent, 1 fully opaque). |\n * | {@link LambertMaterial#lineWidth} | Number | [0..100] | 1 | | Line width in pixels. |\n * | {@link LambertMaterial#pointSize} | Number | [0..100] | 1 | | Point size in pixels. |\n * | {@link LambertMaterial#backfaces} | Boolean | | false | | Whether to render {@link Geometry} backfaces. |\n * | {@link LambertMaterial#frontface} | String | \"ccw\", \"cw\" | \"ccw\" | | The winding order for {@link Geometry} frontfaces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise. |\n *\n */\nclass LambertMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"LambertMaterial\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The LambertMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {String:Object} [cfg.meta=null] Metadata to attach to this LambertMaterial.\n * @param {Number[]} [cfg.ambient=[1.0, 1.0, 1.0 ]] LambertMaterial ambient color.\n * @param {Number[]} [cfg.color=[ 1.0, 1.0, 1.0 ]] LambertMaterial diffuse color.\n * @param {Number[]} [cfg.emissive=[ 0.0, 0.0, 0.0 ]] LambertMaterial emissive color.\n * @param {Number} [cfg.alpha=1]Scalar in range 0-1 that controls alpha, where 0 is completely transparent and 1 is completely opaque.\n * @param {Number} [cfg.reflectivity=1]Scalar in range 0-1 that controls how much {@link ReflectionMap} is reflected.\n * @param {Number} [cfg.lineWidth=1] Scalar that controls the width of {@link Geometry} lines.\n * @param {Number} [cfg.pointSize=1] Scalar that controls the size of points for {@link Geometry} with {@link Geometry#primitive} set to \"points\".\n * @param {Boolean} [cfg.backfaces=false] Whether to render {@link Geometry} backfaces.\n * @param {Boolean} [cfg.frontface=\"ccw\"] The winding order for {@link Geometry} front faces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"LambertMaterial\",\n ambient: math.vec3([1.0, 1.0, 1.0]),\n color: math.vec3([1.0, 1.0, 1.0]),\n emissive: math.vec3([0.0, 0.0, 0.0]),\n alpha: null,\n alphaMode: 0, // 2 (\"blend\") when transparent, so renderer knows when to add to transparency bin\n lineWidth: null,\n pointSize: null,\n backfaces: null,\n frontface: null, // Boolean for speed; true == \"ccw\", false == \"cw\"\n hash: \"/lam;\"\n });\n\n this.ambient = cfg.ambient;\n this.color = cfg.color;\n this.emissive = cfg.emissive;\n this.alpha = cfg.alpha;\n this.lineWidth = cfg.lineWidth;\n this.pointSize = cfg.pointSize;\n this.backfaces = cfg.backfaces;\n this.frontface = cfg.frontface;\n }\n\n /**\n * Sets the LambertMaterial's ambient color.\n *\n * Default value is ````[0.3, 0.3, 0.3]````.\n *\n * @type {Number[]}\n */\n set ambient(value) {\n let ambient = this._state.ambient;\n if (!ambient) {\n ambient = this._state.ambient = new Float32Array(3);\n } else if (value && ambient[0] === value[0] && ambient[1] === value[1] && ambient[2] === value[2]) {\n return;\n }\n if (value) {\n ambient[0] = value[0];\n ambient[1] = value[1];\n ambient[2] = value[2];\n } else {\n ambient[0] = .2;\n ambient[1] = .2;\n ambient[2] = .2;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the LambertMaterial's ambient color.\n *\n * Default value is ````[0.3, 0.3, 0.3]````.\n *\n * @type {Number[]}\n */\n get ambient() {\n return this._state.ambient;\n }\n\n /**\n * Sets the LambertMaterial's diffuse color.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n set color(value) {\n let color = this._state.color;\n if (!color) {\n color = this._state.color = new Float32Array(3);\n } else if (value && color[0] === value[0] && color[1] === value[1] && color[2] === value[2]) {\n return;\n }\n if (value) {\n color[0] = value[0];\n color[1] = value[1];\n color[2] = value[2];\n } else {\n color[0] = 1;\n color[1] = 1;\n color[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the LambertMaterial's diffuse color.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n get color() {\n return this._state.color;\n }\n\n /**\n * Sets the LambertMaterial's emissive color.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n set emissive(value) {\n let emissive = this._state.emissive;\n if (!emissive) {\n emissive = this._state.emissive = new Float32Array(3);\n } else if (value && emissive[0] === value[0] && emissive[1] === value[1] && emissive[2] === value[2]) {\n return;\n }\n if (value) {\n emissive[0] = value[0];\n emissive[1] = value[1];\n emissive[2] = value[2];\n } else {\n emissive[0] = 0;\n emissive[1] = 0;\n emissive[2] = 0;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the LambertMaterial's emissive color.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n get emissive() {\n return this._state.emissive;\n }\n\n /**\n * Sets factor in the range ````[0..1]```` indicating how transparent the LambertMaterial is.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default value is ````1.0````\n *\n * @type {Number}\n */\n set alpha(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.alpha === value) {\n return;\n }\n this._state.alpha = value;\n this._state.alphaMode = value < 1.0 ? 2 /* blend */ : 0\n /* opaque */\n this.glRedraw();\n }\n\n /**\n * Gets factor in the range ````[0..1]```` indicating how transparent the LambertMaterial is.\n *\n * A value of ````0.0```` indicates fully transparent, ````1.0```` is fully opaque.\n *\n * Default value is ````1.0````\n *\n * @type {Number}\n */\n get alpha() {\n return this._state.alpha;\n }\n\n /**\n * Sets the LambertMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set lineWidth(value) {\n this._state.lineWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the LambertMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get lineWidth() {\n return this._state.lineWidth;\n }\n\n /**\n * Sets the LambertMaterial's point size.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set pointSize(value) {\n this._state.pointSize = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the LambertMaterial's point size.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get pointSize() {\n return this._state.pointSize;\n }\n\n /**\n * Sets whether backfaces are visible on attached {@link Mesh}es.\n *\n * @type {Boolean}\n */\n set backfaces(value) {\n value = !!value;\n if (this._state.backfaces === value) {\n return;\n }\n this._state.backfaces = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether backfaces are visible on attached {@link Mesh}es.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._state.backfaces;\n }\n\n /**\n * Sets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n *\n * Default value is ````\"ccw\"````.\n *\n * @type {String}\n */\n set frontface(value) {\n value = value !== \"cw\";\n if (this._state.frontface === value) {\n return;\n }\n this._state.frontface = value;\n this.glRedraw();\n }\n\n /**\n * Gets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n *\n * Default value is ````\"ccw\"````.\n *\n * @type {String}\n */\n get frontface() {\n return this._state.frontface ? \"ccw\" : \"cw\";\n }\n\n _getState() {\n return this._state;\n }\n\n /**\n * Destroys this LambertMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {LambertMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/LambertMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/LambertMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4015, + "__docId__": 4023, "kind": "class", "name": "LambertMaterial", "memberof": "src/viewer/scene/materials/LambertMaterial.js", @@ -80354,7 +80570,7 @@ ] }, { - "__docId__": 4016, + "__docId__": 4024, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80373,7 +80589,7 @@ } }, { - "__docId__": 4017, + "__docId__": 4025, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80556,7 +80772,7 @@ ] }, { - "__docId__": 4018, + "__docId__": 4026, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80574,7 +80790,7 @@ } }, { - "__docId__": 4027, + "__docId__": 4035, "kind": "set", "name": "ambient", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80595,7 +80811,7 @@ } }, { - "__docId__": 4028, + "__docId__": 4036, "kind": "get", "name": "ambient", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80616,7 +80832,7 @@ } }, { - "__docId__": 4029, + "__docId__": 4037, "kind": "set", "name": "color", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80637,7 +80853,7 @@ } }, { - "__docId__": 4030, + "__docId__": 4038, "kind": "get", "name": "color", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80658,7 +80874,7 @@ } }, { - "__docId__": 4031, + "__docId__": 4039, "kind": "set", "name": "emissive", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80679,7 +80895,7 @@ } }, { - "__docId__": 4032, + "__docId__": 4040, "kind": "get", "name": "emissive", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80700,7 +80916,7 @@ } }, { - "__docId__": 4033, + "__docId__": 4041, "kind": "set", "name": "alpha", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80721,7 +80937,7 @@ } }, { - "__docId__": 4034, + "__docId__": 4042, "kind": "get", "name": "alpha", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80742,7 +80958,7 @@ } }, { - "__docId__": 4035, + "__docId__": 4043, "kind": "set", "name": "lineWidth", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80763,7 +80979,7 @@ } }, { - "__docId__": 4036, + "__docId__": 4044, "kind": "get", "name": "lineWidth", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80784,7 +81000,7 @@ } }, { - "__docId__": 4037, + "__docId__": 4045, "kind": "set", "name": "pointSize", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80805,7 +81021,7 @@ } }, { - "__docId__": 4038, + "__docId__": 4046, "kind": "get", "name": "pointSize", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80826,7 +81042,7 @@ } }, { - "__docId__": 4039, + "__docId__": 4047, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80847,7 +81063,7 @@ } }, { - "__docId__": 4040, + "__docId__": 4048, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80868,7 +81084,7 @@ } }, { - "__docId__": 4041, + "__docId__": 4049, "kind": "set", "name": "frontface", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80889,7 +81105,7 @@ } }, { - "__docId__": 4042, + "__docId__": 4050, "kind": "get", "name": "frontface", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80910,7 +81126,7 @@ } }, { - "__docId__": 4043, + "__docId__": 4051, "kind": "method", "name": "_getState", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80931,7 +81147,7 @@ } }, { - "__docId__": 4044, + "__docId__": 4052, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/LambertMaterial.js~LambertMaterial", @@ -80946,18 +81162,18 @@ "return": null }, { - "__docId__": 4045, + "__docId__": 4053, "kind": "file", "name": "src/viewer/scene/materials/LinesMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\nconst PRESETS = {\n \"default\": {\n lineWidth: 1\n },\n \"thick\": {\n lineWidth: 2\n },\n \"thicker\": {\n lineWidth: 4\n }\n};\n\n/**\n * @desc Configures the shape of \"lines\" geometry primitives.\n *\n * * Located at {@link Scene#linesMaterial}.\n * * Globally configures \"lines\" primitives for all {@link VBOSceneModel}s.\n *\n * ## Usage\n *\n * In the example below, we'll customize the {@link Scene}'s global ````LinesMaterial````, then use\n * an {@link XKTLoaderPlugin} to load a model containing line segments.\n *\n * [[Run this example](/examples/index.html#materials_LinesMaterial)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * viewer.scene.linesMaterial.lineWidth = 3;\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/Duplex.ifc.xkt\"\n * });\n * ````\n */\nclass LinesMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"LinesMaterial\";\n }\n\n /**\n * Gets available LinesMaterial presets.\n *\n * @type {Object}\n */\n get presets() {\n return PRESETS;\n };\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The LinesMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number} [cfg.lineWidth=1] Line width in pixels.\n * @param {String} [cfg.preset] Selects a preset LinesMaterial configuration - see {@link LinesMaterial#presets}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"LinesMaterial\",\n lineWidth: null\n });\n\n if (cfg.preset) { // Apply preset then override with configs where provided\n this.preset = cfg.preset;\n if (cfg.lineWidth !== undefined) {\n this.lineWidth = cfg.lineWidth;\n }\n } else {\n this._preset = \"default\";\n this.lineWidth = cfg.lineWidth;\n }\n }\n\n /**\n * Sets line width.\n *\n * Default value is ````1```` pixels.\n *\n * @type {Number}\n */\n set lineWidth(value) {\n this._state.lineWidth = value || 1;\n this.glRedraw();\n }\n\n /**\n * Gets the line width.\n *\n * Default value is ````1```` pixels.\n *\n * @type {Number}\n */\n get lineWidth() {\n return this._state.lineWidth;\n }\n\n /**\n * Selects a preset LinesMaterial configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n set preset(value) {\n value = value || \"default\";\n if (this._preset === value) {\n return;\n }\n const preset = PRESETS[value];\n if (!preset) {\n this.error(\"unsupported preset: '\" + value + \"' - supported values are \" + Object.keys(PRESETS).join(\", \"));\n return;\n }\n this.lineWidth = preset.lineWidth;\n this._preset = value;\n }\n\n /**\n * The current preset LinesMaterial configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n get preset() {\n return this._preset;\n }\n\n /**\n * @private\n * @return {string}\n */\n get hash() {\n return [\"\" + this.lineWidth].join((\";\"));\n }\n\n /**\n * Destroys this LinesMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {LinesMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/LinesMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/LinesMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4046, + "__docId__": 4054, "kind": "variable", "name": "PRESETS", "memberof": "src/viewer/scene/materials/LinesMaterial.js", @@ -80978,7 +81194,7 @@ "ignore": true }, { - "__docId__": 4047, + "__docId__": 4055, "kind": "class", "name": "LinesMaterial", "memberof": "src/viewer/scene/materials/LinesMaterial.js", @@ -80996,7 +81212,7 @@ ] }, { - "__docId__": 4048, + "__docId__": 4056, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81015,7 +81231,7 @@ } }, { - "__docId__": 4049, + "__docId__": 4057, "kind": "get", "name": "presets", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81036,7 +81252,7 @@ } }, { - "__docId__": 4050, + "__docId__": 4058, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81109,7 +81325,7 @@ ] }, { - "__docId__": 4051, + "__docId__": 4059, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81127,7 +81343,7 @@ } }, { - "__docId__": 4054, + "__docId__": 4062, "kind": "member", "name": "_preset", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81145,7 +81361,7 @@ } }, { - "__docId__": 4056, + "__docId__": 4064, "kind": "set", "name": "lineWidth", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81166,7 +81382,7 @@ } }, { - "__docId__": 4057, + "__docId__": 4065, "kind": "get", "name": "lineWidth", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81187,7 +81403,7 @@ } }, { - "__docId__": 4058, + "__docId__": 4066, "kind": "set", "name": "preset", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81208,7 +81424,7 @@ } }, { - "__docId__": 4061, + "__docId__": 4069, "kind": "get", "name": "preset", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81229,7 +81445,7 @@ } }, { - "__docId__": 4062, + "__docId__": 4070, "kind": "get", "name": "hash", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81256,7 +81472,7 @@ } }, { - "__docId__": 4063, + "__docId__": 4071, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/LinesMaterial.js~LinesMaterial", @@ -81271,18 +81487,18 @@ "return": null }, { - "__docId__": 4064, + "__docId__": 4072, "kind": "file", "name": "src/viewer/scene/materials/Material.js", "content": "/**\n * @desc A **Material** defines the surface appearance of attached {@link Mesh}es.\n *\n * Material is the base class for:\n *\n * * {@link MetallicMaterial} - physically-based material for metallic surfaces. Use this one for things made of metal.\n * * {@link SpecularMaterial} - physically-based material for non-metallic (dielectric) surfaces. Use this one for insulators, such as ceramics, plastics, wood etc.\n * * {@link PhongMaterial} - material for classic Blinn-Phong shading. This is less demanding of graphics hardware than the physically-based materials.\n * * {@link LambertMaterial} - material for fast, flat-shaded CAD rendering without textures. Use this for navigating huge CAD or BIM models interactively. This material gives the best rendering performance and uses the least memory.\n * * {@link EmphasisMaterial} - defines the appearance of Meshes when \"xrayed\" or \"highlighted\".\n * * {@link EdgeMaterial} - defines the appearance of Meshes when edges are emphasized.\n *\n * A {@link Scene} is allowed to contain a mixture of these material types.\n *\n */\nimport {Component} from '../Component.js';\nimport {stats} from '../stats.js';\n\nclass Material extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Material\";\n }\n\n constructor(owner, cfg={}) {\n super(owner, cfg);\n stats.memory.materials++;\n }\n\n destroy() {\n super.destroy();\n stats.memory.materials--;\n }\n}\n\nexport {Material};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/Material.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/Material.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4065, + "__docId__": 4073, "kind": "class", "name": "Material", "memberof": "src/viewer/scene/materials/Material.js", @@ -81301,7 +81517,7 @@ ] }, { - "__docId__": 4066, + "__docId__": 4074, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/Material.js~Material", @@ -81320,7 +81536,7 @@ } }, { - "__docId__": 4067, + "__docId__": 4075, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/Material.js~Material", @@ -81334,7 +81550,7 @@ "undocument": true }, { - "__docId__": 4068, + "__docId__": 4076, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/Material.js~Material", @@ -81350,18 +81566,18 @@ "return": null }, { - "__docId__": 4069, + "__docId__": 4077, "kind": "file", "name": "src/viewer/scene/materials/MetallicMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\nconst modes = {\"opaque\": 0, \"mask\": 1, \"blend\": 2};\nconst modeNames = [\"opaque\", \"mask\", \"blend\"];\n\n/**\n * @desc Configures the normal rendered appearance of {@link Mesh}es using the physically-accurate *metallic-roughness* shading model.\n *\n * * Useful for conductive materials, such as metal, but also appropriate for insulators.\n * * {@link SpecularMaterial} is best for insulators, such as wood, ceramics and plastic.\n * * {@link PhongMaterial} is appropriate for non-realistic objects.\n * * {@link LambertMaterial} is appropriate for high-detail models that need to render as efficiently as possible.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with {@link MetallicMaterial} and {@link ReadableGeometry} loaded from OBJ.\n *\n * Note that in this example we're providing separate {@link Texture} for the {@link MetallicMaterial#metallic} and {@link MetallicMaterial#roughness}\n * channels, which allows us a little creative flexibility. Then, in the next example further down, we'll combine those channels\n * within the same {@link Texture} for efficiency.\n *\n * [[Run this example](/examples/index.html#materials_MetallicMaterial)]\n *\n * ````javascript\n * import {Viewer, Mesh, loadOBJGeometry, ReadableGeometry, MetallicMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0.57, 1.37, 1.14];\n * viewer.scene.camera.look = [0.04, 0.58, 0.00];\n * viewer.scene.camera.up = [-0.22, 0.84, -0.48];\n *\n * loadOBJGeometry(viewer.scene, {\n * src: \"models/obj/fireHydrant/FireHydrantMesh.obj\"\n * })\n * .then(function (geometry) {\n *\n * // Success\n *\n * new Mesh(viewer.scene, {\n *\n * geometry: new ReadableGeometry(viewer.scene, geometry),\n *\n * material: new MetallicMaterial(viewer.scene, {\n *\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0,\n *\n * baseColorMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Base_Color.png\",\n * encoding: \"sRGB\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Normal_OpenGL.png\"\n * }),\n * roughnessMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Roughness.png\"\n * }),\n * metallicMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Metallic.png\"\n * }),\n * occlusionMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Mixed_AO.png\"\n * }),\n *\n * specularF0: 0.7\n * })\n * });\n * }, function () {\n * // Error\n * });\n * ````\n *\n * ## Background Theory\n *\n * For an introduction to physically-based rendering (PBR) concepts, try these articles:\n *\n * * Joe Wilson's [Basic Theory of Physically-Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)\n * * Jeff Russel's [Physically-based Rendering, and you can too!](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)\n * * Sebastien Legarde's [Adapting a physically-based shading model](http://seblagarde.wordpress.com/tag/physically-based-rendering/)\n *\n * ## MetallicMaterial Properties\n *\n * The following table summarizes MetallicMaterial properties:\n *\n * | Property | Type | Range | Default Value | Space | Description |\n * |:--------:|:----:|:-----:|:-------------:|:-----:|:-----------:|\n * | {@link MetallicMaterial#baseColor} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the base color of the material. |\n * | {@link MetallicMaterial#metallic} | Number | [0, 1] | 1 | linear | The metallic-ness the material (1 for metals, 0 for non-metals). |\n * | {@link MetallicMaterial#roughness} | Number | [0, 1] | 1 | linear | The roughness of the material surface. |\n * | {@link MetallicMaterial#specularF0} | Number | [0, 1] | 1 | linear | The specular Fresnel of the material surface. |\n * | {@link MetallicMaterial#emissive} | Array | [0, 1] for all components | [0,0,0] | linear | The RGB components of the emissive color of the material. |\n * | {@link MetallicMaterial#alpha} | Number | [0, 1] | 1 | linear | The transparency of the material surface (0 fully transparent, 1 fully opaque). |\n * | {@link MetallicMaterial#baseColorMap} | {@link Texture} | | null | sRGB | Texture RGB components multiplying by {@link MetallicMaterial#baseColor}. If the fourth component (A) is present, it multiplies by {@link MetallicMaterial#alpha}. |\n * | {@link MetallicMaterial#metallicMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link MetallicMaterial#metallic}. |\n * | {@link MetallicMaterial#roughnessMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link MetallicMaterial#roughness}. |\n * | {@link MetallicMaterial#metallicRoughnessMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link MetallicMaterial#metallic} and second component multiplying by {@link MetallicMaterial#roughness}. |\n * | {@link MetallicMaterial#emissiveMap} | {@link Texture} | | null | linear | Texture with RGB components multiplying by {@link MetallicMaterial#emissive}. |\n * | {@link MetallicMaterial#alphaMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link MetallicMaterial#alpha}. |\n * | {@link MetallicMaterial#occlusionMap} | {@link Texture} | | null | linear | Ambient occlusion texture multiplying by surface's reflected diffuse and specular light. |\n * | {@link MetallicMaterial#normalMap} | {@link Texture} | | null | linear | Tangent-space normal map. |\n * | {@link MetallicMaterial#alphaMode} | String | \"opaque\", \"blend\", \"mask\" | \"blend\" | | Alpha blend mode. |\n * | {@link MetallicMaterial#alphaCutoff} | Number | [0..1] | 0.5 | | Alpha cutoff value. |\n * | {@link MetallicMaterial#backfaces} | Boolean | | false | | Whether to render {@link ReadableGeometry} backfaces. |\n * | {@link MetallicMaterial#frontface} | String | \"ccw\", \"cw\" | \"ccw\" | | The winding order for {@link ReadableGeometry} frontfaces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise. |\n *\n *\n * ## Combining Channels Within the Same Textures\n *\n * In the previous example we provided separate {@link Texture} for the {@link MetallicMaterial#metallic} and\n * {@link MetallicMaterial#roughness} channels, but we can combine those channels into the same {@link Texture} to\n * reduce download time, memory footprint and rendering time (and also for glTF compatibility).\n *\n * Here's the {@link Mesh} again, with our MetallicMaterial with those channels combined in the {@link MetallicMaterial#metallicRoughnessMap}\n * {@link Texture}, where the *R* component multiplies by {@link MetallicMaterial#metallic} and *G* multiplies\n * by {@link MetallicMaterial#roughness}.\n *\n * ````javascript\n * new Mesh(viewer.scene, {\n *\n * geometry: geometry,\n *\n * material: new MetallicMaterial(viewer.scene, {\n *\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0,\n *\n * baseColorMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Base_Color.png\",\n * encoding: \"sRGB\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Normal_OpenGL.png\"\n * }),\n * metallicRoughnessMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_MetallicRoughness.png\"\n * }),\n * metallicRoughnessMap : new Texture(viewer.scene, { // <<----------- Added\n * src: \"models/obj/fireHydrant/fire_hydrant_MetallicRoughness.png\" // R component multiplies by metallic\n * }), // G component multiplies by roughness\n * occlusionMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Mixed_AO.png\"\n * }),\n *\n * specularF0: 0.7\n * })\n * ````\n *\n * Although not shown in this example, we can also texture {@link MetallicMaterial#alpha} with the *A* component of\n * {@link MetallicMaterial#baseColorMap}'s {@link Texture}, if required.\n *\n * ## Alpha Blending\n *\n * Let's make our {@link Mesh} transparent.\n *\n * We'll update the {@link MetallicMaterial#alpha} and {@link MetallicMaterial#alphaMode}, causing it to blend 50%\n * with the background:\n *\n * ````javascript\n * hydrant.material.alpha = 0.5;\n * hydrant.material.alphaMode = \"blend\";\n * ````\n *\n * ## Alpha Masking\n *\n * Let's apply an alpha mask to our {@link Mesh}.\n *\n * We'll configure an {@link MetallicMaterial#alphaMap} to multiply by {@link MetallicMaterial#alpha},\n * with {@link MetallicMaterial#alphaMode} and {@link MetallicMaterial#alphaCutoff} to treat it as an alpha mask:\n *\n * ````javascript\n * new Mesh(viewer.scene, {\n *\n * geometry: geometry,\n *\n * material: new MetallicMaterial(viewer.scene, {\n *\n * baseColor: [1, 1, 1],\n * metallic: 1.0,\n * roughness: 1.0,\n * alpha: 1.0,\n * alphaMode : \"mask\", // <<---------------- Added\n * alphaCutoff : 0.2, // <<---------------- Added\n *\n * alphaMap : new Texture(viewer.scene{ // <<---------------- Added\n * src: \"textures/alphaMap.jpg\"\n * }),\n * baseColorMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Base_Color.png\",\n * encoding: \"sRGB\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Normal_OpenGL.png\"\n * }),\n * metallicRoughnessMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_MetallicRoughness.png\"\n * }),\n * metallicRoughnessMap : new Texture(viewer.scene, { // <<----------- Added\n * src: \"models/obj/fireHydrant/fire_hydrant_MetallicRoughness.png\" // R component multiplies by metallic\n * }), // G component multiplies by roughness\n * occlusionMap: new Texture(viewer.scene, {\n * src: \"models/obj/fireHydrant/fire_hydrant_Mixed_AO.png\"\n * }),\n *\n * specularF0: 0.7\n * })\n * ````\n */\nclass MetallicMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"MetallicMaterial\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this MetallicMaterial as well.\n * @param {*} [cfg] The MetallicMaterial configuration.\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.baseColor=[1,1,1]] RGB diffuse color of this MetallicMaterial. Multiplies by the RGB components of {@link MetallicMaterial#baseColorMap}.\n * @param {Number} [cfg.metallic=1.0] Factor in the range ````[0..1]```` indicating how metallic this MetallicMaterial is. ````1```` is metal, ````0```` is non-metal. Multiplies by the *R* component of {@link MetallicMaterial#metallicMap} and the *A* component of {@link MetallicMaterial#metallicRoughnessMap}.\n * @param {Number} [cfg.roughness=1.0] Factor in the range ````[0..1]```` indicating the roughness of this MetallicMaterial. ````0```` is fully smooth, ````1```` is fully rough. Multiplies by the *R* component of {@link MetallicMaterial#roughnessMap}.\n * @param {Number} [cfg.specularF0=0.0] Factor in the range ````[0..1]```` indicating specular Fresnel.\n * @param {Number[]} [cfg.emissive=[0,0,0]] RGB emissive color of this MetallicMaterial. Multiplies by the RGB components of {@link MetallicMaterial#emissiveMap}.\n * @param {Number} [cfg.alpha=1.0] Factor in the range ````[0..1]```` indicating the alpha of this MetallicMaterial. Multiplies by the *R* component of {@link MetallicMaterial#alphaMap} and the *A* component, if present, of {@link MetallicMaterial#baseColorMap}. The value of {@link MetallicMaterial#alphaMode} indicates how alpha is interpreted when rendering.\n * @param {Texture} [cfg.baseColorMap=undefined] RGBA {@link Texture} containing the diffuse color of this MetallicMaterial, with optional *A* component for alpha. The RGB components multiply by the {@link MetallicMaterial#baseColor} property, while the *A* component, if present, multiplies by the {@link MetallicMaterial#alpha} property.\n * @param {Texture} [cfg.alphaMap=undefined] RGB {@link Texture} containing this MetallicMaterial's alpha in its *R* component. The *R* component multiplies by the {@link MetallicMaterial#alpha} property. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.metallicMap=undefined] RGB {@link Texture} containing this MetallicMaterial's metallic factor in its *R* component. The *R* component multiplies by the {@link MetallicMaterial#metallic} property. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.roughnessMap=undefined] RGB {@link Texture} containing this MetallicMaterial's roughness factor in its *R* component. The *R* component multiplies by the {@link MetallicMaterial#roughness} property. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.metallicRoughnessMap=undefined] RGB {@link Texture} containing this MetallicMaterial's metalness in its *R* component and roughness in its *G* component. Its *R* component multiplies by the {@link MetallicMaterial#metallic} property, while its *G* component multiplies by the {@link MetallicMaterial#roughness} property. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.emissiveMap=undefined] RGB {@link Texture} containing the emissive color of this MetallicMaterial. Multiplies by the {@link MetallicMaterial#emissive} property. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.occlusionMap=undefined] RGB ambient occlusion {@link Texture}. Within shaders, multiplies by the specular and diffuse light reflected by surfaces. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {Texture} [cfg.normalMap=undefined] RGB tangent-space normal {@link Texture}. Must be within the same {@link Scene} as this MetallicMaterial.\n * @param {String} [cfg.alphaMode=\"opaque\"] The alpha blend mode, which specifies how alpha is to be interpreted. Accepted values are \"opaque\", \"blend\" and \"mask\". See the {@link MetallicMaterial#alphaMode} property for more info.\n * @param {Number} [cfg.alphaCutoff=0.5] The alpha cutoff value. See the {@link MetallicMaterial#alphaCutoff} property for more info.\n * @param {Boolean} [cfg.backfaces=false] Whether to render {@link ReadableGeometry} backfaces.\n * @param {Boolean} [cfg.frontface=\"ccw\"] The winding order for {@link ReadableGeometry} front faces - ````\"cw\"```` for clockwise, or ````\"ccw\"```` for counter-clockwise.\n * @param {Number} [cfg.lineWidth=1] Scalar that controls the width of lines for {@link ReadableGeometry} with {@link ReadableGeometry#primitive} set to \"lines\".\n * @param {Number} [cfg.pointSize=1] Scalar that controls the size of points for {@link ReadableGeometry} with {@link ReadableGeometry#primitive} set to \"points\".\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"MetallicMaterial\",\n baseColor: math.vec4([1.0, 1.0, 1.0]),\n emissive: math.vec4([0.0, 0.0, 0.0]),\n metallic: null,\n roughness: null,\n specularF0: null,\n alpha: null,\n alphaMode: null, // \"opaque\"\n alphaCutoff: null,\n lineWidth: null,\n pointSize: null,\n backfaces: null,\n frontface: null, // Boolean for speed; true == \"ccw\", false == \"cw\"\n hash: null\n });\n\n this.baseColor = cfg.baseColor;\n this.metallic = cfg.metallic;\n this.roughness = cfg.roughness;\n this.specularF0 = cfg.specularF0;\n this.emissive = cfg.emissive;\n this.alpha = cfg.alpha;\n\n if (cfg.baseColorMap) {\n this._baseColorMap = this._checkComponent(\"Texture\", cfg.baseColorMap);\n }\n if (cfg.metallicMap) {\n this._metallicMap = this._checkComponent(\"Texture\", cfg.metallicMap);\n\n }\n if (cfg.roughnessMap) {\n this._roughnessMap = this._checkComponent(\"Texture\", cfg.roughnessMap);\n }\n if (cfg.metallicRoughnessMap) {\n this._metallicRoughnessMap = this._checkComponent(\"Texture\", cfg.metallicRoughnessMap);\n }\n if (cfg.emissiveMap) {\n this._emissiveMap = this._checkComponent(\"Texture\", cfg.emissiveMap);\n }\n if (cfg.occlusionMap) {\n this._occlusionMap = this._checkComponent(\"Texture\", cfg.occlusionMap);\n }\n if (cfg.alphaMap) {\n this._alphaMap = this._checkComponent(\"Texture\", cfg.alphaMap);\n }\n if (cfg.normalMap) {\n this._normalMap = this._checkComponent(\"Texture\", cfg.normalMap);\n }\n\n this.alphaMode = cfg.alphaMode;\n this.alphaCutoff = cfg.alphaCutoff;\n this.backfaces = cfg.backfaces;\n this.frontface = cfg.frontface;\n this.lineWidth = cfg.lineWidth;\n this.pointSize = cfg.pointSize;\n\n this._makeHash();\n }\n\n _makeHash() {\n const state = this._state;\n const hash = [\"/met\"];\n if (this._baseColorMap) {\n hash.push(\"/bm\");\n if (this._baseColorMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n hash.push(\"/\" + this._baseColorMap._state.encoding);\n }\n if (this._metallicMap) {\n hash.push(\"/mm\");\n if (this._metallicMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._roughnessMap) {\n hash.push(\"/rm\");\n if (this._roughnessMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._metallicRoughnessMap) {\n hash.push(\"/mrm\");\n if (this._metallicRoughnessMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._emissiveMap) {\n hash.push(\"/em\");\n if (this._emissiveMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._occlusionMap) {\n hash.push(\"/ocm\");\n if (this._occlusionMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._alphaMap) {\n hash.push(\"/am\");\n if (this._alphaMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._normalMap) {\n hash.push(\"/nm\");\n if (this._normalMap._state.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n hash.push(\";\");\n state.hash = hash.join(\"\");\n }\n\n\n /**\n * Sets the RGB diffuse color.\n *\n * Multiplies by the RGB components of {@link MetallicMaterial#baseColorMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n * @type {Number[]}\n */\n set baseColor(value) {\n let baseColor = this._state.baseColor;\n if (!baseColor) {\n baseColor = this._state.baseColor = new Float32Array(3);\n } else if (value && baseColor[0] === value[0] && baseColor[1] === value[1] && baseColor[2] === value[2]) {\n return;\n }\n if (value) {\n baseColor[0] = value[0];\n baseColor[1] = value[1];\n baseColor[2] = value[2];\n } else {\n baseColor[0] = 1;\n baseColor[1] = 1;\n baseColor[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB diffuse color.\n *\n * Multiplies by the RGB components of {@link MetallicMaterial#baseColorMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n * @type {Number[]}\n */\n get baseColor() {\n return this._state.baseColor;\n }\n\n\n /**\n * Gets the RGB {@link Texture} containing the diffuse color of this MetallicMaterial, with optional *A* component for alpha.\n *\n * The RGB components multiply by {@link MetallicMaterial#baseColor}, while the *A* component, if present, multiplies by {@link MetallicMaterial#alpha}.\n *\n * @type {Texture}\n */\n get baseColorMap() {\n return this._baseColorMap;\n }\n\n /**\n * Sets the metallic factor.\n *\n * This is in the range ````[0..1]```` and indicates how metallic this MetallicMaterial is.\n *\n * ````1```` is metal, ````0```` is non-metal.\n *\n * Multiplies by the *R* component of {@link MetallicMaterial#metallicMap} and the *A* component of {@link MetallicMaterial#metallicRoughnessMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set metallic(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.metallic === value) {\n return;\n }\n this._state.metallic = value;\n this.glRedraw();\n }\n\n /**\n * Gets the metallic factor.\n *\n * @type {Number}\n */\n get metallic() {\n return this._state.metallic;\n }\n\n /**\n * Gets the RGB {@link Texture} containing this MetallicMaterial's metallic factor in its *R* component.\n *\n * The *R* component multiplies by {@link MetallicMaterial#metallic}.\n *\n * @type {Texture}\n */\n get metallicMap() {\n return this._attached.metallicMap;\n }\n\n /**\n * Sets the roughness factor.\n *\n * This factor is in the range ````[0..1]````, where ````0```` is fully smooth,````1```` is fully rough.\n *\n * Multiplies by the *R* component of {@link MetallicMaterial#roughnessMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set roughness(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.roughness === value) {\n return;\n }\n this._state.roughness = value;\n this.glRedraw();\n }\n\n /**\n * Gets the roughness factor.\n *\n * @type {Number}\n */\n get roughness() {\n return this._state.roughness;\n }\n\n /**\n * Gets the RGB {@link Texture} containing this MetallicMaterial's roughness factor in its *R* component.\n *\n * The *R* component multiplies by {@link MetallicMaterial#roughness}.\n *\n * @type {Texture}\n */\n get roughnessMap() {\n return this._attached.roughnessMap;\n }\n\n /**\n * Gets the RGB {@link Texture} containing this MetallicMaterial's metalness in its *R* component and roughness in its *G* component.\n *\n * Its *B* component multiplies by the {@link MetallicMaterial#metallic} property, while its *G* component multiplies by the {@link MetallicMaterial#roughness} property.\n *\n * @type {Texture}\n */\n get metallicRoughnessMap() {\n return this._attached.metallicRoughnessMap;\n }\n\n /**\n * Sets the factor in the range [0..1] indicating specular Fresnel value.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n set specularF0(value) {\n value = (value !== undefined && value !== null) ? value : 0.0;\n if (this._state.specularF0 === value) {\n return;\n }\n this._state.specularF0 = value;\n this.glRedraw();\n }\n\n /**\n * Gets the factor in the range [0..1] indicating specular Fresnel value.\n *\n * @type {Number}\n */\n get specularF0() {\n return this._state.specularF0;\n }\n\n /**\n * Sets the RGB emissive color.\n *\n * Multiplies by {@link MetallicMaterial#emissiveMap}.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n set emissive(value) {\n let emissive = this._state.emissive;\n if (!emissive) {\n emissive = this._state.emissive = new Float32Array(3);\n } else if (value && emissive[0] === value[0] && emissive[1] === value[1] && emissive[2] === value[2]) {\n return;\n }\n if (value) {\n emissive[0] = value[0];\n emissive[1] = value[1];\n emissive[2] = value[2];\n } else {\n emissive[0] = 0;\n emissive[1] = 0;\n emissive[2] = 0;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB emissive color.\n *\n * @type {Number[]}\n */\n get emissive() {\n return this._state.emissive;\n }\n\n /**\n * Gets the RGB emissive map.\n *\n * Multiplies by {@link MetallicMaterial#emissive}.\n *\n * @type {Texture}\n */\n get emissiveMap() {\n return this._attached.emissiveMap;\n }\n\n /**\n * Gets the RGB ambient occlusion map.\n *\n * Multiplies by the specular and diffuse light reflected by surfaces.\n *\n * @type {Texture}\n */\n get occlusionMap() {\n return this._attached.occlusionMap;\n }\n\n /**\n * Sets factor in the range ````[0..1]```` that indicates the alpha value.\n *\n * Multiplies by the *R* component of {@link MetallicMaterial#alphaMap} and the *A* component, if present, of {@link MetallicMaterial#baseColorMap}.\n *\n * The value of {@link MetallicMaterial#alphaMode} indicates how alpha is interpreted when rendering.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set alpha(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.alpha === value) {\n return;\n }\n this._state.alpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets factor in the range ````[0..1]```` that indicates the alpha value.\n *\n * @type {Number}\n */\n get alpha() {\n return this._state.alpha;\n }\n\n /**\n * Gets the RGB {@link Texture} containing this MetallicMaterial's alpha in its *R* component.\n *\n * The *R* component multiplies by the {@link MetallicMaterial#alpha} property.\n *\n * @type {Texture}\n */\n get alphaMap() {\n return this._attached.alphaMap;\n }\n\n /**\n * Gets the RGB tangent-space normal map {@link Texture}.\n *\n * @type {Texture}\n */\n get normalMap() {\n return this._attached.normalMap;\n }\n\n /**\n * Sets the alpha rendering mode.\n *\n * This specifies how alpha is interpreted. Alpha is the combined result of the {@link MetallicMaterial#alpha} and {@link MetallicMaterial#alphaMap} properties.\n *\n * Accepted values are:\n *\n * * \"opaque\" - The alpha value is ignored and the rendered output is fully opaque (default).\n * * \"mask\" - The rendered output is either fully opaque or fully transparent depending on the alpha and {@link MetallicMaterial#alphaCutoff}.\n * * \"blend\" - The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator).\n *\n * @type {String}\n */\n set alphaMode(alphaMode) {\n alphaMode = alphaMode || \"opaque\";\n let value = modes[alphaMode];\n if (value === undefined) {\n this.error(\"Unsupported value for 'alphaMode': \" + alphaMode + \" defaulting to 'opaque'\");\n value = \"opaque\";\n }\n if (this._state.alphaMode === value) {\n return;\n }\n this._state.alphaMode = value;\n this.glRedraw();\n }\n\n /**\n * Gets the alpha rendering mode.\n *\n * @type {String}\n */\n get alphaMode() {\n return modeNames[this._state.alphaMode];\n }\n\n /**\n * Sets the alpha cutoff value.\n *\n * Specifies the cutoff threshold when {@link MetallicMaterial#alphaMode} equals \"mask\". If the alpha is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. A value greater than 1.0 will render the entire\n * material as fully transparent. This value is ignored for other modes.\n *\n * Alpha is the combined result of the {@link MetallicMaterial#alpha} and {@link MetallicMaterial#alphaMap} properties.\n *\n * Default value is ````0.5````.\n *\n * @type {Number}\n */\n set alphaCutoff(alphaCutoff) {\n if (alphaCutoff === null || alphaCutoff === undefined) {\n alphaCutoff = 0.5;\n }\n if (this._state.alphaCutoff === alphaCutoff) {\n return;\n }\n this._state.alphaCutoff = alphaCutoff;\n }\n\n /**\n * Gets the alpha cutoff value.\n *\n * @type {Number}\n */\n get alphaCutoff() {\n return this._state.alphaCutoff;\n }\n\n /**\n * Sets whether backfaces are visible on attached {@link Mesh}es.\n *\n * The backfaces will belong to {@link ReadableGeometry} compoents that are also attached to the {@link Mesh}es.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n set backfaces(value) {\n value = !!value;\n if (this._state.backfaces === value) {\n return;\n }\n this._state.backfaces = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether backfaces are visible on attached {@link Mesh}es.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._state.backfaces;\n }\n\n /**\n * Sets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n *\n * Default value is ````\"ccw\"````.\n *\n * @type {String}\n */\n set frontface(value) {\n value = value !== \"cw\";\n if (this._state.frontface === value) {\n return;\n }\n this._state.frontface = value;\n this.glRedraw();\n }\n\n /**\n * Gets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n*\n * @type {String}\n */\n get frontface() {\n return this._state.frontface ? \"ccw\" : \"cw\";\n }\n\n /**\n * Sets the MetallicMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set lineWidth(value) {\n this._state.lineWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the MetallicMaterial's line width.\n *\n * @type {Number}\n */\n get lineWidth() {\n return this._state.lineWidth;\n }\n\n /**\n * Sets the MetallicMaterial's point size.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set pointSize(value) {\n this._state.pointSize = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the MetallicMaterial's point size.\n *\n * @type {Number}\n */\n get pointSize() {\n return this._state.pointSize;\n }\n\n /**\n * Destroys this MetallicMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {MetallicMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/MetallicMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/MetallicMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4070, + "__docId__": 4078, "kind": "variable", "name": "modes", "memberof": "src/viewer/scene/materials/MetallicMaterial.js", @@ -81382,7 +81598,7 @@ "ignore": true }, { - "__docId__": 4071, + "__docId__": 4079, "kind": "variable", "name": "modeNames", "memberof": "src/viewer/scene/materials/MetallicMaterial.js", @@ -81403,7 +81619,7 @@ "ignore": true }, { - "__docId__": 4072, + "__docId__": 4080, "kind": "class", "name": "MetallicMaterial", "memberof": "src/viewer/scene/materials/MetallicMaterial.js", @@ -81421,7 +81637,7 @@ ] }, { - "__docId__": 4073, + "__docId__": 4081, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81440,7 +81656,7 @@ } }, { - "__docId__": 4074, + "__docId__": 4082, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81739,7 +81955,7 @@ ] }, { - "__docId__": 4075, + "__docId__": 4083, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81757,7 +81973,7 @@ } }, { - "__docId__": 4082, + "__docId__": 4090, "kind": "member", "name": "_baseColorMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81775,7 +81991,7 @@ } }, { - "__docId__": 4083, + "__docId__": 4091, "kind": "member", "name": "_metallicMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81793,7 +82009,7 @@ } }, { - "__docId__": 4084, + "__docId__": 4092, "kind": "member", "name": "_roughnessMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81811,7 +82027,7 @@ } }, { - "__docId__": 4085, + "__docId__": 4093, "kind": "member", "name": "_metallicRoughnessMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81829,7 +82045,7 @@ } }, { - "__docId__": 4086, + "__docId__": 4094, "kind": "member", "name": "_emissiveMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81847,7 +82063,7 @@ } }, { - "__docId__": 4087, + "__docId__": 4095, "kind": "member", "name": "_occlusionMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81865,7 +82081,7 @@ } }, { - "__docId__": 4088, + "__docId__": 4096, "kind": "member", "name": "_alphaMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81883,7 +82099,7 @@ } }, { - "__docId__": 4089, + "__docId__": 4097, "kind": "member", "name": "_normalMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81901,7 +82117,7 @@ } }, { - "__docId__": 4096, + "__docId__": 4104, "kind": "method", "name": "_makeHash", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81918,7 +82134,7 @@ "return": null }, { - "__docId__": 4097, + "__docId__": 4105, "kind": "set", "name": "baseColor", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81939,7 +82155,7 @@ } }, { - "__docId__": 4098, + "__docId__": 4106, "kind": "get", "name": "baseColor", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81960,7 +82176,7 @@ } }, { - "__docId__": 4099, + "__docId__": 4107, "kind": "get", "name": "baseColorMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -81981,7 +82197,7 @@ } }, { - "__docId__": 4100, + "__docId__": 4108, "kind": "set", "name": "metallic", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82002,7 +82218,7 @@ } }, { - "__docId__": 4101, + "__docId__": 4109, "kind": "get", "name": "metallic", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82023,7 +82239,7 @@ } }, { - "__docId__": 4102, + "__docId__": 4110, "kind": "get", "name": "metallicMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82044,7 +82260,7 @@ } }, { - "__docId__": 4103, + "__docId__": 4111, "kind": "set", "name": "roughness", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82065,7 +82281,7 @@ } }, { - "__docId__": 4104, + "__docId__": 4112, "kind": "get", "name": "roughness", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82086,7 +82302,7 @@ } }, { - "__docId__": 4105, + "__docId__": 4113, "kind": "get", "name": "roughnessMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82107,7 +82323,7 @@ } }, { - "__docId__": 4106, + "__docId__": 4114, "kind": "get", "name": "metallicRoughnessMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82128,7 +82344,7 @@ } }, { - "__docId__": 4107, + "__docId__": 4115, "kind": "set", "name": "specularF0", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82149,7 +82365,7 @@ } }, { - "__docId__": 4108, + "__docId__": 4116, "kind": "get", "name": "specularF0", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82170,7 +82386,7 @@ } }, { - "__docId__": 4109, + "__docId__": 4117, "kind": "set", "name": "emissive", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82191,7 +82407,7 @@ } }, { - "__docId__": 4110, + "__docId__": 4118, "kind": "get", "name": "emissive", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82212,7 +82428,7 @@ } }, { - "__docId__": 4111, + "__docId__": 4119, "kind": "get", "name": "emissiveMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82233,7 +82449,7 @@ } }, { - "__docId__": 4112, + "__docId__": 4120, "kind": "get", "name": "occlusionMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82254,7 +82470,7 @@ } }, { - "__docId__": 4113, + "__docId__": 4121, "kind": "set", "name": "alpha", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82275,7 +82491,7 @@ } }, { - "__docId__": 4114, + "__docId__": 4122, "kind": "get", "name": "alpha", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82296,7 +82512,7 @@ } }, { - "__docId__": 4115, + "__docId__": 4123, "kind": "get", "name": "alphaMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82317,7 +82533,7 @@ } }, { - "__docId__": 4116, + "__docId__": 4124, "kind": "get", "name": "normalMap", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82338,7 +82554,7 @@ } }, { - "__docId__": 4117, + "__docId__": 4125, "kind": "set", "name": "alphaMode", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82359,7 +82575,7 @@ } }, { - "__docId__": 4118, + "__docId__": 4126, "kind": "get", "name": "alphaMode", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82380,7 +82596,7 @@ } }, { - "__docId__": 4119, + "__docId__": 4127, "kind": "set", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82401,7 +82617,7 @@ } }, { - "__docId__": 4120, + "__docId__": 4128, "kind": "get", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82422,7 +82638,7 @@ } }, { - "__docId__": 4121, + "__docId__": 4129, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82443,7 +82659,7 @@ } }, { - "__docId__": 4122, + "__docId__": 4130, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82464,7 +82680,7 @@ } }, { - "__docId__": 4123, + "__docId__": 4131, "kind": "set", "name": "frontface", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82485,7 +82701,7 @@ } }, { - "__docId__": 4124, + "__docId__": 4132, "kind": "get", "name": "frontface", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82506,7 +82722,7 @@ } }, { - "__docId__": 4125, + "__docId__": 4133, "kind": "set", "name": "lineWidth", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82527,7 +82743,7 @@ } }, { - "__docId__": 4126, + "__docId__": 4134, "kind": "get", "name": "lineWidth", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82548,7 +82764,7 @@ } }, { - "__docId__": 4127, + "__docId__": 4135, "kind": "set", "name": "pointSize", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82569,7 +82785,7 @@ } }, { - "__docId__": 4128, + "__docId__": 4136, "kind": "get", "name": "pointSize", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82590,7 +82806,7 @@ } }, { - "__docId__": 4129, + "__docId__": 4137, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/MetallicMaterial.js~MetallicMaterial", @@ -82605,18 +82821,18 @@ "return": null }, { - "__docId__": 4130, + "__docId__": 4138, "kind": "file", "name": "src/viewer/scene/materials/PhongMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\nconst alphaModes = {\"opaque\": 0, \"mask\": 1, \"blend\": 2};\nconst alphaModeNames = [\"opaque\", \"mask\", \"blend\"];\n\n/**\n * @desc Configures the normal rendered appearance of {@link Mesh}es using the non-physically-correct Blinn-Phong shading model.\n *\n * * Useful for non-realistic objects like gizmos.\n * * {@link SpecularMaterial} is best for insulators, such as wood, ceramics and plastic.\n * * {@link MetallicMaterial} is best for conductive materials, such as metal.\n * * {@link LambertMaterial} is appropriate for high-detail models that need to render as efficiently as possible.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Mesh} with a PhongMaterial with a diffuse {@link Texture} and a specular {@link Fresnel}, using a {@link buildTorusGeometry} to create the {@link Geometry}.\n *\n * [[Run this example](/examples/index.html#materials_PhongMaterial)]\n *\n * ```` javascript\n * import {Viewer, Mesh, buildTorusGeometry,\n * ReadableGeometry, PhongMaterial, Texture, Fresnel} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * ambient: [0.9, 0.3, 0.9],\n * shininess: 30,\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * }),\n * specularFresnel: new Fresnel(viewer.scene, {\n * leftColor: [1.0, 1.0, 1.0],\n * rightColor: [0.0, 0.0, 0.0],\n * power: 4\n * })\n * })\n * });\n * ````\n *\n * ## PhongMaterial Properties\n *\n * The following table summarizes PhongMaterial properties:\n *\n * | Property | Type | Range | Default Value | Space | Description |\n * |:--------:|:----:|:-----:|:-------------:|:-----:|:-----------:|\n * | {@link PhongMaterial#ambient} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the ambient light reflected by the material. |\n * | {@link PhongMaterial#diffuse} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the diffuse light reflected by the material. |\n * | {@link PhongMaterial#specular} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the specular light reflected by the material. |\n * | {@link PhongMaterial#emissive} | Array | [0, 1] for all components | [0,0,0] | linear | The RGB components of the light emitted by the material. |\n * | {@link PhongMaterial#alpha} | Number | [0, 1] | 1 | linear | The transparency of the material surface (0 fully transparent, 1 fully opaque). |\n * | {@link PhongMaterial#shininess} | Number | [0, 128] | 80 | linear | Determines the size and sharpness of specular highlights. |\n * | {@link PhongMaterial#reflectivity} | Number | [0, 1] | 1 | linear | Determines the amount of reflectivity. |\n * | {@link PhongMaterial#diffuseMap} | {@link Texture} | | null | sRGB | Texture RGB components multiplying by {@link PhongMaterial#diffuse}. If the fourth component (A) is present, it multiplies by {@link PhongMaterial#alpha}. |\n * | {@link PhongMaterial#specularMap} | {@link Texture} | | null | sRGB | Texture RGB components multiplying by {@link PhongMaterial#specular}. If the fourth component (A) is present, it multiplies by {@link PhongMaterial#alpha}. |\n * | {@link PhongMaterial#emissiveMap} | {@link Texture} | | null | linear | Texture with RGB components multiplying by {@link PhongMaterial#emissive}. |\n * | {@link PhongMaterial#alphaMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link PhongMaterial#alpha}. |\n * | {@link PhongMaterial#occlusionMap} | {@link Texture} | | null | linear | Ambient occlusion texture multiplying by {@link PhongMaterial#ambient}, {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}. |\n * | {@link PhongMaterial#normalMap} | {@link Texture} | | null | linear | Tangent-space normal map. |\n * | {@link PhongMaterial#diffuseFresnel} | {@link Fresnel} | | null | | Fresnel term applied to {@link PhongMaterial#diffuse}. |\n * | {@link PhongMaterial#specularFresnel} | {@link Fresnel} | | null | | Fresnel term applied to {@link PhongMaterial#specular}. |\n * | {@link PhongMaterial#emissiveFresnel} | {@link Fresnel} | | null | | Fresnel term applied to {@link PhongMaterial#emissive}. |\n * | {@link PhongMaterial#reflectivityFresnel} | {@link Fresnel} | | null | | Fresnel term applied to {@link PhongMaterial#reflectivity}. |\n * | {@link PhongMaterial#alphaFresnel} | {@link Fresnel} | | null | | Fresnel term applied to {@link PhongMaterial#alpha}. |\n * | {@link PhongMaterial#lineWidth} | Number | [0..100] | 1 | | Line width in pixels. |\n * | {@link PhongMaterial#pointSize} | Number | [0..100] | 1 | | Point size in pixels. |\n * | {@link PhongMaterial#alphaMode} | String | \"opaque\", \"blend\", \"mask\" | \"blend\" | | Alpha blend mode. |\n * | {@link PhongMaterial#alphaCutoff} | Number | [0..1] | 0.5 | | Alpha cutoff value. |\n * | {@link PhongMaterial#backfaces} | Boolean | | false | | Whether to render geometry backfaces. |\n * | {@link PhongMaterial#frontface} | String | \"ccw\", \"cw\" | \"ccw\" | | The winding order for geometry frontfaces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise. |\n */\nclass PhongMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"PhongMaterial\";\n }\n\n /**\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The PhongMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.ambient=[1.0, 1.0, 1.0 ]] PhongMaterial ambient color.\n * @param {Number[]} [cfg.diffuse=[ 1.0, 1.0, 1.0 ]] PhongMaterial diffuse color.\n * @param {Number[]} [cfg.specular=[ 1.0, 1.0, 1.0 ]] PhongMaterial specular color.\n * @param {Number[]} [cfg.emissive=[ 0.0, 0.0, 0.0 ]] PhongMaterial emissive color.\n * @param {Number} [cfg.alpha=1] Scalar in range 0-1 that controls alpha, where 0 is completely transparent and 1 is completely opaque.\n * @param {Number} [cfg.shininess=80] Scalar in range 0-128 that determines the size and sharpness of specular highlights.\n * @param {Number} [cfg.reflectivity=1] Scalar in range 0-1 that controls how much {@link ReflectionMap} is reflected.\n * @param {Number} [cfg.lineWidth=1] Scalar that controls the width of lines.\n * @param {Number} [cfg.pointSize=1] Scalar that controls the size of points.\n * @param {Texture} [cfg.ambientMap=null] A ambient map {@link Texture}, which will multiply by the diffuse property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.diffuseMap=null] A diffuse map {@link Texture}, which will override the effect of the diffuse property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.specularMap=null] A specular map {@link Texture}, which will override the effect of the specular property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.emissiveMap=undefined] An emissive map {@link Texture}, which will override the effect of the emissive property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.normalMap=undefined] A normal map {@link Texture}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.alphaMap=undefined] An alpha map {@link Texture}, which will override the effect of the alpha property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.reflectivityMap=undefined] A reflectivity control map {@link Texture}, which will override the effect of the reflectivity property. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Texture} [cfg.occlusionMap=null] An occlusion map {@link Texture}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Fresnel} [cfg.diffuseFresnel=undefined] A diffuse {@link Fresnel\"}}Fresnel{{/crossLink}}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Fresnel} [cfg.specularFresnel=undefined] A specular {@link Fresnel\"}}Fresnel{{/crossLink}}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Fresnel} [cfg.emissiveFresnel=undefined] An emissive {@link Fresnel\"}}Fresnel{{/crossLink}}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Fresnel} [cfg.alphaFresnel=undefined] An alpha {@link Fresnel\"}}Fresnel{{/crossLink}}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {Fresnel} [cfg.reflectivityFresnel=undefined] A reflectivity {@link Fresnel\"}}Fresnel{{/crossLink}}. Must be within the same {@link Scene} as this PhongMaterial.\n * @param {String} [cfg.alphaMode=\"opaque\"] The alpha blend mode - accepted values are \"opaque\", \"blend\" and \"mask\". See the {@link PhongMaterial#alphaMode} property for more info.\n * @param {Number} [cfg.alphaCutoff=0.5] The alpha cutoff value. See the {@link PhongMaterial#alphaCutoff} property for more info.\n * @param {Boolean} [cfg.backfaces=false] Whether to render geometry backfaces.\n * @param {Boolean} [cfg.frontface=\"ccw\"] The winding order for geometry front faces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"PhongMaterial\",\n ambient: math.vec3([1.0, 1.0, 1.0]),\n diffuse: math.vec3([1.0, 1.0, 1.0]),\n specular: math.vec3([1.0, 1.0, 1.0]),\n emissive: math.vec3([0.0, 0.0, 0.0]),\n alpha: null,\n shininess: null,\n reflectivity: null,\n alphaMode: null,\n alphaCutoff: null,\n lineWidth: null,\n pointSize: null,\n backfaces: null,\n frontface: null, // Boolean for speed; true == \"ccw\", false == \"cw\"\n hash: null\n });\n\n this.ambient = cfg.ambient;\n this.diffuse = cfg.diffuse;\n this.specular = cfg.specular;\n this.emissive = cfg.emissive;\n this.alpha = cfg.alpha;\n this.shininess = cfg.shininess;\n this.reflectivity = cfg.reflectivity;\n this.lineWidth = cfg.lineWidth;\n this.pointSize = cfg.pointSize;\n\n if (cfg.ambientMap) {\n this._ambientMap = this._checkComponent(\"Texture\", cfg.ambientMap);\n }\n if (cfg.diffuseMap) {\n this._diffuseMap = this._checkComponent(\"Texture\", cfg.diffuseMap);\n }\n if (cfg.specularMap) {\n this._specularMap = this._checkComponent(\"Texture\", cfg.specularMap);\n }\n if (cfg.emissiveMap) {\n this._emissiveMap = this._checkComponent(\"Texture\", cfg.emissiveMap);\n }\n if (cfg.alphaMap) {\n this._alphaMap = this._checkComponent(\"Texture\", cfg.alphaMap);\n }\n if (cfg.reflectivityMap) {\n this._reflectivityMap = this._checkComponent(\"Texture\", cfg.reflectivityMap);\n }\n if (cfg.normalMap) {\n this._normalMap = this._checkComponent(\"Texture\", cfg.normalMap);\n }\n if (cfg.occlusionMap) {\n this._occlusionMap = this._checkComponent(\"Texture\", cfg.occlusionMap);\n }\n if (cfg.diffuseFresnel) {\n this._diffuseFresnel = this._checkComponent(\"Fresnel\", cfg.diffuseFresnel);\n }\n if (cfg.specularFresnel) {\n this._specularFresnel = this._checkComponent(\"Fresnel\", cfg.specularFresnel);\n }\n if (cfg.emissiveFresnel) {\n this._emissiveFresnel = this._checkComponent(\"Fresnel\", cfg.emissiveFresnel);\n }\n if (cfg.alphaFresnel) {\n this._alphaFresnel = this._checkComponent(\"Fresnel\", cfg.alphaFresnel);\n }\n if (cfg.reflectivityFresnel) {\n this._reflectivityFresnel = this._checkComponent(\"Fresnel\", cfg.reflectivityFresnel);\n }\n\n this.alphaMode = cfg.alphaMode;\n this.alphaCutoff = cfg.alphaCutoff;\n this.backfaces = cfg.backfaces;\n this.frontface = cfg.frontface;\n\n this._makeHash();\n }\n\n _makeHash() {\n const state = this._state;\n const hash = [\"/p\"]; // 'P' for Phong\n if (this._normalMap) {\n hash.push(\"/nm\");\n if (this._normalMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._ambientMap) {\n hash.push(\"/am\");\n if (this._ambientMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n hash.push(\"/\" + this._ambientMap.encoding);\n }\n if (this._diffuseMap) {\n hash.push(\"/dm\");\n if (this._diffuseMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n hash.push(\"/\" + this._diffuseMap.encoding);\n }\n if (this._specularMap) {\n hash.push(\"/sm\");\n if (this._specularMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._emissiveMap) {\n hash.push(\"/em\");\n if (this._emissiveMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n hash.push(\"/\" + this._emissiveMap.encoding);\n }\n if (this._alphaMap) {\n hash.push(\"/opm\");\n if (this._alphaMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._reflectivityMap) {\n hash.push(\"/rm\");\n if (this._reflectivityMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._occlusionMap) {\n hash.push(\"/ocm\");\n if (this._occlusionMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._diffuseFresnel) {\n hash.push(\"/df\");\n }\n if (this._specularFresnel) {\n hash.push(\"/sf\");\n }\n if (this._emissiveFresnel) {\n hash.push(\"/ef\");\n }\n if (this._alphaFresnel) {\n hash.push(\"/of\");\n }\n if (this._reflectivityFresnel) {\n hash.push(\"/rf\");\n }\n hash.push(\";\");\n state.hash = hash.join(\"\");\n }\n\n /**\n * Sets the PhongMaterial's ambient color.\n *\n * Default value is ````[0.3, 0.3, 0.3]````.\n *\n * @type {Number[]}\n */\n set ambient(value) {\n let ambient = this._state.ambient;\n if (!ambient) {\n ambient = this._state.ambient = new Float32Array(3);\n } else if (value && ambient[0] === value[0] && ambient[1] === value[1] && ambient[2] === value[2]) {\n return;\n }\n if (value) {\n ambient[0] = value[0];\n ambient[1] = value[1];\n ambient[2] = value[2];\n } else {\n ambient[0] = .2;\n ambient[1] = .2;\n ambient[2] = .2;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's ambient color.\n *\n * Default value is ````[0.3, 0.3, 0.3]````.\n *\n * @type {Number[]}\n */\n get ambient() {\n return this._state.ambient;\n }\n\n /**\n * Sets the PhongMaterial's diffuse color.\n *\n * Multiplies by {@link PhongMaterial#diffuseMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n set diffuse(value) {\n let diffuse = this._state.diffuse;\n if (!diffuse) {\n diffuse = this._state.diffuse = new Float32Array(3);\n } else if (value && diffuse[0] === value[0] && diffuse[1] === value[1] && diffuse[2] === value[2]) {\n return;\n }\n if (value) {\n diffuse[0] = value[0];\n diffuse[1] = value[1];\n diffuse[2] = value[2];\n } else {\n diffuse[0] = 1;\n diffuse[1] = 1;\n diffuse[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Sets the PhongMaterial's diffuse color.\n *\n * Multiplies by {@link PhongMaterial#diffuseMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n get diffuse() {\n return this._state.diffuse;\n }\n\n /**\n * Sets the PhongMaterial's specular color.\n *\n * Multiplies by {@link PhongMaterial#specularMap}.\n * Default value is ````[1.0, 1.0, 1.0]````.\n * @type {Number[]}\n */\n set specular(value) {\n let specular = this._state.specular;\n if (!specular) {\n specular = this._state.specular = new Float32Array(3);\n } else if (value && specular[0] === value[0] && specular[1] === value[1] && specular[2] === value[2]) {\n return;\n }\n if (value) {\n specular[0] = value[0];\n specular[1] = value[1];\n specular[2] = value[2];\n } else {\n specular[0] = 1;\n specular[1] = 1;\n specular[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's specular color.\n *\n * Multiplies by {@link PhongMaterial#specularMap}.\n * Default value is ````[1.0, 1.0, 1.0]````.\n * @type {Number[]}\n */\n get specular() {\n return this._state.specular;\n }\n\n /**\n * Sets the PhongMaterial's emissive color.\n *\n * Multiplies by {@link PhongMaterial#emissiveMap}.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n * @type {Number[]}\n */\n set emissive(value) {\n let emissive = this._state.emissive;\n if (!emissive) {\n emissive = this._state.emissive = new Float32Array(3);\n } else if (value && emissive[0] === value[0] && emissive[1] === value[1] && emissive[2] === value[2]) {\n return;\n }\n if (value) {\n emissive[0] = value[0];\n emissive[1] = value[1];\n emissive[2] = value[2];\n } else {\n emissive[0] = 0;\n emissive[1] = 0;\n emissive[2] = 0;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's emissive color.\n *\n * Multiplies by {@link PhongMaterial#emissiveMap}.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n * @type {Number[]}\n */\n get emissive() {\n return this._state.emissive;\n }\n\n /**\n * Sets the PhongMaterial alpha.\n *\n * This is a factor in the range [0..1] indicating how transparent the PhongMaterial is.\n *\n * A value of 0.0 indicates fully transparent, 1.0 is fully opaque.\n *\n * Multiplies by {@link PhongMaterial#alphaMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set alpha(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.alpha === value) {\n return;\n }\n this._state.alpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial alpha.\n *\n * This is a factor in the range [0..1] indicating how transparent the PhongMaterial is.\n *\n * A value of 0.0 indicates fully transparent, 1.0 is fully opaque.\n *\n * Multiplies by {@link PhongMaterial#alphaMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get alpha() {\n return this._state.alpha;\n }\n\n /**\n * Sets the PhongMaterial shininess.\n *\n * This is a factor in range [0..128] that determines the size and sharpness of the specular highlights create by this PhongMaterial.\n *\n * Larger values produce smaller, sharper highlights. A value of 0.0 gives very large highlights that are almost never\n * desirable. Try values close to 10 for a larger, fuzzier highlight and values of 100 or more for a small, sharp\n * highlight.\n *\n * Default value is ```` 80.0````.\n *\n * @type {Number}\n */\n set shininess(value) {\n this._state.shininess = value !== undefined ? value : 80;\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial shininess.\n *\n * This is a factor in range [0..128] that determines the size and sharpness of the specular highlights create by this PhongMaterial.\n *\n * Larger values produce smaller, sharper highlights. A value of 0.0 gives very large highlights that are almost never\n * desirable. Try values close to 10 for a larger, fuzzier highlight and values of 100 or more for a small, sharp\n * highlight.\n *\n * Default value is ```` 80.0````.\n *\n * @type {Number}\n */\n get shininess() {\n return this._state.shininess;\n }\n\n /**\n * Sets the PhongMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set lineWidth(value) {\n this._state.lineWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get lineWidth() {\n return this._state.lineWidth;\n }\n\n /**\n * Sets the PhongMaterial's point size.\n *\n * Default value is 1.0.\n *\n * @type {Number}\n */\n set pointSize(value) {\n this._state.pointSize = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's point size.\n *\n * Default value is 1.0.\n *\n * @type {Number}\n */\n get pointSize() {\n return this._state.pointSize;\n }\n\n /**\n * Sets how much {@link ReflectionMap} is reflected by this PhongMaterial.\n *\n * This is a scalar in range ````[0-1]````. Default value is ````1.0````.\n *\n * The surface will be non-reflective when this is ````0````, and completely mirror-like when it is ````1.0````.\n *\n * Multiplies by {@link PhongMaterial#reflectivityMap}.\n *\n * @type {Number}\n */\n set reflectivity(value) {\n this._state.reflectivity = value !== undefined ? value : 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets how much {@link ReflectionMap} is reflected by this PhongMaterial.\n *\n * This is a scalar in range ````[0-1]````. Default value is ````1.0````.\n *\n * The surface will be non-reflective when this is ````0````, and completely mirror-like when it is ````1.0````.\n *\n * Multiplies by {@link PhongMaterial#reflectivityMap}.\n *\n * @type {Number}\n */\n get reflectivity() {\n return this._state.reflectivity;\n }\n\n /**\n * Gets the PhongMaterials's normal map {@link Texture}.\n *\n * @type {Texture}\n */\n get normalMap() {\n return this._normalMap;\n }\n\n /**\n * Gets the PhongMaterials's ambient {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#ambient}.\n *\n * @type {Texture}\n */\n get ambientMap() {\n return this._ambientMap;\n }\n\n /**\n * Gets the PhongMaterials's diffuse {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#diffuse}.\n *\n * @type {Texture}\n */\n get diffuseMap() {\n return this._diffuseMap;\n }\n\n /**\n * Gets the PhongMaterials's specular {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#specular}.\n *\n * @type {Texture}\n */\n get specularMap() {\n return this._specularMap;\n }\n\n /**\n * Gets the PhongMaterials's emissive {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#emissive}.\n *\n * @type {Texture}\n */\n get emissiveMap() {\n return this._emissiveMap;\n }\n\n /**\n * Gets the PhongMaterials's alpha {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#alpha}.\n *\n * @type {Texture}\n */\n get alphaMap() {\n return this._alphaMap;\n }\n\n /**\n * Gets the PhongMaterials's reflectivity {@link Texture}.\n *\n * Multiplies by {@link PhongMaterial#reflectivity}.\n *\n * @type {Texture}\n */\n get reflectivityMap() {\n return this._reflectivityMap;\n }\n\n /**\n * Gets the PhongMaterials's ambient occlusion {@link Texture}.\n *\n * @type {Texture}\n */\n get occlusionMap() {\n return this._occlusionMap;\n }\n\n /**\n * Gets the PhongMaterials's diffuse {@link Fresnel}.\n *\n * Applies to {@link PhongMaterial#diffuse}.\n *\n * @type {Fresnel}\n */\n get diffuseFresnel() {\n return this._diffuseFresnel;\n }\n\n /**\n * Gets the PhongMaterials's specular {@link Fresnel}.\n *\n * Applies to {@link PhongMaterial#specular}.\n *\n * @type {Fresnel}\n */\n get specularFresnel() {\n return this._specularFresnel;\n }\n\n /**\n * Gets the PhongMaterials's emissive {@link Fresnel}.\n *\n * Applies to {@link PhongMaterial#emissive}.\n *\n * @type {Fresnel}\n */\n get emissiveFresnel() {\n return this._emissiveFresnel;\n }\n\n /**\n * Gets the PhongMaterials's alpha {@link Fresnel}.\n *\n * Applies to {@link PhongMaterial#alpha}.\n *\n * @type {Fresnel}\n */\n get alphaFresnel() {\n return this._alphaFresnel;\n }\n\n /**\n * Gets the PhongMaterials's reflectivity {@link Fresnel}.\n *\n * Applies to {@link PhongMaterial#reflectivity}.\n *\n * @type {Fresnel}\n */\n get reflectivityFresnel() {\n return this._reflectivityFresnel;\n }\n\n /**\n * Sets the PhongMaterial's alpha rendering mode.\n *\n * This governs how alpha is treated. Alpha is the combined result of {@link PhongMaterial#alpha} and {@link PhongMaterial#alphaMap}.\n *\n * Supported values are:\n *\n * * \"opaque\" - The alpha value is ignored and the rendered output is fully opaque (default).\n * * \"mask\" - The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value.\n * * \"blend\" - The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator).\n *\n *@type {String}\n */\n set alphaMode(alphaMode) {\n alphaMode = alphaMode || \"opaque\";\n let value = alphaModes[alphaMode];\n if (value === undefined) {\n this.error(\"Unsupported value for 'alphaMode': \" + alphaMode + \" - defaulting to 'opaque'\");\n value = \"opaque\";\n }\n if (this._state.alphaMode === value) {\n return;\n }\n this._state.alphaMode = value;\n this.glRedraw();\n }\n\n /**\n * Gets the PhongMaterial's alpha rendering mode.\n *\n *@type {String}\n */\n get alphaMode() {\n return alphaModeNames[this._state.alphaMode];\n }\n\n /**\n * Sets the PhongMaterial's alpha cutoff value.\n *\n * This specifies the cutoff threshold when {@link PhongMaterial#alphaMode} equals \"mask\". If the alpha is greater than or equal to this value then it is rendered as fully\n * opaque, otherwise, it is rendered as fully transparent. A value greater than 1.0 will render the entire material as fully transparent. This value is ignored for other modes.\n *\n * Alpha is the combined result of {@link PhongMaterial#alpha} and {@link PhongMaterial#alphaMap}.\n *\n * Default value is ````0.5````.\n *\n * @type {Number}\n */\n set alphaCutoff(alphaCutoff) {\n if (alphaCutoff === null || alphaCutoff === undefined) {\n alphaCutoff = 0.5;\n }\n if (this._state.alphaCutoff === alphaCutoff) {\n return;\n }\n this._state.alphaCutoff = alphaCutoff;\n }\n\n /**\n * Gets the PhongMaterial's alpha cutoff value.\n *\n * @type {Number}\n */\n get alphaCutoff() {\n return this._state.alphaCutoff;\n }\n\n /**\n * Sets whether backfaces are visible on attached {@link Mesh}es.\n *\n * The backfaces will belong to {@link Geometry} compoents that are also attached to the {@link Mesh}es.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n set backfaces(value) {\n value = !!value;\n if (this._state.backfaces === value) {\n return;\n }\n this._state.backfaces = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether backfaces are visible on attached {@link Mesh}es.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._state.backfaces;\n }\n\n /**\n * Sets the winding direction of geometry front faces.\n *\n * Default is ````\"ccw\"````.\n * @type {String}\n */\n set frontface(value) {\n value = value !== \"cw\";\n if (this._state.frontface === value) {\n return;\n }\n this._state.frontface = value;\n this.glRedraw();\n }\n\n /**\n * Gets the winding direction of front faces on attached {@link Mesh}es.\n *\n * Default is ````\"ccw\"````.\n * @type {String}\n */\n get frontface() {\n return this._state.frontface ? \"ccw\" : \"cw\";\n }\n\n /**\n * Destroys this PhongMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {PhongMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/PhongMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/PhongMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4131, + "__docId__": 4139, "kind": "variable", "name": "alphaModes", "memberof": "src/viewer/scene/materials/PhongMaterial.js", @@ -82637,7 +82853,7 @@ "ignore": true }, { - "__docId__": 4132, + "__docId__": 4140, "kind": "variable", "name": "alphaModeNames", "memberof": "src/viewer/scene/materials/PhongMaterial.js", @@ -82658,7 +82874,7 @@ "ignore": true }, { - "__docId__": 4133, + "__docId__": 4141, "kind": "class", "name": "PhongMaterial", "memberof": "src/viewer/scene/materials/PhongMaterial.js", @@ -82676,7 +82892,7 @@ ] }, { - "__docId__": 4134, + "__docId__": 4142, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -82695,7 +82911,7 @@ } }, { - "__docId__": 4135, + "__docId__": 4143, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83068,7 +83284,7 @@ ] }, { - "__docId__": 4136, + "__docId__": 4144, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83086,7 +83302,7 @@ } }, { - "__docId__": 4146, + "__docId__": 4154, "kind": "member", "name": "_ambientMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83104,7 +83320,7 @@ } }, { - "__docId__": 4147, + "__docId__": 4155, "kind": "member", "name": "_diffuseMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83122,7 +83338,7 @@ } }, { - "__docId__": 4148, + "__docId__": 4156, "kind": "member", "name": "_specularMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83140,7 +83356,7 @@ } }, { - "__docId__": 4149, + "__docId__": 4157, "kind": "member", "name": "_emissiveMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83158,7 +83374,7 @@ } }, { - "__docId__": 4150, + "__docId__": 4158, "kind": "member", "name": "_alphaMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83176,7 +83392,7 @@ } }, { - "__docId__": 4151, + "__docId__": 4159, "kind": "member", "name": "_reflectivityMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83194,7 +83410,7 @@ } }, { - "__docId__": 4152, + "__docId__": 4160, "kind": "member", "name": "_normalMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83212,7 +83428,7 @@ } }, { - "__docId__": 4153, + "__docId__": 4161, "kind": "member", "name": "_occlusionMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83230,7 +83446,7 @@ } }, { - "__docId__": 4154, + "__docId__": 4162, "kind": "member", "name": "_diffuseFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83248,7 +83464,7 @@ } }, { - "__docId__": 4155, + "__docId__": 4163, "kind": "member", "name": "_specularFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83266,7 +83482,7 @@ } }, { - "__docId__": 4156, + "__docId__": 4164, "kind": "member", "name": "_emissiveFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83284,7 +83500,7 @@ } }, { - "__docId__": 4157, + "__docId__": 4165, "kind": "member", "name": "_alphaFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83302,7 +83518,7 @@ } }, { - "__docId__": 4158, + "__docId__": 4166, "kind": "member", "name": "_reflectivityFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83320,7 +83536,7 @@ } }, { - "__docId__": 4163, + "__docId__": 4171, "kind": "method", "name": "_makeHash", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83337,7 +83553,7 @@ "return": null }, { - "__docId__": 4164, + "__docId__": 4172, "kind": "set", "name": "ambient", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83358,7 +83574,7 @@ } }, { - "__docId__": 4165, + "__docId__": 4173, "kind": "get", "name": "ambient", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83379,7 +83595,7 @@ } }, { - "__docId__": 4166, + "__docId__": 4174, "kind": "set", "name": "diffuse", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83400,7 +83616,7 @@ } }, { - "__docId__": 4167, + "__docId__": 4175, "kind": "get", "name": "diffuse", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83421,7 +83637,7 @@ } }, { - "__docId__": 4168, + "__docId__": 4176, "kind": "set", "name": "specular", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83442,7 +83658,7 @@ } }, { - "__docId__": 4169, + "__docId__": 4177, "kind": "get", "name": "specular", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83463,7 +83679,7 @@ } }, { - "__docId__": 4170, + "__docId__": 4178, "kind": "set", "name": "emissive", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83484,7 +83700,7 @@ } }, { - "__docId__": 4171, + "__docId__": 4179, "kind": "get", "name": "emissive", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83505,7 +83721,7 @@ } }, { - "__docId__": 4172, + "__docId__": 4180, "kind": "set", "name": "alpha", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83526,7 +83742,7 @@ } }, { - "__docId__": 4173, + "__docId__": 4181, "kind": "get", "name": "alpha", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83547,7 +83763,7 @@ } }, { - "__docId__": 4174, + "__docId__": 4182, "kind": "set", "name": "shininess", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83568,7 +83784,7 @@ } }, { - "__docId__": 4175, + "__docId__": 4183, "kind": "get", "name": "shininess", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83589,7 +83805,7 @@ } }, { - "__docId__": 4176, + "__docId__": 4184, "kind": "set", "name": "lineWidth", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83610,7 +83826,7 @@ } }, { - "__docId__": 4177, + "__docId__": 4185, "kind": "get", "name": "lineWidth", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83631,7 +83847,7 @@ } }, { - "__docId__": 4178, + "__docId__": 4186, "kind": "set", "name": "pointSize", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83652,7 +83868,7 @@ } }, { - "__docId__": 4179, + "__docId__": 4187, "kind": "get", "name": "pointSize", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83673,7 +83889,7 @@ } }, { - "__docId__": 4180, + "__docId__": 4188, "kind": "set", "name": "reflectivity", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83694,7 +83910,7 @@ } }, { - "__docId__": 4181, + "__docId__": 4189, "kind": "get", "name": "reflectivity", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83715,7 +83931,7 @@ } }, { - "__docId__": 4182, + "__docId__": 4190, "kind": "get", "name": "normalMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83736,7 +83952,7 @@ } }, { - "__docId__": 4183, + "__docId__": 4191, "kind": "get", "name": "ambientMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83757,7 +83973,7 @@ } }, { - "__docId__": 4184, + "__docId__": 4192, "kind": "get", "name": "diffuseMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83778,7 +83994,7 @@ } }, { - "__docId__": 4185, + "__docId__": 4193, "kind": "get", "name": "specularMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83799,7 +84015,7 @@ } }, { - "__docId__": 4186, + "__docId__": 4194, "kind": "get", "name": "emissiveMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83820,7 +84036,7 @@ } }, { - "__docId__": 4187, + "__docId__": 4195, "kind": "get", "name": "alphaMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83841,7 +84057,7 @@ } }, { - "__docId__": 4188, + "__docId__": 4196, "kind": "get", "name": "reflectivityMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83862,7 +84078,7 @@ } }, { - "__docId__": 4189, + "__docId__": 4197, "kind": "get", "name": "occlusionMap", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83883,7 +84099,7 @@ } }, { - "__docId__": 4190, + "__docId__": 4198, "kind": "get", "name": "diffuseFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83904,7 +84120,7 @@ } }, { - "__docId__": 4191, + "__docId__": 4199, "kind": "get", "name": "specularFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83925,7 +84141,7 @@ } }, { - "__docId__": 4192, + "__docId__": 4200, "kind": "get", "name": "emissiveFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83946,7 +84162,7 @@ } }, { - "__docId__": 4193, + "__docId__": 4201, "kind": "get", "name": "alphaFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83967,7 +84183,7 @@ } }, { - "__docId__": 4194, + "__docId__": 4202, "kind": "get", "name": "reflectivityFresnel", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -83988,7 +84204,7 @@ } }, { - "__docId__": 4195, + "__docId__": 4203, "kind": "set", "name": "alphaMode", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84009,7 +84225,7 @@ } }, { - "__docId__": 4196, + "__docId__": 4204, "kind": "get", "name": "alphaMode", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84030,7 +84246,7 @@ } }, { - "__docId__": 4197, + "__docId__": 4205, "kind": "set", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84051,7 +84267,7 @@ } }, { - "__docId__": 4198, + "__docId__": 4206, "kind": "get", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84072,7 +84288,7 @@ } }, { - "__docId__": 4199, + "__docId__": 4207, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84093,7 +84309,7 @@ } }, { - "__docId__": 4200, + "__docId__": 4208, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84114,7 +84330,7 @@ } }, { - "__docId__": 4201, + "__docId__": 4209, "kind": "set", "name": "frontface", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84135,7 +84351,7 @@ } }, { - "__docId__": 4202, + "__docId__": 4210, "kind": "get", "name": "frontface", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84156,7 +84372,7 @@ } }, { - "__docId__": 4203, + "__docId__": 4211, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/PhongMaterial.js~PhongMaterial", @@ -84171,18 +84387,18 @@ "return": null }, { - "__docId__": 4204, + "__docId__": 4212, "kind": "file", "name": "src/viewer/scene/materials/PointsMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\nconst PRESETS = {\n \"default\": {\n pointSize: 4,\n roundPoints: true,\n perspectivePoints: true\n },\n \"square\": {\n pointSize: 4,\n roundPoints: false,\n perspectivePoints: true\n },\n \"round\": {\n pointSize: 4,\n roundPoints: true,\n perspectivePoints: true\n }\n};\n\n/**\n * @desc Configures the size and shape of \"points\" geometry primitives.\n *\n * * Located at {@link Scene#pointsMaterial}.\n * * Supports round and square points.\n * * Optional perspective point scaling.\n * * Globally configures \"points\" primitives for all {@link VBOSceneModel}s.\n *\n * ## Usage\n *\n * In the example below, we'll customize the {@link Scene}'s global ````PointsMaterial````, then use\n * an {@link XKTLoaderPlugin} to load a model containing a point cloud.\n *\n * [[Run this example](/examples/index.html#materials_PointsMaterial)]\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [0, 0, 5];\n * viewer.scene.camera.look = [0, 0, 0];\n * viewer.scene.camera.up = [0, 1, 0];\n *\n * viewer.scene.pointsMaterial.pointSize = 2;\n * viewer.scene.pointsMaterial.roundPoints = true;\n * viewer.scene.pointsMaterial.perspectivePoints = true;\n * viewer.scene.pointsMaterial.minPerspectivePointSize = 1;\n * viewer.scene.pointsMaterial.maxPerspectivePointSize = 6;\n * viewer.scene.pointsMaterial.filterIntensity = true;\n * viewer.scene.pointsMaterial.minIntensity = 0.0;\n * viewer.scene.pointsMaterial.maxIntensity = 1.0;\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"../assets/models/xkt/MAP-PointCloud.xkt\"\n * });\n * ````\n */\nclass PointsMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"PointsMaterial\";\n }\n\n /**\n * Gets available PointsMaterial presets.\n *\n * @type {Object}\n */\n get presets() {\n return PRESETS;\n };\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The PointsMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number} [cfg.pointSize=2] Point size in pixels.\n * @param {Boolean} [cfg.roundPoints=true] Whether points are round (````true````) or square (````false````).\n * @param {Boolean} [cfg.perspectivePoints=true] Whether apparent point size reduces with distance when {@link Camera#projection} is set to \"perspective\".\n * @param {Number} [cfg.minPerspectivePointSize=1] When ````perspectivePoints```` is ````true````, this is the minimum rendered size of each point in pixels.\n * @param {Number} [cfg.maxPerspectivePointSize=6] When ````perspectivePoints```` is ````true````, this is the maximum rendered size of each point in pixels.\n * @param {Boolean} [cfg.filterIntensity=false] When this is true, points are only rendered when their intensity value falls within the range given in {@link }\n * @param {Number} [cfg.minIntensity=0] When ````filterIntensity```` is ````true````, points with intensity below this value will not be rendered.\n * @param {Number} [cfg.maxIntensity=1] When ````filterIntensity```` is ````true````, points with intensity above this value will not be rendered.\n * @param {String} [cfg.preset] Selects a preset PointsMaterial configuration - see {@link PointsMaterial#presets}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"PointsMaterial\",\n pointSize: null,\n roundPoints: null,\n perspectivePoints: null,\n minPerspectivePointSize: null,\n maxPerspectivePointSize: null,\n filterIntensity: null,\n minIntensity: null,\n maxIntensity: null\n });\n\n if (cfg.preset) { // Apply preset then override with configs where provided\n this.preset = cfg.preset;\n if (cfg.pointSize !== undefined) {\n this.pointSize = cfg.pointSize;\n }\n if (cfg.roundPoints !== undefined) {\n this.roundPoints = cfg.roundPoints;\n }\n if (cfg.perspectivePoints !== undefined) {\n this.perspectivePoints = cfg.perspectivePoints;\n }\n if (cfg.minPerspectivePointSize !== undefined) {\n this.minPerspectivePointSize = cfg.minPerspectivePointSize;\n }\n if (cfg.maxPerspectivePointSize !== undefined) {\n this.maxPerspectivePointSize = cfg.minPerspectivePointSize;\n }\n } else {\n this._preset = \"default\";\n this.pointSize = cfg.pointSize;\n this.roundPoints = cfg.roundPoints;\n\n this.perspectivePoints = cfg.perspectivePoints;\n this.minPerspectivePointSize = cfg.minPerspectivePointSize;\n this.maxPerspectivePointSize = cfg.maxPerspectivePointSize;\n }\n\n this.filterIntensity = cfg.filterIntensity;\n this.minIntensity = cfg.minIntensity;\n this.maxIntensity = cfg.maxIntensity;\n }\n\n /**\n * Sets point size.\n *\n * Default value is ````2.0```` pixels.\n *\n * @type {Number}\n */\n set pointSize(value) {\n this._state.pointSize = value || 2.0;\n this.glRedraw();\n }\n\n /**\n * Gets point size.\n *\n * Default value is ````2.0```` pixels.\n *\n * @type {Number}\n */\n get pointSize() {\n return this._state.pointSize;\n }\n\n\n /**\n * Sets if points are round or square.\n *\n * Default is ````true```` to set points round.\n *\n * @type {Boolean}\n */\n set roundPoints(value) {\n value = (value !== false);\n if (this._state.roundPoints === value) {\n return;\n }\n this._state.roundPoints = value;\n this.scene._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets if points are round or square.\n *\n * Default is ````true```` to set points round.\n *\n * @type {Boolean}\n */\n get roundPoints() {\n return this._state.roundPoints;\n }\n\n /**\n * Sets if rendered point size reduces with distance when {@link Camera#projection} is set to ````\"perspective\"````.\n *\n * Default is ````true````.\n *\n * @type {Boolean}\n */\n set perspectivePoints(value) {\n value = (value !== false);\n if (this._state.perspectivePoints === value) {\n return;\n }\n this._state.perspectivePoints = value;\n this.scene._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets if rendered point size reduces with distance when {@link Camera#projection} is set to \"perspective\".\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n get perspectivePoints() {\n return this._state.perspectivePoints;\n }\n\n /**\n * Sets the minimum rendered size of points when {@link PointsMaterial#perspectivePoints} is ````true````.\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n set minPerspectivePointSize(value) {\n this._state.minPerspectivePointSize = value || 1.0;\n this.scene._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets the minimum rendered size of points when {@link PointsMaterial#perspectivePoints} is ````true````.\n *\n * Default value is ````1.0```` pixels.\n *\n * @type {Number}\n */\n get minPerspectivePointSize() {\n return this._state.minPerspectivePointSize;\n }\n\n /**\n * Sets the maximum rendered size of points when {@link PointsMaterial#perspectivePoints} is ````true````.\n *\n * Default value is ````6```` pixels.\n *\n * @type {Number}\n */\n set maxPerspectivePointSize(value) {\n this._state.maxPerspectivePointSize = value || 6;\n this.scene._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets the maximum rendered size of points when {@link PointsMaterial#perspectivePoints} is ````true````.\n *\n * Default value is ````6```` pixels.\n *\n * @type {Number}\n */\n get maxPerspectivePointSize() {\n return this._state.maxPerspectivePointSize;\n }\n\n /**\n * Sets if rendered point size reduces with distance when {@link Camera#projection} is set to ````\"perspective\"````.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n set filterIntensity(value) {\n value = (value !== false);\n if (this._state.filterIntensity === value) {\n return;\n }\n this._state.filterIntensity = value;\n this.scene._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets if rendered point size reduces with distance when {@link Camera#projection} is set to \"perspective\".\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n get filterIntensity() {\n return this._state.filterIntensity;\n }\n\n /**\n * Sets the minimum rendered size of points when {@link PointsMaterial#perspectivePoints} is ````true````.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n set minIntensity(value) {\n this._state.minIntensity = (value !== undefined && value !== null) ? value: 0.0;\n this.glRedraw();\n }\n\n /**\n * Gets the minimum rendered size of points when {@link PointsMaterial#filterIntensity} is ````true````.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n get minIntensity() {\n return this._state.minIntensity;\n }\n\n /**\n * Sets the maximum rendered size of points when {@link PointsMaterial#filterIntensity} is ````true````.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n set maxIntensity(value) {\n this._state.maxIntensity = (value !== undefined && value !== null) ? value: 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the maximum rendered size of points when {@link PointsMaterial#filterIntensity} is ````true````.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get maxIntensity() {\n return this._state.maxIntensity;\n }\n\n /**\n * Selects a preset ````PointsMaterial```` configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n set preset(value) {\n value = value || \"default\";\n if (this._preset === value) {\n return;\n }\n const preset = PRESETS[value];\n if (!preset) {\n this.error(\"unsupported preset: '\" + value + \"' - supported values are \" + Object.keys(PRESETS).join(\", \"));\n return;\n }\n this.pointSize = preset.pointSize;\n this.roundPoints = preset.roundPoints;\n this.perspectivePoints = preset.perspectivePoints;\n this.minPerspectivePointSize = preset.minPerspectivePointSize;\n this.maxPerspectivePointSize = preset.maxPerspectivePointSize;\n this._preset = value;\n }\n\n /**\n * The current preset ````PointsMaterial```` configuration.\n *\n * Default value is ````\"default\"````.\n *\n * @type {String}\n */\n get preset() {\n return this._preset;\n }\n\n /**\n * @private\n * @return {string}\n */\n get hash() {\n return [\n this.pointSize,\n this.roundPoints,\n this.perspectivePoints,\n this.minPerspectivePointSize,\n this.maxPerspectivePointSize,\n this.filterIntensity\n ].join((\";\"));\n }\n\n /**\n * Destroys this ````PointsMaterial````.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {PointsMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/PointsMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/PointsMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4205, + "__docId__": 4213, "kind": "variable", "name": "PRESETS", "memberof": "src/viewer/scene/materials/PointsMaterial.js", @@ -84203,7 +84419,7 @@ "ignore": true }, { - "__docId__": 4206, + "__docId__": 4214, "kind": "class", "name": "PointsMaterial", "memberof": "src/viewer/scene/materials/PointsMaterial.js", @@ -84221,7 +84437,7 @@ ] }, { - "__docId__": 4207, + "__docId__": 4215, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84240,7 +84456,7 @@ } }, { - "__docId__": 4208, + "__docId__": 4216, "kind": "get", "name": "presets", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84261,7 +84477,7 @@ } }, { - "__docId__": 4209, + "__docId__": 4217, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84418,7 +84634,7 @@ ] }, { - "__docId__": 4210, + "__docId__": 4218, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84436,7 +84652,7 @@ } }, { - "__docId__": 4217, + "__docId__": 4225, "kind": "member", "name": "_preset", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84454,7 +84670,7 @@ } }, { - "__docId__": 4226, + "__docId__": 4234, "kind": "set", "name": "pointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84475,7 +84691,7 @@ } }, { - "__docId__": 4227, + "__docId__": 4235, "kind": "get", "name": "pointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84496,7 +84712,7 @@ } }, { - "__docId__": 4228, + "__docId__": 4236, "kind": "set", "name": "roundPoints", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84517,7 +84733,7 @@ } }, { - "__docId__": 4229, + "__docId__": 4237, "kind": "get", "name": "roundPoints", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84538,7 +84754,7 @@ } }, { - "__docId__": 4230, + "__docId__": 4238, "kind": "set", "name": "perspectivePoints", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84559,7 +84775,7 @@ } }, { - "__docId__": 4231, + "__docId__": 4239, "kind": "get", "name": "perspectivePoints", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84580,7 +84796,7 @@ } }, { - "__docId__": 4232, + "__docId__": 4240, "kind": "set", "name": "minPerspectivePointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84601,7 +84817,7 @@ } }, { - "__docId__": 4233, + "__docId__": 4241, "kind": "get", "name": "minPerspectivePointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84622,7 +84838,7 @@ } }, { - "__docId__": 4234, + "__docId__": 4242, "kind": "set", "name": "maxPerspectivePointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84643,7 +84859,7 @@ } }, { - "__docId__": 4235, + "__docId__": 4243, "kind": "get", "name": "maxPerspectivePointSize", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84664,7 +84880,7 @@ } }, { - "__docId__": 4236, + "__docId__": 4244, "kind": "set", "name": "filterIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84685,7 +84901,7 @@ } }, { - "__docId__": 4237, + "__docId__": 4245, "kind": "get", "name": "filterIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84706,7 +84922,7 @@ } }, { - "__docId__": 4238, + "__docId__": 4246, "kind": "set", "name": "minIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84727,7 +84943,7 @@ } }, { - "__docId__": 4239, + "__docId__": 4247, "kind": "get", "name": "minIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84748,7 +84964,7 @@ } }, { - "__docId__": 4240, + "__docId__": 4248, "kind": "set", "name": "maxIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84769,7 +84985,7 @@ } }, { - "__docId__": 4241, + "__docId__": 4249, "kind": "get", "name": "maxIntensity", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84790,7 +85006,7 @@ } }, { - "__docId__": 4242, + "__docId__": 4250, "kind": "set", "name": "preset", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84811,7 +85027,7 @@ } }, { - "__docId__": 4249, + "__docId__": 4257, "kind": "get", "name": "preset", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84832,7 +85048,7 @@ } }, { - "__docId__": 4250, + "__docId__": 4258, "kind": "get", "name": "hash", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84859,7 +85075,7 @@ } }, { - "__docId__": 4251, + "__docId__": 4259, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/PointsMaterial.js~PointsMaterial", @@ -84874,18 +85090,18 @@ "return": null }, { - "__docId__": 4252, + "__docId__": 4260, "kind": "file", "name": "src/viewer/scene/materials/SpecularMaterial.js", "content": "import {Material} from './Material.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from '../math/math.js';\n\nconst alphaModes = {\"opaque\": 0, \"mask\": 1, \"blend\": 2};\nconst alphaModeNames = [\"opaque\", \"mask\", \"blend\"];\n\n/**\n * @desc Configures the normal rendered appearance of {@link Mesh}es using the physically-accurate *specular-glossiness* shading model.\n *\n * * Useful for insulators, such as wood, ceramics and plastic.\n * * {@link MetallicMaterial} is best for conductive materials, such as metal.\n * * {@link PhongMaterial} is appropriate for non-realistic objects.\n * * {@link LambertMaterial} is appropriate for high-detail models that need to render as efficiently as possible.\n *\n * ## Usage\n *\n * In the example below we'll create a {@link Mesh} with a {@link buildTorusGeometry} and a SpecularMaterial.\n *\n * Note that in this example we're providing separate {@link Texture} for the {@link SpecularMaterial#specular} and {@link SpecularMaterial#glossiness}\n * channels, which allows us a little creative flexibility. Then, in the next example further down, we'll combine those channels\n * within the same {@link Texture} for efficiency.\n *\n * ````javascript\n * import {Viewer, Mesh, buildTorusGeometry, SpecularMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({ canvasId: \"myCanvas\" });\n *\n * const myMesh = new Mesh(viewer.scene,{\n *\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry()),\n *\n * material: new SpecularMaterial(viewer.scene,{\n *\n * // Channels with default values, just to show them\n *\n * diffuse: [1.0, 1.0, 1.0],\n * specular: [1.0, 1.0, 1.0],\n * glossiness: 1.0,\n * emissive: [0.0, 0.0, 0.0]\n * alpha: 1.0,\n *\n * // Textures to multiply some of the channels\n *\n * diffuseMap: new Texture(viewer.scene, { // RGB components multiply by diffuse\n * src: \"textures/diffuse.jpg\"\n * }),\n * specularMap: new Texture(viewer.scene, { // RGB component multiplies by specular\n * src: \"textures/specular.jpg\"\n * }),\n * glossinessMap: new Texture(viewer.scene, { // R component multiplies by glossiness\n * src: \"textures/glossiness.jpg\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"textures/normalMap.jpg\"\n * })\n * })\n * });\n * ````\n *\n * ## Combining Channels Within the Same Textures\n *\n * In the previous example we provided separate {@link Texture} for the {@link SpecularMaterial#specular} and\n * {@link SpecularMaterial#glossiness} channels, but we can combine those channels into the same {@link Texture} to reduce\n * download time, memory footprint and rendering time (and also for glTF compatibility).\n *\n * Here's our SpecularMaterial again with those channels combined in the {@link SpecularMaterial#specularGlossinessMap}\n * {@link Texture}, where the *RGB* component multiplies by {@link SpecularMaterial#specular} and *A* multiplies by {@link SpecularMaterial#glossiness}.\n *\n * ````javascript\n * const myMesh = new Mesh(viewer.scene,{\n *\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry()),\n *\n * material: new SpecularMaterial(viewer.scene,{\n *\n * // Channels with default values, just to show them\n *\n * diffuse: [1.0, 1.0, 1.0],\n * specular: [1.0, 1.0, 1.0],\n * glossiness: 1.0,\n * emissive: [0.0, 0.0, 0.0]\n * alpha: 1.0,\n *\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse.jpg\"\n * }),\n * specularGlossinessMap: new Texture(viewer.scene, { // RGB multiplies by specular, A by glossiness\n * src: \"textures/specularGlossiness.jpg\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"textures/normalMap.jpg\"\n * })\n * })\n * });\n * ````\n *\n * Although not shown in this example, we can also texture {@link SpecularMaterial#alpha} with\n * the *A* component of {@link SpecularMaterial#diffuseMap}'s {@link Texture}, if required.\n *\n * ## Alpha Blending\n *\n * Let's make our {@link Mesh} transparent. We'll redefine {@link SpecularMaterial#alpha}\n * and {@link SpecularMaterial#alphaMode}, causing it to blend 50% with the background:\n *\n * ````javascript\n * const myMesh = new Mesh(viewer.scene,{\n *\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry()),\n *\n * material: new SpecularMaterial(viewer.scene,{\n *\n * // Channels with default values, just to show them\n *\n * diffuse: [1.0, 1.0, 1.0],\n * specular: [1.0, 1.0, 1.0],\n * glossiness: 1.0,\n * emissive: [0.0, 0.0, 0.0]\n * alpha: 0.5, // <<----------- Changed\n * alphaMode: \"blend\", // <<----------- Added\n *\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse.jpg\"\n * }),\n * specularGlossinessMap: new Texture(viewer.scene, { // RGB multiplies by specular, A by glossiness\n * src: \"textures/specularGlossiness.jpg\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"textures/normalMap.jpg\"\n * })\n * })\n * });\n * ````\n *\n * ## Alpha Masking\n *\n * Now let's make holes in our {@link Mesh}. We'll give its SpecularMaterial an {@link SpecularMaterial#alphaMap}\n * and configure {@link SpecularMaterial#alpha}, {@link SpecularMaterial#alphaMode},\n * and {@link SpecularMaterial#alphaCutoff} to treat it as an alpha mask:\n *\n * ````javascript\n * const myMesh = new Mesh(viewer.scene,{\n *\n * geometry: buildTorusGeometry(viewer.scene, ReadableGeometry, {}),\n *\n * material: new SpecularMaterial(viewer.scene, {\n *\n * // Channels with default values, just to show them\n *\n * diffuse: [1.0, 1.0, 1.0],\n * specular: [1.0, 1.0, 1.0],\n * glossiness: 1.0,\n * emissive: [0.0, 0.0, 0.0]\n * alpha: 1.0, // <<----------- Changed\n * alphaMode: \"mask\", // <<----------- Changed\n * alphaCutoff: 0.2, // <<----------- Added\n *\n * alphaMap: new Texture(viewer.scene, { // <<---------- Added\n * src: \"textures/diffuse/crossGridColorMap.jpg\"\n * }),\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse.jpg\"\n * }),\n * specularGlossinessMap: new Texture(viewer.scene, { // RGB multiplies by specular, A by glossiness\n * src: \"textures/specularGlossiness.jpg\"\n * }),\n * normalMap: new Texture(viewer.scene, {\n * src: \"textures/normalMap.jpg\"\n * })\n * })\n * });\n * ````\n *\n * ## Background Theory\n *\n * For an introduction to physically-based rendering (PBR) concepts, try these articles:\n *\n * * Joe Wilson's [Basic Theory of Physically-Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)\n * * Jeff Russel's [Physically-based Rendering, and you can too!](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)\n * * Sebastien Legarde's [Adapting a physically-based shading model](http://seblagarde.wordpress.com/tag/physically-based-rendering/)\n *\n * ## SpecularMaterial Properties\n *\n * The following table summarizes SpecularMaterial properties:\n *\n * | Property | Type | Range | Default Value | Space | Description |\n * |:--------:|:----:|:-----:|:-------------:|:-----:|:-----------:|\n * | {@link SpecularMaterial#diffuse} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the diffuse color of the material. |\n * | {@link SpecularMaterial#specular} | Array | [0, 1] for all components | [1,1,1,1] | linear | The RGB components of the specular color of the material. |\n * | {@link SpecularMaterial#glossiness} | Number | [0, 1] | 1 | linear | The glossiness the material. |\n * | {@link SpecularMaterial#specularF0} | Number | [0, 1] | 1 | linear | The specularF0 of the material surface. |\n * | {@link SpecularMaterial#emissive} | Array | [0, 1] for all components | [0,0,0] | linear | The RGB components of the emissive color of the material. |\n * | {@link SpecularMaterial#alpha} | Number | [0, 1] | 1 | linear | The transparency of the material surface (0 fully transparent, 1 fully opaque). |\n * | {@link SpecularMaterial#diffuseMap} | {@link Texture} | | null | sRGB | Texture RGB components multiplying by {@link SpecularMaterial#diffuse}. If the fourth component (A) is present, it multiplies by {@link SpecularMaterial#alpha}. |\n * | {@link SpecularMaterial#specularMap} | {@link Texture} | | null | sRGB | Texture RGB components multiplying by {@link SpecularMaterial#specular}. If the fourth component (A) is present, it multiplies by {@link SpecularMaterial#alpha}. |\n * | {@link SpecularMaterial#glossinessMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link SpecularMaterial#glossiness}. |\n * | {@link SpecularMaterial#specularGlossinessMap} | {@link Texture} | | null | linear | Texture with first three components multiplying by {@link SpecularMaterial#specular} and fourth component multiplying by {@link SpecularMaterial#glossiness}. |\n * | {@link SpecularMaterial#emissiveMap} | {@link Texture} | | null | linear | Texture with RGB components multiplying by {@link SpecularMaterial#emissive}. |\n * | {@link SpecularMaterial#alphaMap} | {@link Texture} | | null | linear | Texture with first component multiplying by {@link SpecularMaterial#alpha}. |\n * | {@link SpecularMaterial#occlusionMap} | {@link Texture} | | null | linear | Ambient occlusion texture multiplying by surface's reflected diffuse and specular light. |\n * | {@link SpecularMaterial#normalMap} | {@link Texture} | | null | linear | Tangent-space normal map. |\n * | {@link SpecularMaterial#alphaMode} | String | \"opaque\", \"blend\", \"mask\" | \"blend\" | | Alpha blend mode. |\n * | {@link SpecularMaterial#alphaCutoff} | Number | [0..1] | 0.5 | | Alpha cutoff value. |\n * | {@link SpecularMaterial#backfaces} | Boolean | | false | | Whether to render {@link Geometry} backfaces. |\n * | {@link SpecularMaterial#frontface} | String | \"ccw\", \"cw\" | \"ccw\" | | The winding order for {@link Geometry} frontfaces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise. |\n *\n */\nclass SpecularMaterial extends Material {\n\n /**\n @private\n */\n get type() {\n return \"SpecularMaterial\";\n }\n\n /**\n *\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] The SpecularMaterial configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.diffuse=[1,1,1]] RGB diffuse color of this SpecularMaterial. Multiplies by the RGB components of {@link SpecularMaterial#diffuseMap}.\n * @param {Texture} [cfg.diffuseMap=undefined] RGBA {@link Texture} containing the diffuse color of this SpecularMaterial, with optional *A* component for alpha. The RGB components multiply by {@link SpecularMaterial#diffuse}, while the *A* component, if present, multiplies by {@link SpecularMaterial#alpha}.\n * @param {Number} [cfg.specular=[1,1,1]] RGB specular color of this SpecularMaterial. Multiplies by the {@link SpecularMaterial#specularMap} and the *RGB* components of {@link SpecularMaterial#specularGlossinessMap}.\n * @param {Texture} [cfg.specularMap=undefined] RGB texture containing the specular color of this SpecularMaterial. Multiplies by the {@link SpecularMaterial#specular} property. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {Number} [cfg.glossiness=1.0] Factor in the range [0..1] indicating how glossy this SpecularMaterial is. 0 is no glossiness, 1 is full glossiness. Multiplies by the *R* component of {@link SpecularMaterial#glossinessMap} and the *A* component of {@link SpecularMaterial#specularGlossinessMap}.\n * @param {Texture} [cfg.specularGlossinessMap=undefined] RGBA {@link Texture} containing this SpecularMaterial's specular color in its *RGB* component and glossiness in its *A* component. Its *RGB* components multiply by {@link SpecularMaterial#specular}, while its *A* component multiplies by {@link SpecularMaterial#glossiness}. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {Number} [cfg.specularF0=0.0] Factor in the range 0..1 indicating how reflective this SpecularMaterial is.\n * @param {Number[]} [cfg.emissive=[0,0,0]] RGB emissive color of this SpecularMaterial. Multiplies by the RGB components of {@link SpecularMaterial#emissiveMap}.\n * @param {Texture} [cfg.emissiveMap=undefined] RGB {@link Texture} containing the emissive color of this SpecularMaterial. Multiplies by the {@link SpecularMaterial#emissive} property. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {Texture} [cfg.occlusionMap=undefined] RGB ambient occlusion {@link Texture}. Within shaders, multiplies by the specular and diffuse light reflected by surfaces. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {Texture} [cfg.normalMap=undefined] {Texture} RGB tangent-space normal {@link Texture}. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {Number} [cfg.alpha=1.0] Factor in the range 0..1 indicating how transparent this SpecularMaterial is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque. Multiplies by the *R* component of {@link SpecularMaterial#alphaMap} and the *A* component, if present, of {@link SpecularMaterial#diffuseMap}.\n * @param {Texture} [cfg.alphaMap=undefined] RGB {@link Texture} containing this SpecularMaterial's alpha in its *R* component. The *R* component multiplies by the {@link SpecularMaterial#alpha} property. Must be within the same {@link Scene} as this SpecularMaterial.\n * @param {String} [cfg.alphaMode=\"opaque\"] The alpha blend mode - accepted values are \"opaque\", \"blend\" and \"mask\". See the {@link SpecularMaterial#alphaMode} property for more info.\n * @param {Number} [cfg.alphaCutoff=0.5] The alpha cutoff value. See the {@link SpecularMaterial#alphaCutoff} property for more info.\n * @param {Boolean} [cfg.backfaces=false] Whether to render {@link Geometry} backfaces.\n * @param {Boolean} [cfg.frontface=\"ccw\"] The winding order for {@link Geometry} front faces - \"cw\" for clockwise, or \"ccw\" for counter-clockwise.\n * @param {Number} [cfg.lineWidth=1] Scalar that controls the width of {@link Geometry lines.\n * @param {Number} [cfg.pointSize=1] Scalar that controls the size of {@link Geometry} points.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n type: \"SpecularMaterial\",\n diffuse: math.vec3([1.0, 1.0, 1.0]),\n emissive: math.vec3([0.0, 0.0, 0.0]),\n specular: math.vec3([1.0, 1.0, 1.0]),\n glossiness: null,\n specularF0: null,\n alpha: null,\n alphaMode: null,\n alphaCutoff: null,\n lineWidth: null,\n pointSize: null,\n backfaces: null,\n frontface: null, // Boolean for speed; true == \"ccw\", false == \"cw\"\n hash: null\n });\n\n this.diffuse = cfg.diffuse;\n this.specular = cfg.specular;\n this.glossiness = cfg.glossiness;\n this.specularF0 = cfg.specularF0;\n this.emissive = cfg.emissive;\n this.alpha = cfg.alpha;\n\n if (cfg.diffuseMap) {\n this._diffuseMap = this._checkComponent(\"Texture\", cfg.diffuseMap);\n }\n if (cfg.emissiveMap) {\n this._emissiveMap = this._checkComponent(\"Texture\", cfg.emissiveMap);\n }\n if (cfg.specularMap) {\n this._specularMap = this._checkComponent(\"Texture\", cfg.specularMap);\n }\n if (cfg.glossinessMap) {\n this._glossinessMap = this._checkComponent(\"Texture\", cfg.glossinessMap);\n }\n if (cfg.specularGlossinessMap) {\n this._specularGlossinessMap = this._checkComponent(\"Texture\", cfg.specularGlossinessMap);\n }\n if (cfg.occlusionMap) {\n this._occlusionMap = this._checkComponent(\"Texture\", cfg.occlusionMap);\n }\n if (cfg.alphaMap) {\n this._alphaMap = this._checkComponent(\"Texture\", cfg.alphaMap);\n }\n if (cfg.normalMap) {\n this._normalMap = this._checkComponent(\"Texture\", cfg.normalMap);\n }\n\n this.alphaMode = cfg.alphaMode;\n this.alphaCutoff = cfg.alphaCutoff;\n this.backfaces = cfg.backfaces;\n this.frontface = cfg.frontface;\n\n this.lineWidth = cfg.lineWidth;\n this.pointSize = cfg.pointSize;\n\n this._makeHash();\n }\n\n _makeHash() {\n const state = this._state;\n const hash = [\"/spe\"];\n if (this._diffuseMap) {\n hash.push(\"/dm\");\n if (this._diffuseMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n hash.push(\"/\" + this._diffuseMap.encoding);\n }\n if (this._emissiveMap) {\n hash.push(\"/em\");\n if (this._emissiveMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._glossinessMap) {\n hash.push(\"/gm\");\n if (this._glossinessMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._specularMap) {\n hash.push(\"/sm\");\n if (this._specularMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._specularGlossinessMap) {\n hash.push(\"/sgm\");\n if (this._specularGlossinessMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._occlusionMap) {\n hash.push(\"/ocm\");\n if (this._occlusionMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._normalMap) {\n hash.push(\"/nm\");\n if (this._normalMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n if (this._alphaMap) {\n hash.push(\"/opm\");\n if (this._alphaMap.hasMatrix) {\n hash.push(\"/mat\");\n }\n }\n hash.push(\";\");\n state.hash = hash.join(\"\");\n }\n\n /**\n * Sets the RGB diffuse color of this SpecularMaterial.\n *\n * Multiplies by the *RGB* components of {@link SpecularMaterial#diffuseMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n * @type {Number[]}\n */\n set diffuse(value) {\n let diffuse = this._state.diffuse;\n if (!diffuse) {\n diffuse = this._state.diffuse = new Float32Array(3);\n } else if (value && diffuse[0] === value[0] && diffuse[1] === value[1] && diffuse[2] === value[2]) {\n return;\n }\n if (value) {\n diffuse[0] = value[0];\n diffuse[1] = value[1];\n diffuse[2] = value[2];\n } else {\n diffuse[0] = 1;\n diffuse[1] = 1;\n diffuse[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB diffuse color of this SpecularMaterial.\n *\n * @type {Number[]}\n */\n get diffuse() {\n return this._state.diffuse;\n }\n\n /**\n * Gets the RGB {@link Texture} containing the diffuse color of this SpecularMaterial, with optional *A* component for alpha.\n *\n * The *RGB* components multipliues by the {@link SpecularMaterial#diffuse} property, while the *A* component, if present, multiplies by the {@link SpecularMaterial#alpha} property.\n *\n * @type {Texture}\n */\n get diffuseMap() {\n return this._diffuseMap;\n }\n\n /**\n * Sets the RGB specular color of this SpecularMaterial.\n *\n * Multiplies by {@link SpecularMaterial#specularMap} and the *A* component of {@link SpecularMaterial#specularGlossinessMap}.\n *\n * Default value is ````[1.0, 1.0, 1.0]````.\n *\n * @type {Number[]}\n */\n set specular(value) {\n let specular = this._state.specular;\n if (!specular) {\n specular = this._state.specular = new Float32Array(3);\n } else if (value && specular[0] === value[0] && specular[1] === value[1] && specular[2] === value[2]) {\n return;\n }\n if (value) {\n specular[0] = value[0];\n specular[1] = value[1];\n specular[2] = value[2];\n } else {\n specular[0] = 1;\n specular[1] = 1;\n specular[2] = 1;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB specular color of this SpecularMaterial.\n *\n * @type {Number[]}\n */\n get specular() {\n return this._state.specular;\n }\n\n /**\n * Gets the RGB texture containing the specular color of this SpecularMaterial.\n *\n * Multiplies by {@link SpecularMaterial#specular}.\n *\n * @type {Texture}\n */\n get specularMap() {\n return this._specularMap;\n }\n\n /**\n * Gets the RGBA texture containing this SpecularMaterial's specular color in its *RGB* components and glossiness in its *A* component.\n *\n * The *RGB* components multiplies {@link SpecularMaterial#specular}, while the *A* component multiplies by {@link SpecularMaterial#glossiness}.\n *\n * @type {Texture}\n */\n get specularGlossinessMap() {\n return this._specularGlossinessMap;\n }\n\n /**\n * Sets the Factor in the range [0..1] indicating how glossy this SpecularMaterial is.\n *\n * ````0```` is no glossiness, ````1```` is full glossiness.\n *\n * Multiplies by the *R* component of {@link SpecularMaterial#glossinessMap} and the *A* component of {@link SpecularMaterial#specularGlossinessMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set glossiness(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.glossiness === value) {\n return;\n }\n this._state.glossiness = value;\n this.glRedraw();\n }\n\n /**\n * Gets the Factor in the range ````[0..1]```` indicating how glossy this SpecularMaterial is.\n\n * @type {Number}\n */\n get glossiness() {\n return this._state.glossiness;\n }\n\n /**\n * Gets the RGB texture containing this SpecularMaterial's glossiness in its *R* component.\n *\n * The *R* component multiplies by {@link SpecularMaterial#glossiness}.\n ** @type {Texture}\n */\n get glossinessMap() {\n return this._glossinessMap;\n }\n\n /**\n * Sets the factor in the range ````[0..1]```` indicating amount of specular Fresnel.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n set specularF0(value) {\n value = (value !== undefined && value !== null) ? value : 0.0;\n if (this._state.specularF0 === value) {\n return;\n }\n this._state.specularF0 = value;\n this.glRedraw();\n }\n\n /**\n * Gets the factor in the range ````[0..1]```` indicating amount of specular Fresnel.\n *\n * @type {Number}\n */\n get specularF0() {\n return this._state.specularF0;\n }\n\n /**\n * Sets the RGB emissive color of this SpecularMaterial.\n *\n * Multiplies by {@link SpecularMaterial#emissiveMap}.\n\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @type {Number[]}\n */\n set emissive(value) {\n let emissive = this._state.emissive;\n if (!emissive) {\n emissive = this._state.emissive = new Float32Array(3);\n } else if (value && emissive[0] === value[0] && emissive[1] === value[1] && emissive[2] === value[2]) {\n return;\n }\n if (value) {\n emissive[0] = value[0];\n emissive[1] = value[1];\n emissive[2] = value[2];\n } else {\n emissive[0] = 0;\n emissive[1] = 0;\n emissive[2] = 0;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the RGB emissive color of this SpecularMaterial.\n *\n * @type {Number[]}\n */\n get emissive() {\n return this._state.emissive;\n }\n\n /**\n * Gets the RGB texture containing the emissive color of this SpecularMaterial.\n *\n * Multiplies by {@link SpecularMaterial#emissive}.\n *\n * @type {Texture}\n */\n get emissiveMap() {\n return this._emissiveMap;\n }\n\n /**\n * Sets the factor in the range [0..1] indicating how transparent this SpecularMaterial is.\n *\n * A value of ````0.0```` is fully transparent, while ````1.0```` is fully opaque.\n *\n * Multiplies by the *R* component of {@link SpecularMaterial#alphaMap} and the *A* component, if present, of {@link SpecularMaterial#diffuseMap}.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set alpha(value) {\n value = (value !== undefined && value !== null) ? value : 1.0;\n if (this._state.alpha === value) {\n return;\n }\n this._state.alpha = value;\n this.glRedraw();\n }\n\n /**\n * Gets the factor in the range [0..1] indicating how transparent this SpecularMaterial is.\n *\n * @type {Number}\n */\n get alpha() {\n return this._state.alpha;\n }\n\n /**\n * Gets the RGB {@link Texture} with alpha in its *R* component.\n *\n * The *R* component multiplies by the {@link SpecularMaterial#alpha} property.\n *\n * @type {Texture}\n */\n get alphaMap() {\n return this._alphaMap;\n }\n\n /**\n * Gets the RGB tangent-space normal {@link Texture} attached to this SpecularMaterial.\n *\n * @type {Texture}\n */\n get normalMap() {\n return this._normalMap;\n }\n\n /**\n * Gets the RGB ambient occlusion {@link Texture} attached to this SpecularMaterial.\n *\n * Multiplies by the specular and diffuse light reflected by surfaces.\n *\n * @type {Texture}\n */\n get occlusionMap() {\n return this._occlusionMap;\n }\n\n /**\n * Sets the alpha rendering mode.\n *\n * This governs how alpha is treated. Alpha is the combined result of the {@link SpecularMaterial#alpha} and {@link SpecularMaterial#alphaMap} properties.\n *\n * Accepted values are:\n *\n * * \"opaque\" - The alpha value is ignored and the rendered output is fully opaque (default).\n * * \"mask\" - The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value.\n * * \"blend\" - The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator)\n *\n * @type {String}\n */\n set alphaMode(alphaMode) {\n alphaMode = alphaMode || \"opaque\";\n let value = alphaModes[alphaMode];\n if (value === undefined) {\n this.error(\"Unsupported value for 'alphaMode': \" + alphaMode + \" defaulting to 'opaque'\");\n value = \"opaque\";\n }\n if (this._state.alphaMode === value) {\n return;\n }\n this._state.alphaMode = value;\n this.glRedraw();\n }\n\n get alphaMode() {\n return alphaModeNames[this._state.alphaMode];\n }\n\n /**\n * Sets the alpha cutoff value.\n *\n * Specifies the cutoff threshold when {@link SpecularMaterial#alphaMode} equals \"mask\". If the alpha is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. A value greater than 1.0 will render the entire material as fully transparent. This value is ignored for other modes.\n *\n * Alpha is the combined result of the {@link SpecularMaterial#alpha} and {@link SpecularMaterial#alphaMap} properties.\n *\n * Default value is ````0.5````.\n *\n * @type {Number}\n */\n set alphaCutoff(alphaCutoff) {\n if (alphaCutoff === null || alphaCutoff === undefined) {\n alphaCutoff = 0.5;\n }\n if (this._state.alphaCutoff === alphaCutoff) {\n return;\n }\n this._state.alphaCutoff = alphaCutoff;\n }\n\n /**\n * Gets the alpha cutoff value.\n\n * @type {Number}\n */\n get alphaCutoff() {\n return this._state.alphaCutoff;\n }\n\n /**\n * Sets whether backfaces are visible on attached {@link Mesh}es.\n *\n * The backfaces will belong to {@link ReadableGeometry} compoents that are also attached to the {@link Mesh}es.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n set backfaces(value) {\n value = !!value;\n if (this._state.backfaces === value) {\n return;\n }\n this._state.backfaces = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether backfaces are visible on attached {@link Mesh}es.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._state.backfaces;\n }\n\n /**\n * Sets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n *\n * Default value is ````\"ccw\"````.\n *\n * @type {String}\n */\n set frontface(value) {\n value = value !== \"cw\";\n if (this._state.frontface === value) {\n return;\n }\n this._state.frontface = value;\n this.glRedraw();\n }\n\n /**\n * Gets the winding direction of front faces of {@link Geometry} of attached {@link Mesh}es.\n *\n * @type {String}\n */\n get frontface() {\n return this._state.frontface ? \"ccw\" : \"cw\";\n }\n\n /**\n * Sets the SpecularMaterial's line width.\n *\n * This is not supported by WebGL implementations based on DirectX [2019].\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set lineWidth(value) {\n this._state.lineWidth = value || 1.0;\n this.glRedraw();\n }\n\n /**\n * Gets the SpecularMaterial's line width.\n *\n * @type {Number}\n */\n get lineWidth() {\n return this._state.lineWidth;\n }\n\n /**\n * Sets the SpecularMaterial's point size.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set pointSize(value) {\n this._state.pointSize = value || 1;\n this.glRedraw();\n }\n\n /**\n * Sets the SpecularMaterial's point size.\n *\n * @type {Number}\n */\n get pointSize() {\n return this._state.pointSize;\n }\n\n /**\n * Destroys this SpecularMaterial.\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {SpecularMaterial};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/SpecularMaterial.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/SpecularMaterial.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4253, + "__docId__": 4261, "kind": "variable", "name": "alphaModes", "memberof": "src/viewer/scene/materials/SpecularMaterial.js", @@ -84906,7 +85122,7 @@ "ignore": true }, { - "__docId__": 4254, + "__docId__": 4262, "kind": "variable", "name": "alphaModeNames", "memberof": "src/viewer/scene/materials/SpecularMaterial.js", @@ -84927,7 +85143,7 @@ "ignore": true }, { - "__docId__": 4255, + "__docId__": 4263, "kind": "class", "name": "SpecularMaterial", "memberof": "src/viewer/scene/materials/SpecularMaterial.js", @@ -84945,7 +85161,7 @@ ] }, { - "__docId__": 4256, + "__docId__": 4264, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -84964,7 +85180,7 @@ } }, { - "__docId__": 4257, + "__docId__": 4265, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85255,7 +85471,7 @@ ] }, { - "__docId__": 4258, + "__docId__": 4266, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85273,7 +85489,7 @@ } }, { - "__docId__": 4265, + "__docId__": 4273, "kind": "member", "name": "_diffuseMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85291,7 +85507,7 @@ } }, { - "__docId__": 4266, + "__docId__": 4274, "kind": "member", "name": "_emissiveMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85309,7 +85525,7 @@ } }, { - "__docId__": 4267, + "__docId__": 4275, "kind": "member", "name": "_specularMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85327,7 +85543,7 @@ } }, { - "__docId__": 4268, + "__docId__": 4276, "kind": "member", "name": "_glossinessMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85345,7 +85561,7 @@ } }, { - "__docId__": 4269, + "__docId__": 4277, "kind": "member", "name": "_specularGlossinessMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85363,7 +85579,7 @@ } }, { - "__docId__": 4270, + "__docId__": 4278, "kind": "member", "name": "_occlusionMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85381,7 +85597,7 @@ } }, { - "__docId__": 4271, + "__docId__": 4279, "kind": "member", "name": "_alphaMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85399,7 +85615,7 @@ } }, { - "__docId__": 4272, + "__docId__": 4280, "kind": "member", "name": "_normalMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85417,7 +85633,7 @@ } }, { - "__docId__": 4279, + "__docId__": 4287, "kind": "method", "name": "_makeHash", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85434,7 +85650,7 @@ "return": null }, { - "__docId__": 4280, + "__docId__": 4288, "kind": "set", "name": "diffuse", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85455,7 +85671,7 @@ } }, { - "__docId__": 4281, + "__docId__": 4289, "kind": "get", "name": "diffuse", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85476,7 +85692,7 @@ } }, { - "__docId__": 4282, + "__docId__": 4290, "kind": "get", "name": "diffuseMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85497,7 +85713,7 @@ } }, { - "__docId__": 4283, + "__docId__": 4291, "kind": "set", "name": "specular", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85518,7 +85734,7 @@ } }, { - "__docId__": 4284, + "__docId__": 4292, "kind": "get", "name": "specular", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85539,7 +85755,7 @@ } }, { - "__docId__": 4285, + "__docId__": 4293, "kind": "get", "name": "specularMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85560,7 +85776,7 @@ } }, { - "__docId__": 4286, + "__docId__": 4294, "kind": "get", "name": "specularGlossinessMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85581,7 +85797,7 @@ } }, { - "__docId__": 4287, + "__docId__": 4295, "kind": "set", "name": "glossiness", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85602,7 +85818,7 @@ } }, { - "__docId__": 4288, + "__docId__": 4296, "kind": "get", "name": "glossiness", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85623,7 +85839,7 @@ } }, { - "__docId__": 4289, + "__docId__": 4297, "kind": "get", "name": "glossinessMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85641,7 +85857,7 @@ } }, { - "__docId__": 4290, + "__docId__": 4298, "kind": "set", "name": "specularF0", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85662,7 +85878,7 @@ } }, { - "__docId__": 4291, + "__docId__": 4299, "kind": "get", "name": "specularF0", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85683,7 +85899,7 @@ } }, { - "__docId__": 4292, + "__docId__": 4300, "kind": "set", "name": "emissive", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85704,7 +85920,7 @@ } }, { - "__docId__": 4293, + "__docId__": 4301, "kind": "get", "name": "emissive", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85725,7 +85941,7 @@ } }, { - "__docId__": 4294, + "__docId__": 4302, "kind": "get", "name": "emissiveMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85746,7 +85962,7 @@ } }, { - "__docId__": 4295, + "__docId__": 4303, "kind": "set", "name": "alpha", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85767,7 +85983,7 @@ } }, { - "__docId__": 4296, + "__docId__": 4304, "kind": "get", "name": "alpha", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85788,7 +86004,7 @@ } }, { - "__docId__": 4297, + "__docId__": 4305, "kind": "get", "name": "alphaMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85809,7 +86025,7 @@ } }, { - "__docId__": 4298, + "__docId__": 4306, "kind": "get", "name": "normalMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85830,7 +86046,7 @@ } }, { - "__docId__": 4299, + "__docId__": 4307, "kind": "get", "name": "occlusionMap", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85851,7 +86067,7 @@ } }, { - "__docId__": 4300, + "__docId__": 4308, "kind": "set", "name": "alphaMode", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85872,7 +86088,7 @@ } }, { - "__docId__": 4301, + "__docId__": 4309, "kind": "get", "name": "alphaMode", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85891,7 +86107,7 @@ } }, { - "__docId__": 4302, + "__docId__": 4310, "kind": "set", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85912,7 +86128,7 @@ } }, { - "__docId__": 4303, + "__docId__": 4311, "kind": "get", "name": "alphaCutoff", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85933,7 +86149,7 @@ } }, { - "__docId__": 4304, + "__docId__": 4312, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85954,7 +86170,7 @@ } }, { - "__docId__": 4305, + "__docId__": 4313, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85975,7 +86191,7 @@ } }, { - "__docId__": 4306, + "__docId__": 4314, "kind": "set", "name": "frontface", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -85996,7 +86212,7 @@ } }, { - "__docId__": 4307, + "__docId__": 4315, "kind": "get", "name": "frontface", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86017,7 +86233,7 @@ } }, { - "__docId__": 4308, + "__docId__": 4316, "kind": "set", "name": "lineWidth", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86038,7 +86254,7 @@ } }, { - "__docId__": 4309, + "__docId__": 4317, "kind": "get", "name": "lineWidth", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86059,7 +86275,7 @@ } }, { - "__docId__": 4310, + "__docId__": 4318, "kind": "set", "name": "pointSize", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86080,7 +86296,7 @@ } }, { - "__docId__": 4311, + "__docId__": 4319, "kind": "get", "name": "pointSize", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86101,7 +86317,7 @@ } }, { - "__docId__": 4312, + "__docId__": 4320, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/SpecularMaterial.js~SpecularMaterial", @@ -86116,18 +86332,18 @@ "return": null }, { - "__docId__": 4313, + "__docId__": 4321, "kind": "file", "name": "src/viewer/scene/materials/Texture.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {Texture2D} from '../webgl/Texture2D.js';\nimport {math} from '../math/math.js';\nimport {stats} from '../stats.js';\nimport {\n ClampToEdgeWrapping, LinearEncoding,\n LinearFilter,\n LinearMipMapLinearFilter,\n LinearMipMapNearestFilter, MirroredRepeatWrapping, NearestFilter,\n NearestMipMapLinearFilter, NearestMipMapNearestFilter, RepeatWrapping, sRGBEncoding\n} from \"../constants/constants.js\";\n\nfunction ensureImageSizePowerOfTwo(image) {\n if (!isPowerOfTwo(image.width) || !isPowerOfTwo(image.height)) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = nextHighestPowerOfTwo(image.width);\n canvas.height = nextHighestPowerOfTwo(image.height);\n const ctx = canvas.getContext(\"2d\");\n ctx.drawImage(image,\n 0, 0, image.width, image.height,\n 0, 0, canvas.width, canvas.height);\n image = canvas;\n }\n return image;\n}\n\nfunction isPowerOfTwo(x) {\n return (x & (x - 1)) === 0;\n}\n\nfunction nextHighestPowerOfTwo(x) {\n --x;\n for (let i = 1; i < 32; i <<= 1) {\n x = x | x >> i;\n }\n return x + 1;\n}\n\n/**\n * @desc A 2D texture map.\n *\n * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.\n * * To create a Texture from an image file, set {@link Texture#src} to the image file path.\n * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.\n *\n * ## Usage\n *\n * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.\n *\n * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those\n * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly\n * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.\n *\n * [[Run this example](/examples/index.html#materials_Texture)]\n *\n * ```` javascript\n * import {Viewer, Mesh, buildTorusGeometry,\n * ReadableGeometry, PhongMaterial, Texture} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.camera.eye = [0, 0, 5];\n * viewer.camera.look = [0, 0, 0];\n * viewer.camera.up = [0, 1, 0];\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({\n * center: [0, 0, 0],\n * radius: 1.5,\n * tube: 0.5,\n * radialSegments: 32,\n * tubeSegments: 24,\n * arc: Math.PI * 2.0\n * }),\n * material: new PhongMaterial(viewer.scene, {\n * ambient: [0.9, 0.3, 0.9],\n * shininess: 30,\n * diffuseMap: new Texture(viewer.scene, {\n * src: \"textures/diffuse/uvGrid2.jpg\"\n * })\n * })\n * });\n *````\n */\nclass Texture extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Texture\";\n }\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.\n * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.\n * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.\n * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.\n * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.\n * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.\n * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.\n * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..\n * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.\n * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.\n * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.\n * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.\n * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n texture: new Texture2D({gl: this.scene.canvas.gl}),\n matrix: math.identityMat4(),\n hasMatrix: (cfg.translate && (cfg.translate[0] !== 0 || cfg.translate[1] !== 0)) || (!!cfg.rotate) || (cfg.scale && (cfg.scale[0] !== 0 || cfg.scale[1] !== 0)),\n minFilter: this._checkMinFilter(cfg.minFilter),\n magFilter: this._checkMagFilter(cfg.magFilter),\n wrapS: this._checkWrapS(cfg.wrapS),\n wrapT: this._checkWrapT(cfg.wrapT),\n flipY: this._checkFlipY(cfg.flipY),\n encoding: this._checkEncoding(cfg.encoding)\n });\n\n // Data source\n\n this._src = null;\n this._image = null;\n\n // Transformation\n\n this._translate = math.vec2([0, 0]);\n this._scale = math.vec2([1, 1]);\n this._rotate = math.vec2([0, 0]);\n\n this._matrixDirty = false;\n\n // Transform\n\n this.translate = cfg.translate;\n this.scale = cfg.scale;\n this.rotate = cfg.rotate;\n\n // Data source\n\n if (cfg.src) {\n this.src = cfg.src; // Image file\n } else if (cfg.image) {\n this.image = cfg.image; // Image object\n }\n\n stats.memory.textures++;\n }\n\n _checkMinFilter(value) {\n value = value || LinearMipMapLinearFilter;\n if (value !== LinearFilter &&\n value !== LinearMipMapNearestFilter &&\n value !== LinearMipMapLinearFilter &&\n value !== NearestMipMapLinearFilter &&\n value !== NearestMipMapNearestFilter) {\n this.error(\"Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, \" +\n \"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.\");\n value = LinearMipMapLinearFilter;\n }\n return value;\n }\n\n _checkMagFilter(value) {\n value = value || LinearFilter;\n if (value !== LinearFilter && value !== NearestFilter) {\n this.error(\"Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.\");\n value = LinearFilter;\n }\n return value;\n }\n\n _checkWrapS(value) {\n value = value || RepeatWrapping;\n if (value !== ClampToEdgeWrapping && value !== MirroredRepeatWrapping && value !== RepeatWrapping) {\n this.error(\"Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.\");\n value = RepeatWrapping;\n }\n return value;\n }\n\n _checkWrapT(value) {\n value = value || RepeatWrapping;\n if (value !== ClampToEdgeWrapping && value !== MirroredRepeatWrapping && value !== RepeatWrapping) {\n this.error(\"Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.\");\n value = RepeatWrapping;\n }\n return value;\n }\n\n _checkFlipY(value) {\n return !!value;\n }\n\n _checkEncoding(value) {\n value = value || LinearEncoding;\n if (value !== LinearEncoding && value !== sRGBEncoding) {\n this.error(\"Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.\");\n value = LinearEncoding;\n }\n return value;\n }\n\n _webglContextRestored() {\n this._state.texture = new Texture2D({gl: this.scene.canvas.gl});\n if (this._image) {\n this.image = this._image;\n } else if (this._src) {\n this.src = this._src;\n }\n }\n\n _update() {\n const state = this._state;\n if (this._matrixDirty) {\n let matrix;\n let t;\n if (this._translate[0] !== 0 || this._translate[1] !== 0) {\n matrix = math.translationMat4v([this._translate[0], this._translate[1], 0], this._state.matrix);\n }\n if (this._scale[0] !== 1 || this._scale[1] !== 1) {\n t = math.scalingMat4v([this._scale[0], this._scale[1], 1]);\n matrix = matrix ? math.mulMat4(matrix, t) : t;\n }\n if (this._rotate !== 0) {\n t = math.rotationMat4v(this._rotate * 0.0174532925, [0, 0, 1]);\n matrix = matrix ? math.mulMat4(matrix, t) : t;\n }\n if (matrix) {\n state.matrix = matrix;\n }\n this._matrixDirty = false;\n }\n this.glRedraw();\n }\n\n\n /**\n * Sets an HTML DOM Image object to source this Texture from.\n *\n * Sets {@link Texture#src} null.\n *\n * @type {HTMLImageElement}\n */\n set image(value) {\n this._image = ensureImageSizePowerOfTwo(value);\n this._image.crossOrigin = \"Anonymous\";\n this._state.texture.setImage(this._image, this._state);\n this._src = null;\n this.glRedraw();\n }\n\n /**\n * Gets HTML DOM Image object this Texture is sourced from, if any.\n *\n * Returns null if not set.\n *\n * @type {HTMLImageElement}\n */\n get image() {\n return this._image;\n }\n\n /**\n * Sets path to an image file to source this Texture from.\n *\n * Sets {@link Texture#image} null.\n *\n * @type {String}\n */\n set src(src) {\n this.scene.loading++;\n this.scene.canvas.spinner.processes++;\n const self = this;\n let image = new Image();\n image.onload = function () {\n image = ensureImageSizePowerOfTwo(image);\n self._state.texture.setImage(image, self._state);\n self.scene.loading--;\n self.glRedraw();\n self.scene.canvas.spinner.processes--;\n };\n image.src = src;\n this._src = src;\n this._image = null;\n }\n\n /**\n * Gets path to the image file this Texture from, if any.\n *\n * Returns null if not set.\n *\n * @type {String}\n */\n get src() {\n return this._src;\n }\n\n /**\n * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````[0, 0]````.\n *\n * @type {Number[]}\n */\n set translate(value) {\n this._translate.set(value || [0, 0]);\n this._matrixDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````[0, 0]````.\n *\n * @type {Number[]}\n */\n get translate() {\n return this._translate;\n }\n\n /**\n * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````[1, 1]````.\n *\n * @type {Number[]}\n */\n set scale(value) {\n this._scale.set(value || [1, 1]);\n this._matrixDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````[1, 1]````.\n *\n * @type {Number[]}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n set rotate(value) {\n value = value || 0;\n if (this._rotate === value) {\n return;\n }\n this._rotate = value;\n this._matrixDirty = true;\n this._needUpdate();\n }\n\n /**\n * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.\n *\n * Default value is ````0````.\n *\n * @type {Number}\n */\n get rotate() {\n return this._rotate;\n }\n\n /**\n * Gets how this Texture is sampled when a texel covers less than one pixel.\n *\n * Options are:\n *\n * * NearestFilter - Uses the value of the texture element that is nearest\n * (in Manhattan distance) to the center of the pixel being textured.\n *\n * * LinearFilter - Uses the weighted average of the four texture elements that are\n * closest to the center of the pixel being textured.\n *\n * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the\n * size of the pixel being textured and uses the \"nearest\" criterion (the texture\n * element nearest to the center of the pixel) to produce a texture value.\n *\n * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of\n * the pixel being textured and uses the \"linear\" criterion (a weighted average of the\n * four texture elements that are closest to the center of the pixel) to produce a\n * texture value.\n *\n * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely\n * match the size of the pixel being textured and uses the \"nearest\" criterion\n * (the texture element nearest to the center of the pixel) to produce a texture\n * value from each mipmap. The final texture value is a weighted average of those two\n * values.\n *\n * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size\n * of the pixel being textured and uses the \"linear\" criterion (a weighted average\n * of the four texture elements that are closest to the center of the pixel) to\n * produce a texture value from each mipmap. The final texture value is a weighted\n * average of those two values.\n *\n * Default value is LinearMipMapLinearFilter.\n *\n * @type {Number}\n */\n get minFilter() {\n return this._state.minFilter;\n }\n\n /**\n * Gets how this Texture is sampled when a texel covers more than one pixel.\n *\n * * NearestFilter - Uses the value of the texture element that is nearest\n * (in Manhattan distance) to the center of the pixel being textured.\n * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are\n * closest to the center of the pixel being textured.\n *\n * Default value is LinearMipMapLinearFilter.\n *\n * @type {Number}\n */\n get magFilter() {\n return this._state.magFilter;\n }\n\n /**\n * Gets the wrap parameter for this Texture's *S* coordinate.\n *\n * Values can be:\n *\n * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.\n * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate\n * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is\n * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.\n * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the\n * fractional part, thereby creating a repeating pattern.\n *\n * Default value is RepeatWrapping.\n *\n * @type {Number}\n */\n get wrapS() {\n return this._state.wrapS;\n }\n\n /**\n * Gets the wrap parameter for this Texture's *T* coordinate.\n *\n * Values can be:\n *\n * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.\n * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate\n * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is\n * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.\n * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the\n * fractional part, thereby creating a repeating pattern.\n *\n * Default value is RepeatWrapping.\n *\n * @type {Number}\n */\n get wrapT() {\n return this._state.wrapT;\n }\n\n /**\n * Gets if this Texture's source data is flipped along its vertical axis.\n *\n * @type {Number}\n */\n get flipY() {\n return this._state.flipY;\n }\n\n /**\n * Gets the Texture's encoding format.\n *\n * @type {Number}\n */\n get encoding() {\n return this._state.encoding;\n }\n\n /**\n * Destroys this Texture\n */\n destroy() {\n super.destroy();\n if (this._state.texture) {\n this._state.texture.destroy();\n }\n this._state.destroy();\n stats.memory.textures--;\n }\n}\n\nexport {Texture};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/Texture.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/Texture.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4314, + "__docId__": 4322, "kind": "function", "name": "ensureImageSizePowerOfTwo", "memberof": "src/viewer/scene/materials/Texture.js", @@ -86158,7 +86374,7 @@ "ignore": true }, { - "__docId__": 4315, + "__docId__": 4323, "kind": "function", "name": "isPowerOfTwo", "memberof": "src/viewer/scene/materials/Texture.js", @@ -86189,7 +86405,7 @@ "ignore": true }, { - "__docId__": 4316, + "__docId__": 4324, "kind": "function", "name": "nextHighestPowerOfTwo", "memberof": "src/viewer/scene/materials/Texture.js", @@ -86220,7 +86436,7 @@ "ignore": true }, { - "__docId__": 4317, + "__docId__": 4325, "kind": "class", "name": "Texture", "memberof": "src/viewer/scene/materials/Texture.js", @@ -86238,7 +86454,7 @@ ] }, { - "__docId__": 4318, + "__docId__": 4326, "kind": "get", "name": "type", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86257,7 +86473,7 @@ } }, { - "__docId__": 4319, + "__docId__": 4327, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86446,7 +86662,7 @@ ] }, { - "__docId__": 4320, + "__docId__": 4328, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86464,7 +86680,7 @@ } }, { - "__docId__": 4321, + "__docId__": 4329, "kind": "member", "name": "_src", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86482,7 +86698,7 @@ } }, { - "__docId__": 4322, + "__docId__": 4330, "kind": "member", "name": "_image", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86500,7 +86716,7 @@ } }, { - "__docId__": 4323, + "__docId__": 4331, "kind": "member", "name": "_translate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86518,7 +86734,7 @@ } }, { - "__docId__": 4324, + "__docId__": 4332, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86536,7 +86752,7 @@ } }, { - "__docId__": 4325, + "__docId__": 4333, "kind": "member", "name": "_rotate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86554,7 +86770,7 @@ } }, { - "__docId__": 4326, + "__docId__": 4334, "kind": "member", "name": "_matrixDirty", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86572,7 +86788,7 @@ } }, { - "__docId__": 4332, + "__docId__": 4340, "kind": "method", "name": "_checkMinFilter", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86600,7 +86816,7 @@ } }, { - "__docId__": 4333, + "__docId__": 4341, "kind": "method", "name": "_checkMagFilter", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86628,7 +86844,7 @@ } }, { - "__docId__": 4334, + "__docId__": 4342, "kind": "method", "name": "_checkWrapS", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86656,7 +86872,7 @@ } }, { - "__docId__": 4335, + "__docId__": 4343, "kind": "method", "name": "_checkWrapT", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86684,7 +86900,7 @@ } }, { - "__docId__": 4336, + "__docId__": 4344, "kind": "method", "name": "_checkFlipY", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86712,7 +86928,7 @@ } }, { - "__docId__": 4337, + "__docId__": 4345, "kind": "method", "name": "_checkEncoding", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86740,7 +86956,7 @@ } }, { - "__docId__": 4338, + "__docId__": 4346, "kind": "method", "name": "_webglContextRestored", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86757,7 +86973,7 @@ "return": null }, { - "__docId__": 4341, + "__docId__": 4349, "kind": "method", "name": "_update", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86774,7 +86990,7 @@ "return": null }, { - "__docId__": 4343, + "__docId__": 4351, "kind": "set", "name": "image", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86795,7 +87011,7 @@ } }, { - "__docId__": 4346, + "__docId__": 4354, "kind": "get", "name": "image", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86816,7 +87032,7 @@ } }, { - "__docId__": 4347, + "__docId__": 4355, "kind": "set", "name": "src", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86837,7 +87053,7 @@ } }, { - "__docId__": 4350, + "__docId__": 4358, "kind": "get", "name": "src", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86858,7 +87074,7 @@ } }, { - "__docId__": 4351, + "__docId__": 4359, "kind": "set", "name": "translate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86879,7 +87095,7 @@ } }, { - "__docId__": 4353, + "__docId__": 4361, "kind": "get", "name": "translate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86900,7 +87116,7 @@ } }, { - "__docId__": 4354, + "__docId__": 4362, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86921,7 +87137,7 @@ } }, { - "__docId__": 4356, + "__docId__": 4364, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86942,7 +87158,7 @@ } }, { - "__docId__": 4357, + "__docId__": 4365, "kind": "set", "name": "rotate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86963,7 +87179,7 @@ } }, { - "__docId__": 4360, + "__docId__": 4368, "kind": "get", "name": "rotate", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -86984,7 +87200,7 @@ } }, { - "__docId__": 4361, + "__docId__": 4369, "kind": "get", "name": "minFilter", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87005,7 +87221,7 @@ } }, { - "__docId__": 4362, + "__docId__": 4370, "kind": "get", "name": "magFilter", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87026,7 +87242,7 @@ } }, { - "__docId__": 4363, + "__docId__": 4371, "kind": "get", "name": "wrapS", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87047,7 +87263,7 @@ } }, { - "__docId__": 4364, + "__docId__": 4372, "kind": "get", "name": "wrapT", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87068,7 +87284,7 @@ } }, { - "__docId__": 4365, + "__docId__": 4373, "kind": "get", "name": "flipY", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87089,7 +87305,7 @@ } }, { - "__docId__": 4366, + "__docId__": 4374, "kind": "get", "name": "encoding", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87110,7 +87326,7 @@ } }, { - "__docId__": 4367, + "__docId__": 4375, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/materials/Texture.js~Texture", @@ -87125,29 +87341,29 @@ "return": null }, { - "__docId__": 4368, + "__docId__": 4376, "kind": "file", "name": "src/viewer/scene/materials/index.js", "content": "export * from \"./LambertMaterial.js\";\nexport * from \"./MetallicMaterial.js\";\nexport * from \"./SpecularMaterial.js\";\nexport * from \"./PhongMaterial.js\";\nexport * from \"./EmphasisMaterial.js\";\nexport * from \"./EdgeMaterial.js\";\nexport * from \"./Texture.js\";\nexport * from \"./Fresnel.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/materials/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/materials/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4369, + "__docId__": 4377, "kind": "file", "name": "src/viewer/scene/math/Frustum.js", "content": "import {math} from \"./math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nclass FrustumPlane {\n\n constructor() {\n this.normal = math.vec3();\n this.offset = 0;\n this.testVertex = math.vec3();\n }\n\n set(nx, ny, nz, offset) {\n const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);\n this.normal[0] = nx * s;\n this.normal[1] = ny * s;\n this.normal[2] = nz * s;\n this.offset = offset * s;\n this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;\n this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;\n this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;\n }\n}\n\n/**\n * @private\n */\nclass Frustum {\n constructor() {\n this.planes = [\n new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),\n new FrustumPlane(), new FrustumPlane(), new FrustumPlane()\n ];\n }\n}\n\nFrustum.INSIDE = 0;\nFrustum.INTERSECT = 1;\nFrustum.OUTSIDE = 2;\n\n/** @private */\nfunction setFrustum(frustum, viewMat, projMat) {\n\n const m = math.mulMat4(projMat, viewMat, tempMat4a);\n\n const m0 = m[0];\n const m1 = m[1];\n const m2 = m[2];\n const m3 = m[3];\n const m4 = m[4];\n const m5 = m[5];\n const m6 = m[6];\n const m7 = m[7];\n const m8 = m[8];\n const m9 = m[9];\n const m10 = m[10];\n const m11 = m[11];\n const m12 = m[12];\n const m13 = m[13];\n const m14 = m[14];\n const m15 = m[15];\n\n frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);\n frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);\n frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);\n frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);\n frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);\n frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);\n}\n\n/** @private */\nfunction frustumIntersectsAABB3(frustum, aabb) {\n\n let ret = Frustum.INSIDE;\n\n const min = tempVec3a;\n const max = tempVec3b;\n\n min[0] = aabb[0];\n min[1] = aabb[1];\n min[2] = aabb[2];\n max[0] = aabb[3];\n max[1] = aabb[4];\n max[2] = aabb[5];\n\n const bminmax = [min, max];\n\n for (let i = 0; i < 6; ++i) {\n const plane = frustum.planes[i];\n if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +\n (plane.normal[1] * bminmax[plane.testVertex[1]][1]) +\n (plane.normal[2] * bminmax[plane.testVertex[2]][2]) +\n (plane.offset)) < 0.0) {\n return Frustum.OUTSIDE;\n }\n\n if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +\n (plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +\n (plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +\n (plane.offset)) < 0.0) {\n ret = Frustum.INTERSECT;\n }\n }\n\n return ret;\n}\n\nexport {\n Frustum,\n FrustumPlane,\n frustumIntersectsAABB3,\n setFrustum\n};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/Frustum.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/Frustum.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4370, + "__docId__": 4378, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87168,7 +87384,7 @@ "ignore": true }, { - "__docId__": 4371, + "__docId__": 4379, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87189,7 +87405,7 @@ "ignore": true }, { - "__docId__": 4372, + "__docId__": 4380, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87210,7 +87426,7 @@ "ignore": true }, { - "__docId__": 4373, + "__docId__": 4381, "kind": "class", "name": "Frustum", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87226,7 +87442,7 @@ "ignore": true }, { - "__docId__": 4374, + "__docId__": 4382, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/math/Frustum.js~Frustum", @@ -87240,7 +87456,7 @@ "undocument": true }, { - "__docId__": 4375, + "__docId__": 4383, "kind": "member", "name": "planes", "memberof": "src/viewer/scene/math/Frustum.js~Frustum", @@ -87257,7 +87473,7 @@ } }, { - "__docId__": 4376, + "__docId__": 4384, "kind": "class", "name": "FrustumPlane", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87273,7 +87489,7 @@ "ignore": true }, { - "__docId__": 4377, + "__docId__": 4385, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/math/Frustum.js~FrustumPlane", @@ -87287,7 +87503,7 @@ "undocument": true }, { - "__docId__": 4378, + "__docId__": 4386, "kind": "member", "name": "normal", "memberof": "src/viewer/scene/math/Frustum.js~FrustumPlane", @@ -87304,7 +87520,7 @@ } }, { - "__docId__": 4379, + "__docId__": 4387, "kind": "member", "name": "offset", "memberof": "src/viewer/scene/math/Frustum.js~FrustumPlane", @@ -87321,7 +87537,7 @@ } }, { - "__docId__": 4380, + "__docId__": 4388, "kind": "member", "name": "testVertex", "memberof": "src/viewer/scene/math/Frustum.js~FrustumPlane", @@ -87338,7 +87554,7 @@ } }, { - "__docId__": 4381, + "__docId__": 4389, "kind": "method", "name": "set", "memberof": "src/viewer/scene/math/Frustum.js~FrustumPlane", @@ -87379,7 +87595,7 @@ "return": null }, { - "__docId__": 4383, + "__docId__": 4391, "kind": "function", "name": "frustumIntersectsAABB3", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87415,7 +87631,7 @@ } }, { - "__docId__": 4384, + "__docId__": 4392, "kind": "function", "name": "setFrustum", "memberof": "src/viewer/scene/math/Frustum.js", @@ -87453,18 +87669,18 @@ "return": null }, { - "__docId__": 4385, + "__docId__": 4393, "kind": "file", "name": "src/viewer/scene/math/buildEdgeIndices.js", "content": "import {math} from './math.js';\n\n/**\n * @private\n */\nvar buildEdgeIndices = (function () {\n\n const uniquePositions = [];\n const indicesLookup = [];\n const indicesReverseLookup = [];\n const weldedIndices = [];\n\n// TODO: Optimize with caching, but need to cater to both compressed and uncompressed positions\n\n const faces = [];\n let numFaces = 0;\n const compa = new Uint16Array(3);\n const compb = new Uint16Array(3);\n const compc = new Uint16Array(3);\n const a = math.vec3();\n const b = math.vec3();\n const c = math.vec3();\n const cb = math.vec3();\n const ab = math.vec3();\n const cross = math.vec3();\n const normal = math.vec3();\n\n function weldVertices(positions, indices) {\n const positionsMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n let vx;\n let vy;\n let vz;\n let key;\n const precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\n const precision = Math.pow(10, precisionPoints);\n let i;\n let len;\n let lenUniquePositions = 0;\n for (i = 0, len = positions.length; i < len; i += 3) {\n vx = positions[i];\n vy = positions[i + 1];\n vz = positions[i + 2];\n key = Math.round(vx * precision) + '_' + Math.round(vy * precision) + '_' + Math.round(vz * precision);\n if (positionsMap[key] === undefined) {\n positionsMap[key] = lenUniquePositions / 3;\n uniquePositions[lenUniquePositions++] = vx;\n uniquePositions[lenUniquePositions++] = vy;\n uniquePositions[lenUniquePositions++] = vz;\n }\n indicesLookup[i / 3] = positionsMap[key];\n }\n for (i = 0, len = indices.length; i < len; i++) {\n weldedIndices[i] = indicesLookup[indices[i]];\n indicesReverseLookup[weldedIndices[i]] = indices[i];\n }\n }\n\n function buildFaces(numIndices, positionsDecodeMatrix) {\n numFaces = 0;\n for (let i = 0, len = numIndices; i < len; i += 3) {\n const ia = ((weldedIndices[i]) * 3);\n const ib = ((weldedIndices[i + 1]) * 3);\n const ic = ((weldedIndices[i + 2]) * 3);\n if (positionsDecodeMatrix) {\n compa[0] = uniquePositions[ia];\n compa[1] = uniquePositions[ia + 1];\n compa[2] = uniquePositions[ia + 2];\n compb[0] = uniquePositions[ib];\n compb[1] = uniquePositions[ib + 1];\n compb[2] = uniquePositions[ib + 2];\n compc[0] = uniquePositions[ic];\n compc[1] = uniquePositions[ic + 1];\n compc[2] = uniquePositions[ic + 2];\n // Decode\n math.decompressPosition(compa, positionsDecodeMatrix, a);\n math.decompressPosition(compb, positionsDecodeMatrix, b);\n math.decompressPosition(compc, positionsDecodeMatrix, c);\n } else {\n a[0] = uniquePositions[ia];\n a[1] = uniquePositions[ia + 1];\n a[2] = uniquePositions[ia + 2];\n b[0] = uniquePositions[ib];\n b[1] = uniquePositions[ib + 1];\n b[2] = uniquePositions[ib + 2];\n c[0] = uniquePositions[ic];\n c[1] = uniquePositions[ic + 1];\n c[2] = uniquePositions[ic + 2];\n }\n math.subVec3(c, b, cb);\n math.subVec3(a, b, ab);\n math.cross3Vec3(cb, ab, cross);\n math.normalizeVec3(cross, normal);\n const face = faces[numFaces] || (faces[numFaces] = {normal: math.vec3()});\n face.normal[0] = normal[0];\n face.normal[1] = normal[1];\n face.normal[2] = normal[2];\n numFaces++;\n }\n }\n\n return function (positions, indices, positionsDecodeMatrix, edgeThreshold) {\n weldVertices(positions, indices);\n buildFaces(indices.length, positionsDecodeMatrix);\n const edgeIndices = [];\n const thresholdDot = Math.cos(math.DEGTORAD * edgeThreshold);\n const edges = {};\n let edge1;\n let edge2;\n let index1;\n let index2;\n let key;\n let largeIndex = false;\n let edge;\n let normal1;\n let normal2;\n let dot;\n let ia;\n let ib;\n for (let i = 0, len = indices.length; i < len; i += 3) {\n const faceIndex = i / 3;\n for (let j = 0; j < 3; j++) {\n edge1 = weldedIndices[i + j];\n edge2 = weldedIndices[i + ((j + 1) % 3)];\n index1 = Math.min(edge1, edge2);\n index2 = Math.max(edge1, edge2);\n key = index1 + \",\" + index2;\n if (edges[key] === undefined) {\n edges[key] = {\n index1: index1,\n index2: index2,\n face1: faceIndex,\n face2: undefined\n };\n } else {\n edges[key].face2 = faceIndex;\n }\n }\n }\n for (key in edges) {\n edge = edges[key];\n // an edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.\n if (edge.face2 !== undefined) {\n normal1 = faces[edge.face1].normal;\n normal2 = faces[edge.face2].normal;\n dot = math.dotVec3(normal1, normal2);\n if (dot > thresholdDot) {\n continue;\n }\n }\n ia = indicesReverseLookup[edge.index1];\n ib = indicesReverseLookup[edge.index2];\n if (!largeIndex && ia > 65535 || ib > 65535) {\n largeIndex = true;\n }\n edgeIndices.push(ia);\n edgeIndices.push(ib);\n }\n return (largeIndex) ? new Uint32Array(edgeIndices) : new Uint16Array(edgeIndices);\n };\n})();\n\nexport {buildEdgeIndices};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/buildEdgeIndices.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/buildEdgeIndices.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4386, + "__docId__": 4394, "kind": "variable", "name": "buildEdgeIndices", "memberof": "src/viewer/scene/math/buildEdgeIndices.js", @@ -87484,18 +87700,18 @@ } }, { - "__docId__": 4387, + "__docId__": 4395, "kind": "file", "name": "src/viewer/scene/math/geometryCompressionUtils.js", "content": "/**\n * Private geometry compression and decompression utilities.\n */\n\nimport {math} from \"./math.js\";\n\n/**\n * @private\n * @param array\n * @returns {{min: Float32Array, max: Float32Array}}\n */\nfunction getPositionsBounds(array) {\n const min = new Float32Array(3);\n const max = new Float32Array(3);\n let i, j;\n for (i = 0; i < 3; i++) {\n min[i] = Number.MAX_VALUE;\n max[i] = -Number.MAX_VALUE;\n }\n for (i = 0; i < array.length; i += 3) {\n for (j = 0; j < 3; j++) {\n min[j] = Math.min(min[j], array[i + j]);\n max[j] = Math.max(max[j], array[i + j]);\n }\n }\n return {\n min: min,\n max: max\n };\n}\n\nconst createPositionsDecodeMatrix = (function () {\n const translate = math.mat4();\n const scale = math.mat4();\n return function (aabb, positionsDecodeMatrix) {\n positionsDecodeMatrix = positionsDecodeMatrix || math.mat4();\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n const xwid = aabb[3] - xmin;\n const ywid = aabb[4] - ymin;\n const zwid = aabb[5] - zmin;\n const maxInt = 65535;\n math.identityMat4(translate);\n math.translationMat4v(aabb, translate);\n math.identityMat4(scale);\n math.scalingMat4v([xwid / maxInt, ywid / maxInt, zwid / maxInt], scale);\n math.mulMat4(translate, scale, positionsDecodeMatrix);\n return positionsDecodeMatrix;\n };\n})();\n\n/**\n * @private\n */\nvar compressPositions = (function () { // http://cg.postech.ac.kr/research/mesh_comp_mobile/mesh_comp_mobile_conference.pdf\n const translate = math.mat4();\n const scale = math.mat4();\n return function (array, min, max) {\n const quantized = new Uint16Array(array.length);\n const multiplier = new Float32Array([\n max[0] !== min[0] ? 65535 / (max[0] - min[0]) : 0,\n max[1] !== min[1] ? 65535 / (max[1] - min[1]) : 0,\n max[2] !== min[2] ? 65535 / (max[2] - min[2]) : 0\n ]);\n let i;\n for (i = 0; i < array.length; i += 3) {\n quantized[i + 0] = Math.max(0, Math.min(65535, Math.floor((array[i + 0] - min[0]) * multiplier[0])));\n quantized[i + 1] = Math.max(0, Math.min(65535, Math.floor((array[i + 1] - min[1]) * multiplier[1])));\n quantized[i + 2] = Math.max(0, Math.min(65535, Math.floor((array[i + 2] - min[2]) * multiplier[2])));\n }\n math.identityMat4(translate);\n math.translationMat4v(min, translate);\n math.identityMat4(scale);\n math.scalingMat4v([\n (max[0] - min[0]) / 65535,\n (max[1] - min[1]) / 65535,\n (max[2] - min[2]) / 65535\n ], scale);\n const decodeMat = math.mulMat4(translate, scale, math.identityMat4());\n return {\n quantized: quantized,\n decodeMatrix: decodeMat\n };\n };\n})();\n\nfunction compressPosition(p, aabb, q) {\n const multiplier = new Float32Array([\n aabb[3] !== aabb[0] ? 65535 / (aabb[3] - aabb[0]) : 0,\n aabb[4] !== aabb[1] ? 65535 / (aabb[4] - aabb[1]) : 0,\n aabb[5] !== aabb[2] ? 65535 / (aabb[5] - aabb[2]) : 0\n ]);\n q[0] = Math.max(0, Math.min(65535, Math.floor((p[0] - aabb[0]) * multiplier[0])));\n q[1] = Math.max(0, Math.min(65535, Math.floor((p[1] - aabb[1]) * multiplier[1])));\n q[2] = Math.max(0, Math.min(65535, Math.floor((p[2] - aabb[2]) * multiplier[2])));\n}\n\nfunction decompressPosition(position, decodeMatrix, dest) {\n dest[0] = position[0] * decodeMatrix[0] + decodeMatrix[12];\n dest[1] = position[1] * decodeMatrix[5] + decodeMatrix[13];\n dest[2] = position[2] * decodeMatrix[10] + decodeMatrix[14];\n return dest;\n}\n\nfunction decompressAABB(aabb, decodeMatrix, dest = aabb) {\n dest[0] = aabb[0] * decodeMatrix[0] + decodeMatrix[12];\n dest[1] = aabb[1] * decodeMatrix[5] + decodeMatrix[13];\n dest[2] = aabb[2] * decodeMatrix[10] + decodeMatrix[14];\n dest[3] = aabb[3] * decodeMatrix[0] + decodeMatrix[12];\n dest[4] = aabb[4] * decodeMatrix[5] + decodeMatrix[13];\n dest[5] = aabb[5] * decodeMatrix[10] + decodeMatrix[14];\n return dest;\n}\n\n/**\n * @private\n */\nfunction decompressPositions(positions, decodeMatrix, dest = new Float32Array(positions.length)) {\n for (let i = 0, len = positions.length; i < len; i += 3) {\n dest[i + 0] = positions[i + 0] * decodeMatrix[0] + decodeMatrix[12];\n dest[i + 1] = positions[i + 1] * decodeMatrix[5] + decodeMatrix[13];\n dest[i + 2] = positions[i + 2] * decodeMatrix[10] + decodeMatrix[14];\n }\n return dest;\n}\n\n//--------------- UVs --------------------------------------------------------------------------------------------------\n\n/**\n * @private\n * @param array\n * @returns {{min: Float32Array, max: Float32Array}}\n */\nfunction getUVBounds(array) {\n const min = new Float32Array(2);\n const max = new Float32Array(2);\n let i, j;\n for (i = 0; i < 2; i++) {\n min[i] = Number.MAX_VALUE;\n max[i] = -Number.MAX_VALUE;\n }\n for (i = 0; i < array.length; i += 2) {\n for (j = 0; j < 2; j++) {\n min[j] = Math.min(min[j], array[i + j]);\n max[j] = Math.max(max[j], array[i + j]);\n }\n }\n return {\n min: min,\n max: max\n };\n}\n\n/**\n * @private\n */\nvar compressUVs = (function () {\n const translate = math.mat3();\n const scale = math.mat3();\n return function (array, min, max) {\n const quantized = new Uint16Array(array.length);\n const multiplier = new Float32Array([\n 65535 / (max[0] - min[0]),\n 65535 / (max[1] - min[1])\n ]);\n let i;\n for (i = 0; i < array.length; i += 2) {\n quantized[i + 0] = Math.max(0, Math.min(65535, Math.floor((array[i + 0] - min[0]) * multiplier[0])));\n quantized[i + 1] = Math.max(0, Math.min(65535, Math.floor((array[i + 1] - min[1]) * multiplier[1])));\n }\n math.identityMat3(translate);\n math.translationMat3v(min, translate);\n math.identityMat3(scale);\n math.scalingMat3v([\n (max[0] - min[0]) / 65535,\n (max[1] - min[1]) / 65535\n ], scale);\n const decodeMat = math.mulMat3(translate, scale, math.identityMat3());\n return {\n quantized: quantized,\n decodeMatrix: decodeMat\n };\n };\n})();\n\n\n//--------------- Normals ----------------------------------------------------------------------------------------------\n\n/**\n * @private\n */\nfunction compressNormals(array) { // http://jcgt.org/published/0003/02/01/\n\n // Note: three elements for each encoded normal, in which the last element in each triplet is redundant.\n // This is to work around a mysterious WebGL issue where 2-element normals just wouldn't work in the shader :/\n\n const encoded = new Int8Array(array.length);\n let oct, dec, best, currentCos, bestCos;\n for (let i = 0; i < array.length; i += 3) {\n // Test various combinations of ceil and floor\n // to minimize rounding errors\n best = oct = octEncodeVec3(array, i, \"floor\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = bestCos = dot(array, i, dec);\n oct = octEncodeVec3(array, i, \"ceil\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = dot(array, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(array, i, \"floor\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(array, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(array, i, \"ceil\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(array, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n encoded[i] = best[0];\n encoded[i + 1] = best[1];\n }\n return encoded;\n}\n\n/**\n * @private\n */\nfunction octEncodeVec3(array, i, xfunc, yfunc) { // Oct-encode single normal vector in 2 bytes\n let x = array[i] / (Math.abs(array[i]) + Math.abs(array[i + 1]) + Math.abs(array[i + 2]));\n let y = array[i + 1] / (Math.abs(array[i]) + Math.abs(array[i + 1]) + Math.abs(array[i + 2]));\n if (array[i + 2] < 0) {\n let tempx = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n let tempy = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n x = tempx;\n y = tempy;\n }\n return new Int8Array([\n Math[xfunc](x * 127.5 + (x < 0 ? -1 : 0)),\n Math[yfunc](y * 127.5 + (y < 0 ? -1 : 0))\n ]);\n}\n\n/**\n * Decode an oct-encoded normal\n */\nfunction octDecodeVec2(oct) {\n let x = oct[0];\n let y = oct[1];\n x /= x < 0 ? 127 : 128;\n y /= y < 0 ? 127 : 128;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n return [\n x / length,\n y / length,\n z / length\n ];\n}\n\n/**\n * Dot product of a normal in an array against a candidate decoding\n * @private\n */\nfunction dot(array, i, vec3) {\n return array[i] * vec3[0] + array[i + 1] * vec3[1] + array[i + 2] * vec3[2];\n}\n\n/**\n * @private\n */\nfunction decompressUV(uv, decodeMatrix, dest) {\n dest[0] = uv[0] * decodeMatrix[0] + decodeMatrix[6];\n dest[1] = uv[1] * decodeMatrix[4] + decodeMatrix[7];\n}\n\n/**\n * @private\n */\nfunction decompressUVs(uvs, decodeMatrix, dest = new Float32Array(uvs.length)) {\n for (let i = 0, len = uvs.length; i < len; i += 3) {\n dest[i + 0] = uvs[i + 0] * decodeMatrix[0] + decodeMatrix[6];\n dest[i + 1] = uvs[i + 1] * decodeMatrix[4] + decodeMatrix[7];\n }\n return dest;\n}\n\n/**\n * @private\n */\nfunction decompressNormal(oct, result) {\n let x = oct[0];\n let y = oct[1];\n x = (2 * x + 1) / 255;\n y = (2 * y + 1) / 255;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n result[0] = x / length;\n result[1] = y / length;\n result[2] = z / length;\n return result;\n}\n\n/**\n * @private\n */\nfunction decompressNormals(octs, result) {\n for (let i = 0, j = 0, len = octs.length; i < len; i += 2) {\n let x = octs[i + 0];\n let y = octs[i + 1];\n x = (2 * x + 1) / 255;\n y = (2 * y + 1) / 255;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n result[j + 0] = x / length;\n result[j + 1] = y / length;\n result[j + 2] = z / length;\n j += 3;\n }\n return result;\n}\n\n/**\n * @private\n */\nconst geometryCompressionUtils = {\n\n getPositionsBounds: getPositionsBounds,\n createPositionsDecodeMatrix: createPositionsDecodeMatrix,\n compressPositions: compressPositions,\n compressPosition:compressPosition,\n decompressPositions: decompressPositions,\n decompressPosition: decompressPosition,\n decompressAABB: decompressAABB,\n\n getUVBounds: getUVBounds,\n compressUVs: compressUVs,\n decompressUVs: decompressUVs,\n decompressUV: decompressUV,\n\n compressNormals: compressNormals,\n decompressNormals: decompressNormals,\n decompressNormal: decompressNormal\n};\n\nexport {geometryCompressionUtils};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/geometryCompressionUtils.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/geometryCompressionUtils.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4388, + "__docId__": 4396, "kind": "function", "name": "getPositionsBounds", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87538,7 +87754,7 @@ "ignore": true }, { - "__docId__": 4389, + "__docId__": 4397, "kind": "variable", "name": "createPositionsDecodeMatrix", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87559,7 +87775,7 @@ "ignore": true }, { - "__docId__": 4390, + "__docId__": 4398, "kind": "variable", "name": "compressPositions", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87579,7 +87795,7 @@ } }, { - "__docId__": 4391, + "__docId__": 4399, "kind": "function", "name": "compressPosition", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87618,7 +87834,7 @@ "ignore": true }, { - "__docId__": 4392, + "__docId__": 4400, "kind": "function", "name": "decompressPosition", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87661,7 +87877,7 @@ "ignore": true }, { - "__docId__": 4393, + "__docId__": 4401, "kind": "function", "name": "decompressAABB", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87707,7 +87923,7 @@ "ignore": true }, { - "__docId__": 4394, + "__docId__": 4402, "kind": "function", "name": "decompressPositions", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87750,7 +87966,7 @@ } }, { - "__docId__": 4395, + "__docId__": 4403, "kind": "function", "name": "getUVBounds", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87793,7 +88009,7 @@ "ignore": true }, { - "__docId__": 4396, + "__docId__": 4404, "kind": "variable", "name": "compressUVs", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87813,7 +88029,7 @@ } }, { - "__docId__": 4397, + "__docId__": 4405, "kind": "function", "name": "compressNormals", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87843,7 +88059,7 @@ } }, { - "__docId__": 4398, + "__docId__": 4406, "kind": "function", "name": "octEncodeVec3", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87891,7 +88107,7 @@ } }, { - "__docId__": 4399, + "__docId__": 4407, "kind": "function", "name": "octDecodeVec2", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87921,7 +88137,7 @@ "ignore": true }, { - "__docId__": 4400, + "__docId__": 4408, "kind": "function", "name": "dot", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -87963,7 +88179,7 @@ } }, { - "__docId__": 4401, + "__docId__": 4409, "kind": "function", "name": "decompressUV", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -88001,7 +88217,7 @@ "return": null }, { - "__docId__": 4402, + "__docId__": 4410, "kind": "function", "name": "decompressUVs", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -88044,7 +88260,7 @@ } }, { - "__docId__": 4403, + "__docId__": 4411, "kind": "function", "name": "decompressNormal", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -88080,7 +88296,7 @@ } }, { - "__docId__": 4404, + "__docId__": 4412, "kind": "function", "name": "decompressNormals", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -88116,7 +88332,7 @@ } }, { - "__docId__": 4405, + "__docId__": 4413, "kind": "variable", "name": "geometryCompressionUtils", "memberof": "src/viewer/scene/math/geometryCompressionUtils.js", @@ -88136,29 +88352,29 @@ } }, { - "__docId__": 4406, + "__docId__": 4414, "kind": "file", "name": "src/viewer/scene/math/index.js", "content": "export * from \"./math.js\";\nexport * from \"./Frustum.js\";\nexport * from \"./rtcCoords.js\";\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4407, + "__docId__": 4415, "kind": "file", "name": "src/viewer/scene/math/math.js", "content": "// Some temporary vars to help avoid garbage collection\n\nlet doublePrecision = true;\nlet FloatArrayType = doublePrecision ? Float64Array : Float32Array;\n\nconst tempVec3a = new FloatArrayType(3);\n\nconst tempMat1 = new FloatArrayType(16);\nconst tempMat2 = new FloatArrayType(16);\nconst tempVec4 = new FloatArrayType(4);\n\n\n/**\n * @private\n */\nconst math = {\n\n setDoublePrecisionEnabled(enable) {\n doublePrecision = enable;\n FloatArrayType = doublePrecision ? Float64Array : Float32Array;\n },\n\n getDoublePrecisionEnabled() {\n return doublePrecision;\n },\n\n MIN_DOUBLE: -Number.MAX_SAFE_INTEGER,\n MAX_DOUBLE: Number.MAX_SAFE_INTEGER,\n\n MAX_INT: 10000000,\n\n /**\n * The number of radiians in a degree (0.0174532925).\n * @property DEGTORAD\n * @type {Number}\n */\n DEGTORAD: 0.0174532925,\n\n /**\n * The number of degrees in a radian.\n * @property RADTODEG\n * @type {Number}\n */\n RADTODEG: 57.295779513,\n\n unglobalizeObjectId(modelId, globalId) {\n const idx = globalId.indexOf(\"#\");\n return (idx === modelId.length && globalId.startsWith(modelId)) ? globalId.substring(idx + 1) : globalId;\n },\n\n globalizeObjectId(modelId, objectId) {\n return (modelId + \"#\" + objectId)\n },\n\n /**\n * Returns:\n * - x != 0 => 1/x,\n * - x == 1 => 1\n *\n * @param {number} x\n */\n safeInv(x) {\n const retVal = 1 / x;\n if (isNaN(retVal) || !isFinite(retVal)) {\n return 1;\n }\n return retVal;\n },\n\n /**\n * Returns a new, uninitialized two-element vector.\n * @method vec2\n * @param [values] Initial values.\n * @static\n * @returns {Number[]}\n */\n vec2(values) {\n return new FloatArrayType(values || 2);\n },\n\n /**\n * Returns a new, uninitialized three-element vector.\n * @method vec3\n * @param [values] Initial values.\n * @static\n * @returns {Number[]}\n */\n vec3(values) {\n return new FloatArrayType(values || 3);\n },\n\n /**\n * Returns a new, uninitialized four-element vector.\n * @method vec4\n * @param [values] Initial values.\n * @static\n * @returns {Number[]}\n */\n vec4(values) {\n return new FloatArrayType(values || 4);\n },\n\n /**\n * Returns a new, uninitialized 3x3 matrix.\n * @method mat3\n * @param [values] Initial values.\n * @static\n * @returns {Number[]}\n */\n mat3(values) {\n return new FloatArrayType(values || 9);\n },\n\n /**\n * Converts a 3x3 matrix to 4x4\n * @method mat3ToMat4\n * @param mat3 3x3 matrix.\n * @param mat4 4x4 matrix\n * @static\n * @returns {Number[]}\n */\n mat3ToMat4(mat3, mat4 = new FloatArrayType(16)) {\n mat4[0] = mat3[0];\n mat4[1] = mat3[1];\n mat4[2] = mat3[2];\n mat4[3] = 0;\n mat4[4] = mat3[3];\n mat4[5] = mat3[4];\n mat4[6] = mat3[5];\n mat4[7] = 0;\n mat4[8] = mat3[6];\n mat4[9] = mat3[7];\n mat4[10] = mat3[8];\n mat4[11] = 0;\n mat4[12] = 0;\n mat4[13] = 0;\n mat4[14] = 0;\n mat4[15] = 1;\n return mat4;\n },\n\n /**\n * Returns a new, uninitialized 4x4 matrix.\n * @method mat4\n * @param [values] Initial values.\n * @static\n * @returns {Number[]}\n */\n mat4(values) {\n return new FloatArrayType(values || 16);\n },\n\n /**\n * Converts a 4x4 matrix to 3x3\n * @method mat4ToMat3\n * @param mat4 4x4 matrix.\n * @param mat3 3x3 matrix\n * @static\n * @returns {Number[]}\n */\n mat4ToMat3(mat4, mat3) { // TODO\n //return new FloatArrayType(values || 9);\n },\n\n /**\n * Converts a list of double-precision values to a list of high-part floats and a list of low-part floats.\n * @param doubleVals\n * @param floatValsHigh\n * @param floatValsLow\n */\n doublesToFloats(doubleVals, floatValsHigh, floatValsLow) {\n const floatPair = new FloatArrayType(2);\n for (let i = 0, len = doubleVals.length; i < len; i++) {\n math.splitDouble(doubleVals[i], floatPair);\n floatValsHigh[i] = floatPair[0];\n floatValsLow[i] = floatPair[1];\n }\n },\n\n /**\n * Splits a double value into two floats.\n * @param value\n * @param floatPair\n */\n splitDouble(value, floatPair) {\n const hi = FloatArrayType.from([value])[0];\n const low = value - hi;\n floatPair[0] = hi;\n floatPair[1] = low;\n },\n\n /**\n * Returns a new UUID.\n * @method createUUID\n * @static\n * @return string The new UUID\n */\n createUUID: ((() => {\n const lut = [];\n for (let i = 0; i < 256; i++) {\n lut[i] = (i < 16 ? '0' : '') + (i).toString(16);\n }\n return () => {\n const d0 = Math.random() * 0xffffffff | 0;\n const d1 = Math.random() * 0xffffffff | 0;\n const d2 = Math.random() * 0xffffffff | 0;\n const d3 = Math.random() * 0xffffffff | 0;\n return `${lut[d0 & 0xff] + lut[d0 >> 8 & 0xff] + lut[d0 >> 16 & 0xff] + lut[d0 >> 24 & 0xff]}-${lut[d1 & 0xff]}${lut[d1 >> 8 & 0xff]}-${lut[d1 >> 16 & 0x0f | 0x40]}${lut[d1 >> 24 & 0xff]}-${lut[d2 & 0x3f | 0x80]}${lut[d2 >> 8 & 0xff]}-${lut[d2 >> 16 & 0xff]}${lut[d2 >> 24 & 0xff]}${lut[d3 & 0xff]}${lut[d3 >> 8 & 0xff]}${lut[d3 >> 16 & 0xff]}${lut[d3 >> 24 & 0xff]}`;\n };\n }))(),\n\n /**\n * Clamps a value to the given range.\n * @param {Number} value Value to clamp.\n * @param {Number} min Lower bound.\n * @param {Number} max Upper bound.\n * @returns {Number} Clamped result.\n */\n clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n },\n\n /**\n * Floating-point modulus\n * @method fmod\n * @static\n * @param {Number} a\n * @param {Number} b\n * @returns {*}\n */\n fmod(a, b) {\n if (a < b) {\n console.error(\"math.fmod : Attempting to find modulus within negative range - would be infinite loop - ignoring\");\n return a;\n }\n while (b <= a) {\n a -= b;\n }\n return a;\n },\n\n /**\n * Returns true if the two 3-element vectors are the same.\n * @param v1\n * @param v2\n * @returns {Boolean}\n */\n compareVec3(v1, v2) {\n return (v1[0] === v2[0] && v1[1] === v2[1] && v1[2] === v2[2]);\n },\n\n /**\n * Negates a three-element vector.\n * @method negateVec3\n * @static\n * @param {Array(Number)} v Vector to negate\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n negateVec3(v, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = -v[0];\n dest[1] = -v[1];\n dest[2] = -v[2];\n return dest;\n },\n\n /**\n * Negates a four-element vector.\n * @method negateVec4\n * @static\n * @param {Array(Number)} v Vector to negate\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n negateVec4(v, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = -v[0];\n dest[1] = -v[1];\n dest[2] = -v[2];\n dest[3] = -v[3];\n return dest;\n },\n\n /**\n * Adds one four-element vector to another.\n * @method addVec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n addVec4(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] + v[0];\n dest[1] = u[1] + v[1];\n dest[2] = u[2] + v[2];\n dest[3] = u[3] + v[3];\n return dest;\n },\n\n /**\n * Adds a scalar value to each element of a four-element vector.\n * @method addVec4Scalar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n addVec4Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] + s;\n dest[1] = v[1] + s;\n dest[2] = v[2] + s;\n dest[3] = v[3] + s;\n return dest;\n },\n\n /**\n * Adds one three-element vector to another.\n * @method addVec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n addVec3(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] + v[0];\n dest[1] = u[1] + v[1];\n dest[2] = u[2] + v[2];\n return dest;\n },\n\n /**\n * Adds a scalar value to each element of a three-element vector.\n * @method addVec4Scalar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n addVec3Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] + s;\n dest[1] = v[1] + s;\n dest[2] = v[2] + s;\n return dest;\n },\n\n /**\n * Subtracts one four-element vector from another.\n * @method subVec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Vector to subtract\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n subVec4(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] - v[0];\n dest[1] = u[1] - v[1];\n dest[2] = u[2] - v[2];\n dest[3] = u[3] - v[3];\n return dest;\n },\n\n /**\n * Subtracts one three-element vector from another.\n * @method subVec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Vector to subtract\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n subVec3(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] - v[0];\n dest[1] = u[1] - v[1];\n dest[2] = u[2] - v[2];\n return dest;\n },\n\n /**\n * Subtracts one two-element vector from another.\n * @method subVec2\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Vector to subtract\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n subVec2(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] - v[0];\n dest[1] = u[1] - v[1];\n return dest;\n },\n\n /**\n * Get the geometric mean of the vectors.\n * @method geometricMeanVec2\n * @static\n * @param {...Array(Number)} vectors Vec2 to mean\n * @return {Array(Number)} The geometric mean vec2\n */\n geometricMeanVec2(...vectors) {\n const geometricMean = new FloatArrayType(vectors[0]);\n for (let i = 1; i < vectors.length; i++) {\n geometricMean[0] += vectors[i][0];\n geometricMean[1] += vectors[i][1];\n }\n geometricMean[0] /= vectors.length;\n geometricMean[1] /= vectors.length;\n return geometricMean;\n },\n\n /**\n * Subtracts a scalar value from each element of a four-element vector.\n * @method subVec4Scalar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n subVec4Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] - s;\n dest[1] = v[1] - s;\n dest[2] = v[2] - s;\n dest[3] = v[3] - s;\n return dest;\n },\n\n /**\n * Sets each element of a 4-element vector to a scalar value minus the value of that element.\n * @method subScalarVec4\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n subScalarVec4(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = s - v[0];\n dest[1] = s - v[1];\n dest[2] = s - v[2];\n dest[3] = s - v[3];\n return dest;\n },\n\n /**\n * Multiplies one three-element vector by another.\n * @method mulVec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n mulVec4(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] * v[0];\n dest[1] = u[1] * v[1];\n dest[2] = u[2] * v[2];\n dest[3] = u[3] * v[3];\n return dest;\n },\n\n /**\n * Multiplies each element of a four-element vector by a scalar.\n * @method mulVec34calar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n mulVec4Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] * s;\n dest[1] = v[1] * s;\n dest[2] = v[2] * s;\n dest[3] = v[3] * s;\n return dest;\n },\n\n /**\n * Multiplies each element of a three-element vector by a scalar.\n * @method mulVec3Scalar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n mulVec3Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] * s;\n dest[1] = v[1] * s;\n dest[2] = v[2] * s;\n return dest;\n },\n\n /**\n * Multiplies each element of a two-element vector by a scalar.\n * @method mulVec2Scalar\n * @static\n * @param {Array(Number)} v The vector\n * @param {Number} s The scalar\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, v otherwise\n */\n mulVec2Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] * s;\n dest[1] = v[1] * s;\n return dest;\n },\n\n /**\n * Divides one three-element vector by another.\n * @method divVec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n divVec3(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] / v[0];\n dest[1] = u[1] / v[1];\n dest[2] = u[2] / v[2];\n return dest;\n },\n\n /**\n * Divides one four-element vector by another.\n * @method divVec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @param {Array(Number)} [dest] Destination vector\n * @return {Array(Number)} dest if specified, u otherwise\n */\n divVec4(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n dest[0] = u[0] / v[0];\n dest[1] = u[1] / v[1];\n dest[2] = u[2] / v[2];\n dest[3] = u[3] / v[3];\n return dest;\n },\n\n /**\n * Divides a scalar by a three-element vector, returning a new vector.\n * @method divScalarVec3\n * @static\n * @param v vec3\n * @param s scalar\n * @param dest vec3 - optional destination\n * @return [] dest if specified, v otherwise\n */\n divScalarVec3(s, v, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = s / v[0];\n dest[1] = s / v[1];\n dest[2] = s / v[2];\n return dest;\n },\n\n /**\n * Divides a three-element vector by a scalar.\n * @method divVec3Scalar\n * @static\n * @param v vec3\n * @param s scalar\n * @param dest vec3 - optional destination\n * @return [] dest if specified, v otherwise\n */\n divVec3Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] / s;\n dest[1] = v[1] / s;\n dest[2] = v[2] / s;\n return dest;\n },\n\n /**\n * Divides a four-element vector by a scalar.\n * @method divVec4Scalar\n * @static\n * @param v vec4\n * @param s scalar\n * @param dest vec4 - optional destination\n * @return [] dest if specified, v otherwise\n */\n divVec4Scalar(v, s, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = v[0] / s;\n dest[1] = v[1] / s;\n dest[2] = v[2] / s;\n dest[3] = v[3] / s;\n return dest;\n },\n\n\n /**\n * Divides a scalar by a four-element vector, returning a new vector.\n * @method divScalarVec4\n * @static\n * @param s scalar\n * @param v vec4\n * @param dest vec4 - optional destination\n * @return [] dest if specified, v otherwise\n */\n divScalarVec4(s, v, dest) {\n if (!dest) {\n dest = v;\n }\n dest[0] = s / v[0];\n dest[1] = s / v[1];\n dest[2] = s / v[2];\n dest[3] = s / v[3];\n return dest;\n },\n\n /**\n * Returns the dot product of two four-element vectors.\n * @method dotVec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @return The dot product\n */\n dotVec4(u, v) {\n return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2] + u[3] * v[3]);\n },\n\n /**\n * Returns the cross product of two four-element vectors.\n * @method cross3Vec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @return The cross product\n */\n cross3Vec4(u, v) {\n const u0 = u[0];\n const u1 = u[1];\n const u2 = u[2];\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return [\n u1 * v2 - u2 * v1,\n u2 * v0 - u0 * v2,\n u0 * v1 - u1 * v0,\n 0.0];\n },\n\n /**\n * Returns the cross product of two three-element vectors.\n * @method cross3Vec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @return The cross product\n */\n cross3Vec3(u, v, dest) {\n if (!dest) {\n dest = u;\n }\n const x = u[0];\n const y = u[1];\n const z = u[2];\n const x2 = v[0];\n const y2 = v[1];\n const z2 = v[2];\n dest[0] = y * z2 - z * y2;\n dest[1] = z * x2 - x * z2;\n dest[2] = x * y2 - y * x2;\n return dest;\n },\n\n\n sqLenVec4(v) { // TODO\n return math.dotVec4(v, v);\n },\n\n /**\n * Returns the length of a four-element vector.\n * @method lenVec4\n * @static\n * @param {Array(Number)} v The vector\n * @return The length\n */\n lenVec4(v) {\n return Math.sqrt(math.sqLenVec4(v));\n },\n\n /**\n * Returns the dot product of two three-element vectors.\n * @method dotVec3\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @return The dot product\n */\n dotVec3(u, v) {\n return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]);\n },\n\n /**\n * Returns the dot product of two two-element vectors.\n * @method dotVec4\n * @static\n * @param {Array(Number)} u First vector\n * @param {Array(Number)} v Second vector\n * @return The dot product\n */\n dotVec2(u, v) {\n return (u[0] * v[0] + u[1] * v[1]);\n },\n\n\n sqLenVec3(v) {\n return math.dotVec3(v, v);\n },\n\n\n sqLenVec2(v) {\n return math.dotVec2(v, v);\n },\n\n /**\n * Returns the length of a three-element vector.\n * @method lenVec3\n * @static\n * @param {Array(Number)} v The vector\n * @return The length\n */\n lenVec3(v) {\n return Math.sqrt(math.sqLenVec3(v));\n },\n\n distVec3: ((() => {\n const vec = new FloatArrayType(3);\n return (v, w) => math.lenVec3(math.subVec3(v, w, vec));\n }))(),\n\n /**\n * Returns the length of a two-element vector.\n * @method lenVec2\n * @static\n * @param {Array(Number)} v The vector\n * @return The length\n */\n lenVec2(v) {\n return Math.sqrt(math.sqLenVec2(v));\n },\n\n distVec2: ((() => {\n const vec = new FloatArrayType(2);\n return (v, w) => math.lenVec2(math.subVec2(v, w, vec));\n }))(),\n\n /**\n * @method rcpVec3\n * @static\n * @param v vec3\n * @param dest vec3 - optional destination\n * @return [] dest if specified, v otherwise\n *\n */\n rcpVec3(v, dest) {\n return math.divScalarVec3(1.0, v, dest);\n },\n\n /**\n * Normalizes a four-element vector\n * @method normalizeVec4\n * @static\n * @param v vec4\n * @param dest vec4 - optional destination\n * @return [] dest if specified, v otherwise\n *\n */\n normalizeVec4(v, dest) {\n const f = 1.0 / math.lenVec4(v);\n return math.mulVec4Scalar(v, f, dest);\n },\n\n /**\n * Normalizes a three-element vector\n * @method normalizeVec4\n * @static\n */\n normalizeVec3(v, dest) {\n const f = 1.0 / math.lenVec3(v);\n return math.mulVec3Scalar(v, f, dest);\n },\n\n /**\n * Normalizes a two-element vector\n * @method normalizeVec2\n * @static\n */\n normalizeVec2(v, dest) {\n const f = 1.0 / math.lenVec2(v);\n return math.mulVec2Scalar(v, f, dest);\n },\n\n /**\n * Gets the angle between two vectors\n * @method angleVec3\n * @param v\n * @param w\n * @returns {number}\n */\n angleVec3(v, w) {\n let theta = math.dotVec3(v, w) / (Math.sqrt(math.sqLenVec3(v) * math.sqLenVec3(w)));\n theta = theta < -1 ? -1 : (theta > 1 ? 1 : theta); // Clamp to handle numerical problems\n return Math.acos(theta);\n },\n\n /**\n * Creates a three-element vector from the rotation part of a sixteen-element matrix.\n * @param m\n * @param dest\n */\n vec3FromMat4Scale: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n\n return (m, dest) => {\n\n tempVec3[0] = m[0];\n tempVec3[1] = m[1];\n tempVec3[2] = m[2];\n\n dest[0] = math.lenVec3(tempVec3);\n\n tempVec3[0] = m[4];\n tempVec3[1] = m[5];\n tempVec3[2] = m[6];\n\n dest[1] = math.lenVec3(tempVec3);\n\n tempVec3[0] = m[8];\n tempVec3[1] = m[9];\n tempVec3[2] = m[10];\n\n dest[2] = math.lenVec3(tempVec3);\n\n return dest;\n };\n }))(),\n\n /**\n * Converts an n-element vector to a JSON-serializable\n * array with values rounded to two decimal places.\n */\n vecToArray: ((() => {\n function trunc(v) {\n return Math.round(v * 100000) / 100000\n }\n\n return v => {\n v = Array.prototype.slice.call(v);\n for (let i = 0, len = v.length; i < len; i++) {\n v[i] = trunc(v[i]);\n }\n return v;\n };\n }))(),\n\n /**\n * Converts a 3-element vector from an array to an object of the form ````{x:999, y:999, z:999}````.\n * @param arr\n * @returns {{x: *, y: *, z: *}}\n */\n xyzArrayToObject(arr) {\n return {\"x\": arr[0], \"y\": arr[1], \"z\": arr[2]};\n },\n\n /**\n * Converts a 3-element vector object of the form ````{x:999, y:999, z:999}```` to an array.\n * @param xyz\n * @param [arry]\n * @returns {*[]}\n */\n xyzObjectToArray(xyz, arry) {\n arry = arry || math.vec3();\n arry[0] = xyz.x;\n arry[1] = xyz.y;\n arry[2] = xyz.z;\n return arry;\n },\n\n /**\n * Duplicates a 4x4 identity matrix.\n * @method dupMat4\n * @static\n */\n dupMat4(m) {\n return m.slice(0, 16);\n },\n\n /**\n * Extracts a 3x3 matrix from a 4x4 matrix.\n * @method mat4To3\n * @static\n */\n mat4To3(m) {\n return [\n m[0], m[1], m[2],\n m[4], m[5], m[6],\n m[8], m[9], m[10]\n ];\n },\n\n /**\n * Returns a 4x4 matrix with each element set to the given scalar value.\n * @method m4s\n * @static\n */\n m4s(s) {\n return [\n s, s, s, s,\n s, s, s, s,\n s, s, s, s,\n s, s, s, s\n ];\n },\n\n /**\n * Returns a 4x4 matrix with each element set to zero.\n * @method setMat4ToZeroes\n * @static\n */\n setMat4ToZeroes() {\n return math.m4s(0.0);\n },\n\n /**\n * Returns a 4x4 matrix with each element set to 1.0.\n * @method setMat4ToOnes\n * @static\n */\n setMat4ToOnes() {\n return math.m4s(1.0);\n },\n\n /**\n * Returns a 4x4 matrix with each element set to 1.0.\n * @method setMat4ToOnes\n * @static\n */\n diagonalMat4v(v) {\n return new FloatArrayType([\n v[0], 0.0, 0.0, 0.0,\n 0.0, v[1], 0.0, 0.0,\n 0.0, 0.0, v[2], 0.0,\n 0.0, 0.0, 0.0, v[3]\n ]);\n },\n\n /**\n * Returns a 4x4 matrix with diagonal elements set to the given vector.\n * @method diagonalMat4c\n * @static\n */\n diagonalMat4c(x, y, z, w) {\n return math.diagonalMat4v([x, y, z, w]);\n },\n\n /**\n * Returns a 4x4 matrix with diagonal elements set to the given scalar.\n * @method diagonalMat4s\n * @static\n */\n diagonalMat4s(s) {\n return math.diagonalMat4c(s, s, s, s);\n },\n\n /**\n * Returns a 4x4 identity matrix.\n * @method identityMat4\n * @static\n */\n identityMat4(mat = new FloatArrayType(16)) {\n mat[0] = 1.0;\n mat[1] = 0.0;\n mat[2] = 0.0;\n mat[3] = 0.0;\n\n mat[4] = 0.0;\n mat[5] = 1.0;\n mat[6] = 0.0;\n mat[7] = 0.0;\n\n mat[8] = 0.0;\n mat[9] = 0.0;\n mat[10] = 1.0;\n mat[11] = 0.0;\n\n mat[12] = 0.0;\n mat[13] = 0.0;\n mat[14] = 0.0;\n mat[15] = 1.0;\n\n return mat;\n },\n\n /**\n * Returns a 3x3 identity matrix.\n * @method identityMat3\n * @static\n */\n identityMat3(mat = new FloatArrayType(9)) {\n mat[0] = 1.0;\n mat[1] = 0.0;\n mat[2] = 0.0;\n\n mat[3] = 0.0;\n mat[4] = 1.0;\n mat[5] = 0.0;\n\n mat[6] = 0.0;\n mat[7] = 0.0;\n mat[8] = 1.0;\n\n return mat;\n },\n\n /**\n * Tests if the given 4x4 matrix is the identity matrix.\n * @method isIdentityMat4\n * @static\n */\n isIdentityMat4(m) {\n if (m[0] !== 1.0 || m[1] !== 0.0 || m[2] !== 0.0 || m[3] !== 0.0 ||\n m[4] !== 0.0 || m[5] !== 1.0 || m[6] !== 0.0 || m[7] !== 0.0 ||\n m[8] !== 0.0 || m[9] !== 0.0 || m[10] !== 1.0 || m[11] !== 0.0 ||\n m[12] !== 0.0 || m[13] !== 0.0 || m[14] !== 0.0 || m[15] !== 1.0) {\n return false;\n }\n return true;\n },\n\n /**\n * Negates the given 4x4 matrix.\n * @method negateMat4\n * @static\n */\n negateMat4(m, dest) {\n if (!dest) {\n dest = m;\n }\n dest[0] = -m[0];\n dest[1] = -m[1];\n dest[2] = -m[2];\n dest[3] = -m[3];\n dest[4] = -m[4];\n dest[5] = -m[5];\n dest[6] = -m[6];\n dest[7] = -m[7];\n dest[8] = -m[8];\n dest[9] = -m[9];\n dest[10] = -m[10];\n dest[11] = -m[11];\n dest[12] = -m[12];\n dest[13] = -m[13];\n dest[14] = -m[14];\n dest[15] = -m[15];\n return dest;\n },\n\n /**\n * Adds the given 4x4 matrices together.\n * @method addMat4\n * @static\n */\n addMat4(a, b, dest) {\n if (!dest) {\n dest = a;\n }\n dest[0] = a[0] + b[0];\n dest[1] = a[1] + b[1];\n dest[2] = a[2] + b[2];\n dest[3] = a[3] + b[3];\n dest[4] = a[4] + b[4];\n dest[5] = a[5] + b[5];\n dest[6] = a[6] + b[6];\n dest[7] = a[7] + b[7];\n dest[8] = a[8] + b[8];\n dest[9] = a[9] + b[9];\n dest[10] = a[10] + b[10];\n dest[11] = a[11] + b[11];\n dest[12] = a[12] + b[12];\n dest[13] = a[13] + b[13];\n dest[14] = a[14] + b[14];\n dest[15] = a[15] + b[15];\n return dest;\n },\n\n /**\n * Adds the given scalar to each element of the given 4x4 matrix.\n * @method addMat4Scalar\n * @static\n */\n addMat4Scalar(m, s, dest) {\n if (!dest) {\n dest = m;\n }\n dest[0] = m[0] + s;\n dest[1] = m[1] + s;\n dest[2] = m[2] + s;\n dest[3] = m[3] + s;\n dest[4] = m[4] + s;\n dest[5] = m[5] + s;\n dest[6] = m[6] + s;\n dest[7] = m[7] + s;\n dest[8] = m[8] + s;\n dest[9] = m[9] + s;\n dest[10] = m[10] + s;\n dest[11] = m[11] + s;\n dest[12] = m[12] + s;\n dest[13] = m[13] + s;\n dest[14] = m[14] + s;\n dest[15] = m[15] + s;\n return dest;\n },\n\n /**\n * Adds the given scalar to each element of the given 4x4 matrix.\n * @method addScalarMat4\n * @static\n */\n addScalarMat4(s, m, dest) {\n return math.addMat4Scalar(m, s, dest);\n },\n\n /**\n * Subtracts the second 4x4 matrix from the first.\n * @method subMat4\n * @static\n */\n subMat4(a, b, dest) {\n if (!dest) {\n dest = a;\n }\n dest[0] = a[0] - b[0];\n dest[1] = a[1] - b[1];\n dest[2] = a[2] - b[2];\n dest[3] = a[3] - b[3];\n dest[4] = a[4] - b[4];\n dest[5] = a[5] - b[5];\n dest[6] = a[6] - b[6];\n dest[7] = a[7] - b[7];\n dest[8] = a[8] - b[8];\n dest[9] = a[9] - b[9];\n dest[10] = a[10] - b[10];\n dest[11] = a[11] - b[11];\n dest[12] = a[12] - b[12];\n dest[13] = a[13] - b[13];\n dest[14] = a[14] - b[14];\n dest[15] = a[15] - b[15];\n return dest;\n },\n\n /**\n * Subtracts the given scalar from each element of the given 4x4 matrix.\n * @method subMat4Scalar\n * @static\n */\n subMat4Scalar(m, s, dest) {\n if (!dest) {\n dest = m;\n }\n dest[0] = m[0] - s;\n dest[1] = m[1] - s;\n dest[2] = m[2] - s;\n dest[3] = m[3] - s;\n dest[4] = m[4] - s;\n dest[5] = m[5] - s;\n dest[6] = m[6] - s;\n dest[7] = m[7] - s;\n dest[8] = m[8] - s;\n dest[9] = m[9] - s;\n dest[10] = m[10] - s;\n dest[11] = m[11] - s;\n dest[12] = m[12] - s;\n dest[13] = m[13] - s;\n dest[14] = m[14] - s;\n dest[15] = m[15] - s;\n return dest;\n },\n\n /**\n * Subtracts the given scalar from each element of the given 4x4 matrix.\n * @method subScalarMat4\n * @static\n */\n subScalarMat4(s, m, dest) {\n if (!dest) {\n dest = m;\n }\n dest[0] = s - m[0];\n dest[1] = s - m[1];\n dest[2] = s - m[2];\n dest[3] = s - m[3];\n dest[4] = s - m[4];\n dest[5] = s - m[5];\n dest[6] = s - m[6];\n dest[7] = s - m[7];\n dest[8] = s - m[8];\n dest[9] = s - m[9];\n dest[10] = s - m[10];\n dest[11] = s - m[11];\n dest[12] = s - m[12];\n dest[13] = s - m[13];\n dest[14] = s - m[14];\n dest[15] = s - m[15];\n return dest;\n },\n\n /**\n * Multiplies the two given 4x4 matrix by each other.\n * @method mulMat4\n * @static\n */\n mulMat4(a, b, dest) {\n if (!dest) {\n dest = a;\n }\n\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = a[0];\n\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[4];\n const b11 = b[5];\n const b12 = b[6];\n const b13 = b[7];\n const b20 = b[8];\n const b21 = b[9];\n const b22 = b[10];\n const b23 = b[11];\n const b30 = b[12];\n const b31 = b[13];\n const b32 = b[14];\n const b33 = b[15];\n\n dest[0] = b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30;\n dest[1] = b00 * a01 + b01 * a11 + b02 * a21 + b03 * a31;\n dest[2] = b00 * a02 + b01 * a12 + b02 * a22 + b03 * a32;\n dest[3] = b00 * a03 + b01 * a13 + b02 * a23 + b03 * a33;\n dest[4] = b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30;\n dest[5] = b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31;\n dest[6] = b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32;\n dest[7] = b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33;\n dest[8] = b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30;\n dest[9] = b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31;\n dest[10] = b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32;\n dest[11] = b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33;\n dest[12] = b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30;\n dest[13] = b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31;\n dest[14] = b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32;\n dest[15] = b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33;\n\n return dest;\n },\n\n /**\n * Multiplies the two given 3x3 matrices by each other.\n * @method mulMat4\n * @static\n */\n mulMat3(a, b, dest) {\n if (!dest) {\n dest = new FloatArrayType(9);\n }\n\n const a11 = a[0];\n const a12 = a[3];\n const a13 = a[6];\n const a21 = a[1];\n const a22 = a[4];\n const a23 = a[7];\n const a31 = a[2];\n const a32 = a[5];\n const a33 = a[8];\n const b11 = b[0];\n const b12 = b[3];\n const b13 = b[6];\n const b21 = b[1];\n const b22 = b[4];\n const b23 = b[7];\n const b31 = b[2];\n const b32 = b[5];\n const b33 = b[8];\n\n dest[0] = a11 * b11 + a12 * b21 + a13 * b31;\n dest[3] = a11 * b12 + a12 * b22 + a13 * b32;\n dest[6] = a11 * b13 + a12 * b23 + a13 * b33;\n\n dest[1] = a21 * b11 + a22 * b21 + a23 * b31;\n dest[4] = a21 * b12 + a22 * b22 + a23 * b32;\n dest[7] = a21 * b13 + a22 * b23 + a23 * b33;\n\n dest[2] = a31 * b11 + a32 * b21 + a33 * b31;\n dest[5] = a31 * b12 + a32 * b22 + a33 * b32;\n dest[8] = a31 * b13 + a32 * b23 + a33 * b33;\n\n return dest;\n },\n\n /**\n * Multiplies each element of the given 4x4 matrix by the given scalar.\n * @method mulMat4Scalar\n * @static\n */\n mulMat4Scalar(m, s, dest) {\n if (!dest) {\n dest = m;\n }\n dest[0] = m[0] * s;\n dest[1] = m[1] * s;\n dest[2] = m[2] * s;\n dest[3] = m[3] * s;\n dest[4] = m[4] * s;\n dest[5] = m[5] * s;\n dest[6] = m[6] * s;\n dest[7] = m[7] * s;\n dest[8] = m[8] * s;\n dest[9] = m[9] * s;\n dest[10] = m[10] * s;\n dest[11] = m[11] * s;\n dest[12] = m[12] * s;\n dest[13] = m[13] * s;\n dest[14] = m[14] * s;\n dest[15] = m[15] * s;\n return dest;\n },\n\n /**\n * Multiplies the given 4x4 matrix by the given four-element vector.\n * @method mulMat4v4\n * @static\n */\n mulMat4v4(m, v, dest = math.vec4()) {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n dest[0] = m[0] * v0 + m[4] * v1 + m[8] * v2 + m[12] * v3;\n dest[1] = m[1] * v0 + m[5] * v1 + m[9] * v2 + m[13] * v3;\n dest[2] = m[2] * v0 + m[6] * v1 + m[10] * v2 + m[14] * v3;\n dest[3] = m[3] * v0 + m[7] * v1 + m[11] * v2 + m[15] * v3;\n return dest;\n },\n\n /**\n * Transposes the given 4x4 matrix.\n * @method transposeMat4\n * @static\n */\n transposeMat4(mat, dest) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n const m4 = mat[4];\n\n const m14 = mat[14];\n const m8 = mat[8];\n const m13 = mat[13];\n const m12 = mat[12];\n const m9 = mat[9];\n if (!dest || mat === dest) {\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a12 = mat[6];\n const a13 = mat[7];\n const a23 = mat[11];\n mat[1] = m4;\n mat[2] = m8;\n mat[3] = m12;\n mat[4] = a01;\n mat[6] = m9;\n mat[7] = m13;\n mat[8] = a02;\n mat[9] = a12;\n mat[11] = m14;\n mat[12] = a03;\n mat[13] = a13;\n mat[14] = a23;\n return mat;\n }\n dest[0] = mat[0];\n dest[1] = m4;\n dest[2] = m8;\n dest[3] = m12;\n dest[4] = mat[1];\n dest[5] = mat[5];\n dest[6] = m9;\n dest[7] = m13;\n dest[8] = mat[2];\n dest[9] = mat[6];\n dest[10] = mat[10];\n dest[11] = m14;\n dest[12] = mat[3];\n dest[13] = mat[7];\n dest[14] = mat[11];\n dest[15] = mat[15];\n return dest;\n },\n\n /**\n * Transposes the given 3x3 matrix.\n *\n * @method transposeMat3\n * @static\n */\n transposeMat3(mat, dest) {\n if (dest === mat) {\n const a01 = mat[1];\n const a02 = mat[2];\n const a12 = mat[5];\n dest[1] = mat[3];\n dest[2] = mat[6];\n dest[3] = a01;\n dest[5] = mat[7];\n dest[6] = a02;\n dest[7] = a12;\n } else {\n dest[0] = mat[0];\n dest[1] = mat[3];\n dest[2] = mat[6];\n dest[3] = mat[1];\n dest[4] = mat[4];\n dest[5] = mat[7];\n dest[6] = mat[2];\n dest[7] = mat[5];\n dest[8] = mat[8];\n }\n return dest;\n },\n\n /**\n * Returns the determinant of the given 4x4 matrix.\n * @method determinantMat4\n * @static\n */\n determinantMat4(mat) {\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = mat[0];\n\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a10 = mat[4];\n const a11 = mat[5];\n const a12 = mat[6];\n const a13 = mat[7];\n const a20 = mat[8];\n const a21 = mat[9];\n const a22 = mat[10];\n const a23 = mat[11];\n const a30 = mat[12];\n const a31 = mat[13];\n const a32 = mat[14];\n const a33 = mat[15];\n return a30 * a21 * a12 * a03 - a20 * a31 * a12 * a03 - a30 * a11 * a22 * a03 + a10 * a31 * a22 * a03 +\n a20 * a11 * a32 * a03 - a10 * a21 * a32 * a03 - a30 * a21 * a02 * a13 + a20 * a31 * a02 * a13 +\n a30 * a01 * a22 * a13 - a00 * a31 * a22 * a13 - a20 * a01 * a32 * a13 + a00 * a21 * a32 * a13 +\n a30 * a11 * a02 * a23 - a10 * a31 * a02 * a23 - a30 * a01 * a12 * a23 + a00 * a31 * a12 * a23 +\n a10 * a01 * a32 * a23 - a00 * a11 * a32 * a23 - a20 * a11 * a02 * a33 + a10 * a21 * a02 * a33 +\n a20 * a01 * a12 * a33 - a00 * a21 * a12 * a33 - a10 * a01 * a22 * a33 + a00 * a11 * a22 * a33;\n },\n\n /**\n * Returns the inverse of the given 4x4 matrix.\n * @method inverseMat4\n * @static\n */\n inverseMat4(mat, dest) {\n if (!dest) {\n dest = mat;\n }\n\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = mat[0];\n\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a10 = mat[4];\n const a11 = mat[5];\n const a12 = mat[6];\n const a13 = mat[7];\n const a20 = mat[8];\n const a21 = mat[9];\n const a22 = mat[10];\n const a23 = mat[11];\n const a30 = mat[12];\n const a31 = mat[13];\n const a32 = mat[14];\n const a33 = mat[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant (inlined to avoid double-caching)\n const invDet = 1 / (b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06);\n\n dest[0] = (a11 * b11 - a12 * b10 + a13 * b09) * invDet;\n dest[1] = (-a01 * b11 + a02 * b10 - a03 * b09) * invDet;\n dest[2] = (a31 * b05 - a32 * b04 + a33 * b03) * invDet;\n dest[3] = (-a21 * b05 + a22 * b04 - a23 * b03) * invDet;\n dest[4] = (-a10 * b11 + a12 * b08 - a13 * b07) * invDet;\n dest[5] = (a00 * b11 - a02 * b08 + a03 * b07) * invDet;\n dest[6] = (-a30 * b05 + a32 * b02 - a33 * b01) * invDet;\n dest[7] = (a20 * b05 - a22 * b02 + a23 * b01) * invDet;\n dest[8] = (a10 * b10 - a11 * b08 + a13 * b06) * invDet;\n dest[9] = (-a00 * b10 + a01 * b08 - a03 * b06) * invDet;\n dest[10] = (a30 * b04 - a31 * b02 + a33 * b00) * invDet;\n dest[11] = (-a20 * b04 + a21 * b02 - a23 * b00) * invDet;\n dest[12] = (-a10 * b09 + a11 * b07 - a12 * b06) * invDet;\n dest[13] = (a00 * b09 - a01 * b07 + a02 * b06) * invDet;\n dest[14] = (-a30 * b03 + a31 * b01 - a32 * b00) * invDet;\n dest[15] = (a20 * b03 - a21 * b01 + a22 * b00) * invDet;\n\n return dest;\n },\n\n /**\n * Returns the trace of the given 4x4 matrix.\n * @method traceMat4\n * @static\n */\n traceMat4(m) {\n return (m[0] + m[5] + m[10] + m[15]);\n },\n\n /**\n * Returns 4x4 translation matrix.\n * @method translationMat4\n * @static\n */\n translationMat4v(v, dest) {\n const m = dest || math.identityMat4();\n m[12] = v[0];\n m[13] = v[1];\n m[14] = v[2];\n return m;\n },\n\n /**\n * Returns 3x3 translation matrix.\n * @method translationMat3\n * @static\n */\n translationMat3v(v, dest) {\n const m = dest || math.identityMat3();\n m[6] = v[0];\n m[7] = v[1];\n return m;\n },\n\n /**\n * Returns 4x4 translation matrix.\n * @method translationMat4c\n * @static\n */\n translationMat4c: ((() => {\n const xyz = new FloatArrayType(3);\n return (x, y, z, dest) => {\n xyz[0] = x;\n xyz[1] = y;\n xyz[2] = z;\n return math.translationMat4v(xyz, dest);\n };\n }))(),\n\n /**\n * Returns 4x4 translation matrix.\n * @method translationMat4s\n * @static\n */\n translationMat4s(s, dest) {\n return math.translationMat4c(s, s, s, dest);\n },\n\n /**\n * Efficiently post-concatenates a translation to the given matrix.\n * @param v\n * @param m\n */\n translateMat4v(xyz, m) {\n return math.translateMat4c(xyz[0], xyz[1], xyz[2], m);\n },\n\n /**\n * Efficiently post-concatenates a translation to the given matrix.\n * @param x\n * @param y\n * @param z\n * @param m\n */\n\n translateMat4c(x, y, z, m) {\n\n const m3 = m[3];\n m[0] += m3 * x;\n m[1] += m3 * y;\n m[2] += m3 * z;\n\n const m7 = m[7];\n m[4] += m7 * x;\n m[5] += m7 * y;\n m[6] += m7 * z;\n\n const m11 = m[11];\n m[8] += m11 * x;\n m[9] += m11 * y;\n m[10] += m11 * z;\n\n const m15 = m[15];\n m[12] += m15 * x;\n m[13] += m15 * y;\n m[14] += m15 * z;\n\n return m;\n },\n\n /**\n * Creates a new matrix that replaces the translation in the rightmost column of the given\n * affine matrix with the given translation.\n * @param m\n * @param translation\n * @param dest\n * @returns {*}\n */\n setMat4Translation(m, translation, dest) {\n\n dest[0] = m[0];\n dest[1] = m[1];\n dest[2] = m[2];\n dest[3] = m[3];\n\n dest[4] = m[4];\n dest[5] = m[5];\n dest[6] = m[6];\n dest[7] = m[7];\n\n dest[8] = m[8];\n dest[9] = m[9];\n dest[10] = m[10];\n dest[11] = m[11];\n\n dest[12] = translation[0];\n dest[13] = translation[1];\n dest[14] = translation[2];\n dest[15] = m[15];\n\n return dest;\n },\n\n /**\n * Returns 4x4 rotation matrix.\n * @method rotationMat4v\n * @static\n */\n rotationMat4v(anglerad, axis, m) {\n const ax = math.normalizeVec4([axis[0], axis[1], axis[2], 0.0], []);\n const s = Math.sin(anglerad);\n const c = Math.cos(anglerad);\n const q = 1.0 - c;\n\n const x = ax[0];\n const y = ax[1];\n const z = ax[2];\n\n let xy;\n let yz;\n let zx;\n let xs;\n let ys;\n let zs;\n\n //xx = x * x; used once\n //yy = y * y; used once\n //zz = z * z; used once\n xy = x * y;\n yz = y * z;\n zx = z * x;\n xs = x * s;\n ys = y * s;\n zs = z * s;\n\n m = m || math.mat4();\n\n m[0] = (q * x * x) + c;\n m[1] = (q * xy) + zs;\n m[2] = (q * zx) - ys;\n m[3] = 0.0;\n\n m[4] = (q * xy) - zs;\n m[5] = (q * y * y) + c;\n m[6] = (q * yz) + xs;\n m[7] = 0.0;\n\n m[8] = (q * zx) + ys;\n m[9] = (q * yz) - xs;\n m[10] = (q * z * z) + c;\n m[11] = 0.0;\n\n m[12] = 0.0;\n m[13] = 0.0;\n m[14] = 0.0;\n m[15] = 1.0;\n\n return m;\n },\n\n /**\n * Returns 4x4 rotation matrix.\n * @method rotationMat4c\n * @static\n */\n rotationMat4c(anglerad, x, y, z, mat) {\n return math.rotationMat4v(anglerad, [x, y, z], mat);\n },\n\n /**\n * Returns 4x4 scale matrix.\n * @method scalingMat4v\n * @static\n */\n scalingMat4v(v, m = math.identityMat4()) {\n m[0] = v[0];\n m[5] = v[1];\n m[10] = v[2];\n return m;\n },\n\n /**\n * Returns 3x3 scale matrix.\n * @method scalingMat3v\n * @static\n */\n scalingMat3v(v, m = math.identityMat3()) {\n m[0] = v[0];\n m[4] = v[1];\n return m;\n },\n\n /**\n * Returns 4x4 scale matrix.\n * @method scalingMat4c\n * @static\n */\n scalingMat4c: ((() => {\n const xyz = new FloatArrayType(3);\n return (x, y, z, dest) => {\n xyz[0] = x;\n xyz[1] = y;\n xyz[2] = z;\n return math.scalingMat4v(xyz, dest);\n };\n }))(),\n\n /**\n * Efficiently post-concatenates a scaling to the given matrix.\n * @method scaleMat4c\n * @param x\n * @param y\n * @param z\n * @param m\n */\n scaleMat4c(x, y, z, m) {\n\n m[0] *= x;\n m[4] *= y;\n m[8] *= z;\n\n m[1] *= x;\n m[5] *= y;\n m[9] *= z;\n\n m[2] *= x;\n m[6] *= y;\n m[10] *= z;\n\n m[3] *= x;\n m[7] *= y;\n m[11] *= z;\n return m;\n },\n\n /**\n * Efficiently post-concatenates a scaling to the given matrix.\n * @method scaleMat4c\n * @param xyz\n * @param m\n */\n scaleMat4v(xyz, m) {\n\n const x = xyz[0];\n const y = xyz[1];\n const z = xyz[2];\n\n m[0] *= x;\n m[4] *= y;\n m[8] *= z;\n m[1] *= x;\n m[5] *= y;\n m[9] *= z;\n m[2] *= x;\n m[6] *= y;\n m[10] *= z;\n m[3] *= x;\n m[7] *= y;\n m[11] *= z;\n\n return m;\n },\n\n /**\n * Returns 4x4 scale matrix.\n * @method scalingMat4s\n * @static\n */\n scalingMat4s(s) {\n return math.scalingMat4c(s, s, s);\n },\n\n /**\n * Creates a matrix from a quaternion rotation and vector translation\n *\n * @param {Number[]} q Rotation quaternion\n * @param {Number[]} v Translation vector\n * @param {Number[]} dest Destination matrix\n * @returns {Number[]} dest\n */\n rotationTranslationMat4(q, v, dest = math.mat4()) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dest[0] = 1 - (yy + zz);\n dest[1] = xy + wz;\n dest[2] = xz - wy;\n dest[3] = 0;\n dest[4] = xy - wz;\n dest[5] = 1 - (xx + zz);\n dest[6] = yz + wx;\n dest[7] = 0;\n dest[8] = xz + wy;\n dest[9] = yz - wx;\n dest[10] = 1 - (xx + yy);\n dest[11] = 0;\n dest[12] = v[0];\n dest[13] = v[1];\n dest[14] = v[2];\n dest[15] = 1;\n\n return dest;\n },\n\n /**\n * Gets Euler angles from a 4x4 matrix.\n *\n * @param {Number[]} mat The 4x4 matrix.\n * @param {String} order Desired Euler angle order: \"XYZ\", \"YXZ\", \"ZXY\" etc.\n * @param {Number[]} [dest] Destination Euler angles, created by default.\n * @returns {Number[]} The Euler angles.\n */\n mat4ToEuler(mat, order, dest = math.vec4()) {\n const clamp = math.clamp;\n\n // Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n const m11 = mat[0];\n\n const m12 = mat[4];\n const m13 = mat[8];\n const m21 = mat[1];\n const m22 = mat[5];\n const m23 = mat[9];\n const m31 = mat[2];\n const m32 = mat[6];\n const m33 = mat[10];\n\n if (order === 'XYZ') {\n\n dest[1] = Math.asin(clamp(m13, -1, 1));\n\n if (Math.abs(m13) < 0.99999) {\n dest[0] = Math.atan2(-m23, m33);\n dest[2] = Math.atan2(-m12, m11);\n } else {\n dest[0] = Math.atan2(m32, m22);\n dest[2] = 0;\n\n }\n\n } else if (order === 'YXZ') {\n\n dest[0] = Math.asin(-clamp(m23, -1, 1));\n\n if (Math.abs(m23) < 0.99999) {\n dest[1] = Math.atan2(m13, m33);\n dest[2] = Math.atan2(m21, m22);\n } else {\n dest[1] = Math.atan2(-m31, m11);\n dest[2] = 0;\n }\n\n } else if (order === 'ZXY') {\n\n dest[0] = Math.asin(clamp(m32, -1, 1));\n\n if (Math.abs(m32) < 0.99999) {\n dest[1] = Math.atan2(-m31, m33);\n dest[2] = Math.atan2(-m12, m22);\n } else {\n dest[1] = 0;\n dest[2] = Math.atan2(m21, m11);\n }\n\n } else if (order === 'ZYX') {\n\n dest[1] = Math.asin(-clamp(m31, -1, 1));\n\n if (Math.abs(m31) < 0.99999) {\n dest[0] = Math.atan2(m32, m33);\n dest[2] = Math.atan2(m21, m11);\n } else {\n dest[0] = 0;\n dest[2] = Math.atan2(-m12, m22);\n }\n\n } else if (order === 'YZX') {\n\n dest[2] = Math.asin(clamp(m21, -1, 1));\n\n if (Math.abs(m21) < 0.99999) {\n dest[0] = Math.atan2(-m23, m22);\n dest[1] = Math.atan2(-m31, m11);\n } else {\n dest[0] = 0;\n dest[1] = Math.atan2(m13, m33);\n }\n\n } else if (order === 'XZY') {\n\n dest[2] = Math.asin(-clamp(m12, -1, 1));\n\n if (Math.abs(m12) < 0.99999) {\n dest[0] = Math.atan2(m32, m22);\n dest[1] = Math.atan2(m13, m11);\n } else {\n dest[0] = Math.atan2(-m23, m33);\n dest[1] = 0;\n }\n }\n\n return dest;\n },\n\n composeMat4(position, quaternion, scale, mat = math.mat4()) {\n math.quaternionToRotationMat4(quaternion, mat);\n math.scaleMat4v(scale, mat);\n math.translateMat4v(position, mat);\n\n return mat;\n },\n\n decomposeMat4: (() => {\n\n const vec = new FloatArrayType(3);\n const matrix = new FloatArrayType(16);\n\n return function decompose(mat, position, quaternion, scale) {\n\n vec[0] = mat[0];\n vec[1] = mat[1];\n vec[2] = mat[2];\n\n let sx = math.lenVec3(vec);\n\n vec[0] = mat[4];\n vec[1] = mat[5];\n vec[2] = mat[6];\n\n const sy = math.lenVec3(vec);\n\n vec[8] = mat[8];\n vec[9] = mat[9];\n vec[10] = mat[10];\n\n const sz = math.lenVec3(vec);\n\n // if determine is negative, we need to invert one scale\n const det = math.determinantMat4(mat);\n\n if (det < 0) {\n sx = -sx;\n }\n\n position[0] = mat[12];\n position[1] = mat[13];\n position[2] = mat[14];\n\n // scale the rotation part\n matrix.set(mat);\n\n const invSX = 1 / sx;\n const invSY = 1 / sy;\n const invSZ = 1 / sz;\n\n matrix[0] *= invSX;\n matrix[1] *= invSX;\n matrix[2] *= invSX;\n\n matrix[4] *= invSY;\n matrix[5] *= invSY;\n matrix[6] *= invSY;\n\n matrix[8] *= invSZ;\n matrix[9] *= invSZ;\n matrix[10] *= invSZ;\n\n math.mat4ToQuaternion(matrix, quaternion);\n\n scale[0] = sx;\n scale[1] = sy;\n scale[2] = sz;\n\n return this;\n\n };\n\n })(),\n\n /** @private */\n getColMat4(mat, c) {\n const i = c * 4;\n return [mat[i], mat[i + 1], mat[i + 2], mat[i + 3]];\n },\n\n /** @private */\n setRowMat4(mat, r, v) {\n mat[r] = v[0];\n mat[r + 4] = v[1];\n mat[r + 8] = v[2];\n mat[r + 12] = v[3];\n },\n\n /**\n * Returns a 4x4 'lookat' viewing transform matrix.\n * @method lookAtMat4v\n * @param pos vec3 position of the viewer\n * @param target vec3 point the viewer is looking at\n * @param up vec3 pointing \"up\"\n * @param dest mat4 Optional, mat4 matrix will be written into\n *\n * @return {mat4} dest if specified, a new mat4 otherwise\n */\n lookAtMat4v(pos, target, up, dest) {\n if (!dest) {\n dest = math.mat4();\n }\n\n const posx = pos[0];\n const posy = pos[1];\n const posz = pos[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const targetx = target[0];\n const targety = target[1];\n const targetz = target[2];\n\n if (posx === targetx && posy === targety && posz === targetz) {\n return math.identityMat4();\n }\n\n let z0;\n let z1;\n let z2;\n let x0;\n let x1;\n let x2;\n let y0;\n let y1;\n let y2;\n let len;\n\n //vec3.direction(eye, center, z);\n z0 = posx - targetx;\n z1 = posy - targety;\n z2 = posz - targetz;\n\n // normalize (no check needed for 0 because of early return)\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n //vec3.normalize(vec3.cross(up, z, x));\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n //vec3.normalize(vec3.cross(z, x, y));\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n dest[0] = x0;\n dest[1] = y0;\n dest[2] = z0;\n dest[3] = 0;\n dest[4] = x1;\n dest[5] = y1;\n dest[6] = z1;\n dest[7] = 0;\n dest[8] = x2;\n dest[9] = y2;\n dest[10] = z2;\n dest[11] = 0;\n dest[12] = -(x0 * posx + x1 * posy + x2 * posz);\n dest[13] = -(y0 * posx + y1 * posy + y2 * posz);\n dest[14] = -(z0 * posx + z1 * posy + z2 * posz);\n dest[15] = 1;\n\n return dest;\n },\n\n /**\n * Returns a 4x4 'lookat' viewing transform matrix.\n * @method lookAtMat4c\n * @static\n */\n lookAtMat4c(posx, posy, posz, targetx, targety, targetz, upx, upy, upz) {\n return math.lookAtMat4v([posx, posy, posz], [targetx, targety, targetz], [upx, upy, upz], []);\n },\n\n /**\n * Returns a 4x4 orthographic projection matrix.\n * @method orthoMat4c\n * @static\n */\n orthoMat4c(left, right, bottom, top, near, far, dest) {\n if (!dest) {\n dest = math.mat4();\n }\n const rl = (right - left);\n const tb = (top - bottom);\n const fn = (far - near);\n\n dest[0] = 2.0 / rl;\n dest[1] = 0.0;\n dest[2] = 0.0;\n dest[3] = 0.0;\n\n dest[4] = 0.0;\n dest[5] = 2.0 / tb;\n dest[6] = 0.0;\n dest[7] = 0.0;\n\n dest[8] = 0.0;\n dest[9] = 0.0;\n dest[10] = -2.0 / fn;\n dest[11] = 0.0;\n\n dest[12] = -(left + right) / rl;\n dest[13] = -(top + bottom) / tb;\n dest[14] = -(far + near) / fn;\n dest[15] = 1.0;\n\n return dest;\n },\n\n /**\n * Returns a 4x4 perspective projection matrix.\n * @method frustumMat4v\n * @static\n */\n frustumMat4v(fmin, fmax, m) {\n if (!m) {\n m = math.mat4();\n }\n\n const fmin4 = [fmin[0], fmin[1], fmin[2], 0.0];\n const fmax4 = [fmax[0], fmax[1], fmax[2], 0.0];\n\n math.addVec4(fmax4, fmin4, tempMat1);\n math.subVec4(fmax4, fmin4, tempMat2);\n\n const t = 2.0 * fmin4[2];\n\n const tempMat20 = tempMat2[0];\n const tempMat21 = tempMat2[1];\n const tempMat22 = tempMat2[2];\n\n m[0] = t / tempMat20;\n m[1] = 0.0;\n m[2] = 0.0;\n m[3] = 0.0;\n\n m[4] = 0.0;\n m[5] = t / tempMat21;\n m[6] = 0.0;\n m[7] = 0.0;\n\n m[8] = tempMat1[0] / tempMat20;\n m[9] = tempMat1[1] / tempMat21;\n m[10] = -tempMat1[2] / tempMat22;\n m[11] = -1.0;\n\n m[12] = 0.0;\n m[13] = 0.0;\n m[14] = -t * fmax4[2] / tempMat22;\n m[15] = 0.0;\n\n return m;\n },\n\n /**\n * Returns a 4x4 perspective projection matrix.\n * @method frustumMat4v\n * @static\n */\n frustumMat4(left, right, bottom, top, near, far, dest) {\n if (!dest) {\n dest = math.mat4();\n }\n const rl = (right - left);\n const tb = (top - bottom);\n const fn = (far - near);\n dest[0] = (near * 2) / rl;\n dest[1] = 0;\n dest[2] = 0;\n dest[3] = 0;\n dest[4] = 0;\n dest[5] = (near * 2) / tb;\n dest[6] = 0;\n dest[7] = 0;\n dest[8] = (right + left) / rl;\n dest[9] = (top + bottom) / tb;\n dest[10] = -(far + near) / fn;\n dest[11] = -1;\n dest[12] = 0;\n dest[13] = 0;\n dest[14] = -(far * near * 2) / fn;\n dest[15] = 0;\n return dest;\n },\n\n /**\n * Returns a 4x4 perspective projection matrix.\n * @method perspectiveMat4v\n * @static\n */\n perspectiveMat4(fovyrad, aspectratio, znear, zfar, m) {\n const pmin = [];\n const pmax = [];\n\n pmin[2] = znear;\n pmax[2] = zfar;\n\n pmax[1] = pmin[2] * Math.tan(fovyrad / 2.0);\n pmin[1] = -pmax[1];\n\n pmax[0] = pmax[1] * aspectratio;\n pmin[0] = -pmax[0];\n\n return math.frustumMat4v(pmin, pmax, m);\n },\n\n /**\n * Returns true if the two 4x4 matrices are the same.\n * @param m1\n * @param m2\n * @returns {Boolean}\n */\n compareMat4(m1, m2) {\n return m1[0] === m2[0] &&\n m1[1] === m2[1] &&\n m1[2] === m2[2] &&\n m1[3] === m2[3] &&\n m1[4] === m2[4] &&\n m1[5] === m2[5] &&\n m1[6] === m2[6] &&\n m1[7] === m2[7] &&\n m1[8] === m2[8] &&\n m1[9] === m2[9] &&\n m1[10] === m2[10] &&\n m1[11] === m2[11] &&\n m1[12] === m2[12] &&\n m1[13] === m2[13] &&\n m1[14] === m2[14] &&\n m1[15] === m2[15];\n },\n\n /**\n * Transforms a three-element position by a 4x4 matrix.\n * @method transformPoint3\n * @static\n */\n transformPoint3(m, p, dest = math.vec3()) {\n\n const x = p[0];\n const y = p[1];\n const z = p[2];\n\n dest[0] = (m[0] * x) + (m[4] * y) + (m[8] * z) + m[12];\n dest[1] = (m[1] * x) + (m[5] * y) + (m[9] * z) + m[13];\n dest[2] = (m[2] * x) + (m[6] * y) + (m[10] * z) + m[14];\n\n return dest;\n },\n\n /**\n * Transforms a homogeneous coordinate by a 4x4 matrix.\n * @method transformPoint3\n * @static\n */\n transformPoint4(m, v, dest = math.vec4()) {\n dest[0] = m[0] * v[0] + m[4] * v[1] + m[8] * v[2] + m[12] * v[3];\n dest[1] = m[1] * v[0] + m[5] * v[1] + m[9] * v[2] + m[13] * v[3];\n dest[2] = m[2] * v[0] + m[6] * v[1] + m[10] * v[2] + m[14] * v[3];\n dest[3] = m[3] * v[0] + m[7] * v[1] + m[11] * v[2] + m[15] * v[3];\n\n return dest;\n },\n\n\n /**\n * Transforms an array of three-element positions by a 4x4 matrix.\n * @method transformPoints3\n * @static\n */\n transformPoints3(m, points, points2) {\n const result = points2 || [];\n const len = points.length;\n let p0;\n let p1;\n let p2;\n let pi;\n\n // cache values\n const m0 = m[0];\n\n const m1 = m[1];\n const m2 = m[2];\n const m3 = m[3];\n const m4 = m[4];\n const m5 = m[5];\n const m6 = m[6];\n const m7 = m[7];\n const m8 = m[8];\n const m9 = m[9];\n const m10 = m[10];\n const m11 = m[11];\n const m12 = m[12];\n const m13 = m[13];\n const m14 = m[14];\n const m15 = m[15];\n\n let r;\n\n for (let i = 0; i < len; ++i) {\n\n // cache values\n pi = points[i];\n\n p0 = pi[0];\n p1 = pi[1];\n p2 = pi[2];\n\n r = result[i] || (result[i] = [0, 0, 0]);\n\n r[0] = (m0 * p0) + (m4 * p1) + (m8 * p2) + m12;\n r[1] = (m1 * p0) + (m5 * p1) + (m9 * p2) + m13;\n r[2] = (m2 * p0) + (m6 * p1) + (m10 * p2) + m14;\n r[3] = (m3 * p0) + (m7 * p1) + (m11 * p2) + m15;\n }\n\n result.length = len;\n\n return result;\n },\n\n /**\n * Transforms an array of positions by a 4x4 matrix.\n * @method transformPositions3\n * @static\n */\n transformPositions3(m, p, p2 = p) {\n let i;\n const len = p.length;\n\n let x;\n let y;\n let z;\n\n const m0 = m[0];\n const m1 = m[1];\n const m2 = m[2];\n const m3 = m[3];\n const m4 = m[4];\n const m5 = m[5];\n const m6 = m[6];\n const m7 = m[7];\n const m8 = m[8];\n const m9 = m[9];\n const m10 = m[10];\n const m11 = m[11];\n const m12 = m[12];\n const m13 = m[13];\n const m14 = m[14];\n const m15 = m[15];\n\n for (i = 0; i < len; i += 3) {\n\n x = p[i + 0];\n y = p[i + 1];\n z = p[i + 2];\n\n p2[i + 0] = (m0 * x) + (m4 * y) + (m8 * z) + m12;\n p2[i + 1] = (m1 * x) + (m5 * y) + (m9 * z) + m13;\n p2[i + 2] = (m2 * x) + (m6 * y) + (m10 * z) + m14;\n }\n\n return p2;\n },\n\n /**\n * Transforms an array of positions by a 4x4 matrix.\n * @method transformPositions4\n * @static\n */\n transformPositions4(m, p, p2 = p) {\n let i;\n const len = p.length;\n\n let x;\n let y;\n let z;\n\n const m0 = m[0];\n const m1 = m[1];\n const m2 = m[2];\n const m3 = m[3];\n const m4 = m[4];\n const m5 = m[5];\n const m6 = m[6];\n const m7 = m[7];\n const m8 = m[8];\n const m9 = m[9];\n const m10 = m[10];\n const m11 = m[11];\n const m12 = m[12];\n const m13 = m[13];\n const m14 = m[14];\n const m15 = m[15];\n\n for (i = 0; i < len; i += 4) {\n\n x = p[i + 0];\n y = p[i + 1];\n z = p[i + 2];\n\n p2[i + 0] = (m0 * x) + (m4 * y) + (m8 * z) + m12;\n p2[i + 1] = (m1 * x) + (m5 * y) + (m9 * z) + m13;\n p2[i + 2] = (m2 * x) + (m6 * y) + (m10 * z) + m14;\n p2[i + 3] = (m3 * x) + (m7 * y) + (m11 * z) + m15;\n }\n\n return p2;\n },\n\n /**\n * Transforms a three-element vector by a 4x4 matrix.\n * @method transformVec3\n * @static\n */\n transformVec3(m, v, dest) {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n dest = dest || this.vec3();\n dest[0] = (m[0] * v0) + (m[4] * v1) + (m[8] * v2);\n dest[1] = (m[1] * v0) + (m[5] * v1) + (m[9] * v2);\n dest[2] = (m[2] * v0) + (m[6] * v1) + (m[10] * v2);\n return dest;\n },\n\n /**\n * Transforms a four-element vector by a 4x4 matrix.\n * @method transformVec4\n * @static\n */\n transformVec4(m, v, dest) {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n dest = dest || math.vec4();\n dest[0] = m[0] * v0 + m[4] * v1 + m[8] * v2 + m[12] * v3;\n dest[1] = m[1] * v0 + m[5] * v1 + m[9] * v2 + m[13] * v3;\n dest[2] = m[2] * v0 + m[6] * v1 + m[10] * v2 + m[14] * v3;\n dest[3] = m[3] * v0 + m[7] * v1 + m[11] * v2 + m[15] * v3;\n return dest;\n },\n\n /**\n * Rotate a 2D vector around a center point.\n *\n * @param a\n * @param center\n * @param angle\n * @returns {math}\n */\n rotateVec2(a, center, angle, dest = a) {\n const c = Math.cos(angle);\n const s = Math.sin(angle);\n const x = a[0] - center[0];\n const y = a[1] - center[1];\n dest[0] = x * c - y * s + center[0];\n dest[1] = x * s + y * c + center[1];\n return a;\n },\n\n /**\n * Rotate a 3D vector around the x-axis\n *\n * @method rotateVec3X\n * @param {Number[]} a The vec3 point to rotate\n * @param {Number[]} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @param {Number[]} dest The receiving vec3\n * @returns {Number[]} dest\n * @static\n */\n rotateVec3X(a, b, c, dest) {\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);\n r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c);\n\n //translate to correct position\n dest[0] = r[0] + b[0];\n dest[1] = r[1] + b[1];\n dest[2] = r[2] + b[2];\n\n return dest;\n },\n\n /**\n * Rotate a 3D vector around the y-axis\n *\n * @method rotateVec3Y\n * @param {Number[]} a The vec3 point to rotate\n * @param {Number[]} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @param {Number[]} dest The receiving vec3\n * @returns {Number[]} dest\n * @static\n */\n rotateVec3Y(a, b, c, dest) {\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c);\n\n //translate to correct position\n dest[0] = r[0] + b[0];\n dest[1] = r[1] + b[1];\n dest[2] = r[2] + b[2];\n\n return dest;\n },\n\n /**\n * Rotate a 3D vector around the z-axis\n *\n * @method rotateVec3Z\n * @param {Number[]} a The vec3 point to rotate\n * @param {Number[]} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @param {Number[]} dest The receiving vec3\n * @returns {Number[]} dest\n * @static\n */\n rotateVec3Z(a, b, c, dest) {\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);\n r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);\n r[2] = p[2];\n\n //translate to correct position\n dest[0] = r[0] + b[0];\n dest[1] = r[1] + b[1];\n dest[2] = r[2] + b[2];\n\n return dest;\n },\n\n /**\n * Transforms a four-element vector by a 4x4 projection matrix.\n *\n * @method projectVec4\n * @param {Number[]} p 3D View-space coordinate\n * @param {Number[]} q 2D Projected coordinate\n * @returns {Number[]} 2D Projected coordinate\n * @static\n */\n projectVec4(p, q) {\n const f = 1.0 / p[3];\n q = q || math.vec2();\n q[0] = p[0] * f;\n q[1] = p[1] * f;\n return q;\n },\n\n /**\n * Unprojects a three-element vector.\n *\n * @method unprojectVec3\n * @param {Number[]} p 3D Projected coordinate\n * @param {Number[]} viewMat View matrix\n * @returns {Number[]} projMat Projection matrix\n * @static\n */\n unprojectVec3: ((() => {\n const mat = new FloatArrayType(16);\n const mat2 = new FloatArrayType(16);\n const mat3 = new FloatArrayType(16);\n return function (p, viewMat, projMat, q) {\n return this.transformVec3(this.mulMat4(this.inverseMat4(viewMat, mat), this.inverseMat4(projMat, mat2), mat3), p, q)\n };\n }))(),\n\n /**\n * Linearly interpolates between two 3D vectors.\n * @method lerpVec3\n * @static\n */\n lerpVec3(t, t1, t2, p1, p2, dest) {\n const result = dest || math.vec3();\n const f = (t - t1) / (t2 - t1);\n result[0] = p1[0] + (f * (p2[0] - p1[0]));\n result[1] = p1[1] + (f * (p2[1] - p1[1]));\n result[2] = p1[2] + (f * (p2[2] - p1[2]));\n return result;\n },\n\n /**\n * Linearly interpolates between two 4x4 matrices.\n * @method lerpMat4\n * @static\n */\n lerpMat4(t, t1, t2, m1, m2, dest) {\n const result = dest || math.mat4();\n const f = (t - t1) / (t2 - t1);\n result[0] = m1[0] + (f * (m2[0] - m1[0]));\n result[1] = m1[1] + (f * (m2[1] - m1[1]));\n result[2] = m1[2] + (f * (m2[2] - m1[2]));\n result[3] = m1[3] + (f * (m2[3] - m1[3]));\n result[4] = m1[4] + (f * (m2[4] - m1[4]));\n result[5] = m1[5] + (f * (m2[5] - m1[5]));\n result[6] = m1[6] + (f * (m2[6] - m1[6]));\n result[7] = m1[7] + (f * (m2[7] - m1[7]));\n result[8] = m1[8] + (f * (m2[8] - m1[8]));\n result[9] = m1[9] + (f * (m2[9] - m1[9]));\n result[10] = m1[10] + (f * (m2[10] - m1[10]));\n result[11] = m1[11] + (f * (m2[11] - m1[11]));\n result[12] = m1[12] + (f * (m2[12] - m1[12]));\n result[13] = m1[13] + (f * (m2[13] - m1[13]));\n result[14] = m1[14] + (f * (m2[14] - m1[14]));\n result[15] = m1[15] + (f * (m2[15] - m1[15]));\n return result;\n },\n\n\n /**\n * Flattens a two-dimensional array into a one-dimensional array.\n *\n * @method flatten\n * @static\n * @param {Array of Arrays} a A 2D array\n * @returns Flattened 1D array\n */\n flatten(a) {\n\n const result = [];\n\n let i;\n let leni;\n let j;\n let lenj;\n let item;\n\n for (i = 0, leni = a.length; i < leni; i++) {\n item = a[i];\n for (j = 0, lenj = item.length; j < lenj; j++) {\n result.push(item[j]);\n }\n }\n\n return result;\n },\n\n\n identityQuaternion(dest = math.vec4()) {\n dest[0] = 0.0;\n dest[1] = 0.0;\n dest[2] = 0.0;\n dest[3] = 1.0;\n return dest;\n },\n\n /**\n * Initializes a quaternion from Euler angles.\n *\n * @param {Number[]} euler The Euler angles.\n * @param {String} order Euler angle order: \"XYZ\", \"YXZ\", \"ZXY\" etc.\n * @param {Number[]} [dest] Destination quaternion, created by default.\n * @returns {Number[]} The quaternion.\n */\n eulerToQuaternion(euler, order, dest = math.vec4()) {\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n //\tcontent/SpinCalc.m\n\n const a = (euler[0] * math.DEGTORAD) / 2;\n const b = (euler[1] * math.DEGTORAD) / 2;\n const c = (euler[2] * math.DEGTORAD) / 2;\n\n const c1 = Math.cos(a);\n const c2 = Math.cos(b);\n const c3 = Math.cos(c);\n const s1 = Math.sin(a);\n const s2 = Math.sin(b);\n const s3 = Math.sin(c);\n\n if (order === 'XYZ') {\n\n dest[0] = s1 * c2 * c3 + c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 - s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 + s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 - s1 * s2 * s3;\n\n } else if (order === 'YXZ') {\n\n dest[0] = s1 * c2 * c3 + c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 - s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 - s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 + s1 * s2 * s3;\n\n } else if (order === 'ZXY') {\n\n dest[0] = s1 * c2 * c3 - c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 + s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 + s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 - s1 * s2 * s3;\n\n } else if (order === 'ZYX') {\n\n dest[0] = s1 * c2 * c3 - c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 + s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 - s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 + s1 * s2 * s3;\n\n } else if (order === 'YZX') {\n\n dest[0] = s1 * c2 * c3 + c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 + s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 - s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 - s1 * s2 * s3;\n\n } else if (order === 'XZY') {\n\n dest[0] = s1 * c2 * c3 - c1 * s2 * s3;\n dest[1] = c1 * s2 * c3 - s1 * c2 * s3;\n dest[2] = c1 * c2 * s3 + s1 * s2 * c3;\n dest[3] = c1 * c2 * c3 + s1 * s2 * s3;\n }\n\n return dest;\n },\n\n mat4ToQuaternion(m, dest = math.vec4()) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n // Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n const m11 = m[0];\n const m12 = m[4];\n const m13 = m[8];\n const m21 = m[1];\n const m22 = m[5];\n const m23 = m[9];\n const m31 = m[2];\n const m32 = m[6];\n const m33 = m[10];\n let s;\n\n const trace = m11 + m22 + m33;\n\n if (trace > 0) {\n\n s = 0.5 / Math.sqrt(trace + 1.0);\n\n dest[3] = 0.25 / s;\n dest[0] = (m32 - m23) * s;\n dest[1] = (m13 - m31) * s;\n dest[2] = (m21 - m12) * s;\n\n } else if (m11 > m22 && m11 > m33) {\n\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\n\n dest[3] = (m32 - m23) / s;\n dest[0] = 0.25 * s;\n dest[1] = (m12 + m21) / s;\n dest[2] = (m13 + m31) / s;\n\n } else if (m22 > m33) {\n\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\n\n dest[3] = (m13 - m31) / s;\n dest[0] = (m12 + m21) / s;\n dest[1] = 0.25 * s;\n dest[2] = (m23 + m32) / s;\n\n } else {\n\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\n\n dest[3] = (m21 - m12) / s;\n dest[0] = (m13 + m31) / s;\n dest[1] = (m23 + m32) / s;\n dest[2] = 0.25 * s;\n }\n\n return dest;\n },\n\n vec3PairToQuaternion(u, v, dest = math.vec4()) {\n const norm_u_norm_v = Math.sqrt(math.dotVec3(u, u) * math.dotVec3(v, v));\n let real_part = norm_u_norm_v + math.dotVec3(u, v);\n\n if (real_part < 0.00000001 * norm_u_norm_v) {\n\n // If u and v are exactly opposite, rotate 180 degrees\n // around an arbitrary orthogonal axis. Axis normalisation\n // can happen later, when we normalise the quaternion.\n\n real_part = 0.0;\n\n if (Math.abs(u[0]) > Math.abs(u[2])) {\n\n dest[0] = -u[1];\n dest[1] = u[0];\n dest[2] = 0;\n\n } else {\n dest[0] = 0;\n dest[1] = -u[2];\n dest[2] = u[1]\n }\n\n } else {\n\n // Otherwise, build quaternion the standard way.\n math.cross3Vec3(u, v, dest);\n }\n\n dest[3] = real_part;\n\n return math.normalizeQuaternion(dest);\n },\n\n angleAxisToQuaternion(angleAxis, dest = math.vec4()) {\n const halfAngle = angleAxis[3] / 2.0;\n const fsin = Math.sin(halfAngle);\n dest[0] = fsin * angleAxis[0];\n dest[1] = fsin * angleAxis[1];\n dest[2] = fsin * angleAxis[2];\n dest[3] = Math.cos(halfAngle);\n return dest;\n },\n\n quaternionToEuler: ((() => {\n const mat = new FloatArrayType(16);\n return (q, order, dest) => {\n dest = dest || math.vec3();\n math.quaternionToRotationMat4(q, mat);\n math.mat4ToEuler(mat, order, dest);\n return dest;\n };\n }))(),\n\n mulQuaternions(p, q, dest = math.vec4()) {\n const p0 = p[0];\n const p1 = p[1];\n const p2 = p[2];\n const p3 = p[3];\n const q0 = q[0];\n const q1 = q[1];\n const q2 = q[2];\n const q3 = q[3];\n dest[0] = p3 * q0 + p0 * q3 + p1 * q2 - p2 * q1;\n dest[1] = p3 * q1 + p1 * q3 + p2 * q0 - p0 * q2;\n dest[2] = p3 * q2 + p2 * q3 + p0 * q1 - p1 * q0;\n dest[3] = p3 * q3 - p0 * q0 - p1 * q1 - p2 * q2;\n return dest;\n },\n\n vec3ApplyQuaternion(q, vec, dest = math.vec3()) {\n const x = vec[0];\n const y = vec[1];\n const z = vec[2];\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n // calculate quat * vector\n\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n\n dest[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n dest[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n dest[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n\n return dest;\n },\n\n quaternionToMat4(q, dest) {\n\n dest = math.identityMat4(dest);\n\n const q0 = q[0]; //x\n const q1 = q[1]; //y\n const q2 = q[2]; //z\n const q3 = q[3]; //w\n\n const tx = 2.0 * q0;\n const ty = 2.0 * q1;\n const tz = 2.0 * q2;\n\n const twx = tx * q3;\n const twy = ty * q3;\n const twz = tz * q3;\n\n const txx = tx * q0;\n const txy = ty * q0;\n const txz = tz * q0;\n\n const tyy = ty * q1;\n const tyz = tz * q1;\n const tzz = tz * q2;\n\n dest[0] = 1.0 - (tyy + tzz);\n dest[1] = txy + twz;\n dest[2] = txz - twy;\n\n dest[4] = txy - twz;\n dest[5] = 1.0 - (txx + tzz);\n dest[6] = tyz + twx;\n\n dest[8] = txz + twy;\n dest[9] = tyz - twx;\n\n dest[10] = 1.0 - (txx + tyy);\n\n return dest;\n },\n\n quaternionToRotationMat4(q, m) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n m[0] = 1 - (yy + zz);\n m[4] = xy - wz;\n m[8] = xz + wy;\n\n m[1] = xy + wz;\n m[5] = 1 - (xx + zz);\n m[9] = yz - wx;\n\n m[2] = xz - wy;\n m[6] = yz + wx;\n m[10] = 1 - (xx + yy);\n\n // last column\n m[3] = 0;\n m[7] = 0;\n m[11] = 0;\n\n // bottom row\n m[12] = 0;\n m[13] = 0;\n m[14] = 0;\n m[15] = 1;\n\n return m;\n },\n\n normalizeQuaternion(q, dest = q) {\n const len = math.lenVec4([q[0], q[1], q[2], q[3]]);\n dest[0] = q[0] / len;\n dest[1] = q[1] / len;\n dest[2] = q[2] / len;\n dest[3] = q[3] / len;\n return dest;\n },\n\n conjugateQuaternion(q, dest = q) {\n dest[0] = -q[0];\n dest[1] = -q[1];\n dest[2] = -q[2];\n dest[3] = q[3];\n return dest;\n },\n\n inverseQuaternion(q, dest) {\n return math.normalizeQuaternion(math.conjugateQuaternion(q, dest));\n },\n\n quaternionToAngleAxis(q, angleAxis = math.vec4()) {\n q = math.normalizeQuaternion(q, tempVec4);\n const q3 = q[3];\n const angle = 2 * Math.acos(q3);\n const s = Math.sqrt(1 - q3 * q3);\n if (s < 0.001) { // test to avoid divide by zero, s is always positive due to sqrt\n angleAxis[0] = q[0];\n angleAxis[1] = q[1];\n angleAxis[2] = q[2];\n } else {\n angleAxis[0] = q[0] / s;\n angleAxis[1] = q[1] / s;\n angleAxis[2] = q[2] / s;\n }\n angleAxis[3] = angle; // * 57.295779579;\n return angleAxis;\n },\n\n //------------------------------------------------------------------------------------------------------------------\n // Boundaries\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns a new, uninitialized 3D axis-aligned bounding box.\n *\n * @private\n */\n AABB3(values) {\n return new FloatArrayType(values || 6);\n },\n\n /**\n * Returns a new, uninitialized 2D axis-aligned bounding box.\n *\n * @private\n */\n AABB2(values) {\n return new FloatArrayType(values || 4);\n },\n\n /**\n * Returns a new, uninitialized 3D oriented bounding box (OBB).\n *\n * @private\n */\n OBB3(values) {\n return new FloatArrayType(values || 32);\n },\n\n /**\n * Returns a new, uninitialized 2D oriented bounding box (OBB).\n *\n * @private\n */\n OBB2(values) {\n return new FloatArrayType(values || 16);\n },\n\n /** Returns a new 3D bounding sphere */\n Sphere3(x, y, z, r) {\n return new FloatArrayType([x, y, z, r]);\n },\n\n /**\n * Transforms an OBB3 by a 4x4 matrix.\n *\n * @private\n */\n transformOBB3(m, p, p2 = p) {\n let i;\n const len = p.length;\n\n let x;\n let y;\n let z;\n\n const m0 = m[0];\n const m1 = m[1];\n const m2 = m[2];\n const m3 = m[3];\n const m4 = m[4];\n const m5 = m[5];\n const m6 = m[6];\n const m7 = m[7];\n const m8 = m[8];\n const m9 = m[9];\n const m10 = m[10];\n const m11 = m[11];\n const m12 = m[12];\n const m13 = m[13];\n const m14 = m[14];\n const m15 = m[15];\n\n for (i = 0; i < len; i += 4) {\n\n x = p[i + 0];\n y = p[i + 1];\n z = p[i + 2];\n\n p2[i + 0] = (m0 * x) + (m4 * y) + (m8 * z) + m12;\n p2[i + 1] = (m1 * x) + (m5 * y) + (m9 * z) + m13;\n p2[i + 2] = (m2 * x) + (m6 * y) + (m10 * z) + m14;\n p2[i + 3] = (m3 * x) + (m7 * y) + (m11 * z) + m15;\n }\n\n return p2;\n },\n\n /** Returns true if the first AABB contains the second AABB.\n * @param aabb1\n * @param aabb2\n * @returns {Boolean}\n */\n containsAABB3: function (aabb1, aabb2) {\n const result = (\n aabb1[0] <= aabb2[0] && aabb2[3] <= aabb1[3] &&\n aabb1[1] <= aabb2[1] && aabb2[4] <= aabb1[4] &&\n aabb1[2] <= aabb2[2] && aabb2[5] <= aabb1[5]);\n return result;\n },\n\n\n /**\n * Gets the diagonal size of an AABB3 given as minima and maxima.\n *\n * @private\n */\n getAABB3Diag: ((() => {\n\n const min = new FloatArrayType(3);\n const max = new FloatArrayType(3);\n const tempVec3 = new FloatArrayType(3);\n\n return aabb => {\n\n min[0] = aabb[0];\n min[1] = aabb[1];\n min[2] = aabb[2];\n\n max[0] = aabb[3];\n max[1] = aabb[4];\n max[2] = aabb[5];\n\n math.subVec3(max, min, tempVec3);\n\n return Math.abs(math.lenVec3(tempVec3));\n };\n }))(),\n\n /**\n * Get a diagonal boundary size that is symmetrical about the given point.\n *\n * @private\n */\n getAABB3DiagPoint: ((() => {\n\n const min = new FloatArrayType(3);\n const max = new FloatArrayType(3);\n const tempVec3 = new FloatArrayType(3);\n\n return (aabb, p) => {\n\n min[0] = aabb[0];\n min[1] = aabb[1];\n min[2] = aabb[2];\n\n max[0] = aabb[3];\n max[1] = aabb[4];\n max[2] = aabb[5];\n\n const diagVec = math.subVec3(max, min, tempVec3);\n\n const xneg = p[0] - aabb[0];\n const xpos = aabb[3] - p[0];\n const yneg = p[1] - aabb[1];\n const ypos = aabb[4] - p[1];\n const zneg = p[2] - aabb[2];\n const zpos = aabb[5] - p[2];\n\n diagVec[0] += (xneg > xpos) ? xneg : xpos;\n diagVec[1] += (yneg > ypos) ? yneg : ypos;\n diagVec[2] += (zneg > zpos) ? zneg : zpos;\n\n return Math.abs(math.lenVec3(diagVec));\n };\n }))(),\n\n /**\n * Gets the area of an AABB.\n *\n * @private\n */\n getAABB3Area(aabb) {\n const width = (aabb[3] - aabb[0]);\n const height = (aabb[4] - aabb[1]);\n const depth = (aabb[5] - aabb[2]);\n return (width * height * depth);\n },\n\n /**\n * Gets the center of an AABB.\n *\n * @private\n */\n getAABB3Center(aabb, dest) {\n const r = dest || math.vec3();\n\n r[0] = (aabb[0] + aabb[3]) / 2;\n r[1] = (aabb[1] + aabb[4]) / 2;\n r[2] = (aabb[2] + aabb[5]) / 2;\n\n return r;\n },\n\n /**\n * Gets the center of a 2D AABB.\n *\n * @private\n */\n getAABB2Center(aabb, dest) {\n const r = dest || math.vec2();\n\n r[0] = (aabb[2] + aabb[0]) / 2;\n r[1] = (aabb[3] + aabb[1]) / 2;\n\n return r;\n },\n\n /**\n * Collapses a 3D axis-aligned boundary, ready to expand to fit 3D points.\n * Creates new AABB if none supplied.\n *\n * @private\n */\n collapseAABB3(aabb = math.AABB3()) {\n aabb[0] = math.MAX_DOUBLE;\n aabb[1] = math.MAX_DOUBLE;\n aabb[2] = math.MAX_DOUBLE;\n aabb[3] = math.MIN_DOUBLE;\n aabb[4] = math.MIN_DOUBLE;\n aabb[5] = math.MIN_DOUBLE;\n\n return aabb;\n },\n\n /**\n * Converts an axis-aligned 3D boundary into an oriented boundary consisting of\n * an array of eight 3D positions, one for each corner of the boundary.\n *\n * @private\n */\n AABB3ToOBB3(aabb, obb = math.OBB3()) {\n obb[0] = aabb[0];\n obb[1] = aabb[1];\n obb[2] = aabb[2];\n obb[3] = 1;\n\n obb[4] = aabb[3];\n obb[5] = aabb[1];\n obb[6] = aabb[2];\n obb[7] = 1;\n\n obb[8] = aabb[3];\n obb[9] = aabb[4];\n obb[10] = aabb[2];\n obb[11] = 1;\n\n obb[12] = aabb[0];\n obb[13] = aabb[4];\n obb[14] = aabb[2];\n obb[15] = 1;\n\n obb[16] = aabb[0];\n obb[17] = aabb[1];\n obb[18] = aabb[5];\n obb[19] = 1;\n\n obb[20] = aabb[3];\n obb[21] = aabb[1];\n obb[22] = aabb[5];\n obb[23] = 1;\n\n obb[24] = aabb[3];\n obb[25] = aabb[4];\n obb[26] = aabb[5];\n obb[27] = 1;\n\n obb[28] = aabb[0];\n obb[29] = aabb[4];\n obb[30] = aabb[5];\n obb[31] = 1;\n\n return obb;\n },\n\n /**\n * Finds the minimum axis-aligned 3D boundary enclosing the homogeneous 3D points (x,y,z,w) given in a flattened array.\n *\n * @private\n */\n positions3ToAABB3: ((() => {\n\n const p = new FloatArrayType(3);\n\n return (positions, aabb, positionsDecodeMatrix) => {\n aabb = aabb || math.AABB3();\n\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let zmin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n let zmax = math.MIN_DOUBLE;\n\n let x;\n let y;\n let z;\n\n for (let i = 0, len = positions.length; i < len; i += 3) {\n\n if (positionsDecodeMatrix) {\n\n p[0] = positions[i + 0];\n p[1] = positions[i + 1];\n p[2] = positions[i + 2];\n\n math.decompressPosition(p, positionsDecodeMatrix, p);\n\n x = p[0];\n y = p[1];\n z = p[2];\n\n } else {\n x = positions[i + 0];\n y = positions[i + 1];\n z = positions[i + 2];\n }\n\n if (x < xmin) {\n xmin = x;\n }\n\n if (y < ymin) {\n ymin = y;\n }\n\n if (z < zmin) {\n zmin = z;\n }\n\n if (x > xmax) {\n xmax = x;\n }\n\n if (y > ymax) {\n ymax = y;\n }\n\n if (z > zmax) {\n zmax = z;\n }\n }\n\n aabb[0] = xmin;\n aabb[1] = ymin;\n aabb[2] = zmin;\n aabb[3] = xmax;\n aabb[4] = ymax;\n aabb[5] = zmax;\n\n return aabb;\n };\n }))(),\n\n /**\n * Finds the minimum axis-aligned 3D boundary enclosing the homogeneous 3D points (x,y,z,w) given in a flattened array.\n *\n * @private\n */\n OBB3ToAABB3(obb, aabb = math.AABB3()) {\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let zmin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n let zmax = math.MIN_DOUBLE;\n\n let x;\n let y;\n let z;\n\n for (let i = 0, len = obb.length; i < len; i += 4) {\n\n x = obb[i + 0];\n y = obb[i + 1];\n z = obb[i + 2];\n\n if (x < xmin) {\n xmin = x;\n }\n\n if (y < ymin) {\n ymin = y;\n }\n\n if (z < zmin) {\n zmin = z;\n }\n\n if (x > xmax) {\n xmax = x;\n }\n\n if (y > ymax) {\n ymax = y;\n }\n\n if (z > zmax) {\n zmax = z;\n }\n }\n\n aabb[0] = xmin;\n aabb[1] = ymin;\n aabb[2] = zmin;\n aabb[3] = xmax;\n aabb[4] = ymax;\n aabb[5] = zmax;\n\n return aabb;\n },\n\n /**\n * Finds the minimum axis-aligned 3D boundary enclosing the given 3D points.\n *\n * @private\n */\n points3ToAABB3(points, aabb = math.AABB3()) {\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let zmin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n let zmax = math.MIN_DOUBLE;\n\n let x;\n let y;\n let z;\n\n for (let i = 0, len = points.length; i < len; i++) {\n\n x = points[i][0];\n y = points[i][1];\n z = points[i][2];\n\n if (x < xmin) {\n xmin = x;\n }\n\n if (y < ymin) {\n ymin = y;\n }\n\n if (z < zmin) {\n zmin = z;\n }\n\n if (x > xmax) {\n xmax = x;\n }\n\n if (y > ymax) {\n ymax = y;\n }\n\n if (z > zmax) {\n zmax = z;\n }\n }\n\n aabb[0] = xmin;\n aabb[1] = ymin;\n aabb[2] = zmin;\n aabb[3] = xmax;\n aabb[4] = ymax;\n aabb[5] = zmax;\n\n return aabb;\n },\n\n /**\n * Finds the minimum boundary sphere enclosing the given 3D points.\n *\n * @private\n */\n points3ToSphere3: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n\n return (points, sphere) => {\n\n sphere = sphere || math.vec4();\n\n let x = 0;\n let y = 0;\n let z = 0;\n\n let i;\n const numPoints = points.length;\n\n for (i = 0; i < numPoints; i++) {\n x += points[i][0];\n y += points[i][1];\n z += points[i][2];\n }\n\n sphere[0] = x / numPoints;\n sphere[1] = y / numPoints;\n sphere[2] = z / numPoints;\n\n let radius = 0;\n let dist;\n\n for (i = 0; i < numPoints; i++) {\n\n dist = Math.abs(math.lenVec3(math.subVec3(points[i], sphere, tempVec3)));\n\n if (dist > radius) {\n radius = dist;\n }\n }\n\n sphere[3] = radius;\n\n return sphere;\n };\n }))(),\n\n /**\n * Finds the minimum boundary sphere enclosing the given 3D positions.\n *\n * @private\n */\n positions3ToSphere3: ((() => {\n\n const tempVec3a = new FloatArrayType(3);\n const tempVec3b = new FloatArrayType(3);\n\n return (positions, sphere) => {\n\n sphere = sphere || math.vec4();\n\n let x = 0;\n let y = 0;\n let z = 0;\n\n let i;\n const lenPositions = positions.length;\n let radius = 0;\n\n for (i = 0; i < lenPositions; i += 3) {\n x += positions[i];\n y += positions[i + 1];\n z += positions[i + 2];\n }\n\n const numPositions = lenPositions / 3;\n\n sphere[0] = x / numPositions;\n sphere[1] = y / numPositions;\n sphere[2] = z / numPositions;\n\n let dist;\n\n for (i = 0; i < lenPositions; i += 3) {\n\n tempVec3a[0] = positions[i];\n tempVec3a[1] = positions[i + 1];\n tempVec3a[2] = positions[i + 2];\n\n dist = Math.abs(math.lenVec3(math.subVec3(tempVec3a, sphere, tempVec3b)));\n\n if (dist > radius) {\n radius = dist;\n }\n }\n\n sphere[3] = radius;\n\n return sphere;\n };\n }))(),\n\n /**\n * Finds the minimum boundary sphere enclosing the given 3D points.\n *\n * @private\n */\n OBB3ToSphere3: ((() => {\n\n const point = new FloatArrayType(3);\n const tempVec3 = new FloatArrayType(3);\n\n return (points, sphere) => {\n\n sphere = sphere || math.vec4();\n\n let x = 0;\n let y = 0;\n let z = 0;\n\n let i;\n const lenPoints = points.length;\n const numPoints = lenPoints / 4;\n\n for (i = 0; i < lenPoints; i += 4) {\n x += points[i + 0];\n y += points[i + 1];\n z += points[i + 2];\n }\n\n sphere[0] = x / numPoints;\n sphere[1] = y / numPoints;\n sphere[2] = z / numPoints;\n\n let radius = 0;\n let dist;\n\n for (i = 0; i < lenPoints; i += 4) {\n\n point[0] = points[i + 0];\n point[1] = points[i + 1];\n point[2] = points[i + 2];\n\n dist = Math.abs(math.lenVec3(math.subVec3(point, sphere, tempVec3)));\n\n if (dist > radius) {\n radius = dist;\n }\n }\n\n sphere[3] = radius;\n\n return sphere;\n };\n }))(),\n\n /**\n * Gets the center of a bounding sphere.\n *\n * @private\n */\n getSphere3Center(sphere, dest = math.vec3()) {\n dest[0] = sphere[0];\n dest[1] = sphere[1];\n dest[2] = sphere[2];\n\n return dest;\n },\n\n /**\n * Gets the 3D center of the given flat array of 3D positions.\n *\n * @private\n */\n getPositionsCenter(positions, center = math.vec3()) {\n let xCenter = 0;\n let yCenter = 0;\n let zCenter = 0;\n for (var i = 0, len = positions.length; i < len; i += 3) {\n xCenter += positions[i + 0];\n yCenter += positions[i + 1];\n zCenter += positions[i + 2];\n }\n const numPositions = positions.length / 3;\n center[0] = xCenter / numPositions;\n center[1] = yCenter / numPositions;\n center[2] = zCenter / numPositions;\n return center;\n },\n\n /**\n * Expands the first axis-aligned 3D boundary to enclose the second, if required.\n *\n * @private\n */\n expandAABB3(aabb1, aabb2) {\n\n if (aabb1[0] > aabb2[0]) {\n aabb1[0] = aabb2[0];\n }\n\n if (aabb1[1] > aabb2[1]) {\n aabb1[1] = aabb2[1];\n }\n\n if (aabb1[2] > aabb2[2]) {\n aabb1[2] = aabb2[2];\n }\n\n if (aabb1[3] < aabb2[3]) {\n aabb1[3] = aabb2[3];\n }\n\n if (aabb1[4] < aabb2[4]) {\n aabb1[4] = aabb2[4];\n }\n\n if (aabb1[5] < aabb2[5]) {\n aabb1[5] = aabb2[5];\n }\n\n return aabb1;\n },\n\n /**\n * Expands an axis-aligned 3D boundary to enclose the given point, if needed.\n *\n * @private\n */\n expandAABB3Point3(aabb, p) {\n\n if (aabb[0] > p[0]) {\n aabb[0] = p[0];\n }\n\n if (aabb[1] > p[1]) {\n aabb[1] = p[1];\n }\n\n if (aabb[2] > p[2]) {\n aabb[2] = p[2];\n }\n\n if (aabb[3] < p[0]) {\n aabb[3] = p[0];\n }\n\n if (aabb[4] < p[1]) {\n aabb[4] = p[1];\n }\n\n if (aabb[5] < p[2]) {\n aabb[5] = p[2];\n }\n\n return aabb;\n },\n\n /**\n * Expands an axis-aligned 3D boundary to enclose the given points, if needed.\n *\n * @private\n */\n expandAABB3Points3(aabb, positions) {\n var x;\n var y;\n var z;\n for (var i = 0, len = positions.length; i < len; i += 3) {\n x = positions[i];\n y = positions[i + 1];\n z = positions[i + 2];\n if (aabb[0] > x) {\n aabb[0] = x;\n }\n if (aabb[1] > y) {\n aabb[1] = y;\n }\n if (aabb[2] > z) {\n aabb[2] = z;\n }\n if (aabb[3] < x) {\n aabb[3] = x;\n }\n if (aabb[4] < y) {\n aabb[4] = y;\n }\n if (aabb[5] < z) {\n aabb[5] = z;\n }\n }\n return aabb;\n },\n\n /**\n * Collapses a 2D axis-aligned boundary, ready to expand to fit 2D points.\n * Creates new AABB if none supplied.\n *\n * @private\n */\n collapseAABB2(aabb = math.AABB2()) {\n aabb[0] = math.MAX_DOUBLE;\n aabb[1] = math.MAX_DOUBLE;\n aabb[2] = math.MIN_DOUBLE;\n aabb[3] = math.MIN_DOUBLE;\n\n return aabb;\n },\n\n point3AABB3Intersect(aabb, p) {\n return aabb[0] > p[0] || aabb[3] < p[0] || aabb[1] > p[1] || aabb[4] < p[1] || aabb[2] > p[2] || aabb[5] < p[2];\n },\n\n /**\n *\n * @param dir\n * @param constant\n * @param aabb\n * @returns {number}\n */\n planeAABB3Intersect(dir, constant, aabb) {\n let min, max;\n if (dir[0] > 0) {\n min = dir[0] * aabb[0];\n max = dir[0] * aabb[3];\n } else {\n min = dir[0] * aabb[3];\n max = dir[0] * aabb[0];\n }\n if (dir[1] > 0) {\n min += dir[1] * aabb[1];\n max += dir[1] * aabb[4];\n } else {\n min += dir[1] * aabb[4];\n max += dir[1] * aabb[1];\n }\n if (dir[2] > 0) {\n min += dir[2] * aabb[2];\n max += dir[2] * aabb[5];\n } else {\n min += dir[2] * aabb[5];\n max += dir[2] * aabb[2];\n }\n const outside = (min <= -constant) && (max <= -constant);\n if (outside) {\n return -1;\n }\n\n const inside = (min >= -constant) && (max >= -constant);\n if (inside) {\n return 1;\n }\n\n return 0;\n },\n\n /**\n * Finds the minimum 2D projected axis-aligned boundary enclosing the given 3D points.\n *\n * @private\n */\n OBB3ToAABB2(points, aabb = math.AABB2()) {\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n\n let x;\n let y;\n let w;\n let f;\n\n for (let i = 0, len = points.length; i < len; i += 4) {\n\n x = points[i + 0];\n y = points[i + 1];\n w = points[i + 3] || 1.0;\n\n f = 1.0 / w;\n\n x *= f;\n y *= f;\n\n if (x < xmin) {\n xmin = x;\n }\n\n if (y < ymin) {\n ymin = y;\n }\n\n if (x > xmax) {\n xmax = x;\n }\n\n if (y > ymax) {\n ymax = y;\n }\n }\n\n aabb[0] = xmin;\n aabb[1] = ymin;\n aabb[2] = xmax;\n aabb[3] = ymax;\n\n return aabb;\n },\n\n /**\n * Expands the first axis-aligned 2D boundary to enclose the second, if required.\n *\n * @private\n */\n expandAABB2(aabb1, aabb2) {\n\n if (aabb1[0] > aabb2[0]) {\n aabb1[0] = aabb2[0];\n }\n\n if (aabb1[1] > aabb2[1]) {\n aabb1[1] = aabb2[1];\n }\n\n if (aabb1[2] < aabb2[2]) {\n aabb1[2] = aabb2[2];\n }\n\n if (aabb1[3] < aabb2[3]) {\n aabb1[3] = aabb2[3];\n }\n\n return aabb1;\n },\n\n /**\n * Expands an axis-aligned 2D boundary to enclose the given point, if required.\n *\n * @private\n */\n expandAABB2Point2(aabb, p) {\n\n if (aabb[0] > p[0]) {\n aabb[0] = p[0];\n }\n\n if (aabb[1] > p[1]) {\n aabb[1] = p[1];\n }\n\n if (aabb[2] < p[0]) {\n aabb[2] = p[0];\n }\n\n if (aabb[3] < p[1]) {\n aabb[3] = p[1];\n }\n\n return aabb;\n },\n\n AABB2ToCanvas(aabb, canvasWidth, canvasHeight, aabb2 = aabb) {\n const xmin = (aabb[0] + 1.0) * 0.5;\n const ymin = (aabb[1] + 1.0) * 0.5;\n const xmax = (aabb[2] + 1.0) * 0.5;\n const ymax = (aabb[3] + 1.0) * 0.5;\n\n aabb2[0] = Math.floor(xmin * canvasWidth);\n aabb2[1] = canvasHeight - Math.floor(ymax * canvasHeight);\n aabb2[2] = Math.floor(xmax * canvasWidth);\n aabb2[3] = canvasHeight - Math.floor(ymin * canvasHeight);\n\n return aabb2;\n },\n\n //------------------------------------------------------------------------------------------------------------------\n // Curves\n //------------------------------------------------------------------------------------------------------------------\n\n tangentQuadraticBezier(t, p0, p1, p2) {\n return 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1);\n },\n\n tangentQuadraticBezier3(t, p0, p1, p2, p3) {\n return -3 * p0 * (1 - t) * (1 - t) +\n 3 * p1 * (1 - t) * (1 - t) - 6 * t * p1 * (1 - t) +\n 6 * t * p2 * (1 - t) - 3 * t * t * p2 +\n 3 * t * t * p3;\n },\n\n tangentSpline(t) {\n const h00 = 6 * t * t - 6 * t;\n const h10 = 3 * t * t - 4 * t + 1;\n const h01 = -6 * t * t + 6 * t;\n const h11 = 3 * t * t - 2 * t;\n return h00 + h10 + h01 + h11;\n },\n\n catmullRomInterpolate(p0, p1, p2, p3, t) {\n const v0 = (p2 - p0) * 0.5;\n const v1 = (p3 - p1) * 0.5;\n const t2 = t * t;\n const t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n },\n\n// Bezier Curve formulii from http://en.wikipedia.org/wiki/B%C3%A9zier_curve\n\n// Quad Bezier Functions\n\n b2p0(t, p) {\n const k = 1 - t;\n return k * k * p;\n\n },\n\n b2p1(t, p) {\n return 2 * (1 - t) * t * p;\n },\n\n b2p2(t, p) {\n return t * t * p;\n },\n\n b2(t, p0, p1, p2) {\n return this.b2p0(t, p0) + this.b2p1(t, p1) + this.b2p2(t, p2);\n },\n\n// Cubic Bezier Functions\n\n b3p0(t, p) {\n const k = 1 - t;\n return k * k * k * p;\n },\n\n b3p1(t, p) {\n const k = 1 - t;\n return 3 * k * k * t * p;\n },\n\n b3p2(t, p) {\n const k = 1 - t;\n return 3 * k * t * t * p;\n },\n\n b3p3(t, p) {\n return t * t * t * p;\n },\n\n b3(t, p0, p1, p2, p3) {\n return this.b3p0(t, p0) + this.b3p1(t, p1) + this.b3p2(t, p2) + this.b3p3(t, p3);\n },\n\n //------------------------------------------------------------------------------------------------------------------\n // Geometry\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Calculates the normal vector of a triangle.\n *\n * @private\n */\n triangleNormal(a, b, c, normal = math.vec3()) {\n const p1x = b[0] - a[0];\n const p1y = b[1] - a[1];\n const p1z = b[2] - a[2];\n\n const p2x = c[0] - a[0];\n const p2y = c[1] - a[1];\n const p2z = c[2] - a[2];\n\n const p3x = p1y * p2z - p1z * p2y;\n const p3y = p1z * p2x - p1x * p2z;\n const p3z = p1x * p2y - p1y * p2x;\n\n const mag = Math.sqrt(p3x * p3x + p3y * p3y + p3z * p3z);\n if (mag === 0) {\n normal[0] = 0;\n normal[1] = 0;\n normal[2] = 0;\n } else {\n normal[0] = p3x / mag;\n normal[1] = p3y / mag;\n normal[2] = p3z / mag;\n }\n\n return normal\n },\n\n /**\n * Finds the intersection of a 3D ray with a 3D triangle.\n *\n * @private\n */\n rayTriangleIntersect: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n const tempVec3b = new FloatArrayType(3);\n const tempVec3c = new FloatArrayType(3);\n const tempVec3d = new FloatArrayType(3);\n const tempVec3e = new FloatArrayType(3);\n\n return (origin, dir, a, b, c, isect) => {\n\n isect = isect || math.vec3();\n\n const EPSILON = 0.000001;\n\n const edge1 = math.subVec3(b, a, tempVec3);\n const edge2 = math.subVec3(c, a, tempVec3b);\n\n const pvec = math.cross3Vec3(dir, edge2, tempVec3c);\n const det = math.dotVec3(edge1, pvec);\n if (det < EPSILON) {\n return null;\n }\n\n const tvec = math.subVec3(origin, a, tempVec3d);\n const u = math.dotVec3(tvec, pvec);\n if (u < 0 || u > det) {\n return null;\n }\n\n const qvec = math.cross3Vec3(tvec, edge1, tempVec3e);\n const v = math.dotVec3(dir, qvec);\n if (v < 0 || u + v > det) {\n return null;\n }\n\n const t = math.dotVec3(edge2, qvec) / det;\n isect[0] = origin[0] + t * dir[0];\n isect[1] = origin[1] + t * dir[1];\n isect[2] = origin[2] + t * dir[2];\n\n return isect;\n };\n }))(),\n\n /**\n * Finds the intersection of a 3D ray with a plane defined by 3 points.\n *\n * @private\n */\n rayPlaneIntersect: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n const tempVec3b = new FloatArrayType(3);\n const tempVec3c = new FloatArrayType(3);\n const tempVec3d = new FloatArrayType(3);\n\n return (origin, dir, a, b, c, isect) => {\n\n isect = isect || math.vec3();\n\n dir = math.normalizeVec3(dir, tempVec3);\n\n const edge1 = math.subVec3(b, a, tempVec3b);\n const edge2 = math.subVec3(c, a, tempVec3c);\n\n const n = math.cross3Vec3(edge1, edge2, tempVec3d);\n math.normalizeVec3(n, n);\n\n const d = -math.dotVec3(a, n);\n\n const t = -(math.dotVec3(origin, n) + d) / math.dotVec3(dir, n);\n\n isect[0] = origin[0] + t * dir[0];\n isect[1] = origin[1] + t * dir[1];\n isect[2] = origin[2] + t * dir[2];\n\n return isect;\n };\n }))(),\n\n /**\n * Gets barycentric coordinates from cartesian coordinates within a triangle.\n * Gets barycentric coordinates from cartesian coordinates within a triangle.\n *\n * @private\n */\n cartesianToBarycentric: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n const tempVec3b = new FloatArrayType(3);\n const tempVec3c = new FloatArrayType(3);\n\n return (cartesian, a, b, c, dest) => {\n\n const v0 = math.subVec3(c, a, tempVec3);\n const v1 = math.subVec3(b, a, tempVec3b);\n const v2 = math.subVec3(cartesian, a, tempVec3c);\n\n const dot00 = math.dotVec3(v0, v0);\n const dot01 = math.dotVec3(v0, v1);\n const dot02 = math.dotVec3(v0, v2);\n const dot11 = math.dotVec3(v1, v1);\n const dot12 = math.dotVec3(v1, v2);\n\n const denom = (dot00 * dot11 - dot01 * dot01);\n\n // Colinear or singular triangle\n\n if (denom === 0) {\n\n // Arbitrary location outside of triangle\n\n return null;\n }\n\n const invDenom = 1 / denom;\n\n const u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n const v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n\n dest[0] = 1 - u - v;\n dest[1] = v;\n dest[2] = u;\n\n return dest;\n };\n }))(),\n\n /**\n * Returns true if the given barycentric coordinates are within their triangle.\n *\n * @private\n */\n barycentricInsideTriangle(bary) {\n\n const v = bary[1];\n const u = bary[2];\n\n return (u >= 0) && (v >= 0) && (u + v < 1);\n },\n\n /**\n * Gets cartesian coordinates from barycentric coordinates within a triangle.\n *\n * @private\n */\n barycentricToCartesian(bary, a, b, c, cartesian = math.vec3()) {\n const u = bary[0];\n const v = bary[1];\n const w = bary[2];\n\n cartesian[0] = a[0] * u + b[0] * v + c[0] * w;\n cartesian[1] = a[1] * u + b[1] * v + c[1] * w;\n cartesian[2] = a[2] * u + b[2] * v + c[2] * w;\n\n return cartesian;\n },\n\n\n /**\n * Given geometry defined as an array of positions, optional normals, option uv and an array of indices, returns\n * modified arrays that have duplicate vertices removed.\n *\n * Note: does not work well when co-incident vertices have same positions but different normals and UVs.\n *\n * @param positions\n * @param normals\n * @param uv\n * @param indices\n * @returns {{positions: Array, indices: Array}}\n * @private\n */\n mergeVertices(positions, normals, uv, indices) {\n const positionsMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n const indicesLookup = [];\n const uniquePositions = [];\n const uniqueNormals = normals ? [] : null;\n const uniqueUV = uv ? [] : null;\n const indices2 = [];\n let vx;\n let vy;\n let vz;\n let key;\n const precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\n const precision = 10 ** precisionPoints;\n let i;\n let len;\n let uvi = 0;\n for (i = 0, len = positions.length; i < len; i += 3) {\n vx = positions[i];\n vy = positions[i + 1];\n vz = positions[i + 2];\n key = `${Math.round(vx * precision)}_${Math.round(vy * precision)}_${Math.round(vz * precision)}`;\n if (positionsMap[key] === undefined) {\n positionsMap[key] = uniquePositions.length / 3;\n uniquePositions.push(vx);\n uniquePositions.push(vy);\n uniquePositions.push(vz);\n if (normals) {\n uniqueNormals.push(normals[i]);\n uniqueNormals.push(normals[i + 1]);\n uniqueNormals.push(normals[i + 2]);\n }\n if (uv) {\n uniqueUV.push(uv[uvi]);\n uniqueUV.push(uv[uvi + 1]);\n }\n }\n indicesLookup[i / 3] = positionsMap[key];\n uvi += 2;\n }\n for (i = 0, len = indices.length; i < len; i++) {\n indices2[i] = indicesLookup[indices[i]];\n }\n const result = {\n positions: uniquePositions,\n indices: indices2\n };\n if (uniqueNormals) {\n result.normals = uniqueNormals;\n }\n if (uniqueUV) {\n result.uv = uniqueUV;\n\n }\n return result;\n },\n\n /**\n * Builds normal vectors from positions and indices.\n *\n * @private\n */\n buildNormals: ((() => {\n\n const a = new FloatArrayType(3);\n const b = new FloatArrayType(3);\n const c = new FloatArrayType(3);\n const ab = new FloatArrayType(3);\n const ac = new FloatArrayType(3);\n const crossVec = new FloatArrayType(3);\n\n return (positions, indices, normals) => {\n\n let i;\n let len;\n const nvecs = new Array(positions.length / 3);\n let j0;\n let j1;\n let j2;\n\n for (i = 0, len = indices.length; i < len; i += 3) {\n\n j0 = indices[i];\n j1 = indices[i + 1];\n j2 = indices[i + 2];\n\n a[0] = positions[j0 * 3];\n a[1] = positions[j0 * 3 + 1];\n a[2] = positions[j0 * 3 + 2];\n\n b[0] = positions[j1 * 3];\n b[1] = positions[j1 * 3 + 1];\n b[2] = positions[j1 * 3 + 2];\n\n c[0] = positions[j2 * 3];\n c[1] = positions[j2 * 3 + 1];\n c[2] = positions[j2 * 3 + 2];\n\n math.subVec3(b, a, ab);\n math.subVec3(c, a, ac);\n\n const normVec = math.vec3();\n\n math.normalizeVec3(math.cross3Vec3(ab, ac, crossVec), normVec);\n\n if (!nvecs[j0]) {\n nvecs[j0] = [];\n }\n if (!nvecs[j1]) {\n nvecs[j1] = [];\n }\n if (!nvecs[j2]) {\n nvecs[j2] = [];\n }\n\n nvecs[j0].push(normVec);\n nvecs[j1].push(normVec);\n nvecs[j2].push(normVec);\n }\n\n normals = (normals && normals.length === positions.length) ? normals : new Float32Array(positions.length);\n\n let count;\n let x;\n let y;\n let z;\n\n for (i = 0, len = nvecs.length; i < len; i++) { // Now go through and average out everything\n\n count = nvecs[i].length;\n\n x = 0;\n y = 0;\n z = 0;\n\n for (let j = 0; j < count; j++) {\n x += nvecs[i][j][0];\n y += nvecs[i][j][1];\n z += nvecs[i][j][2];\n }\n\n normals[i * 3] = (x / count);\n normals[i * 3 + 1] = (y / count);\n normals[i * 3 + 2] = (z / count);\n }\n\n return normals;\n };\n }))(),\n\n /**\n * Builds vertex tangent vectors from positions, UVs and indices.\n *\n * @private\n */\n buildTangents: ((() => {\n\n const tempVec3 = new FloatArrayType(3);\n const tempVec3b = new FloatArrayType(3);\n const tempVec3c = new FloatArrayType(3);\n const tempVec3d = new FloatArrayType(3);\n const tempVec3e = new FloatArrayType(3);\n const tempVec3f = new FloatArrayType(3);\n const tempVec3g = new FloatArrayType(3);\n\n return (positions, indices, uv) => {\n\n const tangents = new Float32Array(positions.length);\n\n // The vertex arrays needs to be calculated\n // before the calculation of the tangents\n\n for (let location = 0; location < indices.length; location += 3) {\n\n // Recontructing each vertex and UV coordinate into the respective vectors\n\n let index = indices[location];\n\n const v0 = positions.subarray(index * 3, index * 3 + 3);\n const uv0 = uv.subarray(index * 2, index * 2 + 2);\n\n index = indices[location + 1];\n\n const v1 = positions.subarray(index * 3, index * 3 + 3);\n const uv1 = uv.subarray(index * 2, index * 2 + 2);\n\n index = indices[location + 2];\n\n const v2 = positions.subarray(index * 3, index * 3 + 3);\n const uv2 = uv.subarray(index * 2, index * 2 + 2);\n\n const deltaPos1 = math.subVec3(v1, v0, tempVec3);\n const deltaPos2 = math.subVec3(v2, v0, tempVec3b);\n\n const deltaUV1 = math.subVec2(uv1, uv0, tempVec3c);\n const deltaUV2 = math.subVec2(uv2, uv0, tempVec3d);\n\n const r = 1 / ((deltaUV1[0] * deltaUV2[1]) - (deltaUV1[1] * deltaUV2[0]));\n\n const tangent = math.mulVec3Scalar(\n math.subVec3(\n math.mulVec3Scalar(deltaPos1, deltaUV2[1], tempVec3e),\n math.mulVec3Scalar(deltaPos2, deltaUV1[1], tempVec3f),\n tempVec3g\n ),\n r,\n tempVec3f\n );\n\n // Average the value of the vectors\n\n let addTo;\n\n for (let v = 0; v < 3; v++) {\n addTo = indices[location + v] * 3;\n tangents[addTo] += tangent[0];\n tangents[addTo + 1] += tangent[1];\n tangents[addTo + 2] += tangent[2];\n }\n }\n\n return tangents;\n };\n }))(),\n\n /**\n * Builds vertex and index arrays needed by color-indexed triangle picking.\n *\n * @private\n */\n buildPickTriangles(positions, indices, compressGeometry) {\n\n const numIndices = indices.length;\n const pickPositions = compressGeometry ? new Uint16Array(numIndices * 9) : new Float32Array(numIndices * 9);\n const pickColors = new Uint8Array(numIndices * 12);\n let primIndex = 0;\n let vi;// Positions array index\n let pvi = 0;// Picking positions array index\n let pci = 0; // Picking color array index\n\n // Triangle indices\n let i;\n let r;\n let g;\n let b;\n let a;\n\n for (let location = 0; location < numIndices; location += 3) {\n\n // Primitive-indexed triangle pick color\n\n a = (primIndex >> 24 & 0xFF);\n b = (primIndex >> 16 & 0xFF);\n g = (primIndex >> 8 & 0xFF);\n r = (primIndex & 0xFF);\n\n // A\n\n i = indices[location];\n vi = i * 3;\n\n pickPositions[pvi++] = positions[vi];\n pickPositions[pvi++] = positions[vi + 1];\n pickPositions[pvi++] = positions[vi + 2];\n\n pickColors[pci++] = r;\n pickColors[pci++] = g;\n pickColors[pci++] = b;\n pickColors[pci++] = a;\n\n // B\n\n i = indices[location + 1];\n vi = i * 3;\n\n pickPositions[pvi++] = positions[vi];\n pickPositions[pvi++] = positions[vi + 1];\n pickPositions[pvi++] = positions[vi + 2];\n\n pickColors[pci++] = r;\n pickColors[pci++] = g;\n pickColors[pci++] = b;\n pickColors[pci++] = a;\n\n // C\n\n i = indices[location + 2];\n vi = i * 3;\n\n pickPositions[pvi++] = positions[vi];\n pickPositions[pvi++] = positions[vi + 1];\n pickPositions[pvi++] = positions[vi + 2];\n\n pickColors[pci++] = r;\n pickColors[pci++] = g;\n pickColors[pci++] = b;\n pickColors[pci++] = a;\n\n primIndex++;\n }\n\n return {\n positions: pickPositions,\n colors: pickColors\n };\n },\n\n /**\n * Converts surface-perpendicular face normals to vertex normals. Assumes that the mesh contains disjoint triangles\n * that don't share vertex array elements. Works by finding groups of vertices that have the same location and\n * averaging their normal vectors.\n *\n * @returns {{positions: Array, normals: *}}\n */\n faceToVertexNormals(positions, normals, options = {}) {\n const smoothNormalsAngleThreshold = options.smoothNormalsAngleThreshold || 20;\n const vertexMap = {};\n const vertexNormals = [];\n const vertexNormalAccum = {};\n let acc;\n let vx;\n let vy;\n let vz;\n let key;\n const precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\n const precision = 10 ** precisionPoints;\n let posi;\n let i;\n let j;\n let len;\n let a;\n let b;\n let c;\n\n for (i = 0, len = positions.length; i < len; i += 3) {\n\n posi = i / 3;\n\n vx = positions[i];\n vy = positions[i + 1];\n vz = positions[i + 2];\n\n key = `${Math.round(vx * precision)}_${Math.round(vy * precision)}_${Math.round(vz * precision)}`;\n\n if (vertexMap[key] === undefined) {\n vertexMap[key] = [posi];\n } else {\n vertexMap[key].push(posi);\n }\n\n const normal = math.normalizeVec3([normals[i], normals[i + 1], normals[i + 2]]);\n\n vertexNormals[posi] = normal;\n\n acc = math.vec4([normal[0], normal[1], normal[2], 1]);\n\n vertexNormalAccum[posi] = acc;\n }\n\n for (key in vertexMap) {\n\n if (vertexMap.hasOwnProperty(key)) {\n\n const vertices = vertexMap[key];\n const numVerts = vertices.length;\n\n for (i = 0; i < numVerts; i++) {\n\n const ii = vertices[i];\n\n acc = vertexNormalAccum[ii];\n\n for (j = 0; j < numVerts; j++) {\n\n if (i === j) {\n continue;\n }\n\n const jj = vertices[j];\n\n a = vertexNormals[ii];\n b = vertexNormals[jj];\n\n const angle = Math.abs(math.angleVec3(a, b) / math.DEGTORAD);\n\n if (angle < smoothNormalsAngleThreshold) {\n\n acc[0] += b[0];\n acc[1] += b[1];\n acc[2] += b[2];\n acc[3] += 1.0;\n }\n }\n }\n }\n }\n\n for (i = 0, len = normals.length; i < len; i += 3) {\n\n acc = vertexNormalAccum[i / 3];\n\n normals[i + 0] = acc[0] / acc[3];\n normals[i + 1] = acc[1] / acc[3];\n normals[i + 2] = acc[2] / acc[3];\n\n }\n },\n\n //------------------------------------------------------------------------------------------------------------------\n // Ray casting\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n Transforms a ray by a matrix.\n @method transformRay\n @static\n @param {Number[]} matrix 4x4 matrix\n @param {Number[]} rayOrigin The ray origin\n @param {Number[]} rayDir The ray direction\n @param {Number[]} rayOriginDest The transformed ray origin\n @param {Number[]} rayDirDest The transformed ray direction\n */\n transformRay: ((() => {\n\n const tempVec4a = new FloatArrayType(4);\n const tempVec4b = new FloatArrayType(4);\n\n return (matrix, rayOrigin, rayDir, rayOriginDest, rayDirDest) => {\n\n tempVec4a[0] = rayOrigin[0];\n tempVec4a[1] = rayOrigin[1];\n tempVec4a[2] = rayOrigin[2];\n tempVec4a[3] = 1;\n\n math.transformVec4(matrix, tempVec4a, tempVec4b);\n\n rayOriginDest[0] = tempVec4b[0];\n rayOriginDest[1] = tempVec4b[1];\n rayOriginDest[2] = tempVec4b[2];\n\n tempVec4a[0] = rayDir[0];\n tempVec4a[1] = rayDir[1];\n tempVec4a[2] = rayDir[2];\n\n math.transformVec3(matrix, tempVec4a, tempVec4b);\n\n math.normalizeVec3(tempVec4b);\n\n rayDirDest[0] = tempVec4b[0];\n rayDirDest[1] = tempVec4b[1];\n rayDirDest[2] = tempVec4b[2];\n };\n }))(),\n\n /**\n Transforms a Canvas-space position into a World-space ray, in the context of a Camera.\n @method canvasPosToWorldRay\n @static\n @param {Number[]} viewMatrix View matrix\n @param {Number[]} projMatrix Projection matrix\n @param {Number[]} canvasPos The Canvas-space position.\n @param {Number[]} worldRayOrigin The World-space ray origin.\n @param {Number[]} worldRayDir The World-space ray direction.\n */\n canvasPosToWorldRay: ((() => {\n\n const tempMat4b = new FloatArrayType(16);\n const tempMat4c = new FloatArrayType(16);\n const tempVec4a = new FloatArrayType(4);\n const tempVec4b = new FloatArrayType(4);\n const tempVec4c = new FloatArrayType(4);\n const tempVec4d = new FloatArrayType(4);\n\n return (canvas, viewMatrix, projMatrix, canvasPos, worldRayOrigin, worldRayDir) => {\n\n const pvMat = math.mulMat4(projMatrix, viewMatrix, tempMat4b);\n const pvMatInverse = math.inverseMat4(pvMat, tempMat4c);\n\n // Calculate clip space coordinates, which will be in range\n // of x=[-1..1] and y=[-1..1], with y=(+1) at top\n\n const canvasWidth = canvas.width;\n const canvasHeight = canvas.height;\n\n const clipX = (canvasPos[0] - canvasWidth / 2) / (canvasWidth / 2); // Calculate clip space coordinates\n const clipY = -(canvasPos[1] - canvasHeight / 2) / (canvasHeight / 2);\n\n tempVec4a[0] = clipX;\n tempVec4a[1] = clipY;\n tempVec4a[2] = -1;\n tempVec4a[3] = 1;\n\n math.transformVec4(pvMatInverse, tempVec4a, tempVec4b);\n math.mulVec4Scalar(tempVec4b, 1 / tempVec4b[3]);\n\n tempVec4c[0] = clipX;\n tempVec4c[1] = clipY;\n tempVec4c[2] = 1;\n tempVec4c[3] = 1;\n\n math.transformVec4(pvMatInverse, tempVec4c, tempVec4d);\n math.mulVec4Scalar(tempVec4d, 1 / tempVec4d[3]);\n\n worldRayOrigin[0] = tempVec4d[0];\n worldRayOrigin[1] = tempVec4d[1];\n worldRayOrigin[2] = tempVec4d[2];\n\n math.subVec3(tempVec4d, tempVec4b, worldRayDir);\n\n math.normalizeVec3(worldRayDir);\n };\n }))(),\n\n /**\n Transforms a Canvas-space position to a Mesh's Local-space coordinate system, in the context of a Camera.\n @method canvasPosToLocalRay\n @static\n @param {Camera} camera The Camera.\n @param {Mesh} mesh The Mesh.\n @param {Number[]} viewMatrix View matrix\n @param {Number[]} projMatrix Projection matrix\n @param {Number[]} worldMatrix Modeling matrix\n @param {Number[]} canvasPos The Canvas-space position.\n @param {Number[]} localRayOrigin The Local-space ray origin.\n @param {Number[]} localRayDir The Local-space ray direction.\n */\n canvasPosToLocalRay: ((() => {\n\n const worldRayOrigin = new FloatArrayType(3);\n const worldRayDir = new FloatArrayType(3);\n\n return (canvas, viewMatrix, projMatrix, worldMatrix, canvasPos, localRayOrigin, localRayDir) => {\n math.canvasPosToWorldRay(canvas, viewMatrix, projMatrix, canvasPos, worldRayOrigin, worldRayDir);\n math.worldRayToLocalRay(worldMatrix, worldRayOrigin, worldRayDir, localRayOrigin, localRayDir);\n };\n }))(),\n\n /**\n Transforms a ray from World-space to a Mesh's Local-space coordinate system.\n @method worldRayToLocalRay\n @static\n @param {Number[]} worldMatrix The World transform matrix\n @param {Number[]} worldRayOrigin The World-space ray origin.\n @param {Number[]} worldRayDir The World-space ray direction.\n @param {Number[]} localRayOrigin The Local-space ray origin.\n @param {Number[]} localRayDir The Local-space ray direction.\n */\n worldRayToLocalRay: ((() => {\n\n const tempMat4 = new FloatArrayType(16);\n const tempVec4a = new FloatArrayType(4);\n const tempVec4b = new FloatArrayType(4);\n\n return (worldMatrix, worldRayOrigin, worldRayDir, localRayOrigin, localRayDir) => {\n\n const modelMatInverse = math.inverseMat4(worldMatrix, tempMat4);\n\n tempVec4a[0] = worldRayOrigin[0];\n tempVec4a[1] = worldRayOrigin[1];\n tempVec4a[2] = worldRayOrigin[2];\n tempVec4a[3] = 1;\n\n math.transformVec4(modelMatInverse, tempVec4a, tempVec4b);\n\n localRayOrigin[0] = tempVec4b[0];\n localRayOrigin[1] = tempVec4b[1];\n localRayOrigin[2] = tempVec4b[2];\n\n math.transformVec3(modelMatInverse, worldRayDir, localRayDir);\n };\n }))(),\n\n buildKDTree: ((() => {\n\n const KD_TREE_MAX_DEPTH = 10;\n const KD_TREE_MIN_TRIANGLES = 20;\n\n const dimLength = new Float32Array();\n\n function buildNode(triangles, indices, positions, depth) {\n const aabb = new FloatArrayType(6);\n\n const node = {\n triangles: null,\n left: null,\n right: null,\n leaf: false,\n splitDim: 0,\n aabb\n };\n\n aabb[0] = aabb[1] = aabb[2] = Number.POSITIVE_INFINITY;\n aabb[3] = aabb[4] = aabb[5] = Number.NEGATIVE_INFINITY;\n\n let t;\n let i;\n let len;\n\n for (t = 0, len = triangles.length; t < len; ++t) {\n var ii = triangles[t] * 3;\n for (let j = 0; j < 3; ++j) {\n const pi = indices[ii + j] * 3;\n if (positions[pi] < aabb[0]) {\n aabb[0] = positions[pi]\n }\n if (positions[pi] > aabb[3]) {\n aabb[3] = positions[pi]\n }\n if (positions[pi + 1] < aabb[1]) {\n aabb[1] = positions[pi + 1]\n }\n if (positions[pi + 1] > aabb[4]) {\n aabb[4] = positions[pi + 1]\n }\n if (positions[pi + 2] < aabb[2]) {\n aabb[2] = positions[pi + 2]\n }\n if (positions[pi + 2] > aabb[5]) {\n aabb[5] = positions[pi + 2]\n }\n }\n }\n\n if (triangles.length < KD_TREE_MIN_TRIANGLES || depth > KD_TREE_MAX_DEPTH) {\n node.triangles = triangles;\n node.leaf = true;\n return node;\n }\n\n dimLength[0] = aabb[3] - aabb[0];\n dimLength[1] = aabb[4] - aabb[1];\n dimLength[2] = aabb[5] - aabb[2];\n\n let dim = 0;\n\n if (dimLength[1] > dimLength[dim]) {\n dim = 1;\n }\n\n if (dimLength[2] > dimLength[dim]) {\n dim = 2;\n }\n\n node.splitDim = dim;\n\n const mid = (aabb[dim] + aabb[dim + 3]) / 2;\n const left = new Array(triangles.length);\n let numLeft = 0;\n const right = new Array(triangles.length);\n let numRight = 0;\n\n for (t = 0, len = triangles.length; t < len; ++t) {\n\n var ii = triangles[t] * 3;\n const i0 = indices[ii];\n const i1 = indices[ii + 1];\n const i2 = indices[ii + 2];\n\n const pi0 = i0 * 3;\n const pi1 = i1 * 3;\n const pi2 = i2 * 3;\n\n if (positions[pi0 + dim] <= mid || positions[pi1 + dim] <= mid || positions[pi2 + dim] <= mid) {\n left[numLeft++] = triangles[t];\n } else {\n right[numRight++] = triangles[t];\n }\n }\n\n left.length = numLeft;\n right.length = numRight;\n\n node.left = buildNode(left, indices, positions, depth + 1);\n node.right = buildNode(right, indices, positions, depth + 1);\n\n return node;\n }\n\n return (indices, positions) => {\n const numTris = indices.length / 3;\n const triangles = new Array(numTris);\n for (let i = 0; i < numTris; ++i) {\n triangles[i] = i;\n }\n return buildNode(triangles, indices, positions, 0);\n };\n }))(),\n\n\n decompressPosition(position, decodeMatrix, dest) {\n dest = dest || position;\n dest[0] = position[0] * decodeMatrix[0] + decodeMatrix[12];\n dest[1] = position[1] * decodeMatrix[5] + decodeMatrix[13];\n dest[2] = position[2] * decodeMatrix[10] + decodeMatrix[14];\n },\n\n decompressPositions(positions, decodeMatrix, dest = new Float32Array(positions.length)) {\n for (let i = 0, len = positions.length; i < len; i += 3) {\n dest[i + 0] = positions[i + 0] * decodeMatrix[0] + decodeMatrix[12];\n dest[i + 1] = positions[i + 1] * decodeMatrix[5] + decodeMatrix[13];\n dest[i + 2] = positions[i + 2] * decodeMatrix[10] + decodeMatrix[14];\n }\n return dest;\n },\n\n decompressUV(uv, decodeMatrix, dest) {\n dest[0] = uv[0] * decodeMatrix[0] + decodeMatrix[6];\n dest[1] = uv[1] * decodeMatrix[4] + decodeMatrix[7];\n },\n\n decompressUVs(uvs, decodeMatrix, dest = new Float32Array(uvs.length)) {\n for (let i = 0, len = uvs.length; i < len; i += 3) {\n dest[i + 0] = uvs[i + 0] * decodeMatrix[0] + decodeMatrix[6];\n dest[i + 1] = uvs[i + 1] * decodeMatrix[4] + decodeMatrix[7];\n }\n return dest;\n },\n\n octDecodeVec2(oct, result) {\n let x = oct[0];\n let y = oct[1];\n x = (2 * x + 1) / 255;\n y = (2 * y + 1) / 255;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n result[0] = x / length;\n result[1] = y / length;\n result[2] = z / length;\n return result;\n },\n\n octDecodeVec2s(octs, result) {\n for (let i = 0, j = 0, len = octs.length; i < len; i += 2) {\n let x = octs[i + 0];\n let y = octs[i + 1];\n x = (2 * x + 1) / 255;\n y = (2 * y + 1) / 255;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n result[j + 0] = x / length;\n result[j + 1] = y / length;\n result[j + 2] = z / length;\n j += 3;\n }\n return result;\n }\n};\n\nmath.buildEdgeIndices = (function () {\n\n const uniquePositions = [];\n const indicesLookup = [];\n const indicesReverseLookup = [];\n const weldedIndices = [];\n\n // TODO: Optimize with caching, but need to cater to both compressed and uncompressed positions\n\n const faces = [];\n let numFaces = 0;\n const compa = new Uint16Array(3);\n const compb = new Uint16Array(3);\n const compc = new Uint16Array(3);\n const a = math.vec3();\n const b = math.vec3();\n const c = math.vec3();\n const cb = math.vec3();\n const ab = math.vec3();\n const cross = math.vec3();\n const normal = math.vec3();\n\n function weldVertices(positions, indices) {\n const positionsMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n let vx;\n let vy;\n let vz;\n let key;\n const precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\n const precision = Math.pow(10, precisionPoints);\n let i;\n let len;\n let lenUniquePositions = 0;\n for (i = 0, len = positions.length; i < len; i += 3) {\n vx = positions[i];\n vy = positions[i + 1];\n vz = positions[i + 2];\n key = Math.round(vx * precision) + '_' + Math.round(vy * precision) + '_' + Math.round(vz * precision);\n if (positionsMap[key] === undefined) {\n positionsMap[key] = lenUniquePositions / 3;\n uniquePositions[lenUniquePositions++] = vx;\n uniquePositions[lenUniquePositions++] = vy;\n uniquePositions[lenUniquePositions++] = vz;\n }\n indicesLookup[i / 3] = positionsMap[key];\n }\n for (i = 0, len = indices.length; i < len; i++) {\n weldedIndices[i] = indicesLookup[indices[i]];\n indicesReverseLookup[weldedIndices[i]] = indices[i];\n }\n }\n\n function buildFaces(numIndices, positionsDecodeMatrix) {\n numFaces = 0;\n for (let i = 0, len = numIndices; i < len; i += 3) {\n const ia = ((weldedIndices[i]) * 3);\n const ib = ((weldedIndices[i + 1]) * 3);\n const ic = ((weldedIndices[i + 2]) * 3);\n if (positionsDecodeMatrix) {\n compa[0] = uniquePositions[ia];\n compa[1] = uniquePositions[ia + 1];\n compa[2] = uniquePositions[ia + 2];\n compb[0] = uniquePositions[ib];\n compb[1] = uniquePositions[ib + 1];\n compb[2] = uniquePositions[ib + 2];\n compc[0] = uniquePositions[ic];\n compc[1] = uniquePositions[ic + 1];\n compc[2] = uniquePositions[ic + 2];\n // Decode\n math.decompressPosition(compa, positionsDecodeMatrix, a);\n math.decompressPosition(compb, positionsDecodeMatrix, b);\n math.decompressPosition(compc, positionsDecodeMatrix, c);\n } else {\n a[0] = uniquePositions[ia];\n a[1] = uniquePositions[ia + 1];\n a[2] = uniquePositions[ia + 2];\n b[0] = uniquePositions[ib];\n b[1] = uniquePositions[ib + 1];\n b[2] = uniquePositions[ib + 2];\n c[0] = uniquePositions[ic];\n c[1] = uniquePositions[ic + 1];\n c[2] = uniquePositions[ic + 2];\n }\n math.subVec3(c, b, cb);\n math.subVec3(a, b, ab);\n math.cross3Vec3(cb, ab, cross);\n math.normalizeVec3(cross, normal);\n const face = faces[numFaces] || (faces[numFaces] = {normal: math.vec3()});\n face.normal[0] = normal[0];\n face.normal[1] = normal[1];\n face.normal[2] = normal[2];\n numFaces++;\n }\n }\n\n return function (positions, indices, positionsDecodeMatrix, edgeThreshold) {\n weldVertices(positions, indices);\n buildFaces(indices.length, positionsDecodeMatrix);\n const edgeIndices = [];\n const thresholdDot = Math.cos(math.DEGTORAD * edgeThreshold);\n const edges = {};\n let edge1;\n let edge2;\n let index1;\n let index2;\n let key;\n let largeIndex = false;\n let edge;\n let normal1;\n let normal2;\n let dot;\n let ia;\n let ib;\n for (let i = 0, len = indices.length; i < len; i += 3) {\n const faceIndex = i / 3;\n for (let j = 0; j < 3; j++) {\n edge1 = weldedIndices[i + j];\n edge2 = weldedIndices[i + ((j + 1) % 3)];\n index1 = Math.min(edge1, edge2);\n index2 = Math.max(edge1, edge2);\n key = index1 + \",\" + index2;\n if (edges[key] === undefined) {\n edges[key] = {\n index1: index1,\n index2: index2,\n face1: faceIndex,\n face2: undefined\n };\n } else {\n edges[key].face2 = faceIndex;\n }\n }\n }\n for (key in edges) {\n edge = edges[key];\n // an edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.\n if (edge.face2 !== undefined) {\n normal1 = faces[edge.face1].normal;\n normal2 = faces[edge.face2].normal;\n dot = math.dotVec3(normal1, normal2);\n if (dot > thresholdDot) {\n continue;\n }\n }\n ia = indicesReverseLookup[edge.index1];\n ib = indicesReverseLookup[edge.index2];\n if (!largeIndex && ia > 65535 || ib > 65535) {\n largeIndex = true;\n }\n edgeIndices.push(ia);\n edgeIndices.push(ib);\n }\n return (largeIndex) ? new Uint32Array(edgeIndices) : new Uint16Array(edgeIndices);\n };\n})();\n\n\n/**\n * Returns `true` if a plane clips the given 3D positions.\n * @param {Number[]} pos Position in plane\n * @param {Number[]} dir Direction of plane\n * @param {number} positions Flat array of 3D positions.\n * @param {number} numElementsPerPosition Number of elements perposition - usually either 3 or 4.\n * @returns {boolean}\n */\nmath.planeClipsPositions3 = function (pos, dir, positions, numElementsPerPosition = 3) {\n for (let i = 0, len = positions.length; i < len; i += numElementsPerPosition) {\n tempVec3a[0] = positions[i + 0] - pos[0];\n tempVec3a[1] = positions[i + 1] - pos[1];\n tempVec3a[2] = positions[i + 2] - pos[2];\n let dotProduct = tempVec3a[0] * dir[0] + tempVec3a[1] * dir[1] + tempVec3a[2] * dir[2];\n if (dotProduct < 0) {\n return true;\n }\n }\n return false;\n}\n\nexport {math};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/math.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/math.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4408, + "__docId__": 4416, "kind": "variable", "name": "doublePrecision", "memberof": "src/viewer/scene/math/math.js", @@ -88179,7 +88395,7 @@ "ignore": true }, { - "__docId__": 4409, + "__docId__": 4417, "kind": "variable", "name": "FloatArrayType", "memberof": "src/viewer/scene/math/math.js", @@ -88200,7 +88416,7 @@ "ignore": true }, { - "__docId__": 4410, + "__docId__": 4418, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/math/math.js", @@ -88221,7 +88437,7 @@ "ignore": true }, { - "__docId__": 4411, + "__docId__": 4419, "kind": "variable", "name": "tempMat1", "memberof": "src/viewer/scene/math/math.js", @@ -88242,7 +88458,7 @@ "ignore": true }, { - "__docId__": 4412, + "__docId__": 4420, "kind": "variable", "name": "tempMat2", "memberof": "src/viewer/scene/math/math.js", @@ -88263,7 +88479,7 @@ "ignore": true }, { - "__docId__": 4413, + "__docId__": 4421, "kind": "variable", "name": "tempVec4", "memberof": "src/viewer/scene/math/math.js", @@ -88284,7 +88500,7 @@ "ignore": true }, { - "__docId__": 4414, + "__docId__": 4422, "kind": "function", "name": "planeClipsPositions3", "memberof": "src/viewer/scene/math/math.js", @@ -88357,7 +88573,7 @@ "ignore": true }, { - "__docId__": 4415, + "__docId__": 4423, "kind": "variable", "name": "math", "memberof": "src/viewer/scene/math/math.js", @@ -88377,18 +88593,18 @@ } }, { - "__docId__": 4416, + "__docId__": 4424, "kind": "file", "name": "src/viewer/scene/math/rtcCoords.js", "content": "import {math} from './math.js';\n\nconst tempVec3a = math.vec3();\n\n/**\n * Given a view matrix and a relative-to-center (RTC) coordinate origin, returns a view matrix\n * to transform RTC coordinates to View-space.\n *\n * The returned view matrix is\n *\n * @private\n */\nconst createRTCViewMat = (function () {\n\n const tempMat = new Float64Array(16);\n const rtcCenterWorld = new Float64Array(4);\n const rtcCenterView = new Float64Array(4);\n\n return function (viewMat, rtcCenter, rtcViewMat) {\n rtcViewMat = rtcViewMat || tempMat;\n rtcCenterWorld[0] = rtcCenter[0];\n rtcCenterWorld[1] = rtcCenter[1];\n rtcCenterWorld[2] = rtcCenter[2];\n rtcCenterWorld[3] = 1;\n math.transformVec4(viewMat, rtcCenterWorld, rtcCenterView);\n math.setMat4Translation(viewMat, rtcCenterView, rtcViewMat);\n return rtcViewMat.slice ();\n }\n}());\n\n/**\n * Converts a World-space 3D position to RTC.\n *\n * Given a double-precision World-space position, returns a double-precision relative-to-center (RTC) center pos\n * and a single-precision offset fom that center.\n * @private\n * @param {Float64Array} worldPos The World-space position.\n * @param {Float64Array} rtcCenter Double-precision relative-to-center (RTC) center pos.\n * @param {Float32Array} rtcPos Single-precision offset fom that center.\n */\nfunction worldToRTCPos(worldPos, rtcCenter, rtcPos) {\n\n const xHigh = Float32Array.from([worldPos[0]])[0];\n const xLow = worldPos[0] - xHigh;\n\n const yHigh = Float32Array.from([worldPos[1]])[0];\n const yLow = worldPos[1] - yHigh;\n\n const zHigh = Float32Array.from([worldPos[2]])[0];\n const zLow = worldPos[2] - zHigh;\n\n rtcCenter[0] = xHigh;\n rtcCenter[1] = yHigh;\n rtcCenter[2] = zHigh;\n\n rtcPos[0] = xLow;\n rtcPos[1] = yLow;\n rtcPos[2] = zLow;\n}\n\n\n/**\n * Converts a flat array of double-precision positions to RTC positions, if necessary.\n *\n * Conversion is necessary if the coordinates have values larger than can be expressed at single-precision. When\n * that's the case, then this function will compute the RTC coordinates and RTC center and return true. Otherwise\n * this function does nothing and returns false.\n *\n * When computing the RTC position, this function uses a modulus operation to ensure that, whenever possible,\n * identical RTC centers are reused for different positions arrays.\n *\n * @private\n * @param {Float64Array} worldPositions Flat array of World-space 3D positions.\n * @param {Float64Array} rtcPositions Outputs the computed flat array of 3D RTC positions.\n * @param {Float64Array} rtcCenter Outputs the computed double-precision relative-to-center (RTC) center pos.\n * @param {Number} [cellSize=10000000] The size of each coordinate cell within the RTC coordinate system.\n * @returns {Boolean} ````True```` if the positions actually needed conversion to RTC, else ````false````. When\n * ````false````, we can safely ignore the data returned in ````rtcPositions```` and ````rtcCenter````,\n * since ````rtcCenter```` will equal ````[0,0,0]````, and ````rtcPositions```` will contain identical values to ````positions````.\n */\nfunction worldToRTCPositions(worldPositions, rtcPositions, rtcCenter, cellSize = 1000) {\n\n const center = math.getPositionsCenter(worldPositions, tempVec3a);\n\n const rtcCenterX = Math.round(center[0] / cellSize) * cellSize;\n const rtcCenterY = Math.round(center[1] / cellSize) * cellSize;\n const rtcCenterZ = Math.round(center[2] / cellSize) * cellSize;\n\n rtcCenter[0] = rtcCenterX;\n rtcCenter[1] = rtcCenterY;\n rtcCenter[2] = rtcCenterZ;\n\n const rtcNeeded = (rtcCenter[0] !== 0 || rtcCenter[1] !== 0 || rtcCenter[2] !== 0);\n\n if (rtcNeeded) {\n for (let i = 0, len = worldPositions.length; i < len; i += 3) {\n rtcPositions[i + 0] = worldPositions[i + 0] - rtcCenterX;\n rtcPositions[i + 1] = worldPositions[i + 1] - rtcCenterY;\n rtcPositions[i + 2] = worldPositions[i + 2] - rtcCenterZ;\n }\n }\n\n return rtcNeeded;\n}\n\n/**\n * Converts an RTC 3D position to World-space.\n *\n * @private\n * @param {Float64Array} rtcCenter Double-precision relative-to-center (RTC) center pos.\n * @param {Float32Array} rtcPos Single-precision offset fom that center.\n * @param {Float64Array} worldPos The World-space position.\n */\nfunction rtcToWorldPos(rtcCenter, rtcPos, worldPos) {\n worldPos[0] = rtcCenter[0] + rtcPos[0];\n worldPos[1] = rtcCenter[1] + rtcPos[1];\n worldPos[2] = rtcCenter[2] + rtcPos[2];\n return worldPos;\n}\n\n/**\n * Given a 3D plane defined by distance from origin and direction, and an RTC center position,\n * return a plane position that is relative to the RTC center.\n *\n * @private\n * @param dist\n * @param dir\n * @param rtcCenter\n * @param rtcPlanePos\n * @returns {*}\n */\nfunction getPlaneRTCPos(dist, dir, rtcCenter, rtcPlanePos) {\n const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;\n const dirNormalized = math.normalizeVec3(dir, tempVec3a);\n math.mulVec3Scalar(dirNormalized, -rtcCenterToPlaneDist, rtcPlanePos);\n return rtcPlanePos;\n}\n\nexport {createRTCViewMat, worldToRTCPos, worldToRTCPositions, rtcToWorldPos, getPlaneRTCPos};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/math/rtcCoords.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/math/rtcCoords.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4417, + "__docId__": 4425, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88409,7 +88625,7 @@ "ignore": true }, { - "__docId__": 4418, + "__docId__": 4426, "kind": "variable", "name": "createRTCViewMat", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88429,7 +88645,7 @@ } }, { - "__docId__": 4419, + "__docId__": 4427, "kind": "function", "name": "worldToRTCPos", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88479,7 +88695,7 @@ "return": null }, { - "__docId__": 4420, + "__docId__": 4428, "kind": "function", "name": "worldToRTCPositions", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88554,7 +88770,7 @@ "ignore": true }, { - "__docId__": 4421, + "__docId__": 4429, "kind": "function", "name": "rtcToWorldPos", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88608,7 +88824,7 @@ } }, { - "__docId__": 4422, + "__docId__": 4430, "kind": "function", "name": "getPlaneRTCPos", "memberof": "src/viewer/scene/math/rtcCoords.js", @@ -88681,18 +88897,18 @@ "ignore": true }, { - "__docId__": 4423, + "__docId__": 4431, "kind": "file", "name": "src/viewer/scene/mementos/CameraMemento.js", "content": "import {math} from \"../math/math.js\";\n\n/**\n * @desc Saves and restores the state of a {@link Scene}'s {@link Camera}.\n *\n * ## See Also\n *\n * * {@link ModelMemento} - Saves and restores a snapshot of the visual state of the {@link Entity}'s of a model within a {@link Scene}.\n * * {@link ObjectsMemento} - Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Viewer} and use an {@link XKTLoaderPlugin} to load an ````.xkt```` model. When the model has loaded, we'll save a snapshot of the {@link Camera} state in an CameraMemento. Then we'll move the Camera, and then we'll restore its original state again from the CameraMemento.\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, CameraMemento} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Load a model\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/schependomlaan/schependomlaan.xkt\"\n * });\n *\n * // Set camera\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * model.on(\"loaded\", () => {\n *\n * // Model has loaded\n *\n * // Save memento of camera state\n * const cameraMemento = new CameraMemento();\n *\n * cameraMemento.saveCamera(viewer.scene);\n *\n * // Move the camera\n * viewer.camera.eye = [45.3, 2.00, 5.13];\n * viewer.camera.look = [0.0, 5.5, 10.0];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * // Restore the camera state again\n * objectsMemento.restoreCamera(viewer.scene);\n * });\n * ````\n */\nclass CameraMemento {\n\n /**\n * Creates a CameraState.\n *\n * @param {Scene} [scene] When given, immediately saves the state of the given {@link Scene}'s {@link Camera}.\n */\n constructor(scene) {\n\n /** @private */\n this._eye = math.vec3();\n\n /** @private */\n this._look = math.vec3();\n\n /** @private */\n this._up = math.vec3();\n\n /** @private */\n this._projection = {};\n\n if (scene) {\n this.saveCamera(scene);\n }\n }\n\n /**\n * Saves the state of the given {@link Scene}'s {@link Camera}.\n *\n * @param {Scene} scene The scene that contains the {@link Camera}.\n */\n saveCamera(scene) {\n\n const camera = scene.camera;\n const project = camera.project;\n\n this._eye.set(camera.eye);\n this._look.set(camera.look);\n this._up.set(camera.up);\n\n switch (camera.projection) {\n\n case \"perspective\":\n this._projection = {\n projection: \"perspective\",\n fov: project.fov,\n fovAxis: project.fovAxis,\n near: project.near,\n far: project.far\n };\n break;\n\n case \"ortho\":\n this._projection = {\n projection: \"ortho\",\n scale: project.scale,\n near: project.near,\n far: project.far\n };\n break;\n\n case \"frustum\":\n this._projection = {\n projection: \"frustum\",\n left: project.left,\n right: project.right,\n top: project.top,\n bottom: project.bottom,\n near: project.near,\n far: project.far\n };\n break;\n\n case \"custom\":\n this._projection = {\n projection: \"custom\",\n matrix: project.matrix.slice()\n };\n break;\n }\n }\n\n /**\n * Restores a {@link Scene}'s {@link Camera} to the state previously captured with {@link CameraMemento#saveCamera}.\n *\n * @param {Scene} scene The scene.\n * @param {Function} [done] When this callback is given, will fly the {@link Camera} to the saved state then fire the callback. Otherwise will just jump the Camera to the saved state.\n */\n restoreCamera(scene, done) {\n\n const camera = scene.camera;\n const savedProjection = this._projection;\n\n function restoreProjection() {\n\n switch (savedProjection.type) {\n\n case \"perspective\":\n camera.perspective.fov = savedProjection.fov;\n camera.perspective.fovAxis = savedProjection.fovAxis;\n camera.perspective.near = savedProjection.near;\n camera.perspective.far = savedProjection.far;\n break;\n\n case \"ortho\":\n camera.ortho.scale = savedProjection.scale;\n camera.ortho.near = savedProjection.near;\n camera.ortho.far = savedProjection.far;\n break;\n\n case \"frustum\":\n camera.frustum.left = savedProjection.left;\n camera.frustum.right = savedProjection.right;\n camera.frustum.top = savedProjection.top;\n camera.frustum.bottom = savedProjection.bottom;\n camera.frustum.near = savedProjection.near;\n camera.frustum.far = savedProjection.far;\n break;\n\n case \"custom\":\n camera.customProjection.matrix = savedProjection.matrix;\n break;\n }\n }\n\n if (done) {\n scene.viewer.cameraFlight.flyTo({\n eye: this._eye,\n look: this._look,\n up: this._up,\n orthoScale: savedProjection.scale,\n projection: savedProjection.projection\n }, () => {\n restoreProjection();\n done();\n });\n } else {\n camera.eye = this._eye;\n camera.look = this._look;\n camera.up = this._up;\n restoreProjection();\n camera.projection = savedProjection.projection;\n }\n }\n}\n\nexport {CameraMemento};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mementos/CameraMemento.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mementos/CameraMemento.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4424, + "__docId__": 4432, "kind": "class", "name": "CameraMemento", "memberof": "src/viewer/scene/mementos/CameraMemento.js", @@ -88707,7 +88923,7 @@ "interface": false }, { - "__docId__": 4425, + "__docId__": 4433, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88732,7 +88948,7 @@ ] }, { - "__docId__": 4426, + "__docId__": 4434, "kind": "member", "name": "_eye", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88749,7 +88965,7 @@ } }, { - "__docId__": 4427, + "__docId__": 4435, "kind": "member", "name": "_look", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88766,7 +88982,7 @@ } }, { - "__docId__": 4428, + "__docId__": 4436, "kind": "member", "name": "_up", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88783,7 +88999,7 @@ } }, { - "__docId__": 4429, + "__docId__": 4437, "kind": "member", "name": "_projection", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88800,7 +89016,7 @@ } }, { - "__docId__": 4430, + "__docId__": 4438, "kind": "method", "name": "saveCamera", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88826,7 +89042,7 @@ "return": null }, { - "__docId__": 4435, + "__docId__": 4443, "kind": "method", "name": "restoreCamera", "memberof": "src/viewer/scene/mementos/CameraMemento.js~CameraMemento", @@ -88862,18 +89078,18 @@ "return": null }, { - "__docId__": 4436, + "__docId__": 4444, "kind": "file", "name": "src/viewer/scene/mementos/ModelMemento.js", "content": "import {math} from \"../math/math.js\";\nimport {utils} from \"../utils.js\";\n\nconst color = math.vec3();\n\n/**\n * @desc Saves and restores a snapshot of the visual state of the {@link Entity}'s of a model within a {@link Scene}.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Viewer} and use an {@link XKTLoaderPlugin} to load an ````.xkt```` model. When the model has loaded, we'll hide a couple of {@link Entity}s and save a snapshot of the visual states of all its Entitys in an ModelMemento. Then we'll show all the Entitys\n * again, and then we'll restore the visual states of all the Entitys again from the ModelMemento, which will hide those two Entitys again.\n *\n * ## See Also\n *\n * * {@link CameraMemento} - Saves and restores the state of a {@link Scene}'s {@link Camera}.\n * * {@link ObjectsMemento} - Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, ModelMemento} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Load a model\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/schependomlaan/schependomlaan.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * // Model has loaded\n *\n * // Hide a couple of objects\n * viewer.scene.objects[\"0u4wgLe6n0ABVaiXyikbkA\"].visible = false;\n * viewer.scene.objects[\"3u4wgLe3n0AXVaiXyikbYO\"].visible = false;\n *\n * // Save memento of all object states, which includes those two hidden objects\n * const ModelMemento = new ModelMemento();\n *\n * const metaModel = viewer.metaScene.metaModels\n * ModelMemento.saveObjects(viewer.scene);\n *\n * // Show all objects\n * viewer.scene.setObjectsVisible(viewer.scene.objectIds, true);\n *\n * // Restore the objects states again, which involves hiding those two objects again\n * ModelMemento.restoreObjects(viewer.scene);\n * });\n * `````\n *\n * ## Masking Saved State\n *\n * We can optionally supply a mask to focus what state we save and restore.\n *\n * For example, to save and restore only the {@link Entity#visible} and {@link Entity#clippable} states:\n *\n * ````javascript\n * ModelMemento.saveObjects(viewer.scene, {\n * visible: true,\n * clippable: true\n * });\n *\n * //...\n *\n * // Restore the objects states again\n * ModelMemento.restoreObjects(viewer.scene);\n * ````\n */\nclass ModelMemento {\n\n /**\n * Creates a ModelMemento.\n *\n * @param {MetaModel} [metaModel] When given, immediately saves the model's {@link Entity} states to this ModelMemento.\n */\n constructor(metaModel) {\n\n /** @private */\n this.objectsVisible = [];\n\n /** @private */\n this.objectsEdges = [];\n\n /** @private */\n this.objectsXrayed = [];\n\n /** @private */\n this.objectsHighlighted = [];\n\n /** @private */\n this.objectsSelected = [];\n\n /** @private */\n this.objectsClippable = [];\n\n /** @private */\n this.objectsPickable = [];\n\n /** @private */\n this.objectsColorize = [];\n\n /** @private */\n this.objectsOpacity = [];\n\n /** @private */\n this.numObjects = 0;\n\n if (metaModel) {\n const metaScene = metaModel.metaScene;\n const scene = metaScene.scene;\n this.saveObjects(scene, metaModel);\n }\n }\n\n /**\n * Saves a snapshot of the visual state of the {@link Entity}'s that represent objects within a model.\n *\n * @param {Scene} scene The scene.\n * @param {MetaModel} metaModel Represents the model. Corresponds with an {@link Entity} that represents the model in the scene.\n * @param {Object} [mask] Masks what state gets saved. Saves all state when not supplied.\n * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````.\n * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````.\n * @param {boolean} [mask.edges] Saves {@link Entity#edges} values when ````true````.\n * @param {boolean} [mask.xrayed] Saves {@link Entity#xrayed} values when ````true````.\n * @param {boolean} [mask.highlighted] Saves {@link Entity#highlighted} values when ````true````.\n * @param {boolean} [mask.selected] Saves {@link Entity#selected} values when ````true````.\n * @param {boolean} [mask.clippable] Saves {@link Entity#clippable} values when ````true````.\n * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.\n * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.\n * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.\n */\n saveObjects(scene, metaModel, mask) {\n\n this.numObjects = 0;\n\n this._mask = mask ? utils.apply(mask, {}) : null;\n\n const visible = (!mask || mask.visible);\n const edges = (!mask || mask.edges);\n const xrayed = (!mask || mask.xrayed);\n const highlighted = (!mask || mask.highlighted);\n const selected = (!mask || mask.selected);\n const clippable = (!mask || mask.clippable);\n const pickable = (!mask || mask.pickable);\n const colorize = (!mask || mask.colorize);\n const opacity = (!mask || mask.opacity);\n\n const metaObjects = metaModel.metaObjects;\n const objects = scene.objects;\n\n for (let i = 0, len = metaObjects.length; i < len; i++) {\n const metaObject = metaObjects[i];\n const objectId = metaObject.id;\n const object = objects[objectId];\n if (!object) {\n continue;\n }\n if (visible) {\n this.objectsVisible[i] = object.visible;\n }\n if (edges) {\n this.objectsEdges[i] = object.edges;\n }\n if (xrayed) {\n this.objectsXrayed[i] = object.xrayed;\n }\n if (highlighted) {\n this.objectsHighlighted[i] = object.highlighted;\n }\n if (selected) {\n this.objectsSelected[i] = object.selected;\n }\n if (clippable) {\n this.objectsClippable[i] = object.clippable;\n }\n if (pickable) {\n this.objectsPickable[i] = object.pickable;\n }\n if (colorize) {\n const objectColor = object.colorize;\n this.objectsColorize[i * 3 + 0] = objectColor[0];\n this.objectsColorize[i * 3 + 1] = objectColor[1];\n this.objectsColorize[i * 3 + 2] = objectColor[2];\n }\n if (opacity) {\n this.objectsOpacity[i] = object.opacity;\n }\n this.numObjects++;\n }\n }\n\n /**\n * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.\n *\n * Assumes that the model has not been destroyed or modified since saving.\n *\n * @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.\n * @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.\n */\n restoreObjects(scene, metaModel) {\n\n const mask = this._mask;\n\n const visible = (!mask || mask.visible);\n const edges = (!mask || mask.edges);\n const xrayed = (!mask || mask.xrayed);\n const highlighted = (!mask || mask.highlighted);\n const selected = (!mask || mask.selected);\n const clippable = (!mask || mask.clippable);\n const pickable = (!mask || mask.pickable);\n const colorize = (!mask || mask.colorize);\n const opacity = (!mask || mask.opacity);\n\n const metaObjects = metaModel.metaObjects;\n const objects = scene.objects;\n\n for (let i = 0, len = metaObjects.length; i < len; i++) {\n const metaObject = metaObjects[i];\n const objectId = metaObject.id;\n const object = objects[objectId];\n if (!object) {\n continue;\n }\n if (visible) {\n object.visible = this.objectsVisible[i];\n }\n if (edges) {\n object.edges = this.objectsEdges[i];\n }\n if (xrayed) {\n object.xrayed = this.objectsXrayed[i];\n }\n if (highlighted) {\n object.highlighted = this.objectsHighlighted[i];\n }\n if (selected) {\n object.selected = this.objectsSelected[i];\n }\n if (clippable) {\n object.clippable = this.objectsClippable[i];\n }\n if (pickable) {\n object.pickable = this.objectsPickable[i];\n }\n if (colorize) {\n color[0] = this.objectsColorize[i * 3 + 0];\n color[1] = this.objectsColorize[i * 3 + 1];\n color[2] = this.objectsColorize[i * 3 + 2];\n object.colorize = color;\n }\n if (opacity) {\n object.opacity = this.objectsOpacity[i];\n }\n }\n }\n}\n\nexport {ModelMemento};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mementos/ModelMemento.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mementos/ModelMemento.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4437, + "__docId__": 4445, "kind": "variable", "name": "color", "memberof": "src/viewer/scene/mementos/ModelMemento.js", @@ -88894,7 +89110,7 @@ "ignore": true }, { - "__docId__": 4438, + "__docId__": 4446, "kind": "class", "name": "ModelMemento", "memberof": "src/viewer/scene/mementos/ModelMemento.js", @@ -88909,7 +89125,7 @@ "interface": false }, { - "__docId__": 4439, + "__docId__": 4447, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -88934,7 +89150,7 @@ ] }, { - "__docId__": 4440, + "__docId__": 4448, "kind": "member", "name": "objectsVisible", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -88951,7 +89167,7 @@ } }, { - "__docId__": 4441, + "__docId__": 4449, "kind": "member", "name": "objectsEdges", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -88968,7 +89184,7 @@ } }, { - "__docId__": 4442, + "__docId__": 4450, "kind": "member", "name": "objectsXrayed", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -88985,7 +89201,7 @@ } }, { - "__docId__": 4443, + "__docId__": 4451, "kind": "member", "name": "objectsHighlighted", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89002,7 +89218,7 @@ } }, { - "__docId__": 4444, + "__docId__": 4452, "kind": "member", "name": "objectsSelected", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89019,7 +89235,7 @@ } }, { - "__docId__": 4445, + "__docId__": 4453, "kind": "member", "name": "objectsClippable", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89036,7 +89252,7 @@ } }, { - "__docId__": 4446, + "__docId__": 4454, "kind": "member", "name": "objectsPickable", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89053,7 +89269,7 @@ } }, { - "__docId__": 4447, + "__docId__": 4455, "kind": "member", "name": "objectsColorize", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89070,7 +89286,7 @@ } }, { - "__docId__": 4448, + "__docId__": 4456, "kind": "member", "name": "objectsOpacity", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89087,7 +89303,7 @@ } }, { - "__docId__": 4449, + "__docId__": 4457, "kind": "member", "name": "numObjects", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89104,7 +89320,7 @@ } }, { - "__docId__": 4450, + "__docId__": 4458, "kind": "method", "name": "saveObjects", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89250,7 +89466,7 @@ "return": null }, { - "__docId__": 4452, + "__docId__": 4460, "kind": "member", "name": "_mask", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89268,7 +89484,7 @@ } }, { - "__docId__": 4453, + "__docId__": 4461, "kind": "method", "name": "restoreObjects", "memberof": "src/viewer/scene/mementos/ModelMemento.js~ModelMemento", @@ -89304,18 +89520,18 @@ "return": null }, { - "__docId__": 4454, + "__docId__": 4462, "kind": "file", "name": "src/viewer/scene/mementos/ObjectsMemento.js", "content": "import {math} from \"../math/math.js\";\nimport {utils} from \"../utils.js\";\n\nconst color = math.vec3();\n\n/**\n * @desc Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.\n *\n * * An Entity represents an object when {@link Entity#isObject} is ````true````.\n * * Each object-Entity is registered by {@link Entity#id} in {@link Scene#objects}.\n *\n * ## See Also\n *\n * * {@link CameraMemento} - Saves and restores the state of a {@link Scene}'s {@link Camera}.\n * * {@link ModelMemento} - Saves and restores a snapshot of the visual state of the {@link Entity}'s of a model within a {@link Scene}.\n *\n * ## Usage\n *\n * In the example below, we'll create a {@link Viewer} and use an {@link XKTLoaderPlugin} to load an ````.xkt```` model. When the model has loaded, we'll hide a couple of {@link Entity}s and save a snapshot of the visual states of all the Entitys in an ObjectsMemento. Then we'll show all the Entitys\n * again, and then we'll restore the visual states of all the Entitys again from the ObjectsMemento, which will hide those two Entitys again.\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin, ObjectsMemento} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * // Load a model\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/schependomlaan/schependomlaan.xkt\"\n * });\n *\n * model.on(\"loaded\", () => {\n *\n * // Model has loaded\n *\n * // Hide a couple of objects\n * viewer.scene.objects[\"0u4wgLe6n0ABVaiXyikbkA\"].visible = false;\n * viewer.scene.objects[\"3u4wgLe3n0AXVaiXyikbYO\"].visible = false;\n *\n * // Save memento of all object states, which includes those two hidden objects\n * const objectsMemento = new ObjectsMemento();\n *\n * objectsMemento.saveObjects(viewer.scene);\n *\n * // Show all objects\n * viewer.scene.setObjectsVisible(viewer.scene.objectIds, true);\n *\n * // Restore the objects states again, which involves hiding those two objects again\n * objectsMemento.restoreObjects(viewer.scene);\n * });\n * `````\n *\n * ## Masking Saved State\n *\n * We can optionally supply a mask to focus what state we save and restore.\n *\n * For example, to save and restore only the {@link Entity#visible} and {@link Entity#clippable} states:\n *\n * ````javascript\n * objectsMemento.saveObjects(viewer.scene, {\n * visible: true,\n * clippable: true\n * });\n *\n * //...\n *\n * // Restore the objects states again\n * objectsMemento.restoreObjects(viewer.scene);\n * ````\n */\nclass ObjectsMemento {\n\n /**\n * Creates an ObjectsMemento.\n */\n constructor() {\n\n /** @private */\n this.objectsVisible = [];\n\n /** @private */\n this.objectsEdges = [];\n\n /** @private */\n this.objectsXrayed = [];\n\n /** @private */\n this.objectsHighlighted = [];\n\n /** @private */\n this.objectsSelected = [];\n\n /** @private */\n this.objectsClippable = [];\n\n /** @private */\n this.objectsPickable = [];\n\n /** @private */\n this.objectsColorize = [];\n\n /** @private */\n this.objectsHasColorize = [];\n\n /** @private */\n this.objectsOpacity = [];\n\n /** @private */\n this.numObjects = 0;\n }\n\n /**\n * Saves a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.\n *\n * @param {Scene} scene The scene.\n * @param {Object} [mask] Masks what state gets saved. Saves all state when not supplied.\n * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````.\n * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````.\n * @param {boolean} [mask.edges] Saves {@link Entity#edges} values when ````true````.\n * @param {boolean} [mask.xrayed] Saves {@link Entity#xrayed} values when ````true````.\n * @param {boolean} [mask.highlighted] Saves {@link Entity#highlighted} values when ````true````.\n * @param {boolean} [mask.selected] Saves {@link Entity#selected} values when ````true````.\n * @param {boolean} [mask.clippable] Saves {@link Entity#clippable} values when ````true````.\n * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.\n * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.\n * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.\n */\n saveObjects(scene, mask) {\n\n this.numObjects = 0;\n\n this._mask = mask ? utils.apply(mask, {}) : null;\n\n const objects = scene.objects;\n const visible = (!mask || mask.visible);\n const edges = (!mask || mask.edges);\n const xrayed = (!mask || mask.xrayed);\n const highlighted = (!mask || mask.highlighted);\n const selected = (!mask || mask.selected);\n const clippable = (!mask || mask.clippable);\n const pickable = (!mask || mask.pickable);\n const colorize = (!mask || mask.colorize);\n const opacity = (!mask || mask.opacity);\n\n for (let objectId in objects) {\n if (objects.hasOwnProperty(objectId)) {\n const object = objects[objectId];\n const i = this.numObjects;\n if (visible) {\n this.objectsVisible[i] = object.visible;\n }\n if (edges) {\n this.objectsEdges[i] = object.edges;\n }\n if (xrayed) {\n this.objectsXrayed[i] = object.xrayed;\n }\n if (highlighted) {\n this.objectsHighlighted[i] = object.highlighted;\n }\n if (selected) {\n this.objectsSelected[i] = object.selected;\n }\n if (clippable) {\n this.objectsClippable[i] = object.clippable;\n }\n if (pickable) {\n this.objectsPickable[i] = object.pickable;\n }\n if (colorize) {\n const objectColor = object.colorize;\n if (objectColor) {\n this.objectsColorize[i * 3 + 0] = objectColor[0];\n this.objectsColorize[i * 3 + 1] = objectColor[1];\n this.objectsColorize[i * 3 + 2] = objectColor[2];\n this.objectsHasColorize[i] = true;\n } else {\n this.objectsHasColorize[i] = false;\n }\n }\n if (opacity) {\n this.objectsOpacity[i] = object.opacity;\n }\n this.numObjects++;\n }\n }\n }\n\n /**\n * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ObjectsMemento#saveObjects}.\n * @param {Scene} scene The scene.\n */\n restoreObjects(scene) {\n\n const mask = this._mask;\n\n const visible = (!mask || mask.visible);\n const edges = (!mask || mask.edges);\n const xrayed = (!mask || mask.xrayed);\n const highlighted = (!mask || mask.highlighted);\n const selected = (!mask || mask.selected);\n const clippable = (!mask || mask.clippable);\n const pickable = (!mask || mask.pickable);\n const colorize = (!mask || mask.colorize);\n const opacity = (!mask || mask.opacity);\n\n var i = 0;\n\n const objects = scene.objects;\n\n for (let objectId in objects) {\n if (objects.hasOwnProperty(objectId)) {\n const object = objects[objectId];\n if (visible) {\n object.visible = this.objectsVisible[i];\n }\n if (edges) {\n object.edges = this.objectsEdges[i];\n }\n if (xrayed) {\n object.xrayed = this.objectsXrayed[i];\n }\n if (highlighted) {\n object.highlighted = this.objectsHighlighted[i];\n }\n if (selected) {\n object.selected = this.objectsSelected[i];\n }\n if (clippable) {\n object.clippable = this.objectsClippable[i];\n }\n if (pickable) {\n object.pickable = this.objectsPickable[i];\n }\n if (colorize ) {\n if (this.objectsHasColorize[i]) {\n color[0] = this.objectsColorize[i * 3 + 0];\n color[1] = this.objectsColorize[i * 3 + 1];\n color[2] = this.objectsColorize[i * 3 + 2];\n object.colorize = color;\n } else {\n object.colorize = null;\n }\n }\n if (opacity) {\n object.opacity = this.objectsOpacity[i];\n }\n i++;\n }\n }\n }\n}\n\nexport {ObjectsMemento};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mementos/ObjectsMemento.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mementos/ObjectsMemento.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4455, + "__docId__": 4463, "kind": "variable", "name": "color", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js", @@ -89336,7 +89552,7 @@ "ignore": true }, { - "__docId__": 4456, + "__docId__": 4464, "kind": "class", "name": "ObjectsMemento", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js", @@ -89351,7 +89567,7 @@ "interface": false }, { - "__docId__": 4457, + "__docId__": 4465, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89364,7 +89580,7 @@ "lineNumber": 81 }, { - "__docId__": 4458, + "__docId__": 4466, "kind": "member", "name": "objectsVisible", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89381,7 +89597,7 @@ } }, { - "__docId__": 4459, + "__docId__": 4467, "kind": "member", "name": "objectsEdges", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89398,7 +89614,7 @@ } }, { - "__docId__": 4460, + "__docId__": 4468, "kind": "member", "name": "objectsXrayed", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89415,7 +89631,7 @@ } }, { - "__docId__": 4461, + "__docId__": 4469, "kind": "member", "name": "objectsHighlighted", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89432,7 +89648,7 @@ } }, { - "__docId__": 4462, + "__docId__": 4470, "kind": "member", "name": "objectsSelected", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89449,7 +89665,7 @@ } }, { - "__docId__": 4463, + "__docId__": 4471, "kind": "member", "name": "objectsClippable", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89466,7 +89682,7 @@ } }, { - "__docId__": 4464, + "__docId__": 4472, "kind": "member", "name": "objectsPickable", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89483,7 +89699,7 @@ } }, { - "__docId__": 4465, + "__docId__": 4473, "kind": "member", "name": "objectsColorize", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89500,7 +89716,7 @@ } }, { - "__docId__": 4466, + "__docId__": 4474, "kind": "member", "name": "objectsHasColorize", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89517,7 +89733,7 @@ } }, { - "__docId__": 4467, + "__docId__": 4475, "kind": "member", "name": "objectsOpacity", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89534,7 +89750,7 @@ } }, { - "__docId__": 4468, + "__docId__": 4476, "kind": "member", "name": "numObjects", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89551,7 +89767,7 @@ } }, { - "__docId__": 4469, + "__docId__": 4477, "kind": "method", "name": "saveObjects", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89687,7 +89903,7 @@ "return": null }, { - "__docId__": 4471, + "__docId__": 4479, "kind": "member", "name": "_mask", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89705,7 +89921,7 @@ } }, { - "__docId__": 4472, + "__docId__": 4480, "kind": "method", "name": "restoreObjects", "memberof": "src/viewer/scene/mementos/ObjectsMemento.js~ObjectsMemento", @@ -89731,29 +89947,29 @@ "return": null }, { - "__docId__": 4473, + "__docId__": 4481, "kind": "file", "name": "src/viewer/scene/mementos/index.js", "content": "export * from \"./CameraMemento.js\";\nexport * from \"./ModelMemento.js\";\nexport * from \"./ObjectsMemento.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mementos/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mementos/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4474, + "__docId__": 4482, "kind": "file", "name": "src/viewer/scene/mesh/Mesh.js", "content": "/**\n Fired when this Mesh is picked via a call to {@link Scene/pick:method\"}}Scene#pick(){{/crossLink}}.\n\n The event parameters will be the hit result returned by the {@link Scene/pick:method\"}}Scene#pick(){{/crossLink}} method.\n @event picked\n */\nimport {math} from '../math/math.js';\nimport {createRTCViewMat} from '../math/rtcCoords.js';\nimport {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {DrawRenderer} from \"./draw/DrawRenderer.js\";\nimport {EmphasisFillRenderer} from \"./emphasis/EmphasisFillRenderer.js\";\nimport {EmphasisEdgesRenderer} from \"./emphasis/EmphasisEdgesRenderer.js\";\nimport {PickMeshRenderer} from \"./pick/PickMeshRenderer.js\";\nimport {PickTriangleRenderer} from \"./pick/PickTriangleRenderer.js\";\nimport {OcclusionRenderer} from \"./occlusion/OcclusionRenderer.js\";\nimport {ShadowRenderer} from \"./shadow/ShadowRenderer.js\";\n\nimport {geometryCompressionUtils} from '../math/geometryCompressionUtils.js';\nimport {RenderFlags} from \"../webgl/RenderFlags.js\";\n\nconst obb = math.OBB3();\nconst angleAxis = math.vec4();\nconst q1 = math.vec4();\nconst q2 = math.vec4();\nconst xAxis = math.vec3([1, 0, 0]);\nconst yAxis = math.vec3([0, 1, 0]);\nconst zAxis = math.vec3([0, 0, 1]);\n\nconst veca = math.vec3(3);\nconst vecb = math.vec3(3);\n\nconst identityMat = math.identityMat4();\n\n/**\n * @desc An {@link Entity} that is a drawable element, with a {@link Geometry} and a {@link Material}, that can be\n * connected into a scene graph using {@link Node}s.\n *\n * ## Usage\n *\n * The example below is the same as the one given for {@link Node}, since the two classes work together. In this example,\n * we'll create a scene graph in which a root {@link Node} represents a group and the Meshes are leaves.\n *\n * Since {@link Node} implements {@link Entity}, we can designate the root {@link Node} as a model, causing it to be registered by its\n * ID in {@link Scene#models}.\n *\n * Since Mesh also implements {@link Entity}, we can designate the leaf Meshes as objects, causing them to\n * be registered by their IDs in {@link Scene#objects}.\n *\n * We can then find those {@link Entity} types in {@link Scene#models} and {@link Scene#objects}.\n *\n * We can also update properties of our object-Meshes via calls to {@link Scene#setObjectsHighlighted} etc.\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#sceneGraph)]\n *\n * ````javascript\n * import {Viewer, Mesh, Node, PhongMaterial, buildBoxGeometry, ReadableGeometry} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({\n * xSize: 1,\n * ySize: 1,\n * zSize: 1\n * }));\n *\n * new Node(viewer.scene, {\n * id: \"table\",\n * isModel: true, // <---------- Node represents a model, so is registered by ID in viewer.scene.models\n * rotation: [0, 50, 0],\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n *\n * children: [\n *\n * new Mesh(viewer.scene, { // Red table leg\n * id: \"redLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1, 0.3, 0.3]\n * }),\n * geometry: boxGeometry\n * }),\n *\n * new Mesh(viewer.scene, { // Green table leg\n * id: \"greenLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 1.0, 0.3]\n * }),\n * geometry: boxGeometry\n * }),\n *\n * new Mesh(viewer.scene, {// Blue table leg\n * id: \"blueLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 0.3, 1.0]\n * }),\n * geometry: boxGeometry\n * }),\n *\n * new Mesh(viewer.scene, { // Yellow table leg\n * id: \"yellowLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 1.0, 0.0]\n * }),\n * geometry: boxGeometry\n * }),\n *\n * new Mesh(viewer.scene, { // Purple table top\n * id: \"tableTop\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 0.3, 1.0]\n * }),\n * geometry: boxGeometry\n * })\n * ]\n * });\n *\n * // Find Nodes and Meshes by their IDs\n *\n * var table = viewer.scene.models[\"table\"]; // Since table Node has isModel == true\n *\n * var redLeg = viewer.scene.objects[\"redLeg\"]; // Since the Meshes have isObject == true\n * var greenLeg = viewer.scene.objects[\"greenLeg\"];\n * var blueLeg = viewer.scene.objects[\"blueLeg\"];\n *\n * // Highlight one of the table leg Meshes\n *\n * viewer.scene.setObjectsHighlighted([\"redLeg\"], true); // Since the Meshes have isObject == true\n *\n * // Periodically update transforms on our Nodes and Meshes\n *\n * viewer.scene.on(\"tick\", function () {\n *\n * // Rotate legs\n * redLeg.rotateY(0.5);\n * greenLeg.rotateY(0.5);\n * blueLeg.rotateY(0.5);\n *\n * // Rotate table\n * table.rotateY(0.5);\n * table.rotateX(0.3);\n * });\n * ````\n *\n * ## Metadata\n *\n * As mentioned, we can also associate {@link MetaModel}s and {@link MetaObject}s with our {@link Node}s and Meshes,\n * within a {@link MetaScene}. See {@link MetaScene} for an example.\n *\n * @implements {Entity}\n * @implements {Drawable}\n */\nclass Mesh extends Component {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.\n * @param {String} [cfg.originalSystemId] ID of the corresponding object within the originating system, if any.\n * @param {Boolean} [cfg.isModel] Specify ````true```` if this Mesh represents a model, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and may also have a corresponding {@link MetaModel} with matching {@link MetaModel#id}, registered by that ID in {@link MetaScene#metaModels}.\n * @param {Boolean} [cfg.isObject] Specify ````true```` if this Mesh represents an object, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and may also have a corresponding {@link MetaObject} with matching {@link MetaObject#id}, registered by that ID in {@link MetaScene#metaObjects}.\n * @param {Node} [cfg.parent] The parent Node.\n * @param {Number[]} [cfg.origin] World-space origin for this Mesh. When this is given, then ````matrix````, ````position```` and ````geometry```` are all assumed to be relative to this center.\n * @param {Number[]} [cfg.rtcCenter] Deprecated - renamed to ````origin````.\n * @param {Number[]} [cfg.position=[0,0,0]] 3D position of this Mesh, relative to ````origin````.\n * @param {Number[]} [cfg.scale=[1,1,1]] Local scale.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Local modelling transform matrix. Overrides the position, scale and rotation parameters.\n * @param {Number[]} [cfg.offset=[0,0,0]] World-space 3D translation offset. Translates the Mesh in World space, after modelling transforms.\n * @param {Boolean} [cfg.occluder=true] Indicates if the Mesh is able to occlude {@link Marker}s.\n * @param {Boolean} [cfg.visible=true] Indicates if the Mesh is initially visible.\n * @param {Boolean} [cfg.culled=false] Indicates if the Mesh is initially culled from view.\n * @param {Boolean} [cfg.pickable=true] Indicates if the Mesh is initially pickable.\n * @param {Boolean} [cfg.clippable=true] Indicates if the Mesh is initially clippable.\n * @param {Boolean} [cfg.collidable=true] Indicates if the Mesh is initially included in boundary calculations.\n * @param {Boolean} [cfg.castsShadow=true] Indicates if the Mesh initially casts shadows.\n * @param {Boolean} [cfg.receivesShadow=true] Indicates if the Mesh initially receives shadows.\n * @param {Boolean} [cfg.xrayed=false] Indicates if the Mesh is initially xrayed.\n * @param {Boolean} [cfg.highlighted=false] Indicates if the Mesh is initially highlighted.\n * @param {Boolean} [cfg.selected=false] Indicates if the Mesh is initially selected.\n * @param {Boolean} [cfg.edges=false] Indicates if the Mesh's edges are initially emphasized.\n * @param {Boolean} [cfg.background=false] Indicates if the Mesh should act as background, e.g., it can be used for a skybox.\n * @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] Mesh's initial RGB colorize color, multiplies by the rendered fragment colors.\n * @param {Number} [cfg.opacity=1.0] Mesh's initial opacity factor, multiplies by the rendered fragment alpha.\n * @param {String} [cfg.billboard=\"none\"] Mesh's billboarding behaviour. Options are \"none\" for no billboarding, \"spherical\" to always directly face {@link Camera.eye}, rotating both vertically and horizontally, or \"cylindrical\" to face the {@link Camera#eye} while rotating only about its vertically axis (use that mode for things like trees on a landscape).\n * @param {Geometry} [cfg.geometry] {@link Geometry} to define the shape of this Mesh. Inherits {@link Scene#geometry} by default.\n * @param {Material} [cfg.material] {@link Material} to define the normal rendered appearance for this Mesh. Inherits {@link Scene#material} by default.\n * @param {EmphasisMaterial} [cfg.xrayMaterial] {@link EmphasisMaterial} to define the xrayed appearance for this Mesh. Inherits {@link Scene#xrayMaterial} by default.\n * @param {EmphasisMaterial} [cfg.highlightMaterial] {@link EmphasisMaterial} to define the xrayed appearance for this Mesh. Inherits {@link Scene#highlightMaterial} by default.\n * @param {EmphasisMaterial} [cfg.selectedMaterial] {@link EmphasisMaterial} to define the selected appearance for this Mesh. Inherits {@link Scene#selectedMaterial} by default.\n * @param {EmphasisMaterial} [cfg.edgeMaterial] {@link EdgeMaterial} to define the appearance of enhanced edges for this Mesh. Inherits {@link Scene#edgeMaterial} by default.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n /**\n * ID of the corresponding object within the originating system, if any.\n *\n * @type {String}\n * @abstract\n */\n this.originalSystemId = (cfg.originalSystemId || this.id);\n\n /** @private **/\n this.renderFlags = new RenderFlags();\n\n this._state = new RenderState({ // NOTE: Renderer gets modeling and normal matrices from Mesh#matrix and Mesh.#normalWorldMatrix\n visible: true,\n culled: false,\n pickable: null,\n clippable: null,\n collidable: null,\n occluder: (cfg.occluder !== false),\n castsShadow: null,\n receivesShadow: null,\n xrayed: false,\n highlighted: false,\n selected: false,\n edges: false,\n stationary: !!cfg.stationary,\n background: !!cfg.background,\n billboard: this._checkBillboard(cfg.billboard),\n layer: null,\n colorize: null,\n pickID: this.scene._renderer.getPickID(this),\n drawHash: \"\",\n pickHash: \"\",\n offset: math.vec3(),\n origin: null,\n originHash: null\n });\n\n this._drawRenderer = null;\n this._shadowRenderer = null;\n this._emphasisFillRenderer = null;\n this._emphasisEdgesRenderer = null;\n this._pickMeshRenderer = null;\n this._pickTriangleRenderer = null;\n this._occlusionRenderer = null;\n\n this._geometry = cfg.geometry ? this._checkComponent2([\"ReadableGeometry\", \"VBOGeometry\"], cfg.geometry) : this.scene.geometry;\n this._material = cfg.material ? this._checkComponent2([\"PhongMaterial\", \"MetallicMaterial\", \"SpecularMaterial\", \"LambertMaterial\"], cfg.material) : this.scene.material;\n this._xrayMaterial = cfg.xrayMaterial ? this._checkComponent(\"EmphasisMaterial\", cfg.xrayMaterial) : this.scene.xrayMaterial;\n this._highlightMaterial = cfg.highlightMaterial ? this._checkComponent(\"EmphasisMaterial\", cfg.highlightMaterial) : this.scene.highlightMaterial;\n this._selectedMaterial = cfg.selectedMaterial ? this._checkComponent(\"EmphasisMaterial\", cfg.selectedMaterial) : this.scene.selectedMaterial;\n this._edgeMaterial = cfg.edgeMaterial ? this._checkComponent(\"EdgeMaterial\", cfg.edgeMaterial) : this.scene.edgeMaterial;\n\n this._parentNode = null;\n\n this._aabb = null;\n this._aabbDirty = true;\n\n this._numTriangles = (this._geometry ? this._geometry.numTriangles : 0);\n\n this.scene._aabbDirty = true;\n\n this._scale = math.vec3();\n this._quaternion = math.identityQuaternion();\n this._rotation = math.vec3();\n this._position = math.vec3();\n\n this._worldMatrix = math.identityMat4();\n this._worldNormalMatrix = math.identityMat4();\n\n this._localMatrixDirty = true;\n this._worldMatrixDirty = true;\n this._worldNormalMatrixDirty = true;\n\n const origin = cfg.origin || cfg.rtcCenter;\n if (origin) {\n this._state.origin = math.vec3(origin);\n this._state.originHash = origin.join();\n }\n\n if (cfg.matrix) {\n this.matrix = cfg.matrix;\n } else {\n this.scale = cfg.scale;\n this.position = cfg.position;\n if (cfg.quaternion) {\n } else {\n this.rotation = cfg.rotation;\n }\n }\n\n this._isObject = cfg.isObject;\n if (this._isObject) {\n this.scene._registerObject(this);\n }\n\n this._isModel = cfg.isModel;\n if (this._isModel) {\n this.scene._registerModel(this);\n }\n\n this.visible = cfg.visible;\n this.culled = cfg.culled;\n this.pickable = cfg.pickable;\n this.clippable = cfg.clippable;\n this.collidable = cfg.collidable;\n this.castsShadow = cfg.castsShadow;\n this.receivesShadow = cfg.receivesShadow;\n this.xrayed = cfg.xrayed;\n this.highlighted = cfg.highlighted;\n this.selected = cfg.selected;\n this.edges = cfg.edges;\n this.layer = cfg.layer;\n this.colorize = cfg.colorize;\n this.opacity = cfg.opacity;\n this.offset = cfg.offset;\n\n if (cfg.parentId) {\n const parentNode = this.scene.components[cfg.parentId];\n if (!parentNode) {\n this.error(\"Parent not found: '\" + cfg.parentId + \"'\");\n } else if (!parentNode.isNode) {\n this.error(\"Parent is not a Node: '\" + cfg.parentId + \"'\");\n } else {\n parentNode.addChild(this);\n }\n this._parentNode = parentNode;\n } else if (cfg.parent) {\n if (!cfg.parent.isNode) {\n this.error(\"Parent is not a Node\");\n }\n cfg.parent.addChild(this);\n this._parentNode = cfg.parent;\n }\n\n this.compile();\n }\n\n /**\n @private\n */\n get type() {\n return \"Mesh\";\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Mesh members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns true to indicate that this Component is a Mesh.\n * @final\n * @type {Boolean}\n */\n get isMesh() {\n return true;\n }\n\n /**\n * The parent Node.\n *\n * The parent Node may also be set by passing the Mesh to the parent's {@link Node#addChild} method.\n *\n * @type {Node}\n */\n get parent() {\n return this._parentNode;\n }\n\n /**\n * Defines the shape of this Mesh.\n *\n * Set to {@link Scene#geometry} by default.\n *\n * @type {Geometry}\n */\n get geometry() {\n return this._geometry;\n }\n\n /**\n * Defines the appearance of this Mesh when rendering normally, ie. when not xrayed, highlighted or selected.\n *\n * Set to {@link Scene#material} by default.\n *\n * @type {Material}\n */\n get material() {\n return this._material;\n }\n\n /**\n * Gets the Mesh's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get position() {\n return this._position;\n }\n\n /**\n * Sets the Mesh's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set position(value) {\n this._position.set(value || [0, 0, 0]);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get rotation() {\n return this._rotation;\n }\n\n /**\n * Sets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set rotation(value) {\n this._rotation.set(value || [0, 0, 0]);\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Mesh's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n get quaternion() {\n return this._quaternion;\n }\n\n /**\n * Sets the Mesh's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n set quaternion(value) {\n this._quaternion.set(value || [0, 0, 0, 1]);\n math.quaternionToEuler(this._quaternion, \"XYZ\", this._rotation);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Mesh's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the Mesh's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n set scale(value) {\n this._scale.set(value || [1, 1, 1]);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Mesh's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n get matrix() {\n if (this._localMatrixDirty) {\n if (!this.__localMatrix) {\n this.__localMatrix = math.identityMat4();\n }\n math.composeMat4(this._position, this._quaternion, this._scale, this.__localMatrix);\n this._localMatrixDirty = false;\n }\n return this.__localMatrix;\n }\n\n /**\n * Sets the Mesh's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n set matrix(value) {\n if (!this.__localMatrix) {\n this.__localMatrix = math.identityMat4();\n }\n this.__localMatrix.set(value || identityMat);\n math.decomposeMat4(this.__localMatrix, this._position, this._quaternion, this._scale);\n this._localMatrixDirty = false;\n this._setWorldMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Mesh's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n */\n get worldMatrix() {\n if (this._worldMatrixDirty) {\n this._buildWorldMatrix();\n }\n return this._worldMatrix;\n }\n\n /**\n * Gets the Mesh's World normal matrix.\n *\n * @type {Number[]}\n */\n get worldNormalMatrix() {\n if (this._worldNormalMatrixDirty) {\n this._buildWorldNormalMatrix();\n }\n return this._worldNormalMatrix;\n }\n\n /**\n * Returns true to indicate that Mesh implements {@link Entity}.\n *\n * @returns {Boolean}\n */\n get isEntity() {\n return true;\n }\n\n /**\n * Returns ````true```` if this Mesh represents a model.\n *\n * When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and\n * may also have a corresponding {@link MetaModel}.\n *\n * @type {Boolean}\n */\n get isModel() {\n return this._isModel;\n }\n\n /**\n * Returns ````true```` if this Mesh represents an object.\n *\n * When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and\n * may also have a corresponding {@link MetaObject}.\n *\n * @type {Boolean}\n */\n get isObject() {\n return this._isObject;\n }\n\n /**\n * Gets the Mesh's World-space 3D axis-aligned bounding box.\n *\n * Represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @type {Number[]}\n */\n get aabb() {\n if (this._aabbDirty) {\n this._updateAABB();\n }\n return this._aabb;\n }\n\n /**\n * Gets the 3D origin of the Mesh's {@link Geometry}'s vertex positions.\n *\n * When this is given, then {@link Mesh#matrix}, {@link Mesh#position} and {@link Mesh#geometry} are all assumed to be relative to this center position.\n *\n * @type {Float64Array}\n */\n get origin() {\n return this._state.origin;\n }\n\n /**\n * Sets the 3D origin of the Mesh's {@link Geometry}'s vertex positions.\n *\n * When this is given, then {@link Mesh#matrix}, {@link Mesh#position} and {@link Mesh#geometry} are all assumed to be relative to this center position.\n *\n * @type {Float64Array}\n */\n set origin(origin) {\n if (origin) {\n if (!this._state.origin) {\n this._state.origin = math.vec3();\n }\n this._state.origin.set(origin);\n this._state.originHash = origin.join();\n this._setAABBDirty();\n this.scene._aabbDirty = true;\n } else {\n if (this._state.origin) {\n this._state.origin = null;\n this._state.originHash = null;\n this._setAABBDirty();\n this.scene._aabbDirty = true;\n }\n }\n }\n\n /**\n * Gets the World-space origin for this Mesh.\n *\n * Deprecated and replaced by {@link Mesh#origin}.\n *\n * @deprecated\n * @type {Float64Array}\n */\n get rtcCenter() {\n return this.origin;\n }\n\n /**\n * Sets the World-space origin for this Mesh.\n *\n * Deprecated and replaced by {@link Mesh#origin}.\n *\n * @deprecated\n * @type {Float64Array}\n */\n set rtcCenter(rtcCenter) {\n this.origin = rtcCenter;\n }\n\n /**\n * The approximate number of triangles in this Mesh.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numTriangles;\n }\n\n /**\n * Gets if this Mesh is visible.\n *\n * Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.\n *\n * When {@link Mesh#isObject} and {@link Mesh#visible} are both ````true```` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n get visible() {\n return this._state.visible;\n }\n\n /**\n * Sets if this Mesh is visible.\n *\n * Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.\n *\n * When {@link Mesh#isObject} and {@link Mesh#visible} are both ````true```` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n set visible(visible) {\n visible = visible !== false;\n this._state.visible = visible;\n if (this._isObject) {\n this.scene._objectVisibilityUpdated(this, visible);\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is xrayed.\n *\n * XRayed appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#xrayMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#xrayed} are both ````true``` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n */\n get xrayed() {\n return this._state.xrayed;\n }\n\n /**\n * Sets if this Mesh is xrayed.\n *\n * XRayed appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#xrayMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#xrayed} are both ````true``` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n */\n set xrayed(xrayed) {\n xrayed = !!xrayed;\n if (this._state.xrayed === xrayed) {\n return;\n }\n this._state.xrayed = xrayed;\n if (this._isObject) {\n this.scene._objectXRayedUpdated(this, xrayed);\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is highlighted.\n *\n * Highlighted appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#highlightMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#highlighted} are both ````true```` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n */\n get highlighted() {\n return this._state.highlighted;\n }\n\n /**\n * Sets if this Mesh is highlighted.\n *\n * Highlighted appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#highlightMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#highlighted} are both ````true```` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n */\n set highlighted(highlighted) {\n highlighted = !!highlighted;\n if (highlighted === this._state.highlighted) {\n return;\n }\n this._state.highlighted = highlighted;\n if (this._isObject) {\n this.scene._objectHighlightedUpdated(this, highlighted);\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is selected.\n *\n * Selected appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#selectedMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#selected} are both ````true``` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n */\n get selected() {\n return this._state.selected;\n }\n\n /**\n * Sets if this Mesh is selected.\n *\n * Selected appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#selectedMaterial}.\n *\n * When {@link Mesh#isObject} and {@link Mesh#selected} are both ````true``` the Mesh will be\n * registered by {@link Mesh#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n */\n set selected(selected) {\n selected = !!selected;\n if (selected === this._state.selected) {\n return;\n }\n this._state.selected = selected;\n if (this._isObject) {\n this.scene._objectSelectedUpdated(this, selected);\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is edge-enhanced.\n *\n * Edge appearance is configured by the {@link EdgeMaterial} referenced by {@link Mesh#edgeMaterial}.\n *\n * @type {Boolean}\n */\n get edges() {\n return this._state.edges;\n }\n\n /**\n * Sets if this Mesh is edge-enhanced.\n *\n * Edge appearance is configured by the {@link EdgeMaterial} referenced by {@link Mesh#edgeMaterial}.\n *\n * @type {Boolean}\n */\n set edges(edges) {\n edges = !!edges;\n if (edges === this._state.edges) {\n return;\n }\n this._state.edges = edges;\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is culled.\n *\n * Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.\n *\n * @type {Boolean}\n */\n get culled() {\n return this._state.culled;\n }\n\n /**\n * Sets if this Mesh is culled.\n *\n * Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.\n *\n * @type {Boolean}\n */\n set culled(value) {\n this._state.culled = !!value;\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._state.clippable;\n }\n\n /**\n * Sets if this Mesh is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n set clippable(value) {\n value = value !== false;\n if (this._state.clippable === value) {\n return;\n }\n this._state.clippable = value;\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh included in boundary calculations.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._state.collidable;\n }\n\n /**\n * Sets if this Mesh included in boundary calculations.\n *\n * @type {Boolean}\n */\n set collidable(value) {\n value = value !== false;\n if (value === this._state.collidable) {\n return;\n }\n this._state.collidable = value;\n this._setAABBDirty();\n this.scene._aabbDirty = true;\n\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Entity members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Gets if this Mesh is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._state.pickable;\n }\n\n /**\n * Sets if this Mesh is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n set pickable(value) {\n value = value !== false;\n if (this._state.pickable === value) {\n return;\n }\n this._state.pickable = value;\n // No need to trigger a render;\n // state is only used when picking\n }\n\n /**\n * Gets if this Mesh casts shadows.\n *\n * @type {Boolean}\n */\n get castsShadow() {\n return this._state.castsShadow;\n }\n\n /**\n * Sets if this Mesh casts shadows.\n *\n * @type {Boolean}\n */\n set castsShadow(value) {\n value = value !== false;\n if (value === this._state.castsShadow) {\n return;\n }\n this._state.castsShadow = value;\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh can have shadows cast upon it.\n *\n * @type {Boolean}\n */\n get receivesShadow() {\n return this._state.receivesShadow;\n }\n\n /**\n * Sets if this Mesh can have shadows cast upon it.\n *\n * @type {Boolean}\n */\n set receivesShadow(value) {\n value = value !== false;\n if (value === this._state.receivesShadow) {\n return;\n }\n this._state.receivesShadow = value;\n this._state.hash = value ? \"/mod/rs;\" : \"/mod;\";\n this.fire(\"dirty\", this); // Now need to (re)compile objectRenderers to include/exclude shadow mapping\n }\n\n /**\n * Gets if this Mesh can have Scalable Ambient Obscurance (SAO) applied to it.\n *\n * SAO is configured by {@link SAO}.\n *\n * @type {Boolean}\n * @abstract\n */\n get saoEnabled() {\n return false; // TODO: Support SAO on Meshes\n }\n\n /**\n * Gets the RGB colorize color for this Mesh.\n *\n * Multiplies by rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n get colorize() {\n return this._state.colorize;\n }\n\n /**\n * Sets the RGB colorize color for this Mesh.\n *\n * Multiplies by rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n set colorize(value) {\n let colorize = this._state.colorize;\n if (!colorize) {\n colorize = this._state.colorize = new Float32Array(4);\n colorize[3] = 1;\n }\n if (value) {\n colorize[0] = value[0];\n colorize[1] = value[1];\n colorize[2] = value[2];\n } else {\n colorize[0] = 1;\n colorize[1] = 1;\n colorize[2] = 1;\n }\n const colorized = (!!value);\n this.scene._objectColorizeUpdated(this, colorized);\n this.glRedraw();\n }\n\n /**\n * Gets the opacity factor for this Mesh.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n return this._state.colorize[3];\n }\n\n /**\n * Sets the opacity factor for this Mesh.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n let colorize = this._state.colorize;\n if (!colorize) {\n colorize = this._state.colorize = new Float32Array(4);\n colorize[0] = 1;\n colorize[1] = 1;\n colorize[2] = 1;\n }\n const opacityUpdated = (opacity !== null && opacity !== undefined);\n colorize[3] = opacityUpdated ? opacity : 1.0;\n this.scene._objectOpacityUpdated(this, opacityUpdated);\n this.glRedraw();\n }\n\n /**\n * Gets if this Mesh is transparent.\n * @returns {Boolean}\n */\n get transparent() {\n return this._material.alphaMode === 2 /* blend */ || this._state.colorize[3] < 1\n }\n\n /**\n * Gets the Mesh's rendering order relative to other Meshes.\n *\n * Default value is ````0````.\n *\n * This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.\n *\n * @type {Number}\n */\n get layer() {\n return this._state.layer;\n }\n\n /**\n * Sets the Mesh's rendering order relative to other Meshes.\n *\n * Default value is ````0````.\n *\n * This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.\n *\n * @type {Number}\n */\n set layer(value) {\n // TODO: Only accept rendering layer in range [0...MAX_layer]\n value = value || 0;\n value = Math.round(value);\n if (value === this._state.layer) {\n return;\n }\n this._state.layer = value;\n this._renderer.needStateSort();\n }\n\n /**\n * Gets if the Node's position is stationary.\n *\n * When true, will disable the effect of {@link Camera} translations for this Mesh, while still allowing it to rotate. This is useful for skyboxes.\n *\n * @type {Boolean}\n */\n get stationary() {\n return this._state.stationary;\n }\n\n /**\n * Gets the Node's billboarding behaviour.\n *\n * Options are:\n * * ````\"none\"```` - (default) - No billboarding.\n * * ````\"spherical\"```` - Mesh is billboarded to face the viewpoint, rotating both vertically and horizontally.\n * * ````\"cylindrical\"```` - Mesh is billboarded to face the viewpoint, rotating only about its vertically axis. Use this mode for things like trees on a landscape.\n * @type {String}\n */\n get billboard() {\n return this._state.billboard;\n }\n\n /**\n * Gets the Mesh's 3D World-space offset.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get offset() {\n return this._state.offset;\n }\n\n /**\n * Sets the Mesh's 3D World-space offset.\n *\n * The offset dynamically translates the Mesh in World-space.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * Provide a null or undefined value to reset to the default value.\n *\n * @type {Number[]}\n */\n set offset(value) {\n this._state.offset.set(value || [0, 0, 0]);\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Returns true to indicate that Mesh implements {@link Drawable}.\n * @final\n * @type {Boolean}\n */\n get isDrawable() {\n return true;\n }\n\n /**\n * Property with final value ````true```` to indicate that xeokit should render this Mesh in sorted order, relative to other Meshes.\n *\n * The sort order is determined by {@link Mesh#stateSortCompare}.\n *\n * Sorting is essential for rendering performance, so that xeokit is able to avoid applying runs of the same state changes to the GPU, ie. can collapse them.\n *\n * @type {Boolean}\n */\n get isStateSortable() {\n return true;\n }\n\n /**\n * Defines the appearance of this Mesh when xrayed.\n *\n * Mesh is xrayed when {@link Mesh#xrayed} is ````true````.\n *\n * Set to {@link Scene#xrayMaterial} by default.\n *\n * @type {EmphasisMaterial}\n */\n get xrayMaterial() {\n return this._xrayMaterial;\n }\n\n /**\n * Defines the appearance of this Mesh when highlighted.\n *\n * Mesh is xrayed when {@link Mesh#highlighted} is ````true````.\n *\n * Set to {@link Scene#highlightMaterial} by default.\n *\n * @type {EmphasisMaterial}\n */\n get highlightMaterial() {\n return this._highlightMaterial;\n }\n\n /**\n * Defines the appearance of this Mesh when selected.\n *\n * Mesh is xrayed when {@link Mesh#selected} is ````true````.\n *\n * Set to {@link Scene#selectedMaterial} by default.\n *\n * @type {EmphasisMaterial}\n */\n get selectedMaterial() {\n return this._selectedMaterial;\n }\n\n /**\n * Defines the appearance of this Mesh when edges are enhanced.\n *\n * Mesh is xrayed when {@link Mesh#edges} is ````true````.\n *\n * Set to {@link Scene#edgeMaterial} by default.\n *\n * @type {EdgeMaterial}\n */\n get edgeMaterial() {\n return this._edgeMaterial;\n }\n\n _checkBillboard(value) {\n value = value || \"none\";\n if (value !== \"spherical\" && value !== \"cylindrical\" && value !== \"none\") {\n this.error(\"Unsupported value for 'billboard': \" + value + \" - accepted values are \" +\n \"'spherical', 'cylindrical' and 'none' - defaulting to 'none'.\");\n value = \"none\";\n }\n return value;\n }\n\n /**\n * Called by xeokit to compile shaders for this Mesh.\n * @private\n */\n compile() {\n const drawHash = this._makeDrawHash();\n if (this._state.drawHash !== drawHash) {\n this._state.drawHash = drawHash;\n this._putDrawRenderers();\n this._drawRenderer = DrawRenderer.get(this);\n // this._shadowRenderer = ShadowRenderer.get(this);\n this._emphasisFillRenderer = EmphasisFillRenderer.get(this);\n this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this);\n }\n const pickHash = this._makePickHash();\n if (this._state.pickHash !== pickHash) {\n this._state.pickHash = pickHash;\n this._putPickRenderers();\n this._pickMeshRenderer = PickMeshRenderer.get(this);\n }\n if (this._state.occluder) {\n const occlusionHash = this._makeOcclusionHash();\n if (this._state.occlusionHash !== occlusionHash) {\n this._state.occlusionHash = occlusionHash;\n this._putOcclusionRenderer();\n this._occlusionRenderer = OcclusionRenderer.get(this);\n }\n }\n }\n\n _setLocalMatrixDirty() {\n this._localMatrixDirty = true;\n this._setWorldMatrixDirty();\n }\n\n _setWorldMatrixDirty() {\n this._worldMatrixDirty = true;\n this._worldNormalMatrixDirty = true;\n }\n\n _buildWorldMatrix() {\n const localMatrix = this.matrix;\n if (!this._parentNode) {\n for (let i = 0, len = localMatrix.length; i < len; i++) {\n this._worldMatrix[i] = localMatrix[i];\n }\n } else {\n math.mulMat4(this._parentNode.worldMatrix, localMatrix, this._worldMatrix);\n }\n this._worldMatrixDirty = false;\n }\n\n _buildWorldNormalMatrix() {\n if (this._worldMatrixDirty) {\n this._buildWorldMatrix();\n }\n if (!this._worldNormalMatrix) {\n this._worldNormalMatrix = math.mat4();\n }\n // Note: order of inverse and transpose doesn't matter\n math.transposeMat4(this._worldMatrix, this._worldNormalMatrix);\n math.inverseMat4(this._worldNormalMatrix);\n this._worldNormalMatrixDirty = false;\n }\n\n _setAABBDirty() {\n if (this.collidable) {\n for (let node = this; node; node = node._parentNode) {\n node._aabbDirty = true;\n }\n }\n }\n\n _updateAABB() {\n this.scene._aabbDirty = true;\n if (!this._aabb) {\n this._aabb = math.AABB3();\n }\n this._buildAABB(this.worldMatrix, this._aabb); // Mesh or VBOSceneModel\n this._aabbDirty = false;\n }\n\n _webglContextRestored() {\n if (this._drawRenderer) {\n this._drawRenderer.webglContextRestored();\n }\n if (this._shadowRenderer) {\n this._shadowRenderer.webglContextRestored();\n }\n if (this._emphasisFillRenderer) {\n this._emphasisFillRenderer.webglContextRestored();\n }\n if (this._emphasisEdgesRenderer) {\n this._emphasisEdgesRenderer.webglContextRestored();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.webglContextRestored();\n }\n if (this._pickTriangleRenderer) {\n this._pickMeshRenderer.webglContextRestored();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.webglContextRestored();\n }\n }\n\n _makeDrawHash() {\n const scene = this.scene;\n const hash = [\n scene.canvas.canvas.id,\n (scene.gammaInput ? \"gi;\" : \";\") + (scene.gammaOutput ? \"go\" : \"\"),\n scene._lightsState.getHash(),\n scene._sectionPlanesState.getHash()\n ];\n const state = this._state;\n if (state.stationary) {\n hash.push(\"/s\");\n }\n if (state.billboard === \"none\") {\n hash.push(\"/n\");\n } else if (state.billboard === \"spherical\") {\n hash.push(\"/s\");\n } else if (state.billboard === \"cylindrical\") {\n hash.push(\"/c\");\n }\n if (state.receivesShadow) {\n hash.push(\"/rs\");\n }\n hash.push(\";\");\n return hash.join(\"\");\n }\n\n _makePickHash() {\n const scene = this.scene;\n const hash = [\n scene.canvas.canvas.id,\n scene._sectionPlanesState.getHash()\n ];\n const state = this._state;\n if (state.stationary) {\n hash.push(\"/s\");\n }\n if (state.billboard === \"none\") {\n hash.push(\"/n\");\n } else if (state.billboard === \"spherical\") {\n hash.push(\"/s\");\n } else if (state.billboard === \"cylindrical\") {\n hash.push(\"/c\");\n }\n hash.push(\";\");\n return hash.join(\"\");\n }\n\n _makeOcclusionHash() {\n const scene = this.scene;\n const hash = [\n scene.canvas.canvas.id,\n scene._sectionPlanesState.getHash()\n ];\n const state = this._state;\n if (state.stationary) {\n hash.push(\"/s\");\n }\n if (state.billboard === \"none\") {\n hash.push(\"/n\");\n } else if (state.billboard === \"spherical\") {\n hash.push(\"/s\");\n } else if (state.billboard === \"cylindrical\") {\n hash.push(\"/c\");\n }\n hash.push(\";\");\n return hash.join(\"\");\n }\n\n _buildAABB(worldMatrix, aabb) {\n\n math.transformOBB3(worldMatrix, this._geometry.obb, obb);\n math.OBB3ToAABB3(obb, aabb);\n\n const offset = this._state.offset;\n\n aabb[0] += offset[0];\n aabb[1] += offset[1];\n aabb[2] += offset[2];\n aabb[3] += offset[0];\n aabb[4] += offset[1];\n aabb[5] += offset[2];\n\n if (this._state.origin) {\n const origin = this._state.origin;\n aabb[0] += origin[0];\n aabb[1] += origin[1];\n aabb[2] += origin[2];\n aabb[3] += origin[0];\n aabb[4] += origin[1];\n aabb[5] += origin[2];\n }\n }\n\n /**\n * Rotates the Mesh about the given local axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotate(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(this.quaternion, q1, q2);\n this.quaternion = q2;\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n return this;\n }\n\n /**\n * Rotates the Mesh about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotateOnWorldAxis(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(q1, this.quaternion, q1);\n //this.quaternion.premultiply(q1);\n return this;\n }\n\n /**\n * Rotates the Mesh about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateX(angle) {\n return this.rotate(xAxis, angle);\n }\n\n /**\n * Rotates the Mesh about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateY(angle) {\n return this.rotate(yAxis, angle);\n }\n\n /**\n * Rotates the Mesh about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateZ(angle) {\n return this.rotate(zAxis, angle);\n }\n\n /**\n * Translates the Mesh along local space vector by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n */\n translate(axis, distance) {\n math.vec3ApplyQuaternion(this.quaternion, axis, veca);\n math.mulVec3Scalar(veca, distance, vecb);\n math.addVec3(this.position, vecb, this.position);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n return this;\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Drawable members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Translates the Mesh along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n */\n translateX(distance) {\n return this.translate(xAxis, distance);\n }\n\n /**\n * Translates the Mesh along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n */\n translateY(distance) {\n return this.translate(yAxis, distance);\n }\n\n /**\n * Translates the Mesh along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n */\n translateZ(distance) {\n return this.translate(zAxis, distance);\n }\n\n _putDrawRenderers() {\n if (this._drawRenderer) {\n this._drawRenderer.put();\n this._drawRenderer = null;\n }\n if (this._shadowRenderer) {\n this._shadowRenderer.put();\n this._shadowRenderer = null;\n }\n if (this._emphasisFillRenderer) {\n this._emphasisFillRenderer.put();\n this._emphasisFillRenderer = null;\n }\n if (this._emphasisEdgesRenderer) {\n this._emphasisEdgesRenderer.put();\n this._emphasisEdgesRenderer = null;\n }\n }\n\n _putPickRenderers() {\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.put();\n this._pickMeshRenderer = null;\n }\n if (this._pickTriangleRenderer) {\n this._pickTriangleRenderer.put();\n this._pickTriangleRenderer = null;\n }\n }\n\n _putOcclusionRenderer() {\n if (this._occlusionRenderer) {\n this._occlusionRenderer.put();\n this._occlusionRenderer = null;\n }\n }\n\n /**\n * Comparison function used by the renderer to determine the order in which xeokit should render the Mesh, relative to to other Meshes.\n *\n * xeokit requires this method because Mesh implements {@link Drawable}.\n *\n * Sorting is essential for rendering performance, so that xeokit is able to avoid needlessly applying runs of the same rendering state changes to the GPU, ie. can collapse them.\n *\n * @param {Mesh} mesh1\n * @param {Mesh} mesh2\n * @returns {number}\n */\n stateSortCompare(mesh1, mesh2) {\n return (mesh1._state.layer - mesh2._state.layer)\n || (mesh1._drawRenderer.id - mesh2._drawRenderer.id) // Program state\n || (mesh1._material._state.id - mesh2._material._state.id) // Material state\n || (mesh1._geometry._state.id - mesh2._geometry._state.id); // Geometry state\n }\n\n /** @private */\n rebuildRenderFlags() {\n this.renderFlags.reset();\n if (!this._getActiveSectionPlanes()) {\n this.renderFlags.culled = true;\n return;\n }\n this.renderFlags.numLayers = 1;\n this.renderFlags.numVisibleLayers = 1;\n this.renderFlags.visibleLayers[0] = 0;\n this._updateRenderFlags();\n }\n\n /**\n * @private\n */\n _updateRenderFlags() {\n\n const renderFlags = this.renderFlags;\n const state = this._state;\n\n if (state.xrayed) {\n const xrayMaterial = this._xrayMaterial._state;\n if (xrayMaterial.fill) {\n if (xrayMaterial.fillAlpha < 1.0) {\n renderFlags.xrayedSilhouetteTransparent = true;\n } else {\n renderFlags.xrayedSilhouetteOpaque = true;\n }\n }\n if (xrayMaterial.edges) {\n if (xrayMaterial.edgeAlpha < 1.0) {\n renderFlags.xrayedEdgesTransparent = true;\n } else {\n renderFlags.xrayedEdgesOpaque = true;\n }\n }\n } else {\n const normalMaterial = this._material._state;\n if (normalMaterial.alpha < 1.0 || state.colorize[3] < 1.0) {\n renderFlags.colorTransparent = true;\n } else {\n renderFlags.colorOpaque = true;\n }\n if (state.edges) {\n const edgeMaterial = this._edgeMaterial._state;\n if (edgeMaterial.alpha < 1.0) {\n renderFlags.edgesTransparent = true;\n } else {\n renderFlags.edgesOpaque = true;\n }\n }\n if (state.selected) {\n const selectedMaterial = this._selectedMaterial._state;\n if (selectedMaterial.fill) {\n if (selectedMaterial.fillAlpha < 1.0) {\n renderFlags.selectedSilhouetteTransparent = true;\n } else {\n renderFlags.selectedSilhouetteOpaque = true;\n }\n }\n if (selectedMaterial.edges) {\n if (selectedMaterial.edgeAlpha < 1.0) {\n renderFlags.selectedEdgesTransparent = true;\n } else {\n renderFlags.selectedEdgesOpaque = true;\n }\n }\n } else if (state.highlighted) {\n const highlightMaterial = this._highlightMaterial._state;\n if (highlightMaterial.fill) {\n if (highlightMaterial.fillAlpha < 1.0) {\n renderFlags.highlightedSilhouetteTransparent = true;\n } else {\n renderFlags.highlightedSilhouetteOpaque = true;\n }\n }\n if (highlightMaterial.edges) {\n if (highlightMaterial.edgeAlpha < 1.0) {\n renderFlags.highlightedEdgesTransparent = true;\n } else {\n renderFlags.highlightedEdgesOpaque = true;\n }\n }\n }\n }\n }\n\n _getActiveSectionPlanes() {\n\n if (this._state.clippable) {\n\n const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;\n const numSectionPlanes = sectionPlanes.length;\n\n if (numSectionPlanes > 0) {\n for (let i = 0; i < numSectionPlanes; i++) {\n\n const sectionPlane = sectionPlanes[i];\n const renderFlags = this.renderFlags;\n\n if (!sectionPlane.active) {\n renderFlags.sectionPlanesActivePerLayer[i] = false;\n\n } else {\n\n if (this._state.origin) {\n\n const intersect = math.planeAABB3Intersect(sectionPlane.dir, sectionPlane.dist, this.aabb);\n const outside = (intersect === -1);\n\n if (outside) {\n return false;\n }\n\n const intersecting = (intersect === 0);\n renderFlags.sectionPlanesActivePerLayer[i] = intersecting;\n\n } else {\n renderFlags.sectionPlanesActivePerLayer[i] = true;\n }\n }\n }\n }\n }\n\n return true;\n }\n\n // ---------------------- NORMAL RENDERING -----------------------------------\n\n /** @private */\n drawColorOpaque(frameCtx) {\n if (this._drawRenderer || (this._drawRenderer = DrawRenderer.get(this))) {\n this._drawRenderer.drawMesh(frameCtx, this);\n }\n }\n\n /** @private */\n drawColorTransparent(frameCtx) {\n if (this._drawRenderer || (this._drawRenderer = DrawRenderer.get(this))) {\n this._drawRenderer.drawMesh(frameCtx, this);\n }\n }\n\n // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------\n\n // TODO\n\n // ---------------------- EMPHASIS RENDERING -----------------------------------\n\n /** @private */\n drawSilhouetteXRayed(frameCtx) {\n if (this._emphasisFillRenderer || (this._emphasisFillRenderer = EmphasisFillRenderer.get(this))) {\n this._emphasisFillRenderer.drawMesh(frameCtx, this, 0); // 0 == xray\n }\n }\n\n /** @private */\n drawSilhouetteHighlighted(frameCtx) {\n if (this._emphasisFillRenderer || (this._emphasisFillRenderer = EmphasisFillRenderer.get(this))) {\n this._emphasisFillRenderer.drawMesh(frameCtx, this, 1); // 1 == highlight\n }\n }\n\n /** @private */\n drawSilhouetteSelected(frameCtx) {\n if (this._emphasisFillRenderer || (this._emphasisFillRenderer = EmphasisFillRenderer.get(this))) {\n this._emphasisFillRenderer.drawMesh(frameCtx, this, 2); // 2 == selected\n }\n }\n\n // ---------------------- EDGES RENDERING -----------------------------------\n\n /** @private */\n drawEdgesColorOpaque(frameCtx) {\n if (this._emphasisEdgesRenderer || (this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this))) {\n this._emphasisEdgesRenderer.drawMesh(frameCtx, this, 3); // 3 == edges\n }\n }\n\n /** @private */\n drawEdgesColorTransparent(frameCtx) {\n if (this._emphasisEdgesRenderer || (this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this))) {\n this._emphasisEdgesRenderer.drawMesh(frameCtx, this, 3); // 3 == edges\n }\n }\n\n /** @private */\n drawEdgesXRayed(frameCtx) {\n if (this._emphasisEdgesRenderer || (this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this))) {\n this._emphasisEdgesRenderer.drawMesh(frameCtx, this, 0); // 0 == xray\n }\n }\n\n /** @private */\n drawEdgesHighlighted(frameCtx) {\n if (this._emphasisEdgesRenderer || (this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this))) {\n this._emphasisEdgesRenderer.drawMesh(frameCtx, this, 1); // 1 == highlight\n }\n }\n\n /** @private */\n drawEdgesSelected(frameCtx) {\n if (this._emphasisEdgesRenderer || (this._emphasisEdgesRenderer = EmphasisEdgesRenderer.get(this))) {\n this._emphasisEdgesRenderer.drawMesh(frameCtx, this, 2); // 2 == selected\n }\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n /** @private */\n drawOcclusion(frameCtx) {\n if (this._state.occluder && this._occlusionRenderer || (this._occlusionRenderer = OcclusionRenderer.get(this))) {\n this._occlusionRenderer.drawMesh(frameCtx, this);\n }\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n /** @private */\n drawShadow(frameCtx) {\n if (this._shadowRenderer || (this._shadowRenderer = ShadowRenderer.get(this))) {\n this._shadowRenderer.drawMesh(frameCtx, this);\n }\n }\n\n // ---------------------- PICKING RENDERING ----------------------------------\n\n /** @private */\n drawPickMesh(frameCtx) {\n if (this._pickMeshRenderer || (this._pickMeshRenderer = PickMeshRenderer.get(this))) {\n this._pickMeshRenderer.drawMesh(frameCtx, this);\n }\n }\n\n /** @private\n */\n canPickTriangle() {\n return this._geometry.isReadableGeometry; // VBOGeometry does not support surface picking because it has no geometry data in browser memory\n }\n\n /** @private */\n drawPickTriangles(frameCtx) {\n if (this._pickTriangleRenderer || (this._pickTriangleRenderer = PickTriangleRenderer.get(this))) {\n this._pickTriangleRenderer.drawMesh(frameCtx, this);\n }\n }\n\n /** @private */\n pickTriangleSurface(pickViewMatrix, pickProjMatrix, pickResult) {\n pickTriangleSurface(this, pickViewMatrix, pickProjMatrix, pickResult);\n }\n\n /** @private */\n drawPickVertices(frameCtx) {\n\n }\n\n /**\n * @private\n * @returns {PerformanceNode}\n */\n delegatePickedEntity() {\n return this;\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Component members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Destroys this Mesh.\n */\n destroy() {\n super.destroy(); // xeokit.Object\n this._putDrawRenderers();\n this._putPickRenderers();\n this._putOcclusionRenderer();\n this.scene._renderer.putPickID(this._state.pickID); // TODO: somehow puch this down into xeokit framework?\n if (this._isObject) {\n this.scene._deregisterObject(this);\n if (this._visible) {\n this.scene._objectVisibilityUpdated(this, false, false);\n }\n if (this._xrayed) {\n this.scene._objectXRayedUpdated(this, false, false);\n }\n if (this._selected) {\n this.scene._objectSelectedUpdated(this, false, false);\n }\n if (this._highlighted) {\n this.scene._objectHighlightedUpdated(this, false, false);\n }\n this.scene._objectColorizeUpdated(this, false);\n this.scene._objectOpacityUpdated(this, false);\n if (this.offset.some((v) => v !== 0))\n this.scene._objectOffsetUpdated(this, false);\n }\n if (this._isModel) {\n this.scene._deregisterModel(this);\n }\n this.glRedraw();\n }\n\n}\n\n\nconst pickTriangleSurface = (function () {\n\n // Cached vars to avoid garbage collection\n\n const localRayOrigin = math.vec3();\n const localRayDir = math.vec3();\n const positionA = math.vec3();\n const positionB = math.vec3();\n const positionC = math.vec3();\n const triangleVertices = math.vec3();\n const position = math.vec4();\n const worldPos = math.vec3();\n const viewPos = math.vec3();\n const bary = math.vec3();\n const normalA = math.vec3();\n const normalB = math.vec3();\n const normalC = math.vec3();\n const uva = math.vec3();\n const uvb = math.vec3();\n const uvc = math.vec3();\n const tempVec4a = math.vec4();\n const tempVec4b = math.vec4();\n const tempVec4c = math.vec4();\n const tempVec3 = math.vec3();\n const tempVec3b = math.vec3();\n const tempVec3c = math.vec3();\n const tempVec3d = math.vec3();\n const tempVec3e = math.vec3();\n const tempVec3f = math.vec3();\n const tempVec3g = math.vec3();\n const tempVec3h = math.vec3();\n const tempVec3i = math.vec3();\n const tempVec3j = math.vec3();\n const tempVec3k = math.vec3();\n\n return function (mesh, pickViewMatrix, pickProjMatrix, pickResult) {\n\n var primIndex = pickResult.primIndex;\n\n if (primIndex !== undefined && primIndex !== null && primIndex > -1) {\n\n const geometry = mesh.geometry._state;\n const scene = mesh.scene;\n const camera = scene.camera;\n const canvas = scene.canvas;\n\n if (geometry.primitiveName === \"triangles\") {\n\n // Triangle picked; this only happens when the\n // Mesh has a Geometry that has primitives of type \"triangle\"\n\n pickResult.primitive = \"triangle\";\n\n // Get the World-space positions of the triangle's vertices\n\n const i = primIndex; // Indicates the first triangle index in the indices array\n\n const indices = geometry.indices; // Indices into geometry arrays, not into shared VertexBufs\n const positions = geometry.positions;\n\n let ia3;\n let ib3;\n let ic3;\n\n if (indices) {\n\n var ia = indices[i + 0];\n var ib = indices[i + 1];\n var ic = indices[i + 2];\n\n triangleVertices[0] = ia;\n triangleVertices[1] = ib;\n triangleVertices[2] = ic;\n\n pickResult.indices = triangleVertices;\n\n ia3 = ia * 3;\n ib3 = ib * 3;\n ic3 = ic * 3;\n\n } else {\n\n ia3 = i * 3;\n ib3 = ia3 + 3;\n ic3 = ib3 + 3;\n }\n\n positionA[0] = positions[ia3 + 0];\n positionA[1] = positions[ia3 + 1];\n positionA[2] = positions[ia3 + 2];\n\n positionB[0] = positions[ib3 + 0];\n positionB[1] = positions[ib3 + 1];\n positionB[2] = positions[ib3 + 2];\n\n positionC[0] = positions[ic3 + 0];\n positionC[1] = positions[ic3 + 1];\n positionC[2] = positions[ic3 + 2];\n\n if (geometry.compressGeometry) {\n\n // Decompress vertex positions\n\n const positionsDecodeMatrix = geometry.positionsDecodeMatrix;\n if (positionsDecodeMatrix) {\n geometryCompressionUtils.decompressPosition(positionA, positionsDecodeMatrix, positionA);\n geometryCompressionUtils.decompressPosition(positionB, positionsDecodeMatrix, positionB);\n geometryCompressionUtils.decompressPosition(positionC, positionsDecodeMatrix, positionC);\n }\n }\n\n // Attempt to ray-pick the triangle in local space\n\n if (pickResult.canvasPos) {\n math.canvasPosToLocalRay(canvas.canvas, mesh.origin ? createRTCViewMat(pickViewMatrix, mesh.origin) : pickViewMatrix, pickProjMatrix, mesh.worldMatrix, pickResult.canvasPos, localRayOrigin, localRayDir);\n\n } else if (pickResult.origin && pickResult.direction) {\n math.worldRayToLocalRay(mesh.worldMatrix, pickResult.origin, pickResult.direction, localRayOrigin, localRayDir);\n }\n\n math.normalizeVec3(localRayDir);\n math.rayPlaneIntersect(localRayOrigin, localRayDir, positionA, positionB, positionC, position);\n\n // Get Local-space cartesian coordinates of the ray-triangle intersection\n\n pickResult.localPos = position;\n pickResult.position = position;\n\n // Get interpolated World-space coordinates\n\n // Need to transform homogeneous coords\n\n tempVec4a[0] = position[0];\n tempVec4a[1] = position[1];\n tempVec4a[2] = position[2];\n tempVec4a[3] = 1;\n\n // Get World-space cartesian coordinates of the ray-triangle intersection\n\n math.transformVec4(mesh.worldMatrix, tempVec4a, tempVec4b);\n\n worldPos[0] = tempVec4b[0];\n worldPos[1] = tempVec4b[1];\n worldPos[2] = tempVec4b[2];\n\n if (pickResult.canvasPos && mesh.origin) {\n worldPos[0] += mesh.origin[0];\n worldPos[1] += mesh.origin[1];\n worldPos[2] += mesh.origin[2];\n }\n\n pickResult.worldPos = worldPos;\n\n // Get View-space cartesian coordinates of the ray-triangle intersection\n\n math.transformVec4(camera.matrix, tempVec4b, tempVec4c);\n\n viewPos[0] = tempVec4c[0];\n viewPos[1] = tempVec4c[1];\n viewPos[2] = tempVec4c[2];\n\n pickResult.viewPos = viewPos;\n\n // Get barycentric coordinates of the ray-triangle intersection\n\n math.cartesianToBarycentric(position, positionA, positionB, positionC, bary);\n\n pickResult.bary = bary;\n\n // Get interpolated normal vector\n\n const normals = geometry.normals;\n\n if (normals) {\n\n if (geometry.compressGeometry) {\n\n // Decompress vertex normals\n\n const ia2 = ia * 3;\n const ib2 = ib * 3;\n const ic2 = ic * 3;\n\n geometryCompressionUtils.decompressNormal(normals.subarray(ia2, ia2 + 2), normalA);\n geometryCompressionUtils.decompressNormal(normals.subarray(ib2, ib2 + 2), normalB);\n geometryCompressionUtils.decompressNormal(normals.subarray(ic2, ic2 + 2), normalC);\n\n } else {\n\n normalA[0] = normals[ia3];\n normalA[1] = normals[ia3 + 1];\n normalA[2] = normals[ia3 + 2];\n\n normalB[0] = normals[ib3];\n normalB[1] = normals[ib3 + 1];\n normalB[2] = normals[ib3 + 2];\n\n normalC[0] = normals[ic3];\n normalC[1] = normals[ic3 + 1];\n normalC[2] = normals[ic3 + 2];\n }\n\n const normal = math.addVec3(math.addVec3(\n math.mulVec3Scalar(normalA, bary[0], tempVec3),\n math.mulVec3Scalar(normalB, bary[1], tempVec3b), tempVec3c),\n math.mulVec3Scalar(normalC, bary[2], tempVec3d), tempVec3e);\n\n pickResult.worldNormal = math.normalizeVec3(math.transformVec3(mesh.worldNormalMatrix, normal, tempVec3f));\n }\n\n // Get interpolated UV coordinates\n\n const uvs = geometry.uv;\n\n if (uvs) {\n\n uva[0] = uvs[(ia * 2)];\n uva[1] = uvs[(ia * 2) + 1];\n\n uvb[0] = uvs[(ib * 2)];\n uvb[1] = uvs[(ib * 2) + 1];\n\n uvc[0] = uvs[(ic * 2)];\n uvc[1] = uvs[(ic * 2) + 1];\n\n if (geometry.compressGeometry) {\n\n // Decompress vertex UVs\n\n const uvDecodeMatrix = geometry.uvDecodeMatrix;\n if (uvDecodeMatrix) {\n geometryCompressionUtils.decompressUV(uva, uvDecodeMatrix, uva);\n geometryCompressionUtils.decompressUV(uvb, uvDecodeMatrix, uvb);\n geometryCompressionUtils.decompressUV(uvc, uvDecodeMatrix, uvc);\n }\n }\n\n pickResult.uv = math.addVec3(\n math.addVec3(\n math.mulVec2Scalar(uva, bary[0], tempVec3g),\n math.mulVec2Scalar(uvb, bary[1], tempVec3h), tempVec3i),\n math.mulVec2Scalar(uvc, bary[2], tempVec3j), tempVec3k);\n }\n }\n }\n }\n})();\n\nexport {Mesh};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/Mesh.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/Mesh.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4475, + "__docId__": 4483, "kind": "variable", "name": "obb", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89774,7 +89990,7 @@ "ignore": true }, { - "__docId__": 4476, + "__docId__": 4484, "kind": "variable", "name": "angleAxis", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89795,7 +90011,7 @@ "ignore": true }, { - "__docId__": 4477, + "__docId__": 4485, "kind": "variable", "name": "q1", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89816,7 +90032,7 @@ "ignore": true }, { - "__docId__": 4478, + "__docId__": 4486, "kind": "variable", "name": "q2", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89837,7 +90053,7 @@ "ignore": true }, { - "__docId__": 4479, + "__docId__": 4487, "kind": "variable", "name": "xAxis", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89858,7 +90074,7 @@ "ignore": true }, { - "__docId__": 4480, + "__docId__": 4488, "kind": "variable", "name": "yAxis", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89879,7 +90095,7 @@ "ignore": true }, { - "__docId__": 4481, + "__docId__": 4489, "kind": "variable", "name": "zAxis", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89900,7 +90116,7 @@ "ignore": true }, { - "__docId__": 4482, + "__docId__": 4490, "kind": "variable", "name": "veca", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89921,7 +90137,7 @@ "ignore": true }, { - "__docId__": 4483, + "__docId__": 4491, "kind": "variable", "name": "vecb", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89942,7 +90158,7 @@ "ignore": true }, { - "__docId__": 4484, + "__docId__": 4492, "kind": "variable", "name": "identityMat", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89963,7 +90179,7 @@ "ignore": true }, { - "__docId__": 4485, + "__docId__": 4493, "kind": "variable", "name": "pickTriangleSurface", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -89984,7 +90200,7 @@ "ignore": true }, { - "__docId__": 4486, + "__docId__": 4494, "kind": "class", "name": "Mesh", "memberof": "src/viewer/scene/mesh/Mesh.js", @@ -90006,7 +90222,7 @@ ] }, { - "__docId__": 4487, + "__docId__": 4495, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90466,7 +90682,7 @@ ] }, { - "__docId__": 4488, + "__docId__": 4496, "kind": "member", "name": "originalSystemId", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90486,7 +90702,7 @@ "abstract": true }, { - "__docId__": 4489, + "__docId__": 4497, "kind": "member", "name": "renderFlags", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90503,7 +90719,7 @@ } }, { - "__docId__": 4490, + "__docId__": 4498, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90521,7 +90737,7 @@ } }, { - "__docId__": 4491, + "__docId__": 4499, "kind": "member", "name": "_drawRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90539,7 +90755,7 @@ } }, { - "__docId__": 4492, + "__docId__": 4500, "kind": "member", "name": "_shadowRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90557,7 +90773,7 @@ } }, { - "__docId__": 4493, + "__docId__": 4501, "kind": "member", "name": "_emphasisFillRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90575,7 +90791,7 @@ } }, { - "__docId__": 4494, + "__docId__": 4502, "kind": "member", "name": "_emphasisEdgesRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90593,7 +90809,7 @@ } }, { - "__docId__": 4495, + "__docId__": 4503, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90611,7 +90827,7 @@ } }, { - "__docId__": 4496, + "__docId__": 4504, "kind": "member", "name": "_pickTriangleRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90629,7 +90845,7 @@ } }, { - "__docId__": 4497, + "__docId__": 4505, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90647,7 +90863,7 @@ } }, { - "__docId__": 4498, + "__docId__": 4506, "kind": "member", "name": "_geometry", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90665,7 +90881,7 @@ } }, { - "__docId__": 4499, + "__docId__": 4507, "kind": "member", "name": "_material", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90683,7 +90899,7 @@ } }, { - "__docId__": 4500, + "__docId__": 4508, "kind": "member", "name": "_xrayMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90701,7 +90917,7 @@ } }, { - "__docId__": 4501, + "__docId__": 4509, "kind": "member", "name": "_highlightMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90719,7 +90935,7 @@ } }, { - "__docId__": 4502, + "__docId__": 4510, "kind": "member", "name": "_selectedMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90737,7 +90953,7 @@ } }, { - "__docId__": 4503, + "__docId__": 4511, "kind": "member", "name": "_edgeMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90755,7 +90971,7 @@ } }, { - "__docId__": 4504, + "__docId__": 4512, "kind": "member", "name": "_parentNode", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90773,7 +90989,7 @@ } }, { - "__docId__": 4505, + "__docId__": 4513, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90791,7 +91007,7 @@ } }, { - "__docId__": 4506, + "__docId__": 4514, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90809,7 +91025,7 @@ } }, { - "__docId__": 4507, + "__docId__": 4515, "kind": "member", "name": "_numTriangles", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90827,7 +91043,7 @@ } }, { - "__docId__": 4508, + "__docId__": 4516, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90845,7 +91061,7 @@ } }, { - "__docId__": 4509, + "__docId__": 4517, "kind": "member", "name": "_quaternion", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90863,7 +91079,7 @@ } }, { - "__docId__": 4510, + "__docId__": 4518, "kind": "member", "name": "_rotation", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90881,7 +91097,7 @@ } }, { - "__docId__": 4511, + "__docId__": 4519, "kind": "member", "name": "_position", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90899,7 +91115,7 @@ } }, { - "__docId__": 4512, + "__docId__": 4520, "kind": "member", "name": "_worldMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90917,7 +91133,7 @@ } }, { - "__docId__": 4513, + "__docId__": 4521, "kind": "member", "name": "_worldNormalMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90935,7 +91151,7 @@ } }, { - "__docId__": 4514, + "__docId__": 4522, "kind": "member", "name": "_localMatrixDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90953,7 +91169,7 @@ } }, { - "__docId__": 4515, + "__docId__": 4523, "kind": "member", "name": "_worldMatrixDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90971,7 +91187,7 @@ } }, { - "__docId__": 4516, + "__docId__": 4524, "kind": "member", "name": "_worldNormalMatrixDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -90989,7 +91205,7 @@ } }, { - "__docId__": 4521, + "__docId__": 4529, "kind": "member", "name": "_isObject", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91007,7 +91223,7 @@ } }, { - "__docId__": 4522, + "__docId__": 4530, "kind": "member", "name": "_isModel", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91025,7 +91241,7 @@ } }, { - "__docId__": 4540, + "__docId__": 4548, "kind": "get", "name": "type", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91044,7 +91260,7 @@ } }, { - "__docId__": 4541, + "__docId__": 4549, "kind": "get", "name": "isMesh", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91071,7 +91287,7 @@ } }, { - "__docId__": 4542, + "__docId__": 4550, "kind": "get", "name": "parent", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91092,7 +91308,7 @@ } }, { - "__docId__": 4543, + "__docId__": 4551, "kind": "get", "name": "geometry", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91113,7 +91329,7 @@ } }, { - "__docId__": 4544, + "__docId__": 4552, "kind": "get", "name": "material", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91134,7 +91350,7 @@ } }, { - "__docId__": 4545, + "__docId__": 4553, "kind": "get", "name": "position", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91155,7 +91371,7 @@ } }, { - "__docId__": 4546, + "__docId__": 4554, "kind": "set", "name": "position", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91176,7 +91392,7 @@ } }, { - "__docId__": 4547, + "__docId__": 4555, "kind": "get", "name": "rotation", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91197,7 +91413,7 @@ } }, { - "__docId__": 4548, + "__docId__": 4556, "kind": "set", "name": "rotation", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91218,7 +91434,7 @@ } }, { - "__docId__": 4549, + "__docId__": 4557, "kind": "get", "name": "quaternion", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91239,7 +91455,7 @@ } }, { - "__docId__": 4550, + "__docId__": 4558, "kind": "set", "name": "quaternion", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91260,7 +91476,7 @@ } }, { - "__docId__": 4551, + "__docId__": 4559, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91281,7 +91497,7 @@ } }, { - "__docId__": 4552, + "__docId__": 4560, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91302,7 +91518,7 @@ } }, { - "__docId__": 4553, + "__docId__": 4561, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91323,7 +91539,7 @@ } }, { - "__docId__": 4554, + "__docId__": 4562, "kind": "member", "name": "__localMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91341,7 +91557,7 @@ } }, { - "__docId__": 4556, + "__docId__": 4564, "kind": "set", "name": "matrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91362,7 +91578,7 @@ } }, { - "__docId__": 4559, + "__docId__": 4567, "kind": "get", "name": "worldMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91395,7 +91611,7 @@ } }, { - "__docId__": 4560, + "__docId__": 4568, "kind": "get", "name": "worldNormalMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91416,7 +91632,7 @@ } }, { - "__docId__": 4561, + "__docId__": 4569, "kind": "get", "name": "isEntity", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91448,7 +91664,7 @@ } }, { - "__docId__": 4562, + "__docId__": 4570, "kind": "get", "name": "isModel", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91469,7 +91685,7 @@ } }, { - "__docId__": 4563, + "__docId__": 4571, "kind": "get", "name": "isObject", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91490,7 +91706,7 @@ } }, { - "__docId__": 4564, + "__docId__": 4572, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91511,7 +91727,7 @@ } }, { - "__docId__": 4565, + "__docId__": 4573, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91532,7 +91748,7 @@ } }, { - "__docId__": 4566, + "__docId__": 4574, "kind": "set", "name": "origin", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91553,7 +91769,7 @@ } }, { - "__docId__": 4567, + "__docId__": 4575, "kind": "get", "name": "rtcCenter", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91575,7 +91791,7 @@ } }, { - "__docId__": 4568, + "__docId__": 4576, "kind": "set", "name": "rtcCenter", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91597,7 +91813,7 @@ } }, { - "__docId__": 4570, + "__docId__": 4578, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91618,7 +91834,7 @@ } }, { - "__docId__": 4571, + "__docId__": 4579, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91639,7 +91855,7 @@ } }, { - "__docId__": 4572, + "__docId__": 4580, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91660,7 +91876,7 @@ } }, { - "__docId__": 4573, + "__docId__": 4581, "kind": "get", "name": "xrayed", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91681,7 +91897,7 @@ } }, { - "__docId__": 4574, + "__docId__": 4582, "kind": "set", "name": "xrayed", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91702,7 +91918,7 @@ } }, { - "__docId__": 4575, + "__docId__": 4583, "kind": "get", "name": "highlighted", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91723,7 +91939,7 @@ } }, { - "__docId__": 4576, + "__docId__": 4584, "kind": "set", "name": "highlighted", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91744,7 +91960,7 @@ } }, { - "__docId__": 4577, + "__docId__": 4585, "kind": "get", "name": "selected", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91765,7 +91981,7 @@ } }, { - "__docId__": 4578, + "__docId__": 4586, "kind": "set", "name": "selected", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91786,7 +92002,7 @@ } }, { - "__docId__": 4579, + "__docId__": 4587, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91807,7 +92023,7 @@ } }, { - "__docId__": 4580, + "__docId__": 4588, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91828,7 +92044,7 @@ } }, { - "__docId__": 4581, + "__docId__": 4589, "kind": "get", "name": "culled", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91849,7 +92065,7 @@ } }, { - "__docId__": 4582, + "__docId__": 4590, "kind": "set", "name": "culled", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91870,7 +92086,7 @@ } }, { - "__docId__": 4583, + "__docId__": 4591, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91891,7 +92107,7 @@ } }, { - "__docId__": 4584, + "__docId__": 4592, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91912,7 +92128,7 @@ } }, { - "__docId__": 4585, + "__docId__": 4593, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91933,7 +92149,7 @@ } }, { - "__docId__": 4586, + "__docId__": 4594, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91954,7 +92170,7 @@ } }, { - "__docId__": 4587, + "__docId__": 4595, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91975,7 +92191,7 @@ } }, { - "__docId__": 4588, + "__docId__": 4596, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -91996,7 +92212,7 @@ } }, { - "__docId__": 4589, + "__docId__": 4597, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92017,7 +92233,7 @@ } }, { - "__docId__": 4590, + "__docId__": 4598, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92038,7 +92254,7 @@ } }, { - "__docId__": 4591, + "__docId__": 4599, "kind": "get", "name": "receivesShadow", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92059,7 +92275,7 @@ } }, { - "__docId__": 4592, + "__docId__": 4600, "kind": "set", "name": "receivesShadow", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92080,7 +92296,7 @@ } }, { - "__docId__": 4593, + "__docId__": 4601, "kind": "get", "name": "saoEnabled", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92102,7 +92318,7 @@ "abstract": true }, { - "__docId__": 4594, + "__docId__": 4602, "kind": "get", "name": "colorize", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92123,7 +92339,7 @@ } }, { - "__docId__": 4595, + "__docId__": 4603, "kind": "set", "name": "colorize", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92144,7 +92360,7 @@ } }, { - "__docId__": 4596, + "__docId__": 4604, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92165,7 +92381,7 @@ } }, { - "__docId__": 4597, + "__docId__": 4605, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92186,7 +92402,7 @@ } }, { - "__docId__": 4598, + "__docId__": 4606, "kind": "get", "name": "transparent", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92218,7 +92434,7 @@ } }, { - "__docId__": 4599, + "__docId__": 4607, "kind": "get", "name": "layer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92239,7 +92455,7 @@ } }, { - "__docId__": 4600, + "__docId__": 4608, "kind": "set", "name": "layer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92260,7 +92476,7 @@ } }, { - "__docId__": 4601, + "__docId__": 4609, "kind": "get", "name": "stationary", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92281,7 +92497,7 @@ } }, { - "__docId__": 4602, + "__docId__": 4610, "kind": "get", "name": "billboard", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92302,7 +92518,7 @@ } }, { - "__docId__": 4603, + "__docId__": 4611, "kind": "get", "name": "offset", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92323,7 +92539,7 @@ } }, { - "__docId__": 4604, + "__docId__": 4612, "kind": "set", "name": "offset", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92344,7 +92560,7 @@ } }, { - "__docId__": 4605, + "__docId__": 4613, "kind": "get", "name": "isDrawable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92371,7 +92587,7 @@ } }, { - "__docId__": 4606, + "__docId__": 4614, "kind": "get", "name": "isStateSortable", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92392,7 +92608,7 @@ } }, { - "__docId__": 4607, + "__docId__": 4615, "kind": "get", "name": "xrayMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92413,7 +92629,7 @@ } }, { - "__docId__": 4608, + "__docId__": 4616, "kind": "get", "name": "highlightMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92434,7 +92650,7 @@ } }, { - "__docId__": 4609, + "__docId__": 4617, "kind": "get", "name": "selectedMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92455,7 +92671,7 @@ } }, { - "__docId__": 4610, + "__docId__": 4618, "kind": "get", "name": "edgeMaterial", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92476,7 +92692,7 @@ } }, { - "__docId__": 4611, + "__docId__": 4619, "kind": "method", "name": "_checkBillboard", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92504,7 +92720,7 @@ } }, { - "__docId__": 4612, + "__docId__": 4620, "kind": "method", "name": "compile", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92520,7 +92736,7 @@ "return": null }, { - "__docId__": 4618, + "__docId__": 4626, "kind": "method", "name": "_setLocalMatrixDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92537,7 +92753,7 @@ "return": null }, { - "__docId__": 4620, + "__docId__": 4628, "kind": "method", "name": "_setWorldMatrixDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92554,7 +92770,7 @@ "return": null }, { - "__docId__": 4623, + "__docId__": 4631, "kind": "method", "name": "_buildWorldMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92571,7 +92787,7 @@ "return": null }, { - "__docId__": 4625, + "__docId__": 4633, "kind": "method", "name": "_buildWorldNormalMatrix", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92588,7 +92804,7 @@ "return": null }, { - "__docId__": 4628, + "__docId__": 4636, "kind": "method", "name": "_setAABBDirty", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92605,7 +92821,7 @@ "return": null }, { - "__docId__": 4629, + "__docId__": 4637, "kind": "method", "name": "_updateAABB", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92622,7 +92838,7 @@ "return": null }, { - "__docId__": 4632, + "__docId__": 4640, "kind": "method", "name": "_webglContextRestored", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92639,7 +92855,7 @@ "return": null }, { - "__docId__": 4633, + "__docId__": 4641, "kind": "method", "name": "_makeDrawHash", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92660,7 +92876,7 @@ } }, { - "__docId__": 4634, + "__docId__": 4642, "kind": "method", "name": "_makePickHash", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92681,7 +92897,7 @@ } }, { - "__docId__": 4635, + "__docId__": 4643, "kind": "method", "name": "_makeOcclusionHash", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92702,7 +92918,7 @@ } }, { - "__docId__": 4636, + "__docId__": 4644, "kind": "method", "name": "_buildAABB", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92732,7 +92948,7 @@ "return": null }, { - "__docId__": 4637, + "__docId__": 4645, "kind": "method", "name": "rotate", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92772,7 +92988,7 @@ } }, { - "__docId__": 4639, + "__docId__": 4647, "kind": "method", "name": "rotateOnWorldAxis", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92812,7 +93028,7 @@ } }, { - "__docId__": 4640, + "__docId__": 4648, "kind": "method", "name": "rotateX", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92842,7 +93058,7 @@ } }, { - "__docId__": 4641, + "__docId__": 4649, "kind": "method", "name": "rotateY", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92872,7 +93088,7 @@ } }, { - "__docId__": 4642, + "__docId__": 4650, "kind": "method", "name": "rotateZ", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92902,7 +93118,7 @@ } }, { - "__docId__": 4643, + "__docId__": 4651, "kind": "method", "name": "translate", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92942,7 +93158,7 @@ } }, { - "__docId__": 4644, + "__docId__": 4652, "kind": "method", "name": "translateX", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -92972,7 +93188,7 @@ } }, { - "__docId__": 4645, + "__docId__": 4653, "kind": "method", "name": "translateY", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93002,7 +93218,7 @@ } }, { - "__docId__": 4646, + "__docId__": 4654, "kind": "method", "name": "translateZ", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93032,7 +93248,7 @@ } }, { - "__docId__": 4647, + "__docId__": 4655, "kind": "method", "name": "_putDrawRenderers", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93049,7 +93265,7 @@ "return": null }, { - "__docId__": 4652, + "__docId__": 4660, "kind": "method", "name": "_putPickRenderers", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93066,7 +93282,7 @@ "return": null }, { - "__docId__": 4655, + "__docId__": 4663, "kind": "method", "name": "_putOcclusionRenderer", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93083,7 +93299,7 @@ "return": null }, { - "__docId__": 4657, + "__docId__": 4665, "kind": "method", "name": "stateSortCompare", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93132,7 +93348,7 @@ } }, { - "__docId__": 4658, + "__docId__": 4666, "kind": "method", "name": "rebuildRenderFlags", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93148,7 +93364,7 @@ "return": null }, { - "__docId__": 4659, + "__docId__": 4667, "kind": "method", "name": "_updateRenderFlags", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93164,7 +93380,7 @@ "return": null }, { - "__docId__": 4660, + "__docId__": 4668, "kind": "method", "name": "_getActiveSectionPlanes", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93185,7 +93401,7 @@ } }, { - "__docId__": 4661, + "__docId__": 4669, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93208,7 +93424,7 @@ "return": null }, { - "__docId__": 4662, + "__docId__": 4670, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93231,7 +93447,7 @@ "return": null }, { - "__docId__": 4663, + "__docId__": 4671, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93254,7 +93470,7 @@ "return": null }, { - "__docId__": 4664, + "__docId__": 4672, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93277,7 +93493,7 @@ "return": null }, { - "__docId__": 4665, + "__docId__": 4673, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93300,7 +93516,7 @@ "return": null }, { - "__docId__": 4666, + "__docId__": 4674, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93323,7 +93539,7 @@ "return": null }, { - "__docId__": 4667, + "__docId__": 4675, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93346,7 +93562,7 @@ "return": null }, { - "__docId__": 4668, + "__docId__": 4676, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93369,7 +93585,7 @@ "return": null }, { - "__docId__": 4669, + "__docId__": 4677, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93392,7 +93608,7 @@ "return": null }, { - "__docId__": 4670, + "__docId__": 4678, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93415,7 +93631,7 @@ "return": null }, { - "__docId__": 4671, + "__docId__": 4679, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93438,7 +93654,7 @@ "return": null }, { - "__docId__": 4672, + "__docId__": 4680, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93461,7 +93677,7 @@ "return": null }, { - "__docId__": 4673, + "__docId__": 4681, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93484,7 +93700,7 @@ "return": null }, { - "__docId__": 4674, + "__docId__": 4682, "kind": "method", "name": "canPickTriangle", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93504,7 +93720,7 @@ } }, { - "__docId__": 4675, + "__docId__": 4683, "kind": "method", "name": "drawPickTriangles", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93527,7 +93743,7 @@ "return": null }, { - "__docId__": 4676, + "__docId__": 4684, "kind": "method", "name": "pickTriangleSurface", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93562,7 +93778,7 @@ "return": null }, { - "__docId__": 4677, + "__docId__": 4685, "kind": "method", "name": "drawPickVertices", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93585,7 +93801,7 @@ "return": null }, { - "__docId__": 4678, + "__docId__": 4686, "kind": "method", "name": "delegatePickedEntity", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93614,7 +93830,7 @@ "params": [] }, { - "__docId__": 4679, + "__docId__": 4687, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/mesh/Mesh.js~Mesh", @@ -93629,18 +93845,18 @@ "return": null }, { - "__docId__": 4680, + "__docId__": 4688, "kind": "file", "name": "src/viewer/scene/mesh/draw/DrawRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {Map} from \"../../utils/Map.js\";\nimport {DrawShaderSource} from \"./DrawShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from '../../stats.js';\nimport {WEBGL_INFO} from '../../webglInfo.js';\nimport {math} from \"../../math/math.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\n\nconst ids = new Map({});\n\n/**\n * @private\n */\nconst DrawRenderer = function (hash, mesh) {\n this.id = ids.addItem({});\n this._hash = hash;\n this._scene = mesh.scene;\n this._useCount = 0;\n this._shaderSource = new DrawShaderSource(mesh);\n this._allocate(mesh);\n};\n\nconst drawRenderers = {};\n\nDrawRenderer.get = function (mesh) {\n const scene = mesh.scene;\n const hash = [\n scene.canvas.canvas.id,\n (scene.gammaInput ? \"gi;\" : \";\") + (scene.gammaOutput ? \"go\" : \"\"),\n scene._lightsState.getHash(),\n scene._sectionPlanesState.getHash(),\n mesh._geometry._state.hash,\n mesh._material._state.hash,\n mesh._state.drawHash\n ].join(\";\");\n let renderer = drawRenderers[hash];\n if (!renderer) {\n renderer = new DrawRenderer(hash, mesh);\n if (renderer.errors) {\n console.log(renderer.errors.join(\"\\n\"));\n return null;\n }\n drawRenderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nDrawRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n ids.removeItem(this.id);\n if (this._program) {\n this._program.destroy();\n }\n delete drawRenderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nDrawRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nDrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const maxTextureUnits = WEBGL_INFO.MAX_TEXTURE_UNITS;\n const scene = mesh.scene;\n const material = mesh._material;\n const gl = scene.canvas.gl;\n const program = this._program;\n const meshState = mesh._state;\n const materialState = mesh._material._state;\n const geometryState = mesh._geometry._state;\n const camera = scene.camera;\n const origin = mesh.origin;\n const background = meshState.background;\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n if (background) {\n gl.depthFunc(gl.LEQUAL);\n }\n this._bindProgram(frameCtx);\n }\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);\n gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n if (materialState.id !== this._lastMaterialId) {\n\n frameCtx.textureUnit = this._baseTextureUnit;\n\n const backfaces = materialState.backfaces;\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n\n const frontface = materialState.frontface;\n if (frameCtx.frontface !== frontface) {\n if (frontface) {\n gl.frontFace(gl.CCW);\n } else {\n gl.frontFace(gl.CW);\n }\n frameCtx.frontface = frontface;\n }\n\n if (frameCtx.lineWidth !== materialState.lineWidth) {\n gl.lineWidth(materialState.lineWidth);\n frameCtx.lineWidth = materialState.lineWidth;\n }\n\n if (this._uPointSize) {\n gl.uniform1f(this._uPointSize, materialState.pointSize);\n }\n\n switch (materialState.type) {\n case \"LambertMaterial\":\n if (this._uMaterialAmbient) {\n gl.uniform3fv(this._uMaterialAmbient, materialState.ambient);\n }\n if (this._uMaterialColor) {\n gl.uniform4f(this._uMaterialColor, materialState.color[0], materialState.color[1], materialState.color[2], materialState.alpha);\n }\n if (this._uMaterialEmissive) {\n gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);\n }\n break;\n\n case \"PhongMaterial\":\n if (this._uMaterialShininess) {\n gl.uniform1f(this._uMaterialShininess, materialState.shininess);\n }\n if (this._uMaterialAmbient) {\n gl.uniform3fv(this._uMaterialAmbient, materialState.ambient);\n }\n if (this._uMaterialDiffuse) {\n gl.uniform3fv(this._uMaterialDiffuse, materialState.diffuse);\n }\n if (this._uMaterialSpecular) {\n gl.uniform3fv(this._uMaterialSpecular, materialState.specular);\n }\n if (this._uMaterialEmissive) {\n gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);\n }\n if (this._uAlphaModeCutoff) {\n gl.uniform4f(\n this._uAlphaModeCutoff,\n 1.0 * materialState.alpha,\n materialState.alphaMode === 1 ? 1.0 : 0.0,\n materialState.alphaCutoff,\n 0);\n }\n if (material._ambientMap && material._ambientMap._state.texture && this._uMaterialAmbientMap) {\n program.bindTexture(this._uMaterialAmbientMap, material._ambientMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uMaterialAmbientMapMatrix) {\n gl.uniformMatrix4fv(this._uMaterialAmbientMapMatrix, false, material._ambientMap._state.matrix);\n }\n }\n if (material._diffuseMap && material._diffuseMap._state.texture && this._uDiffuseMap) {\n program.bindTexture(this._uDiffuseMap, material._diffuseMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uDiffuseMapMatrix) {\n gl.uniformMatrix4fv(this._uDiffuseMapMatrix, false, material._diffuseMap._state.matrix);\n }\n }\n if (material._specularMap && material._specularMap._state.texture && this._uSpecularMap) {\n program.bindTexture(this._uSpecularMap, material._specularMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uSpecularMapMatrix) {\n gl.uniformMatrix4fv(this._uSpecularMapMatrix, false, material._specularMap._state.matrix);\n }\n }\n if (material._emissiveMap && material._emissiveMap._state.texture && this._uEmissiveMap) {\n program.bindTexture(this._uEmissiveMap, material._emissiveMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uEmissiveMapMatrix) {\n gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, material._emissiveMap._state.matrix);\n }\n }\n if (material._alphaMap && material._alphaMap._state.texture && this._uAlphaMap) {\n program.bindTexture(this._uAlphaMap, material._alphaMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uAlphaMapMatrix) {\n gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, material._alphaMap._state.matrix);\n }\n }\n if (material._reflectivityMap && material._reflectivityMap._state.texture && this._uReflectivityMap) {\n program.bindTexture(this._uReflectivityMap, material._reflectivityMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n if (this._uReflectivityMapMatrix) {\n gl.uniformMatrix4fv(this._uReflectivityMapMatrix, false, material._reflectivityMap._state.matrix);\n }\n }\n if (material._normalMap && material._normalMap._state.texture && this._uNormalMap) {\n program.bindTexture(this._uNormalMap, material._normalMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uNormalMapMatrix) {\n gl.uniformMatrix4fv(this._uNormalMapMatrix, false, material._normalMap._state.matrix);\n }\n }\n if (material._occlusionMap && material._occlusionMap._state.texture && this._uOcclusionMap) {\n program.bindTexture(this._uOcclusionMap, material._occlusionMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uOcclusionMapMatrix) {\n gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, material._occlusionMap._state.matrix);\n }\n }\n if (material._diffuseFresnel) {\n if (this._uDiffuseFresnelEdgeBias) {\n gl.uniform1f(this._uDiffuseFresnelEdgeBias, material._diffuseFresnel.edgeBias);\n }\n if (this._uDiffuseFresnelCenterBias) {\n gl.uniform1f(this._uDiffuseFresnelCenterBias, material._diffuseFresnel.centerBias);\n }\n if (this._uDiffuseFresnelEdgeColor) {\n gl.uniform3fv(this._uDiffuseFresnelEdgeColor, material._diffuseFresnel.edgeColor);\n }\n if (this._uDiffuseFresnelCenterColor) {\n gl.uniform3fv(this._uDiffuseFresnelCenterColor, material._diffuseFresnel.centerColor);\n }\n if (this._uDiffuseFresnelPower) {\n gl.uniform1f(this._uDiffuseFresnelPower, material._diffuseFresnel.power);\n }\n }\n if (material._specularFresnel) {\n if (this._uSpecularFresnelEdgeBias) {\n gl.uniform1f(this._uSpecularFresnelEdgeBias, material._specularFresnel.edgeBias);\n }\n if (this._uSpecularFresnelCenterBias) {\n gl.uniform1f(this._uSpecularFresnelCenterBias, material._specularFresnel.centerBias);\n }\n if (this._uSpecularFresnelEdgeColor) {\n gl.uniform3fv(this._uSpecularFresnelEdgeColor, material._specularFresnel.edgeColor);\n }\n if (this._uSpecularFresnelCenterColor) {\n gl.uniform3fv(this._uSpecularFresnelCenterColor, material._specularFresnel.centerColor);\n }\n if (this._uSpecularFresnelPower) {\n gl.uniform1f(this._uSpecularFresnelPower, material._specularFresnel.power);\n }\n }\n if (material._alphaFresnel) {\n if (this._uAlphaFresnelEdgeBias) {\n gl.uniform1f(this._uAlphaFresnelEdgeBias, material._alphaFresnel.edgeBias);\n }\n if (this._uAlphaFresnelCenterBias) {\n gl.uniform1f(this._uAlphaFresnelCenterBias, material._alphaFresnel.centerBias);\n }\n if (this._uAlphaFresnelEdgeColor) {\n gl.uniform3fv(this._uAlphaFresnelEdgeColor, material._alphaFresnel.edgeColor);\n }\n if (this._uAlphaFresnelCenterColor) {\n gl.uniform3fv(this._uAlphaFresnelCenterColor, material._alphaFresnel.centerColor);\n }\n if (this._uAlphaFresnelPower) {\n gl.uniform1f(this._uAlphaFresnelPower, material._alphaFresnel.power);\n }\n }\n if (material._reflectivityFresnel) {\n if (this._uReflectivityFresnelEdgeBias) {\n gl.uniform1f(this._uReflectivityFresnelEdgeBias, material._reflectivityFresnel.edgeBias);\n }\n if (this._uReflectivityFresnelCenterBias) {\n gl.uniform1f(this._uReflectivityFresnelCenterBias, material._reflectivityFresnel.centerBias);\n }\n if (this._uReflectivityFresnelEdgeColor) {\n gl.uniform3fv(this._uReflectivityFresnelEdgeColor, material._reflectivityFresnel.edgeColor);\n }\n if (this._uReflectivityFresnelCenterColor) {\n gl.uniform3fv(this._uReflectivityFresnelCenterColor, material._reflectivityFresnel.centerColor);\n }\n if (this._uReflectivityFresnelPower) {\n gl.uniform1f(this._uReflectivityFresnelPower, material._reflectivityFresnel.power);\n }\n }\n if (material._emissiveFresnel) {\n if (this._uEmissiveFresnelEdgeBias) {\n gl.uniform1f(this._uEmissiveFresnelEdgeBias, material._emissiveFresnel.edgeBias);\n }\n if (this._uEmissiveFresnelCenterBias) {\n gl.uniform1f(this._uEmissiveFresnelCenterBias, material._emissiveFresnel.centerBias);\n }\n if (this._uEmissiveFresnelEdgeColor) {\n gl.uniform3fv(this._uEmissiveFresnelEdgeColor, material._emissiveFresnel.edgeColor);\n }\n if (this._uEmissiveFresnelCenterColor) {\n gl.uniform3fv(this._uEmissiveFresnelCenterColor, material._emissiveFresnel.centerColor);\n }\n if (this._uEmissiveFresnelPower) {\n gl.uniform1f(this._uEmissiveFresnelPower, material._emissiveFresnel.power);\n }\n }\n break;\n\n case \"MetallicMaterial\":\n if (this._uBaseColor) {\n gl.uniform3fv(this._uBaseColor, materialState.baseColor);\n }\n if (this._uMaterialMetallic) {\n gl.uniform1f(this._uMaterialMetallic, materialState.metallic);\n }\n if (this._uMaterialRoughness) {\n gl.uniform1f(this._uMaterialRoughness, materialState.roughness);\n }\n if (this._uMaterialSpecularF0) {\n gl.uniform1f(this._uMaterialSpecularF0, materialState.specularF0);\n }\n if (this._uMaterialEmissive) {\n gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);\n }\n if (this._uAlphaModeCutoff) {\n gl.uniform4f(\n this._uAlphaModeCutoff,\n 1.0 * materialState.alpha,\n materialState.alphaMode === 1 ? 1.0 : 0.0,\n materialState.alphaCutoff,\n 0.0);\n }\n const baseColorMap = material._baseColorMap;\n if (baseColorMap && baseColorMap._state.texture && this._uBaseColorMap) {\n program.bindTexture(this._uBaseColorMap, baseColorMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uBaseColorMapMatrix) {\n gl.uniformMatrix4fv(this._uBaseColorMapMatrix, false, baseColorMap._state.matrix);\n }\n }\n const metallicMap = material._metallicMap;\n if (metallicMap && metallicMap._state.texture && this._uMetallicMap) {\n program.bindTexture(this._uMetallicMap, metallicMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uMetallicMapMatrix) {\n gl.uniformMatrix4fv(this._uMetallicMapMatrix, false, metallicMap._state.matrix);\n }\n }\n const roughnessMap = material._roughnessMap;\n if (roughnessMap && roughnessMap._state.texture && this._uRoughnessMap) {\n program.bindTexture(this._uRoughnessMap, roughnessMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uRoughnessMapMatrix) {\n gl.uniformMatrix4fv(this._uRoughnessMapMatrix, false, roughnessMap._state.matrix);\n }\n }\n const metallicRoughnessMap = material._metallicRoughnessMap;\n if (metallicRoughnessMap && metallicRoughnessMap._state.texture && this._uMetallicRoughnessMap) {\n program.bindTexture(this._uMetallicRoughnessMap, metallicRoughnessMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uMetallicRoughnessMapMatrix) {\n gl.uniformMatrix4fv(this._uMetallicRoughnessMapMatrix, false, metallicRoughnessMap._state.matrix);\n }\n }\n var emissiveMap = material._emissiveMap;\n if (emissiveMap && emissiveMap._state.texture && this._uEmissiveMap) {\n program.bindTexture(this._uEmissiveMap, emissiveMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uEmissiveMapMatrix) {\n gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, emissiveMap._state.matrix);\n }\n }\n var occlusionMap = material._occlusionMap;\n if (occlusionMap && material._occlusionMap._state.texture && this._uOcclusionMap) {\n program.bindTexture(this._uOcclusionMap, occlusionMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uOcclusionMapMatrix) {\n gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, occlusionMap._state.matrix);\n }\n }\n var alphaMap = material._alphaMap;\n if (alphaMap && alphaMap._state.texture && this._uAlphaMap) {\n program.bindTexture(this._uAlphaMap, alphaMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uAlphaMapMatrix) {\n gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, alphaMap._state.matrix);\n }\n }\n var normalMap = material._normalMap;\n if (normalMap && normalMap._state.texture && this._uNormalMap) {\n program.bindTexture(this._uNormalMap, normalMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uNormalMapMatrix) {\n gl.uniformMatrix4fv(this._uNormalMapMatrix, false, normalMap._state.matrix);\n }\n }\n break;\n\n case \"SpecularMaterial\":\n if (this._uMaterialDiffuse) {\n gl.uniform3fv(this._uMaterialDiffuse, materialState.diffuse);\n }\n if (this._uMaterialSpecular) {\n gl.uniform3fv(this._uMaterialSpecular, materialState.specular);\n }\n if (this._uMaterialGlossiness) {\n gl.uniform1f(this._uMaterialGlossiness, materialState.glossiness);\n }\n if (this._uMaterialReflectivity) {\n gl.uniform1f(this._uMaterialReflectivity, materialState.reflectivity);\n }\n if (this._uMaterialEmissive) {\n gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);\n }\n if (this._uAlphaModeCutoff) {\n gl.uniform4f(\n this._uAlphaModeCutoff,\n 1.0 * materialState.alpha,\n materialState.alphaMode === 1 ? 1.0 : 0.0,\n materialState.alphaCutoff,\n 0.0);\n }\n const diffuseMap = material._diffuseMap;\n if (diffuseMap && diffuseMap._state.texture && this._uDiffuseMap) {\n program.bindTexture(this._uDiffuseMap, diffuseMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uDiffuseMapMatrix) {\n gl.uniformMatrix4fv(this._uDiffuseMapMatrix, false, diffuseMap._state.matrix);\n }\n }\n const specularMap = material._specularMap;\n if (specularMap && specularMap._state.texture && this._uSpecularMap) {\n program.bindTexture(this._uSpecularMap, specularMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uSpecularMapMatrix) {\n gl.uniformMatrix4fv(this._uSpecularMapMatrix, false, specularMap._state.matrix);\n }\n }\n const glossinessMap = material._glossinessMap;\n if (glossinessMap && glossinessMap._state.texture && this._uGlossinessMap) {\n program.bindTexture(this._uGlossinessMap, glossinessMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uGlossinessMapMatrix) {\n gl.uniformMatrix4fv(this._uGlossinessMapMatrix, false, glossinessMap._state.matrix);\n }\n }\n const specularGlossinessMap = material._specularGlossinessMap;\n if (specularGlossinessMap && specularGlossinessMap._state.texture && this._uSpecularGlossinessMap) {\n program.bindTexture(this._uSpecularGlossinessMap, specularGlossinessMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uSpecularGlossinessMapMatrix) {\n gl.uniformMatrix4fv(this._uSpecularGlossinessMapMatrix, false, specularGlossinessMap._state.matrix);\n }\n }\n var emissiveMap = material._emissiveMap;\n if (emissiveMap && emissiveMap._state.texture && this._uEmissiveMap) {\n program.bindTexture(this._uEmissiveMap, emissiveMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uEmissiveMapMatrix) {\n gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, emissiveMap._state.matrix);\n }\n }\n var occlusionMap = material._occlusionMap;\n if (occlusionMap && occlusionMap._state.texture && this._uOcclusionMap) {\n program.bindTexture(this._uOcclusionMap, occlusionMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uOcclusionMapMatrix) {\n gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, occlusionMap._state.matrix);\n }\n }\n var alphaMap = material._alphaMap;\n if (alphaMap && alphaMap._state.texture && this._uAlphaMap) {\n program.bindTexture(this._uAlphaMap, alphaMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uAlphaMapMatrix) {\n gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, alphaMap._state.matrix);\n }\n }\n var normalMap = material._normalMap;\n if (normalMap && normalMap._state.texture && this._uNormalMap) {\n program.bindTexture(this._uNormalMap, normalMap._state.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n if (this._uNormalMapMatrix) {\n gl.uniformMatrix4fv(this._uNormalMapMatrix, false, normalMap._state.matrix);\n }\n }\n break;\n }\n this._lastMaterialId = materialState.id;\n }\n\n gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);\n if (this._uModelNormalMatrix) {\n gl.uniformMatrix4fv(this._uModelNormalMatrix, gl.FALSE, mesh.worldNormalMatrix);\n }\n\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, meshState.clippable);\n }\n\n if (this._uColorize) {\n const colorize = meshState.colorize;\n const lastColorize = this._lastColorize;\n if (lastColorize[0] !== colorize[0] ||\n lastColorize[1] !== colorize[1] ||\n lastColorize[2] !== colorize[2] ||\n lastColorize[3] !== colorize[3]) {\n gl.uniform4fv(this._uColorize, colorize);\n lastColorize[0] = colorize[0];\n lastColorize[1] = colorize[1];\n lastColorize[2] = colorize[2];\n lastColorize[3] = colorize[3];\n }\n }\n\n gl.uniform3fv(this._uOffset, meshState.offset);\n\n // Bind VBOs\n\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (this._uUVDecodeMatrix) {\n gl.uniformMatrix3fv(this._uUVDecodeMatrix, false, geometryState.uvDecodeMatrix);\n }\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf);\n frameCtx.bindArray++;\n }\n if (this._aNormal) {\n this._aNormal.bindArrayBuffer(geometryState.normalsBuf);\n frameCtx.bindArray++;\n }\n if (this._aUV) {\n this._aUV.bindArrayBuffer(geometryState.uvBuf);\n frameCtx.bindArray++;\n }\n if (this._aColor) {\n this._aColor.bindArrayBuffer(geometryState.colorsBuf);\n frameCtx.bindArray++;\n }\n if (this._aFlags) {\n this._aFlags.bindArrayBuffer(geometryState.flagsBuf);\n frameCtx.bindArray++;\n }\n if (geometryState.indicesBuf) {\n geometryState.indicesBuf.bind();\n frameCtx.bindArray++;\n }\n this._lastGeometryId = geometryState.id;\n }\n\n // Draw (indices bound in prev step)\n\n if (geometryState.indicesBuf) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n frameCtx.drawElements++;\n } else if (geometryState.positions) {\n gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);\n frameCtx.drawArrays++;\n }\n\n if (background) {\n gl.depthFunc(gl.LESS);\n }\n};\n\nDrawRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n const material = mesh._material;\n const lightsState = scene._lightsState;\n const sectionPlanesState = scene._sectionPlanesState;\n const materialState = mesh._material._state;\n\n this._program = new Program(gl, this._shaderSource);\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uUVDecodeMatrix = program.getLocation(\"uvDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uModelNormalMatrix = program.getLocation(\"modelNormalMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uViewNormalMatrix = program.getLocation(\"viewNormalMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uGammaFactor = program.getLocation(\"gammaFactor\");\n this._uLightAmbient = [];\n this._uLightColor = [];\n this._uLightDir = [];\n this._uLightPos = [];\n this._uLightAttenuation = [];\n this._uShadowViewMatrix = [];\n this._uShadowProjMatrix = [];\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n const lights = lightsState.lights;\n let light;\n\n for (var i = 0, len = lights.length; i < len; i++) {\n light = lights[i];\n switch (light.type) {\n\n case \"ambient\":\n this._uLightAmbient[i] = program.getLocation(\"lightAmbient\");\n break;\n\n case \"dir\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = null;\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n break;\n\n case \"point\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = null;\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n\n case \"spot\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n }\n\n if (light.castsShadow) {\n this._uShadowViewMatrix[i] = program.getLocation(\"shadowViewMatrix\" + i);\n this._uShadowProjMatrix[i] = program.getLocation(\"shadowProjMatrix\" + i);\n }\n }\n\n if (lightsState.lightMaps.length > 0) {\n this._uLightMap = \"lightMap\";\n }\n\n if (lightsState.reflectionMaps.length > 0) {\n this._uReflectionMap = \"reflectionMap\";\n }\n\n this._uSectionPlanes = [];\n const sectionPlanes = sectionPlanesState.sectionPlanes;\n for (var i = 0, len = sectionPlanes.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n this._uPointSize = program.getLocation(\"pointSize\");\n\n switch (materialState.type) {\n case \"LambertMaterial\":\n this._uMaterialColor = program.getLocation(\"materialColor\");\n this._uMaterialEmissive = program.getLocation(\"materialEmissive\");\n this._uAlphaModeCutoff = program.getLocation(\"materialAlphaModeCutoff\");\n break;\n\n case \"PhongMaterial\":\n this._uMaterialAmbient = program.getLocation(\"materialAmbient\");\n this._uMaterialDiffuse = program.getLocation(\"materialDiffuse\");\n this._uMaterialSpecular = program.getLocation(\"materialSpecular\");\n this._uMaterialEmissive = program.getLocation(\"materialEmissive\");\n this._uAlphaModeCutoff = program.getLocation(\"materialAlphaModeCutoff\");\n this._uMaterialShininess = program.getLocation(\"materialShininess\");\n if (material._ambientMap) {\n this._uMaterialAmbientMap = \"ambientMap\";\n this._uMaterialAmbientMapMatrix = program.getLocation(\"ambientMapMatrix\");\n }\n if (material._diffuseMap) {\n this._uDiffuseMap = \"diffuseMap\";\n this._uDiffuseMapMatrix = program.getLocation(\"diffuseMapMatrix\");\n }\n if (material._specularMap) {\n this._uSpecularMap = \"specularMap\";\n this._uSpecularMapMatrix = program.getLocation(\"specularMapMatrix\");\n }\n if (material._emissiveMap) {\n this._uEmissiveMap = \"emissiveMap\";\n this._uEmissiveMapMatrix = program.getLocation(\"emissiveMapMatrix\");\n }\n if (material._alphaMap) {\n this._uAlphaMap = \"alphaMap\";\n this._uAlphaMapMatrix = program.getLocation(\"alphaMapMatrix\");\n }\n if (material._reflectivityMap) {\n this._uReflectivityMap = \"reflectivityMap\";\n this._uReflectivityMapMatrix = program.getLocation(\"reflectivityMapMatrix\");\n }\n if (material._normalMap) {\n this._uNormalMap = \"normalMap\";\n this._uNormalMapMatrix = program.getLocation(\"normalMapMatrix\");\n }\n if (material._occlusionMap) {\n this._uOcclusionMap = \"occlusionMap\";\n this._uOcclusionMapMatrix = program.getLocation(\"occlusionMapMatrix\");\n }\n if (material._diffuseFresnel) {\n this._uDiffuseFresnelEdgeBias = program.getLocation(\"diffuseFresnelEdgeBias\");\n this._uDiffuseFresnelCenterBias = program.getLocation(\"diffuseFresnelCenterBias\");\n this._uDiffuseFresnelEdgeColor = program.getLocation(\"diffuseFresnelEdgeColor\");\n this._uDiffuseFresnelCenterColor = program.getLocation(\"diffuseFresnelCenterColor\");\n this._uDiffuseFresnelPower = program.getLocation(\"diffuseFresnelPower\");\n }\n if (material._specularFresnel) {\n this._uSpecularFresnelEdgeBias = program.getLocation(\"specularFresnelEdgeBias\");\n this._uSpecularFresnelCenterBias = program.getLocation(\"specularFresnelCenterBias\");\n this._uSpecularFresnelEdgeColor = program.getLocation(\"specularFresnelEdgeColor\");\n this._uSpecularFresnelCenterColor = program.getLocation(\"specularFresnelCenterColor\");\n this._uSpecularFresnelPower = program.getLocation(\"specularFresnelPower\");\n }\n if (material._alphaFresnel) {\n this._uAlphaFresnelEdgeBias = program.getLocation(\"alphaFresnelEdgeBias\");\n this._uAlphaFresnelCenterBias = program.getLocation(\"alphaFresnelCenterBias\");\n this._uAlphaFresnelEdgeColor = program.getLocation(\"alphaFresnelEdgeColor\");\n this._uAlphaFresnelCenterColor = program.getLocation(\"alphaFresnelCenterColor\");\n this._uAlphaFresnelPower = program.getLocation(\"alphaFresnelPower\");\n }\n if (material._reflectivityFresnel) {\n this._uReflectivityFresnelEdgeBias = program.getLocation(\"reflectivityFresnelEdgeBias\");\n this._uReflectivityFresnelCenterBias = program.getLocation(\"reflectivityFresnelCenterBias\");\n this._uReflectivityFresnelEdgeColor = program.getLocation(\"reflectivityFresnelEdgeColor\");\n this._uReflectivityFresnelCenterColor = program.getLocation(\"reflectivityFresnelCenterColor\");\n this._uReflectivityFresnelPower = program.getLocation(\"reflectivityFresnelPower\");\n }\n if (material._emissiveFresnel) {\n this._uEmissiveFresnelEdgeBias = program.getLocation(\"emissiveFresnelEdgeBias\");\n this._uEmissiveFresnelCenterBias = program.getLocation(\"emissiveFresnelCenterBias\");\n this._uEmissiveFresnelEdgeColor = program.getLocation(\"emissiveFresnelEdgeColor\");\n this._uEmissiveFresnelCenterColor = program.getLocation(\"emissiveFresnelCenterColor\");\n this._uEmissiveFresnelPower = program.getLocation(\"emissiveFresnelPower\");\n }\n break;\n\n case \"MetallicMaterial\":\n this._uBaseColor = program.getLocation(\"materialBaseColor\");\n this._uMaterialMetallic = program.getLocation(\"materialMetallic\");\n this._uMaterialRoughness = program.getLocation(\"materialRoughness\");\n this._uMaterialSpecularF0 = program.getLocation(\"materialSpecularF0\");\n this._uMaterialEmissive = program.getLocation(\"materialEmissive\");\n this._uAlphaModeCutoff = program.getLocation(\"materialAlphaModeCutoff\");\n if (material._baseColorMap) {\n this._uBaseColorMap = \"baseColorMap\";\n this._uBaseColorMapMatrix = program.getLocation(\"baseColorMapMatrix\");\n }\n if (material._metallicMap) {\n this._uMetallicMap = \"metallicMap\";\n this._uMetallicMapMatrix = program.getLocation(\"metallicMapMatrix\");\n }\n if (material._roughnessMap) {\n this._uRoughnessMap = \"roughnessMap\";\n this._uRoughnessMapMatrix = program.getLocation(\"roughnessMapMatrix\");\n }\n if (material._metallicRoughnessMap) {\n this._uMetallicRoughnessMap = \"metallicRoughnessMap\";\n this._uMetallicRoughnessMapMatrix = program.getLocation(\"metallicRoughnessMapMatrix\");\n }\n if (material._emissiveMap) {\n this._uEmissiveMap = \"emissiveMap\";\n this._uEmissiveMapMatrix = program.getLocation(\"emissiveMapMatrix\");\n }\n if (material._occlusionMap) {\n this._uOcclusionMap = \"occlusionMap\";\n this._uOcclusionMapMatrix = program.getLocation(\"occlusionMapMatrix\");\n }\n if (material._alphaMap) {\n this._uAlphaMap = \"alphaMap\";\n this._uAlphaMapMatrix = program.getLocation(\"alphaMapMatrix\");\n }\n if (material._normalMap) {\n this._uNormalMap = \"normalMap\";\n this._uNormalMapMatrix = program.getLocation(\"normalMapMatrix\");\n }\n break;\n\n case \"SpecularMaterial\":\n this._uMaterialDiffuse = program.getLocation(\"materialDiffuse\");\n this._uMaterialSpecular = program.getLocation(\"materialSpecular\");\n this._uMaterialGlossiness = program.getLocation(\"materialGlossiness\");\n this._uMaterialReflectivity = program.getLocation(\"reflectivityFresnel\");\n this._uMaterialEmissive = program.getLocation(\"materialEmissive\");\n this._uAlphaModeCutoff = program.getLocation(\"materialAlphaModeCutoff\");\n if (material._diffuseMap) {\n this._uDiffuseMap = \"diffuseMap\";\n this._uDiffuseMapMatrix = program.getLocation(\"diffuseMapMatrix\");\n }\n if (material._specularMap) {\n this._uSpecularMap = \"specularMap\";\n this._uSpecularMapMatrix = program.getLocation(\"specularMapMatrix\");\n }\n if (material._glossinessMap) {\n this._uGlossinessMap = \"glossinessMap\";\n this._uGlossinessMapMatrix = program.getLocation(\"glossinessMapMatrix\");\n }\n if (material._specularGlossinessMap) {\n this._uSpecularGlossinessMap = \"materialSpecularGlossinessMap\";\n this._uSpecularGlossinessMapMatrix = program.getLocation(\"materialSpecularGlossinessMapMatrix\");\n }\n if (material._emissiveMap) {\n this._uEmissiveMap = \"emissiveMap\";\n this._uEmissiveMapMatrix = program.getLocation(\"emissiveMapMatrix\");\n }\n if (material._occlusionMap) {\n this._uOcclusionMap = \"occlusionMap\";\n this._uOcclusionMapMatrix = program.getLocation(\"occlusionMapMatrix\");\n }\n if (material._alphaMap) {\n this._uAlphaMap = \"alphaMap\";\n this._uAlphaMapMatrix = program.getLocation(\"alphaMapMatrix\");\n }\n if (material._normalMap) {\n this._uNormalMap = \"normalMap\";\n this._uNormalMapMatrix = program.getLocation(\"normalMapMatrix\");\n }\n break;\n }\n\n this._aPosition = program.getAttribute(\"position\");\n this._aNormal = program.getAttribute(\"normal\");\n this._aUV = program.getAttribute(\"uv\");\n this._aColor = program.getAttribute(\"color\");\n this._aFlags = program.getAttribute(\"flags\");\n\n this._uClippable = program.getLocation(\"clippable\");\n this._uColorize = program.getLocation(\"colorize\");\n this._uOffset = program.getLocation(\"offset\");\n\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n\n this._lastColorize = new Float32Array(4);\n\n this._baseTextureUnit = 0;\n\n};\n\nDrawRenderer.prototype._bindProgram = function (frameCtx) {\n\n const maxTextureUnits = WEBGL_INFO.MAX_TEXTURE_UNITS;\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const lightsState = scene._lightsState;\n const project = scene.camera.project;\n let light;\n\n const program = this._program;\n\n program.bind();\n\n frameCtx.useProgram++;\n frameCtx.textureUnit = 0;\n\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n\n this._lastColorize[0] = -1;\n this._lastColorize[1] = -1;\n this._lastColorize[2] = -1;\n this._lastColorize[3] = -1;\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n for (var i = 0, len = lightsState.lights.length; i < len; i++) {\n\n light = lightsState.lights[i];\n\n if (this._uLightAmbient[i]) {\n gl.uniform4f(this._uLightAmbient[i], light.color[0], light.color[1], light.color[2], light.intensity);\n\n } else {\n\n if (this._uLightColor[i]) {\n gl.uniform4f(this._uLightColor[i], light.color[0], light.color[1], light.color[2], light.intensity);\n }\n\n if (this._uLightPos[i]) {\n gl.uniform3fv(this._uLightPos[i], light.pos);\n if (this._uLightAttenuation[i]) {\n gl.uniform1f(this._uLightAttenuation[i], light.attenuation);\n }\n }\n\n if (this._uLightDir[i]) {\n gl.uniform3fv(this._uLightDir[i], light.dir);\n }\n\n if (light.castsShadow) {\n if (this._uShadowViewMatrix[i]) {\n gl.uniformMatrix4fv(this._uShadowViewMatrix[i], false, light.getShadowViewMatrix());\n }\n if (this._uShadowProjMatrix[i]) {\n gl.uniformMatrix4fv(this._uShadowProjMatrix[i], false, light.getShadowProjMatrix());\n }\n const shadowRenderBuf = light.getShadowRenderBuf();\n if (shadowRenderBuf) {\n program.bindTexture(\"shadowMap\" + i, shadowRenderBuf.getTexture(), frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n }\n }\n }\n\n if (lightsState.lightMaps.length > 0 && lightsState.lightMaps[0].texture && this._uLightMap) {\n program.bindTexture(this._uLightMap, lightsState.lightMaps[0].texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n\n if (lightsState.reflectionMaps.length > 0 && lightsState.reflectionMaps[0].texture && this._uReflectionMap) {\n program.bindTexture(this._uReflectionMap, lightsState.reflectionMaps[0].texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n\n if (this._uGammaFactor) {\n gl.uniform1f(this._uGammaFactor, scene.gammaFactor);\n }\n\n this._baseTextureUnit = frameCtx.textureUnit;\n};\n\nexport {DrawRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/draw/DrawRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/draw/DrawRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4681, + "__docId__": 4689, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93661,7 +93877,7 @@ "ignore": true }, { - "__docId__": 4682, + "__docId__": 4690, "kind": "variable", "name": "ids", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93682,7 +93898,7 @@ "ignore": true }, { - "__docId__": 4683, + "__docId__": 4691, "kind": "variable", "name": "drawRenderers", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93703,7 +93919,7 @@ "ignore": true }, { - "__docId__": 4684, + "__docId__": 4692, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93734,7 +93950,7 @@ "ignore": true }, { - "__docId__": 4685, + "__docId__": 4693, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93754,7 +93970,7 @@ "ignore": true }, { - "__docId__": 4686, + "__docId__": 4694, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93774,7 +93990,7 @@ "ignore": true }, { - "__docId__": 4687, + "__docId__": 4695, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93807,7 +94023,7 @@ "ignore": true }, { - "__docId__": 4688, + "__docId__": 4696, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93834,7 +94050,7 @@ "return": null }, { - "__docId__": 4689, + "__docId__": 4697, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93861,7 +94077,7 @@ "return": null }, { - "__docId__": 4690, + "__docId__": 4698, "kind": "function", "name": "DrawRenderer", "memberof": "src/viewer/scene/mesh/draw/DrawRenderer.js", @@ -93893,18 +94109,18 @@ "return": null }, { - "__docId__": 4691, + "__docId__": 4699, "kind": "file", "name": "src/viewer/scene/mesh/draw/DrawShaderSource.js", "content": "/**\n * @private\n */\n\nimport {LinearEncoding, sRGBEncoding} from \"../../constants/constants.js\";\n\nconst DrawShaderSource = function (mesh) {\n if (mesh._material._state.type === \"LambertMaterial\") {\n this.vertex = buildVertexLambert(mesh);\n this.fragment = buildFragmentLambert(mesh);\n } else {\n this.vertex = buildVertexDraw(mesh);\n this.fragment = buildFragmentDraw(mesh);\n }\n};\n\nconst TEXTURE_DECODE_FUNCS = {};\nTEXTURE_DECODE_FUNCS[LinearEncoding] = \"linearToLinear\";\nTEXTURE_DECODE_FUNCS[sRGBEncoding] = \"sRGBToLinear\";\n\nfunction getReceivesShadow(mesh) {\n if (!mesh.receivesShadow) {\n return false;\n }\n const lights = mesh.scene._lightsState.lights;\n if (!lights || lights.length === 0) {\n return false;\n }\n for (let i = 0, len = lights.length; i < len; i++) {\n if (lights[i].castsShadow) {\n return true;\n }\n }\n return false;\n}\n\nfunction hasTextures(mesh) {\n if (!mesh._geometry._state.uvBuf) {\n return false;\n }\n const material = mesh._material;\n return !!(material._ambientMap ||\n material._occlusionMap ||\n material._baseColorMap ||\n material._diffuseMap ||\n material._alphaMap ||\n material._specularMap ||\n material._glossinessMap ||\n material._specularGlossinessMap ||\n material._emissiveMap ||\n material._metallicMap ||\n material._roughnessMap ||\n material._metallicRoughnessMap ||\n material._reflectivityMap ||\n material._normalMap);\n}\n\nfunction hasNormals(mesh) {\n const primitive = mesh._geometry._state.primitiveName;\n if ((mesh._geometry._state.autoVertexNormals || mesh._geometry._state.normalsBuf) && (primitive === \"triangles\" || primitive === \"triangle-strip\" || primitive === \"triangle-fan\")) {\n return true;\n }\n return false;\n}\n\nfunction buildVertexLambert(mesh) {\n\n const scene = mesh.scene;\n const sectionPlanesState = mesh.scene._sectionPlanesState;\n const lightsState = mesh.scene._lightsState;\n const geometryState = mesh._geometry._state;\n const billboard = mesh._state.billboard;\n const stationary = mesh._state.stationary;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!geometryState.compressGeometry;\n\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Lambertian drawing vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform vec4 colorize;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n src.push(\"uniform vec4 lightAmbient;\");\n src.push(\"uniform vec4 materialColor;\");\n src.push(\"uniform vec3 materialEmissive;\");\n if (geometryState.normalsBuf) {\n src.push(\"in vec3 normal;\");\n src.push(\"uniform mat4 modelNormalMatrix;\");\n src.push(\"uniform mat4 viewNormalMatrix;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n if (quantizedGeometry) {\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n }\n }\n src.push(\"out vec4 vColor;\");\n if (geometryState.primitiveName === \"points\") {\n src.push(\"uniform float pointSize;\");\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n if (geometryState.normalsBuf) {\n if (quantizedGeometry) {\n src.push(\"vec4 localNormal = vec4(octDecode(normal.xy), 0.0); \");\n } else {\n src.push(\"vec4 localNormal = vec4(normal, 0.0); \");\n }\n src.push(\"mat4 modelNormalMatrix2 = modelNormalMatrix;\");\n src.push(\"mat4 viewNormalMatrix2 = viewNormalMatrix;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n src.push(\"billboard(modelViewMatrix);\");\n if (geometryState.normalsBuf) {\n src.push(\"mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;\");\n src.push(\"billboard(modelNormalMatrix2);\");\n src.push(\"billboard(viewNormalMatrix2);\");\n src.push(\"billboard(modelViewNormalMatrix);\");\n }\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = modelViewMatrix * localPosition;\");\n } else {\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = viewMatrix2 * worldPosition; \");\n }\n if (geometryState.normalsBuf) {\n src.push(\"vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);\");\n }\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n src.push(\"float lambertian = 1.0;\");\n if (geometryState.normalsBuf) {\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix2 * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix2 * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix2 * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n }\n src.push(\"vColor = vec4((lightAmbient.rgb * lightAmbient.a * materialColor.rgb) + materialEmissive.rgb + (reflectedColor * materialColor.rgb), materialColor.a) * colorize;\"); // TODO: How to have ambient bright enough for canvas BG but not too bright for scene?\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n }\n if (geometryState.primitiveName === \"points\") {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragmentLambert(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const materialState = mesh._material._state;\n const geometryState = mesh._geometry._state;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const solid = false && materialState.backfaces;\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Lambertian drawing fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"uniform bool clippable;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n if (gammaOutput) {\n src.push(\"uniform float gammaFactor;\");\n src.push(\" vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n if (solid) {\n src.push(\" if (gl_FrontFacing == false) {\");\n src.push(\" outColor = vec4(1.0, 0.0, 0.0, 1.0);\");\n src.push(\" return;\");\n src.push(\" }\");\n }\n src.push(\"}\");\n }\n if (geometryState.primitiveName === \"points\") {\n src.push(\"vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\"float r = dot(cxy, cxy);\");\n src.push(\"if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\"}\");\n\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n if (gammaOutput) {\n src.push(\"outColor = linearToGamma(vColor, gammaFactor);\");\n } else {\n src.push(\"outColor = vColor;\");\n }\n src.push(\"}\");\n return src;\n}\n\nfunction buildVertexDraw(mesh) {\n const scene = mesh.scene;\n const material = mesh._material;\n const meshState = mesh._state;\n const sectionPlanesState = scene._sectionPlanesState;\n const geometryState = mesh._geometry._state;\n const lightsState = scene._lightsState;\n let i;\n let len;\n let light;\n const billboard = meshState.billboard;\n const background = meshState.background;\n const stationary = meshState.stationary;\n const texturing = hasTextures(mesh);\n const normals = hasNormals(mesh);\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const receivesShadow = getReceivesShadow(mesh);\n const quantizedGeometry = !!geometryState.compressGeometry;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Drawing vertex shader\");\n src.push(\"in vec3 position;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"out vec3 vViewPosition;\");\n src.push(\"uniform vec3 offset;\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (lightsState.lightMaps.length > 0) {\n src.push(\"out vec3 vWorldNormal;\");\n }\n if (normals) {\n src.push(\"in vec3 normal;\");\n src.push(\"uniform mat4 modelNormalMatrix;\");\n src.push(\"uniform mat4 viewNormalMatrix;\");\n src.push(\"out vec3 vViewNormal;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (!(light.type === \"dir\" && light.space === \"view\")) {\n src.push(\"out vec4 vViewLightReverseDirAndDist\" + i + \";\");\n }\n }\n if (quantizedGeometry) {\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n }\n }\n if (texturing) {\n src.push(\"in vec2 uv;\");\n src.push(\"out vec2 vUV;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat3 uvDecodeMatrix;\")\n }\n }\n if (geometryState.colors) {\n src.push(\"in vec4 color;\");\n src.push(\"out vec4 vColor;\");\n }\n if (geometryState.primitiveName === \"points\") {\n src.push(\"uniform float pointSize;\");\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n if (receivesShadow) {\n src.push(\"const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) { // Light sources\n if (lightsState.lights[i].castsShadow) {\n src.push(\"uniform mat4 shadowViewMatrix\" + i + \";\");\n src.push(\"uniform mat4 shadowProjMatrix\" + i + \";\");\n src.push(\"out vec4 vShadowPosFromLight\" + i + \";\");\n }\n }\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n if (normals) {\n if (quantizedGeometry) {\n src.push(\"vec4 localNormal = vec4(octDecode(normal.xy), 0.0); \");\n } else {\n src.push(\"vec4 localNormal = vec4(normal, 0.0); \");\n }\n src.push(\"mat4 modelNormalMatrix2 = modelNormalMatrix;\");\n src.push(\"mat4 viewNormalMatrix2 = viewNormalMatrix;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n } else if (background) {\n src.push(\"viewMatrix2[3] = vec4(0.0, 0.0, 0.0 ,1.0);\");\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n src.push(\"billboard(modelViewMatrix);\");\n if (normals) {\n src.push(\"mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;\");\n src.push(\"billboard(modelNormalMatrix2);\");\n src.push(\"billboard(viewNormalMatrix2);\");\n src.push(\"billboard(modelViewNormalMatrix);\");\n }\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = modelViewMatrix * localPosition;\");\n } else {\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = viewMatrix2 * worldPosition; \");\n }\n if (normals) {\n src.push(\"vec3 worldNormal = (modelNormalMatrix2 * localNormal).xyz; \");\n if (lightsState.lightMaps.length > 0) {\n src.push(\"vWorldNormal = worldNormal;\");\n }\n src.push(\"vViewNormal = normalize((viewNormalMatrix2 * vec4(worldNormal, 1.0)).xyz);\");\n src.push(\"vec3 tmpVec3;\");\n src.push(\"float lightDist;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) { // Lights\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"world\") {\n src.push(\"tmpVec3 = vec3(viewMatrix2 * vec4(lightDir\" + i + \", 0.0) ).xyz;\");\n src.push(\"vViewLightReverseDirAndDist\" + i + \" = vec4(-tmpVec3, 0.0);\");\n }\n }\n if (light.type === \"point\") {\n if (light.space === \"world\") {\n src.push(\"tmpVec3 = (viewMatrix2 * vec4(lightPos\" + i + \", 1.0)).xyz - viewPosition.xyz;\");\n src.push(\"lightDist = abs(length(tmpVec3));\");\n } else {\n src.push(\"tmpVec3 = lightPos\" + i + \".xyz - viewPosition.xyz;\");\n src.push(\"lightDist = abs(length(tmpVec3));\");\n }\n src.push(\"vViewLightReverseDirAndDist\" + i + \" = vec4(tmpVec3, lightDist);\");\n }\n }\n }\n if (texturing) {\n if (quantizedGeometry) {\n src.push(\"vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;\");\n } else {\n src.push(\"vUV = uv;\");\n }\n }\n if (geometryState.colors) {\n src.push(\"vColor = color;\");\n }\n if (geometryState.primitiveName === \"points\") {\n src.push(\"gl_PointSize = pointSize;\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n }\n src.push(\" vViewPosition = viewPosition.xyz;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (background) {\n src.push(\"clipPos.z = clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n if (receivesShadow) {\n src.push(\"const mat4 texUnitConverter = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\");\n src.push(\"vec4 tempx; \");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) { // Light sources\n if (lightsState.lights[i].castsShadow) {\n src.push(\"vShadowPosFromLight\" + i + \" = texUnitConverter * shadowProjMatrix\" + i + \" * (shadowViewMatrix\" + i + \" * worldPosition); \");\n }\n }\n }\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragmentDraw(mesh) {\n\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n const material = mesh._material;\n const geometryState = mesh._geometry._state;\n const sectionPlanesState = mesh.scene._sectionPlanesState;\n const lightsState = mesh.scene._lightsState;\n const materialState = mesh._material._state;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const normals = hasNormals(mesh);\n const uvs = geometryState.uvBuf;\n const solid = false && materialState.backfaces;\n const phongMaterial = (materialState.type === \"PhongMaterial\");\n const metallicMaterial = (materialState.type === \"MetallicMaterial\");\n const specularMaterial = (materialState.type === \"SpecularMaterial\");\n const receivesShadow = getReceivesShadow(mesh);\n const gammaInput = scene.gammaInput; // If set, then it expects that all textures and colors are premultiplied gamma. Default is false.\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n\n let light;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (receivesShadow) {\n src.push(\"float unpackDepth (vec4 color) {\");\n src.push(\" const vec4 bitShift = vec4(1.0, 1.0/256.0, 1.0/(256.0 * 256.0), 1.0/(256.0*256.0*256.0));\");\n src.push(\" return dot(color, bitShift);\");\n src.push(\"}\");\n }\n\n //--------------------------------------------------------------------------------\n // GAMMA CORRECTION\n //--------------------------------------------------------------------------------\n\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToLinear( in vec4 value ) {\");\n src.push(\" return value;\");\n src.push(\"}\");\n src.push(\"vec4 sRGBToLinear( in vec4 value ) {\");\n src.push(\" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\");\n src.push(\"}\");\n src.push(\"vec4 gammaToLinear( in vec4 value) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\");\n src.push(\"}\");\n if (gammaOutput) {\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n\n //--------------------------------------------------------------------------------\n // USER CLIP PLANES\n //--------------------------------------------------------------------------------\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"uniform bool clippable;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n if (normals) {\n\n //--------------------------------------------------------------------------------\n // LIGHT AND REFLECTION MAP INPUTS\n // Define here so available globally to shader functions\n //--------------------------------------------------------------------------------\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"uniform samplerCube lightMap;\");\n src.push(\"uniform mat4 viewNormalMatrix;\");\n }\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"uniform samplerCube reflectionMap;\");\n }\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n src.push(\"uniform mat4 viewMatrix;\");\n }\n\n //--------------------------------------------------------------------------------\n // SHADING FUNCTIONS\n //--------------------------------------------------------------------------------\n\n // CONSTANT DEFINITIONS\n\n src.push(\"#define PI 3.14159265359\");\n src.push(\"#define RECIPROCAL_PI 0.31830988618\");\n src.push(\"#define RECIPROCAL_PI2 0.15915494\");\n src.push(\"#define EPSILON 1e-6\");\n\n src.push(\"#define saturate(a) clamp( a, 0.0, 1.0 )\");\n\n // UTILITY DEFINITIONS\n\n src.push(\"vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\");\n src.push(\" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\");\n src.push(\"}\");\n\n // STRUCTURES\n\n src.push(\"struct IncidentLight {\");\n src.push(\" vec3 color;\");\n src.push(\" vec3 direction;\");\n src.push(\"};\");\n\n src.push(\"struct ReflectedLight {\");\n src.push(\" vec3 diffuse;\");\n src.push(\" vec3 specular;\");\n src.push(\"};\");\n\n src.push(\"struct Geometry {\");\n src.push(\" vec3 position;\");\n src.push(\" vec3 viewNormal;\");\n src.push(\" vec3 worldNormal;\");\n src.push(\" vec3 viewEyeDir;\");\n src.push(\"};\");\n\n src.push(\"struct Material {\");\n src.push(\" vec3 diffuseColor;\");\n src.push(\" float specularRoughness;\");\n src.push(\" vec3 specularColor;\");\n src.push(\" float shine;\"); // Only used for Phong\n src.push(\"};\");\n\n // COMMON UTILS\n\n if (phongMaterial) {\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n\n src.push(\"void computePhongLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\" vec3 irradiance = \" + TEXTURE_DECODE_FUNCS[lightsState.lightMaps[0].encoding] + \"(texture(lightMap, geometry.worldNormal)).rgb;\");\n src.push(\" irradiance *= PI;\");\n src.push(\" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;\");\n }\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);\");\n src.push(\" vec3 radiance = texture(reflectionMap, reflectVec).rgb * 0.2;\");\n src.push(\" radiance *= PI;\");\n src.push(\" reflectedLight.specular += radiance;\");\n }\n src.push(\"}\");\n }\n\n src.push(\"void computePhongLighting(const in IncidentLight directLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n src.push(\" float dotNL = saturate(dot(geometry.viewNormal, directLight.direction));\");\n src.push(\" vec3 irradiance = dotNL * directLight.color * PI;\");\n src.push(\" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.specular += directLight.color * material.specularColor * pow(max(dot(reflect(-directLight.direction, -geometry.viewNormal), geometry.viewEyeDir), 0.0), material.shine);\");\n src.push(\"}\");\n }\n\n if (metallicMaterial || specularMaterial) {\n\n // IRRADIANCE EVALUATION\n\n src.push(\"float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\");\n src.push(\" float r = ggxRoughness + 0.0001;\");\n src.push(\" return (2.0 / (r * r) - 2.0);\");\n src.push(\"}\");\n\n src.push(\"float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float maxMIPLevelScalar = float( maxMIPLevel );\");\n src.push(\" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );\");\n src.push(\" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\");\n src.push(\"}\");\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\"); //TODO: a random factor - fix this\n src.push(\" vec3 envMapColor = \" + TEXTURE_DECODE_FUNCS[lightsState.reflectionMaps[0].encoding] + \"(texture(reflectionMap, reflectVec, mipLevel)).rgb;\");\n src.push(\" return envMapColor;\");\n src.push(\"}\");\n }\n\n // SPECULAR BRDF EVALUATION\n\n src.push(\"vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\");\n src.push(\" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\");\n src.push(\" return ( 1.0 - specularColor ) * fresnel + specularColor;\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" return 1.0 / ( gl * gv );\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" return 0.5 / max( gv + gl, EPSILON );\");\n src.push(\"}\");\n\n src.push(\"float D_GGX(const in float alpha, const in float dotNH) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;\");\n src.push(\" return RECIPROCAL_PI * a2 / ( denom * denom);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float alpha = ( roughness * roughness );\");\n src.push(\" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );\");\n src.push(\" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );\");\n src.push(\" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );\");\n src.push(\" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );\");\n src.push(\" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\");\n src.push(\" vec3 F = F_Schlick( specularColor, dotLH );\");\n src.push(\" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\");\n src.push(\" float D = D_GGX( alpha, dotNH );\");\n src.push(\" return F * (G * D);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));\");\n src.push(\" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);\");\n src.push(\" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);\");\n src.push(\" vec4 r = roughness * c0 + c1;\");\n src.push(\" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\");\n src.push(\" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\");\n src.push(\" return specularColor * AB.x + AB.y;\");\n src.push(\"}\");\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n\n src.push(\"void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n if (lightsState.lightMaps.length > 0) {\n src.push(\" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;\");\n src.push(\" irradiance *= PI;\");\n src.push(\" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;\");\n // src.push(\" reflectedLight.diffuse = vec3(1.0, 0.0, 0.0);\");\n }\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\" vec3 reflectVec = reflect(-geometry.viewEyeDir, geometry.viewNormal);\");\n src.push(\" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);\");\n src.push(\" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);\");\n src.push(\" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);\");\n src.push(\" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\");\n src.push(\" reflectedLight.specular += radiance * specularBRDFContrib;\");\n }\n src.push(\"}\");\n }\n\n // MAIN LIGHTING COMPUTATION FUNCTION\n\n src.push(\"void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n src.push(\" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));\");\n src.push(\" vec3 irradiance = dotNL * incidentLight.color * PI;\");\n src.push(\" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);\");\n src.push(\"}\");\n\n } // (metallicMaterial || specularMaterial)\n\n } // geometry.normals\n\n //--------------------------------------------------------------------------------\n // GEOMETRY INPUTS\n //--------------------------------------------------------------------------------\n\n src.push(\"in vec3 vViewPosition;\");\n\n if (geometryState.colors) {\n src.push(\"in vec4 vColor;\");\n }\n\n if (uvs &&\n ((normals && material._normalMap)\n || material._ambientMap\n || material._baseColorMap\n || material._diffuseMap\n || material._emissiveMap\n || material._metallicMap\n || material._roughnessMap\n || material._metallicRoughnessMap\n || material._specularMap\n || material._glossinessMap\n || material._specularGlossinessMap\n || material._occlusionMap\n || material._alphaMap)) {\n src.push(\"in vec2 vUV;\");\n }\n\n if (normals) {\n if (lightsState.lightMaps.length > 0) {\n src.push(\"in vec3 vWorldNormal;\");\n }\n src.push(\"in vec3 vViewNormal;\");\n }\n\n //--------------------------------------------------------------------------------\n // MATERIAL CHANNEL INPUTS\n //--------------------------------------------------------------------------------\n\n if (materialState.ambient) {\n src.push(\"uniform vec3 materialAmbient;\");\n }\n if (materialState.baseColor) {\n src.push(\"uniform vec3 materialBaseColor;\");\n }\n if (materialState.alpha !== undefined && materialState.alpha !== null) {\n src.push(\"uniform vec4 materialAlphaModeCutoff;\"); // [alpha, alphaMode, alphaCutoff]\n }\n if (materialState.emissive) {\n src.push(\"uniform vec3 materialEmissive;\");\n }\n if (materialState.diffuse) {\n src.push(\"uniform vec3 materialDiffuse;\");\n }\n if (materialState.glossiness !== undefined && materialState.glossiness !== null) {\n src.push(\"uniform float materialGlossiness;\");\n }\n if (materialState.shininess !== undefined && materialState.shininess !== null) {\n src.push(\"uniform float materialShininess;\"); // Phong channel\n }\n if (materialState.specular) {\n src.push(\"uniform vec3 materialSpecular;\");\n }\n if (materialState.metallic !== undefined && materialState.metallic !== null) {\n src.push(\"uniform float materialMetallic;\");\n }\n if (materialState.roughness !== undefined && materialState.roughness !== null) {\n src.push(\"uniform float materialRoughness;\");\n }\n if (materialState.specularF0 !== undefined && materialState.specularF0 !== null) {\n src.push(\"uniform float materialSpecularF0;\");\n }\n\n //--------------------------------------------------------------------------------\n // MATERIAL TEXTURE INPUTS\n //--------------------------------------------------------------------------------\n\n if (uvs && material._ambientMap) {\n src.push(\"uniform sampler2D ambientMap;\");\n if (material._ambientMap._state.matrix) {\n src.push(\"uniform mat4 ambientMapMatrix;\");\n }\n }\n if (uvs && material._baseColorMap) {\n src.push(\"uniform sampler2D baseColorMap;\");\n if (material._baseColorMap._state.matrix) {\n src.push(\"uniform mat4 baseColorMapMatrix;\");\n }\n }\n if (uvs && material._diffuseMap) {\n src.push(\"uniform sampler2D diffuseMap;\");\n if (material._diffuseMap._state.matrix) {\n src.push(\"uniform mat4 diffuseMapMatrix;\");\n }\n }\n if (uvs && material._emissiveMap) {\n src.push(\"uniform sampler2D emissiveMap;\");\n if (material._emissiveMap._state.matrix) {\n src.push(\"uniform mat4 emissiveMapMatrix;\");\n }\n }\n if (normals && uvs && material._metallicMap) {\n src.push(\"uniform sampler2D metallicMap;\");\n if (material._metallicMap._state.matrix) {\n src.push(\"uniform mat4 metallicMapMatrix;\");\n }\n }\n if (normals && uvs && material._roughnessMap) {\n src.push(\"uniform sampler2D roughnessMap;\");\n if (material._roughnessMap._state.matrix) {\n src.push(\"uniform mat4 roughnessMapMatrix;\");\n }\n }\n if (normals && uvs && material._metallicRoughnessMap) {\n src.push(\"uniform sampler2D metallicRoughnessMap;\");\n if (material._metallicRoughnessMap._state.matrix) {\n src.push(\"uniform mat4 metallicRoughnessMapMatrix;\");\n }\n }\n if (normals && material._normalMap) {\n src.push(\"uniform sampler2D normalMap;\");\n if (material._normalMap._state.matrix) {\n src.push(\"uniform mat4 normalMapMatrix;\");\n }\n src.push(\"vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\");\n src.push(\" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\");\n src.push(\" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\");\n src.push(\" vec2 st0 = dFdx( uv.st );\");\n src.push(\" vec2 st1 = dFdy( uv.st );\");\n src.push(\" vec3 S = normalize( q0 * st1.t - q1 * st0.t );\");\n src.push(\" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\");\n src.push(\" vec3 N = normalize( surf_norm );\");\n src.push(\" vec3 mapN = texture( normalMap, uv ).xyz * 2.0 - 1.0;\");\n src.push(\" mat3 tsn = mat3( S, T, N );\");\n // src.push(\" mapN *= 3.0;\");\n src.push(\" return normalize( tsn * mapN );\");\n src.push(\"}\");\n }\n if (uvs && material._occlusionMap) {\n src.push(\"uniform sampler2D occlusionMap;\");\n if (material._occlusionMap._state.matrix) {\n src.push(\"uniform mat4 occlusionMapMatrix;\");\n }\n }\n if (uvs && material._alphaMap) {\n src.push(\"uniform sampler2D alphaMap;\");\n if (material._alphaMap._state.matrix) {\n src.push(\"uniform mat4 alphaMapMatrix;\");\n }\n }\n if (normals && uvs && material._specularMap) {\n src.push(\"uniform sampler2D specularMap;\");\n if (material._specularMap._state.matrix) {\n src.push(\"uniform mat4 specularMapMatrix;\");\n }\n }\n if (normals && uvs && material._glossinessMap) {\n src.push(\"uniform sampler2D glossinessMap;\");\n if (material._glossinessMap._state.matrix) {\n src.push(\"uniform mat4 glossinessMapMatrix;\");\n }\n }\n if (normals && uvs && material._specularGlossinessMap) {\n src.push(\"uniform sampler2D materialSpecularGlossinessMap;\");\n if (material._specularGlossinessMap._state.matrix) {\n src.push(\"uniform mat4 materialSpecularGlossinessMapMatrix;\");\n }\n }\n\n //--------------------------------------------------------------------------------\n // MATERIAL FRESNEL INPUTS\n //--------------------------------------------------------------------------------\n\n if (normals && (material._diffuseFresnel ||\n material._specularFresnel ||\n material._alphaFresnel ||\n material._emissiveFresnel ||\n material._reflectivityFresnel)) {\n src.push(\"float fresnel(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {\");\n src.push(\" float fr = abs(dot(eyeDir, normal));\");\n src.push(\" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);\");\n src.push(\" return pow(finalFr, power);\");\n src.push(\"}\");\n if (material._diffuseFresnel) {\n src.push(\"uniform float diffuseFresnelCenterBias;\");\n src.push(\"uniform float diffuseFresnelEdgeBias;\");\n src.push(\"uniform float diffuseFresnelPower;\");\n src.push(\"uniform vec3 diffuseFresnelCenterColor;\");\n src.push(\"uniform vec3 diffuseFresnelEdgeColor;\");\n }\n if (material._specularFresnel) {\n src.push(\"uniform float specularFresnelCenterBias;\");\n src.push(\"uniform float specularFresnelEdgeBias;\");\n src.push(\"uniform float specularFresnelPower;\");\n src.push(\"uniform vec3 specularFresnelCenterColor;\");\n src.push(\"uniform vec3 specularFresnelEdgeColor;\");\n }\n if (material._alphaFresnel) {\n src.push(\"uniform float alphaFresnelCenterBias;\");\n src.push(\"uniform float alphaFresnelEdgeBias;\");\n src.push(\"uniform float alphaFresnelPower;\");\n src.push(\"uniform vec3 alphaFresnelCenterColor;\");\n src.push(\"uniform vec3 alphaFresnelEdgeColor;\");\n }\n if (material._reflectivityFresnel) {\n src.push(\"uniform float materialSpecularF0FresnelCenterBias;\");\n src.push(\"uniform float materialSpecularF0FresnelEdgeBias;\");\n src.push(\"uniform float materialSpecularF0FresnelPower;\");\n src.push(\"uniform vec3 materialSpecularF0FresnelCenterColor;\");\n src.push(\"uniform vec3 materialSpecularF0FresnelEdgeColor;\");\n }\n if (material._emissiveFresnel) {\n src.push(\"uniform float emissiveFresnelCenterBias;\");\n src.push(\"uniform float emissiveFresnelEdgeBias;\");\n src.push(\"uniform float emissiveFresnelPower;\");\n src.push(\"uniform vec3 emissiveFresnelCenterColor;\");\n src.push(\"uniform vec3 emissiveFresnelEdgeColor;\");\n }\n }\n\n //--------------------------------------------------------------------------------\n // LIGHT SOURCES\n //--------------------------------------------------------------------------------\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n if (normals) {\n for (let i = 0, len = lightsState.lights.length; i < len; i++) { // Light sources\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightAttenuation\" + i + \";\");\n }\n if (light.type === \"dir\" && light.space === \"view\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\" && light.space === \"view\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n } else {\n src.push(\"in vec4 vViewLightReverseDirAndDist\" + i + \";\");\n }\n }\n }\n\n if (receivesShadow) {\n\n // Variance castsShadow mapping filter\n\n // src.push(\"float linstep(float low, float high, float v){\");\n // src.push(\" return clamp((v-low)/(high-low), 0.0, 1.0);\");\n // src.push(\"}\");\n //\n // src.push(\"float VSM(sampler2D depths, vec2 uv, float compare){\");\n // src.push(\" vec2 moments = texture(depths, uv).xy;\");\n // src.push(\" float p = smoothstep(compare-0.02, compare, moments.x);\");\n // src.push(\" float variance = max(moments.y - moments.x*moments.x, -0.001);\");\n // src.push(\" float d = compare - moments.x;\");\n // src.push(\" float p_max = linstep(0.2, 1.0, variance / (variance + d*d));\");\n // src.push(\" return clamp(max(p, p_max), 0.0, 1.0);\");\n // src.push(\"}\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) { // Light sources\n if (lightsState.lights[i].castsShadow) {\n src.push(\"in vec4 vShadowPosFromLight\" + i + \";\");\n src.push(\"uniform sampler2D shadowMap\" + i + \";\");\n }\n }\n }\n\n src.push(\"uniform vec4 colorize;\");\n\n //================================================================================\n // MAIN\n //================================================================================\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n if (solid) {\n src.push(\" if (gl_FrontFacing == false) {\");\n src.push(\" outColor = vec4(1.0, 0.0, 0.0, 1.0);\");\n src.push(\" return;\");\n src.push(\" }\");\n }\n src.push(\"}\");\n }\n\n if (geometryState.primitiveName === \"points\") {\n src.push(\"vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\"float r = dot(cxy, cxy);\");\n src.push(\"if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\"}\");\n }\n\n src.push(\"float occlusion = 1.0;\");\n\n if (materialState.ambient) {\n src.push(\"vec3 ambientColor = materialAmbient;\");\n } else {\n src.push(\"vec3 ambientColor = vec3(1.0, 1.0, 1.0);\");\n }\n\n if (materialState.diffuse) {\n src.push(\"vec3 diffuseColor = materialDiffuse;\");\n } else if (materialState.baseColor) {\n src.push(\"vec3 diffuseColor = materialBaseColor;\");\n } else {\n src.push(\"vec3 diffuseColor = vec3(1.0, 1.0, 1.0);\");\n }\n\n if (geometryState.colors) {\n src.push(\"diffuseColor *= vColor.rgb;\");\n }\n\n if (materialState.emissive) {\n src.push(\"vec3 emissiveColor = materialEmissive;\"); // Emissive default is (0,0,0), so initializing here\n } else {\n src.push(\"vec3 emissiveColor = vec3(0.0, 0.0, 0.0);\");\n }\n\n if (materialState.specular) {\n src.push(\"vec3 specular = materialSpecular;\");\n } else {\n src.push(\"vec3 specular = vec3(1.0, 1.0, 1.0);\");\n }\n\n if (materialState.alpha !== undefined) {\n src.push(\"float alpha = materialAlphaModeCutoff[0];\");\n } else {\n src.push(\"float alpha = 1.0;\");\n }\n\n if (geometryState.colors) {\n src.push(\"alpha *= vColor.a;\");\n }\n\n if (materialState.glossiness !== undefined) {\n src.push(\"float glossiness = materialGlossiness;\");\n } else {\n src.push(\"float glossiness = 1.0;\");\n }\n\n if (materialState.metallic !== undefined) {\n src.push(\"float metallic = materialMetallic;\");\n } else {\n src.push(\"float metallic = 1.0;\");\n }\n\n if (materialState.roughness !== undefined) {\n src.push(\"float roughness = materialRoughness;\");\n } else {\n src.push(\"float roughness = 1.0;\");\n }\n\n if (materialState.specularF0 !== undefined) {\n src.push(\"float specularF0 = materialSpecularF0;\");\n } else {\n src.push(\"float specularF0 = 1.0;\");\n }\n\n //--------------------------------------------------------------------------------\n // TEXTURING\n //--------------------------------------------------------------------------------\n\n if (uvs && ((normals && material._normalMap)\n || material._ambientMap\n || material._baseColorMap\n || material._diffuseMap\n || material._occlusionMap\n || material._emissiveMap\n || material._metallicMap\n || material._roughnessMap\n || material._metallicRoughnessMap\n || material._specularMap\n || material._glossinessMap\n || material._specularGlossinessMap\n || material._alphaMap)) {\n src.push(\"vec4 texturePos = vec4(vUV.s, vUV.t, 1.0, 1.0);\");\n src.push(\"vec2 textureCoord;\");\n }\n\n if (uvs && material._ambientMap) {\n if (material._ambientMap._state.matrix) {\n src.push(\"textureCoord = (ambientMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec4 ambientTexel = texture(ambientMap, textureCoord).rgb;\");\n src.push(\"ambientTexel = \" + TEXTURE_DECODE_FUNCS[material._ambientMap._state.encoding] + \"(ambientTexel);\");\n src.push(\"ambientColor *= ambientTexel.rgb;\");\n }\n\n if (uvs && material._diffuseMap) {\n if (material._diffuseMap._state.matrix) {\n src.push(\"textureCoord = (diffuseMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec4 diffuseTexel = texture(diffuseMap, textureCoord);\");\n src.push(\"diffuseTexel = \" + TEXTURE_DECODE_FUNCS[material._diffuseMap._state.encoding] + \"(diffuseTexel);\");\n src.push(\"diffuseColor *= diffuseTexel.rgb;\");\n src.push(\"alpha *= diffuseTexel.a;\");\n }\n\n if (uvs && material._baseColorMap) {\n if (material._baseColorMap._state.matrix) {\n src.push(\"textureCoord = (baseColorMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec4 baseColorTexel = texture(baseColorMap, textureCoord);\");\n src.push(\"baseColorTexel = \" + TEXTURE_DECODE_FUNCS[material._baseColorMap._state.encoding] + \"(baseColorTexel);\");\n src.push(\"diffuseColor *= baseColorTexel.rgb;\");\n src.push(\"alpha *= baseColorTexel.a;\");\n }\n\n if (uvs && material._emissiveMap) {\n if (material._emissiveMap._state.matrix) {\n src.push(\"textureCoord = (emissiveMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec4 emissiveTexel = texture(emissiveMap, textureCoord);\");\n src.push(\"emissiveTexel = \" + TEXTURE_DECODE_FUNCS[material._emissiveMap._state.encoding] + \"(emissiveTexel);\");\n src.push(\"emissiveColor = emissiveTexel.rgb;\");\n }\n\n if (uvs && material._alphaMap) {\n if (material._alphaMap._state.matrix) {\n src.push(\"textureCoord = (alphaMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"alpha *= texture(alphaMap, textureCoord).r;\");\n }\n\n if (uvs && material._occlusionMap) {\n if (material._occlusionMap._state.matrix) {\n src.push(\"textureCoord = (occlusionMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"occlusion *= texture(occlusionMap, textureCoord).r;\");\n }\n\n if (normals && ((lightsState.lights.length > 0) || lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0)) {\n\n //--------------------------------------------------------------------------------\n // SHADING\n //--------------------------------------------------------------------------------\n\n if (uvs && material._normalMap) {\n if (material._normalMap._state.matrix) {\n src.push(\"textureCoord = (normalMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec3 viewNormal = perturbNormal2Arb( vViewPosition, normalize(vViewNormal), textureCoord );\");\n } else {\n src.push(\"vec3 viewNormal = normalize(vViewNormal);\");\n }\n\n if (uvs && material._specularMap) {\n if (material._specularMap._state.matrix) {\n src.push(\"textureCoord = (specularMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"specular *= texture(specularMap, textureCoord).rgb;\");\n }\n\n if (uvs && material._glossinessMap) {\n if (material._glossinessMap._state.matrix) {\n src.push(\"textureCoord = (glossinessMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"glossiness *= texture(glossinessMap, textureCoord).r;\");\n }\n\n if (uvs && material._specularGlossinessMap) {\n if (material._specularGlossinessMap._state.matrix) {\n src.push(\"textureCoord = (materialSpecularGlossinessMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec4 specGlossRGB = texture(materialSpecularGlossinessMap, textureCoord).rgba;\"); // TODO: what if only RGB texture?\n src.push(\"specular *= specGlossRGB.rgb;\");\n src.push(\"glossiness *= specGlossRGB.a;\");\n }\n\n if (uvs && material._metallicMap) {\n if (material._metallicMap._state.matrix) {\n src.push(\"textureCoord = (metallicMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"metallic *= texture(metallicMap, textureCoord).r;\");\n }\n\n if (uvs && material._roughnessMap) {\n if (material._roughnessMap._state.matrix) {\n src.push(\"textureCoord = (roughnessMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"roughness *= texture(roughnessMap, textureCoord).r;\");\n }\n\n if (uvs && material._metallicRoughnessMap) {\n if (material._metallicRoughnessMap._state.matrix) {\n src.push(\"textureCoord = (metallicRoughnessMapMatrix * texturePos).xy;\");\n } else {\n src.push(\"textureCoord = texturePos.xy;\");\n }\n src.push(\"vec3 metalRoughRGB = texture(metallicRoughnessMap, textureCoord).rgb;\");\n src.push(\"metallic *= metalRoughRGB.b;\");\n src.push(\"roughness *= metalRoughRGB.g;\");\n }\n\n src.push(\"vec3 viewEyeDir = normalize(-vViewPosition);\");\n\n if (material._diffuseFresnel) {\n src.push(\"float diffuseFresnel = fresnel(viewEyeDir, viewNormal, diffuseFresnelEdgeBias, diffuseFresnelCenterBias, diffuseFresnelPower);\");\n src.push(\"diffuseColor *= mix(diffuseFresnelEdgeColor, diffuseFresnelCenterColor, diffuseFresnel);\");\n }\n if (material._specularFresnel) {\n src.push(\"float specularFresnel = fresnel(viewEyeDir, viewNormal, specularFresnelEdgeBias, specularFresnelCenterBias, specularFresnelPower);\");\n src.push(\"specular *= mix(specularFresnelEdgeColor, specularFresnelCenterColor, specularFresnel);\");\n }\n if (material._alphaFresnel) {\n src.push(\"float alphaFresnel = fresnel(viewEyeDir, viewNormal, alphaFresnelEdgeBias, alphaFresnelCenterBias, alphaFresnelPower);\");\n src.push(\"alpha *= mix(alphaFresnelEdgeColor.r, alphaFresnelCenterColor.r, alphaFresnel);\");\n }\n if (material._emissiveFresnel) {\n src.push(\"float emissiveFresnel = fresnel(viewEyeDir, viewNormal, emissiveFresnelEdgeBias, emissiveFresnelCenterBias, emissiveFresnelPower);\");\n src.push(\"emissiveColor *= mix(emissiveFresnelEdgeColor, emissiveFresnelCenterColor, emissiveFresnel);\");\n }\n\n src.push(\"if (materialAlphaModeCutoff[1] == 1.0 && alpha < materialAlphaModeCutoff[2]) {\"); // ie. (alphaMode == \"mask\" && alpha < alphaCutoff)\n src.push(\" discard;\"); // TODO: Discard earlier within this shader?\n src.push(\"}\");\n\n // PREPARE INPUTS FOR SHADER FUNCTIONS\n\n src.push(\"IncidentLight light;\");\n src.push(\"Material material;\");\n src.push(\"Geometry geometry;\");\n src.push(\"ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));\");\n src.push(\"vec3 viewLightDir;\");\n\n if (phongMaterial) {\n src.push(\"material.diffuseColor = diffuseColor;\");\n src.push(\"material.specularColor = specular;\");\n src.push(\"material.shine = materialShininess;\");\n }\n\n if (specularMaterial) {\n src.push(\"float oneMinusSpecularStrength = 1.0 - max(max(specular.r, specular.g ),specular.b);\"); // Energy conservation\n src.push(\"material.diffuseColor = diffuseColor * oneMinusSpecularStrength;\");\n src.push(\"material.specularRoughness = clamp( 1.0 - glossiness, 0.04, 1.0 );\");\n src.push(\"material.specularColor = specular;\");\n }\n\n if (metallicMaterial) {\n src.push(\"float dielectricSpecular = 0.16 * specularF0 * specularF0;\");\n src.push(\"material.diffuseColor = diffuseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);\");\n src.push(\"material.specularRoughness = clamp(roughness, 0.04, 1.0);\");\n src.push(\"material.specularColor = mix(vec3(dielectricSpecular), diffuseColor, metallic);\");\n }\n\n src.push(\"geometry.position = vViewPosition;\");\n if (lightsState.lightMaps.length > 0) {\n src.push(\"geometry.worldNormal = normalize(vWorldNormal);\");\n }\n src.push(\"geometry.viewNormal = viewNormal;\");\n src.push(\"geometry.viewEyeDir = viewEyeDir;\");\n\n // ENVIRONMENT AND REFLECTION MAP SHADING\n\n if ((phongMaterial) && (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0)) {\n src.push(\"computePhongLightMapping(geometry, material, reflectedLight);\");\n }\n\n if ((specularMaterial || metallicMaterial) && (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0)) {\n src.push(\"computePBRLightMapping(geometry, material, reflectedLight);\");\n }\n\n // LIGHT SOURCE SHADING\n\n src.push(\"float shadow = 1.0;\");\n\n // if (receivesShadow) {\n //\n // src.push(\"float lightDepth2 = clamp(length(lightPos)/40.0, 0.0, 1.0);\");\n // src.push(\"float illuminated = VSM(sLightDepth, lightUV, lightDepth2);\");\n //\n src.push(\"float shadowAcneRemover = 0.007;\");\n src.push(\"vec3 fragmentDepth;\");\n src.push(\"float texelSize = 1.0 / 1024.0;\");\n src.push(\"float amountInLight = 0.0;\");\n src.push(\"vec3 shadowCoord;\");\n src.push('vec4 rgbaDepth;');\n src.push(\"float depth;\");\n // }\n\n const numShadows = 0;\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n\n const light = lightsState.lights[i];\n\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\" && light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightDir\" + i + \");\");\n } else if (light.type === \"point\" && light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightPos\" + i + \" - vViewPosition);\");\n //src.push(\"tmpVec3 = lightPos\" + i + \".xyz - viewPosition.xyz;\");\n //src.push(\"lightDist = abs(length(tmpVec3));\");\n } else {\n src.push(\"viewLightDir = normalize(vViewLightReverseDirAndDist\" + i + \".xyz);\"); // If normal mapping, the fragment->light vector will be in tangent space\n }\n\n if (receivesShadow && light.castsShadow) {\n\n // if (true) {\n // src.push('shadowCoord = (vShadowPosFromLight' + i + '.xyz/vShadowPosFromLight' + i + '.w)/2.0 + 0.5;');\n // src.push(\"lightDepth2 = clamp(length(vec3[0.0, 20.0, 20.0])/40.0, 0.0, 1.0);\");\n // src.push(\"castsShadow *= VSM(shadowMap' + i + ', shadowCoord, lightDepth2);\");\n // }\n //\n // if (false) {\n //\n // PCF\n\n src.push(\"shadow = 0.0;\");\n\n src.push(\"fragmentDepth = vShadowPosFromLight\" + i + \".xyz;\");\n src.push(\"fragmentDepth.z -= shadowAcneRemover;\");\n src.push(\"for (int x = -3; x <= 3; x++) {\");\n src.push(\" for (int y = -3; y <= 3; y++) {\");\n src.push(\" float texelDepth = unpackDepth(texture(shadowMap\" + i + \", fragmentDepth.xy + vec2(x, y) * texelSize));\");\n src.push(\" if (fragmentDepth.z < texelDepth) {\");\n src.push(\" shadow += 1.0;\");\n src.push(\" }\");\n src.push(\" }\");\n src.push(\"}\");\n\n src.push(\"shadow = shadow / 9.0;\");\n\n src.push(\"light.color = lightColor\" + i + \".rgb * (lightColor\" + i + \".a * shadow);\"); // a is intensity\n //\n // }\n //\n // if (false){\n //\n // src.push(\"shadow = 1.0;\");\n //\n // src.push('shadowCoord = (vShadowPosFromLight' + i + '.xyz/vShadowPosFromLight' + i + '.w)/2.0 + 0.5;');\n //\n // src.push('shadow -= (shadowCoord.z > unpackDepth(texture(shadowMap' + i + ', shadowCoord.xy + vec2( -0.94201624, -0.39906216 ) / 700.0)) + 0.0015) ? 0.2 : 0.0;');\n // src.push('shadow -= (shadowCoord.z > unpackDepth(texture(shadowMap' + i + ', shadowCoord.xy + vec2( 0.94558609, -0.76890725 ) / 700.0)) + 0.0015) ? 0.2 : 0.0;');\n // src.push('shadow -= (shadowCoord.z > unpackDepth(texture(shadowMap' + i + ', shadowCoord.xy + vec2( -0.094184101, -0.92938870 ) / 700.0)) + 0.0015) ? 0.2 : 0.0;');\n // src.push('shadow -= (shadowCoord.z > unpackDepth(texture(shadowMap' + i + ', shadowCoord.xy + vec2( 0.34495938, 0.29387760 ) / 700.0)) + 0.0015) ? 0.2 : 0.0;');\n //\n // src.push(\"light.color = lightColor\" + i + \".rgb * (lightColor\" + i + \".a * shadow);\");\n // }\n } else {\n src.push(\"light.color = lightColor\" + i + \".rgb * (lightColor\" + i + \".a );\"); // a is intensity\n }\n\n src.push(\"light.direction = viewLightDir;\");\n\n if (phongMaterial) {\n src.push(\"computePhongLighting(light, geometry, material, reflectedLight);\");\n }\n\n if (specularMaterial || metallicMaterial) {\n src.push(\"computePBRLighting(light, geometry, material, reflectedLight);\");\n }\n }\n\n if (numShadows > 0) {\n //src.push(\"shadow /= \" + (9 * numShadows) + \".0;\");\n }\n\n //src.push(\"reflectedLight.diffuse *= shadow;\");\n\n // COMBINE TERMS\n\n if (phongMaterial) {\n src.push(\"vec3 outgoingLight = (lightAmbient.rgb * lightAmbient.a * diffuseColor) + ((occlusion * (( reflectedLight.diffuse + reflectedLight.specular)))) + emissiveColor;\");\n\n } else {\n src.push(\"vec3 outgoingLight = (occlusion * (reflectedLight.diffuse)) + (occlusion * reflectedLight.specular) + emissiveColor;\");\n }\n\n } else {\n\n //--------------------------------------------------------------------------------\n // NO SHADING - EMISSIVE and AMBIENT ONLY\n //--------------------------------------------------------------------------------\n\n src.push(\"ambientColor *= (lightAmbient.rgb * lightAmbient.a);\");\n\n src.push(\"vec3 outgoingLight = emissiveColor + ambientColor;\");\n }\n\n src.push(\"vec4 fragColor = vec4(outgoingLight, alpha) * colorize;\");\n\n if (gammaOutput) {\n src.push(\"fragColor = linearToGamma(fragColor, gammaFactor);\");\n }\n\n src.push(\"outColor = fragColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n\n return src;\n}\n\nexport {DrawShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/draw/DrawShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/draw/DrawShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4692, + "__docId__": 4700, "kind": "variable", "name": "TEXTURE_DECODE_FUNCS", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -93925,7 +94141,7 @@ "ignore": true }, { - "__docId__": 4693, + "__docId__": 4701, "kind": "function", "name": "getReceivesShadow", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -93956,7 +94172,7 @@ "ignore": true }, { - "__docId__": 4694, + "__docId__": 4702, "kind": "function", "name": "hasTextures", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -93987,7 +94203,7 @@ "ignore": true }, { - "__docId__": 4695, + "__docId__": 4703, "kind": "function", "name": "hasNormals", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94018,7 +94234,7 @@ "ignore": true }, { - "__docId__": 4696, + "__docId__": 4704, "kind": "function", "name": "buildVertexLambert", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94049,7 +94265,7 @@ "ignore": true }, { - "__docId__": 4697, + "__docId__": 4705, "kind": "function", "name": "buildFragmentLambert", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94080,7 +94296,7 @@ "ignore": true }, { - "__docId__": 4698, + "__docId__": 4706, "kind": "function", "name": "buildVertexDraw", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94111,7 +94327,7 @@ "ignore": true }, { - "__docId__": 4699, + "__docId__": 4707, "kind": "function", "name": "buildFragmentDraw", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94142,7 +94358,7 @@ "ignore": true }, { - "__docId__": 4700, + "__docId__": 4708, "kind": "function", "name": "DrawShaderSource", "memberof": "src/viewer/scene/mesh/draw/DrawShaderSource.js", @@ -94168,18 +94384,18 @@ "return": null }, { - "__docId__": 4701, + "__docId__": 4709, "kind": "file", "name": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {Map} from \"../../utils/Map.js\";\nimport {EmphasisEdgesShaderSource} from \"./EmphasisEdgesShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from '../../stats.js';\nimport {math} from \"../../math/math.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\n\nconst ids = new Map({});\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nconst EmphasisEdgesRenderer = function (hash, mesh) {\n this.id = ids.addItem({});\n this._hash = hash;\n this._scene = mesh.scene;\n this._useCount = 0;\n this._shaderSource = new EmphasisEdgesShaderSource(mesh);\n this._allocate(mesh);\n};\n\nconst renderers = {};\n\nEmphasisEdgesRenderer.get = function (mesh) {\n const hash = [\n mesh.scene.id,\n mesh.scene.gammaOutput ? \"go\" : \"\", // Gamma input not needed\n mesh.scene._sectionPlanesState.getHash(),\n mesh._geometry._state.compressGeometry ? \"cp\" : \"\",\n mesh._state.hash\n ].join(\";\");\n let renderer = renderers[hash];\n if (!renderer) {\n renderer = new EmphasisEdgesRenderer(hash, mesh);\n renderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nEmphasisEdgesRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n ids.removeItem(this.id);\n if (this._program) {\n this._program.destroy();\n }\n delete renderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nEmphasisEdgesRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nEmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const scene = this._scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n let materialState;\n const meshState = mesh._state;\n const geometry = mesh._geometry;\n const geometryState = geometry._state;\n const origin = mesh.origin;\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n switch (mode) {\n case 0:\n materialState = mesh._xrayMaterial._state;\n break;\n case 1:\n materialState = mesh._highlightMaterial._state;\n break;\n case 2:\n materialState = mesh._selectedMaterial._state;\n break;\n case 3:\n default:\n materialState = mesh._edgeMaterial._state;\n break;\n }\n\n if (materialState.id !== this._lastMaterialId) {\n const backfaces = materialState.backfaces;\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n if (frameCtx.lineWidth !== materialState.edgeWidth) {\n gl.lineWidth(materialState.edgeWidth);\n frameCtx.lineWidth = materialState.edgeWidth;\n }\n if (this._uEdgeColor) {\n const edgeColor = materialState.edgeColor;\n const edgeAlpha = materialState.edgeAlpha;\n gl.uniform4f(this._uEdgeColor, edgeColor[0], edgeColor[1], edgeColor[2], edgeAlpha);\n }\n this._lastMaterialId = materialState.id;\n }\n\n gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);\n\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, meshState.clippable);\n }\n\n gl.uniform3fv(this._uOffset, meshState.offset);\n\n // Bind VBOs\n let indicesBuf;\n if (geometryState.primitive === gl.TRIANGLES) {\n indicesBuf = geometry._getEdgeIndices();\n } else if (geometryState.primitive === gl.LINES) {\n indicesBuf = geometryState.indicesBuf;\n }\n\n if (indicesBuf) {\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf, geometryState.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n frameCtx.bindArray++;\n }\n indicesBuf.bind();\n frameCtx.bindArray++;\n this._lastGeometryId = geometryState.id;\n }\n\n gl.drawElements(gl.LINES, indicesBuf.numItems, indicesBuf.itemType, 0);\n\n frameCtx.drawElements++;\n }\n};\n\nEmphasisEdgesRenderer.prototype._allocate = function (mesh) {\n\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n const sectionPlanesState = scene._sectionPlanesState;\n\n this._program = new Program(gl, this._shaderSource);\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n\n const program = this._program;\n\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._uEdgeColor = program.getLocation(\"edgeColor\");\n this._aPosition = program.getAttribute(\"position\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uGammaFactor = program.getLocation(\"gammaFactor\");\n this._uOffset = program.getLocation(\"offset\");\n\n if (scene.logarithmicDepthBufferEnabled ) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n};\n\nEmphasisEdgesRenderer.prototype._bindProgram = function (frameCtx) {\n\n const program = this._program;\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const camera = scene.camera;\n const project = camera.project;\n\n program.bind();\n\n frameCtx.useProgram++;\n\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n\n if (scene.logarithmicDepthBufferEnabled ) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n if (this._uGammaFactor) {\n gl.uniform1f(this._uGammaFactor, scene.gammaFactor);\n }\n};\n\nexport {EmphasisEdgesRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4702, + "__docId__": 4710, "kind": "variable", "name": "ids", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94200,7 +94416,7 @@ "ignore": true }, { - "__docId__": 4703, + "__docId__": 4711, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94221,7 +94437,7 @@ "ignore": true }, { - "__docId__": 4704, + "__docId__": 4712, "kind": "variable", "name": "renderers", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94242,7 +94458,7 @@ "ignore": true }, { - "__docId__": 4705, + "__docId__": 4713, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94273,7 +94489,7 @@ "ignore": true }, { - "__docId__": 4706, + "__docId__": 4714, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94293,7 +94509,7 @@ "ignore": true }, { - "__docId__": 4707, + "__docId__": 4715, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94313,7 +94529,7 @@ "ignore": true }, { - "__docId__": 4708, + "__docId__": 4716, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94352,7 +94568,7 @@ "ignore": true }, { - "__docId__": 4709, + "__docId__": 4717, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94379,7 +94595,7 @@ "return": null }, { - "__docId__": 4710, + "__docId__": 4718, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94406,7 +94622,7 @@ "return": null }, { - "__docId__": 4711, + "__docId__": 4719, "kind": "function", "name": "EmphasisEdgesRenderer", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js", @@ -94438,18 +94654,18 @@ "return": null }, { - "__docId__": 4712, + "__docId__": 4720, "kind": "file", "name": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", "content": "\n\n/**\n * @private\n */\nclass EmphasisEdgesShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const billboard = mesh._state.billboard;\n const stationary = mesh._state.stationary;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Edges drawing vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform vec4 edgeColor;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n src.push(\"out vec4 vColor;\");\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n src.push(\"billboard(modelViewMatrix);\");\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = modelViewMatrix * localPosition;\");\n } else {\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = viewMatrix2 * worldPosition; \");\n }\n src.push(\"vColor = edgeColor;\");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragment(mesh) {\n\n const scene = mesh.scene;\n const sectionPlanesState = mesh.scene._sectionPlanesState;\n const gammaOutput = mesh.scene.gammaOutput;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Edges drawing fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (gammaOutput) {\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"uniform bool clippable;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n if (gammaOutput) {\n src.push(\"outColor = linearToGamma(vColor, gammaFactor);\");\n } else {\n src.push(\"outColor = vColor;\");\n }\n src.push(\"}\");\n return src;\n}\n\nexport {EmphasisEdgesShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4713, + "__docId__": 4721, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", @@ -94480,7 +94696,7 @@ "ignore": true }, { - "__docId__": 4714, + "__docId__": 4722, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", @@ -94511,7 +94727,7 @@ "ignore": true }, { - "__docId__": 4715, + "__docId__": 4723, "kind": "class", "name": "EmphasisEdgesShaderSource", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js", @@ -94527,7 +94743,7 @@ "ignore": true }, { - "__docId__": 4716, + "__docId__": 4724, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js~EmphasisEdgesShaderSource", @@ -94541,7 +94757,7 @@ "undocument": true }, { - "__docId__": 4717, + "__docId__": 4725, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js~EmphasisEdgesShaderSource", @@ -94558,7 +94774,7 @@ } }, { - "__docId__": 4718, + "__docId__": 4726, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js~EmphasisEdgesShaderSource", @@ -94575,18 +94791,18 @@ } }, { - "__docId__": 4719, + "__docId__": 4727, "kind": "file", "name": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {Map} from \"../../utils/Map.js\";\nimport {EmphasisFillShaderSource} from \"./EmphasisFillShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from '../../stats.js';\nimport {math} from \"../../math/math.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\n\nconst ids = new Map({});\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nconst EmphasisFillRenderer = function (hash, mesh) {\n this.id = ids.addItem({});\n this._hash = hash;\n this._scene = mesh.scene;\n this._useCount = 0;\n this._shaderSource = new EmphasisFillShaderSource(mesh);\n this._allocate(mesh);\n};\n\nconst xrayFillRenderers = {};\n\nEmphasisFillRenderer.get = function (mesh) {\n const hash = [\n mesh.scene.id,\n mesh.scene.gammaOutput ? \"go\" : \"\", // Gamma input not needed\n mesh.scene._sectionPlanesState.getHash(),\n !!mesh._geometry._state.normalsBuf ? \"n\" : \"\",\n mesh._geometry._state.compressGeometry ? \"cp\" : \"\",\n mesh._state.hash\n ].join(\";\");\n let renderer = xrayFillRenderers[hash];\n if (!renderer) {\n renderer = new EmphasisFillRenderer(hash, mesh);\n xrayFillRenderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nEmphasisFillRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n ids.removeItem(this.id);\n if (this._program) {\n this._program.destroy();\n }\n delete xrayFillRenderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nEmphasisFillRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nEmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const scene = this._scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const materialState = mode === 0 ? mesh._xrayMaterial._state : (mode === 1 ? mesh._highlightMaterial._state : mesh._selectedMaterial._state);\n const meshState = mesh._state;\n const geometryState = mesh._geometry._state;\n const origin = mesh.origin;\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);\n gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n if (materialState.id !== this._lastMaterialId) {\n const fillColor = materialState.fillColor;\n const backfaces = materialState.backfaces;\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n gl.uniform4f(this._uFillColor, fillColor[0], fillColor[1], fillColor[2], materialState.fillAlpha);\n this._lastMaterialId = materialState.id;\n }\n\n gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);\n if (this._uModelNormalMatrix) {\n gl.uniformMatrix4fv(this._uModelNormalMatrix, gl.FALSE, mesh.worldNormalMatrix);\n }\n\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, meshState.clippable);\n }\n\n gl.uniform3fv(this._uOffset, meshState.offset);\n\n // Bind VBOs\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (this._uUVDecodeMatrix) {\n gl.uniformMatrix3fv(this._uUVDecodeMatrix, false, geometryState.uvDecodeMatrix);\n }\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf);\n frameCtx.bindArray++;\n }\n if (this._aNormal) {\n this._aNormal.bindArrayBuffer(geometryState.normalsBuf);\n frameCtx.bindArray++;\n }\n if (geometryState.indicesBuf) {\n geometryState.indicesBuf.bind();\n frameCtx.bindArray++;\n // gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n // frameCtx.drawElements++;\n } else if (geometryState.positionsBuf) {\n // gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);\n // frameCtx.drawArrays++;\n }\n this._lastGeometryId = geometryState.id;\n }\n\n if (geometryState.indicesBuf) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n frameCtx.drawElements++;\n } else if (geometryState.positionsBuf) {\n gl.drawArrays(gl.TRIANGLES, 0, geometryState.positionsBuf.numItems);\n frameCtx.drawArrays++;\n }\n};\n\nEmphasisFillRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const lightsState = scene._lightsState;\n const sectionPlanesState = scene._sectionPlanesState;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._shaderSource);\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uModelNormalMatrix = program.getLocation(\"modelNormalMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uViewNormalMatrix = program.getLocation(\"viewNormalMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uLightAmbient = [];\n this._uLightColor = [];\n this._uLightDir = [];\n this._uLightPos = [];\n this._uLightAttenuation = [];\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n switch (light.type) {\n case \"ambient\":\n this._uLightAmbient[i] = program.getLocation(\"lightAmbient\");\n break;\n case \"dir\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = null;\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n break;\n case \"point\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = null;\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n }\n }\n this._uSectionPlanes = [];\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._uFillColor = program.getLocation(\"fillColor\");\n this._aPosition = program.getAttribute(\"position\");\n this._aNormal = program.getAttribute(\"normal\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uGammaFactor = program.getLocation(\"gammaFactor\");\n this._uOffset = program.getLocation(\"offset\");\n if (scene.logarithmicDepthBufferEnabled ) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n};\n\nEmphasisFillRenderer.prototype._bindProgram = function (frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const lightsState = scene._lightsState;\n const camera = scene.camera;\n const project = camera.project;\n const program = this._program;\n program.bind();\n frameCtx.useProgram++;\n frameCtx.textureUnit = 0;\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n this._lastIndicesBufId = null;\n gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.normalMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n if (scene.logarithmicDepthBufferEnabled ) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (this._uLightAmbient[i]) {\n gl.uniform4f(this._uLightAmbient[i], light.color[0], light.color[1], light.color[2], light.intensity);\n } else {\n if (this._uLightColor[i]) {\n gl.uniform4f(this._uLightColor[i], light.color[0], light.color[1], light.color[2], light.intensity);\n }\n if (this._uLightPos[i]) {\n gl.uniform3fv(this._uLightPos[i], light.pos);\n if (this._uLightAttenuation[i]) {\n gl.uniform1f(this._uLightAttenuation[i], light.attenuation);\n }\n }\n if (this._uLightDir[i]) {\n gl.uniform3fv(this._uLightDir[i], light.dir);\n }\n }\n }\n if (this._uGammaFactor) {\n gl.uniform1f(this._uGammaFactor, scene.gammaFactor);\n }\n};\n\nexport {EmphasisFillRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4720, + "__docId__": 4728, "kind": "variable", "name": "ids", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94607,7 +94823,7 @@ "ignore": true }, { - "__docId__": 4721, + "__docId__": 4729, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94628,7 +94844,7 @@ "ignore": true }, { - "__docId__": 4722, + "__docId__": 4730, "kind": "variable", "name": "xrayFillRenderers", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94649,7 +94865,7 @@ "ignore": true }, { - "__docId__": 4723, + "__docId__": 4731, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94680,7 +94896,7 @@ "ignore": true }, { - "__docId__": 4724, + "__docId__": 4732, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94700,7 +94916,7 @@ "ignore": true }, { - "__docId__": 4725, + "__docId__": 4733, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94720,7 +94936,7 @@ "ignore": true }, { - "__docId__": 4726, + "__docId__": 4734, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94759,7 +94975,7 @@ "ignore": true }, { - "__docId__": 4727, + "__docId__": 4735, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94786,7 +95002,7 @@ "return": null }, { - "__docId__": 4728, + "__docId__": 4736, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94813,7 +95029,7 @@ "return": null }, { - "__docId__": 4729, + "__docId__": 4737, "kind": "function", "name": "EmphasisFillRenderer", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js", @@ -94845,18 +95061,18 @@ "return": null }, { - "__docId__": 4730, + "__docId__": 4738, "kind": "file", "name": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", "content": "import {WEBGL_INFO} from \"../../webglInfo.js\";\n\n/**\n * @private\n */\nclass EmphasisFillShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n\n const scene = mesh.scene;\n const lightsState = scene._lightsState;\n const normals = hasNormals(mesh);\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const billboard = mesh._state.billboard;\n const stationary = mesh._state.stationary;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EmphasisFillShaderSource vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform vec4 colorize;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n src.push(\"uniform vec4 lightAmbient;\");\n src.push(\"uniform vec4 fillColor;\");\n if (normals) {\n src.push(\"in vec3 normal;\");\n src.push(\"uniform mat4 modelNormalMatrix;\");\n src.push(\"uniform mat4 viewNormalMatrix;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n }\n if (quantizedGeometry) {\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n }\n }\n src.push(\"out vec4 vColor;\");\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n if (normals) {\n if (quantizedGeometry) {\n src.push(\"vec4 localNormal = vec4(octDecode(normal.xy), 0.0); \");\n } else {\n src.push(\"vec4 localNormal = vec4(normal, 0.0); \");\n }\n src.push(\"mat4 modelNormalMatrix2 = modelNormalMatrix;\");\n src.push(\"mat4 viewNormalMatrix2 = viewNormalMatrix;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n src.push(\"billboard(modelViewMatrix);\");\n if (normals) {\n src.push(\"mat4 modelViewNormalMatrix = viewNormalMatrix2 * modelNormalMatrix2;\");\n src.push(\"billboard(modelNormalMatrix2);\");\n src.push(\"billboard(viewNormalMatrix2);\");\n src.push(\"billboard(modelViewNormalMatrix);\");\n }\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"vec4 viewPosition = modelViewMatrix * localPosition;\");\n } else {\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = viewMatrix2 * worldPosition; \");\n }\n if (normals) {\n src.push(\"vec3 viewNormal = normalize((viewNormalMatrix2 * modelNormalMatrix2 * localNormal).xyz);\");\n }\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n src.push(\"float lambertian = 1.0;\");\n if (normals) {\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix2 * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix2 * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n }\n // TODO: A blending mode for emphasis materials, to select add/multiply/mix\n //src.push(\"vColor = vec4((mix(reflectedColor, fillColor.rgb, 0.7)), fillColor.a);\");\n src.push(\"vColor = vec4(reflectedColor * fillColor.rgb, fillColor.a);\");\n //src.push(\"vColor = vec4(reflectedColor + fillColor.rgb, fillColor.a);\");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n }\n if (mesh._geometry._state.primitiveName === \"points\") {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n return src;\n}\n\nfunction hasNormals(mesh) {\n const primitive = mesh._geometry._state.primitiveName;\n if ((mesh._geometry._state.autoVertexNormals || mesh._geometry._state.normalsBuf) && (primitive === \"triangles\" || primitive === \"triangle-strip\" || primitive === \"triangle-fan\")) {\n return true;\n }\n return false;\n}\n\nfunction buildFragment(mesh) {\n\n const scene = mesh.scene;\n const sectionPlanesState = mesh.scene._sectionPlanesState;\n const gammaOutput = mesh.scene.gammaOutput;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Lambertian drawing fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (gammaOutput) {\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"uniform bool clippable;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (mesh._geometry._state.primitiveName === \"points\") {\n src.push(\"vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\"float r = dot(cxy, cxy);\");\n src.push(\"if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n if (gammaOutput) {\n src.push(\"outColor = linearToGamma(vColor, gammaFactor);\");\n } else {\n src.push(\"outColor = vColor;\");\n }\n src.push(\"}\");\n return src;\n}\n\nexport {EmphasisFillShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4731, + "__docId__": 4739, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", @@ -94887,7 +95103,7 @@ "ignore": true }, { - "__docId__": 4732, + "__docId__": 4740, "kind": "function", "name": "hasNormals", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", @@ -94918,7 +95134,7 @@ "ignore": true }, { - "__docId__": 4733, + "__docId__": 4741, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", @@ -94949,7 +95165,7 @@ "ignore": true }, { - "__docId__": 4734, + "__docId__": 4742, "kind": "class", "name": "EmphasisFillShaderSource", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js", @@ -94965,7 +95181,7 @@ "ignore": true }, { - "__docId__": 4735, + "__docId__": 4743, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js~EmphasisFillShaderSource", @@ -94979,7 +95195,7 @@ "undocument": true }, { - "__docId__": 4736, + "__docId__": 4744, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js~EmphasisFillShaderSource", @@ -94996,7 +95212,7 @@ } }, { - "__docId__": 4737, + "__docId__": 4745, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js~EmphasisFillShaderSource", @@ -95013,29 +95229,29 @@ } }, { - "__docId__": 4738, + "__docId__": 4746, "kind": "file", "name": "src/viewer/scene/mesh/index.js", "content": "export * from \"./Mesh.js\";\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4739, + "__docId__": 4747, "kind": "file", "name": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {OcclusionShaderSource} from \"./OcclusionShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from \"../../stats.js\";\nimport {math} from \"../../math/math.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\n\n// No ID, because there is exactly one PickMeshRenderer per scene\n\n/**\n * @private\n */\nconst OcclusionRenderer = function (hash, mesh) {\n this._hash = hash;\n this._shaderSource = new OcclusionShaderSource(mesh);\n this._scene = mesh.scene;\n this._useCount = 0;\n this._allocate(mesh);\n};\n\nconst renderers = {};\n\nOcclusionRenderer.get = function (mesh) {\n const hash = [\n mesh.scene.canvas.canvas.id,\n mesh.scene._sectionPlanesState.getHash(),\n mesh._geometry._state.hash,\n mesh._state.occlusionHash\n ].join(\";\");\n let renderer = renderers[hash];\n if (!renderer) {\n renderer = new OcclusionRenderer(hash, mesh);\n if (renderer.errors) {\n console.log(renderer.errors.join(\"\\n\"));\n return null;\n }\n renderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nOcclusionRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n if (this._program) {\n this._program.destroy();\n }\n delete renderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nOcclusionRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nOcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const materialState = mesh._material._state;\n const meshState = mesh._state;\n const geometryState = mesh._geometry._state;\n const origin = mesh.origin;\n\n if (materialState.alpha < 1.0) {\n return;\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n\n if (materialState.id !== this._lastMaterialId) {\n const backfaces = materialState.backfaces;\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n const frontface = materialState.frontface;\n if (frameCtx.frontface !== frontface) {\n if (frontface) {\n gl.frontFace(gl.CCW);\n } else {\n gl.frontFace(gl.CW);\n }\n frameCtx.frontface = frontface;\n }\n this._lastMaterialId = materialState.id;\n }\n\n const camera = scene.camera;\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera._project._state.matrix);\n gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);\n\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, mesh._state.clippable);\n }\n\n gl.uniform3fv(this._uOffset, mesh._state.offset);\n\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf, geometryState.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n frameCtx.bindArray++;\n }\n if (geometryState.indicesBuf) {\n geometryState.indicesBuf.bind();\n frameCtx.bindArray++;\n }\n this._lastGeometryId = geometryState.id;\n }\n if (geometryState.indicesBuf) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n frameCtx.drawElements++;\n } else if (geometryState.positions) {\n gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);\n }\n};\n\nOcclusionRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._shaderSource);\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n const clips = scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = clips.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uOffset = program.getLocation(\"offset\");\n if (scene.logarithmicDepthBufferEnabled ) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n};\n\nOcclusionRenderer.prototype._bindProgram = function (frameCtx) {\n const scene = this._scene;\n const project = scene.camera.project;\n const gl = scene.canvas.gl;\n this._program.bind();\n frameCtx.useProgram++;\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n if (scene.logarithmicDepthBufferEnabled ) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n};\n\nexport {OcclusionRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4740, + "__docId__": 4748, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95056,7 +95272,7 @@ "ignore": true }, { - "__docId__": 4741, + "__docId__": 4749, "kind": "variable", "name": "renderers", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95077,7 +95293,7 @@ "ignore": true }, { - "__docId__": 4742, + "__docId__": 4750, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95108,7 +95324,7 @@ "ignore": true }, { - "__docId__": 4743, + "__docId__": 4751, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95128,7 +95344,7 @@ "ignore": true }, { - "__docId__": 4744, + "__docId__": 4752, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95148,7 +95364,7 @@ "ignore": true }, { - "__docId__": 4745, + "__docId__": 4753, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95181,7 +95397,7 @@ "ignore": true }, { - "__docId__": 4746, + "__docId__": 4754, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95208,7 +95424,7 @@ "return": null }, { - "__docId__": 4747, + "__docId__": 4755, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95235,7 +95451,7 @@ "return": null }, { - "__docId__": 4748, + "__docId__": 4756, "kind": "function", "name": "OcclusionRenderer", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionRenderer.js", @@ -95267,18 +95483,18 @@ "return": null }, { - "__docId__": 4749, + "__docId__": 4757, "kind": "file", "name": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {WEBGL_INFO} from \"../../webglInfo.js\";\n\n/**\n * @private\n */\nclass OcclusionShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const billboard = mesh._state.billboard;\n const stationary = mesh._state.stationary;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Mesh occlusion vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n src.push(\"billboard(modelViewMatrix);\");\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = modelViewMatrix * localPosition;\");\n } else {\n src.push(\"worldPosition = modelMatrix2 * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = viewMatrix2 * worldPosition; \");\n }\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragment(mesh) {\n\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Mesh occlusion fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"uniform bool clippable;\");\n src.push(\"in vec4 vWorldPosition;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n\n return src;\n}\n\nexport {OcclusionShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4750, + "__docId__": 4758, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", @@ -95309,7 +95525,7 @@ "ignore": true }, { - "__docId__": 4751, + "__docId__": 4759, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", @@ -95340,7 +95556,7 @@ "ignore": true }, { - "__docId__": 4752, + "__docId__": 4760, "kind": "class", "name": "OcclusionShaderSource", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js", @@ -95356,7 +95572,7 @@ "ignore": true }, { - "__docId__": 4753, + "__docId__": 4761, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js~OcclusionShaderSource", @@ -95370,7 +95586,7 @@ "undocument": true }, { - "__docId__": 4754, + "__docId__": 4762, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js~OcclusionShaderSource", @@ -95387,7 +95603,7 @@ } }, { - "__docId__": 4755, + "__docId__": 4763, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js~OcclusionShaderSource", @@ -95404,18 +95620,18 @@ } }, { - "__docId__": 4756, + "__docId__": 4764, "kind": "file", "name": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {PickMeshShaderSource} from \"./PickMeshShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from \"../../stats.js\";\nimport {math} from \"../../math/math.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\n\n// No ID, because there is exactly one PickMeshRenderer per scene\n\n/**\n * @private\n */\nconst PickMeshRenderer = function (hash, mesh) {\n this._hash = hash;\n this._shaderSource = new PickMeshShaderSource(mesh);\n this._scene = mesh.scene;\n this._useCount = 0;\n this._allocate(mesh);\n};\n\nconst renderers = {};\n\nPickMeshRenderer.get = function (mesh) {\n const hash = [\n mesh.scene.canvas.canvas.id,\n mesh.scene._sectionPlanesState.getHash(),\n mesh._geometry._state.hash,\n mesh._state.hash\n ].join(\";\");\n let renderer = renderers[hash];\n if (!renderer) {\n renderer = new PickMeshRenderer(hash, mesh);\n if (renderer.errors) {\n console.log(renderer.errors.join(\"\\n\"));\n return null;\n }\n renderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nPickMeshRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n if (this._program) {\n this._program.destroy();\n }\n delete renderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nPickMeshRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nPickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const meshState = mesh._state;\n const materialState = mesh._material._state;\n const geometryState = mesh._geometry._state;\n const origin = mesh.origin;\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n if (materialState.id !== this._lastMaterialId) {\n const backfaces = materialState.backfaces;\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n const frontface = materialState.frontface;\n if (frameCtx.frontface !== frontface) {\n if (frontface) {\n gl.frontFace(gl.CCW);\n } else {\n gl.frontFace(gl.CW);\n }\n frameCtx.frontface = frontface;\n }\n this._lastMaterialId = materialState.id;\n }\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, frameCtx.pickProjMatrix);\n gl.uniformMatrix4fv(this._uModelMatrix, false, mesh.worldMatrix);\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, mesh._state.clippable);\n }\n gl.uniform3fv(this._uOffset, mesh._state.offset);\n\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf, geometryState.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n frameCtx.bindArray++;\n }\n if (geometryState.indicesBuf) {\n geometryState.indicesBuf.bind();\n frameCtx.bindArray++;\n }\n this._lastGeometryId = geometryState.id;\n }\n\n // Mesh-indexed color\n var pickID = mesh._state.pickID;\n const a = pickID >> 24 & 0xFF;\n const b = pickID >> 16 & 0xFF;\n const g = pickID >> 8 & 0xFF;\n const r = pickID & 0xFF;\n gl.uniform4f(this._uPickColor, r / 255, g / 255, b / 255, a / 255);\n\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n\n if (geometryState.indicesBuf) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n frameCtx.drawElements++;\n } else if (geometryState.positions) {\n gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);\n }\n};\n\nPickMeshRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._shaderSource);\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n const clips = scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = clips.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uPickColor = program.getLocation(\"pickColor\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uOffset = program.getLocation(\"offset\");\n if (scene.logarithmicDepthBufferEnabled ) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._lastMaterialId = null;\n this._lastGeometryId = null;\n};\n\nPickMeshRenderer.prototype._bindProgram = function (frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const project = scene.camera.project;\n this._program.bind();\n frameCtx.useProgram++;\n if (scene.logarithmicDepthBufferEnabled ) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n this._lastMaterialId = null;\n this._lastGeometryId = null;\n};\n\nexport {PickMeshRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/pick/PickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/pick/PickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4757, + "__docId__": 4765, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95436,7 +95652,7 @@ "ignore": true }, { - "__docId__": 4758, + "__docId__": 4766, "kind": "variable", "name": "renderers", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95457,7 +95673,7 @@ "ignore": true }, { - "__docId__": 4759, + "__docId__": 4767, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95488,7 +95704,7 @@ "ignore": true }, { - "__docId__": 4760, + "__docId__": 4768, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95508,7 +95724,7 @@ "ignore": true }, { - "__docId__": 4761, + "__docId__": 4769, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95528,7 +95744,7 @@ "ignore": true }, { - "__docId__": 4762, + "__docId__": 4770, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95561,7 +95777,7 @@ "ignore": true }, { - "__docId__": 4763, + "__docId__": 4771, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95588,7 +95804,7 @@ "return": null }, { - "__docId__": 4764, + "__docId__": 4772, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95615,7 +95831,7 @@ "return": null }, { - "__docId__": 4765, + "__docId__": 4773, "kind": "function", "name": "PickMeshRenderer", "memberof": "src/viewer/scene/mesh/pick/PickMeshRenderer.js", @@ -95647,18 +95863,18 @@ "return": null }, { - "__docId__": 4766, + "__docId__": 4774, "kind": "file", "name": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\n/**\n * @private\n */\nclass PickMeshShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const billboard = mesh._state.billboard;\n const stationary = mesh._state.stationary;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Mesh picking vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"void billboard(inout mat4 mat) {\");\n src.push(\" mat[0][0] = 1.0;\");\n src.push(\" mat[0][1] = 0.0;\");\n src.push(\" mat[0][2] = 0.0;\");\n if (billboard === \"spherical\") {\n src.push(\" mat[1][0] = 0.0;\");\n src.push(\" mat[1][1] = 1.0;\");\n src.push(\" mat[1][2] = 0.0;\");\n }\n src.push(\" mat[2][0] = 0.0;\");\n src.push(\" mat[2][1] = 0.0;\");\n src.push(\" mat[2][2] =1.0;\");\n src.push(\"}\");\n }\n\n src.push(\"uniform vec2 pickClipPos;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\")\n src.push(\" clipPos.xy -= pickClipPos;\");\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n src.push(\"mat4 viewMatrix2 = viewMatrix;\");\n src.push(\"mat4 modelMatrix2 = modelMatrix;\");\n if (stationary) {\n src.push(\"viewMatrix2[3][0] = viewMatrix2[3][1] = viewMatrix2[3][2] = 0.0;\")\n }\n if (billboard === \"spherical\" || billboard === \"cylindrical\") {\n src.push(\"mat4 modelViewMatrix = viewMatrix2 * modelMatrix2;\");\n src.push(\"billboard(modelMatrix2);\");\n src.push(\"billboard(viewMatrix2);\");\n }\n src.push(\" vec4 worldPosition = modelMatrix2 * localPosition;\");\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\" vec4 viewPosition = viewMatrix2 * worldPosition;\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragment(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Mesh picking fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform vec4 pickColor;\");\n if (clipping) {\n src.push(\"uniform bool clippable;\");\n src.push(\"in vec4 vWorldPosition;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = pickColor; \");\n src.push(\"}\");\n return src;\n}\n\nexport {PickMeshShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/pick/PickMeshShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/pick/PickMeshShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4767, + "__docId__": 4775, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js", @@ -95689,7 +95905,7 @@ "ignore": true }, { - "__docId__": 4768, + "__docId__": 4776, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js", @@ -95720,7 +95936,7 @@ "ignore": true }, { - "__docId__": 4769, + "__docId__": 4777, "kind": "class", "name": "PickMeshShaderSource", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js", @@ -95736,7 +95952,7 @@ "ignore": true }, { - "__docId__": 4770, + "__docId__": 4778, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js~PickMeshShaderSource", @@ -95750,7 +95966,7 @@ "undocument": true }, { - "__docId__": 4771, + "__docId__": 4779, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js~PickMeshShaderSource", @@ -95767,7 +95983,7 @@ } }, { - "__docId__": 4772, + "__docId__": 4780, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/pick/PickMeshShaderSource.js~PickMeshShaderSource", @@ -95784,18 +96000,18 @@ } }, { - "__docId__": 4773, + "__docId__": 4781, "kind": "file", "name": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\nimport {PickTriangleShaderSource} from \"./PickTriangleShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from \"../../stats.js\";\nimport {getPlaneRTCPos} from \"../../math/rtcCoords.js\";\nimport {math} from \"../../math/math.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nconst PickTriangleRenderer = function (hash, mesh) {\n this._hash = hash;\n this._scene = mesh.scene;\n this._useCount = 0;\n this._shaderSource = new PickTriangleShaderSource(mesh);\n this._allocate(mesh);\n};\n\nconst renderers = {};\n\nPickTriangleRenderer.get = function (mesh) {\n const hash = [\n mesh.scene.canvas.canvas.id,\n mesh.scene._sectionPlanesState.getHash(),\n mesh._geometry._state.compressGeometry ? \"cp\" : \"\",\n mesh._state.hash\n ].join(\";\");\n let renderer = renderers[hash];\n if (!renderer) {\n renderer = new PickTriangleRenderer(hash, mesh);\n if (renderer.errors) {\n console.log(renderer.errors.join(\"\\n\"));\n return null;\n }\n renderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nPickTriangleRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n if (this._program) {\n this._program.destroy();\n }\n delete renderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nPickTriangleRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nPickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {\n\n if (!this._program) {\n this._allocate(mesh);\n }\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const meshState = mesh._state;\n const materialState = mesh._material._state;\n const geometry = mesh._geometry;\n const geometryState = mesh._geometry._state;\n const origin = mesh.origin;\n const backfaces = materialState.backfaces;\n const frontface = materialState.frontface;\n const project = scene.camera.project;\n const positionsBuf = geometry._getPickTrianglePositions();\n const pickColorsBuf = geometry._getPickTriangleColors();\n\n this._program.bind();\n\n frameCtx.useProgram++;\n\n if (scene.logarithmicDepthBufferEnabled ) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);\n\n if (meshState.clippable) {\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const renderFlags = mesh.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, frameCtx.pickProjMatrix);\n\n if (scene.logarithmicDepthBufferEnabled) {\n gl.uniform1f(this._uZFar, scene.camera.project.far);\n }\n\n if (frameCtx.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n if (frameCtx.frontface !== frontface) {\n if (frontface) {\n gl.frontFace(gl.CCW);\n } else {\n gl.frontFace(gl.CW);\n }\n frameCtx.frontface = frontface;\n }\n\n gl.uniformMatrix4fv(this._uModelMatrix, false, mesh.worldMatrix);\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, mesh._state.clippable);\n }\n gl.uniform3fv(this._uOffset, mesh._state.offset);\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n this._aPosition.bindArrayBuffer(positionsBuf, geometryState.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n } else {\n this._aPosition.bindArrayBuffer(positionsBuf);\n }\n\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n\n pickColorsBuf.bind();\n gl.enableVertexAttribArray(this._aColor.location);\n gl.vertexAttribPointer(this._aColor.location, pickColorsBuf.itemSize, pickColorsBuf.itemType, true, 0, 0); // Normalize\n gl.drawArrays(geometryState.primitive, 0, positionsBuf.numItems / 3);\n};\n\nPickTriangleRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._shaderSource);\n this._useCount = 0;\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = sectionPlanes.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n this._aColor = program.getAttribute(\"color\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uOffset = program.getLocation(\"offset\");\n if (scene.logarithmicDepthBufferEnabled ) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n};\n\nexport {PickTriangleRenderer};\n\n\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/pick/PickTriangleRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/pick/PickTriangleRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4774, + "__docId__": 4782, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95816,7 +96032,7 @@ "ignore": true }, { - "__docId__": 4775, + "__docId__": 4783, "kind": "variable", "name": "renderers", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95837,7 +96053,7 @@ "ignore": true }, { - "__docId__": 4776, + "__docId__": 4784, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95868,7 +96084,7 @@ "ignore": true }, { - "__docId__": 4777, + "__docId__": 4785, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95888,7 +96104,7 @@ "ignore": true }, { - "__docId__": 4778, + "__docId__": 4786, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95908,7 +96124,7 @@ "ignore": true }, { - "__docId__": 4779, + "__docId__": 4787, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95941,7 +96157,7 @@ "ignore": true }, { - "__docId__": 4780, + "__docId__": 4788, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -95968,7 +96184,7 @@ "return": null }, { - "__docId__": 4781, + "__docId__": 4789, "kind": "function", "name": "PickTriangleRenderer", "memberof": "src/viewer/scene/mesh/pick/PickTriangleRenderer.js", @@ -96000,18 +96216,18 @@ "return": null }, { - "__docId__": 4782, + "__docId__": 4790, "kind": "file", "name": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", "content": "/**\n * @private\n */\n\nclass PickTriangleShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Surface picking vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform vec3 offset;\");\n if (clipping) {\n src.push(\"uniform bool clippable;\");\n src.push(\"out vec4 vWorldPosition;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec2 pickClipPos;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\")\n src.push(\" clipPos.xy -= pickClipPos;\");\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"out vec4 vColor;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n src.push(\" vec4 worldPosition = modelMatrix * localPosition; \");\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition;\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n }\n src.push(\" vColor = color;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragment(mesh) {\n const scene = mesh.scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Surface picking fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n src.push(\"in vec4 vColor;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"uniform bool clippable;\");\n src.push(\"in vec4 vWorldPosition;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vColor;\");\n src.push(\"}\");\n return src;\n}\n\nexport {PickTriangleShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4783, + "__docId__": 4791, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", @@ -96042,7 +96258,7 @@ "ignore": true }, { - "__docId__": 4784, + "__docId__": 4792, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", @@ -96073,7 +96289,7 @@ "ignore": true }, { - "__docId__": 4785, + "__docId__": 4793, "kind": "class", "name": "PickTriangleShaderSource", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js", @@ -96089,7 +96305,7 @@ "ignore": true }, { - "__docId__": 4786, + "__docId__": 4794, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js~PickTriangleShaderSource", @@ -96103,7 +96319,7 @@ "undocument": true }, { - "__docId__": 4787, + "__docId__": 4795, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js~PickTriangleShaderSource", @@ -96120,7 +96336,7 @@ } }, { - "__docId__": 4788, + "__docId__": 4796, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/pick/PickTriangleShaderSource.js~PickTriangleShaderSource", @@ -96137,18 +96353,18 @@ } }, { - "__docId__": 4789, + "__docId__": 4797, "kind": "file", "name": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", "content": "import {ShadowShaderSource} from \"./ShadowShaderSource.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from \"../../stats.js\";\n\n/**\n * @private\n */\nconst ShadowRenderer = function (hash, mesh) {\n this._hash = hash;\n this._shaderSource = new ShadowShaderSource(mesh);\n this._scene = mesh.scene;\n this._useCount = 0;\n this._allocate(mesh);\n};\n\nconst renderers = {};\n\nShadowRenderer.get = function (mesh) {\n const scene = mesh.scene;\n const hash = [scene.canvas.canvas.id, scene._sectionPlanesState.getHash(), mesh._geometry._state.hash, mesh._state.hash].join(\";\");\n let renderer = renderers[hash];\n if (!renderer) {\n renderer = new ShadowRenderer(hash, mesh);\n if (renderer.errors) {\n console.log(renderer.errors.join(\"\\n\"));\n return null;\n }\n renderers[hash] = renderer;\n stats.memory.programs++;\n }\n renderer._useCount++;\n return renderer;\n};\n\nShadowRenderer.prototype.put = function () {\n if (--this._useCount === 0) {\n if (this._program) {\n this._program.destroy();\n }\n delete renderers[this._hash];\n stats.memory.programs--;\n }\n};\n\nShadowRenderer.prototype.webglContextRestored = function () {\n this._program = null;\n};\n\nShadowRenderer.prototype.drawMesh = function (frame, mesh) {\n if (!this._program) {\n this._allocate(mesh);\n }\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const materialState = mesh._material._state;\n const geometryState = mesh._geometry._state;\n if (frame.lastProgramId !== this._program.id) {\n frame.lastProgramId = this._program.id;\n this._bindProgram(frame);\n }\n if (materialState.id !== this._lastMaterialId) {\n const backfaces = materialState.backfaces;\n if (frame.backfaces !== backfaces) {\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frame.backfaces = backfaces;\n }\n const frontface = materialState.frontface;\n if (frame.frontface !== frontface) {\n if (frontface) {\n gl.frontFace(gl.CCW);\n } else {\n gl.frontFace(gl.CW);\n }\n frame.frontface = frontface;\n }\n if (frame.lineWidth !== materialState.lineWidth) {\n gl.lineWidth(materialState.lineWidth);\n frame.lineWidth = materialState.lineWidth;\n }\n if (this._uPointSize) {\n gl.uniform1i(this._uPointSize, materialState.pointSize);\n }\n this._lastMaterialId = materialState.id;\n }\n gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);\n if (geometryState.combineGeometry) {\n const vertexBufs = mesh.vertexBufs;\n if (vertexBufs.id !== this._lastVertexBufsId) {\n if (vertexBufs.positionsBuf && this._aPosition) {\n this._aPosition.bindArrayBuffer(vertexBufs.positionsBuf, vertexBufs.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n frame.bindArray++;\n }\n this._lastVertexBufsId = vertexBufs.id;\n }\n }\n if (this._uClippable) {\n gl.uniform1i(this._uClippable, mesh._state.clippable);\n }\n gl.uniform3fv(this._uOffset, mesh._state.offset);\n if (geometryState.id !== this._lastGeometryId) {\n if (this._uPositionsDecodeMatrix) {\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);\n }\n if (geometryState.combineGeometry) { // VBOs were bound by the preceding VertexBufs chunk\n if (geometryState.indicesBufCombined) {\n geometryState.indicesBufCombined.bind();\n frame.bindArray++;\n }\n } else {\n if (this._aPosition) {\n this._aPosition.bindArrayBuffer(geometryState.positionsBuf, geometryState.compressGeometry ? gl.UNSIGNED_SHORT : gl.FLOAT);\n frame.bindArray++;\n }\n if (geometryState.indicesBuf) {\n geometryState.indicesBuf.bind();\n frame.bindArray++;\n }\n }\n this._lastGeometryId = geometryState.id;\n }\n if (geometryState.combineGeometry) {\n if (geometryState.indicesBufCombined) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBufCombined.numItems, geometryState.indicesBufCombined.itemType, 0);\n frame.drawElements++;\n } else {\n // TODO: drawArrays() with VertexBufs positions\n }\n } else {\n if (geometryState.indicesBuf) {\n gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);\n frame.drawElements++;\n } else if (geometryState.positions) {\n gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);\n frame.drawArrays++;\n }\n }\n};\n\nShadowRenderer.prototype._allocate = function (mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._shaderSource);\n this._scene = scene;\n this._useCount = 0;\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uPositionsDecodeMatrix = program.getLocation(\"positionsDecodeMatrix\");\n this._uModelMatrix = program.getLocation(\"modelMatrix\");\n this._uShadowViewMatrix = program.getLocation(\"shadowViewMatrix\");\n this._uShadowProjMatrix = program.getLocation(\"shadowProjMatrix\");\n this._uSectionPlanes = {};\n const clips = scene._sectionPlanesState.sectionPlanes;\n for (let i = 0, len = clips.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n this._uClippable = program.getLocation(\"clippable\");\n this._uOffset = program.getLocation(\"offset\");\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n};\n\nShadowRenderer.prototype._bindProgram = function (frame) {\n if (!this._program) {\n this._allocate(mesh);\n }\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const sectionPlanesState = scene._sectionPlanesState;\n this._program.bind();\n frame.useProgram++;\n gl.uniformMatrix4fv(this._uShadowViewMatrix, false, frame.shadowViewMatrix);\n gl.uniformMatrix4fv(this._uShadowProjMatrix, false, frame.shadowProjMatrix);\n this._lastMaterialId = null;\n this._lastVertexBufsId = null;\n this._lastGeometryId = null;\n if (sectionPlanesState.getNumAllocatedSectionPlanes() > 0) {\n let sectionPlaneUniforms;\n let uSectionPlaneActive;\n let sectionPlane;\n let uSectionPlanePos;\n let uSectionPlaneDir;\n for (let i = 0, len = this._uSectionPlanes.length; i < len; i++) {\n sectionPlaneUniforms = this._uSectionPlanes[i];\n uSectionPlaneActive = sectionPlaneUniforms.active;\n sectionPlane = sectionPlanesState.sectionPlanes[i];\n if (uSectionPlaneActive) {\n gl.uniform1i(uSectionPlaneActive, sectionPlane.active);\n }\n uSectionPlanePos = sectionPlaneUniforms.pos;\n if (uSectionPlanePos) {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n uSectionPlaneDir = sectionPlaneUniforms.dir;\n if (uSectionPlaneDir) {\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n }\n }\n};\n\nexport {ShadowRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/shadow/ShadowRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/shadow/ShadowRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4790, + "__docId__": 4798, "kind": "variable", "name": "renderers", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96169,7 +96385,7 @@ "ignore": true }, { - "__docId__": 4791, + "__docId__": 4799, "kind": "function", "name": "get", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96200,7 +96416,7 @@ "ignore": true }, { - "__docId__": 4792, + "__docId__": 4800, "kind": "function", "name": "put", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96220,7 +96436,7 @@ "ignore": true }, { - "__docId__": 4793, + "__docId__": 4801, "kind": "function", "name": "webglContextRestored", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96240,7 +96456,7 @@ "ignore": true }, { - "__docId__": 4794, + "__docId__": 4802, "kind": "function", "name": "drawMesh", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96273,7 +96489,7 @@ "ignore": true }, { - "__docId__": 4795, + "__docId__": 4803, "kind": "function", "name": "_allocate", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96300,7 +96516,7 @@ "return": null }, { - "__docId__": 4796, + "__docId__": 4804, "kind": "function", "name": "_bindProgram", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96327,7 +96543,7 @@ "return": null }, { - "__docId__": 4797, + "__docId__": 4805, "kind": "function", "name": "ShadowRenderer", "memberof": "src/viewer/scene/mesh/shadow/ShadowRenderer.js", @@ -96359,18 +96575,18 @@ "return": null }, { - "__docId__": 4798, + "__docId__": 4806, "kind": "file", "name": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js", "content": "/**\n * @private\n */\nclass ShadowShaderSource {\n constructor(mesh) {\n this.vertex = buildVertex(mesh);\n this.fragment = buildFragment(mesh);\n }\n}\n\nfunction buildVertex(mesh) {\n const scene = mesh.scene;\n const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;\n const quantizedGeometry = !!mesh._geometry._state.compressGeometry;\n const src = [];\n src.push(\"// Mesh shadow vertex shader\");\n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 shadowViewMatrix;\");\n src.push(\"uniform mat4 shadowProjMatrix;\");\n src.push(\"uniform vec3 offset;\");\n if (quantizedGeometry) {\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 localPosition = vec4(position, 1.0); \");\n src.push(\"vec4 worldPosition;\");\n if (quantizedGeometry) {\n src.push(\"localPosition = positionsDecodeMatrix * localPosition;\");\n }\n src.push(\"worldPosition = modelMatrix * localPosition;\");\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n src.push(\"vec4 viewPosition = shadowViewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n }\n src.push(\" gl_Position = shadowProjMatrix * viewPosition;\");\n src.push(\"}\");\n return src;\n}\n\nfunction buildFragment(mesh) {\n const scene = mesh.scene;\n const gl = scene.canvas.gl;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"// Mesh shadow fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (clipping) {\n src.push(\"uniform bool clippable;\");\n src.push(\"in vec4 vWorldPosition;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n src.push(\"vec4 encodeFloat( const in float depth ) {\");\n src.push(\" const vec4 bitShift = vec4(256 * 256 * 256, 256 * 256, 256, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\");\n src.push(\" vec4 comp = fract(depth * bitShift);\");\n src.push(\" comp -= comp.xxyz * bitMask;\");\n src.push(\" return comp;\");\n src.push(\"}\");\n\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\"if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\"outColor = encodeFloat(gl_FragCoord.z);\");\n src.push(\"}\");\n return src;\n}\n\nexport {ShadowShaderSource};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/mesh/shadow/ShadowShaderSource.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/mesh/shadow/ShadowShaderSource.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4799, + "__docId__": 4807, "kind": "function", "name": "buildVertex", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js", @@ -96401,7 +96617,7 @@ "ignore": true }, { - "__docId__": 4800, + "__docId__": 4808, "kind": "function", "name": "buildFragment", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js", @@ -96432,7 +96648,7 @@ "ignore": true }, { - "__docId__": 4801, + "__docId__": 4809, "kind": "class", "name": "ShadowShaderSource", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js", @@ -96448,7 +96664,7 @@ "ignore": true }, { - "__docId__": 4802, + "__docId__": 4810, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js~ShadowShaderSource", @@ -96462,7 +96678,7 @@ "undocument": true }, { - "__docId__": 4803, + "__docId__": 4811, "kind": "member", "name": "vertex", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js~ShadowShaderSource", @@ -96479,7 +96695,7 @@ } }, { - "__docId__": 4804, + "__docId__": 4812, "kind": "member", "name": "fragment", "memberof": "src/viewer/scene/mesh/shadow/ShadowShaderSource.js~ShadowShaderSource", @@ -96496,18 +96712,18 @@ } }, { - "__docId__": 4805, + "__docId__": 4813, "kind": "file", "name": "src/viewer/scene/metriqs/Metriqs.js", "content": "//----------------------------------------------------------------------------------------------------------------------\n// This file is named \"Metriqs.js\" because \"Metrics.js\" is blocked by uBlock Origin (https://en.wikipedia.org/wiki/UBlock_Origin)\n//----------------------------------------------------------------------------------------------------------------------\n\nimport {Component} from \"../Component.js\";\nimport {math} from \"../math/math.js\";\n\nconst unitsInfo = {\n meters: {\n abbrev: \"m\"\n },\n metres: {\n abbrev: \"m\"\n },\n centimeters: {\n abbrev: \"cm\"\n },\n centimetres: {\n abbrev: \"cm\"\n },\n millimeters: {\n abbrev: \"mm\"\n },\n millimetres: {\n abbrev: \"mm\"\n },\n yards: {\n abbrev: \"yd\"\n },\n feet: {\n abbrev: \"ft\"\n },\n inches: {\n abbrev: \"in\"\n }\n};\n\n/**\n * @desc Configures its {@link Scene}'s measurement unit and mapping between the Real-space and World-space 3D Cartesian coordinate systems.\n *\n *\n * ## Overview\n *\n * * Located at {@link Scene#metrics}.\n * * {@link Metrics#units} configures the Real-space unit type, which is ````\"meters\"```` by default.\n * * {@link Metrics#scale} configures the number of Real-space units represented by each unit within the World-space 3D coordinate system. This is ````1.0```` by default.\n * * {@link Metrics#origin} configures the 3D Real-space origin, in current Real-space units, at which this {@link Scene}'s World-space coordinate origin sits, This is ````[0,0,0]```` by default.\n *\n * ## Usage\n *\n * Let's load a model using an {@link XKTLoaderPlugin}, then configure the Real-space unit type and the coordinate\n * mapping between the Real-space and World-space 3D coordinate systems.\n *\n * ````JavaScript\n * import {Viewer, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [-2.37, 18.97, -26.12];\n * viewer.scene.camera.look = [10.97, 5.82, -11.22];\n * viewer.scene.camera.up = [0.36, 0.83, 0.40];\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * src: \"./models/xkt/duplex/duplex.xkt\"\n * });\n *\n * const metrics = viewer.scene.metrics;\n *\n * metrics.units = \"meters\";\n * metrics.scale = 10.0;\n * metrics.origin = [100.0, 0.0, 200.0];\n * ````\n */\nclass Metrics extends Component {\n\n /**\n * @constructor\n * @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._units = \"meters\";\n this._scale = 1.0;\n this._origin = math.vec3([0, 0, 0]);\n\n this.units = cfg.units;\n this.scale = cfg.scale;\n this.origin = cfg.origin;\n }\n\n /**\n * Gets info about the supported Real-space unit types.\n *\n * This will be:\n *\n * ````javascript\n * {\n * {\n * meters: {\n * abbrev: \"m\"\n * },\n * metres: {\n * abbrev: \"m\"\n * },\n * centimeters: {\n * abbrev: \"cm\"\n * },\n * centimetres: {\n * abbrev: \"cm\"\n * },\n * millimeters: {\n * abbrev: \"mm\"\n * },\n * millimetres: {\n * abbrev: \"mm\"\n * },\n * yards: {\n * abbrev: \"yd\"\n * },\n * feet: {\n * abbrev: \"ft\"\n * },\n * inches: {\n * abbrev: \"in\"\n * }\n * }\n * }\n * ````\n *\n * @type {*}\n */\n get unitsInfo() {\n return unitsInfo;\n }\n\n /**\n * Sets the {@link Scene}'s Real-space unit type.\n *\n * Accepted values are ````\"meters\"````, ````\"centimeters\"````, ````\"millimeters\"````, ````\"metres\"````, ````\"centimetres\"````, ````\"millimetres\"````, ````\"yards\"````, ````\"feet\"```` and ````\"inches\"````.\n *\n * @emits ````\"units\"```` event on change, with the value of this property.\n * @type {String}\n */\n set units(value) {\n if (!value) {\n value = \"meters\";\n }\n const info = unitsInfo[value];\n if (!info) {\n this.error(\"Unsupported value for 'units': \" + value + \" defaulting to 'meters'\");\n value = \"meters\";\n }\n this._units = value;\n this.fire(\"units\", this._units);\n }\n\n /**\n * Gets the {@link Scene}'s Real-space unit type.\n *\n * @type {String}\n */\n get units() {\n return this._units;\n }\n\n /**\n * Sets the number of Real-space units represented by each unit of the {@link Scene}'s World-space coordinate system.\n *\n * For example, if {@link Metrics#units} is ````\"meters\"````, and there are ten meters per World-space coordinate system unit, then ````scale```` would have a value of ````10.0````.\n *\n * @emits ````\"scale\"```` event on change, with the value of this property.\n * @type {Number}\n */\n set scale(value) {\n value = value || 1;\n if (value <= 0) {\n this.error(\"scale value should be larger than zero\");\n return;\n }\n this._scale = value;\n this.fire(\"scale\", this._scale);\n }\n\n /**\n * Gets the number of Real-space units represented by each unit of the {@link Scene}'s World-space coordinate system.\n *\n * @type {Number}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the Real-space 3D origin, in Real-space units, at which this {@link Scene}'s World-space coordinate origin ````[0,0,0]```` sits.\n *\n * @emits \"origin\" event on change, with the value of this property.\n * @type {Number[]}\n */\n set origin(value) {\n if (!value) {\n this._origin[0] = 0;\n this._origin[1] = 0;\n this._origin[2] = 0;\n return;\n }\n this._origin[0] = value[0];\n this._origin[1] = value[1];\n this._origin[2] = value[2];\n this.fire(\"origin\", this._origin);\n }\n\n /**\n * Gets the 3D Real-space origin, in Real-space units, at which this {@link Scene}'s World-space coordinate origin ````[0,0,0]```` sits.\n *\n * @type {Number[]}\n */\n get origin() {\n return this._origin;\n }\n\n /**\n * Converts a 3D position from World-space to Real-space.\n *\n * This is equivalent to ````realPos = #origin + (worldPos * #scale)````.\n *\n * @param {Number[]} worldPos World-space 3D position, in World coordinate system units.\n * @param {Number[]} [realPos] Destination for Real-space 3D position.\n * @returns {Number[]} Real-space 3D position, in units indicated by {@link Metrics#units}.\n */\n worldToRealPos(worldPos, realPos = math.vec3(3)) {\n realPos[0] = this._origin[0] + (this._scale * worldPos[0]);\n realPos[1] = this._origin[1] + (this._scale * worldPos[1]);\n realPos[2] = this._origin[2] + (this._scale * worldPos[2]);\n }\n\n /**\n * Converts a 3D position from Real-space to World-space.\n *\n * This is equivalent to ````worldPos = (worldPos - #origin) / #scale````.\n *\n * @param {Number[]} realPos Real-space 3D position.\n * @param {Number[]} [worldPos] Destination for World-space 3D position.\n * @returns {Number[]} World-space 3D position.\n */\n realToWorldPos(realPos, worldPos = math.vec3(3)) {\n worldPos[0] = (realPos[0] - this._origin[0]) / this._scale;\n worldPos[1] = (realPos[1] - this._origin[1]) / this._scale;\n worldPos[2] = (realPos[2] - this._origin[2]) / this._scale;\n return worldPos;\n }\n}\n\nexport {Metrics};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/metriqs/Metriqs.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/metriqs/Metriqs.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4806, + "__docId__": 4814, "kind": "variable", "name": "unitsInfo", "memberof": "src/viewer/scene/metriqs/Metriqs.js", @@ -96528,7 +96744,7 @@ "ignore": true }, { - "__docId__": 4807, + "__docId__": 4815, "kind": "class", "name": "Metrics", "memberof": "src/viewer/scene/metriqs/Metriqs.js", @@ -96546,7 +96762,7 @@ ] }, { - "__docId__": 4808, + "__docId__": 4816, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96566,7 +96782,7 @@ "ignore": true }, { - "__docId__": 4809, + "__docId__": 4817, "kind": "member", "name": "_units", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96584,7 +96800,7 @@ } }, { - "__docId__": 4810, + "__docId__": 4818, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96602,7 +96818,7 @@ } }, { - "__docId__": 4811, + "__docId__": 4819, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96620,7 +96836,7 @@ } }, { - "__docId__": 4815, + "__docId__": 4823, "kind": "get", "name": "unitsInfo", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96641,7 +96857,7 @@ } }, { - "__docId__": 4816, + "__docId__": 4824, "kind": "set", "name": "units", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96670,7 +96886,7 @@ ] }, { - "__docId__": 4818, + "__docId__": 4826, "kind": "get", "name": "units", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96691,7 +96907,7 @@ } }, { - "__docId__": 4819, + "__docId__": 4827, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96720,7 +96936,7 @@ ] }, { - "__docId__": 4821, + "__docId__": 4829, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96741,7 +96957,7 @@ } }, { - "__docId__": 4822, + "__docId__": 4830, "kind": "set", "name": "origin", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96770,7 +96986,7 @@ ] }, { - "__docId__": 4823, + "__docId__": 4831, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96791,7 +97007,7 @@ } }, { - "__docId__": 4824, + "__docId__": 4832, "kind": "method", "name": "worldToRealPos", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96840,7 +97056,7 @@ } }, { - "__docId__": 4825, + "__docId__": 4833, "kind": "method", "name": "realToWorldPos", "memberof": "src/viewer/scene/metriqs/Metriqs.js~Metrics", @@ -96889,18 +97105,18 @@ } }, { - "__docId__": 4826, + "__docId__": 4834, "kind": "file", "name": "src/viewer/scene/model/ENTITY_FLAGS.js", "content": "/**\n * @private\n * @type {{PICKABLE: number, CLIPPABLE: number, BACKFACES: number, VISIBLE: number, SELECTED: number, OUTLINED: number, CULLED: number, RECEIVE_SHADOW: number, COLLIDABLE: number, XRAYED: number, CAST_SHADOW: number, EDGES: number, HIGHLIGHTED: number}}\n */\nconst ENTITY_FLAGS = {\n VISIBLE: 1,\n CULLED: 1 << 2,\n PICKABLE: 1 << 3,\n CLIPPABLE: 1 << 4,\n COLLIDABLE: 1 << 5,\n CAST_SHADOW: 1 << 6,\n RECEIVE_SHADOW: 1 << 7,\n XRAYED: 1 << 8,\n HIGHLIGHTED: 1 << 9,\n SELECTED: 1 << 10,\n EDGES: 1 << 11,\n BACKFACES: 1 << 12,\n TRANSPARENT: 1 << 13\n};\n\nexport {ENTITY_FLAGS};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/ENTITY_FLAGS.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/ENTITY_FLAGS.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4827, + "__docId__": 4835, "kind": "variable", "name": "ENTITY_FLAGS", "memberof": "src/viewer/scene/model/ENTITY_FLAGS.js", @@ -96923,18 +97139,18 @@ "ignore": true }, { - "__docId__": 4828, + "__docId__": 4836, "kind": "file", "name": "src/viewer/scene/model/PerformanceModel.js", "content": "import {SceneModel} from \"./SceneModel.js\";\n\n/**\n * @desc A high-performance model representation for efficient rendering and low memory usage.\n *\n * * PerformanceModel was replaced with {@link SceneModel} in ````xeokit-sdk v2.4````.\n * * PerformanceModel currently extends {@link SceneModel}, in order to maintain backward-compatibility until we remove PerformanceModel.\n * * See {@link SceneModel} for API details.\n *\n * @deprecated\n * @implements {Drawable}\n * @implements {Entity}\n * @extends {SceneModel}\n */\nexport class PerformanceModel extends SceneModel {\n\n /**\n * See {@link VBOSceneModel} for details.\n *\n * @param owner\n * @param cfg\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/PerformanceModel.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/PerformanceModel.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4829, + "__docId__": 4837, "kind": "class", "name": "PerformanceModel", "memberof": "src/viewer/scene/model/PerformanceModel.js", @@ -96957,7 +97173,7 @@ ] }, { - "__docId__": 4830, + "__docId__": 4838, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/PerformanceModel.js~PerformanceModel", @@ -96992,18 +97208,18 @@ ] }, { - "__docId__": 4831, + "__docId__": 4839, "kind": "file", "name": "src/viewer/scene/model/RENDER_PASSES.js", "content": "/**\n * @private\n */\nconst RENDER_PASSES = {\n\n // Skipped - suppress rendering\n\n NOT_RENDERED: 0,\n\n // Normal rendering - mutually exclusive modes\n\n COLOR_OPAQUE: 1,\n COLOR_TRANSPARENT: 2,\n\n // Emphasis silhouette rendering - mutually exclusive modes\n\n SILHOUETTE_HIGHLIGHTED: 3,\n SILHOUETTE_SELECTED: 4,\n SILHOUETTE_XRAYED: 5,\n\n // Edges rendering - mutually exclusive modes\n\n EDGES_COLOR_OPAQUE: 6,\n EDGES_COLOR_TRANSPARENT: 7,\n EDGES_HIGHLIGHTED: 8,\n EDGES_SELECTED: 9,\n EDGES_XRAYED: 10,\n\n // Picking\n\n PICK: 11\n};\n\nexport {RENDER_PASSES};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/RENDER_PASSES.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/RENDER_PASSES.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4832, + "__docId__": 4840, "kind": "variable", "name": "RENDER_PASSES", "memberof": "src/viewer/scene/model/RENDER_PASSES.js", @@ -97023,18 +97239,18 @@ } }, { - "__docId__": 4833, + "__docId__": 4841, "kind": "file", "name": "src/viewer/scene/model/SceneModel.js", "content": "import {Component} from \"../Component.js\";\nimport {math} from \"../math/math.js\";\nimport {buildEdgeIndices} from '../math/buildEdgeIndices.js';\nimport {SceneModelMesh} from './SceneModelMesh.js';\nimport {getScratchMemory, putScratchMemory} from \"./vbo/ScratchMemory.js\";\nimport {VBOBatchingTrianglesLayer} from './vbo/batching/triangles/VBOBatchingTrianglesLayer.js';\nimport {VBOInstancingTrianglesLayer} from './vbo/instancing/triangles/VBOInstancingTrianglesLayer.js';\nimport {VBOBatchingLinesLayer} from './vbo/batching/lines/VBOBatchingLinesLayer.js';\nimport {VBOInstancingLinesLayer} from './vbo/instancing/lines/VBOInstancingLinesLayer.js';\nimport {VBOBatchingPointsLayer} from './vbo/batching/points/VBOBatchingPointsLayer.js';\nimport {VBOInstancingPointsLayer} from './vbo/instancing/points/VBOInstancingPointsLayer.js';\nimport {DTXLinesLayer} from \"./dtx/lines/DTXLinesLayer.js\";\nimport {DTXTrianglesLayer} from \"./dtx/triangles/DTXTrianglesLayer.js\";\nimport {ENTITY_FLAGS} from './ENTITY_FLAGS.js';\nimport {RenderFlags} from \"../webgl/RenderFlags.js\";\nimport {worldToRTCPositions} from \"../math/rtcCoords.js\";\nimport {SceneModelTextureSet} from \"./SceneModelTextureSet.js\";\nimport {SceneModelTexture} from \"./SceneModelTexture.js\";\nimport {Texture2D} from \"../webgl/Texture2D.js\";\nimport {utils} from \"../utils.js\";\nimport {getKTX2TextureTranscoder} from \"../utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js\";\nimport {\n ClampToEdgeWrapping,\n LinearEncoding,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipMapNearestFilter,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipMapLinearFilter,\n NearestMipMapNearestFilter,\n RepeatWrapping,\n sRGBEncoding\n} from \"../constants/constants.js\";\nimport {createPositionsDecodeMatrix, quantizePositions} from \"./compression.js\";\nimport {uniquifyPositions} from \"./calculateUniquePositions.js\";\nimport {rebucketPositions} from \"./rebucketPositions.js\";\nimport {SceneModelEntity} from \"./SceneModelEntity.js\";\nimport {geometryCompressionUtils} from \"../math/geometryCompressionUtils.js\";\nimport {SceneModelTransform} from \"./SceneModelTransform.js\";\n\n\nconst tempVec3a = math.vec3();\n\nconst tempOBB3 = math.OBB3();\n\nconst DEFAULT_SCALE = math.vec3([1, 1, 1]);\nconst DEFAULT_POSITION = math.vec3([0, 0, 0]);\nconst DEFAULT_ROTATION = math.vec3([0, 0, 0]);\nconst DEFAULT_QUATERNION = math.identityQuaternion();\nconst DEFAULT_MATRIX = math.identityMat4();\n\nconst DEFAULT_COLOR_TEXTURE_ID = \"defaultColorTexture\";\nconst DEFAULT_METAL_ROUGH_TEXTURE_ID = \"defaultMetalRoughTexture\";\nconst DEFAULT_NORMALS_TEXTURE_ID = \"defaultNormalsTexture\";\nconst DEFAULT_EMISSIVE_TEXTURE_ID = \"defaultEmissiveTexture\";\nconst DEFAULT_OCCLUSION_TEXTURE_ID = \"defaultOcclusionTexture\";\nconst DEFAULT_TEXTURE_SET_ID = \"defaultTextureSet\";\n\nconst defaultCompressedColor = new Uint8Array([255, 255, 255]);\n\nconst VBO_INSTANCED = 0;\nconst VBO_BATCHED = 1;\nconst DTX = 2;\n\n/**\n * @desc A high-performance model representation for efficient rendering and low memory usage.\n *\n * # Examples\n *\n * Internally, SceneModel uses a combination of several different techniques to render and represent\n * the different parts of a typical model. Each of the live examples at these links is designed to \"unit test\" one of these\n * techniques, in isolation. If some bug occurs in SceneModel, we use these tests to debug, but they also\n * serve to demonstrate how to use the capabilities of SceneModel programmatically.\n *\n * * [Loading building models into SceneModels](/examples/buildings)\n * * [Loading city models into SceneModels](/examples/cities)\n * * [Loading LiDAR scans into SceneModels](/examples/lidar)\n * * [Loading CAD models into SceneModels](/examples/cad)\n * * [SceneModel feature tests](/examples/scenemodel)\n *\n * # Overview\n *\n * While xeokit's standard [scene graph](https://github.com/xeokit/xeokit-sdk/wiki/Scene-Graphs) is great for gizmos and medium-sized models, it doesn't scale up to millions of objects in terms of memory and rendering efficiency.\n *\n * For huge models, we have the ````SceneModel```` representation, which is optimized to pack large amounts of geometry into memory and render it efficiently using WebGL.\n *\n * ````SceneModel```` is the default model representation loaded by (at least) {@link GLTFLoaderPlugin}, {@link XKTLoaderPlugin} and {@link WebIFCLoaderPlugin}.\n *\n * In this tutorial you'll learn how to use ````SceneModel```` to create high-detail content programmatically. Ordinarily you'd be learning about ````SceneModel```` if you were writing your own model loader plugins.\n *\n * # Contents\n *\n * - [SceneModel](#DataTextureSceneModel)\n * - [GPU-Resident Geometry](#gpu-resident-geometry)\n * - [Picking](#picking)\n * - [Example 1: Geometry Instancing](#example-1--geometry-instancing)\n * - [Finalizing a SceneModel](#finalizing-a-DataTextureSceneModel)\n * - [Finding Entities](#finding-entities)\n * - [Example 2: Geometry Batching](#example-2--geometry-batching)\n * - [Classifying with Metadata](#classifying-with-metadata)\n * - [Querying Metadata](#querying-metadata)\n * - [Metadata Structure](#metadata-structure)\n * - [RTC Coordinates](#rtc-coordinates-for-double-precision)\n * - [Example 3: RTC Coordinates with Geometry Instancing](#example-2--rtc-coordinates-with-geometry-instancing)\n * - [Example 4: RTC Coordinates with Geometry Batching](#example-2--rtc-coordinates-with-geometry-batching)\n *\n * ## SceneModel\n *\n * ````SceneModel```` uses two rendering techniques internally:\n *\n * 1. ***Geometry batching*** for unique geometries, combining those into a single WebGL geometry buffer, to render in one draw call, and\n * 2. ***geometry instancing*** for geometries that are shared by multiple meshes, rendering all instances of each shared geometry in one draw call.\n *\n *
    \n * These techniques come with certain limitations:\n *\n * * Non-realistic rendering - while scene graphs can use xeokit's full set of material workflows, ````SceneModel```` uses simple Lambertian shading without textures.\n * * Static transforms - transforms within a ````SceneModel```` are static and cannot be dynamically translated, rotated and scaled the way {@link Node}s and {@link Mesh}es in scene graphs can.\n * * Immutable model representation - while scene graph {@link Node}s and\n * {@link Mesh}es can be dynamically plugged together, ````SceneModel```` is immutable,\n * since it packs its geometries into buffers and instanced arrays.\n *\n * ````SceneModel````'s API allows us to exploit batching and instancing, while exposing its elements as\n * abstract {@link Entity} types.\n *\n * {@link Entity} is the abstract base class for\n * the various xeokit components that represent models, objects, or anonymous visible elements. An Entity has a unique ID and can be\n * individually shown, hidden, selected, highlighted, ghosted, culled, picked and clipped, and has its own World-space boundary.\n *\n * * A ````SceneModel```` is an {@link Entity} that represents a model.\n * * A ````SceneModel```` represents each of its objects with an {@link Entity}.\n * * Each {@link Entity} has one or more meshes that define its shape.\n * * Each mesh has either its own unique geometry, or shares a geometry with other meshes.\n *\n * ## GPU-Resident Geometry\n *\n * For a low memory footprint, ````SceneModel```` stores its geometries in GPU memory only, compressed (quantized) as integers. Unfortunately, GPU-resident geometry is\n * not readable by JavaScript.\n *\n *\n * ## Example 1: Geometry Instancing\n *\n * In the example below, we'll use a ````SceneModel````\n * to build a simple table model using geometry instancing.\n *\n * We'll start by adding a reusable box-shaped geometry to our ````SceneModel````.\n *\n * Then, for each object in our model we'll add an {@link Entity}\n * that has a mesh that instances our box geometry, transforming and coloring the instance.\n *\n * [![](http://xeokit.io/img/docs/sceneGraph.png)](https://xeokit.github.io/xeokit-sdk/examples/index.html#sceneRepresentation_SceneModel_instancing)\n *\n * ````javascript\n * import {Viewer, SceneModel} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * // Build a SceneModel representing a table\n * // with four legs, using geometry instancing\n *\n * const sceneModel = new SceneModel(viewer.scene, {\n * id: \"table\",\n * isModel: true, // <--- Registers SceneModel in viewer.scene.models\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n * rotation: [0, 0, 0]\n * });\n *\n * // Create a reusable geometry within the SceneModel\n * // We'll instance this geometry by five meshes\n *\n * sceneModel.createGeometry({\n *\n * id: \"myBoxGeometry\",\n *\n * // The primitive type - allowed values are \"points\", \"lines\" and \"triangles\".\n * // See the OpenGL/WebGL specification docs\n * // for how the coordinate arrays are supposed to be laid out.\n * primitive: \"triangles\",\n *\n * // The vertices - eight for our cube, each\n * // one spanning three array elements for X,Y and Z\n * positions: [\n * 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // v0-v1-v2-v3 front\n * 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // v0-v3-v4-v1 right\n * 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // v0-v1-v6-v1 top\n * -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // v1-v6-v7-v2 left\n * -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, // v7-v4-v3-v2 bottom\n * 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1 // v4-v7-v6-v1 back\n * ],\n *\n * // Normal vectors, one for each vertex\n * normals: [\n * 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, // v0-v1-v2-v3 front\n * 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, // v0-v3-v4-v5 right\n * 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, // v0-v5-v6-v1 top\n * -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, // v1-v6-v7-v2 left\n * 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, // v7-v4-v3-v2 bottom\n * 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1 // v4-v7-v6-v5 back\n * ],\n *\n * // Indices - these organise the positions and and normals\n * // into geometric primitives in accordance with the \"primitive\" parameter,\n * // in this case a set of three indices for each triangle.\n * //\n * // Note that each triangle is specified in counter-clockwise winding order.\n * //\n * indices: [\n * 0, 1, 2, 0, 2, 3, // front\n * 4, 5, 6, 4, 6, 7, // right\n * 8, 9, 10, 8, 10, 11, // top\n * 12, 13, 14, 12, 14, 15, // left\n * 16, 17, 18, 16, 18, 19, // bottom\n * 20, 21, 22, 20, 22, 23\n * ]\n * });\n *\n * // Red table leg\n *\n * sceneModel.createMesh({\n * id: \"redLegMesh\",\n * geometryId: \"myBoxGeometry\",\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1, 0.3, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * id: \"redLeg\",\n * meshIds: [\"redLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Green table leg\n *\n * sceneModel.createMesh({\n * id: \"greenLegMesh\",\n * geometryId: \"myBoxGeometry\",\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 1.0, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * id: \"greenLeg\",\n * meshIds: [\"greenLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Blue table leg\n *\n * sceneModel.createMesh({\n * id: \"blueLegMesh\",\n * geometryId: \"myBoxGeometry\",\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"blueLeg\",\n * meshIds: [\"blueLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Yellow table leg\n *\n * sceneModel.createMesh({\n * id: \"yellowLegMesh\",\n * geometryId: \"myBoxGeometry\",\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1.0, 1.0, 0.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"yellowLeg\",\n * meshIds: [\"yellowLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Purple table top\n *\n * sceneModel.createMesh({\n * id: \"purpleTableTopMesh\",\n * geometryId: \"myBoxGeometry\",\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * color: [1.0, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"purpleTableTop\",\n * meshIds: [\"purpleTableTopMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n * ````\n *\n * ## Finalizing a SceneModel\n *\n * Before we can view and interact with our ````SceneModel````, we need to **finalize** it. Internally, this causes the ````SceneModel```` to build the\n * vertex buffer objects (VBOs) that support our geometry instances. When using geometry batching (see next example),\n * this causes ````SceneModel```` to build the VBOs that combine the batched geometries. Note that you can do both instancing and\n * batching within the same ````SceneModel````.\n *\n * Once finalized, we can't add anything more to our ````SceneModel````.\n *\n * ```` javascript\n * SceneModel.finalize();\n * ````\n *\n * ## Finding Entities\n *\n * As mentioned earlier, {@link Entity} is\n * the abstract base class for components that represent models, objects, or just\n * anonymous visible elements.\n *\n * Since we created configured our ````SceneModel```` with ````isModel: true````,\n * we're able to find it as an Entity by ID in ````viewer.scene.models````. Likewise, since\n * we configured each of its Entities with ````isObject: true````, we're able to\n * find them in ````viewer.scene.objects````.\n *\n *\n * ````javascript\n * // Get the whole table model Entity\n * const table = viewer.scene.models[\"table\"];\n *\n * // Get some leg object Entities\n * const redLeg = viewer.scene.objects[\"redLeg\"];\n * const greenLeg = viewer.scene.objects[\"greenLeg\"];\n * const blueLeg = viewer.scene.objects[\"blueLeg\"];\n * ````\n *\n * ## Example 2: Geometry Batching\n *\n * Let's once more use a ````SceneModel````\n * to build the simple table model, this time exploiting geometry batching.\n *\n * [![](http://xeokit.io/img/docs/sceneGraph.png)](https://xeokit.github.io/xeokit-sdk/examples/index.html#sceneRepresentation_SceneModel_batching)\n *\n * ````javascript\n * import {Viewer, SceneModel} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * // Create a SceneModel representing a table with four legs, using geometry batching\n * const sceneModel = new SceneModel(viewer.scene, {\n * id: \"table\",\n * isModel: true, // <--- Registers SceneModel in viewer.scene.models\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n * rotation: [0, 0, 0]\n * });\n *\n * // Red table leg\n *\n * sceneModel.createMesh({\n * id: \"redLegMesh\",\n *\n * // Geometry arrays are same as for the earlier batching example\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1, 0.3, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * id: \"redLeg\",\n * meshIds: [\"redLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Green table leg\n *\n * sceneModel.createMesh({\n * id: \"greenLegMesh\",\n * primitive: \"triangles\",\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 1.0, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * id: \"greenLeg\",\n * meshIds: [\"greenLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Blue table leg\n *\n * sceneModel.createMesh({\n * id: \"blueLegMesh\",\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"blueLeg\",\n * meshIds: [\"blueLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Yellow table leg object\n *\n * sceneModel.createMesh({\n * id: \"yellowLegMesh\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1.0, 1.0, 0.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"yellowLeg\",\n * meshIds: [\"yellowLegMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Purple table top\n *\n * sceneModel.createMesh({\n * id: \"purpleTableTopMesh\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * color: [1.0, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * id: \"purpleTableTop\",\n * meshIds: [\"purpleTableTopMesh\"],\n * isObject: true // <---- Registers Entity by ID on viewer.scene.objects\n * });\n *\n * // Finalize the SceneModel.\n *\n * SceneModel.finalize();\n *\n * // Find BigModelNodes by their model and object IDs\n *\n * // Get the whole table model\n * const table = viewer.scene.models[\"table\"];\n *\n * // Get some leg objects\n * const redLeg = viewer.scene.objects[\"redLeg\"];\n * const greenLeg = viewer.scene.objects[\"greenLeg\"];\n * const blueLeg = viewer.scene.objects[\"blueLeg\"];\n * ````\n *\n * ## Classifying with Metadata\n *\n * In the previous examples, we used ````SceneModel```` to build\n * two versions of the same table model, to demonstrate geometry batching and geometry instancing.\n *\n * We'll now classify our {@link Entity}s with metadata. This metadata\n * will work the same for both our examples, since they create the exact same structure of {@link Entity}s\n * to represent their models and objects. The abstract Entity type is, after all, intended to provide an abstract interface through which differently-implemented scene content can be accessed uniformly.\n *\n * To create the metadata, we'll create a {@link MetaModel} for our model,\n * with a {@link MetaObject} for each of it's objects. The MetaModel and MetaObjects\n * get the same IDs as the {@link Entity}s that represent their model and objects within our scene.\n *\n * ```` javascript\n * const furnitureMetaModel = viewer.metaScene.createMetaModel(\"furniture\", { // Creates a MetaModel in the MetaScene\n *\n * \"projectId\": \"myTableProject\",\n * \"revisionId\": \"V1.0\",\n *\n * \"metaObjects\": [\n * { // Creates a MetaObject in the MetaModel\n * \"id\": \"table\",\n * \"name\": \"Table\", // Same ID as an object Entity\n * \"type\": \"furniture\", // Arbitrary type, could be IFC type\n * \"properties\": { // Arbitrary properties, could be IfcPropertySet\n * \"cost\": \"200\"\n * }\n * },\n * {\n * \"id\": \"redLeg\",\n * \"name\": \"Red table Leg\",\n * \"type\": \"leg\",\n * \"parent\": \"table\", // References first MetaObject as parent\n * \"properties\": {\n * \"material\": \"wood\"\n * }\n * },\n * {\n * \"id\": \"greenLeg\", // Node with corresponding id does not need to exist\n * \"name\": \"Green table leg\", // and MetaObject does not need to exist for Node with an id\n * \"type\": \"leg\",\n * \"parent\": \"table\",\n * \"properties\": {\n * \"material\": \"wood\"\n * }\n * },\n * {\n * \"id\": \"blueLeg\",\n * \"name\": \"Blue table leg\",\n * \"type\": \"leg\",\n * \"parent\": \"table\",\n * \"properties\": {\n * \"material\": \"wood\"\n * }\n * },\n * {\n * \"id\": \"yellowLeg\",\n * \"name\": \"Yellow table leg\",\n * \"type\": \"leg\",\n * \"parent\": \"table\",\n * \"properties\": {\n * \"material\": \"wood\"\n * }\n * },\n * {\n * \"id\": \"tableTop\",\n * \"name\": \"Purple table top\",\n * \"type\": \"surface\",\n * \"parent\": \"table\",\n * \"properties\": {\n * \"material\": \"formica\",\n * \"width\": \"60\",\n * \"depth\": \"60\",\n * \"thickness\": \"5\"\n * }\n * }\n * ]\n * });\n * ````\n *\n * ## Querying Metadata\n *\n * Having created and classified our model (either the instancing or batching example), we can now find the {@link MetaModel}\n * and {@link MetaObject}s using the IDs of their\n * corresponding {@link Entity}s.\n *\n * ````JavaScript\n * const furnitureMetaModel = scene.metaScene.metaModels[\"furniture\"];\n *\n * const redLegMetaObject = scene.metaScene.metaObjects[\"redLeg\"];\n * ````\n *\n * In the snippet below, we'll log metadata on each {@link Entity} we click on:\n *\n * ````JavaScript\n * viewer.scene.input.on(\"mouseclicked\", function (coords) {\n *\n * const hit = viewer.scene.pick({\n * canvasPos: coords\n * });\n *\n * if (hit) {\n * const entity = hit.entity;\n * const metaObject = viewer.metaScene.metaObjects[entity.id];\n * if (metaObject) {\n * console.log(JSON.stringify(metaObject.getJSON(), null, \"\\t\"));\n * }\n * }\n * });\n * ````\n *\n * ## Metadata Structure\n *\n * The {@link MetaModel}\n * organizes its {@link MetaObject}s in\n * a tree that describes their structural composition:\n *\n * ````JavaScript\n * // Get metadata on the root object\n * const tableMetaObject = furnitureMetaModel.rootMetaObject;\n *\n * // Get metadata on the leg objects\n * const redLegMetaObject = tableMetaObject.children[0];\n * const greenLegMetaObject = tableMetaObject.children[1];\n * const blueLegMetaObject = tableMetaObject.children[2];\n * const yellowLegMetaObject = tableMetaObject.children[3];\n * ````\n *\n * Given an {@link Entity}, we can find the object or model of which it is a part, or the objects that comprise it. We can also generate UI\n * components from the metadata, such as the tree view demonstrated in [this demo](https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_glTF_OTCConferenceCenter).\n *\n * This hierarchy allows us to express the hierarchical structure of a model while representing it in\n * various ways in the 3D scene (such as with ````SceneModel````, which\n * has a non-hierarchical scene representation).\n *\n * Note also that a {@link MetaObject} does not need to have a corresponding\n * {@link Entity} and vice-versa.\n *\n * # RTC Coordinates for Double Precision\n *\n * ````SceneModel```` can emulate 64-bit precision on GPUs using relative-to-center (RTC) coordinates.\n *\n * Consider a model that contains many small objects, but with such large spatial extents that 32 bits of GPU precision (accurate to ~7 digits) will not be sufficient to render all of the the objects without jittering.\n *\n * To prevent jittering, we could spatially subdivide the objects into \"tiles\". Each tile would have a center position, and the positions of the objects within the tile would be relative to that center (\"RTC coordinates\").\n *\n * While the center positions of the tiles would be 64-bit values, the object positions only need to be 32-bit.\n *\n * Internally, when rendering an object with RTC coordinates, xeokit first temporarily translates the camera viewing matrix by the object's tile's RTC center, on the CPU, using 64-bit math.\n *\n * Then xeokit loads the viewing matrix into its WebGL shaders, where math happens at 32-bit precision. Within the shaders, the matrix is effectively down-cast to 32-bit precision, and the object's 32-bit vertex positions are transformed by the matrix.\n *\n * We see no jittering, because with RTC a detectable loss of GPU accuracy only starts happening to objects as they become very distant from the camera viewpoint, at which point they are too small to be discernible anyway.\n *\n * ## RTC Coordinates with Geometry Instancing\n *\n * To use RTC with ````SceneModel```` geometry instancing, we specify an RTC center for the geometry via its ````origin```` parameter. Then ````SceneModel```` assumes that all meshes that instance that geometry are within the same RTC coordinate system, ie. the meshes ````position```` and ````rotation```` properties are assumed to be relative to the geometry's ````origin````.\n *\n * For simplicity, our example's meshes all instance the same geometry. Therefore, our example model has only one RTC center.\n *\n * Note that the axis-aligned World-space boundary (AABB) of our model is ````[ -6, -9, -6, 1000000006, -2.5, 1000000006]````.\n *\n * [![](http://xeokit.io/img/docs/sceneGraph.png)](https://xeokit.github.io/xeokit-sdk/examples/index.html#sceneRepresentation_SceneModel_batching)\n *\n * ````javascript\n * const origin = [100000000, 0, 100000000];\n *\n * sceneModel.createGeometry({\n * id: \"box\",\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg1\",\n * geometryId: \"box\",\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1, 0.3, 0.3],\n * origin: origin\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg1\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg2\",\n * geometryId: \"box\",\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 1.0, 0.3],\n * origin: origin\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg2\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg3\",\n * geometryId: \"box\",\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 0.3, 1.0],\n * origin: origin\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg3\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg4\",\n * geometryId: \"box\",\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1.0, 1.0, 0.0],\n * origin: origin\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg4\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"top\",\n * geometryId: \"box\",\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * color: [1.0, 0.3, 1.0],\n * origin: origin\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"top\"],\n * isObject: true\n * });\n * ````\n *\n * ## RTC Coordinates with Geometry Batching\n *\n * To use RTC with ````SceneModel```` geometry batching, we specify an RTC center (````origin````) for each mesh. For performance, we try to have as many meshes share the same value for ````origin```` as possible. Each mesh's ````positions````, ````position```` and ````rotation```` properties are assumed to be relative to ````origin````.\n *\n * For simplicity, the meshes in our example all share the same RTC center.\n *\n * The axis-aligned World-space boundary (AABB) of our model is ````[ -6, -9, -6, 1000000006, -2.5, 1000000006]````.\n *\n * [![](http://xeokit.io/img/docs/sceneGraph.png)](https://xeokit.github.io/xeokit-sdk/examples/index.html#sceneRepresentation_SceneModel_batching)\n *\n * ````javascript\n * const origin = [100000000, 0, 100000000];\n *\n * sceneModel.createMesh({\n * id: \"leg1\",\n * origin: origin, // This mesh's positions and transforms are relative to the RTC center\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1, 0.3, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg1\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg2\",\n * origin: origin, // This mesh's positions and transforms are relative to the RTC center\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 1.0, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg2\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg3\",\n * origin: origin, // This mesh's positions and transforms are relative to the RTC center\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg3\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg4\",\n * origin: origin, // This mesh's positions and transforms are relative to the RTC center\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1.0, 1.0, 0.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg4\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"top\",\n * origin: origin, // This mesh's positions and transforms are relative to the RTC center\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * color: [1.0, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"top\"],\n * isObject: true\n * });\n * ````\n *\n * ## Positioning at World-space coordinates\n *\n * To position a SceneModel at given double-precision World coordinates, we can\n * configure the ````origin```` of the SceneModel itself. The ````origin```` is a double-precision\n * 3D World-space position at which the SceneModel will be located.\n *\n * Note that ````position```` is a single-precision offset relative to ````origin````.\n *\n * ````javascript\n * const origin = [100000000, 0, 100000000];\n *\n * const sceneModel = new SceneModel(viewer.scene, {\n * id: \"table\",\n * isModel: true,\n * origin: origin, // Everything in this SceneModel is relative to this RTC center\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n * rotation: [0, 0, 0]\n * });\n *\n * sceneModel.createGeometry({\n * id: \"box\",\n * primitive: \"triangles\",\n * positions: [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 ... ],\n * normals: [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ... ],\n * indices: [ 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, ... ],\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg1\",\n * geometryId: \"box\",\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1, 0.3, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg1\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg2\",\n * geometryId: \"box\",\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 1.0, 0.3]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg2\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg3\",\n * geometryId: \"box\",\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [0.3, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg3\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"leg4\",\n * geometryId: \"box\",\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * color: [1.0, 1.0, 0.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"leg4\"],\n * isObject: true\n * });\n *\n * sceneModel.createMesh({\n * id: \"top\",\n * geometryId: \"box\",\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * color: [1.0, 0.3, 1.0]\n * });\n *\n * sceneModel.createEntity({\n * meshIds: [\"top\"],\n * isObject: true\n * });\n * ````\n *\n * # Textures\n *\n * ## Loading KTX2 Texture Files into a SceneModel\n *\n * A {@link SceneModel} that is configured with a {@link KTX2TextureTranscoder} will\n * allow us to load textures into it from KTX2 buffers or files.\n *\n * In the example below, we'll create a {@link Viewer}, containing a {@link SceneModel} configured with a\n * {@link KTX2TextureTranscoder}. We'll then programmatically create a simple object within the SceneModel, consisting of\n * a single mesh with a texture loaded from a KTX2 file, which our SceneModel internally transcodes, using\n * its {@link KTX2TextureTranscoder}. Note how we configure our {@link KTX2TextureTranscoder} with a path to the Basis Universal\n * transcoder WASM module.\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to BasisU transcoder module\n * });\n *\n * const sceneModel = new SceneModel(viewer.scene, {\n * id: \"myModel\",\n * textureTranscoder // <<-------------------- Configure model with our transcoder\n * });\n *\n * sceneModel.createTexture({\n * id: \"myColorTexture\",\n * src: \"../assets/textures/compressed/sample_uastc_zstd.ktx2\" // <<----- KTX2 texture asset\n * });\n *\n * sceneModel.createTexture({\n * id: \"myMetallicRoughnessTexture\",\n * src: \"../assets/textures/alpha/crosshatchAlphaMap.jpg\" // <<----- JPEG texture asset\n * });\n *\n * sceneModel.createTextureSet({\n * id: \"myTextureSet\",\n * colorTextureId: \"myColorTexture\",\n * metallicRoughnessTextureId: \"myMetallicRoughnessTexture\"\n * });\n *\n * sceneModel.createMesh({\n * id: \"myMesh\",\n * textureSetId: \"myTextureSet\",\n * primitive: \"triangles\",\n * positions: [1, 1, 1, ...],\n * normals: [0, 0, 1, 0, ...],\n * uv: [1, 0, 0, ...],\n * indices: [0, 1, 2, ...],\n * });\n *\n * sceneModel.createEntity({\n * id: \"myEntity\",\n * meshIds: [\"myMesh\"]\n * });\n *\n * sceneModel.finalize();\n * ````\n *\n * ## Loading KTX2 Textures from ArrayBuffers into a SceneModel\n *\n * A SceneModel that is configured with a {@link KTX2TextureTranscoder} will allow us to load textures into\n * it from KTX2 ArrayBuffers.\n *\n * In the example below, we'll create a {@link Viewer}, containing a {@link SceneModel} configured with a\n * {@link KTX2TextureTranscoder}. We'll then programmatically create a simple object within the SceneModel, consisting of\n * a single mesh with a texture loaded from a KTX2 ArrayBuffer, which our SceneModel internally transcodes, using\n * its {@link KTX2TextureTranscoder}.\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to BasisU transcoder module\n * });\n *\n * const sceneModel = new SceneModel(viewer.scene, {\n * id: \"myModel\",\n * textureTranscoder // <<-------------------- Configure model with our transcoder\n * });\n *\n * utils.loadArraybuffer(\"../assets/textures/compressed/sample_uastc_zstd.ktx2\",(arrayBuffer) => {\n *\n * sceneModel.createTexture({\n * id: \"myColorTexture\",\n * buffers: [arrayBuffer] // <<----- KTX2 texture asset\n * });\n *\n * sceneModel.createTexture({\n * id: \"myMetallicRoughnessTexture\",\n * src: \"../assets/textures/alpha/crosshatchAlphaMap.jpg\" // <<----- JPEG texture asset\n * });\n *\n * sceneModel.createTextureSet({\n * id: \"myTextureSet\",\n * colorTextureId: \"myColorTexture\",\n * metallicRoughnessTextureId: \"myMetallicRoughnessTexture\"\n * });\n *\n * sceneModel.createMesh({\n * id: \"myMesh\",\n * textureSetId: \"myTextureSet\",\n * primitive: \"triangles\",\n * positions: [1, 1, 1, ...],\n * normals: [0, 0, 1, 0, ...],\n * uv: [1, 0, 0, ...],\n * indices: [0, 1, 2, ...],\n * });\n *\n * sceneModel.createEntity({\n * id: \"myEntity\",\n * meshIds: [\"myMesh\"]\n * });\n *\n * sceneModel.finalize();\n * });\n * ````\n *\n * @implements {Entity}\n */\nexport class SceneModel extends Component {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.\n * @param {Boolean} [cfg.isModel] Specify ````true```` if this SceneModel represents a model, in which case the SceneModel will be registered by {@link SceneModel#id} in {@link Scene#models} and may also have a corresponding {@link MetaModel} with matching {@link MetaModel#id}, registered by that ID in {@link MetaScene#metaModels}.\n * @param {Number[]} [cfg.origin=[0,0,0]] World-space double-precision 3D origin.\n * @param {Number[]} [cfg.position=[0,0,0]] Local, single-precision 3D position, relative to the origin parameter.\n * @param {Number[]} [cfg.scale=[1,1,1]] Local scale.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1] Local modelling transform matrix. Overrides the position, scale and rotation parameters.\n * @param {Boolean} [cfg.visible=true] Indicates if the SceneModel is initially visible.\n * @param {Boolean} [cfg.culled=false] Indicates if the SceneModel is initially culled from view.\n * @param {Boolean} [cfg.pickable=true] Indicates if the SceneModel is initially pickable.\n * @param {Boolean} [cfg.clippable=true] Indicates if the SceneModel is initially clippable.\n * @param {Boolean} [cfg.collidable=true] Indicates if the SceneModel is initially included in boundary calculations.\n * @param {Boolean} [cfg.xrayed=false] Indicates if the SceneModel is initially xrayed.\n * @param {Boolean} [cfg.highlighted=false] Indicates if the SceneModel is initially highlighted.\n * @param {Boolean} [cfg.selected=false] Indicates if the SceneModel is initially selected.\n * @param {Boolean} [cfg.edges=false] Indicates if the SceneModel's edges are initially emphasized.\n * @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] SceneModel's initial RGB colorize color, multiplies by the rendered fragment colors.\n * @param {Number} [cfg.opacity=1.0] SceneModel's initial opacity factor, multiplies by the rendered fragment alpha.\n * @param {Number} [cfg.backfaces=false] When we set this ````true````, then we force rendering of backfaces for this SceneModel. When\n * we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the\n * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.\n * @param {Boolean} [cfg.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to this SceneModel. SAO is configured by the Scene's {@link SAO} component.\n * @param {Boolean} [cfg.pbrEnabled=true] Indicates if physically-based rendering (PBR) will apply to the SceneModel when {@link Scene#pbrEnabled} is ````true````.\n * @param {Boolean} [cfg.colorTextureEnabled=true] Indicates if base color textures will be rendered for the SceneModel when {@link Scene#colorTextureEnabled} is ````true````.\n * @param {Number} [cfg.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.\n * @param {Number} [cfg.maxGeometryBatchSize=50000000] Maximum geometry batch size, as number of vertices. This is optionally supplied\n * to limit the size of the batched geometry arrays that SceneModel internally creates for batched geometries.\n * A lower value means less heap allocation/de-allocation while creating/loading batched geometries, but more draw calls and\n * slower rendering speed. A high value means larger heap allocation/de-allocation while creating/loading, but less draw calls\n * and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.\n * @param {TextureTranscoder} [cfg.textureTranscoder] Transcoder that will be used internally by {@link SceneModel#createTexture}\n * to convert transcoded texture data. Only required when we'll be providing transcoded data\n * to {@link SceneModel#createTexture}. We assume that all transcoded texture data added to a ````SceneModel````\n * will then in a format supported by this transcoder.\n * @param {Boolean} [cfg.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to\n * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable\n * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point\n * primitives. Only works while {@link DTX#enabled} is also ````true````.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._dtxEnabled = this.scene.dtxEnabled && (cfg.dtxEnabled !== false);\n\n this._enableVertexWelding = false; // Not needed for most objects, and very expensive, so disabled\n this._enableIndexBucketing = false; // Until fixed: https://github.com/xeokit/xeokit-sdk/issues/1204\n\n this._vboBatchingLayerScratchMemory = getScratchMemory();\n this._textureTranscoder = cfg.textureTranscoder || getKTX2TextureTranscoder(this.scene.viewer);\n\n this._maxGeometryBatchSize = cfg.maxGeometryBatchSize;\n\n this._aabb = math.collapseAABB3();\n this._aabbDirty = true;\n\n this._quantizationRanges = {};\n\n this._vboInstancingLayers = {};\n this._vboBatchingLayers = {};\n this._dtxLayers = {};\n\n this._meshList = [];\n\n this.layerList = []; // For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second\n this._entityList = [];\n\n this._geometries = {};\n this._dtxBuckets = {}; // Geometries with optimizations used for data texture representation\n this._textures = {};\n this._textureSets = {};\n this._transforms = {};\n this._meshes = {};\n this._unusedMeshes = {};\n this._entities = {};\n\n /** @private **/\n this.renderFlags = new RenderFlags();\n\n /**\n * @private\n */\n this.numGeometries = 0; // Number of geometries created with createGeometry()\n\n // These counts are used to avoid unnecessary render passes\n // They are incremented or decremented exclusively by BatchingLayer and InstancingLayer\n\n /**\n * @private\n */\n this.numPortions = 0;\n\n /**\n * @private\n */\n this.numVisibleLayerPortions = 0;\n\n /**\n * @private\n */\n this.numTransparentLayerPortions = 0;\n\n /**\n * @private\n */\n this.numXRayedLayerPortions = 0;\n\n /**\n * @private\n */\n this.numHighlightedLayerPortions = 0;\n\n /**\n * @private\n */\n this.numSelectedLayerPortions = 0;\n\n /**\n * @private\n */\n this.numEdgesLayerPortions = 0;\n\n /**\n * @private\n */\n this.numPickableLayerPortions = 0;\n\n /**\n * @private\n */\n this.numClippableLayerPortions = 0;\n\n /**\n * @private\n */\n this.numCulledLayerPortions = 0;\n\n this.numEntities = 0;\n this._numTriangles = 0;\n this._numLines = 0;\n this._numPoints = 0;\n\n this._edgeThreshold = cfg.edgeThreshold || 10;\n\n // Build static matrix\n\n this._origin = math.vec3(cfg.origin || [0, 0, 0]);\n this._position = math.vec3(cfg.position || [0, 0, 0]);\n this._rotation = math.vec3(cfg.rotation || [0, 0, 0]);\n this._quaternion = math.vec4(cfg.quaternion || [0, 0, 0, 1]);\n this._conjugateQuaternion = math.vec4(cfg.quaternion || [0, 0, 0, 1]);\n\n if (cfg.rotation) {\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n }\n this._scale = math.vec3(cfg.scale || [1, 1, 1]);\n\n this._worldRotationMatrix = math.mat4();\n this._worldRotationMatrixConjugate = math.mat4();\n this._matrix = math.mat4();\n this._matrixDirty = true;\n\n this._rebuildMatrices();\n\n this._worldNormalMatrix = math.mat4();\n math.inverseMat4(this._matrix, this._worldNormalMatrix);\n math.transposeMat4(this._worldNormalMatrix);\n\n if (cfg.matrix || cfg.position || cfg.rotation || cfg.scale || cfg.quaternion) {\n this._viewMatrix = math.mat4();\n this._viewNormalMatrix = math.mat4();\n this._viewMatrixDirty = true;\n this._matrixNonIdentity = true;\n }\n\n this._opacity = 1.0;\n this._colorize = [1, 1, 1];\n\n this._saoEnabled = (cfg.saoEnabled !== false);\n this._pbrEnabled = (cfg.pbrEnabled !== false);\n this._colorTextureEnabled = (cfg.colorTextureEnabled !== false);\n\n this._isModel = cfg.isModel;\n if (this._isModel) {\n this.scene._registerModel(this);\n }\n\n this._onCameraViewMatrix = this.scene.camera.on(\"matrix\", () => {\n this._viewMatrixDirty = true;\n });\n\n this._meshesWithDirtyMatrices = [];\n this._numMeshesWithDirtyMatrices = 0;\n\n this._onTick = this.scene.on(\"tick\", () => {\n while (this._numMeshesWithDirtyMatrices > 0) {\n this._meshesWithDirtyMatrices[--this._numMeshesWithDirtyMatrices]._updateMatrix();\n }\n });\n\n this._createDefaultTextureSet();\n\n this.visible = cfg.visible;\n this.culled = cfg.culled;\n this.pickable = cfg.pickable;\n this.clippable = cfg.clippable;\n this.collidable = cfg.collidable;\n this.castsShadow = cfg.castsShadow;\n this.receivesShadow = cfg.receivesShadow;\n this.xrayed = cfg.xrayed;\n this.highlighted = cfg.highlighted;\n this.selected = cfg.selected;\n this.edges = cfg.edges;\n this.colorize = cfg.colorize;\n this.opacity = cfg.opacity;\n this.backfaces = cfg.backfaces;\n }\n\n _meshMatrixDirty(mesh) {\n this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++] = mesh;\n }\n\n _createDefaultTextureSet() {\n // Every SceneModelMesh gets at least the default TextureSet,\n // which contains empty default textures filled with color\n const defaultColorTexture = new SceneModelTexture({\n id: DEFAULT_COLOR_TEXTURE_ID,\n texture: new Texture2D({\n gl: this.scene.canvas.gl,\n preloadColor: [1, 1, 1, 1] // [r, g, b, a]})\n })\n });\n const defaultMetalRoughTexture = new SceneModelTexture({\n id: DEFAULT_METAL_ROUGH_TEXTURE_ID,\n texture: new Texture2D({\n gl: this.scene.canvas.gl,\n preloadColor: [0, 1, 1, 1] // [unused, roughness, metalness, unused]\n })\n });\n const defaultNormalsTexture = new SceneModelTexture({\n id: DEFAULT_NORMALS_TEXTURE_ID,\n texture: new Texture2D({\n gl: this.scene.canvas.gl,\n preloadColor: [0, 0, 0, 0] // [x, y, z, unused] - these must be zeros\n })\n });\n const defaultEmissiveTexture = new SceneModelTexture({\n id: DEFAULT_EMISSIVE_TEXTURE_ID,\n texture: new Texture2D({\n gl: this.scene.canvas.gl,\n preloadColor: [0, 0, 0, 1] // [x, y, z, unused]\n })\n });\n const defaultOcclusionTexture = new SceneModelTexture({\n id: DEFAULT_OCCLUSION_TEXTURE_ID,\n texture: new Texture2D({\n gl: this.scene.canvas.gl,\n preloadColor: [1, 1, 1, 1] // [x, y, z, unused]\n })\n });\n this._textures[DEFAULT_COLOR_TEXTURE_ID] = defaultColorTexture;\n this._textures[DEFAULT_METAL_ROUGH_TEXTURE_ID] = defaultMetalRoughTexture;\n this._textures[DEFAULT_NORMALS_TEXTURE_ID] = defaultNormalsTexture;\n this._textures[DEFAULT_EMISSIVE_TEXTURE_ID] = defaultEmissiveTexture;\n this._textures[DEFAULT_OCCLUSION_TEXTURE_ID] = defaultOcclusionTexture;\n this._textureSets[DEFAULT_TEXTURE_SET_ID] = new SceneModelTextureSet({\n id: DEFAULT_TEXTURE_SET_ID,\n model: this,\n colorTexture: defaultColorTexture,\n metallicRoughnessTexture: defaultMetalRoughTexture,\n normalsTexture: defaultNormalsTexture,\n emissiveTexture: defaultEmissiveTexture,\n occlusionTexture: defaultOcclusionTexture\n });\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // SceneModel members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns true to indicate that this Component is a SceneModel.\n * @type {Boolean}\n */\n get isPerformanceModel() {\n return true;\n }\n\n /**\n * The {@link SceneModelTransform}s in this SceneModel.\n *\n * Each {#link SceneModelTransform} is stored here against its {@link SceneModelTransform.id}.\n *\n * @returns {*|{}}\n */\n get transforms() {\n return this._transforms;\n }\n\n /**\n * The {@link SceneModelTexture}s in this SceneModel.\n *\n * * Each {@link SceneModelTexture} is created with {@link SceneModel.createTexture}.\n * * Each {@link SceneModelTexture} is stored here against its {@link SceneModelTexture.id}.\n *\n * @returns {*|{}}\n */\n get textures() {\n return this._textures;\n }\n\n /**\n * The {@link SceneModelTextureSet}s in this SceneModel.\n *\n * Each {@link SceneModelTextureSet} is stored here against its {@link SceneModelTextureSet.id}.\n *\n * @returns {*|{}}\n */\n get textureSets() {\n return this._textureSets;\n }\n\n /**\n * The {@link SceneModelMesh}es in this SceneModel.\n *\n * Each {@SceneModelMesh} is stored here against its {@link SceneModelMesh.id}.\n *\n * @returns {*|{}}\n */\n get meshes() {\n return this._meshes;\n }\n\n /**\n * The {@link SceneModelEntity}s in this SceneModel.\n *\n * Each {#link SceneModelEntity} in this SceneModel that represents an object is\n * stored here against its {@link SceneModelTransform.id}.\n *\n * @returns {*|{}}\n */\n get objects() {\n return this._entities;\n }\n\n /**\n * Gets the 3D World-space origin for this SceneModel.\n *\n * Each {@link SceneModelMesh.origin}, if supplied, is relative to this origin.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Float64Array}\n */\n get origin() {\n return this._origin;\n }\n\n /**\n * Sets the SceneModel's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set position(value) {\n this._position.set(value || [0, 0, 0]);\n this._setWorldMatrixDirty();\n this._sceneModelDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the SceneModel's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get position() {\n return this._position;\n }\n\n /**\n * Sets the SceneModel's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set rotation(value) {\n this._rotation.set(value || [0, 0, 0]);\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n this._setWorldMatrixDirty();\n this._sceneModelDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the SceneModel's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get rotation() {\n return this._rotation;\n }\n\n /**\n * Sets the SceneModel's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n set quaternion(value) {\n this._quaternion.set(value || [0, 0, 0, 1]);\n math.quaternionToEuler(this._quaternion, \"XYZ\", this._rotation);\n this._setWorldMatrixDirty();\n this._sceneModelDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the SceneModel's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n get quaternion() {\n return this._quaternion;\n }\n\n /**\n * Sets the SceneModel's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n * @deprecated\n */\n set scale(value) {\n // NOP - deprecated\n }\n\n /**\n * Gets the SceneModel's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n * @deprecated\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the SceneModel's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n set matrix(value) {\n this._matrix.set(value || DEFAULT_MATRIX);\n\n math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);\n math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);\n math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);\n this._matrix.set(this._worldRotationMatrix);\n math.translateMat4v(this._position, this._matrix);\n\n this._matrixDirty = false;\n this._setWorldMatrixDirty();\n this._sceneModelDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the SceneModel's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n get matrix() {\n if (this._matrixDirty) {\n this._rebuildMatrices();\n }\n return this._matrix;\n }\n\n /**\n * Gets the SceneModel's local modeling rotation transform matrix.\n *\n * @type {Number[]}\n */\n get rotationMatrix() {\n if (this._matrixDirty) {\n this._rebuildMatrices();\n }\n return this._worldRotationMatrix;\n }\n\n _rebuildMatrices() {\n if (this._matrixDirty) {\n math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);\n math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);\n math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);\n this._matrix.set(this._worldRotationMatrix);\n math.translateMat4v(this._position, this._matrix);\n this._matrixDirty = false;\n }\n }\n\n /**\n * Gets the conjugate of the SceneModel's local modeling rotation transform matrix.\n *\n * This is used for RTC view matrix management in renderers.\n *\n * @type {Number[]}\n */\n get rotationMatrixConjugate() {\n if (this._matrixDirty) {\n this._rebuildMatrices();\n }\n return this._worldRotationMatrixConjugate;\n }\n\n _setWorldMatrixDirty() {\n this._matrixDirty = true;\n this._aabbDirty = true;\n }\n\n _transformDirty() {\n this._matrixDirty = true;\n this._aabbDirty = true;\n this.scene._aabbDirty = true;\n }\n\n _sceneModelDirty() {\n this.scene._aabbDirty = true;\n this._aabbDirty = true;\n this.scene._aabbDirty = true;\n this._matrixDirty = true;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i]._sceneModelDirty(); // Entities need to retransform their World AABBs by SceneModel's worldMatrix\n }\n }\n\n /**\n * Gets the SceneModel's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n */\n get worldMatrix() {\n return this.matrix;\n }\n\n /**\n * Gets the SceneModel's World normal matrix.\n *\n * @type {Number[]}\n */\n get worldNormalMatrix() {\n return this._worldNormalMatrix;\n }\n\n /**\n * Called by private renderers in ./lib, returns the view matrix with which to\n * render this SceneModel. The view matrix is the concatenation of the\n * Camera view matrix with the Performance model's world (modeling) matrix.\n *\n * @private\n */\n get viewMatrix() {\n if (!this._viewMatrix) {\n return this.scene.camera.viewMatrix;\n }\n if (this._matrixDirty) {\n this._rebuildMatrices();\n this._viewMatrixDirty = true;\n }\n if (this._viewMatrixDirty) {\n math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);\n math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);\n math.transposeMat4(this._viewNormalMatrix);\n this._viewMatrixDirty = false;\n }\n return this._viewMatrix;\n }\n\n /**\n * Called by private renderers in ./lib, returns the view normal matrix with which to render this SceneModel.\n *\n * @private\n */\n get viewNormalMatrix() {\n if (!this._viewNormalMatrix) {\n return this.scene.camera.viewNormalMatrix;\n }\n if (this._matrixDirty) {\n this._rebuildMatrices();\n this._viewMatrixDirty = true;\n }\n if (this._viewMatrixDirty) {\n math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);\n math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);\n math.transposeMat4(this._viewNormalMatrix);\n this._viewMatrixDirty = false;\n }\n math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);\n math.transposeMat4(this._viewNormalMatrix);\n return this._viewNormalMatrix;\n }\n\n /**\n * Sets if backfaces are rendered for this SceneModel.\n *\n * Default is ````false````.\n *\n * @type {Boolean}\n */\n get backfaces() {\n return this._backfaces;\n }\n\n /**\n * Sets if backfaces are rendered for this SceneModel.\n *\n * Default is ````false````.\n *\n * When we set this ````true````, then backfaces are always rendered for this SceneModel.\n *\n * When we set this ````false````, then we allow the Viewer to decide whether to render backfaces. In this case,\n * the Viewer will:\n *\n * * hide backfaces on watertight meshes,\n * * show backfaces on open meshes, and\n * * always show backfaces on meshes when we slice them open with {@link SectionPlane}s.\n *\n * @type {Boolean}\n */\n set backfaces(backfaces) {\n backfaces = !!backfaces;\n this._backfaces = backfaces;\n this.glRedraw();\n }\n\n /**\n * Gets the list of {@link SceneModelEntity}s within this SceneModel.\n *\n * @returns {SceneModelEntity[]}\n */\n get entityList() {\n return this._entityList;\n }\n\n /**\n * Returns true to indicate that SceneModel is an {@link Entity}.\n * @type {Boolean}\n */\n get isEntity() {\n return true;\n }\n\n /**\n * Returns ````true```` if this SceneModel represents a model.\n *\n * When ````true```` the SceneModel will be registered by {@link SceneModel#id} in\n * {@link Scene#models} and may also have a {@link MetaObject} with matching {@link MetaObject#id}.\n *\n * @type {Boolean}\n */\n get isModel() {\n return this._isModel;\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // SceneModel members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns ````false```` to indicate that SceneModel never represents an object.\n *\n * @type {Boolean}\n */\n get isObject() {\n return false;\n }\n\n /**\n * Gets the SceneModel's World-space 3D axis-aligned bounding box.\n *\n * Represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @type {Number[]}\n */\n get aabb() {\n if (this._aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._entityList[i].aabb);\n }\n this._aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * The approximate number of triangle primitives in this SceneModel.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numTriangles;\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Entity members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * The approximate number of line primitives in this SceneModel.\n *\n * @type {Number}\n */\n get numLines() {\n return this._numLines;\n }\n\n /**\n * The approximate number of point primitives in this SceneModel.\n *\n * @type {Number}\n */\n get numPoints() {\n return this._numPoints;\n }\n\n /**\n * Gets if any {@link SceneModelEntity}s in this SceneModel are visible.\n *\n * The SceneModel is only rendered when {@link SceneModel#visible} is ````true```` and {@link SceneModel#culled} is ````false````.\n *\n * @type {Boolean}\n */\n get visible() {\n return (this.numVisibleLayerPortions > 0);\n }\n\n /**\n * Sets if this SceneModel is visible.\n *\n * The SceneModel is only rendered when {@link SceneModel#visible} is ````true```` and {@link SceneModel#culled} is ````false````.\n **\n * @type {Boolean}\n */\n set visible(visible) {\n visible = visible !== false;\n this._visible = visible;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].visible = visible;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if any {@link SceneModelEntity}s in this SceneModel are xrayed.\n *\n * @type {Boolean}\n */\n get xrayed() {\n return (this.numXRayedLayerPortions > 0);\n }\n\n /**\n * Sets if all {@link SceneModelEntity}s in this SceneModel are xrayed.\n *\n * @type {Boolean}\n */\n set xrayed(xrayed) {\n xrayed = !!xrayed;\n this._xrayed = xrayed;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].xrayed = xrayed;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if any {@link SceneModelEntity}s in this SceneModel are highlighted.\n *\n * @type {Boolean}\n */\n get highlighted() {\n return (this.numHighlightedLayerPortions > 0);\n }\n\n /**\n * Sets if all {@link SceneModelEntity}s in this SceneModel are highlighted.\n *\n * @type {Boolean}\n */\n set highlighted(highlighted) {\n highlighted = !!highlighted;\n this._highlighted = highlighted;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].highlighted = highlighted;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if any {@link SceneModelEntity}s in this SceneModel are selected.\n *\n * @type {Boolean}\n */\n get selected() {\n return (this.numSelectedLayerPortions > 0);\n }\n\n /**\n * Sets if all {@link SceneModelEntity}s in this SceneModel are selected.\n *\n * @type {Boolean}\n */\n set selected(selected) {\n selected = !!selected;\n this._selected = selected;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].selected = selected;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if any {@link SceneModelEntity}s in this SceneModel have edges emphasised.\n *\n * @type {Boolean}\n */\n get edges() {\n return (this.numEdgesLayerPortions > 0);\n }\n\n /**\n * Sets if all {@link SceneModelEntity}s in this SceneModel have edges emphasised.\n *\n * @type {Boolean}\n */\n set edges(edges) {\n edges = !!edges;\n this._edges = edges;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].edges = edges;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this SceneModel is culled from view.\n *\n * The SceneModel is only rendered when {@link SceneModel#visible} is true and {@link SceneModel#culled} is false.\n *\n * @type {Boolean}\n */\n get culled() {\n return this._culled;\n }\n\n /**\n * Sets if this SceneModel is culled from view.\n *\n * The SceneModel is only rendered when {@link SceneModel#visible} is true and {@link SceneModel#culled} is false.\n *\n * @type {Boolean}\n */\n set culled(culled) {\n culled = !!culled;\n this._culled = culled;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].culled = culled;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if {@link SceneModelEntity}s in this SceneModel are clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._clippable;\n }\n\n /**\n * Sets if {@link SceneModelEntity}s in this SceneModel are clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n set clippable(clippable) {\n clippable = clippable !== false;\n this._clippable = clippable;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].clippable = clippable;\n }\n this.glRedraw();\n }\n\n /**\n * Gets if this SceneModel is collidable.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._collidable;\n }\n\n /**\n * Sets if {@link SceneModelEntity}s in this SceneModel are collidable.\n *\n * @type {Boolean}\n */\n set collidable(collidable) {\n collidable = collidable !== false;\n this._collidable = collidable;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].collidable = collidable;\n }\n }\n\n /**\n * Gets if this SceneModel is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n get pickable() {\n return (this.numPickableLayerPortions > 0);\n }\n\n /**\n * Sets if {@link SceneModelEntity}s in this SceneModel are pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n set pickable(pickable) {\n pickable = pickable !== false;\n this._pickable = pickable;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].pickable = pickable;\n }\n }\n\n /**\n * Gets the RGB colorize color for this SceneModel.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n get colorize() {\n return this._colorize;\n }\n\n /**\n * Sets the RGB colorize color for this SceneModel.\n *\n * Multiplies by rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n set colorize(colorize) {\n this._colorize = colorize;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].colorize = colorize;\n }\n }\n\n /**\n * Gets this SceneModel's opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n return this._opacity;\n }\n\n /**\n * Sets the opacity factor for this SceneModel.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n this._opacity = opacity;\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i].opacity = opacity;\n }\n }\n\n /**\n * Gets if this SceneModel casts a shadow.\n *\n * @type {Boolean}\n */\n get castsShadow() {\n return this._castsShadow;\n }\n\n /**\n * Sets if this SceneModel casts a shadow.\n *\n * @type {Boolean}\n */\n set castsShadow(castsShadow) {\n castsShadow = (castsShadow !== false);\n if (castsShadow !== this._castsShadow) {\n this._castsShadow = castsShadow;\n this.glRedraw();\n }\n }\n\n /**\n * Sets if this SceneModel can have shadow cast upon it.\n *\n * @type {Boolean}\n */\n get receivesShadow() {\n return this._receivesShadow;\n }\n\n /**\n * Sets if this SceneModel can have shadow cast upon it.\n *\n * @type {Boolean}\n */\n set receivesShadow(receivesShadow) {\n receivesShadow = (receivesShadow !== false);\n if (receivesShadow !== this._receivesShadow) {\n this._receivesShadow = receivesShadow;\n this.glRedraw();\n }\n }\n\n /**\n * Gets if Scalable Ambient Obscurance (SAO) will apply to this SceneModel.\n *\n * SAO is configured by the Scene's {@link SAO} component.\n *\n * Only works when {@link SAO#enabled} is also true.\n *\n * @type {Boolean}\n */\n get saoEnabled() {\n return this._saoEnabled;\n }\n\n /**\n * Gets if physically-based rendering (PBR) is enabled for this SceneModel.\n *\n * Only works when {@link Scene#pbrEnabled} is also true.\n *\n * @type {Boolean}\n */\n get pbrEnabled() {\n return this._pbrEnabled;\n }\n\n /**\n * Gets if color textures are enabled for this SceneModel.\n *\n * Only works when {@link Scene#colorTextureEnabled} is also true.\n *\n * @type {Boolean}\n */\n get colorTextureEnabled() {\n return this._colorTextureEnabled;\n }\n\n /**\n * Returns true to indicate that SceneModel is implements {@link Drawable}.\n *\n * @type {Boolean}\n */\n get isDrawable() {\n return true;\n }\n\n /** @private */\n get isStateSortable() {\n return false\n }\n\n /**\n * Configures the appearance of xrayed {@link SceneModelEntity}s within this SceneModel.\n *\n * This is the {@link Scene#xrayMaterial}.\n *\n * @type {EmphasisMaterial}\n */\n get xrayMaterial() {\n return this.scene.xrayMaterial;\n }\n\n /**\n * Configures the appearance of highlighted {@link SceneModelEntity}s within this SceneModel.\n *\n * This is the {@link Scene#highlightMaterial}.\n *\n * @type {EmphasisMaterial}\n */\n get highlightMaterial() {\n return this.scene.highlightMaterial;\n }\n\n /**\n * Configures the appearance of selected {@link SceneModelEntity}s within this SceneModel.\n *\n * This is the {@link Scene#selectedMaterial}.\n *\n * @type {EmphasisMaterial}\n */\n get selectedMaterial() {\n return this.scene.selectedMaterial;\n }\n\n /**\n * Configures the appearance of edges of {@link SceneModelEntity}s within this SceneModel.\n *\n * This is the {@link Scene#edgeMaterial}.\n *\n * @type {EdgeMaterial}\n */\n get edgeMaterial() {\n return this.scene.edgeMaterial;\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Drawable members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Called by private renderers in ./lib, returns the picking view matrix with which to\n * ray-pick on this SceneModel.\n *\n * @private\n */\n getPickViewMatrix(pickViewMatrix) {\n if (!this._viewMatrix) {\n return pickViewMatrix;\n }\n return this._viewMatrix;\n }\n\n /**\n *\n * @param cfg\n */\n createQuantizationRange(cfg) {\n if (cfg.id === undefined || cfg.id === null) {\n this.error(\"[createQuantizationRange] Config missing: id\");\n return;\n }\n if (cfg.aabb) {\n this.error(\"[createQuantizationRange] Config missing: aabb\");\n return;\n }\n if (this._quantizationRanges[cfg.id]) {\n this.error(\"[createQuantizationRange] QuantizationRange already created: \" + cfg.id);\n return;\n }\n this._quantizationRanges[cfg.id] = {\n id: cfg.id,\n aabb: cfg.aabb,\n matrix: createPositionsDecodeMatrix(cfg.aabb, math.mat4())\n }\n }\n\n /**\n * Creates a reusable geometry within this SceneModel.\n *\n * We can then supply the geometry ID to {@link SceneModel#createMesh} when we want to create meshes that\n * instance the geometry.\n *\n * @param {*} cfg Geometry properties.\n * @param {String|Number} cfg.id Mandatory ID for the geometry, to refer to with {@link SceneModel#createMesh}.\n * @param {String} cfg.primitive The primitive type. Accepted values are 'points', 'lines', 'triangles', 'solid' and 'surface'.\n * @param {Number[]} [cfg.positions] Flat array of uncompressed 3D vertex positions positions. Required for all primitive types. Overridden by ````positionsCompressed````.\n * @param {Number[]} [cfg.positionsCompressed] Flat array of quantized 3D vertex positions. Overrides ````positions````, and must be accompanied by ````positionsDecodeMatrix````.\n * @param {Number[]} [cfg.positionsDecodeMatrix] A 4x4 matrix for decompressing ````positionsCompressed````. Must be accompanied by ````positionsCompressed````.\n * @param {Number[]} [cfg.normals] Flat array of normal vectors. Only used with \"triangles\", \"solid\" and \"surface\" primitives. When no normals are given, the geometry will be flat shaded using auto-generated face-aligned normals.\n * @param {Number[]} [cfg.normalsCompressed] Flat array of oct-encoded normal vectors. Overrides ````normals````. Only used with \"triangles\", \"solid\" and \"surface\" primitives. When no normals are given, the geometry will be flat shaded using auto-generated face-aligned normals.\n * @param {Number[]} [cfg.colors] Flat array of uncompressed RGBA vertex colors, as float values in range ````[0..1]````. Ignored when ````geometryId```` is given. Overridden by ````color```` and ````colorsCompressed````.\n * @param {Number[]} [cfg.colorsCompressed] Flat array of compressed RGBA vertex colors, as unsigned short integers in range ````[0..255]````. Ignored when ````geometryId```` is given. Overrides ````colors```` and is overridden by ````color````.\n * @param {Number[]} [cfg.uv] Flat array of uncompressed vertex UV coordinates. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Required for textured rendering.\n * @param {Number[]} [cfg.uvCompressed] Flat array of compressed vertex UV coordinates. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Overrides ````uv````. Must be accompanied by ````uvDecodeMatrix````. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Required for textured rendering.\n * @param {Number[]} [cfg.uvDecodeMatrix] A 3x3 matrix for decompressing ````uvCompressed````.\n * @param {Number[]} [cfg.indices] Array of primitive connectivity indices. Not required for `points` primitives.\n * @param {Number[]} [cfg.edgeIndices] Array of edge line indices. Used only with 'triangles', 'solid' and 'surface' primitives. Automatically generated internally if not supplied, using the optional ````edgeThreshold```` given to the ````SceneModel```` constructor.\n */\n createGeometry(cfg) {\n if (cfg.id === undefined || cfg.id === null) {\n this.error(\"[createGeometry] Config missing: id\");\n return;\n }\n if (this._geometries[cfg.id]) {\n this.error(\"[createGeometry] Geometry already created: \" + cfg.id);\n return;\n }\n if (cfg.primitive === undefined || cfg.primitive === null) {\n cfg.primitive = \"triangles\";\n }\n if (cfg.primitive !== \"points\" && cfg.primitive !== \"lines\" && cfg.primitive !== \"triangles\" && cfg.primitive !== \"solid\" && cfg.primitive !== \"surface\") {\n this.error(`[createGeometry] Unsupported value for 'primitive': '${cfg.primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);\n return;\n }\n if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {\n this.error(\"[createGeometry] Param expected: `positions`, `positionsCompressed' or 'buckets\");\n return null;\n }\n if (cfg.positionsCompressed && !cfg.positionsDecodeMatrix && !cfg.positionsDecodeBoundary) {\n this.error(\"[createGeometry] Param expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')\");\n return null;\n }\n if (cfg.positionsDecodeMatrix && cfg.positionsDecodeBoundary) {\n this.error(\"[createGeometry] Only one of these params expected: `positionsDecodeMatrix` or 'positionsDecodeBoundary' (required for `positionsCompressed')\");\n return null;\n }\n if (cfg.uvCompressed && !cfg.uvDecodeMatrix) {\n this.error(\"[createGeometry] Param expected: `uvDecodeMatrix` (required for `uvCompressed')\");\n return null;\n }\n if (!cfg.buckets && !cfg.indices && (cfg.primitive === \"triangles\" || cfg.primitive === \"solid\" || cfg.primitive === \"surface\")) {\n const numPositions = (cfg.positions || cfg.positionsCompressed).length / 3;\n cfg.indices = this._createDefaultIndices(numPositions);\n }\n if (!cfg.buckets && !cfg.indices && cfg.primitive !== \"points\") {\n this.error(`[createGeometry] Param expected: indices (required for '${cfg.primitive}' primitive type)`);\n return null;\n }\n if (cfg.positionsDecodeBoundary) {\n cfg.positionsDecodeMatrix = createPositionsDecodeMatrix(cfg.positionsDecodeBoundary, math.mat4());\n }\n if (cfg.positions) {\n const aabb = math.collapseAABB3();\n cfg.positionsDecodeMatrix = math.mat4();\n math.expandAABB3Points3(aabb, cfg.positions);\n cfg.positionsCompressed = quantizePositions(cfg.positions, aabb, cfg.positionsDecodeMatrix);\n cfg.aabb = aabb;\n } else if (cfg.positionsCompressed) {\n const aabb = math.collapseAABB3();\n cfg.positionsDecodeMatrix = new Float64Array(cfg.positionsDecodeMatrix);\n cfg.positionsCompressed = new Uint16Array(cfg.positionsCompressed);\n math.expandAABB3Points3(aabb, cfg.positionsCompressed);\n geometryCompressionUtils.decompressAABB(aabb, cfg.positionsDecodeMatrix);\n cfg.aabb = aabb;\n } else if (cfg.buckets) {\n const aabb = math.collapseAABB3();\n this._dtxBuckets[cfg.id] = cfg.buckets;\n for (let i = 0, len = cfg.buckets.length; i < len; i++) {\n const bucket = cfg.buckets[i];\n if (bucket.positions) {\n math.expandAABB3Points3(aabb, bucket.positions);\n } else if (bucket.positionsCompressed) {\n math.expandAABB3Points3(aabb, bucket.positionsCompressed);\n }\n }\n if (cfg.positionsDecodeMatrix) {\n geometryCompressionUtils.decompressAABB(aabb, cfg.positionsDecodeMatrix);\n }\n cfg.aabb = aabb;\n }\n if (cfg.colorsCompressed && cfg.colorsCompressed.length > 0) {\n cfg.colorsCompressed = new Uint8Array(cfg.colorsCompressed);\n } else if (cfg.colors && cfg.colors.length > 0) {\n const colors = cfg.colors;\n const colorsCompressed = new Uint8Array(colors.length);\n for (let i = 0, len = colors.length; i < len; i++) {\n colorsCompressed[i] = colors[i] * 255;\n }\n cfg.colorsCompressed = colorsCompressed;\n }\n if (!cfg.buckets && !cfg.edgeIndices && (cfg.primitive === \"triangles\" || cfg.primitive === \"solid\" || cfg.primitive === \"surface\")) {\n if (cfg.positions) {\n cfg.edgeIndices = buildEdgeIndices(cfg.positions, cfg.indices, null, 5.0);\n } else {\n cfg.edgeIndices = buildEdgeIndices(cfg.positionsCompressed, cfg.indices, cfg.positionsDecodeMatrix, 2.0);\n }\n }\n if (cfg.uv) {\n const bounds = geometryCompressionUtils.getUVBounds(cfg.uv);\n const result = geometryCompressionUtils.compressUVs(cfg.uv, bounds.min, bounds.max);\n cfg.uvCompressed = result.quantized;\n cfg.uvDecodeMatrix = result.decodeMatrix;\n } else if (cfg.uvCompressed) {\n cfg.uvCompressed = new Uint16Array(cfg.uvCompressed);\n cfg.uvDecodeMatrix = new Float64Array(cfg.uvDecodeMatrix);\n }\n if (cfg.normals) { // HACK\n cfg.normals = null;\n }\n this._geometries [cfg.id] = cfg;\n this._numTriangles += (cfg.indices ? Math.round(cfg.indices.length / 3) : 0);\n this.numGeometries++;\n }\n\n /**\n * Creates a texture within this SceneModel.\n *\n * We can then supply the texture ID to {@link SceneModel#createTextureSet} when we want to create texture sets that use the texture.\n *\n * @param {*} cfg Texture properties.\n * @param {String|Number} cfg.id Mandatory ID for the texture, to refer to with {@link SceneModel#createTextureSet}.\n * @param {String} [cfg.src] Image file for the texture. Assumed to be transcoded if not having a recognized image file\n * extension (jpg, jpeg, png etc.). If transcoded, then assumes ````SceneModel```` is configured with a {@link TextureTranscoder}.\n * @param {ArrayBuffer[]} [cfg.buffers] Transcoded texture data. Assumes ````SceneModel```` is\n * configured with a {@link TextureTranscoder}. This parameter is given as an array of buffers so we can potentially support multi-image textures, such as cube maps.\n * @param {HTMLImageElement} [cfg.image] HTML Image object to load into this texture. Overrides ````src```` and ````buffers````. Never transcoded.\n * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.\n * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.\n * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.\n * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.\n * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..\n * @param {Number} [cfg.wrapR=RepeatWrapping] Wrap parameter for texture coordinate *R*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.\n * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.\n * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.\n */\n createTexture(cfg) {\n const textureId = cfg.id;\n if (textureId === undefined || textureId === null) {\n this.error(\"[createTexture] Config missing: id\");\n return;\n }\n if (this._textures[textureId]) {\n this.error(\"[createTexture] Texture already created: \" + textureId);\n return;\n }\n if (!cfg.src && !cfg.image && !cfg.buffers) {\n this.error(\"[createTexture] Param expected: `src`, `image' or 'buffers'\");\n return null;\n }\n let minFilter = cfg.minFilter || LinearMipmapLinearFilter;\n if (minFilter !== LinearFilter &&\n minFilter !== LinearMipMapNearestFilter &&\n minFilter !== LinearMipmapLinearFilter &&\n minFilter !== NearestMipMapLinearFilter &&\n minFilter !== NearestMipMapNearestFilter) {\n this.error(`[createTexture] Unsupported value for 'minFilter' - \n supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, \n NearestMipMapLinearFilter and LinearMipmapLinearFilter. Defaulting to LinearMipmapLinearFilter.`);\n minFilter = LinearMipmapLinearFilter;\n }\n let magFilter = cfg.magFilter || LinearFilter;\n if (magFilter !== LinearFilter && magFilter !== NearestFilter) {\n this.error(`[createTexture] Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.`);\n magFilter = LinearFilter;\n }\n let wrapS = cfg.wrapS || RepeatWrapping;\n if (wrapS !== ClampToEdgeWrapping && wrapS !== MirroredRepeatWrapping && wrapS !== RepeatWrapping) {\n this.error(`[createTexture] Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.`);\n wrapS = RepeatWrapping;\n }\n let wrapT = cfg.wrapT || RepeatWrapping;\n if (wrapT !== ClampToEdgeWrapping && wrapT !== MirroredRepeatWrapping && wrapT !== RepeatWrapping) {\n this.error(`[createTexture] Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.`);\n wrapT = RepeatWrapping;\n }\n let wrapR = cfg.wrapR || RepeatWrapping;\n if (wrapR !== ClampToEdgeWrapping && wrapR !== MirroredRepeatWrapping && wrapR !== RepeatWrapping) {\n this.error(`[createTexture] Unsupported value for 'wrapR' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.`);\n wrapR = RepeatWrapping;\n }\n let encoding = cfg.encoding || LinearEncoding;\n if (encoding !== LinearEncoding && encoding !== sRGBEncoding) {\n this.error(\"[createTexture] Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.\");\n encoding = LinearEncoding;\n }\n const texture = new Texture2D({\n gl: this.scene.canvas.gl,\n minFilter,\n magFilter,\n wrapS,\n wrapT,\n wrapR,\n // flipY: cfg.flipY,\n encoding\n });\n if (cfg.preloadColor) {\n texture.setPreloadColor(cfg.preloadColor);\n }\n if (cfg.image) { // Ignore transcoder for Images\n const image = cfg.image;\n image.crossOrigin = \"Anonymous\";\n texture.setImage(image, {minFilter, magFilter, wrapS, wrapT, wrapR, flipY: cfg.flipY, encoding});\n } else if (cfg.src) {\n const ext = cfg.src.split('.').pop();\n switch (ext) { // Don't transcode recognized image file types\n case \"jpeg\":\n case \"jpg\":\n case \"png\":\n case \"gif\":\n const image = new Image();\n image.onload = () => {\n texture.setImage(image, {\n minFilter,\n magFilter,\n wrapS,\n wrapT,\n wrapR,\n flipY: cfg.flipY,\n encoding\n });\n this.glRedraw();\n };\n image.src = cfg.src; // URL or Base64 string\n break;\n default: // Assume other file types need transcoding\n if (!this._textureTranscoder) {\n this.error(`[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('${ext}')`);\n } else {\n utils.loadArraybuffer(cfg.src, (arrayBuffer) => {\n if (!arrayBuffer.byteLength) {\n this.error(`[createTexture] Can't create texture from 'src': file data is zero length`);\n return;\n }\n this._textureTranscoder.transcode([arrayBuffer], texture).then(() => {\n this.glRedraw();\n });\n },\n function (errMsg) {\n this.error(`[createTexture] Can't create texture from 'src': ${errMsg}`);\n });\n }\n break;\n }\n } else if (cfg.buffers) { // Buffers implicitly require transcoding\n if (!this._textureTranscoder) {\n this.error(`[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option`);\n } else {\n this._textureTranscoder.transcode(cfg.buffers, texture).then(() => {\n this.glRedraw();\n });\n }\n }\n this._textures[textureId] = new SceneModelTexture({id: textureId, texture});\n }\n\n /**\n * Creates a texture set within this SceneModel.\n *\n * * Stores the new {@link SceneModelTextureSet} in {@link SceneModel#textureSets}.\n *\n * A texture set is a collection of textures that can be shared among meshes. We can then supply the texture set\n * ID to {@link SceneModel#createMesh} when we want to create meshes that use the texture set.\n *\n * The textures can work as a texture atlas, where each mesh can have geometry UVs that index\n * a different part of the textures. This allows us to minimize the number of textures in our models, which\n * means faster rendering.\n *\n * @param {*} cfg Texture set properties.\n * @param {String|Number} cfg.id Mandatory ID for the texture set, to refer to with {@link SceneModel#createMesh}.\n * @param {*} [cfg.colorTextureId] ID of *RGBA* base color texture, with color in *RGB* and alpha in *A*.\n * @param {*} [cfg.metallicRoughnessTextureId] ID of *RGBA* metal-roughness texture, with the metallic factor in *R*, and roughness factor in *G*.\n * @param {*} [cfg.normalsTextureId] ID of *RGBA* normal map texture, with normal map vectors in *RGB*.\n * @param {*} [cfg.emissiveTextureId] ID of *RGBA* emissive map texture, with emissive color in *RGB*.\n * @param {*} [cfg.occlusionTextureId] ID of *RGBA* occlusion map texture, with occlusion factor in *R*.\n * @returns {SceneModelTransform} The new texture set.\n */\n createTextureSet(cfg) {\n const textureSetId = cfg.id;\n if (textureSetId === undefined || textureSetId === null) {\n this.error(\"[createTextureSet] Config missing: id\");\n return;\n }\n if (this._textureSets[textureSetId]) {\n this.error(`[createTextureSet] Texture set already created: ${textureSetId}`);\n return;\n }\n let colorTexture;\n if (cfg.colorTextureId !== undefined && cfg.colorTextureId !== null) {\n colorTexture = this._textures[cfg.colorTextureId];\n if (!colorTexture) {\n this.error(`[createTextureSet] Texture not found: ${cfg.colorTextureId} - ensure that you create it first with createTexture()`);\n return;\n }\n } else {\n colorTexture = this._textures[DEFAULT_COLOR_TEXTURE_ID];\n }\n let metallicRoughnessTexture;\n if (cfg.metallicRoughnessTextureId !== undefined && cfg.metallicRoughnessTextureId !== null) {\n metallicRoughnessTexture = this._textures[cfg.metallicRoughnessTextureId];\n if (!metallicRoughnessTexture) {\n this.error(`[createTextureSet] Texture not found: ${cfg.metallicRoughnessTextureId} - ensure that you create it first with createTexture()`);\n return;\n }\n } else {\n metallicRoughnessTexture = this._textures[DEFAULT_METAL_ROUGH_TEXTURE_ID];\n }\n let normalsTexture;\n if (cfg.normalsTextureId !== undefined && cfg.normalsTextureId !== null) {\n normalsTexture = this._textures[cfg.normalsTextureId];\n if (!normalsTexture) {\n this.error(`[createTextureSet] Texture not found: ${cfg.normalsTextureId} - ensure that you create it first with createTexture()`);\n return;\n }\n } else {\n normalsTexture = this._textures[DEFAULT_NORMALS_TEXTURE_ID];\n }\n let emissiveTexture;\n if (cfg.emissiveTextureId !== undefined && cfg.emissiveTextureId !== null) {\n emissiveTexture = this._textures[cfg.emissiveTextureId];\n if (!emissiveTexture) {\n this.error(`[createTextureSet] Texture not found: ${cfg.emissiveTextureId} - ensure that you create it first with createTexture()`);\n return;\n }\n } else {\n emissiveTexture = this._textures[DEFAULT_EMISSIVE_TEXTURE_ID];\n }\n let occlusionTexture;\n if (cfg.occlusionTextureId !== undefined && cfg.occlusionTextureId !== null) {\n occlusionTexture = this._textures[cfg.occlusionTextureId];\n if (!occlusionTexture) {\n this.error(`[createTextureSet] Texture not found: ${cfg.occlusionTextureId} - ensure that you create it first with createTexture()`);\n return;\n }\n } else {\n occlusionTexture = this._textures[DEFAULT_OCCLUSION_TEXTURE_ID];\n }\n const textureSet = new SceneModelTextureSet({\n id: textureSetId,\n model: this,\n colorTexture,\n metallicRoughnessTexture,\n normalsTexture,\n emissiveTexture,\n occlusionTexture\n });\n this._textureSets[textureSetId] = textureSet;\n return textureSet;\n }\n\n /**\n * Creates a new {@link SceneModelTransform} within this SceneModel.\n *\n * * Stores the new {@link SceneModelTransform} in {@link SceneModel#transforms}.\n * * Can be connected into hierarchies\n * * Each {@link SceneModelTransform} can be used by unlimited {@link SceneModelMesh}es\n *\n * @param {*} cfg Transform creation parameters.\n * @param {String} cfg.id Mandatory ID for the new transform. Must not clash with any existing components within the {@link Scene}.\n * @param {String} [cfg.parentTransformId] ID of a parent transform, previously created with {@link SceneModel#createTextureSet}.\n * @param {Number[]} [cfg.position=[0,0,0]] Local 3D position of the mesh. Overridden by ````transformId````.\n * @param {Number[]} [cfg.scale=[1,1,1]] Scale of the transform.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Rotation of the transform as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Modelling transform matrix. Overrides the ````position````, ````scale```` and ````rotation```` parameters.\n * @returns {SceneModelTransform} The new transform.\n */\n createTransform(cfg) {\n if (cfg.id === undefined || cfg.id === null) {\n this.error(\"[createTransform] SceneModel.createTransform() config missing: id\");\n return;\n }\n if (this._transforms[cfg.id]) {\n this.error(`[createTransform] SceneModel already has a transform with this ID: ${cfg.id}`);\n return;\n }\n let parentTransform;\n if (cfg.parentTransformId) {\n parentTransform = this._transforms[cfg.parentTransformId];\n if (!parentTransform) {\n this.error(\"[createTransform] SceneModel.createTransform() config missing: id\");\n return;\n }\n }\n const transform = new SceneModelTransform({\n id: cfg.id,\n model: this,\n parent: parentTransform,\n matrix: cfg.matrix,\n position: cfg.position,\n scale: cfg.scale,\n rotation: cfg.rotation,\n quaternion: cfg.quaternion\n });\n this._transforms[transform.id] = transform;\n return transform;\n }\n\n /**\n * Creates a new {@link SceneModelMesh} within this SceneModel.\n *\n * * It prepares and saves data for a SceneModelMesh {@link SceneModel#meshes} creation. SceneModelMesh will be created only once the SceneModelEntity (which references this particular SceneModelMesh) will be created.\n * * The SceneModelMesh can either define its own geometry or share it with other SceneModelMeshes. To define own geometry, provide the\n * various geometry arrays to this method. To share a geometry, provide the ID of a geometry created earlier\n * with {@link SceneModel#createGeometry}.\n * * If you accompany the arrays with an ````origin````, then ````createMesh()```` will assume\n * that the geometry ````positions```` are in relative-to-center (RTC) coordinates, with ````origin```` being the\n * origin of their RTC coordinate system.\n *\n * @param {object} cfg Object properties.\n * @param {String} cfg.id Mandatory ID for the new mesh. Must not clash with any existing components within the {@link Scene}.\n * @param {String|Number} [cfg.textureSetId] ID of a {@link SceneModelTextureSet} previously created with {@link SceneModel#createTextureSet}.\n * @param {String|Number} [cfg.transformId] ID of a {@link SceneModelTransform} to instance, previously created with {@link SceneModel#createTransform}. Overrides all other transform parameters given to this method.\n * @param {String|Number} [cfg.geometryId] ID of a geometry to instance, previously created with {@link SceneModel#createGeometry}. Overrides all other geometry parameters given to this method.\n * @param {String} cfg.primitive The primitive type. Accepted values are 'points', 'lines', 'triangles', 'solid' and 'surface'.\n * @param {Number[]} [cfg.positions] Flat array of uncompressed 3D vertex positions positions. Required for all primitive types. Overridden by ````positionsCompressed````.\n * @param {Number[]} [cfg.positionsCompressed] Flat array of quantized 3D vertex positions. Overrides ````positions````, and must be accompanied by ````positionsDecodeMatrix````.\n * @param {Number[]} [cfg.positionsDecodeMatrix] A 4x4 matrix for decompressing ````positionsCompressed````. Must be accompanied by ````positionsCompressed````.\n * @param {Number[]} [cfg.normals] Flat array of normal vectors. Only used with \"triangles\", \"solid\" and \"surface\" primitives. When no normals are given, the geometry will be flat shaded using auto-generated face-aligned normals.\n * @param {Number[]} [cfg.normalsCompressed] Flat array of oct-encoded normal vectors. Overrides ````normals````. Only used with \"triangles\", \"solid\" and \"surface\" primitives. When no normals are given, the geometry will be flat shaded using auto-generated face-aligned normals.\n * @param {Number[]} [cfg.colors] Flat array of uncompressed RGBA vertex colors, as float values in range ````[0..1]````. Ignored when ````geometryId```` is given. Overridden by ````color```` and ````colorsCompressed````.\n * @param {Number[]} [cfg.colorsCompressed] Flat array of compressed RGBA vertex colors, as unsigned short integers in range ````[0..255]````. Ignored when ````geometryId```` is given. Overrides ````colors```` and is overridden by ````color````.\n * @param {Number[]} [cfg.uv] Flat array of uncompressed vertex UV coordinates. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Required for textured rendering.\n * @param {Number[]} [cfg.uvCompressed] Flat array of compressed vertex UV coordinates. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Overrides ````uv````. Must be accompanied by ````uvDecodeMatrix````. Only used with \"triangles\", \"solid\" and \"surface\" primitives. Required for textured rendering.\n * @param {Number[]} [cfg.uvDecodeMatrix] A 3x3 matrix for decompressing ````uvCompressed````.\n * @param {Number[]} [cfg.indices] Array of primitive connectivity indices. Not required for `points` primitives.\n * @param {Number[]} [cfg.edgeIndices] Array of edge line indices. Used only with 'triangles', 'solid' and 'surface' primitives. Automatically generated internally if not supplied, using the optional ````edgeThreshold```` given to the ````SceneModel```` constructor.\n * @param {Number[]} [cfg.origin] Optional geometry origin, relative to {@link SceneModel#origin}. When this is given, then ````positions```` are assumed to be relative to this.\n * @param {Number[]} [cfg.position=[0,0,0]] Local 3D position of the mesh. Overridden by ````transformId````.\n * @param {Number[]} [cfg.scale=[1,1,1]] Scale of the mesh. Overridden by ````transformId````.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Rotation of the mesh as Euler angles given in degrees, for each of the X, Y and Z axis. Overridden by ````transformId````.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Mesh modelling transform matrix. Overrides the ````position````, ````scale```` and ````rotation```` parameters. Also overridden by ````transformId````.\n * @param {Number[]} [cfg.color=[1,1,1]] RGB color in range ````[0..1, 0..1, 0..1]````. Overridden by texture set ````colorTexture````. Overrides ````colors```` and ````colorsCompressed````.\n * @param {Number} [cfg.opacity=1] Opacity in range ````[0..1]````. Overridden by texture set ````colorTexture````.\n * @param {Number} [cfg.metallic=0] Metallic factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.\n * @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.\n * @returns {SceneModelMesh} The new mesh.\n */\n createMesh(cfg) {\n\n if (cfg.id === undefined || cfg.id === null) {\n this.error(\"[createMesh] SceneModel.createMesh() config missing: id\");\n return false;\n }\n\n if (this._meshes[cfg.id]) {\n this.error(`[createMesh] SceneModel already has a mesh with this ID: ${cfg.id}`);\n return false;\n }\n\n const instancing = (cfg.geometryId !== undefined);\n const batching = !instancing;\n\n if (batching) {\n\n // Batched geometry\n\n if (cfg.primitive === undefined || cfg.primitive === null) {\n cfg.primitive = \"triangles\";\n }\n if (cfg.primitive !== \"points\" && cfg.primitive !== \"lines\" && cfg.primitive !== \"triangles\" && cfg.primitive !== \"solid\" && cfg.primitive !== \"surface\") {\n this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`);\n return false;\n }\n if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {\n this.error(\"Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)\");\n return false;\n }\n if (cfg.positions && (cfg.positionsDecodeMatrix || cfg.positionsDecodeBoundary)) {\n this.error(\"Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)\");\n return false;\n }\n if (cfg.positionsCompressed && !cfg.positionsDecodeMatrix && !cfg.positionsDecodeBoundary) {\n this.error(\"Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)\");\n return false;\n }\n if (cfg.uvCompressed && !cfg.uvDecodeMatrix) {\n this.error(\"Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)\");\n return false;\n }\n if (!cfg.buckets && !cfg.indices && (cfg.primitive === \"triangles\" || cfg.primitive === \"solid\" || cfg.primitive === \"surface\")) {\n const numPositions = (cfg.positions || cfg.positionsCompressed).length / 3;\n cfg.indices = this._createDefaultIndices(numPositions);\n }\n if (!cfg.buckets && !cfg.indices && cfg.primitive !== \"points\") {\n cfg.indices = this._createDefaultIndices(numIndices)\n this.error(`Param expected: indices (required for '${cfg.primitive}' primitive type)`);\n return false;\n }\n if ((cfg.matrix || cfg.position || cfg.rotation || cfg.scale) && (cfg.positionsCompressed || cfg.positionsDecodeBoundary)) {\n this.error(\"Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'\");\n return false;\n }\n\n const useDTX = (!!this._dtxEnabled && (cfg.primitive === \"triangles\"\n || cfg.primitive === \"solid\"\n || cfg.primitive === \"surface\"))\n && (!cfg.textureSetId);\n\n cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;\n\n // MATRIX - optional for batching\n\n if (cfg.matrix) {\n cfg.meshMatrix = cfg.matrix;\n } else if (cfg.scale || cfg.rotation || cfg.position) {\n const scale = cfg.scale || DEFAULT_SCALE;\n const position = cfg.position || DEFAULT_POSITION;\n const rotation = cfg.rotation || DEFAULT_ROTATION;\n math.eulerToQuaternion(rotation, \"XYZ\", DEFAULT_QUATERNION);\n cfg.meshMatrix = math.composeMat4(position, DEFAULT_QUATERNION, scale, math.mat4());\n }\n\n if (cfg.positionsDecodeBoundary) {\n cfg.positionsDecodeMatrix = createPositionsDecodeMatrix(cfg.positionsDecodeBoundary, math.mat4());\n }\n\n if (useDTX) {\n\n // DTX\n\n cfg.type = DTX;\n\n // NPR\n\n cfg.color = (cfg.color) ? new Uint8Array([Math.floor(cfg.color[0] * 255), Math.floor(cfg.color[1] * 255), Math.floor(cfg.color[2] * 255)]) : defaultCompressedColor;\n cfg.opacity = (cfg.opacity !== undefined && cfg.opacity !== null) ? Math.floor(cfg.opacity * 255) : 255;\n\n // RTC\n\n if (cfg.positions) {\n const rtcCenter = math.vec3();\n const rtcPositions = [];\n const rtcNeeded = worldToRTCPositions(cfg.positions, rtcPositions, rtcCenter);\n if (rtcNeeded) {\n cfg.positions = rtcPositions;\n cfg.origin = math.addVec3(cfg.origin, rtcCenter, rtcCenter);\n }\n }\n\n // COMPRESSION\n\n if (cfg.positions) {\n const aabb = math.collapseAABB3();\n cfg.positionsDecodeMatrix = math.mat4();\n math.expandAABB3Points3(aabb, cfg.positions);\n cfg.positionsCompressed = quantizePositions(cfg.positions, aabb, cfg.positionsDecodeMatrix);\n cfg.aabb = aabb;\n\n } else if (cfg.positionsCompressed) {\n const aabb = math.collapseAABB3();\n math.expandAABB3Points3(aabb, cfg.positionsCompressed);\n geometryCompressionUtils.decompressAABB(aabb, cfg.positionsDecodeMatrix);\n cfg.aabb = aabb;\n\n }\n if (cfg.buckets) {\n const aabb = math.collapseAABB3();\n for (let i = 0, len = cfg.buckets.length; i < len; i++) {\n const bucket = cfg.buckets[i];\n if (bucket.positions) {\n math.expandAABB3Points3(aabb, bucket.positions);\n } else if (bucket.positionsCompressed) {\n math.expandAABB3Points3(aabb, bucket.positionsCompressed);\n }\n }\n if (cfg.positionsDecodeMatrix) {\n geometryCompressionUtils.decompressAABB(aabb, cfg.positionsDecodeMatrix);\n }\n cfg.aabb = aabb;\n }\n\n if (cfg.meshMatrix) {\n math.AABB3ToOBB3(cfg.aabb, tempOBB3);\n math.transformOBB3(cfg.meshMatrix, tempOBB3);\n math.OBB3ToAABB3(tempOBB3, cfg.aabb);\n }\n\n // EDGES\n\n if (!cfg.buckets && !cfg.edgeIndices && (cfg.primitive === \"triangles\" || cfg.primitive === \"solid\" || cfg.primitive === \"surface\")) {\n if (cfg.positions) { // Faster\n cfg.edgeIndices = buildEdgeIndices(cfg.positions, cfg.indices, null, 2.0);\n } else {\n cfg.edgeIndices = buildEdgeIndices(cfg.positionsCompressed, cfg.indices, cfg.positionsDecodeMatrix, 2.0);\n }\n }\n\n // BUCKETING\n\n if (!cfg.buckets) {\n cfg.buckets = createDTXBuckets(cfg, this._enableVertexWelding && this._enableIndexBucketing);\n }\n\n } else {\n\n // VBO\n\n cfg.type = VBO_BATCHED;\n\n // PBR\n\n cfg.color = (cfg.color) ? new Uint8Array([Math.floor(cfg.color[0] * 255), Math.floor(cfg.color[1] * 255), Math.floor(cfg.color[2] * 255)]) : [255, 255, 255];\n cfg.opacity = (cfg.opacity !== undefined && cfg.opacity !== null) ? Math.floor(cfg.opacity * 255) : 255;\n cfg.metallic = (cfg.metallic !== undefined && cfg.metallic !== null) ? Math.floor(cfg.metallic * 255) : 0;\n cfg.roughness = (cfg.roughness !== undefined && cfg.roughness !== null) ? Math.floor(cfg.roughness * 255) : 255;\n\n // RTC\n\n if (cfg.positions) {\n const rtcPositions = [];\n const rtcNeeded = worldToRTCPositions(cfg.positions, rtcPositions, tempVec3a);\n if (rtcNeeded) {\n cfg.positions = rtcPositions;\n cfg.origin = math.addVec3(cfg.origin, tempVec3a, math.vec3());\n }\n }\n\n if (cfg.positions) {\n const aabb = math.collapseAABB3();\n if (cfg.meshMatrix) {\n math.transformPositions3(cfg.meshMatrix, cfg.positions, cfg.positions);\n cfg.meshMatrix = null; // Positions now baked, don't need any more\n }\n math.expandAABB3Points3(aabb, cfg.positions);\n cfg.aabb = aabb;\n\n } else {\n const aabb = math.collapseAABB3();\n math.expandAABB3Points3(aabb, cfg.positionsCompressed);\n geometryCompressionUtils.decompressAABB(aabb, cfg.positionsDecodeMatrix);\n cfg.aabb = aabb;\n }\n\n if (cfg.meshMatrix) {\n math.AABB3ToOBB3(cfg.aabb, tempOBB3);\n math.transformOBB3(cfg.meshMatrix, tempOBB3);\n math.OBB3ToAABB3(tempOBB3, cfg.aabb);\n }\n\n // EDGES\n\n if (!cfg.buckets && !cfg.edgeIndices && (cfg.primitive === \"triangles\" || cfg.primitive === \"solid\" || cfg.primitive === \"surface\")) {\n if (cfg.positions) {\n cfg.edgeIndices = buildEdgeIndices(cfg.positions, cfg.indices, null, 2.0);\n } else {\n cfg.edgeIndices = buildEdgeIndices(cfg.positionsCompressed, cfg.indices, cfg.positionsDecodeMatrix, 2.0);\n }\n }\n\n // TEXTURE\n\n // cfg.textureSetId = cfg.textureSetId || DEFAULT_TEXTURE_SET_ID;\n if (cfg.textureSetId) {\n cfg.textureSet = this._textureSets[cfg.textureSetId];\n if (!cfg.textureSet) {\n this.error(`[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`);\n return false;\n }\n }\n }\n\n } else {\n\n // INSTANCING\n\n if (cfg.positions || cfg.positionsCompressed || cfg.indices || cfg.edgeIndices || cfg.normals || cfg.normalsCompressed || cfg.uv || cfg.uvCompressed || cfg.positionsDecodeMatrix) {\n this.error(`Mesh geometry parameters not expected when instancing a geometry (not expected: positions, positionsCompressed, indices, edgeIndices, normals, normalsCompressed, uv, uvCompressed, positionsDecodeMatrix)`);\n return false;\n }\n\n cfg.geometry = this._geometries[cfg.geometryId];\n if (!cfg.geometry) {\n this.error(`[createMesh] Geometry not found: ${cfg.geometryId} - ensure that you create it first with createGeometry()`);\n return false;\n }\n\n cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;\n cfg.positionsDecodeMatrix = cfg.geometry.positionsDecodeMatrix;\n\n if (cfg.transformId) {\n\n // TRANSFORM\n\n cfg.transform = this._transforms[cfg.transformId];\n\n if (!cfg.transform) {\n this.error(`[createMesh] Transform not found: ${cfg.transformId} - ensure that you create it first with createTransform()`);\n return false;\n }\n\n cfg.aabb = cfg.geometry.aabb;\n\n } else {\n\n // MATRIX\n\n if (cfg.matrix) {\n cfg.meshMatrix = cfg.matrix.slice();\n } else {\n const scale = cfg.scale || DEFAULT_SCALE;\n const position = cfg.position || DEFAULT_POSITION;\n const rotation = cfg.rotation || DEFAULT_ROTATION;\n math.eulerToQuaternion(rotation, \"XYZ\", DEFAULT_QUATERNION);\n cfg.meshMatrix = math.composeMat4(position, DEFAULT_QUATERNION, scale, math.mat4());\n }\n\n math.AABB3ToOBB3(cfg.geometry.aabb, tempOBB3);\n math.transformOBB3(cfg.meshMatrix, tempOBB3);\n cfg.aabb = math.OBB3ToAABB3(tempOBB3, math.AABB3());\n }\n\n const useDTX = (!!this._dtxEnabled\n && (cfg.geometry.primitive === \"triangles\"\n || cfg.geometry.primitive === \"solid\"\n || cfg.geometry.primitive === \"surface\"))\n && (!cfg.textureSetId);\n\n if (useDTX) {\n\n // DTX\n\n cfg.type = DTX;\n\n // NPR\n\n cfg.color = (cfg.color) ? new Uint8Array([Math.floor(cfg.color[0] * 255), Math.floor(cfg.color[1] * 255), Math.floor(cfg.color[2] * 255)]) : defaultCompressedColor;\n cfg.opacity = (cfg.opacity !== undefined && cfg.opacity !== null) ? Math.floor(cfg.opacity * 255) : 255;\n\n // BUCKETING - lazy generated, reused\n\n let buckets = this._dtxBuckets[cfg.geometryId];\n if (!buckets) {\n buckets = createDTXBuckets(cfg.geometry, this._enableVertexWelding, this._enableIndexBucketing);\n this._dtxBuckets[cfg.geometryId] = buckets;\n }\n cfg.buckets = buckets;\n\n } else {\n\n // VBO\n\n cfg.type = VBO_INSTANCED;\n\n // PBR\n\n cfg.color = (cfg.color) ? new Uint8Array([Math.floor(cfg.color[0] * 255), Math.floor(cfg.color[1] * 255), Math.floor(cfg.color[2] * 255)]) : defaultCompressedColor;\n cfg.opacity = (cfg.opacity !== undefined && cfg.opacity !== null) ? Math.floor(cfg.opacity * 255) : 255;\n cfg.metallic = (cfg.metallic !== undefined && cfg.metallic !== null) ? Math.floor(cfg.metallic * 255) : 0;\n cfg.roughness = (cfg.roughness !== undefined && cfg.roughness !== null) ? Math.floor(cfg.roughness * 255) : 255;\n\n // TEXTURE\n\n if (cfg.textureSetId) {\n cfg.textureSet = this._textureSets[cfg.textureSetId];\n // if (!cfg.textureSet) {\n // this.error(`[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`);\n // return false;\n // }\n }\n }\n }\n\n cfg.numPrimitives = this._getNumPrimitives(cfg);\n\n return this._createMesh(cfg);\n }\n\n _createMesh(cfg) {\n const mesh = new SceneModelMesh(this, cfg.id, cfg.color, cfg.opacity, cfg.transform, cfg.textureSet);\n mesh.pickId = this.scene._renderer.getPickID(mesh);\n const pickId = mesh.pickId;\n const a = pickId >> 24 & 0xFF;\n const b = pickId >> 16 & 0xFF;\n const g = pickId >> 8 & 0xFF;\n const r = pickId & 0xFF;\n cfg.pickColor = new Uint8Array([r, g, b, a]); // Quantized pick color\n cfg.solid = (cfg.primitive === \"solid\");\n mesh.origin = math.vec3(cfg.origin);\n switch (cfg.type) {\n case DTX:\n mesh.layer = this._getDTXLayer(cfg);\n mesh.aabb = cfg.aabb;\n break;\n case VBO_BATCHED:\n mesh.layer = this._getVBOBatchingLayer(cfg);\n mesh.aabb = cfg.aabb;\n break;\n case VBO_INSTANCED:\n mesh.layer = this._getVBOInstancingLayer(cfg);\n mesh.aabb = cfg.aabb;\n break;\n }\n if (cfg.transform) {\n cfg.meshMatrix = cfg.transform.worldMatrix;\n }\n mesh.portionId = mesh.layer.createPortion(mesh, cfg);\n this._meshes[cfg.id] = mesh;\n this._unusedMeshes[cfg.id] = mesh;\n this._meshList.push(mesh);\n return mesh;\n }\n\n _getNumPrimitives(cfg) {\n let countIndices = 0;\n const primitive = cfg.geometry ? cfg.geometry.primitive : cfg.primitive;\n switch (primitive) {\n case \"triangles\":\n case \"solid\":\n case \"surface\":\n switch (cfg.type) {\n case DTX:\n for (let i = 0, len = cfg.buckets.length; i < len; i++) {\n countIndices += cfg.buckets[i].indices.length;\n }\n break;\n case VBO_BATCHED:\n countIndices += cfg.indices.length;\n break;\n case VBO_INSTANCED:\n countIndices += cfg.geometry.indices.length;\n break;\n }\n return Math.round(countIndices / 3);\n case \"points\":\n switch (cfg.type) {\n case DTX:\n for (let i = 0, len = cfg.buckets.length; i < len; i++) {\n countIndices += cfg.buckets[i].positionsCompressed.length;\n }\n break;\n case VBO_BATCHED:\n countIndices += cfg.positions ? cfg.positions.length : cfg.positionsCompressed.length;\n break;\n case VBO_INSTANCED:\n const geometry = cfg.geometry;\n countIndices += geometry.positions ? geometry.positions.length : geometry.positionsCompressed.length;\n break;\n }\n return Math.round(countIndices);\n case \"lines\":\n case \"line-strip\":\n switch (cfg.type) {\n case DTX:\n for (let i = 0, len = cfg.buckets.length; i < len; i++) {\n countIndices += cfg.buckets[i].indices.length;\n }\n break;\n case VBO_BATCHED:\n countIndices += cfg.indices.length;\n break;\n case VBO_INSTANCED:\n countIndices += cfg.geometry.indices.length;\n break;\n }\n return Math.round(countIndices / 2);\n }\n return 0;\n }\n\n _getDTXLayer(cfg) {\n const origin = cfg.origin;\n const primitive = cfg.geometry ? cfg.geometry.primitive : cfg.primitive;\n const layerId = `.${primitive}.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}`;\n let dtxLayer = this._dtxLayers[layerId];\n if (dtxLayer) {\n if (!dtxLayer.canCreatePortion(cfg)) {\n dtxLayer.finalize();\n delete this._dtxLayers[layerId];\n dtxLayer = null;\n } else {\n return dtxLayer;\n }\n }\n switch (primitive) {\n case \"triangles\":\n case \"solid\":\n case \"surface\":\n dtxLayer = new DTXTrianglesLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()\n break;\n case \"lines\":\n dtxLayer = new DTXLinesLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()\n break;\n default:\n return;\n }\n this._dtxLayers[layerId] = dtxLayer;\n this.layerList.push(dtxLayer);\n return dtxLayer;\n }\n\n _getVBOBatchingLayer(cfg) {\n const model = this;\n const origin = cfg.origin;\n const positionsDecodeHash = cfg.positionsDecodeMatrix || cfg.positionsDecodeBoundary ?\n this._createHashStringFromMatrix(cfg.positionsDecodeMatrix || cfg.positionsDecodeBoundary)\n : \"-\";\n const textureSetId = cfg.textureSetId || \"-\";\n const layerId = `${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${cfg.primitive}.${positionsDecodeHash}.${textureSetId}`;\n let vboBatchingLayer = this._vboBatchingLayers[layerId];\n if (vboBatchingLayer) {\n return vboBatchingLayer;\n }\n let textureSet = cfg.textureSet;\n while (!vboBatchingLayer) {\n switch (cfg.primitive) {\n case \"triangles\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);\n vboBatchingLayer = new VBOBatchingTrianglesLayer({\n model,\n textureSet,\n layerIndex: 0, // This is set in #finalize()\n scratchMemory: this._vboBatchingLayerScratchMemory,\n positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined\n uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined\n origin,\n maxGeometryBatchSize: this._maxGeometryBatchSize,\n solid: (cfg.primitive === \"solid\"),\n autoNormals: true\n });\n break;\n case \"solid\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);\n vboBatchingLayer = new VBOBatchingTrianglesLayer({\n model,\n textureSet,\n layerIndex: 0, // This is set in #finalize()\n scratchMemory: this._vboBatchingLayerScratchMemory,\n positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined\n uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined\n origin,\n maxGeometryBatchSize: this._maxGeometryBatchSize,\n solid: (cfg.primitive === \"solid\"),\n autoNormals: true\n });\n break;\n case \"surface\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);\n vboBatchingLayer = new VBOBatchingTrianglesLayer({\n model,\n textureSet,\n layerIndex: 0, // This is set in #finalize()\n scratchMemory: this._vboBatchingLayerScratchMemory,\n positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined\n uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined\n origin,\n maxGeometryBatchSize: this._maxGeometryBatchSize,\n solid: (cfg.primitive === \"solid\"),\n autoNormals: true\n });\n break;\n case \"lines\":\n // console.info(`[SceneModel ${this.id}]: creating VBOBatchingLinesLayer`);\n vboBatchingLayer = new VBOBatchingLinesLayer({\n model,\n layerIndex: 0, // This is set in #finalize()\n scratchMemory: this._vboBatchingLayerScratchMemory,\n positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined\n uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined\n origin,\n maxGeometryBatchSize: this._maxGeometryBatchSize\n });\n break;\n case \"points\":\n // console.info(`[SceneModel ${this.id}]: creating VBOBatchingPointsLayer`);\n vboBatchingLayer = new VBOBatchingPointsLayer({\n model,\n layerIndex: 0, // This is set in #finalize()\n scratchMemory: this._vboBatchingLayerScratchMemory,\n positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined\n uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined\n origin,\n maxGeometryBatchSize: this._maxGeometryBatchSize\n });\n break;\n }\n const lenPositions = cfg.positionsCompressed ? cfg.positionsCompressed.length : cfg.positions.length;\n const canCreatePortion = (cfg.primitive === \"points\")\n ? vboBatchingLayer.canCreatePortion(lenPositions)\n : vboBatchingLayer.canCreatePortion(lenPositions, cfg.indices.length);\n if (!canCreatePortion) {\n vboBatchingLayer.finalize();\n delete this._vboBatchingLayers[layerId];\n vboBatchingLayer = null;\n }\n }\n this._vboBatchingLayers[layerId] = vboBatchingLayer;\n this.layerList.push(vboBatchingLayer);\n return vboBatchingLayer;\n }\n\n _createHashStringFromMatrix(matrix) {\n const matrixString = matrix.join('');\n let hash = 0;\n for (let i = 0; i < matrixString.length; i++) {\n const char = matrixString.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash |= 0; // Convert to 32-bit integer\n }\n const hashString = (hash >>> 0).toString(16);\n return hashString;\n }\n\n _getVBOInstancingLayer(cfg) {\n const model = this;\n const origin = cfg.origin;\n const textureSetId = cfg.textureSetId || \"-\";\n const geometryId = cfg.geometryId;\n const layerId = `${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${textureSetId}.${geometryId}`;\n let vboInstancingLayer = this._vboInstancingLayers[layerId];\n if (vboInstancingLayer) {\n return vboInstancingLayer;\n }\n let textureSet = cfg.textureSet;\n const geometry = cfg.geometry;\n while (!vboInstancingLayer) {\n switch (geometry.primitive) {\n case \"triangles\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);\n vboInstancingLayer = new VBOInstancingTrianglesLayer({\n model,\n textureSet,\n geometry,\n origin,\n layerIndex: 0,\n solid: false\n });\n break;\n case \"solid\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);\n vboInstancingLayer = new VBOInstancingTrianglesLayer({\n model,\n textureSet,\n geometry,\n origin,\n layerIndex: 0,\n solid: true\n });\n break;\n case \"surface\":\n // console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);\n vboInstancingLayer = new VBOInstancingTrianglesLayer({\n model,\n textureSet,\n geometry,\n origin,\n layerIndex: 0,\n solid: false\n });\n break;\n case \"lines\":\n // console.info(`[SceneModel ${this.id}]: creating VBOInstancingLinesLayer`);\n vboInstancingLayer = new VBOInstancingLinesLayer({\n model,\n textureSet,\n geometry,\n origin,\n layerIndex: 0\n });\n break;\n case \"points\":\n // console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);\n vboInstancingLayer = new VBOInstancingPointsLayer({\n model,\n textureSet,\n geometry,\n origin,\n layerIndex: 0\n });\n break;\n }\n // const lenPositions = geometry.positionsCompressed.length;\n // if (!vboInstancingLayer.canCreatePortion(lenPositions, geometry.indices.length)) { // FIXME: indices should be optional\n // vboInstancingLayer.finalize();\n // delete this._vboInstancingLayers[layerId];\n // vboInstancingLayer = null;\n // }\n }\n this._vboInstancingLayers[layerId] = vboInstancingLayer;\n this.layerList.push(vboInstancingLayer);\n return vboInstancingLayer;\n }\n\n /**\n * Creates a {@link SceneModelEntity} within this SceneModel.\n *\n * * Gives the SceneModelEntity one or more {@link SceneModelMesh}es previously created with\n * {@link SceneModel#createMesh}. A SceneModelMesh can only belong to one SceneModelEntity, so you'll get an\n * error if you try to reuse a mesh among multiple SceneModelEntitys.\n * * The SceneModelEntity can have a {@link SceneModelTextureSet}, previously created with\n * {@link SceneModel#createTextureSet}. A SceneModelTextureSet can belong to multiple SceneModelEntitys.\n * * The SceneModelEntity can have a geometry, previously created with\n * {@link SceneModel#createTextureSet}. A geometry is a \"virtual component\" and can belong to multiple SceneModelEntitys.\n *\n * @param {Object} cfg SceneModelEntity configuration.\n * @param {String} cfg.id Optional ID for the new SceneModelEntity. Must not clash with any existing components within the {@link Scene}.\n * @param {String[]} cfg.meshIds IDs of one or more meshes created previously with {@link SceneModel@createMesh}.\n * @param {Boolean} [cfg.isObject] Set ````true```` if the {@link SceneModelEntity} represents an object, in which case it will be registered by {@link SceneModelEntity#id} in {@link Scene#objects} and can also have a corresponding {@link MetaObject} with matching {@link MetaObject#id}, registered by that ID in {@link MetaScene#metaObjects}.\n * @param {Boolean} [cfg.visible=true] Indicates if the SceneModelEntity is initially visible.\n * @param {Boolean} [cfg.culled=false] Indicates if the SceneModelEntity is initially culled from view.\n * @param {Boolean} [cfg.pickable=true] Indicates if the SceneModelEntity is initially pickable.\n * @param {Boolean} [cfg.clippable=true] Indicates if the SceneModelEntity is initially clippable.\n * @param {Boolean} [cfg.collidable=true] Indicates if the SceneModelEntity is initially included in boundary calculations.\n * @param {Boolean} [cfg.castsShadow=true] Indicates if the SceneModelEntity initially casts shadows.\n * @param {Boolean} [cfg.receivesShadow=true] Indicates if the SceneModelEntity initially receives shadows.\n * @param {Boolean} [cfg.xrayed=false] Indicates if the SceneModelEntity is initially xrayed. XRayed appearance is configured by {@link SceneModel#xrayMaterial}.\n * @param {Boolean} [cfg.highlighted=false] Indicates if the SceneModelEntity is initially highlighted. Highlighted appearance is configured by {@link SceneModel#highlightMaterial}.\n * @param {Boolean} [cfg.selected=false] Indicates if the SceneModelEntity is initially selected. Selected appearance is configured by {@link SceneModel#selectedMaterial}.\n * @param {Boolean} [cfg.edges=false] Indicates if the SceneModelEntity's edges are initially emphasized. Edges appearance is configured by {@link SceneModel#edgeMaterial}.\n * @returns {SceneModelEntity} The new SceneModelEntity.\n */\n createEntity(cfg) {\n if (cfg.id === undefined) {\n cfg.id = math.createUUID();\n } else if (this.scene.components[cfg.id]) {\n this.error(`Scene already has a Component with this ID: ${cfg.id} - will assign random ID`);\n cfg.id = math.createUUID();\n }\n if (cfg.meshIds === undefined) {\n this.error(\"Config missing: meshIds\");\n return;\n }\n let flags = 0;\n if (this._visible && cfg.visible !== false) {\n flags = flags | ENTITY_FLAGS.VISIBLE;\n }\n if (this._pickable && cfg.pickable !== false) {\n flags = flags | ENTITY_FLAGS.PICKABLE;\n }\n if (this._culled && cfg.culled !== false) {\n flags = flags | ENTITY_FLAGS.CULLED;\n }\n if (this._clippable && cfg.clippable !== false) {\n flags = flags | ENTITY_FLAGS.CLIPPABLE;\n }\n if (this._collidable && cfg.collidable !== false) {\n flags = flags | ENTITY_FLAGS.COLLIDABLE;\n }\n if (this._edges && cfg.edges !== false) {\n flags = flags | ENTITY_FLAGS.EDGES;\n }\n if (this._xrayed && cfg.xrayed !== false) {\n flags = flags | ENTITY_FLAGS.XRAYED;\n }\n if (this._highlighted && cfg.highlighted !== false) {\n flags = flags | ENTITY_FLAGS.HIGHLIGHTED;\n }\n if (this._selected && cfg.selected !== false) {\n flags = flags | ENTITY_FLAGS.SELECTED;\n }\n cfg.flags = flags;\n this._createEntity(cfg);\n }\n\n _createEntity(cfg) {\n let meshes = [];\n for (let i = 0, len = cfg.meshIds.length; i < len; i++) {\n const meshId = cfg.meshIds[i];\n let mesh = this._meshes[meshId]; // Trying to get already created mesh\n if (!mesh) { // Checks if there is already created mesh for this meshId\n this.error(`Mesh with this ID not found: \"${meshId}\" - ignoring this mesh`); // There is no such cfg\n continue;\n }\n if (mesh.parent) {\n this.error(`Mesh with ID \"${meshId}\" already belongs to object with ID \"${mesh.parent.id}\" - ignoring this mesh`);\n continue;\n }\n meshes.push(mesh);\n delete this._unusedMeshes[meshId];\n }\n const lodCullable = true;\n const entity = new SceneModelEntity(\n this,\n cfg.isObject,\n cfg.id,\n meshes,\n cfg.flags,\n lodCullable); // Internally sets SceneModelEntity#parent to this SceneModel\n this._entityList.push(entity);\n this._entities[cfg.id] = entity;\n this.numEntities++;\n }\n\n /**\n * Finalizes this SceneModel.\n *\n * Once finalized, you can't add anything more to this SceneModel.\n */\n finalize() {\n if (this.destroyed) {\n return;\n }\n this._createDummyEntityForUnusedMeshes();\n for (let i = 0, len = this.layerList.length; i < len; i++) {\n const layer = this.layerList[i];\n layer.finalize();\n }\n this._geometries = {};\n this._dtxBuckets = {};\n this._textures = {};\n this._textureSets = {};\n this._dtxLayers = {};\n this._vboInstancingLayers = {};\n this._vboBatchingLayers = {};\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n const entity = this._entityList[i];\n entity._finalize();\n }\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n const entity = this._entityList[i];\n entity._finalize2();\n }\n // Sort layers to reduce WebGL shader switching when rendering them\n this.layerList.sort((a, b) => {\n if (a.sortId < b.sortId) {\n return -1;\n }\n if (a.sortId > b.sortId) {\n return 1;\n }\n return 0;\n });\n for (let i = 0, len = this.layerList.length; i < len; i++) {\n const layer = this.layerList[i];\n layer.layerIndex = i;\n }\n this.glRedraw();\n this.scene._aabbDirty = true;\n this._viewMatrixDirty = true;\n this._matrixDirty = true;\n this._aabbDirty = true;\n\n this._setWorldMatrixDirty();\n this._sceneModelDirty();\n\n this.position = this._position;\n }\n\n /** @private */\n stateSortCompare(drawable1, drawable2) {\n }\n\n /** @private */\n rebuildRenderFlags() {\n this.renderFlags.reset();\n this._updateRenderFlagsVisibleLayers();\n if (this.renderFlags.numLayers > 0 && this.renderFlags.numVisibleLayers === 0) {\n this.renderFlags.culled = true;\n return;\n }\n this._updateRenderFlags();\n }\n\n /**\n * @private\n */\n _updateRenderFlagsVisibleLayers() {\n const renderFlags = this.renderFlags;\n renderFlags.numLayers = this.layerList.length;\n renderFlags.numVisibleLayers = 0;\n for (let layerIndex = 0, len = this.layerList.length; layerIndex < len; layerIndex++) {\n const layer = this.layerList[layerIndex];\n const layerVisible = this._getActiveSectionPlanesForLayer(layer);\n if (layerVisible) {\n renderFlags.visibleLayers[renderFlags.numVisibleLayers++] = layerIndex;\n }\n }\n }\n\n /** @private */\n _createDummyEntityForUnusedMeshes() {\n const unusedMeshIds = Object.keys(this._unusedMeshes);\n if (unusedMeshIds.length > 0) {\n const entityId = `${this.id}-dummyEntityForUnusedMeshes`;\n this.warn(`Creating dummy SceneModelEntity \"${entityId}\" for unused SceneMeshes: [${unusedMeshIds.join(\",\")}]`)\n this.createEntity({\n id: entityId,\n meshIds: unusedMeshIds,\n isObject: true\n });\n }\n this._unusedMeshes = {};\n }\n\n _getActiveSectionPlanesForLayer(layer) {\n const renderFlags = this.renderFlags;\n const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;\n const numSectionPlanes = sectionPlanes.length;\n const baseIndex = layer.layerIndex * numSectionPlanes;\n if (numSectionPlanes > 0) {\n for (let i = 0; i < numSectionPlanes; i++) {\n const sectionPlane = sectionPlanes[i];\n if (!sectionPlane.active) {\n renderFlags.sectionPlanesActivePerLayer[baseIndex + i] = false;\n } else {\n renderFlags.sectionPlanesActivePerLayer[baseIndex + i] = true;\n renderFlags.sectioned = true;\n }\n }\n }\n return true;\n }\n\n _updateRenderFlags() {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n if (this.numCulledLayerPortions === this.numPortions) {\n return;\n }\n const renderFlags = this.renderFlags;\n renderFlags.colorOpaque = (this.numTransparentLayerPortions < this.numPortions);\n if (this.numTransparentLayerPortions > 0) {\n renderFlags.colorTransparent = true;\n }\n if (this.numXRayedLayerPortions > 0) {\n const xrayMaterial = this.scene.xrayMaterial._state;\n if (xrayMaterial.fill) {\n if (xrayMaterial.fillAlpha < 1.0) {\n renderFlags.xrayedSilhouetteTransparent = true;\n } else {\n renderFlags.xrayedSilhouetteOpaque = true;\n }\n }\n if (xrayMaterial.edges) {\n if (xrayMaterial.edgeAlpha < 1.0) {\n renderFlags.xrayedEdgesTransparent = true;\n } else {\n renderFlags.xrayedEdgesOpaque = true;\n }\n }\n }\n if (this.numEdgesLayerPortions > 0) {\n const edgeMaterial = this.scene.edgeMaterial._state;\n if (edgeMaterial.edges) {\n renderFlags.edgesOpaque = (this.numTransparentLayerPortions < this.numPortions);\n if (this.numTransparentLayerPortions > 0) {\n renderFlags.edgesTransparent = true;\n }\n }\n }\n if (this.numSelectedLayerPortions > 0) {\n const selectedMaterial = this.scene.selectedMaterial._state;\n if (selectedMaterial.fill) {\n if (selectedMaterial.fillAlpha < 1.0) {\n renderFlags.selectedSilhouetteTransparent = true;\n } else {\n renderFlags.selectedSilhouetteOpaque = true;\n }\n }\n if (selectedMaterial.edges) {\n if (selectedMaterial.edgeAlpha < 1.0) {\n renderFlags.selectedEdgesTransparent = true;\n } else {\n renderFlags.selectedEdgesOpaque = true;\n }\n }\n }\n if (this.numHighlightedLayerPortions > 0) {\n const highlightMaterial = this.scene.highlightMaterial._state;\n if (highlightMaterial.fill) {\n if (highlightMaterial.fillAlpha < 1.0) {\n renderFlags.highlightedSilhouetteTransparent = true;\n } else {\n renderFlags.highlightedSilhouetteOpaque = true;\n }\n }\n if (highlightMaterial.edges) {\n if (highlightMaterial.edgeAlpha < 1.0) {\n renderFlags.highlightedEdgesTransparent = true;\n } else {\n renderFlags.highlightedEdgesOpaque = true;\n }\n }\n }\n }\n\n // -------------- RENDERING ---------------------------------------------------------------------------------------\n\n /** @private */\n drawColorOpaque(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawColorOpaque(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawColorTransparent(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawColorTransparent(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawDepth(frameCtx) { // Dedicated to SAO because it skips transparent objects\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawDepth(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawNormals(frameCtx) { // Dedicated to SAO because it skips transparent objects\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawNormals(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawSilhouetteXRayed(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawSilhouetteXRayed(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawSilhouetteHighlighted(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawSilhouetteHighlighted(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawSilhouetteSelected(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawSilhouetteSelected(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawEdgesColorOpaque(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawEdgesColorOpaque(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawEdgesColorTransparent(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawEdgesColorTransparent(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawEdgesXRayed(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawEdgesXRayed(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawEdgesHighlighted(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawEdgesHighlighted(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n drawEdgesSelected(frameCtx) {\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawEdgesSelected(renderFlags, frameCtx);\n }\n }\n\n /**\n * @private\n */\n drawOcclusion(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawOcclusion(renderFlags, frameCtx);\n }\n }\n\n /**\n * @private\n */\n drawShadow(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawShadow(renderFlags, frameCtx);\n }\n }\n\n /** @private */\n setPickMatrices(pickViewMatrix, pickProjMatrix) {\n if (this._numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n const layer = this.layerList[layerIndex];\n if (layer.setPickMatrices) {\n layer.setPickMatrices(pickViewMatrix, pickProjMatrix);\n }\n }\n }\n\n /** @private */\n drawPickMesh(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawPickMesh(renderFlags, frameCtx);\n }\n }\n\n /**\n * Called by SceneModelMesh.drawPickDepths()\n * @private\n */\n drawPickDepths(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawPickDepths(renderFlags, frameCtx);\n }\n }\n\n /**\n * Called by SceneModelMesh.drawPickNormals()\n * @private\n */\n drawPickNormals(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n this.layerList[layerIndex].drawPickNormals(renderFlags, frameCtx);\n }\n }\n\n /**\n * @private\n */\n drawSnapInit(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n const layer = this.layerList[layerIndex];\n if (layer.drawSnapInit) {\n frameCtx.snapPickOrigin = [0, 0, 0];\n frameCtx.snapPickCoordinateScale = [1, 1, 1];\n frameCtx.snapPickLayerNumber++;\n layer.drawSnapInit(renderFlags, frameCtx);\n frameCtx.snapPickLayerParams[frameCtx.snapPickLayerNumber] = {\n origin: frameCtx.snapPickOrigin.slice(),\n coordinateScale: frameCtx.snapPickCoordinateScale.slice(),\n };\n }\n }\n }\n\n /**\n * @private\n */\n drawSnap(frameCtx) {\n if (this.numVisibleLayerPortions === 0) {\n return;\n }\n const renderFlags = this.renderFlags;\n for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {\n const layerIndex = renderFlags.visibleLayers[i];\n const layer = this.layerList[layerIndex];\n if (layer.drawSnap) {\n frameCtx.snapPickOrigin = [0, 0, 0];\n frameCtx.snapPickCoordinateScale = [1, 1, 1];\n frameCtx.snapPickLayerNumber++;\n layer.drawSnap(renderFlags, frameCtx);\n frameCtx.snapPickLayerParams[frameCtx.snapPickLayerNumber] = {\n origin: frameCtx.snapPickOrigin.slice(),\n coordinateScale: frameCtx.snapPickCoordinateScale.slice(),\n };\n }\n }\n }\n\n /**\n * Destroys this SceneModel.\n */\n destroy() {\n for (let layerId in this._vboBatchingLayers) {\n if (this._vboBatchingLayers.hasOwnProperty(layerId)) {\n this._vboBatchingLayers[layerId].destroy();\n }\n }\n this._vboBatchingLayers = {};\n for (let layerId in this._vboInstancingLayers) {\n if (this._vboInstancingLayers.hasOwnProperty(layerId)) {\n this._vboInstancingLayers[layerId].destroy();\n }\n }\n this._vboInstancingLayers = {};\n this.scene.camera.off(this._onCameraViewMatrix);\n this.scene.off(this._onTick);\n for (let i = 0, len = this.layerList.length; i < len; i++) {\n this.layerList[i].destroy();\n }\n this.layerList = [];\n for (let i = 0, len = this._entityList.length; i < len; i++) {\n this._entityList[i]._destroy();\n }\n // Object.entries(this._geometries).forEach(([id, geometry]) => {\n // geometry.destroy();\n // });\n this._geometries = {};\n this._dtxBuckets = {};\n this._textures = {};\n this._textureSets = {};\n this._meshes = {};\n this._entities = {};\n this.scene._aabbDirty = true;\n if (this._isModel) {\n this.scene._deregisterModel(this);\n }\n putScratchMemory();\n super.destroy();\n }\n}\n\n\n/**\n * This function applies two steps to the provided mesh geometry data:\n *\n * - 1st, it reduces its `.positions` to unique positions, thus removing duplicate vertices. It will adjust the `.indices` and `.edgeIndices` array accordingly to the unique `.positions`.\n *\n * - 2nd, it tries to do an optimization called `index rebucketting`\n *\n * _Rebucketting minimizes the amount of RAM usage for a given mesh geometry by trying do demote its needed index bitness._\n *\n * - _for 32 bit indices, will try to demote them to 16 bit indices_\n * - _for 16 bit indices, will try to demote them to 8 bits indices_\n * - _8 bits indices are kept as-is_\n *\n * The fact that 32/16/8 bits are needed for indices, depends on the number of maximumm indexable vertices within the mesh geometry: this is, the number of vertices in the mesh geometry.\n *\n * The function returns the same provided input `geometry`, enrichened with the additional key `.preparedBukets`.\n *\n * @param {object} geometry The mesh information containing `.positions`, `.indices`, `.edgeIndices` arrays.\n *\n * @param enableVertexWelding\n * @param enableIndexBucketing\n * @returns {object} The mesh information enrichened with `.buckets` key.\n */\nfunction createDTXBuckets(geometry, enableVertexWelding, enableIndexBucketing) {\n let uniquePositionsCompressed, uniqueIndices, uniqueEdgeIndices;\n if (enableVertexWelding || enableIndexBucketing) { // Expensive - careful!\n [\n uniquePositionsCompressed,\n uniqueIndices,\n uniqueEdgeIndices,\n ] = uniquifyPositions({\n positionsCompressed: geometry.positionsCompressed,\n indices: geometry.indices,\n edgeIndices: geometry.edgeIndices\n });\n } else {\n uniquePositionsCompressed = geometry.positionsCompressed;\n uniqueIndices = geometry.indices;\n uniqueEdgeIndices = geometry.edgeIndices;\n }\n let buckets;\n if (enableIndexBucketing) {\n let numUniquePositions = uniquePositionsCompressed.length / 3;\n buckets = rebucketPositions({\n positionsCompressed: uniquePositionsCompressed,\n indices: uniqueIndices,\n edgeIndices: uniqueEdgeIndices,\n },\n (numUniquePositions > (1 << 16)) ? 16 : 8,\n // true\n );\n } else {\n buckets = [{\n positionsCompressed: uniquePositionsCompressed,\n indices: uniqueIndices,\n edgeIndices: uniqueEdgeIndices,\n }];\n }\n return buckets;\n}\n\nfunction\n\ncreateGeometryOBB(geometry) {\n geometry.obb = math.OBB3();\n if (geometry.positionsCompressed && geometry.positionsCompressed.length > 0) {\n const localAABB = math.collapseAABB3();\n math.expandAABB3Points3(localAABB, geometry.positionsCompressed);\n geometryCompressionUtils.decompressAABB(localAABB, geometry.positionsDecodeMatrix);\n math.AABB3ToOBB3(localAABB, geometry.obb);\n } else if (geometry.positions && geometry.positions.length > 0) {\n const localAABB = math.collapseAABB3();\n math.expandAABB3Points3(localAABB, geometry.positions);\n math.AABB3ToOBB3(localAABB, geometry.obb);\n } else if (geometry.buckets) {\n const localAABB = math.collapseAABB3();\n for (let i = 0, len = geometry.buckets.length; i < len; i++) {\n const bucket = geometry.buckets[i];\n math.expandAABB3Points3(localAABB, bucket.positionsCompressed);\n }\n geometryCompressionUtils.decompressAABB(localAABB, geometry.positionsDecodeMatrix);\n math.AABB3ToOBB3(localAABB, geometry.obb);\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModel.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModel.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 4834, + "__docId__": 4842, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97055,7 +97271,7 @@ "ignore": true }, { - "__docId__": 4835, + "__docId__": 4843, "kind": "variable", "name": "tempOBB3", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97076,7 +97292,7 @@ "ignore": true }, { - "__docId__": 4836, + "__docId__": 4844, "kind": "variable", "name": "DEFAULT_SCALE", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97097,7 +97313,7 @@ "ignore": true }, { - "__docId__": 4837, + "__docId__": 4845, "kind": "variable", "name": "DEFAULT_POSITION", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97118,7 +97334,7 @@ "ignore": true }, { - "__docId__": 4838, + "__docId__": 4846, "kind": "variable", "name": "DEFAULT_ROTATION", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97139,7 +97355,7 @@ "ignore": true }, { - "__docId__": 4839, + "__docId__": 4847, "kind": "variable", "name": "DEFAULT_QUATERNION", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97160,7 +97376,7 @@ "ignore": true }, { - "__docId__": 4840, + "__docId__": 4848, "kind": "variable", "name": "DEFAULT_MATRIX", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97181,7 +97397,7 @@ "ignore": true }, { - "__docId__": 4841, + "__docId__": 4849, "kind": "variable", "name": "DEFAULT_COLOR_TEXTURE_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97202,7 +97418,7 @@ "ignore": true }, { - "__docId__": 4842, + "__docId__": 4850, "kind": "variable", "name": "DEFAULT_METAL_ROUGH_TEXTURE_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97223,7 +97439,7 @@ "ignore": true }, { - "__docId__": 4843, + "__docId__": 4851, "kind": "variable", "name": "DEFAULT_NORMALS_TEXTURE_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97244,7 +97460,7 @@ "ignore": true }, { - "__docId__": 4844, + "__docId__": 4852, "kind": "variable", "name": "DEFAULT_EMISSIVE_TEXTURE_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97265,7 +97481,7 @@ "ignore": true }, { - "__docId__": 4845, + "__docId__": 4853, "kind": "variable", "name": "DEFAULT_OCCLUSION_TEXTURE_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97286,7 +97502,7 @@ "ignore": true }, { - "__docId__": 4846, + "__docId__": 4854, "kind": "variable", "name": "DEFAULT_TEXTURE_SET_ID", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97307,7 +97523,7 @@ "ignore": true }, { - "__docId__": 4847, + "__docId__": 4855, "kind": "variable", "name": "defaultCompressedColor", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97328,7 +97544,7 @@ "ignore": true }, { - "__docId__": 4848, + "__docId__": 4856, "kind": "variable", "name": "VBO_INSTANCED", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97349,7 +97565,7 @@ "ignore": true }, { - "__docId__": 4849, + "__docId__": 4857, "kind": "variable", "name": "VBO_BATCHED", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97370,7 +97586,7 @@ "ignore": true }, { - "__docId__": 4850, + "__docId__": 4858, "kind": "variable", "name": "DTX", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97391,7 +97607,7 @@ "ignore": true }, { - "__docId__": 4851, + "__docId__": 4859, "kind": "class", "name": "SceneModel", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -97412,7 +97628,7 @@ ] }, { - "__docId__": 4852, + "__docId__": 4860, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97779,7 +97995,7 @@ ] }, { - "__docId__": 4853, + "__docId__": 4861, "kind": "member", "name": "_dtxEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97797,7 +98013,7 @@ } }, { - "__docId__": 4854, + "__docId__": 4862, "kind": "member", "name": "_enableVertexWelding", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97815,7 +98031,7 @@ } }, { - "__docId__": 4855, + "__docId__": 4863, "kind": "member", "name": "_enableIndexBucketing", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97833,7 +98049,7 @@ } }, { - "__docId__": 4856, + "__docId__": 4864, "kind": "member", "name": "_vboBatchingLayerScratchMemory", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97851,7 +98067,7 @@ } }, { - "__docId__": 4857, + "__docId__": 4865, "kind": "member", "name": "_textureTranscoder", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97869,7 +98085,7 @@ } }, { - "__docId__": 4858, + "__docId__": 4866, "kind": "member", "name": "_maxGeometryBatchSize", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97887,7 +98103,7 @@ } }, { - "__docId__": 4859, + "__docId__": 4867, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97905,7 +98121,7 @@ } }, { - "__docId__": 4860, + "__docId__": 4868, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97923,7 +98139,7 @@ } }, { - "__docId__": 4861, + "__docId__": 4869, "kind": "member", "name": "_quantizationRanges", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97941,7 +98157,7 @@ } }, { - "__docId__": 4862, + "__docId__": 4870, "kind": "member", "name": "_vboInstancingLayers", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97959,7 +98175,7 @@ } }, { - "__docId__": 4863, + "__docId__": 4871, "kind": "member", "name": "_vboBatchingLayers", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97977,7 +98193,7 @@ } }, { - "__docId__": 4864, + "__docId__": 4872, "kind": "member", "name": "_dtxLayers", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -97995,7 +98211,7 @@ } }, { - "__docId__": 4865, + "__docId__": 4873, "kind": "member", "name": "_meshList", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98013,7 +98229,7 @@ } }, { - "__docId__": 4866, + "__docId__": 4874, "kind": "member", "name": "layerList", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98030,7 +98246,7 @@ } }, { - "__docId__": 4867, + "__docId__": 4875, "kind": "member", "name": "_entityList", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98048,7 +98264,7 @@ } }, { - "__docId__": 4868, + "__docId__": 4876, "kind": "member", "name": "_geometries", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98066,7 +98282,7 @@ } }, { - "__docId__": 4869, + "__docId__": 4877, "kind": "member", "name": "_dtxBuckets", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98084,7 +98300,7 @@ } }, { - "__docId__": 4870, + "__docId__": 4878, "kind": "member", "name": "_textures", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98102,7 +98318,7 @@ } }, { - "__docId__": 4871, + "__docId__": 4879, "kind": "member", "name": "_textureSets", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98120,7 +98336,7 @@ } }, { - "__docId__": 4872, + "__docId__": 4880, "kind": "member", "name": "_transforms", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98138,7 +98354,7 @@ } }, { - "__docId__": 4873, + "__docId__": 4881, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98156,7 +98372,7 @@ } }, { - "__docId__": 4874, + "__docId__": 4882, "kind": "member", "name": "_unusedMeshes", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98174,7 +98390,7 @@ } }, { - "__docId__": 4875, + "__docId__": 4883, "kind": "member", "name": "_entities", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98192,7 +98408,7 @@ } }, { - "__docId__": 4876, + "__docId__": 4884, "kind": "member", "name": "renderFlags", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98209,7 +98425,7 @@ } }, { - "__docId__": 4877, + "__docId__": 4885, "kind": "member", "name": "numGeometries", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98226,7 +98442,7 @@ } }, { - "__docId__": 4878, + "__docId__": 4886, "kind": "member", "name": "numPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98243,7 +98459,7 @@ } }, { - "__docId__": 4879, + "__docId__": 4887, "kind": "member", "name": "numVisibleLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98260,7 +98476,7 @@ } }, { - "__docId__": 4880, + "__docId__": 4888, "kind": "member", "name": "numTransparentLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98277,7 +98493,7 @@ } }, { - "__docId__": 4881, + "__docId__": 4889, "kind": "member", "name": "numXRayedLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98294,7 +98510,7 @@ } }, { - "__docId__": 4882, + "__docId__": 4890, "kind": "member", "name": "numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98311,7 +98527,7 @@ } }, { - "__docId__": 4883, + "__docId__": 4891, "kind": "member", "name": "numSelectedLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98328,7 +98544,7 @@ } }, { - "__docId__": 4884, + "__docId__": 4892, "kind": "member", "name": "numEdgesLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98345,7 +98561,7 @@ } }, { - "__docId__": 4885, + "__docId__": 4893, "kind": "member", "name": "numPickableLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98362,7 +98578,7 @@ } }, { - "__docId__": 4886, + "__docId__": 4894, "kind": "member", "name": "numClippableLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98379,7 +98595,7 @@ } }, { - "__docId__": 4887, + "__docId__": 4895, "kind": "member", "name": "numCulledLayerPortions", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98396,7 +98612,7 @@ } }, { - "__docId__": 4888, + "__docId__": 4896, "kind": "member", "name": "numEntities", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98413,7 +98629,7 @@ } }, { - "__docId__": 4889, + "__docId__": 4897, "kind": "member", "name": "_numTriangles", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98431,7 +98647,7 @@ } }, { - "__docId__": 4890, + "__docId__": 4898, "kind": "member", "name": "_numLines", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98449,7 +98665,7 @@ } }, { - "__docId__": 4891, + "__docId__": 4899, "kind": "member", "name": "_numPoints", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98467,7 +98683,7 @@ } }, { - "__docId__": 4892, + "__docId__": 4900, "kind": "member", "name": "_edgeThreshold", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98485,7 +98701,7 @@ } }, { - "__docId__": 4893, + "__docId__": 4901, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98503,7 +98719,7 @@ } }, { - "__docId__": 4894, + "__docId__": 4902, "kind": "member", "name": "_position", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98521,7 +98737,7 @@ } }, { - "__docId__": 4895, + "__docId__": 4903, "kind": "member", "name": "_rotation", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98539,7 +98755,7 @@ } }, { - "__docId__": 4896, + "__docId__": 4904, "kind": "member", "name": "_quaternion", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98557,7 +98773,7 @@ } }, { - "__docId__": 4897, + "__docId__": 4905, "kind": "member", "name": "_conjugateQuaternion", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98575,7 +98791,7 @@ } }, { - "__docId__": 4898, + "__docId__": 4906, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98593,7 +98809,7 @@ } }, { - "__docId__": 4899, + "__docId__": 4907, "kind": "member", "name": "_worldRotationMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98611,7 +98827,7 @@ } }, { - "__docId__": 4900, + "__docId__": 4908, "kind": "member", "name": "_worldRotationMatrixConjugate", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98629,7 +98845,7 @@ } }, { - "__docId__": 4901, + "__docId__": 4909, "kind": "member", "name": "_matrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98647,7 +98863,7 @@ } }, { - "__docId__": 4902, + "__docId__": 4910, "kind": "member", "name": "_matrixDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98665,7 +98881,7 @@ } }, { - "__docId__": 4903, + "__docId__": 4911, "kind": "member", "name": "_worldNormalMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98683,7 +98899,7 @@ } }, { - "__docId__": 4904, + "__docId__": 4912, "kind": "member", "name": "_viewMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98701,7 +98917,7 @@ } }, { - "__docId__": 4905, + "__docId__": 4913, "kind": "member", "name": "_viewNormalMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98719,7 +98935,7 @@ } }, { - "__docId__": 4906, + "__docId__": 4914, "kind": "member", "name": "_viewMatrixDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98737,7 +98953,7 @@ } }, { - "__docId__": 4907, + "__docId__": 4915, "kind": "member", "name": "_matrixNonIdentity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98755,7 +98971,7 @@ } }, { - "__docId__": 4908, + "__docId__": 4916, "kind": "member", "name": "_opacity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98773,7 +98989,7 @@ } }, { - "__docId__": 4909, + "__docId__": 4917, "kind": "member", "name": "_colorize", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98791,7 +99007,7 @@ } }, { - "__docId__": 4910, + "__docId__": 4918, "kind": "member", "name": "_saoEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98809,7 +99025,7 @@ } }, { - "__docId__": 4911, + "__docId__": 4919, "kind": "member", "name": "_pbrEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98827,7 +99043,7 @@ } }, { - "__docId__": 4912, + "__docId__": 4920, "kind": "member", "name": "_colorTextureEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98845,7 +99061,7 @@ } }, { - "__docId__": 4913, + "__docId__": 4921, "kind": "member", "name": "_isModel", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98863,7 +99079,7 @@ } }, { - "__docId__": 4914, + "__docId__": 4922, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98881,7 +99097,7 @@ } }, { - "__docId__": 4916, + "__docId__": 4924, "kind": "member", "name": "_meshesWithDirtyMatrices", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98899,7 +99115,7 @@ } }, { - "__docId__": 4917, + "__docId__": 4925, "kind": "member", "name": "_numMeshesWithDirtyMatrices", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98917,7 +99133,7 @@ } }, { - "__docId__": 4918, + "__docId__": 4926, "kind": "member", "name": "_onTick", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98935,7 +99151,7 @@ } }, { - "__docId__": 4933, + "__docId__": 4941, "kind": "method", "name": "_meshMatrixDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98959,7 +99175,7 @@ "return": null }, { - "__docId__": 4934, + "__docId__": 4942, "kind": "method", "name": "_createDefaultTextureSet", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98976,7 +99192,7 @@ "return": null }, { - "__docId__": 4935, + "__docId__": 4943, "kind": "get", "name": "isPerformanceModel", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -98997,7 +99213,7 @@ } }, { - "__docId__": 4936, + "__docId__": 4944, "kind": "get", "name": "transforms", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99030,7 +99246,7 @@ } }, { - "__docId__": 4937, + "__docId__": 4945, "kind": "get", "name": "textures", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99063,7 +99279,7 @@ } }, { - "__docId__": 4938, + "__docId__": 4946, "kind": "get", "name": "textureSets", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99096,7 +99312,7 @@ } }, { - "__docId__": 4939, + "__docId__": 4947, "kind": "get", "name": "meshes", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99129,7 +99345,7 @@ } }, { - "__docId__": 4940, + "__docId__": 4948, "kind": "get", "name": "objects", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99162,7 +99378,7 @@ } }, { - "__docId__": 4941, + "__docId__": 4949, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99183,7 +99399,7 @@ } }, { - "__docId__": 4942, + "__docId__": 4950, "kind": "set", "name": "position", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99204,7 +99420,7 @@ } }, { - "__docId__": 4943, + "__docId__": 4951, "kind": "get", "name": "position", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99225,7 +99441,7 @@ } }, { - "__docId__": 4944, + "__docId__": 4952, "kind": "set", "name": "rotation", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99246,7 +99462,7 @@ } }, { - "__docId__": 4945, + "__docId__": 4953, "kind": "get", "name": "rotation", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99267,7 +99483,7 @@ } }, { - "__docId__": 4946, + "__docId__": 4954, "kind": "set", "name": "quaternion", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99288,7 +99504,7 @@ } }, { - "__docId__": 4947, + "__docId__": 4955, "kind": "get", "name": "quaternion", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99309,7 +99525,7 @@ } }, { - "__docId__": 4948, + "__docId__": 4956, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99331,7 +99547,7 @@ } }, { - "__docId__": 4949, + "__docId__": 4957, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99353,7 +99569,7 @@ } }, { - "__docId__": 4950, + "__docId__": 4958, "kind": "set", "name": "matrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99374,7 +99590,7 @@ } }, { - "__docId__": 4952, + "__docId__": 4960, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99395,7 +99611,7 @@ } }, { - "__docId__": 4953, + "__docId__": 4961, "kind": "get", "name": "rotationMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99416,7 +99632,7 @@ } }, { - "__docId__": 4954, + "__docId__": 4962, "kind": "method", "name": "_rebuildMatrices", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99433,7 +99649,7 @@ "return": null }, { - "__docId__": 4956, + "__docId__": 4964, "kind": "get", "name": "rotationMatrixConjugate", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99454,7 +99670,7 @@ } }, { - "__docId__": 4957, + "__docId__": 4965, "kind": "method", "name": "_setWorldMatrixDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99471,7 +99687,7 @@ "return": null }, { - "__docId__": 4960, + "__docId__": 4968, "kind": "method", "name": "_transformDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99488,7 +99704,7 @@ "return": null }, { - "__docId__": 4963, + "__docId__": 4971, "kind": "method", "name": "_sceneModelDirty", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99505,7 +99721,7 @@ "return": null }, { - "__docId__": 4966, + "__docId__": 4974, "kind": "get", "name": "worldMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99538,7 +99754,7 @@ } }, { - "__docId__": 4967, + "__docId__": 4975, "kind": "get", "name": "worldNormalMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99559,7 +99775,7 @@ } }, { - "__docId__": 4968, + "__docId__": 4976, "kind": "get", "name": "viewMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99578,7 +99794,7 @@ } }, { - "__docId__": 4971, + "__docId__": 4979, "kind": "get", "name": "viewNormalMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99597,7 +99813,7 @@ } }, { - "__docId__": 4974, + "__docId__": 4982, "kind": "get", "name": "backfaces", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99618,7 +99834,7 @@ } }, { - "__docId__": 4975, + "__docId__": 4983, "kind": "set", "name": "backfaces", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99639,7 +99855,7 @@ } }, { - "__docId__": 4976, + "__docId__": 4984, "kind": "member", "name": "_backfaces", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99657,7 +99873,7 @@ } }, { - "__docId__": 4977, + "__docId__": 4985, "kind": "get", "name": "entityList", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99689,7 +99905,7 @@ } }, { - "__docId__": 4978, + "__docId__": 4986, "kind": "get", "name": "isEntity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99710,7 +99926,7 @@ } }, { - "__docId__": 4979, + "__docId__": 4987, "kind": "get", "name": "isModel", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99731,7 +99947,7 @@ } }, { - "__docId__": 4980, + "__docId__": 4988, "kind": "get", "name": "isObject", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99752,7 +99968,7 @@ } }, { - "__docId__": 4981, + "__docId__": 4989, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99773,7 +99989,7 @@ } }, { - "__docId__": 4983, + "__docId__": 4991, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99794,7 +100010,7 @@ } }, { - "__docId__": 4984, + "__docId__": 4992, "kind": "get", "name": "numLines", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99815,7 +100031,7 @@ } }, { - "__docId__": 4985, + "__docId__": 4993, "kind": "get", "name": "numPoints", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99836,7 +100052,7 @@ } }, { - "__docId__": 4986, + "__docId__": 4994, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99857,7 +100073,7 @@ } }, { - "__docId__": 4987, + "__docId__": 4995, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99878,7 +100094,7 @@ } }, { - "__docId__": 4988, + "__docId__": 4996, "kind": "member", "name": "_visible", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99896,7 +100112,7 @@ } }, { - "__docId__": 4989, + "__docId__": 4997, "kind": "get", "name": "xrayed", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99917,7 +100133,7 @@ } }, { - "__docId__": 4990, + "__docId__": 4998, "kind": "set", "name": "xrayed", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99938,7 +100154,7 @@ } }, { - "__docId__": 4991, + "__docId__": 4999, "kind": "member", "name": "_xrayed", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99956,7 +100172,7 @@ } }, { - "__docId__": 4992, + "__docId__": 5000, "kind": "get", "name": "highlighted", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99977,7 +100193,7 @@ } }, { - "__docId__": 4993, + "__docId__": 5001, "kind": "set", "name": "highlighted", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -99998,7 +100214,7 @@ } }, { - "__docId__": 4994, + "__docId__": 5002, "kind": "member", "name": "_highlighted", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100016,7 +100232,7 @@ } }, { - "__docId__": 4995, + "__docId__": 5003, "kind": "get", "name": "selected", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100037,7 +100253,7 @@ } }, { - "__docId__": 4996, + "__docId__": 5004, "kind": "set", "name": "selected", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100058,7 +100274,7 @@ } }, { - "__docId__": 4997, + "__docId__": 5005, "kind": "member", "name": "_selected", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100076,7 +100292,7 @@ } }, { - "__docId__": 4998, + "__docId__": 5006, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100097,7 +100313,7 @@ } }, { - "__docId__": 4999, + "__docId__": 5007, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100118,7 +100334,7 @@ } }, { - "__docId__": 5000, + "__docId__": 5008, "kind": "member", "name": "_edges", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100136,7 +100352,7 @@ } }, { - "__docId__": 5001, + "__docId__": 5009, "kind": "get", "name": "culled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100157,7 +100373,7 @@ } }, { - "__docId__": 5002, + "__docId__": 5010, "kind": "set", "name": "culled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100178,7 +100394,7 @@ } }, { - "__docId__": 5003, + "__docId__": 5011, "kind": "member", "name": "_culled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100196,7 +100412,7 @@ } }, { - "__docId__": 5004, + "__docId__": 5012, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100217,7 +100433,7 @@ } }, { - "__docId__": 5005, + "__docId__": 5013, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100238,7 +100454,7 @@ } }, { - "__docId__": 5006, + "__docId__": 5014, "kind": "member", "name": "_clippable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100256,7 +100472,7 @@ } }, { - "__docId__": 5007, + "__docId__": 5015, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100277,7 +100493,7 @@ } }, { - "__docId__": 5008, + "__docId__": 5016, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100298,7 +100514,7 @@ } }, { - "__docId__": 5009, + "__docId__": 5017, "kind": "member", "name": "_collidable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100316,7 +100532,7 @@ } }, { - "__docId__": 5010, + "__docId__": 5018, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100337,7 +100553,7 @@ } }, { - "__docId__": 5011, + "__docId__": 5019, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100358,7 +100574,7 @@ } }, { - "__docId__": 5012, + "__docId__": 5020, "kind": "member", "name": "_pickable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100376,7 +100592,7 @@ } }, { - "__docId__": 5013, + "__docId__": 5021, "kind": "get", "name": "colorize", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100397,7 +100613,7 @@ } }, { - "__docId__": 5014, + "__docId__": 5022, "kind": "set", "name": "colorize", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100418,7 +100634,7 @@ } }, { - "__docId__": 5016, + "__docId__": 5024, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100439,7 +100655,7 @@ } }, { - "__docId__": 5017, + "__docId__": 5025, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100460,7 +100676,7 @@ } }, { - "__docId__": 5019, + "__docId__": 5027, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100481,7 +100697,7 @@ } }, { - "__docId__": 5020, + "__docId__": 5028, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100502,7 +100718,7 @@ } }, { - "__docId__": 5021, + "__docId__": 5029, "kind": "member", "name": "_castsShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100520,7 +100736,7 @@ } }, { - "__docId__": 5022, + "__docId__": 5030, "kind": "get", "name": "receivesShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100541,7 +100757,7 @@ } }, { - "__docId__": 5023, + "__docId__": 5031, "kind": "set", "name": "receivesShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100562,7 +100778,7 @@ } }, { - "__docId__": 5024, + "__docId__": 5032, "kind": "member", "name": "_receivesShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100580,7 +100796,7 @@ } }, { - "__docId__": 5025, + "__docId__": 5033, "kind": "get", "name": "saoEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100601,7 +100817,7 @@ } }, { - "__docId__": 5026, + "__docId__": 5034, "kind": "get", "name": "pbrEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100622,7 +100838,7 @@ } }, { - "__docId__": 5027, + "__docId__": 5035, "kind": "get", "name": "colorTextureEnabled", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100643,7 +100859,7 @@ } }, { - "__docId__": 5028, + "__docId__": 5036, "kind": "get", "name": "isDrawable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100664,7 +100880,7 @@ } }, { - "__docId__": 5029, + "__docId__": 5037, "kind": "get", "name": "isStateSortable", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100683,7 +100899,7 @@ } }, { - "__docId__": 5030, + "__docId__": 5038, "kind": "get", "name": "xrayMaterial", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100704,7 +100920,7 @@ } }, { - "__docId__": 5031, + "__docId__": 5039, "kind": "get", "name": "highlightMaterial", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100725,7 +100941,7 @@ } }, { - "__docId__": 5032, + "__docId__": 5040, "kind": "get", "name": "selectedMaterial", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100746,7 +100962,7 @@ } }, { - "__docId__": 5033, + "__docId__": 5041, "kind": "get", "name": "edgeMaterial", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100767,7 +100983,7 @@ } }, { - "__docId__": 5034, + "__docId__": 5042, "kind": "method", "name": "getPickViewMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100794,7 +101010,7 @@ } }, { - "__docId__": 5035, + "__docId__": 5043, "kind": "method", "name": "createQuantizationRange", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100820,7 +101036,7 @@ "return": null }, { - "__docId__": 5036, + "__docId__": 5044, "kind": "method", "name": "createGeometry", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -100991,7 +101207,7 @@ } }, { - "__docId__": 5038, + "__docId__": 5046, "kind": "method", "name": "createTexture", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101146,7 +101362,7 @@ } }, { - "__docId__": 5039, + "__docId__": 5047, "kind": "method", "name": "createTextureSet", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101246,7 +101462,7 @@ } }, { - "__docId__": 5040, + "__docId__": 5048, "kind": "method", "name": "createTransform", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101382,7 +101598,7 @@ } }, { - "__docId__": 5041, + "__docId__": 5049, "kind": "method", "name": "createMesh", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101733,7 +101949,7 @@ } }, { - "__docId__": 5042, + "__docId__": 5050, "kind": "method", "name": "_createMesh", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101761,7 +101977,7 @@ } }, { - "__docId__": 5043, + "__docId__": 5051, "kind": "method", "name": "_getNumPrimitives", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101789,7 +102005,7 @@ } }, { - "__docId__": 5044, + "__docId__": 5052, "kind": "method", "name": "_getDTXLayer", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101817,7 +102033,7 @@ } }, { - "__docId__": 5045, + "__docId__": 5053, "kind": "method", "name": "_getVBOBatchingLayer", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101845,7 +102061,7 @@ } }, { - "__docId__": 5046, + "__docId__": 5054, "kind": "method", "name": "_createHashStringFromMatrix", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101873,7 +102089,7 @@ } }, { - "__docId__": 5047, + "__docId__": 5055, "kind": "method", "name": "_getVBOInstancingLayer", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -101901,7 +102117,7 @@ } }, { - "__docId__": 5048, + "__docId__": 5056, "kind": "method", "name": "createEntity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102102,7 +102318,7 @@ } }, { - "__docId__": 5049, + "__docId__": 5057, "kind": "method", "name": "_createEntity", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102126,7 +102342,7 @@ "return": null }, { - "__docId__": 5050, + "__docId__": 5058, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102141,7 +102357,7 @@ "return": null }, { - "__docId__": 5062, + "__docId__": 5070, "kind": "method", "name": "stateSortCompare", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102170,7 +102386,7 @@ "return": null }, { - "__docId__": 5063, + "__docId__": 5071, "kind": "method", "name": "rebuildRenderFlags", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102186,7 +102402,7 @@ "return": null }, { - "__docId__": 5064, + "__docId__": 5072, "kind": "method", "name": "_updateRenderFlagsVisibleLayers", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102202,7 +102418,7 @@ "return": null }, { - "__docId__": 5065, + "__docId__": 5073, "kind": "method", "name": "_createDummyEntityForUnusedMeshes", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102218,7 +102434,7 @@ "return": null }, { - "__docId__": 5067, + "__docId__": 5075, "kind": "method", "name": "_getActiveSectionPlanesForLayer", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102246,7 +102462,7 @@ } }, { - "__docId__": 5068, + "__docId__": 5076, "kind": "method", "name": "_updateRenderFlags", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102263,7 +102479,7 @@ "return": null }, { - "__docId__": 5069, + "__docId__": 5077, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102286,7 +102502,7 @@ "return": null }, { - "__docId__": 5070, + "__docId__": 5078, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102309,7 +102525,7 @@ "return": null }, { - "__docId__": 5071, + "__docId__": 5079, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102332,7 +102548,7 @@ "return": null }, { - "__docId__": 5072, + "__docId__": 5080, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102355,7 +102571,7 @@ "return": null }, { - "__docId__": 5073, + "__docId__": 5081, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102378,7 +102594,7 @@ "return": null }, { - "__docId__": 5074, + "__docId__": 5082, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102401,7 +102617,7 @@ "return": null }, { - "__docId__": 5075, + "__docId__": 5083, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102424,7 +102640,7 @@ "return": null }, { - "__docId__": 5076, + "__docId__": 5084, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102447,7 +102663,7 @@ "return": null }, { - "__docId__": 5077, + "__docId__": 5085, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102470,7 +102686,7 @@ "return": null }, { - "__docId__": 5078, + "__docId__": 5086, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102493,7 +102709,7 @@ "return": null }, { - "__docId__": 5079, + "__docId__": 5087, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102516,7 +102732,7 @@ "return": null }, { - "__docId__": 5080, + "__docId__": 5088, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102539,7 +102755,7 @@ "return": null }, { - "__docId__": 5081, + "__docId__": 5089, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102562,7 +102778,7 @@ "return": null }, { - "__docId__": 5082, + "__docId__": 5090, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102585,7 +102801,7 @@ "return": null }, { - "__docId__": 5083, + "__docId__": 5091, "kind": "method", "name": "setPickMatrices", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102614,7 +102830,7 @@ "return": null }, { - "__docId__": 5084, + "__docId__": 5092, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102637,7 +102853,7 @@ "return": null }, { - "__docId__": 5085, + "__docId__": 5093, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102660,7 +102876,7 @@ "return": null }, { - "__docId__": 5086, + "__docId__": 5094, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102683,7 +102899,7 @@ "return": null }, { - "__docId__": 5087, + "__docId__": 5095, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102706,7 +102922,7 @@ "return": null }, { - "__docId__": 5088, + "__docId__": 5096, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102729,7 +102945,7 @@ "return": null }, { - "__docId__": 5089, + "__docId__": 5097, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/SceneModel.js~SceneModel", @@ -102744,7 +102960,7 @@ "return": null }, { - "__docId__": 5099, + "__docId__": 5107, "kind": "function", "name": "createDTXBuckets", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -102807,7 +103023,7 @@ "ignore": true }, { - "__docId__": 5100, + "__docId__": 5108, "kind": "function", "name": "createGeometryOBB", "memberof": "src/viewer/scene/model/SceneModel.js", @@ -102834,18 +103050,18 @@ "ignore": true }, { - "__docId__": 5101, + "__docId__": 5109, "kind": "file", "name": "src/viewer/scene/model/SceneModelEntity.js", "content": "import {ENTITY_FLAGS} from './ENTITY_FLAGS.js';\nimport {math} from \"../math/math.js\";\n\nconst tempFloatRGB = new Float32Array([0, 0, 0]);\nconst tempIntRGB = new Uint16Array([0, 0, 0]);\n\nconst tempOBB3a = math.OBB3();\n\n/**\n * An entity within a {@link SceneModel}\n *\n * * Created with {@link SceneModel#createEntity}\n * * Stored by ID in {@link SceneModel#entities}\n * * Has one or more {@link SceneModelMesh}es\n *\n * @implements {Entity}\n */\nexport class SceneModelEntity {\n\n /**\n * @private\n */\n constructor(model, isObject, id, meshes, flags, lodCullable) {\n\n this._isObject = isObject;\n\n /**\n * The {@link Scene} to which this SceneModelEntity belongs.\n */\n this.scene = model.scene;\n\n /**\n * The {@link SceneModel} to which this SceneModelEntity belongs.\n */\n this.model = model;\n\n /**\n * The {@link SceneModelMesh}es belonging to this SceneModelEntity.\n *\n * * These are created with {@link SceneModel#createMesh} and registered in {@ilnk SceneModel#meshes}\n * * Each SceneModelMesh belongs to one SceneModelEntity\n */\n this.meshes = meshes;\n\n this._numPrimitives = 0;\n\n for (let i = 0, len = this.meshes.length; i < len; i++) { // TODO: tidier way? Refactor?\n const mesh = this.meshes[i];\n mesh.parent = this;\n mesh.entity = this;\n this._numPrimitives += mesh.numPrimitives;\n }\n\n /**\n * The unique ID of this SceneModelEntity.\n */\n this.id = id;\n\n /**\n * The original system ID of this SceneModelEntity.\n */\n this.originalSystemId = math.unglobalizeObjectId(model.id, id);\n\n this._flags = flags;\n this._aabb = math.AABB3();\n this._aabbDirty = true;\n\n this._offset = math.vec3();\n this._colorizeUpdated = false;\n this._opacityUpdated = false;\n\n this._lodCullable = (!!lodCullable);\n this._culled = false;\n this._culledVFC = false;\n this._culledLOD = false;\n\n if (this._isObject) {\n model.scene._registerObject(this);\n }\n }\n\n _transformDirty() {\n this._aabbDirty = true;\n this.model._transformDirty();\n\n }\n\n _sceneModelDirty() { // Called by SceneModel when SceneModel's matrix is updated\n this._aabbDirty = true;\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._sceneModelDirty();\n }\n }\n\n /**\n * World-space 3D axis-aligned bounding box (AABB) of this SceneModelEntity.\n *\n * Represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````.\n *\n * @type {Float64Array}\n */\n get aabb() {\n if (this._aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this.meshes[i].aabb);\n }\n this._aabbDirty = false;\n }\n // if (this._aabbDirty) {\n // math.AABB3ToOBB3(this._aabb, tempOBB3a);\n // math.transformOBB3(this.model.matrix, tempOBB3a);\n // math.OBB3ToAABB3(tempOBB3a, this._worldAABB);\n // this._worldAABB[0] += this._offset[0];\n // this._worldAABB[1] += this._offset[1];\n // this._worldAABB[2] += this._offset[2];\n // this._worldAABB[3] += this._offset[0];\n // this._worldAABB[4] += this._offset[1];\n // this._worldAABB[5] += this._offset[2];\n // this._aabbDirty = false;\n // }\n return this._aabb;\n }\n\n get isEntity() {\n return true;\n }\n\n /**\n * Returns false to indicate that this Entity subtype is not a model.\n * @returns {boolean}\n */\n get isModel() {\n return false;\n }\n\n /**\n * Returns ````true```` if this SceneModelEntity represents an object.\n *\n * When this is ````true````, the SceneModelEntity will be registered by {@link SceneModelEntity#id}\n * in {@link Scene#objects} and may also have a corresponding {@link MetaObject}.\n *\n * @type {Boolean}\n */\n get isObject() {\n return this._isObject;\n }\n\n get numPrimitives() {\n return this._numPrimitives;\n }\n\n /**\n * The approximate number of triangles in this SceneModelEntity.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numPrimitives;\n }\n\n /**\n * Gets if this SceneModelEntity is visible.\n *\n * Only rendered when {@link SceneModelEntity#visible} is ````true````\n * and {@link SceneModelEntity#culled} is ````false````.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#visible} are\n * both ````true```` the SceneModelEntity will be registered\n * by {@link SceneModelEntity#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n get visible() {\n return this._getFlag(ENTITY_FLAGS.VISIBLE);\n }\n\n /**\n * Sets if this SceneModelEntity is visible.\n *\n * Only rendered when {@link SceneModelEntity#visible} is ````true```` and {@link SceneModelEntity#culled} is ````false````.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#visible} are\n * both ````true```` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n set visible(visible) {\n if (!!(this._flags & ENTITY_FLAGS.VISIBLE) === visible) {\n return; // Redundant update\n }\n if (visible) {\n this._flags = this._flags | ENTITY_FLAGS.VISIBLE;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.VISIBLE;\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setVisible(this._flags);\n }\n if (this._isObject) {\n this.model.scene._objectVisibilityUpdated(this);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity is highlighted.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#highlighted} are both ````true```` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n */\n get highlighted() {\n return this._getFlag(ENTITY_FLAGS.HIGHLIGHTED);\n }\n\n /**\n * Sets if this SceneModelEntity is highlighted.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#highlighted} are both ````true```` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n */\n set highlighted(highlighted) {\n if (!!(this._flags & ENTITY_FLAGS.HIGHLIGHTED) === highlighted) {\n return; // Redundant update\n }\n\n if (highlighted) {\n this._flags = this._flags | ENTITY_FLAGS.HIGHLIGHTED;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.HIGHLIGHTED;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setHighlighted(this._flags);\n }\n if (this._isObject) {\n this.model.scene._objectHighlightedUpdated(this);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity is xrayed.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#xrayed} are both ````true``` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n */\n get xrayed() {\n return this._getFlag(ENTITY_FLAGS.XRAYED);\n }\n\n /**\n * Sets if this SceneModelEntity is xrayed.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#xrayed} are both ````true``` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n */\n set xrayed(xrayed) {\n if (!!(this._flags & ENTITY_FLAGS.XRAYED) === xrayed) {\n return; // Redundant update\n }\n if (xrayed) {\n this._flags = this._flags | ENTITY_FLAGS.XRAYED;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.XRAYED;\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setXRayed(this._flags);\n }\n if (this._isObject) {\n this.model.scene._objectXRayedUpdated(this);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity is selected.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#selected} are both ````true``` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n */\n get selected() {\n return this._getFlag(ENTITY_FLAGS.SELECTED);\n }\n\n /**\n * Gets if this SceneModelEntity is selected.\n *\n * When {@link SceneModelEntity#isObject} and {@link SceneModelEntity#selected} are both ````true``` the SceneModelEntity will be\n * registered by {@link SceneModelEntity#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n */\n set selected(selected) {\n if (!!(this._flags & ENTITY_FLAGS.SELECTED) === selected) {\n return; // Redundant update\n }\n if (selected) {\n this._flags = this._flags | ENTITY_FLAGS.SELECTED;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.SELECTED;\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setSelected(this._flags);\n }\n if (this._isObject) {\n this.model.scene._objectSelectedUpdated(this);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity's edges are enhanced.\n *\n * @type {Boolean}\n */\n get edges() {\n return this._getFlag(ENTITY_FLAGS.EDGES);\n }\n\n /**\n * Sets if this SceneModelEntity's edges are enhanced.\n *\n * @type {Boolean}\n */\n set edges(edges) {\n if (!!(this._flags & ENTITY_FLAGS.EDGES) === edges) {\n return; // Redundant update\n }\n if (edges) {\n this._flags = this._flags | ENTITY_FLAGS.EDGES;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.EDGES;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setEdges(this._flags);\n }\n this.model.glRedraw();\n }\n\n\n get culledVFC() {\n return !!(this._culledVFC);\n }\n\n set culledVFC(culled) {\n this._culledVFC = culled;\n this._setCulled();\n }\n\n get culledLOD() {\n return !!(this._culledLOD);\n }\n\n set culledLOD(culled) {\n this._culledLOD = culled;\n this._setCulled();\n }\n\n /**\n * Gets if this SceneModelEntity is culled.\n *\n * Only rendered when {@link SceneModelEntity#visible} is ````true```` and {@link SceneModelEntity#culled} is ````false````.\n *\n * @type {Boolean}\n */\n get culled() {\n return !!(this._culled);\n // return this._getFlag(ENTITY_FLAGS.CULLED);\n }\n\n /**\n * Sets if this SceneModelEntity is culled.\n *\n * Only rendered when {@link SceneModelEntity#visible} is ````true```` and {@link SceneModelEntity#culled} is ````false````.\n *\n * @type {Boolean}\n */\n set culled(culled) {\n this._culled = culled;\n this._setCulled();\n }\n\n _setCulled() {\n let culled = !!(this._culled) || !!(this._culledLOD && this._lodCullable) || !!(this._culledVFC);\n if (!!(this._flags & ENTITY_FLAGS.CULLED) === culled) {\n return; // Redundant update\n }\n if (culled) {\n this._flags = this._flags | ENTITY_FLAGS.CULLED;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.CULLED;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setCulled(this._flags);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._getFlag(ENTITY_FLAGS.CLIPPABLE);\n }\n\n /**\n * Sets if this SceneModelEntity is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.\n *\n * @type {Boolean}\n */\n set clippable(clippable) {\n if ((!!(this._flags & ENTITY_FLAGS.CLIPPABLE)) === clippable) {\n return; // Redundant update\n }\n if (clippable) {\n this._flags = this._flags | ENTITY_FLAGS.CLIPPABLE;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.CLIPPABLE;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setClippable(this._flags);\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets if this SceneModelEntity is included in boundary calculations.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._getFlag(ENTITY_FLAGS.COLLIDABLE);\n }\n\n /**\n * Sets if this SceneModelEntity is included in boundary calculations.\n *\n * @type {Boolean}\n */\n set collidable(collidable) {\n if (!!(this._flags & ENTITY_FLAGS.COLLIDABLE) === collidable) {\n return; // Redundant update\n }\n if (collidable) {\n this._flags = this._flags | ENTITY_FLAGS.COLLIDABLE;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.COLLIDABLE;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setCollidable(this._flags);\n }\n }\n\n /**\n * Gets if this SceneModelEntity is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._getFlag(ENTITY_FLAGS.PICKABLE);\n }\n\n /**\n * Sets if this SceneModelEntity is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n set pickable(pickable) {\n if (!!(this._flags & ENTITY_FLAGS.PICKABLE) === pickable) {\n return; // Redundant update\n }\n if (pickable) {\n this._flags = this._flags | ENTITY_FLAGS.PICKABLE;\n } else {\n this._flags = this._flags & ~ENTITY_FLAGS.PICKABLE;\n }\n for (var i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setPickable(this._flags);\n }\n }\n\n /**\n * Gets the SceneModelEntity's RGB colorize color, multiplies by the SceneModelEntity's rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n get colorize() { // [0..1, 0..1, 0..1]\n if (this.meshes.length === 0) {\n return null;\n }\n const colorize = this.meshes[0]._colorize;\n tempFloatRGB[0] = colorize[0] / 255.0; // Unquantize\n tempFloatRGB[1] = colorize[1] / 255.0;\n tempFloatRGB[2] = colorize[2] / 255.0;\n return tempFloatRGB;\n }\n\n /**\n * Sets the SceneModelEntity's RGB colorize color, multiplies by the SceneModelEntity's rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n set colorize(color) { // [0..1, 0..1, 0..1]\n if (color) {\n tempIntRGB[0] = Math.floor(color[0] * 255.0); // Quantize\n tempIntRGB[1] = Math.floor(color[1] * 255.0);\n tempIntRGB[2] = Math.floor(color[2] * 255.0);\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setColorize(tempIntRGB);\n }\n } else {\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setColorize(null);\n }\n }\n if (this._isObject) {\n const colorized = (!!color);\n this.scene._objectColorizeUpdated(this, colorized);\n this._colorizeUpdated = colorized;\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets the SceneModelEntity's opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n get opacity() {\n if (this.meshes.length > 0) {\n return (this.meshes[0]._colorize[3] / 255.0);\n } else {\n return 1.0;\n }\n }\n\n /**\n * Sets the SceneModelEntity's opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n if (this.meshes.length === 0) {\n return;\n }\n const opacityUpdated = (opacity !== null && opacity !== undefined);\n const lastOpacityQuantized = this.meshes[0]._colorize[3];\n let opacityQuantized = 255;\n if (opacityUpdated) {\n if (opacity < 0) {\n opacity = 0;\n } else if (opacity > 1) {\n opacity = 1;\n }\n opacityQuantized = Math.floor(opacity * 255.0); // Quantize\n if (lastOpacityQuantized === opacityQuantized) {\n return;\n }\n } else {\n opacityQuantized = 255.0;\n if (lastOpacityQuantized === opacityQuantized) {\n return;\n }\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setOpacity(opacityQuantized, this._flags);\n }\n if (this._isObject) {\n this.scene._objectOpacityUpdated(this, opacityUpdated);\n this._opacityUpdated = opacityUpdated;\n }\n this.model.glRedraw();\n }\n\n /**\n * Gets the SceneModelEntity's 3D World-space offset.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get offset() {\n return this._offset;\n }\n\n /**\n * Sets the SceneModelEntity's 3D World-space offset.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set offset(offset) {\n if (offset) {\n this._offset[0] = offset[0];\n this._offset[1] = offset[1];\n this._offset[2] = offset[2];\n } else {\n this._offset[0] = 0;\n this._offset[1] = 0;\n this._offset[2] = 0;\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._setOffset(this._offset);\n }\n this._aabbDirty = true;\n this.model._aabbDirty = true;\n this.scene._aabbDirty = true;\n this.scene._objectOffsetUpdated(this, offset);\n this.model.glRedraw();\n }\n\n get saoEnabled() {\n return this.model.saoEnabled;\n }\n\n getEachVertex(callback) {\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i].getEachVertex(callback)\n }\n }\n\n _getFlag(flag) {\n return !!(this._flags & flag);\n }\n\n _finalize() {\n const scene = this.model.scene;\n if (this._isObject) {\n if (this.visible) {\n scene._objectVisibilityUpdated(this);\n }\n if (this.highlighted) {\n scene._objectHighlightedUpdated(this);\n }\n if (this.xrayed) {\n scene._objectXRayedUpdated(this);\n }\n if (this.selected) {\n scene._objectSelectedUpdated(this);\n }\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._finalize(this._flags);\n }\n }\n\n _finalize2() {\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._finalize2();\n }\n }\n\n _destroy() {\n const scene = this.model.scene;\n if (this._isObject) {\n scene._deregisterObject(this);\n if (this.visible) {\n scene._deRegisterVisibleObject(this);\n }\n if (this.xrayed) {\n scene._deRegisterXRayedObject(this);\n }\n if (this.selected) {\n scene._deRegisterSelectedObject(this);\n }\n if (this.highlighted) {\n scene._deRegisterHighlightedObject(this);\n }\n if (this._colorizeUpdated) {\n this.scene._deRegisterColorizedObject(this);\n }\n if (this._opacityUpdated) {\n this.scene._deRegisterOpacityObject(this);\n }\n if (this._offset && (this._offset[0] !== 0 || this._offset[1] !== 0 || this._offset[2] !== 0)) {\n this.scene._deRegisterOffsetObject(this);\n }\n }\n for (let i = 0, len = this.meshes.length; i < len; i++) {\n this.meshes[i]._destroy();\n }\n scene._aabbDirty = true;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModelEntity.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModelEntity.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5102, + "__docId__": 5110, "kind": "variable", "name": "tempFloatRGB", "memberof": "src/viewer/scene/model/SceneModelEntity.js", @@ -102866,7 +103082,7 @@ "ignore": true }, { - "__docId__": 5103, + "__docId__": 5111, "kind": "variable", "name": "tempIntRGB", "memberof": "src/viewer/scene/model/SceneModelEntity.js", @@ -102887,7 +103103,7 @@ "ignore": true }, { - "__docId__": 5104, + "__docId__": 5112, "kind": "variable", "name": "tempOBB3a", "memberof": "src/viewer/scene/model/SceneModelEntity.js", @@ -102908,7 +103124,7 @@ "ignore": true }, { - "__docId__": 5105, + "__docId__": 5113, "kind": "class", "name": "SceneModelEntity", "memberof": "src/viewer/scene/model/SceneModelEntity.js", @@ -102926,7 +103142,7 @@ ] }, { - "__docId__": 5106, + "__docId__": 5114, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -102940,7 +103156,7 @@ "ignore": true }, { - "__docId__": 5107, + "__docId__": 5115, "kind": "member", "name": "_isObject", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -102958,7 +103174,7 @@ } }, { - "__docId__": 5108, + "__docId__": 5116, "kind": "member", "name": "scene", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -102974,7 +103190,7 @@ } }, { - "__docId__": 5109, + "__docId__": 5117, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -102990,7 +103206,7 @@ } }, { - "__docId__": 5110, + "__docId__": 5118, "kind": "member", "name": "meshes", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103006,7 +103222,7 @@ } }, { - "__docId__": 5111, + "__docId__": 5119, "kind": "member", "name": "_numPrimitives", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103024,7 +103240,7 @@ } }, { - "__docId__": 5113, + "__docId__": 5121, "kind": "member", "name": "id", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103040,7 +103256,7 @@ } }, { - "__docId__": 5114, + "__docId__": 5122, "kind": "member", "name": "originalSystemId", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103056,7 +103272,7 @@ } }, { - "__docId__": 5115, + "__docId__": 5123, "kind": "member", "name": "_flags", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103074,7 +103290,7 @@ } }, { - "__docId__": 5116, + "__docId__": 5124, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103092,7 +103308,7 @@ } }, { - "__docId__": 5117, + "__docId__": 5125, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103110,7 +103326,7 @@ } }, { - "__docId__": 5118, + "__docId__": 5126, "kind": "member", "name": "_offset", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103128,7 +103344,7 @@ } }, { - "__docId__": 5119, + "__docId__": 5127, "kind": "member", "name": "_colorizeUpdated", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103146,7 +103362,7 @@ } }, { - "__docId__": 5120, + "__docId__": 5128, "kind": "member", "name": "_opacityUpdated", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103164,7 +103380,7 @@ } }, { - "__docId__": 5121, + "__docId__": 5129, "kind": "member", "name": "_lodCullable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103182,7 +103398,7 @@ } }, { - "__docId__": 5122, + "__docId__": 5130, "kind": "member", "name": "_culled", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103200,7 +103416,7 @@ } }, { - "__docId__": 5123, + "__docId__": 5131, "kind": "member", "name": "_culledVFC", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103218,7 +103434,7 @@ } }, { - "__docId__": 5124, + "__docId__": 5132, "kind": "member", "name": "_culledLOD", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103236,7 +103452,7 @@ } }, { - "__docId__": 5125, + "__docId__": 5133, "kind": "method", "name": "_transformDirty", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103253,7 +103469,7 @@ "return": null }, { - "__docId__": 5127, + "__docId__": 5135, "kind": "method", "name": "_sceneModelDirty", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103270,7 +103486,7 @@ "return": null }, { - "__docId__": 5129, + "__docId__": 5137, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103291,7 +103507,7 @@ } }, { - "__docId__": 5131, + "__docId__": 5139, "kind": "get", "name": "isEntity", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103310,7 +103526,7 @@ } }, { - "__docId__": 5132, + "__docId__": 5140, "kind": "get", "name": "isModel", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103342,7 +103558,7 @@ } }, { - "__docId__": 5133, + "__docId__": 5141, "kind": "get", "name": "isObject", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103363,7 +103579,7 @@ } }, { - "__docId__": 5134, + "__docId__": 5142, "kind": "get", "name": "numPrimitives", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103382,7 +103598,7 @@ } }, { - "__docId__": 5135, + "__docId__": 5143, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103403,7 +103619,7 @@ } }, { - "__docId__": 5136, + "__docId__": 5144, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103424,7 +103640,7 @@ } }, { - "__docId__": 5137, + "__docId__": 5145, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103445,7 +103661,7 @@ } }, { - "__docId__": 5140, + "__docId__": 5148, "kind": "get", "name": "highlighted", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103466,7 +103682,7 @@ } }, { - "__docId__": 5141, + "__docId__": 5149, "kind": "set", "name": "highlighted", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103487,7 +103703,7 @@ } }, { - "__docId__": 5144, + "__docId__": 5152, "kind": "get", "name": "xrayed", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103508,7 +103724,7 @@ } }, { - "__docId__": 5145, + "__docId__": 5153, "kind": "set", "name": "xrayed", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103529,7 +103745,7 @@ } }, { - "__docId__": 5148, + "__docId__": 5156, "kind": "get", "name": "selected", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103550,7 +103766,7 @@ } }, { - "__docId__": 5149, + "__docId__": 5157, "kind": "set", "name": "selected", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103571,7 +103787,7 @@ } }, { - "__docId__": 5152, + "__docId__": 5160, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103592,7 +103808,7 @@ } }, { - "__docId__": 5153, + "__docId__": 5161, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103613,7 +103829,7 @@ } }, { - "__docId__": 5156, + "__docId__": 5164, "kind": "get", "name": "culledVFC", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103632,7 +103848,7 @@ } }, { - "__docId__": 5157, + "__docId__": 5165, "kind": "set", "name": "culledVFC", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103646,7 +103862,7 @@ "undocument": true }, { - "__docId__": 5159, + "__docId__": 5167, "kind": "get", "name": "culledLOD", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103665,7 +103881,7 @@ } }, { - "__docId__": 5160, + "__docId__": 5168, "kind": "set", "name": "culledLOD", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103679,7 +103895,7 @@ "undocument": true }, { - "__docId__": 5162, + "__docId__": 5170, "kind": "get", "name": "culled", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103700,7 +103916,7 @@ } }, { - "__docId__": 5163, + "__docId__": 5171, "kind": "set", "name": "culled", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103721,7 +103937,7 @@ } }, { - "__docId__": 5165, + "__docId__": 5173, "kind": "method", "name": "_setCulled", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103738,7 +103954,7 @@ "return": null }, { - "__docId__": 5168, + "__docId__": 5176, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103759,7 +103975,7 @@ } }, { - "__docId__": 5169, + "__docId__": 5177, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103780,7 +103996,7 @@ } }, { - "__docId__": 5172, + "__docId__": 5180, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103801,7 +104017,7 @@ } }, { - "__docId__": 5173, + "__docId__": 5181, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103822,7 +104038,7 @@ } }, { - "__docId__": 5176, + "__docId__": 5184, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103843,7 +104059,7 @@ } }, { - "__docId__": 5177, + "__docId__": 5185, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103864,7 +104080,7 @@ } }, { - "__docId__": 5180, + "__docId__": 5188, "kind": "get", "name": "colorize", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103885,7 +104101,7 @@ } }, { - "__docId__": 5181, + "__docId__": 5189, "kind": "set", "name": "colorize", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103906,7 +104122,7 @@ } }, { - "__docId__": 5183, + "__docId__": 5191, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103927,7 +104143,7 @@ } }, { - "__docId__": 5184, + "__docId__": 5192, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103948,7 +104164,7 @@ } }, { - "__docId__": 5186, + "__docId__": 5194, "kind": "get", "name": "offset", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103969,7 +104185,7 @@ } }, { - "__docId__": 5187, + "__docId__": 5195, "kind": "set", "name": "offset", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -103990,7 +104206,7 @@ } }, { - "__docId__": 5189, + "__docId__": 5197, "kind": "get", "name": "saoEnabled", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104009,7 +104225,7 @@ } }, { - "__docId__": 5190, + "__docId__": 5198, "kind": "method", "name": "getEachVertex", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104032,7 +104248,7 @@ "return": null }, { - "__docId__": 5191, + "__docId__": 5199, "kind": "method", "name": "_getFlag", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104060,7 +104276,7 @@ } }, { - "__docId__": 5192, + "__docId__": 5200, "kind": "method", "name": "_finalize", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104077,7 +104293,7 @@ "return": null }, { - "__docId__": 5193, + "__docId__": 5201, "kind": "method", "name": "_finalize2", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104094,7 +104310,7 @@ "return": null }, { - "__docId__": 5194, + "__docId__": 5202, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/SceneModelEntity.js~SceneModelEntity", @@ -104111,18 +104327,18 @@ "return": null }, { - "__docId__": 5195, + "__docId__": 5203, "kind": "file", "name": "src/viewer/scene/model/SceneModelMesh.js", "content": "import {math} from \"../math/math.js\";\n\nconst tempOBB3 = math.OBB3();\nconst tempOBB3b = math.OBB3();\nconst tempOBB3c = math.OBB3();\n\n/**\n * A mesh within a {@link SceneModel}.\n *\n * * Created with {@link SceneModel#createMesh}\n * * Belongs to exactly one {@link SceneModelEntity}\n * * Stored by ID in {@link SceneModel#meshes}\n * * Referenced by {@link SceneModelEntity#meshes}\n * * Can have a {@link SceneModelTransform} to dynamically scale, rotate and translate it.\n */\nexport class SceneModelMesh {\n\n /**\n * @private\n */\n constructor(model, id, color, opacity, transform, textureSet, layer = null, portionId = 0) {\n\n /**\n * The {@link SceneModel} that owns this SceneModelMesh.\n *\n * @type {SceneModel}\n */\n this.model = model;\n\n /**\n * The {@link SceneModelEntity} that owns this SceneModelMesh.\n *\n * @type {SceneModelEntity}\n */\n this.object = null;\n\n /**\n * @private\n */\n this.parent = null;\n\n /**\n * The {@link SceneModelTransform} that transforms this SceneModelMesh.\n *\n * * This only exists when the SceneModelMesh is instancing its geometry.\n * * These are created with {@link SceneModel#createTransform}\n * * Each of these is also registered in {@link SceneModel#transforms}.\n *\n * @type {SceneModelTransform}\n */\n this.transform = transform;\n\n /**\n * The {@link SceneModelTextureSet} that optionally textures this SceneModelMesh.\n *\n * * This only exists when the SceneModelMesh has texture.\n * * These are created with {@link SceneModel#createTextureSet}\n * * Each of these is also registered in {@link SceneModel#textureSets}.\n *\n * @type {SceneModelTextureSet}\n */\n this.textureSet = textureSet;\n\n this._matrixDirty = false;\n this._matrixUpdateScheduled = false;\n\n /**\n * Unique ID of this SceneModelMesh.\n *\n * The SceneModelMesh is registered against this ID in {@link SceneModel#meshes}.\n */\n this.id = id;\n\n /**\n * @private\n */\n this.obb = null;\n\n this._aabbLocal = null;\n this._aabbWorld = math.AABB3();\n this._aabbWorldDirty = false;\n\n /**\n * @private\n */\n this.layer = layer;\n\n /**\n * @private\n */\n this.portionId = portionId;\n\n this._color = new Uint8Array([color[0], color[1], color[2], opacity]); // [0..255]\n this._colorize = new Uint8Array([color[0], color[1], color[2], opacity]); // [0..255]\n this._colorizing = false;\n this._transparent = (opacity < 255);\n\n /**\n * @private\n */\n this.numTriangles = 0;\n\n /**\n * @private\n * @type {null}\n */\n this.origin = null; // Set By SceneModel\n\n /**\n * The {@link SceneModelEntity} that owns this SceneModelMesh.\n *\n * @type {SceneModelEntity}\n */\n this.entity = null;\n\n if (transform) {\n transform._addMesh(this);\n }\n }\n\n _sceneModelDirty() {\n this._aabbWorldDirty = true;\n this.layer.aabbDirty = true;\n }\n\n _transformDirty() {\n if (!this._matrixDirty && !this._matrixUpdateScheduled) {\n this.model._meshMatrixDirty(this);\n this._matrixDirty = true;\n this._matrixUpdateScheduled = true;\n }\n this._aabbWorldDirty = true;\n this.layer.aabbDirty = true;\n if (this.entity) {\n this.entity._transformDirty();\n }\n }\n\n _updateMatrix() {\n if (this.transform && this._matrixDirty) {\n this.layer.setMatrix(this.portionId, this.transform.worldMatrix);\n }\n this._matrixDirty = false;\n this._matrixUpdateScheduled = false;\n }\n\n _finalize(entityFlags) {\n this.layer.initFlags(this.portionId, entityFlags, this._transparent);\n }\n\n _finalize2() {\n if (this.layer.flushInitFlags) {\n this.layer.flushInitFlags();\n }\n }\n\n _setVisible(entityFlags) {\n this.layer.setVisible(this.portionId, entityFlags, this._transparent);\n }\n\n _setColor(color) {\n this._color[0] = color[0];\n this._color[1] = color[1];\n this._color[2] = color[2];\n if (!this._colorizing) {\n this.layer.setColor(this.portionId, this._color, false);\n }\n }\n\n _setColorize(colorize) {\n const setOpacity = false;\n if (colorize) {\n this._colorize[0] = colorize[0];\n this._colorize[1] = colorize[1];\n this._colorize[2] = colorize[2];\n this.layer.setColor(this.portionId, this._colorize, setOpacity);\n this._colorizing = true;\n } else {\n this.layer.setColor(this.portionId, this._color, setOpacity);\n this._colorizing = false;\n }\n }\n\n _setOpacity(opacity, entityFlags) {\n const newTransparent = (opacity < 255);\n const lastTransparent = this._transparent;\n const changingTransparency = (lastTransparent !== newTransparent);\n this._color[3] = opacity;\n this._colorize[3] = opacity;\n this._transparent = newTransparent;\n if (this._colorizing) {\n this.layer.setColor(this.portionId, this._colorize);\n } else {\n this.layer.setColor(this.portionId, this._color);\n }\n if (changingTransparency) {\n this.layer.setTransparent(this.portionId, entityFlags, newTransparent);\n }\n }\n\n _setOffset(offset) {\n this.layer.setOffset(this.portionId, offset);\n }\n\n _setHighlighted(entityFlags) {\n this.layer.setHighlighted(this.portionId, entityFlags, this._transparent);\n }\n\n _setXRayed(entityFlags) {\n this.layer.setXRayed(this.portionId, entityFlags, this._transparent);\n }\n\n _setSelected(entityFlags) {\n this.layer.setSelected(this.portionId, entityFlags, this._transparent);\n }\n\n _setEdges(entityFlags) {\n this.layer.setEdges(this.portionId, entityFlags, this._transparent);\n }\n\n _setClippable(entityFlags) {\n this.layer.setClippable(this.portionId, entityFlags, this._transparent);\n }\n\n _setCollidable(entityFlags) {\n this.layer.setCollidable(this.portionId, entityFlags);\n }\n\n _setPickable(flags) {\n this.layer.setPickable(this.portionId, flags, this._transparent);\n }\n\n _setCulled(flags) {\n this.layer.setCulled(this.portionId, flags, this._transparent);\n }\n\n /**\n * @private\n */\n canPickTriangle() {\n return false;\n }\n\n /**\n * @private\n */\n drawPickTriangles(renderFlags, frameCtx) {\n // NOP\n }\n\n /**\n * @private\n */\n pickTriangleSurface(pickResult) {\n // NOP\n }\n\n /**\n * @private\n */\n precisionRayPickSurface(worldRayOrigin, worldRayDir, worldSurfacePos, worldSurfaceNormal) {\n return this.layer.precisionRayPickSurface ? this.layer.precisionRayPickSurface(this.portionId, worldRayOrigin, worldRayDir, worldSurfacePos, worldSurfaceNormal) : false;\n }\n\n /**\n * @private\n */\n canPickWorldPos() {\n return true;\n }\n\n /**\n * @private\n */\n drawPickDepths(frameCtx) {\n this.model.drawPickDepths(frameCtx);\n }\n\n /**\n * @private\n */\n drawPickNormals(frameCtx) {\n this.model.drawPickNormals(frameCtx);\n }\n\n /**\n * @private\n */\n delegatePickedEntity() {\n return this.parent;\n }\n\n /**\n * @private\n */\n getEachVertex(callback) {\n this.layer.getEachVertex(this.portionId, callback);\n }\n\n /**\n * @private\n */\n set aabb(aabb) { // Called by SceneModel\n this._aabbLocal = aabb;\n }\n\n /**\n * @private\n */\n get aabb() { // called by SceneModelEntity\n if (this._aabbWorldDirty) {\n math.AABB3ToOBB3(this._aabbLocal, tempOBB3);\n if (this.transform) {\n math.transformOBB3(this.transform.worldMatrix, tempOBB3, tempOBB3b);\n math.transformOBB3(this.model.worldMatrix, tempOBB3b, tempOBB3c);\n math.OBB3ToAABB3(tempOBB3c, this._aabbWorld);\n } else {\n math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);\n math.OBB3ToAABB3(tempOBB3b, this._aabbWorld);\n }\n if (this.origin) {\n const origin = this.origin;\n this._aabbWorld[0] += origin[0];\n this._aabbWorld[1] += origin[1];\n this._aabbWorld[2] += origin[2];\n this._aabbWorld[3] += origin[0];\n this._aabbWorld[4] += origin[1];\n this._aabbWorld[5] += origin[2];\n }\n this._aabbWorldDirty = false;\n }\n return this._aabbWorld;\n }\n\n /**\n * @private\n */\n _destroy() {\n this.model.scene._renderer.putPickID(this.pickId);\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModelMesh.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModelMesh.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5196, + "__docId__": 5204, "kind": "variable", "name": "tempOBB3", "memberof": "src/viewer/scene/model/SceneModelMesh.js", @@ -104143,7 +104359,7 @@ "ignore": true }, { - "__docId__": 5197, + "__docId__": 5205, "kind": "variable", "name": "tempOBB3b", "memberof": "src/viewer/scene/model/SceneModelMesh.js", @@ -104164,7 +104380,7 @@ "ignore": true }, { - "__docId__": 5198, + "__docId__": 5206, "kind": "variable", "name": "tempOBB3c", "memberof": "src/viewer/scene/model/SceneModelMesh.js", @@ -104185,7 +104401,7 @@ "ignore": true }, { - "__docId__": 5199, + "__docId__": 5207, "kind": "class", "name": "SceneModelMesh", "memberof": "src/viewer/scene/model/SceneModelMesh.js", @@ -104200,7 +104416,7 @@ "interface": false }, { - "__docId__": 5200, + "__docId__": 5208, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104214,7 +104430,7 @@ "ignore": true }, { - "__docId__": 5201, + "__docId__": 5209, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104233,7 +104449,7 @@ } }, { - "__docId__": 5202, + "__docId__": 5210, "kind": "member", "name": "object", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104252,7 +104468,7 @@ } }, { - "__docId__": 5203, + "__docId__": 5211, "kind": "member", "name": "parent", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104269,7 +104485,7 @@ } }, { - "__docId__": 5204, + "__docId__": 5212, "kind": "member", "name": "transform", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104288,7 +104504,7 @@ } }, { - "__docId__": 5205, + "__docId__": 5213, "kind": "member", "name": "textureSet", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104307,7 +104523,7 @@ } }, { - "__docId__": 5206, + "__docId__": 5214, "kind": "member", "name": "_matrixDirty", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104325,7 +104541,7 @@ } }, { - "__docId__": 5207, + "__docId__": 5215, "kind": "member", "name": "_matrixUpdateScheduled", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104343,7 +104559,7 @@ } }, { - "__docId__": 5208, + "__docId__": 5216, "kind": "member", "name": "id", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104359,7 +104575,7 @@ } }, { - "__docId__": 5209, + "__docId__": 5217, "kind": "member", "name": "obb", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104376,7 +104592,7 @@ } }, { - "__docId__": 5210, + "__docId__": 5218, "kind": "member", "name": "_aabbLocal", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104394,7 +104610,7 @@ } }, { - "__docId__": 5211, + "__docId__": 5219, "kind": "member", "name": "_aabbWorld", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104412,7 +104628,7 @@ } }, { - "__docId__": 5212, + "__docId__": 5220, "kind": "member", "name": "_aabbWorldDirty", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104430,7 +104646,7 @@ } }, { - "__docId__": 5213, + "__docId__": 5221, "kind": "member", "name": "layer", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104447,7 +104663,7 @@ } }, { - "__docId__": 5214, + "__docId__": 5222, "kind": "member", "name": "portionId", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104464,7 +104680,7 @@ } }, { - "__docId__": 5215, + "__docId__": 5223, "kind": "member", "name": "_color", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104482,7 +104698,7 @@ } }, { - "__docId__": 5216, + "__docId__": 5224, "kind": "member", "name": "_colorize", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104500,7 +104716,7 @@ } }, { - "__docId__": 5217, + "__docId__": 5225, "kind": "member", "name": "_colorizing", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104518,7 +104734,7 @@ } }, { - "__docId__": 5218, + "__docId__": 5226, "kind": "member", "name": "_transparent", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104536,7 +104752,7 @@ } }, { - "__docId__": 5219, + "__docId__": 5227, "kind": "member", "name": "numTriangles", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104553,7 +104769,7 @@ } }, { - "__docId__": 5220, + "__docId__": 5228, "kind": "member", "name": "origin", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104573,7 +104789,7 @@ "ignore": true }, { - "__docId__": 5221, + "__docId__": 5229, "kind": "member", "name": "entity", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104592,7 +104808,7 @@ } }, { - "__docId__": 5222, + "__docId__": 5230, "kind": "method", "name": "_sceneModelDirty", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104609,7 +104825,7 @@ "return": null }, { - "__docId__": 5224, + "__docId__": 5232, "kind": "method", "name": "_transformDirty", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104626,7 +104842,7 @@ "return": null }, { - "__docId__": 5228, + "__docId__": 5236, "kind": "method", "name": "_updateMatrix", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104643,7 +104859,7 @@ "return": null }, { - "__docId__": 5231, + "__docId__": 5239, "kind": "method", "name": "_finalize", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104667,7 +104883,7 @@ "return": null }, { - "__docId__": 5232, + "__docId__": 5240, "kind": "method", "name": "_finalize2", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104684,7 +104900,7 @@ "return": null }, { - "__docId__": 5233, + "__docId__": 5241, "kind": "method", "name": "_setVisible", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104708,7 +104924,7 @@ "return": null }, { - "__docId__": 5234, + "__docId__": 5242, "kind": "method", "name": "_setColor", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104732,7 +104948,7 @@ "return": null }, { - "__docId__": 5235, + "__docId__": 5243, "kind": "method", "name": "_setColorize", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104756,7 +104972,7 @@ "return": null }, { - "__docId__": 5238, + "__docId__": 5246, "kind": "method", "name": "_setOpacity", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104786,7 +105002,7 @@ "return": null }, { - "__docId__": 5240, + "__docId__": 5248, "kind": "method", "name": "_setOffset", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104810,7 +105026,7 @@ "return": null }, { - "__docId__": 5241, + "__docId__": 5249, "kind": "method", "name": "_setHighlighted", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104834,7 +105050,7 @@ "return": null }, { - "__docId__": 5242, + "__docId__": 5250, "kind": "method", "name": "_setXRayed", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104858,7 +105074,7 @@ "return": null }, { - "__docId__": 5243, + "__docId__": 5251, "kind": "method", "name": "_setSelected", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104882,7 +105098,7 @@ "return": null }, { - "__docId__": 5244, + "__docId__": 5252, "kind": "method", "name": "_setEdges", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104906,7 +105122,7 @@ "return": null }, { - "__docId__": 5245, + "__docId__": 5253, "kind": "method", "name": "_setClippable", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104930,7 +105146,7 @@ "return": null }, { - "__docId__": 5246, + "__docId__": 5254, "kind": "method", "name": "_setCollidable", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104954,7 +105170,7 @@ "return": null }, { - "__docId__": 5247, + "__docId__": 5255, "kind": "method", "name": "_setPickable", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -104978,7 +105194,7 @@ "return": null }, { - "__docId__": 5248, + "__docId__": 5256, "kind": "method", "name": "_setCulled", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105002,7 +105218,7 @@ "return": null }, { - "__docId__": 5249, + "__docId__": 5257, "kind": "method", "name": "canPickTriangle", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105022,7 +105238,7 @@ } }, { - "__docId__": 5250, + "__docId__": 5258, "kind": "method", "name": "drawPickTriangles", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105051,7 +105267,7 @@ "return": null }, { - "__docId__": 5251, + "__docId__": 5259, "kind": "method", "name": "pickTriangleSurface", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105074,7 +105290,7 @@ "return": null }, { - "__docId__": 5252, + "__docId__": 5260, "kind": "method", "name": "precisionRayPickSurface", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105119,7 +105335,7 @@ } }, { - "__docId__": 5253, + "__docId__": 5261, "kind": "method", "name": "canPickWorldPos", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105139,7 +105355,7 @@ } }, { - "__docId__": 5254, + "__docId__": 5262, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105162,7 +105378,7 @@ "return": null }, { - "__docId__": 5255, + "__docId__": 5263, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105185,7 +105401,7 @@ "return": null }, { - "__docId__": 5256, + "__docId__": 5264, "kind": "method", "name": "delegatePickedEntity", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105205,7 +105421,7 @@ } }, { - "__docId__": 5257, + "__docId__": 5265, "kind": "method", "name": "getEachVertex", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105228,7 +105444,7 @@ "return": null }, { - "__docId__": 5258, + "__docId__": 5266, "kind": "set", "name": "aabb", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105242,7 +105458,7 @@ "ignore": true }, { - "__docId__": 5260, + "__docId__": 5268, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105261,7 +105477,7 @@ } }, { - "__docId__": 5262, + "__docId__": 5270, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/SceneModelMesh.js~SceneModelMesh", @@ -105277,18 +105493,18 @@ "return": null }, { - "__docId__": 5263, + "__docId__": 5271, "kind": "file", "name": "src/viewer/scene/model/SceneModelTexture.js", "content": "/**\n * A texture within a {@link SceneModelTextureSet}.\n *\n * * Created with {@link SceneModel#createTexture}\n * * Belongs to many {@link SceneModelTextureSet}s\n * * Stored by ID in {@link SceneModel#textures}}\n */\nexport class SceneModelTexture {\n\n /**\n * @private\n * @param cfg\n */\n constructor(cfg) {\n\n /**\n * Unique ID of this SceneModelTexture.\n *\n * The SceneModelTexture is registered against this ID in {@link SceneModel#textures}.\n */\n this.id = cfg.id;\n\n /**\n * @private\n */\n this.texture = cfg.texture;\n }\n\n /**\n * @private\n */\n destroy() {\n if (this.texture) {\n this.texture.destroy();\n this.texture = null;\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModelTexture.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModelTexture.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5264, + "__docId__": 5272, "kind": "class", "name": "SceneModelTexture", "memberof": "src/viewer/scene/model/SceneModelTexture.js", @@ -105303,7 +105519,7 @@ "interface": false }, { - "__docId__": 5265, + "__docId__": 5273, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModelTexture.js~SceneModelTexture", @@ -105329,7 +105545,7 @@ "ignore": true }, { - "__docId__": 5266, + "__docId__": 5274, "kind": "member", "name": "id", "memberof": "src/viewer/scene/model/SceneModelTexture.js~SceneModelTexture", @@ -105345,7 +105561,7 @@ } }, { - "__docId__": 5267, + "__docId__": 5275, "kind": "member", "name": "texture", "memberof": "src/viewer/scene/model/SceneModelTexture.js~SceneModelTexture", @@ -105362,7 +105578,7 @@ } }, { - "__docId__": 5268, + "__docId__": 5276, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/SceneModelTexture.js~SceneModelTexture", @@ -105378,18 +105594,18 @@ "return": null }, { - "__docId__": 5270, + "__docId__": 5278, "kind": "file", "name": "src/viewer/scene/model/SceneModelTextureSet.js", "content": "/**\n * A texture set within a {@link SceneModel}.\n *\n * * Created with {@link SceneModel#createTextureSet}\n * * Belongs to many {@link SceneModelMesh}es\n * * Stored by ID in {@link SceneModel#textureSets}\n * * Referenced by {@link SceneModelMesh#textureSet}\n */\nexport class SceneModelTextureSet {\n\n /**\n * @private\n */\n constructor(cfg) {\n\n /**\n * Unique ID of this SceneModelTextureSet.\n *\n * The SceneModelTextureSet is registered against this ID in {@link SceneModel#textureSets}.\n */\n this.id = cfg.id;\n\n /**\n * The color texture.\n * @type {SceneModelTexture|*}\n */\n this.colorTexture = cfg.colorTexture;\n\n /**\n * The metallic-roughness texture.\n * @type {SceneModelTexture|*}\n */\n this.metallicRoughnessTexture = cfg.metallicRoughnessTexture;\n\n /**\n * The normal map texture.\n * @type {SceneModelTexture|*}\n */\n this.normalsTexture = cfg.normalsTexture;\n\n /**\n * The emissive color texture.\n * @type {SceneModelTexture|*}\n */\n this.emissiveTexture = cfg.emissiveTexture;\n\n /**\n * The ambient occlusion texture.\n * @type {SceneModelTexture|*}\n */\n this.occlusionTexture = cfg.occlusionTexture;\n }\n\n /**\n * @private\n */\n destroy() {\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModelTextureSet.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModelTextureSet.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5271, + "__docId__": 5279, "kind": "class", "name": "SceneModelTextureSet", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js", @@ -105404,7 +105620,7 @@ "interface": false }, { - "__docId__": 5272, + "__docId__": 5280, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105418,7 +105634,7 @@ "ignore": true }, { - "__docId__": 5273, + "__docId__": 5281, "kind": "member", "name": "id", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105434,7 +105650,7 @@ } }, { - "__docId__": 5274, + "__docId__": 5282, "kind": "member", "name": "colorTexture", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105454,7 +105670,7 @@ } }, { - "__docId__": 5275, + "__docId__": 5283, "kind": "member", "name": "metallicRoughnessTexture", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105474,7 +105690,7 @@ } }, { - "__docId__": 5276, + "__docId__": 5284, "kind": "member", "name": "normalsTexture", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105494,7 +105710,7 @@ } }, { - "__docId__": 5277, + "__docId__": 5285, "kind": "member", "name": "emissiveTexture", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105514,7 +105730,7 @@ } }, { - "__docId__": 5278, + "__docId__": 5286, "kind": "member", "name": "occlusionTexture", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105534,7 +105750,7 @@ } }, { - "__docId__": 5279, + "__docId__": 5287, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/SceneModelTextureSet.js~SceneModelTextureSet", @@ -105550,18 +105766,18 @@ "return": null }, { - "__docId__": 5280, + "__docId__": 5288, "kind": "file", "name": "src/viewer/scene/model/SceneModelTransform.js", - "content": "import {math} from \"../math/index.js\";\n\nconst angleAxis = math.vec4(4);\nconst q1 = math.vec4();\nconst q2 = math.vec4();\nconst xAxis = math.vec3([1, 0, 0]);\nconst yAxis = math.vec3([0, 1, 0]);\nconst zAxis = math.vec3([0, 0, 1]);\n\nconst veca = math.vec3(3);\nconst vecb = math.vec3(3);\n\nconst identityMat = math.identityMat4();\n\n/**\n * A dynamically-updatable transform within a {@link SceneModel}.\n *\n * * Can be composed into hierarchies\n * * Shared by multiple {@link SceneModelMesh}es\n * * Created with {@link SceneModel#createTransform}\n * * Stored by ID in {@link SceneModel#transforms}\n * * Referenced by {@link SceneModelMesh#transform}\n */\nexport class SceneModelTransform {\n\n /**\n * @private\n */\n constructor(cfg) {\n this._model = cfg.model;\n\n /**\n * Unique ID of this SceneModelTransform.\n *\n * The SceneModelTransform is registered against this ID in {@link SceneModel#transforms}.\n */\n this.id = cfg.id;\n\n this._parentTransform = cfg.parent;\n this._childTransforms = [];\n this._meshes = [];\n this._scale = new Float32Array([1,1,1]);\n this._quaternion = math.identityQuaternion(new Float32Array(4));\n this._rotation = new Float32Array(3);\n this._position = new Float32Array(3);\n this._localMatrix = math.identityMat4(new Float32Array(16));\n this._worldMatrix = math.identityMat4(new Float32Array(16));\n this._localMatrixDirty = true;\n this._worldMatrixDirty = true;\n\n if (cfg.matrix) {\n this.matrix = cfg.matrix;\n } else {\n this.scale = cfg.scale;\n this.position = cfg.position;\n if (cfg.quaternion) {\n } else {\n this.rotation = cfg.rotation;\n }\n }\n if (cfg.parent) {\n cfg.parent._addChildTransform(this);\n }\n }\n\n _addChildTransform(childTransform) {\n this._childTransforms.push(childTransform);\n childTransform._parentTransform = this;\n childTransform._transformDirty();\n childTransform._setAABBDirty();\n }\n\n _addMesh(mesh) {\n this._meshes.push(mesh);\n mesh.transform = this;\n // childTransform._setWorldMatrixDirty();\n // childTransform._setAABBDirty();\n }\n\n /**\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n */\n get parentTransform() {\n return this._parentTransform;\n }\n\n /**\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n */\n get meshes() {\n return this._meshes;\n }\n\n /**\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set position(value) {\n this._position.set(value || [0, 0, 0]);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get position() {\n return this._position;\n }\n\n /**\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set rotation(value) {\n this._rotation.set(value || [0, 0, 0]);\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get rotation() {\n return this._rotation;\n }\n\n /**\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n set quaternion(value) {\n this._quaternion.set(value || [0, 0, 0, 1]);\n math.quaternionToEuler(this._quaternion, \"XYZ\", this._rotation);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n get quaternion() {\n return this._quaternion;\n }\n\n /**\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n set scale(value) {\n this._scale.set(value || [1, 1, 1]);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n set matrix(value) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n this._localMatrix.set(value || identityMat);\n math.decomposeMat4(this._localMatrix, this._position, this._quaternion, this._scale);\n this._localMatrixDirty = false;\n this._transformDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n get matrix() {\n if (this._localMatrixDirty) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n math.composeMat4(this._position, this._quaternion, this._scale, this._localMatrix);\n this._localMatrixDirty = false;\n }\n return this._localMatrix;\n }\n\n /**\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n */\n get worldMatrix() {\n if (this._worldMatrixDirty) {\n this._buildWorldMatrix();\n }\n return this._worldMatrix;\n }\n\n /**\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotate(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(this.quaternion, q1, q2);\n this.quaternion = q2;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotateOnWorldAxis(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(q1, this.quaternion, q1);\n //this.quaternion.premultiply(q1);\n return this;\n }\n\n /**\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateX(angle) {\n return this.rotate(xAxis, angle);\n }\n\n /**\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateY(angle) {\n return this.rotate(yAxis, angle);\n }\n\n /**\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateZ(angle) {\n return this.rotate(zAxis, angle);\n }\n\n /**\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n */\n translate(axis) {\n this._position[0] += axis[0];\n this._position[1] += axis[1];\n this._position[2] += axis[2];\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n */\n translateX(distance) {\n this._position[0] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n */\n translateY(distance) {\n this._position[1] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n */\n translateZ(distance) {\n this._position[2] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n _setLocalMatrixDirty() {\n this._localMatrixDirty = true;\n this._transformDirty();\n }\n\n _transformDirty() {\n this._worldMatrixDirty = true;\n for (let i = 0, len = this._childTransforms.length; i < len; i++) {\n const childTransform = this._childTransforms[i];\n childTransform._transformDirty();\n if (childTransform._meshes && childTransform._meshes.length > 0) {\n const meshes = childTransform._meshes;\n for (let j =0, lenj = meshes.length; j < lenj; j++) {\n meshes[j]._transformDirty();\n }\n }\n }\n if (this._meshes && this._meshes.length > 0) {\n const meshes = this._meshes;\n for (let j =0, lenj = meshes.length; j < lenj; j++) {\n meshes[j]._transformDirty();\n }\n }\n }\n\n _buildWorldMatrix() {\n const localMatrix = this.matrix;\n if (!this._parentTransform) {\n for (let i = 0, len = localMatrix.length; i < len; i++) {\n this._worldMatrix[i] = localMatrix[i];\n }\n } else {\n math.mulMat4(this._parentTransform.worldMatrix, localMatrix, this._worldMatrix);\n }\n this._worldMatrixDirty = false;\n }\n\n _setSubtreeAABBsDirty(sceneTransform) {\n sceneTransform._aabbDirty = true;\n if (sceneTransform._childTransforms) {\n for (let i = 0, len = sceneTransform._childTransforms.length; i < len; i++) {\n this._setSubtreeAABBsDirty(sceneTransform._childTransforms[i]);\n }\n }\n }\n}\n", + "content": "import {math} from \"../math/index.js\";\n\nconst angleAxis = math.vec4(4);\nconst q1 = math.vec4();\nconst q2 = math.vec4();\nconst xAxis = math.vec3([1, 0, 0]);\nconst yAxis = math.vec3([0, 1, 0]);\nconst zAxis = math.vec3([0, 0, 1]);\n\nconst veca = math.vec3(3);\nconst vecb = math.vec3(3);\n\nconst identityMat = math.identityMat4();\n\n/**\n * A dynamically-updatable transform within a {@link SceneModel}.\n *\n * * Can be composed into hierarchies\n * * Shared by multiple {@link SceneModelMesh}es\n * * Created with {@link SceneModel#createTransform}\n * * Stored by ID in {@link SceneModel#transforms}\n * * Referenced by {@link SceneModelMesh#transform}\n */\nexport class SceneModelTransform {\n\n /**\n * @private\n */\n constructor(cfg) {\n this._model = cfg.model;\n\n /**\n * Unique ID of this SceneModelTransform.\n *\n * The SceneModelTransform is registered against this ID in {@link SceneModel#transforms}.\n */\n this.id = cfg.id;\n\n this._parentTransform = cfg.parent;\n this._childTransforms = [];\n this._meshes = [];\n this._scale = new Float32Array([1,1,1]);\n this._quaternion = math.identityQuaternion(new Float32Array(4));\n this._rotation = new Float32Array(3);\n this._position = new Float32Array(3);\n this._localMatrix = math.identityMat4(new Float32Array(16));\n this._worldMatrix = math.identityMat4(new Float32Array(16));\n this._localMatrixDirty = true;\n this._worldMatrixDirty = true;\n\n if (cfg.matrix) {\n this.matrix = cfg.matrix;\n } else {\n this.scale = cfg.scale;\n this.position = cfg.position;\n if (cfg.quaternion) {\n } else {\n this.rotation = cfg.rotation;\n }\n }\n if (cfg.parent) {\n cfg.parent._addChildTransform(this);\n }\n }\n\n _addChildTransform(childTransform) {\n this._childTransforms.push(childTransform);\n childTransform._parentTransform = this;\n childTransform._transformDirty();\n childTransform._setSubtreeAABBsDirty(this);\n }\n\n _addMesh(mesh) {\n this._meshes.push(mesh);\n mesh.transform = this;\n // childTransform._setWorldMatrixDirty();\n // childTransform._setAABBDirty();\n }\n\n /**\n * The optional parent SceneModelTransform.\n *\n * @type {SceneModelTransform}\n */\n get parentTransform() {\n return this._parentTransform;\n }\n\n /**\n * The {@link SceneModelMesh}es transformed by this SceneModelTransform.\n *\n * @returns {[]}\n */\n get meshes() {\n return this._meshes;\n }\n\n /**\n * Sets the SceneModelTransform's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set position(value) {\n this._position.set(value || [0, 0, 0]);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get position() {\n return this._position;\n }\n\n /**\n * Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set rotation(value) {\n this._rotation.set(value || [0, 0, 0]);\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get rotation() {\n return this._rotation;\n }\n\n /**\n * Sets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n set quaternion(value) {\n this._quaternion.set(value || [0, 0, 0, 1]);\n math.quaternionToEuler(this._quaternion, \"XYZ\", this._rotation);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n get quaternion() {\n return this._quaternion;\n }\n\n /**\n * Sets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n set scale(value) {\n this._scale.set(value || [1, 1, 1]);\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n set matrix(value) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n this._localMatrix.set(value || identityMat);\n math.decomposeMat4(this._localMatrix, this._position, this._quaternion, this._scale);\n this._localMatrixDirty = false;\n this._transformDirty();\n this._model.glRedraw();\n }\n\n /**\n * Gets the SceneModelTransform's transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n get matrix() {\n if (this._localMatrixDirty) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n math.composeMat4(this._position, this._quaternion, this._scale, this._localMatrix);\n this._localMatrixDirty = false;\n }\n return this._localMatrix;\n }\n\n /**\n * Gets the SceneModelTransform's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n */\n get worldMatrix() {\n if (this._worldMatrixDirty) {\n this._buildWorldMatrix();\n }\n return this._worldMatrix;\n }\n\n /**\n * Rotates the SceneModelTransform about the given axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotate(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(this.quaternion, q1, q2);\n this.quaternion = q2;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Rotates the SceneModelTransform about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotateOnWorldAxis(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(q1, this.quaternion, q1);\n //this.quaternion.premultiply(q1);\n return this;\n }\n\n /**\n * Rotates the SceneModelTransform about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateX(angle) {\n return this.rotate(xAxis, angle);\n }\n\n /**\n * Rotates the SceneModelTransform about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateY(angle) {\n return this.rotate(yAxis, angle);\n }\n\n /**\n * Rotates the SceneModelTransform about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateZ(angle) {\n return this.rotate(zAxis, angle);\n }\n\n /**\n * Translates the SceneModelTransform along the local axis by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n */\n translate(axis) {\n this._position[0] += axis[0];\n this._position[1] += axis[1];\n this._position[2] += axis[2];\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n */\n translateX(distance) {\n this._position[0] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n */\n translateY(distance) {\n this._position[1] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n /**\n * Translates the SceneModelTransform along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n */\n translateZ(distance) {\n this._position[2] += distance;\n this._setLocalMatrixDirty();\n this._model.glRedraw();\n return this;\n }\n\n _setLocalMatrixDirty() {\n this._localMatrixDirty = true;\n this._transformDirty();\n }\n\n _transformDirty() {\n this._worldMatrixDirty = true;\n for (let i = 0, len = this._childTransforms.length; i < len; i++) {\n const childTransform = this._childTransforms[i];\n childTransform._transformDirty();\n if (childTransform._meshes && childTransform._meshes.length > 0) {\n const meshes = childTransform._meshes;\n for (let j =0, lenj = meshes.length; j < lenj; j++) {\n meshes[j]._transformDirty();\n }\n }\n }\n if (this._meshes && this._meshes.length > 0) {\n const meshes = this._meshes;\n for (let j =0, lenj = meshes.length; j < lenj; j++) {\n meshes[j]._transformDirty();\n }\n }\n }\n\n _buildWorldMatrix() {\n const localMatrix = this.matrix;\n if (!this._parentTransform) {\n for (let i = 0, len = localMatrix.length; i < len; i++) {\n this._worldMatrix[i] = localMatrix[i];\n }\n } else {\n math.mulMat4(this._parentTransform.worldMatrix, localMatrix, this._worldMatrix);\n }\n this._worldMatrixDirty = false;\n }\n\n _setSubtreeAABBsDirty(sceneTransform) {\n sceneTransform._aabbDirty = true;\n if (sceneTransform._childTransforms) {\n for (let i = 0, len = sceneTransform._childTransforms.length; i < len; i++) {\n this._setSubtreeAABBsDirty(sceneTransform._childTransforms[i]);\n }\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/SceneModelTransform.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/SceneModelTransform.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5281, + "__docId__": 5289, "kind": "variable", "name": "angleAxis", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105582,7 +105798,7 @@ "ignore": true }, { - "__docId__": 5282, + "__docId__": 5290, "kind": "variable", "name": "q1", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105603,7 +105819,7 @@ "ignore": true }, { - "__docId__": 5283, + "__docId__": 5291, "kind": "variable", "name": "q2", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105624,7 +105840,7 @@ "ignore": true }, { - "__docId__": 5284, + "__docId__": 5292, "kind": "variable", "name": "xAxis", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105645,7 +105861,7 @@ "ignore": true }, { - "__docId__": 5285, + "__docId__": 5293, "kind": "variable", "name": "yAxis", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105666,7 +105882,7 @@ "ignore": true }, { - "__docId__": 5286, + "__docId__": 5294, "kind": "variable", "name": "zAxis", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105687,7 +105903,7 @@ "ignore": true }, { - "__docId__": 5287, + "__docId__": 5295, "kind": "variable", "name": "veca", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105708,7 +105924,7 @@ "ignore": true }, { - "__docId__": 5288, + "__docId__": 5296, "kind": "variable", "name": "vecb", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105729,7 +105945,7 @@ "ignore": true }, { - "__docId__": 5289, + "__docId__": 5297, "kind": "variable", "name": "identityMat", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105750,7 +105966,7 @@ "ignore": true }, { - "__docId__": 5290, + "__docId__": 5298, "kind": "class", "name": "SceneModelTransform", "memberof": "src/viewer/scene/model/SceneModelTransform.js", @@ -105765,7 +105981,7 @@ "interface": false }, { - "__docId__": 5291, + "__docId__": 5299, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105779,7 +105995,7 @@ "ignore": true }, { - "__docId__": 5292, + "__docId__": 5300, "kind": "member", "name": "_model", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105797,7 +106013,7 @@ } }, { - "__docId__": 5293, + "__docId__": 5301, "kind": "member", "name": "id", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105813,7 +106029,7 @@ } }, { - "__docId__": 5294, + "__docId__": 5302, "kind": "member", "name": "_parentTransform", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105831,7 +106047,7 @@ } }, { - "__docId__": 5295, + "__docId__": 5303, "kind": "member", "name": "_childTransforms", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105849,7 +106065,7 @@ } }, { - "__docId__": 5296, + "__docId__": 5304, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105867,7 +106083,7 @@ } }, { - "__docId__": 5297, + "__docId__": 5305, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105885,7 +106101,7 @@ } }, { - "__docId__": 5298, + "__docId__": 5306, "kind": "member", "name": "_quaternion", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105903,7 +106119,7 @@ } }, { - "__docId__": 5299, + "__docId__": 5307, "kind": "member", "name": "_rotation", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105921,7 +106137,7 @@ } }, { - "__docId__": 5300, + "__docId__": 5308, "kind": "member", "name": "_position", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105939,7 +106155,7 @@ } }, { - "__docId__": 5301, + "__docId__": 5309, "kind": "member", "name": "_localMatrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105957,7 +106173,7 @@ } }, { - "__docId__": 5302, + "__docId__": 5310, "kind": "member", "name": "_worldMatrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105975,7 +106191,7 @@ } }, { - "__docId__": 5303, + "__docId__": 5311, "kind": "member", "name": "_localMatrixDirty", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -105993,7 +106209,7 @@ } }, { - "__docId__": 5304, + "__docId__": 5312, "kind": "member", "name": "_worldMatrixDirty", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106011,7 +106227,7 @@ } }, { - "__docId__": 5309, + "__docId__": 5317, "kind": "method", "name": "_addChildTransform", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106035,7 +106251,7 @@ "return": null }, { - "__docId__": 5310, + "__docId__": 5318, "kind": "method", "name": "_addMesh", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106059,7 +106275,7 @@ "return": null }, { - "__docId__": 5311, + "__docId__": 5319, "kind": "get", "name": "parentTransform", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106080,7 +106296,7 @@ } }, { - "__docId__": 5312, + "__docId__": 5320, "kind": "get", "name": "meshes", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106112,7 +106328,7 @@ } }, { - "__docId__": 5313, + "__docId__": 5321, "kind": "set", "name": "position", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106133,7 +106349,7 @@ } }, { - "__docId__": 5314, + "__docId__": 5322, "kind": "get", "name": "position", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106154,7 +106370,7 @@ } }, { - "__docId__": 5315, + "__docId__": 5323, "kind": "set", "name": "rotation", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106175,7 +106391,7 @@ } }, { - "__docId__": 5316, + "__docId__": 5324, "kind": "get", "name": "rotation", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106196,7 +106412,7 @@ } }, { - "__docId__": 5317, + "__docId__": 5325, "kind": "set", "name": "quaternion", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106217,7 +106433,7 @@ } }, { - "__docId__": 5318, + "__docId__": 5326, "kind": "get", "name": "quaternion", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106238,7 +106454,7 @@ } }, { - "__docId__": 5319, + "__docId__": 5327, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106259,7 +106475,7 @@ } }, { - "__docId__": 5320, + "__docId__": 5328, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106280,7 +106496,7 @@ } }, { - "__docId__": 5321, + "__docId__": 5329, "kind": "set", "name": "matrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106301,7 +106517,7 @@ } }, { - "__docId__": 5324, + "__docId__": 5332, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106322,7 +106538,7 @@ } }, { - "__docId__": 5327, + "__docId__": 5335, "kind": "get", "name": "worldMatrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106355,7 +106571,7 @@ } }, { - "__docId__": 5328, + "__docId__": 5336, "kind": "method", "name": "rotate", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106395,7 +106611,7 @@ } }, { - "__docId__": 5330, + "__docId__": 5338, "kind": "method", "name": "rotateOnWorldAxis", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106435,7 +106651,7 @@ } }, { - "__docId__": 5331, + "__docId__": 5339, "kind": "method", "name": "rotateX", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106465,7 +106681,7 @@ } }, { - "__docId__": 5332, + "__docId__": 5340, "kind": "method", "name": "rotateY", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106495,7 +106711,7 @@ } }, { - "__docId__": 5333, + "__docId__": 5341, "kind": "method", "name": "rotateZ", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106525,7 +106741,7 @@ } }, { - "__docId__": 5334, + "__docId__": 5342, "kind": "method", "name": "translate", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106565,7 +106781,7 @@ } }, { - "__docId__": 5335, + "__docId__": 5343, "kind": "method", "name": "translateX", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106595,7 +106811,7 @@ } }, { - "__docId__": 5336, + "__docId__": 5344, "kind": "method", "name": "translateY", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106625,7 +106841,7 @@ } }, { - "__docId__": 5337, + "__docId__": 5345, "kind": "method", "name": "translateZ", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106655,7 +106871,7 @@ } }, { - "__docId__": 5338, + "__docId__": 5346, "kind": "method", "name": "_setLocalMatrixDirty", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106672,7 +106888,7 @@ "return": null }, { - "__docId__": 5340, + "__docId__": 5348, "kind": "method", "name": "_transformDirty", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106689,7 +106905,7 @@ "return": null }, { - "__docId__": 5342, + "__docId__": 5350, "kind": "method", "name": "_buildWorldMatrix", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106706,7 +106922,7 @@ "return": null }, { - "__docId__": 5344, + "__docId__": 5352, "kind": "method", "name": "_setSubtreeAABBsDirty", "memberof": "src/viewer/scene/model/SceneModelTransform.js~SceneModelTransform", @@ -106730,18 +106946,18 @@ "return": null }, { - "__docId__": 5345, + "__docId__": 5353, "kind": "file", "name": "src/viewer/scene/model/VBOSceneModel.js", "content": "import {SceneModel} from \"./SceneModel.js\";\n\n/**\n * @desc A high-performance model representation for efficient rendering and low memory usage.\n *\n * * VBOSceneModel was replaced with {@link SceneModel} in ````xeokit-sdk v2.4````.\n * * VBOSceneModel currently extends {@link SceneModel}, in order to maintain backward-compatibility until we remove VBOSceneModel.\n * * See {@link SceneModel} for API details.\n *\n * @deprecated\n * @implements {Drawable}\n * @implements {Entity}\n * @extends {SceneModel}\n */\nexport class VBOSceneModel extends SceneModel {\n\n /**\n * See {@link VBOSceneModel} for details.\n *\n * @param owner\n * @param cfg\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/VBOSceneModel.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/VBOSceneModel.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5346, + "__docId__": 5354, "kind": "class", "name": "VBOSceneModel", "memberof": "src/viewer/scene/model/VBOSceneModel.js", @@ -106764,7 +106980,7 @@ ] }, { - "__docId__": 5347, + "__docId__": 5355, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/VBOSceneModel.js~VBOSceneModel", @@ -106799,18 +107015,18 @@ ] }, { - "__docId__": 5348, + "__docId__": 5356, "kind": "file", "name": "src/viewer/scene/model/calculateUniquePositions.js", "content": "/**\n * @author https://github.com/tmarti, with support from https://tribia.com/\n * @license MIT\n *\n * This file takes a geometry given by { positionsCompressed, indices }, and returns\n * equivalent { positionsCompressed, indices } arrays but which only contain unique\n * positionsCompressed.\n *\n * The time is O(N logN) with the number of positionsCompressed due to a pre-sorting\n * step, but is much more GC-friendly and actually faster than the classic O(N)\n * approach based in keeping a hash-based LUT to identify unique positionsCompressed.\n */\nlet comparePositions = null;\n\nfunction compareVertex(a, b) {\n let res;\n for (let i = 0; i < 3; i++) {\n if (0 !== (res = comparePositions[a * 3 + i] - comparePositions[b * 3 + i])) {\n return res;\n }\n }\n return 0;\n}\n\nlet seqInit = null;\n\nfunction setMaxNumberOfPositions(maxPositions) {\n if (seqInit !== null && seqInit.length >= maxPositions) {\n return;\n }\n seqInit = new Uint32Array(maxPositions);\n for (let i = 0; i < maxPositions; i++) {\n seqInit[i] = i;\n }\n}\n\n/**\n * This function obtains unique positionsCompressed in the provided object\n * .positionsCompressed array and calculates an index mapping, which is then\n * applied to the provided object .indices and .edgeindices.\n *\n * The input object items are not modified, and instead new set\n * of positionsCompressed, indices and edgeIndices with the applied optimization\n * are returned.\n *\n * The algorithm, instead of being based in a hash-like LUT for\n * identifying unique positionsCompressed, is based in pre-sorting the input\n * positionsCompressed...\n *\n * (it's possible to define a _\"consistent ordering\"_ for the positionsCompressed\n * as positionsCompressed are quantized and thus not suffer from float number\n * comparison artifacts)\n *\n * ... so same positionsCompressed are adjacent in the sorted array, and then\n * it's easy to scan linearly the sorted array. During the linear run,\n * we will know that we found a different position because the comparison\n * function will return != 0 between current and previous element.\n *\n * During this linear traversal of the array, a `unique counter` is used\n * in order to calculate the mapping between original indices and unique\n * indices.\n *\n * @param {{positionsCompressed: number[],indices: number[], edgeIndices: number[]}} mesh The input mesh to process, with `positionsCompressed`, `indices` and `edgeIndices` keys.\n *\n * @returns {[Uint16Array, Uint32Array, Uint32Array]} An array with 3 elements: 0 => the uniquified positionsCompressed; 1 and 2 => the remapped edges and edgeIndices arrays\n */\nexport function uniquifyPositions(mesh) {\n const _positions = mesh.positionsCompressed;\n const _indices = mesh.indices;\n const _edgeIndices = mesh.edgeIndices;\n\n setMaxNumberOfPositions(_positions.length / 3);\n\n const seq = seqInit.slice(0, _positions.length / 3);\n const remappings = seqInit.slice(0, _positions.length / 3);\n\n comparePositions = _positions;\n\n seq.sort(compareVertex);\n\n let uniqueIdx = 0\n\n remappings[seq[0]] = 0;\n\n for (let i = 1, len = seq.length; i < len; i++) {\n if (0 !== compareVertex(seq[i], seq[i - 1])) {\n uniqueIdx++;\n }\n remappings[seq[i]] = uniqueIdx;\n }\n\n const numUniquePositions = uniqueIdx + 1;\n const newPositions = new Uint16Array(numUniquePositions * 3);\n\n uniqueIdx = 0\n\n newPositions [uniqueIdx * 3 + 0] = _positions [seq[0] * 3 + 0];\n newPositions [uniqueIdx * 3 + 1] = _positions [seq[0] * 3 + 1];\n newPositions [uniqueIdx * 3 + 2] = _positions [seq[0] * 3 + 2];\n\n for (let i = 1, len = seq.length; i < len; i++) {\n if (0 !== compareVertex(seq[i], seq[i - 1])) {\n uniqueIdx++;\n newPositions [uniqueIdx * 3 + 0] = _positions [seq[i] * 3 + 0];\n newPositions [uniqueIdx * 3 + 1] = _positions [seq[i] * 3 + 1];\n newPositions [uniqueIdx * 3 + 2] = _positions [seq[i] * 3 + 2];\n }\n remappings[seq[i]] = uniqueIdx;\n }\n\n comparePositions = null;\n\n const newIndices = new Uint32Array(_indices.length);\n\n for (let i = 0, len = _indices.length; i < len; i++) {\n newIndices[i] = remappings [_indices[i]];\n }\n\n const newEdgeIndices = new Uint32Array(_edgeIndices.length);\n\n for (let i = 0, len = _edgeIndices.length; i < len; i++) {\n newEdgeIndices[i] = remappings [_edgeIndices[i]];\n }\n\n return [newPositions, newIndices, newEdgeIndices];\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/calculateUniquePositions.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/calculateUniquePositions.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5349, + "__docId__": 5357, "kind": "variable", "name": "comparePositions", "memberof": "src/viewer/scene/model/calculateUniquePositions.js", @@ -106840,7 +107056,7 @@ "ignore": true }, { - "__docId__": 5350, + "__docId__": 5358, "kind": "function", "name": "compareVertex", "memberof": "src/viewer/scene/model/calculateUniquePositions.js", @@ -106877,7 +107093,7 @@ "ignore": true }, { - "__docId__": 5351, + "__docId__": 5359, "kind": "variable", "name": "seqInit", "memberof": "src/viewer/scene/model/calculateUniquePositions.js", @@ -106898,7 +107114,7 @@ "ignore": true }, { - "__docId__": 5352, + "__docId__": 5360, "kind": "function", "name": "setMaxNumberOfPositions", "memberof": "src/viewer/scene/model/calculateUniquePositions.js", @@ -106925,7 +107141,7 @@ "ignore": true }, { - "__docId__": 5353, + "__docId__": 5361, "kind": "function", "name": "uniquifyPositions", "memberof": "src/viewer/scene/model/calculateUniquePositions.js", @@ -106967,18 +107183,18 @@ } }, { - "__docId__": 5354, + "__docId__": 5362, "kind": "file", "name": "src/viewer/scene/model/compression.js", "content": "import {math} from \"../math/math.js\";\n\nconst translate = math.mat4();\nconst scale = math.mat4();\n\n/**\n * @private\n */\nfunction quantizePositions(positions, aabb, positionsDecodeMatrix) { // http://cg.postech.ac.kr/research/mesh_comp_mobile/mesh_comp_mobile_conference.pdf\n const lenPositions = positions.length;\n const quantizedPositions = new Uint16Array(lenPositions);\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n const xwid = aabb[3] - xmin;\n const ywid = aabb[4] - ymin;\n const zwid = aabb[5] - zmin;\n const maxInt = 65525;\n const xMultiplier = maxInt / xwid;\n const yMultiplier = maxInt / ywid;\n const zMultiplier = maxInt / zwid;\n const verify = (num) => num >= 0 ? num : 0;\n for (let i = 0; i < lenPositions; i += 3) {\n quantizedPositions[i + 0] = Math.floor(verify(positions[i + 0] - xmin) * xMultiplier);\n quantizedPositions[i + 1] = Math.floor(verify(positions[i + 1] - ymin) * yMultiplier);\n quantizedPositions[i + 2] = Math.floor(verify(positions[i + 2] - zmin) * zMultiplier);\n }\n math.identityMat4(translate);\n math.translationMat4v(aabb, translate);\n math.identityMat4(scale);\n math.scalingMat4v([xwid / maxInt, ywid / maxInt, zwid / maxInt], scale);\n math.mulMat4(translate, scale, positionsDecodeMatrix);\n return quantizedPositions;\n}\n\n/**\n * @private\n * @param aabb\n * @param positionsDecodeMatrix\n * @returns {*}\n */\nfunction createPositionsDecodeMatrix(aabb, positionsDecodeMatrix) { // http://cg.postech.ac.kr/research/mesh_comp_mobile/mesh_comp_mobile_conference.pdf\n const xmin = aabb[0];\n const ymin = aabb[1];\n const zmin = aabb[2];\n const xwid = aabb[3] - xmin;\n const ywid = aabb[4] - ymin;\n const zwid = aabb[5] - zmin;\n const maxInt = 65525;\n math.identityMat4(translate);\n math.translationMat4v(aabb, translate);\n math.identityMat4(scale);\n math.scalingMat4v([xwid / maxInt, ywid / maxInt, zwid / maxInt], scale);\n math.mulMat4(translate, scale, positionsDecodeMatrix);\n return positionsDecodeMatrix;\n}\n\n/**\n * @private\n */\nfunction transformAndOctEncodeNormals(worldNormalMatrix, normals, lenNormals, compressedNormals, lenCompressedNormals) {\n // http://jcgt.org/published/0003/02/01/\n\n function dot(array, vec3) {\n return array[0] * vec3[0] + array[1] * vec3[1] + array[2] * vec3[2];\n }\n\n let oct, dec, best, currentCos, bestCos;\n let i, ei;\n let localNormal = new Float32Array([0, 0, 0, 0]);\n let worldNormal = new Float32Array([0, 0, 0, 0]);\n for (i = 0; i < lenNormals; i += 3) {\n localNormal[0] = normals[i];\n localNormal[1] = normals[i + 1];\n localNormal[2] = normals[i + 2];\n\n math.transformVec3(worldNormalMatrix, localNormal, worldNormal);\n math.normalizeVec3(worldNormal, worldNormal);\n\n // Test various combinations of ceil and floor to minimize rounding errors\n best = oct = octEncodeVec3(worldNormal, \"floor\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = bestCos = dot(worldNormal, dec);\n oct = octEncodeVec3(worldNormal, \"ceil\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = dot(worldNormal, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(worldNormal, \"floor\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(worldNormal, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(worldNormal, \"ceil\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(worldNormal, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n compressedNormals[lenCompressedNormals + i + 0] = best[0];\n compressedNormals[lenCompressedNormals + i + 1] = best[1];\n compressedNormals[lenCompressedNormals + i + 2] = 0.0; // Unused\n }\n lenCompressedNormals += lenNormals;\n return lenCompressedNormals;\n}\n\n/**\n * @private\n */\nfunction octEncodeNormals(normals) { // http://jcgt.org/published/0003/02/01/\n const lenNormals = normals.length;\n const compressedNormals = new Int8Array(lenNormals)\n let oct, dec, best, currentCos, bestCos;\n for (let i = 0; i < lenNormals; i += 3) {\n // Test various combinations of ceil and floor to minimize rounding errors\n best = oct = octEncodeNormal(normals, i, \"floor\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = bestCos = dot(normals, i, dec);\n oct = octEncodeNormal(normals, i, \"ceil\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = dot(normals, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeNormal(normals, i, \"floor\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(normals, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeNormal(normals, i, \"ceil\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(normals, i, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n compressedNormals[i + 0] = best[0];\n compressedNormals[i + 1] = best[1];\n compressedNormals[i + 2] = 0.0; // Unused\n }\n return compressedNormals;\n}\n\n/**\n * @private\n */\nfunction octEncodeVec3(p, xfunc, yfunc) { // Oct-encode single normal vector in 2 bytes\n let x = p[0] / (Math.abs(p[0]) + Math.abs(p[1]) + Math.abs(p[2]));\n let y = p[1] / (Math.abs(p[0]) + Math.abs(p[1]) + Math.abs(p[2]));\n if (p[2] < 0) {\n let tempx = x;\n let tempy = y;\n tempx = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n tempy = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n x = tempx;\n y = tempy;\n }\n return new Int8Array([\n Math[xfunc](x * 127.5 + (x < 0 ? -1 : 0)),\n Math[yfunc](y * 127.5 + (y < 0 ? -1 : 0))\n ]);\n}\n\n/**\n * @private\n */\nfunction octEncodeNormal(array, i, xfunc, yfunc) { // Oct-encode single normal vector in 2 bytes\n let x = array[i] / (Math.abs(array[i]) + Math.abs(array[i + 1]) + Math.abs(array[i + 2]));\n let y = array[i + 1] / (Math.abs(array[i]) + Math.abs(array[i + 1]) + Math.abs(array[i + 2]));\n if (array[i + 2] < 0) {\n let tempx = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n let tempy = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n x = tempx;\n y = tempy;\n }\n return new Int8Array([\n Math[xfunc](x * 127.5 + (x < 0 ? -1 : 0)),\n Math[yfunc](y * 127.5 + (y < 0 ? -1 : 0))\n ]);\n}\n\n/**\n * @private\n */\nfunction octDecodeVec2(oct) { // Decode an oct-encoded normal\n let x = oct[0];\n let y = oct[1];\n x /= x < 0 ? 127 : 128;\n y /= y < 0 ? 127 : 128;\n const z = 1 - Math.abs(x) - Math.abs(y);\n if (z < 0) {\n x = (1 - Math.abs(y)) * (x >= 0 ? 1 : -1);\n y = (1 - Math.abs(x)) * (y >= 0 ? 1 : -1);\n }\n const length = Math.sqrt(x * x + y * y + z * z);\n return [\n x / length,\n y / length,\n z / length\n ];\n}\n\n/**\n * @private\n */\nfunction dot(array, i, vec3) {\n return array[i] * vec3[0] + array[i + 1] * vec3[1] + array[i + 2] * vec3[2];\n}\n\nexport {\n quantizePositions,\n createPositionsDecodeMatrix,\n octEncodeNormals,\n transformAndOctEncodeNormals,\n octEncodeVec3,\n octDecodeVec2\n\n};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/compression.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/compression.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5355, + "__docId__": 5363, "kind": "variable", "name": "translate", "memberof": "src/viewer/scene/model/compression.js", @@ -106999,7 +107215,7 @@ "ignore": true }, { - "__docId__": 5356, + "__docId__": 5364, "kind": "variable", "name": "scale", "memberof": "src/viewer/scene/model/compression.js", @@ -107020,7 +107236,7 @@ "ignore": true }, { - "__docId__": 5357, + "__docId__": 5365, "kind": "function", "name": "octEncodeNormal", "memberof": "src/viewer/scene/model/compression.js", @@ -107068,7 +107284,7 @@ } }, { - "__docId__": 5358, + "__docId__": 5366, "kind": "function", "name": "dot", "memberof": "src/viewer/scene/model/compression.js", @@ -107110,7 +107326,7 @@ } }, { - "__docId__": 5359, + "__docId__": 5367, "kind": "function", "name": "quantizePositions", "memberof": "src/viewer/scene/model/compression.js", @@ -107152,7 +107368,7 @@ } }, { - "__docId__": 5360, + "__docId__": 5368, "kind": "function", "name": "createPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/compression.js", @@ -107205,7 +107421,7 @@ "ignore": true }, { - "__docId__": 5361, + "__docId__": 5369, "kind": "function", "name": "octEncodeNormals", "memberof": "src/viewer/scene/model/compression.js", @@ -107235,7 +107451,7 @@ } }, { - "__docId__": 5362, + "__docId__": 5370, "kind": "function", "name": "transformAndOctEncodeNormals", "memberof": "src/viewer/scene/model/compression.js", @@ -107289,7 +107505,7 @@ } }, { - "__docId__": 5363, + "__docId__": 5371, "kind": "function", "name": "octEncodeVec3", "memberof": "src/viewer/scene/model/compression.js", @@ -107331,7 +107547,7 @@ } }, { - "__docId__": 5364, + "__docId__": 5372, "kind": "function", "name": "octDecodeVec2", "memberof": "src/viewer/scene/model/compression.js", @@ -107361,18 +107577,18 @@ } }, { - "__docId__": 5365, + "__docId__": 5373, "kind": "file", "name": "src/viewer/scene/model/dtx/BindableDataTexture.js", "content": "/**\n * @private\n */\nexport class BindableDataTexture {\n\n constructor(gl, texture, textureWidth, textureHeight, textureData = null) {\n this._gl = gl;\n this._texture = texture;\n this._textureWidth = textureWidth;\n this._textureHeight = textureHeight;\n this._textureData = textureData;\n }\n\n bindTexture(glProgram, shaderName, glTextureUnit) {\n return glProgram.bindTexture(shaderName, this, glTextureUnit);\n }\n\n bind(unit) {\n this._gl.activeTexture(this._gl[\"TEXTURE\" + unit]);\n this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture);\n return true;\n }\n\n unbind(unit) {\n // This `unbind` method is ignored at the moment to allow avoiding\n // to rebind same texture already bound to a texture unit.\n\n // this._gl.activeTexture(this.state.gl[\"TEXTURE\" + unit]);\n // this._gl.bindTexture(this.state.gl.TEXTURE_2D, null);\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/BindableDataTexture.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/BindableDataTexture.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5366, + "__docId__": 5374, "kind": "class", "name": "BindableDataTexture", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js", @@ -107388,7 +107604,7 @@ "ignore": true }, { - "__docId__": 5367, + "__docId__": 5375, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107402,7 +107618,7 @@ "undocument": true }, { - "__docId__": 5368, + "__docId__": 5376, "kind": "member", "name": "_gl", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107420,7 +107636,7 @@ } }, { - "__docId__": 5369, + "__docId__": 5377, "kind": "member", "name": "_texture", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107438,7 +107654,7 @@ } }, { - "__docId__": 5370, + "__docId__": 5378, "kind": "member", "name": "_textureWidth", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107456,7 +107672,7 @@ } }, { - "__docId__": 5371, + "__docId__": 5379, "kind": "member", "name": "_textureHeight", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107474,7 +107690,7 @@ } }, { - "__docId__": 5372, + "__docId__": 5380, "kind": "member", "name": "_textureData", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107492,7 +107708,7 @@ } }, { - "__docId__": 5373, + "__docId__": 5381, "kind": "method", "name": "bindTexture", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107531,7 +107747,7 @@ } }, { - "__docId__": 5374, + "__docId__": 5382, "kind": "method", "name": "bind", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107558,7 +107774,7 @@ } }, { - "__docId__": 5375, + "__docId__": 5383, "kind": "method", "name": "unbind", "memberof": "src/viewer/scene/model/dtx/BindableDataTexture.js~BindableDataTexture", @@ -107581,18 +107797,18 @@ "return": null }, { - "__docId__": 5376, + "__docId__": 5384, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js", "content": "/**\n * @private\n */\nexport class DTXLinesBuffer {\n\n constructor() {\n this.positionsCompressed = [];\n this.lenPositionsCompressed = 0;\n this.indices8Bits = [];\n this.lenIndices8Bits = 0;\n this.indices16Bits = [];\n this.lenIndices16Bits = 0;\n this.indices32Bits = [];\n this.lenIndices32Bits = 0;\n this.perObjectColors = [];\n this.perObjectPickColors = [];\n this.perObjectSolid = [];\n this.perObjectOffsets = [];\n this.perObjectPositionsDecodeMatrices = [];\n this.perObjectInstancePositioningMatrices = [];\n this.perObjectVertexBases = [];\n this.perObjectIndexBaseOffsets = [];\n this.perLineNumberPortionId8Bits = [];\n this.perLineNumberPortionId16Bits = [];\n this.perLineNumberPortionId32Bits = [];\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5377, + "__docId__": 5385, "kind": "class", "name": "DTXLinesBuffer", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js", @@ -107608,7 +107824,7 @@ "ignore": true }, { - "__docId__": 5378, + "__docId__": 5386, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107622,7 +107838,7 @@ "undocument": true }, { - "__docId__": 5379, + "__docId__": 5387, "kind": "member", "name": "positionsCompressed", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107639,7 +107855,7 @@ } }, { - "__docId__": 5380, + "__docId__": 5388, "kind": "member", "name": "lenPositionsCompressed", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107656,7 +107872,7 @@ } }, { - "__docId__": 5381, + "__docId__": 5389, "kind": "member", "name": "indices8Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107673,7 +107889,7 @@ } }, { - "__docId__": 5382, + "__docId__": 5390, "kind": "member", "name": "lenIndices8Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107690,7 +107906,7 @@ } }, { - "__docId__": 5383, + "__docId__": 5391, "kind": "member", "name": "indices16Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107707,7 +107923,7 @@ } }, { - "__docId__": 5384, + "__docId__": 5392, "kind": "member", "name": "lenIndices16Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107724,7 +107940,7 @@ } }, { - "__docId__": 5385, + "__docId__": 5393, "kind": "member", "name": "indices32Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107741,7 +107957,7 @@ } }, { - "__docId__": 5386, + "__docId__": 5394, "kind": "member", "name": "lenIndices32Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107758,7 +107974,7 @@ } }, { - "__docId__": 5387, + "__docId__": 5395, "kind": "member", "name": "perObjectColors", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107775,7 +107991,7 @@ } }, { - "__docId__": 5388, + "__docId__": 5396, "kind": "member", "name": "perObjectPickColors", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107792,7 +108008,7 @@ } }, { - "__docId__": 5389, + "__docId__": 5397, "kind": "member", "name": "perObjectSolid", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107809,7 +108025,7 @@ } }, { - "__docId__": 5390, + "__docId__": 5398, "kind": "member", "name": "perObjectOffsets", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107826,7 +108042,7 @@ } }, { - "__docId__": 5391, + "__docId__": 5399, "kind": "member", "name": "perObjectPositionsDecodeMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107843,7 +108059,7 @@ } }, { - "__docId__": 5392, + "__docId__": 5400, "kind": "member", "name": "perObjectInstancePositioningMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107860,7 +108076,7 @@ } }, { - "__docId__": 5393, + "__docId__": 5401, "kind": "member", "name": "perObjectVertexBases", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107877,7 +108093,7 @@ } }, { - "__docId__": 5394, + "__docId__": 5402, "kind": "member", "name": "perObjectIndexBaseOffsets", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107894,7 +108110,7 @@ } }, { - "__docId__": 5395, + "__docId__": 5403, "kind": "member", "name": "perLineNumberPortionId8Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107911,7 +108127,7 @@ } }, { - "__docId__": 5396, + "__docId__": 5404, "kind": "member", "name": "perLineNumberPortionId16Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107928,7 +108144,7 @@ } }, { - "__docId__": 5397, + "__docId__": 5405, "kind": "member", "name": "perLineNumberPortionId32Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js~DTXLinesBuffer", @@ -107945,18 +108161,18 @@ } }, { - "__docId__": 5398, + "__docId__": 5406, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/DTXLinesState.js", "content": "/**\n * @private\n */\nexport class DTXLinesState {\n\n constructor() {\n this.texturePerObjectColorsAndFlags = null;\n this.texturePerObjectOffsets = null;\n this.texturePerObjectInstanceMatrices = null;\n this.texturePerObjectPositionsDecodeMatrix = null;\n this.texturePerVertexIdCoordinates = null;\n this.texturePerLineIdPortionIds8Bits = null;\n this.texturePerLineIdPortionIds16Bits = null;\n this.texturePerLineIdPortionIds32Bits = null;\n this.texturePerLineIdIndices8Bits = null;\n this.texturePerLineIdIndices16Bits = null;\n this.texturePerLineIdIndices32Bits = null;\n this.textureModelMatrices = null;\n }\n\n finalize() {\n this.indicesPerBitnessTextures = {\n 8: this.texturePerLineIdIndices8Bits,\n 16: this.texturePerLineIdIndices16Bits,\n 32: this.texturePerLineIdIndices32Bits,\n };\n this.indicesPortionIdsPerBitnessTextures = {\n 8: this.texturePerLineIdPortionIds8Bits,\n 16: this.texturePerLineIdPortionIds16Bits,\n 32: this.texturePerLineIdPortionIds32Bits,\n };\n }\n\n bindCommonTextures(glProgram, objectDecodeMatricesShaderName, vertexTextureShaderName, objectAttributesTextureShaderName, objectMatricesShaderName) {\n this.texturePerObjectPositionsDecodeMatrix.bindTexture(glProgram, objectDecodeMatricesShaderName, 1);\n this.texturePerVertexIdCoordinates.bindTexture(glProgram, vertexTextureShaderName, 2);\n this.texturePerObjectColorsAndFlags.bindTexture(glProgram, objectAttributesTextureShaderName, 3);\n this.texturePerObjectInstanceMatrices.bindTexture(glProgram, objectMatricesShaderName, 4);\n }\n\n bindLineIndicesTextures(glProgram, portionIdsShaderName, lineIndicesShaderName, textureBitness) {\n this.indicesPortionIdsPerBitnessTextures[textureBitness].bindTexture(glProgram, portionIdsShaderName, 5);\n this.indicesPerBitnessTextures[textureBitness].bindTexture(glProgram, lineIndicesShaderName, 6);\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/DTXLinesState.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/DTXLinesState.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5399, + "__docId__": 5407, "kind": "class", "name": "DTXLinesState", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js", @@ -107972,7 +108188,7 @@ "ignore": true }, { - "__docId__": 5400, + "__docId__": 5408, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -107986,7 +108202,7 @@ "undocument": true }, { - "__docId__": 5401, + "__docId__": 5409, "kind": "member", "name": "texturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108003,7 +108219,7 @@ } }, { - "__docId__": 5402, + "__docId__": 5410, "kind": "member", "name": "texturePerObjectOffsets", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108020,7 +108236,7 @@ } }, { - "__docId__": 5403, + "__docId__": 5411, "kind": "member", "name": "texturePerObjectInstanceMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108037,7 +108253,7 @@ } }, { - "__docId__": 5404, + "__docId__": 5412, "kind": "member", "name": "texturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108054,7 +108270,7 @@ } }, { - "__docId__": 5405, + "__docId__": 5413, "kind": "member", "name": "texturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108071,7 +108287,7 @@ } }, { - "__docId__": 5406, + "__docId__": 5414, "kind": "member", "name": "texturePerLineIdPortionIds8Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108088,7 +108304,7 @@ } }, { - "__docId__": 5407, + "__docId__": 5415, "kind": "member", "name": "texturePerLineIdPortionIds16Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108105,7 +108321,7 @@ } }, { - "__docId__": 5408, + "__docId__": 5416, "kind": "member", "name": "texturePerLineIdPortionIds32Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108122,7 +108338,7 @@ } }, { - "__docId__": 5409, + "__docId__": 5417, "kind": "member", "name": "texturePerLineIdIndices8Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108139,7 +108355,7 @@ } }, { - "__docId__": 5410, + "__docId__": 5418, "kind": "member", "name": "texturePerLineIdIndices16Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108156,7 +108372,7 @@ } }, { - "__docId__": 5411, + "__docId__": 5419, "kind": "member", "name": "texturePerLineIdIndices32Bits", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108173,7 +108389,7 @@ } }, { - "__docId__": 5412, + "__docId__": 5420, "kind": "member", "name": "textureModelMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108190,7 +108406,7 @@ } }, { - "__docId__": 5413, + "__docId__": 5421, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108206,7 +108422,7 @@ "return": null }, { - "__docId__": 5414, + "__docId__": 5422, "kind": "member", "name": "indicesPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108223,7 +108439,7 @@ } }, { - "__docId__": 5415, + "__docId__": 5423, "kind": "member", "name": "indicesPortionIdsPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108240,7 +108456,7 @@ } }, { - "__docId__": 5416, + "__docId__": 5424, "kind": "method", "name": "bindCommonTextures", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108287,7 +108503,7 @@ "return": null }, { - "__docId__": 5417, + "__docId__": 5425, "kind": "method", "name": "bindLineIndicesTextures", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesState.js~DTXLinesState", @@ -108328,18 +108544,18 @@ "return": null }, { - "__docId__": 5418, + "__docId__": 5426, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js", "content": "import {BindableDataTexture} from \"./../BindableDataTexture.js\";\nimport {dataTextureRamStats} from \"./dataTextureRamStats.js\";\n\n/**\n * @private\n */\nexport class DTXLinesTextureFactory {\n /**\n * Enables the currently binded ````WebGLTexture```` to be used as a data texture.\n *\n * @param {WebGL2RenderingContext} gl\n *\n * @private\n */\n disableBindedTextureFiltering(gl) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n }\n\n /**\n * This will generate an RGBA texture for:\n * - colors\n * - pickColors\n * - flags\n * - flags2\n * - vertex bases\n * - vertex base offsets\n *\n * The texture will have:\n * - 4 RGBA columns per row: for each object (pick) color and flags(2)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike>} colors Array of colors for all objects in the layer\n * @param {ArrayLike>} pickColors Array of pickColors for all objects in the layer\n * @param {ArrayLike} vertexBases Array of position-index-bases foteh all objects in the layer\n * @param {ArrayLike} indexBaseOffsets For lines: array of offests between the (gl_VertexID / 2) and the position where the indices start in the texture layer\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForColorsAndFlags(gl, colors, pickColors, vertexBases, indexBaseOffsets) {\n const numPortions = colors.length;\n\n // The number of rows in the texture is the number of\n // objects in the layer.\n\n this.numPortions = numPortions;\n\n const textureWidth = 512 * 8;\n const textureHeight = Math.ceil(numPortions / (textureWidth / 8));\n\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n\n // 8 columns per texture row:\n // - col0: (RGBA) object color RGBA\n // - col1: (packed Uint32 as RGBA) object pick color\n // - col2: (packed 4 bytes as RGBA) object flags\n // - col3: (packed 4 bytes as RGBA) object flags2\n // - col4: (packed Uint32 bytes as RGBA) vertex base\n // - col5: (packed Uint32 bytes as RGBA) index base offset\n\n\n // // - col6: (packed Uint32 bytes as RGBA) edge index base offset\n // // - col7: (packed 4 bytes as RGBA) is-solid flag for objects\n\n const texArray = new Uint8Array(4 * textureWidth * textureHeight);\n\n dataTextureRamStats.sizeDataColorsAndFlags += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n\n for (let i = 0; i < numPortions; i++) {\n // object color\n texArray.set(colors [i], i * 32 + 0);\n texArray.set(pickColors [i], i * 32 + 4); // object pick color\n texArray.set([0, 0, 0, 0], i * 32 + 8); // object flags\n texArray.set([0, 0, 0, 0], i * 32 + 12); // object flags2\n\n // vertex base\n texArray.set([\n (vertexBases[i] >> 24) & 255,\n (vertexBases[i] >> 16) & 255,\n (vertexBases[i] >> 8) & 255,\n (vertexBases[i]) & 255,\n ],\n i * 32 + 16\n );\n\n // lines index base offset\n texArray.set(\n [\n (indexBaseOffsets[i] >> 24) & 255,\n (indexBaseOffsets[i] >> 16) & 255,\n (indexBaseOffsets[i] >> 8) & 255,\n (indexBaseOffsets[i]) & 255,\n ],\n i * 32 + 20\n );\n\n // // edge index base offset\n // texArray.set(\n // [\n // (edgeIndexBaseOffsets[i] >> 24) & 255,\n // (edgeIndexBaseOffsets[i] >> 16) & 255,\n // (edgeIndexBaseOffsets[i] >> 8) & 255,\n // (edgeIndexBaseOffsets[i]) & 255,\n // ],\n // i * 32 + 24\n // );\n //\n // // is-solid flag\n // texArray.set([solid[i] ? 1 : 0, 0, 0, 0], i * 32 + 28);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA_INTEGER, gl.UNSIGNED_BYTE, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all object offsets.\n *\n * @param {WebGL2RenderingContext} gl\n * @param {int[]} offsets Array of int[3], one XYZ offset array for each object\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForObjectOffsets(gl, numOffsets) {\n const textureWidth = 512;\n const textureHeight = Math.ceil(numOffsets / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArray = new Float32Array(3 * textureWidth * textureHeight).fill(0);\n dataTextureRamStats.sizeDataTextureOffsets += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all positions decode matrices in the layer.\n *\n * The texture will have:\n * - 4 RGBA columns per row (each column will contain 4 packed half-float (16 bits) components).\n * Thus, each row will contain 16 packed half-floats corresponding to a complete positions decode matrix)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} instanceMatrices Array of geometry instancing matrices for all objects in the layer. Null if the objects are not instanced.\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForInstancingMatrices(gl, instanceMatrices) {\n const numMatrices = instanceMatrices.length;\n if (numMatrices === 0) {\n throw \"num instance matrices===0\";\n }\n // in one row we can fit 512 matrices\n const textureWidth = 512 * 4;\n const textureHeight = Math.ceil(numMatrices / (textureWidth / 4));\n const texArray = new Float32Array(4 * textureWidth * textureHeight);\n // dataTextureRamStats.sizeDataPositionDecodeMatrices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0; i < instanceMatrices.length; i++) { // 4x4 values\n texArray.set(instanceMatrices[i], i * 16);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all positions decode matrices in the layer.\n *\n * The texture will have:\n * - 4 RGBA columns per row (each column will contain 4 packed half-float (16 bits) components).\n * Thus, each row will contain 16 packed half-floats corresponding to a complete positions decode matrix)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} positionDecodeMatrices Array of positions decode matrices for all objects in the layer\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForPositionsDecodeMatrices(gl, positionDecodeMatrices) {\n const numMatrices = positionDecodeMatrices.length;\n if (numMatrices === 0) {\n throw \"num decode+entity matrices===0\";\n }\n // in one row we can fit 512 matrices\n const textureWidth = 512 * 4;\n const textureHeight = Math.ceil(numMatrices / (textureWidth / 4));\n const texArray = new Float32Array(4 * textureWidth * textureHeight);\n dataTextureRamStats.sizeDataPositionDecodeMatrices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0; i < positionDecodeMatrices.length; i++) { // 4x4 values\n texArray.set(positionDecodeMatrices[i], i * 16);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n generateTextureFor8BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint8Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB8UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_BYTE, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n generateTextureFor16BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint16Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n generateTextureFor32BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint32Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB32UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_INT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} positionsArrays Arrays of quantized positions in the layer\n * @param lenPositions\n *\n * This will generate a texture for positions in the layer.\n *\n * The texture will have:\n * - 1024 columns, where each pixel will be a 16-bit-per-component RGB texture, corresponding to the XYZ of the position\n * - a number of rows R where R*1024 is just >= than the number of vertices (positions / 3)\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForPositions(gl, positionsArrays, lenPositions) {\n const numVertices = lenPositions / 3;\n const textureWidth = 4096;\n const textureHeight = Math.ceil(numVertices / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint16Array(texArraySize);\n dataTextureRamStats.sizeDataTexturePositions += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = positionsArrays.length; i < len; i++) {\n const pc = positionsArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} portionIdsArray\n *\n * @returns {BindableDataTexture}\n */\n generateTextureForPackedPortionIds(gl, portionIdsArray) {\n if (portionIdsArray.length === 0) {\n return {texture: null, textureHeight: 0};\n }\n const lenArray = portionIdsArray.length;\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenArray / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight;\n const texArray = new Uint16Array(texArraySize);\n texArray.set(portionIdsArray, 0);\n dataTextureRamStats.sizeDataTexturePortionIds += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RED_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5419, + "__docId__": 5427, "kind": "class", "name": "DTXLinesTextureFactory", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js", @@ -108355,7 +108571,7 @@ "ignore": true }, { - "__docId__": 5420, + "__docId__": 5428, "kind": "method", "name": "disableBindedTextureFiltering", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108382,7 +108598,7 @@ "return": null }, { - "__docId__": 5421, + "__docId__": 5429, "kind": "method", "name": "generateTextureForColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108461,7 +108677,7 @@ } }, { - "__docId__": 5422, + "__docId__": 5430, "kind": "member", "name": "numPortions", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108478,7 +108694,7 @@ } }, { - "__docId__": 5423, + "__docId__": 5431, "kind": "method", "name": "generateTextureForObjectOffsets", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108527,7 +108743,7 @@ } }, { - "__docId__": 5424, + "__docId__": 5432, "kind": "method", "name": "generateTextureForInstancingMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108576,7 +108792,7 @@ } }, { - "__docId__": 5425, + "__docId__": 5433, "kind": "method", "name": "generateTextureForPositionsDecodeMatrices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108625,7 +108841,7 @@ } }, { - "__docId__": 5426, + "__docId__": 5434, "kind": "method", "name": "generateTextureFor8BitIndices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108684,7 +108900,7 @@ } }, { - "__docId__": 5427, + "__docId__": 5435, "kind": "method", "name": "generateTextureFor16BitIndices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108743,7 +108959,7 @@ } }, { - "__docId__": 5428, + "__docId__": 5436, "kind": "method", "name": "generateTextureFor32BitIndices", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108802,7 +109018,7 @@ } }, { - "__docId__": 5429, + "__docId__": 5437, "kind": "method", "name": "generateTextureForPositions", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108861,7 +109077,7 @@ } }, { - "__docId__": 5430, + "__docId__": 5438, "kind": "method", "name": "generateTextureForPackedPortionIds", "memberof": "src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js~DTXLinesTextureFactory", @@ -108910,18 +109126,18 @@ } }, { - "__docId__": 5431, + "__docId__": 5439, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/dataTextureRamStats.js", "content": "export const dataTextureRamStats = {\n sizeDataColorsAndFlags: 0,\n sizeDataPositionDecodeMatrices: 0,\n sizeDataTextureOffsets: 0,\n sizeDataTexturePositions: 0,\n sizeDataTextureIndices: 0,\n sizeDataTexturePortionIds: 0,\n numberOfGeometries: 0,\n numberOfPortions: 0,\n numberOfLayers: 0,\n numberOfTextures: 0,\n totalLines: 0,\n totalLines8Bits: 0,\n totalLines16Bits: 0,\n totalLines32Bits: 0,\n cannotCreatePortion: {\n because10BitsObjectId: 0,\n becauseTextureSize: 0,\n },\n overheadSizeAlignementIndices: 0,\n overheadSizeAlignementEdgeIndices: 0,\n};\n\nwindow.printDataTextureRamStats = function () {\n\n console.log(JSON.stringify(dataTextureRamStats, null, 4));\n\n let totalRamSize = 0;\n\n Object.keys(dataTextureRamStats).forEach(key => {\n if (key.startsWith(\"size\")) {\n totalRamSize += dataTextureRamStats[key];\n }\n });\n\n console.log(`Total size ${totalRamSize} bytes (${(totalRamSize / 1000 / 1000).toFixed(2)} MB)`);\n console.log(`Avg bytes / triangle: ${(totalRamSize / dataTextureRamStats.totalLines).toFixed(2)}`);\n\n let percentualRamStats = {};\n\n Object.keys(dataTextureRamStats).forEach(key => {\n if (key.startsWith(\"size\")) {\n percentualRamStats[key] =\n `${(dataTextureRamStats[key] / totalRamSize * 100).toFixed(2)} % of total`;\n }\n });\n\n console.log(JSON.stringify({percentualRamUsage: percentualRamStats}, null, 4));\n};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/dataTextureRamStats.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/dataTextureRamStats.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5432, + "__docId__": 5440, "kind": "variable", "name": "dataTextureRamStats", "memberof": "src/viewer/scene/model/dtx/lines/dataTextureRamStats.js", @@ -108941,7 +109157,7 @@ } }, { - "__docId__": 5433, + "__docId__": 5441, "kind": "function", "name": "printDataTextureRamStats", "memberof": "src/viewer/scene/model/dtx/lines/dataTextureRamStats.js", @@ -108961,18 +109177,18 @@ "ignore": true }, { - "__docId__": 5434, + "__docId__": 5442, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", "content": "/**\n * @author https://github.com/tmarti, with support from https://tribia.com/\n * @license MIT\n **/\n\nconst MAX_RE_BUCKET_FAN_OUT = 8;\n\nlet compareEdgeIndices = null;\n\nfunction compareIndices(a, b) {\n let retVal = compareEdgeIndices[a * 2] - compareEdgeIndices[b * 2];\n if (retVal !== 0) {\n return retVal;\n }\n return compareEdgeIndices[a * 2 + 1] - compareEdgeIndices[b * 2 + 1];\n}\n\nfunction preSortEdgeIndices(edgeIndices) {\n if ((edgeIndices || []).length === 0) {\n return [];\n }\n let seq = new Int32Array(edgeIndices.length / 2);\n for (let i = 0, len = seq.length; i < len; i++) {\n seq[i] = i;\n }\n for (let i = 0, j = 0, len = edgeIndices.length; i < len; i += 2) {\n if (edgeIndices[i] > edgeIndices[i + 1]) {\n let tmp = edgeIndices[i];\n edgeIndices[i] = edgeIndices[i + 1];\n edgeIndices[i + 1] = tmp;\n }\n }\n compareEdgeIndices = new Int32Array(edgeIndices);\n seq.sort(compareIndices);\n const sortedEdgeIndices = new Int32Array(edgeIndices.length);\n for (let i = 0, len = seq.length; i < len; i++) {\n sortedEdgeIndices[i * 2 + 0] = edgeIndices[seq[i] * 2 + 0];\n sortedEdgeIndices[i * 2 + 1] = edgeIndices[seq[i] * 2 + 1];\n }\n return sortedEdgeIndices;\n}\n\n/**\n * @param {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}} mesh\n * @param {number} bitsPerBucket\n * @param {boolean} checkResult\n *\n * @returns {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}[]}\n */\nfunction rebucketPositions(mesh, bitsPerBucket, checkResult = false) {\n const positionsCompressed = (mesh.positionsCompressed || []);\n const edgeIndices = preSortEdgeIndices(mesh.edgeIndices || []);\n\n function edgeSearch(el0, el1) { // Code adapted from https://stackoverflow.com/questions/22697936/binary-search-in-javascript\n if (el0 > el1) {\n let tmp = el0;\n el0 = el1;\n el1 = tmp;\n }\n\n function compare_fn(a, b) {\n if (a !== el0) {\n return el0 - a;\n }\n if (b !== el1) {\n return el1 - b;\n }\n return 0;\n }\n\n let m = 0;\n let n = (edgeIndices.length >> 1) - 1;\n while (m <= n) {\n const k = (n + m) >> 1;\n const cmp = compare_fn(edgeIndices[k * 2], edgeIndices[k * 2 + 1]);\n if (cmp > 0) {\n m = k + 1;\n } else if (cmp < 0) {\n n = k - 1;\n } else {\n return k;\n }\n }\n return -m - 1;\n }\n\n const alreadyOutputEdgeIndices = new Int32Array(edgeIndices.length / 2);\n alreadyOutputEdgeIndices.fill(0);\n\n const numPositions = positionsCompressed.length / 3;\n\n if (numPositions > ((1 << bitsPerBucket) * MAX_RE_BUCKET_FAN_OUT)) {\n return [mesh];\n }\n\n const bucketIndicesRemap = new Int32Array(numPositions);\n bucketIndicesRemap.fill(-1);\n\n const buckets = [];\n\n function addEmptyBucket() {\n bucketIndicesRemap.fill(-1);\n\n const newBucket = {\n positionsCompressed: [],\n indices: [],\n edgeIndices: [],\n maxNumPositions: (1 << bitsPerBucket) - bitsPerBucket,\n numPositions: 0,\n bucketNumber: buckets.length,\n };\n\n buckets.push(newBucket);\n\n return newBucket;\n }\n\n let currentBucket = addEmptyBucket();\n\n // let currentBucket = 0;\n\n let retVal = 0;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n let additonalPositionsInBucket = 0;\n const ii0 = indices[i];\n const ii1 = indices[i + 1];\n const ii2 = indices[i + 2];\n if (bucketIndicesRemap[ii0] === -1) {\n additonalPositionsInBucket++;\n }\n if (bucketIndicesRemap[ii1] === -1) {\n additonalPositionsInBucket++;\n }\n if (bucketIndicesRemap[ii2] === -1) {\n additonalPositionsInBucket++;\n }\n if ((additonalPositionsInBucket + currentBucket.numPositions) > currentBucket.maxNumPositions) {\n currentBucket = addEmptyBucket();\n }\n if (currentBucket.bucketNumber > MAX_RE_BUCKET_FAN_OUT) {\n return [mesh];\n }\n if (bucketIndicesRemap[ii0] === -1) {\n bucketIndicesRemap[ii0] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3 + 2]);\n }\n if (bucketIndicesRemap[ii1] === -1) {\n bucketIndicesRemap[ii1] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3 + 2]);\n }\n if (bucketIndicesRemap[ii2] === -1) {\n bucketIndicesRemap[ii2] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3 + 2]);\n }\n // Check possible edge1\n let edgeIndex;\n if ((edgeIndex = edgeSearch(ii0, ii1)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n if ((edgeIndex = edgeSearch(ii0, ii2)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n if ((edgeIndex = edgeSearch(ii1, ii2)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n }\n\n const prevBytesPerIndex = bitsPerBucket / 8 * 2;\n const newBytesPerIndex = bitsPerBucket / 8;\n\n const originalSize = positionsCompressed.length * 2 + (indices.length + edgeIndices.length) * prevBytesPerIndex;\n\n let newSize = 0;\n let newPositions = -positionsCompressed.length / 3;\n\n buckets.forEach(bucket => {\n newSize += bucket.positionsCompressed.length * 2 + (bucket.indices.length + bucket.edgeIndices.length) * newBytesPerIndex;\n newPositions += bucket.positionsCompressed.length / 3;\n });\n if (newSize > originalSize) {\n return [mesh];\n }\n if (checkResult) {\n doCheckResult(buckets, mesh);\n }\n return buckets;\n}\n\nexport {rebucketPositions}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/rebucketPositions.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/rebucketPositions.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5435, + "__docId__": 5443, "kind": "variable", "name": "MAX_RE_BUCKET_FAN_OUT", "memberof": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", @@ -109002,7 +109218,7 @@ "ignore": true }, { - "__docId__": 5436, + "__docId__": 5444, "kind": "variable", "name": "compareEdgeIndices", "memberof": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", @@ -109023,7 +109239,7 @@ "ignore": true }, { - "__docId__": 5437, + "__docId__": 5445, "kind": "function", "name": "compareIndices", "memberof": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", @@ -109060,7 +109276,7 @@ "ignore": true }, { - "__docId__": 5438, + "__docId__": 5446, "kind": "function", "name": "preSortEdgeIndices", "memberof": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", @@ -109091,7 +109307,7 @@ "ignore": true }, { - "__docId__": 5439, + "__docId__": 5447, "kind": "function", "name": "rebucketPositions", "memberof": "src/viewer/scene/model/dtx/lines/rebucketPositions.js", @@ -109153,18 +109369,18 @@ } }, { - "__docId__": 5440, + "__docId__": 5448, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXLinesColorRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const scene = this._scene;\n const camera = scene.camera;\n const model = dataTextureLayer.model;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = camera.viewMatrix;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx, state);\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uPerObjectDecodeMatrix,\n this._uPerVertexPosition,\n this.uPerObjectColorAndFlags,\n this._uPerObjectMatrix\n );\n\n let rtcViewMatrix;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n } else {\n rtcViewMatrix = viewMatrix;\n }\n\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n gl.uniform1i(this._uRenderPass, renderPass);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindLineIndicesTextures(\n this._program,\n this._uPerLineObject,\n this._uPerLineIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.LINES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindLineIndicesTextures(\n this._program,\n this._uPerLineObject,\n this._uPerLineIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.LINES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindLineIndicesTextures(\n this._program,\n this._uPerLineObject,\n this._uPerLineIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.LINES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n console.error(this.errors);\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uPerObjectDecodeMatrix = \"uPerObjectDecodeMatrix\";\n this.uPerObjectColorAndFlags = \"uPerObjectColorAndFlags\";\n this._uPerVertexPosition = \"uPerVertexPosition\";\n this._uPerLineIndices = \"uPerLineIndices\";\n this._uPerLineObject = \"uPerLineObject\";\n this._uPerObjectMatrix= \"uPerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const project = scene.camera.project;\n program.bind();\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// LinesDataTextureColorRenderer\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n // src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uPerObjectDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uPerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uPerObjectColorAndFlags;\");\n src.push(\"uniform mediump usampler2D uPerVertexPosition;\");\n src.push(\"uniform highp usampler2D uPerLineIndices;\");\n src.push(\"uniform mediump usampler2D uPerLineObject;\");\n\n // src.push(\"uniform vec4 color;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out vec4 vColor;\");\n src.push(\"void main(void) {\");\n\n src.push(\" int lineIndex = gl_VertexID / 2;\")\n\n src.push(\" int h_packed_object_id_index = (lineIndex >> 3) & 4095;\")\n src.push(\" int v_packed_object_id_index = (lineIndex >> 3) >> 12;\")\n\n src.push(\" int objectIndex = int(texelFetch(uPerLineObject, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n\n src.push(\" ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n src.push(\" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(` if (int(flags.x) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\" } else {\");\n\n src.push(\" ivec4 packedVertexBase = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n src.push(\" ivec4 packedLineIndexBaseOffset = ivec4(texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));\");\n src.push(\" int lineIndexBaseOffset = (packedLineIndexBaseOffset.r << 24) + (packedLineIndexBaseOffset.g << 16) + (packedLineIndexBaseOffset.b << 8) + packedLineIndexBaseOffset.a;\");\n src.push(\" int h_index = (lineIndex - lineIndexBaseOffset) & 4095;\")\n src.push(\" int v_index = (lineIndex - lineIndexBaseOffset) >> 12;\")\n src.push(\" ivec3 vertexIndices = ivec3(texelFetch(uPerLineIndices, ivec2(h_index, v_index), 0));\");\n src.push(\" ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\" int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;\")\n src.push(\" int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;\")\n\n src.push(\" mat4 objectInstanceMatrix = mat4 (texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\" mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uPerObjectDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\" uvec4 flags = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\" uvec4 flags2 = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n src.push(\" vec3 position = vec3(texelFetch(uPerVertexPosition, ivec2(indexPositionH, indexPositionV), 0));\")\n\n src.push(\" uvec4 color = texelFetch (uPerObjectColorAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n src.push(` if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\" };\");\n src.push(\" vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.r;\");\n }\n src.push(\" vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" vFragDepth = 1.0 + clipPos.w;\");\n src.push(\" isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\" gl_Position = clipPos;\");\n src.push(\" vec4 rgb = vec4(color.rgba);\");\n src.push(\" vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// LinesDataTextureColorRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5441, + "__docId__": 5449, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", @@ -109185,7 +109401,7 @@ "ignore": true }, { - "__docId__": 5442, + "__docId__": 5450, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", @@ -109206,7 +109422,7 @@ "ignore": true }, { - "__docId__": 5443, + "__docId__": 5451, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", @@ -109227,7 +109443,7 @@ "ignore": true }, { - "__docId__": 5444, + "__docId__": 5452, "kind": "class", "name": "DTXLinesColorRenderer", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js", @@ -109243,7 +109459,7 @@ "ignore": true }, { - "__docId__": 5445, + "__docId__": 5453, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109257,7 +109473,7 @@ "undocument": true }, { - "__docId__": 5446, + "__docId__": 5454, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109275,7 +109491,7 @@ } }, { - "__docId__": 5447, + "__docId__": 5455, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109293,7 +109509,7 @@ } }, { - "__docId__": 5448, + "__docId__": 5456, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109313,7 +109529,7 @@ } }, { - "__docId__": 5449, + "__docId__": 5457, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109334,7 +109550,7 @@ } }, { - "__docId__": 5450, + "__docId__": 5458, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109369,7 +109585,7 @@ "return": null }, { - "__docId__": 5451, + "__docId__": 5459, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109386,7 +109602,7 @@ "return": null }, { - "__docId__": 5452, + "__docId__": 5460, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109404,7 +109620,7 @@ } }, { - "__docId__": 5453, + "__docId__": 5461, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109421,7 +109637,7 @@ } }, { - "__docId__": 5454, + "__docId__": 5462, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109439,7 +109655,7 @@ } }, { - "__docId__": 5455, + "__docId__": 5463, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109457,7 +109673,7 @@ } }, { - "__docId__": 5456, + "__docId__": 5464, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109475,7 +109691,7 @@ } }, { - "__docId__": 5457, + "__docId__": 5465, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109493,7 +109709,7 @@ } }, { - "__docId__": 5458, + "__docId__": 5466, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109511,7 +109727,7 @@ } }, { - "__docId__": 5459, + "__docId__": 5467, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109529,7 +109745,7 @@ } }, { - "__docId__": 5460, + "__docId__": 5468, "kind": "member", "name": "uPerObjectDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109546,7 +109762,7 @@ } }, { - "__docId__": 5461, + "__docId__": 5469, "kind": "member", "name": "uPerObjectColorAndFlags", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109563,7 +109779,7 @@ } }, { - "__docId__": 5462, + "__docId__": 5470, "kind": "member", "name": "_uPerVertexPosition", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109581,7 +109797,7 @@ } }, { - "__docId__": 5463, + "__docId__": 5471, "kind": "member", "name": "_uPerLineIndices", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109599,7 +109815,7 @@ } }, { - "__docId__": 5464, + "__docId__": 5472, "kind": "member", "name": "_uPerLineObject", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109617,7 +109833,7 @@ } }, { - "__docId__": 5465, + "__docId__": 5473, "kind": "member", "name": "_uPerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109635,7 +109851,7 @@ } }, { - "__docId__": 5466, + "__docId__": 5474, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109653,7 +109869,7 @@ } }, { - "__docId__": 5467, + "__docId__": 5475, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109677,7 +109893,7 @@ "return": null }, { - "__docId__": 5468, + "__docId__": 5476, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109698,7 +109914,7 @@ } }, { - "__docId__": 5469, + "__docId__": 5477, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109719,7 +109935,7 @@ } }, { - "__docId__": 5470, + "__docId__": 5478, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109740,7 +109956,7 @@ } }, { - "__docId__": 5471, + "__docId__": 5479, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109756,7 +109972,7 @@ "return": null }, { - "__docId__": 5473, + "__docId__": 5481, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js~DTXLinesColorRenderer", @@ -109772,18 +109988,18 @@ "return": null }, { - "__docId__": 5475, + "__docId__": 5483, "kind": "file", "name": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", "content": "import {DTXLinesColorRenderer} from \"./DTXLinesColorRenderer.js\";\n\n/**\n * @private\n */\nclass DTXLinesRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n \n }\n\n eagerCreateRenders() {\n\n // Pre-initialize certain renderers that would otherwise be lazy-initialised\n // on user interaction, such as picking or emphasis, so that there is no delay\n // when user first begins interacting with the viewer.\n \n }\n \n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new DTXLinesColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n \n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let dataTextureRenderers = cachedRenderers[sceneId];\n if (!dataTextureRenderers) {\n dataTextureRenderers = new DTXLinesRenderers(scene);\n cachedRenderers[sceneId] = dataTextureRenderers;\n dataTextureRenderers._compile();\n dataTextureRenderers.eagerCreateRenders();\n scene.on(\"compile\", () => {\n dataTextureRenderers._compile();\n dataTextureRenderers.eagerCreateRenders();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n dataTextureRenderers._destroy();\n });\n }\n return dataTextureRenderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5476, + "__docId__": 5484, "kind": "class", "name": "DTXLinesRenderers", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", @@ -109799,7 +110015,7 @@ "ignore": true }, { - "__docId__": 5477, + "__docId__": 5485, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109813,7 +110029,7 @@ "undocument": true }, { - "__docId__": 5478, + "__docId__": 5486, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109831,7 +110047,7 @@ } }, { - "__docId__": 5479, + "__docId__": 5487, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109848,7 +110064,7 @@ "return": null }, { - "__docId__": 5480, + "__docId__": 5488, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109866,7 +110082,7 @@ } }, { - "__docId__": 5481, + "__docId__": 5489, "kind": "method", "name": "eagerCreateRenders", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109882,7 +110098,7 @@ "return": null }, { - "__docId__": 5482, + "__docId__": 5490, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109901,7 +110117,7 @@ } }, { - "__docId__": 5484, + "__docId__": 5492, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js~DTXLinesRenderers", @@ -109918,7 +110134,7 @@ "return": null }, { - "__docId__": 5485, + "__docId__": 5493, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", @@ -109939,7 +110155,7 @@ "ignore": true }, { - "__docId__": 5486, + "__docId__": 5494, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js", @@ -109969,18 +110185,18 @@ } }, { - "__docId__": 5487, + "__docId__": 5495, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js", "content": "/**\n * @private\n */\nexport class DTXTrianglesBuffer {\n\n constructor() {\n this.positionsCompressed = [];\n this.lenPositionsCompressed = 0;\n\n this.metallicRoughness = [];\n\n this.indices8Bits = [];\n this.lenIndices8Bits = 0;\n\n this.indices16Bits = [];\n this.lenIndices16Bits = 0;\n\n this.indices32Bits = [];\n this.lenIndices32Bits = 0;\n\n this.edgeIndices8Bits = [];\n this.lenEdgeIndices8Bits = 0;\n\n this.edgeIndices16Bits = [];\n this.lenEdgeIndices16Bits = 0;\n\n this.edgeIndices32Bits = [];\n this.lenEdgeIndices32Bits = 0;\n\n this.perObjectColors = [];\n this.perObjectPickColors = [];\n this.perObjectSolid = [];\n this.perObjectOffsets = [];\n this.perObjectPositionsDecodeMatrices = [];\n this.perObjectInstancePositioningMatrices = [];\n this.perObjectVertexBases = [];\n this.perObjectIndexBaseOffsets = [];\n this.perObjectEdgeIndexBaseOffsets = [];\n this.perTriangleNumberPortionId8Bits = [];\n this.perTriangleNumberPortionId16Bits = [];\n this.perTriangleNumberPortionId32Bits = [];\n this.perEdgeNumberPortionId8Bits = [];\n this.perEdgeNumberPortionId16Bits = [];\n this.perEdgeNumberPortionId32Bits = [];\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5488, + "__docId__": 5496, "kind": "class", "name": "DTXTrianglesBuffer", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js", @@ -109996,7 +110212,7 @@ "ignore": true }, { - "__docId__": 5489, + "__docId__": 5497, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110010,7 +110226,7 @@ "undocument": true }, { - "__docId__": 5490, + "__docId__": 5498, "kind": "member", "name": "positionsCompressed", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110027,7 +110243,7 @@ } }, { - "__docId__": 5491, + "__docId__": 5499, "kind": "member", "name": "lenPositionsCompressed", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110044,7 +110260,7 @@ } }, { - "__docId__": 5492, + "__docId__": 5500, "kind": "member", "name": "metallicRoughness", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110061,7 +110277,7 @@ } }, { - "__docId__": 5493, + "__docId__": 5501, "kind": "member", "name": "indices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110078,7 +110294,7 @@ } }, { - "__docId__": 5494, + "__docId__": 5502, "kind": "member", "name": "lenIndices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110095,7 +110311,7 @@ } }, { - "__docId__": 5495, + "__docId__": 5503, "kind": "member", "name": "indices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110112,7 +110328,7 @@ } }, { - "__docId__": 5496, + "__docId__": 5504, "kind": "member", "name": "lenIndices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110129,7 +110345,7 @@ } }, { - "__docId__": 5497, + "__docId__": 5505, "kind": "member", "name": "indices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110146,7 +110362,7 @@ } }, { - "__docId__": 5498, + "__docId__": 5506, "kind": "member", "name": "lenIndices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110163,7 +110379,7 @@ } }, { - "__docId__": 5499, + "__docId__": 5507, "kind": "member", "name": "edgeIndices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110180,7 +110396,7 @@ } }, { - "__docId__": 5500, + "__docId__": 5508, "kind": "member", "name": "lenEdgeIndices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110197,7 +110413,7 @@ } }, { - "__docId__": 5501, + "__docId__": 5509, "kind": "member", "name": "edgeIndices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110214,7 +110430,7 @@ } }, { - "__docId__": 5502, + "__docId__": 5510, "kind": "member", "name": "lenEdgeIndices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110231,7 +110447,7 @@ } }, { - "__docId__": 5503, + "__docId__": 5511, "kind": "member", "name": "edgeIndices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110248,7 +110464,7 @@ } }, { - "__docId__": 5504, + "__docId__": 5512, "kind": "member", "name": "lenEdgeIndices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110265,7 +110481,7 @@ } }, { - "__docId__": 5505, + "__docId__": 5513, "kind": "member", "name": "perObjectColors", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110282,7 +110498,7 @@ } }, { - "__docId__": 5506, + "__docId__": 5514, "kind": "member", "name": "perObjectPickColors", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110299,7 +110515,7 @@ } }, { - "__docId__": 5507, + "__docId__": 5515, "kind": "member", "name": "perObjectSolid", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110316,7 +110532,7 @@ } }, { - "__docId__": 5508, + "__docId__": 5516, "kind": "member", "name": "perObjectOffsets", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110333,7 +110549,7 @@ } }, { - "__docId__": 5509, + "__docId__": 5517, "kind": "member", "name": "perObjectPositionsDecodeMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110350,7 +110566,7 @@ } }, { - "__docId__": 5510, + "__docId__": 5518, "kind": "member", "name": "perObjectInstancePositioningMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110367,7 +110583,7 @@ } }, { - "__docId__": 5511, + "__docId__": 5519, "kind": "member", "name": "perObjectVertexBases", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110384,7 +110600,7 @@ } }, { - "__docId__": 5512, + "__docId__": 5520, "kind": "member", "name": "perObjectIndexBaseOffsets", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110401,7 +110617,7 @@ } }, { - "__docId__": 5513, + "__docId__": 5521, "kind": "member", "name": "perObjectEdgeIndexBaseOffsets", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110418,7 +110634,7 @@ } }, { - "__docId__": 5514, + "__docId__": 5522, "kind": "member", "name": "perTriangleNumberPortionId8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110435,7 +110651,7 @@ } }, { - "__docId__": 5515, + "__docId__": 5523, "kind": "member", "name": "perTriangleNumberPortionId16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110452,7 +110668,7 @@ } }, { - "__docId__": 5516, + "__docId__": 5524, "kind": "member", "name": "perTriangleNumberPortionId32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110469,7 +110685,7 @@ } }, { - "__docId__": 5517, + "__docId__": 5525, "kind": "member", "name": "perEdgeNumberPortionId8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110486,7 +110702,7 @@ } }, { - "__docId__": 5518, + "__docId__": 5526, "kind": "member", "name": "perEdgeNumberPortionId16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110503,7 +110719,7 @@ } }, { - "__docId__": 5519, + "__docId__": 5527, "kind": "member", "name": "perEdgeNumberPortionId32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js~DTXTrianglesBuffer", @@ -110520,18 +110736,18 @@ } }, { - "__docId__": 5520, + "__docId__": 5528, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js", "content": "// Imports used to complete the JSDocs arguments to methods\nimport {Program} from \"../../../../webgl/Program.js\"\n\n/**\n * @private\n */\nexport class DTXTrianglesState {\n constructor() {\n /**\n * Texture that holds colors/pickColors/flags/flags2 per-object:\n * - columns: one concept per column => color / pick-color / ...\n * - row: the object Id\n *\n * @type BindableDataTexture\n */\n this.texturePerObjectColorsAndFlags = null;\n\n /**\n * Texture that holds the XYZ offsets per-object:\n * - columns: just 1 column with the XYZ-offset\n * - row: the object Id\n *\n * @type BindableDataTexture\n */\n this.texturePerObjectOffsets = null;\n\n this.texturePerObjectInstanceMatrices = null;\n\n /**\n * Texture that holds the objectDecodeAndInstanceMatrix per-object:\n * - columns: each column is one column of the matrix\n * - row: the object Id\n *\n * @type BindableDataTexture\n */\n this.texturePerObjectPositionsDecodeMatrix = null;\n\n /**\n * Texture that holds all the `different-vertices` used by the layer.\n *\n * @type BindableDataTexture\n */\n this.texturePerVertexIdCoordinates = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given polygon-id.\n *\n * Variant of the texture for 8-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdPortionIds8Bits = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given polygon-id.\n *\n * Variant of the texture for 16-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdPortionIds16Bits = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given polygon-id.\n *\n * Variant of the texture for 32-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdPortionIds32Bits = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given edge-id.\n *\n * Variant of the texture for 8-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerEdgeIdPortionIds8Bits = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given edge-id.\n *\n * Variant of the texture for 16-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerEdgeIdPortionIds16Bits = null;\n\n /**\n * Texture that holds the PortionId that corresponds to a given edge-id.\n *\n * Variant of the texture for 32-bit based polygon-ids.\n *\n * @type BindableDataTexture\n */\n this.texturePerEdgeIdPortionIds32Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 8-bit based indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdIndices8Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 16-bit based indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdIndices16Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 32-bit based indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdIndices32Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 8-bit based edge indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdEdgeIndices8Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 16-bit based edge indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdEdgeIndices16Bits = null;\n\n /**\n * Texture that holds the unique-vertex-indices for 32-bit based edge indices.\n *\n * @type BindableDataTexture\n */\n this.texturePerPolygonIdEdgeIndices32Bits = null;\n\n /**\n * Texture that holds the model matrices\n * - columns: each column in the texture is a model matrix column.\n * - row: each row is a different model matrix.\n *\n * @type BindableDataTexture\n */\n this.textureModelMatrices = null;\n }\n\n finalize() {\n this.indicesPerBitnessTextures = {\n 8: this.texturePerPolygonIdIndices8Bits,\n 16: this.texturePerPolygonIdIndices16Bits,\n 32: this.texturePerPolygonIdIndices32Bits,\n };\n\n this.indicesPortionIdsPerBitnessTextures = {\n 8: this.texturePerPolygonIdPortionIds8Bits,\n 16: this.texturePerPolygonIdPortionIds16Bits,\n 32: this.texturePerPolygonIdPortionIds32Bits,\n };\n\n this.edgeIndicesPerBitnessTextures = {\n 8: this.texturePerPolygonIdEdgeIndices8Bits,\n 16: this.texturePerPolygonIdEdgeIndices16Bits,\n 32: this.texturePerPolygonIdEdgeIndices32Bits,\n };\n\n this.edgeIndicesPortionIdsPerBitnessTextures = {\n 8: this.texturePerEdgeIdPortionIds8Bits,\n 16: this.texturePerEdgeIdPortionIds16Bits,\n 32: this.texturePerEdgeIdPortionIds32Bits,\n };\n }\n\n /**\n *\n * @param {Program} glProgram\n * @param {string} objectDecodeMatricesShaderName\n * @param {string} vertexTextureShaderName\n * @param {string} objectAttributesTextureShaderName\n * @param {string} objectMatricesShaderName\n */\n bindCommonTextures(\n glProgram,\n objectDecodeMatricesShaderName,\n vertexTextureShaderName,\n objectAttributesTextureShaderName,\n objectMatricesShaderName\n ) {\n this.texturePerObjectPositionsDecodeMatrix.bindTexture(glProgram, objectDecodeMatricesShaderName, 1);\n this.texturePerVertexIdCoordinates.bindTexture(glProgram, vertexTextureShaderName, 2);\n this.texturePerObjectColorsAndFlags.bindTexture(glProgram, objectAttributesTextureShaderName, 3);\n this.texturePerObjectInstanceMatrices.bindTexture(glProgram, objectMatricesShaderName, 4);\n }\n\n /**\n *\n * @param {Program} glProgram\n * @param {string} portionIdsShaderName\n * @param {string} polygonIndicesShaderName\n * @param {8|16|32} textureBitness\n */\n bindTriangleIndicesTextures(\n glProgram,\n portionIdsShaderName,\n polygonIndicesShaderName,\n textureBitness,\n ) {\n this.indicesPortionIdsPerBitnessTextures[textureBitness].bindTexture(\n glProgram,\n portionIdsShaderName,\n 5 // webgl texture unit\n );\n\n this.indicesPerBitnessTextures[textureBitness].bindTexture(\n glProgram,\n polygonIndicesShaderName,\n 6 // webgl texture unit\n );\n }\n\n /**\n *\n * @param {Program} glProgram\n * @param {string} edgePortionIdsShaderName\n * @param {string} edgeIndicesShaderName\n * @param {8|16|32} textureBitness\n */\n bindEdgeIndicesTextures(\n glProgram,\n edgePortionIdsShaderName,\n edgeIndicesShaderName,\n textureBitness,\n ) {\n this.edgeIndicesPortionIdsPerBitnessTextures[textureBitness].bindTexture(\n glProgram,\n edgePortionIdsShaderName,\n 5 // webgl texture unit\n );\n\n this.edgeIndicesPerBitnessTextures[textureBitness].bindTexture(\n glProgram,\n edgeIndicesShaderName,\n 6 // webgl texture unit\n );\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5521, + "__docId__": 5529, "kind": "class", "name": "DTXTrianglesState", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js", @@ -110547,7 +110763,7 @@ "ignore": true }, { - "__docId__": 5522, + "__docId__": 5530, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110561,7 +110777,7 @@ "undocument": true }, { - "__docId__": 5523, + "__docId__": 5531, "kind": "member", "name": "texturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110580,7 +110796,7 @@ } }, { - "__docId__": 5524, + "__docId__": 5532, "kind": "member", "name": "texturePerObjectOffsets", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110599,7 +110815,7 @@ } }, { - "__docId__": 5525, + "__docId__": 5533, "kind": "member", "name": "texturePerObjectInstanceMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110616,7 +110832,7 @@ } }, { - "__docId__": 5526, + "__docId__": 5534, "kind": "member", "name": "texturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110635,7 +110851,7 @@ } }, { - "__docId__": 5527, + "__docId__": 5535, "kind": "member", "name": "texturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110654,7 +110870,7 @@ } }, { - "__docId__": 5528, + "__docId__": 5536, "kind": "member", "name": "texturePerPolygonIdPortionIds8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110673,7 +110889,7 @@ } }, { - "__docId__": 5529, + "__docId__": 5537, "kind": "member", "name": "texturePerPolygonIdPortionIds16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110692,7 +110908,7 @@ } }, { - "__docId__": 5530, + "__docId__": 5538, "kind": "member", "name": "texturePerPolygonIdPortionIds32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110711,7 +110927,7 @@ } }, { - "__docId__": 5531, + "__docId__": 5539, "kind": "member", "name": "texturePerEdgeIdPortionIds8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110730,7 +110946,7 @@ } }, { - "__docId__": 5532, + "__docId__": 5540, "kind": "member", "name": "texturePerEdgeIdPortionIds16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110749,7 +110965,7 @@ } }, { - "__docId__": 5533, + "__docId__": 5541, "kind": "member", "name": "texturePerEdgeIdPortionIds32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110768,7 +110984,7 @@ } }, { - "__docId__": 5534, + "__docId__": 5542, "kind": "member", "name": "texturePerPolygonIdIndices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110787,7 +111003,7 @@ } }, { - "__docId__": 5535, + "__docId__": 5543, "kind": "member", "name": "texturePerPolygonIdIndices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110806,7 +111022,7 @@ } }, { - "__docId__": 5536, + "__docId__": 5544, "kind": "member", "name": "texturePerPolygonIdIndices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110825,7 +111041,7 @@ } }, { - "__docId__": 5537, + "__docId__": 5545, "kind": "member", "name": "texturePerPolygonIdEdgeIndices8Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110844,7 +111060,7 @@ } }, { - "__docId__": 5538, + "__docId__": 5546, "kind": "member", "name": "texturePerPolygonIdEdgeIndices16Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110863,7 +111079,7 @@ } }, { - "__docId__": 5539, + "__docId__": 5547, "kind": "member", "name": "texturePerPolygonIdEdgeIndices32Bits", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110882,7 +111098,7 @@ } }, { - "__docId__": 5540, + "__docId__": 5548, "kind": "member", "name": "textureModelMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110901,7 +111117,7 @@ } }, { - "__docId__": 5541, + "__docId__": 5549, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110917,7 +111133,7 @@ "return": null }, { - "__docId__": 5542, + "__docId__": 5550, "kind": "member", "name": "indicesPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110934,7 +111150,7 @@ } }, { - "__docId__": 5543, + "__docId__": 5551, "kind": "member", "name": "indicesPortionIdsPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110951,7 +111167,7 @@ } }, { - "__docId__": 5544, + "__docId__": 5552, "kind": "member", "name": "edgeIndicesPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110968,7 +111184,7 @@ } }, { - "__docId__": 5545, + "__docId__": 5553, "kind": "member", "name": "edgeIndicesPortionIdsPerBitnessTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -110985,7 +111201,7 @@ } }, { - "__docId__": 5546, + "__docId__": 5554, "kind": "method", "name": "bindCommonTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -111051,7 +111267,7 @@ "return": null }, { - "__docId__": 5547, + "__docId__": 5555, "kind": "method", "name": "bindTriangleIndicesTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -111109,7 +111325,7 @@ "return": null }, { - "__docId__": 5548, + "__docId__": 5556, "kind": "method", "name": "bindEdgeIndicesTextures", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js~DTXTrianglesState", @@ -111167,18 +111383,18 @@ "return": null }, { - "__docId__": 5549, + "__docId__": 5557, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js", "content": "import {BindableDataTexture} from \"./../../BindableDataTexture.js\";\nimport {dataTextureRamStats} from \"./dataTextureRamStats.js\";\n\n/**\n * @private\n */\nexport class DTXTrianglesTextureFactory {\n\n constructor() {\n\n }\n\n /**\n * Enables the currently binded ````WebGLTexture```` to be used as a data texture.\n *\n * @param {WebGL2RenderingContext} gl\n *\n * @private\n */\n disableBindedTextureFiltering(gl) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n }\n\n /**\n * This will generate an RGBA texture for:\n * - colors\n * - pickColors\n * - flags\n * - flags2\n * - vertex bases\n * - vertex base offsets\n *\n * The texture will have:\n * - 4 RGBA columns per row: for each object (pick) color and flags(2)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike>} colors Array of colors for all objects in the layer\n * @param {ArrayLike>} pickColors Array of pickColors for all objects in the layer\n * @param {ArrayLike} vertexBases Array of position-index-bases foteh all objects in the layer\n * @param {ArrayLike} indexBaseOffsets For triangles: array of offests between the (gl_VertexID / 3) and the position where the indices start in the texture layer\n * @param {ArrayLike} edgeIndexBaseOffsets For edges: Array of offests between the (gl_VertexID / 2) and the position where the edge indices start in the texture layer\n * @param {ArrayLike} solid Array is-solid flag for all objects in the layer\n *\n * @returns {BindableDataTexture}\n */\n createTextureForColorsAndFlags(gl, colors, pickColors, vertexBases, indexBaseOffsets, edgeIndexBaseOffsets, solid) {\n const numPortions = colors.length;\n\n // The number of rows in the texture is the number of\n // objects in the layer.\n\n this.numPortions = numPortions;\n\n const textureWidth = 512 * 8;\n const textureHeight = Math.ceil(numPortions / (textureWidth / 8));\n\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n\n // 8 columns per texture row:\n // - col0: (RGBA) object color RGBA\n // - col1: (packed Uint32 as RGBA) object pick color\n // - col2: (packed 4 bytes as RGBA) object flags\n // - col3: (packed 4 bytes as RGBA) object flags2\n // - col4: (packed Uint32 bytes as RGBA) vertex base\n // - col5: (packed Uint32 bytes as RGBA) index base offset\n // - col6: (packed Uint32 bytes as RGBA) edge index base offset\n // - col7: (packed 4 bytes as RGBA) is-solid flag for objects\n\n const texArray = new Uint8Array(4 * textureWidth * textureHeight);\n\n dataTextureRamStats.sizeDataColorsAndFlags += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n\n for (let i = 0; i < numPortions; i++) {\n // object color\n texArray.set(colors [i], i * 32 + 0);\n texArray.set(pickColors [i], i * 32 + 4); // object pick color\n texArray.set([0, 0, 0, 0], i * 32 + 8); // object flags\n texArray.set([0, 0, 0, 0], i * 32 + 12); // object flags2\n\n // vertex base\n texArray.set([\n (vertexBases[i] >> 24) & 255,\n (vertexBases[i] >> 16) & 255,\n (vertexBases[i] >> 8) & 255,\n (vertexBases[i]) & 255,\n ],\n i * 32 + 16\n );\n\n // triangles index base offset\n texArray.set(\n [\n (indexBaseOffsets[i] >> 24) & 255,\n (indexBaseOffsets[i] >> 16) & 255,\n (indexBaseOffsets[i] >> 8) & 255,\n (indexBaseOffsets[i]) & 255,\n ],\n i * 32 + 20\n );\n\n // edge index base offset\n texArray.set(\n [\n (edgeIndexBaseOffsets[i] >> 24) & 255,\n (edgeIndexBaseOffsets[i] >> 16) & 255,\n (edgeIndexBaseOffsets[i] >> 8) & 255,\n (edgeIndexBaseOffsets[i]) & 255,\n ],\n i * 32 + 24\n );\n\n // is-solid flag\n texArray.set([solid[i] ? 1 : 0, 0, 0, 0], i * 32 + 28);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA_INTEGER, gl.UNSIGNED_BYTE, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all object offsets.\n *\n * @param {WebGL2RenderingContext} gl\n * @param {int[]} offsets Array of int[3], one XYZ offset array for each object\n *\n * @returns {BindableDataTexture}\n */\n createTextureForObjectOffsets(gl, numOffsets) {\n const textureWidth = 512;\n const textureHeight = Math.ceil(numOffsets / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArray = new Float32Array(3 * textureWidth * textureHeight).fill(0);\n dataTextureRamStats.sizeDataTextureOffsets += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all positions decode matrices in the layer.\n *\n * The texture will have:\n * - 4 RGBA columns per row (each column will contain 4 packed half-float (16 bits) components).\n * Thus, each row will contain 16 packed half-floats corresponding to a complete positions decode matrix)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} instanceMatrices Array of geometry instancing matrices for all objects in the layer. Null if the objects are not instanced.\n *\n * @returns {BindableDataTexture}\n */\n createTextureForInstancingMatrices(gl, instanceMatrices) {\n const numMatrices = instanceMatrices.length;\n if (numMatrices === 0) {\n throw \"num instance matrices===0\";\n }\n // in one row we can fit 512 matrices\n const textureWidth = 512 * 4;\n const textureHeight = Math.ceil(numMatrices / (textureWidth / 4));\n const texArray = new Float32Array(4 * textureWidth * textureHeight);\n // dataTextureRamStats.sizeDataPositionDecodeMatrices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0; i < instanceMatrices.length; i++) { // 4x4 values\n texArray.set(instanceMatrices[i], i * 16);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight, texArray);\n }\n\n /**\n * This will generate a texture for all positions decode matrices in the layer.\n *\n * The texture will have:\n * - 4 RGBA columns per row (each column will contain 4 packed half-float (16 bits) components).\n * Thus, each row will contain 16 packed half-floats corresponding to a complete positions decode matrix)\n * - N rows where N is the number of objects\n *\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} positionDecodeMatrices Array of positions decode matrices for all objects in the layer\n *\n * @returns {BindableDataTexture}\n */\n createTextureForPositionsDecodeMatrices(gl, positionDecodeMatrices) {\n const numMatrices = positionDecodeMatrices.length;\n if (numMatrices === 0) {\n throw \"num decode+entity matrices===0\";\n }\n // in one row we can fit 512 matrices\n const textureWidth = 512 * 4;\n const textureHeight = Math.ceil(numMatrices / (textureWidth / 4));\n const texArray = new Float32Array(4 * textureWidth * textureHeight);\n dataTextureRamStats.sizeDataPositionDecodeMatrices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0; i < positionDecodeMatrices.length; i++) { // 4x4 values\n texArray.set(positionDecodeMatrices[i], i * 16);\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA32F, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGBA, gl.FLOAT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor8BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint8Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB8UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_BYTE, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor16BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint16Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor32BitIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 3 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint32Array(texArraySize);\n dataTextureRamStats.sizeDataTextureIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB32UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_INT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor8BitsEdgeIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 2 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 2;\n const texArray = new Uint8Array(texArraySize);\n dataTextureRamStats.sizeDataTextureEdgeIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RG8UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RG_INTEGER, gl.UNSIGNED_BYTE, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor16BitsEdgeIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 2 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 2;\n const texArray = new Uint16Array(texArraySize);\n dataTextureRamStats.sizeDataTextureEdgeIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RG16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RG_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param indicesArrays\n * @param lenIndices\n *\n * @returns {BindableDataTexture}\n */\n createTextureFor32BitsEdgeIndices(gl, indicesArrays, lenIndices) {\n if (lenIndices === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenIndices / 2 / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 2;\n const texArray = new Uint32Array(texArraySize);\n dataTextureRamStats.sizeDataTextureEdgeIndices += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = indicesArrays.length; i < len; i++) {\n const pc = indicesArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RG32UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RG_INTEGER, gl.UNSIGNED_INT, texArray, 0);\n this.disableBindedTextureFiltering(gl);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} positionsArrays Arrays of quantized positions in the layer\n * @param lenPositions\n *\n * This will generate a texture for positions in the layer.\n *\n * The texture will have:\n * - 1024 columns, where each pixel will be a 16-bit-per-component RGB texture, corresponding to the XYZ of the position\n * - a number of rows R where R*1024 is just >= than the number of vertices (positions / 3)\n *\n * @returns {BindableDataTexture}\n */\n createTextureForPositions(gl, positionsArrays, lenPositions) {\n const numVertices = lenPositions / 3;\n const textureWidth = 4096;\n const textureHeight = Math.ceil(numVertices / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight * 3;\n const texArray = new Uint16Array(texArraySize);\n dataTextureRamStats.sizeDataTexturePositions += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n for (let i = 0, j = 0, len = positionsArrays.length; i < len; i++) {\n const pc = positionsArrays[i];\n texArray.set(pc, j);\n j += pc.length;\n }\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGB16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RGB_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n\n /**\n * @param {WebGL2RenderingContext} gl\n * @param {ArrayLike} portionIdsArray\n *\n * @returns {BindableDataTexture}\n */\n createTextureForPackedPortionIds(gl, portionIdsArray) {\n if (portionIdsArray.length === 0) {\n return {texture: null, textureHeight: 0,};\n }\n const lenArray = portionIdsArray.length;\n const textureWidth = 4096;\n const textureHeight = Math.ceil(lenArray / textureWidth);\n if (textureHeight === 0) {\n throw \"texture height===0\";\n }\n const texArraySize = textureWidth * textureHeight;\n const texArray = new Uint16Array(texArraySize);\n texArray.set(portionIdsArray, 0);\n dataTextureRamStats.sizeDataTexturePortionIds += texArray.byteLength;\n dataTextureRamStats.numberOfTextures++;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R16UI, textureWidth, textureHeight);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, gl.RED_INTEGER, gl.UNSIGNED_SHORT, texArray, 0);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n return new BindableDataTexture(gl, texture, textureWidth, textureHeight);\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5550, + "__docId__": 5558, "kind": "class", "name": "DTXTrianglesTextureFactory", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js", @@ -111194,7 +111410,7 @@ "ignore": true }, { - "__docId__": 5551, + "__docId__": 5559, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111208,7 +111424,7 @@ "undocument": true }, { - "__docId__": 5552, + "__docId__": 5560, "kind": "method", "name": "disableBindedTextureFiltering", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111235,7 +111451,7 @@ "return": null }, { - "__docId__": 5553, + "__docId__": 5561, "kind": "method", "name": "createTextureForColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111334,7 +111550,7 @@ } }, { - "__docId__": 5554, + "__docId__": 5562, "kind": "member", "name": "numPortions", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111351,7 +111567,7 @@ } }, { - "__docId__": 5555, + "__docId__": 5563, "kind": "method", "name": "createTextureForObjectOffsets", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111400,7 +111616,7 @@ } }, { - "__docId__": 5556, + "__docId__": 5564, "kind": "method", "name": "createTextureForInstancingMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111449,7 +111665,7 @@ } }, { - "__docId__": 5557, + "__docId__": 5565, "kind": "method", "name": "createTextureForPositionsDecodeMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111498,7 +111714,7 @@ } }, { - "__docId__": 5558, + "__docId__": 5566, "kind": "method", "name": "createTextureFor8BitIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111557,7 +111773,7 @@ } }, { - "__docId__": 5559, + "__docId__": 5567, "kind": "method", "name": "createTextureFor16BitIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111616,7 +111832,7 @@ } }, { - "__docId__": 5560, + "__docId__": 5568, "kind": "method", "name": "createTextureFor32BitIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111675,7 +111891,7 @@ } }, { - "__docId__": 5561, + "__docId__": 5569, "kind": "method", "name": "createTextureFor8BitsEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111734,7 +111950,7 @@ } }, { - "__docId__": 5562, + "__docId__": 5570, "kind": "method", "name": "createTextureFor16BitsEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111793,7 +112009,7 @@ } }, { - "__docId__": 5563, + "__docId__": 5571, "kind": "method", "name": "createTextureFor32BitsEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111852,7 +112068,7 @@ } }, { - "__docId__": 5564, + "__docId__": 5572, "kind": "method", "name": "createTextureForPositions", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111911,7 +112127,7 @@ } }, { - "__docId__": 5565, + "__docId__": 5573, "kind": "method", "name": "createTextureForPackedPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js~DTXTrianglesTextureFactory", @@ -111960,18 +112176,18 @@ } }, { - "__docId__": 5566, + "__docId__": 5574, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js", "content": "export const dataTextureRamStats = {\n sizeDataColorsAndFlags: 0,\n sizeDataPositionDecodeMatrices: 0,\n sizeDataTextureOffsets: 0,\n sizeDataTexturePositions: 0,\n sizeDataTextureIndices: 0,\n sizeDataTextureEdgeIndices: 0,\n sizeDataTexturePortionIds: 0,\n numberOfGeometries: 0,\n numberOfPortions: 0,\n numberOfLayers: 0,\n numberOfTextures: 0,\n totalPolygons: 0,\n totalPolygons8Bits: 0,\n totalPolygons16Bits: 0,\n totalPolygons32Bits: 0,\n totalEdges: 0,\n totalEdges8Bits: 0,\n totalEdges16Bits: 0,\n totalEdges32Bits: 0,\n cannotCreatePortion: {\n because10BitsObjectId: 0,\n becauseTextureSize: 0,\n },\n overheadSizeAlignementIndices: 0,\n overheadSizeAlignementEdgeIndices: 0,\n};\n\nwindow.printDataTextureRamStats = function () {\n\n console.log(JSON.stringify(dataTextureRamStats, null, 4));\n\n let totalRamSize = 0;\n\n Object.keys(dataTextureRamStats).forEach(key => {\n if (key.startsWith(\"size\")) {\n totalRamSize += dataTextureRamStats[key];\n }\n });\n\n console.log(`Total size ${totalRamSize} bytes (${(totalRamSize / 1000 / 1000).toFixed(2)} MB)`);\n console.log(`Avg bytes / triangle: ${(totalRamSize / dataTextureRamStats.totalPolygons).toFixed(2)}`);\n\n let percentualRamStats = {};\n\n Object.keys(dataTextureRamStats).forEach(key => {\n if (key.startsWith(\"size\")) {\n percentualRamStats[key] =\n `${(dataTextureRamStats[key] / totalRamSize * 100).toFixed(2)} % of total`;\n }\n });\n\n console.log(JSON.stringify({percentualRamUsage: percentualRamStats}, null, 4));\n};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5567, + "__docId__": 5575, "kind": "variable", "name": "dataTextureRamStats", "memberof": "src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js", @@ -111991,7 +112207,7 @@ } }, { - "__docId__": 5568, + "__docId__": 5576, "kind": "function", "name": "printDataTextureRamStats", "memberof": "src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js", @@ -112011,18 +112227,18 @@ "ignore": true }, { - "__docId__": 5569, + "__docId__": 5577, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\n\nconst tempVec4a = math.vec4();\n\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesColorRenderer {\n\n constructor(scene, withSAO) {\n this._scene = scene;\n this._withSAO = withSAO;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const scene = this._scene;\n const camera = scene.camera;\n const model = dataTextureLayer.model;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx, state);\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = camera.viewMatrix;\n rtcCameraEye = camera.eye;\n }\n\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const lightsState = scene._lightsState;\n\n this._program = new Program(gl, this._buildShader());\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n console.error(this.errors);\n return;\n }\n\n const program = this._program;\n\n this._uRenderPass = program.getLocation(\"renderPass\");\n\n this._uLightAmbient = program.getLocation(\"lightAmbient\");\n this._uLightColor = [];\n this._uLightDir = [];\n this._uLightPos = [];\n this._uLightAttenuation = [];\n\n const lights = lightsState.lights;\n let light;\n\n for (let i = 0, len = lights.length; i < len; i++) {\n light = lights[i];\n switch (light.type) {\n case \"dir\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = null;\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n break;\n case \"point\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = null;\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n case \"spot\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n }\n }\n\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n\n this._uSectionPlanes = [];\n\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n if (this._withSAO) {\n this._uOcclusionTexture = \"uOcclusionTexture\";\n this._uSAOParams = program.getLocation(\"uSAOParams\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const lights = scene._lightsState.lights;\n const project = scene.camera.project;\n\n program.bind();\n\n if (this._uLightAmbient) {\n gl.uniform4fv(this._uLightAmbient, scene._lightsState.getAmbientColorAndIntensity());\n }\n\n for (let i = 0, len = lights.length; i < len; i++) {\n const light = lights[i];\n\n if (this._uLightColor[i]) {\n gl.uniform4f(this._uLightColor[i], light.color[0], light.color[1], light.color[2], light.intensity);\n }\n if (this._uLightPos[i]) {\n gl.uniform3fv(this._uLightPos[i], light.pos);\n if (this._uLightAttenuation[i]) {\n gl.uniform1f(this._uLightAttenuation[i], light.attenuation);\n }\n }\n if (this._uLightDir[i]) {\n gl.uniform3fv(this._uLightDir[i], light.dir);\n }\n }\n\n if (this._withSAO) {\n const sao = scene.sao;\n const saoEnabled = sao.possible;\n if (saoEnabled) {\n const viewportWidth = gl.drawingBufferWidth;\n const viewportHeight = gl.drawingBufferHeight;\n tempVec4a[0] = viewportWidth;\n tempVec4a[1] = viewportHeight;\n tempVec4a[2] = sao.blendCutoff;\n tempVec4a[3] = sao.blendFactor;\n gl.uniform4fv(this._uSAOParams, tempVec4a);\n this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 10);\n }\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n let light;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// TrianglesDataTextureColorRenderer vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`if (int(flags.x) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n // when the geometry is not solid, if needed, flip the triangle winding\n\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n // src.push(\"vColor = vec4(vec3(1, -1, 0)*dot(normalize(position.xyz - uCameraEyeRtcInQuantizedSpace), normal), 1);\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"} else {\");\n // src.push(\"vColor = vec4(vec3(1, -1, 0)*viewNormal.z, 1);\")\n\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); \");\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec3 rgb = vec3(color.rgb) / 255.0;\");\n src.push(\"vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n\n src.push(\"}\");\n\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// TrianglesDataTextureColorRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\"}\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n //src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(vColor.rgb * ambient, 1.0);\");\n } else {\n src.push(\" outColor = vColor;\");\n }\n\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5570, + "__docId__": 5578, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112043,7 +112259,7 @@ "ignore": true }, { - "__docId__": 5571, + "__docId__": 5579, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112064,7 +112280,7 @@ "ignore": true }, { - "__docId__": 5572, + "__docId__": 5580, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112085,7 +112301,7 @@ "ignore": true }, { - "__docId__": 5573, + "__docId__": 5581, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112106,7 +112322,7 @@ "ignore": true }, { - "__docId__": 5574, + "__docId__": 5582, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112127,7 +112343,7 @@ "ignore": true }, { - "__docId__": 5575, + "__docId__": 5583, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112148,7 +112364,7 @@ "ignore": true }, { - "__docId__": 5576, + "__docId__": 5584, "kind": "class", "name": "DTXTrianglesColorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js", @@ -112164,7 +112380,7 @@ "ignore": true }, { - "__docId__": 5577, + "__docId__": 5585, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112178,7 +112394,7 @@ "undocument": true }, { - "__docId__": 5578, + "__docId__": 5586, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112196,7 +112412,7 @@ } }, { - "__docId__": 5579, + "__docId__": 5587, "kind": "member", "name": "_withSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112214,7 +112430,7 @@ } }, { - "__docId__": 5580, + "__docId__": 5588, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112232,7 +112448,7 @@ } }, { - "__docId__": 5581, + "__docId__": 5589, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112252,7 +112468,7 @@ } }, { - "__docId__": 5582, + "__docId__": 5590, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112273,7 +112489,7 @@ } }, { - "__docId__": 5583, + "__docId__": 5591, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112308,7 +112524,7 @@ "return": null }, { - "__docId__": 5584, + "__docId__": 5592, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112325,7 +112541,7 @@ "return": null }, { - "__docId__": 5585, + "__docId__": 5593, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112343,7 +112559,7 @@ } }, { - "__docId__": 5586, + "__docId__": 5594, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112360,7 +112576,7 @@ } }, { - "__docId__": 5587, + "__docId__": 5595, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112378,7 +112594,7 @@ } }, { - "__docId__": 5588, + "__docId__": 5596, "kind": "member", "name": "_uLightAmbient", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112396,7 +112612,7 @@ } }, { - "__docId__": 5589, + "__docId__": 5597, "kind": "member", "name": "_uLightColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112414,7 +112630,7 @@ } }, { - "__docId__": 5590, + "__docId__": 5598, "kind": "member", "name": "_uLightDir", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112432,7 +112648,7 @@ } }, { - "__docId__": 5591, + "__docId__": 5599, "kind": "member", "name": "_uLightPos", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112450,7 +112666,7 @@ } }, { - "__docId__": 5592, + "__docId__": 5600, "kind": "member", "name": "_uLightAttenuation", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112468,7 +112684,7 @@ } }, { - "__docId__": 5593, + "__docId__": 5601, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112486,7 +112702,7 @@ } }, { - "__docId__": 5594, + "__docId__": 5602, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112504,7 +112720,7 @@ } }, { - "__docId__": 5595, + "__docId__": 5603, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112522,7 +112738,7 @@ } }, { - "__docId__": 5596, + "__docId__": 5604, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112540,7 +112756,7 @@ } }, { - "__docId__": 5597, + "__docId__": 5605, "kind": "member", "name": "_uOcclusionTexture", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112558,7 +112774,7 @@ } }, { - "__docId__": 5598, + "__docId__": 5606, "kind": "member", "name": "_uSAOParams", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112576,7 +112792,7 @@ } }, { - "__docId__": 5599, + "__docId__": 5607, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112594,7 +112810,7 @@ } }, { - "__docId__": 5600, + "__docId__": 5608, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112611,7 +112827,7 @@ } }, { - "__docId__": 5601, + "__docId__": 5609, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112628,7 +112844,7 @@ } }, { - "__docId__": 5602, + "__docId__": 5610, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112646,7 +112862,7 @@ } }, { - "__docId__": 5603, + "__docId__": 5611, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112664,7 +112880,7 @@ } }, { - "__docId__": 5604, + "__docId__": 5612, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112682,7 +112898,7 @@ } }, { - "__docId__": 5605, + "__docId__": 5613, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112700,7 +112916,7 @@ } }, { - "__docId__": 5606, + "__docId__": 5614, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112718,7 +112934,7 @@ } }, { - "__docId__": 5607, + "__docId__": 5615, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112736,7 +112952,7 @@ } }, { - "__docId__": 5608, + "__docId__": 5616, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112760,7 +112976,7 @@ "return": null }, { - "__docId__": 5609, + "__docId__": 5617, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112781,7 +112997,7 @@ } }, { - "__docId__": 5610, + "__docId__": 5618, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112802,7 +113018,7 @@ } }, { - "__docId__": 5611, + "__docId__": 5619, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112823,7 +113039,7 @@ } }, { - "__docId__": 5612, + "__docId__": 5620, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112839,7 +113055,7 @@ "return": null }, { - "__docId__": 5614, + "__docId__": 5622, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js~DTXTrianglesColorRenderer", @@ -112855,18 +113071,18 @@ "return": null }, { - "__docId__": 5616, + "__docId__": 5624, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesDepthRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._allocate();\n this._hash = this._getHash();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const scene = this._scene;\n const camera = scene.camera;\n const model = dataTextureLayer.model;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx, state);\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = camera.viewMatrix;\n rtcCameraEye = camera.eye;\n }\n\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n\n this._program = new Program(gl, this._buildShader());\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n\n const program = this._program;\n\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPositionsDecodeMatrix = program.getLocation(\"objectDecodeAndInstanceMatrix\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const project = scene.camera.project;\n\n program.bind();\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles dataTexture draw vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n src.push(\"out highp vec2 vHighPrecisionZW;\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`if (int(flags.x) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vHighPrecisionZW = gl_Position.zw;\");\n src.push(\"}\");\n\n src.push(\"}\");\n\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Triangles dataTexture draw fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n src.push(\"in highp vec2 vHighPrecisionZW;\");\n src.push(\"out vec4 outColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\"}\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n //src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\");\n src.push(\" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); \");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5617, + "__docId__": 5625, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112887,7 +113103,7 @@ "ignore": true }, { - "__docId__": 5618, + "__docId__": 5626, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112908,7 +113124,7 @@ "ignore": true }, { - "__docId__": 5619, + "__docId__": 5627, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112929,7 +113145,7 @@ "ignore": true }, { - "__docId__": 5620, + "__docId__": 5628, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112950,7 +113166,7 @@ "ignore": true }, { - "__docId__": 5621, + "__docId__": 5629, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112971,7 +113187,7 @@ "ignore": true }, { - "__docId__": 5622, + "__docId__": 5630, "kind": "class", "name": "DTXTrianglesDepthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js", @@ -112987,7 +113203,7 @@ "ignore": true }, { - "__docId__": 5623, + "__docId__": 5631, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113001,7 +113217,7 @@ "undocument": true }, { - "__docId__": 5624, + "__docId__": 5632, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113019,7 +113235,7 @@ } }, { - "__docId__": 5625, + "__docId__": 5633, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113037,7 +113253,7 @@ } }, { - "__docId__": 5626, + "__docId__": 5634, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113057,7 +113273,7 @@ } }, { - "__docId__": 5627, + "__docId__": 5635, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113078,7 +113294,7 @@ } }, { - "__docId__": 5628, + "__docId__": 5636, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113113,7 +113329,7 @@ "return": null }, { - "__docId__": 5629, + "__docId__": 5637, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113130,7 +113346,7 @@ "return": null }, { - "__docId__": 5630, + "__docId__": 5638, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113148,7 +113364,7 @@ } }, { - "__docId__": 5631, + "__docId__": 5639, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113165,7 +113381,7 @@ } }, { - "__docId__": 5632, + "__docId__": 5640, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113183,7 +113399,7 @@ } }, { - "__docId__": 5633, + "__docId__": 5641, "kind": "member", "name": "_uPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113201,7 +113417,7 @@ } }, { - "__docId__": 5634, + "__docId__": 5642, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113219,7 +113435,7 @@ } }, { - "__docId__": 5635, + "__docId__": 5643, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113237,7 +113453,7 @@ } }, { - "__docId__": 5636, + "__docId__": 5644, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113255,7 +113471,7 @@ } }, { - "__docId__": 5637, + "__docId__": 5645, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113273,7 +113489,7 @@ } }, { - "__docId__": 5638, + "__docId__": 5646, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113291,7 +113507,7 @@ } }, { - "__docId__": 5639, + "__docId__": 5647, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113308,7 +113524,7 @@ } }, { - "__docId__": 5640, + "__docId__": 5648, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113325,7 +113541,7 @@ } }, { - "__docId__": 5641, + "__docId__": 5649, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113343,7 +113559,7 @@ } }, { - "__docId__": 5642, + "__docId__": 5650, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113361,7 +113577,7 @@ } }, { - "__docId__": 5643, + "__docId__": 5651, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113379,7 +113595,7 @@ } }, { - "__docId__": 5644, + "__docId__": 5652, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113397,7 +113613,7 @@ } }, { - "__docId__": 5645, + "__docId__": 5653, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113415,7 +113631,7 @@ } }, { - "__docId__": 5646, + "__docId__": 5654, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113433,7 +113649,7 @@ } }, { - "__docId__": 5647, + "__docId__": 5655, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113457,7 +113673,7 @@ "return": null }, { - "__docId__": 5648, + "__docId__": 5656, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113478,7 +113694,7 @@ } }, { - "__docId__": 5649, + "__docId__": 5657, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113499,7 +113715,7 @@ } }, { - "__docId__": 5650, + "__docId__": 5658, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113520,7 +113736,7 @@ } }, { - "__docId__": 5651, + "__docId__": 5659, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113536,7 +113752,7 @@ "return": null }, { - "__docId__": 5653, + "__docId__": 5661, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js~DTXTrianglesDepthRenderer", @@ -113552,18 +113768,18 @@ "return": null }, { - "__docId__": 5655, + "__docId__": 5663, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesEdgesColorRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = camera.viewMatrix;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n } else {\n rtcViewMatrix = viewMatrix;\n }\n\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numEdgeIndices8Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 8 // 8 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices8Bits);\n }\n\n if (state.numEdgeIndices16Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 16 // 16 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices16Bits);\n }\n\n if (state.numEdgeIndices32Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 32 // 32 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n\n this._program = new Program(gl, this._buildShader());\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n\n const program = this._program;\n\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n //this._aOffset = program.getAttribute(\"offset\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdEdgeIndices = \"uTexturePerPolygonIdEdgeIndices\";\n this._uTexturePerEdgeIdPortionIds = \"uTexturePerEdgeIdPortionIds\";\n this._uTexturePerObjectMatrix = \"uTexturePerObjectMatrix\";\n }\n\n _bindProgram() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const project = scene.camera.project;\n\n program.bind();\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// TrianglesDataTextureEdgesColorRenderer\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n // src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform highp sampler2D uObjectPerObjectOffsets;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerEdgeIdPortionIds;\");\n\n // src.push(\"uniform vec4 color;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int edgeIndex = gl_VertexID / 2;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (edgeIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (edgeIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.z = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT\n\n src.push(`if (int(flags.z) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));\");\n\n src.push(\"int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;\")\n src.push(\"int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;\")\n src.push(\"int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // get position\n src.push(\"vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.r;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vec4 rgb = vec4(color.rgba);\");\n //src.push(\"vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);\");\n src.push(\"vColor = vec4(float(rgb.r*0.5) / 255.0, float(rgb.g*0.5) / 255.0, float(rgb.b*0.5) / 255.0, float(rgb.a) / 255.0);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// TrianglesDataTextureEdgesColorRenderer\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5656, + "__docId__": 5664, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", @@ -113584,7 +113800,7 @@ "ignore": true }, { - "__docId__": 5657, + "__docId__": 5665, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", @@ -113605,7 +113821,7 @@ "ignore": true }, { - "__docId__": 5658, + "__docId__": 5666, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", @@ -113626,7 +113842,7 @@ "ignore": true }, { - "__docId__": 5659, + "__docId__": 5667, "kind": "class", "name": "DTXTrianglesEdgesColorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js", @@ -113642,7 +113858,7 @@ "ignore": true }, { - "__docId__": 5660, + "__docId__": 5668, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113656,7 +113872,7 @@ "undocument": true }, { - "__docId__": 5661, + "__docId__": 5669, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113674,7 +113890,7 @@ } }, { - "__docId__": 5662, + "__docId__": 5670, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113692,7 +113908,7 @@ } }, { - "__docId__": 5663, + "__docId__": 5671, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113712,7 +113928,7 @@ } }, { - "__docId__": 5664, + "__docId__": 5672, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113733,7 +113949,7 @@ } }, { - "__docId__": 5665, + "__docId__": 5673, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113768,7 +113984,7 @@ "return": null }, { - "__docId__": 5666, + "__docId__": 5674, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113785,7 +114001,7 @@ "return": null }, { - "__docId__": 5667, + "__docId__": 5675, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113803,7 +114019,7 @@ } }, { - "__docId__": 5668, + "__docId__": 5676, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113820,7 +114036,7 @@ } }, { - "__docId__": 5669, + "__docId__": 5677, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113838,7 +114054,7 @@ } }, { - "__docId__": 5670, + "__docId__": 5678, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113856,7 +114072,7 @@ } }, { - "__docId__": 5671, + "__docId__": 5679, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113874,7 +114090,7 @@ } }, { - "__docId__": 5672, + "__docId__": 5680, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113892,7 +114108,7 @@ } }, { - "__docId__": 5673, + "__docId__": 5681, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113910,7 +114126,7 @@ } }, { - "__docId__": 5674, + "__docId__": 5682, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113928,7 +114144,7 @@ } }, { - "__docId__": 5675, + "__docId__": 5683, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113945,7 +114161,7 @@ } }, { - "__docId__": 5676, + "__docId__": 5684, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113962,7 +114178,7 @@ } }, { - "__docId__": 5677, + "__docId__": 5685, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113980,7 +114196,7 @@ } }, { - "__docId__": 5678, + "__docId__": 5686, "kind": "member", "name": "_uTexturePerPolygonIdEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -113998,7 +114214,7 @@ } }, { - "__docId__": 5679, + "__docId__": 5687, "kind": "member", "name": "_uTexturePerEdgeIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114016,7 +114232,7 @@ } }, { - "__docId__": 5680, + "__docId__": 5688, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114034,7 +114250,7 @@ } }, { - "__docId__": 5681, + "__docId__": 5689, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114051,7 +114267,7 @@ "return": null }, { - "__docId__": 5682, + "__docId__": 5690, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114072,7 +114288,7 @@ } }, { - "__docId__": 5683, + "__docId__": 5691, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114093,7 +114309,7 @@ } }, { - "__docId__": 5684, + "__docId__": 5692, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114114,7 +114330,7 @@ } }, { - "__docId__": 5685, + "__docId__": 5693, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114130,7 +114346,7 @@ "return": null }, { - "__docId__": 5687, + "__docId__": 5695, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js~DTXTrianglesEdgesColorRenderer", @@ -114146,18 +114362,18 @@ "return": null }, { - "__docId__": 5689, + "__docId__": 5697, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {RENDER_PASSES} from \"../../../RENDER_PASSES.js\";\n\nconst defaultColor = new Float32Array([0, 0, 0, 1]);\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesEdgesRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = camera.viewMatrix;\n\n if (!this._program) {\n this._allocate(dataTextureLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n } else {\n rtcViewMatrix = viewMatrix;\n }\n\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n\n if (renderPass === RENDER_PASSES.EDGES_XRAYED) {\n const material = scene.xrayMaterial._state;\n const edgeColor = material.edgeColor;\n const edgeAlpha = material.edgeAlpha;\n gl.uniform4f(this._uColor, edgeColor[0], edgeColor[1], edgeColor[2], edgeAlpha);\n\n } else if (renderPass === RENDER_PASSES.EDGES_HIGHLIGHTED) {\n const material = scene.highlightMaterial._state;\n const edgeColor = material.edgeColor;\n const edgeAlpha = material.edgeAlpha;\n gl.uniform4f(this._uColor, edgeColor[0], edgeColor[1], edgeColor[2], edgeAlpha);\n\n } else if (renderPass === RENDER_PASSES.EDGES_SELECTED) {\n const material = scene.selectedMaterial._state;\n const edgeColor = material.edgeColor;\n const edgeAlpha = material.edgeAlpha;\n gl.uniform4f(this._uColor, edgeColor[0], edgeColor[1], edgeColor[2], edgeAlpha);\n\n } else {\n gl.uniform4fv(this._uColor, defaultColor);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numEdgeIndices8Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 8 // 8 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices8Bits);\n }\n\n if (state.numEdgeIndices16Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 16 // 16 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices16Bits);\n }\n\n if (state.numEdgeIndices32Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 32 // 32 bits edge indices\n );\n\n gl.drawArrays(gl.LINES, 0, state.numEdgeIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uColor = program.getLocation(\"color\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uWorldMatrix = program.getLocation(\"worldMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdEdgeIndices = \"uTexturePerPolygonIdEdgeIndices\";\n this._uTexturePerEdgeIdPortionIds = \"uTexturePerEdgeIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n }\n\n _bindProgram() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const project = scene.camera.project;\n program.bind();\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// DTXTrianglesEdgesRenderer vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n // if (scene.entityOffsetsEnabled) {\n // src.push(\"in vec3 offset;\");\n // }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerEdgeIdPortionIds;\");\n\n src.push(\"uniform vec4 color;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int edgeIndex = gl_VertexID / 2;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (edgeIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (edgeIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.z = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n\n src.push(`if (int(flags.z) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));\");\n\n src.push(\"int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;\")\n src.push(\"int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;\")\n src.push(\"int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // get position\n src.push(\"vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));\")\n\n src.push(\"mat4 matrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.r;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vColor = vec4(color.r, color.g, color.b, color.a);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// DTXTrianglesEdgesRenderer fragment shader\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"#extension GL_EXT_frag_depth : enable\");\n }\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5690, + "__docId__": 5698, "kind": "variable", "name": "defaultColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114178,7 +114394,7 @@ "ignore": true }, { - "__docId__": 5691, + "__docId__": 5699, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114199,7 +114415,7 @@ "ignore": true }, { - "__docId__": 5692, + "__docId__": 5700, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114220,7 +114436,7 @@ "ignore": true }, { - "__docId__": 5693, + "__docId__": 5701, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114241,7 +114457,7 @@ "ignore": true }, { - "__docId__": 5694, + "__docId__": 5702, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114262,7 +114478,7 @@ "ignore": true }, { - "__docId__": 5695, + "__docId__": 5703, "kind": "class", "name": "DTXTrianglesEdgesRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js", @@ -114278,7 +114494,7 @@ "ignore": true }, { - "__docId__": 5696, + "__docId__": 5704, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114292,7 +114508,7 @@ "undocument": true }, { - "__docId__": 5697, + "__docId__": 5705, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114310,7 +114526,7 @@ } }, { - "__docId__": 5698, + "__docId__": 5706, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114328,7 +114544,7 @@ } }, { - "__docId__": 5699, + "__docId__": 5707, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114348,7 +114564,7 @@ } }, { - "__docId__": 5700, + "__docId__": 5708, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114369,7 +114585,7 @@ } }, { - "__docId__": 5701, + "__docId__": 5709, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114404,7 +114620,7 @@ "return": null }, { - "__docId__": 5702, + "__docId__": 5710, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114421,7 +114637,7 @@ "return": null }, { - "__docId__": 5703, + "__docId__": 5711, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114439,7 +114655,7 @@ } }, { - "__docId__": 5704, + "__docId__": 5712, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114456,7 +114672,7 @@ } }, { - "__docId__": 5705, + "__docId__": 5713, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114474,7 +114690,7 @@ } }, { - "__docId__": 5706, + "__docId__": 5714, "kind": "member", "name": "_uColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114492,7 +114708,7 @@ } }, { - "__docId__": 5707, + "__docId__": 5715, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114510,7 +114726,7 @@ } }, { - "__docId__": 5708, + "__docId__": 5716, "kind": "member", "name": "_uWorldMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114528,7 +114744,7 @@ } }, { - "__docId__": 5709, + "__docId__": 5717, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114546,7 +114762,7 @@ } }, { - "__docId__": 5710, + "__docId__": 5718, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114564,7 +114780,7 @@ } }, { - "__docId__": 5711, + "__docId__": 5719, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114582,7 +114798,7 @@ } }, { - "__docId__": 5712, + "__docId__": 5720, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114600,7 +114816,7 @@ } }, { - "__docId__": 5713, + "__docId__": 5721, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114617,7 +114833,7 @@ } }, { - "__docId__": 5714, + "__docId__": 5722, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114634,7 +114850,7 @@ } }, { - "__docId__": 5715, + "__docId__": 5723, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114652,7 +114868,7 @@ } }, { - "__docId__": 5716, + "__docId__": 5724, "kind": "member", "name": "_uTexturePerPolygonIdEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114670,7 +114886,7 @@ } }, { - "__docId__": 5717, + "__docId__": 5725, "kind": "member", "name": "_uTexturePerEdgeIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114688,7 +114904,7 @@ } }, { - "__docId__": 5718, + "__docId__": 5726, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114706,7 +114922,7 @@ } }, { - "__docId__": 5719, + "__docId__": 5727, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114723,7 +114939,7 @@ "return": null }, { - "__docId__": 5720, + "__docId__": 5728, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114744,7 +114960,7 @@ } }, { - "__docId__": 5721, + "__docId__": 5729, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114765,7 +114981,7 @@ } }, { - "__docId__": 5722, + "__docId__": 5730, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114786,7 +115002,7 @@ } }, { - "__docId__": 5723, + "__docId__": 5731, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114802,7 +115018,7 @@ "return": null }, { - "__docId__": 5725, + "__docId__": 5733, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js~DTXTrianglesEdgesRenderer", @@ -114818,18 +115034,18 @@ "return": null }, { - "__docId__": 5727, + "__docId__": 5735, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {WEBGL_INFO} from \"../../../../webglInfo.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesNormalsRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = camera.viewMatrix;\n\n if (!this._program) {\n this._allocate(dataTextureLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(dataTextureLayer);\n }\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = tempVec3b;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n }\n\n gl.uniform1i(this._uRenderPass, renderPass);\n\n gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n\n gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);\n gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, dataTextureLayer._state.objectDecodeAndInstanceMatrix);\n\n this._aPosition.bindArrayBuffer(state.positionsBuf);\n this._aOffset.bindArrayBuffer(state.offsetsBuf);\n this._aNormal.bindArrayBuffer(state.normalsBuf);\n this._aColor.bindArrayBuffer(state.colorsBuf);// Needed for masking out transparent entities using alpha channel\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n if (this._aFlags2) {\n this._aFlags2.bindArrayBuffer(state.flags2Buf);\n }\n state.indicesBuf.bind();\n\n gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPositionsDecodeMatrix = program.getLocation(\"objectDecodeAndInstanceMatrix\");\n this._uWorldMatrix = program.getLocation(\"worldMatrix\");\n this._uWorldNormalMatrix = program.getLocation(\"worldNormalMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uViewNormalMatrix = program.getLocation(\"viewNormalMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n this._aOffset = program.getAttribute(\"offset\");\n this._aNormal = program.getAttribute(\"normal\");\n this._aColor = program.getAttribute(\"color\");\n this._aFlags = program.getAttribute(\"flags\");\n if (this._aFlags2) { // Won't be in shader when not clipping\n this._aFlags2 = program.getAttribute(\"flags2\");\n }\n if ( scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n }\n\n _bindProgram() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const project = scene.camera.project;\n this._program.bind();\n gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);\n if ( scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"// Batched geometry normals vertex shader\");\n if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\"#extension GL_EXT_frag_depth : enable\");\n }\n src.push(\"uniform int renderPass;\");\n src.push(\"attribute vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"attribute vec3 offset;\");\n }\n src.push(\"attribute vec3 normal;\");\n src.push(\"attribute vec4 color;\");\n src.push(\"attribute vec4 flags;\");\n src.push(\"attribute vec4 flags2;\");\n src.push(\"uniform mat4 worldMatrix;\");\n src.push(\"uniform mat4 worldNormalMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform mat4 viewNormalMatrix;\");\n src.push(\"uniform mat4 objectDecodeAndInstanceMatrix;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n if (WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\"out float vFragDepth;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"varying float isPerspective;\");\n }\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out vec4 vFlags2;\");\n }\n src.push(\"out vec3 vViewNormal;\");\n src.push(\"void main(void) {\");\n\n // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`if (int(flags.x) != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); \");\n src.push(\" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2;\");\n }\n src.push(\" vViewNormal = viewNormal;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n if (WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n } else {\n src.push(\"clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;\");\n src.push(\"clipPos.z *= clipPos.w;\");\n }\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry normals fragment shader\");\n\n if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\"#extension GL_EXT_frag_depth : enable\");\n }\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in vec4 vFlags2;\");\n for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (float(vFlags2.x) > 0.0);\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS[\"EXT_frag_depth\"]) {\n src.push(\" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" gl_FragColor = vec4(packNormalToRGB(vViewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5728, + "__docId__": 5736, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114850,7 +115066,7 @@ "ignore": true }, { - "__docId__": 5729, + "__docId__": 5737, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114871,7 +115087,7 @@ "ignore": true }, { - "__docId__": 5730, + "__docId__": 5738, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114892,7 +115108,7 @@ "ignore": true }, { - "__docId__": 5731, + "__docId__": 5739, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114913,7 +115129,7 @@ "ignore": true }, { - "__docId__": 5732, + "__docId__": 5740, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114934,7 +115150,7 @@ "ignore": true }, { - "__docId__": 5733, + "__docId__": 5741, "kind": "class", "name": "DTXTrianglesNormalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js", @@ -114950,7 +115166,7 @@ "ignore": true }, { - "__docId__": 5734, + "__docId__": 5742, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -114964,7 +115180,7 @@ "undocument": true }, { - "__docId__": 5735, + "__docId__": 5743, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -114982,7 +115198,7 @@ } }, { - "__docId__": 5736, + "__docId__": 5744, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115000,7 +115216,7 @@ } }, { - "__docId__": 5737, + "__docId__": 5745, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115020,7 +115236,7 @@ } }, { - "__docId__": 5738, + "__docId__": 5746, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115041,7 +115257,7 @@ } }, { - "__docId__": 5739, + "__docId__": 5747, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115076,7 +115292,7 @@ "return": null }, { - "__docId__": 5740, + "__docId__": 5748, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115093,7 +115309,7 @@ "return": null }, { - "__docId__": 5741, + "__docId__": 5749, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115111,7 +115327,7 @@ } }, { - "__docId__": 5742, + "__docId__": 5750, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115128,7 +115344,7 @@ } }, { - "__docId__": 5743, + "__docId__": 5751, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115146,7 +115362,7 @@ } }, { - "__docId__": 5744, + "__docId__": 5752, "kind": "member", "name": "_uPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115164,7 +115380,7 @@ } }, { - "__docId__": 5745, + "__docId__": 5753, "kind": "member", "name": "_uWorldMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115182,7 +115398,7 @@ } }, { - "__docId__": 5746, + "__docId__": 5754, "kind": "member", "name": "_uWorldNormalMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115200,7 +115416,7 @@ } }, { - "__docId__": 5747, + "__docId__": 5755, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115218,7 +115434,7 @@ } }, { - "__docId__": 5748, + "__docId__": 5756, "kind": "member", "name": "_uViewNormalMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115236,7 +115452,7 @@ } }, { - "__docId__": 5749, + "__docId__": 5757, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115254,7 +115470,7 @@ } }, { - "__docId__": 5750, + "__docId__": 5758, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115272,7 +115488,7 @@ } }, { - "__docId__": 5751, + "__docId__": 5759, "kind": "member", "name": "_aPosition", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115290,7 +115506,7 @@ } }, { - "__docId__": 5752, + "__docId__": 5760, "kind": "member", "name": "_aOffset", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115308,7 +115524,7 @@ } }, { - "__docId__": 5753, + "__docId__": 5761, "kind": "member", "name": "_aNormal", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115326,7 +115542,7 @@ } }, { - "__docId__": 5754, + "__docId__": 5762, "kind": "member", "name": "_aColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115344,7 +115560,7 @@ } }, { - "__docId__": 5755, + "__docId__": 5763, "kind": "member", "name": "_aFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115362,7 +115578,7 @@ } }, { - "__docId__": 5756, + "__docId__": 5764, "kind": "member", "name": "_aFlags2", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115380,7 +115596,7 @@ } }, { - "__docId__": 5757, + "__docId__": 5765, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115398,7 +115614,7 @@ } }, { - "__docId__": 5758, + "__docId__": 5766, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115415,7 +115631,7 @@ "return": null }, { - "__docId__": 5759, + "__docId__": 5767, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115436,7 +115652,7 @@ } }, { - "__docId__": 5760, + "__docId__": 5768, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115457,7 +115673,7 @@ } }, { - "__docId__": 5761, + "__docId__": 5769, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115478,7 +115694,7 @@ } }, { - "__docId__": 5762, + "__docId__": 5770, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115494,7 +115710,7 @@ "return": null }, { - "__docId__": 5764, + "__docId__": 5772, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js~DTXTrianglesNormalsRenderer", @@ -115510,18 +115726,18 @@ "return": null }, { - "__docId__": 5766, + "__docId__": 5774, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n// Logarithmic depth buffer involves an accuracy tradeoff, sacrificing\n// accuracy at close range to improve accuracy at long range. This can\n// mess up accuracy for occlusion tests, so we'll disable for now.\n\nconst ENABLE_LOG_DEPTH_BUF = false;\n\n/**\n * @private\n */\nexport class DTXTrianglesOcclusionRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (!this._program) {\n this._allocate(dataTextureLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3a;\n if (origin) {\n const rotatedOrigin = tempVec3b;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project objectInstanceMatrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uWorldMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._uPickZNear = program.getLocation(\"pickZNear\");\n this._uPickZFar = program.getLocation(\"pickZFar\");\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const project = scene.camera.project;\n\n this._program.bind();\n\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// TrianglesDataTextureOcclusionRenderer vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (ENABLE_LOG_DEPTH_BUF &&scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n // Only opaque objects can be occluders\n\n src.push(`if (int(flags.x) != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\" } else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\" if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\" position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\" }\");\n src.push(\" } else {\");\n src.push(\" vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n src.push(\" if (viewNormal.z < 0.0) {\");\n src.push(\" position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\" }\");\n src.push(\" }\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// TrianglesDataTextureColorRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (float(vFlags2) > 0.0);\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5767, + "__docId__": 5775, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115542,7 +115758,7 @@ "ignore": true }, { - "__docId__": 5768, + "__docId__": 5776, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115563,7 +115779,7 @@ "ignore": true }, { - "__docId__": 5769, + "__docId__": 5777, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115584,7 +115800,7 @@ "ignore": true }, { - "__docId__": 5770, + "__docId__": 5778, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115605,7 +115821,7 @@ "ignore": true }, { - "__docId__": 5771, + "__docId__": 5779, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115626,7 +115842,7 @@ "ignore": true }, { - "__docId__": 5772, + "__docId__": 5780, "kind": "variable", "name": "ENABLE_LOG_DEPTH_BUF", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115647,7 +115863,7 @@ "ignore": true }, { - "__docId__": 5773, + "__docId__": 5781, "kind": "class", "name": "DTXTrianglesOcclusionRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js", @@ -115663,7 +115879,7 @@ "ignore": true }, { - "__docId__": 5774, + "__docId__": 5782, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115677,7 +115893,7 @@ "undocument": true }, { - "__docId__": 5775, + "__docId__": 5783, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115695,7 +115911,7 @@ } }, { - "__docId__": 5776, + "__docId__": 5784, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115713,7 +115929,7 @@ } }, { - "__docId__": 5777, + "__docId__": 5785, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115733,7 +115949,7 @@ } }, { - "__docId__": 5778, + "__docId__": 5786, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115754,7 +115970,7 @@ } }, { - "__docId__": 5779, + "__docId__": 5787, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115789,7 +116005,7 @@ "return": null }, { - "__docId__": 5780, + "__docId__": 5788, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115806,7 +116022,7 @@ "return": null }, { - "__docId__": 5781, + "__docId__": 5789, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115824,7 +116040,7 @@ } }, { - "__docId__": 5782, + "__docId__": 5790, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115841,7 +116057,7 @@ } }, { - "__docId__": 5783, + "__docId__": 5791, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115859,7 +116075,7 @@ } }, { - "__docId__": 5784, + "__docId__": 5792, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115877,7 +116093,7 @@ } }, { - "__docId__": 5785, + "__docId__": 5793, "kind": "member", "name": "_uWorldMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115895,7 +116111,7 @@ } }, { - "__docId__": 5786, + "__docId__": 5794, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115913,7 +116129,7 @@ } }, { - "__docId__": 5787, + "__docId__": 5795, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115931,7 +116147,7 @@ } }, { - "__docId__": 5788, + "__docId__": 5796, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115949,7 +116165,7 @@ } }, { - "__docId__": 5789, + "__docId__": 5797, "kind": "member", "name": "_uPickZNear", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115967,7 +116183,7 @@ } }, { - "__docId__": 5790, + "__docId__": 5798, "kind": "member", "name": "_uPickZFar", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -115985,7 +116201,7 @@ } }, { - "__docId__": 5791, + "__docId__": 5799, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116003,7 +116219,7 @@ } }, { - "__docId__": 5792, + "__docId__": 5800, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116020,7 +116236,7 @@ } }, { - "__docId__": 5793, + "__docId__": 5801, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116037,7 +116253,7 @@ } }, { - "__docId__": 5794, + "__docId__": 5802, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116055,7 +116271,7 @@ } }, { - "__docId__": 5795, + "__docId__": 5803, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116073,7 +116289,7 @@ } }, { - "__docId__": 5796, + "__docId__": 5804, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116091,7 +116307,7 @@ } }, { - "__docId__": 5797, + "__docId__": 5805, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116109,7 +116325,7 @@ } }, { - "__docId__": 5798, + "__docId__": 5806, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116127,7 +116343,7 @@ } }, { - "__docId__": 5799, + "__docId__": 5807, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116145,7 +116361,7 @@ } }, { - "__docId__": 5800, + "__docId__": 5808, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116162,7 +116378,7 @@ "return": null }, { - "__docId__": 5801, + "__docId__": 5809, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116183,7 +116399,7 @@ } }, { - "__docId__": 5802, + "__docId__": 5810, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116204,7 +116420,7 @@ } }, { - "__docId__": 5803, + "__docId__": 5811, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116225,7 +116441,7 @@ } }, { - "__docId__": 5804, + "__docId__": 5812, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116241,7 +116457,7 @@ "return": null }, { - "__docId__": 5806, + "__docId__": 5814, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js~DTXTrianglesOcclusionRenderer", @@ -116257,18 +116473,18 @@ "return": null }, { - "__docId__": 5808, + "__docId__": 5816, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesPickDepthRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n }\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (!this._program) {\n this._allocate();\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3a;\n if (origin) {\n const rotatedOrigin = tempVec3b;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.uniform1f(this._uPickZNear, frameCtx.pickZNear);\n gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uDrawingBufferSize = program.getLocation(\"drawingBufferSize\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._uPickZNear = program.getLocation(\"pickZNear\");\n this._uPickZFar = program.getLocation(\"pickZFar\");\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles dataTexture pick depth vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n src.push(\"uniform bool pickInvisible;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec2 pickClipPos;\");\n src.push(\"uniform vec2 drawingBufferSize;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\")\n src.push(` clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;`);\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.w = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`if (int(flags.w) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.r;\");\n }\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Triangles dataTexture pick depth fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform float pickZNear;\");\n src.push(\"uniform float pickZFar;\");\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"vec4 packDepth(const in float depth) {\");\n src.push(\" const vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\");\n src.push(\" vec4 res = fract(depth * bitShift);\");\n src.push(\" res -= res.xxyz * bitMask;\");\n src.push(\" return res;\");\n src.push(\"}\");\n\n src.push(\"out vec4 outPackedDepth;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));\");\n src.push(\" outPackedDepth = packDepth(zNormalizedDepth); \"); // Must be linear depth\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5809, + "__docId__": 5817, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116289,7 +116505,7 @@ "ignore": true }, { - "__docId__": 5810, + "__docId__": 5818, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116310,7 +116526,7 @@ "ignore": true }, { - "__docId__": 5811, + "__docId__": 5819, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116331,7 +116547,7 @@ "ignore": true }, { - "__docId__": 5812, + "__docId__": 5820, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116352,7 +116568,7 @@ "ignore": true }, { - "__docId__": 5813, + "__docId__": 5821, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116373,7 +116589,7 @@ "ignore": true }, { - "__docId__": 5814, + "__docId__": 5822, "kind": "class", "name": "DTXTrianglesPickDepthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js", @@ -116389,7 +116605,7 @@ "ignore": true }, { - "__docId__": 5815, + "__docId__": 5823, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116403,7 +116619,7 @@ "undocument": true }, { - "__docId__": 5816, + "__docId__": 5824, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116421,7 +116637,7 @@ } }, { - "__docId__": 5817, + "__docId__": 5825, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116439,7 +116655,7 @@ } }, { - "__docId__": 5818, + "__docId__": 5826, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116459,7 +116675,7 @@ } }, { - "__docId__": 5819, + "__docId__": 5827, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116480,7 +116696,7 @@ } }, { - "__docId__": 5820, + "__docId__": 5828, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116515,7 +116731,7 @@ "return": null }, { - "__docId__": 5821, + "__docId__": 5829, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116532,7 +116748,7 @@ "return": null }, { - "__docId__": 5822, + "__docId__": 5830, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116550,7 +116766,7 @@ } }, { - "__docId__": 5823, + "__docId__": 5831, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116567,7 +116783,7 @@ } }, { - "__docId__": 5824, + "__docId__": 5832, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116585,7 +116801,7 @@ } }, { - "__docId__": 5825, + "__docId__": 5833, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116603,7 +116819,7 @@ } }, { - "__docId__": 5826, + "__docId__": 5834, "kind": "member", "name": "_uPickClipPos", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116621,7 +116837,7 @@ } }, { - "__docId__": 5827, + "__docId__": 5835, "kind": "member", "name": "_uDrawingBufferSize", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116639,7 +116855,7 @@ } }, { - "__docId__": 5828, + "__docId__": 5836, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116657,7 +116873,7 @@ } }, { - "__docId__": 5829, + "__docId__": 5837, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116675,7 +116891,7 @@ } }, { - "__docId__": 5830, + "__docId__": 5838, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116693,7 +116909,7 @@ } }, { - "__docId__": 5831, + "__docId__": 5839, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116711,7 +116927,7 @@ } }, { - "__docId__": 5832, + "__docId__": 5840, "kind": "member", "name": "_uPickZNear", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116729,7 +116945,7 @@ } }, { - "__docId__": 5833, + "__docId__": 5841, "kind": "member", "name": "_uPickZFar", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116747,7 +116963,7 @@ } }, { - "__docId__": 5834, + "__docId__": 5842, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116765,7 +116981,7 @@ } }, { - "__docId__": 5835, + "__docId__": 5843, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116782,7 +116998,7 @@ } }, { - "__docId__": 5836, + "__docId__": 5844, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116799,7 +117015,7 @@ } }, { - "__docId__": 5837, + "__docId__": 5845, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116817,7 +117033,7 @@ } }, { - "__docId__": 5838, + "__docId__": 5846, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116835,7 +117051,7 @@ } }, { - "__docId__": 5839, + "__docId__": 5847, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116853,7 +117069,7 @@ } }, { - "__docId__": 5840, + "__docId__": 5848, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116871,7 +117087,7 @@ } }, { - "__docId__": 5841, + "__docId__": 5849, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116889,7 +117105,7 @@ } }, { - "__docId__": 5842, + "__docId__": 5850, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116907,7 +117123,7 @@ } }, { - "__docId__": 5843, + "__docId__": 5851, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116924,7 +117140,7 @@ "return": null }, { - "__docId__": 5844, + "__docId__": 5852, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116945,7 +117161,7 @@ } }, { - "__docId__": 5845, + "__docId__": 5853, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116966,7 +117182,7 @@ } }, { - "__docId__": 5846, + "__docId__": 5854, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -116987,7 +117203,7 @@ } }, { - "__docId__": 5847, + "__docId__": 5855, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -117003,7 +117219,7 @@ "return": null }, { - "__docId__": 5849, + "__docId__": 5857, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js~DTXTrianglesPickDepthRenderer", @@ -117019,18 +117235,18 @@ "return": null }, { - "__docId__": 5851, + "__docId__": 5859, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesPickMeshRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n }\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n if (!this._program) {\n this._allocate(dataTextureLayer);\n if (this.errors) {\n return;\n }\n }\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n let rtcViewMatrix;\n let rtcCameraEye;\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = camera.viewMatrix;\n rtcCameraEye = camera.eye;\n }\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uDrawingBufferSize = program.getLocation(\"drawingBufferSize\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix = \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program.bind();\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry picking vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform bool pickInvisible;\");\n // src.push(\"uniform sampler2D uOcclusionTexture;\"); \n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec2 pickClipPos;\");\n src.push(\"uniform vec2 drawingBufferSize;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\")\n src.push(` clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;`);\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"smooth out vec4 vWorldPosition;\");\n src.push(\"flat out uvec4 vFlags2;\");\n }\n\n src.push(\"out vec4 vPickColor;\");\n\n src.push(\"void main(void) {\");\n\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.w = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`if (int(flags.w) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n // get pick-color\n src.push(\"vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;\");\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Batched geometry picking fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uvec4 vFlags2;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vPickColor;\");\n src.push(\"out vec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (float(vFlags2.x) > 0.0);\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n //src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outPickColor = vPickColor; \");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5852, + "__docId__": 5860, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", @@ -117051,7 +117267,7 @@ "ignore": true }, { - "__docId__": 5853, + "__docId__": 5861, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", @@ -117072,7 +117288,7 @@ "ignore": true }, { - "__docId__": 5854, + "__docId__": 5862, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", @@ -117093,7 +117309,7 @@ "ignore": true }, { - "__docId__": 5855, + "__docId__": 5863, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", @@ -117114,7 +117330,7 @@ "ignore": true }, { - "__docId__": 5856, + "__docId__": 5864, "kind": "class", "name": "DTXTrianglesPickMeshRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js", @@ -117130,7 +117346,7 @@ "ignore": true }, { - "__docId__": 5857, + "__docId__": 5865, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117144,7 +117360,7 @@ "undocument": true }, { - "__docId__": 5858, + "__docId__": 5866, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117162,7 +117378,7 @@ } }, { - "__docId__": 5859, + "__docId__": 5867, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117180,7 +117396,7 @@ } }, { - "__docId__": 5860, + "__docId__": 5868, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117200,7 +117416,7 @@ } }, { - "__docId__": 5861, + "__docId__": 5869, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117221,7 +117437,7 @@ } }, { - "__docId__": 5862, + "__docId__": 5870, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117256,7 +117472,7 @@ "return": null }, { - "__docId__": 5863, + "__docId__": 5871, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117273,7 +117489,7 @@ "return": null }, { - "__docId__": 5864, + "__docId__": 5872, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117291,7 +117507,7 @@ } }, { - "__docId__": 5865, + "__docId__": 5873, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117308,7 +117524,7 @@ } }, { - "__docId__": 5866, + "__docId__": 5874, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117326,7 +117542,7 @@ } }, { - "__docId__": 5867, + "__docId__": 5875, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117344,7 +117560,7 @@ } }, { - "__docId__": 5868, + "__docId__": 5876, "kind": "member", "name": "_uPickClipPos", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117362,7 +117578,7 @@ } }, { - "__docId__": 5869, + "__docId__": 5877, "kind": "member", "name": "_uDrawingBufferSize", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117380,7 +117596,7 @@ } }, { - "__docId__": 5870, + "__docId__": 5878, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117398,7 +117614,7 @@ } }, { - "__docId__": 5871, + "__docId__": 5879, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117416,7 +117632,7 @@ } }, { - "__docId__": 5872, + "__docId__": 5880, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117434,7 +117650,7 @@ } }, { - "__docId__": 5873, + "__docId__": 5881, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117452,7 +117668,7 @@ } }, { - "__docId__": 5874, + "__docId__": 5882, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117470,7 +117686,7 @@ } }, { - "__docId__": 5875, + "__docId__": 5883, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117487,7 +117703,7 @@ } }, { - "__docId__": 5876, + "__docId__": 5884, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117504,7 +117720,7 @@ } }, { - "__docId__": 5877, + "__docId__": 5885, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117522,7 +117738,7 @@ } }, { - "__docId__": 5878, + "__docId__": 5886, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117540,7 +117756,7 @@ } }, { - "__docId__": 5879, + "__docId__": 5887, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117558,7 +117774,7 @@ } }, { - "__docId__": 5880, + "__docId__": 5888, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117576,7 +117792,7 @@ } }, { - "__docId__": 5881, + "__docId__": 5889, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117594,7 +117810,7 @@ } }, { - "__docId__": 5882, + "__docId__": 5890, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117612,7 +117828,7 @@ } }, { - "__docId__": 5883, + "__docId__": 5891, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117636,7 +117852,7 @@ "return": null }, { - "__docId__": 5884, + "__docId__": 5892, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117657,7 +117873,7 @@ } }, { - "__docId__": 5885, + "__docId__": 5893, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117678,7 +117894,7 @@ } }, { - "__docId__": 5886, + "__docId__": 5894, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117699,7 +117915,7 @@ } }, { - "__docId__": 5887, + "__docId__": 5895, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117715,7 +117931,7 @@ "return": null }, { - "__docId__": 5889, + "__docId__": 5897, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js~DTXTrianglesPickMeshRenderer", @@ -117731,18 +117947,18 @@ "return": null }, { - "__docId__": 5891, + "__docId__": 5899, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\n\nconst tempVec4a = math.vec4();\n\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesPickNormalsFlatRenderer {\n\n constructor(scene, withSAO) {\n this._scene = scene;\n this._withSAO = withSAO;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const scene = this._scene;\n const camera = scene.camera;\n const model = dataTextureLayer.model;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx, state);\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = camera.viewMatrix; // TODO: make pickMatrix\n rtcCameraEye = camera.eye;\n }\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix); // TODO: pickProjMatrix\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uDrawingBufferSize = program.getLocation(\"drawingBufferSize\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix = \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const project = scene.camera.project;\n program.bind();\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n let light;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// trianglesDatatextureNormalsRenderer vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec2 pickClipPos;\");\n src.push(\"uniform vec2 drawingBufferSize;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\")\n src.push(` clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;`);\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n src.push(\"out vec4 vWorldPosition;\");\n\n if (clipping) {\n src.push(\"flat out uint vFlags2;\");\n }\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\"); // pickFlag = NOT_RENDERED | PICK\n\n // renderPass = PICK\n src.push(`if (int(flags.w) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n // get normal\n\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n // src.push(\"vColor = vec4(vec3(1, -1, 0)*dot(normalize(position.xyz - uCameraEyeRtcInQuantizedSpace), normal), 1);\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n src.push(\"vWorldPosition = worldPosition;\");\n\n if (clipping) {\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// TrianglesDataTexturePickNormalsRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"in vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\" vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(` outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5892, + "__docId__": 5900, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117763,7 +117979,7 @@ "ignore": true }, { - "__docId__": 5893, + "__docId__": 5901, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117784,7 +118000,7 @@ "ignore": true }, { - "__docId__": 5894, + "__docId__": 5902, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117805,7 +118021,7 @@ "ignore": true }, { - "__docId__": 5895, + "__docId__": 5903, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117826,7 +118042,7 @@ "ignore": true }, { - "__docId__": 5896, + "__docId__": 5904, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117847,7 +118063,7 @@ "ignore": true }, { - "__docId__": 5897, + "__docId__": 5905, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117868,7 +118084,7 @@ "ignore": true }, { - "__docId__": 5898, + "__docId__": 5906, "kind": "class", "name": "DTXTrianglesPickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js", @@ -117884,7 +118100,7 @@ "ignore": true }, { - "__docId__": 5899, + "__docId__": 5907, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117898,7 +118114,7 @@ "undocument": true }, { - "__docId__": 5900, + "__docId__": 5908, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117916,7 +118132,7 @@ } }, { - "__docId__": 5901, + "__docId__": 5909, "kind": "member", "name": "_withSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117934,7 +118150,7 @@ } }, { - "__docId__": 5902, + "__docId__": 5910, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117952,7 +118168,7 @@ } }, { - "__docId__": 5903, + "__docId__": 5911, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117972,7 +118188,7 @@ } }, { - "__docId__": 5904, + "__docId__": 5912, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -117993,7 +118209,7 @@ } }, { - "__docId__": 5905, + "__docId__": 5913, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118028,7 +118244,7 @@ "return": null }, { - "__docId__": 5906, + "__docId__": 5914, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118045,7 +118261,7 @@ "return": null }, { - "__docId__": 5907, + "__docId__": 5915, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118063,7 +118279,7 @@ } }, { - "__docId__": 5908, + "__docId__": 5916, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118080,7 +118296,7 @@ } }, { - "__docId__": 5909, + "__docId__": 5917, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118098,7 +118314,7 @@ } }, { - "__docId__": 5910, + "__docId__": 5918, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118116,7 +118332,7 @@ } }, { - "__docId__": 5911, + "__docId__": 5919, "kind": "member", "name": "_uPickClipPos", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118134,7 +118350,7 @@ } }, { - "__docId__": 5912, + "__docId__": 5920, "kind": "member", "name": "_uDrawingBufferSize", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118152,7 +118368,7 @@ } }, { - "__docId__": 5913, + "__docId__": 5921, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118170,7 +118386,7 @@ } }, { - "__docId__": 5914, + "__docId__": 5922, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118188,7 +118404,7 @@ } }, { - "__docId__": 5915, + "__docId__": 5923, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118206,7 +118422,7 @@ } }, { - "__docId__": 5916, + "__docId__": 5924, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118224,7 +118440,7 @@ } }, { - "__docId__": 5917, + "__docId__": 5925, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118242,7 +118458,7 @@ } }, { - "__docId__": 5918, + "__docId__": 5926, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118259,7 +118475,7 @@ } }, { - "__docId__": 5919, + "__docId__": 5927, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118276,7 +118492,7 @@ } }, { - "__docId__": 5920, + "__docId__": 5928, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118294,7 +118510,7 @@ } }, { - "__docId__": 5921, + "__docId__": 5929, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118312,7 +118528,7 @@ } }, { - "__docId__": 5922, + "__docId__": 5930, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118330,7 +118546,7 @@ } }, { - "__docId__": 5923, + "__docId__": 5931, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118348,7 +118564,7 @@ } }, { - "__docId__": 5924, + "__docId__": 5932, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118366,7 +118582,7 @@ } }, { - "__docId__": 5925, + "__docId__": 5933, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118384,7 +118600,7 @@ } }, { - "__docId__": 5926, + "__docId__": 5934, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118408,7 +118624,7 @@ "return": null }, { - "__docId__": 5927, + "__docId__": 5935, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118429,7 +118645,7 @@ } }, { - "__docId__": 5928, + "__docId__": 5936, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118450,7 +118666,7 @@ } }, { - "__docId__": 5929, + "__docId__": 5937, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118471,7 +118687,7 @@ } }, { - "__docId__": 5930, + "__docId__": 5938, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118487,7 +118703,7 @@ "return": null }, { - "__docId__": 5932, + "__docId__": 5940, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js~DTXTrianglesPickNormalsFlatRenderer", @@ -118503,18 +118719,18 @@ "return": null }, { - "__docId__": 5934, + "__docId__": 5942, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @private\n */\nexport class DTXTrianglesPickNormalsRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n }\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n\n if (!this._program) {\n this._allocate(dataTextureLayer);\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let cameraEye = camera.eye;\n\n // if (frameCtx.pickViewMatrix) {\n // textureState.bindPickCameraTexture(\n // this._program,\n // this._uTextureCameraMatrices\n // );\n // cameraEye = frameCtx.pickOrigin || cameraEye;\n // }\n\n const originCameraEye = [\n cameraEye[0] - origin[0],\n cameraEye[1] - origin[1],\n cameraEye[2] - origin[2],\n ];\n\n gl.uniform3fv(this._uCameraEyeRtc, originCameraEye);\n\n gl.uniform1i(this._uRenderPass, renderPass);\n\n gl.uniform3fv(this._uCameraEyeRtc, originCameraEye);\n\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far should be from projection objectInstanceMatrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n\n this._program = new Program(gl, this._buildShader());\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n\n const program = this._program;\n\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uDrawingBufferSize = program.getLocation(\"drawingBufferSize\");\n\n this._uSectionPlanes = [];\n\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles dataTexture pick normals vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform bool pickInvisible;\");\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform highp sampler2D uObjectPerObjectOffsets;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform highp sampler2D uTextureCameraMatrices;\");\n src.push(\"uniform highp sampler2D uTextureModelMatrices;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec2 drawingBufferSize;\");\n src.push(\"uniform vec2 pickClipPos;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\");\n src.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / 3.0);`);\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n\n src.push(\"out vec3 vWorldNormal;\");\n\n src.push(\"void main(void) {\");\n\n // camera matrices\n src.push(\"mat4 viewMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 0), 0));\");\n src.push(\"mat4 projMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 2), 0));\");\n\n // model matrices\n src.push(\"mat4 worldMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 0), 0), texelFetch (uTextureModelMatrices, ivec2(1, 0), 0), texelFetch (uTextureModelMatrices, ivec2(2, 0), 0), texelFetch (uTextureModelMatrices, ivec2(3, 0), 0));\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.w = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`if (int(flags.w) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\");\n \n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(worldMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"normal = -normal;\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"normal = -normal;\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"normal = -normal;\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vWorldNormal = normal.xyz;\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.w;\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n\n src.push(\"}\");\n\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Triangles dataTexture pick normals fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vWorldNormal;\");\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n // src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(` outNormal = ivec4(vWorldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5935, + "__docId__": 5943, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js", @@ -118535,7 +118751,7 @@ "ignore": true }, { - "__docId__": 5936, + "__docId__": 5944, "kind": "class", "name": "DTXTrianglesPickNormalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js", @@ -118551,7 +118767,7 @@ "ignore": true }, { - "__docId__": 5937, + "__docId__": 5945, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118565,7 +118781,7 @@ "undocument": true }, { - "__docId__": 5938, + "__docId__": 5946, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118583,7 +118799,7 @@ } }, { - "__docId__": 5939, + "__docId__": 5947, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118601,7 +118817,7 @@ } }, { - "__docId__": 5940, + "__docId__": 5948, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118621,7 +118837,7 @@ } }, { - "__docId__": 5941, + "__docId__": 5949, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118642,7 +118858,7 @@ } }, { - "__docId__": 5942, + "__docId__": 5950, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118677,7 +118893,7 @@ "return": null }, { - "__docId__": 5943, + "__docId__": 5951, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118694,7 +118910,7 @@ "return": null }, { - "__docId__": 5944, + "__docId__": 5952, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118712,7 +118928,7 @@ } }, { - "__docId__": 5945, + "__docId__": 5953, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118729,7 +118945,7 @@ } }, { - "__docId__": 5946, + "__docId__": 5954, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118747,7 +118963,7 @@ } }, { - "__docId__": 5947, + "__docId__": 5955, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118765,7 +118981,7 @@ } }, { - "__docId__": 5948, + "__docId__": 5956, "kind": "member", "name": "_uPickClipPos", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118783,7 +118999,7 @@ } }, { - "__docId__": 5949, + "__docId__": 5957, "kind": "member", "name": "_uDrawingBufferSize", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118801,7 +119017,7 @@ } }, { - "__docId__": 5950, + "__docId__": 5958, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118819,7 +119035,7 @@ } }, { - "__docId__": 5951, + "__docId__": 5959, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118837,7 +119053,7 @@ } }, { - "__docId__": 5952, + "__docId__": 5960, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118854,7 +119070,7 @@ } }, { - "__docId__": 5953, + "__docId__": 5961, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118871,7 +119087,7 @@ } }, { - "__docId__": 5954, + "__docId__": 5962, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118889,7 +119105,7 @@ } }, { - "__docId__": 5955, + "__docId__": 5963, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118907,7 +119123,7 @@ } }, { - "__docId__": 5956, + "__docId__": 5964, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118925,7 +119141,7 @@ } }, { - "__docId__": 5957, + "__docId__": 5965, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118943,7 +119159,7 @@ } }, { - "__docId__": 5958, + "__docId__": 5966, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118961,7 +119177,7 @@ } }, { - "__docId__": 5959, + "__docId__": 5967, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118979,7 +119195,7 @@ } }, { - "__docId__": 5960, + "__docId__": 5968, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -118996,7 +119212,7 @@ "return": null }, { - "__docId__": 5961, + "__docId__": 5969, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -119017,7 +119233,7 @@ } }, { - "__docId__": 5962, + "__docId__": 5970, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -119038,7 +119254,7 @@ } }, { - "__docId__": 5963, + "__docId__": 5971, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -119059,7 +119275,7 @@ } }, { - "__docId__": 5964, + "__docId__": 5972, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -119075,7 +119291,7 @@ "return": null }, { - "__docId__": 5966, + "__docId__": 5974, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js~DTXTrianglesPickNormalsRenderer", @@ -119091,18 +119307,18 @@ "return": null }, { - "__docId__": 5968, + "__docId__": 5976, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", "content": "import {DTXTrianglesColorRenderer} from \"./DTXTrianglesColorRenderer.js\";\nimport {DTXTrianglesSilhouetteRenderer} from \"./DTXTrianglesSilhouetteRenderer.js\";\nimport {DTXTrianglesEdgesRenderer} from \"./DTXTrianglesEdgesRenderer.js\";\nimport {DTXTrianglesEdgesColorRenderer} from \"./DTXTrianglesEdgesColorRenderer.js\";\nimport {DTXTrianglesPickMeshRenderer} from \"./DTXTrianglesPickMeshRenderer.js\";\nimport {DTXTrianglesPickDepthRenderer} from \"./DTXTrianglesPickDepthRenderer.js\";\nimport {DTXTrianglesSnapRenderer} from \"./DTXTrianglesSnapRenderer.js\";\nimport {DTXTrianglesSnapInitRenderer} from \"./DTXTrianglesSnapInitRenderer.js\";\nimport {DTXTrianglesOcclusionRenderer} from \"./DTXTrianglesOcclusionRenderer.js\";\nimport {DTXTrianglesDepthRenderer} from \"./DTXTrianglesDepthRenderer.js\";\nimport {DTXTrianglesNormalsRenderer} from \"./DTXTrianglesNormalsRenderer.js\";\nimport {DTXTrianglesPickNormalsFlatRenderer} from \"./DTXTrianglesPickNormalsFlatRenderer.js\";\n\n/**\n * @private\n */\nclass DTXTrianglesRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._colorRendererWithSAO && (!this._colorRendererWithSAO.getValid())) {\n this._colorRendererWithSAO.destroy();\n this._colorRendererWithSAO = null;\n }\n if (this._flatColorRenderer && (!this._flatColorRenderer.getValid())) {\n this._flatColorRenderer.destroy();\n this._flatColorRenderer = null;\n }\n if (this._flatColorRendererWithSAO && (!this._flatColorRendererWithSAO.getValid())) {\n this._flatColorRendererWithSAO.destroy();\n this._flatColorRendererWithSAO = null;\n }\n if (this._colorQualityRendererWithSAO && (!this._colorQualityRendererWithSAO.getValid())) {\n this._colorQualityRendererWithSAO.destroy();\n this._colorQualityRendererWithSAO = null;\n }\n if (this._depthRenderer && (!this._depthRenderer.getValid())) {\n this._depthRenderer.destroy();\n this._depthRenderer = null;\n }\n if (this._normalsRenderer && (!this._normalsRenderer.getValid())) {\n this._normalsRenderer.destroy();\n this._normalsRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._edgesRenderer && (!this._edgesRenderer.getValid())) {\n this._edgesRenderer.destroy();\n this._edgesRenderer = null;\n }\n if (this._edgesColorRenderer && (!this._edgesColorRenderer.getValid())) {\n this._edgesColorRenderer.destroy();\n this._edgesColorRenderer = null;\n }\n if (this._pickMeshRenderer && (!this._pickMeshRenderer.getValid())) {\n this._pickMeshRenderer.destroy();\n this._pickMeshRenderer = null;\n }\n if (this._pickDepthRenderer && (!this._pickDepthRenderer.getValid())) {\n this._pickDepthRenderer.destroy();\n this._pickDepthRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._pickNormalsRenderer && this._pickNormalsRenderer.getValid() === false) {\n this._pickNormalsRenderer.destroy();\n this._pickNormalsRenderer = null;\n }\n if (this._pickNormalsFlatRenderer && this._pickNormalsFlatRenderer.getValid() === false) {\n this._pickNormalsFlatRenderer.destroy();\n this._pickNormalsFlatRenderer = null;\n }\n if (this._occlusionRenderer && this._occlusionRenderer.getValid() === false) {\n this._occlusionRenderer.destroy();\n this._occlusionRenderer = null;\n }\n }\n\n eagerCreateRenders() {\n\n // Pre-initialize certain renderers that would otherwise be lazy-initialised\n // on user interaction, such as picking or emphasis, so that there is no delay\n // when user first begins interacting with the viewer.\n\n if (!this._silhouetteRenderer) { // Used for highlighting and selection\n this._silhouetteRenderer = new DTXTrianglesSilhouetteRenderer(this._scene);\n }\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new DTXTrianglesPickMeshRenderer(this._scene);\n }\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new DTXTrianglesPickDepthRenderer(this._scene);\n }\n if (!this._pickNormalsRenderer) {\n this._pickNormalsRenderer = new DTXTrianglesPickNormalsFlatRenderer(this._scene);\n }\n if (!this._snapRenderer) {\n this._snapRenderer = new DTXTrianglesSnapRenderer(this._scene);\n }\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new DTXTrianglesSnapInitRenderer(this._scene);\n }\n if (!this._snapRenderer) {\n this._snapRenderer = new DTXTrianglesSnapRenderer(this._scene);\n }\n }\n\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new DTXTrianglesColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n\n get colorRendererWithSAO() {\n if (!this._colorRendererWithSAO) {\n this._colorRendererWithSAO = new DTXTrianglesColorRenderer(this._scene, true);\n }\n return this._colorRendererWithSAO;\n }\n\n get colorQualityRendererWithSAO() {\n // if (!this._colorQualityRendererWithSAO) {\n // this._colorQualityRendererWithSAO = new TrianglesDataTextureColorQualityRenderer(this._scene, true);\n // }\n return this._colorQualityRendererWithSAO;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new DTXTrianglesSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get depthRenderer() {\n if (!this._depthRenderer) {\n this._depthRenderer = new DTXTrianglesDepthRenderer(this._scene);\n }\n return this._depthRenderer;\n }\n\n get normalsRenderer() {\n if (!this._normalsRenderer) {\n this._normalsRenderer = new DTXTrianglesNormalsRenderer(this._scene);\n }\n return this._normalsRenderer;\n }\n\n get edgesRenderer() {\n if (!this._edgesRenderer) {\n this._edgesRenderer = new DTXTrianglesEdgesRenderer(this._scene);\n }\n return this._edgesRenderer;\n }\n\n get edgesColorRenderer() {\n if (!this._edgesColorRenderer) {\n this._edgesColorRenderer = new DTXTrianglesEdgesColorRenderer(this._scene);\n }\n return this._edgesColorRenderer;\n }\n\n get pickMeshRenderer() {\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new DTXTrianglesPickMeshRenderer(this._scene);\n }\n return this._pickMeshRenderer;\n }\n\n get pickNormalsRenderer() {\n if (!this._pickNormalsRenderer) {\n this._pickNormalsRenderer = new DTXTrianglesPickNormalsFlatRenderer(this._scene);\n }\n return this._pickNormalsRenderer;\n }\n\n get pickNormalsFlatRenderer() {\n if (!this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer = new DTXTrianglesPickNormalsFlatRenderer(this._scene);\n }\n return this._pickNormalsFlatRenderer;\n }\n\n get pickDepthRenderer() {\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new DTXTrianglesPickDepthRenderer(this._scene);\n }\n return this._pickDepthRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new DTXTrianglesSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new DTXTrianglesSnapInitRenderer(this._scene);\n }\n return this._snapInitRenderer;\n }\n\n get occlusionRenderer() {\n if (!this._occlusionRenderer) {\n this._occlusionRenderer = new DTXTrianglesOcclusionRenderer(this._scene);\n }\n return this._occlusionRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._colorRendererWithSAO) {\n this._colorRendererWithSAO.destroy();\n }\n if (this._flatColorRenderer) {\n this._flatColorRenderer.destroy();\n }\n if (this._flatColorRendererWithSAO) {\n this._flatColorRendererWithSAO.destroy();\n }\n if (this._colorQualityRendererWithSAO) {\n this._colorQualityRendererWithSAO.destroy();\n }\n if (this._depthRenderer) {\n this._depthRenderer.destroy();\n }\n if (this._normalsRenderer) {\n this._normalsRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._edgesRenderer) {\n this._edgesRenderer.destroy();\n }\n if (this._edgesColorRenderer) {\n this._edgesColorRenderer.destroy();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.destroy();\n }\n if (this._pickDepthRenderer) {\n this._pickDepthRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._pickNormalsRenderer) {\n this._pickNormalsRenderer.destroy();\n }\n if (this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer.destroy();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.destroy();\n }\n }\n}\n\nconst cachdRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let dataTextureRenderers = cachdRenderers[sceneId];\n if (!dataTextureRenderers) {\n dataTextureRenderers = new DTXTrianglesRenderers(scene);\n cachdRenderers[sceneId] = dataTextureRenderers;\n dataTextureRenderers._compile();\n dataTextureRenderers.eagerCreateRenders();\n scene.on(\"compile\", () => {\n dataTextureRenderers._compile();\n dataTextureRenderers.eagerCreateRenders();\n });\n scene.on(\"destroyed\", () => {\n delete cachdRenderers[sceneId];\n dataTextureRenderers._destroy();\n });\n }\n return dataTextureRenderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 5969, + "__docId__": 5977, "kind": "class", "name": "DTXTrianglesRenderers", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", @@ -119118,7 +119334,7 @@ "ignore": true }, { - "__docId__": 5970, + "__docId__": 5978, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119132,7 +119348,7 @@ "undocument": true }, { - "__docId__": 5971, + "__docId__": 5979, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119150,7 +119366,7 @@ } }, { - "__docId__": 5972, + "__docId__": 5980, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119167,7 +119383,7 @@ "return": null }, { - "__docId__": 5973, + "__docId__": 5981, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119185,7 +119401,7 @@ } }, { - "__docId__": 5974, + "__docId__": 5982, "kind": "member", "name": "_colorRendererWithSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119203,7 +119419,7 @@ } }, { - "__docId__": 5975, + "__docId__": 5983, "kind": "member", "name": "_flatColorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119221,7 +119437,7 @@ } }, { - "__docId__": 5976, + "__docId__": 5984, "kind": "member", "name": "_flatColorRendererWithSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119239,7 +119455,7 @@ } }, { - "__docId__": 5977, + "__docId__": 5985, "kind": "member", "name": "_colorQualityRendererWithSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119257,7 +119473,7 @@ } }, { - "__docId__": 5978, + "__docId__": 5986, "kind": "member", "name": "_depthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119275,7 +119491,7 @@ } }, { - "__docId__": 5979, + "__docId__": 5987, "kind": "member", "name": "_normalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119293,7 +119509,7 @@ } }, { - "__docId__": 5980, + "__docId__": 5988, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119311,7 +119527,7 @@ } }, { - "__docId__": 5981, + "__docId__": 5989, "kind": "member", "name": "_edgesRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119329,7 +119545,7 @@ } }, { - "__docId__": 5982, + "__docId__": 5990, "kind": "member", "name": "_edgesColorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119347,7 +119563,7 @@ } }, { - "__docId__": 5983, + "__docId__": 5991, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119365,7 +119581,7 @@ } }, { - "__docId__": 5984, + "__docId__": 5992, "kind": "member", "name": "_pickDepthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119383,7 +119599,7 @@ } }, { - "__docId__": 5985, + "__docId__": 5993, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119401,7 +119617,7 @@ } }, { - "__docId__": 5986, + "__docId__": 5994, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119419,7 +119635,7 @@ } }, { - "__docId__": 5987, + "__docId__": 5995, "kind": "member", "name": "_pickNormalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119437,7 +119653,7 @@ } }, { - "__docId__": 5988, + "__docId__": 5996, "kind": "member", "name": "_pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119455,7 +119671,7 @@ } }, { - "__docId__": 5989, + "__docId__": 5997, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119473,7 +119689,7 @@ } }, { - "__docId__": 5990, + "__docId__": 5998, "kind": "method", "name": "eagerCreateRenders", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119489,7 +119705,7 @@ "return": null }, { - "__docId__": 5998, + "__docId__": 6006, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119508,7 +119724,7 @@ } }, { - "__docId__": 6000, + "__docId__": 6008, "kind": "get", "name": "colorRendererWithSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119527,7 +119743,7 @@ } }, { - "__docId__": 6002, + "__docId__": 6010, "kind": "get", "name": "colorQualityRendererWithSAO", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119546,7 +119762,7 @@ } }, { - "__docId__": 6003, + "__docId__": 6011, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119565,7 +119781,7 @@ } }, { - "__docId__": 6005, + "__docId__": 6013, "kind": "get", "name": "depthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119584,7 +119800,7 @@ } }, { - "__docId__": 6007, + "__docId__": 6015, "kind": "get", "name": "normalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119603,7 +119819,7 @@ } }, { - "__docId__": 6009, + "__docId__": 6017, "kind": "get", "name": "edgesRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119622,7 +119838,7 @@ } }, { - "__docId__": 6011, + "__docId__": 6019, "kind": "get", "name": "edgesColorRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119641,7 +119857,7 @@ } }, { - "__docId__": 6013, + "__docId__": 6021, "kind": "get", "name": "pickMeshRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119660,7 +119876,7 @@ } }, { - "__docId__": 6015, + "__docId__": 6023, "kind": "get", "name": "pickNormalsRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119679,7 +119895,7 @@ } }, { - "__docId__": 6017, + "__docId__": 6025, "kind": "get", "name": "pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119698,7 +119914,7 @@ } }, { - "__docId__": 6019, + "__docId__": 6027, "kind": "get", "name": "pickDepthRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119717,7 +119933,7 @@ } }, { - "__docId__": 6021, + "__docId__": 6029, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119736,7 +119952,7 @@ } }, { - "__docId__": 6023, + "__docId__": 6031, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119755,7 +119971,7 @@ } }, { - "__docId__": 6025, + "__docId__": 6033, "kind": "get", "name": "occlusionRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119774,7 +119990,7 @@ } }, { - "__docId__": 6027, + "__docId__": 6035, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js~DTXTrianglesRenderers", @@ -119791,7 +120007,7 @@ "return": null }, { - "__docId__": 6028, + "__docId__": 6036, "kind": "variable", "name": "cachdRenderers", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", @@ -119812,7 +120028,7 @@ "ignore": true }, { - "__docId__": 6029, + "__docId__": 6037, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js", @@ -119842,18 +120058,18 @@ } }, { - "__docId__": 6030, + "__docId__": 6038, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {RENDER_PASSES} from \"../../../RENDER_PASSES.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst defaultColor = new Float32Array([1, 1, 1]);\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class DTXTrianglesSilhouetteRenderer {\n\n constructor(scene, primitiveType) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n const scene = this._scene;\n const camera = scene.camera;\n const model = dataTextureLayer.model;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const viewMatrix = camera.viewMatrix;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx, state);\n }\n\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3a;\n if (origin) {\n const rotatedOrigin = tempVec3b;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3c;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n\n if (renderPass === RENDER_PASSES.SILHOUETTE_XRAYED) {\n const material = scene.xrayMaterial._state;\n const fillColor = material.fillColor;\n const fillAlpha = material.fillAlpha;\n gl.uniform4f(this._uColor, fillColor[0], fillColor[1], fillColor[2], fillAlpha);\n\n } else if (renderPass === RENDER_PASSES.SILHOUETTE_HIGHLIGHTED) {\n const material = scene.highlightMaterial._state;\n const fillColor = material.fillColor;\n const fillAlpha = material.fillAlpha;\n gl.uniform4f(this._uColor, fillColor[0], fillColor[1], fillColor[2], fillAlpha);\n\n } else if (renderPass === RENDER_PASSES.SILHOUETTE_SELECTED) {\n const material = scene.selectedMaterial._state;\n const fillColor = material.fillColor;\n const fillAlpha = material.fillAlpha;\n gl.uniform4f(this._uColor, fillColor[0], fillColor[1], fillColor[2], fillAlpha);\n\n } else {\n gl.uniform4fv(this._uColor, defaultColor);\n }\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uColor = program.getLocation(\"color\");\n this._uWorldMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdNormals = \"uTexturePerPolygonIdNormals\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n }\n\n _bindProgram(frameCtx) {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const project = scene.camera.project;\n\n this._program.bind();\n\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles dataTexture silhouette vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n // src.push(\"uniform sampler2D uOcclusionTexture;\"); \n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n // flags.y = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`if (int(flags.y) != renderPass) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\"); // Cull vertex\n src.push(\"} else {\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\"if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\"vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\"if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"} else {\");\n src.push(\"if (viewNormal.z < 0.0) {\");\n src.push(\"position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\"viewNormal = -viewNormal;\");\n src.push(\"}\");\n src.push(\"}\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n\n src.push(\"}\");\n\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Triangles dataTexture draw fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"uniform vec4 color;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = color;\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6031, + "__docId__": 6039, "kind": "variable", "name": "defaultColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119874,7 +120090,7 @@ "ignore": true }, { - "__docId__": 6032, + "__docId__": 6040, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119895,7 +120111,7 @@ "ignore": true }, { - "__docId__": 6033, + "__docId__": 6041, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119916,7 +120132,7 @@ "ignore": true }, { - "__docId__": 6034, + "__docId__": 6042, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119937,7 +120153,7 @@ "ignore": true }, { - "__docId__": 6035, + "__docId__": 6043, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119958,7 +120174,7 @@ "ignore": true }, { - "__docId__": 6036, + "__docId__": 6044, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119979,7 +120195,7 @@ "ignore": true }, { - "__docId__": 6037, + "__docId__": 6045, "kind": "class", "name": "DTXTrianglesSilhouetteRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js", @@ -119995,7 +120211,7 @@ "ignore": true }, { - "__docId__": 6038, + "__docId__": 6046, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120009,7 +120225,7 @@ "undocument": true }, { - "__docId__": 6039, + "__docId__": 6047, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120027,7 +120243,7 @@ } }, { - "__docId__": 6040, + "__docId__": 6048, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120045,7 +120261,7 @@ } }, { - "__docId__": 6041, + "__docId__": 6049, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120065,7 +120281,7 @@ } }, { - "__docId__": 6042, + "__docId__": 6050, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120086,7 +120302,7 @@ } }, { - "__docId__": 6043, + "__docId__": 6051, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120121,7 +120337,7 @@ "return": null }, { - "__docId__": 6044, + "__docId__": 6052, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120138,7 +120354,7 @@ "return": null }, { - "__docId__": 6045, + "__docId__": 6053, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120156,7 +120372,7 @@ } }, { - "__docId__": 6046, + "__docId__": 6054, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120173,7 +120389,7 @@ } }, { - "__docId__": 6047, + "__docId__": 6055, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120191,7 +120407,7 @@ } }, { - "__docId__": 6048, + "__docId__": 6056, "kind": "member", "name": "_uColor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120209,7 +120425,7 @@ } }, { - "__docId__": 6049, + "__docId__": 6057, "kind": "member", "name": "_uWorldMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120227,7 +120443,7 @@ } }, { - "__docId__": 6050, + "__docId__": 6058, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120245,7 +120461,7 @@ } }, { - "__docId__": 6051, + "__docId__": 6059, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120263,7 +120479,7 @@ } }, { - "__docId__": 6052, + "__docId__": 6060, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120281,7 +120497,7 @@ } }, { - "__docId__": 6053, + "__docId__": 6061, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120299,7 +120515,7 @@ } }, { - "__docId__": 6054, + "__docId__": 6062, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120316,7 +120532,7 @@ } }, { - "__docId__": 6055, + "__docId__": 6063, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120333,7 +120549,7 @@ } }, { - "__docId__": 6056, + "__docId__": 6064, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120351,7 +120567,7 @@ } }, { - "__docId__": 6057, + "__docId__": 6065, "kind": "member", "name": "_uTexturePerPolygonIdNormals", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120369,7 +120585,7 @@ } }, { - "__docId__": 6058, + "__docId__": 6066, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120387,7 +120603,7 @@ } }, { - "__docId__": 6059, + "__docId__": 6067, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120405,7 +120621,7 @@ } }, { - "__docId__": 6060, + "__docId__": 6068, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120423,7 +120639,7 @@ } }, { - "__docId__": 6061, + "__docId__": 6069, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120441,7 +120657,7 @@ } }, { - "__docId__": 6062, + "__docId__": 6070, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120465,7 +120681,7 @@ "return": null }, { - "__docId__": 6063, + "__docId__": 6071, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120486,7 +120702,7 @@ } }, { - "__docId__": 6064, + "__docId__": 6072, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120507,7 +120723,7 @@ } }, { - "__docId__": 6065, + "__docId__": 6073, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120528,7 +120744,7 @@ } }, { - "__docId__": 6066, + "__docId__": 6074, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120544,7 +120760,7 @@ "return": null }, { - "__docId__": 6068, + "__docId__": 6076, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js~DTXTrianglesSilhouetteRenderer", @@ -120560,18 +120776,18 @@ "return": null }, { - "__docId__": 6070, + "__docId__": 6078, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {math} from \"../../../../math/math.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/index.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempVec3e = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n/**\n * @private\n */\nexport class DTXTrianglesSnapInitRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n let rtcViewMatrix;\n let rtcCameraEye;\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3b;\n if (gotOrigin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this._uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this._uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n gl.uniformMatrix4fv(this._uSceneWorldModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n if (state.numIndices8Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 8 // 8 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);\n }\n if (state.numIndices16Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 16 // 16 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);\n }\n if (state.numIndices32Bits > 0) {\n textureState.bindTriangleIndicesTextures(\n this._program,\n this._uTexturePerPolygonIdPortionIds,\n this._uTexturePerPolygonIdIndices,\n 32 // 32 bits indices\n );\n gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);\n }\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uSceneWorldModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdIndices = \"uTexturePerPolygonIdIndices\";\n this._uTexturePerPolygonIdPortionIds = \"uTexturePerPolygonIdPortionIds\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this._uVectorA = program.getLocation(\"uVectorAB\");\n this._uInverseVectorAB = program.getLocation(\"uInverseVectorAB\");\n this._uLayerNumber = program.getLocation(\"uLayerNumber\");\n this._uCoordinateScaler = program.getLocation(\"uCoordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// DTXTrianglesSnapInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerPolygonIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 uVectorAB;\");\n src.push(\"uniform vec2 uInverseVectorAB;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - uVectorAB.x) * uInverseVectorAB.x;\");\n src.push(\" float y = (clipPos.y - uVectorAB.y) * uInverseVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int polygonIndex = gl_VertexID / 3;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (polygonIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (polygonIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n src.push(\"{\");\n\n // get color\n src.push(\"uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);\");\n\n src.push(`if (color.a == 0u) {`);\n src.push(\" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);\"); // Cull vertex\n src.push(\" return;\");\n src.push(\"};\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n\n src.push(\"ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));\");\n\n src.push(\"int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;\");\n\n src.push(\"int h_index = (polygonIndex - indexBaseOffset) & 4095;\")\n src.push(\"int v_index = (polygonIndex - indexBaseOffset) >> 12;\")\n\n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));\");\n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n\n src.push(\"ivec3 indexPositionH = uniqueVertexIndexes & 4095;\")\n src.push(\"ivec3 indexPositionV = uniqueVertexIndexes >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\");\n\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;\");\n\n // get position\n src.push(\"positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));\")\n src.push(\"positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));\")\n src.push(\"positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));\")\n\n // get normal\n src.push(\"vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));\");\n src.push(\"vec3 position;\");\n src.push(\"position = positions[gl_VertexID % 3];\");\n src.push(\"vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);\");\n\n // when the geometry is not solid, if needed, flip the triangle winding\n src.push(\"if (solid != 1u) {\");\n src.push(\" if (isPerspectiveMatrix(projMatrix)) {\");\n src.push(\" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;\")\n src.push(\" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {\");\n src.push(\" position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\" viewNormal = -viewNormal;\");\n src.push(\" }\");\n src.push(\" } else {\");\n src.push(\" if (viewNormal.z < 0.0) {\");\n src.push(\" position = positions[2 - (gl_VertexID % 3)];\");\n src.push(\" viewNormal = -viewNormal;\");\n src.push(\" }\");\n src.push(\" }\");\n src.push(\"}\");\n\n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\"vFlags2 = flags2.r;\");\n }\n src.push(\"vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));\");\n\n // TODO: Normalized color? See here:\n //src.push(\"vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) /255.0;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// DTXTrianglesSnapInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int uLayerNumber;\");\n src.push(\"uniform vec3 uCoordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);\")\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6071, + "__docId__": 6079, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120592,7 +120808,7 @@ "ignore": true }, { - "__docId__": 6072, + "__docId__": 6080, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120613,7 +120829,7 @@ "ignore": true }, { - "__docId__": 6073, + "__docId__": 6081, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120634,7 +120850,7 @@ "ignore": true }, { - "__docId__": 6074, + "__docId__": 6082, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120655,7 +120871,7 @@ "ignore": true }, { - "__docId__": 6075, + "__docId__": 6083, "kind": "variable", "name": "tempVec3e", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120676,7 +120892,7 @@ "ignore": true }, { - "__docId__": 6076, + "__docId__": 6084, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120697,7 +120913,7 @@ "ignore": true }, { - "__docId__": 6077, + "__docId__": 6085, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120718,7 +120934,7 @@ "ignore": true }, { - "__docId__": 6078, + "__docId__": 6086, "kind": "class", "name": "DTXTrianglesSnapInitRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js", @@ -120734,7 +120950,7 @@ "ignore": true }, { - "__docId__": 6079, + "__docId__": 6087, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120748,7 +120964,7 @@ "undocument": true }, { - "__docId__": 6080, + "__docId__": 6088, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120766,7 +120982,7 @@ } }, { - "__docId__": 6081, + "__docId__": 6089, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120784,7 +121000,7 @@ } }, { - "__docId__": 6082, + "__docId__": 6090, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120804,7 +121020,7 @@ } }, { - "__docId__": 6083, + "__docId__": 6091, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120825,7 +121041,7 @@ } }, { - "__docId__": 6084, + "__docId__": 6092, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120860,7 +121076,7 @@ "return": null }, { - "__docId__": 6085, + "__docId__": 6093, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120877,7 +121093,7 @@ "return": null }, { - "__docId__": 6086, + "__docId__": 6094, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120895,7 +121111,7 @@ } }, { - "__docId__": 6087, + "__docId__": 6095, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120912,7 +121128,7 @@ } }, { - "__docId__": 6088, + "__docId__": 6096, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120930,7 +121146,7 @@ } }, { - "__docId__": 6089, + "__docId__": 6097, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120948,7 +121164,7 @@ } }, { - "__docId__": 6090, + "__docId__": 6098, "kind": "member", "name": "_uSceneWorldModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120966,7 +121182,7 @@ } }, { - "__docId__": 6091, + "__docId__": 6099, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -120984,7 +121200,7 @@ } }, { - "__docId__": 6092, + "__docId__": 6100, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121002,7 +121218,7 @@ } }, { - "__docId__": 6093, + "__docId__": 6101, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121020,7 +121236,7 @@ } }, { - "__docId__": 6094, + "__docId__": 6102, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121038,7 +121254,7 @@ } }, { - "__docId__": 6095, + "__docId__": 6103, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121055,7 +121271,7 @@ } }, { - "__docId__": 6096, + "__docId__": 6104, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121072,7 +121288,7 @@ } }, { - "__docId__": 6097, + "__docId__": 6105, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121090,7 +121306,7 @@ } }, { - "__docId__": 6098, + "__docId__": 6106, "kind": "member", "name": "_uTexturePerPolygonIdIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121108,7 +121324,7 @@ } }, { - "__docId__": 6099, + "__docId__": 6107, "kind": "member", "name": "_uTexturePerPolygonIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121126,7 +121342,7 @@ } }, { - "__docId__": 6100, + "__docId__": 6108, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121144,7 +121360,7 @@ } }, { - "__docId__": 6101, + "__docId__": 6109, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121162,7 +121378,7 @@ } }, { - "__docId__": 6102, + "__docId__": 6110, "kind": "member", "name": "_uVectorA", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121180,7 +121396,7 @@ } }, { - "__docId__": 6103, + "__docId__": 6111, "kind": "member", "name": "_uInverseVectorAB", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121198,7 +121414,7 @@ } }, { - "__docId__": 6104, + "__docId__": 6112, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121216,7 +121432,7 @@ } }, { - "__docId__": 6105, + "__docId__": 6113, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121234,7 +121450,7 @@ } }, { - "__docId__": 6106, + "__docId__": 6114, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121251,7 +121467,7 @@ "return": null }, { - "__docId__": 6107, + "__docId__": 6115, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121272,7 +121488,7 @@ } }, { - "__docId__": 6108, + "__docId__": 6116, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121293,7 +121509,7 @@ } }, { - "__docId__": 6109, + "__docId__": 6117, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121314,7 +121530,7 @@ } }, { - "__docId__": 6110, + "__docId__": 6118, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121330,7 +121546,7 @@ "return": null }, { - "__docId__": 6112, + "__docId__": 6120, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js~DTXTrianglesSnapInitRenderer", @@ -121346,18 +121562,18 @@ "return": null }, { - "__docId__": 6114, + "__docId__": 6122, "kind": "file", "name": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", "content": "import {Program} from \"../../../../webgl/Program.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempVec3e = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class DTXTrianglesSnapRenderer {\n\n constructor(scene) {\n this._scene = scene;\n this._hash = this._getHash();\n this._allocate();\n }\n\n getValid() {\n return this._hash === this._getHash();\n };\n\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n drawLayer(frameCtx, dataTextureLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = dataTextureLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = dataTextureLayer._state;\n const textureState = state.textureState;\n const origin = dataTextureLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n \n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n textureState.bindCommonTextures(\n this._program,\n this.uTexturePerObjectPositionsDecodeMatrix,\n this._uTexturePerVertexIdCoordinates,\n this.uTexturePerObjectColorsAndFlags,\n this._uTexturePerObjectMatrix\n );\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3b;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);\n gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n const glMode = (frameCtx.snapMode === \"edge\") ? gl.LINES : gl.POINTS;\n if (state.numEdgeIndices8Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 8 // 8 bits edge indices\n );\n gl.drawArrays(glMode, 0, state.numEdgeIndices8Bits);\n }\n if (state.numEdgeIndices16Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 16 // 16 bits edge indices\n );\n gl.drawArrays(glMode, 0, state.numEdgeIndices16Bits);\n }\n if (state.numEdgeIndices32Bits > 0) {\n textureState.bindEdgeIndicesTextures(\n this._program,\n this._uTexturePerEdgeIdPortionIds,\n this._uTexturePerPolygonIdEdgeIndices,\n 32 // 32 bits edge indices\n );\n gl.drawArrays(glMode, 0, state.numEdgeIndices32Bits);\n }\n frameCtx.drawElements++;\n }\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n this._program = new Program(gl, this._buildShader());\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uRenderPass = program.getLocation(\"renderPass\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uSceneModelMatrix = program.getLocation(\"sceneModelMatrix\");\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uTexturePerObjectPositionsDecodeMatrix = \"uObjectPerObjectPositionsDecodeMatrix\";\n this.uTexturePerObjectColorsAndFlags = \"uObjectPerObjectColorsAndFlags\";\n this._uTexturePerVertexIdCoordinates = \"uTexturePerVertexIdCoordinates\";\n this._uTexturePerPolygonIdEdgeIndices = \"uTexturePerPolygonIdEdgeIndices\";\n this._uTexturePerEdgeIdPortionIds = \"uTexturePerEdgeIdPortionIds\";\n this._uTextureModelMatrices = \"uTextureModelMatrices\";\n this._uTexturePerObjectMatrix= \"uTexturePerObjectMatrix\";\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"uSnapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"uSnapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"uLayerNumber\");\n this._uCoordinateScaler = program.getLocation(\"uCoordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry edges drawing vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"uniform mat4 sceneModelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n\n src.push(\"uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;\");\n src.push(\"uniform lowp usampler2D uObjectPerObjectColorsAndFlags;\");\n src.push(\"uniform highp sampler2D uTexturePerObjectMatrix;\");\n src.push(\"uniform mediump usampler2D uTexturePerVertexIdCoordinates;\");\n src.push(\"uniform highp usampler2D uTexturePerPolygonIdEdgeIndices;\");\n src.push(\"uniform mediump usampler2D uTexturePerEdgeIdPortionIds;\");\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 uSnapVectorA;\");\n src.push(\"uniform vec2 uSnapInvVectorAB;\");\n\n src.push(\"vec3 positions[3];\")\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - uSnapVectorA.x) * uSnapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - uSnapVectorA.y) * uSnapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"flat out uint vFlags2;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n\n // constants\n src.push(\"int edgeIndex = gl_VertexID / 2;\")\n\n // get packed object-id\n src.push(\"int h_packed_object_id_index = (edgeIndex >> 3) & 4095;\")\n src.push(\"int v_packed_object_id_index = (edgeIndex >> 3) >> 12;\")\n\n src.push(\"int objectIndex = int(texelFetch(uTexturePerEdgeIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);\");\n src.push(\"ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);\");\n\n // get flags & flags2\n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n\n src.push(\"{\");\n\n // get vertex base\n src.push(\"ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));\");\n src.push(\"ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));\");\n src.push(\"int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;\");\n \n src.push(\"int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;\")\n src.push(\"int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;\")\n \n src.push(\"ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));\");\n \n src.push(\"ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;\")\n \n src.push(\"int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;\")\n src.push(\"int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;\")\n\n src.push(\"mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n src.push(\"mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));\")\n \n src.push(\"uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);\");\n src.push(\"uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);\");\n \n src.push(\"vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));\")\n \n src.push(\"vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); \");\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags2 = flags2.r;\");\n }\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n src.push(\"vViewPosition = clipPos;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Triangles dataTexture pick depth fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int uLayerNumber;\");\n src.push(\"uniform vec3 uCoordinateScaler;\");\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in uint vFlags2;\");\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = vFlags2 > 0u;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, uLayerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6115, + "__docId__": 6123, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121378,7 +121594,7 @@ "ignore": true }, { - "__docId__": 6116, + "__docId__": 6124, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121399,7 +121615,7 @@ "ignore": true }, { - "__docId__": 6117, + "__docId__": 6125, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121420,7 +121636,7 @@ "ignore": true }, { - "__docId__": 6118, + "__docId__": 6126, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121441,7 +121657,7 @@ "ignore": true }, { - "__docId__": 6119, + "__docId__": 6127, "kind": "variable", "name": "tempVec3e", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121462,7 +121678,7 @@ "ignore": true }, { - "__docId__": 6120, + "__docId__": 6128, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121483,7 +121699,7 @@ "ignore": true }, { - "__docId__": 6121, + "__docId__": 6129, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121504,7 +121720,7 @@ "ignore": true }, { - "__docId__": 6122, + "__docId__": 6130, "kind": "class", "name": "DTXTrianglesSnapRenderer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js", @@ -121520,7 +121736,7 @@ "ignore": true }, { - "__docId__": 6123, + "__docId__": 6131, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121534,7 +121750,7 @@ "undocument": true }, { - "__docId__": 6124, + "__docId__": 6132, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121552,7 +121768,7 @@ } }, { - "__docId__": 6125, + "__docId__": 6133, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121570,7 +121786,7 @@ } }, { - "__docId__": 6126, + "__docId__": 6134, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121590,7 +121806,7 @@ } }, { - "__docId__": 6127, + "__docId__": 6135, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121611,7 +121827,7 @@ } }, { - "__docId__": 6128, + "__docId__": 6136, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121646,7 +121862,7 @@ "return": null }, { - "__docId__": 6129, + "__docId__": 6137, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121663,7 +121879,7 @@ "return": null }, { - "__docId__": 6130, + "__docId__": 6138, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121681,7 +121897,7 @@ } }, { - "__docId__": 6131, + "__docId__": 6139, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121698,7 +121914,7 @@ } }, { - "__docId__": 6132, + "__docId__": 6140, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121716,7 +121932,7 @@ } }, { - "__docId__": 6133, + "__docId__": 6141, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121734,7 +121950,7 @@ } }, { - "__docId__": 6134, + "__docId__": 6142, "kind": "member", "name": "_uSceneModelMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121752,7 +121968,7 @@ } }, { - "__docId__": 6135, + "__docId__": 6143, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121770,7 +121986,7 @@ } }, { - "__docId__": 6136, + "__docId__": 6144, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121788,7 +122004,7 @@ } }, { - "__docId__": 6137, + "__docId__": 6145, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121806,7 +122022,7 @@ } }, { - "__docId__": 6138, + "__docId__": 6146, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121824,7 +122040,7 @@ } }, { - "__docId__": 6139, + "__docId__": 6147, "kind": "member", "name": "uTexturePerObjectPositionsDecodeMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121841,7 +122057,7 @@ } }, { - "__docId__": 6140, + "__docId__": 6148, "kind": "member", "name": "uTexturePerObjectColorsAndFlags", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121858,7 +122074,7 @@ } }, { - "__docId__": 6141, + "__docId__": 6149, "kind": "member", "name": "_uTexturePerVertexIdCoordinates", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121876,7 +122092,7 @@ } }, { - "__docId__": 6142, + "__docId__": 6150, "kind": "member", "name": "_uTexturePerPolygonIdEdgeIndices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121894,7 +122110,7 @@ } }, { - "__docId__": 6143, + "__docId__": 6151, "kind": "member", "name": "_uTexturePerEdgeIdPortionIds", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121912,7 +122128,7 @@ } }, { - "__docId__": 6144, + "__docId__": 6152, "kind": "member", "name": "_uTextureModelMatrices", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121930,7 +122146,7 @@ } }, { - "__docId__": 6145, + "__docId__": 6153, "kind": "member", "name": "_uTexturePerObjectMatrix", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121948,7 +122164,7 @@ } }, { - "__docId__": 6146, + "__docId__": 6154, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121966,7 +122182,7 @@ } }, { - "__docId__": 6147, + "__docId__": 6155, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -121983,7 +122199,7 @@ } }, { - "__docId__": 6148, + "__docId__": 6156, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122000,7 +122216,7 @@ } }, { - "__docId__": 6149, + "__docId__": 6157, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122018,7 +122234,7 @@ } }, { - "__docId__": 6150, + "__docId__": 6158, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122036,7 +122252,7 @@ } }, { - "__docId__": 6151, + "__docId__": 6159, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122053,7 +122269,7 @@ "return": null }, { - "__docId__": 6152, + "__docId__": 6160, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122074,7 +122290,7 @@ } }, { - "__docId__": 6153, + "__docId__": 6161, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122095,7 +122311,7 @@ } }, { - "__docId__": 6154, + "__docId__": 6162, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122116,7 +122332,7 @@ } }, { - "__docId__": 6155, + "__docId__": 6163, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122132,7 +122348,7 @@ "return": null }, { - "__docId__": 6157, + "__docId__": 6165, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js~DTXTrianglesSnapRenderer", @@ -122148,29 +122364,29 @@ "return": null }, { - "__docId__": 6159, + "__docId__": 6167, "kind": "file", "name": "src/viewer/scene/model/index.js", "content": "\nexport * from \"./PerformanceModel.js\";\nexport * from \"./SceneModelTransform.js\";\nexport * from \"./SceneModelMesh.js\";\nexport * from \"./SceneModel.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6160, + "__docId__": 6168, "kind": "file", "name": "src/viewer/scene/model/rebucketPositions.js", "content": "/**\n * @author https://github.com/tmarti, with support from https://tribia.com/\n * @license MIT\n **/\n\nconst MAX_RE_BUCKET_FAN_OUT = 8;\n\nlet bucketsForIndices = null;\n\nfunction compareBuckets(a, b) {\n const aa = a * 3;\n const bb = b * 3;\n let aa1, aa2, aa3, bb1, bb2, bb3;\n const minBucketA = Math.min(\n aa1 = bucketsForIndices[aa],\n aa2 = bucketsForIndices[aa + 1],\n aa3 = bucketsForIndices[aa + 2]\n );\n const minBucketB = Math.min(\n bb1 = bucketsForIndices[bb],\n bb2 = bucketsForIndices[bb + 1],\n bb3 = bucketsForIndices[bb + 2]\n );\n if (minBucketA !== minBucketB) {\n return minBucketA - minBucketB;\n }\n const maxBucketA = Math.max(aa1, aa2, aa3);\n const maxBucketB = Math.max(bb1, bb2, bb3,);\n if (maxBucketA !== maxBucketB) {\n return maxBucketA - maxBucketB;\n }\n return 0;\n}\n\nfunction preSortIndices(indices, bitsPerBucket) {\n const seq = new Int32Array(indices.length / 3);\n for (let i = 0, len = seq.length; i < len; i++) {\n seq[i] = i;\n }\n bucketsForIndices = new Int32Array(indices.length);\n for (let i = 0, len = indices.length; i < len; i++) {\n bucketsForIndices[i] = indices[i] >> bitsPerBucket;\n }\n seq.sort(compareBuckets);\n const sortedIndices = new Int32Array(indices.length);\n for (let i = 0, len = seq.length; i < len; i++) {\n sortedIndices[i * 3 + 0] = indices[seq[i] * 3 + 0];\n sortedIndices[i * 3 + 1] = indices[seq[i] * 3 + 1];\n sortedIndices[i * 3 + 2] = indices[seq[i] * 3 + 2];\n }\n return sortedIndices;\n}\n\nlet compareEdgeIndices = null;\n\nfunction compareIndices(a, b) {\n let retVal = compareEdgeIndices[a * 2] - compareEdgeIndices[b * 2];\n if (retVal !== 0) {\n return retVal;\n }\n return compareEdgeIndices[a * 2 + 1] - compareEdgeIndices[b * 2 + 1];\n}\n\nfunction preSortEdgeIndices(edgeIndices) {\n if ((edgeIndices || []).length === 0) {\n return [];\n }\n let seq = new Int32Array(edgeIndices.length / 2);\n for (let i = 0, len = seq.length; i < len; i++) {\n seq[i] = i;\n }\n for (let i = 0, j = 0, len = edgeIndices.length; i < len; i += 2) {\n if (edgeIndices[i] > edgeIndices[i + 1]) {\n let tmp = edgeIndices[i];\n edgeIndices[i] = edgeIndices[i + 1];\n edgeIndices[i + 1] = tmp;\n }\n }\n compareEdgeIndices = new Int32Array(edgeIndices);\n seq.sort(compareIndices);\n const sortedEdgeIndices = new Int32Array(edgeIndices.length);\n for (let i = 0, len = seq.length; i < len; i++) {\n sortedEdgeIndices[i * 2 + 0] = edgeIndices[seq[i] * 2 + 0];\n sortedEdgeIndices[i * 2 + 1] = edgeIndices[seq[i] * 2 + 1];\n }\n return sortedEdgeIndices;\n}\n\n/**\n * @param {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}} mesh \n * @param {number} bitsPerBucket \n * @param {boolean} checkResult \n * \n * @returns {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}[]}\n */\nfunction rebucketPositions(mesh, bitsPerBucket, checkResult = false) {\n const positionsCompressed = (mesh.positionsCompressed || []);\n const indices = preSortIndices(mesh.indices || [], bitsPerBucket);\n const edgeIndices = preSortEdgeIndices(mesh.edgeIndices || []);\n\n function edgeSearch(el0, el1) { // Code adapted from https://stackoverflow.com/questions/22697936/binary-search-in-javascript\n if (el0 > el1) {\n let tmp = el0;\n el0 = el1;\n el1 = tmp;\n }\n\n function compare_fn(a, b) {\n if (a !== el0) {\n return el0 - a;\n }\n if (b !== el1) {\n return el1 - b;\n }\n return 0;\n }\n\n let m = 0;\n let n = (edgeIndices.length >> 1) - 1;\n while (m <= n) {\n const k = (n + m) >> 1;\n const cmp = compare_fn(edgeIndices[k * 2], edgeIndices[k * 2 + 1]);\n if (cmp > 0) {\n m = k + 1;\n } else if (cmp < 0) {\n n = k - 1;\n } else {\n return k;\n }\n }\n return -m - 1;\n }\n\n const alreadyOutputEdgeIndices = new Int32Array(edgeIndices.length / 2);\n alreadyOutputEdgeIndices.fill(0);\n\n const numPositions = positionsCompressed.length / 3;\n\n if (numPositions > ((1 << bitsPerBucket) * MAX_RE_BUCKET_FAN_OUT)) {\n return [mesh];\n }\n\n const bucketIndicesRemap = new Int32Array(numPositions);\n bucketIndicesRemap.fill(-1);\n\n const buckets = [];\n\n function addEmptyBucket() {\n bucketIndicesRemap.fill(-1);\n\n const newBucket = {\n positionsCompressed: [],\n indices: [],\n edgeIndices: [],\n maxNumPositions: (1 << bitsPerBucket) - bitsPerBucket,\n numPositions: 0,\n bucketNumber: buckets.length,\n };\n\n buckets.push(newBucket);\n\n return newBucket;\n }\n\n let currentBucket = addEmptyBucket();\n\n // let currentBucket = 0;\n\n let retVal = 0;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n let additonalPositionsInBucket = 0;\n\n const ii0 = indices[i];\n const ii1 = indices[i + 1];\n const ii2 = indices[i + 2];\n\n if (bucketIndicesRemap[ii0] === -1) {\n additonalPositionsInBucket++;\n }\n\n if (bucketIndicesRemap[ii1] === -1) {\n additonalPositionsInBucket++;\n }\n\n if (bucketIndicesRemap[ii2] === -1) {\n additonalPositionsInBucket++;\n }\n\n if ((additonalPositionsInBucket + currentBucket.numPositions) > currentBucket.maxNumPositions) {\n currentBucket = addEmptyBucket();\n }\n\n if (currentBucket.bucketNumber > MAX_RE_BUCKET_FAN_OUT) {\n return [mesh];\n }\n\n if (bucketIndicesRemap[ii0] === -1) {\n bucketIndicesRemap[ii0] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii0 * 3 + 2]);\n }\n\n if (bucketIndicesRemap[ii1] === -1) {\n bucketIndicesRemap[ii1] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii1 * 3 + 2]);\n }\n\n if (bucketIndicesRemap[ii2] === -1) {\n bucketIndicesRemap[ii2] = currentBucket.numPositions++;\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3 + 1]);\n currentBucket.positionsCompressed.push(positionsCompressed[ii2 * 3 + 2]);\n }\n\n currentBucket.indices.push(bucketIndicesRemap[ii0]);\n currentBucket.indices.push(bucketIndicesRemap[ii1]);\n currentBucket.indices.push(bucketIndicesRemap[ii2]);\n\n // Check possible edge1\n let edgeIndex;\n\n if ((edgeIndex = edgeSearch(ii0, ii1)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n\n if ((edgeIndex = edgeSearch(ii0, ii2)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n\n if ((edgeIndex = edgeSearch(ii1, ii2)) >= 0) {\n if (alreadyOutputEdgeIndices[edgeIndex] === 0) {\n alreadyOutputEdgeIndices[edgeIndex] = 1;\n\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2]]);\n currentBucket.edgeIndices.push(bucketIndicesRemap[edgeIndices[edgeIndex * 2 + 1]]);\n }\n }\n }\n\n const prevBytesPerIndex = bitsPerBucket / 8 * 2;\n const newBytesPerIndex = bitsPerBucket / 8;\n\n const originalSize = positionsCompressed.length * 2 + (indices.length + edgeIndices.length) * prevBytesPerIndex;\n\n let newSize = 0;\n let newPositions = -positionsCompressed.length / 3;\n\n buckets.forEach(bucket => {\n newSize += bucket.positionsCompressed.length * 2 + (bucket.indices.length + bucket.edgeIndices.length) * newBytesPerIndex;\n newPositions += bucket.positionsCompressed.length / 3;\n });\n if (newSize > originalSize) {\n return [mesh];\n }\n if (checkResult) {\n doCheckResult(buckets, mesh);\n }\n return buckets;\n}\n\nfunction unbucket(buckets) {\n const positionsCompressed = [];\n const indices = [];\n const edgeIndices = [];\n let positionsBase = 0;\n buckets.forEach(bucket => {\n bucket.positionsCompressed.forEach(coord => {\n positionsCompressed.push(coord);\n });\n bucket.indices.forEach(index => {\n indices.push(index + positionsBase);\n });\n bucket.edgeIndices.forEach(edgeIndex => {\n edgeIndices.push(edgeIndex + positionsBase);\n });\n positionsBase += positionsCompressed.length / 3;\n });\n return {positionsCompressed, indices, edgeIndices};\n}\n\nfunction doCheckResult(buckets, mesh) {\n const meshDict = {};\n const edgesDict = {};\n\n let edgeIndicesCount = 0;\n\n buckets.forEach(bucket => {\n const indices = bucket.indices;\n const edgeIndices = bucket.edgeIndices;\n const positionsCompressed = bucket.positionsCompressed;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n const key = positionsCompressed[indices[i] * 3] + \"_\" + positionsCompressed[indices[i] * 3 + 1] + \"_\" + positionsCompressed[indices[i] * 3 + 2] + \"/\" +\n positionsCompressed[indices[i + 1] * 3] + \"_\" + positionsCompressed[indices[i + 1] * 3 + 1] + \"_\" + positionsCompressed[indices[i + 1] * 3 + 2] + \"/\" +\n positionsCompressed[indices[i + 2] * 3] + \"_\" + positionsCompressed[indices[i + 2] * 3 + 1] + \"_\" + positionsCompressed[indices[i + 2] * 3 + 2];\n meshDict[key] = true;\n }\n\n edgeIndicesCount += bucket.edgeIndices.length / 2;\n\n for (let i = 0, len = edgeIndices.length; i < len; i += 2) {\n const key = positionsCompressed[edgeIndices[i] * 3] + \"_\" + positionsCompressed[edgeIndices[i] * 3 + 1] + \"_\" + positionsCompressed[edgeIndices[i] * 3 + 2] + \"/\" +\n positionsCompressed[edgeIndices[i + 1] * 3] + \"_\" + positionsCompressed[edgeIndices[i + 1] * 3 + 1] + \"_\" + positionsCompressed[edgeIndices[i + 1] * 3 + 2] + \"/\";\n edgesDict[key] = true;\n }\n });\n\n {\n const indices = mesh.indices;\n const edgeIndices = mesh.edgeIndices;\n const positionsCompressed = mesh.positionsCompressed;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n const key = positionsCompressed[indices[i] * 3] + \"_\" + positionsCompressed[indices[i] * 3 + 1] + \"_\" + positionsCompressed[indices[i] * 3 + 2] + \"/\" +\n positionsCompressed[indices[i + 1] * 3] + \"_\" + positionsCompressed[indices[i + 1] * 3 + 1] + \"_\" + positionsCompressed[indices[i + 1] * 3 + 2] + \"/\" +\n positionsCompressed[indices[i + 2] * 3] + \"_\" + positionsCompressed[indices[i + 2] * 3 + 1] + \"_\" + positionsCompressed[indices[i + 2] * 3 + 2];\n\n if (!(key in meshDict)) {\n console.log(\"Not found \" + key);\n throw \"Ohhhh!\";\n }\n }\n\n // for (var i = 0, len = edgeIndices.length; i < len; i+=2)\n // {\n // var key = positionsCompressed[edgeIndices[i]*3] + \"_\" + positionsCompressed[edgeIndices[i]*3+1] + \"_\" + positionsCompressed[edgeIndices[i]*3+2] + \"/\" +\n // positionsCompressed[edgeIndices[i+1]*3] + \"_\" + positionsCompressed[edgeIndices[i+1]*3+1] + \"_\" + positionsCompressed[edgeIndices[i+1]*3+2] + \"/\";\n\n // if (!(key in edgesDict)) {\n // var key2 = edgeIndices[i] + \"_\" + edgeIndices[i+1];\n\n // console.log (\" - Not found \" + key);\n // console.log (\" - Not found \" + key2);\n // // throw \"Ohhhh2!\";\n // }\n // }\n }\n}\n\nexport {rebucketPositions}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/rebucketPositions.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/rebucketPositions.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6161, + "__docId__": 6169, "kind": "variable", "name": "MAX_RE_BUCKET_FAN_OUT", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122200,7 +122416,7 @@ "ignore": true }, { - "__docId__": 6162, + "__docId__": 6170, "kind": "variable", "name": "bucketsForIndices", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122221,7 +122437,7 @@ "ignore": true }, { - "__docId__": 6163, + "__docId__": 6171, "kind": "function", "name": "compareBuckets", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122258,7 +122474,7 @@ "ignore": true }, { - "__docId__": 6164, + "__docId__": 6172, "kind": "function", "name": "preSortIndices", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122295,7 +122511,7 @@ "ignore": true }, { - "__docId__": 6165, + "__docId__": 6173, "kind": "variable", "name": "compareEdgeIndices", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122316,7 +122532,7 @@ "ignore": true }, { - "__docId__": 6166, + "__docId__": 6174, "kind": "function", "name": "compareIndices", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122353,7 +122569,7 @@ "ignore": true }, { - "__docId__": 6167, + "__docId__": 6175, "kind": "function", "name": "preSortEdgeIndices", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122384,7 +122600,7 @@ "ignore": true }, { - "__docId__": 6168, + "__docId__": 6176, "kind": "function", "name": "unbucket", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122415,7 +122631,7 @@ "ignore": true }, { - "__docId__": 6169, + "__docId__": 6177, "kind": "function", "name": "doCheckResult", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122448,7 +122664,7 @@ "ignore": true }, { - "__docId__": 6170, + "__docId__": 6178, "kind": "function", "name": "rebucketPositions", "memberof": "src/viewer/scene/model/rebucketPositions.js", @@ -122510,18 +122726,18 @@ } }, { - "__docId__": 6171, + "__docId__": 6179, "kind": "file", "name": "src/viewer/scene/model/vbo/ScratchMemory.js", "content": "/**\n * Provides scratch memory for methods like TrianglesBatchingLayer setFlags() and setColors(),\n * so they don't need to allocate temporary arrays that need garbage collection.\n *\n * @private\n */\nclass ScratchMemory {\n\n constructor() {\n this._uint8Arrays = {};\n this._float32Arrays = {};\n }\n\n _clear() {\n this._uint8Arrays = {};\n this._float32Arrays = {};\n }\n\n getUInt8Array(len) {\n let uint8Array = this._uint8Arrays[len];\n if (!uint8Array) {\n uint8Array = new Uint8Array(len);\n this._uint8Arrays[len] = uint8Array;\n }\n return uint8Array;\n }\n\n getFloat32Array(len) {\n let float32Array = this._float32Arrays[len];\n if (!float32Array) {\n float32Array = new Float32Array(len);\n this._float32Arrays[len] = float32Array;\n }\n return float32Array;\n }\n}\n\nconst batchingLayerScratchMemory = new ScratchMemory();\n\nlet countUsers = 0;\n\n/**\n * @private\n */\nfunction getScratchMemory() {\n countUsers++;\n return batchingLayerScratchMemory;\n}\n\n/**\n * @private\n */\nfunction putScratchMemory() {\n if (countUsers === 0) {\n return;\n }\n countUsers--;\n if (countUsers === 0) {\n batchingLayerScratchMemory._clear();\n }\n}\n\nexport {getScratchMemory, putScratchMemory};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/ScratchMemory.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/ScratchMemory.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6172, + "__docId__": 6180, "kind": "class", "name": "ScratchMemory", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js", @@ -122537,7 +122753,7 @@ "ignore": true }, { - "__docId__": 6173, + "__docId__": 6181, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122551,7 +122767,7 @@ "undocument": true }, { - "__docId__": 6174, + "__docId__": 6182, "kind": "member", "name": "_uint8Arrays", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122569,7 +122785,7 @@ } }, { - "__docId__": 6175, + "__docId__": 6183, "kind": "member", "name": "_float32Arrays", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122587,7 +122803,7 @@ } }, { - "__docId__": 6176, + "__docId__": 6184, "kind": "method", "name": "_clear", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122604,7 +122820,7 @@ "return": null }, { - "__docId__": 6179, + "__docId__": 6187, "kind": "method", "name": "getUInt8Array", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122631,7 +122847,7 @@ } }, { - "__docId__": 6180, + "__docId__": 6188, "kind": "method", "name": "getFloat32Array", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js~ScratchMemory", @@ -122658,7 +122874,7 @@ } }, { - "__docId__": 6181, + "__docId__": 6189, "kind": "variable", "name": "batchingLayerScratchMemory", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js", @@ -122679,7 +122895,7 @@ "ignore": true }, { - "__docId__": 6182, + "__docId__": 6190, "kind": "variable", "name": "countUsers", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js", @@ -122700,7 +122916,7 @@ "ignore": true }, { - "__docId__": 6183, + "__docId__": 6191, "kind": "function", "name": "getScratchMemory", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js", @@ -122723,7 +122939,7 @@ } }, { - "__docId__": 6184, + "__docId__": 6192, "kind": "function", "name": "putScratchMemory", "memberof": "src/viewer/scene/model/vbo/ScratchMemory.js", @@ -122742,18 +122958,18 @@ "return": null }, { - "__docId__": 6185, + "__docId__": 6193, "kind": "file", "name": "src/viewer/scene/model/vbo/VBORenderer.js", "content": "import {createRTCViewMat, getPlaneRTCPos} from \"../../math/rtcCoords.js\";\nimport {math} from \"../../math/math.js\";\nimport {Program} from \"../../webgl/Program.js\";\nimport {stats} from \"../../stats.js\"\nimport {WEBGL_INFO} from \"../../webglInfo.js\";\nimport {RENDER_PASSES} from \"./../RENDER_PASSES.js\";\n\nconst defaultColor = new Float32Array([1, 1, 1, 1]);\nconst edgesDefaultColor = new Float32Array([0, 0, 0, 1]);\n\nconst tempVec4 = math.vec4();\nconst tempVec3a = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempMat4a = math.mat4();\n\n/**\n * @private\n */\nexport class VBORenderer {\n constructor(scene, withSAO = false, {instancing = false, edges = false} = {}) {\n this._scene = scene;\n this._withSAO = withSAO;\n this._instancing = instancing;\n this._edges = edges;\n this._hash = this._getHash();\n\n /**\n * Matrices Uniform Block Buffer\n *\n * In shaders, matrices in the Matrices Uniform Block MUST be set in this order:\n * - worldMatrix\n * - viewMatrix\n * - projMatrix\n * - positionsDecodeMatrix\n * - worldNormalMatrix\n * - viewNormalMatrix\n */\n this._matricesUniformBlockBufferBindingPoint = 0;\n\n this._matricesUniformBlockBuffer = this._scene.canvas.gl.createBuffer();\n this._matricesUniformBlockBufferData = new Float32Array(4 * 4 * 6); // there is 6 mat4\n\n /**\n * A Vertex Array Object by Layer\n */\n this._vaoCache = new WeakMap();\n\n this._allocate();\n }\n\n /**\n * Should be overrided by subclasses if it does not only \"depend\" on section planes state.\n * @returns { string }\n */\n _getHash() {\n return this._scene._sectionPlanesState.getHash();\n }\n\n _buildShader() {\n return {\n vertex: this._buildVertexShader(),\n fragment: this._buildFragmentShader()\n };\n }\n\n _buildVertexShader() {\n return [\"\"];\n }\n\n _buildFragmentShader() {\n return [\"\"];\n }\n\n _addMatricesUniformBlockLines(src, normals = false) {\n src.push(\"uniform Matrices {\");\n src.push(\" mat4 worldMatrix;\");\n src.push(\" mat4 viewMatrix;\");\n src.push(\" mat4 projMatrix;\");\n src.push(\" mat4 positionsDecodeMatrix;\");\n if (normals) {\n src.push(\" mat4 worldNormalMatrix;\");\n src.push(\" mat4 viewNormalMatrix;\");\n }\n src.push(\"};\");\n return src;\n }\n\n _addRemapClipPosLines(src, viewportSize = 1) {\n src.push(\"uniform vec2 drawingBufferSize;\");\n src.push(\"uniform vec2 pickClipPos;\");\n\n src.push(\"vec4 remapClipPos(vec4 clipPos) {\");\n src.push(\" clipPos.xy /= clipPos.w;\");\n if (viewportSize === 1) {\n src.push(\" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;\");\n } else {\n src.push(` clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(${viewportSize}));`);\n }\n src.push(\" clipPos.xy *= clipPos.w;\")\n src.push(\" return clipPos;\")\n src.push(\"}\");\n return src;\n }\n\n getValid() {\n return this._hash === this._getHash();\n }\n\n setSectionPlanesStateUniforms(layer) {\n const scene = this._scene;\n const {gl} = scene.canvas;\n const {model, layerIndex} = layer;\n\n const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();\n const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;\n if (numAllocatedSectionPlanes > 0) {\n const sectionPlanes = scene._sectionPlanesState.sectionPlanes;\n const baseIndex = layerIndex * numSectionPlanes;\n const renderFlags = model.renderFlags;\n if (scene.crossSections) {\n gl.uniform4fv(this._uSliceColor, scene.crossSections.sliceColor);\n gl.uniform1f(this._uSliceThickness, scene.crossSections.sliceThickness);\n }\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n if (sectionPlaneIndex < numSectionPlanes) {\n const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n const origin = layer._state.origin;\n if (origin) {\n const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);\n gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);\n } else {\n gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);\n }\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n } else {\n gl.uniform1i(sectionPlaneUniforms.active, 0);\n }\n }\n }\n }\n }\n\n\n _allocate() {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const lightsState = scene._lightsState;\n\n this._program = new Program(gl, this._buildShader());\n\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n\n const program = this._program;\n\n this._uRenderPass = program.getLocation(\"renderPass\");\n\n this._uColor = program.getLocation(\"color\");\n if (!this._uColor) {\n // some shader may have color as attribute, in this case the uniform must be renamed silhouetteColor\n this._uColor = program.getLocation(\"silhouetteColor\");\n }\n this._uUVDecodeMatrix = program.getLocation(\"uvDecodeMatrix\");\n this._uPickInvisible = program.getLocation(\"pickInvisible\");\n this._uGammaFactor = program.getLocation(\"gammaFactor\");\n\n gl.uniformBlockBinding(\n program.handle,\n gl.getUniformBlockIndex(program.handle, \"Matrices\"),\n this._matricesUniformBlockBufferBindingPoint\n );\n\n this._uShadowViewMatrix = program.getLocation(\"shadowViewMatrix\");\n this._uShadowProjMatrix = program.getLocation(\"shadowProjMatrix\");\n if (scene.logarithmicDepthBufferEnabled) {\n this._uZFar = program.getLocation(\"zFar\");\n }\n\n this._uLightAmbient = program.getLocation(\"lightAmbient\");\n this._uLightColor = [];\n this._uLightDir = [];\n this._uLightPos = [];\n this._uLightAttenuation = [];\n\n // TODO add a gard to prevent light params if not affected by light ?\n const lights = lightsState.lights;\n let light;\n\n for (let i = 0, len = lights.length; i < len; i++) {\n light = lights[i];\n switch (light.type) {\n case \"dir\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = null;\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n break;\n case \"point\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = null;\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n case \"spot\":\n this._uLightColor[i] = program.getLocation(\"lightColor\" + i);\n this._uLightPos[i] = program.getLocation(\"lightPos\" + i);\n this._uLightDir[i] = program.getLocation(\"lightDir\" + i);\n this._uLightAttenuation[i] = program.getLocation(\"lightAttenuation\" + i);\n break;\n }\n }\n\n if (lightsState.reflectionMaps.length > 0) {\n this._uReflectionMap = \"reflectionMap\";\n }\n\n if (lightsState.lightMaps.length > 0) {\n this._uLightMap = \"lightMap\";\n }\n\n this._uSectionPlanes = [];\n\n for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n\n this._aPosition = program.getAttribute(\"position\");\n this._aOffset = program.getAttribute(\"offset\");\n this._aNormal = program.getAttribute(\"normal\");\n this._aUV = program.getAttribute(\"uv\");\n this._aColor = program.getAttribute(\"color\");\n this._aMetallicRoughness = program.getAttribute(\"metallicRoughness\");\n this._aFlags = program.getAttribute(\"flags\");\n this._aPickColor = program.getAttribute(\"pickColor\");\n this._uPickZNear = program.getLocation(\"pickZNear\");\n this._uPickZFar = program.getLocation(\"pickZFar\");\n this._uPickClipPos = program.getLocation(\"pickClipPos\");\n this._uDrawingBufferSize = program.getLocation(\"drawingBufferSize\");\n\n this._uColorMap = \"uColorMap\";\n this._uMetallicRoughMap = \"uMetallicRoughMap\";\n this._uEmissiveMap = \"uEmissiveMap\";\n this._uNormalMap = \"uNormalMap\";\n this._uAOMap = \"uAOMap\";\n\n if (this._instancing) {\n\n this._aModelMatrix = program.getAttribute(\"modelMatrix\");\n\n this._aModelMatrixCol0 = program.getAttribute(\"modelMatrixCol0\");\n this._aModelMatrixCol1 = program.getAttribute(\"modelMatrixCol1\");\n this._aModelMatrixCol2 = program.getAttribute(\"modelMatrixCol2\");\n\n this._aModelNormalMatrixCol0 = program.getAttribute(\"modelNormalMatrixCol0\");\n this._aModelNormalMatrixCol1 = program.getAttribute(\"modelNormalMatrixCol1\");\n this._aModelNormalMatrixCol2 = program.getAttribute(\"modelNormalMatrixCol2\");\n }\n\n if (this._withSAO) {\n this._uOcclusionTexture = \"uOcclusionTexture\";\n this._uSAOParams = program.getLocation(\"uSAOParams\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n if (scene.pointsMaterial._state.filterIntensity) {\n this._uIntensityRange = program.getLocation(\"intensityRange\");\n }\n\n this._uPointSize = program.getLocation(\"pointSize\");\n this._uNearPlaneHeight = program.getLocation(\"nearPlaneHeight\");\n\n if (scene.crossSections) {\n this._uSliceColor = program.getLocation(\"sliceColor\");\n this._uSliceThickness = program.getLocation(\"sliceThickness\");\n }\n }\n\n _bindProgram(frameCtx) {\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const lightsState = scene._lightsState;\n const lights = lightsState.lights;\n\n program.bind();\n\n frameCtx.textureUnit = 0;\n\n if (this._uLightAmbient) {\n gl.uniform4fv(this._uLightAmbient, lightsState.getAmbientColorAndIntensity());\n }\n\n if (this._uGammaFactor) {\n gl.uniform1f(this._uGammaFactor, scene.gammaFactor);\n }\n\n for (let i = 0, len = lights.length; i < len; i++) {\n\n const light = lights[i];\n\n if (this._uLightColor[i]) {\n gl.uniform4f(this._uLightColor[i], light.color[0], light.color[1], light.color[2], light.intensity);\n }\n if (this._uLightPos[i]) {\n gl.uniform3fv(this._uLightPos[i], light.pos);\n if (this._uLightAttenuation[i]) {\n gl.uniform1f(this._uLightAttenuation[i], light.attenuation);\n }\n }\n if (this._uLightDir[i]) {\n gl.uniform3fv(this._uLightDir[i], light.dir);\n }\n }\n }\n\n _makeVAO(state) {\n const gl = this._scene.canvas.gl;\n const vao = gl.createVertexArray();\n gl.bindVertexArray(vao);\n\n if (this._instancing) {\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n if (this._aModelNormalMatrixCol0) {\n this._aModelNormalMatrixCol0.bindArrayBuffer(state.modelNormalMatrixCol0Buf);\n gl.vertexAttribDivisor(this._aModelNormalMatrixCol0.location, 1);\n }\n if (this._aModelNormalMatrixCol1) {\n this._aModelNormalMatrixCol1.bindArrayBuffer(state.modelNormalMatrixCol1Buf);\n gl.vertexAttribDivisor(this._aModelNormalMatrixCol1.location, 1);\n }\n if (this._aModelNormalMatrixCol2) {\n this._aModelNormalMatrixCol2.bindArrayBuffer(state.modelNormalMatrixCol2Buf);\n gl.vertexAttribDivisor(this._aModelNormalMatrixCol2.location, 1);\n }\n\n }\n\n this._aPosition.bindArrayBuffer(state.positionsBuf);\n\n if (this._aUV) {\n this._aUV.bindArrayBuffer(state.uvBuf);\n }\n\n if (this._aNormal) {\n this._aNormal.bindArrayBuffer(state.normalsBuf);\n }\n\n if (this._aMetallicRoughness) {\n this._aMetallicRoughness.bindArrayBuffer(state.metallicRoughnessBuf);\n if (this._instancing) {\n gl.vertexAttribDivisor(this._aMetallicRoughness.location, 1);\n }\n }\n\n if (this._aColor) {\n this._aColor.bindArrayBuffer(state.colorsBuf);\n if (this._instancing && state.colorsBuf) {\n gl.vertexAttribDivisor(this._aColor.location, 1);\n }\n }\n\n if (this._aFlags) {\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n if (this._instancing) {\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n }\n }\n\n if (this._aOffset) {\n this._aOffset.bindArrayBuffer(state.offsetsBuf);\n if (this._instancing) {\n gl.vertexAttribDivisor(this._aOffset.location, 1);\n }\n }\n\n if (this._aPickColor) {\n this._aPickColor.bindArrayBuffer(state.pickColorsBuf);\n if (this._instancing) {\n gl.vertexAttribDivisor(this._aPickColor.location, 1);\n }\n }\n\n if (this._instancing) {\n if (this._edges) {\n state.edgeIndicesBuf.bind();\n } else {\n if (state.indicesBuf) {\n state.indicesBuf.bind();\n }\n }\n } else {\n if (this._edges) {\n state.edgeIndicesBuf.bind();\n } else {\n if (state.indicesBuf) {\n state.indicesBuf.bind();\n }\n }\n }\n\n return vao;\n }\n\n drawLayer(frameCtx, layer, renderPass, {colorUniform = false, incrementDrawState = false} = {}) {\n const maxTextureUnits = WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const {_state: state, model} = layer;\n const {textureSet, origin, positionsDecodeMatrix} = state;\n const lightsState = scene._lightsState;\n const pointsMaterial = scene.pointsMaterial;\n const {camera} = model.scene;\n const {viewNormalMatrix, project} = camera;\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix\n const {position, rotationMatrix, rotationMatrixConjugate, worldNormalMatrix} = model;\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram(frameCtx);\n }\n\n if (this._vaoCache.has(layer)) {\n gl.bindVertexArray(this._vaoCache.get(layer));\n } else {\n this._vaoCache.set(layer, this._makeVAO(state))\n }\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n\n const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);\n const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);\n if (gotOrigin || gotPosition) {\n const rtcOrigin = tempVec3a;\n if (gotOrigin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n this._matricesUniformBlockBufferData.set(createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a), offset += mat4Size);\n } else {\n this._matricesUniformBlockBufferData.set(viewMatrix, offset += mat4Size);\n }\n\n this._matricesUniformBlockBufferData.set(frameCtx.pickProjMatrix || project.matrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(positionsDecodeMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(worldNormalMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(viewNormalMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n\n gl.uniform1i(this._uRenderPass, renderPass);\n\n this.setSectionPlanesStateUniforms(layer);\n\n if (scene.logarithmicDepthBufferEnabled) {\n if (this._uLogDepthBufFC) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n if (this._uZFar) {\n gl.uniform1f(this._uZFar, scene.camera.project.far)\n }\n }\n\n if (this._uPickInvisible) {\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n }\n\n if (this._uPickZNear) {\n gl.uniform1f(this._uPickZNear, frameCtx.pickZNear);\n }\n\n if (this._uPickZFar) {\n gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);\n }\n\n if (this._uPickClipPos) {\n gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);\n }\n\n if (this._uDrawingBufferSize) {\n gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);\n }\n\n if (this._uUVDecodeMatrix) {\n gl.uniformMatrix3fv(this._uUVDecodeMatrix, false, state.uvDecodeMatrix);\n }\n\n if (this._uIntensityRange && pointsMaterial.filterIntensity) {\n gl.uniform2f(this._uIntensityRange, pointsMaterial.minIntensity, pointsMaterial.maxIntensity);\n }\n\n if (this._uPointSize) {\n gl.uniform1f(this._uPointSize, pointsMaterial.pointSize);\n }\n\n if (this._uNearPlaneHeight) {\n const nearPlaneHeight = (scene.camera.projection === \"ortho\") ?\n 1.0\n : (gl.drawingBufferHeight / (2 * Math.tan(0.5 * scene.camera.perspective.fov * Math.PI / 180.0)));\n gl.uniform1f(this._uNearPlaneHeight, nearPlaneHeight);\n }\n\n if (textureSet) {\n const {\n colorTexture,\n metallicRoughnessTexture,\n emissiveTexture,\n normalsTexture,\n occlusionTexture,\n } = textureSet;\n\n if (this._uColorMap && colorTexture) {\n this._program.bindTexture(this._uColorMap, colorTexture.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n }\n if (this._uMetallicRoughMap && metallicRoughnessTexture) {\n this._program.bindTexture(this._uMetallicRoughMap, metallicRoughnessTexture.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n }\n if (this._uEmissiveMap && emissiveTexture) {\n this._program.bindTexture(this._uEmissiveMap, emissiveTexture.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n }\n if (this._uNormalMap && normalsTexture) {\n this._program.bindTexture(this._uNormalMap, normalsTexture.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n }\n if (this._uAOMap && occlusionTexture) {\n this._program.bindTexture(this._uAOMap, occlusionTexture.texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n }\n\n }\n\n if (lightsState.reflectionMaps.length > 0 && lightsState.reflectionMaps[0].texture && this._uReflectionMap) {\n this._program.bindTexture(this._uReflectionMap, lightsState.reflectionMaps[0].texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n\n if (lightsState.lightMaps.length > 0 && lightsState.lightMaps[0].texture && this._uLightMap) {\n this._program.bindTexture(this._uLightMap, lightsState.lightMaps[0].texture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n\n if (this._withSAO) {\n const sao = scene.sao;\n const saoEnabled = sao.possible;\n if (saoEnabled) {\n const viewportWidth = gl.drawingBufferWidth;\n const viewportHeight = gl.drawingBufferHeight;\n tempVec4[0] = viewportWidth;\n tempVec4[1] = viewportHeight;\n tempVec4[2] = sao.blendCutoff;\n tempVec4[3] = sao.blendFactor;\n gl.uniform4fv(this._uSAOParams, tempVec4);\n this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, frameCtx.textureUnit);\n frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;\n frameCtx.bindTexture++;\n }\n }\n\n if (colorUniform) {\n const colorKey = this._edges ? \"edgeColor\" : \"fillColor\";\n const alphaKey = this._edges ? \"edgeAlpha\" : \"fillAlpha\";\n\n if (renderPass === RENDER_PASSES[`${this._edges ? \"EDGES\" : \"SILHOUETTE\"}_XRAYED`]) {\n const material = scene.xrayMaterial._state;\n const color = material[colorKey];\n const alpha = material[alphaKey];\n gl.uniform4f(this._uColor, color[0], color[1], color[2], alpha);\n\n } else if (renderPass === RENDER_PASSES[`${this._edges ? \"EDGES\" : \"SILHOUETTE\"}_HIGHLIGHTED`]) {\n const material = scene.highlightMaterial._state;\n const color = material[colorKey];\n const alpha = material[alphaKey];\n gl.uniform4f(this._uColor, color[0], color[1], color[2], alpha);\n\n } else if (renderPass === RENDER_PASSES[`${this._edges ? \"EDGES\" : \"SILHOUETTE\"}_SELECTED`]) {\n const material = scene.selectedMaterial._state;\n const color = material[colorKey];\n const alpha = material[alphaKey];\n gl.uniform4f(this._uColor, color[0], color[1], color[2], alpha);\n\n } else {\n gl.uniform4fv(this._uColor, this._edges ? edgesDefaultColor : defaultColor);\n }\n }\n\n this._draw({state, frameCtx, incrementDrawState});\n\n gl.bindVertexArray(null);\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n stats.memory.programs--;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/VBORenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/VBORenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6186, + "__docId__": 6194, "kind": "variable", "name": "defaultColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122774,7 +122990,7 @@ "ignore": true }, { - "__docId__": 6187, + "__docId__": 6195, "kind": "variable", "name": "edgesDefaultColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122795,7 +123011,7 @@ "ignore": true }, { - "__docId__": 6188, + "__docId__": 6196, "kind": "variable", "name": "tempVec4", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122816,7 +123032,7 @@ "ignore": true }, { - "__docId__": 6189, + "__docId__": 6197, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122837,7 +123053,7 @@ "ignore": true }, { - "__docId__": 6190, + "__docId__": 6198, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122858,7 +123074,7 @@ "ignore": true }, { - "__docId__": 6191, + "__docId__": 6199, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122879,7 +123095,7 @@ "ignore": true }, { - "__docId__": 6192, + "__docId__": 6200, "kind": "class", "name": "VBORenderer", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js", @@ -122895,7 +123111,7 @@ "ignore": true }, { - "__docId__": 6193, + "__docId__": 6201, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122909,7 +123125,7 @@ "undocument": true }, { - "__docId__": 6194, + "__docId__": 6202, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122927,7 +123143,7 @@ } }, { - "__docId__": 6195, + "__docId__": 6203, "kind": "member", "name": "_withSAO", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122945,7 +123161,7 @@ } }, { - "__docId__": 6196, + "__docId__": 6204, "kind": "member", "name": "_instancing", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122963,7 +123179,7 @@ } }, { - "__docId__": 6197, + "__docId__": 6205, "kind": "member", "name": "_edges", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122981,7 +123197,7 @@ } }, { - "__docId__": 6198, + "__docId__": 6206, "kind": "member", "name": "_hash", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -122999,7 +123215,7 @@ } }, { - "__docId__": 6199, + "__docId__": 6207, "kind": "member", "name": "_matricesUniformBlockBufferBindingPoint", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123016,7 +123232,7 @@ } }, { - "__docId__": 6200, + "__docId__": 6208, "kind": "member", "name": "_matricesUniformBlockBuffer", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123034,7 +123250,7 @@ } }, { - "__docId__": 6201, + "__docId__": 6209, "kind": "member", "name": "_matricesUniformBlockBufferData", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123052,7 +123268,7 @@ } }, { - "__docId__": 6202, + "__docId__": 6210, "kind": "member", "name": "_vaoCache", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123069,7 +123285,7 @@ } }, { - "__docId__": 6203, + "__docId__": 6211, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123098,7 +123314,7 @@ "params": [] }, { - "__docId__": 6204, + "__docId__": 6212, "kind": "method", "name": "_buildShader", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123119,7 +123335,7 @@ } }, { - "__docId__": 6205, + "__docId__": 6213, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123140,7 +123356,7 @@ } }, { - "__docId__": 6206, + "__docId__": 6214, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123161,7 +123377,7 @@ } }, { - "__docId__": 6207, + "__docId__": 6215, "kind": "method", "name": "_addMatricesUniformBlockLines", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123198,7 +123414,7 @@ } }, { - "__docId__": 6208, + "__docId__": 6216, "kind": "method", "name": "_addRemapClipPosLines", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123235,7 +123451,7 @@ } }, { - "__docId__": 6209, + "__docId__": 6217, "kind": "method", "name": "getValid", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123255,7 +123471,7 @@ } }, { - "__docId__": 6210, + "__docId__": 6218, "kind": "method", "name": "setSectionPlanesStateUniforms", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123278,7 +123494,7 @@ "return": null }, { - "__docId__": 6211, + "__docId__": 6219, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123295,7 +123511,7 @@ "return": null }, { - "__docId__": 6212, + "__docId__": 6220, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123313,7 +123529,7 @@ } }, { - "__docId__": 6213, + "__docId__": 6221, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123330,7 +123546,7 @@ } }, { - "__docId__": 6214, + "__docId__": 6222, "kind": "member", "name": "_uRenderPass", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123348,7 +123564,7 @@ } }, { - "__docId__": 6215, + "__docId__": 6223, "kind": "member", "name": "_uColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123366,7 +123582,7 @@ } }, { - "__docId__": 6217, + "__docId__": 6225, "kind": "member", "name": "_uUVDecodeMatrix", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123384,7 +123600,7 @@ } }, { - "__docId__": 6218, + "__docId__": 6226, "kind": "member", "name": "_uPickInvisible", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123402,7 +123618,7 @@ } }, { - "__docId__": 6219, + "__docId__": 6227, "kind": "member", "name": "_uGammaFactor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123420,7 +123636,7 @@ } }, { - "__docId__": 6220, + "__docId__": 6228, "kind": "member", "name": "_uShadowViewMatrix", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123438,7 +123654,7 @@ } }, { - "__docId__": 6221, + "__docId__": 6229, "kind": "member", "name": "_uShadowProjMatrix", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123456,7 +123672,7 @@ } }, { - "__docId__": 6222, + "__docId__": 6230, "kind": "member", "name": "_uZFar", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123474,7 +123690,7 @@ } }, { - "__docId__": 6223, + "__docId__": 6231, "kind": "member", "name": "_uLightAmbient", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123492,7 +123708,7 @@ } }, { - "__docId__": 6224, + "__docId__": 6232, "kind": "member", "name": "_uLightColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123510,7 +123726,7 @@ } }, { - "__docId__": 6225, + "__docId__": 6233, "kind": "member", "name": "_uLightDir", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123528,7 +123744,7 @@ } }, { - "__docId__": 6226, + "__docId__": 6234, "kind": "member", "name": "_uLightPos", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123546,7 +123762,7 @@ } }, { - "__docId__": 6227, + "__docId__": 6235, "kind": "member", "name": "_uLightAttenuation", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123564,7 +123780,7 @@ } }, { - "__docId__": 6228, + "__docId__": 6236, "kind": "member", "name": "_uReflectionMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123582,7 +123798,7 @@ } }, { - "__docId__": 6229, + "__docId__": 6237, "kind": "member", "name": "_uLightMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123600,7 +123816,7 @@ } }, { - "__docId__": 6230, + "__docId__": 6238, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123618,7 +123834,7 @@ } }, { - "__docId__": 6231, + "__docId__": 6239, "kind": "member", "name": "_aPosition", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123636,7 +123852,7 @@ } }, { - "__docId__": 6232, + "__docId__": 6240, "kind": "member", "name": "_aOffset", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123654,7 +123870,7 @@ } }, { - "__docId__": 6233, + "__docId__": 6241, "kind": "member", "name": "_aNormal", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123672,7 +123888,7 @@ } }, { - "__docId__": 6234, + "__docId__": 6242, "kind": "member", "name": "_aUV", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123690,7 +123906,7 @@ } }, { - "__docId__": 6235, + "__docId__": 6243, "kind": "member", "name": "_aColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123708,7 +123924,7 @@ } }, { - "__docId__": 6236, + "__docId__": 6244, "kind": "member", "name": "_aMetallicRoughness", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123726,7 +123942,7 @@ } }, { - "__docId__": 6237, + "__docId__": 6245, "kind": "member", "name": "_aFlags", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123744,7 +123960,7 @@ } }, { - "__docId__": 6238, + "__docId__": 6246, "kind": "member", "name": "_aPickColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123762,7 +123978,7 @@ } }, { - "__docId__": 6239, + "__docId__": 6247, "kind": "member", "name": "_uPickZNear", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123780,7 +123996,7 @@ } }, { - "__docId__": 6240, + "__docId__": 6248, "kind": "member", "name": "_uPickZFar", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123798,7 +124014,7 @@ } }, { - "__docId__": 6241, + "__docId__": 6249, "kind": "member", "name": "_uPickClipPos", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123816,7 +124032,7 @@ } }, { - "__docId__": 6242, + "__docId__": 6250, "kind": "member", "name": "_uDrawingBufferSize", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123834,7 +124050,7 @@ } }, { - "__docId__": 6243, + "__docId__": 6251, "kind": "member", "name": "_uColorMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123852,7 +124068,7 @@ } }, { - "__docId__": 6244, + "__docId__": 6252, "kind": "member", "name": "_uMetallicRoughMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123870,7 +124086,7 @@ } }, { - "__docId__": 6245, + "__docId__": 6253, "kind": "member", "name": "_uEmissiveMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123888,7 +124104,7 @@ } }, { - "__docId__": 6246, + "__docId__": 6254, "kind": "member", "name": "_uNormalMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123906,7 +124122,7 @@ } }, { - "__docId__": 6247, + "__docId__": 6255, "kind": "member", "name": "_uAOMap", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123924,7 +124140,7 @@ } }, { - "__docId__": 6248, + "__docId__": 6256, "kind": "member", "name": "_aModelMatrix", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123942,7 +124158,7 @@ } }, { - "__docId__": 6249, + "__docId__": 6257, "kind": "member", "name": "_aModelMatrixCol0", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123960,7 +124176,7 @@ } }, { - "__docId__": 6250, + "__docId__": 6258, "kind": "member", "name": "_aModelMatrixCol1", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123978,7 +124194,7 @@ } }, { - "__docId__": 6251, + "__docId__": 6259, "kind": "member", "name": "_aModelMatrixCol2", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -123996,7 +124212,7 @@ } }, { - "__docId__": 6252, + "__docId__": 6260, "kind": "member", "name": "_aModelNormalMatrixCol0", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124014,7 +124230,7 @@ } }, { - "__docId__": 6253, + "__docId__": 6261, "kind": "member", "name": "_aModelNormalMatrixCol1", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124032,7 +124248,7 @@ } }, { - "__docId__": 6254, + "__docId__": 6262, "kind": "member", "name": "_aModelNormalMatrixCol2", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124050,7 +124266,7 @@ } }, { - "__docId__": 6255, + "__docId__": 6263, "kind": "member", "name": "_uOcclusionTexture", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124068,7 +124284,7 @@ } }, { - "__docId__": 6256, + "__docId__": 6264, "kind": "member", "name": "_uSAOParams", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124086,7 +124302,7 @@ } }, { - "__docId__": 6257, + "__docId__": 6265, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124104,7 +124320,7 @@ } }, { - "__docId__": 6258, + "__docId__": 6266, "kind": "member", "name": "_uIntensityRange", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124122,7 +124338,7 @@ } }, { - "__docId__": 6259, + "__docId__": 6267, "kind": "member", "name": "_uPointSize", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124140,7 +124356,7 @@ } }, { - "__docId__": 6260, + "__docId__": 6268, "kind": "member", "name": "_uNearPlaneHeight", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124158,7 +124374,7 @@ } }, { - "__docId__": 6261, + "__docId__": 6269, "kind": "member", "name": "_uSliceColor", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124176,7 +124392,7 @@ } }, { - "__docId__": 6262, + "__docId__": 6270, "kind": "member", "name": "_uSliceThickness", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124194,7 +124410,7 @@ } }, { - "__docId__": 6263, + "__docId__": 6271, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124218,7 +124434,7 @@ "return": null }, { - "__docId__": 6264, + "__docId__": 6272, "kind": "method", "name": "_makeVAO", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124246,7 +124462,7 @@ } }, { - "__docId__": 6265, + "__docId__": 6273, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124290,7 +124506,7 @@ "return": null }, { - "__docId__": 6266, + "__docId__": 6274, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124306,7 +124522,7 @@ "return": null }, { - "__docId__": 6268, + "__docId__": 6276, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer", @@ -124322,18 +124538,18 @@ "return": null }, { - "__docId__": 6270, + "__docId__": 6278, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {getRenderers} from \"./renderers/VBOBatchingLinesRenderers.js\";\nimport {VBOBatchingLinesBuffer} from \"./lib/VBOBatchingLinesBuffer.js\";\nimport {quantizePositions} from \"../../../compression.js\";\n\n/**\n * @private\n */\nexport class VBOBatchingLinesLayer {\n\n /**\n * @param model\n * @param cfg\n * @param cfg.layerIndex\n * @param cfg.positionsDecodeMatrix\n * @param cfg.maxGeometryBatchSize\n * @param cfg.origin\n * @param cfg.scratchMemory\n */\n constructor(cfg) {\n\n console.info(\"Creating VBOBatchingLinesLayer\");\n\n /**\n * Index of this LinesBatchingLayer in {@link VBOSceneModel#_layerList}.\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n this.model = cfg.model;\n this._buffer = new VBOBatchingLinesBuffer(cfg.maxGeometryBatchSize);\n this._scratchMemory = cfg.scratchMemory;\n\n this._state = new RenderState({\n positionsBuf: null,\n offsetsBuf: null,\n colorsBuf: null,\n flagsBuf: null,\n indicesBuf: null,\n positionsDecodeMatrix: math.mat4(),\n origin: null\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numEdgesLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n this._modelAABB = math.collapseAABB3(); // Model-space AABB\n this._portions = [];\n this._meshes = [];\n this._numVerts = 0;\n\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n this._finalized = false;\n\n if (cfg.positionsDecodeMatrix) {\n this._state.positionsDecodeMatrix.set(cfg.positionsDecodeMatrix);\n this._preCompressedPositionsExpected = true;\n } else {\n this._preCompressedPositionsExpected = false;\n }\n\n if (cfg.origin) {\n this._state.origin = math.vec3(cfg.origin);\n }\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Tests if there is room for another portion in this LinesBatchingLayer.\n *\n * @param lenPositions Number of positions we'd like to create in the portion.\n * @param lenIndices Number of indices we'd like to create in this portion.\n * @returns {Boolean} True if OK to create another portion.\n */\n canCreatePortion(lenPositions, lenIndices) {\n if (this._finalized) {\n throw \"Already finalized\";\n }\n return ((this._buffer.positions.length + lenPositions) < (this._buffer.maxVerts * 3) && (this._buffer.indices.length + lenIndices) < (this._buffer.maxIndices));\n }\n\n /**\n * Creates a new portion within this LinesBatchingLayer, returns the new portion ID.\n *\n * Gives the portion the specified geometry, color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg.positions Flat float Local-space positions array.\n * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix\n * @param cfg.indices Flat int indices array.\n * @param cfg.color Quantized RGB color [0..255,0..255,0..255,0..255]\n * @param cfg.opacity Opacity [0..255]\n * @param [cfg.meshMatrix] Flat float 4x4 matrix\n * @param cfg.aabb Flat float AABB World-space AABB\n * @param cfg.pickColor Quantized pick color\n * @returns {number} Portion ID\n */\n createPortion(mesh, cfg) {\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n const positions = cfg.positions;\n const positionsCompressed = cfg.positionsCompressed;\n const indices = cfg.indices;\n const color = cfg.color;\n const opacity = cfg.opacity;\n\n const buffer = this._buffer;\n const positionsIndex = buffer.positions.length;\n const vertsIndex = positionsIndex / 3;\n\n let numVerts;\n\n math.expandAABB3(this._modelAABB, cfg.aabb);\n\n if (this._preCompressedPositionsExpected) {\n if (!positionsCompressed) {\n throw \"positionsCompressed expected\";\n }\n numVerts = positionsCompressed.length / 3;\n for (let i = 0, len = positionsCompressed.length; i < len; i++) {\n buffer.positions.push(positionsCompressed[i]);\n }\n } else {\n if (!positions) {\n throw \"positions expected\";\n }\n numVerts = positions.length / 3;\n for (let i = 0, len = positions.length; i < len; i++) {\n buffer.positions.push(positions[i]);\n }\n }\n\n if (color) {\n\n const r = color[0]; // Color is pre-quantized by VBOSceneModel\n const g = color[1];\n const b = color[2];\n const a = opacity;\n\n for (let i = 0; i < numVerts; i++) {\n buffer.colors.push(r);\n buffer.colors.push(g);\n buffer.colors.push(b);\n buffer.colors.push(a);\n }\n }\n\n if (indices) {\n for (let i = 0, len = indices.length; i < len; i++) {\n buffer.indices.push(indices[i] + vertsIndex);\n }\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n for (let i = 0; i < numVerts; i++) {\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n }\n }\n\n const portionId = this._portions.length / 2;\n\n this._portions.push(vertsIndex);\n this._portions.push(numVerts);\n\n this._numPortions++;\n this.model.numPortions++;\n\n this._numVerts += numVerts;\n\n this._meshes.push(mesh);\n\n return portionId;\n }\n\n /**\n * Builds batch VBOs from appended geometries.\n * No more portions can then be created.\n */\n finalize() {\n\n if (this._finalized) {\n return;\n }\n\n const state = this._state;\n const gl = this.model.scene.canvas.gl;\n const buffer = this._buffer;\n\n if (buffer.positions.length > 0) {\n if (this._preCompressedPositionsExpected) {\n const positions = new Uint16Array(buffer.positions);\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, buffer.positions.length, 3, gl.STATIC_DRAW);\n } else {\n const positions = new Float32Array(buffer.positions);\n const quantizedPositions = quantizePositions(positions, this._modelAABB, state.positionsDecodeMatrix);\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, quantizedPositions, buffer.positions.length, 3, gl.STATIC_DRAW);\n }\n }\n\n if (buffer.colors.length > 0) {\n const colors = new Uint8Array(buffer.colors);\n let normalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, buffer.colors.length, 4, gl.DYNAMIC_DRAW, normalized);\n }\n\n if (buffer.colors.length > 0) { // Because we build flags arrays here, get their length from the colors array\n const flagsLength = buffer.colors.length / 4;\n const flags = new Float32Array(flagsLength);\n let notNormalized = false;\n state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, flags, flags.length, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n if (buffer.offsets.length > 0) {\n const offsets = new Float32Array(buffer.offsets);\n state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, offsets, buffer.offsets.length, 3, gl.DYNAMIC_DRAW);\n }\n }\n\n if (buffer.indices.length > 0) {\n const indices = new Uint32Array(buffer.indices);\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, indices, buffer.indices.length, 1, gl.STATIC_DRAW);\n }\n\n this._buffer = null;\n this._finalized = true;\n }\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n const deferred = true;\n this._setFlags(portionId, flags, meshTransparent, deferred);\n }\n\n flushInitFlags() {\n this._setDeferredFlags();\n }\n\n setVisible(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setHighlighted(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setXRayed(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setSelected(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setEdges(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n } else {\n this._numEdgesLayerPortions--;\n this.model.numEdgesLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCulled(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setColor(portionId, color) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstColor = vertexBase * 4;\n const lenColor = numVerts * 4;\n const tempArray = this._scratchMemory.getUInt8Array(lenColor);\n const r = color[0];\n const g = color[1];\n const b = color[2];\n const a = color[3];\n for (let i = 0; i < lenColor; i += 4) {\n tempArray[i + 0] = r;\n tempArray[i + 1] = g;\n tempArray[i + 2] = b;\n tempArray[i + 3] = a;\n }\n this._state.colorsBuf.setData(tempArray, firstColor, lenColor);\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, transparent, deferred = false) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstFlag = vertexBase;\n const lenFlags = numVerts;\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n // no edges\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (transparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 1 : 0;\n\n if (deferred) {\n // Avoid zillions of individual WebGL bufferSubData calls - buffer them to apply in one shot\n if (!this._deferredFlagValues) {\n this._deferredFlagValues = new Float32Array(this._numVerts);\n }\n for (let i = firstFlag, len = (firstFlag + lenFlags); i < len; i++) {\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n // no edges\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n this._deferredFlagValues[i] = vertFlag;\n }\n } else if (this._state.flagsBuf) {\n const tempArray = this._scratchMemory.getFloat32Array(lenFlags);\n for (let i = 0; i < lenFlags; i++) {\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n // no edges\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempArray[i] = vertFlag;\n }\n this._state.flagsBuf.setData(tempArray, firstFlag, lenFlags);\n }\n }\n\n _setDeferredFlags() {\n if (this._deferredFlagValues) {\n this._state.flagsBuf.setData(this._deferredFlagValues);\n this._deferredFlagValues = null;\n }\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstOffset = vertexBase * 3;\n const lenOffsets = numVerts * 3;\n const tempArray = this._scratchMemory.getFloat32Array(lenOffsets);\n const x = offset[0];\n const y = offset[1];\n const z = offset[2];\n for (let i = 0; i < lenOffsets; i += 3) {\n tempArray[i + 0] = x;\n tempArray[i + 1] = y;\n tempArray[i + 2] = z;\n }\n this._state.offsetsBuf.setData(tempArray, firstOffset, lenOffsets);\n }\n\n //-- RENDERING ----------------------------------------------------------------------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n\n drawDepth(renderFlags, frameCtx) {\n }\n\n drawNormals(renderFlags, frameCtx) {\n }\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n }\n\n drawPickMesh(frameCtx) {\n }\n\n drawPickDepths(frameCtx) {\n }\n\n drawPickNormals(frameCtx) {\n }\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawOcclusion(frameCtx) {\n }\n\n drawShadow(frameCtx) {\n }\n\n destroy() {\n const state = this._state;\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n state.positionsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.indicesBuf) {\n state.indicesBuf.destroy();\n state.indicesBuf = null;\n }\n state.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6271, + "__docId__": 6279, "kind": "class", "name": "VBOBatchingLinesLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js", @@ -124349,7 +124565,7 @@ "ignore": true }, { - "__docId__": 6272, + "__docId__": 6280, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124434,7 +124650,7 @@ ] }, { - "__docId__": 6273, + "__docId__": 6281, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124453,7 +124669,7 @@ } }, { - "__docId__": 6274, + "__docId__": 6282, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124471,7 +124687,7 @@ } }, { - "__docId__": 6275, + "__docId__": 6283, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124488,7 +124704,7 @@ } }, { - "__docId__": 6276, + "__docId__": 6284, "kind": "member", "name": "_buffer", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124506,7 +124722,7 @@ } }, { - "__docId__": 6277, + "__docId__": 6285, "kind": "member", "name": "_scratchMemory", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124524,7 +124740,7 @@ } }, { - "__docId__": 6278, + "__docId__": 6286, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124542,7 +124758,7 @@ } }, { - "__docId__": 6279, + "__docId__": 6287, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124560,7 +124776,7 @@ } }, { - "__docId__": 6280, + "__docId__": 6288, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124578,7 +124794,7 @@ } }, { - "__docId__": 6281, + "__docId__": 6289, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124596,7 +124812,7 @@ } }, { - "__docId__": 6282, + "__docId__": 6290, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124614,7 +124830,7 @@ } }, { - "__docId__": 6283, + "__docId__": 6291, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124632,7 +124848,7 @@ } }, { - "__docId__": 6284, + "__docId__": 6292, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124650,7 +124866,7 @@ } }, { - "__docId__": 6285, + "__docId__": 6293, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124668,7 +124884,7 @@ } }, { - "__docId__": 6286, + "__docId__": 6294, "kind": "member", "name": "_numEdgesLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124686,7 +124902,7 @@ } }, { - "__docId__": 6287, + "__docId__": 6295, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124704,7 +124920,7 @@ } }, { - "__docId__": 6288, + "__docId__": 6296, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124722,7 +124938,7 @@ } }, { - "__docId__": 6289, + "__docId__": 6297, "kind": "member", "name": "_modelAABB", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124740,7 +124956,7 @@ } }, { - "__docId__": 6290, + "__docId__": 6298, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124758,7 +124974,7 @@ } }, { - "__docId__": 6291, + "__docId__": 6299, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124776,7 +124992,7 @@ } }, { - "__docId__": 6292, + "__docId__": 6300, "kind": "member", "name": "_numVerts", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124794,7 +125010,7 @@ } }, { - "__docId__": 6293, + "__docId__": 6301, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124812,7 +125028,7 @@ } }, { - "__docId__": 6294, + "__docId__": 6302, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124829,7 +125045,7 @@ } }, { - "__docId__": 6295, + "__docId__": 6303, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124847,7 +125063,7 @@ } }, { - "__docId__": 6296, + "__docId__": 6304, "kind": "member", "name": "_preCompressedPositionsExpected", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124865,7 +125081,7 @@ } }, { - "__docId__": 6298, + "__docId__": 6306, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124884,7 +125100,7 @@ } }, { - "__docId__": 6300, + "__docId__": 6308, "kind": "method", "name": "canCreatePortion", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -124933,7 +125149,7 @@ } }, { - "__docId__": 6301, + "__docId__": 6309, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125052,7 +125268,7 @@ } }, { - "__docId__": 6303, + "__docId__": 6311, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125067,7 +125283,7 @@ "return": null }, { - "__docId__": 6306, + "__docId__": 6314, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125102,7 +125318,7 @@ "return": null }, { - "__docId__": 6307, + "__docId__": 6315, "kind": "method", "name": "flushInitFlags", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125118,7 +125334,7 @@ "return": null }, { - "__docId__": 6308, + "__docId__": 6316, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125153,7 +125369,7 @@ "return": null }, { - "__docId__": 6309, + "__docId__": 6317, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125188,7 +125404,7 @@ "return": null }, { - "__docId__": 6310, + "__docId__": 6318, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125223,7 +125439,7 @@ "return": null }, { - "__docId__": 6311, + "__docId__": 6319, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125258,7 +125474,7 @@ "return": null }, { - "__docId__": 6312, + "__docId__": 6320, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125293,7 +125509,7 @@ "return": null }, { - "__docId__": 6313, + "__docId__": 6321, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125322,7 +125538,7 @@ "return": null }, { - "__docId__": 6314, + "__docId__": 6322, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125357,7 +125573,7 @@ "return": null }, { - "__docId__": 6315, + "__docId__": 6323, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125386,7 +125602,7 @@ "return": null }, { - "__docId__": 6316, + "__docId__": 6324, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125421,7 +125637,7 @@ "return": null }, { - "__docId__": 6317, + "__docId__": 6325, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125450,7 +125666,7 @@ "return": null }, { - "__docId__": 6318, + "__docId__": 6326, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125485,7 +125701,7 @@ "return": null }, { - "__docId__": 6319, + "__docId__": 6327, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125529,7 +125745,7 @@ "return": null }, { - "__docId__": 6320, + "__docId__": 6328, "kind": "member", "name": "_deferredFlagValues", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125547,7 +125763,7 @@ } }, { - "__docId__": 6321, + "__docId__": 6329, "kind": "method", "name": "_setDeferredFlags", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125564,7 +125780,7 @@ "return": null }, { - "__docId__": 6323, + "__docId__": 6331, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125593,7 +125809,7 @@ "return": null }, { - "__docId__": 6324, + "__docId__": 6332, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125622,7 +125838,7 @@ "return": null }, { - "__docId__": 6325, + "__docId__": 6333, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125651,7 +125867,7 @@ "return": null }, { - "__docId__": 6326, + "__docId__": 6334, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125680,7 +125896,7 @@ "return": null }, { - "__docId__": 6327, + "__docId__": 6335, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125709,7 +125925,7 @@ "return": null }, { - "__docId__": 6328, + "__docId__": 6336, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125738,7 +125954,7 @@ "return": null }, { - "__docId__": 6329, + "__docId__": 6337, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125767,7 +125983,7 @@ "return": null }, { - "__docId__": 6330, + "__docId__": 6338, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125796,7 +126012,7 @@ "return": null }, { - "__docId__": 6331, + "__docId__": 6339, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125825,7 +126041,7 @@ "return": null }, { - "__docId__": 6332, + "__docId__": 6340, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125854,7 +126070,7 @@ "return": null }, { - "__docId__": 6333, + "__docId__": 6341, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125883,7 +126099,7 @@ "return": null }, { - "__docId__": 6334, + "__docId__": 6342, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125912,7 +126128,7 @@ "return": null }, { - "__docId__": 6335, + "__docId__": 6343, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125941,7 +126157,7 @@ "return": null }, { - "__docId__": 6336, + "__docId__": 6344, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125964,7 +126180,7 @@ "return": null }, { - "__docId__": 6337, + "__docId__": 6345, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -125987,7 +126203,7 @@ "return": null }, { - "__docId__": 6338, + "__docId__": 6346, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126010,7 +126226,7 @@ "return": null }, { - "__docId__": 6339, + "__docId__": 6347, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126039,7 +126255,7 @@ "return": null }, { - "__docId__": 6340, + "__docId__": 6348, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126068,7 +126284,7 @@ "return": null }, { - "__docId__": 6341, + "__docId__": 6349, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126091,7 +126307,7 @@ "return": null }, { - "__docId__": 6342, + "__docId__": 6350, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126114,7 +126330,7 @@ "return": null }, { - "__docId__": 6343, + "__docId__": 6351, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js~VBOBatchingLinesLayer", @@ -126130,18 +126346,18 @@ "return": null }, { - "__docId__": 6344, + "__docId__": 6352, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js", "content": "/**\n * @private\n */\nexport class VBOBatchingLinesBuffer {\n\n constructor(maxGeometryBatchSize = 5000000) {\n\n if (maxGeometryBatchSize > 5000000) {\n maxGeometryBatchSize = 5000000;\n }\n\n this.maxVerts = maxGeometryBatchSize;\n this.maxIndices = maxGeometryBatchSize * 3; // Rough rule-of-thumb\n this.positions = [];\n this.colors = [];\n this.offsets = [];\n this.indices = [];\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6345, + "__docId__": 6353, "kind": "class", "name": "VBOBatchingLinesBuffer", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js", @@ -126157,7 +126373,7 @@ "ignore": true }, { - "__docId__": 6346, + "__docId__": 6354, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126171,7 +126387,7 @@ "undocument": true }, { - "__docId__": 6347, + "__docId__": 6355, "kind": "member", "name": "maxVerts", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126188,7 +126404,7 @@ } }, { - "__docId__": 6348, + "__docId__": 6356, "kind": "member", "name": "maxIndices", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126205,7 +126421,7 @@ } }, { - "__docId__": 6349, + "__docId__": 6357, "kind": "member", "name": "positions", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126222,7 +126438,7 @@ } }, { - "__docId__": 6350, + "__docId__": 6358, "kind": "member", "name": "colors", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126239,7 +126455,7 @@ } }, { - "__docId__": 6351, + "__docId__": 6359, "kind": "member", "name": "offsets", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126256,7 +126472,7 @@ } }, { - "__docId__": 6352, + "__docId__": 6360, "kind": "member", "name": "indices", "memberof": "src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js~VBOBatchingLinesBuffer", @@ -126273,18 +126489,18 @@ } }, { - "__docId__": 6353, + "__docId__": 6361, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", "content": "\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\nimport {VBORenderer} from \"../../../VBORenderer.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOBatchingLineSnapInitRenderer extends VBORenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n state.indicesBuf.bind();\n gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n state.indicesBuf.unbind();\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" relativeToOriginPosition = worldPosition.xyz;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n ///////////////////////////////////////////\n // TODO: normal placeholder?\n // Primitive type?\n ///////////////////////////////////////////\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\");\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6354, + "__docId__": 6362, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126305,7 +126521,7 @@ "ignore": true }, { - "__docId__": 6355, + "__docId__": 6363, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126326,7 +126542,7 @@ "ignore": true }, { - "__docId__": 6356, + "__docId__": 6364, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126347,7 +126563,7 @@ "ignore": true }, { - "__docId__": 6357, + "__docId__": 6365, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126368,7 +126584,7 @@ "ignore": true }, { - "__docId__": 6358, + "__docId__": 6366, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126389,7 +126605,7 @@ "ignore": true }, { - "__docId__": 6359, + "__docId__": 6367, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126410,7 +126626,7 @@ "ignore": true }, { - "__docId__": 6360, + "__docId__": 6368, "kind": "class", "name": "VBOBatchingLineSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js", @@ -126429,7 +126645,7 @@ "ignore": true }, { - "__docId__": 6361, + "__docId__": 6369, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126464,7 +126680,7 @@ "return": null }, { - "__docId__": 6362, + "__docId__": 6370, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126481,7 +126697,7 @@ "return": null }, { - "__docId__": 6363, + "__docId__": 6371, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126499,7 +126715,7 @@ } }, { - "__docId__": 6364, + "__docId__": 6372, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126517,7 +126733,7 @@ } }, { - "__docId__": 6365, + "__docId__": 6373, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126534,7 +126750,7 @@ } }, { - "__docId__": 6366, + "__docId__": 6374, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126551,7 +126767,7 @@ } }, { - "__docId__": 6367, + "__docId__": 6375, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126569,7 +126785,7 @@ } }, { - "__docId__": 6368, + "__docId__": 6376, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126587,7 +126803,7 @@ } }, { - "__docId__": 6369, + "__docId__": 6377, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126604,7 +126820,7 @@ "return": null }, { - "__docId__": 6370, + "__docId__": 6378, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126625,7 +126841,7 @@ } }, { - "__docId__": 6371, + "__docId__": 6379, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126646,7 +126862,7 @@ } }, { - "__docId__": 6372, + "__docId__": 6380, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126662,7 +126878,7 @@ "return": null }, { - "__docId__": 6373, + "__docId__": 6381, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126680,7 +126896,7 @@ } }, { - "__docId__": 6374, + "__docId__": 6382, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js~VBOBatchingLineSnapInitRenderer", @@ -126696,18 +126912,18 @@ "return": null }, { - "__docId__": 6376, + "__docId__": 6384, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js", "content": "import {VBOSceneModelLineBatchingRenderer} from \"./VBOSceneModelLineBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOBatchingLinesColorRenderer extends VBOSceneModelLineBatchingRenderer {\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines batching color vertex shader\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n src.push(\"void main(void) {\");\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines batching color fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vColor;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6377, + "__docId__": 6385, "kind": "class", "name": "VBOBatchingLinesColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js", @@ -126726,7 +126942,7 @@ "ignore": true }, { - "__docId__": 6378, + "__docId__": 6386, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js~VBOBatchingLinesColorRenderer", @@ -126761,7 +126977,7 @@ "return": null }, { - "__docId__": 6379, + "__docId__": 6387, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js~VBOBatchingLinesColorRenderer", @@ -126782,7 +126998,7 @@ } }, { - "__docId__": 6380, + "__docId__": 6388, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js~VBOBatchingLinesColorRenderer", @@ -126803,18 +127019,18 @@ } }, { - "__docId__": 6381, + "__docId__": 6389, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", "content": "import {VBOBatchingLinesColorRenderer} from \"./VBOBatchingLinesColorRenderer.js\";\nimport {VBOBatchingLinesSilhouetteRenderer} from \"./VBOBatchingLinesSilhouetteRenderer.js\";\nimport {VBOBatchingLinesSnapInitRenderer} from \"./VBOBatchingLinesSnapInitRenderer.js\";\nimport {VBOBatchingLinesSnapRenderer} from \"./VBOBatchingLinesSnapRenderer.js\";\n\n/**\n * @private\n */\nclass VBOBatchingLinesRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new VBOBatchingLinesColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new VBOBatchingLinesSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new VBOBatchingLinesSnapInitRenderer(this._scene, false);\n }\n return this._snapInitRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new VBOBatchingLinesSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let batchingRenderers = cachedRenderers[sceneId];\n if (!batchingRenderers) {\n batchingRenderers = new VBOBatchingLinesRenderers(scene);\n cachedRenderers[sceneId] = batchingRenderers;\n batchingRenderers._compile();\n scene.on(\"compile\", () => {\n batchingRenderers._compile();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n batchingRenderers._destroy();\n });\n }\n return batchingRenderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6382, + "__docId__": 6390, "kind": "class", "name": "VBOBatchingLinesRenderers", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", @@ -126830,7 +127046,7 @@ "ignore": true }, { - "__docId__": 6383, + "__docId__": 6391, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126844,7 +127060,7 @@ "undocument": true }, { - "__docId__": 6384, + "__docId__": 6392, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126862,7 +127078,7 @@ } }, { - "__docId__": 6385, + "__docId__": 6393, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126879,7 +127095,7 @@ "return": null }, { - "__docId__": 6386, + "__docId__": 6394, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126897,7 +127113,7 @@ } }, { - "__docId__": 6387, + "__docId__": 6395, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126915,7 +127131,7 @@ } }, { - "__docId__": 6388, + "__docId__": 6396, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126933,7 +127149,7 @@ } }, { - "__docId__": 6389, + "__docId__": 6397, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126951,7 +127167,7 @@ } }, { - "__docId__": 6390, + "__docId__": 6398, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126970,7 +127186,7 @@ } }, { - "__docId__": 6392, + "__docId__": 6400, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -126989,7 +127205,7 @@ } }, { - "__docId__": 6394, + "__docId__": 6402, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -127008,7 +127224,7 @@ } }, { - "__docId__": 6396, + "__docId__": 6404, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -127027,7 +127243,7 @@ } }, { - "__docId__": 6398, + "__docId__": 6406, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js~VBOBatchingLinesRenderers", @@ -127044,7 +127260,7 @@ "return": null }, { - "__docId__": 6399, + "__docId__": 6407, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", @@ -127065,7 +127281,7 @@ "ignore": true }, { - "__docId__": 6400, + "__docId__": 6408, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js", @@ -127095,18 +127311,18 @@ } }, { - "__docId__": 6401, + "__docId__": 6409, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js", "content": "import {VBOSceneModelLineBatchingRenderer} from \"./VBOSceneModelLineBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOBatchingLinesSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n super.drawLayer(frameCtx, batchingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines batching silhouette vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 color;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines batching silhouette fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"uniform vec4 color;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = color;\");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6402, + "__docId__": 6410, "kind": "class", "name": "VBOBatchingLinesSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js", @@ -127125,7 +127341,7 @@ "ignore": true }, { - "__docId__": 6403, + "__docId__": 6411, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js~VBOBatchingLinesSilhouetteRenderer", @@ -127160,7 +127376,7 @@ "return": null }, { - "__docId__": 6404, + "__docId__": 6412, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js~VBOBatchingLinesSilhouetteRenderer", @@ -127181,7 +127397,7 @@ } }, { - "__docId__": 6405, + "__docId__": 6413, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js~VBOBatchingLinesSilhouetteRenderer", @@ -127202,18 +127418,18 @@ } }, { - "__docId__": 6406, + "__docId__": 6414, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", "content": "\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\nimport {VBORenderer} from \"../../../VBORenderer.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOBatchingLinesSnapInitRenderer extends VBORenderer {\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n state.indicesBuf.bind();\n gl.drawElements(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n state.indicesBuf.unbind();\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" relativeToOriginPosition = worldPosition.xyz;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\");\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6407, + "__docId__": 6415, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127234,7 +127450,7 @@ "ignore": true }, { - "__docId__": 6408, + "__docId__": 6416, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127255,7 +127471,7 @@ "ignore": true }, { - "__docId__": 6409, + "__docId__": 6417, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127276,7 +127492,7 @@ "ignore": true }, { - "__docId__": 6410, + "__docId__": 6418, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127297,7 +127513,7 @@ "ignore": true }, { - "__docId__": 6411, + "__docId__": 6419, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127318,7 +127534,7 @@ "ignore": true }, { - "__docId__": 6412, + "__docId__": 6420, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127339,7 +127555,7 @@ "ignore": true }, { - "__docId__": 6413, + "__docId__": 6421, "kind": "class", "name": "VBOBatchingLinesSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js", @@ -127358,7 +127574,7 @@ "ignore": true }, { - "__docId__": 6414, + "__docId__": 6422, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127393,7 +127609,7 @@ "return": null }, { - "__docId__": 6415, + "__docId__": 6423, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127410,7 +127626,7 @@ "return": null }, { - "__docId__": 6416, + "__docId__": 6424, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127428,7 +127644,7 @@ } }, { - "__docId__": 6417, + "__docId__": 6425, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127446,7 +127662,7 @@ } }, { - "__docId__": 6418, + "__docId__": 6426, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127463,7 +127679,7 @@ } }, { - "__docId__": 6419, + "__docId__": 6427, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127480,7 +127696,7 @@ } }, { - "__docId__": 6420, + "__docId__": 6428, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127498,7 +127714,7 @@ } }, { - "__docId__": 6421, + "__docId__": 6429, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127516,7 +127732,7 @@ } }, { - "__docId__": 6422, + "__docId__": 6430, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127533,7 +127749,7 @@ "return": null }, { - "__docId__": 6423, + "__docId__": 6431, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127554,7 +127770,7 @@ } }, { - "__docId__": 6424, + "__docId__": 6432, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127575,7 +127791,7 @@ } }, { - "__docId__": 6425, + "__docId__": 6433, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127591,7 +127807,7 @@ "return": null }, { - "__docId__": 6426, + "__docId__": 6434, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127609,7 +127825,7 @@ } }, { - "__docId__": 6427, + "__docId__": 6435, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js~VBOBatchingLinesSnapInitRenderer", @@ -127625,18 +127841,18 @@ "return": null }, { - "__docId__": 6429, + "__docId__": 6437, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", "content": "\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\nimport {VBORenderer} from \"../../../VBORenderer.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOBatchingLinesSnapRenderer extends VBORenderer{\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n if (frameCtx.snapMode === \"edge\") {\n state.indicesBuf.bind();\n gl.drawElements(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n state.indicesBuf.unbind(); // needed?\n } else {\n gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\"); \n this.uVectorA = program.getLocation(\"snapVectorA\"); \n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapBatchingDepthRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\"); \n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapBatchingDepthRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6430, + "__docId__": 6438, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127657,7 +127873,7 @@ "ignore": true }, { - "__docId__": 6431, + "__docId__": 6439, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127678,7 +127894,7 @@ "ignore": true }, { - "__docId__": 6432, + "__docId__": 6440, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127699,7 +127915,7 @@ "ignore": true }, { - "__docId__": 6433, + "__docId__": 6441, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127720,7 +127936,7 @@ "ignore": true }, { - "__docId__": 6434, + "__docId__": 6442, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127741,7 +127957,7 @@ "ignore": true }, { - "__docId__": 6435, + "__docId__": 6443, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127762,7 +127978,7 @@ "ignore": true }, { - "__docId__": 6436, + "__docId__": 6444, "kind": "class", "name": "VBOBatchingLinesSnapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js", @@ -127781,7 +127997,7 @@ "ignore": true }, { - "__docId__": 6437, + "__docId__": 6445, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127802,7 +128018,7 @@ } }, { - "__docId__": 6438, + "__docId__": 6446, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127837,7 +128053,7 @@ "return": null }, { - "__docId__": 6439, + "__docId__": 6447, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127854,7 +128070,7 @@ "return": null }, { - "__docId__": 6440, + "__docId__": 6448, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127872,7 +128088,7 @@ } }, { - "__docId__": 6441, + "__docId__": 6449, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127890,7 +128106,7 @@ } }, { - "__docId__": 6442, + "__docId__": 6450, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127907,7 +128123,7 @@ } }, { - "__docId__": 6443, + "__docId__": 6451, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127924,7 +128140,7 @@ } }, { - "__docId__": 6444, + "__docId__": 6452, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127942,7 +128158,7 @@ } }, { - "__docId__": 6445, + "__docId__": 6453, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127960,7 +128176,7 @@ } }, { - "__docId__": 6446, + "__docId__": 6454, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127977,7 +128193,7 @@ "return": null }, { - "__docId__": 6447, + "__docId__": 6455, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -127998,7 +128214,7 @@ } }, { - "__docId__": 6448, + "__docId__": 6456, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -128019,7 +128235,7 @@ } }, { - "__docId__": 6449, + "__docId__": 6457, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -128035,7 +128251,7 @@ "return": null }, { - "__docId__": 6450, + "__docId__": 6458, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -128053,7 +128269,7 @@ } }, { - "__docId__": 6451, + "__docId__": 6459, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js~VBOBatchingLinesSnapRenderer", @@ -128069,18 +128285,18 @@ "return": null }, { - "__docId__": 6453, + "__docId__": 6461, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class VBOSceneModelLineBatchingRenderer extends VBORenderer {\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState\n } = drawCfg;\n\n gl.drawElements(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n\n if (incrementDrawState) {\n frameCtx.drawElements++;\n }\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6454, + "__docId__": 6462, "kind": "class", "name": "VBOSceneModelLineBatchingRenderer", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js", @@ -128099,7 +128315,7 @@ "ignore": true }, { - "__docId__": 6455, + "__docId__": 6463, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js~VBOSceneModelLineBatchingRenderer", @@ -128123,18 +128339,18 @@ "return": null }, { - "__docId__": 6456, + "__docId__": 6464, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js", "content": "/**\n * @private\n */\nexport class VBOBatchingPointsBuffer {\n\n constructor(maxGeometryBatchSize = 5000000) {\n\n if (maxGeometryBatchSize > 5000000) {\n maxGeometryBatchSize = 5000000;\n }\n\n this.maxVerts = maxGeometryBatchSize;\n this.maxIndices = maxGeometryBatchSize * 3; // Rough rule-of-thumb\n this.positions = [];\n this.colors = [];\n this.intensities = [];\n this.pickColors = [];\n this.offsets = [];\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6457, + "__docId__": 6465, "kind": "class", "name": "VBOBatchingPointsBuffer", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js", @@ -128150,7 +128366,7 @@ "ignore": true }, { - "__docId__": 6458, + "__docId__": 6466, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128164,7 +128380,7 @@ "undocument": true }, { - "__docId__": 6459, + "__docId__": 6467, "kind": "member", "name": "maxVerts", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128181,7 +128397,7 @@ } }, { - "__docId__": 6460, + "__docId__": 6468, "kind": "member", "name": "maxIndices", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128198,7 +128414,7 @@ } }, { - "__docId__": 6461, + "__docId__": 6469, "kind": "member", "name": "positions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128215,7 +128431,7 @@ } }, { - "__docId__": 6462, + "__docId__": 6470, "kind": "member", "name": "colors", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128232,7 +128448,7 @@ } }, { - "__docId__": 6463, + "__docId__": 6471, "kind": "member", "name": "intensities", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128249,7 +128465,7 @@ } }, { - "__docId__": 6464, + "__docId__": 6472, "kind": "member", "name": "pickColors", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128266,7 +128482,7 @@ } }, { - "__docId__": 6465, + "__docId__": 6473, "kind": "member", "name": "offsets", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js~VBOBatchingPointsBuffer", @@ -128283,18 +128499,18 @@ } }, { - "__docId__": 6466, + "__docId__": 6474, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {getRenderers} from \"./renderers/VBOBatchingPointsRenderers.js\";\nimport {VBOBatchingPointsBuffer} from \"./VBOBatchingPointsBuffer.js\";\nimport {quantizePositions} from \"../../../compression.js\";\n\n/**\n * @private\n */\nexport class VBOBatchingPointsLayer {\n\n /**\n * @param model\n * @param cfg\n * @param cfg.layerIndex\n * @param cfg.positionsDecodeMatrix\n * @param cfg.maxGeometryBatchSize\n * @param cfg.origin\n * @param cfg.scratchMemory\n */\n constructor(cfg) {\n\n console.info(\"Creating VBOBatchingPointsLayer\");\n\n /**\n * Owner model\n * @type {VBOSceneModel}\n */\n this.model = cfg.model;\n\n /**\n * State sorting key.\n * @type {string}\n */\n this.sortId = \"PointsBatchingLayer\";\n\n /**\n * Index of this PointsBatchingLayer in {@link VBOSceneModel#_layerList}.\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n\n this._buffer = new VBOBatchingPointsBuffer(cfg.maxGeometryBatchSize);\n this._scratchMemory = cfg.scratchMemory;\n\n this._state = new RenderState({\n positionsBuf: null,\n offsetsBuf: null,\n colorsBuf: null,\n flagsBuf: null,\n positionsDecodeMatrix: math.mat4(),\n origin: null\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n this._modelAABB = math.collapseAABB3(); // Model-space AABB\n this._portions = [];\n this._meshes = [];\n\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n this._finalized = false;\n\n if (cfg.positionsDecodeMatrix) {\n this._state.positionsDecodeMatrix.set(cfg.positionsDecodeMatrix);\n this._preCompressedPositionsExpected = true;\n } else {\n this._preCompressedPositionsExpected = false;\n }\n\n if (cfg.origin) {\n this._state.origin = math.vec3(cfg.origin);\n }\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Tests if there is room for another portion in this PointsBatchingLayer.\n *\n * @param lenPositions Number of positions we'd like to create in the portion.\n * @returns {Boolean} True if OK to create another portion.\n */\n canCreatePortion(lenPositions) {\n if (this._finalized) {\n throw \"Already finalized\";\n }\n return ((this._buffer.positions.length + lenPositions) < (this._buffer.maxVerts * 3));\n }\n\n /**\n * Creates a new portion within this PointsBatchingLayer, returns the new portion ID.\n *\n * Gives the portion the specified geometry, color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg.positions Flat float Local-space positions array.\n * @param cfg.positionsCompressed Flat quantized positions array - decompressed with PointsBatchingLayer positionsDecodeMatrix\n * @param [cfg.colorsCompressed] Quantized RGB colors [0..255,0..255,0..255,0..255]\n * @param [cfg.colors] Flat float colors array.\n * @param cfg.color Float RGB color [0..1,0..1,0..1]\n * @param [cfg.meshMatrix] Flat float 4x4 matrix\n * @param cfg.aabb Flat float AABB World-space AABB\n * @param cfg.pickColor Quantized pick color\n * @returns {number} Portion ID\n */\n createPortion(mesh, cfg) {\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n const positions = cfg.positions;\n const positionsCompressed = cfg.positionsCompressed;\n const color = cfg.color;\n const colorsCompressed = cfg.colorsCompressed;\n const colors = cfg.colors;\n const pickColor = cfg.pickColor;\n\n const buffer = this._buffer;\n const positionsIndex = buffer.positions.length;\n const vertsIndex = positionsIndex / 3;\n\n let numVerts;\n\n math.expandAABB3(this._modelAABB, cfg.aabb);\n\n if (this._preCompressedPositionsExpected) {\n\n if (!positionsCompressed) {\n throw \"positionsCompressed expected\";\n }\n\n for (let i = 0, len = positionsCompressed.length; i < len; i++) {\n buffer.positions.push(positionsCompressed[i]);\n }\n\n numVerts = positionsCompressed.length / 3;\n\n } else {\n\n if (!positions) {\n throw \"positions expected\";\n }\n\n numVerts = positions.length / 3;\n\n const lenPositions = positions.length;\n const positionsBase = buffer.positions.length;\n\n for (let i = 0, len = positions.length; i < len; i++) {\n buffer.positions.push(positions[i]);\n }\n }\n\n if (colorsCompressed) {\n for (let i = 0, len = colorsCompressed.length; i < len; i++) {\n buffer.colors.push(colorsCompressed[i]);\n }\n\n } else if (colors) {\n for (let i = 0, len = colors.length; i < len; i++) {\n buffer.colors.push(colors[i] * 255);\n }\n\n } else if (color) {\n\n const r = color[0]; // Color is pre-quantized by VBOSceneModel\n const g = color[1];\n const b = color[2];\n const a = 1.0;\n\n for (let i = 0; i < numVerts; i++) {\n buffer.colors.push(r);\n buffer.colors.push(g);\n buffer.colors.push(b);\n buffer.colors.push(a);\n }\n }\n\n {\n const pickColorsBase = buffer.pickColors.length;\n const lenPickColors = numVerts * 4;\n for (let i = pickColorsBase, len = pickColorsBase + lenPickColors; i < len; i += 4) {\n buffer.pickColors.push(pickColor[0]);\n buffer.pickColors.push(pickColor[1]);\n buffer.pickColors.push(pickColor[2]);\n buffer.pickColors.push(pickColor[3]);\n }\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n for (let i = 0; i < numVerts; i++) {\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n }\n }\n\n const portionId = this._portions.length / 2;\n\n this._portions.push(vertsIndex);\n this._portions.push(numVerts);\n\n this._numPortions++;\n this.model.numPortions++;\n this._meshes.push(mesh);\n return portionId;\n }\n\n /**\n * Builds batch VBOs from appended geometries.\n * No more portions can then be created.\n */\n finalize() {\n\n if (this._finalized) {\n return;\n }\n\n const state = this._state;\n const gl = this.model.scene.canvas.gl;\n const buffer = this._buffer;\n\n if (buffer.positions.length > 0) {\n if (this._preCompressedPositionsExpected) {\n const positions = new Uint16Array(buffer.positions);\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, buffer.positions.length, 3, gl.STATIC_DRAW);\n } else {\n const positions = new Float32Array(buffer.positions);\n const quantizedPositions = quantizePositions(positions, this._modelAABB, state.positionsDecodeMatrix);\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, quantizedPositions, buffer.positions.length, 3, gl.STATIC_DRAW);\n }\n }\n\n if (buffer.colors.length > 0) {\n const colors = new Uint8Array(buffer.colors);\n let normalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, buffer.colors.length, 4, gl.STATIC_DRAW, normalized);\n }\n\n if (buffer.positions.length > 0) { // Because we build flags arrays here, get their length from the positions array\n const flagsLength = buffer.positions.length / 3;\n const flags = new Float32Array(flagsLength);\n let notNormalized = false;\n state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, flags, flags.length, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n\n if (buffer.pickColors.length > 0) {\n const pickColors = new Uint8Array(buffer.pickColors);\n let normalized = false;\n state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, pickColors, buffer.pickColors.length, 4, gl.STATIC_DRAW, normalized);\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n if (buffer.offsets.length > 0) {\n const offsets = new Float32Array(buffer.offsets);\n state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, offsets, buffer.offsets.length, 3, gl.DYNAMIC_DRAW);\n }\n }\n\n this._buffer = null;\n this._finalized = true;\n }\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setVisible(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setHighlighted(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setXRayed(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setSelected(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setEdges(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n // Not applicable to point clouds\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCulled(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setColor(portionId, color) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstColor = vertexBase * 4;\n const lenColor = numVerts * 4;\n const tempArray = this._scratchMemory.getUInt8Array(lenColor);\n const r = color[0];\n const g = color[1];\n const b = color[2];\n for (let i = 0; i < lenColor; i += 4) {\n tempArray[i + 0] = r;\n tempArray[i + 1] = g;\n tempArray[i + 2] = b;\n }\n this._state.colorsBuf.setData(tempArray, firstColor, lenColor);\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, transparent) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstFlag = vertexBase;\n const lenFlags = numVerts;\n const tempArray = this._scratchMemory.getFloat32Array(lenFlags);\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (transparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 1 : 0;\n\n for (let i = 0; i < lenFlags; i++) {\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n // no edges\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempArray[i] = vertFlag;\n }\n\n this._state.flagsBuf.setData(tempArray, firstFlag);\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n const portionsIdx = portionId * 2;\n const vertexBase = this._portions[portionsIdx];\n const numVerts = this._portions[portionsIdx + 1];\n const firstOffset = vertexBase * 3;\n const lenOffsets = numVerts * 3;\n const tempArray = this._scratchMemory.getFloat32Array(lenOffsets);\n const x = offset[0];\n const y = offset[1];\n const z = offset[2];\n for (let i = 0; i < lenOffsets; i += 3) {\n tempArray[i + 0] = x;\n tempArray[i + 1] = y;\n tempArray[i + 2] = z;\n }\n this._state.offsetsBuf.setData(tempArray, firstOffset, lenOffsets);\n }\n\n //-- NORMAL RENDERING ----------------------------------------------------------------------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n\n // -- RENDERING SAO POST EFFECT TARGETS ----------------------------------------------------------------------------\n\n drawDepth(renderFlags, frameCtx) {\n }\n\n drawNormals(renderFlags, frameCtx) {\n }\n\n // -- EMPHASIS RENDERING -------------------------------------------------------------------------------------------\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n //-- EDGES RENDERING -----------------------------------------------------------------------------------------------\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n }\n\n //---- PICKING ----------------------------------------------------------------------------------------------------\n\n drawPickMesh(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.pickMeshRenderer) {\n this._renderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickDepths(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.pickDepthRenderer) {\n this._renderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickNormals(renderFlags, frameCtx) {\n }\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n //---- OCCLUSION TESTING -------------------------------------------------------------------------------------------\n\n drawOcclusion(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.occlusionRenderer) {\n this._renderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n //---- SHADOWS -----------------------------------------------------------------------------------------------------\n\n drawShadow(renderFlags, frameCtx) {\n }\n\n destroy() {\n const state = this._state;\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n state.positionsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.pickColorsBuf) {\n state.pickColorsBuf.destroy();\n state.pickColorsBuf = null;\n }\n state.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6467, + "__docId__": 6475, "kind": "class", "name": "VBOBatchingPointsLayer", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js", @@ -128310,7 +128526,7 @@ "ignore": true }, { - "__docId__": 6468, + "__docId__": 6476, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128395,7 +128611,7 @@ ] }, { - "__docId__": 6469, + "__docId__": 6477, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128414,7 +128630,7 @@ } }, { - "__docId__": 6470, + "__docId__": 6478, "kind": "member", "name": "sortId", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128433,7 +128649,7 @@ } }, { - "__docId__": 6471, + "__docId__": 6479, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128452,7 +128668,7 @@ } }, { - "__docId__": 6472, + "__docId__": 6480, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128470,7 +128686,7 @@ } }, { - "__docId__": 6473, + "__docId__": 6481, "kind": "member", "name": "_buffer", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128488,7 +128704,7 @@ } }, { - "__docId__": 6474, + "__docId__": 6482, "kind": "member", "name": "_scratchMemory", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128506,7 +128722,7 @@ } }, { - "__docId__": 6475, + "__docId__": 6483, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128524,7 +128740,7 @@ } }, { - "__docId__": 6476, + "__docId__": 6484, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128542,7 +128758,7 @@ } }, { - "__docId__": 6477, + "__docId__": 6485, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128560,7 +128776,7 @@ } }, { - "__docId__": 6478, + "__docId__": 6486, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128578,7 +128794,7 @@ } }, { - "__docId__": 6479, + "__docId__": 6487, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128596,7 +128812,7 @@ } }, { - "__docId__": 6480, + "__docId__": 6488, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128614,7 +128830,7 @@ } }, { - "__docId__": 6481, + "__docId__": 6489, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128632,7 +128848,7 @@ } }, { - "__docId__": 6482, + "__docId__": 6490, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128650,7 +128866,7 @@ } }, { - "__docId__": 6483, + "__docId__": 6491, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128668,7 +128884,7 @@ } }, { - "__docId__": 6484, + "__docId__": 6492, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128686,7 +128902,7 @@ } }, { - "__docId__": 6485, + "__docId__": 6493, "kind": "member", "name": "_modelAABB", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128704,7 +128920,7 @@ } }, { - "__docId__": 6486, + "__docId__": 6494, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128722,7 +128938,7 @@ } }, { - "__docId__": 6487, + "__docId__": 6495, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128740,7 +128956,7 @@ } }, { - "__docId__": 6488, + "__docId__": 6496, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128758,7 +128974,7 @@ } }, { - "__docId__": 6489, + "__docId__": 6497, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128775,7 +128991,7 @@ } }, { - "__docId__": 6490, + "__docId__": 6498, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128793,7 +129009,7 @@ } }, { - "__docId__": 6491, + "__docId__": 6499, "kind": "member", "name": "_preCompressedPositionsExpected", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128811,7 +129027,7 @@ } }, { - "__docId__": 6493, + "__docId__": 6501, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128830,7 +129046,7 @@ } }, { - "__docId__": 6495, + "__docId__": 6503, "kind": "method", "name": "canCreatePortion", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128869,7 +129085,7 @@ } }, { - "__docId__": 6496, + "__docId__": 6504, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -128988,7 +129204,7 @@ } }, { - "__docId__": 6497, + "__docId__": 6505, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129003,7 +129219,7 @@ "return": null }, { - "__docId__": 6500, + "__docId__": 6508, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129038,7 +129254,7 @@ "return": null }, { - "__docId__": 6501, + "__docId__": 6509, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129073,7 +129289,7 @@ "return": null }, { - "__docId__": 6502, + "__docId__": 6510, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129108,7 +129324,7 @@ "return": null }, { - "__docId__": 6503, + "__docId__": 6511, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129143,7 +129359,7 @@ "return": null }, { - "__docId__": 6504, + "__docId__": 6512, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129178,7 +129394,7 @@ "return": null }, { - "__docId__": 6505, + "__docId__": 6513, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129213,7 +129429,7 @@ "return": null }, { - "__docId__": 6506, + "__docId__": 6514, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129242,7 +129458,7 @@ "return": null }, { - "__docId__": 6507, + "__docId__": 6515, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129277,7 +129493,7 @@ "return": null }, { - "__docId__": 6508, + "__docId__": 6516, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129306,7 +129522,7 @@ "return": null }, { - "__docId__": 6509, + "__docId__": 6517, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129341,7 +129557,7 @@ "return": null }, { - "__docId__": 6510, + "__docId__": 6518, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129370,7 +129586,7 @@ "return": null }, { - "__docId__": 6511, + "__docId__": 6519, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129405,7 +129621,7 @@ "return": null }, { - "__docId__": 6512, + "__docId__": 6520, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129440,7 +129656,7 @@ "return": null }, { - "__docId__": 6513, + "__docId__": 6521, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129469,7 +129685,7 @@ "return": null }, { - "__docId__": 6514, + "__docId__": 6522, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129498,7 +129714,7 @@ "return": null }, { - "__docId__": 6515, + "__docId__": 6523, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129527,7 +129743,7 @@ "return": null }, { - "__docId__": 6516, + "__docId__": 6524, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129556,7 +129772,7 @@ "return": null }, { - "__docId__": 6517, + "__docId__": 6525, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129585,7 +129801,7 @@ "return": null }, { - "__docId__": 6518, + "__docId__": 6526, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129614,7 +129830,7 @@ "return": null }, { - "__docId__": 6519, + "__docId__": 6527, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129643,7 +129859,7 @@ "return": null }, { - "__docId__": 6520, + "__docId__": 6528, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129672,7 +129888,7 @@ "return": null }, { - "__docId__": 6521, + "__docId__": 6529, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129701,7 +129917,7 @@ "return": null }, { - "__docId__": 6522, + "__docId__": 6530, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129730,7 +129946,7 @@ "return": null }, { - "__docId__": 6523, + "__docId__": 6531, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129759,7 +129975,7 @@ "return": null }, { - "__docId__": 6524, + "__docId__": 6532, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129788,7 +130004,7 @@ "return": null }, { - "__docId__": 6525, + "__docId__": 6533, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129817,7 +130033,7 @@ "return": null }, { - "__docId__": 6526, + "__docId__": 6534, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129846,7 +130062,7 @@ "return": null }, { - "__docId__": 6527, + "__docId__": 6535, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129875,7 +130091,7 @@ "return": null }, { - "__docId__": 6528, + "__docId__": 6536, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129904,7 +130120,7 @@ "return": null }, { - "__docId__": 6529, + "__docId__": 6537, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129933,7 +130149,7 @@ "return": null }, { - "__docId__": 6530, + "__docId__": 6538, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129962,7 +130178,7 @@ "return": null }, { - "__docId__": 6531, + "__docId__": 6539, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -129991,7 +130207,7 @@ "return": null }, { - "__docId__": 6532, + "__docId__": 6540, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -130020,7 +130236,7 @@ "return": null }, { - "__docId__": 6533, + "__docId__": 6541, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js~VBOBatchingPointsLayer", @@ -130036,18 +130252,18 @@ "return": null }, { - "__docId__": 6534, + "__docId__": 6542, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js", "content": "import {VBORenderer} from \"../../VBORenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class VBOBatchingPointsRenderer extends VBORenderer {\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState,\n } = drawCfg;\n\n gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);\n\n if (incrementDrawState) {\n frameCtx.drawArrays++;\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6535, + "__docId__": 6543, "kind": "class", "name": "VBOBatchingPointsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js", @@ -130066,7 +130282,7 @@ "ignore": true }, { - "__docId__": 6536, + "__docId__": 6544, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js~VBOBatchingPointsRenderer", @@ -130090,18 +130306,18 @@ "return": null }, { - "__docId__": 6537, + "__docId__": 6545, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n/**\n * @private\n */\nclass VBOBatchingPointsColorRenderer extends VBOBatchingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batching color vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (pointsMaterial.filterIntensity) {\n src.push(\"uniform vec2 intensityRange;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n if (pointsMaterial.filterIntensity) {\n src.push(\"float intensity = float(color.a) / 255.0;\")\n src.push(\"if (intensity < intensityRange[0] || intensity > intensityRange[1]) {\");\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n }\n\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);\");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n if (pointsMaterial.filterIntensity) {\n src.push(\"}\");\n }\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batching color fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vColor;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n\nexport {VBOBatchingPointsColorRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6538, + "__docId__": 6546, "kind": "class", "name": "VBOBatchingPointsColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js", @@ -130120,7 +130336,7 @@ "ignore": true }, { - "__docId__": 6539, + "__docId__": 6547, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js~VBOBatchingPointsColorRenderer", @@ -130141,7 +130357,7 @@ } }, { - "__docId__": 6540, + "__docId__": 6548, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js~VBOBatchingPointsColorRenderer", @@ -130176,7 +130392,7 @@ "return": null }, { - "__docId__": 6541, + "__docId__": 6549, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js~VBOBatchingPointsColorRenderer", @@ -130197,7 +130413,7 @@ } }, { - "__docId__": 6542, + "__docId__": 6550, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js~VBOBatchingPointsColorRenderer", @@ -130218,18 +130434,18 @@ } }, { - "__docId__": 6543, + "__docId__": 6551, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n\n/**\n * @private\n */\nclass VBOBatchingPointsOcclusionRenderer extends VBOBatchingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batching occlusion vertex shader\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n // Only opaque objects can be occluders\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\" gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batching occlusion fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n src.push(\"}\");\n return src;\n }\n}\n\nexport {VBOBatchingPointsOcclusionRenderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6544, + "__docId__": 6552, "kind": "class", "name": "VBOBatchingPointsOcclusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js", @@ -130248,7 +130464,7 @@ "ignore": true }, { - "__docId__": 6545, + "__docId__": 6553, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js~VBOBatchingPointsOcclusionRenderer", @@ -130269,7 +130485,7 @@ } }, { - "__docId__": 6546, + "__docId__": 6554, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js~VBOBatchingPointsOcclusionRenderer", @@ -130290,7 +130506,7 @@ } }, { - "__docId__": 6547, + "__docId__": 6555, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js~VBOBatchingPointsOcclusionRenderer", @@ -130311,18 +130527,18 @@ } }, { - "__docId__": 6548, + "__docId__": 6556, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class VBOBatchingPointsPickDepthRenderer extends VBOBatchingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batched pick depth vertex shader\");\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"gl_PointSize += 10.0;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points batched pick depth fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform float pickZNear;\");\n src.push(\"uniform float pickZFar;\");\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"vec4 packDepth(const in float depth) {\");\n src.push(\" const vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\");\n src.push(\" vec4 res = fract(depth * bitShift);\");\n src.push(\" res -= res.xxyz * bitMask;\");\n src.push(\" return res;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));\");\n src.push(\" outColor = packDepth(zNormalizedDepth); \"); // Must be linear depth\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6549, + "__docId__": 6557, "kind": "class", "name": "VBOBatchingPointsPickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js", @@ -130341,7 +130557,7 @@ "ignore": true }, { - "__docId__": 6550, + "__docId__": 6558, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js~VBOBatchingPointsPickDepthRenderer", @@ -130362,7 +130578,7 @@ } }, { - "__docId__": 6551, + "__docId__": 6559, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js~VBOBatchingPointsPickDepthRenderer", @@ -130383,7 +130599,7 @@ } }, { - "__docId__": 6552, + "__docId__": 6560, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js~VBOBatchingPointsPickDepthRenderer", @@ -130404,18 +130620,18 @@ } }, { - "__docId__": 6553, + "__docId__": 6561, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class VBOBatchingPointsPickMeshRenderer extends VBOBatchingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points batching pick mesh vertex shader\");\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n src.push(\"in vec4 pickColor;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vPickColor;\");\n\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"gl_PointSize += 10.0;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points batching pick mesh vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vPickColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vPickColor; \");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6554, + "__docId__": 6562, "kind": "class", "name": "VBOBatchingPointsPickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js", @@ -130434,7 +130650,7 @@ "ignore": true }, { - "__docId__": 6555, + "__docId__": 6563, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js~VBOBatchingPointsPickMeshRenderer", @@ -130455,7 +130671,7 @@ } }, { - "__docId__": 6556, + "__docId__": 6564, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js~VBOBatchingPointsPickMeshRenderer", @@ -130476,7 +130692,7 @@ } }, { - "__docId__": 6557, + "__docId__": 6565, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js~VBOBatchingPointsPickMeshRenderer", @@ -130497,18 +130713,18 @@ } }, { - "__docId__": 6558, + "__docId__": 6566, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", "content": "import {VBOBatchingPointsColorRenderer} from \"./VBOBatchingPointsColorRenderer.js\";\nimport {VBOBatchingPointsSilhouetteRenderer} from \"./VBOBatchingPointsSilhouetteRenderer.js\";\nimport {VBOBatchingPointsPickMeshRenderer} from \"./VBOBatchingPointsPickMeshRenderer.js\";\nimport {VBOBatchingPointsPickDepthRenderer} from \"./VBOBatchingPointsPickDepthRenderer.js\";\nimport {VBOBatchingPointsOcclusionRenderer} from \"./VBOBatchingPointsOcclusionRenderer.js\";\nimport {VBOBatchingPointsSnapInitRenderer} from \"./VBOBatchingPointsSnapInitRenderer.js\";\nimport {VBOBatchingPointsSnapRenderer} from \"./VBOBatchingPointsSnapRenderer.js\";\n\n/**\n * @private\n */\nclass VBOBatchingPointsRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._pickMeshRenderer && (!this._pickMeshRenderer.getValid())) {\n this._pickMeshRenderer.destroy();\n this._pickMeshRenderer = null;\n }\n if (this._pickDepthRenderer && (!this._pickDepthRenderer.getValid())) {\n this._pickDepthRenderer.destroy();\n this._pickDepthRenderer = null;\n }\n if (this._occlusionRenderer && this._occlusionRenderer.getValid() === false) {\n this._occlusionRenderer.destroy();\n this._occlusionRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new VBOBatchingPointsColorRenderer(this._scene);\n }\n return this._colorRenderer;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new VBOBatchingPointsSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get pickMeshRenderer() {\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new VBOBatchingPointsPickMeshRenderer(this._scene);\n }\n return this._pickMeshRenderer;\n }\n\n get pickDepthRenderer() {\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new VBOBatchingPointsPickDepthRenderer(this._scene);\n }\n return this._pickDepthRenderer;\n }\n\n get occlusionRenderer() {\n if (!this._occlusionRenderer) {\n this._occlusionRenderer = new VBOBatchingPointsOcclusionRenderer(this._scene);\n }\n return this._occlusionRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new VBOBatchingPointsSnapInitRenderer(this._scene, false);\n }\n return this._snapInitRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new VBOBatchingPointsSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.destroy();\n }\n if (this._pickDepthRenderer) {\n this._pickDepthRenderer.destroy();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let renderers = cachedRenderers[sceneId];\n if (!renderers) {\n renderers = new VBOBatchingPointsRenderers(scene);\n cachedRenderers[sceneId] = renderers;\n renderers._compile();\n scene.on(\"compile\", () => {\n renderers._compile();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n renderers._destroy();\n });\n }\n return renderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6559, + "__docId__": 6567, "kind": "class", "name": "VBOBatchingPointsRenderers", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", @@ -130524,7 +130740,7 @@ "ignore": true }, { - "__docId__": 6560, + "__docId__": 6568, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130538,7 +130754,7 @@ "undocument": true }, { - "__docId__": 6561, + "__docId__": 6569, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130556,7 +130772,7 @@ } }, { - "__docId__": 6562, + "__docId__": 6570, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130573,7 +130789,7 @@ "return": null }, { - "__docId__": 6563, + "__docId__": 6571, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130591,7 +130807,7 @@ } }, { - "__docId__": 6564, + "__docId__": 6572, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130609,7 +130825,7 @@ } }, { - "__docId__": 6565, + "__docId__": 6573, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130627,7 +130843,7 @@ } }, { - "__docId__": 6566, + "__docId__": 6574, "kind": "member", "name": "_pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130645,7 +130861,7 @@ } }, { - "__docId__": 6567, + "__docId__": 6575, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130663,7 +130879,7 @@ } }, { - "__docId__": 6568, + "__docId__": 6576, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130681,7 +130897,7 @@ } }, { - "__docId__": 6569, + "__docId__": 6577, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130699,7 +130915,7 @@ } }, { - "__docId__": 6570, + "__docId__": 6578, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130718,7 +130934,7 @@ } }, { - "__docId__": 6572, + "__docId__": 6580, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130737,7 +130953,7 @@ } }, { - "__docId__": 6574, + "__docId__": 6582, "kind": "get", "name": "pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130756,7 +130972,7 @@ } }, { - "__docId__": 6576, + "__docId__": 6584, "kind": "get", "name": "pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130775,7 +130991,7 @@ } }, { - "__docId__": 6578, + "__docId__": 6586, "kind": "get", "name": "occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130794,7 +131010,7 @@ } }, { - "__docId__": 6580, + "__docId__": 6588, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130813,7 +131029,7 @@ } }, { - "__docId__": 6582, + "__docId__": 6590, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130832,7 +131048,7 @@ } }, { - "__docId__": 6584, + "__docId__": 6592, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js~VBOBatchingPointsRenderers", @@ -130849,7 +131065,7 @@ "return": null }, { - "__docId__": 6585, + "__docId__": 6593, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", @@ -130870,7 +131086,7 @@ "ignore": true }, { - "__docId__": 6586, + "__docId__": 6594, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js", @@ -130900,18 +131116,18 @@ } }, { - "__docId__": 6587, + "__docId__": 6595, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n/**\n * Renders pointsBatchingLayer fragment depths to a shadow map.\n *\n * @private\n */\nexport class VBOBatchingPointsShadowRenderer extends VBOBatchingPointsRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Batched geometry shadow vertex shader\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n\n src.push(\"uniform mat4 shadowProjMatrix;\");\n src.push(\"uniform mat4 positionsDecodeMatrix;\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n src.push(\" int colorFlag = int(flags) & 0xF;\");\n src.push(\" bool visible = (colorFlag > 0);\");\n src.push(\" bool transparent = ((float(color.a) / 255.0) < 1.0);\");\n src.push(\" if (!visible || transparent) {\");\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = shadowViewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\" vViewPosition = viewPosition;\");\n src.push(\" gl_Position = shadowProjMatrix * viewPosition;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Batched geometry shadow fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n\n src.push(\"vec4 encodeFloat( const in float v ) {\");\n src.push(\" const vec4 bitShift = vec4(256 * 256 * 256, 256 * 256, 256, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\");\n src.push(\" vec4 comp = fract(v * bitShift);\");\n src.push(\" comp -= comp.xxyz * bitMask;\");\n src.push(\" return comp;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n src.push(\" outColor = encodeFloat( gl_FragCoord.z); \");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6588, + "__docId__": 6596, "kind": "class", "name": "VBOBatchingPointsShadowRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js", @@ -130930,7 +131146,7 @@ "ignore": true }, { - "__docId__": 6589, + "__docId__": 6597, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js~VBOBatchingPointsShadowRenderer", @@ -130951,7 +131167,7 @@ } }, { - "__docId__": 6590, + "__docId__": 6598, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js~VBOBatchingPointsShadowRenderer", @@ -130972,18 +131188,18 @@ } }, { - "__docId__": 6591, + "__docId__": 6599, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js", "content": "import {VBOBatchingPointsRenderer} from \"../VBOBatchingPointsRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOBatchingPointsSilhouetteRenderer extends VBOBatchingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n drawLayer(frameCtx, pointsBatchingLayer, renderPass) {\n super.drawLayer(frameCtx, pointsBatchingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points batching silhouette vertex shader\");\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 color;\");\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points batching silhouette vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"uniform vec4 color;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = color;\");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6592, + "__docId__": 6600, "kind": "class", "name": "VBOBatchingPointsSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js", @@ -131002,7 +131218,7 @@ "ignore": true }, { - "__docId__": 6593, + "__docId__": 6601, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js~VBOBatchingPointsSilhouetteRenderer", @@ -131023,7 +131239,7 @@ } }, { - "__docId__": 6594, + "__docId__": 6602, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js~VBOBatchingPointsSilhouetteRenderer", @@ -131058,7 +131274,7 @@ "return": null }, { - "__docId__": 6595, + "__docId__": 6603, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js~VBOBatchingPointsSilhouetteRenderer", @@ -131079,7 +131295,7 @@ } }, { - "__docId__": 6596, + "__docId__": 6604, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js~VBOBatchingPointsSilhouetteRenderer", @@ -131100,18 +131316,18 @@ } }, { - "__docId__": 6597, + "__docId__": 6605, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", "content": "\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\nimport {VBORenderer} from \"../../../VBORenderer.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOBatchingPointsSnapInitRenderer extends VBORenderer {\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBOBatchingPointsSnapInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" relativeToOriginPosition = worldPosition.xyz;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBOBatchingPointsSnapInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\");\n\n // src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n // src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n // src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(1.0, 1.0, 1.0, 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6598, + "__docId__": 6606, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131132,7 +131348,7 @@ "ignore": true }, { - "__docId__": 6599, + "__docId__": 6607, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131153,7 +131369,7 @@ "ignore": true }, { - "__docId__": 6600, + "__docId__": 6608, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131174,7 +131390,7 @@ "ignore": true }, { - "__docId__": 6601, + "__docId__": 6609, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131195,7 +131411,7 @@ "ignore": true }, { - "__docId__": 6602, + "__docId__": 6610, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131216,7 +131432,7 @@ "ignore": true }, { - "__docId__": 6603, + "__docId__": 6611, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131237,7 +131453,7 @@ "ignore": true }, { - "__docId__": 6604, + "__docId__": 6612, "kind": "class", "name": "VBOBatchingPointsSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js", @@ -131256,7 +131472,7 @@ "ignore": true }, { - "__docId__": 6605, + "__docId__": 6613, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131291,7 +131507,7 @@ "return": null }, { - "__docId__": 6606, + "__docId__": 6614, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131308,7 +131524,7 @@ "return": null }, { - "__docId__": 6607, + "__docId__": 6615, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131326,7 +131542,7 @@ } }, { - "__docId__": 6608, + "__docId__": 6616, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131344,7 +131560,7 @@ } }, { - "__docId__": 6609, + "__docId__": 6617, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131361,7 +131577,7 @@ } }, { - "__docId__": 6610, + "__docId__": 6618, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131378,7 +131594,7 @@ } }, { - "__docId__": 6611, + "__docId__": 6619, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131396,7 +131612,7 @@ } }, { - "__docId__": 6612, + "__docId__": 6620, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131414,7 +131630,7 @@ } }, { - "__docId__": 6613, + "__docId__": 6621, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131431,7 +131647,7 @@ "return": null }, { - "__docId__": 6614, + "__docId__": 6622, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131452,7 +131668,7 @@ } }, { - "__docId__": 6615, + "__docId__": 6623, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131473,7 +131689,7 @@ } }, { - "__docId__": 6616, + "__docId__": 6624, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131489,7 +131705,7 @@ "return": null }, { - "__docId__": 6617, + "__docId__": 6625, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131507,7 +131723,7 @@ } }, { - "__docId__": 6618, + "__docId__": 6626, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js~VBOBatchingPointsSnapInitRenderer", @@ -131523,18 +131739,18 @@ "return": null }, { - "__docId__": 6620, + "__docId__": 6628, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", "content": "\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\nimport {VBORenderer} from \"../../../VBORenderer.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOBatchingPointsSnapRenderer extends VBORenderer{\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\"); \n this.uVectorA = program.getLocation(\"snapVectorA\"); \n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBOBatchingPointsSnapRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\"); \n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBOBatchingPointsSnapRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6621, + "__docId__": 6629, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131555,7 +131771,7 @@ "ignore": true }, { - "__docId__": 6622, + "__docId__": 6630, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131576,7 +131792,7 @@ "ignore": true }, { - "__docId__": 6623, + "__docId__": 6631, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131597,7 +131813,7 @@ "ignore": true }, { - "__docId__": 6624, + "__docId__": 6632, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131618,7 +131834,7 @@ "ignore": true }, { - "__docId__": 6625, + "__docId__": 6633, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131639,7 +131855,7 @@ "ignore": true }, { - "__docId__": 6626, + "__docId__": 6634, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131660,7 +131876,7 @@ "ignore": true }, { - "__docId__": 6627, + "__docId__": 6635, "kind": "class", "name": "VBOBatchingPointsSnapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js", @@ -131679,7 +131895,7 @@ "ignore": true }, { - "__docId__": 6628, + "__docId__": 6636, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131700,7 +131916,7 @@ } }, { - "__docId__": 6629, + "__docId__": 6637, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131735,7 +131951,7 @@ "return": null }, { - "__docId__": 6630, + "__docId__": 6638, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131752,7 +131968,7 @@ "return": null }, { - "__docId__": 6631, + "__docId__": 6639, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131770,7 +131986,7 @@ } }, { - "__docId__": 6632, + "__docId__": 6640, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131788,7 +132004,7 @@ } }, { - "__docId__": 6633, + "__docId__": 6641, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131805,7 +132021,7 @@ } }, { - "__docId__": 6634, + "__docId__": 6642, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131822,7 +132038,7 @@ } }, { - "__docId__": 6635, + "__docId__": 6643, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131840,7 +132056,7 @@ } }, { - "__docId__": 6636, + "__docId__": 6644, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131858,7 +132074,7 @@ } }, { - "__docId__": 6637, + "__docId__": 6645, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131875,7 +132091,7 @@ "return": null }, { - "__docId__": 6638, + "__docId__": 6646, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131896,7 +132112,7 @@ } }, { - "__docId__": 6639, + "__docId__": 6647, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131917,7 +132133,7 @@ } }, { - "__docId__": 6640, + "__docId__": 6648, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131933,7 +132149,7 @@ "return": null }, { - "__docId__": 6641, + "__docId__": 6649, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131951,7 +132167,7 @@ } }, { - "__docId__": 6642, + "__docId__": 6650, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js~VBOBatchingPointsSnapRenderer", @@ -131967,18 +132183,18 @@ "return": null }, { - "__docId__": 6644, + "__docId__": 6652, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js", "content": "import {Configs} from \"../../../../../Configs.js\";\n\nconst configs = new Configs();\n\n/**\n * @private\n */\nexport class VBOBatchingTrianglesBuffer {\n\n constructor() {\n this.maxVerts = configs.maxGeometryBatchSize;\n this.maxIndices = configs.maxGeometryBatchSize * 3; // Rough rule-of-thumb\n this.positions = [];\n this.colors = [];\n this.uv = [];\n this.metallicRoughness = [];\n this.normals = [];\n this.pickColors = [];\n this.offsets = [];\n this.indices = [];\n this.edgeIndices = [];\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6645, + "__docId__": 6653, "kind": "variable", "name": "configs", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js", @@ -131999,7 +132215,7 @@ "ignore": true }, { - "__docId__": 6646, + "__docId__": 6654, "kind": "class", "name": "VBOBatchingTrianglesBuffer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js", @@ -132015,7 +132231,7 @@ "ignore": true }, { - "__docId__": 6647, + "__docId__": 6655, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132029,7 +132245,7 @@ "undocument": true }, { - "__docId__": 6648, + "__docId__": 6656, "kind": "member", "name": "maxVerts", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132046,7 +132262,7 @@ } }, { - "__docId__": 6649, + "__docId__": 6657, "kind": "member", "name": "maxIndices", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132063,7 +132279,7 @@ } }, { - "__docId__": 6650, + "__docId__": 6658, "kind": "member", "name": "positions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132080,7 +132296,7 @@ } }, { - "__docId__": 6651, + "__docId__": 6659, "kind": "member", "name": "colors", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132097,7 +132313,7 @@ } }, { - "__docId__": 6652, + "__docId__": 6660, "kind": "member", "name": "uv", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132114,7 +132330,7 @@ } }, { - "__docId__": 6653, + "__docId__": 6661, "kind": "member", "name": "metallicRoughness", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132131,7 +132347,7 @@ } }, { - "__docId__": 6654, + "__docId__": 6662, "kind": "member", "name": "normals", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132148,7 +132364,7 @@ } }, { - "__docId__": 6655, + "__docId__": 6663, "kind": "member", "name": "pickColors", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132165,7 +132381,7 @@ } }, { - "__docId__": 6656, + "__docId__": 6664, "kind": "member", "name": "offsets", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132182,7 +132398,7 @@ } }, { - "__docId__": 6657, + "__docId__": 6665, "kind": "member", "name": "indices", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132199,7 +132415,7 @@ } }, { - "__docId__": 6658, + "__docId__": 6666, "kind": "member", "name": "edgeIndices", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js~VBOBatchingTrianglesBuffer", @@ -132216,18 +132432,18 @@ } }, { - "__docId__": 6659, + "__docId__": 6667, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {geometryCompressionUtils} from \"../../../../math/geometryCompressionUtils.js\";\nimport {getRenderers} from \"./renderers/Renderers.js\";\nimport {VBOBatchingTrianglesBuffer} from \"./VBOBatchingTrianglesBuffer.js\";\nimport {quantizePositions, transformAndOctEncodeNormals} from \"../../../compression.js\";\n\nconst tempMat4 = math.mat4();\nconst tempMat4b = math.mat4();\nconst tempVec4a = math.vec4([0, 0, 0, 1]);\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempVec3e = math.vec3();\nconst tempVec3f = math.vec3();\nconst tempVec3g = math.vec3();\n\n/**\n * @private\n */\nexport class VBOBatchingTrianglesLayer {\n\n /**\n * @param model\n * @param cfg.model\n * @param cfg.autoNormals\n * @param cfg.layerIndex\n * @param cfg.positionsDecodeMatrix\n * @param cfg.uvDecodeMatrix\n * @param cfg.maxGeometryBatchSize\n * @param cfg.origin\n * @param cfg.scratchMemory\n * @param cfg.textureSet\n * @param cfg.solid\n */\n constructor(cfg) {\n\n console.info(\"Creating VBOBatchingTrianglesLayer\");\n\n /**\n * Owner model\n * @type {VBOSceneModel}\n */\n this.model = cfg.model;\n\n /**\n * State sorting key.\n * @type {string}\n */\n this.sortId = \"TrianglesBatchingLayer\"\n + (cfg.solid ? \"-solid\" : \"-surface\")\n + (cfg.autoNormals ? \"-autonormals\" : \"-normals\")\n\n // TODO: These two parts need to be IDs (ie. unique):\n\n + (cfg.textureSet && cfg.textureSet.colorTexture ? \"-colorTexture\" : \"\")\n + (cfg.textureSet && cfg.textureSet.metallicRoughnessTexture ? \"-metallicRoughnessTexture\" : \"\");\n\n /**\n * Index of this TrianglesBatchingLayer in {@link VBOSceneModel#_layerList}.\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n this._buffer = new VBOBatchingTrianglesBuffer(cfg.maxGeometryBatchSize);\n this._scratchMemory = cfg.scratchMemory;\n\n this._state = new RenderState({\n origin: math.vec3(),\n positionsBuf: null,\n offsetsBuf: null,\n normalsBuf: null,\n colorsBuf: null,\n uvBuf: null,\n metallicRoughnessBuf: null,\n flagsBuf: null,\n indicesBuf: null,\n edgeIndicesBuf: null,\n positionsDecodeMatrix: null,\n uvDecodeMatrix: null,\n textureSet: cfg.textureSet,\n pbrSupported: false // Set in #finalize if we have enough to support quality rendering\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numEdgesLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n this._modelAABB = math.collapseAABB3(); // Model-space AABB\n this._portions = [];\n this._meshes = [];\n this._numVerts = 0;\n\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n this._finalized = false;\n\n if (cfg.positionsDecodeMatrix) {\n this._state.positionsDecodeMatrix = math.mat4(cfg.positionsDecodeMatrix);\n }\n\n if (cfg.uvDecodeMatrix) {\n this._state.uvDecodeMatrix = math.mat3(cfg.uvDecodeMatrix);\n this._preCompressedUVsExpected = true;\n } else {\n this._preCompressedUVsExpected = false;\n }\n\n if (cfg.origin) {\n this._state.origin.set(cfg.origin);\n }\n\n /**\n * When true, this layer contains solid triangle meshes, otherwise this layer contains surface triangle meshes\n * @type {boolean}\n */\n this.solid = !!cfg.solid;\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Tests if there is room for another portion in this TrianglesBatchingLayer.\n *\n * @param lenPositions Number of positions we'd like to create in the portion.\n * @param lenIndices Number of indices we'd like to create in this portion.\n * @returns {Boolean} True if OK to create another portion.\n */\n canCreatePortion(lenPositions, lenIndices) {\n if (this._finalized) {\n throw \"Already finalized\";\n }\n return ((this._buffer.positions.length + lenPositions) < (this._buffer.maxVerts * 3) && (this._buffer.indices.length + lenIndices) < (this._buffer.maxIndices));\n }\n\n /**\n * Creates a new portion within this TrianglesBatchingLayer, returns the new portion ID.\n *\n * Gives the portion the specified geometry, color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg.positions Flat float Local-space positions array.\n * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix\n * @param [cfg.normals] Flat float normals array.\n * @param [cfg.uv] Flat UVs array.\n * @param [cfg.uvCompressed]\n * @param [cfg.colors] Flat float colors array.\n * @param [cfg.colorsCompressed]\n * @param cfg.indices Flat int indices array.\n * @param [cfg.edgeIndices] Flat int edges indices array.\n * @param cfg.color Quantized RGB color [0..255,0..255,0..255,0..255]\n * @param cfg.metallic Metalness factor [0..255]\n * @param cfg.roughness Roughness factor [0..255]\n * @param cfg.opacity Opacity [0..255]\n * @param [cfg.meshMatrix] Flat float 4x4 matrix\n * @param cfg.aabb Flat float AABB World-space AABB\n * @param cfg.pickColor Quantized pick color\n * @returns {number} Portion ID\n */\n createPortion(mesh, cfg) {\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n const positions = cfg.positions;\n const positionsCompressed = cfg.positionsCompressed;\n const normals = cfg.normals;\n const normalsCompressed = cfg.normalsCompressed;\n const uv = cfg.uv;\n const uvCompressed = cfg.uvCompressed;\n const colors = cfg.colors;\n const colorsCompressed = cfg.colorsCompressed;\n const indices = cfg.indices;\n const edgeIndices = cfg.edgeIndices;\n const color = cfg.color;\n const metallic = cfg.metallic;\n const roughness = cfg.roughness;\n const opacity = cfg.opacity;\n const meshMatrix = cfg.meshMatrix;\n const pickColor = cfg.pickColor;\n\n const scene = this.model.scene;\n const buffer = this._buffer;\n const vertsBaseIndex = buffer.positions.length / 3;\n\n let numVerts;\n\n math.expandAABB3(this._modelAABB, cfg.aabb);\n\n if (this._state.positionsDecodeMatrix) {\n if (!positionsCompressed) {\n throw \"positionsCompressed expected\";\n }\n numVerts = positionsCompressed.length / 3;\n for (let i = 0, len = positionsCompressed.length; i < len; i++) {\n buffer.positions.push(positionsCompressed[i]);\n }\n } else {\n if (!positions) {\n throw \"positions expected\";\n }\n numVerts = positions.length / 3;\n for (let i = 0, len = positions.length; i < len; i++) {\n buffer.positions.push(positions[i]);\n }\n }\n\n if (normalsCompressed && normalsCompressed.length > 0) {\n for (let i = 0, len = normalsCompressed.length; i < len; i++) {\n buffer.normals.push(normalsCompressed[i]);\n }\n } else if (normals && normals.length > 0) {\n const worldNormalMatrix = tempMat4;\n if (meshMatrix) {\n math.inverseMat4(math.transposeMat4(meshMatrix, tempMat4b), worldNormalMatrix); // Note: order of inverse and transpose doesn't matter\n } else {\n math.identityMat4(worldNormalMatrix, worldNormalMatrix);\n }\n transformAndOctEncodeNormals(worldNormalMatrix, normals, normals.length, buffer.normals, buffer.normals.length);\n }\n\n if (colors) {\n for (let i = 0, len = colors.length; i < len; i += 3) {\n buffer.colors.push(colors[i] * 255);\n buffer.colors.push(colors[i + 1] * 255);\n buffer.colors.push(colors[i + 2] * 255);\n buffer.colors.push(255);\n }\n } else if (colorsCompressed) {\n for (let i = 0, len = colors.length; i < len; i += 3) {\n buffer.colors.push(colors[i]);\n buffer.colors.push(colors[i + 1]);\n buffer.colors.push(colors[i + 2]);\n buffer.colors.push(255);\n }\n } else if (color) {\n const r = color[0]; // Color is pre-quantized by VBOSceneModel\n const g = color[1];\n const b = color[2];\n const a = opacity;\n for (let i = 0; i < numVerts; i++) {\n buffer.colors.push(r);\n buffer.colors.push(g);\n buffer.colors.push(b);\n buffer.colors.push(a);\n }\n }\n const metallicValue = (metallic !== null && metallic !== undefined) ? metallic : 0;\n const roughnessValue = (roughness !== null && roughness !== undefined) ? roughness : 255;\n for (let i = 0; i < numVerts; i++) {\n buffer.metallicRoughness.push(metallicValue);\n buffer.metallicRoughness.push(roughnessValue);\n }\n\n if (uv && uv.length > 0) {\n for (let i = 0, len = uv.length; i < len; i++) {\n buffer.uv.push(uv[i]);\n }\n } else if (uvCompressed && uvCompressed.length > 0) {\n for (let i = 0, len = uvCompressed.length; i < len; i++) {\n buffer.uv.push(uvCompressed[i]);\n }\n }\n\n for (let i = 0, len = indices.length; i < len; i++) {\n buffer.indices.push(vertsBaseIndex + indices[i]);\n }\n\n\n if (edgeIndices) {\n for (let i = 0, len = edgeIndices.length; i < len; i++) {\n buffer.edgeIndices.push(vertsBaseIndex + edgeIndices[i]);\n }\n }\n\n {\n const pickColorsBase = buffer.pickColors.length;\n const lenPickColors = numVerts * 4;\n for (let i = pickColorsBase, len = pickColorsBase + lenPickColors; i < len; i += 4) {\n buffer.pickColors.push(pickColor[0]);\n buffer.pickColors.push(pickColor[1]);\n buffer.pickColors.push(pickColor[2]);\n buffer.pickColors.push(pickColor[3]);\n }\n }\n\n if (scene.entityOffsetsEnabled) {\n for (let i = 0; i < numVerts; i++) {\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n buffer.offsets.push(0);\n }\n }\n\n const portionId = this._portions.length;\n\n const portion = {\n vertsBaseIndex: vertsBaseIndex,\n numVerts: numVerts,\n indicesBaseIndex: buffer.indices.length - indices.length,\n numIndices: indices.length,\n };\n\n if (scene.pickSurfacePrecisionEnabled) {\n // Quantized in-memory positions are initialized in finalize()\n\n portion.indices = indices;\n\n if (scene.entityOffsetsEnabled) {\n portion.offset = new Float32Array(3);\n }\n }\n\n this._portions.push(portion);\n this._numPortions++;\n this.model.numPortions++;\n this._numVerts += portion.numVerts;\n this._meshes.push(mesh);\n return portionId;\n }\n\n /**\n * Builds batch VBOs from appended geometries.\n * No more portions can then be created.\n */\n finalize() {\n\n if (this._finalized) {\n return;\n }\n\n const state = this._state;\n const gl = this.model.scene.canvas.gl;\n const buffer = this._buffer;\n\n if (buffer.positions.length > 0) {\n const quantizedPositions = (this._state.positionsDecodeMatrix)\n ? new Uint16Array(buffer.positions)\n : quantizePositions(buffer.positions, this._modelAABB, this._state.positionsDecodeMatrix = math.mat4()); // BOTTLENECK\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, quantizedPositions, quantizedPositions.length, 3, gl.STATIC_DRAW);\n if (this.model.scene.pickSurfacePrecisionEnabled) {\n for (let i = 0, numPortions = this._portions.length; i < numPortions; i++) {\n const portion = this._portions[i];\n const start = portion.vertsBaseIndex * 3;\n const end = start + (portion.numVerts * 3);\n portion.quantizedPositions = quantizedPositions.slice(start, end);\n }\n }\n }\n\n if (buffer.normals.length > 0) { // Normals are already oct-encoded\n const normals = new Int8Array(buffer.normals);\n let normalized = true; // For oct encoded UInts\n state.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, normals, buffer.normals.length, 3, gl.STATIC_DRAW, normalized);\n }\n\n if (buffer.colors.length > 0) { // Colors are already compressed\n const colors = new Uint8Array(buffer.colors);\n let normalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, buffer.colors.length, 4, gl.DYNAMIC_DRAW, normalized);\n }\n\n if (buffer.uv.length > 0) {\n if (!state.uvDecodeMatrix) {\n const bounds = geometryCompressionUtils.getUVBounds(buffer.uv);\n const result = geometryCompressionUtils.compressUVs(buffer.uv, bounds.min, bounds.max);\n const uv = result.quantized;\n let notNormalized = false;\n state.uvDecodeMatrix = math.mat3(result.decodeMatrix);\n state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW, notNormalized);\n } else {\n let notNormalized = false;\n state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, buffer.uv, buffer.uv.length, 2, gl.STATIC_DRAW, notNormalized);\n }\n }\n\n if (buffer.metallicRoughness.length > 0) {\n const metallicRoughness = new Uint8Array(buffer.metallicRoughness);\n let normalized = false;\n state.metallicRoughnessBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, metallicRoughness, buffer.metallicRoughness.length, 2, gl.STATIC_DRAW, normalized);\n }\n\n if (buffer.positions.length > 0) { // Because we build flags arrays here, get their length from the positions array\n const flagsLength = (buffer.positions.length / 3);\n const flags = new Float32Array(flagsLength);\n const notNormalized = false;\n state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, flags, flags.length, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n\n if (buffer.pickColors.length > 0) {\n const pickColors = new Uint8Array(buffer.pickColors);\n let normalized = false;\n state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, pickColors, buffer.pickColors.length, 4, gl.STATIC_DRAW, normalized);\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n if (buffer.offsets.length > 0) {\n const offsets = new Float32Array(buffer.offsets);\n state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, offsets, buffer.offsets.length, 3, gl.DYNAMIC_DRAW);\n }\n }\n\n if (buffer.indices.length > 0) {\n const indices = new Uint32Array(buffer.indices);\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, indices, buffer.indices.length, 1, gl.STATIC_DRAW);\n }\n if (buffer.edgeIndices.length > 0) {\n const edgeIndices = new Uint32Array(buffer.edgeIndices);\n state.edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, edgeIndices, buffer.edgeIndices.length, 1, gl.STATIC_DRAW);\n }\n\n this._state.pbrSupported\n = !!state.metallicRoughnessBuf\n && !!state.uvBuf\n && !!state.normalsBuf\n && !!state.textureSet\n && !!state.textureSet.colorTexture\n && !!state.textureSet.metallicRoughnessTexture;\n\n this._state.colorTextureSupported\n = !!state.uvBuf\n && !!state.textureSet\n && !!state.textureSet.colorTexture;\n\n this._buffer = null;\n this._finalized = true;\n }\n\n isEmpty() {\n return (!this._state.indicesBuf);\n }\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n const deferred = true;\n this._setFlags(portionId, flags, meshTransparent, deferred);\n }\n\n flushInitFlags() {\n this._setDeferredFlags();\n }\n\n setVisible(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setHighlighted(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setXRayed(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setSelected(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setEdges(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n } else {\n this._numEdgesLayerPortions--;\n this.model.numEdgesLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCulled(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, transparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n setColor(portionId, color) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n const portionsIdx = portionId;\n const portion = this._portions[portionsIdx];\n const vertsBaseIndex = portion.vertsBaseIndex;\n const numVerts = portion.numVerts;\n const firstColor = vertsBaseIndex * 4;\n const lenColor = numVerts * 4;\n const tempArray = this._scratchMemory.getUInt8Array(lenColor);\n const r = color[0];\n const g = color[1];\n const b = color[2];\n const a = color[3];\n for (let i = 0; i < lenColor; i += 4) {\n tempArray[i + 0] = r;\n tempArray[i + 1] = g;\n tempArray[i + 2] = b;\n tempArray[i + 3] = a;\n }\n if (this._state.colorsBuf) {\n this._state.colorsBuf.setData(tempArray, firstColor, lenColor);\n }\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, transparent, deferred = false) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const portionsIdx = portionId;\n const portion = this._portions[portionsIdx];\n const vertsBaseIndex = portion.vertsBaseIndex;\n const numVerts = portion.numVerts;\n const firstFlag = vertsBaseIndex;\n const lenFlags = numVerts;\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n const edges = !!(flags & ENTITY_FLAGS.EDGES);\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (transparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let edgeFlag = 0;\n if (!visible || culled) {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n edgeFlag = RENDER_PASSES.EDGES_SELECTED;\n } else if (highlighted) {\n edgeFlag = RENDER_PASSES.EDGES_HIGHLIGHTED;\n } else if (xrayed) {\n edgeFlag = RENDER_PASSES.EDGES_XRAYED;\n } else if (edges) {\n if (transparent) {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;\n } else {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_OPAQUE;\n }\n } else {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 1 : 0;\n\n if (deferred) {\n // Avoid zillions of individual WebGL bufferSubData calls - buffer them to apply in one shot\n if (!this._deferredFlagValues) {\n this._deferredFlagValues = new Float32Array(this._numVerts);\n }\n for (let i = firstFlag, len = (firstFlag + lenFlags); i < len; i++) {\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n vertFlag |= edgeFlag << 8;\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n this._deferredFlagValues[i] = vertFlag;\n }\n } else if (this._state.flagsBuf) {\n const tempArray = this._scratchMemory.getFloat32Array(lenFlags);\n for (let i = 0; i < lenFlags; i++) {\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n vertFlag |= edgeFlag << 8;\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempArray[i] = vertFlag;\n }\n this._state.flagsBuf.setData(tempArray, firstFlag, lenFlags);\n }\n }\n\n _setDeferredFlags() {\n if (this._deferredFlagValues) {\n this._state.flagsBuf.setData(this._deferredFlagValues);\n this._deferredFlagValues = null;\n }\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n const portionsIdx = portionId;\n const portion = this._portions[portionsIdx];\n const vertsBaseIndex = portion.vertsBaseIndex;\n const numVerts = portion.numVerts;\n const firstOffset = vertsBaseIndex * 3;\n const lenOffsets = numVerts * 3;\n const tempArray = this._scratchMemory.getFloat32Array(lenOffsets);\n const x = offset[0];\n const y = offset[1];\n const z = offset[2];\n for (let i = 0; i < lenOffsets; i += 3) {\n tempArray[i + 0] = x;\n tempArray[i + 1] = y;\n tempArray[i + 2] = z;\n }\n if (this._state.offsetsBuf) {\n this._state.offsetsBuf.setData(tempArray, firstOffset, lenOffsets);\n }\n if (this.model.scene.pickSurfacePrecisionEnabled) {\n portion.offset[0] = offset[0];\n portion.offset[1] = offset[1];\n portion.offset[2] = offset[2];\n }\n }\n\n getEachVertex(portionId, callback) {\n if (!this.model.scene.pickSurfacePrecisionEnabled) {\n return;\n }\n const state = this._state;\n const portion = this._portions[portionId];\n if (!portion) {\n this.model.error(\"portion not found: \" + portionId);\n return;\n }\n const positions = portion.quantizedPositions;\n const origin = state.origin;\n const offset = portion.offset;\n const offsetX = origin[0] + offset[0];\n const offsetY = origin[1] + offset[1];\n const offsetZ = origin[2] + offset[2];\n const worldPos = tempVec4a;\n for (let i = 0, len = positions.length; i < len; i += 3) {\n worldPos[0] = positions[i];\n worldPos[1] = positions[i + 1];\n worldPos[2] = positions[i + 2];\n worldPos[3] = 1.0;\n math.decompressPosition(worldPos, state.positionsDecodeMatrix);\n math.transformPoint4(this.model.worldMatrix, worldPos);\n worldPos[0] += offsetX;\n worldPos[1] += offsetY;\n worldPos[2] += offsetZ;\n callback(worldPos);\n }\n }\n\n getElementsCountAndOffset(portionId) {\n let count = null;\n let offset = null;\n const portion = this._portions[portionId];\n\n if (portion) {\n count = portion.numIndices;\n offset = portion.indicesBaseIndex;\n }\n\n return {count, offset}\n }\n\n // ---------------------- COLOR RENDERING -----------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (frameCtx.withSAO && this.model.saoEnabled) {\n if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRendererWithSAO) {\n this._renderers.pbrRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRendererWithSAO) {\n this._renderers.colorTextureRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRendererWithSAO) {\n this._renderers.colorRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else {\n if (this._renderers.flatColorRendererWithSAO) {\n this._renderers.flatColorRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n } else {\n if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRenderer) {\n this._renderers.pbrRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRenderer) {\n this._renderers.colorTextureRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else {\n if (this._renderers.flatColorRenderer) {\n this._renderers.flatColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n }\n }\n\n _updateBackfaceCull(renderFlags, frameCtx) {\n const backfaces = this.model.backfaces || (!this.solid) || renderFlags.sectioned;\n if (frameCtx.backfaces !== backfaces) {\n const gl = frameCtx.gl;\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRenderer) {\n this._renderers.pbrRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRenderer) {\n this._renderers.colorTextureRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else {\n if (this._renderers.flatColorRenderer) {\n this._renderers.flatColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n }\n\n // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------\n\n drawDepth(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.depthRenderer) {\n this._renderers.depthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects\n }\n }\n\n drawNormals(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.normalsRenderer) {\n this._renderers.normalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses normals (eg SAO) does not apply to transparent objects\n }\n }\n\n // ---------------------- SILHOUETTE RENDERING -----------------------------------\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n // ---------------------- EDGES RENDERING -----------------------------------\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesColorRenderer) {\n this._renderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_OPAQUE);\n }\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0 || this._numTransparentLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesColorRenderer) {\n this._renderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_TRANSPARENT);\n }\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_HIGHLIGHTED);\n }\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_SELECTED);\n }\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_XRAYED);\n }\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n drawOcclusion(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.occlusionRenderer) {\n this._renderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n drawShadow(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.shadowRenderer) {\n this._renderers.shadowRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n //---- PICKING ----------------------------------------------------------------------------------------------------\n\n drawPickMesh(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.pickMeshRenderer) {\n this._renderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickDepths(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.pickDepthRenderer) {\n this._renderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickNormals(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n\n ////////////////////////////////////////////////////////////////////////////////////////////////////\n // TODO\n // if (this._state.normalsBuf) {\n // if (this._renderers.pickNormalsRenderer) {\n // this._renderers.pickNormalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n // }\n ////////////////////////////////////////////////////////////////////////////////////////////////////\n // } else {\n if (this._renderers.pickNormalsFlatRenderer) {\n this._renderers.pickNormalsFlatRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n // }\n }\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n //------------------------------------------------------------------------------------------------\n\n precisionRayPickSurface(portionId, worldRayOrigin, worldRayDir, worldSurfacePos, worldNormal) {\n\n if (!this.model.scene.pickSurfacePrecisionEnabled) {\n return false;\n }\n\n const state = this._state;\n const portion = this._portions[portionId];\n\n if (!portion) {\n this.model.error(\"portion not found: \" + portionId);\n return false;\n }\n\n const positions = portion.quantizedPositions;\n const indices = portion.indices;\n const origin = state.origin;\n const offset = portion.offset;\n\n const rtcRayOrigin = tempVec3a;\n const rtcRayDir = tempVec3b;\n\n rtcRayOrigin.set(origin ? math.subVec3(worldRayOrigin, origin, tempVec3c) : worldRayOrigin); // World -> RTC\n rtcRayDir.set(worldRayDir);\n\n if (offset) {\n math.subVec3(rtcRayOrigin, offset);\n }\n\n math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local\n\n const a = tempVec3d;\n const b = tempVec3e;\n const c = tempVec3f;\n\n let gotIntersect = false;\n let closestDist = 0;\n const closestIntersectPos = tempVec3g;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n\n const ia = indices[i] * 3;\n const ib = indices[i + 1] * 3;\n const ic = indices[i + 2] * 3;\n\n a[0] = positions[ia];\n a[1] = positions[ia + 1];\n a[2] = positions[ia + 2];\n\n b[0] = positions[ib];\n b[1] = positions[ib + 1];\n b[2] = positions[ib + 2];\n\n c[0] = positions[ic];\n c[1] = positions[ic + 1];\n c[2] = positions[ic + 2];\n\n math.decompressPosition(a, state.positionsDecodeMatrix);\n math.decompressPosition(b, state.positionsDecodeMatrix);\n math.decompressPosition(c, state.positionsDecodeMatrix);\n\n if (math.rayTriangleIntersect(rtcRayOrigin, rtcRayDir, a, b, c, closestIntersectPos)) {\n\n math.transformPoint3(this.model.worldMatrix, closestIntersectPos, closestIntersectPos);\n\n if (offset) {\n math.addVec3(closestIntersectPos, offset);\n }\n\n if (origin) {\n math.addVec3(closestIntersectPos, origin);\n }\n\n const dist = Math.abs(math.lenVec3(math.subVec3(closestIntersectPos, worldRayOrigin, [])));\n\n if (!gotIntersect || dist > closestDist) {\n closestDist = dist;\n worldSurfacePos.set(closestIntersectPos);\n if (worldNormal) { // Not that wasteful to eagerly compute - unlikely to hit >2 surfaces on most geometry\n math.triangleNormal(a, b, c, worldNormal);\n }\n gotIntersect = true;\n }\n }\n }\n\n if (gotIntersect && worldNormal) {\n math.transformVec3(this.model.worldNormalMatrix, worldNormal, worldNormal);\n math.normalizeVec3(worldNormal);\n }\n\n return gotIntersect;\n }\n\n // ---------\n\n destroy() {\n const state = this._state;\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n state.positionsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.normalsBuf) {\n state.normalsBuf.destroy();\n state.normalsBuf = null;\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.metallicRoughnessBuf) {\n state.metallicRoughnessBuf.destroy();\n state.metallicRoughnessBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.pickColorsBuf) {\n state.pickColorsBuf.destroy();\n state.pickColorsBuf = null;\n }\n if (state.indicesBuf) {\n state.indicesBuf.destroy();\n state.indicessBuf = null;\n }\n if (state.edgeIndicesBuf) {\n state.edgeIndicesBuf.destroy();\n state.edgeIndicessBuf = null;\n }\n state.destroy();\n }\n}\n\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6660, + "__docId__": 6668, "kind": "variable", "name": "tempMat4", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132248,7 +132464,7 @@ "ignore": true }, { - "__docId__": 6661, + "__docId__": 6669, "kind": "variable", "name": "tempMat4b", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132269,7 +132485,7 @@ "ignore": true }, { - "__docId__": 6662, + "__docId__": 6670, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132290,7 +132506,7 @@ "ignore": true }, { - "__docId__": 6663, + "__docId__": 6671, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132311,7 +132527,7 @@ "ignore": true }, { - "__docId__": 6664, + "__docId__": 6672, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132332,7 +132548,7 @@ "ignore": true }, { - "__docId__": 6665, + "__docId__": 6673, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132353,7 +132569,7 @@ "ignore": true }, { - "__docId__": 6666, + "__docId__": 6674, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132374,7 +132590,7 @@ "ignore": true }, { - "__docId__": 6667, + "__docId__": 6675, "kind": "variable", "name": "tempVec3e", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132395,7 +132611,7 @@ "ignore": true }, { - "__docId__": 6668, + "__docId__": 6676, "kind": "variable", "name": "tempVec3f", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132416,7 +132632,7 @@ "ignore": true }, { - "__docId__": 6669, + "__docId__": 6677, "kind": "variable", "name": "tempVec3g", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132437,7 +132653,7 @@ "ignore": true }, { - "__docId__": 6670, + "__docId__": 6678, "kind": "class", "name": "VBOBatchingTrianglesLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js", @@ -132453,7 +132669,7 @@ "ignore": true }, { - "__docId__": 6671, + "__docId__": 6679, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132578,7 +132794,7 @@ ] }, { - "__docId__": 6672, + "__docId__": 6680, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132597,7 +132813,7 @@ } }, { - "__docId__": 6673, + "__docId__": 6681, "kind": "member", "name": "sortId", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132616,7 +132832,7 @@ } }, { - "__docId__": 6674, + "__docId__": 6682, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132635,7 +132851,7 @@ } }, { - "__docId__": 6675, + "__docId__": 6683, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132653,7 +132869,7 @@ } }, { - "__docId__": 6676, + "__docId__": 6684, "kind": "member", "name": "_buffer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132671,7 +132887,7 @@ } }, { - "__docId__": 6677, + "__docId__": 6685, "kind": "member", "name": "_scratchMemory", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132689,7 +132905,7 @@ } }, { - "__docId__": 6678, + "__docId__": 6686, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132707,7 +132923,7 @@ } }, { - "__docId__": 6679, + "__docId__": 6687, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132725,7 +132941,7 @@ } }, { - "__docId__": 6680, + "__docId__": 6688, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132743,7 +132959,7 @@ } }, { - "__docId__": 6681, + "__docId__": 6689, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132761,7 +132977,7 @@ } }, { - "__docId__": 6682, + "__docId__": 6690, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132779,7 +132995,7 @@ } }, { - "__docId__": 6683, + "__docId__": 6691, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132797,7 +133013,7 @@ } }, { - "__docId__": 6684, + "__docId__": 6692, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132815,7 +133031,7 @@ } }, { - "__docId__": 6685, + "__docId__": 6693, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132833,7 +133049,7 @@ } }, { - "__docId__": 6686, + "__docId__": 6694, "kind": "member", "name": "_numEdgesLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132851,7 +133067,7 @@ } }, { - "__docId__": 6687, + "__docId__": 6695, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132869,7 +133085,7 @@ } }, { - "__docId__": 6688, + "__docId__": 6696, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132887,7 +133103,7 @@ } }, { - "__docId__": 6689, + "__docId__": 6697, "kind": "member", "name": "_modelAABB", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132905,7 +133121,7 @@ } }, { - "__docId__": 6690, + "__docId__": 6698, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132923,7 +133139,7 @@ } }, { - "__docId__": 6691, + "__docId__": 6699, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132941,7 +133157,7 @@ } }, { - "__docId__": 6692, + "__docId__": 6700, "kind": "member", "name": "_numVerts", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132959,7 +133175,7 @@ } }, { - "__docId__": 6693, + "__docId__": 6701, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132977,7 +133193,7 @@ } }, { - "__docId__": 6694, + "__docId__": 6702, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -132994,7 +133210,7 @@ } }, { - "__docId__": 6695, + "__docId__": 6703, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133012,7 +133228,7 @@ } }, { - "__docId__": 6696, + "__docId__": 6704, "kind": "member", "name": "_preCompressedUVsExpected", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133030,7 +133246,7 @@ } }, { - "__docId__": 6698, + "__docId__": 6706, "kind": "member", "name": "solid", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133049,7 +133265,7 @@ } }, { - "__docId__": 6699, + "__docId__": 6707, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133068,7 +133284,7 @@ } }, { - "__docId__": 6701, + "__docId__": 6709, "kind": "method", "name": "canCreatePortion", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133117,7 +133333,7 @@ } }, { - "__docId__": 6702, + "__docId__": 6710, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133316,7 +133532,7 @@ } }, { - "__docId__": 6704, + "__docId__": 6712, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133331,7 +133547,7 @@ "return": null }, { - "__docId__": 6707, + "__docId__": 6715, "kind": "method", "name": "isEmpty", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133351,7 +133567,7 @@ } }, { - "__docId__": 6708, + "__docId__": 6716, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133386,7 +133602,7 @@ "return": null }, { - "__docId__": 6709, + "__docId__": 6717, "kind": "method", "name": "flushInitFlags", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133402,7 +133618,7 @@ "return": null }, { - "__docId__": 6710, + "__docId__": 6718, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133437,7 +133653,7 @@ "return": null }, { - "__docId__": 6711, + "__docId__": 6719, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133472,7 +133688,7 @@ "return": null }, { - "__docId__": 6712, + "__docId__": 6720, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133507,7 +133723,7 @@ "return": null }, { - "__docId__": 6713, + "__docId__": 6721, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133542,7 +133758,7 @@ "return": null }, { - "__docId__": 6714, + "__docId__": 6722, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133577,7 +133793,7 @@ "return": null }, { - "__docId__": 6715, + "__docId__": 6723, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133606,7 +133822,7 @@ "return": null }, { - "__docId__": 6716, + "__docId__": 6724, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133641,7 +133857,7 @@ "return": null }, { - "__docId__": 6717, + "__docId__": 6725, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133670,7 +133886,7 @@ "return": null }, { - "__docId__": 6718, + "__docId__": 6726, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133705,7 +133921,7 @@ "return": null }, { - "__docId__": 6719, + "__docId__": 6727, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133734,7 +133950,7 @@ "return": null }, { - "__docId__": 6720, + "__docId__": 6728, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133769,7 +133985,7 @@ "return": null }, { - "__docId__": 6721, + "__docId__": 6729, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133813,7 +134029,7 @@ "return": null }, { - "__docId__": 6722, + "__docId__": 6730, "kind": "member", "name": "_deferredFlagValues", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133831,7 +134047,7 @@ } }, { - "__docId__": 6723, + "__docId__": 6731, "kind": "method", "name": "_setDeferredFlags", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133848,7 +134064,7 @@ "return": null }, { - "__docId__": 6725, + "__docId__": 6733, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133877,7 +134093,7 @@ "return": null }, { - "__docId__": 6726, + "__docId__": 6734, "kind": "method", "name": "getEachVertex", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133906,7 +134122,7 @@ "return": null }, { - "__docId__": 6727, + "__docId__": 6735, "kind": "method", "name": "getElementsCountAndOffset", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133933,7 +134149,7 @@ } }, { - "__docId__": 6728, + "__docId__": 6736, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133962,7 +134178,7 @@ "return": null }, { - "__docId__": 6729, + "__docId__": 6737, "kind": "method", "name": "_updateBackfaceCull", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -133992,7 +134208,7 @@ "return": null }, { - "__docId__": 6730, + "__docId__": 6738, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134021,7 +134237,7 @@ "return": null }, { - "__docId__": 6731, + "__docId__": 6739, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134050,7 +134266,7 @@ "return": null }, { - "__docId__": 6732, + "__docId__": 6740, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134079,7 +134295,7 @@ "return": null }, { - "__docId__": 6733, + "__docId__": 6741, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134108,7 +134324,7 @@ "return": null }, { - "__docId__": 6734, + "__docId__": 6742, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134137,7 +134353,7 @@ "return": null }, { - "__docId__": 6735, + "__docId__": 6743, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134166,7 +134382,7 @@ "return": null }, { - "__docId__": 6736, + "__docId__": 6744, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134195,7 +134411,7 @@ "return": null }, { - "__docId__": 6737, + "__docId__": 6745, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134224,7 +134440,7 @@ "return": null }, { - "__docId__": 6738, + "__docId__": 6746, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134253,7 +134469,7 @@ "return": null }, { - "__docId__": 6739, + "__docId__": 6747, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134282,7 +134498,7 @@ "return": null }, { - "__docId__": 6740, + "__docId__": 6748, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134311,7 +134527,7 @@ "return": null }, { - "__docId__": 6741, + "__docId__": 6749, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134340,7 +134556,7 @@ "return": null }, { - "__docId__": 6742, + "__docId__": 6750, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134369,7 +134585,7 @@ "return": null }, { - "__docId__": 6743, + "__docId__": 6751, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134398,7 +134614,7 @@ "return": null }, { - "__docId__": 6744, + "__docId__": 6752, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134427,7 +134643,7 @@ "return": null }, { - "__docId__": 6745, + "__docId__": 6753, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134456,7 +134672,7 @@ "return": null }, { - "__docId__": 6746, + "__docId__": 6754, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134485,7 +134701,7 @@ "return": null }, { - "__docId__": 6747, + "__docId__": 6755, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134514,7 +134730,7 @@ "return": null }, { - "__docId__": 6748, + "__docId__": 6756, "kind": "method", "name": "precisionRayPickSurface", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134565,7 +134781,7 @@ } }, { - "__docId__": 6749, + "__docId__": 6757, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js~VBOBatchingTrianglesLayer", @@ -134581,18 +134797,18 @@ "return": null }, { - "__docId__": 6750, + "__docId__": 6758, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js", "content": "import {EdgesRenderer} from \"./EdgesRenderer.js\";\n\n/**\n * @private\n */\nexport class EdgesColorRenderer extends EdgesRenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n super.drawLayer(frameCtx, batchingLayer, renderPass, { colorUniform: false });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry edges drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n src.push(\"void main(void) {\");\n\n // edgeFlag = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT\n\n src.push(`int edgeFlag = int(flags) >> 8 & 0xF;`);\n src.push(`if (edgeFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n //src.push(\"vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);\");\n src.push(\"vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry edges drawing fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6751, + "__docId__": 6759, "kind": "class", "name": "EdgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js", @@ -134611,7 +134827,7 @@ "ignore": true }, { - "__docId__": 6752, + "__docId__": 6760, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -134646,7 +134862,7 @@ "return": null }, { - "__docId__": 6753, + "__docId__": 6761, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -134667,7 +134883,7 @@ } }, { - "__docId__": 6754, + "__docId__": 6762, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -134688,18 +134904,18 @@ } }, { - "__docId__": 6755, + "__docId__": 6763, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\nimport {EdgesRenderer} from \"./EdgesRenderer.js\";\n\n\n/**\n * @private\n */\nexport class EdgesEmphasisRenderer extends EdgesRenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n super.drawLayer(frameCtx, batchingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n\n src.push(\"#version 300 es\");\n src.push(\"// EdgesEmphasisRenderer vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"uniform vec4 color;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // edgeFlag = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_COLOR_OPAQUE | EDGES_COLOR_TRANSPARENT | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n\n src.push(`int edgeFlag = int(flags) >> 8 & 0xF;`);\n src.push(`if (edgeFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vColor = vec4(color.r, color.g, color.b, color.a);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EdgesEmphasisRenderer fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6756, + "__docId__": 6764, "kind": "class", "name": "EdgesEmphasisRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js", @@ -134718,7 +134934,7 @@ "ignore": true }, { - "__docId__": 6757, + "__docId__": 6765, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -134753,7 +134969,7 @@ "return": null }, { - "__docId__": 6758, + "__docId__": 6766, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -134774,7 +134990,7 @@ } }, { - "__docId__": 6759, + "__docId__": 6767, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -134795,18 +135011,18 @@ } }, { - "__docId__": 6760, + "__docId__": 6768, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class EdgesRenderer extends TrianglesBatchingRenderer {\n constructor(scene) {\n super(scene, false, {instancing: false, edges: true});\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6761, + "__docId__": 6769, "kind": "class", "name": "EdgesRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js", @@ -134825,7 +135041,7 @@ "ignore": true }, { - "__docId__": 6762, + "__docId__": 6770, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js~EdgesRenderer", @@ -134839,18 +135055,18 @@ "undocument": true }, { - "__docId__": 6763, + "__docId__": 6771, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", "content": "import {TrianglesColorRenderer} from \"./TrianglesColorRenderer.js\";\nimport {TrianglesFlatColorRenderer} from \"./TrianglesFlatColorRenderer.js\";\nimport {TrianglesSilhouetteRenderer} from \"./TrianglesSilhouetteRenderer.js\";\nimport {EdgesEmphasisRenderer} from \"./EdgesEmphasisRenderer.js\";\nimport {EdgesColorRenderer} from \"./EdgesColorRenderer.js\";\nimport {TrianglesPickMeshRenderer} from \"./TrianglesPickMeshRenderer.js\";\nimport {TrianglesPickDepthRenderer} from \"./TrianglesPickDepthRenderer.js\";\nimport {TrianglesPickNormalsRenderer} from \"./TrianglesPickNormalsRenderer.js\";\nimport {TrianglesOcclusionRenderer} from \"./TrianglesOcclusionRenderer.js\";\nimport {TrianglesDepthRenderer} from \"./TrianglesDepthRenderer.js\";\nimport {TrianglesNormalsRenderer} from \"./TrianglesNormalsRenderer.js\";\nimport {TrianglesShadowRenderer} from \"./TrianglesShadowRenderer.js\";\nimport {TrianglesPBRRenderer} from \"./TrianglesPBRRenderer.js\";\nimport {TrianglesPickNormalsFlatRenderer} from \"./TrianglesPickNormalsFlatRenderer.js\";\nimport {TrianglesColorTextureRenderer} from \"./TrianglesColorTextureRenderer.js\";\nimport {TrianglesSnapInitRenderer} from \"./TrianglesSnapInitRenderer.js\";\nimport {TrianglesSnapRenderer} from \"./TrianglesSnapRenderer.js\";\n\n/**\n * @private\n */\nclass Renderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._colorRendererWithSAO && (!this._colorRendererWithSAO.getValid())) {\n this._colorRendererWithSAO.destroy();\n this._colorRendererWithSAO = null;\n }\n if (this._flatColorRenderer && (!this._flatColorRenderer.getValid())) {\n this._flatColorRenderer.destroy();\n this._flatColorRenderer = null;\n }\n if (this._flatColorRendererWithSAO && (!this._flatColorRendererWithSAO.getValid())) {\n this._flatColorRendererWithSAO.destroy();\n this._flatColorRendererWithSAO = null;\n }\n if (this._colorTextureRenderer && (!this._colorTextureRenderer.getValid())) {\n this._colorTextureRenderer.destroy();\n this._colorTextureRenderer = null;\n }\n if (this._colorTextureRendererWithSAO && (!this._colorTextureRendererWithSAO.getValid())) {\n this._colorTextureRendererWithSAO.destroy();\n this._colorTextureRendererWithSAO = null;\n }\n if (this._pbrRenderer && (!this._pbrRenderer.getValid())) {\n this._pbrRenderer.destroy();\n this._pbrRenderer = null;\n }\n if (this._pbrRendererWithSAO && (!this._pbrRendererWithSAO.getValid())) {\n this._pbrRendererWithSAO.destroy();\n this._pbrRendererWithSAO = null;\n }\n if (this._depthRenderer && (!this._depthRenderer.getValid())) {\n this._depthRenderer.destroy();\n this._depthRenderer = null;\n }\n if (this._normalsRenderer && (!this._normalsRenderer.getValid())) {\n this._normalsRenderer.destroy();\n this._normalsRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._edgesRenderer && (!this._edgesRenderer.getValid())) {\n this._edgesRenderer.destroy();\n this._edgesRenderer = null;\n }\n if (this._edgesColorRenderer && (!this._edgesColorRenderer.getValid())) {\n this._edgesColorRenderer.destroy();\n this._edgesColorRenderer = null;\n }\n if (this._pickMeshRenderer && (!this._pickMeshRenderer.getValid())) {\n this._pickMeshRenderer.destroy();\n this._pickMeshRenderer = null;\n }\n if (this._pickDepthRenderer && (!this._pickDepthRenderer.getValid())) {\n this._pickDepthRenderer.destroy();\n this._pickDepthRenderer = null;\n }\n if (this._pickNormalsRenderer && this._pickNormalsRenderer.getValid() === false) {\n this._pickNormalsRenderer.destroy();\n this._pickNormalsRenderer = null;\n }\n if (this._pickNormalsFlatRenderer && this._pickNormalsFlatRenderer.getValid() === false) {\n this._pickNormalsFlatRenderer.destroy();\n this._pickNormalsFlatRenderer = null;\n }\n if (this._occlusionRenderer && this._occlusionRenderer.getValid() === false) {\n this._occlusionRenderer.destroy();\n this._occlusionRenderer = null;\n }\n if (this._shadowRenderer && (!this._shadowRenderer.getValid())) {\n this._shadowRenderer.destroy();\n this._shadowRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n eagerCreateRenders() {\n\n // Pre-initialize certain renderers that would otherwise be lazy-initialised\n // on user interaction, such as picking or emphasis, so that there is no delay\n // when user first begins interacting with the viewer.\n\n if (!this._silhouetteRenderer) { // Used for highlighting and selection\n this._silhouetteRenderer = new TrianglesSilhouetteRenderer(this._scene);\n }\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new TrianglesPickMeshRenderer(this._scene);\n }\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new TrianglesPickDepthRenderer(this._scene);\n }\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new TrianglesSnapInitRenderer(this._scene, false);\n }\n if (!this._snapRenderer) {\n this._snapRenderer = new TrianglesSnapRenderer(this._scene);\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new TrianglesColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n\n get colorRendererWithSAO() {\n if (!this._colorRendererWithSAO) {\n this._colorRendererWithSAO = new TrianglesColorRenderer(this._scene, true);\n }\n return this._colorRendererWithSAO;\n }\n\n get flatColorRenderer() {\n if (!this._flatColorRenderer) {\n this._flatColorRenderer = new TrianglesFlatColorRenderer(this._scene, false);\n }\n return this._flatColorRenderer;\n }\n\n get flatColorRendererWithSAO() {\n if (!this._flatColorRendererWithSAO) {\n this._flatColorRendererWithSAO = new TrianglesFlatColorRenderer(this._scene, true);\n }\n return this._flatColorRendererWithSAO;\n }\n\n get colorTextureRenderer() {\n if (!this._colorTextureRenderer) {\n this._colorTextureRenderer = new TrianglesColorTextureRenderer(this._scene, false);\n }\n return this._colorTextureRenderer;\n }\n\n get colorTextureRendererWithSAO() {\n if (!this._colorTextureRendererWithSAO) {\n this._colorTextureRendererWithSAO = new TrianglesColorTextureRenderer(this._scene, true);\n }\n return this._colorTextureRendererWithSAO;\n }\n\n get pbrRenderer() {\n if (!this._pbrRenderer) {\n this._pbrRenderer = new TrianglesPBRRenderer(this._scene, false);\n }\n return this._pbrRenderer;\n }\n\n get pbrRendererWithSAO() {\n if (!this._pbrRendererWithSAO) {\n this._pbrRendererWithSAO = new TrianglesPBRRenderer(this._scene, true);\n }\n return this._pbrRendererWithSAO;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new TrianglesSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get depthRenderer() {\n if (!this._depthRenderer) {\n this._depthRenderer = new TrianglesDepthRenderer(this._scene);\n }\n return this._depthRenderer;\n }\n\n get normalsRenderer() {\n if (!this._normalsRenderer) {\n this._normalsRenderer = new TrianglesNormalsRenderer(this._scene);\n }\n return this._normalsRenderer;\n }\n\n get edgesRenderer() {\n if (!this._edgesRenderer) {\n this._edgesRenderer = new EdgesEmphasisRenderer(this._scene);\n }\n return this._edgesRenderer;\n }\n\n get edgesColorRenderer() {\n if (!this._edgesColorRenderer) {\n this._edgesColorRenderer = new EdgesColorRenderer(this._scene);\n }\n return this._edgesColorRenderer;\n }\n\n get pickMeshRenderer() {\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new TrianglesPickMeshRenderer(this._scene);\n }\n return this._pickMeshRenderer;\n }\n\n get pickNormalsRenderer() {\n if (!this._pickNormalsRenderer) {\n this._pickNormalsRenderer = new TrianglesPickNormalsRenderer(this._scene);\n }\n return this._pickNormalsRenderer;\n }\n\n get pickNormalsFlatRenderer() {\n if (!this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer = new TrianglesPickNormalsFlatRenderer(this._scene);\n }\n return this._pickNormalsFlatRenderer;\n }\n\n get pickDepthRenderer() {\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new TrianglesPickDepthRenderer(this._scene);\n }\n return this._pickDepthRenderer;\n }\n\n get occlusionRenderer() {\n if (!this._occlusionRenderer) {\n this._occlusionRenderer = new TrianglesOcclusionRenderer(this._scene);\n }\n return this._occlusionRenderer;\n }\n\n get shadowRenderer() {\n if (!this._shadowRenderer) {\n this._shadowRenderer = new TrianglesShadowRenderer(this._scene);\n }\n return this._shadowRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new TrianglesSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new TrianglesSnapInitRenderer(this._scene);\n }\n return this._snapInitRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._colorRendererWithSAO) {\n this._colorRendererWithSAO.destroy();\n }\n if (this._flatColorRenderer) {\n this._flatColorRenderer.destroy();\n }\n if (this._flatColorRendererWithSAO) {\n this._flatColorRendererWithSAO.destroy();\n }\n if (this._colorTextureRenderer) {\n this._colorTextureRenderer.destroy();\n }\n if (this._colorTextureRendererWithSAO) {\n this._colorTextureRendererWithSAO.destroy();\n }\n if (this._pbrRenderer) {\n this._pbrRenderer.destroy();\n }\n if (this._pbrRendererWithSAO) {\n this._pbrRendererWithSAO.destroy();\n }\n if (this._depthRenderer) {\n this._depthRenderer.destroy();\n }\n if (this._normalsRenderer) {\n this._normalsRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._edgesRenderer) {\n this._edgesRenderer.destroy();\n }\n if (this._edgesColorRenderer) {\n this._edgesColorRenderer.destroy();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.destroy();\n }\n if (this._pickDepthRenderer) {\n this._pickDepthRenderer.destroy();\n }\n if (this._pickNormalsRenderer) {\n this._pickNormalsRenderer.destroy();\n }\n if (this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer.destroy();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.destroy();\n }\n if (this._shadowRenderer) {\n this._shadowRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachdRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let batchingRenderers = cachdRenderers[sceneId];\n if (!batchingRenderers) {\n batchingRenderers = new Renderers(scene);\n cachdRenderers[sceneId] = batchingRenderers;\n batchingRenderers._compile();\n batchingRenderers.eagerCreateRenders();\n scene.on(\"compile\", () => {\n batchingRenderers._compile();\n batchingRenderers.eagerCreateRenders();\n });\n scene.on(\"destroyed\", () => {\n delete cachdRenderers[sceneId];\n batchingRenderers._destroy();\n });\n }\n return batchingRenderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6764, + "__docId__": 6772, "kind": "class", "name": "Renderers", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", @@ -134866,7 +135082,7 @@ "ignore": true }, { - "__docId__": 6765, + "__docId__": 6773, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134880,7 +135096,7 @@ "undocument": true }, { - "__docId__": 6766, + "__docId__": 6774, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134898,7 +135114,7 @@ } }, { - "__docId__": 6767, + "__docId__": 6775, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134915,7 +135131,7 @@ "return": null }, { - "__docId__": 6768, + "__docId__": 6776, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134933,7 +135149,7 @@ } }, { - "__docId__": 6769, + "__docId__": 6777, "kind": "member", "name": "_colorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134951,7 +135167,7 @@ } }, { - "__docId__": 6770, + "__docId__": 6778, "kind": "member", "name": "_flatColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134969,7 +135185,7 @@ } }, { - "__docId__": 6771, + "__docId__": 6779, "kind": "member", "name": "_flatColorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -134987,7 +135203,7 @@ } }, { - "__docId__": 6772, + "__docId__": 6780, "kind": "member", "name": "_colorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135005,7 +135221,7 @@ } }, { - "__docId__": 6773, + "__docId__": 6781, "kind": "member", "name": "_colorTextureRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135023,7 +135239,7 @@ } }, { - "__docId__": 6774, + "__docId__": 6782, "kind": "member", "name": "_pbrRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135041,7 +135257,7 @@ } }, { - "__docId__": 6775, + "__docId__": 6783, "kind": "member", "name": "_pbrRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135059,7 +135275,7 @@ } }, { - "__docId__": 6776, + "__docId__": 6784, "kind": "member", "name": "_depthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135077,7 +135293,7 @@ } }, { - "__docId__": 6777, + "__docId__": 6785, "kind": "member", "name": "_normalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135095,7 +135311,7 @@ } }, { - "__docId__": 6778, + "__docId__": 6786, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135113,7 +135329,7 @@ } }, { - "__docId__": 6779, + "__docId__": 6787, "kind": "member", "name": "_edgesRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135131,7 +135347,7 @@ } }, { - "__docId__": 6780, + "__docId__": 6788, "kind": "member", "name": "_edgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135149,7 +135365,7 @@ } }, { - "__docId__": 6781, + "__docId__": 6789, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135167,7 +135383,7 @@ } }, { - "__docId__": 6782, + "__docId__": 6790, "kind": "member", "name": "_pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135185,7 +135401,7 @@ } }, { - "__docId__": 6783, + "__docId__": 6791, "kind": "member", "name": "_pickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135203,7 +135419,7 @@ } }, { - "__docId__": 6784, + "__docId__": 6792, "kind": "member", "name": "_pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135221,7 +135437,7 @@ } }, { - "__docId__": 6785, + "__docId__": 6793, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135239,7 +135455,7 @@ } }, { - "__docId__": 6786, + "__docId__": 6794, "kind": "member", "name": "_shadowRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135257,7 +135473,7 @@ } }, { - "__docId__": 6787, + "__docId__": 6795, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135275,7 +135491,7 @@ } }, { - "__docId__": 6788, + "__docId__": 6796, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135293,7 +135509,7 @@ } }, { - "__docId__": 6789, + "__docId__": 6797, "kind": "method", "name": "eagerCreateRenders", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135309,7 +135525,7 @@ "return": null }, { - "__docId__": 6795, + "__docId__": 6803, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135328,7 +135544,7 @@ } }, { - "__docId__": 6797, + "__docId__": 6805, "kind": "get", "name": "colorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135347,7 +135563,7 @@ } }, { - "__docId__": 6799, + "__docId__": 6807, "kind": "get", "name": "flatColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135366,7 +135582,7 @@ } }, { - "__docId__": 6801, + "__docId__": 6809, "kind": "get", "name": "flatColorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135385,7 +135601,7 @@ } }, { - "__docId__": 6803, + "__docId__": 6811, "kind": "get", "name": "colorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135404,7 +135620,7 @@ } }, { - "__docId__": 6805, + "__docId__": 6813, "kind": "get", "name": "colorTextureRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135423,7 +135639,7 @@ } }, { - "__docId__": 6807, + "__docId__": 6815, "kind": "get", "name": "pbrRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135442,7 +135658,7 @@ } }, { - "__docId__": 6809, + "__docId__": 6817, "kind": "get", "name": "pbrRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135461,7 +135677,7 @@ } }, { - "__docId__": 6811, + "__docId__": 6819, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135480,7 +135696,7 @@ } }, { - "__docId__": 6813, + "__docId__": 6821, "kind": "get", "name": "depthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135499,7 +135715,7 @@ } }, { - "__docId__": 6815, + "__docId__": 6823, "kind": "get", "name": "normalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135518,7 +135734,7 @@ } }, { - "__docId__": 6817, + "__docId__": 6825, "kind": "get", "name": "edgesRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135537,7 +135753,7 @@ } }, { - "__docId__": 6819, + "__docId__": 6827, "kind": "get", "name": "edgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135556,7 +135772,7 @@ } }, { - "__docId__": 6821, + "__docId__": 6829, "kind": "get", "name": "pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135575,7 +135791,7 @@ } }, { - "__docId__": 6823, + "__docId__": 6831, "kind": "get", "name": "pickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135594,7 +135810,7 @@ } }, { - "__docId__": 6825, + "__docId__": 6833, "kind": "get", "name": "pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135613,7 +135829,7 @@ } }, { - "__docId__": 6827, + "__docId__": 6835, "kind": "get", "name": "pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135632,7 +135848,7 @@ } }, { - "__docId__": 6829, + "__docId__": 6837, "kind": "get", "name": "occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135651,7 +135867,7 @@ } }, { - "__docId__": 6831, + "__docId__": 6839, "kind": "get", "name": "shadowRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135670,7 +135886,7 @@ } }, { - "__docId__": 6833, + "__docId__": 6841, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135689,7 +135905,7 @@ } }, { - "__docId__": 6835, + "__docId__": 6843, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135708,7 +135924,7 @@ } }, { - "__docId__": 6837, + "__docId__": 6845, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js~Renderers", @@ -135725,7 +135941,7 @@ "return": null }, { - "__docId__": 6838, + "__docId__": 6846, "kind": "variable", "name": "cachdRenderers", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", @@ -135746,7 +135962,7 @@ "ignore": true }, { - "__docId__": 6839, + "__docId__": 6847, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js", @@ -135776,18 +135992,18 @@ } }, { - "__docId__": 6840, + "__docId__": 6848, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js", "content": "import {VBORenderer} from \"./../../../VBORenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesBatchingRenderer extends VBORenderer {\n\n constructor(scene, withSAO, {edges = false} = {}) {\n super(scene, withSAO, {instancing: false, edges});\n }\n\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState\n } = drawCfg;\n\n if (this._edges) {\n gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);\n } else {\n const count = frameCtx.pickElementsCount || state.indicesBuf.numItems;\n const offset = frameCtx.pickElementsOffset ? frameCtx.pickElementsOffset * state.indicesBuf.itemByteSize : 0;\n\n gl.drawElements(gl.TRIANGLES, count, state.indicesBuf.itemType, offset);\n\n if (incrementDrawState) {\n frameCtx.drawElements++;\n }\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6841, + "__docId__": 6849, "kind": "class", "name": "TrianglesBatchingRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js", @@ -135806,7 +136022,7 @@ "ignore": true }, { - "__docId__": 6842, + "__docId__": 6850, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js~TrianglesBatchingRenderer", @@ -135820,7 +136036,7 @@ "undocument": true }, { - "__docId__": 6843, + "__docId__": 6851, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js~TrianglesBatchingRenderer", @@ -135844,18 +136060,18 @@ "return": null }, { - "__docId__": 6844, + "__docId__": 6852, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesColorRenderer extends TrianglesBatchingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n let light;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching draw vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec3 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src, true);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); \");\n\n src.push(\"vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);\");\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));\");\n src.push(\"vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching draw fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(newColor.rgb * ambient, 1.0);\");\n } else {\n src.push(\" outColor = newColor;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6845, + "__docId__": 6853, "kind": "class", "name": "TrianglesColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js", @@ -135874,7 +136090,7 @@ "ignore": true }, { - "__docId__": 6846, + "__docId__": 6854, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -135895,7 +136111,7 @@ } }, { - "__docId__": 6847, + "__docId__": 6855, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -135930,7 +136146,7 @@ "return": null }, { - "__docId__": 6848, + "__docId__": 6856, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -135951,7 +136167,7 @@ } }, { - "__docId__": 6849, + "__docId__": 6857, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -135972,18 +136188,18 @@ } }, { - "__docId__": 6850, + "__docId__": 6858, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n\n/**\n * @private\n */\nexport class TrianglesColorTextureRenderer extends TrianglesBatchingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, {incrementDrawState: true});\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching color texture vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in vec2 uv;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform mat3 uvDecodeMatrix;\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec4 vColor;\");\n src.push(\"out vec2 vUV;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n src.push(\"vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n const lightsState = scene._lightsState;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching color texture fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform sampler2D uColorMap;\");\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToLinear( in vec4 value ) {\");\n src.push(\" return value;\");\n src.push(\"}\");\n src.push(\"vec4 sRGBToLinear( in vec4 value ) {\");\n src.push(\" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\");\n src.push(\"}\");\n src.push(\"vec4 gammaToLinear( in vec4 value) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\");\n src.push(\"}\");\n if (gammaOutput) {\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n this._addMatricesUniformBlockLines(src);\n src.push(\"uniform vec4 lightAmbient;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"in vec2 vUV;\");\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n\n src.push(\"vec3 xTangent = dFdx( vViewPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vViewPosition.xyz );\");\n src.push(\"vec3 viewNormal = normalize( cross( xTangent, yTangent ) );\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);\");\n if (gammaOutput) {\n src.push(\"vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));\");\n } else {\n src.push(\"vec4 colorTexel = color * texture(uColorMap, vUV);\");\n }\n src.push(\"float opacity = color.a;\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n\n src.push(\" outColor = vec4(colorTexel.rgb * ambient, opacity);\");\n } else {\n src.push(\" outColor = vec4(colorTexel.rgb, opacity);\");\n }\n\n if (gammaOutput) {\n src.push(\"outColor = linearToGamma(outColor, gammaFactor);\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6851, + "__docId__": 6859, "kind": "class", "name": "TrianglesColorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js", @@ -136002,7 +136218,7 @@ "ignore": true }, { - "__docId__": 6852, + "__docId__": 6860, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -136023,7 +136239,7 @@ } }, { - "__docId__": 6853, + "__docId__": 6861, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -136058,7 +136274,7 @@ "return": null }, { - "__docId__": 6854, + "__docId__": 6862, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -136079,7 +136295,7 @@ } }, { - "__docId__": 6855, + "__docId__": 6863, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -136100,18 +136316,18 @@ } }, { - "__docId__": 6856, + "__docId__": 6864, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n\n/**\n * @private\n */\nexport class TrianglesDepthRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching depth vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec2 vHighPrecisionZW;\");\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vHighPrecisionZW = gl_Position.zw;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching depth fragment shader\");\n\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"const float packUpScale = 256. / 255.;\");\n src.push(\"const float unpackDownscale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );\");\n src.push(\"const float shiftRight8 = 1.0 / 256.;\");\n\n src.push(\"vec4 packDepthToRGBA( const in float v ) {\");\n src.push(\" vec4 r = vec4( fract( v * packFactors ), v );\");\n src.push(\" r.yzw -= r.xyz * shiftRight8;\");\n src.push(\" return r * packUpScale;\");\n src.push(\"}\");\n src.push(\"in vec2 vHighPrecisionZW;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\");\n src.push(\" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6857, + "__docId__": 6865, "kind": "class", "name": "TrianglesDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js", @@ -136130,7 +136346,7 @@ "ignore": true }, { - "__docId__": 6858, + "__docId__": 6866, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js~TrianglesDepthRenderer", @@ -136151,7 +136367,7 @@ } }, { - "__docId__": 6859, + "__docId__": 6867, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js~TrianglesDepthRenderer", @@ -136172,18 +136388,18 @@ } }, { - "__docId__": 6860, + "__docId__": 6868, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesFlatColorRenderer extends TrianglesBatchingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching flat-shading draw vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const lightsState = scene._lightsState;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching flat-shading draw fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 lightAmbient;\");\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n\n src.push(\"vec3 xTangent = dFdx( vViewPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vViewPosition.xyz );\");\n src.push(\"vec3 viewNormal = normalize( cross( xTangent, yTangent ) );\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(fragColor.rgb * ambient, 1.0);\");\n } else {\n src.push(\" outColor = fragColor;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6861, + "__docId__": 6869, "kind": "class", "name": "TrianglesFlatColorRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js", @@ -136202,7 +136418,7 @@ "ignore": true }, { - "__docId__": 6862, + "__docId__": 6870, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -136223,7 +136439,7 @@ } }, { - "__docId__": 6863, + "__docId__": 6871, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -136244,7 +136460,7 @@ } }, { - "__docId__": 6864, + "__docId__": 6872, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -136265,18 +136481,18 @@ } }, { - "__docId__": 6865, + "__docId__": 6873, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n\n/**\n * @private\n */\n\n\nexport class TrianglesNormalsRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry normals vertex shader\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec3 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src, true);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec3 vViewNormal;\");\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); \");\n src.push(\" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\" vViewNormal = viewNormal;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry normals fragment shader\");\n\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6866, + "__docId__": 6874, "kind": "class", "name": "TrianglesNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js", @@ -136295,7 +136511,7 @@ "ignore": true }, { - "__docId__": 6867, + "__docId__": 6875, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js~TrianglesNormalsRenderer", @@ -136316,7 +136532,7 @@ } }, { - "__docId__": 6868, + "__docId__": 6876, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js~TrianglesNormalsRenderer", @@ -136337,18 +136553,18 @@ } }, { - "__docId__": 6869, + "__docId__": 6877, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n// Logarithmic depth buffer involves an accuracy tradeoff, sacrificing\n// accuracy at close range to improve accuracy at long range. This can\n// mess up accuracy for occlusion tests, so we'll disable for now.\n\nconst ENABLE_LOG_DEPTH_BUF = false;\n\n/**\n * @private\n */\nexport class TrianglesOcclusionRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching occlusion vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n // Only opaque objects can be occluders\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching occlusion fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6870, + "__docId__": 6878, "kind": "variable", "name": "ENABLE_LOG_DEPTH_BUF", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js", @@ -136369,7 +136585,7 @@ "ignore": true }, { - "__docId__": 6871, + "__docId__": 6879, "kind": "class", "name": "TrianglesOcclusionRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js", @@ -136388,7 +136604,7 @@ "ignore": true }, { - "__docId__": 6872, + "__docId__": 6880, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js~TrianglesOcclusionRenderer", @@ -136409,7 +136625,7 @@ } }, { - "__docId__": 6873, + "__docId__": 6881, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js~TrianglesOcclusionRenderer", @@ -136430,18 +136646,18 @@ } }, { - "__docId__": 6874, + "__docId__": 6882, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n// const TEXTURE_DECODE_FUNCS = {};\n// TEXTURE_DECODE_FUNCS[LinearEncoding] = \"linearToLinear\";\n// TEXTURE_DECODE_FUNCS[sRGBEncoding] = \"sRGBToLinear\";\n\n/**\n * @private\n */\nexport class TrianglesPBRRenderer extends TrianglesBatchingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const clippingCaps = sectionPlanesState.clippingCaps;\n\n const src = [];\n\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching quality draw vertex shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec3 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in vec2 uv;\");\n src.push(\"in vec2 metallicRoughness;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n this._addMatricesUniformBlockLines(src, true);\n\n src.push(\"uniform mat3 uvDecodeMatrix;\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec3 vViewNormal;\");\n src.push(\"out vec4 vColor;\");\n src.push(\"out vec2 vUV;\");\n src.push(\"out vec2 vMetallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"out vec3 vWorldNormal;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n if (clippingCaps) {\n src.push(\"out vec4 vClipPosition;\");\n }\n }\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); \");\n src.push(\"vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n if (clippingCaps) {\n src.push(\"vClipPosition = clipPos;\");\n }\n }\n\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vViewNormal = viewNormal;\");\n src.push(\"vColor = color;\");\n src.push(\"vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;\");\n src.push(\"vMetallicRoughness = metallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"vWorldNormal = worldNormal.xyz;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const clippingCaps = sectionPlanesState.clippingCaps;\n const src = [];\n\n src.push('#version 300 es');\n src.push(\"// Triangles batching quality draw fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform sampler2D uColorMap;\");\n src.push(\"uniform sampler2D uMetallicRoughMap;\");\n src.push(\"uniform sampler2D uEmissiveMap;\");\n src.push(\"uniform sampler2D uNormalMap;\");\n src.push(\"uniform sampler2D uAOMap;\");\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"in vec2 vUV;\");\n src.push(\"in vec2 vMetallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"in vec3 vWorldNormal;\");\n }\n\n this._addMatricesUniformBlockLines(src, true);\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"uniform samplerCube reflectionMap;\");\n }\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"uniform samplerCube lightMap;\");\n }\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToLinear( in vec4 value ) {\");\n src.push(\" return value;\");\n src.push(\"}\");\n src.push(\"vec4 sRGBToLinear( in vec4 value ) {\");\n src.push(\" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\");\n src.push(\"}\");\n src.push(\"vec4 gammaToLinear( in vec4 value) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\");\n src.push(\"}\");\n\n if (gammaOutput) {\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n if (clippingCaps) {\n src.push(\"in vec4 vClipPosition;\");\n }\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n // CONSTANT DEFINITIONS\n\n src.push(\"#define PI 3.14159265359\");\n src.push(\"#define RECIPROCAL_PI 0.31830988618\");\n src.push(\"#define RECIPROCAL_PI2 0.15915494\");\n src.push(\"#define EPSILON 1e-6\");\n\n src.push(\"#define saturate(a) clamp( a, 0.0, 1.0 )\");\n\n // UTILITY DEFINITIONS\n\n src.push(\"vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\");\n src.push(\" vec3 texel = texture( uNormalMap, uv ).xyz;\");\n src.push(\" if (texel.x == 0.0 && texel.y == 0.0 && texel.z == 0.0) {\");\n src.push(\" return surf_norm;\");\n src.push(\" }\");\n src.push(\" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\");\n src.push(\" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\");\n src.push(\" vec2 st0 = dFdx( uv.st );\");\n src.push(\" vec2 st1 = dFdy( uv.st );\");\n src.push(\" vec3 S = normalize( q0 * st1.t - q1 * st0.t );\");\n src.push(\" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\");\n src.push(\" vec3 N = normalize( surf_norm );\");\n src.push(\" vec3 mapN = texel.xyz * 2.0 - 1.0;\");\n src.push(\" mat3 tsn = mat3( S, T, N );\");\n //src.push(\" mapN *= 3.0;\");\n src.push(\" return normalize( tsn * mapN );\");\n src.push(\"}\");\n\n src.push(\"vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\");\n src.push(\" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\");\n src.push(\"}\");\n\n // STRUCTURES\n\n src.push(\"struct IncidentLight {\");\n src.push(\" vec3 color;\");\n src.push(\" vec3 direction;\");\n src.push(\"};\");\n\n src.push(\"struct ReflectedLight {\");\n src.push(\" vec3 diffuse;\");\n src.push(\" vec3 specular;\");\n src.push(\"};\");\n\n src.push(\"struct Geometry {\");\n src.push(\" vec3 position;\");\n src.push(\" vec3 viewNormal;\");\n src.push(\" vec3 worldNormal;\");\n src.push(\" vec3 viewEyeDir;\");\n src.push(\"};\");\n\n src.push(\"struct Material {\");\n src.push(\" vec3 diffuseColor;\");\n src.push(\" float specularRoughness;\");\n src.push(\" vec3 specularColor;\");\n src.push(\" float shine;\"); // Only used for Phong\n src.push(\"};\");\n\n // IRRADIANCE EVALUATION\n\n src.push(\"float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\");\n src.push(\" float r = ggxRoughness + 0.0001;\");\n src.push(\" return (2.0 / (r * r) - 2.0);\");\n src.push(\"}\");\n\n src.push(\"float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float maxMIPLevelScalar = float( maxMIPLevel );\");\n src.push(\" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );\");\n src.push(\" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\");\n src.push(\"}\");\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\"); //TODO: a random factor - fix this\n src.push(\" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;\");\n src.push(\" return envMapColor;\");\n src.push(\"}\");\n }\n\n // SPECULAR BRDF EVALUATION\n\n src.push(\"vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\");\n src.push(\" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\");\n src.push(\" return ( 1.0 - specularColor ) * fresnel + specularColor;\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" return 1.0 / ( gl * gv );\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" return 0.5 / max( gv + gl, EPSILON );\");\n src.push(\"}\");\n\n src.push(\"float D_GGX(const in float alpha, const in float dotNH) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;\");\n src.push(\" return RECIPROCAL_PI * a2 / ( denom * denom);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float alpha = ( roughness * roughness );\");\n src.push(\" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );\");\n src.push(\" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );\");\n src.push(\" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );\");\n src.push(\" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );\");\n src.push(\" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\");\n src.push(\" vec3 F = F_Schlick( specularColor, dotLH );\");\n src.push(\" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\");\n src.push(\" float D = D_GGX( alpha, dotNH );\");\n src.push(\" return F * (G * D);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));\");\n src.push(\" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);\");\n src.push(\" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);\");\n src.push(\" vec4 r = roughness * c0 + c1;\");\n src.push(\" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\");\n src.push(\" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\");\n src.push(\" return specularColor * AB.x + AB.y;\");\n src.push(\"}\");\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n src.push(\"void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n if (lightsState.lightMaps.length > 0) {\n src.push(\" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;\");\n src.push(\" irradiance *= PI;\");\n src.push(\" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;\");\n }\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);\");\n src.push(\" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);\");\n src.push(\" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);\");\n src.push(\" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);\");\n src.push(\" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\");\n src.push(\" reflectedLight.specular += radiance * specularBRDFContrib;\");\n }\n src.push(\"}\");\n }\n\n // MAIN LIGHTING COMPUTATION FUNCTION\n\n src.push(\"void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n src.push(\" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));\");\n src.push(\" vec3 irradiance = dotNL * incidentLight.color * PI;\");\n src.push(\" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);\");\n src.push(\"}\");\n\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n if (clippingCaps) {\n src.push(\" if (dist > (0.002 * vClipPosition.w)) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" outColor=vec4(1.0, 0.0, 0.0, 1.0);\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" return;\");\n src.push(\"}\");\n } else {\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n }\n src.push(\"}\");\n }\n\n src.push(\"IncidentLight light;\");\n src.push(\"Material material;\");\n src.push(\"Geometry geometry;\");\n src.push(\"ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));\");\n\n src.push(\"vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));\");\n src.push(\"float opacity = float(vColor.a) / 255.0;\");\n\n src.push(\"vec3 baseColor = rgb;\");\n src.push(\"float specularF0 = 1.0;\");\n src.push(\"float metallic = float(vMetallicRoughness.r) / 255.0;\");\n src.push(\"float roughness = float(vMetallicRoughness.g) / 255.0;\");\n src.push(\"float dielectricSpecular = 0.16 * specularF0 * specularF0;\");\n\n src.push(\"vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));\");\n src.push(\"baseColor *= colorTexel.rgb;\");\n // src.push(\"opacity *= colorTexel.a;\");\n\n src.push(\"vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;\");\n src.push(\"metallic *= metalRoughTexel.b;\");\n src.push(\"roughness *= metalRoughTexel.g;\");\n\n src.push(\"vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );\");\n\n src.push(\"material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);\");\n src.push(\"material.specularRoughness = clamp(roughness, 0.04, 1.0);\");\n src.push(\"material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);\");\n\n src.push(\"geometry.position = vViewPosition.xyz;\");\n src.push(\"geometry.viewNormal = -normalize(viewNormal);\");\n src.push(\"geometry.viewEyeDir = normalize(vViewPosition.xyz);\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"geometry.worldNormal = normalize(vWorldNormal);\");\n }\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n src.push(\"computePBRLightMapping(geometry, material, reflectedLight);\");\n }\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightPos\" + i + \" - vViewPosition.xyz);\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n\n src.push(\"light.color = lightColor\" + i + \".rgb * lightColor\" + i + \".a;\"); // a is intensity\n\n src.push(\"computePBRLighting(light, geometry, material, reflectedLight);\");\n }\n\n src.push(\"vec3 emissiveColor = sRGBToLinear(texture(uEmissiveMap, vUV)).rgb;\"); // TODO: correct gamma function\n src.push(\"float aoFactor = texture(uAOMap, vUV).r;\");\n\n src.push(\"vec3 outgoingLight = (lightAmbient.rgb * lightAmbient.a * baseColor * opacity * rgb) + (reflectedLight.diffuse) + (reflectedLight.specular) + emissiveColor;\");\n src.push(\"vec4 fragColor;\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" fragColor = vec4(outgoingLight.rgb * ambient * aoFactor, opacity);\");\n } else {\n src.push(\" fragColor = vec4(outgoingLight.rgb * aoFactor, opacity);\");\n }\n\n if (gammaOutput) {\n src.push(\"fragColor = linearToGamma(fragColor, gammaFactor);\");\n }\n\n src.push(\"outColor = fragColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6875, + "__docId__": 6883, "kind": "class", "name": "TrianglesPBRRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js", @@ -136460,7 +136676,7 @@ "ignore": true }, { - "__docId__": 6876, + "__docId__": 6884, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -136481,7 +136697,7 @@ } }, { - "__docId__": 6877, + "__docId__": 6885, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -136516,7 +136732,7 @@ "return": null }, { - "__docId__": 6878, + "__docId__": 6886, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -136537,7 +136753,7 @@ } }, { - "__docId__": 6879, + "__docId__": 6887, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -136558,18 +136774,18 @@ } }, { - "__docId__": 6880, + "__docId__": 6888, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesPickDepthRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick depth vertex shader\");\n\n \n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n this._addRemapClipPosLines(src);\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick depth fragment shader\");\n\n \n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform float pickZNear;\");\n src.push(\"uniform float pickZFar;\");\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"vec4 packDepth(const in float depth) {\");\n src.push(\" const vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\");\n src.push(\" vec4 res = fract(depth * bitShift);\");\n src.push(\" res -= res.xxyz * bitMask;\");\n src.push(\" return res;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));\");\n src.push(\" outColor = packDepth(zNormalizedDepth); \"); // Must be linear depth\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6881, + "__docId__": 6889, "kind": "class", "name": "TrianglesPickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js", @@ -136588,7 +136804,7 @@ "ignore": true }, { - "__docId__": 6882, + "__docId__": 6890, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js~TrianglesPickDepthRenderer", @@ -136609,7 +136825,7 @@ } }, { - "__docId__": 6883, + "__docId__": 6891, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js~TrianglesPickDepthRenderer", @@ -136630,18 +136846,18 @@ } }, { - "__docId__": 6884, + "__docId__": 6892, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesPickMeshRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry picking vertex shader\");\n \n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n src.push(\"in vec4 pickColor;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n this._addRemapClipPosLines(src);\n\n src.push(\"out vec4 vPickColor;\");\n\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry picking fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vPickColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vPickColor; \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6885, + "__docId__": 6893, "kind": "class", "name": "TrianglesPickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js", @@ -136660,7 +136876,7 @@ "ignore": true }, { - "__docId__": 6886, + "__docId__": 6894, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js~TrianglesPickMeshRenderer", @@ -136681,7 +136897,7 @@ } }, { - "__docId__": 6887, + "__docId__": 6895, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js~TrianglesPickMeshRenderer", @@ -136702,18 +136918,18 @@ } }, { - "__docId__": 6888, + "__docId__": 6896, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", "content": "import { math } from \"../../../../../math/math.js\";\nimport {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n\n/**\n * @private\n */\nexport class TrianglesPickNormalsFlatRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick flat normals vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src, 3);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick flat normals fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"in vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\" vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(` outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6889, + "__docId__": 6897, "kind": "class", "name": "TrianglesPickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", @@ -136732,7 +136948,7 @@ "ignore": true }, { - "__docId__": 6890, + "__docId__": 6898, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js~TrianglesPickNormalsFlatRenderer", @@ -136753,7 +136969,7 @@ } }, { - "__docId__": 6891, + "__docId__": 6899, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js~TrianglesPickNormalsFlatRenderer", @@ -136774,18 +136990,18 @@ } }, { - "__docId__": 6892, + "__docId__": 6900, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js", "content": "import { math } from \"../../../../../math/math.js\";\nimport {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n\n/**\n * @private\n */\nexport class TrianglesPickNormalsRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick normals vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec3 normal;\");\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src, 3);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec3 vWorldNormal;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vec3 worldNormal = octDecode(normal.xy); \");\n src.push(\" vWorldNormal = worldNormal;\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching pick normals fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vWorldNormal;\");\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(` outNormal = ivec4(vWorldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6893, + "__docId__": 6901, "kind": "class", "name": "TrianglesPickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js", @@ -136804,7 +137020,7 @@ "ignore": true }, { - "__docId__": 6894, + "__docId__": 6902, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js~TrianglesPickNormalsRenderer", @@ -136825,7 +137041,7 @@ } }, { - "__docId__": 6895, + "__docId__": 6903, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js~TrianglesPickNormalsRenderer", @@ -136846,18 +137062,18 @@ } }, { - "__docId__": 6896, + "__docId__": 6904, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * Renders BatchingLayer fragment depths to a shadow map.\n *\n * @private\n */\nexport class TrianglesShadowRenderer extends TrianglesBatchingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry shadow vertex shader\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"uniform mat4 shadowViewMatrix;\");\n src.push(\"uniform mat4 shadowProjMatrix;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(` int colorFlag = int(flags) & 0xF;`);\n src.push(\" bool visible = (colorFlag > 0);\");\n src.push(\" bool transparent = ((float(color.a) / 255.0) < 1.0);\");\n src.push(\" if (!visible || transparent) {\");\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = shadowViewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\" vViewPosition = viewPosition;\");\n src.push(\" gl_Position = shadowProjMatrix * viewPosition;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry shadow fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n\n src.push(\"vec4 encodeFloat( const in float v ) {\");\n src.push(\" const vec4 bitShift = vec4(256 * 256 * 256, 256 * 256, 256, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\");\n src.push(\" vec4 comp = fract(v * bitShift);\");\n src.push(\" comp -= comp.xxyz * bitMask;\");\n src.push(\" return comp;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n src.push(\" outColor = encodeFloat( gl_FragCoord.z); \");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6897, + "__docId__": 6905, "kind": "class", "name": "TrianglesShadowRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js", @@ -136876,7 +137092,7 @@ "ignore": true }, { - "__docId__": 6898, + "__docId__": 6906, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js~TrianglesShadowRenderer", @@ -136897,7 +137113,7 @@ } }, { - "__docId__": 6899, + "__docId__": 6907, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js~TrianglesShadowRenderer", @@ -136918,18 +137134,18 @@ } }, { - "__docId__": 6900, + "__docId__": 6908, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js", "content": "import {TrianglesBatchingRenderer} from \"./TrianglesBatchingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesSilhouetteRenderer extends TrianglesBatchingRenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n super.drawLayer(frameCtx, batchingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching silhouette vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 color;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 silhouetteColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, color.a ));\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Triangles batching silhouette fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = newColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6901, + "__docId__": 6909, "kind": "class", "name": "TrianglesSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js", @@ -136948,7 +137164,7 @@ "ignore": true }, { - "__docId__": 6902, + "__docId__": 6910, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", @@ -136983,240 +137199,240 @@ "return": null }, { - "__docId__": 6903, - "kind": "method", - "name": "_buildVertexShader", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer#_buildVertexShader", - "access": "private", - "description": null, - "lineNumber": 12, - "undocument": true, - "ignore": true, - "params": [], - "return": { - "types": [ - "*" - ] - } - }, - { - "__docId__": 6904, - "kind": "method", - "name": "_buildFragmentShader", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer#_buildFragmentShader", - "access": "private", - "description": null, - "lineNumber": 82, - "undocument": true, - "ignore": true, - "params": [], - "return": { - "types": [ - "*" - ] - } - }, - { - "__docId__": 6905, - "kind": "file", - "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class TrianglesSnapInitRenderer extends VBORenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n state.indicesBuf.bind();\n gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n state.indicesBuf.unbind();\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" relativeToOriginPosition = worldPosition.xyz;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\");\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", - "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 6906, - "kind": "variable", - "name": "tempVec3a", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3a", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 5, - "undocument": true, - "type": { - "types": [ - "*" - ] - }, - "ignore": true - }, - { - "__docId__": 6907, - "kind": "variable", - "name": "tempVec3b", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3b", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 6, - "undocument": true, - "type": { - "types": [ - "*" - ] - }, - "ignore": true - }, - { - "__docId__": 6908, - "kind": "variable", - "name": "tempVec3c", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3c", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 7, - "undocument": true, - "type": { - "types": [ - "*" - ] - }, - "ignore": true - }, - { - "__docId__": 6909, - "kind": "variable", - "name": "tempVec3d", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3d", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 8, - "undocument": true, - "type": { - "types": [ - "*" - ] - }, - "ignore": true - }, - { - "__docId__": 6910, - "kind": "variable", - "name": "tempMat4a", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempMat4a", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 9, - "undocument": true, - "type": { - "types": [ - "*" - ] - }, - "ignore": true - }, - { - "__docId__": 6911, - "kind": "variable", - "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~SNAPPING_LOG_DEPTH_BUF_ENABLED", - "access": "public", - "export": false, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": null, - "description": null, - "lineNumber": 11, - "undocument": true, - "type": { - "types": [ - "boolean" - ] - }, - "ignore": true - }, - { - "__docId__": 6912, - "kind": "class", - "name": "TrianglesSnapInitRenderer", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "static": true, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", - "access": "private", - "export": true, - "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", - "importStyle": "{TrianglesSnapInitRenderer}", - "description": "", - "lineNumber": 16, - "interface": false, - "extends": [ - "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer" - ], - "ignore": true - }, - { - "__docId__": 6913, - "kind": "method", - "name": "drawLayer", - "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer#drawLayer", - "access": "public", - "description": null, - "lineNumber": 18, - "undocument": true, - "params": [ - { - "name": "frameCtx", - "types": [ - "*" - ] - }, - { - "name": "batchingLayer", - "types": [ - "*" - ] - }, - { - "name": "renderPass", - "types": [ - "*" - ] - } - ], - "return": null - }, - { + "__docId__": 6911, + "kind": "method", + "name": "_buildVertexShader", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer#_buildVertexShader", + "access": "private", + "description": null, + "lineNumber": 12, + "undocument": true, + "ignore": true, + "params": [], + "return": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 6912, + "kind": "method", + "name": "_buildFragmentShader", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer#_buildFragmentShader", + "access": "private", + "description": null, + "lineNumber": 82, + "undocument": true, + "ignore": true, + "params": [], + "return": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 6913, + "kind": "file", + "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class TrianglesSnapInitRenderer extends VBORenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n state.indicesBuf.bind();\n gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);\n state.indicesBuf.unbind();\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" relativeToOriginPosition = worldPosition.xyz;\");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// VBO SnapBatchingDepthBufInitRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\");\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", + "static": true, + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { "__docId__": 6914, + "kind": "variable", + "name": "tempVec3a", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3a", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 5, + "undocument": true, + "type": { + "types": [ + "*" + ] + }, + "ignore": true + }, + { + "__docId__": 6915, + "kind": "variable", + "name": "tempVec3b", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3b", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 6, + "undocument": true, + "type": { + "types": [ + "*" + ] + }, + "ignore": true + }, + { + "__docId__": 6916, + "kind": "variable", + "name": "tempVec3c", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3c", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 7, + "undocument": true, + "type": { + "types": [ + "*" + ] + }, + "ignore": true + }, + { + "__docId__": 6917, + "kind": "variable", + "name": "tempVec3d", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempVec3d", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 8, + "undocument": true, + "type": { + "types": [ + "*" + ] + }, + "ignore": true + }, + { + "__docId__": 6918, + "kind": "variable", + "name": "tempMat4a", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~tempMat4a", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 9, + "undocument": true, + "type": { + "types": [ + "*" + ] + }, + "ignore": true + }, + { + "__docId__": 6919, + "kind": "variable", + "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~SNAPPING_LOG_DEPTH_BUF_ENABLED", + "access": "public", + "export": false, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": null, + "description": null, + "lineNumber": 11, + "undocument": true, + "type": { + "types": [ + "boolean" + ] + }, + "ignore": true + }, + { + "__docId__": 6920, + "kind": "class", + "name": "TrianglesSnapInitRenderer", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "static": true, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", + "access": "private", + "export": true, + "importPath": "@xeokit/xeokit-sdk/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js", + "importStyle": "{TrianglesSnapInitRenderer}", + "description": "", + "lineNumber": 16, + "interface": false, + "extends": [ + "src/viewer/scene/model/vbo/VBORenderer.js~VBORenderer" + ], + "ignore": true + }, + { + "__docId__": 6921, + "kind": "method", + "name": "drawLayer", + "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer#drawLayer", + "access": "public", + "description": null, + "lineNumber": 18, + "undocument": true, + "params": [ + { + "name": "frameCtx", + "types": [ + "*" + ] + }, + { + "name": "batchingLayer", + "types": [ + "*" + ] + }, + { + "name": "renderPass", + "types": [ + "*" + ] + } + ], + "return": null + }, + { + "__docId__": 6922, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137233,7 +137449,7 @@ "return": null }, { - "__docId__": 6915, + "__docId__": 6923, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137251,7 +137467,7 @@ } }, { - "__docId__": 6916, + "__docId__": 6924, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137269,7 +137485,7 @@ } }, { - "__docId__": 6917, + "__docId__": 6925, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137286,7 +137502,7 @@ } }, { - "__docId__": 6918, + "__docId__": 6926, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137303,7 +137519,7 @@ } }, { - "__docId__": 6919, + "__docId__": 6927, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137321,7 +137537,7 @@ } }, { - "__docId__": 6920, + "__docId__": 6928, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137339,7 +137555,7 @@ } }, { - "__docId__": 6921, + "__docId__": 6929, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137356,7 +137572,7 @@ "return": null }, { - "__docId__": 6922, + "__docId__": 6930, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137377,7 +137593,7 @@ } }, { - "__docId__": 6923, + "__docId__": 6931, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137398,7 +137614,7 @@ } }, { - "__docId__": 6924, + "__docId__": 6932, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137414,7 +137630,7 @@ "return": null }, { - "__docId__": 6925, + "__docId__": 6933, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137432,7 +137648,7 @@ } }, { - "__docId__": 6926, + "__docId__": 6934, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -137448,18 +137664,18 @@ "return": null }, { - "__docId__": 6928, + "__docId__": 6936, "kind": "file", "name": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class TrianglesSnapRenderer extends VBORenderer{\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + (this._scene.pointsMaterial.hash);\n }\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = batchingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = batchingLayer._state;\n const origin = batchingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(batchingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(batchingLayer));\n } else {\n this._vaoCache.set(batchingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = tempVec3c;\n math.transformPoint3(rotationMatrix, origin, rotatedOrigin);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(batchingLayer);\n\n //=============================================================\n // TODO: Use drawElements count and offset to draw only one entity\n //=============================================================\n\n if (frameCtx.snapMode === \"edge\") {\n state.edgeIndicesBuf.bind();\n gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);\n state.edgeIndicesBuf.unbind(); // needed?\n } else {\n gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\"); \n this.uVectorA = program.getLocation(\"snapVectorA\"); \n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapBatchingDepthRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\"); \n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\" } else {\");\n src.push(\" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); \");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\" }\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapBatchingDepthRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\" if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\" }\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\" }\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6929, + "__docId__": 6937, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137480,7 +137696,7 @@ "ignore": true }, { - "__docId__": 6930, + "__docId__": 6938, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137501,7 +137717,7 @@ "ignore": true }, { - "__docId__": 6931, + "__docId__": 6939, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137522,7 +137738,7 @@ "ignore": true }, { - "__docId__": 6932, + "__docId__": 6940, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137543,7 +137759,7 @@ "ignore": true }, { - "__docId__": 6933, + "__docId__": 6941, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137564,7 +137780,7 @@ "ignore": true }, { - "__docId__": 6934, + "__docId__": 6942, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137585,7 +137801,7 @@ "ignore": true }, { - "__docId__": 6935, + "__docId__": 6943, "kind": "class", "name": "TrianglesSnapRenderer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js", @@ -137604,7 +137820,7 @@ "ignore": true }, { - "__docId__": 6936, + "__docId__": 6944, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137625,7 +137841,7 @@ } }, { - "__docId__": 6937, + "__docId__": 6945, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137660,7 +137876,7 @@ "return": null }, { - "__docId__": 6938, + "__docId__": 6946, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137677,7 +137893,7 @@ "return": null }, { - "__docId__": 6939, + "__docId__": 6947, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137695,7 +137911,7 @@ } }, { - "__docId__": 6940, + "__docId__": 6948, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137713,7 +137929,7 @@ } }, { - "__docId__": 6941, + "__docId__": 6949, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137730,7 +137946,7 @@ } }, { - "__docId__": 6942, + "__docId__": 6950, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137747,7 +137963,7 @@ } }, { - "__docId__": 6943, + "__docId__": 6951, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137765,7 +137981,7 @@ } }, { - "__docId__": 6944, + "__docId__": 6952, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137783,7 +137999,7 @@ } }, { - "__docId__": 6945, + "__docId__": 6953, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137800,7 +138016,7 @@ "return": null }, { - "__docId__": 6946, + "__docId__": 6954, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137821,7 +138037,7 @@ } }, { - "__docId__": 6947, + "__docId__": 6955, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137842,7 +138058,7 @@ } }, { - "__docId__": 6948, + "__docId__": 6956, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137858,7 +138074,7 @@ "return": null }, { - "__docId__": 6949, + "__docId__": 6957, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137876,7 +138092,7 @@ } }, { - "__docId__": 6950, + "__docId__": 6958, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -137892,18 +138108,18 @@ "return": null }, { - "__docId__": 6952, + "__docId__": 6960, "kind": "file", "name": "src/viewer/scene/model/vbo/float16.js", "content": "/**\n * Bundled by jsDelivr using Rollup v2.59.0 and Terser v5.9.0.\n * Original file: /npm/@petamoriken/float16@3.5.11/src/index.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\nfunction t(t)\n{\n return (r, ...e) => n(t, r, e)\n}\n\nfunction r(r, n)\n{\n return t(s(r, n).get)\n}\nconst\n{\n apply: n,\n construct: e,\n defineProperty: o,\n get: i,\n getOwnPropertyDescriptor: s,\n getPrototypeOf: c,\n has: u,\n ownKeys: f,\n set: h,\n setPrototypeOf: l\n} = Reflect, a = Proxy, y = Number,\n{\n isFinite: p,\n isNaN: w\n} = y,\n{\n iterator: g,\n species: d,\n toStringTag: v,\n for: b\n} = Symbol, A = Object,\n{\n create: m,\n defineProperty: B,\n freeze: x,\n is: E\n} = A, T = A.prototype, O = t(T.isPrototypeOf), j = A.hasOwn || t(T.hasOwnProperty), I = Array, P = I.isArray, S = I.prototype, _ = t(S.join), F = t(S.push), L = t(S.toLocaleString), R = S[g], C = t(R), N = Math.trunc, U = ArrayBuffer, M = U.isView, D = t(U.prototype.slice), k = r(U.prototype, \"byteLength\"), W = \"undefined\" != typeof SharedArrayBuffer ? SharedArrayBuffer : null, V = W && r(W.prototype, \"byteLength\"), Y = c(Uint8Array), z = Y.from, G = Y.prototype, K = G[g], X = t(G.keys), q = t(G.values), H = t(G.entries), J = t(G.set), Q = t(G.reverse), Z = t(G.fill), $ = t(G.copyWithin), tt = t(G.sort), rt = t(G.slice), nt = t(G.subarray), et = r(G, \"buffer\"), ot = r(G, \"byteOffset\"), it = r(G, \"length\"), st = r(G, v), ct = Uint16Array, ut = (...t) => n(z, ct, t), ft = Uint32Array, ht = Float32Array, lt = c([][g]()), at = t(lt.next), yt = t(function*() {}().next), pt = c(lt), wt = DataView.prototype, gt = t(wt.getUint16), dt = t(wt.setUint16), vt = TypeError, bt = RangeError, At = Set, mt = At.prototype, Bt = t(mt.add), xt = t(mt.has), Et = WeakMap, Tt = Et.prototype, Ot = t(Tt.get), jt = t(Tt.has), It = t(Tt.set), Pt = new U(4), St = new ht(Pt), _t = new ft(Pt), Ft = new ft(512), Lt = new ft(512);\nfor (let t = 0; t < 256; ++t)\n{\n const r = t - 127;\n r < -27 ? (Ft[t] = 0, Ft[256 | t] = 32768, Lt[t] = 24, Lt[256 | t] = 24) : r < -14 ? (Ft[t] = 1024 >> -r - 14, Ft[256 | t] = 1024 >> -r - 14 | 32768, Lt[t] = -r - 1, Lt[256 | t] = -r - 1) : r <= 15 ? (Ft[t] = r + 15 << 10, Ft[256 | t] = r + 15 << 10 | 32768, Lt[t] = 13, Lt[256 | t] = 13) : r < 128 ? (Ft[t] = 31744, Ft[256 | t] = 64512, Lt[t] = 24, Lt[256 | t] = 24) : (Ft[t] = 31744, Ft[256 | t] = 64512, Lt[t] = 13, Lt[256 | t] = 13)\n}\n\nfunction Rt(t)\n{\n St[0] = t;\n const r = _t[0],\n n = r >> 23 & 511;\n return Ft[n] + ((8388607 & r) >> Lt[n])\n}\nconst Ct = new ft(2048),\n Nt = new ft(64),\n Ut = new ft(64);\nCt[0] = 0;\nfor (let t = 1; t < 1024; ++t)\n{\n let r = t << 13,\n n = 0;\n for (; 0 == (8388608 & r);) n -= 8388608, r <<= 1;\n r &= -8388609, n += 947912704, Ct[t] = r | n\n}\nfor (let t = 1024; t < 2048; ++t) Ct[t] = 939524096 + (t - 1024 << 13);\nNt[0] = 0;\nfor (let t = 1; t < 31; ++t) Nt[t] = t << 23;\nNt[31] = 1199570944, Nt[32] = 2147483648;\nfor (let t = 33; t < 63; ++t) Nt[t] = 2147483648 + (t - 32 << 23);\nNt[63] = 3347054592, Ut[0] = 0;\nfor (let t = 1; t < 64; ++t) Ut[t] = 32 === t ? 0 : 1024;\n\nfunction Mt(t)\n{\n const r = t >> 10;\n return _t[0] = Ct[Ut[r] + (1023 & t)] + Nt[r], St[0]\n}\n\nfunction Dt(t)\n{\n if (\"bigint\" == typeof t) throw vt(\"Cannot convert a BigInt value to a number\");\n if (t = y(t), !p(t) || 0 === t) return t;\n return Mt(Rt(t))\n}\n\nfunction kt(t)\n{\n if (t[g] === R) return t;\n const r = C(t);\n return m(null,\n {\n next:\n {\n value: function()\n {\n return at(r)\n }\n },\n [g]:\n {\n value: function()\n {\n return this\n }\n }\n })\n}\nconst Wt = new Et,\n Vt = m(pt,\n {\n next:\n {\n value: function()\n {\n const t = Ot(Wt, this);\n return yt(t)\n },\n writable: !0,\n configurable: !0\n },\n [v]:\n {\n value: \"Array Iterator\",\n configurable: !0\n }\n });\n\nfunction Yt(t)\n{\n const r = m(Vt);\n return It(Wt, r, t), r\n}\n\nfunction zt(t)\n{\n return null !== t && \"object\" == typeof t || \"function\" == typeof t\n}\n\nfunction Gt(t)\n{\n return null !== t && \"object\" == typeof t\n}\n\nfunction Kt(t)\n{\n return void 0 !== st(t)\n}\n\nfunction Xt(t)\n{\n const r = st(t);\n return \"BigInt64Array\" === r || \"BigUint64Array\" === r\n}\n\nfunction qt(t)\n{\n if (null === W) return !1;\n try\n {\n return V(t), !0\n }\n catch (t)\n {\n return !1\n }\n}\n\nfunction Ht(t)\n{\n if (!P(t)) return !1;\n if (t[g] === R) return !0;\n return \"Array Iterator\" === t[g]()[v]\n}\n\nfunction Jt(t)\n{\n if (\"string\" != typeof t) return !1;\n const r = y(t);\n return t === r + \"\" && (!!p(r) && r === N(r))\n}\nconst Qt = y.MAX_SAFE_INTEGER;\n\nfunction Zt(t)\n{\n if (\"bigint\" == typeof t) throw vt(\"Cannot convert a BigInt value to a number\");\n const r = y(t);\n return w(r) || 0 === r ? 0 : N(r)\n}\n\nfunction $t(t)\n{\n const r = Zt(t);\n return r < 0 ? 0 : r < Qt ? r : Qt\n}\n\nfunction tr(t, r)\n{\n if (!zt(t)) throw vt(\"This is not an object\");\n const n = t.constructor;\n if (void 0 === n) return r;\n if (!zt(n)) throw vt(\"The constructor property value is not an object\");\n const e = n[d];\n return null == e ? r : e\n}\n\nfunction rr(t)\n{\n if (qt(t)) return !1;\n try\n {\n return D(t, 0, 0), !1\n }\n catch (t)\n {}\n return !0\n}\n\nfunction nr(t, r)\n{\n const n = w(t),\n e = w(r);\n if (n && e) return 0;\n if (n) return 1;\n if (e) return -1;\n if (t < r) return -1;\n if (t > r) return 1;\n if (0 === t && 0 === r)\n {\n const n = E(t, 0),\n e = E(r, 0);\n if (!n && e) return -1;\n if (n && !e) return 1\n }\n return 0\n}\nconst er = b(\"__Float16Array__\"),\n or = new Et;\n\nfunction ir(t)\n{\n return jt(or, t) || !M(t) && function(t)\n {\n if (!Gt(t)) return !1;\n const r = c(t);\n if (!Gt(r)) return !1;\n const n = r.constructor;\n if (void 0 === n) return !1;\n if (!zt(n)) throw vt(\"The constructor property value is not an object\");\n return u(n, er)\n }(t)\n}\n\nfunction sr(t)\n{\n if (!ir(t)) throw vt(\"This is not a Float16Array object\")\n}\n\nfunction cr(t, r)\n{\n const n = ir(t),\n e = Kt(t);\n if (!n && !e) throw vt(\"Species constructor didn't return TypedArray object\");\n if (\"number\" == typeof r)\n {\n let e;\n if (n)\n {\n const r = ur(t);\n e = it(r)\n }\n else e = it(t);\n if (e < r) throw vt(\"Derived constructor created TypedArray object which was too small length\")\n }\n if (Xt(t)) throw vt(\"Cannot mix BigInt and other types, use explicit conversions\")\n}\n\nfunction ur(t)\n{\n const r = Ot(or, t);\n if (void 0 !== r)\n {\n if (rr(et(r))) throw vt(\"Attempting to access detached ArrayBuffer\");\n return r\n }\n const n = t.buffer;\n if (rr(n)) throw vt(\"Attempting to access detached ArrayBuffer\");\n const o = e(ar, [n, t.byteOffset, t.length], t.constructor);\n return Ot(or, o)\n}\n\nfunction fr(t)\n{\n const r = it(t),\n n = [];\n for (let e = 0; e < r; ++e) n[e] = Mt(t[e]);\n return n\n}\nconst hr = new At;\nfor (const t of f(G))\n{\n if (t === v) continue;\n const r = s(G, t);\n j(r, \"get\") && Bt(hr, t)\n}\nconst lr = x(\n{\n get: (t, r, n) => Jt(r) && j(t, r) ? Mt(i(t, r)) : xt(hr, r) && O(G, t) ? i(t, r) : i(t, r, n),\n set: (t, r, n, e) => Jt(r) && j(t, r) ? h(t, r, Rt(n)) : h(t, r, n, e),\n getOwnPropertyDescriptor(t, r)\n {\n if (Jt(r) && j(t, r))\n {\n const n = s(t, r);\n return n.value = Mt(n.value), n\n }\n return s(t, r)\n },\n defineProperty: (t, r, n) => Jt(r) && j(t, r) && j(n, \"value\") ? (n.value = Rt(n.value), o(t, r, n)) : o(t, r, n)\n});\nclass ar\n{\n constructor(t, r, n)\n {\n let o;\n if (ir(t)) o = e(ct, [ur(t)], new.target);\n else if (zt(t) && ! function(t)\n {\n try\n {\n return k(t), !0\n }\n catch (t)\n {\n return !1\n }\n }(t))\n {\n let r, n;\n if (Kt(t))\n {\n r = t, n = it(t);\n const i = et(t),\n s = qt(i) ? U : tr(i, U);\n if (rr(i)) throw vt(\"Attempting to access detached ArrayBuffer\");\n if (Xt(t)) throw vt(\"Cannot mix BigInt and other types, use explicit conversions\");\n const c = new s(2 * n);\n o = e(ct, [c], new.target)\n }\n else\n {\n const i = t[g];\n if (null != i && \"function\" != typeof i) throw vt(\"@@iterator property is not callable\");\n null != i ? Ht(t) ? (r = t, n = t.length) : (r = [...t], n = r.length) : (r = t, n = $t(r.length)), o = e(ct, [n], new.target)\n }\n for (let t = 0; t < n; ++t) o[t] = Rt(r[t])\n }\n else o = e(ct, arguments, new.target);\n const i = new a(o, lr);\n return It(or, i, o), i\n }\n static from(t, ...r)\n {\n const e = this;\n if (!u(e, er)) throw vt(\"This constructor is not a subclass of Float16Array\");\n if (e === ar)\n {\n if (ir(t) && 0 === r.length)\n {\n const r = ur(t),\n n = new ct(et(r), ot(r), it(r));\n return new ar(et(rt(n)))\n }\n if (0 === r.length) return new ar(et(ut(t, Rt)));\n const e = r[0],\n o = r[1];\n return new ar(et(ut(t, (function(t, ...r)\n {\n return Rt(n(e, this, [t, ...kt(r)]))\n }), o)))\n }\n let o, i;\n const s = t[g];\n if (null != s && \"function\" != typeof s) throw vt(\"@@iterator property is not callable\");\n if (null != s) Ht(t) ? (o = t, i = t.length) : !Kt(c = t) || c[g] !== K && \"Array Iterator\" !== c[g]()[v] ? (o = [...t], i = o.length) : (o = t, i = it(t));\n else\n {\n if (null == t) throw vt(\"Cannot convert undefined or null to object\");\n o = A(t), i = $t(o.length)\n }\n var c;\n const f = new e(i);\n if (0 === r.length)\n for (let t = 0; t < i; ++t) f[t] = o[t];\n else\n {\n const t = r[0],\n e = r[1];\n for (let r = 0; r < i; ++r) f[r] = n(t, e, [o[r], r])\n }\n return f\n }\n static of(...t)\n {\n const r = this;\n if (!u(r, er)) throw vt(\"This constructor is not a subclass of Float16Array\");\n const n = t.length;\n if (r === ar)\n {\n const r = new ar(n),\n e = ur(r);\n for (let r = 0; r < n; ++r) e[r] = Rt(t[r]);\n return r\n }\n const e = new r(n);\n for (let r = 0; r < n; ++r) e[r] = t[r];\n return e\n }\n keys()\n {\n sr(this);\n const t = ur(this);\n return X(t)\n }\n values()\n {\n sr(this);\n const t = ur(this);\n return Yt(function*()\n {\n for (const r of q(t)) yield Mt(r)\n }())\n }\n entries()\n {\n sr(this);\n const t = ur(this);\n return Yt(function*()\n {\n for (const [r, n] of H(t)) yield [r, Mt(n)]\n }())\n }\n at(t)\n {\n sr(this);\n const r = ur(this),\n n = it(r),\n e = Zt(t),\n o = e >= 0 ? e : n + e;\n if (!(o < 0 || o >= n)) return Mt(r[o])\n }\n map(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0],\n s = tr(e, ar);\n if (s === ar)\n {\n const r = new ar(o),\n s = ur(r);\n for (let r = 0; r < o; ++r)\n {\n const o = Mt(e[r]);\n s[r] = Rt(n(t, i, [o, r, this]))\n }\n return r\n }\n const c = new s(o);\n cr(c, o);\n for (let r = 0; r < o; ++r)\n {\n const o = Mt(e[r]);\n c[r] = n(t, i, [o, r, this])\n }\n return c\n }\n filter(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0],\n s = [];\n for (let r = 0; r < o; ++r)\n {\n const o = Mt(e[r]);\n n(t, i, [o, r, this]) && F(s, o)\n }\n const c = new(tr(e, ar))(s);\n return cr(c), c\n }\n reduce(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = it(n);\n if (0 === e && 0 === r.length) throw vt(\"Reduce of empty array with no initial value\");\n let o, i;\n 0 === r.length ? (o = Mt(n[0]), i = 1) : (o = r[0], i = 0);\n for (let r = i; r < e; ++r) o = t(o, Mt(n[r]), r, this);\n return o\n }\n reduceRight(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = it(n);\n if (0 === e && 0 === r.length) throw vt(\"Reduce of empty array with no initial value\");\n let o, i;\n 0 === r.length ? (o = Mt(n[e - 1]), i = e - 2) : (o = r[0], i = e - 1);\n for (let r = i; r >= 0; --r) o = t(o, Mt(n[r]), r, this);\n return o\n }\n forEach(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = 0; r < o; ++r) n(t, i, [Mt(e[r]), r, this])\n }\n find(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = 0; r < o; ++r)\n {\n const o = Mt(e[r]);\n if (n(t, i, [o, r, this])) return o\n }\n }\n findIndex(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = 0; r < o; ++r)\n {\n const o = Mt(e[r]);\n if (n(t, i, [o, r, this])) return r\n }\n return -1\n }\n findLast(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = o - 1; r >= 0; --r)\n {\n const o = Mt(e[r]);\n if (n(t, i, [o, r, this])) return o\n }\n }\n findLastIndex(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = o - 1; r >= 0; --r)\n {\n const o = Mt(e[r]);\n if (n(t, i, [o, r, this])) return r\n }\n return -1\n }\n every(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = 0; r < o; ++r)\n if (!n(t, i, [Mt(e[r]), r, this])) return !1;\n return !0\n }\n some(t, ...r)\n {\n sr(this);\n const e = ur(this),\n o = it(e),\n i = r[0];\n for (let r = 0; r < o; ++r)\n if (n(t, i, [Mt(e[r]), r, this])) return !0;\n return !1\n }\n set(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = Zt(r[0]);\n if (e < 0) throw bt(\"Offset is out of bounds\");\n if (null == t) throw vt(\"Cannot convert undefined or null to object\");\n if (Xt(t)) throw vt(\"Cannot mix BigInt and other types, use explicit conversions\");\n if (ir(t)) return J(ur(this), ur(t), e);\n if (Kt(t))\n {\n if (rr(et(t))) throw vt(\"Attempting to access detached ArrayBuffer\")\n }\n const o = it(n),\n i = A(t),\n s = $t(i.length);\n if (e === 1 / 0 || s + e > o) throw bt(\"Offset is out of bounds\");\n for (let t = 0; t < s; ++t) n[t + e] = Rt(i[t])\n }\n reverse()\n {\n sr(this);\n const t = ur(this);\n return Q(t), this\n }\n fill(t, ...r)\n {\n sr(this);\n const n = ur(this);\n return Z(n, Rt(t), ...kt(r)), this\n }\n copyWithin(t, r, ...n)\n {\n sr(this);\n const e = ur(this);\n return $(e, t, r, ...kt(n)), this\n }\n sort(...t)\n {\n sr(this);\n const r = ur(this),\n n = void 0 !== t[0] ? t[0] : nr;\n return tt(r, ((t, r) => n(Mt(t), Mt(r)))), this\n }\n slice(...t)\n {\n sr(this);\n const r = ur(this),\n n = tr(r, ar);\n if (n === ar)\n {\n const n = new ct(et(r), ot(r), it(r));\n return new ar(et(rt(n, ...kt(t))))\n }\n const e = it(r),\n o = Zt(t[0]),\n i = void 0 === t[1] ? e : Zt(t[1]);\n let s, c;\n s = o === -1 / 0 ? 0 : o < 0 ? e + o > 0 ? e + o : 0 : e < o ? e : o, c = i === -1 / 0 ? 0 : i < 0 ? e + i > 0 ? e + i : 0 : e < i ? e : i;\n const u = c - s > 0 ? c - s : 0,\n f = new n(u);\n if (cr(f, u), 0 === u) return f;\n if (rr(et(r))) throw vt(\"Attempting to access detached ArrayBuffer\");\n let h = 0;\n for (; s < c;) f[h] = Mt(r[s]), ++s, ++h;\n return f\n }\n subarray(...t)\n {\n sr(this);\n const r = ur(this),\n n = tr(r, ar),\n e = new ct(et(r), ot(r), it(r)),\n o = nt(e, ...kt(t)),\n i = new n(et(o), ot(o), it(o));\n return cr(i), i\n }\n indexOf(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = it(n);\n let o = Zt(r[0]);\n if (o === 1 / 0) return -1;\n o < 0 && (o += e, o < 0 && (o = 0));\n for (let r = o; r < e; ++r)\n if (j(n, r) && Mt(n[r]) === t) return r;\n return -1\n }\n lastIndexOf(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = it(n);\n let o = r.length >= 1 ? Zt(r[0]) : e - 1;\n if (o === -1 / 0) return -1;\n o >= 0 ? o = o < e - 1 ? o : e - 1 : o += e;\n for (let r = o; r >= 0; --r)\n if (j(n, r) && Mt(n[r]) === t) return r;\n return -1\n }\n includes(t, ...r)\n {\n sr(this);\n const n = ur(this),\n e = it(n);\n let o = Zt(r[0]);\n if (o === 1 / 0) return !1;\n o < 0 && (o += e, o < 0 && (o = 0));\n const i = w(t);\n for (let r = o; r < e; ++r)\n {\n const e = Mt(n[r]);\n if (i && w(e)) return !0;\n if (e === t) return !0\n }\n return !1\n }\n join(...t)\n {\n sr(this);\n const r = fr(ur(this));\n return _(r, ...kt(t))\n }\n toLocaleString(...t)\n {\n sr(this);\n const r = fr(ur(this));\n return L(r, ...kt(t))\n }\n get[v]()\n {\n if (ir(this)) return \"Float16Array\"\n }\n}\nB(ar, \"BYTES_PER_ELEMENT\",\n{\n value: 2\n}), B(ar, er,\n{}), l(ar, Y);\nconst yr = ar.prototype;\n\nfunction pr(t, r, ...n)\n{\n return Mt(gt(t, r, ...kt(n)))\n}\n\nfunction wr(t, r, n, ...e)\n{\n return dt(t, r, Rt(n), ...kt(e))\n}\nB(yr, \"BYTES_PER_ELEMENT\",\n{\n value: 2\n}), B(yr, g,\n{\n value: yr.values,\n writable: !0,\n configurable: !0\n}), l(yr, G);\nexport\n{\n ar as Float16Array, pr as getFloat16, Dt as hfround, ir as isFloat16Array, wr as setFloat16\n};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/float16.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/float16.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 6953, + "__docId__": 6961, "kind": "function", "name": "t", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -137933,7 +138149,7 @@ "ignore": true }, { - "__docId__": 6954, + "__docId__": 6962, "kind": "function", "name": "r", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -137970,7 +138186,7 @@ "ignore": true }, { - "__docId__": 6955, + "__docId__": 6963, "kind": "variable", "name": "apply", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -137991,7 +138207,7 @@ "ignore": true }, { - "__docId__": 6956, + "__docId__": 6964, "kind": "function", "name": "Rt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138022,7 +138238,7 @@ "ignore": true }, { - "__docId__": 6957, + "__docId__": 6965, "kind": "variable", "name": "Ct", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138043,7 +138259,7 @@ "ignore": true }, { - "__docId__": 6958, + "__docId__": 6966, "kind": "function", "name": "Mt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138074,7 +138290,7 @@ "ignore": true }, { - "__docId__": 6959, + "__docId__": 6967, "kind": "function", "name": "Dt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138105,7 +138321,7 @@ "ignore": true }, { - "__docId__": 6960, + "__docId__": 6968, "kind": "function", "name": "kt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138136,7 +138352,7 @@ "ignore": true }, { - "__docId__": 6961, + "__docId__": 6969, "kind": "variable", "name": "Wt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138157,7 +138373,7 @@ "ignore": true }, { - "__docId__": 6962, + "__docId__": 6970, "kind": "function", "name": "Yt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138188,7 +138404,7 @@ "ignore": true }, { - "__docId__": 6963, + "__docId__": 6971, "kind": "function", "name": "zt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138219,7 +138435,7 @@ "ignore": true }, { - "__docId__": 6964, + "__docId__": 6972, "kind": "function", "name": "Gt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138250,7 +138466,7 @@ "ignore": true }, { - "__docId__": 6965, + "__docId__": 6973, "kind": "function", "name": "Kt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138281,7 +138497,7 @@ "ignore": true }, { - "__docId__": 6966, + "__docId__": 6974, "kind": "function", "name": "Xt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138312,7 +138528,7 @@ "ignore": true }, { - "__docId__": 6967, + "__docId__": 6975, "kind": "function", "name": "qt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138343,7 +138559,7 @@ "ignore": true }, { - "__docId__": 6968, + "__docId__": 6976, "kind": "function", "name": "Ht", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138374,7 +138590,7 @@ "ignore": true }, { - "__docId__": 6969, + "__docId__": 6977, "kind": "function", "name": "Jt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138405,7 +138621,7 @@ "ignore": true }, { - "__docId__": 6970, + "__docId__": 6978, "kind": "variable", "name": "Qt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138426,7 +138642,7 @@ "ignore": true }, { - "__docId__": 6971, + "__docId__": 6979, "kind": "function", "name": "Zt", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138457,7 +138673,7 @@ "ignore": true }, { - "__docId__": 6972, + "__docId__": 6980, "kind": "function", "name": "$t", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138488,7 +138704,7 @@ "ignore": true }, { - "__docId__": 6973, + "__docId__": 6981, "kind": "function", "name": "tr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138525,7 +138741,7 @@ "ignore": true }, { - "__docId__": 6974, + "__docId__": 6982, "kind": "function", "name": "rr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138556,7 +138772,7 @@ "ignore": true }, { - "__docId__": 6975, + "__docId__": 6983, "kind": "function", "name": "nr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138593,7 +138809,7 @@ "ignore": true }, { - "__docId__": 6976, + "__docId__": 6984, "kind": "variable", "name": "er", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138614,7 +138830,7 @@ "ignore": true }, { - "__docId__": 6977, + "__docId__": 6985, "kind": "function", "name": "ir", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138645,7 +138861,7 @@ "ignore": true }, { - "__docId__": 6978, + "__docId__": 6986, "kind": "function", "name": "sr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138672,7 +138888,7 @@ "ignore": true }, { - "__docId__": 6979, + "__docId__": 6987, "kind": "function", "name": "cr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138705,7 +138921,7 @@ "ignore": true }, { - "__docId__": 6980, + "__docId__": 6988, "kind": "function", "name": "ur", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138736,7 +138952,7 @@ "ignore": true }, { - "__docId__": 6981, + "__docId__": 6989, "kind": "function", "name": "fr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138767,7 +138983,7 @@ "ignore": true }, { - "__docId__": 6982, + "__docId__": 6990, "kind": "variable", "name": "hr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138788,7 +139004,7 @@ "ignore": true }, { - "__docId__": 6983, + "__docId__": 6991, "kind": "variable", "name": "lr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138809,7 +139025,7 @@ "ignore": true }, { - "__docId__": 6984, + "__docId__": 6992, "kind": "class", "name": "ar", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -138826,7 +139042,7 @@ "ignore": true }, { - "__docId__": 6985, + "__docId__": 6993, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138840,7 +139056,7 @@ "undocument": true }, { - "__docId__": 6986, + "__docId__": 6994, "kind": "method", "name": "from", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138874,7 +139090,7 @@ } }, { - "__docId__": 6987, + "__docId__": 6995, "kind": "method", "name": "of", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138902,7 +139118,7 @@ } }, { - "__docId__": 6988, + "__docId__": 6996, "kind": "method", "name": "keys", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138922,7 +139138,7 @@ } }, { - "__docId__": 6989, + "__docId__": 6997, "kind": "method", "name": "values", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138942,7 +139158,7 @@ } }, { - "__docId__": 6990, + "__docId__": 6998, "kind": "method", "name": "entries", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138962,7 +139178,7 @@ } }, { - "__docId__": 6991, + "__docId__": 6999, "kind": "method", "name": "at", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -138989,7 +139205,7 @@ } }, { - "__docId__": 6992, + "__docId__": 7000, "kind": "method", "name": "map", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139023,7 +139239,7 @@ } }, { - "__docId__": 6993, + "__docId__": 7001, "kind": "method", "name": "filter", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139057,7 +139273,7 @@ } }, { - "__docId__": 6994, + "__docId__": 7002, "kind": "method", "name": "reduce", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139091,7 +139307,7 @@ } }, { - "__docId__": 6995, + "__docId__": 7003, "kind": "method", "name": "reduceRight", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139125,7 +139341,7 @@ } }, { - "__docId__": 6996, + "__docId__": 7004, "kind": "method", "name": "forEach", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139155,7 +139371,7 @@ "return": null }, { - "__docId__": 6997, + "__docId__": 7005, "kind": "method", "name": "find", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139189,7 +139405,7 @@ } }, { - "__docId__": 6998, + "__docId__": 7006, "kind": "method", "name": "findIndex", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139223,7 +139439,7 @@ } }, { - "__docId__": 6999, + "__docId__": 7007, "kind": "method", "name": "findLast", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139257,7 +139473,7 @@ } }, { - "__docId__": 7000, + "__docId__": 7008, "kind": "method", "name": "findLastIndex", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139291,7 +139507,7 @@ } }, { - "__docId__": 7001, + "__docId__": 7009, "kind": "method", "name": "every", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139325,7 +139541,7 @@ } }, { - "__docId__": 7002, + "__docId__": 7010, "kind": "method", "name": "some", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139359,7 +139575,7 @@ } }, { - "__docId__": 7003, + "__docId__": 7011, "kind": "method", "name": "set", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139393,7 +139609,7 @@ } }, { - "__docId__": 7004, + "__docId__": 7012, "kind": "method", "name": "reverse", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139413,7 +139629,7 @@ } }, { - "__docId__": 7005, + "__docId__": 7013, "kind": "method", "name": "fill", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139447,7 +139663,7 @@ } }, { - "__docId__": 7006, + "__docId__": 7014, "kind": "method", "name": "copyWithin", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139487,7 +139703,7 @@ } }, { - "__docId__": 7007, + "__docId__": 7015, "kind": "method", "name": "sort", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139515,7 +139731,7 @@ } }, { - "__docId__": 7008, + "__docId__": 7016, "kind": "method", "name": "slice", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139543,7 +139759,7 @@ } }, { - "__docId__": 7009, + "__docId__": 7017, "kind": "method", "name": "subarray", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139571,7 +139787,7 @@ } }, { - "__docId__": 7010, + "__docId__": 7018, "kind": "method", "name": "indexOf", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139605,7 +139821,7 @@ } }, { - "__docId__": 7011, + "__docId__": 7019, "kind": "method", "name": "lastIndexOf", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139639,7 +139855,7 @@ } }, { - "__docId__": 7012, + "__docId__": 7020, "kind": "method", "name": "includes", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139673,7 +139889,7 @@ } }, { - "__docId__": 7013, + "__docId__": 7021, "kind": "method", "name": "join", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139701,7 +139917,7 @@ } }, { - "__docId__": 7014, + "__docId__": 7022, "kind": "method", "name": "toLocaleString", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139729,7 +139945,7 @@ } }, { - "__docId__": 7015, + "__docId__": 7023, "kind": "get", "name": "[v]", "memberof": "src/viewer/scene/model/vbo/float16.js~ar", @@ -139748,7 +139964,7 @@ } }, { - "__docId__": 7016, + "__docId__": 7024, "kind": "variable", "name": "yr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -139769,7 +139985,7 @@ "ignore": true }, { - "__docId__": 7017, + "__docId__": 7025, "kind": "function", "name": "pr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -139813,7 +140029,7 @@ "ignore": true }, { - "__docId__": 7018, + "__docId__": 7026, "kind": "function", "name": "wr", "memberof": "src/viewer/scene/model/vbo/float16.js", @@ -139863,18 +140079,18 @@ "ignore": true }, { - "__docId__": 7019, + "__docId__": 7027, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {getRenderers} from \"./renderers/VBOInstancingLinesRenderers.js\";\n\nconst tempUint8Vec4 = new Uint8Array(4);\nconst tempFloat32 = new Float32Array(1);\n\nconst tempVec3fa = new Float32Array(3);\n\nconst tempFloat32Vec4 = new Float32Array(4);\n\n/**\n * @private\n */\nclass VBOInstancingLinesLayer {\n\n /**\n * @param cfg\n * @param cfg.layerIndex\n * @param cfg.model\n * @param cfg.geometry\n * @param cfg.material\n * @param cfg.origin\n */\n constructor(cfg) {\n\n console.info(\"VBOInstancingLinesLayer\");\n\n /**\n * Owner model\n * @type {VBOSceneModel}\n */\n this.model = cfg.model;\n\n /**\n * Shared material\n * @type {VBOSceneModelGeometry}\n */\n this.material = cfg.material;\n\n /**\n * State sorting key.\n * @type {string}\n */\n this.sortId = \"LinesInstancingLayer\";\n\n /**\n * Index of this InstancingLayer in VBOSceneModel#_layerList\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n\n this._aabb = math.collapseAABB3();\n\n this._state = new RenderState({\n obb: math.OBB3(),\n numInstances: 0,\n origin: null,\n geometry: cfg.geometry,\n positionsDecodeMatrix: cfg.geometry.positionsDecodeMatrix, // So we can null the geometry for GC\n positionsBuf: null,\n colorsBuf: null,\n flagsBuf: null,\n offsetsBuf: null,\n modelMatrixCol0Buf: null,\n modelMatrixCol1Buf: null,\n modelMatrixCol2Buf: null\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numEdgesLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n /** @private */\n this.numIndices = cfg.geometry.numIndices;\n\n // Vertex arrays\n this._colors = [];\n this._offsets = [];\n\n // Modeling matrix per instance, array for each column\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n\n this._portions = [];\n this._meshes = [];\n\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n if (cfg.origin) {\n this._state.origin = math.vec3(cfg.origin);\n }\n\n this._finalized = false;\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Creates a new portion within this InstancingLayer, returns the new portion ID.\n *\n * The portion will instance this InstancingLayer's geometry.\n *\n * Gives the portion the specified color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg Portion params\n * @param cfg.color Color [0..255,0..255,0..255]\n * @param cfg.opacity Opacity [0..255].\n * @param cfg.meshMatrix Flat float 4x4 matrix.\n * @returns {number} Portion ID.\n */\n createPortion(mesh, cfg) {\n\n const color = cfg.color;\n const opacity = cfg.opacity;\n const meshMatrix = cfg.meshMatrix;\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n const r = color[0]; // Color is pre-quantized by VBOSceneModel\n const g = color[1];\n const b = color[2];\n const a = color[3];\n\n this._colors.push(r);\n this._colors.push(g);\n this._colors.push(b);\n this._colors.push(opacity);\n\n if (this.model.scene.entityOffsetsEnabled) {\n this._offsets.push(0);\n this._offsets.push(0);\n this._offsets.push(0);\n }\n\n this._modelMatrixCol0.push(meshMatrix[0]);\n this._modelMatrixCol0.push(meshMatrix[4]);\n this._modelMatrixCol0.push(meshMatrix[8]);\n this._modelMatrixCol0.push(meshMatrix[12]);\n\n this._modelMatrixCol1.push(meshMatrix[1]);\n this._modelMatrixCol1.push(meshMatrix[5]);\n this._modelMatrixCol1.push(meshMatrix[9]);\n this._modelMatrixCol1.push(meshMatrix[13]);\n\n this._modelMatrixCol2.push(meshMatrix[2]);\n this._modelMatrixCol2.push(meshMatrix[6]);\n this._modelMatrixCol2.push(meshMatrix[10]);\n this._modelMatrixCol2.push(meshMatrix[14]);\n\n this._state.numInstances++;\n\n const portionId = this._portions.length;\n this._portions.push({});\n\n this._numPortions++;\n this.model.numPortions++;\n\n this._meshes.push(mesh);\n\n return portionId;\n }\n\n finalize() {\n if (this._finalized) {\n throw \"Already finalized\";\n }\n const gl = this.model.scene.canvas.gl;\n const state = this._state;\n const geometry = state.geometry;\n const colorsLength = this._colors.length;\n const flagsLength = colorsLength / 4;\n if (colorsLength > 0) {\n let notNormalized = false;\n this._state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._colors), this._colors.length, 4, gl.DYNAMIC_DRAW, notNormalized);\n this._colors = []; // Release memory\n }\n if (flagsLength > 0) {\n // Because we only build flags arrays here, \n // get their length from the colors array\n let notNormalized = false;\n this._state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(flagsLength), flagsLength, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n if (this.model.scene.entityOffsetsEnabled) {\n if (this._offsets.length > 0) {\n const notNormalized = false;\n this._state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);\n this._offsets = []; // Release memory\n }\n }\n if (geometry.colorsCompressed && geometry.colorsCompressed.length > 0) {\n const colorsCompressed = new Uint8Array(geometry.colorsCompressed);\n const notNormalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colorsCompressed, colorsCompressed.length, 4, gl.STATIC_DRAW, notNormalized);\n }\n if (geometry.positionsCompressed && geometry.positionsCompressed.length > 0) {\n const normalized = false;\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, geometry.positionsCompressed, geometry.positionsCompressed.length, 3, gl.STATIC_DRAW, normalized);\n state.positionsDecodeMatrix = math.mat4(geometry.positionsDecodeMatrix);\n }\n if (geometry.indices && geometry.indices.length > 0) {\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(geometry.indices), geometry.indices.length, 1, gl.STATIC_DRAW);\n state.numIndices = geometry.indices.length;\n }\n if (this._modelMatrixCol0.length > 0) {\n const normalized = false;\n this._state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);\n this._state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);\n this._state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n }\n this._state.geometry = null;\n this._finalized = true;\n }\n\n // The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.\n // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setVisible(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setHighlighted(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setXRayed(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setSelected(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setEdges(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n } else {\n this._numEdgesLayerPortions--;\n this.model.numEdgesLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setCulled(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setColor(portionId, color) { // RGBA color is normalized as ints\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n tempUint8Vec4[0] = color[0];\n tempUint8Vec4[1] = color[1];\n tempUint8Vec4[2] = color[2];\n tempUint8Vec4[3] = color[3];\n this._state.colorsBuf.setData(tempUint8Vec4, portionId * 4, 4);\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, meshTransparent) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n const edges = !!(flags & ENTITY_FLAGS.EDGES);\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (meshTransparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let edgeFlag = 0;\n if (!visible || culled) {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n edgeFlag = RENDER_PASSES.EDGES_SELECTED;\n } else if (highlighted) {\n edgeFlag = RENDER_PASSES.EDGES_HIGHLIGHTED;\n } else if (xrayed) {\n edgeFlag = RENDER_PASSES.EDGES_XRAYED;\n } else if (edges) {\n if (meshTransparent) {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;\n } else {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_OPAQUE;\n }\n } else {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 255 : 0;\n\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n vertFlag |= edgeFlag << 8;\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempFloat32[0] = vertFlag;\n\n this._state.flagsBuf.setData(tempFloat32, portionId);\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n tempVec3fa[0] = offset[0];\n tempVec3fa[1] = offset[1];\n tempVec3fa[2] = offset[2];\n this._state.offsetsBuf.setData(tempVec3fa, portionId * 3, 3);\n }\n\n setMatrix(portionId, matrix) {\n\n ////////////////////////////////////////\n // TODO: Update portion matrix\n ////////////////////////////////////////\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n const offset = portionId * 4;\n\n tempFloat32Vec4[0] = matrix[0];\n tempFloat32Vec4[1] = matrix[4];\n tempFloat32Vec4[2] = matrix[8];\n tempFloat32Vec4[3] = matrix[12];\n\n this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[1];\n tempFloat32Vec4[1] = matrix[5];\n tempFloat32Vec4[2] = matrix[9];\n tempFloat32Vec4[3] = matrix[13];\n\n this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[2];\n tempFloat32Vec4[1] = matrix[6];\n tempFloat32Vec4[2] = matrix[10];\n tempFloat32Vec4[3] = matrix[14];\n\n this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);\n }\n\n // ---------------------- NORMAL RENDERING -----------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n\n // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------\n\n drawDepth(renderFlags, frameCtx) {\n }\n\n drawNormals(renderFlags, frameCtx) {\n }\n\n // ---------------------- EMPHASIS RENDERING -----------------------------------\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n // ---------------------- EDGES RENDERING -----------------------------------\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n }\n\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n drawOcclusion(renderFlags, frameCtx) {\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n drawShadow(renderFlags, frameCtx) {\n }\n\n //---- PICKING ----------------------------------------------------------------------------------------------------\n\n drawPickMesh(renderFlags, frameCtx) {\n }\n\n drawPickDepths(renderFlags, frameCtx) {\n }\n\n drawPickNormals(renderFlags, frameCtx) {\n }\n\n\n destroy() {\n const state = this._state;\n if (state.positionsBuf) {\n state.positionsBuf.destroy();\n state.positionsBuf = null;\n }\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.modelMatrixCol0Buf) {\n state.modelMatrixCol0Buf.destroy();\n state.modelMatrixCol0Buf = null;\n }\n if (state.modelMatrixCol1Buf) {\n state.modelMatrixCol1Buf.destroy();\n state.modelMatrixCol1Buf = null;\n }\n if (state.modelMatrixCol2Buf) {\n state.modelMatrixCol2Buf.destroy();\n state.modelMatrixCol2Buf = null;\n }\n state.destroy();\n }\n}\n\nexport {VBOInstancingLinesLayer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7020, + "__docId__": 7028, "kind": "variable", "name": "tempUint8Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", @@ -139895,7 +140111,7 @@ "ignore": true }, { - "__docId__": 7021, + "__docId__": 7029, "kind": "variable", "name": "tempFloat32", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", @@ -139916,7 +140132,7 @@ "ignore": true }, { - "__docId__": 7022, + "__docId__": 7030, "kind": "variable", "name": "tempVec3fa", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", @@ -139937,7 +140153,7 @@ "ignore": true }, { - "__docId__": 7023, + "__docId__": 7031, "kind": "variable", "name": "tempFloat32Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", @@ -139958,7 +140174,7 @@ "ignore": true }, { - "__docId__": 7024, + "__docId__": 7032, "kind": "class", "name": "VBOInstancingLinesLayer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js", @@ -139974,7 +140190,7 @@ "ignore": true }, { - "__docId__": 7025, + "__docId__": 7033, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140049,7 +140265,7 @@ ] }, { - "__docId__": 7026, + "__docId__": 7034, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140068,7 +140284,7 @@ } }, { - "__docId__": 7027, + "__docId__": 7035, "kind": "member", "name": "material", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140087,7 +140303,7 @@ } }, { - "__docId__": 7028, + "__docId__": 7036, "kind": "member", "name": "sortId", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140106,7 +140322,7 @@ } }, { - "__docId__": 7029, + "__docId__": 7037, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140125,7 +140341,7 @@ } }, { - "__docId__": 7030, + "__docId__": 7038, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140143,7 +140359,7 @@ } }, { - "__docId__": 7031, + "__docId__": 7039, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140161,7 +140377,7 @@ } }, { - "__docId__": 7032, + "__docId__": 7040, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140179,7 +140395,7 @@ } }, { - "__docId__": 7033, + "__docId__": 7041, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140197,7 +140413,7 @@ } }, { - "__docId__": 7034, + "__docId__": 7042, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140215,7 +140431,7 @@ } }, { - "__docId__": 7035, + "__docId__": 7043, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140233,7 +140449,7 @@ } }, { - "__docId__": 7036, + "__docId__": 7044, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140251,7 +140467,7 @@ } }, { - "__docId__": 7037, + "__docId__": 7045, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140269,7 +140485,7 @@ } }, { - "__docId__": 7038, + "__docId__": 7046, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140287,7 +140503,7 @@ } }, { - "__docId__": 7039, + "__docId__": 7047, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140305,7 +140521,7 @@ } }, { - "__docId__": 7040, + "__docId__": 7048, "kind": "member", "name": "_numEdgesLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140323,7 +140539,7 @@ } }, { - "__docId__": 7041, + "__docId__": 7049, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140341,7 +140557,7 @@ } }, { - "__docId__": 7042, + "__docId__": 7050, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140359,7 +140575,7 @@ } }, { - "__docId__": 7043, + "__docId__": 7051, "kind": "member", "name": "numIndices", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140376,7 +140592,7 @@ } }, { - "__docId__": 7044, + "__docId__": 7052, "kind": "member", "name": "_colors", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140394,7 +140610,7 @@ } }, { - "__docId__": 7045, + "__docId__": 7053, "kind": "member", "name": "_offsets", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140412,7 +140628,7 @@ } }, { - "__docId__": 7046, + "__docId__": 7054, "kind": "member", "name": "_modelMatrixCol0", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140430,7 +140646,7 @@ } }, { - "__docId__": 7047, + "__docId__": 7055, "kind": "member", "name": "_modelMatrixCol1", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140448,7 +140664,7 @@ } }, { - "__docId__": 7048, + "__docId__": 7056, "kind": "member", "name": "_modelMatrixCol2", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140466,7 +140682,7 @@ } }, { - "__docId__": 7049, + "__docId__": 7057, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140484,7 +140700,7 @@ } }, { - "__docId__": 7050, + "__docId__": 7058, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140502,7 +140718,7 @@ } }, { - "__docId__": 7052, + "__docId__": 7060, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140519,7 +140735,7 @@ } }, { - "__docId__": 7053, + "__docId__": 7061, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140537,7 +140753,7 @@ } }, { - "__docId__": 7054, + "__docId__": 7062, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140556,7 +140772,7 @@ } }, { - "__docId__": 7056, + "__docId__": 7064, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140635,7 +140851,7 @@ } }, { - "__docId__": 7057, + "__docId__": 7065, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140651,7 +140867,7 @@ "return": null }, { - "__docId__": 7064, + "__docId__": 7072, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140686,7 +140902,7 @@ "return": null }, { - "__docId__": 7065, + "__docId__": 7073, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140721,7 +140937,7 @@ "return": null }, { - "__docId__": 7066, + "__docId__": 7074, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140756,7 +140972,7 @@ "return": null }, { - "__docId__": 7067, + "__docId__": 7075, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140791,7 +141007,7 @@ "return": null }, { - "__docId__": 7068, + "__docId__": 7076, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140826,7 +141042,7 @@ "return": null }, { - "__docId__": 7069, + "__docId__": 7077, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140861,7 +141077,7 @@ "return": null }, { - "__docId__": 7070, + "__docId__": 7078, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140890,7 +141106,7 @@ "return": null }, { - "__docId__": 7071, + "__docId__": 7079, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140919,7 +141135,7 @@ "return": null }, { - "__docId__": 7072, + "__docId__": 7080, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140954,7 +141170,7 @@ "return": null }, { - "__docId__": 7073, + "__docId__": 7081, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -140989,7 +141205,7 @@ "return": null }, { - "__docId__": 7074, + "__docId__": 7082, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141018,7 +141234,7 @@ "return": null }, { - "__docId__": 7075, + "__docId__": 7083, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141053,7 +141269,7 @@ "return": null }, { - "__docId__": 7076, + "__docId__": 7084, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141088,7 +141304,7 @@ "return": null }, { - "__docId__": 7077, + "__docId__": 7085, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141117,7 +141333,7 @@ "return": null }, { - "__docId__": 7078, + "__docId__": 7086, "kind": "method", "name": "setMatrix", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141146,7 +141362,7 @@ "return": null }, { - "__docId__": 7079, + "__docId__": 7087, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141175,7 +141391,7 @@ "return": null }, { - "__docId__": 7080, + "__docId__": 7088, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141204,7 +141420,7 @@ "return": null }, { - "__docId__": 7081, + "__docId__": 7089, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141233,7 +141449,7 @@ "return": null }, { - "__docId__": 7082, + "__docId__": 7090, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141262,7 +141478,7 @@ "return": null }, { - "__docId__": 7083, + "__docId__": 7091, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141291,7 +141507,7 @@ "return": null }, { - "__docId__": 7084, + "__docId__": 7092, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141320,7 +141536,7 @@ "return": null }, { - "__docId__": 7085, + "__docId__": 7093, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141349,7 +141565,7 @@ "return": null }, { - "__docId__": 7086, + "__docId__": 7094, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141378,7 +141594,7 @@ "return": null }, { - "__docId__": 7087, + "__docId__": 7095, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141407,7 +141623,7 @@ "return": null }, { - "__docId__": 7088, + "__docId__": 7096, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141436,7 +141652,7 @@ "return": null }, { - "__docId__": 7089, + "__docId__": 7097, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141465,7 +141681,7 @@ "return": null }, { - "__docId__": 7090, + "__docId__": 7098, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141494,7 +141710,7 @@ "return": null }, { - "__docId__": 7091, + "__docId__": 7099, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141523,7 +141739,7 @@ "return": null }, { - "__docId__": 7092, + "__docId__": 7100, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141552,7 +141768,7 @@ "return": null }, { - "__docId__": 7093, + "__docId__": 7101, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141581,7 +141797,7 @@ "return": null }, { - "__docId__": 7094, + "__docId__": 7102, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141610,7 +141826,7 @@ "return": null }, { - "__docId__": 7095, + "__docId__": 7103, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141639,7 +141855,7 @@ "return": null }, { - "__docId__": 7096, + "__docId__": 7104, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141668,7 +141884,7 @@ "return": null }, { - "__docId__": 7097, + "__docId__": 7105, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141697,7 +141913,7 @@ "return": null }, { - "__docId__": 7098, + "__docId__": 7106, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js~VBOInstancingLinesLayer", @@ -141713,18 +141929,18 @@ "return": null }, { - "__docId__": 7099, + "__docId__": 7107, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js", "content": "import {VBOInstancingLinesRenderer} from \"./VBOInstancingLinesRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingLinesColorRenderer extends VBOInstancingLinesRenderer {\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, {incrementDrawState: true});\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines instancing color vertex shader\");\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines instancing color fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n\n if (this._withSAO) {\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBAToDepth(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(vColor.rgb * ambient, vColor.a);\");\n } else {\n src.push(\" outColor = vColor;\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7100, + "__docId__": 7108, "kind": "class", "name": "VBOInstancingLinesColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js", @@ -141743,7 +141959,7 @@ "ignore": true }, { - "__docId__": 7101, + "__docId__": 7109, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js~VBOInstancingLinesColorRenderer", @@ -141778,7 +141994,7 @@ "return": null }, { - "__docId__": 7102, + "__docId__": 7110, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js~VBOInstancingLinesColorRenderer", @@ -141799,7 +142015,7 @@ } }, { - "__docId__": 7103, + "__docId__": 7111, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js~VBOInstancingLinesColorRenderer", @@ -141820,18 +142036,18 @@ } }, { - "__docId__": 7104, + "__docId__": 7112, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js", "content": "import {VBORenderer} from \"./../../../VBORenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingLinesRenderer extends VBORenderer {\n constructor(scene, withSAO) {\n super(scene, withSAO, {instancing: true});\n }\n\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState,\n } = drawCfg;\n\n gl.drawElementsInstanced(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);\n\n if (incrementDrawState) {\n frameCtx.drawElements++;\n }\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7105, + "__docId__": 7113, "kind": "class", "name": "VBOInstancingLinesRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js", @@ -141850,7 +142066,7 @@ "ignore": true }, { - "__docId__": 7106, + "__docId__": 7114, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js~VBOInstancingLinesRenderer", @@ -141864,7 +142080,7 @@ "undocument": true }, { - "__docId__": 7107, + "__docId__": 7115, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js~VBOInstancingLinesRenderer", @@ -141888,18 +142104,18 @@ "return": null }, { - "__docId__": 7108, + "__docId__": 7116, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", "content": "import {VBOInstancingLinesColorRenderer} from \"./VBOInstancingLinesColorRenderer.js\";\nimport {VBOInstancingLinesSilhouetteRenderer} from \"./VBOInstancingLinesSilhouetteRenderer.js\";\nimport {VBOInstancingLinesSnapInitRenderer} from \"./VBOInstancingLinesSnapInitRenderer.js\";\nimport {VBOInstancingLinesSnapRenderer} from \"./VBOInstancingLinesSnapRenderer.js\";\n\n/**\n * @private\n */\nclass VBOInstancingLinesRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n eagerCreateRenders() {\n\n // Pre-initialize renderers that would otherwise be lazy-initialised\n // on user interaction, such as picking or emphasis, so that there is no delay\n // when user first begins interacting with the viewer.\n\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new VBOInstancingLinesSnapInitRenderer(this._scene, false);\n }\n if (!this._snapRenderer) {\n this._snapRenderer = new VBOInstancingLinesSnapRenderer(this._scene);\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new VBOInstancingLinesColorRenderer(this._scene);\n }\n return this._colorRenderer;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new VBOInstancingLinesSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new VBOInstancingLinesSnapInitRenderer(this._scene, false);\n }\n return this._snapInitRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new VBOInstancingLinesSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let instancingRenderers = cachedRenderers[sceneId];\n if (!instancingRenderers) {\n instancingRenderers = new VBOInstancingLinesRenderers(scene);\n cachedRenderers[sceneId] = instancingRenderers;\n instancingRenderers._compile();\n scene.on(\"compile\", () => {\n instancingRenderers._compile();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n instancingRenderers._destroy();\n });\n }\n return instancingRenderers;\n}\n\n/*\n\nfunction getSnapInstancingRenderers(scene) {\n const sceneId = scene.id;\n let instancingRenderers = cachedRenderers[sceneId];\n if (!instancingRenderers) {\n instancingRenderers = new VBOInstancingLineSnapRenderers(scene);\n cachedRenderers[sceneId] = instancingRenderers;\n instancingRenderers._compile();\n instancingRenderers.eagerCreateRenders();\n scene.on(\"compile\", () => {\n instancingRenderers._compile();\n instancingRenderers.eagerCreateRenders();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n instancingRenderers._destroy();\n });\n }\n return instancingRenderers;\n}\n\n */\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7109, + "__docId__": 7117, "kind": "class", "name": "VBOInstancingLinesRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", @@ -141915,7 +142131,7 @@ "ignore": true }, { - "__docId__": 7110, + "__docId__": 7118, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -141929,7 +142145,7 @@ "undocument": true }, { - "__docId__": 7111, + "__docId__": 7119, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -141947,7 +142163,7 @@ } }, { - "__docId__": 7112, + "__docId__": 7120, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -141964,7 +142180,7 @@ "return": null }, { - "__docId__": 7113, + "__docId__": 7121, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -141982,7 +142198,7 @@ } }, { - "__docId__": 7114, + "__docId__": 7122, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142000,7 +142216,7 @@ } }, { - "__docId__": 7115, + "__docId__": 7123, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142018,7 +142234,7 @@ } }, { - "__docId__": 7116, + "__docId__": 7124, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142036,7 +142252,7 @@ } }, { - "__docId__": 7117, + "__docId__": 7125, "kind": "method", "name": "eagerCreateRenders", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142052,7 +142268,7 @@ "return": null }, { - "__docId__": 7120, + "__docId__": 7128, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142071,7 +142287,7 @@ } }, { - "__docId__": 7122, + "__docId__": 7130, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142090,7 +142306,7 @@ } }, { - "__docId__": 7124, + "__docId__": 7132, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142109,7 +142325,7 @@ } }, { - "__docId__": 7126, + "__docId__": 7134, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142128,7 +142344,7 @@ } }, { - "__docId__": 7128, + "__docId__": 7136, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js~VBOInstancingLinesRenderers", @@ -142145,7 +142361,7 @@ "return": null }, { - "__docId__": 7129, + "__docId__": 7137, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", @@ -142166,7 +142382,7 @@ "ignore": true }, { - "__docId__": 7130, + "__docId__": 7138, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js", @@ -142196,18 +142412,18 @@ } }, { - "__docId__": 7131, + "__docId__": 7139, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js", "content": "import {VBOInstancingLinesRenderer} from \"./VBOInstancingLinesRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingLinesSilhouetteRenderer extends VBOInstancingLinesRenderer {\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n super.drawLayer(frameCtx, instancingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines instancing silhouette vertex shader\");\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n src.push(\"uniform vec4 color;\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Lines instancing silhouette fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"uniform vec4 color;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = color;\");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7132, + "__docId__": 7140, "kind": "class", "name": "VBOInstancingLinesSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js", @@ -142226,7 +142442,7 @@ "ignore": true }, { - "__docId__": 7133, + "__docId__": 7141, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js~VBOInstancingLinesSilhouetteRenderer", @@ -142261,7 +142477,7 @@ "return": null }, { - "__docId__": 7134, + "__docId__": 7142, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js~VBOInstancingLinesSilhouetteRenderer", @@ -142282,7 +142498,7 @@ } }, { - "__docId__": 7135, + "__docId__": 7143, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js~VBOInstancingLinesSilhouetteRenderer", @@ -142303,18 +142519,18 @@ } }, { - "__docId__": 7136, + "__docId__": 7144, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOInstancingLinesSnapInitRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const gl = scene.canvas.gl;\n const camera = scene.camera;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n\n if (this._aFlags) {\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n }\n\n state.indicesBuf.bind();\n gl.drawElementsInstanced(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);\n state.indicesBuf.unbind();\n\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n if (this._aFlags) {\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n }\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing pick depth fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n ///////////////////////////////////////////\n // TODO: normal placeholder?\n // Primitive type?\n ///////////////////////////////////////////\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\")\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7137, + "__docId__": 7145, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142335,7 +142551,7 @@ "ignore": true }, { - "__docId__": 7138, + "__docId__": 7146, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142356,7 +142572,7 @@ "ignore": true }, { - "__docId__": 7139, + "__docId__": 7147, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142377,7 +142593,7 @@ "ignore": true }, { - "__docId__": 7140, + "__docId__": 7148, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142398,7 +142614,7 @@ "ignore": true }, { - "__docId__": 7141, + "__docId__": 7149, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142419,7 +142635,7 @@ "ignore": true }, { - "__docId__": 7142, + "__docId__": 7150, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142440,7 +142656,7 @@ "ignore": true }, { - "__docId__": 7143, + "__docId__": 7151, "kind": "class", "name": "VBOInstancingLinesSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js", @@ -142459,7 +142675,7 @@ "ignore": true }, { - "__docId__": 7144, + "__docId__": 7152, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142473,7 +142689,7 @@ "undocument": true }, { - "__docId__": 7145, + "__docId__": 7153, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142508,7 +142724,7 @@ "return": null }, { - "__docId__": 7146, + "__docId__": 7154, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142525,7 +142741,7 @@ "return": null }, { - "__docId__": 7147, + "__docId__": 7155, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142543,7 +142759,7 @@ } }, { - "__docId__": 7148, + "__docId__": 7156, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142560,7 +142776,7 @@ } }, { - "__docId__": 7149, + "__docId__": 7157, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142577,7 +142793,7 @@ } }, { - "__docId__": 7150, + "__docId__": 7158, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142595,7 +142811,7 @@ } }, { - "__docId__": 7151, + "__docId__": 7159, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142613,7 +142829,7 @@ } }, { - "__docId__": 7152, + "__docId__": 7160, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142630,7 +142846,7 @@ "return": null }, { - "__docId__": 7153, + "__docId__": 7161, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142651,7 +142867,7 @@ } }, { - "__docId__": 7154, + "__docId__": 7162, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142672,7 +142888,7 @@ } }, { - "__docId__": 7155, + "__docId__": 7163, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142688,7 +142904,7 @@ "return": null }, { - "__docId__": 7156, + "__docId__": 7164, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142706,7 +142922,7 @@ } }, { - "__docId__": 7157, + "__docId__": 7165, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js~VBOInstancingLinesSnapInitRenderer", @@ -142722,18 +142938,18 @@ "return": null }, { - "__docId__": 7159, + "__docId__": 7167, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOInstancingLinesSnapRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate(instancingLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n\n if (frameCtx.snapMode === \"edge\") {\n state.indicesBuf.bind();\n gl.drawElementsInstanced(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);\n state.indicesBuf.unbind(); // needed?\n } else {\n gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);\n }\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7160, + "__docId__": 7168, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142754,7 +142970,7 @@ "ignore": true }, { - "__docId__": 7161, + "__docId__": 7169, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142775,7 +142991,7 @@ "ignore": true }, { - "__docId__": 7162, + "__docId__": 7170, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142796,7 +143012,7 @@ "ignore": true }, { - "__docId__": 7163, + "__docId__": 7171, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142817,7 +143033,7 @@ "ignore": true }, { - "__docId__": 7164, + "__docId__": 7172, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142838,7 +143054,7 @@ "ignore": true }, { - "__docId__": 7165, + "__docId__": 7173, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142859,7 +143075,7 @@ "ignore": true }, { - "__docId__": 7166, + "__docId__": 7174, "kind": "class", "name": "VBOInstancingLinesSnapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js", @@ -142878,7 +143094,7 @@ "ignore": true }, { - "__docId__": 7167, + "__docId__": 7175, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142892,7 +143108,7 @@ "undocument": true }, { - "__docId__": 7168, + "__docId__": 7176, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142927,7 +143143,7 @@ "return": null }, { - "__docId__": 7169, + "__docId__": 7177, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142944,7 +143160,7 @@ "return": null }, { - "__docId__": 7170, + "__docId__": 7178, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142962,7 +143178,7 @@ } }, { - "__docId__": 7171, + "__docId__": 7179, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142979,7 +143195,7 @@ } }, { - "__docId__": 7172, + "__docId__": 7180, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -142996,7 +143212,7 @@ } }, { - "__docId__": 7173, + "__docId__": 7181, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143014,7 +143230,7 @@ } }, { - "__docId__": 7174, + "__docId__": 7182, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143032,7 +143248,7 @@ } }, { - "__docId__": 7175, + "__docId__": 7183, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143049,7 +143265,7 @@ "return": null }, { - "__docId__": 7176, + "__docId__": 7184, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143070,7 +143286,7 @@ } }, { - "__docId__": 7177, + "__docId__": 7185, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143091,7 +143307,7 @@ } }, { - "__docId__": 7178, + "__docId__": 7186, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143107,7 +143323,7 @@ "return": null }, { - "__docId__": 7179, + "__docId__": 7187, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143125,7 +143341,7 @@ } }, { - "__docId__": 7180, + "__docId__": 7188, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js~VBOInstancingLinesSnapRenderer", @@ -143141,18 +143357,18 @@ "return": null }, { - "__docId__": 7182, + "__docId__": 7190, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {getRenderers} from \"./renderers/VBOInstancingPointsRenderers.js\";\n\nconst tempUint8Vec4 = new Uint8Array(4);\nconst tempFloat32 = new Float32Array(1);\nconst tempVec3fa = new Float32Array(3);\n\nconst tempFloat32Vec4 = new Float32Array(4);\n\n/**\n * @private\n */\nexport class VBOInstancingPointsLayer {\n\n /**\n * @param cfg\n * @param cfg.layerIndex\n * @param cfg.model\n * @param cfg.geometry\n * @param cfg.material\n * @param cfg.origin\n */\n constructor(cfg) {\n\n console.info(\"VBOInstancingPointsLayer\");\n\n /**\n * Owner model\n * @type {VBOSceneModel}\n */\n this.model = cfg.model;\n\n /**\n * Shared material\n * @type {VBOSceneModelGeometry}\n */\n this.material = cfg.material;\n\n /**\n * State sorting key.\n * @type {string}\n */\n this.sortId = \"PointsInstancingLayer\";\n\n /**\n * Index of this InstancingLayer in VBOSceneModel#_layerList\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n this._aabb = math.collapseAABB3();\n\n this._state = new RenderState({\n obb: math.OBB3(),\n numInstances: 0,\n origin: cfg.origin ? math.vec3(cfg.origin) : null,\n geometry: cfg.geometry,\n positionsDecodeMatrix: cfg.geometry.positionsDecodeMatrix, // So we can null the geometry for GC\n colorsBuf: null,\n flagsBuf: null,\n offsetsBuf: null,\n modelMatrixCol0Buf: null,\n modelMatrixCol1Buf: null,\n modelMatrixCol2Buf: null,\n pickColorsBuf: null\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numEdgesLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n /** @private */\n this.numIndices = cfg.geometry.numIndices;\n\n // Per-instance arrays\n this._pickColors = [];\n this._offsets = [];\n\n // Modeling matrix per instance, array for each column\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n\n this._portions = [];\n this._meshes = [];\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n this._finalized = false;\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Creates a new portion within this InstancingLayer, returns the new portion ID.\n *\n * The portion will instance this InstancingLayer's geometry.\n *\n * Gives the portion the specified color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg Portion params\n * @param cfg.meshMatrix Flat float 4x4 matrix.\n * @param [cfg.worldMatrix] Flat float 4x4 matrix.\n * @param cfg.pickColor Quantized pick color\n * @returns {number} Portion ID.\n */\n createPortion(mesh, cfg) {\n\n const meshMatrix = cfg.meshMatrix;\n const pickColor = cfg.pickColor;\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n this._offsets.push(0);\n this._offsets.push(0);\n this._offsets.push(0);\n }\n\n this._modelMatrixCol0.push(meshMatrix[0]);\n this._modelMatrixCol0.push(meshMatrix[4]);\n this._modelMatrixCol0.push(meshMatrix[8]);\n this._modelMatrixCol0.push(meshMatrix[12]);\n\n this._modelMatrixCol1.push(meshMatrix[1]);\n this._modelMatrixCol1.push(meshMatrix[5]);\n this._modelMatrixCol1.push(meshMatrix[9]);\n this._modelMatrixCol1.push(meshMatrix[13]);\n\n this._modelMatrixCol2.push(meshMatrix[2]);\n this._modelMatrixCol2.push(meshMatrix[6]);\n this._modelMatrixCol2.push(meshMatrix[10]);\n this._modelMatrixCol2.push(meshMatrix[14]);\n\n // Per-instance pick colors\n\n this._pickColors.push(pickColor[0]);\n this._pickColors.push(pickColor[1]);\n this._pickColors.push(pickColor[2]);\n this._pickColors.push(pickColor[3]);\n\n this._state.numInstances++;\n\n const portionId = this._portions.length;\n this._portions.push({});\n\n this._numPortions++;\n this.model.numPortions++;\n this._meshes.push(mesh);\n return portionId;\n }\n\n finalize() {\n if (this._finalized) {\n throw \"Already finalized\";\n }\n const gl = this.model.scene.canvas.gl;\n const flagsLength = this._pickColors.length / 4;\n const state = this._state;\n const geometry = state.geometry;\n if (flagsLength > 0) {\n // Because we only build flags arrays here, \n // get their length from the colors array\n let notNormalized = false;\n state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(flagsLength), flagsLength, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n if (this.model.scene.entityOffsetsEnabled) {\n if (this._offsets.length > 0) {\n const notNormalized = false;\n state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);\n this._offsets = []; // Release memory\n }\n }\n if (geometry.positionsCompressed && geometry.positionsCompressed.length > 0) {\n const normalized = false;\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, geometry.positionsCompressed, geometry.positionsCompressed.length, 3, gl.STATIC_DRAW, normalized);\n state.positionsDecodeMatrix = math.mat4(geometry.positionsDecodeMatrix);\n }\n if (geometry.colorsCompressed && geometry.colorsCompressed.length > 0) {\n const colorsCompressed = new Uint8Array(geometry.colorsCompressed);\n const notNormalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colorsCompressed, colorsCompressed.length, 4, gl.STATIC_DRAW, notNormalized);\n }\n if (this._modelMatrixCol0.length > 0) {\n const normalized = false;\n state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);\n state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);\n state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n }\n if (this._pickColors.length > 0) {\n const normalized = false;\n state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._pickColors), this._pickColors.length, 4, gl.STATIC_DRAW, normalized);\n this._pickColors = []; // Release memory\n }\n state.geometry = null;\n this._finalized = true;\n }\n\n // The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.\n // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setVisible(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setHighlighted(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setXRayed(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setSelected(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setEdges(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n } else {\n this._numEdgesLayerPortions--;\n this.model.numEdgesLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setCulled(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setColor(portionId, color) { // RGBA color is normalized as ints\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n tempUint8Vec4[0] = color[0];\n tempUint8Vec4[1] = color[1];\n tempUint8Vec4[2] = color[2];\n this._state.colorsBuf.setData(tempUint8Vec4, portionId * 3);\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n // setMatrix(portionId, matrix) {\n\n ////////////////////////////////////////\n // TODO: Update portion matrix\n ////////////////////////////////////////\n //\n // if (!this._finalized) {\n // throw \"Not finalized\";\n // }\n //\n // var offset = portionId * 4;\n //\n // tempFloat32Vec4[0] = matrix[0];\n // tempFloat32Vec4[1] = matrix[4];\n // tempFloat32Vec4[2] = matrix[8];\n // tempFloat32Vec4[3] = matrix[12];\n //\n // this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);\n //\n // tempFloat32Vec4[0] = matrix[1];\n // tempFloat32Vec4[1] = matrix[5];\n // tempFloat32Vec4[2] = matrix[9];\n // tempFloat32Vec4[3] = matrix[13];\n //\n // this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);\n //\n // tempFloat32Vec4[0] = matrix[2];\n // tempFloat32Vec4[1] = matrix[6];\n // tempFloat32Vec4[2] = matrix[10];\n // tempFloat32Vec4[3] = matrix[14];\n //\n // this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);\n // }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, meshTransparent) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n const edges = !!(flags & ENTITY_FLAGS.EDGES);\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (meshTransparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let edgeFlag = 0;\n if (!visible || culled) {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n edgeFlag = RENDER_PASSES.EDGES_SELECTED;\n } else if (highlighted) {\n edgeFlag = RENDER_PASSES.EDGES_HIGHLIGHTED;\n } else if (xrayed) {\n edgeFlag = RENDER_PASSES.EDGES_XRAYED;\n } else if (edges) {\n if (meshTransparent) {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;\n } else {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_OPAQUE;\n }\n } else {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 255 : 0;\n\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n vertFlag |= edgeFlag << 8;\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempFloat32[0] = vertFlag;\n\n this._state.flagsBuf.setData(tempFloat32, portionId);\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n tempVec3fa[0] = offset[0];\n tempVec3fa[1] = offset[1];\n tempVec3fa[2] = offset[2];\n this._state.offsetsBuf.setData(tempVec3fa, portionId * 3);\n }\n\n setMatrix(portionId, matrix) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n const offset = portionId * 4;\n\n tempFloat32Vec4[0] = matrix[0];\n tempFloat32Vec4[1] = matrix[4];\n tempFloat32Vec4[2] = matrix[8];\n tempFloat32Vec4[3] = matrix[12];\n\n this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[1];\n tempFloat32Vec4[1] = matrix[5];\n tempFloat32Vec4[2] = matrix[9];\n tempFloat32Vec4[3] = matrix[13];\n\n this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[2];\n tempFloat32Vec4[1] = matrix[6];\n tempFloat32Vec4[2] = matrix[10];\n tempFloat32Vec4[3] = matrix[14];\n\n this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);\n }\n\n // ---------------------- NORMAL RENDERING -----------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n\n // -- RENDERING SAO POST EFFECT TARGETS ----------------------------------------------------------------------------\n\n drawDepth(renderFlags, frameCtx) {\n }\n\n drawNormals(renderFlags, frameCtx) {\n }\n\n // ---------------------- EMPHASIS RENDERING -----------------------------------\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n //-- EDGES RENDERING -----------------------------------------------------------------------------------------------\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n drawOcclusion(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.occlusionRenderer) {\n // Only opaque, filled objects can be occluders\n this._renderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n drawShadow(renderFlags, frameCtx) {\n }\n\n //---- PICKING ----------------------------------------------------------------------------------------------------\n\n drawPickMesh(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.pickMeshRenderer) {\n this._renderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickDepths(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.pickDepthRenderer) {\n this._renderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickNormals(renderFlags, frameCtx) {\n }\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n destroy() {\n const state = this._state;\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.modelMatrixCol0Buf) {\n state.modelMatrixCol0Buf.destroy();\n state.modelMatrixCol0Buf = null;\n }\n if (state.modelMatrixCol1Buf) {\n state.modelMatrixCol1Buf.destroy();\n state.modelMatrixCol1Buf = null;\n }\n if (state.modelMatrixCol2Buf) {\n state.modelMatrixCol2Buf.destroy();\n state.modelMatrixCol2Buf = null;\n }\n if (state.pickColorsBuf) {\n state.pickColorsBuf.destroy();\n state.pickColorsBuf = null;\n }\n state.destroy();\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7183, + "__docId__": 7191, "kind": "variable", "name": "tempUint8Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", @@ -143173,7 +143389,7 @@ "ignore": true }, { - "__docId__": 7184, + "__docId__": 7192, "kind": "variable", "name": "tempFloat32", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", @@ -143194,7 +143410,7 @@ "ignore": true }, { - "__docId__": 7185, + "__docId__": 7193, "kind": "variable", "name": "tempVec3fa", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", @@ -143215,7 +143431,7 @@ "ignore": true }, { - "__docId__": 7186, + "__docId__": 7194, "kind": "variable", "name": "tempFloat32Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", @@ -143236,7 +143452,7 @@ "ignore": true }, { - "__docId__": 7187, + "__docId__": 7195, "kind": "class", "name": "VBOInstancingPointsLayer", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js", @@ -143252,7 +143468,7 @@ "ignore": true }, { - "__docId__": 7188, + "__docId__": 7196, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143327,7 +143543,7 @@ ] }, { - "__docId__": 7189, + "__docId__": 7197, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143346,7 +143562,7 @@ } }, { - "__docId__": 7190, + "__docId__": 7198, "kind": "member", "name": "material", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143365,7 +143581,7 @@ } }, { - "__docId__": 7191, + "__docId__": 7199, "kind": "member", "name": "sortId", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143384,7 +143600,7 @@ } }, { - "__docId__": 7192, + "__docId__": 7200, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143403,7 +143619,7 @@ } }, { - "__docId__": 7193, + "__docId__": 7201, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143421,7 +143637,7 @@ } }, { - "__docId__": 7194, + "__docId__": 7202, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143439,7 +143655,7 @@ } }, { - "__docId__": 7195, + "__docId__": 7203, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143457,7 +143673,7 @@ } }, { - "__docId__": 7196, + "__docId__": 7204, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143475,7 +143691,7 @@ } }, { - "__docId__": 7197, + "__docId__": 7205, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143493,7 +143709,7 @@ } }, { - "__docId__": 7198, + "__docId__": 7206, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143511,7 +143727,7 @@ } }, { - "__docId__": 7199, + "__docId__": 7207, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143529,7 +143745,7 @@ } }, { - "__docId__": 7200, + "__docId__": 7208, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143547,7 +143763,7 @@ } }, { - "__docId__": 7201, + "__docId__": 7209, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143565,7 +143781,7 @@ } }, { - "__docId__": 7202, + "__docId__": 7210, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143583,7 +143799,7 @@ } }, { - "__docId__": 7203, + "__docId__": 7211, "kind": "member", "name": "_numEdgesLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143601,7 +143817,7 @@ } }, { - "__docId__": 7204, + "__docId__": 7212, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143619,7 +143835,7 @@ } }, { - "__docId__": 7205, + "__docId__": 7213, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143637,7 +143853,7 @@ } }, { - "__docId__": 7206, + "__docId__": 7214, "kind": "member", "name": "numIndices", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143654,7 +143870,7 @@ } }, { - "__docId__": 7207, + "__docId__": 7215, "kind": "member", "name": "_pickColors", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143672,7 +143888,7 @@ } }, { - "__docId__": 7208, + "__docId__": 7216, "kind": "member", "name": "_offsets", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143690,7 +143906,7 @@ } }, { - "__docId__": 7209, + "__docId__": 7217, "kind": "member", "name": "_modelMatrixCol0", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143708,7 +143924,7 @@ } }, { - "__docId__": 7210, + "__docId__": 7218, "kind": "member", "name": "_modelMatrixCol1", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143726,7 +143942,7 @@ } }, { - "__docId__": 7211, + "__docId__": 7219, "kind": "member", "name": "_modelMatrixCol2", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143744,7 +143960,7 @@ } }, { - "__docId__": 7212, + "__docId__": 7220, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143762,7 +143978,7 @@ } }, { - "__docId__": 7213, + "__docId__": 7221, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143780,7 +143996,7 @@ } }, { - "__docId__": 7215, + "__docId__": 7223, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143797,7 +144013,7 @@ } }, { - "__docId__": 7216, + "__docId__": 7224, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143815,7 +144031,7 @@ } }, { - "__docId__": 7217, + "__docId__": 7225, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143834,7 +144050,7 @@ } }, { - "__docId__": 7219, + "__docId__": 7227, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143913,7 +144129,7 @@ } }, { - "__docId__": 7220, + "__docId__": 7228, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143929,7 +144145,7 @@ "return": null }, { - "__docId__": 7227, + "__docId__": 7235, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143964,7 +144180,7 @@ "return": null }, { - "__docId__": 7228, + "__docId__": 7236, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -143999,7 +144215,7 @@ "return": null }, { - "__docId__": 7229, + "__docId__": 7237, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144034,7 +144250,7 @@ "return": null }, { - "__docId__": 7230, + "__docId__": 7238, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144069,7 +144285,7 @@ "return": null }, { - "__docId__": 7231, + "__docId__": 7239, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144104,7 +144320,7 @@ "return": null }, { - "__docId__": 7232, + "__docId__": 7240, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144139,7 +144355,7 @@ "return": null }, { - "__docId__": 7233, + "__docId__": 7241, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144168,7 +144384,7 @@ "return": null }, { - "__docId__": 7234, + "__docId__": 7242, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144197,7 +144413,7 @@ "return": null }, { - "__docId__": 7235, + "__docId__": 7243, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144232,7 +144448,7 @@ "return": null }, { - "__docId__": 7236, + "__docId__": 7244, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144267,7 +144483,7 @@ "return": null }, { - "__docId__": 7237, + "__docId__": 7245, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144296,7 +144512,7 @@ "return": null }, { - "__docId__": 7238, + "__docId__": 7246, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144331,7 +144547,7 @@ "return": null }, { - "__docId__": 7239, + "__docId__": 7247, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144366,7 +144582,7 @@ "return": null }, { - "__docId__": 7240, + "__docId__": 7248, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144395,7 +144611,7 @@ "return": null }, { - "__docId__": 7241, + "__docId__": 7249, "kind": "method", "name": "setMatrix", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144424,7 +144640,7 @@ "return": null }, { - "__docId__": 7242, + "__docId__": 7250, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144453,7 +144669,7 @@ "return": null }, { - "__docId__": 7243, + "__docId__": 7251, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144482,7 +144698,7 @@ "return": null }, { - "__docId__": 7244, + "__docId__": 7252, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144511,7 +144727,7 @@ "return": null }, { - "__docId__": 7245, + "__docId__": 7253, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144540,7 +144756,7 @@ "return": null }, { - "__docId__": 7246, + "__docId__": 7254, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144569,7 +144785,7 @@ "return": null }, { - "__docId__": 7247, + "__docId__": 7255, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144598,7 +144814,7 @@ "return": null }, { - "__docId__": 7248, + "__docId__": 7256, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144627,7 +144843,7 @@ "return": null }, { - "__docId__": 7249, + "__docId__": 7257, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144656,7 +144872,7 @@ "return": null }, { - "__docId__": 7250, + "__docId__": 7258, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144685,7 +144901,7 @@ "return": null }, { - "__docId__": 7251, + "__docId__": 7259, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144714,7 +144930,7 @@ "return": null }, { - "__docId__": 7252, + "__docId__": 7260, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144743,7 +144959,7 @@ "return": null }, { - "__docId__": 7253, + "__docId__": 7261, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144772,7 +144988,7 @@ "return": null }, { - "__docId__": 7254, + "__docId__": 7262, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144801,7 +145017,7 @@ "return": null }, { - "__docId__": 7255, + "__docId__": 7263, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144830,7 +145046,7 @@ "return": null }, { - "__docId__": 7256, + "__docId__": 7264, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144859,7 +145075,7 @@ "return": null }, { - "__docId__": 7257, + "__docId__": 7265, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144888,7 +145104,7 @@ "return": null }, { - "__docId__": 7258, + "__docId__": 7266, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144917,7 +145133,7 @@ "return": null }, { - "__docId__": 7259, + "__docId__": 7267, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144946,7 +145162,7 @@ "return": null }, { - "__docId__": 7260, + "__docId__": 7268, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144975,7 +145191,7 @@ "return": null }, { - "__docId__": 7261, + "__docId__": 7269, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js~VBOInstancingPointsLayer", @@ -144991,18 +145207,18 @@ "return": null }, { - "__docId__": 7262, + "__docId__": 7270, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nclass VBOInstancingPointsColorRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing color vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (pointsMaterial.filterIntensity) {\n src.push(\"uniform vec2 intensityRange;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n if (pointsMaterial.filterIntensity) {\n src.push(\"float intensity = float(color.a) / 255.0;\")\n src.push(\"if (intensity < intensityRange[0] || intensity > intensityRange[1]) {\");\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n }\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, 1.0);\");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n if (pointsMaterial.filterIntensity) {\n src.push(\"}\");\n }\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing color fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vColor;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n\nexport {VBOInstancingPointsColorRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7263, + "__docId__": 7271, "kind": "class", "name": "VBOInstancingPointsColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js", @@ -145021,7 +145237,7 @@ "ignore": true }, { - "__docId__": 7264, + "__docId__": 7272, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js~VBOInstancingPointsColorRenderer", @@ -145042,7 +145258,7 @@ } }, { - "__docId__": 7265, + "__docId__": 7273, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js~VBOInstancingPointsColorRenderer", @@ -145077,7 +145293,7 @@ "return": null }, { - "__docId__": 7266, + "__docId__": 7274, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js~VBOInstancingPointsColorRenderer", @@ -145098,7 +145314,7 @@ } }, { - "__docId__": 7267, + "__docId__": 7275, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js~VBOInstancingPointsColorRenderer", @@ -145119,18 +145335,18 @@ } }, { - "__docId__": 7268, + "__docId__": 7276, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nclass VBOInstancingPointsDepthRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing depth vertex shader\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing depth vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n src.push(\"const float packUpScale = 256. / 255.;\");\n src.push(\"const float unpackDownscale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );\");\n src.push(\"const float shiftRight8 = 1.0 / 256.;\");\n\n src.push(\"vec4 packDepthToRGBA( const in float v ) {\");\n src.push(\" vec4 r = vec4( fract( v * packFactors ), v );\");\n src.push(\" r.yzw -= r.xyz * shiftRight8;\");\n src.push(\" return r * packUpScale;\");\n src.push(\"}\");\n\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = packDepthToRGBA( gl_FragCoord.z); \"); // Must be linear depth\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n\nexport {VBOInstancingPointsDepthRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7269, + "__docId__": 7277, "kind": "class", "name": "VBOInstancingPointsDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js", @@ -145149,7 +145365,7 @@ "ignore": true }, { - "__docId__": 7270, + "__docId__": 7278, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js~VBOInstancingPointsDepthRenderer", @@ -145170,7 +145386,7 @@ } }, { - "__docId__": 7271, + "__docId__": 7279, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js~VBOInstancingPointsDepthRenderer", @@ -145191,7 +145407,7 @@ } }, { - "__docId__": 7272, + "__docId__": 7280, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js~VBOInstancingPointsDepthRenderer", @@ -145212,18 +145428,18 @@ } }, { - "__docId__": 7273, + "__docId__": 7281, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingPointsOcclusionRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n\n src.push ('#version 300 es');\n src.push(\"// Points instancing occlusion vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing occlusion vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7274, + "__docId__": 7282, "kind": "class", "name": "VBOInstancingPointsOcclusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js", @@ -145242,7 +145458,7 @@ "ignore": true }, { - "__docId__": 7275, + "__docId__": 7283, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js~VBOInstancingPointsOcclusionRenderer", @@ -145263,7 +145479,7 @@ } }, { - "__docId__": 7276, + "__docId__": 7284, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js~VBOInstancingPointsOcclusionRenderer", @@ -145284,7 +145500,7 @@ } }, { - "__docId__": 7277, + "__docId__": 7285, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js~VBOInstancingPointsOcclusionRenderer", @@ -145305,18 +145521,18 @@ } }, { - "__docId__": 7278, + "__docId__": 7286, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class VBOInstancingPointsPickDepthRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n\n src.push('#version 300 es');\n src.push(\"// Points instancing pick depth vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\" vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing pick depth fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform float pickZNear;\");\n src.push(\"uniform float pickZFar;\");\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"vec4 packDepth(const in float depth) {\");\n src.push(\" const vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\");\n src.push(\" vec4 res = fract(depth * bitShift);\");\n src.push(\" res -= res.xxyz * bitMask;\");\n src.push(\" return res;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));\");\n src.push(\" outColor = packDepth(zNormalizedDepth); \"); // Must be linear depth\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7279, + "__docId__": 7287, "kind": "class", "name": "VBOInstancingPointsPickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js", @@ -145335,7 +145551,7 @@ "ignore": true }, { - "__docId__": 7280, + "__docId__": 7288, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js~VBOInstancingPointsPickDepthRenderer", @@ -145356,7 +145572,7 @@ } }, { - "__docId__": 7281, + "__docId__": 7289, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js~VBOInstancingPointsPickDepthRenderer", @@ -145377,7 +145593,7 @@ } }, { - "__docId__": 7282, + "__docId__": 7290, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js~VBOInstancingPointsPickDepthRenderer", @@ -145398,18 +145614,18 @@ } }, { - "__docId__": 7283, + "__docId__": 7291, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingPointsPickMeshRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing pick mesh vertex shader\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 pickColor;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vPickColor;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing pick mesh fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vPickColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vPickColor; \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7284, + "__docId__": 7292, "kind": "class", "name": "VBOInstancingPointsPickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js", @@ -145428,7 +145644,7 @@ "ignore": true }, { - "__docId__": 7285, + "__docId__": 7293, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js~VBOInstancingPointsPickMeshRenderer", @@ -145449,7 +145665,7 @@ } }, { - "__docId__": 7286, + "__docId__": 7294, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js~VBOInstancingPointsPickMeshRenderer", @@ -145470,7 +145686,7 @@ } }, { - "__docId__": 7287, + "__docId__": 7295, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js~VBOInstancingPointsPickMeshRenderer", @@ -145491,18 +145707,18 @@ } }, { - "__docId__": 7288, + "__docId__": 7296, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js", "content": "import {VBORenderer} from \"./../../../VBORenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingPointsRenderer extends VBORenderer {\n constructor(scene, withSAO) {\n super(scene, withSAO, {instancing: true});\n }\n\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState,\n } = drawCfg;\n\n gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);\n\n if (incrementDrawState) {\n frameCtx.drawArrays++;\n }\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7289, + "__docId__": 7297, "kind": "class", "name": "VBOInstancingPointsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js", @@ -145521,7 +145737,7 @@ "ignore": true }, { - "__docId__": 7290, + "__docId__": 7298, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js~VBOInstancingPointsRenderer", @@ -145535,7 +145751,7 @@ "undocument": true }, { - "__docId__": 7291, + "__docId__": 7299, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js~VBOInstancingPointsRenderer", @@ -145559,18 +145775,18 @@ "return": null }, { - "__docId__": 7292, + "__docId__": 7300, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", "content": "import {VBOInstancingPointsColorRenderer} from \"./VBOInstancingPointsColorRenderer.js\";\nimport {VBOInstancingPointsSilhouetteRenderer} from \"./VBOInstancingPointsSilhouetteRenderer.js\";\nimport {VBOInstancingPointsPickMeshRenderer} from \"./VBOInstancingPointsPickMeshRenderer.js\";\nimport {VBOInstancingPointsPickDepthRenderer} from \"./VBOInstancingPointsPickDepthRenderer.js\";\nimport {VBOInstancingPointsOcclusionRenderer} from \"./VBOInstancingPointsOcclusionRenderer.js\";\nimport {VBOInstancingPointsDepthRenderer} from \"./VBOInstancingPointsDepthRenderer.js\";\nimport {VBOInstancingPointsShadowRenderer} from \"./VBOInstancingPointsShadowRenderer.js\";\nimport {VBOInstancingPointsSnapInitRenderer} from \"./VBOInstancingPointsSnapInitRenderer.js\";\nimport {VBOInstancingPointsSnapRenderer} from \"./VBOInstancingPointsSnapRenderer.js\";\n\n/**\n * @private\n */\n class VBOInstancingPointsRenderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._depthRenderer && (!this._depthRenderer.getValid())) {\n this._depthRenderer.destroy();\n this._depthRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._pickMeshRenderer && (!this._pickMeshRenderer.getValid())) {\n this._pickMeshRenderer.destroy();\n this._pickMeshRenderer = null;\n }\n if (this._pickDepthRenderer && (!this._pickDepthRenderer.getValid())) {\n this._pickDepthRenderer.destroy();\n this._pickDepthRenderer = null;\n }\n if (this._occlusionRenderer && this._occlusionRenderer.getValid() === false) {\n this._occlusionRenderer.destroy();\n this._occlusionRenderer = null;\n }\n if (this._shadowRenderer && (!this._shadowRenderer.getValid())) {\n this._shadowRenderer.destroy();\n this._shadowRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new VBOInstancingPointsColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new VBOInstancingPointsSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get depthRenderer() {\n if (!this._depthRenderer) {\n this._depthRenderer = new VBOInstancingPointsDepthRenderer(this._scene);\n }\n return this._depthRenderer;\n }\n\n get pickMeshRenderer() {\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new VBOInstancingPointsPickMeshRenderer(this._scene);\n }\n return this._pickMeshRenderer;\n }\n\n get pickDepthRenderer() {\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new VBOInstancingPointsPickDepthRenderer(this._scene);\n }\n return this._pickDepthRenderer;\n }\n\n get occlusionRenderer() {\n if (!this._occlusionRenderer) {\n this._occlusionRenderer = new VBOInstancingPointsOcclusionRenderer(this._scene);\n }\n return this._occlusionRenderer;\n }\n\n get shadowRenderer() {\n if (!this._shadowRenderer) {\n this._shadowRenderer = new VBOInstancingPointsShadowRenderer(this._scene);\n }\n return this._shadowRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new VBOInstancingPointsSnapInitRenderer(this._scene, false);\n }\n return this._snapInitRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new VBOInstancingPointsSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._depthRenderer) {\n this._depthRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.destroy();\n }\n if (this._pickDepthRenderer) {\n this._pickDepthRenderer.destroy();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.destroy();\n }\n if (this._shadowRenderer) {\n this._shadowRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let instancingRenderers = cachedRenderers[sceneId];\n if (!instancingRenderers) {\n instancingRenderers = new VBOInstancingPointsRenderers(scene);\n cachedRenderers[sceneId] = instancingRenderers;\n instancingRenderers._compile();\n scene.on(\"compile\", () => {\n instancingRenderers._compile();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n instancingRenderers._destroy();\n });\n }\n return instancingRenderers;\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7293, + "__docId__": 7301, "kind": "class", "name": "VBOInstancingPointsRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", @@ -145586,7 +145802,7 @@ "ignore": true }, { - "__docId__": 7294, + "__docId__": 7302, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145600,7 +145816,7 @@ "undocument": true }, { - "__docId__": 7295, + "__docId__": 7303, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145618,7 +145834,7 @@ } }, { - "__docId__": 7296, + "__docId__": 7304, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145635,7 +145851,7 @@ "return": null }, { - "__docId__": 7297, + "__docId__": 7305, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145653,7 +145869,7 @@ } }, { - "__docId__": 7298, + "__docId__": 7306, "kind": "member", "name": "_depthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145671,7 +145887,7 @@ } }, { - "__docId__": 7299, + "__docId__": 7307, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145689,7 +145905,7 @@ } }, { - "__docId__": 7300, + "__docId__": 7308, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145707,7 +145923,7 @@ } }, { - "__docId__": 7301, + "__docId__": 7309, "kind": "member", "name": "_pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145725,7 +145941,7 @@ } }, { - "__docId__": 7302, + "__docId__": 7310, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145743,7 +145959,7 @@ } }, { - "__docId__": 7303, + "__docId__": 7311, "kind": "member", "name": "_shadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145761,7 +145977,7 @@ } }, { - "__docId__": 7304, + "__docId__": 7312, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145779,7 +145995,7 @@ } }, { - "__docId__": 7305, + "__docId__": 7313, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145797,7 +146013,7 @@ } }, { - "__docId__": 7306, + "__docId__": 7314, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145816,7 +146032,7 @@ } }, { - "__docId__": 7308, + "__docId__": 7316, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145835,7 +146051,7 @@ } }, { - "__docId__": 7310, + "__docId__": 7318, "kind": "get", "name": "depthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145854,7 +146070,7 @@ } }, { - "__docId__": 7312, + "__docId__": 7320, "kind": "get", "name": "pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145873,7 +146089,7 @@ } }, { - "__docId__": 7314, + "__docId__": 7322, "kind": "get", "name": "pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145892,7 +146108,7 @@ } }, { - "__docId__": 7316, + "__docId__": 7324, "kind": "get", "name": "occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145911,7 +146127,7 @@ } }, { - "__docId__": 7318, + "__docId__": 7326, "kind": "get", "name": "shadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145930,7 +146146,7 @@ } }, { - "__docId__": 7320, + "__docId__": 7328, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145949,7 +146165,7 @@ } }, { - "__docId__": 7322, + "__docId__": 7330, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145968,7 +146184,7 @@ } }, { - "__docId__": 7324, + "__docId__": 7332, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js~VBOInstancingPointsRenderers", @@ -145985,7 +146201,7 @@ "return": null }, { - "__docId__": 7325, + "__docId__": 7333, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", @@ -146006,7 +146222,7 @@ "ignore": true }, { - "__docId__": 7326, + "__docId__": 7334, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js", @@ -146036,18 +146252,18 @@ } }, { - "__docId__": 7327, + "__docId__": 7335, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * Renders InstancingLayer fragment depths to a shadow map.\n *\n * @private\n */\nexport class VBOInstancingPointsShadowRenderer extends VBOInstancingPointsRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Instancing geometry shadow drawing vertex shader\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform mat4 shadowViewMatrix;\");\n src.push(\"uniform mat4 shadowProjMatrix;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n src.push(\"int colorFlag = int(flags) & 0xF;\");\n src.push(\"bool visible = (colorFlag > 0);\");\n src.push(\"bool transparent = ((float(color.a) / 255.0) < 1.0);\");\n src.push(`if (!visible || transparent) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = shadowViewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\" gl_Position = shadowProjMatrix * viewPosition;\");\n src.push(\"}\");\n src.push(\"gl_PointSize = pointSize;\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Instancing geometry depth drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7328, + "__docId__": 7336, "kind": "class", "name": "VBOInstancingPointsShadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js", @@ -146066,7 +146282,7 @@ "ignore": true }, { - "__docId__": 7329, + "__docId__": 7337, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js~VBOInstancingPointsShadowRenderer", @@ -146087,7 +146303,7 @@ } }, { - "__docId__": 7330, + "__docId__": 7338, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js~VBOInstancingPointsShadowRenderer", @@ -146108,18 +146324,18 @@ } }, { - "__docId__": 7331, + "__docId__": 7339, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingPointsSilhouetteRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n super.drawLayer(frameCtx, instancingLayer, renderPass, {colorUniform: true});\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing silhouette vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 color;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n src.push(\"uniform vec4 silhouetteColor;\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n src.push(\"vColor = vec4(float(silhouetteColor.r) / 255.0, float(silhouetteColor.g) / 255.0, float(silhouetteColor.b) / 255.0, float(color.a) / 255.0);\");\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing silhouette fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7332, + "__docId__": 7340, "kind": "class", "name": "VBOInstancingPointsSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js", @@ -146138,7 +146354,7 @@ "ignore": true }, { - "__docId__": 7333, + "__docId__": 7341, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js~VBOInstancingPointsSilhouetteRenderer", @@ -146159,7 +146375,7 @@ } }, { - "__docId__": 7334, + "__docId__": 7342, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js~VBOInstancingPointsSilhouetteRenderer", @@ -146194,7 +146410,7 @@ "return": null }, { - "__docId__": 7335, + "__docId__": 7343, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js~VBOInstancingPointsSilhouetteRenderer", @@ -146215,7 +146431,7 @@ } }, { - "__docId__": 7336, + "__docId__": 7344, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js~VBOInstancingPointsSilhouetteRenderer", @@ -146236,18 +146452,18 @@ } }, { - "__docId__": 7337, + "__docId__": 7345, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOInstancingPointsSnapInitRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const gl = scene.canvas.gl;\n const camera = scene.camera;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n\n if (this._aFlags) {\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n }\n\n gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);\n\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n if (this._aFlags) {\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n }\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing pick depth fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\")\n // src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n // src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n // src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(1.0, 1.0, 1.0, 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7338, + "__docId__": 7346, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146268,7 +146484,7 @@ "ignore": true }, { - "__docId__": 7339, + "__docId__": 7347, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146289,7 +146505,7 @@ "ignore": true }, { - "__docId__": 7340, + "__docId__": 7348, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146310,7 +146526,7 @@ "ignore": true }, { - "__docId__": 7341, + "__docId__": 7349, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146331,7 +146547,7 @@ "ignore": true }, { - "__docId__": 7342, + "__docId__": 7350, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146352,7 +146568,7 @@ "ignore": true }, { - "__docId__": 7343, + "__docId__": 7351, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146373,7 +146589,7 @@ "ignore": true }, { - "__docId__": 7344, + "__docId__": 7352, "kind": "class", "name": "VBOInstancingPointsSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js", @@ -146392,7 +146608,7 @@ "ignore": true }, { - "__docId__": 7345, + "__docId__": 7353, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146406,7 +146622,7 @@ "undocument": true }, { - "__docId__": 7346, + "__docId__": 7354, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146441,7 +146657,7 @@ "return": null }, { - "__docId__": 7347, + "__docId__": 7355, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146458,7 +146674,7 @@ "return": null }, { - "__docId__": 7348, + "__docId__": 7356, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146476,7 +146692,7 @@ } }, { - "__docId__": 7349, + "__docId__": 7357, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146493,7 +146709,7 @@ } }, { - "__docId__": 7350, + "__docId__": 7358, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146510,7 +146726,7 @@ } }, { - "__docId__": 7351, + "__docId__": 7359, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146528,7 +146744,7 @@ } }, { - "__docId__": 7352, + "__docId__": 7360, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146546,7 +146762,7 @@ } }, { - "__docId__": 7353, + "__docId__": 7361, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146563,7 +146779,7 @@ "return": null }, { - "__docId__": 7354, + "__docId__": 7362, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146584,7 +146800,7 @@ } }, { - "__docId__": 7355, + "__docId__": 7363, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146605,7 +146821,7 @@ } }, { - "__docId__": 7356, + "__docId__": 7364, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146621,7 +146837,7 @@ "return": null }, { - "__docId__": 7357, + "__docId__": 7365, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146639,7 +146855,7 @@ } }, { - "__docId__": 7358, + "__docId__": 7366, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js~VBOInstancingPointsSnapInitRenderer", @@ -146655,18 +146871,18 @@ "return": null }, { - "__docId__": 7360, + "__docId__": 7368, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class VBOInstancingPointsSnapRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate(instancingLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n\n gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);\n\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7361, + "__docId__": 7369, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146687,7 +146903,7 @@ "ignore": true }, { - "__docId__": 7362, + "__docId__": 7370, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146708,7 +146924,7 @@ "ignore": true }, { - "__docId__": 7363, + "__docId__": 7371, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146729,7 +146945,7 @@ "ignore": true }, { - "__docId__": 7364, + "__docId__": 7372, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146750,7 +146966,7 @@ "ignore": true }, { - "__docId__": 7365, + "__docId__": 7373, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146771,7 +146987,7 @@ "ignore": true }, { - "__docId__": 7366, + "__docId__": 7374, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146792,7 +147008,7 @@ "ignore": true }, { - "__docId__": 7367, + "__docId__": 7375, "kind": "class", "name": "VBOInstancingPointsSnapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js", @@ -146811,7 +147027,7 @@ "ignore": true }, { - "__docId__": 7368, + "__docId__": 7376, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146825,7 +147041,7 @@ "undocument": true }, { - "__docId__": 7369, + "__docId__": 7377, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146860,7 +147076,7 @@ "return": null }, { - "__docId__": 7370, + "__docId__": 7378, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146877,7 +147093,7 @@ "return": null }, { - "__docId__": 7371, + "__docId__": 7379, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146895,7 +147111,7 @@ } }, { - "__docId__": 7372, + "__docId__": 7380, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146912,7 +147128,7 @@ } }, { - "__docId__": 7373, + "__docId__": 7381, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146929,7 +147145,7 @@ } }, { - "__docId__": 7374, + "__docId__": 7382, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146947,7 +147163,7 @@ } }, { - "__docId__": 7375, + "__docId__": 7383, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146965,7 +147181,7 @@ } }, { - "__docId__": 7376, + "__docId__": 7384, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -146982,7 +147198,7 @@ "return": null }, { - "__docId__": 7377, + "__docId__": 7385, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -147003,7 +147219,7 @@ } }, { - "__docId__": 7378, + "__docId__": 7386, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -147024,7 +147240,7 @@ } }, { - "__docId__": 7379, + "__docId__": 7387, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -147040,7 +147256,7 @@ "return": null }, { - "__docId__": 7380, + "__docId__": 7388, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -147058,7 +147274,7 @@ } }, { - "__docId__": 7381, + "__docId__": 7389, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js~VBOInstancingPointsSnapRenderer", @@ -147074,18 +147290,18 @@ "return": null }, { - "__docId__": 7383, + "__docId__": 7391, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js", "content": "import {VBOInstancingPointsRenderer} from \"./VBOInstancingPointsRenderer.js\";\n\n/**\n * @private\n */\nexport class VBOInstancingTrianglesRenderer extends VBOInstancingPointsRenderer {\n _getHash() {\n return this._scene._sectionPlanesState.getHash() + this._scene.pointsMaterial.hash;\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const pointsMaterial = scene.pointsMaterial._state;\n const src = [];\n\n src.push('#version 300 es');\n src.push(\"// Points instancing occlusion vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform float pointSize;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"uniform float nearPlaneHeight;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n if (pointsMaterial.perspectivePoints) {\n src.push(\"gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;\");\n src.push(\"gl_PointSize = max(gl_PointSize, \" + Math.floor(pointsMaterial.minPerspectivePointSize) + \".0);\");\n src.push(\"gl_PointSize = min(gl_PointSize, \" + Math.floor(pointsMaterial.maxPerspectivePointSize) + \".0);\");\n } else {\n src.push(\"gl_PointSize = pointSize;\");\n }\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push('#version 300 es');\n src.push(\"// Points instancing occlusion vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (scene.pointsMaterial.roundPoints) {\n src.push(\" vec2 cxy = 2.0 * gl_PointCoord - 1.0;\");\n src.push(\" float r = dot(cxy, cxy);\");\n src.push(\" if (r > 1.0) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n }\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7384, + "__docId__": 7392, "kind": "class", "name": "VBOInstancingTrianglesRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js", @@ -147104,7 +147320,7 @@ "ignore": true }, { - "__docId__": 7385, + "__docId__": 7393, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js~VBOInstancingTrianglesRenderer", @@ -147125,7 +147341,7 @@ } }, { - "__docId__": 7386, + "__docId__": 7394, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js~VBOInstancingTrianglesRenderer", @@ -147146,7 +147362,7 @@ } }, { - "__docId__": 7387, + "__docId__": 7395, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js~VBOInstancingTrianglesRenderer", @@ -147167,18 +147383,18 @@ } }, { - "__docId__": 7388, + "__docId__": 7396, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", "content": "import {ENTITY_FLAGS} from '../../../ENTITY_FLAGS.js';\nimport {RENDER_PASSES} from '../../../RENDER_PASSES.js';\n\nimport {math} from \"../../../../math/math.js\";\nimport {RenderState} from \"../../../../webgl/RenderState.js\";\nimport {ArrayBuf} from \"../../../../webgl/ArrayBuf.js\";\nimport {getRenderers} from \"./renderers/Renderers.js\";\n\nconst tempUint8Vec4 = new Uint8Array(4);\nconst tempFloat32 = new Float32Array(1);\nconst tempVec4a = math.vec4([0, 0, 0, 1]);\nconst tempVec3fa = new Float32Array(3);\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempVec3e = math.vec3();\nconst tempVec3f = math.vec3();\nconst tempVec3g = math.vec3();\n\nconst tempFloat32Vec4 = new Float32Array(4);\n\n/**\n * @private\n */\nexport class VBOInstancingTrianglesLayer {\n\n /**\n * @param cfg\n * @param cfg.layerIndex\n * @param cfg.model\n * @param cfg.geometry\n * @param cfg.textureSet\n * @param cfg.origin\n */\n constructor(cfg) {\n\n console.info(\"Creating VBOInstancingTrianglesLayer\");\n\n /**\n * Owner model\n * @type {VBOSceneModel}\n */\n this.model = cfg.model;\n\n /**\n * State sorting key.\n * @type {string}\n */\n this.sortId = \"TrianglesInstancingLayer\" + (cfg.solid ? \"-solid\" : \"-surface\") + (cfg.normals ? \"-normals\" : \"-autoNormals\");\n\n /**\n * Index of this InstancingLayer in VBOSceneModel#_layerList\n * @type {Number}\n */\n this.layerIndex = cfg.layerIndex;\n\n this._renderers = getRenderers(cfg.model.scene);\n\n this._aabb = math.collapseAABB3();\n\n this._state = new RenderState({\n numInstances: 0,\n obb: math.OBB3(),\n origin: math.vec3(),\n geometry: cfg.geometry,\n textureSet: cfg.textureSet,\n pbrSupported: false, // Set in #finalize if we have enough to support quality rendering\n positionsDecodeMatrix: cfg.geometry.positionsDecodeMatrix, // So we can null the geometry for GC\n colorsBuf: null,\n metallicRoughnessBuf: null,\n flagsBuf: null,\n offsetsBuf: null,\n modelMatrixBuf: null,\n modelMatrixCol0Buf: null,\n modelMatrixCol1Buf: null,\n modelMatrixCol2Buf: null,\n modelNormalMatrixCol0Buf: null,\n modelNormalMatrixCol1Buf: null,\n modelNormalMatrixCol2Buf: null,\n pickColorsBuf: null\n });\n\n // These counts are used to avoid unnecessary render passes\n this._numPortions = 0;\n this._numVisibleLayerPortions = 0;\n this._numTransparentLayerPortions = 0;\n this._numXRayedLayerPortions = 0;\n this._numHighlightedLayerPortions = 0;\n this._numSelectedLayerPortions = 0;\n this._numClippableLayerPortions = 0;\n this._numEdgesLayerPortions = 0;\n this._numPickableLayerPortions = 0;\n this._numCulledLayerPortions = 0;\n\n /** @private */\n this.numIndices = cfg.geometry.numIndices;\n\n // Vertex arrays\n this._colors = [];\n this._metallicRoughness = [];\n this._pickColors = [];\n this._offsets = [];\n\n // Modeling matrix per instance, array for each column\n\n this._modelMatrix = [];\n\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n\n // Modeling normal matrix per instance, array for each column\n this._modelNormalMatrixCol0 = [];\n this._modelNormalMatrixCol1 = [];\n this._modelNormalMatrixCol2 = [];\n\n this._portions = [];\n this._meshes = [];\n\n this._aabb = math.collapseAABB3();\n this.aabbDirty = true;\n\n if (cfg.origin) {\n this._state.origin.set(cfg.origin);\n }\n\n this._finalized = false;\n\n /**\n * When true, this layer contains solid triangle meshes, otherwise this layer contains surface triangle meshes\n * @type {boolean}\n */\n this.solid = !!cfg.solid;\n\n /**\n * The number of indices in this layer.\n * @type {number|*}\n */\n this.numIndices = cfg.geometry.numIndices;\n }\n\n get aabb() {\n if (this.aabbDirty) {\n math.collapseAABB3(this._aabb);\n for (let i = 0, len = this._meshes.length; i < len; i++) {\n math.expandAABB3(this._aabb, this._meshes[i].aabb);\n }\n this.aabbDirty = false;\n }\n return this._aabb;\n }\n\n /**\n * Creates a new portion within this InstancingLayer, returns the new portion ID.\n *\n * The portion will instance this InstancingLayer's geometry.\n *\n * Gives the portion the specified color and matrix.\n *\n * @param mesh The SceneModelMesh that owns the portion\n * @param cfg Portion params\n * @param cfg.color Color [0..255,0..255,0..255]\n * @param cfg.metallic Metalness factor [0..255]\n * @param cfg.roughness Roughness factor [0..255]\n * @param cfg.opacity Opacity [0..255].\n * @param cfg.meshMatrix Flat float 4x4 matrix.\n * @param [cfg.worldMatrix] Flat float 4x4 matrix.\n * @param cfg.pickColor Quantized pick color\n * @returns {number} Portion ID.\n */\n createPortion(mesh, cfg) {\n\n const color = cfg.color;\n const metallic = cfg.metallic;\n const roughness = cfg.roughness;\n const opacity = cfg.opacity !== null && cfg.opacity !== undefined ? cfg.opacity : 255;\n const meshMatrix = cfg.meshMatrix;\n const pickColor = cfg.pickColor;\n\n if (this._finalized) {\n throw \"Already finalized\";\n }\n\n const r = color[0]; // Color is pre-quantized by SceneModel\n const g = color[1];\n const b = color[2];\n\n this._colors.push(r);\n this._colors.push(g);\n this._colors.push(b);\n this._colors.push(opacity);\n\n this._metallicRoughness.push((metallic !== null && metallic !== undefined) ? metallic : 0);\n this._metallicRoughness.push((roughness !== null && roughness !== undefined) ? roughness : 255);\n\n if (this.model.scene.entityOffsetsEnabled) {\n this._offsets.push(0);\n this._offsets.push(0);\n this._offsets.push(0);\n }\n\n this._modelMatrixCol0.push(meshMatrix[0]);\n this._modelMatrixCol0.push(meshMatrix[4]);\n this._modelMatrixCol0.push(meshMatrix[8]);\n this._modelMatrixCol0.push(meshMatrix[12]);\n\n this._modelMatrixCol1.push(meshMatrix[1]);\n this._modelMatrixCol1.push(meshMatrix[5]);\n this._modelMatrixCol1.push(meshMatrix[9]);\n this._modelMatrixCol1.push(meshMatrix[13]);\n\n this._modelMatrixCol2.push(meshMatrix[2]);\n this._modelMatrixCol2.push(meshMatrix[6]);\n this._modelMatrixCol2.push(meshMatrix[10]);\n this._modelMatrixCol2.push(meshMatrix[14]);\n\n if (this._state.geometry.normals) {\n\n // Note: order of inverse and transpose doesn't matter\n\n let transposedMat = math.transposeMat4(meshMatrix, math.mat4()); // TODO: Use cached matrix\n let normalMatrix = math.inverseMat4(transposedMat);\n\n this._modelNormalMatrixCol0.push(normalMatrix[0]);\n this._modelNormalMatrixCol0.push(normalMatrix[4]);\n this._modelNormalMatrixCol0.push(normalMatrix[8]);\n this._modelNormalMatrixCol0.push(normalMatrix[12]);\n\n this._modelNormalMatrixCol1.push(normalMatrix[1]);\n this._modelNormalMatrixCol1.push(normalMatrix[5]);\n this._modelNormalMatrixCol1.push(normalMatrix[9]);\n this._modelNormalMatrixCol1.push(normalMatrix[13]);\n\n this._modelNormalMatrixCol2.push(normalMatrix[2]);\n this._modelNormalMatrixCol2.push(normalMatrix[6]);\n this._modelNormalMatrixCol2.push(normalMatrix[10]);\n this._modelNormalMatrixCol2.push(normalMatrix[14]);\n }\n\n // Per-vertex pick colors\n\n this._pickColors.push(pickColor[0]);\n this._pickColors.push(pickColor[1]);\n this._pickColors.push(pickColor[2]);\n this._pickColors.push(pickColor[3]);\n\n this._state.numInstances++;\n\n const portionId = this._portions.length;\n\n const portion = {};\n\n if (this.model.scene.pickSurfacePrecisionEnabled) {\n portion.matrix = meshMatrix.slice();\n portion.inverseMatrix = null; // Lazy-computed in precisionRayPickSurface\n portion.normalMatrix = null; // Lazy-computed in precisionRayPickSurface\n }\n\n this._portions.push(portion);\n\n this._numPortions++;\n this.model.numPortions++;\n this._meshes.push(mesh);\n return portionId;\n }\n\n finalize() {\n\n if (this._finalized) {\n return;\n }\n\n const state = this._state;\n const geometry = state.geometry;\n const textureSet = state.textureSet;\n const gl = this.model.scene.canvas.gl;\n const colorsLength = this._colors.length;\n const flagsLength = colorsLength / 4;\n\n if (colorsLength > 0) {\n let notNormalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._colors), this._colors.length, 4, gl.DYNAMIC_DRAW, notNormalized);\n this._colors = []; // Release memory\n }\n\n if (this._metallicRoughness.length > 0) {\n const metallicRoughness = new Uint8Array(this._metallicRoughness);\n let normalized = false;\n state.metallicRoughnessBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, metallicRoughness, this._metallicRoughness.length, 2, gl.STATIC_DRAW, normalized);\n }\n\n if (flagsLength > 0) {\n // Because we only build flags arrays here,\n // get their length from the colors array\n let notNormalized = false;\n state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(flagsLength), flagsLength, 1, gl.DYNAMIC_DRAW, notNormalized);\n }\n\n if (this.model.scene.entityOffsetsEnabled) {\n if (this._offsets.length > 0) {\n const notNormalized = false;\n state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);\n this._offsets = []; // Release memory\n }\n }\n\n if (geometry.positionsCompressed && geometry.positionsCompressed.length > 0) {\n const normalized = false;\n state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, geometry.positionsCompressed, geometry.positionsCompressed.length, 3, gl.STATIC_DRAW, normalized);\n state.positionsDecodeMatrix = math.mat4(geometry.positionsDecodeMatrix);\n }\n // if (geometry.normalsCompressed && geometry.normalsCompressed.length > 0) {\n // const normalized = true; // For oct-encoded UInt8\n // state.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, geometry.normalsCompressed, geometry.normalsCompressed.length, 3, gl.STATIC_DRAW, normalized);\n // }\n if (geometry.colorsCompressed && geometry.colorsCompressed.length > 0) {\n const colorsCompressed = new Uint8Array(geometry.colorsCompressed);\n const notNormalized = false;\n state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colorsCompressed, colorsCompressed.length, 4, gl.STATIC_DRAW, notNormalized);\n }\n if (geometry.uvCompressed && geometry.uvCompressed.length > 0) {\n const uvCompressed = geometry.uvCompressed;\n state.uvDecodeMatrix = geometry.uvDecodeMatrix;\n state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uvCompressed, uvCompressed.length, 2, gl.STATIC_DRAW, false);\n }\n if (geometry.indices && geometry.indices.length > 0) {\n state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(geometry.indices), geometry.indices.length, 1, gl.STATIC_DRAW);\n state.numIndices = geometry.indices.length;\n }\n if (geometry.primitive === \"triangles\" || geometry.primitive === \"solid\" || geometry.primitive === \"surface\") {\n state.edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(geometry.edgeIndices), geometry.edgeIndices.length, 1, gl.STATIC_DRAW);\n }\n\n if (this._modelMatrixCol0.length > 0) {\n\n const normalized = false;\n\n state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);\n state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);\n state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);\n this._modelMatrixCol0 = [];\n this._modelMatrixCol1 = [];\n this._modelMatrixCol2 = [];\n\n if (state.normalsBuf) {\n state.modelNormalMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol0), this._modelNormalMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);\n state.modelNormalMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol1), this._modelNormalMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);\n state.modelNormalMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol2), this._modelNormalMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);\n this._modelNormalMatrixCol0 = [];\n this._modelNormalMatrixCol1 = [];\n this._modelNormalMatrixCol2 = [];\n }\n }\n\n if (this._pickColors.length > 0) {\n const normalized = false;\n state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._pickColors), this._pickColors.length, 4, gl.STATIC_DRAW, normalized);\n this._pickColors = []; // Release memory\n }\n\n state.pbrSupported\n = !!state.metallicRoughnessBuf\n && !!state.uvBuf\n && !!state.normalsBuf\n && !!textureSet\n && !!textureSet.colorTexture\n && !!textureSet.metallicRoughnessTexture;\n\n state.colorTextureSupported\n = !!state.uvBuf\n && !!textureSet\n && !!textureSet.colorTexture;\n\n this._state.geometry = null;\n\n this._finalized = true;\n }\n\n // The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.\n // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.\n\n initFlags(portionId, flags, meshTransparent) {\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n }\n if (meshTransparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setVisible(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.VISIBLE) {\n this._numVisibleLayerPortions++;\n this.model.numVisibleLayerPortions++;\n } else {\n this._numVisibleLayerPortions--;\n this.model.numVisibleLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setHighlighted(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.HIGHLIGHTED) {\n this._numHighlightedLayerPortions++;\n this.model.numHighlightedLayerPortions++;\n } else {\n this._numHighlightedLayerPortions--;\n this.model.numHighlightedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setXRayed(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.XRAYED) {\n this._numXRayedLayerPortions++;\n this.model.numXRayedLayerPortions++;\n } else {\n this._numXRayedLayerPortions--;\n this.model.numXRayedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setSelected(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.SELECTED) {\n this._numSelectedLayerPortions++;\n this.model.numSelectedLayerPortions++;\n } else {\n this._numSelectedLayerPortions--;\n this.model.numSelectedLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setEdges(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.EDGES) {\n this._numEdgesLayerPortions++;\n this.model.numEdgesLayerPortions++;\n } else {\n this._numEdgesLayerPortions--;\n this.model.numEdgesLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setClippable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CLIPPABLE) {\n this._numClippableLayerPortions++;\n this.model.numClippableLayerPortions++;\n } else {\n this._numClippableLayerPortions--;\n this.model.numClippableLayerPortions--;\n }\n this._setFlags(portionId, flags);\n }\n\n setCollidable(portionId, flags) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n }\n\n setPickable(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.PICKABLE) {\n this._numPickableLayerPortions++;\n this.model.numPickableLayerPortions++;\n } else {\n this._numPickableLayerPortions--;\n this.model.numPickableLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setCulled(portionId, flags, meshTransparent) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (flags & ENTITY_FLAGS.CULLED) {\n this._numCulledLayerPortions++;\n this.model.numCulledLayerPortions++;\n } else {\n this._numCulledLayerPortions--;\n this.model.numCulledLayerPortions--;\n }\n this._setFlags(portionId, flags, meshTransparent);\n }\n\n setColor(portionId, color) { // RGBA color is normalized as ints\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n tempUint8Vec4[0] = color[0];\n tempUint8Vec4[1] = color[1];\n tempUint8Vec4[2] = color[2];\n tempUint8Vec4[3] = color[3];\n if (this._state.colorsBuf) {\n this._state.colorsBuf.setData(tempUint8Vec4, portionId * 4);\n }\n }\n\n setTransparent(portionId, flags, transparent) {\n if (transparent) {\n this._numTransparentLayerPortions++;\n this.model.numTransparentLayerPortions++;\n } else {\n this._numTransparentLayerPortions--;\n this.model.numTransparentLayerPortions--;\n }\n this._setFlags(portionId, flags, transparent);\n }\n\n // setMatrix(portionId, matrix) {\n //\n // if (!this._finalized) {\n // throw \"Not finalized\";\n // }\n //\n // var offset = portionId * 4;\n //\n // tempFloat32Vec4[0] = matrix[0];\n // tempFloat32Vec4[1] = matrix[4];\n // tempFloat32Vec4[2] = matrix[8];\n // tempFloat32Vec4[3] = matrix[12];\n //\n // this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);\n //\n // tempFloat32Vec4[0] = matrix[1];\n // tempFloat32Vec4[1] = matrix[5];\n // tempFloat32Vec4[2] = matrix[9];\n // tempFloat32Vec4[3] = matrix[13];\n //\n // this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);\n //\n // tempFloat32Vec4[0] = matrix[2];\n // tempFloat32Vec4[1] = matrix[6];\n // tempFloat32Vec4[2] = matrix[10];\n // tempFloat32Vec4[3] = matrix[14];\n //\n // this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);\n // }\n\n /**\n * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.\n */\n _setFlags(portionId, flags, meshTransparent) {\n\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n const visible = !!(flags & ENTITY_FLAGS.VISIBLE);\n const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);\n const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);\n const selected = !!(flags & ENTITY_FLAGS.SELECTED);\n const edges = !!(flags & ENTITY_FLAGS.EDGES);\n const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);\n const culled = !!(flags & ENTITY_FLAGS.CULLED);\n\n let colorFlag;\n if (!visible || culled || xrayed\n || (highlighted && !this.model.scene.highlightMaterial.glowThrough)\n || (selected && !this.model.scene.selectedMaterial.glowThrough)) {\n colorFlag = RENDER_PASSES.NOT_RENDERED;\n } else {\n if (meshTransparent) {\n colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;\n } else {\n colorFlag = RENDER_PASSES.COLOR_OPAQUE;\n }\n }\n\n let silhouetteFlag;\n if (!visible || culled) {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;\n } else if (highlighted) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;\n } else if (xrayed) {\n silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;\n } else {\n silhouetteFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n let edgeFlag = 0;\n if (!visible || culled) {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n } else if (selected) {\n edgeFlag = RENDER_PASSES.EDGES_SELECTED;\n } else if (highlighted) {\n edgeFlag = RENDER_PASSES.EDGES_HIGHLIGHTED;\n } else if (xrayed) {\n edgeFlag = RENDER_PASSES.EDGES_XRAYED;\n } else if (edges) {\n if (meshTransparent) {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;\n } else {\n edgeFlag = RENDER_PASSES.EDGES_COLOR_OPAQUE;\n }\n } else {\n edgeFlag = RENDER_PASSES.NOT_RENDERED;\n }\n\n const pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;\n\n const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 1 : 0;\n\n let vertFlag = 0;\n vertFlag |= colorFlag;\n vertFlag |= silhouetteFlag << 4;\n vertFlag |= edgeFlag << 8;\n vertFlag |= pickFlag << 12;\n vertFlag |= clippableFlag << 16;\n\n tempFloat32[0] = vertFlag;\n\n if (this._state.flagsBuf) {\n this._state.flagsBuf.setData(tempFloat32, portionId);\n }\n }\n\n setOffset(portionId, offset) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n if (!this.model.scene.entityOffsetsEnabled) {\n this.model.error(\"Entity#offset not enabled for this Viewer\"); // See Viewer entityOffsetsEnabled\n return;\n }\n tempVec3fa[0] = offset[0];\n tempVec3fa[1] = offset[1];\n tempVec3fa[2] = offset[2];\n if (this._state.offsetsBuf) {\n this._state.offsetsBuf.setData(tempVec3fa, portionId * 3);\n }\n }\n\n getEachVertex(portionId, callback) {\n if (!this.model.scene.pickSurfacePrecisionEnabled) {\n return false;\n }\n const state = this._state;\n const geometry = state.geometry;\n const portion = this._portions[portionId];\n if (!portion) {\n this.model.error(\"portion not found: \" + portionId);\n return;\n }\n const positions = geometry.quantizedPositions;\n const origin = state.origin;\n const offset = portion.offset;\n const offsetX = origin[0] + offset[0];\n const offsetY = origin[1] + offset[1];\n const offsetZ = origin[2] + offset[2];\n const worldPos = tempVec4a;\n const portionMatrix = portion.matrix;\n const sceneModelPatrix = this.model.sceneModelMatrix;\n const positionsDecodeMatrix = state.positionsDecodeMatrix;\n for (let i = 0, len = positions.length; i < len; i += 3) {\n worldPos[0] = positions[i];\n worldPos[1] = positions[i + 1];\n worldPos[2] = positions[i + 2];\n math.decompressPosition(worldPos, positionsDecodeMatrix);\n math.transformPoint3(portionMatrix, worldPos);\n math.transformPoint3(sceneModelPatrix, worldPos);\n worldPos[0] += offsetX;\n worldPos[1] += offsetY;\n worldPos[2] += offsetZ;\n callback(worldPos);\n }\n }\n\n setMatrix(portionId, matrix) {\n if (!this._finalized) {\n throw \"Not finalized\";\n }\n\n ////////////////////////////////////////\n // TODO: Update portion matrix\n ////////////////////////////////////////\n\n var offset = portionId * 4;\n\n tempFloat32Vec4[0] = matrix[0];\n tempFloat32Vec4[1] = matrix[4];\n tempFloat32Vec4[2] = matrix[8];\n tempFloat32Vec4[3] = matrix[12];\n\n this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[1];\n tempFloat32Vec4[1] = matrix[5];\n tempFloat32Vec4[2] = matrix[9];\n tempFloat32Vec4[3] = matrix[13];\n\n this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);\n\n tempFloat32Vec4[0] = matrix[2];\n tempFloat32Vec4[1] = matrix[6];\n tempFloat32Vec4[2] = matrix[10];\n tempFloat32Vec4[3] = matrix[14];\n\n this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);\n }\n\n // ---------------------- COLOR RENDERING -----------------------------------\n\n drawColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (frameCtx.withSAO && this.model.saoEnabled) {\n if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRendererWithSAO) {\n this._renderers.pbrRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRendererWithSAO) {\n this._renderers.colorTextureRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRendererWithSAO) {\n this._renderers.colorRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else {\n if (this._renderers.flatColorRendererWithSAO) {\n this._renderers.flatColorRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n } else if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRenderer) {\n this._renderers.pbrRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRenderer) {\n this._renderers.colorTextureRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n } else {\n if (this._renderers.flatColorRenderer) {\n this._renderers.flatColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n }\n\n _updateBackfaceCull(renderFlags, frameCtx) {\n const backfaces = this.model.backfaces || (!this.solid) || renderFlags.sectioned;\n if (frameCtx.backfaces !== backfaces) {\n const gl = frameCtx.gl;\n if (backfaces) {\n gl.disable(gl.CULL_FACE);\n } else {\n gl.enable(gl.CULL_FACE);\n }\n frameCtx.backfaces = backfaces;\n }\n }\n\n drawColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (frameCtx.pbrEnabled && this.model.pbrEnabled && this._state.pbrSupported) {\n if (this._renderers.pbrRenderer) {\n this._renderers.pbrRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else if (frameCtx.colorTextureEnabled && this.model.colorTextureEnabled && this._state.colorTextureSupported) {\n if (this._renderers.colorTextureRenderer) {\n this._renderers.colorTextureRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else if (this._state.normalsBuf) {\n if (this._renderers.colorRenderer) {\n this._renderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n } else {\n if (this._renderers.flatColorRenderer) {\n this._renderers.flatColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);\n }\n }\n }\n\n // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------\n\n drawDepth(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.depthRenderer) {\n this._renderers.depthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects\n }\n }\n\n drawNormals(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.normalsRenderer) {\n this._renderers.normalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses normals (eg SAO) does not apply to transparent objects\n }\n }\n\n // ---------------------- SILHOUETTE RENDERING -----------------------------------\n\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);\n }\n }\n\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);\n }\n }\n\n drawSilhouetteSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.silhouetteRenderer) {\n this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);\n }\n }\n\n // ---------------------- EDGES RENDERING -----------------------------------\n\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesColorRenderer) {\n this._renderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_OPAQUE);\n }\n }\n\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesColorRenderer) {\n this._renderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_TRANSPARENT);\n }\n }\n\n drawEdgesXRayed(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_XRAYED);\n }\n }\n\n drawEdgesHighlighted(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_HIGHLIGHTED);\n }\n }\n\n drawEdgesSelected(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {\n return;\n }\n if (this._renderers.edgesRenderer) {\n this._renderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_SELECTED);\n }\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n drawOcclusion(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.occlusionRenderer) {\n // Only opaque, filled objects can be occluders\n this._renderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n drawShadow(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.shadowRenderer) {\n this._renderers.shadowRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);\n }\n }\n\n //---- PICKING ----------------------------------------------------------------------------------------------------\n\n drawPickMesh(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.pickMeshRenderer) {\n this._renderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickDepths(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.pickDepthRenderer) {\n this._renderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawPickNormals(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n\n ////////////////////////////////////////////////////////////////////////////////////////////////////\n // TODO\n // if (this._state.normalsBuf) {\n // if (this._renderers.pickNormalsRenderer) {\n // this._renderers.pickNormalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n // }\n ////////////////////////////////////////////////////////////////////////////////////////////////////\n // } else {\n if (this._renderers.pickNormalsFlatRenderer) {\n this._renderers.pickNormalsFlatRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n // }\n }\n\n drawSnapInit(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.snapInitRenderer) {\n this._renderers.snapInitRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n drawSnap(renderFlags, frameCtx) {\n if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {\n return;\n }\n this._updateBackfaceCull(renderFlags, frameCtx);\n if (this._renderers.snapRenderer) {\n this._renderers.snapRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);\n }\n }\n\n //-----------------------------------------------------------------------------------------\n\n precisionRayPickSurface(portionId, worldRayOrigin, worldRayDir, worldSurfacePos, worldNormal) {\n\n if (!this.model.scene.pickSurfacePrecisionEnabled) {\n return false;\n }\n\n const geometry = this._state.geometry;\n const state = this._state;\n const portion = this._portions[portionId];\n\n if (!portion) {\n this.model.error(\"portion not found: \" + portionId);\n return false;\n }\n\n if (!portion.inverseMatrix) {\n portion.inverseMatrix = math.inverseMat4(portion.matrix, math.mat4());\n }\n\n if (worldNormal && !portion.normalMatrix) {\n portion.normalMatrix = math.transposeMat4(portion.inverseMatrix, math.mat4());\n }\n\n const quantizedPositions = geometry.quantizedPositions;\n const indices = geometry.indices;\n const origin = state.origin;\n const offset = portion.offset;\n\n const rtcRayOrigin = tempVec3a;\n const rtcRayDir = tempVec3b;\n\n rtcRayOrigin.set(origin ? math.subVec3(worldRayOrigin, origin, tempVec3c) : worldRayOrigin); // World -> RTC\n rtcRayDir.set(worldRayDir);\n\n if (offset) {\n math.subVec3(rtcRayOrigin, offset);\n }\n\n math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);\n\n math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);\n\n const a = tempVec3d;\n const b = tempVec3e;\n const c = tempVec3f;\n\n let gotIntersect = false;\n let closestDist = 0;\n const closestIntersectPos = tempVec3g;\n\n for (let i = 0, len = indices.length; i < len; i += 3) {\n\n const ia = indices[i + 0] * 3;\n const ib = indices[i + 1] * 3;\n const ic = indices[i + 2] * 3;\n\n a[0] = quantizedPositions[ia];\n a[1] = quantizedPositions[ia + 1];\n a[2] = quantizedPositions[ia + 2];\n\n b[0] = quantizedPositions[ib];\n b[1] = quantizedPositions[ib + 1];\n b[2] = quantizedPositions[ib + 2];\n\n c[0] = quantizedPositions[ic];\n c[1] = quantizedPositions[ic + 1];\n c[2] = quantizedPositions[ic + 2];\n\n const {positionsDecodeMatrix} = state.geometry;\n\n math.decompressPosition(a, positionsDecodeMatrix);\n math.decompressPosition(b, positionsDecodeMatrix);\n math.decompressPosition(c, positionsDecodeMatrix);\n\n if (math.rayTriangleIntersect(rtcRayOrigin, rtcRayDir, a, b, c, closestIntersectPos)) {\n\n math.transformPoint3(portion.matrix, closestIntersectPos, closestIntersectPos);\n\n math.transformPoint3(this.model.worldMatrix, closestIntersectPos, closestIntersectPos);\n\n if (offset) {\n math.addVec3(closestIntersectPos, offset);\n }\n\n if (origin) {\n math.addVec3(closestIntersectPos, origin);\n }\n\n const dist = Math.abs(math.lenVec3(math.subVec3(closestIntersectPos, worldRayOrigin, [])));\n\n if (!gotIntersect || dist > closestDist) {\n closestDist = dist;\n worldSurfacePos.set(closestIntersectPos);\n if (worldNormal) { // Not that wasteful to eagerly compute - unlikely to hit >2 surfaces on most geometry\n math.triangleNormal(a, b, c, worldNormal);\n }\n gotIntersect = true;\n }\n }\n }\n\n if (gotIntersect && worldNormal) {\n math.transformVec3(portion.normalMatrix, worldNormal, worldNormal);\n math.transformVec3(this.model.worldNormalMatrix, worldNormal, worldNormal);\n math.normalizeVec3(worldNormal);\n }\n\n return gotIntersect;\n }\n\n destroy() {\n const state = this._state;\n if (state.colorsBuf) {\n state.colorsBuf.destroy();\n state.colorsBuf = null;\n }\n if (state.metallicRoughnessBuf) {\n state.metallicRoughnessBuf.destroy();\n state.metallicRoughnessBuf = null;\n }\n if (state.flagsBuf) {\n state.flagsBuf.destroy();\n state.flagsBuf = null;\n }\n if (state.offsetsBuf) {\n state.offsetsBuf.destroy();\n state.offsetsBuf = null;\n }\n if (state.modelMatrixCol0Buf) {\n state.modelMatrixCol0Buf.destroy();\n state.modelMatrixCol0Buf = null;\n }\n if (state.modelMatrixCol1Buf) {\n state.modelMatrixCol1Buf.destroy();\n state.modelMatrixCol1Buf = null;\n }\n if (state.modelMatrixCol2Buf) {\n state.modelMatrixCol2Buf.destroy();\n state.modelMatrixCol2Buf = null;\n }\n if (state.modelNormalMatrixCol0Buf) {\n state.modelNormalMatrixCol0Buf.destroy();\n state.modelNormalMatrixCol0Buf = null;\n }\n if (state.modelNormalMatrixCol1Buf) {\n state.modelNormalMatrixCol1Buf.destroy();\n state.modelNormalMatrixCol1Buf = null;\n }\n if (state.modelNormalMatrixCol2Buf) {\n state.modelNormalMatrixCol2Buf.destroy();\n state.modelNormalMatrixCol2Buf = null;\n }\n if (state.pickColorsBuf) {\n state.pickColorsBuf.destroy();\n state.pickColorsBuf = null;\n }\n state.destroy();\n this._state = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7389, + "__docId__": 7397, "kind": "variable", "name": "tempUint8Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147199,7 +147415,7 @@ "ignore": true }, { - "__docId__": 7390, + "__docId__": 7398, "kind": "variable", "name": "tempFloat32", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147220,7 +147436,7 @@ "ignore": true }, { - "__docId__": 7391, + "__docId__": 7399, "kind": "variable", "name": "tempVec4a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147241,7 +147457,7 @@ "ignore": true }, { - "__docId__": 7392, + "__docId__": 7400, "kind": "variable", "name": "tempVec3fa", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147262,7 +147478,7 @@ "ignore": true }, { - "__docId__": 7393, + "__docId__": 7401, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147283,7 +147499,7 @@ "ignore": true }, { - "__docId__": 7394, + "__docId__": 7402, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147304,7 +147520,7 @@ "ignore": true }, { - "__docId__": 7395, + "__docId__": 7403, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147325,7 +147541,7 @@ "ignore": true }, { - "__docId__": 7396, + "__docId__": 7404, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147346,7 +147562,7 @@ "ignore": true }, { - "__docId__": 7397, + "__docId__": 7405, "kind": "variable", "name": "tempVec3e", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147367,7 +147583,7 @@ "ignore": true }, { - "__docId__": 7398, + "__docId__": 7406, "kind": "variable", "name": "tempVec3f", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147388,7 +147604,7 @@ "ignore": true }, { - "__docId__": 7399, + "__docId__": 7407, "kind": "variable", "name": "tempVec3g", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147409,7 +147625,7 @@ "ignore": true }, { - "__docId__": 7400, + "__docId__": 7408, "kind": "variable", "name": "tempFloat32Vec4", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147430,7 +147646,7 @@ "ignore": true }, { - "__docId__": 7401, + "__docId__": 7409, "kind": "class", "name": "VBOInstancingTrianglesLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js", @@ -147446,7 +147662,7 @@ "ignore": true }, { - "__docId__": 7402, + "__docId__": 7410, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147521,7 +147737,7 @@ ] }, { - "__docId__": 7403, + "__docId__": 7411, "kind": "member", "name": "model", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147540,7 +147756,7 @@ } }, { - "__docId__": 7404, + "__docId__": 7412, "kind": "member", "name": "sortId", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147559,7 +147775,7 @@ } }, { - "__docId__": 7405, + "__docId__": 7413, "kind": "member", "name": "layerIndex", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147578,7 +147794,7 @@ } }, { - "__docId__": 7406, + "__docId__": 7414, "kind": "member", "name": "_renderers", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147596,7 +147812,7 @@ } }, { - "__docId__": 7407, + "__docId__": 7415, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147614,7 +147830,7 @@ } }, { - "__docId__": 7408, + "__docId__": 7416, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147632,7 +147848,7 @@ } }, { - "__docId__": 7409, + "__docId__": 7417, "kind": "member", "name": "_numPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147650,7 +147866,7 @@ } }, { - "__docId__": 7410, + "__docId__": 7418, "kind": "member", "name": "_numVisibleLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147668,7 +147884,7 @@ } }, { - "__docId__": 7411, + "__docId__": 7419, "kind": "member", "name": "_numTransparentLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147686,7 +147902,7 @@ } }, { - "__docId__": 7412, + "__docId__": 7420, "kind": "member", "name": "_numXRayedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147704,7 +147920,7 @@ } }, { - "__docId__": 7413, + "__docId__": 7421, "kind": "member", "name": "_numHighlightedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147722,7 +147938,7 @@ } }, { - "__docId__": 7414, + "__docId__": 7422, "kind": "member", "name": "_numSelectedLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147740,7 +147956,7 @@ } }, { - "__docId__": 7415, + "__docId__": 7423, "kind": "member", "name": "_numClippableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147758,7 +147974,7 @@ } }, { - "__docId__": 7416, + "__docId__": 7424, "kind": "member", "name": "_numEdgesLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147776,7 +147992,7 @@ } }, { - "__docId__": 7417, + "__docId__": 7425, "kind": "member", "name": "_numPickableLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147794,7 +148010,7 @@ } }, { - "__docId__": 7418, + "__docId__": 7426, "kind": "member", "name": "_numCulledLayerPortions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147812,7 +148028,7 @@ } }, { - "__docId__": 7419, + "__docId__": 7427, "kind": "member", "name": "numIndices", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147829,7 +148045,7 @@ } }, { - "__docId__": 7420, + "__docId__": 7428, "kind": "member", "name": "_colors", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147847,7 +148063,7 @@ } }, { - "__docId__": 7421, + "__docId__": 7429, "kind": "member", "name": "_metallicRoughness", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147865,7 +148081,7 @@ } }, { - "__docId__": 7422, + "__docId__": 7430, "kind": "member", "name": "_pickColors", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147883,7 +148099,7 @@ } }, { - "__docId__": 7423, + "__docId__": 7431, "kind": "member", "name": "_offsets", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147901,7 +148117,7 @@ } }, { - "__docId__": 7424, + "__docId__": 7432, "kind": "member", "name": "_modelMatrix", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147919,7 +148135,7 @@ } }, { - "__docId__": 7425, + "__docId__": 7433, "kind": "member", "name": "_modelMatrixCol0", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147937,7 +148153,7 @@ } }, { - "__docId__": 7426, + "__docId__": 7434, "kind": "member", "name": "_modelMatrixCol1", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147955,7 +148171,7 @@ } }, { - "__docId__": 7427, + "__docId__": 7435, "kind": "member", "name": "_modelMatrixCol2", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147973,7 +148189,7 @@ } }, { - "__docId__": 7428, + "__docId__": 7436, "kind": "member", "name": "_modelNormalMatrixCol0", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -147991,7 +148207,7 @@ } }, { - "__docId__": 7429, + "__docId__": 7437, "kind": "member", "name": "_modelNormalMatrixCol1", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148009,7 +148225,7 @@ } }, { - "__docId__": 7430, + "__docId__": 7438, "kind": "member", "name": "_modelNormalMatrixCol2", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148027,7 +148243,7 @@ } }, { - "__docId__": 7431, + "__docId__": 7439, "kind": "member", "name": "_portions", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148045,7 +148261,7 @@ } }, { - "__docId__": 7432, + "__docId__": 7440, "kind": "member", "name": "_meshes", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148063,7 +148279,7 @@ } }, { - "__docId__": 7434, + "__docId__": 7442, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148080,7 +148296,7 @@ } }, { - "__docId__": 7435, + "__docId__": 7443, "kind": "member", "name": "_finalized", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148098,7 +148314,7 @@ } }, { - "__docId__": 7436, + "__docId__": 7444, "kind": "member", "name": "solid", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148117,7 +148333,7 @@ } }, { - "__docId__": 7438, + "__docId__": 7446, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148136,7 +148352,7 @@ } }, { - "__docId__": 7440, + "__docId__": 7448, "kind": "method", "name": "createPortion", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148255,7 +148471,7 @@ } }, { - "__docId__": 7441, + "__docId__": 7449, "kind": "method", "name": "finalize", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148271,7 +148487,7 @@ "return": null }, { - "__docId__": 7452, + "__docId__": 7460, "kind": "method", "name": "initFlags", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148306,7 +148522,7 @@ "return": null }, { - "__docId__": 7453, + "__docId__": 7461, "kind": "method", "name": "setVisible", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148341,7 +148557,7 @@ "return": null }, { - "__docId__": 7454, + "__docId__": 7462, "kind": "method", "name": "setHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148376,7 +148592,7 @@ "return": null }, { - "__docId__": 7455, + "__docId__": 7463, "kind": "method", "name": "setXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148411,7 +148627,7 @@ "return": null }, { - "__docId__": 7456, + "__docId__": 7464, "kind": "method", "name": "setSelected", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148446,7 +148662,7 @@ "return": null }, { - "__docId__": 7457, + "__docId__": 7465, "kind": "method", "name": "setEdges", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148481,7 +148697,7 @@ "return": null }, { - "__docId__": 7458, + "__docId__": 7466, "kind": "method", "name": "setClippable", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148510,7 +148726,7 @@ "return": null }, { - "__docId__": 7459, + "__docId__": 7467, "kind": "method", "name": "setCollidable", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148539,7 +148755,7 @@ "return": null }, { - "__docId__": 7460, + "__docId__": 7468, "kind": "method", "name": "setPickable", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148574,7 +148790,7 @@ "return": null }, { - "__docId__": 7461, + "__docId__": 7469, "kind": "method", "name": "setCulled", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148609,7 +148825,7 @@ "return": null }, { - "__docId__": 7462, + "__docId__": 7470, "kind": "method", "name": "setColor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148638,7 +148854,7 @@ "return": null }, { - "__docId__": 7463, + "__docId__": 7471, "kind": "method", "name": "setTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148673,7 +148889,7 @@ "return": null }, { - "__docId__": 7464, + "__docId__": 7472, "kind": "method", "name": "_setFlags", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148708,7 +148924,7 @@ "return": null }, { - "__docId__": 7465, + "__docId__": 7473, "kind": "method", "name": "setOffset", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148737,7 +148953,7 @@ "return": null }, { - "__docId__": 7466, + "__docId__": 7474, "kind": "method", "name": "getEachVertex", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148770,7 +148986,7 @@ } }, { - "__docId__": 7467, + "__docId__": 7475, "kind": "method", "name": "setMatrix", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148799,7 +149015,7 @@ "return": null }, { - "__docId__": 7468, + "__docId__": 7476, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148828,7 +149044,7 @@ "return": null }, { - "__docId__": 7469, + "__docId__": 7477, "kind": "method", "name": "_updateBackfaceCull", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148858,7 +149074,7 @@ "return": null }, { - "__docId__": 7470, + "__docId__": 7478, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148887,7 +149103,7 @@ "return": null }, { - "__docId__": 7471, + "__docId__": 7479, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148916,7 +149132,7 @@ "return": null }, { - "__docId__": 7472, + "__docId__": 7480, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148945,7 +149161,7 @@ "return": null }, { - "__docId__": 7473, + "__docId__": 7481, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -148974,7 +149190,7 @@ "return": null }, { - "__docId__": 7474, + "__docId__": 7482, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149003,7 +149219,7 @@ "return": null }, { - "__docId__": 7475, + "__docId__": 7483, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149032,7 +149248,7 @@ "return": null }, { - "__docId__": 7476, + "__docId__": 7484, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149061,7 +149277,7 @@ "return": null }, { - "__docId__": 7477, + "__docId__": 7485, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149090,7 +149306,7 @@ "return": null }, { - "__docId__": 7478, + "__docId__": 7486, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149119,7 +149335,7 @@ "return": null }, { - "__docId__": 7479, + "__docId__": 7487, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149148,7 +149364,7 @@ "return": null }, { - "__docId__": 7480, + "__docId__": 7488, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149177,7 +149393,7 @@ "return": null }, { - "__docId__": 7481, + "__docId__": 7489, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149206,7 +149422,7 @@ "return": null }, { - "__docId__": 7482, + "__docId__": 7490, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149235,7 +149451,7 @@ "return": null }, { - "__docId__": 7483, + "__docId__": 7491, "kind": "method", "name": "drawPickMesh", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149264,7 +149480,7 @@ "return": null }, { - "__docId__": 7484, + "__docId__": 7492, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149293,7 +149509,7 @@ "return": null }, { - "__docId__": 7485, + "__docId__": 7493, "kind": "method", "name": "drawPickNormals", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149322,7 +149538,7 @@ "return": null }, { - "__docId__": 7486, + "__docId__": 7494, "kind": "method", "name": "drawSnapInit", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149351,7 +149567,7 @@ "return": null }, { - "__docId__": 7487, + "__docId__": 7495, "kind": "method", "name": "drawSnap", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149380,7 +149596,7 @@ "return": null }, { - "__docId__": 7488, + "__docId__": 7496, "kind": "method", "name": "precisionRayPickSurface", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149431,7 +149647,7 @@ } }, { - "__docId__": 7489, + "__docId__": 7497, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js~VBOInstancingTrianglesLayer", @@ -149447,18 +149663,18 @@ "return": null }, { - "__docId__": 7491, + "__docId__": 7499, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js", "content": "import {EdgesRenderer} from \"./EdgesRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class EdgesColorRenderer extends EdgesRenderer {\n\n drawLayer(frameCtx, batchingLayer, renderPass) {\n super.drawLayer(frameCtx, batchingLayer, renderPass, { colorUniform: false });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EdgesColorRenderer vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // edgeFlag = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n\n src.push(`int edgeFlag = int(flags) >> 8 & 0xF;`);\n src.push(`if (edgeFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n // src.push(\"vColor = vec4(float(color.r-100.0) / 255.0, float(color.g-100.0) / 255.0, float(color.b-100.0) / 255.0, float(color.a) / 255.0);\");\n src.push(\"vColor = vec4(float(color.r*0.5) / 255.0, float(color.g*0.5) / 255.0, float(color.b*0.5) / 255.0, float(color.a) / 255.0);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EdgesColorRenderer fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7492, + "__docId__": 7500, "kind": "class", "name": "EdgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js", @@ -149477,7 +149693,7 @@ "ignore": true }, { - "__docId__": 7493, + "__docId__": 7501, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -149512,7 +149728,7 @@ "return": null }, { - "__docId__": 7494, + "__docId__": 7502, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -149533,7 +149749,7 @@ } }, { - "__docId__": 7495, + "__docId__": 7503, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js~EdgesColorRenderer", @@ -149554,18 +149770,18 @@ } }, { - "__docId__": 7496, + "__docId__": 7504, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js", "content": "import {EdgesRenderer} from \"./EdgesRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class EdgesEmphasisRenderer extends EdgesRenderer {\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n super.drawLayer(frameCtx, instancingLayer, renderPass, {colorUniform: true});\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EdgesEmphasisRenderer vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"uniform vec4 color;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // edgeFlag = NOT_RENDERED | EDGES_COLOR_OPAQUE | EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n // renderPass = EDGES_HIGHLIGHTED | EDGES_XRAYED | EDGES_SELECTED\n\n src.push(`int edgeFlag = int(flags) >> 8 & 0xF;`);\n src.push(`if (edgeFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = worldMatrix * positionsDecodeMatrix * vec4(position, 1.0); \");\n\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vColor = vec4(color.r, color.g, color.b, color.a);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// EdgesEmphasisRenderer fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7497, + "__docId__": 7505, "kind": "class", "name": "EdgesEmphasisRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js", @@ -149584,7 +149800,7 @@ "ignore": true }, { - "__docId__": 7498, + "__docId__": 7506, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -149619,7 +149835,7 @@ "return": null }, { - "__docId__": 7499, + "__docId__": 7507, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -149640,7 +149856,7 @@ } }, { - "__docId__": 7500, + "__docId__": 7508, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js~EdgesEmphasisRenderer", @@ -149661,18 +149877,18 @@ } }, { - "__docId__": 7501, + "__docId__": 7509, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class EdgesRenderer extends TrianglesInstancingRenderer {\n constructor(scene, withSAO) {\n super(scene, withSAO, {instancing: true, edges: true});\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7502, + "__docId__": 7510, "kind": "class", "name": "EdgesRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js", @@ -149691,7 +149907,7 @@ "ignore": true }, { - "__docId__": 7503, + "__docId__": 7511, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js~EdgesRenderer", @@ -149705,18 +149921,18 @@ "undocument": true }, { - "__docId__": 7504, + "__docId__": 7512, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", "content": "import {TrianglesColorRenderer} from \"./TrianglesColorRenderer.js\";\nimport {TrianglesFlatColorRenderer} from \"./TrianglesFlatColorRenderer.js\";\nimport {TrianglesSilhouetteRenderer} from \"./TrianglesSilhouetteRenderer.js\";\nimport {EdgesEmphasisRenderer} from \"./EdgesEmphasisRenderer.js\";\nimport {EdgesColorRenderer} from \"./EdgesColorRenderer.js\";\nimport {TrianglesPickMeshRenderer} from \"./TrianglesPickMeshRenderer.js\";\nimport {TrianglesPickDepthRenderer} from \"./TrianglesPickDepthRenderer.js\";\nimport {TrianglesPickNormalsRenderer} from \"./TrianglesPickNormalsRenderer.js\";\nimport {TrianglesOcclusionRenderer} from \"./TrianglesOcclusionRenderer.js\";\nimport {TrianglesDepthRenderer} from \"./TrianglesDepthRenderer.js\";\nimport {TrianglesNormalsRenderer} from \"./TrianglesNormalsRenderer.js\";\nimport {TrianglesShadowRenderer} from \"./TrianglesShadowRenderer.js\";\nimport {TrianglesPBRRenderer} from \"./TrianglesPBRRenderer.js\";\nimport {TrianglesPickNormalsFlatRenderer} from \"./TrianglesPickNormalsFlatRenderer.js\";\nimport {TrianglesColorTextureRenderer} from \"./TrianglesColorTextureRenderer.js\";\nimport {TrianglesSnapInitRenderer} from \"./TrianglesSnapInitRenderer.js\";\nimport {TrianglesSnapRenderer} from \"./TrianglesSnapRenderer.js\";\n\n/**\n * @private\n */\nclass Renderers {\n\n constructor(scene) {\n this._scene = scene;\n }\n\n _compile() {\n if (this._colorRenderer && (!this._colorRenderer.getValid())) {\n this._colorRenderer.destroy();\n this._colorRenderer = null;\n }\n if (this._colorRendererWithSAO && (!this._colorRendererWithSAO.getValid())) {\n this._colorRendererWithSAO.destroy();\n this._colorRendererWithSAO = null;\n }\n if (this._flatColorRenderer && (!this._flatColorRenderer.getValid())) {\n this._flatColorRenderer.destroy();\n this._flatColorRenderer = null;\n }\n if (this._flatColorRendererWithSAO && (!this._flatColorRendererWithSAO.getValid())) {\n this._flatColorRendererWithSAO.destroy();\n this._flatColorRendererWithSAO = null;\n }\n if (this._pbrRenderer && (!this._pbrRenderer.getValid())) {\n this._pbrRenderer.destroy();\n this._pbrRenderer = null;\n }\n if (this._pbrRendererWithSAO && (!this._pbrRendererWithSAO.getValid())) {\n this._pbrRendererWithSAO.destroy();\n this._pbrRendererWithSAO = null;\n }\n if (this._colorTextureRenderer && (!this._colorTextureRenderer.getValid())) {\n this._colorTextureRenderer.destroy();\n this._colorTextureRenderer = null;\n }\n if (this._colorTextureRendererWithSAO && (!this._colorTextureRendererWithSAO.getValid())) {\n this._colorTextureRendererWithSAO.destroy();\n this._colorTextureRendererWithSAO = null;\n }\n if (this._depthRenderer && (!this._depthRenderer.getValid())) {\n this._depthRenderer.destroy();\n this._depthRenderer = null;\n }\n if (this._normalsRenderer && (!this._normalsRenderer.getValid())) {\n this._normalsRenderer.destroy();\n this._normalsRenderer = null;\n }\n if (this._silhouetteRenderer && (!this._silhouetteRenderer.getValid())) {\n this._silhouetteRenderer.destroy();\n this._silhouetteRenderer = null;\n }\n if (this._edgesRenderer && (!this._edgesRenderer.getValid())) {\n this._edgesRenderer.destroy();\n this._edgesRenderer = null;\n }\n if (this._edgesColorRenderer && (!this._edgesColorRenderer.getValid())) {\n this._edgesColorRenderer.destroy();\n this._edgesColorRenderer = null;\n }\n if (this._pickMeshRenderer && (!this._pickMeshRenderer.getValid())) {\n this._pickMeshRenderer.destroy();\n this._pickMeshRenderer = null;\n }\n if (this._pickDepthRenderer && (!this._pickDepthRenderer.getValid())) {\n this._pickDepthRenderer.destroy();\n this._pickDepthRenderer = null;\n }\n if (this._pickNormalsRenderer && this._pickNormalsRenderer.getValid() === false) {\n this._pickNormalsRenderer.destroy();\n this._pickNormalsRenderer = null;\n }\n if (this._pickNormalsFlatRenderer && (!this._pickNormalsFlatRenderer.getValid())) {\n this._pickNormalsFlatRenderer.destroy();\n this._pickNormalsFlatRenderer = null;\n }\n if (this._occlusionRenderer && this._occlusionRenderer.getValid() === false) {\n this._occlusionRenderer.destroy();\n this._occlusionRenderer = null;\n }\n if (this._shadowRenderer && (!this._shadowRenderer.getValid())) {\n this._shadowRenderer.destroy();\n this._shadowRenderer = null;\n }\n if (this._snapInitRenderer && (!this._snapInitRenderer.getValid())) {\n this._snapInitRenderer.destroy();\n this._snapInitRenderer = null;\n }\n if (this._snapRenderer && (!this._snapRenderer.getValid())) {\n this._snapRenderer.destroy();\n this._snapRenderer = null;\n }\n }\n\n eagerCreateRenders() {\n\n // Pre-initialize certain renderers that would otherwise be lazy-initialised\n // on user interaction, such as picking or emphasis, so that there is no delay\n // when user first begins interacting with the viewer.\n\n if (!this._silhouetteRenderer) { // Used for highlighting and selection\n this._silhouetteRenderer = new TrianglesSilhouetteRenderer(this._scene);\n }\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new TrianglesPickMeshRenderer(this._scene);\n }\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new TrianglesPickDepthRenderer(this._scene);\n }\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new TrianglesSnapInitRenderer(this._scene, false);\n }\n if (!this._snapRenderer) {\n this._snapRenderer = new TrianglesSnapRenderer(this._scene);\n }\n }\n\n get colorRenderer() {\n if (!this._colorRenderer) {\n this._colorRenderer = new TrianglesColorRenderer(this._scene, false);\n }\n return this._colorRenderer;\n }\n\n get colorRendererWithSAO() {\n if (!this._colorRendererWithSAO) {\n this._colorRendererWithSAO = new TrianglesColorRenderer(this._scene, true);\n }\n return this._colorRendererWithSAO;\n }\n\n get flatColorRenderer() {\n if (!this._flatColorRenderer) {\n this._flatColorRenderer = new TrianglesFlatColorRenderer(this._scene, false);\n }\n return this._flatColorRenderer;\n }\n\n get flatColorRendererWithSAO() {\n if (!this._flatColorRendererWithSAO) {\n this._flatColorRendererWithSAO = new TrianglesFlatColorRenderer(this._scene, true);\n }\n return this._flatColorRendererWithSAO;\n }\n\n get pbrRenderer() {\n if (!this._pbrRenderer) {\n this._pbrRenderer = new TrianglesPBRRenderer(this._scene, false);\n }\n return this._pbrRenderer;\n }\n\n get pbrRendererWithSAO() {\n if (!this._pbrRendererWithSAO) {\n this._pbrRendererWithSAO = new TrianglesPBRRenderer(this._scene, true);\n }\n return this._pbrRendererWithSAO;\n }\n\n get colorTextureRenderer() {\n if (!this._colorTextureRenderer) {\n this._colorTextureRenderer = new TrianglesColorTextureRenderer(this._scene, false);\n }\n return this._colorTextureRenderer;\n }\n\n get colorTextureRendererWithSAO() {\n if (!this._colorTextureRendererWithSAO) {\n this._colorTextureRendererWithSAO = new TrianglesColorTextureRenderer(this._scene, true);\n }\n return this._colorTextureRendererWithSAO;\n }\n\n get silhouetteRenderer() {\n if (!this._silhouetteRenderer) {\n this._silhouetteRenderer = new TrianglesSilhouetteRenderer(this._scene);\n }\n return this._silhouetteRenderer;\n }\n\n get depthRenderer() {\n if (!this._depthRenderer) {\n this._depthRenderer = new TrianglesDepthRenderer(this._scene);\n }\n return this._depthRenderer;\n }\n\n get normalsRenderer() {\n if (!this._normalsRenderer) {\n this._normalsRenderer = new TrianglesNormalsRenderer(this._scene);\n }\n return this._normalsRenderer;\n }\n\n get edgesRenderer() {\n if (!this._edgesRenderer) {\n this._edgesRenderer = new EdgesEmphasisRenderer(this._scene);\n }\n return this._edgesRenderer;\n }\n\n get edgesColorRenderer() {\n if (!this._edgesColorRenderer) {\n this._edgesColorRenderer = new EdgesColorRenderer(this._scene);\n }\n return this._edgesColorRenderer;\n }\n\n get pickMeshRenderer() {\n if (!this._pickMeshRenderer) {\n this._pickMeshRenderer = new TrianglesPickMeshRenderer(this._scene);\n }\n return this._pickMeshRenderer;\n }\n\n get pickNormalsRenderer() {\n if (!this._pickNormalsRenderer) {\n this._pickNormalsRenderer = new TrianglesPickNormalsRenderer(this._scene);\n }\n return this._pickNormalsRenderer;\n }\n\n get pickNormalsFlatRenderer() {\n if (!this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer = new TrianglesPickNormalsFlatRenderer(this._scene);\n }\n return this._pickNormalsFlatRenderer;\n }\n\n get pickDepthRenderer() {\n if (!this._pickDepthRenderer) {\n this._pickDepthRenderer = new TrianglesPickDepthRenderer(this._scene);\n }\n return this._pickDepthRenderer;\n }\n\n get occlusionRenderer() {\n if (!this._occlusionRenderer) {\n this._occlusionRenderer = new TrianglesOcclusionRenderer(this._scene);\n }\n return this._occlusionRenderer;\n }\n\n get shadowRenderer() {\n if (!this._shadowRenderer) {\n this._shadowRenderer = new TrianglesShadowRenderer(this._scene);\n }\n return this._shadowRenderer;\n }\n\n get snapInitRenderer() {\n if (!this._snapInitRenderer) {\n this._snapInitRenderer = new TrianglesSnapInitRenderer(this._scene, false);\n }\n return this._snapInitRenderer;\n }\n\n get snapRenderer() {\n if (!this._snapRenderer) {\n this._snapRenderer = new TrianglesSnapRenderer(this._scene);\n }\n return this._snapRenderer;\n }\n\n _destroy() {\n if (this._colorRenderer) {\n this._colorRenderer.destroy();\n }\n if (this._colorRendererWithSAO) {\n this._colorRendererWithSAO.destroy();\n }\n if (this._flatColorRenderer) {\n this._flatColorRenderer.destroy();\n }\n if (this._flatColorRendererWithSAO) {\n this._flatColorRendererWithSAO.destroy();\n }\n if (this._pbrRenderer) {\n this._pbrRenderer.destroy();\n }\n if (this._pbrRendererWithSAO) {\n this._pbrRendererWithSAO.destroy();\n }\n if (this._colorTextureRenderer) {\n this._colorTextureRenderer.destroy();\n }\n if (this._colorTextureRendererWithSAO) {\n this._colorTextureRendererWithSAO.destroy();\n }\n if (this._depthRenderer) {\n this._depthRenderer.destroy();\n }\n if (this._normalsRenderer) {\n this._normalsRenderer.destroy();\n }\n if (this._silhouetteRenderer) {\n this._silhouetteRenderer.destroy();\n }\n if (this._edgesRenderer) {\n this._edgesRenderer.destroy();\n }\n if (this._edgesColorRenderer) {\n this._edgesColorRenderer.destroy();\n }\n if (this._pickMeshRenderer) {\n this._pickMeshRenderer.destroy();\n }\n if (this._pickDepthRenderer) {\n this._pickDepthRenderer.destroy();\n }\n if (this._pickNormalsRenderer) {\n this._pickNormalsRenderer.destroy();\n }\n if (this._pickNormalsFlatRenderer) {\n this._pickNormalsFlatRenderer.destroy();\n }\n if (this._occlusionRenderer) {\n this._occlusionRenderer.destroy();\n }\n if (this._shadowRenderer) {\n this._shadowRenderer.destroy();\n }\n if (this._snapInitRenderer) {\n this._snapInitRenderer.destroy();\n }\n if (this._snapRenderer) {\n this._snapRenderer.destroy();\n }\n }\n}\n\nconst cachedRenderers = {};\n\n/**\n * @private\n */\nexport function getRenderers(scene) {\n const sceneId = scene.id;\n let instancingRenderers = cachedRenderers[sceneId];\n if (!instancingRenderers) {\n instancingRenderers = new Renderers(scene);\n cachedRenderers[sceneId] = instancingRenderers;\n instancingRenderers._compile();\n instancingRenderers.eagerCreateRenders();\n scene.on(\"compile\", () => {\n instancingRenderers._compile();\n instancingRenderers.eagerCreateRenders();\n });\n scene.on(\"destroyed\", () => {\n delete cachedRenderers[sceneId];\n instancingRenderers._destroy();\n });\n }\n return instancingRenderers;\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7505, + "__docId__": 7513, "kind": "class", "name": "Renderers", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", @@ -149732,7 +149948,7 @@ "ignore": true }, { - "__docId__": 7506, + "__docId__": 7514, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149746,7 +149962,7 @@ "undocument": true }, { - "__docId__": 7507, + "__docId__": 7515, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149764,7 +149980,7 @@ } }, { - "__docId__": 7508, + "__docId__": 7516, "kind": "method", "name": "_compile", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149781,7 +149997,7 @@ "return": null }, { - "__docId__": 7509, + "__docId__": 7517, "kind": "member", "name": "_colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149799,7 +150015,7 @@ } }, { - "__docId__": 7510, + "__docId__": 7518, "kind": "member", "name": "_colorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149817,7 +150033,7 @@ } }, { - "__docId__": 7511, + "__docId__": 7519, "kind": "member", "name": "_flatColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149835,7 +150051,7 @@ } }, { - "__docId__": 7512, + "__docId__": 7520, "kind": "member", "name": "_flatColorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149853,7 +150069,7 @@ } }, { - "__docId__": 7513, + "__docId__": 7521, "kind": "member", "name": "_pbrRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149871,7 +150087,7 @@ } }, { - "__docId__": 7514, + "__docId__": 7522, "kind": "member", "name": "_pbrRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149889,7 +150105,7 @@ } }, { - "__docId__": 7515, + "__docId__": 7523, "kind": "member", "name": "_colorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149907,7 +150123,7 @@ } }, { - "__docId__": 7516, + "__docId__": 7524, "kind": "member", "name": "_colorTextureRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149925,7 +150141,7 @@ } }, { - "__docId__": 7517, + "__docId__": 7525, "kind": "member", "name": "_depthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149943,7 +150159,7 @@ } }, { - "__docId__": 7518, + "__docId__": 7526, "kind": "member", "name": "_normalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149961,7 +150177,7 @@ } }, { - "__docId__": 7519, + "__docId__": 7527, "kind": "member", "name": "_silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149979,7 +150195,7 @@ } }, { - "__docId__": 7520, + "__docId__": 7528, "kind": "member", "name": "_edgesRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -149997,7 +150213,7 @@ } }, { - "__docId__": 7521, + "__docId__": 7529, "kind": "member", "name": "_edgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150015,7 +150231,7 @@ } }, { - "__docId__": 7522, + "__docId__": 7530, "kind": "member", "name": "_pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150033,7 +150249,7 @@ } }, { - "__docId__": 7523, + "__docId__": 7531, "kind": "member", "name": "_pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150051,7 +150267,7 @@ } }, { - "__docId__": 7524, + "__docId__": 7532, "kind": "member", "name": "_pickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150069,7 +150285,7 @@ } }, { - "__docId__": 7525, + "__docId__": 7533, "kind": "member", "name": "_pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150087,7 +150303,7 @@ } }, { - "__docId__": 7526, + "__docId__": 7534, "kind": "member", "name": "_occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150105,7 +150321,7 @@ } }, { - "__docId__": 7527, + "__docId__": 7535, "kind": "member", "name": "_shadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150123,7 +150339,7 @@ } }, { - "__docId__": 7528, + "__docId__": 7536, "kind": "member", "name": "_snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150141,7 +150357,7 @@ } }, { - "__docId__": 7529, + "__docId__": 7537, "kind": "member", "name": "_snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150159,7 +150375,7 @@ } }, { - "__docId__": 7530, + "__docId__": 7538, "kind": "method", "name": "eagerCreateRenders", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150175,7 +150391,7 @@ "return": null }, { - "__docId__": 7536, + "__docId__": 7544, "kind": "get", "name": "colorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150194,7 +150410,7 @@ } }, { - "__docId__": 7538, + "__docId__": 7546, "kind": "get", "name": "colorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150213,7 +150429,7 @@ } }, { - "__docId__": 7540, + "__docId__": 7548, "kind": "get", "name": "flatColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150232,7 +150448,7 @@ } }, { - "__docId__": 7542, + "__docId__": 7550, "kind": "get", "name": "flatColorRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150251,7 +150467,7 @@ } }, { - "__docId__": 7544, + "__docId__": 7552, "kind": "get", "name": "pbrRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150270,7 +150486,7 @@ } }, { - "__docId__": 7546, + "__docId__": 7554, "kind": "get", "name": "pbrRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150289,7 +150505,7 @@ } }, { - "__docId__": 7548, + "__docId__": 7556, "kind": "get", "name": "colorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150308,7 +150524,7 @@ } }, { - "__docId__": 7550, + "__docId__": 7558, "kind": "get", "name": "colorTextureRendererWithSAO", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150327,7 +150543,7 @@ } }, { - "__docId__": 7552, + "__docId__": 7560, "kind": "get", "name": "silhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150346,7 +150562,7 @@ } }, { - "__docId__": 7554, + "__docId__": 7562, "kind": "get", "name": "depthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150365,7 +150581,7 @@ } }, { - "__docId__": 7556, + "__docId__": 7564, "kind": "get", "name": "normalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150384,7 +150600,7 @@ } }, { - "__docId__": 7558, + "__docId__": 7566, "kind": "get", "name": "edgesRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150403,7 +150619,7 @@ } }, { - "__docId__": 7560, + "__docId__": 7568, "kind": "get", "name": "edgesColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150422,7 +150638,7 @@ } }, { - "__docId__": 7562, + "__docId__": 7570, "kind": "get", "name": "pickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150441,7 +150657,7 @@ } }, { - "__docId__": 7564, + "__docId__": 7572, "kind": "get", "name": "pickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150460,7 +150676,7 @@ } }, { - "__docId__": 7566, + "__docId__": 7574, "kind": "get", "name": "pickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150479,7 +150695,7 @@ } }, { - "__docId__": 7568, + "__docId__": 7576, "kind": "get", "name": "pickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150498,7 +150714,7 @@ } }, { - "__docId__": 7570, + "__docId__": 7578, "kind": "get", "name": "occlusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150517,7 +150733,7 @@ } }, { - "__docId__": 7572, + "__docId__": 7580, "kind": "get", "name": "shadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150536,7 +150752,7 @@ } }, { - "__docId__": 7574, + "__docId__": 7582, "kind": "get", "name": "snapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150555,7 +150771,7 @@ } }, { - "__docId__": 7576, + "__docId__": 7584, "kind": "get", "name": "snapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150574,7 +150790,7 @@ } }, { - "__docId__": 7578, + "__docId__": 7586, "kind": "method", "name": "_destroy", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js~Renderers", @@ -150591,7 +150807,7 @@ "return": null }, { - "__docId__": 7579, + "__docId__": 7587, "kind": "variable", "name": "cachedRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", @@ -150612,7 +150828,7 @@ "ignore": true }, { - "__docId__": 7580, + "__docId__": 7588, "kind": "function", "name": "getRenderers", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js", @@ -150642,18 +150858,18 @@ } }, { - "__docId__": 7581, + "__docId__": 7589, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nclass TrianglesColorRenderer extends TrianglesInstancingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n let i;\n let len;\n let light;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec2 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"in vec4 modelNormalMatrixCol0;\");\n src.push(\"in vec4 modelNormalMatrixCol1;\");\n src.push(\"in vec4 modelNormalMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src, true);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); \");\n src.push(\"vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);\");\n src.push(\"vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);\");\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));\");\n src.push(\"vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n\n if (this._withSAO) {\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(newColor.rgb * ambient, 1.0);\");\n } else {\n src.push(\" outColor = newColor;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n\nexport {TrianglesColorRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7582, + "__docId__": 7590, "kind": "class", "name": "TrianglesColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js", @@ -150672,7 +150888,7 @@ "ignore": true }, { - "__docId__": 7583, + "__docId__": 7591, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -150693,7 +150909,7 @@ } }, { - "__docId__": 7584, + "__docId__": 7592, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -150728,7 +150944,7 @@ "return": null }, { - "__docId__": 7585, + "__docId__": 7593, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -150749,7 +150965,7 @@ } }, { - "__docId__": 7586, + "__docId__": 7594, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js~TrianglesColorRenderer", @@ -150770,18 +150986,18 @@ } }, { - "__docId__": 7587, + "__docId__": 7595, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class TrianglesColorTextureRenderer extends TrianglesInstancingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in vec2 uv;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform mat3 uvDecodeMatrix;\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec4 vColor;\");\n src.push(\"out vec2 vUV;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n src.push(\"vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform sampler2D uColorMap;\");\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToLinear( in vec4 value ) {\");\n src.push(\" return value;\");\n src.push(\"}\");\n src.push(\"vec4 sRGBToLinear( in vec4 value ) {\");\n src.push(\" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\");\n src.push(\"}\");\n src.push(\"vec4 gammaToLinear( in vec4 value) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\");\n src.push(\"}\");\n if (gammaOutput) {\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 lightAmbient;\");\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"in vec2 vUV;\");\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n\n src.push(\"vec3 xTangent = dFdx( vViewPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vViewPosition.xyz );\");\n src.push(\"vec3 viewNormal = normalize( cross( xTangent, yTangent ) );\");\n\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);\");\n if (gammaOutput) {\n src.push(\"vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));\");\n } else {\n src.push(\"vec4 colorTexel = color * texture(uColorMap, vUV);\");\n }\n src.push(\"float opacity = color.a;\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(newColor.rgb * colorTexel.rgb * ambient, opacity);\");\n } else {\n src.push(\" outColor = vec4(newColor.rgb * colorTexel.rgb, opacity);\");\n }\n\n if (gammaOutput) {\n src.push(\"outColor = linearToGamma(outColor, gammaFactor);\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7588, + "__docId__": 7596, "kind": "class", "name": "TrianglesColorTextureRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js", @@ -150800,7 +151016,7 @@ "ignore": true }, { - "__docId__": 7589, + "__docId__": 7597, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -150821,7 +151037,7 @@ } }, { - "__docId__": 7590, + "__docId__": 7598, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -150856,7 +151072,7 @@ "return": null }, { - "__docId__": 7591, + "__docId__": 7599, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -150877,7 +151093,7 @@ } }, { - "__docId__": 7592, + "__docId__": 7600, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js~TrianglesColorTextureRenderer", @@ -150898,18 +151114,18 @@ } }, { - "__docId__": 7593, + "__docId__": 7601, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class TrianglesDepthRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry depth drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec2 vHighPrecisionZW;\");\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"vHighPrecisionZW = gl_Position.zw;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry depth drawing fragment shader\");\n\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec2 vHighPrecisionZW;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\");\n src.push(\" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7594, + "__docId__": 7602, "kind": "class", "name": "TrianglesDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js", @@ -150928,7 +151144,7 @@ "ignore": true }, { - "__docId__": 7595, + "__docId__": 7603, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js~TrianglesDepthRenderer", @@ -150949,7 +151165,7 @@ } }, { - "__docId__": 7596, + "__docId__": 7604, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js~TrianglesDepthRenderer", @@ -150970,18 +151186,18 @@ } }, { - "__docId__": 7597, + "__docId__": 7605, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\n\n\nexport class TrianglesFlatColorRenderer extends TrianglesInstancingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry flat-shading drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n let i;\n let len;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry flat-shading drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n\n src.push(\"vec3 reflectedColor = vec3(0.0, 0.0, 0.0);\");\n src.push(\"vec3 viewLightDir = vec3(0.0, 0.0, -1.0);\");\n\n src.push(\"float lambertian = 1.0;\");\n\n src.push(\"vec3 xTangent = dFdx( vViewPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vViewPosition.xyz );\");\n src.push(\"vec3 viewNormal = normalize( cross( xTangent, yTangent ) );\");\n\n for (i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = -normalize(lightPos\" + i + \" - viewPosition.xyz);\");\n } else {\n src.push(\"viewLightDir = -normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"viewLightDir = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"viewLightDir = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n src.push(\"lambertian = max(dot(-viewNormal, viewLightDir), 0.0);\");\n src.push(\"reflectedColor += lambertian * (lightColor\" + i + \".rgb * lightColor\" + i + \".a);\");\n }\n\n src.push(\"vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * newColor.rgb) + (reflectedColor * newColor.rgb), newColor.a);\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" outColor = vec4(fragColor.rgb * ambient, 1.0);\");\n } else {\n src.push(\" outColor = fragColor;\");\n }\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7598, + "__docId__": 7606, "kind": "class", "name": "TrianglesFlatColorRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js", @@ -151000,7 +151216,7 @@ "ignore": true }, { - "__docId__": 7599, + "__docId__": 7607, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -151021,7 +151237,7 @@ } }, { - "__docId__": 7600, + "__docId__": 7608, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -151042,7 +151258,7 @@ } }, { - "__docId__": 7601, + "__docId__": 7609, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js~TrianglesFlatColorRenderer", @@ -151063,18 +151279,18 @@ } }, { - "__docId__": 7602, + "__docId__": 7610, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n\n/**\n * @private\n */\n\nexport class TrianglesFlatNormalsRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry flat normals drawing vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\" vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry flat nornals drawing fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewPosition;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"vec3 xTangent = dFdx( vViewPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vViewPosition.xyz );\");\n src.push(\"vec3 viewNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(\" outColor = vec4(packNormalToRGB(viewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7603, + "__docId__": 7611, "kind": "class", "name": "TrianglesFlatNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js", @@ -151093,7 +151309,7 @@ "ignore": true }, { - "__docId__": 7604, + "__docId__": 7612, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js~TrianglesFlatNormalsRenderer", @@ -151114,7 +151330,7 @@ } }, { - "__docId__": 7605, + "__docId__": 7613, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js~TrianglesFlatNormalsRenderer", @@ -151135,18 +151351,18 @@ } }, { - "__docId__": 7606, + "__docId__": 7614, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js", "content": "import {VBORenderer} from \"./../../../VBORenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesInstancingRenderer extends VBORenderer {\n constructor(scene, withSAO, {edges = false} = {}) {\n super(scene, withSAO, {instancing: true, edges});\n }\n\n _draw(drawCfg) {\n const {gl} = this._scene.canvas;\n\n const {\n state,\n frameCtx,\n incrementDrawState,\n } = drawCfg;\n\n if (this._edges) {\n gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);\n } else {\n gl.drawElementsInstanced(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);\n if (incrementDrawState) {\n frameCtx.drawElements++;\n }\n }\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7607, + "__docId__": 7615, "kind": "class", "name": "TrianglesInstancingRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js", @@ -151165,7 +151381,7 @@ "ignore": true }, { - "__docId__": 7608, + "__docId__": 7616, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js~TrianglesInstancingRenderer", @@ -151179,7 +151395,7 @@ "undocument": true }, { - "__docId__": 7609, + "__docId__": 7617, "kind": "method", "name": "_draw", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js~TrianglesInstancingRenderer", @@ -151203,18 +151419,18 @@ "return": null }, { - "__docId__": 7610, + "__docId__": 7618, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesNormalsRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry normals drawing vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec3 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src, true);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec3 vViewNormal;\");\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vec4 worldNormal = worldNormalMatrix * vec4(octDecode(normal.xy), 0.0); \");\n src.push(\" vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);\");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\" vViewNormal = viewNormal;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry depth drawing fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7611, + "__docId__": 7619, "kind": "class", "name": "TrianglesNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js", @@ -151233,7 +151449,7 @@ "ignore": true }, { - "__docId__": 7612, + "__docId__": 7620, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js~TrianglesNormalsRenderer", @@ -151254,7 +151470,7 @@ } }, { - "__docId__": 7613, + "__docId__": 7621, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js~TrianglesNormalsRenderer", @@ -151275,18 +151491,18 @@ } }, { - "__docId__": 7614, + "__docId__": 7622, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n// Logarithmic depth buffer involves an accuracy tradeoff, sacrificing\n// accuracy at close range to improve accuracy at long range. This can\n// mess up accuracy for occlusion tests, so we'll disable for now.\n\nconst ENABLE_LOG_DEPTH_BUF = false;\n\n/**\n * @private\n */\nexport class TrianglesOcclusionRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// TrianglesInstancingOcclusionRenderer vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\");\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// TrianglesInstancingOcclusionRenderer fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n src.push(\" outColor = vec4(0.0, 0.0, 1.0, 1.0); \"); // Occluders are blue\n if (ENABLE_LOG_DEPTH_BUF && scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7615, + "__docId__": 7623, "kind": "variable", "name": "ENABLE_LOG_DEPTH_BUF", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js", @@ -151307,7 +151523,7 @@ "ignore": true }, { - "__docId__": 7616, + "__docId__": 7624, "kind": "class", "name": "TrianglesOcclusionRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js", @@ -151326,7 +151542,7 @@ "ignore": true }, { - "__docId__": 7617, + "__docId__": 7625, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js~TrianglesOcclusionRenderer", @@ -151347,7 +151563,7 @@ } }, { - "__docId__": 7618, + "__docId__": 7626, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js~TrianglesOcclusionRenderer", @@ -151368,18 +151584,18 @@ } }, { - "__docId__": 7619, + "__docId__": 7627, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js", "content": "import {LinearEncoding, sRGBEncoding} from \"../../../../../constants/constants.js\";\nimport {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\nconst TEXTURE_DECODE_FUNCS = {};\nTEXTURE_DECODE_FUNCS[LinearEncoding] = \"linearToLinear\";\nTEXTURE_DECODE_FUNCS[sRGBEncoding] = \"sRGBToLinear\";\n\n/**\n * @private\n */\nexport class TrianglesPBRRenderer extends TrianglesInstancingRenderer {\n _getHash() {\n const scene = this._scene;\n return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? \"sao\" : \"nosao\")].join(\";\");\n }\n\n drawLayer(frameCtx, layer, renderPass) {\n super.drawLayer(frameCtx, layer, renderPass, { incrementDrawState: true });\n }\n\n _buildVertexShader() {\n\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const clippingCaps = sectionPlanesState.clippingCaps;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry quality drawing vertex shader\");\n\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n src.push(\"in vec3 normal;\");\n src.push(\"in vec4 color;\");\n src.push(\"in vec2 uv;\");\n src.push(\"in vec2 metallicRoughness;\");\n src.push(\"in float flags;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"in vec4 modelNormalMatrixCol0;\");\n src.push(\"in vec4 modelNormalMatrixCol1;\");\n src.push(\"in vec4 modelNormalMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src, true);\n\n src.push(\"uniform mat3 uvDecodeMatrix;\")\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"out vec3 vViewNormal;\");\n src.push(\"out vec4 vColor;\");\n src.push(\"out vec2 vUV;\");\n src.push(\"out vec2 vMetallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"out vec3 vWorldNormal;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n if (clippingCaps) {\n src.push(\"out vec4 vClipPosition;\");\n }\n }\n\n src.push(\"void main(void) {\");\n\n // colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT\n // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT\n\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(`if (colorFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\"vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); \");\n src.push(\"vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 1.0);\");\n src.push(\"vec3 viewNormal = vec4(viewNormalMatrix * worldNormal).xyz;\");\n\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n if (clippingCaps) {\n src.push(\"vClipPosition = clipPos;\");\n }\n }\n\n src.push(\"vViewPosition = viewPosition;\");\n src.push(\"vViewNormal = viewNormal;\");\n src.push(\"vColor = color;\");\n src.push(\"vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;\");\n src.push(\"vMetallicRoughness = metallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"vWorldNormal = worldNormal.xyz;\");\n }\n\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n\n const scene = this._scene;\n const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.\n const sectionPlanesState = scene._sectionPlanesState;\n const lightsState = scene._lightsState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const clippingCaps = sectionPlanesState.clippingCaps;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry quality drawing fragment shader\");\n\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform sampler2D uColorMap;\");\n src.push(\"uniform sampler2D uMetallicRoughMap;\");\n src.push(\"uniform sampler2D uEmissiveMap;\");\n src.push(\"uniform sampler2D uNormalMap;\");\n\n if (this._withSAO) {\n src.push(\"uniform sampler2D uOcclusionTexture;\");\n src.push(\"uniform vec4 uSAOParams;\");\n\n src.push(\"const float packUpscale = 256. / 255.;\");\n src.push(\"const float unpackDownScale = 255. / 256.;\");\n src.push(\"const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\");\n src.push(\"const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );\");\n\n src.push(\"float unpackRGBToFloat( const in vec4 v ) {\");\n src.push(\" return dot( v, unPackFactors );\");\n src.push(\"}\");\n }\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"uniform samplerCube reflectionMap;\");\n }\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"uniform samplerCube lightMap;\");\n }\n\n src.push(\"uniform vec4 lightAmbient;\");\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n const light = lightsState.lights[i];\n if (light.type === \"ambient\") {\n continue;\n }\n src.push(\"uniform vec4 lightColor\" + i + \";\");\n if (light.type === \"dir\") {\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n if (light.type === \"point\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n }\n if (light.type === \"spot\") {\n src.push(\"uniform vec3 lightPos\" + i + \";\");\n src.push(\"uniform vec3 lightDir\" + i + \";\");\n }\n }\n\n src.push(\"uniform float gammaFactor;\");\n src.push(\"vec4 linearToLinear( in vec4 value ) {\");\n src.push(\" return value;\");\n src.push(\"}\");\n src.push(\"vec4 sRGBToLinear( in vec4 value ) {\");\n src.push(\" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\");\n src.push(\"}\");\n src.push(\"vec4 gammaToLinear( in vec4 value) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\");\n src.push(\"}\");\n if (gammaOutput) {\n src.push(\"vec4 linearToGamma( in vec4 value, in float gammaFactor ) {\");\n src.push(\" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\");\n src.push(\"}\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n if (clippingCaps) {\n src.push(\"in vec4 vClipPosition;\");\n }\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"in vec4 vColor;\");\n src.push(\"in vec2 vUV;\");\n src.push(\"in vec2 vMetallicRoughness;\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"in vec3 vWorldNormal;\");\n }\n\n this._addMatricesUniformBlockLines(src, true);\n\n // CONSTANT DEFINITIONS\n\n src.push(\"#define PI 3.14159265359\");\n src.push(\"#define RECIPROCAL_PI 0.31830988618\");\n src.push(\"#define RECIPROCAL_PI2 0.15915494\");\n src.push(\"#define EPSILON 1e-6\");\n\n src.push(\"#define saturate(a) clamp( a, 0.0, 1.0 )\");\n\n // UTILITY DEFINITIONS\n\n src.push(\"vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\");\n src.push(\" vec3 texel = texture( uNormalMap, uv ).xyz;\");\n src.push(\" if (texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0) {\");\n src.push(\" return normalize(surf_norm );\");\n src.push(\" }\");\n src.push(\" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\");\n src.push(\" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\");\n src.push(\" vec2 st0 = dFdx( uv.st );\");\n src.push(\" vec2 st1 = dFdy( uv.st );\");\n src.push(\" vec3 S = normalize( q0 * st1.t - q1 * st0.t );\");\n src.push(\" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\");\n src.push(\" vec3 N = normalize( surf_norm );\");\n src.push(\" vec3 mapN = texel.xyz * 2.0 - 1.0;\");\n src.push(\" mat3 tsn = mat3( S, T, N );\");\n // src.push(\" mapN *= 3.0;\");\n src.push(\" return normalize( tsn * mapN );\");\n src.push(\"}\");\n\n src.push(\"vec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\");\n src.push(\" return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\");\n src.push(\"}\");\n\n // STRUCTURES\n\n src.push(\"struct IncidentLight {\");\n src.push(\" vec3 color;\");\n src.push(\" vec3 direction;\");\n src.push(\"};\");\n\n src.push(\"struct ReflectedLight {\");\n src.push(\" vec3 diffuse;\");\n src.push(\" vec3 specular;\");\n src.push(\"};\");\n\n src.push(\"struct Geometry {\");\n src.push(\" vec3 position;\");\n src.push(\" vec3 viewNormal;\");\n src.push(\" vec3 worldNormal;\");\n src.push(\" vec3 viewEyeDir;\");\n src.push(\"};\");\n\n src.push(\"struct Material {\");\n src.push(\" vec3 diffuseColor;\");\n src.push(\" float specularRoughness;\");\n src.push(\" vec3 specularColor;\");\n src.push(\" float shine;\"); // Only used for Phong\n src.push(\"};\");\n\n // IRRADIANCE EVALUATION\n\n src.push(\"float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\");\n src.push(\" float r = ggxRoughness + 0.0001;\");\n src.push(\" return (2.0 / (r * r) - 2.0);\");\n src.push(\"}\");\n\n src.push(\"float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float maxMIPLevelScalar = float( maxMIPLevel );\");\n src.push(\" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );\");\n src.push(\" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\");\n src.push(\"}\");\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\"vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {\");\n src.push(\" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\"); //TODO: a random factor - fix this\n src.push(\" vec3 envMapColor = \" + TEXTURE_DECODE_FUNCS[lightsState.reflectionMaps[0].encoding] + \"(texture(reflectionMap, reflectVec, mipLevel)).rgb;\");\n src.push(\" return envMapColor;\");\n src.push(\"}\");\n }\n\n // SPECULAR BRDF EVALUATION\n\n src.push(\"vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\");\n src.push(\" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\");\n src.push(\" return ( 1.0 - specularColor ) * fresnel + specularColor;\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" return 1.0 / ( gl * gv );\");\n src.push(\"}\");\n\n src.push(\"float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );\");\n src.push(\" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );\");\n src.push(\" return 0.5 / max( gv + gl, EPSILON );\");\n src.push(\"}\");\n\n src.push(\"float D_GGX(const in float alpha, const in float dotNH) {\");\n src.push(\" float a2 = ( alpha * alpha );\");\n src.push(\" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;\");\n src.push(\" return RECIPROCAL_PI * a2 / ( denom * denom);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float alpha = ( roughness * roughness );\");\n src.push(\" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );\");\n src.push(\" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );\");\n src.push(\" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );\");\n src.push(\" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );\");\n src.push(\" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\");\n src.push(\" vec3 F = F_Schlick( specularColor, dotLH );\");\n src.push(\" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\");\n src.push(\" float D = D_GGX( alpha, dotNH );\");\n src.push(\" return F * (G * D);\");\n src.push(\"}\");\n\n src.push(\"vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {\");\n src.push(\" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));\");\n src.push(\" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);\");\n src.push(\" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);\");\n src.push(\" vec4 r = roughness * c0 + c1;\");\n src.push(\" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\");\n src.push(\" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\");\n src.push(\" return specularColor * AB.x + AB.y;\");\n src.push(\"}\");\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n\n src.push(\"void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\" vec3 irradiance = \" + TEXTURE_DECODE_FUNCS[lightsState.lightMaps[0].encoding] + \"(texture(lightMap, geometry.worldNormal)).rgb;\");\n src.push(\" irradiance *= PI;\");\n src.push(\" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;\");\n }\n\n if (lightsState.reflectionMaps.length > 0) {\n src.push(\" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);\");\n src.push(\" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);\");\n src.push(\" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);\");\n src.push(\" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);\");\n src.push(\" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\");\n src.push(\" reflectedLight.specular += radiance * specularBRDFContrib;\");\n }\n\n src.push(\"}\");\n }\n\n // MAIN LIGHTING COMPUTATION FUNCTION\n\n src.push(\"void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {\");\n src.push(\" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));\");\n src.push(\" vec3 irradiance = dotNL * incidentLight.color * PI;\");\n src.push(\" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);\");\n src.push(\" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);\");\n src.push(\"}\");\n\n src.push(\"out vec4 outColor;\");\n\n src.push(\"void main(void) {\");\n\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n if (clippingCaps) {\n src.push(\" if (dist > (0.002 * vClipPosition.w)) {\");\n src.push(\" discard;\");\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" outColor=vec4(1.0, 0.0, 0.0, 1.0);\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" return;\");\n src.push(\"}\");\n } else {\n src.push(\" if (dist > 0.0) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n }\n src.push(\"}\");\n }\n\n src.push(\"IncidentLight light;\");\n src.push(\"Material material;\");\n src.push(\"Geometry geometry;\");\n src.push(\"ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));\");\n\n src.push(\"vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));\");\n src.push(\"float opacity = float(vColor.a) / 255.0;\");\n\n src.push(\"vec3 baseColor = rgb;\");\n src.push(\"float specularF0 = 1.0;\");\n src.push(\"float metallic = float(vMetallicRoughness.r) / 255.0;\");\n src.push(\"float roughness = float(vMetallicRoughness.g) / 255.0;\");\n src.push(\"float dielectricSpecular = 0.16 * specularF0 * specularF0;\");\n\n src.push(\"vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));\");\n src.push(\"baseColor *= colorTexel.rgb;\");\n // src.push(\"opacity = colorTexel.a;\");\n\n src.push(\"vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;\");\n src.push(\"metallic *= metalRoughTexel.b;\");\n src.push(\"roughness *= metalRoughTexel.g;\");\n\n src.push(\"vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );\");\n\n src.push(\"material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);\");\n src.push(\"material.specularRoughness = clamp(roughness, 0.04, 1.0);\");\n src.push(\"material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);\");\n\n src.push(\"geometry.position = vViewPosition.xyz;\");\n src.push(\"geometry.viewNormal = -normalize(viewNormal);\");\n src.push(\"geometry.viewEyeDir = normalize(vViewPosition.xyz);\");\n\n if (lightsState.lightMaps.length > 0) {\n src.push(\"geometry.worldNormal = normalize(vWorldNormal);\");\n }\n\n if (lightsState.lightMaps.length > 0 || lightsState.reflectionMaps.length > 0) {\n src.push(\"computePBRLightMapping(geometry, material, reflectedLight);\");\n }\n\n for (let i = 0, len = lightsState.lights.length; i < len; i++) {\n\n const light = lightsState.lights[i];\n\n if (light.type === \"ambient\") {\n continue;\n }\n if (light.type === \"dir\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"point\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightPos\" + i + \" - vViewPosition.xyz);\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightPos\" + i + \", 0.0)).xyz);\");\n }\n } else if (light.type === \"spot\") {\n if (light.space === \"view\") {\n src.push(\"light.direction = normalize(lightDir\" + i + \");\");\n } else {\n src.push(\"light.direction = normalize((viewMatrix * vec4(lightDir\" + i + \", 0.0)).xyz);\");\n }\n } else {\n continue;\n }\n\n src.push(\"light.color = lightColor\" + i + \".rgb * lightColor\" + i + \".a;\"); // a is intensity\n\n src.push(\"computePBRLighting(light, geometry, material, reflectedLight);\");\n }\n\n src.push(\"vec3 emissiveColor = sRGBToLinear(texture(uEmissiveMap, vUV)).rgb;\"); // TODO: correct gamma function\n\n src.push(\"vec3 outgoingLight = (lightAmbient.rgb * lightAmbient.a * baseColor * opacity * rgb) + (reflectedLight.diffuse) + (reflectedLight.specular) + emissiveColor;\");\n src.push(\"vec4 fragColor;\");\n\n if (this._withSAO) {\n // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top\n // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject\n src.push(\" float viewportWidth = uSAOParams[0];\");\n src.push(\" float viewportHeight = uSAOParams[1];\");\n src.push(\" float blendCutoff = uSAOParams[2];\");\n src.push(\" float blendFactor = uSAOParams[3];\");\n src.push(\" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);\");\n src.push(\" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;\");\n src.push(\" fragColor = vec4(outgoingLight.rgb * ambient, opacity);\");\n } else {\n src.push(\" fragColor = vec4(outgoingLight.rgb, opacity);\");\n }\n\n if (gammaOutput) {\n src.push(\"fragColor = linearToGamma(fragColor, gammaFactor);\");\n }\n\n src.push(\"outColor = fragColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7620, + "__docId__": 7628, "kind": "variable", "name": "TEXTURE_DECODE_FUNCS", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js", @@ -151400,7 +151616,7 @@ "ignore": true }, { - "__docId__": 7621, + "__docId__": 7629, "kind": "class", "name": "TrianglesPBRRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js", @@ -151419,7 +151635,7 @@ "ignore": true }, { - "__docId__": 7622, + "__docId__": 7630, "kind": "method", "name": "_getHash", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -151440,7 +151656,7 @@ } }, { - "__docId__": 7623, + "__docId__": 7631, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -151475,7 +151691,7 @@ "return": null }, { - "__docId__": 7624, + "__docId__": 7632, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -151496,7 +151712,7 @@ } }, { - "__docId__": 7625, + "__docId__": 7633, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js~TrianglesPBRRenderer", @@ -151517,18 +151733,18 @@ } }, { - "__docId__": 7626, + "__docId__": 7634, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n/**\n * @private\n */\nexport class TrianglesPickDepthRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry depth vertex shader\");\n\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vViewPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\" vViewPosition = viewPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry depth fragment shader\");\n\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n src.push(\"uniform float pickZNear;\");\n src.push(\"uniform float pickZFar;\");\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vViewPosition;\");\n src.push(\"vec4 packDepth(const in float depth) {\");\n src.push(\" const vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\");\n src.push(\" const vec4 bitMask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\");\n src.push(\" vec4 res = fract(depth * bitShift);\");\n src.push(\" res -= res.xxyz * bitMask;\");\n src.push(\" return res;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" float zNormalizedDepth = abs((pickZNear + vViewPosition.z) / (pickZFar - pickZNear));\");\n src.push(\" outColor = packDepth(zNormalizedDepth); \"); // Must be linear depth\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7627, + "__docId__": 7635, "kind": "class", "name": "TrianglesPickDepthRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js", @@ -151547,7 +151763,7 @@ "ignore": true }, { - "__docId__": 7628, + "__docId__": 7636, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js~TrianglesPickDepthRenderer", @@ -151568,7 +151784,7 @@ } }, { - "__docId__": 7629, + "__docId__": 7637, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js~TrianglesPickDepthRenderer", @@ -151589,18 +151805,18 @@ } }, { - "__docId__": 7630, + "__docId__": 7638, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesPickMeshRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry picking vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 pickColor;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vPickColor;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n\n src.push(\" vPickColor = vec4(float(pickColor.r) / 255.0, float(pickColor.g) / 255.0, float(pickColor.b) / 255.0, float(pickColor.a) / 255.0);\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry picking fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec4 vPickColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = vPickColor; \");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7631, + "__docId__": 7639, "kind": "class", "name": "TrianglesPickMeshRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js", @@ -151619,7 +151835,7 @@ "ignore": true }, { - "__docId__": 7632, + "__docId__": 7640, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js~TrianglesPickMeshRenderer", @@ -151640,7 +151856,7 @@ } }, { - "__docId__": 7633, + "__docId__": 7641, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js~TrianglesPickMeshRenderer", @@ -151661,18 +151877,18 @@ } }, { - "__docId__": 7634, + "__docId__": 7642, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", "content": "import { math } from \"../../../../../math/math.js\";\nimport {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesPickNormalsFlatRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry normals vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src, 3);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n\n if (clipping) {\n src.push(\"vFlags = flags;\");\n }\n\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry normals fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"in vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\" vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\" vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(` outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7635, + "__docId__": 7643, "kind": "class", "name": "TrianglesPickNormalsFlatRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js", @@ -151691,7 +151907,7 @@ "ignore": true }, { - "__docId__": 7636, + "__docId__": 7644, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js~TrianglesPickNormalsFlatRenderer", @@ -151712,7 +151928,7 @@ } }, { - "__docId__": 7637, + "__docId__": 7645, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js~TrianglesPickNormalsFlatRenderer", @@ -151733,18 +151949,18 @@ } }, { - "__docId__": 7638, + "__docId__": 7646, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js", "content": "import { math } from \"../../../../../math/math.js\";\nimport {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesPickNormalsRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry normals vertex shader\");\n \n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec2 normal;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"in vec4 modelNormalMatrixCol0;\");\n src.push(\"in vec4 modelNormalMatrixCol1;\");\n src.push(\"in vec4 modelNormalMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n this._addRemapClipPosLines(src, 3);\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec3 octDecode(vec2 oct) {\");\n src.push(\" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));\");\n src.push(\" if (v.z < 0.0) {\");\n src.push(\" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);\");\n src.push(\" }\");\n src.push(\" return normalize(v);\");\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out vec3 vWorldNormal;\");\n src.push(\"void main(void) {\");\n\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); \");\n src.push(\" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));\");\n src.push(\" vWorldNormal = worldNormal;\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = remapClipPos(clipPos);\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Batched geometry normals fragment shader\");\n\n \n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vWorldNormal;\");\n src.push(\"out highp ivec4 outNormal;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(` outNormal = ivec4(vWorldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"}\");\n return src;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7639, + "__docId__": 7647, "kind": "class", "name": "TrianglesPickNormalsRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js", @@ -151763,7 +151979,7 @@ "ignore": true }, { - "__docId__": 7640, + "__docId__": 7648, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js~TrianglesPickNormalsRenderer", @@ -151784,7 +152000,7 @@ } }, { - "__docId__": 7641, + "__docId__": 7649, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js~TrianglesPickNormalsRenderer", @@ -151805,18 +152021,18 @@ } }, { - "__docId__": 7642, + "__docId__": 7650, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * Renders InstancingLayer fragment depths to a shadow map.\n *\n * @private\n */\nexport class TrianglesShadowRenderer extends TrianglesInstancingRenderer {\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry shadow drawing vertex shader\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in vec4 color;\");\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\");\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform mat4 shadowViewMatrix;\");\n src.push(\"uniform mat4 shadowProjMatrix;\");\n\n this._addMatricesUniformBlockLines(src);\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"void main(void) {\");\n src.push(`int colorFlag = int(flags) & 0xF;`);\n src.push(\"bool visible = (colorFlag > 0);\");\n src.push(\"bool transparent = ((float(color.a) / 255.0) < 1.0);\");\n src.push(`if (!visible || transparent) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\" vec4 viewPosition = shadowViewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\" gl_Position = shadowProjMatrix * viewPosition;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing geometry depth drawing fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in vec3 vViewNormal;\");\n src.push(\"vec3 packNormalToRGB( const in vec3 normal ) {\");\n src.push(\" return normalize( normal ) * 0.5 + 0.5;\");\n src.push(\"}\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); \");\n src.push(\"}\");\n return src;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7643, + "__docId__": 7651, "kind": "class", "name": "TrianglesShadowRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js", @@ -151835,7 +152051,7 @@ "ignore": true }, { - "__docId__": 7644, + "__docId__": 7652, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js~TrianglesShadowRenderer", @@ -151856,7 +152072,7 @@ } }, { - "__docId__": 7645, + "__docId__": 7653, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js~TrianglesShadowRenderer", @@ -151877,18 +152093,18 @@ } }, { - "__docId__": 7646, + "__docId__": 7654, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js", "content": "import {TrianglesInstancingRenderer} from \"./TrianglesInstancingRenderer.js\";\n\n/**\n * @private\n */\nexport class TrianglesSilhouetteRenderer extends TrianglesInstancingRenderer {\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n // TODO color uniform true ???\n super.drawLayer(frameCtx, instancingLayer, renderPass, { colorUniform: true });\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing silhouette vertex shader\");\n\n src.push(\"uniform int renderPass;\");\n\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 color;\");\n\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec4 silhouetteColor;\");\n\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n\n src.push(\"out vec4 vColor;\");\n\n src.push(\"void main(void) {\");\n\n // silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED\n\n src.push(`int silhouetteFlag = int(flags) >> 4 & 0xF;`);\n src.push(`if (silhouetteFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n\n src.push(\"} else {\");\n\n src.push(\"vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\"worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"vec4 viewPosition = viewMatrix * worldPosition; \");\n\n if (clipping) {\n src.push(\"vWorldPosition = worldPosition;\");\n src.push(\"vFlags = flags;\");\n }\n src.push(\"vColor = vec4(silhouetteColor.r, silhouetteColor.g, silhouetteColor.b, min(silhouetteColor.a, float(color.a) / 255.0));\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// Instancing fill fragment shader\");\n\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n src.push(\"uniform float sliceThickness;\");\n src.push(\"uniform vec4 sliceColor;\");\n }\n src.push(\"in vec4 vColor;\");\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n src.push(\" vec4 newColor;\");\n src.push(\" newColor = vColor;\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > sliceThickness) { \");\n src.push(\" discard;\")\n src.push(\" }\");\n src.push(\" if (dist > 0.0) { \");\n src.push(\" newColor = sliceColor;\");\n src.push(\" }\");\n src.push(\"}\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outColor = newColor;\");\n src.push(\"}\");\n return src;\n }\n}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7647, + "__docId__": 7655, "kind": "class", "name": "TrianglesSilhouetteRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js", @@ -151907,7 +152123,7 @@ "ignore": true }, { - "__docId__": 7648, + "__docId__": 7656, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", @@ -151942,7 +152158,7 @@ "return": null }, { - "__docId__": 7649, + "__docId__": 7657, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", @@ -151963,7 +152179,7 @@ } }, { - "__docId__": 7650, + "__docId__": 7658, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js~TrianglesSilhouetteRenderer", @@ -151984,18 +152200,18 @@ } }, { - "__docId__": 7651, + "__docId__": 7659, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", "content": "import {VBORenderer} from \"../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class TrianglesSnapInitRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate();\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const gl = scene.canvas.gl;\n const camera = scene.camera;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n\n if (this._aFlags) {\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n }\n\n state.indicesBuf.bind();\n gl.drawElementsInstanced(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);\n state.indicesBuf.unbind();\n\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n if (this._aFlags) {\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n }\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\");\n this.uVectorA = program.getLocation(\"snapVectorA\");\n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\");\n this._uLayerNumber = program.getLocation(\"layerNumber\");\n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\");\n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthBufInitRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec4 pickColor;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\");\n src.push(\"uniform vec2 snapVectorA;\");\n src.push(\"uniform vec2 snapInvVectorAB;\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n src.push(\"flat out vec4 vPickColor;\");\n src.push(\"out vec4 vWorldPosition;\");\n if (clipping) {\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n src.push(\" vWorldPosition = worldPosition;\");\n if (clipping) {\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vPickColor = pickColor;\");\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// Points instancing pick depth fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\");\n src.push(\"uniform vec3 coordinateScaler;\");\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"flat in vec4 vPickColor;\");\n if (clipping) {\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"layout(location = 0) out highp ivec4 outCoords;\");\n src.push(\"layout(location = 1) out highp ivec4 outNormal;\");\n src.push(\"layout(location = 2) out lowp uvec4 outPickColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" float dx = dFdx(vFragDepth);\")\n src.push(\" float dy = dFdy(vFragDepth);\")\n src.push(\" float diff = sqrt(dx*dx+dy*dy);\");\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);\")\n\n src.push(\"vec3 xTangent = dFdx( vWorldPosition.xyz );\");\n src.push(\"vec3 yTangent = dFdy( vWorldPosition.xyz );\");\n src.push(\"vec3 worldNormal = normalize( cross( xTangent, yTangent ) );\");\n src.push(`outNormal = ivec4(worldNormal * float(${math.MAX_INT}), 1.0);`);\n src.push(\"outPickColor = uvec4(vPickColor);\");\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7652, + "__docId__": 7660, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152016,7 +152232,7 @@ "ignore": true }, { - "__docId__": 7653, + "__docId__": 7661, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152037,7 +152253,7 @@ "ignore": true }, { - "__docId__": 7654, + "__docId__": 7662, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152058,7 +152274,7 @@ "ignore": true }, { - "__docId__": 7655, + "__docId__": 7663, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152079,7 +152295,7 @@ "ignore": true }, { - "__docId__": 7656, + "__docId__": 7664, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152100,7 +152316,7 @@ "ignore": true }, { - "__docId__": 7657, + "__docId__": 7665, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152121,7 +152337,7 @@ "ignore": true }, { - "__docId__": 7658, + "__docId__": 7666, "kind": "class", "name": "TrianglesSnapInitRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js", @@ -152140,7 +152356,7 @@ "ignore": true }, { - "__docId__": 7659, + "__docId__": 7667, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152154,7 +152370,7 @@ "undocument": true }, { - "__docId__": 7660, + "__docId__": 7668, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152189,7 +152405,7 @@ "return": null }, { - "__docId__": 7661, + "__docId__": 7669, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152206,7 +152422,7 @@ "return": null }, { - "__docId__": 7662, + "__docId__": 7670, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152224,7 +152440,7 @@ } }, { - "__docId__": 7663, + "__docId__": 7671, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152242,7 +152458,7 @@ } }, { - "__docId__": 7664, + "__docId__": 7672, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152259,7 +152475,7 @@ } }, { - "__docId__": 7665, + "__docId__": 7673, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152276,7 +152492,7 @@ } }, { - "__docId__": 7666, + "__docId__": 7674, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152294,7 +152510,7 @@ } }, { - "__docId__": 7667, + "__docId__": 7675, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152312,7 +152528,7 @@ } }, { - "__docId__": 7668, + "__docId__": 7676, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152329,7 +152545,7 @@ "return": null }, { - "__docId__": 7669, + "__docId__": 7677, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152350,7 +152566,7 @@ } }, { - "__docId__": 7670, + "__docId__": 7678, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152371,7 +152587,7 @@ } }, { - "__docId__": 7671, + "__docId__": 7679, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152387,7 +152603,7 @@ "return": null }, { - "__docId__": 7672, + "__docId__": 7680, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152405,7 +152621,7 @@ } }, { - "__docId__": 7673, + "__docId__": 7681, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js~TrianglesSnapInitRenderer", @@ -152421,18 +152637,18 @@ "return": null }, { - "__docId__": 7675, + "__docId__": 7683, "kind": "file", "name": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", "content": "import {VBORenderer} from \"./../../../VBORenderer.js\";\nimport {createRTCViewMat} from \"../../../../../math/rtcCoords.js\";\nimport {math} from \"../../../../../math/math.js\";\n\nconst tempVec3a = math.vec3();\nconst tempVec3b = math.vec3();\nconst tempVec3c = math.vec3();\nconst tempVec3d = math.vec3();\nconst tempMat4a = math.mat4();\n\nconst SNAPPING_LOG_DEPTH_BUF_ENABLED = true; // Improves occlusion accuracy at distance\n\n/**\n * @private\n */\nexport class TrianglesSnapRenderer extends VBORenderer {\n\n constructor(scene) {\n super(scene, false, { instancing: true });\n }\n\n drawLayer(frameCtx, instancingLayer, renderPass) {\n\n if (!this._program) {\n this._allocate(instancingLayer);\n if (this.errors) {\n return;\n }\n }\n\n if (frameCtx.lastProgramId !== this._program.id) {\n frameCtx.lastProgramId = this._program.id;\n this._bindProgram();\n }\n\n const model = instancingLayer.model;\n const scene = model.scene;\n const camera = scene.camera;\n const gl = scene.canvas.gl;\n const state = instancingLayer._state;\n const origin = instancingLayer._state.origin;\n const {position, rotationMatrix, rotationMatrixConjugate} = model;\n const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy\n const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;\n\n if (this._vaoCache.has(instancingLayer)) {\n gl.bindVertexArray(this._vaoCache.get(instancingLayer));\n } else {\n this._vaoCache.set(instancingLayer, this._makeVAO(state))\n }\n\n const coordinateScaler = tempVec3a;\n coordinateScaler[0] = math.safeInv(aabb[3] - aabb[0]) * math.MAX_INT;\n coordinateScaler[1] = math.safeInv(aabb[4] - aabb[1]) * math.MAX_INT;\n coordinateScaler[2] = math.safeInv(aabb[5] - aabb[2]) * math.MAX_INT;\n\n frameCtx.snapPickCoordinateScale[0] = math.safeInv(coordinateScaler[0]);\n frameCtx.snapPickCoordinateScale[1] = math.safeInv(coordinateScaler[1]);\n frameCtx.snapPickCoordinateScale[2] = math.safeInv(coordinateScaler[2]);\n\n let rtcViewMatrix;\n let rtcCameraEye;\n\n if (origin || position[0] !== 0 || position[1] !== 0 || position[2] !== 0) {\n const rtcOrigin = tempVec3b;\n if (origin) {\n const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3c);\n rtcOrigin[0] = rotatedOrigin[0];\n rtcOrigin[1] = rotatedOrigin[1];\n rtcOrigin[2] = rotatedOrigin[2];\n } else {\n rtcOrigin[0] = 0;\n rtcOrigin[1] = 0;\n rtcOrigin[2] = 0;\n }\n rtcOrigin[0] += position[0];\n rtcOrigin[1] += position[1];\n rtcOrigin[2] += position[2];\n rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a);\n rtcCameraEye = tempVec3d;\n rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];\n rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];\n rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];\n frameCtx.snapPickOrigin[0] = rtcOrigin[0];\n frameCtx.snapPickOrigin[1] = rtcOrigin[1];\n frameCtx.snapPickOrigin[2] = rtcOrigin[2];\n } else {\n rtcViewMatrix = viewMatrix;\n rtcCameraEye = camera.eye;\n frameCtx.snapPickOrigin[0] = 0;\n frameCtx.snapPickOrigin[1] = 0;\n frameCtx.snapPickOrigin[2] = 0;\n }\n\n gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);\n gl.uniform2fv(this.uVectorA, frameCtx.snapVectorA);\n gl.uniform2fv(this.uInverseVectorAB, frameCtx.snapInvVectorAB);\n gl.uniform1i(this._uLayerNumber, frameCtx.snapPickLayerNumber);\n gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);\n gl.uniform1i(this._uRenderPass, renderPass);\n gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);\n\n let offset = 0;\n const mat4Size = 4 * 4;\n\n this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);\n this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);\n this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);\n\n gl.bindBuffer(gl.UNIFORM_BUFFER, this._matricesUniformBlockBuffer);\n gl.bufferData(gl.UNIFORM_BUFFER, this._matricesUniformBlockBufferData, gl.DYNAMIC_DRAW);\n\n gl.bindBufferBase(\n gl.UNIFORM_BUFFER,\n this._matricesUniformBlockBufferBindingPoint,\n this._matricesUniformBlockBuffer);\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n this.setSectionPlanesStateUniforms(instancingLayer);\n\n\n this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);\n this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);\n this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);\n\n this._aFlags.bindArrayBuffer(state.flagsBuf);\n gl.vertexAttribDivisor(this._aFlags.location, 1);\n\n if (frameCtx.snapMode === \"edge\") {\n state.edgeIndicesBuf.bind();\n gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);\n state.edgeIndicesBuf.unbind(); // needed?\n } else {\n gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);\n }\n // Cleanup\n gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);\n gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);\n gl.vertexAttribDivisor(this._aFlags.location, 0);\n if (this._aOffset) {\n gl.vertexAttribDivisor(this._aOffset.location, 0);\n }\n }\n\n _allocate() {\n super._allocate();\n\n const program = this._program;\n\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n this._uCameraEyeRtc = program.getLocation(\"uCameraEyeRtc\"); \n this.uVectorA = program.getLocation(\"snapVectorA\"); \n this.uInverseVectorAB = program.getLocation(\"snapInvVectorAB\"); \n this._uLayerNumber = program.getLocation(\"layerNumber\"); \n this._uCoordinateScaler = program.getLocation(\"coordinateScaler\"); \n }\n\n _bindProgram() {\n this._program.bind();\n\n }\n\n _buildVertexShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer vertex shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"precision highp usampler2D;\");\n src.push(\"precision highp isampler2D;\");\n src.push(\"precision highp sampler2D;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"precision mediump usampler2D;\");\n src.push(\"precision mediump isampler2D;\");\n src.push(\"precision mediump sampler2D;\");\n src.push(\"#endif\");\n src.push(\"uniform int renderPass;\");\n src.push(\"in vec3 position;\");\n if (scene.entityOffsetsEnabled) {\n src.push(\"in vec3 offset;\");\n }\n src.push(\"in float flags;\");\n src.push(\"in vec4 modelMatrixCol0;\"); // Modeling matrix\n src.push(\"in vec4 modelMatrixCol1;\");\n src.push(\"in vec4 modelMatrixCol2;\");\n src.push(\"uniform bool pickInvisible;\");\n\n this._addMatricesUniformBlockLines(src);\n\n src.push(\"uniform vec3 uCameraEyeRtc;\"); \n src.push(\"uniform vec2 snapVectorA;\"); \n src.push(\"uniform vec2 snapInvVectorAB;\"); \n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n src.push(\"bool isPerspectiveMatrix(mat4 m) {\");\n src.push(\" return (m[2][3] == - 1.0);\");\n src.push(\"}\");\n src.push(\"out float isPerspective;\");\n }\n src.push(\"vec2 remapClipPos(vec2 clipPos) {\");\n src.push(\" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;\");\n src.push(\" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;\");\n src.push(\" return vec2(x, y);\")\n src.push(\"}\");\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n src.push(\"out float vFlags;\");\n }\n src.push(\"out highp vec3 relativeToOriginPosition;\");\n src.push(\"void main(void) {\");\n // pickFlag = NOT_RENDERED | PICK\n // renderPass = PICK\n src.push(`int pickFlag = int(flags) >> 12 & 0xF;`);\n src.push(`if (pickFlag != renderPass) {`);\n src.push(\" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);\"); // Cull vertex\n src.push(\"} else {\");\n src.push(\" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); \");\n src.push(\" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);\");\n if (scene.entityOffsetsEnabled) {\n src.push(\" worldPosition.xyz = worldPosition.xyz + offset;\");\n }\n src.push(\"relativeToOriginPosition = worldPosition.xyz;\")\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition; \");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n src.push(\" vFlags = flags;\");\n }\n src.push(\"vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\"float tmp = clipPos.w;\")\n src.push(\"clipPos.xyzw /= tmp;\")\n src.push(\"clipPos.xy = remapClipPos(clipPos.xy);\");\n src.push(\"clipPos.xyzw *= tmp;\")\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n src.push(\"isPerspective = float (isPerspectiveMatrix(projMatrix));\");\n }\n src.push(\"gl_Position = clipPos;\");\n src.push(\"gl_PointSize = 1.0;\"); // Windows needs this?\n src.push(\"}\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShader() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;\n const src = [];\n src.push ('#version 300 es');\n src.push(\"// SnapInstancingDepthRenderer fragment shader\");\n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\"in float isPerspective;\");\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n src.push(\"uniform int layerNumber;\"); \n src.push(\"uniform vec3 coordinateScaler;\"); \n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n src.push(\"in float vFlags;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"in highp vec3 relativeToOriginPosition;\");\n src.push(\"out highp ivec4 outCoords;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;\");\n src.push(\" if (clippable) {\");\n src.push(\" float dist = 0.0;\");\n for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\"if (dist > 0.0) { discard; }\");\n src.push(\"}\");\n }\n if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {\n src.push(\" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\"outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);\")\n src.push(\"}\");\n return src;\n }\n\n webglContextRestored() {\n this._program = null;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n }\n this._program = null;\n }\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7676, + "__docId__": 7684, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152453,7 +152669,7 @@ "ignore": true }, { - "__docId__": 7677, + "__docId__": 7685, "kind": "variable", "name": "tempVec3b", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152474,7 +152690,7 @@ "ignore": true }, { - "__docId__": 7678, + "__docId__": 7686, "kind": "variable", "name": "tempVec3c", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152495,7 +152711,7 @@ "ignore": true }, { - "__docId__": 7679, + "__docId__": 7687, "kind": "variable", "name": "tempVec3d", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152516,7 +152732,7 @@ "ignore": true }, { - "__docId__": 7680, + "__docId__": 7688, "kind": "variable", "name": "tempMat4a", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152537,7 +152753,7 @@ "ignore": true }, { - "__docId__": 7681, + "__docId__": 7689, "kind": "variable", "name": "SNAPPING_LOG_DEPTH_BUF_ENABLED", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152558,7 +152774,7 @@ "ignore": true }, { - "__docId__": 7682, + "__docId__": 7690, "kind": "class", "name": "TrianglesSnapRenderer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js", @@ -152577,7 +152793,7 @@ "ignore": true }, { - "__docId__": 7683, + "__docId__": 7691, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152591,7 +152807,7 @@ "undocument": true }, { - "__docId__": 7684, + "__docId__": 7692, "kind": "method", "name": "drawLayer", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152626,7 +152842,7 @@ "return": null }, { - "__docId__": 7685, + "__docId__": 7693, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152643,7 +152859,7 @@ "return": null }, { - "__docId__": 7686, + "__docId__": 7694, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152661,7 +152877,7 @@ } }, { - "__docId__": 7687, + "__docId__": 7695, "kind": "member", "name": "_uCameraEyeRtc", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152679,7 +152895,7 @@ } }, { - "__docId__": 7688, + "__docId__": 7696, "kind": "member", "name": "uVectorA", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152696,7 +152912,7 @@ } }, { - "__docId__": 7689, + "__docId__": 7697, "kind": "member", "name": "uInverseVectorAB", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152713,7 +152929,7 @@ } }, { - "__docId__": 7690, + "__docId__": 7698, "kind": "member", "name": "_uLayerNumber", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152731,7 +152947,7 @@ } }, { - "__docId__": 7691, + "__docId__": 7699, "kind": "member", "name": "_uCoordinateScaler", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152749,7 +152965,7 @@ } }, { - "__docId__": 7692, + "__docId__": 7700, "kind": "method", "name": "_bindProgram", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152766,7 +152982,7 @@ "return": null }, { - "__docId__": 7693, + "__docId__": 7701, "kind": "method", "name": "_buildVertexShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152787,7 +153003,7 @@ } }, { - "__docId__": 7694, + "__docId__": 7702, "kind": "method", "name": "_buildFragmentShader", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152808,7 +153024,7 @@ } }, { - "__docId__": 7695, + "__docId__": 7703, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152824,7 +153040,7 @@ "return": null }, { - "__docId__": 7696, + "__docId__": 7704, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152842,7 +153058,7 @@ } }, { - "__docId__": 7697, + "__docId__": 7705, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js~TrianglesSnapRenderer", @@ -152858,18 +153074,18 @@ "return": null }, { - "__docId__": 7699, + "__docId__": 7707, "kind": "file", "name": "src/viewer/scene/nodes/Node.js", "content": "import {utils} from '../utils.js';\nimport {Component} from '../Component.js';\nimport {math} from '../math/math.js';\n\nconst angleAxis = math.vec4(4);\nconst q1 = math.vec4();\nconst q2 = math.vec4();\nconst xAxis = math.vec3([1, 0, 0]);\nconst yAxis = math.vec3([0, 1, 0]);\nconst zAxis = math.vec3([0, 0, 1]);\n\nconst veca = math.vec3(3);\nconst vecb = math.vec3(3);\n\nconst identityMat = math.identityMat4();\n\n/**\n * @desc An {@link Entity} that is a scene graph node that can have child Nodes and {@link Mesh}es.\n *\n * ## Usage\n *\n * The example below is the same as the one given for {@link Mesh}, since the two classes work together. In this example,\n * we'll create a scene graph in which a root Node represents a group and the {@link Mesh}s are leaves. Since Node\n * implements {@link Entity}, we can designate the root Node as a model, causing it to be registered by its ID in {@link Scene#models}.\n *\n * Since {@link Mesh} also implements {@link Entity}, we can designate the leaf {@link Mesh}es as objects, causing them to\n * be registered by their IDs in {@link Scene#objects}.\n *\n * We can then find those {@link Entity} types in {@link Scene#models} and {@link Scene#objects}.\n *\n * We can also update properties of our object-Meshes via calls to {@link Scene#setObjectsHighlighted} etc.\n *\n * [[Run this example](/examples/index.html#sceneRepresentation_SceneGraph)]\n *\n * ````javascript\n * import {Viewer, Mesh, Node, PhongMaterial} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * new Node(viewer.scene, {\n * id: \"table\",\n * isModel: true, // <---------- Node represents a model, so is registered by ID in viewer.scene.models\n * rotation: [0, 50, 0],\n * position: [0, 0, 0],\n * scale: [1, 1, 1],\n *\n * children: [\n *\n * new Mesh(viewer.scene, { // Red table leg\n * id: \"redLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [-4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1, 0.3, 0.3]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Green table leg\n * id: \"greenLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [4, -6, -4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 1.0, 0.3]\n * })\n * }),\n *\n * new Mesh(viewer.scene, {// Blue table leg\n * id: \"blueLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [0.3, 0.3, 1.0]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Yellow table leg\n * id: \"yellowLeg\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [-4, -6, 4],\n * scale: [1, 3, 1],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 1.0, 0.0]\n * })\n * }),\n *\n * new Mesh(viewer.scene, { // Purple table top\n * id: \"tableTop\",\n * isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects\n * position: [0, -3, 0],\n * scale: [6, 0.5, 6],\n * rotation: [0, 0, 0],\n * material: new PhongMaterial(viewer.scene, {\n * diffuse: [1.0, 0.3, 1.0]\n * })\n * })\n * ]\n * });\n *\n * // Find Nodes and Meshes by their IDs\n *\n * var table = viewer.scene.models[\"table\"]; // Since table Node has isModel == true\n *\n * var redLeg = viewer.scene.objects[\"redLeg\"]; // Since the Meshes have isObject == true\n * var greenLeg = viewer.scene.objects[\"greenLeg\"];\n * var blueLeg = viewer.scene.objects[\"blueLeg\"];\n *\n * // Highlight one of the table leg Meshes\n *\n * viewer.scene.setObjectsHighlighted([\"redLeg\"], true); // Since the Meshes have isObject == true\n *\n * // Periodically update transforms on our Nodes and Meshes\n *\n * viewer.scene.on(\"tick\", function () {\n *\n * // Rotate legs\n * redLeg.rotateY(0.5);\n * greenLeg.rotateY(0.5);\n * blueLeg.rotateY(0.5);\n *\n * // Rotate table\n * table.rotateY(0.5);\n * table.rotateX(0.3);\n * });\n * ````\n *\n * ## Metadata\n *\n * As mentioned, we can also associate {@link MetaModel}s and {@link MetaObject}s with our Nodes and {@link Mesh}es,\n * within a {@link MetaScene}. See {@link MetaScene} for an example.\n *\n * @implements {Entity}\n */\nclass Node extends Component {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.\n * @param {Boolean} [cfg.isModel] Specify ````true```` if this Mesh represents a model, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and may also have a corresponding {@link MetaModel} with matching {@link MetaModel#id}, registered by that ID in {@link MetaScene#metaModels}.\n * @param {Boolean} [cfg.isObject] Specify ````true```` if this Mesh represents an object, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and may also have a corresponding {@link MetaObject} with matching {@link MetaObject#id}, registered by that ID in {@link MetaScene#metaObjects}.\n * @param {Node} [cfg.parent] The parent Node.\n * @param {Number[]} [cfg.origin] World-space origin for this Node.\n * @param {Number[]} [cfg.rtcCenter] Deprecated - renamed to ````origin````.\n * @param {Number[]} [cfg.position=[0,0,0]] Local 3D position.\n * @param {Number[]} [cfg.scale=[1,1,1]] Local scale.\n * @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1] Local modelling transform matrix. Overrides the position, scale and rotation parameters.\n * @param {Number[]} [cfg.offset=[0,0,0]] World-space 3D translation offset. Translates the Node in World space, after modelling transforms.\n * @param {Boolean} [cfg.visible=true] Indicates if the Node is initially visible.\n * @param {Boolean} [cfg.culled=false] Indicates if the Node is initially culled from view.\n * @param {Boolean} [cfg.pickable=true] Indicates if the Node is initially pickable.\n * @param {Boolean} [cfg.clippable=true] Indicates if the Node is initially clippable.\n * @param {Boolean} [cfg.collidable=true] Indicates if the Node is initially included in boundary calculations.\n * @param {Boolean} [cfg.castsShadow=true] Indicates if the Node initially casts shadows.\n * @param {Boolean} [cfg.receivesShadow=true] Indicates if the Node initially receives shadows.\n * @param {Boolean} [cfg.xrayed=false] Indicates if the Node is initially xrayed.\n * @param {Boolean} [cfg.highlighted=false] Indicates if the Node is initially highlighted.\n * @param {Boolean} [cfg.selected=false] Indicates if the Mesh is initially selected.\n * @param {Boolean} [cfg.edges=false] Indicates if the Node's edges are initially emphasized.\n * @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] Node's initial RGB colorize color, multiplies by the rendered fragment colors.\n * @param {Number} [cfg.opacity=1.0] Node's initial opacity factor, multiplies by the rendered fragment alpha.\n * @param {Array} [cfg.children] Child Nodes or {@link Mesh}es to add initially. Children must be in the same {@link Scene} and will be removed first from whatever parents they may already have.\n * @param {Boolean} [cfg.inheritStates=true] Indicates if children given to this constructor should inherit rendering state from this parent as they are added. Rendering state includes {@link Node#visible}, {@link Node#culled}, {@link Node#pickable}, {@link Node#clippable}, {@link Node#castsShadow}, {@link Node#receivesShadow}, {@link Node#selected}, {@link Node#highlighted}, {@link Node#colorize} and {@link Node#opacity}.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._parentNode = null;\n this._children = [];\n\n this._aabb = null;\n this._aabbDirty = true;\n\n this.scene._aabbDirty = true;\n\n this._numTriangles = 0;\n\n this._scale = math.vec3();\n this._quaternion = math.identityQuaternion();\n this._rotation = math.vec3();\n this._position = math.vec3();\n this._offset = math.vec3();\n\n this._localMatrix = math.identityMat4();\n this._worldMatrix = math.identityMat4();\n\n this._localMatrixDirty = true;\n this._worldMatrixDirty = true;\n\n if (cfg.matrix) {\n this.matrix = cfg.matrix;\n } else {\n this.scale = cfg.scale;\n this.position = cfg.position;\n if (cfg.quaternion) {\n } else {\n this.rotation = cfg.rotation;\n }\n }\n\n this._isModel = cfg.isModel;\n if (this._isModel) {\n this.scene._registerModel(this);\n }\n\n this._isObject = cfg.isObject;\n if (this._isObject) {\n this.scene._registerObject(this);\n }\n\n this.origin = cfg.origin;\n this.visible = cfg.visible;\n this.culled = cfg.culled;\n this.pickable = cfg.pickable;\n this.clippable = cfg.clippable;\n this.collidable = cfg.collidable;\n this.castsShadow = cfg.castsShadow;\n this.receivesShadow = cfg.receivesShadow;\n this.xrayed = cfg.xrayed;\n this.highlighted = cfg.highlighted;\n this.selected = cfg.selected;\n this.edges = cfg.edges;\n this.colorize = cfg.colorize;\n this.opacity = cfg.opacity;\n this.offset = cfg.offset;\n\n // Add children, which inherit state from this Node\n\n if (cfg.children) {\n const children = cfg.children;\n for (let i = 0, len = children.length; i < len; i++) {\n this.addChild(children[i], cfg.inheritStates);\n }\n }\n\n if (cfg.parentId) {\n const parentNode = this.scene.components[cfg.parentId];\n if (!parentNode) {\n this.error(\"Parent not found: '\" + cfg.parentId + \"'\");\n } else if (!parentNode.isNode) {\n this.error(\"Parent is not a Node: '\" + cfg.parentId + \"'\");\n } else {\n parentNode.addChild(this);\n }\n } else if (cfg.parent) {\n if (!cfg.parent.isNode) {\n this.error(\"Parent is not a Node\");\n }\n cfg.parent.addChild(this);\n }\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Entity members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns true to indicate that this Component is an Entity.\n * @type {Boolean}\n */\n get isEntity() {\n return true;\n }\n\n /**\n * Returns ````true```` if this Mesh represents a model.\n *\n * When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and\n * may also have a corresponding {@link MetaModel}.\n *\n * @type {Boolean}\n */\n get isModel() {\n return this._isModel;\n }\n\n /**\n * Returns ````true```` if this Node represents an object.\n *\n * When ````true```` the Node will be registered by {@link Node#id} in\n * {@link Scene#objects} and may also have a {@link MetaObject} with matching {@link MetaObject#id}.\n *\n * @type {Boolean}\n * @abstract\n */\n get isObject() {\n return this._isObject;\n }\n\n /**\n * Gets the Node's World-space 3D axis-aligned bounding box.\n *\n * Represented by a six-element Float64Array containing the min/max extents of the\n * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * @type {Number[]}\n */\n get aabb() {\n if (this._aabbDirty) {\n this._updateAABB();\n }\n return this._aabb;\n }\n\n /**\n * Sets the World-space origin for this Node.\n *\n * @type {Float64Array}\n */\n set origin(origin) {\n if (origin) {\n if (!this._origin) {\n this._origin = math.vec3();\n }\n this._origin.set(origin);\n } else {\n if (this._origin) {\n this._origin = null;\n }\n }\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].origin = origin;\n }\n this.glRedraw();\n }\n\n /**\n * Gets the World-space origin for this Node.\n *\n * @type {Float64Array}\n */\n get origin() {\n return this._origin;\n }\n\n /**\n * Sets the World-space origin for this Node.\n *\n * Deprecated and replaced by {@link Node#origin}.\n *\n * @deprecated\n * @type {Float64Array}\n */\n set rtcCenter(rtcCenter) {\n this.origin = rtcCenter;\n }\n\n /**\n * Gets the World-space origin for this Node.\n *\n * Deprecated and replaced by {@link Node#origin}.\n *\n * @deprecated\n * @type {Float64Array}\n */\n get rtcCenter() {\n return this.origin;\n }\n\n /**\n * The number of triangles in this Node.\n *\n * @type {Number}\n */\n get numTriangles() {\n return this._numTriangles;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are visible.\n *\n * Only rendered both {@link Node#visible} is ````true```` and {@link Node#culled} is ````false````.\n *\n * When {@link Node#isObject} and {@link Node#visible} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n set visible(visible) {\n visible = visible !== false;\n this._visible = visible;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].visible = visible;\n }\n if (this._isObject) {\n this.scene._objectVisibilityUpdated(this, visible);\n }\n }\n\n /**\n * Gets if this Node is visible.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * When {@link Node#isObject} and {@link Node#visible} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#visibleObjects}.\n *\n * @type {Boolean}\n */\n get visible() {\n return this._visible;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are xrayed.\n *\n * When {@link Node#isObject} and {@link Node#xrayed} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#xrayedObjects}.\n *\n * @type {Boolean}\n */\n set xrayed(xrayed) {\n xrayed = !!xrayed;\n this._xrayed = xrayed;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].xrayed = xrayed;\n }\n if (this._isObject) {\n this.scene._objectXRayedUpdated(this, xrayed);\n }\n }\n\n /**\n * Gets if this Node is xrayed.\n *\n * When {@link Node#isObject} and {@link Node#xrayed} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#xrayedObjects}.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get xrayed() {\n return this._xrayed;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are highlighted.\n *\n * When {@link Node#isObject} and {@link Node#highlighted} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#highlightedObjects}.\n *\n * @type {Boolean}\n */\n set highlighted(highlighted) {\n highlighted = !!highlighted;\n this._highlighted = highlighted;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].highlighted = highlighted;\n }\n if (this._isObject) {\n this.scene._objectHighlightedUpdated(this, highlighted);\n }\n }\n\n /**\n * Gets if this Node is highlighted.\n *\n * When {@link Node#isObject} and {@link Node#highlighted} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#highlightedObjects}.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get highlighted() {\n return this._highlighted;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are selected.\n *\n * When {@link Node#isObject} and {@link Node#selected} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#selectedObjects}.\n *\n * @type {Boolean}\n */\n set selected(selected) {\n selected = !!selected;\n this._selected = selected;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].selected = selected;\n }\n if (this._isObject) {\n this.scene._objectSelectedUpdated(this, selected);\n }\n }\n\n /**\n * Gets if this Node is selected.\n *\n * When {@link Node#isObject} and {@link Node#selected} are both ````true```` the Node will be\n * registered by {@link Node#id} in {@link Scene#selectedObjects}.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get selected() {\n return this._selected;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are edge-enhanced.\n *\n * @type {Boolean}\n */\n set edges(edges) {\n edges = !!edges;\n this._edges = edges;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].edges = edges;\n }\n }\n\n /**\n * Gets if this Node's edges are enhanced.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get edges() {\n return this._edges;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are culled.\n *\n * @type {Boolean}\n */\n set culled(culled) {\n culled = !!culled;\n this._culled = culled;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].culled = culled;\n }\n }\n\n /**\n * Gets if this Node is culled.\n *\n * @type {Boolean}\n */\n get culled() {\n return this._culled;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#clips}.\n *\n * @type {Boolean}\n */\n set clippable(clippable) {\n clippable = clippable !== false;\n this._clippable = clippable;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].clippable = clippable;\n }\n }\n\n /**\n * Gets if this Node is clippable.\n *\n * Clipping is done by the {@link SectionPlane}s in {@link Scene#clips}.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get clippable() {\n return this._clippable;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are included in boundary calculations.\n *\n * @type {Boolean}\n */\n set collidable(collidable) {\n collidable = collidable !== false;\n this._collidable = collidable;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].collidable = collidable;\n }\n }\n\n /**\n * Gets if this Node is included in boundary calculations.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get collidable() {\n return this._collidable;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es are pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * @type {Boolean}\n */\n set pickable(pickable) {\n pickable = pickable !== false;\n this._pickable = pickable;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].pickable = pickable;\n }\n }\n\n /**\n * Gets if to this Node is pickable.\n *\n * Picking is done via calls to {@link Scene#pick}.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get pickable() {\n return this._pickable;\n }\n\n /**\n * Sets the RGB colorize color for this Node and all child Nodes and {@link Mesh}es}.\n *\n * Multiplies by rendered fragment colors.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * @type {Number[]}\n */\n set colorize(rgb) {\n let colorize = this._colorize;\n if (!colorize) {\n colorize = this._colorize = new Float32Array(4);\n colorize[3] = 1.0;\n }\n if (rgb) {\n colorize[0] = rgb[0];\n colorize[1] = rgb[1];\n colorize[2] = rgb[2];\n } else {\n colorize[0] = 1;\n colorize[1] = 1;\n colorize[2] = 1;\n }\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].colorize = colorize;\n }\n if (this._isObject) {\n const colorized = (!!rgb);\n this.scene._objectColorizeUpdated(this, colorized);\n }\n }\n\n /**\n * Gets the RGB colorize color for this Node.\n *\n * Each element of the color is in range ````[0..1]````.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Number[]}\n */\n get colorize() {\n return this._colorize.slice(0, 3);\n }\n\n /**\n * Sets the opacity factor for this Node and all child Nodes and {@link Mesh}es.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * @type {Number}\n */\n set opacity(opacity) {\n let colorize = this._colorize;\n if (!colorize) {\n colorize = this._colorize = new Float32Array(4);\n colorize[0] = 1;\n colorize[1] = 1;\n colorize[2] = 1;\n }\n colorize[3] = opacity !== null && opacity !== undefined ? opacity : 1.0;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].opacity = opacity;\n }\n if (this._isObject) {\n const opacityUpdated = (opacity !== null && opacity !== undefined);\n this.scene._objectOpacityUpdated(this, opacityUpdated);\n }\n }\n\n /**\n * Gets this Node's opacity factor.\n *\n * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Number}\n */\n get opacity() {\n return this._colorize[3];\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es cast shadows.\n *\n * @type {Boolean}\n */\n set castsShadow(castsShadow) {\n castsShadow = !!castsShadow;\n this._castsShadow = castsShadow;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].castsShadow = castsShadow;\n }\n }\n\n /**\n * Gets if this Node casts shadows.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get castsShadow() {\n return this._castsShadow;\n }\n\n /**\n * Sets if this Node and all child Nodes and {@link Mesh}es can have shadows cast upon them.\n *\n * @type {Boolean}\n */\n set receivesShadow(receivesShadow) {\n receivesShadow = !!receivesShadow;\n this._receivesShadow = receivesShadow;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].receivesShadow = receivesShadow;\n }\n }\n\n /**\n * Whether or not to this Node can have shadows cast upon it.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Boolean}\n */\n get receivesShadow() {\n return this._receivesShadow;\n }\n\n /**\n * Gets if this Node can have Scalable Ambient Obscurance (SAO) applied to it.\n *\n * SAO is configured by {@link SAO}.\n *\n * @type {Boolean}\n * @abstract\n */\n get saoEnabled() {\n return false; // TODO: Support SAO on Nodes\n }\n\n\n /**\n * Sets the 3D World-space offset for this Node and all child Nodes and {@link Mesh}es}.\n *\n * The offset dynamically translates those components in World-space.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * Note that child Nodes and {@link Mesh}es may subsequently be given different values for this property.\n *\n * @type {Number[]}\n */\n set offset(offset) {\n if (offset) {\n this._offset[0] = offset[0];\n this._offset[1] = offset[1];\n this._offset[2] = offset[2];\n } else {\n this._offset[0] = 0;\n this._offset[1] = 0;\n this._offset[2] = 0;\n }\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i].offset = this._offset;\n }\n if (this._isObject) {\n this.scene._objectOffsetUpdated(this, offset);\n }\n }\n\n /**\n * Gets the Node's 3D World-space offset.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * Child Nodes and {@link Mesh}es may have different values for this property.\n *\n * @type {Number[]}\n */\n get offset() {\n return this._offset;\n }\n\n\n //------------------------------------------------------------------------------------------------------------------\n // Node members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Returns true to indicate that this Component is a Node.\n * @type {Boolean}\n */\n get isNode() {\n return true;\n }\n\n _setLocalMatrixDirty() {\n this._localMatrixDirty = true;\n this._setWorldMatrixDirty();\n }\n\n _setWorldMatrixDirty() {\n this._worldMatrixDirty = true;\n for (let i = 0, len = this._children.length; i < len; i++) {\n this._children[i]._setWorldMatrixDirty();\n }\n }\n\n _buildWorldMatrix() {\n const localMatrix = this.matrix;\n if (!this._parentNode) {\n for (let i = 0, len = localMatrix.length; i < len; i++) {\n this._worldMatrix[i] = localMatrix[i];\n }\n } else {\n math.mulMat4(this._parentNode.worldMatrix, localMatrix, this._worldMatrix);\n }\n this._worldMatrixDirty = false;\n }\n\n _setSubtreeAABBsDirty(node) {\n node._aabbDirty = true;\n if (node._children) {\n for (let i = 0, len = node._children.length; i < len; i++) {\n this._setSubtreeAABBsDirty(node._children[i]);\n }\n }\n }\n\n _setAABBDirty() {\n this._setSubtreeAABBsDirty(this);\n if (this.collidable) {\n for (let node = this; node; node = node._parentNode) {\n node._aabbDirty = true;\n }\n }\n }\n\n _updateAABB() {\n this.scene._aabbDirty = true;\n if (!this._aabb) {\n this._aabb = math.AABB3();\n }\n if (this._buildAABB) {\n this._buildAABB(this.worldMatrix, this._aabb); // Mesh or VBOSceneModel\n } else { // Node | Node | Model\n math.collapseAABB3(this._aabb);\n let node;\n for (let i = 0, len = this._children.length; i < len; i++) {\n node = this._children[i];\n if (!node.collidable) {\n continue;\n }\n math.expandAABB3(this._aabb, node.aabb);\n }\n }\n this._aabbDirty = false;\n }\n\n /**\n * Adds a child Node or {@link Mesh}.\n *\n * The child must be a Node or {@link Mesh} in the same {@link Scene}.\n *\n * If the child already has a parent, will be removed from that parent first.\n *\n * Does nothing if already a child.\n *\n * @param {Node|Mesh|String} child Instance or ID of the child to add.\n * @param [inheritStates=false] Indicates if the child should inherit rendering states from this parent as it is added. Rendering state includes {@link Node#visible}, {@link Node#culled}, {@link Node#pickable}, {@link Node#clippable}, {@link Node#castsShadow}, {@link Node#receivesShadow}, {@link Node#selected}, {@link Node#highlighted}, {@link Node#colorize} and {@link Node#opacity}.\n * @returns {Node|Mesh} The child.\n */\n addChild(child, inheritStates) {\n if (utils.isNumeric(child) || utils.isString(child)) {\n const nodeId = child;\n child = this.scene.component[nodeId];\n if (!child) {\n this.warn(\"Component not found: \" + utils.inQuotes(nodeId));\n return;\n }\n if (!child.isNode && !child.isMesh) {\n this.error(\"Not a Node or Mesh: \" + nodeId);\n return;\n }\n } else {\n if (!child.isNode && !child.isMesh) {\n this.error(\"Not a Node or Mesh: \" + child.id);\n return;\n }\n if (child._parentNode) {\n if (child._parentNode.id === this.id) {\n this.warn(\"Already a child: \" + child.id);\n return;\n }\n child._parentNode.removeChild(child);\n }\n }\n const id = child.id;\n if (child.scene.id !== this.scene.id) {\n this.error(\"Child not in same Scene: \" + child.id);\n return;\n }\n this._children.push(child);\n child._parentNode = this;\n if (!!inheritStates) {\n child.visible = this.visible;\n child.culled = this.culled;\n child.xrayed = this.xrayed;\n child.highlited = this.highlighted;\n child.selected = this.selected;\n child.edges = this.edges;\n child.clippable = this.clippable;\n child.pickable = this.pickable;\n child.collidable = this.collidable;\n child.castsShadow = this.castsShadow;\n child.receivesShadow = this.receivesShadow;\n child.colorize = this.colorize;\n child.opacity = this.opacity;\n child.offset = this.offset;\n }\n child._setWorldMatrixDirty();\n child._setAABBDirty();\n this._numTriangles += child.numTriangles;\n return child;\n }\n\n /**\n * Removes the given child Node or {@link Mesh}.\n *\n * @param {Node|Mesh} child Child to remove.\n */\n removeChild(child) {\n for (let i = 0, len = this._children.length; i < len; i++) {\n if (this._children[i].id === child.id) {\n child._parentNode = null;\n this._children = this._children.splice(i, 1);\n child._setWorldMatrixDirty();\n child._setAABBDirty();\n this._setAABBDirty();\n this._numTriangles -= child.numTriangles;\n return;\n }\n }\n }\n\n /**\n * Removes all child Nodes and {@link Mesh}es.\n */\n removeChildren() {\n let child;\n for (let i = 0, len = this._children.length; i < len; i++) {\n child = this._children[i];\n child._parentNode = null;\n child._setWorldMatrixDirty();\n child._setAABBDirty();\n this._numTriangles -= child.numTriangles;\n }\n this._children = [];\n this._setAABBDirty();\n }\n\n /**\n * Number of child Nodes or {@link Mesh}es.\n *\n * @type {Number}\n */\n get numChildren() {\n return this._children.length;\n }\n\n /**\n * Array of child Nodes or {@link Mesh}es.\n *\n * @type {Array}\n */\n get children() {\n return this._children;\n }\n\n /**\n * The parent Node.\n *\n * The parent Node may also be set by passing the Node to the parent's {@link Node#addChild} method.\n *\n * @type {Node}\n */\n set parent(node) {\n if (utils.isNumeric(node) || utils.isString(node)) {\n const nodeId = node;\n node = this.scene.components[nodeId];\n if (!node) {\n this.warn(\"Node not found: \" + utils.inQuotes(nodeId));\n return;\n }\n if (!node.isNode) {\n this.error(\"Not a Node: \" + node.id);\n return;\n }\n }\n if (node.scene.id !== this.scene.id) {\n this.error(\"Node not in same Scene: \" + node.id);\n return;\n }\n if (this._parentNode && this._parentNode.id === node.id) {\n this.warn(\"Already a child of Node: \" + node.id);\n return;\n }\n node.addChild(this);\n }\n\n /**\n * The parent Node.\n *\n * @type {Node}\n */\n get parent() {\n return this._parentNode;\n }\n\n /**\n * Sets the Node's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set position(value) {\n this._position.set(value || [0, 0, 0]);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Node's local translation.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get position() {\n return this._position;\n }\n\n /**\n * Sets the Node's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n set rotation(value) {\n this._rotation.set(value || [0, 0, 0]);\n math.eulerToQuaternion(this._rotation, \"XYZ\", this._quaternion);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Node's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.\n *\n * Default value is ````[0,0,0]````.\n *\n * @type {Number[]}\n */\n get rotation() {\n return this._rotation;\n }\n\n /**\n * Sets the Node's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n set quaternion(value) {\n this._quaternion.set(value || [0, 0, 0, 1]);\n math.quaternionToEuler(this._quaternion, \"XYZ\", this._rotation);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Node's local rotation quaternion.\n *\n * Default value is ````[0,0,0,1]````.\n *\n * @type {Number[]}\n */\n get quaternion() {\n return this._quaternion;\n }\n\n /**\n * Sets the Node's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n set scale(value) {\n this._scale.set(value || [1, 1, 1]);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Node's local scale.\n *\n * Default value is ````[1,1,1]````.\n *\n * @type {Number[]}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the Node's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n set matrix(value) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n this._localMatrix.set(value || identityMat);\n math.decomposeMat4(this._localMatrix, this._position, this._quaternion, this._scale);\n this._localMatrixDirty = false;\n this._setWorldMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n }\n\n /**\n * Gets the Node's local modeling transform matrix.\n *\n * Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.\n *\n * @type {Number[]}\n */\n get matrix() {\n if (this._localMatrixDirty) {\n if (!this._localMatrix) {\n this._localMatrix = math.identityMat4();\n }\n math.composeMat4(this._position, this._quaternion, this._scale, this._localMatrix);\n this._localMatrixDirty = false;\n }\n return this._localMatrix;\n }\n\n /**\n * Gets the Node's World matrix.\n *\n * @property worldMatrix\n * @type {Number[]}\n */\n get worldMatrix() {\n if (this._worldMatrixDirty) {\n this._buildWorldMatrix();\n }\n return this._worldMatrix;\n }\n\n /**\n * Rotates the Node about the given local axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotate(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(this.quaternion, q1, q2);\n this.quaternion = q2;\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n return this;\n }\n\n /**\n * Rotates the Node about the given World-space axis by the given increment.\n *\n * @param {Number[]} axis Local axis about which to rotate.\n * @param {Number} angle Angle increment in degrees.\n */\n rotateOnWorldAxis(axis, angle) {\n angleAxis[0] = axis[0];\n angleAxis[1] = axis[1];\n angleAxis[2] = axis[2];\n angleAxis[3] = angle * math.DEGTORAD;\n math.angleAxisToQuaternion(angleAxis, q1);\n math.mulQuaternions(q1, this.quaternion, q1);\n //this.quaternion.premultiply(q1);\n return this;\n }\n\n /**\n * Rotates the Node about the local X-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateX(angle) {\n return this.rotate(xAxis, angle);\n }\n\n /**\n * Rotates the Node about the local Y-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateY(angle) {\n return this.rotate(yAxis, angle);\n }\n\n /**\n * Rotates the Node about the local Z-axis by the given increment.\n *\n * @param {Number} angle Angle increment in degrees.\n */\n rotateZ(angle) {\n return this.rotate(zAxis, angle);\n }\n\n /**\n * Translates the Node along local space vector by the given increment.\n *\n * @param {Number[]} axis Normalized local space 3D vector along which to translate.\n * @param {Number} distance Distance to translate along the vector.\n */\n translate(axis, distance) {\n math.vec3ApplyQuaternion(this.quaternion, axis, veca);\n math.mulVec3Scalar(veca, distance, vecb);\n math.addVec3(this.position, vecb, this.position);\n this._setLocalMatrixDirty();\n this._setAABBDirty();\n this.glRedraw();\n return this;\n }\n\n /**\n * Translates the Node along the local X-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the X-axis.\n */\n translateX(distance) {\n return this.translate(xAxis, distance);\n }\n\n /**\n * Translates the Node along the local Y-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Y-axis.\n */\n translateY(distance) {\n return this.translate(yAxis, distance);\n }\n\n /**\n * Translates the Node along the local Z-axis by the given increment.\n *\n * @param {Number} distance Distance to translate along the Z-axis.\n */\n translateZ(distance) {\n return this.translate(zAxis, distance);\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Component members\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n @private\n */\n get type() {\n return \"Node\";\n }\n\n /**\n * Destroys this Node.\n */\n destroy() {\n super.destroy();\n if (this._parentNode) {\n this._parentNode.removeChild(this);\n }\n if (this._isObject) {\n this.scene._deregisterObject(this);\n if (this._visible) {\n this.scene._objectVisibilityUpdated(this, false, false);\n }\n if (this._xrayed) {\n this.scene._objectXRayedUpdated(this, false, false);\n }\n if (this._selected) {\n this.scene._objectSelectedUpdated(this, false, false);\n }\n if (this._highlighted) {\n this.scene._objectHighlightedUpdated(this, false, false);\n }\n this.scene._objectColorizeUpdated(this, false);\n this.scene._objectOpacityUpdated(this, false);\n if (this.offset.some((v) => v !== 0))\n this.scene._objectOffsetUpdated(this, false);\n }\n if (this._isModel) {\n this.scene._deregisterModel(this);\n }\n if (this._children.length) {\n // Clone the _children before iterating, so our children don't mess us up when calling removeChild().\n const tempChildList = this._children.splice();\n let child;\n for (let i = 0, len = tempChildList.length; i < len; i++) {\n child = tempChildList[i];\n child.destroy();\n }\n }\n this._children = [];\n this._setAABBDirty();\n this.scene._aabbDirty = true;\n }\n\n}\n\nexport {Node};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/nodes/Node.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/nodes/Node.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7700, + "__docId__": 7708, "kind": "variable", "name": "angleAxis", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152890,7 +153106,7 @@ "ignore": true }, { - "__docId__": 7701, + "__docId__": 7709, "kind": "variable", "name": "q1", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152911,7 +153127,7 @@ "ignore": true }, { - "__docId__": 7702, + "__docId__": 7710, "kind": "variable", "name": "q2", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152932,7 +153148,7 @@ "ignore": true }, { - "__docId__": 7703, + "__docId__": 7711, "kind": "variable", "name": "xAxis", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152953,7 +153169,7 @@ "ignore": true }, { - "__docId__": 7704, + "__docId__": 7712, "kind": "variable", "name": "yAxis", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152974,7 +153190,7 @@ "ignore": true }, { - "__docId__": 7705, + "__docId__": 7713, "kind": "variable", "name": "zAxis", "memberof": "src/viewer/scene/nodes/Node.js", @@ -152995,7 +153211,7 @@ "ignore": true }, { - "__docId__": 7706, + "__docId__": 7714, "kind": "variable", "name": "veca", "memberof": "src/viewer/scene/nodes/Node.js", @@ -153016,7 +153232,7 @@ "ignore": true }, { - "__docId__": 7707, + "__docId__": 7715, "kind": "variable", "name": "vecb", "memberof": "src/viewer/scene/nodes/Node.js", @@ -153037,7 +153253,7 @@ "ignore": true }, { - "__docId__": 7708, + "__docId__": 7716, "kind": "variable", "name": "identityMat", "memberof": "src/viewer/scene/nodes/Node.js", @@ -153058,7 +153274,7 @@ "ignore": true }, { - "__docId__": 7709, + "__docId__": 7717, "kind": "class", "name": "Node", "memberof": "src/viewer/scene/nodes/Node.js", @@ -153079,7 +153295,7 @@ ] }, { - "__docId__": 7710, + "__docId__": 7718, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153438,7 +153654,7 @@ ] }, { - "__docId__": 7711, + "__docId__": 7719, "kind": "member", "name": "_parentNode", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153456,7 +153672,7 @@ } }, { - "__docId__": 7712, + "__docId__": 7720, "kind": "member", "name": "_children", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153474,7 +153690,7 @@ } }, { - "__docId__": 7713, + "__docId__": 7721, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153492,7 +153708,7 @@ } }, { - "__docId__": 7714, + "__docId__": 7722, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153510,7 +153726,7 @@ } }, { - "__docId__": 7715, + "__docId__": 7723, "kind": "member", "name": "_numTriangles", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153528,7 +153744,7 @@ } }, { - "__docId__": 7716, + "__docId__": 7724, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153546,7 +153762,7 @@ } }, { - "__docId__": 7717, + "__docId__": 7725, "kind": "member", "name": "_quaternion", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153564,7 +153780,7 @@ } }, { - "__docId__": 7718, + "__docId__": 7726, "kind": "member", "name": "_rotation", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153582,7 +153798,7 @@ } }, { - "__docId__": 7719, + "__docId__": 7727, "kind": "member", "name": "_position", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153600,7 +153816,7 @@ } }, { - "__docId__": 7720, + "__docId__": 7728, "kind": "member", "name": "_offset", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153618,7 +153834,7 @@ } }, { - "__docId__": 7721, + "__docId__": 7729, "kind": "member", "name": "_localMatrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153636,7 +153852,7 @@ } }, { - "__docId__": 7722, + "__docId__": 7730, "kind": "member", "name": "_worldMatrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153654,7 +153870,7 @@ } }, { - "__docId__": 7723, + "__docId__": 7731, "kind": "member", "name": "_localMatrixDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153672,7 +153888,7 @@ } }, { - "__docId__": 7724, + "__docId__": 7732, "kind": "member", "name": "_worldMatrixDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153690,7 +153906,7 @@ } }, { - "__docId__": 7729, + "__docId__": 7737, "kind": "member", "name": "_isModel", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153708,7 +153924,7 @@ } }, { - "__docId__": 7730, + "__docId__": 7738, "kind": "member", "name": "_isObject", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153726,7 +153942,7 @@ } }, { - "__docId__": 7746, + "__docId__": 7754, "kind": "get", "name": "isEntity", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153747,7 +153963,7 @@ } }, { - "__docId__": 7747, + "__docId__": 7755, "kind": "get", "name": "isModel", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153768,7 +153984,7 @@ } }, { - "__docId__": 7748, + "__docId__": 7756, "kind": "get", "name": "isObject", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153790,7 +154006,7 @@ "abstract": true }, { - "__docId__": 7749, + "__docId__": 7757, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153811,7 +154027,7 @@ } }, { - "__docId__": 7750, + "__docId__": 7758, "kind": "set", "name": "origin", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153832,7 +154048,7 @@ } }, { - "__docId__": 7751, + "__docId__": 7759, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153850,7 +154066,7 @@ } }, { - "__docId__": 7753, + "__docId__": 7761, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153871,7 +154087,7 @@ } }, { - "__docId__": 7754, + "__docId__": 7762, "kind": "set", "name": "rtcCenter", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153893,7 +154109,7 @@ } }, { - "__docId__": 7756, + "__docId__": 7764, "kind": "get", "name": "rtcCenter", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153915,7 +154131,7 @@ } }, { - "__docId__": 7757, + "__docId__": 7765, "kind": "get", "name": "numTriangles", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153936,7 +154152,7 @@ } }, { - "__docId__": 7758, + "__docId__": 7766, "kind": "set", "name": "visible", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153957,7 +154173,7 @@ } }, { - "__docId__": 7759, + "__docId__": 7767, "kind": "member", "name": "_visible", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153975,7 +154191,7 @@ } }, { - "__docId__": 7760, + "__docId__": 7768, "kind": "get", "name": "visible", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -153996,7 +154212,7 @@ } }, { - "__docId__": 7761, + "__docId__": 7769, "kind": "set", "name": "xrayed", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154017,7 +154233,7 @@ } }, { - "__docId__": 7762, + "__docId__": 7770, "kind": "member", "name": "_xrayed", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154035,7 +154251,7 @@ } }, { - "__docId__": 7763, + "__docId__": 7771, "kind": "get", "name": "xrayed", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154056,7 +154272,7 @@ } }, { - "__docId__": 7764, + "__docId__": 7772, "kind": "set", "name": "highlighted", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154077,7 +154293,7 @@ } }, { - "__docId__": 7765, + "__docId__": 7773, "kind": "member", "name": "_highlighted", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154095,7 +154311,7 @@ } }, { - "__docId__": 7766, + "__docId__": 7774, "kind": "get", "name": "highlighted", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154116,7 +154332,7 @@ } }, { - "__docId__": 7767, + "__docId__": 7775, "kind": "set", "name": "selected", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154137,7 +154353,7 @@ } }, { - "__docId__": 7768, + "__docId__": 7776, "kind": "member", "name": "_selected", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154155,7 +154371,7 @@ } }, { - "__docId__": 7769, + "__docId__": 7777, "kind": "get", "name": "selected", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154176,7 +154392,7 @@ } }, { - "__docId__": 7770, + "__docId__": 7778, "kind": "set", "name": "edges", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154197,7 +154413,7 @@ } }, { - "__docId__": 7771, + "__docId__": 7779, "kind": "member", "name": "_edges", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154215,7 +154431,7 @@ } }, { - "__docId__": 7772, + "__docId__": 7780, "kind": "get", "name": "edges", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154236,7 +154452,7 @@ } }, { - "__docId__": 7773, + "__docId__": 7781, "kind": "set", "name": "culled", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154257,7 +154473,7 @@ } }, { - "__docId__": 7774, + "__docId__": 7782, "kind": "member", "name": "_culled", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154275,7 +154491,7 @@ } }, { - "__docId__": 7775, + "__docId__": 7783, "kind": "get", "name": "culled", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154296,7 +154512,7 @@ } }, { - "__docId__": 7776, + "__docId__": 7784, "kind": "set", "name": "clippable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154317,7 +154533,7 @@ } }, { - "__docId__": 7777, + "__docId__": 7785, "kind": "member", "name": "_clippable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154335,7 +154551,7 @@ } }, { - "__docId__": 7778, + "__docId__": 7786, "kind": "get", "name": "clippable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154356,7 +154572,7 @@ } }, { - "__docId__": 7779, + "__docId__": 7787, "kind": "set", "name": "collidable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154377,7 +154593,7 @@ } }, { - "__docId__": 7780, + "__docId__": 7788, "kind": "member", "name": "_collidable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154395,7 +154611,7 @@ } }, { - "__docId__": 7781, + "__docId__": 7789, "kind": "get", "name": "collidable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154416,7 +154632,7 @@ } }, { - "__docId__": 7782, + "__docId__": 7790, "kind": "set", "name": "pickable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154437,7 +154653,7 @@ } }, { - "__docId__": 7783, + "__docId__": 7791, "kind": "member", "name": "_pickable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154455,7 +154671,7 @@ } }, { - "__docId__": 7784, + "__docId__": 7792, "kind": "get", "name": "pickable", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154476,7 +154692,7 @@ } }, { - "__docId__": 7785, + "__docId__": 7793, "kind": "set", "name": "colorize", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154497,7 +154713,7 @@ } }, { - "__docId__": 7786, + "__docId__": 7794, "kind": "get", "name": "colorize", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154518,7 +154734,7 @@ } }, { - "__docId__": 7787, + "__docId__": 7795, "kind": "set", "name": "opacity", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154539,7 +154755,7 @@ } }, { - "__docId__": 7788, + "__docId__": 7796, "kind": "get", "name": "opacity", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154560,7 +154776,7 @@ } }, { - "__docId__": 7789, + "__docId__": 7797, "kind": "set", "name": "castsShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154581,7 +154797,7 @@ } }, { - "__docId__": 7790, + "__docId__": 7798, "kind": "member", "name": "_castsShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154599,7 +154815,7 @@ } }, { - "__docId__": 7791, + "__docId__": 7799, "kind": "get", "name": "castsShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154620,7 +154836,7 @@ } }, { - "__docId__": 7792, + "__docId__": 7800, "kind": "set", "name": "receivesShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154641,7 +154857,7 @@ } }, { - "__docId__": 7793, + "__docId__": 7801, "kind": "member", "name": "_receivesShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154659,7 +154875,7 @@ } }, { - "__docId__": 7794, + "__docId__": 7802, "kind": "get", "name": "receivesShadow", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154680,7 +154896,7 @@ } }, { - "__docId__": 7795, + "__docId__": 7803, "kind": "get", "name": "saoEnabled", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154702,7 +154918,7 @@ "abstract": true }, { - "__docId__": 7796, + "__docId__": 7804, "kind": "set", "name": "offset", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154723,7 +154939,7 @@ } }, { - "__docId__": 7797, + "__docId__": 7805, "kind": "get", "name": "offset", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154744,7 +154960,7 @@ } }, { - "__docId__": 7798, + "__docId__": 7806, "kind": "get", "name": "isNode", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154765,7 +154981,7 @@ } }, { - "__docId__": 7799, + "__docId__": 7807, "kind": "method", "name": "_setLocalMatrixDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154782,7 +154998,7 @@ "return": null }, { - "__docId__": 7801, + "__docId__": 7809, "kind": "method", "name": "_setWorldMatrixDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154799,7 +155015,7 @@ "return": null }, { - "__docId__": 7803, + "__docId__": 7811, "kind": "method", "name": "_buildWorldMatrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154816,7 +155032,7 @@ "return": null }, { - "__docId__": 7805, + "__docId__": 7813, "kind": "method", "name": "_setSubtreeAABBsDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154840,7 +155056,7 @@ "return": null }, { - "__docId__": 7806, + "__docId__": 7814, "kind": "method", "name": "_setAABBDirty", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154857,7 +155073,7 @@ "return": null }, { - "__docId__": 7807, + "__docId__": 7815, "kind": "method", "name": "_updateAABB", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154874,7 +155090,7 @@ "return": null }, { - "__docId__": 7810, + "__docId__": 7818, "kind": "method", "name": "addChild", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154928,7 +155144,7 @@ } }, { - "__docId__": 7812, + "__docId__": 7820, "kind": "method", "name": "removeChild", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154955,7 +155171,7 @@ "return": null }, { - "__docId__": 7815, + "__docId__": 7823, "kind": "method", "name": "removeChildren", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154970,7 +155186,7 @@ "return": null }, { - "__docId__": 7818, + "__docId__": 7826, "kind": "get", "name": "numChildren", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -154991,7 +155207,7 @@ } }, { - "__docId__": 7819, + "__docId__": 7827, "kind": "get", "name": "children", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155012,7 +155228,7 @@ } }, { - "__docId__": 7820, + "__docId__": 7828, "kind": "set", "name": "parent", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155033,7 +155249,7 @@ } }, { - "__docId__": 7821, + "__docId__": 7829, "kind": "get", "name": "parent", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155054,7 +155270,7 @@ } }, { - "__docId__": 7822, + "__docId__": 7830, "kind": "set", "name": "position", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155075,7 +155291,7 @@ } }, { - "__docId__": 7823, + "__docId__": 7831, "kind": "get", "name": "position", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155096,7 +155312,7 @@ } }, { - "__docId__": 7824, + "__docId__": 7832, "kind": "set", "name": "rotation", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155117,7 +155333,7 @@ } }, { - "__docId__": 7825, + "__docId__": 7833, "kind": "get", "name": "rotation", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155138,7 +155354,7 @@ } }, { - "__docId__": 7826, + "__docId__": 7834, "kind": "set", "name": "quaternion", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155159,7 +155375,7 @@ } }, { - "__docId__": 7827, + "__docId__": 7835, "kind": "get", "name": "quaternion", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155180,7 +155396,7 @@ } }, { - "__docId__": 7828, + "__docId__": 7836, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155201,7 +155417,7 @@ } }, { - "__docId__": 7829, + "__docId__": 7837, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155222,7 +155438,7 @@ } }, { - "__docId__": 7830, + "__docId__": 7838, "kind": "set", "name": "matrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155243,7 +155459,7 @@ } }, { - "__docId__": 7833, + "__docId__": 7841, "kind": "get", "name": "matrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155264,7 +155480,7 @@ } }, { - "__docId__": 7836, + "__docId__": 7844, "kind": "get", "name": "worldMatrix", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155297,7 +155513,7 @@ } }, { - "__docId__": 7837, + "__docId__": 7845, "kind": "method", "name": "rotate", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155337,7 +155553,7 @@ } }, { - "__docId__": 7839, + "__docId__": 7847, "kind": "method", "name": "rotateOnWorldAxis", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155377,7 +155593,7 @@ } }, { - "__docId__": 7840, + "__docId__": 7848, "kind": "method", "name": "rotateX", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155407,7 +155623,7 @@ } }, { - "__docId__": 7841, + "__docId__": 7849, "kind": "method", "name": "rotateY", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155437,7 +155653,7 @@ } }, { - "__docId__": 7842, + "__docId__": 7850, "kind": "method", "name": "rotateZ", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155467,7 +155683,7 @@ } }, { - "__docId__": 7843, + "__docId__": 7851, "kind": "method", "name": "translate", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155507,7 +155723,7 @@ } }, { - "__docId__": 7844, + "__docId__": 7852, "kind": "method", "name": "translateX", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155537,7 +155753,7 @@ } }, { - "__docId__": 7845, + "__docId__": 7853, "kind": "method", "name": "translateY", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155567,7 +155783,7 @@ } }, { - "__docId__": 7846, + "__docId__": 7854, "kind": "method", "name": "translateZ", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155597,7 +155813,7 @@ } }, { - "__docId__": 7847, + "__docId__": 7855, "kind": "get", "name": "type", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155616,7 +155832,7 @@ } }, { - "__docId__": 7848, + "__docId__": 7856, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/nodes/Node.js~Node", @@ -155631,29 +155847,29 @@ "return": null }, { - "__docId__": 7850, + "__docId__": 7858, "kind": "file", "name": "src/viewer/scene/nodes/index.js", "content": "export * from \"./Node.js\";\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/nodes/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/nodes/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7851, + "__docId__": 7859, "kind": "file", "name": "src/viewer/scene/paths/CubicBezierCurve.js", "content": "import {Curve} from \"./Curve.js\"\nimport {math} from \"../math/math.js\";\n\n/**\n * @desc A {@link Curve} along which a 3D position can be animated.\n *\n * * As shown in the diagram below, a CubicBezierCurve is defined by four control points.\n * * You can sample a {@link CubicBezierCurve#point} and a {@link CubicBezierCurve#tangent} vector on a CubicBezierCurve for any given value of {@link CubicBezierCurve#t} in the range [0..1].\n * * When you set {@link CubicBezierCurve#t} on a CubicBezierCurve, its {@link CubicBezierCurve#point} and {@link CubicBezierCurve#tangent} properties will update accordingly.\n * * To build a complex path, you can combine an unlimited combination of CubicBezierCurves, {@link QuadraticBezierCurve}s and {@link SplineCurve}s into a {@link Path}.\n *\n *
    \n * \n *
    \n * [Cubic Bezier Curve from WikiPedia](https://en.wikipedia.org/wiki/B%C3%A9zier_curve)\n */\nclass CubicBezierCurve extends Curve {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this CubicBezierCurve as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Number[]} [cfg.v0=[0,0,0]] The starting point.\n * @param {Number[]} [cfg.v1=[0,0,0]] The first control point.\n * @param {Number[]} [cfg.v2=[0,0,0]] The middle control point.\n * @param {Number[]} [cfg.v3=[0,0,0]] The ending point.\n * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.v0 = cfg.v0;\n this.v1 = cfg.v1;\n this.v2 = cfg.v2;\n this.v3 = cfg.v3;\n this.t = cfg.t;\n }\n\n /**\n * Sets the starting point on this CubicBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @param {Number[]} value The starting point.\n */\n set v0(value) {\n this._v0 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the starting point on this CubicBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @returns {Number[]} The starting point.\n */\n get v0() {\n return this._v0;\n }\n\n /**\n * Sets the first control point on this CubicBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @param {Number[]} value The first control point.\n */\n set v1(value) {\n this._v1 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the first control point on this CubicBezierCurve.\n *\n * Fires a {@link CubicBezierCurve#v1:event} event on change.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @returns {Number[]} The first control point.\n */\n get v1() {\n return this._v1;\n }\n\n /**\n * Sets the second control point on this CubicBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @param {Number[]} value The second control point.\n */\n set v2(value) {\n this._v2 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the second control point on this CubicBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @returns {Number[]} The second control point.\n */\n get v2() {\n return this._v2;\n }\n\n /**\n * Sets the end point on this CubicBezierCurve.\n *\n * Fires a {@link CubicBezierCurve#v3:event} event on change.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @param {Number[]} value The end point.\n */\n set v3(value) {\n this.fire(\"v3\", this._v3 = value || math.vec3([0, 0, 0]));\n }\n\n /**\n * Gets the end point on this CubicBezierCurve.\n *\n * Fires a {@link CubicBezierCurve#v3:event} event on change.\n *\n * Default value is ````[0.0, 0.0, 0.0]````\n *\n * @returns {Number[]} The end point.\n */\n get v3() {\n return this._v3;\n }\n\n /**\n * Sets the current position of progress along this CubicBezierCurve.\n *\n * Automatically clamps to range ````[0..1]````.\n *\n * @param {Number} value New progress time value.\n */\n set t(value) {\n value = value || 0;\n this._t = value < 0.0 ? 0.0 : (value > 1.0 ? 1.0 : value);\n }\n\n /**\n * Gets the current position of progress along this CubicBezierCurve.\n *\n * @returns {Number} Current progress time value.\n */\n get t() {\n return this._t;\n }\n\n /**\n * Returns point on this CubicBezierCurve at the given position.\n *\n * @param {Number} t Position to get point at.\n *\n * @returns {Number[]} The point at the given position.\n */\n get point() {\n return this.getPoint(this._t);\n }\n\n /**\n * Returns point on this CubicBezierCurve at the given position.\n *\n * @param {Number} t Position to get point at.\n *\n * @returns {Number[]} The point at the given position.\n */\n getPoint(t) {\n\n var vector = math.vec3();\n\n vector[0] = math.b3(t, this._v0[0], this._v1[0], this._v2[0], this._v3[0]);\n vector[1] = math.b3(t, this._v0[1], this._v1[1], this._v2[1], this._v3[1]);\n vector[2] = math.b3(t, this._v0[2], this._v1[2], this._v2[2], this._v3[2]);\n\n return vector;\n }\n\n getJSON() {\n return {\n v0: this._v0,\n v1: this._v1,\n v2: this._v2,\n v3: this._v3,\n t: this._t\n };\n }\n}\n\nexport {CubicBezierCurve}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/CubicBezierCurve.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/CubicBezierCurve.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7852, + "__docId__": 7860, "kind": "class", "name": "CubicBezierCurve", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js", @@ -155671,7 +155887,7 @@ ] }, { - "__docId__": 7853, + "__docId__": 7861, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155798,7 +156014,7 @@ ] }, { - "__docId__": 7859, + "__docId__": 7867, "kind": "set", "name": "v0", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155823,7 +156039,7 @@ ] }, { - "__docId__": 7860, + "__docId__": 7868, "kind": "member", "name": "_v0", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155841,7 +156057,7 @@ } }, { - "__docId__": 7861, + "__docId__": 7869, "kind": "get", "name": "v0", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155873,7 +156089,7 @@ } }, { - "__docId__": 7862, + "__docId__": 7870, "kind": "set", "name": "v1", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155898,7 +156114,7 @@ ] }, { - "__docId__": 7863, + "__docId__": 7871, "kind": "member", "name": "_v1", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155916,7 +156132,7 @@ } }, { - "__docId__": 7864, + "__docId__": 7872, "kind": "get", "name": "v1", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155948,7 +156164,7 @@ } }, { - "__docId__": 7865, + "__docId__": 7873, "kind": "set", "name": "v2", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155973,7 +156189,7 @@ ] }, { - "__docId__": 7866, + "__docId__": 7874, "kind": "member", "name": "_v2", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -155991,7 +156207,7 @@ } }, { - "__docId__": 7867, + "__docId__": 7875, "kind": "get", "name": "v2", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156023,7 +156239,7 @@ } }, { - "__docId__": 7868, + "__docId__": 7876, "kind": "set", "name": "v3", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156048,7 +156264,7 @@ ] }, { - "__docId__": 7869, + "__docId__": 7877, "kind": "get", "name": "v3", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156080,7 +156296,7 @@ } }, { - "__docId__": 7870, + "__docId__": 7878, "kind": "set", "name": "t", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156105,7 +156321,7 @@ ] }, { - "__docId__": 7871, + "__docId__": 7879, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156123,7 +156339,7 @@ } }, { - "__docId__": 7872, + "__docId__": 7880, "kind": "get", "name": "t", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156155,7 +156371,7 @@ } }, { - "__docId__": 7873, + "__docId__": 7881, "kind": "get", "name": "point", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156199,7 +156415,7 @@ } }, { - "__docId__": 7874, + "__docId__": 7882, "kind": "method", "name": "getPoint", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156238,7 +156454,7 @@ } }, { - "__docId__": 7875, + "__docId__": 7883, "kind": "method", "name": "getJSON", "memberof": "src/viewer/scene/paths/CubicBezierCurve.js~CubicBezierCurve", @@ -156258,18 +156474,18 @@ } }, { - "__docId__": 7876, + "__docId__": 7884, "kind": "file", "name": "src/viewer/scene/paths/Curve.js", "content": "import {Component} from \"../Component.js\"\nimport {math} from \"../math/math.js\";\n\n/**\n * @desc Abstract base class for curve classes.\n */\nclass Curve extends Component {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Curve as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Curve}, generated automatically when omitted.\n * @param {Object} [cfg] Configs for this Curve.\n * @param {Number} [cfg.t=0] Current position on this Curve, in range between ````0..1````.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.t = cfg.t;\n }\n\n /**\n * Sets the progress along this Curve.\n *\n * Automatically clamps to range ````[0..1]````.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The progress value.\n */\n set t(value) {\n value = value || 0;\n this._t = value < 0.0 ? 0.0 : (value > 1.0 ? 1.0 : value);\n }\n\n /**\n * Gets the progress along this Curve.\n *\n * @returns {Number} The progress value.\n */\n get t() {\n return this._t;\n }\n\n /**\n * Gets the tangent on this Curve at position {@link Curve#t}.\n *\n * @returns {Number[]} The tangent.\n */\n get tangent() {\n return this.getTangent(this._t);\n }\n\n /**\n * Gets the length of this Curve.\n *\n * @returns {Number} The Curve length.\n */\n get length() {\n var lengths = this._getLengths();\n return lengths[lengths.length - 1];\n }\n\n /**\n * Returns a normalized tangent vector on this Curve at the given position.\n *\n * @param {Number} t Position to get tangent at.\n * @returns {Number[]} Normalized tangent vector\n */\n getTangent(t) {\n var delta = 0.0001;\n if (t === undefined) {\n t = this._t;\n }\n var t1 = t - delta;\n var t2 = t + delta;\n if (t1 < 0) {\n t1 = 0;\n }\n if (t2 > 1) {\n t2 = 1;\n }\n var pt1 = this.getPoint(t1);\n var pt2 = this.getPoint(t2);\n var vec = math.subVec3(pt2, pt1, []);\n return math.normalizeVec3(vec, []);\n }\n\n getPointAt(u) {\n var t = this.getUToTMapping(u);\n return this.getPoint(t);\n }\n\n /**\n * Samples points on this Curve, at the given number of equally-spaced divisions.\n *\n * @param {Number} divisions The number of divisions.\n * @returns {{Array of Array}} Array of sampled 3D points.\n */\n getPoints(divisions) {\n if (!divisions) {\n divisions = 5;\n }\n var d, pts = [];\n for (d = 0; d <= divisions; d++) {\n pts.push(this.getPoint(d / divisions));\n }\n return pts;\n }\n\n _getLengths(divisions) {\n if (!divisions) {\n divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions) : 200;\n }\n if (this.cacheArcLengths && (this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) {\n return this.cacheArcLengths;\n\n }\n this.needsUpdate = false;\n var cache = [];\n var current;\n var last = this.getPoint(0);\n var p;\n var sum = 0;\n cache.push(0);\n for (p = 1; p <= divisions; p++) {\n current = this.getPoint(p / divisions);\n sum += math.lenVec3(math.subVec3(current, last, []));\n cache.push(sum);\n last = current;\n }\n this.cacheArcLengths = cache;\n return cache; // { sums: cache, sum:sum }, Sum is in the last element.\n }\n\n _updateArcLengths() {\n this.needsUpdate = true;\n this._getLengths();\n }\n\n // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance\n\n getUToTMapping(u, distance) {\n var arcLengths = this._getLengths();\n var i = 0;\n var il = arcLengths.length;\n var t;\n var targetArcLength; // The targeted u distance value to get\n if (distance) {\n targetArcLength = distance;\n } else {\n targetArcLength = u * arcLengths[il - 1];\n }\n //var time = Date.now();\n var low = 0, high = il - 1, comparison;\n while (low <= high) {\n i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n comparison = arcLengths[i] - targetArcLength;\n if (comparison < 0) {\n low = i + 1;\n } else if (comparison > 0) {\n high = i - 1;\n } else {\n high = i;\n break;\n // DONE\n }\n }\n i = high;\n if (arcLengths[i] === targetArcLength) {\n t = i / (il - 1);\n return t;\n }\n var lengthBefore = arcLengths[i];\n var lengthAfter = arcLengths[i + 1];\n var segmentLength = lengthAfter - lengthBefore;\n var segmentFraction = (targetArcLength - lengthBefore) / segmentLength;\n t = (i + segmentFraction) / (il - 1);\n return t;\n }\n}\n\nexport {Curve}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/Curve.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/Curve.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7877, + "__docId__": 7885, "kind": "class", "name": "Curve", "memberof": "src/viewer/scene/paths/Curve.js", @@ -156287,7 +156503,7 @@ ] }, { - "__docId__": 7878, + "__docId__": 7886, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156360,7 +156576,7 @@ ] }, { - "__docId__": 7880, + "__docId__": 7888, "kind": "set", "name": "t", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156385,7 +156601,7 @@ ] }, { - "__docId__": 7881, + "__docId__": 7889, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156403,7 +156619,7 @@ } }, { - "__docId__": 7882, + "__docId__": 7890, "kind": "get", "name": "t", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156435,7 +156651,7 @@ } }, { - "__docId__": 7883, + "__docId__": 7891, "kind": "get", "name": "tangent", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156467,7 +156683,7 @@ } }, { - "__docId__": 7884, + "__docId__": 7892, "kind": "get", "name": "length", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156499,7 +156715,7 @@ } }, { - "__docId__": 7885, + "__docId__": 7893, "kind": "method", "name": "getTangent", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156538,7 +156754,7 @@ } }, { - "__docId__": 7886, + "__docId__": 7894, "kind": "method", "name": "getPointAt", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156565,7 +156781,7 @@ } }, { - "__docId__": 7887, + "__docId__": 7895, "kind": "method", "name": "getPoints", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156604,7 +156820,7 @@ } }, { - "__docId__": 7888, + "__docId__": 7896, "kind": "method", "name": "_getLengths", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156632,7 +156848,7 @@ } }, { - "__docId__": 7889, + "__docId__": 7897, "kind": "member", "name": "needsUpdate", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156649,7 +156865,7 @@ } }, { - "__docId__": 7890, + "__docId__": 7898, "kind": "member", "name": "cacheArcLengths", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156666,7 +156882,7 @@ } }, { - "__docId__": 7891, + "__docId__": 7899, "kind": "method", "name": "_updateArcLengths", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156683,7 +156899,7 @@ "return": null }, { - "__docId__": 7893, + "__docId__": 7901, "kind": "method", "name": "getUToTMapping", "memberof": "src/viewer/scene/paths/Curve.js~Curve", @@ -156716,18 +156932,18 @@ } }, { - "__docId__": 7894, + "__docId__": 7902, "kind": "file", "name": "src/viewer/scene/paths/Path.js", "content": "import {utils} from \"../utils.js\";\nimport {Curve} from \"./Curve.js\"\n\n/**\n * @desc A complex curved path constructed from various {@link Curve} subtypes.\n *\n * * A Path can be constructed from these {@link Curve} subtypes: {@link SplineCurve}, {@link CubicBezierCurve} and {@link QuadraticBezierCurve}.\n * * You can sample a {@link Path#point} and a {@link Curve#tangent} vector on a Path for any given value of {@link Path#t} in the range ````[0..1]````.\n * * When you set {@link Path#t} on a Path, its {@link Path#point} and {@link Curve#tangent} properties will update accordingly.\n */\nclass Path extends Curve {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this SectionPlane as well.\n * @param {*} [cfg] Path configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {String []} [cfg.paths=[]] IDs or instances of {{#crossLink \"path\"}}{{/crossLink}} subtypes to add to this Path.\n * @param {Number} [cfg.t=0] Current position on this Path, in range between 0..1.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this._cachedLengths = [];\n this._dirty = true;\n this._curves = []; // Array of child Curve components\n this._t = 0;\n this._dirtySubs = []; // Subscriptions to \"dirty\" events from child Curve components\n this._destroyedSubs = []; // Subscriptions to \"destroyed\" events from child Curve components\n this.curves = cfg.curves || []; // Add initial curves\n this.t = cfg.t; // Set initial progress\n }\n\n /**\n * Adds a {@link Curve} to this Path.\n *\n * @param {Curve} curve The {@link Curve} to add.\n */\n addCurve(curve) {\n this._curves.push(curve);\n this._dirty = true;\n }\n\n /**\n * Sets the {@link Curve}s in this Path.\n *\n * Default value is ````[]````.\n *\n * @param {{Array of Spline, Path, QuadraticBezierCurve or CubicBezierCurve}} value.\n */\n set curves(value) {\n\n value = value || [];\n\n var curve;\n // Unsubscribe from events on old curves\n var i;\n var len;\n for (i = 0, len = this._curves.length; i < len; i++) {\n curve = this._curves[i];\n curve.off(this._dirtySubs[i]);\n curve.off(this._destroyedSubs[i]);\n }\n\n this._curves = [];\n this._dirtySubs = [];\n this._destroyedSubs = [];\n\n var self = this;\n\n function curveDirty() {\n self._dirty = true;\n }\n\n function curveDestroyed() {\n var id = this.id;\n for (i = 0, len = self._curves.length; i < len; i++) {\n if (self._curves[i].id === id) {\n self._curves = self._curves.slice(i, i + 1);\n self._dirtySubs = self._dirtySubs.slice(i, i + 1);\n self._destroyedSubs = self._destroyedSubs.slice(i, i + 1);\n self._dirty = true;\n return;\n }\n }\n }\n\n for (i = 0, len = value.length; i < len; i++) {\n curve = value[i];\n if (utils.isNumeric(curve) || utils.isString(curve)) {\n // ID given for curve - find the curve component\n var id = curve;\n curve = this.scene.components[id];\n if (!curve) {\n this.error(\"Component not found: \" + _inQuotes(id));\n continue;\n }\n }\n\n var type = curve.type;\n\n if (type !== \"xeokit.SplineCurve\" &&\n type !== \"xeokit.Path\" &&\n type !== \"xeokit.CubicBezierCurve\" &&\n type !== \"xeokit.QuadraticBezierCurve\") {\n\n this.error(\"Component \" + _inQuotes(curve.id)\n + \" is not a xeokit.SplineCurve, xeokit.Path or xeokit.QuadraticBezierCurve\");\n\n continue;\n }\n\n this._curves.push(curve);\n this._dirtySubs.push(curve.on(\"dirty\", curveDirty));\n this._destroyedSubs.push(curve.once(\"destroyed\", curveDestroyed));\n }\n\n this._dirty = true;\n }\n\n /**\n * Gets the {@link Curve}s in this Path.\n *\n * @returns {{Array of Spline, Path, QuadraticBezierCurve or CubicBezierCurve}} the {@link Curve}s in this path.\n */\n get curves() {\n return this._curves;\n }\n\n /**\n * Sets the current point of progress along this Path.\n *\n * Automatically clamps to range ````[0..1]````.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The current point of progress.\n */\n set t(value) {\n value = value || 0;\n this._t = value < 0.0 ? 0.0 : (value > 1.0 ? 1.0 : value);\n }\n\n /**\n * Gets the current point of progress along this Path.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The current point of progress.\n */\n get t() {\n return this._t;\n }\n\n /**\n * Gets point on this Path corresponding to the current value of {@link Path#t}.\n *\n * @returns {Number[]} The point.\n */\n get point() {\n return this.getPoint(this._t);\n }\n\n /**\n * Length of this Path, which is the cumulative length of all {@link Curve}s currently in {@link Path#curves}.\n *\n * @return {Number} Length of this path.\n */\n get length() {\n var lens = this._getCurveLengths();\n return lens[lens.length - 1];\n }\n\n /**\n * Gets a point on this Path corresponding to the given progress position.\n *\n * @param {Number} t Indicates point of progress along this curve, in the range [0..1].\n * @returns {Number[]}\n */\n getPoint(t) {\n var d = t * this.length;\n var curveLengths = this._getCurveLengths();\n var i = 0, diff, curve;\n while (i < curveLengths.length) {\n if (curveLengths[i] >= d) {\n diff = curveLengths[i] - d;\n curve = this._curves[i];\n var u = 1 - diff / curve.length;\n return curve.getPointAt(u);\n }\n i++;\n }\n return null;\n }\n\n _getCurveLengths() {\n if (!this._dirty) {\n return this._cachedLengths;\n }\n var lengths = [];\n var sums = 0;\n var i, il = this._curves.length;\n for (i = 0; i < il; i++) {\n sums += this._curves[i].length;\n lengths.push(sums);\n\n }\n this._cachedLengths = lengths;\n this._dirty = false;\n return lengths;\n }\n\n _getJSON() {\n var curveIds = [];\n for (var i = 0, len = this._curves.length; i < len; i++) {\n curveIds.push(this._curves[i].id);\n }\n return {\n curves: curveIds,\n t: this._t\n };\n }\n\n /**\n * Destroys this Path.\n */\n destroy() {\n super.destroy();\n var i;\n var len;\n var curve;\n for (i = 0, len = this._curves.length; i < len; i++) {\n curve = this._curves[i];\n curve.off(this._dirtySubs[i]);\n curve.off(this._destroyedSubs[i]);\n }\n }\n}\n\nexport {Path}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/Path.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/Path.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7895, + "__docId__": 7903, "kind": "class", "name": "Path", "memberof": "src/viewer/scene/paths/Path.js", @@ -156745,7 +156961,7 @@ ] }, { - "__docId__": 7896, + "__docId__": 7904, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156820,7 +157036,7 @@ ] }, { - "__docId__": 7897, + "__docId__": 7905, "kind": "member", "name": "_cachedLengths", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156838,7 +157054,7 @@ } }, { - "__docId__": 7898, + "__docId__": 7906, "kind": "member", "name": "_dirty", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156856,7 +157072,7 @@ } }, { - "__docId__": 7899, + "__docId__": 7907, "kind": "member", "name": "_curves", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156874,7 +157090,7 @@ } }, { - "__docId__": 7900, + "__docId__": 7908, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156892,7 +157108,7 @@ } }, { - "__docId__": 7901, + "__docId__": 7909, "kind": "member", "name": "_dirtySubs", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156910,7 +157126,7 @@ } }, { - "__docId__": 7902, + "__docId__": 7910, "kind": "member", "name": "_destroyedSubs", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156928,7 +157144,7 @@ } }, { - "__docId__": 7905, + "__docId__": 7913, "kind": "method", "name": "addCurve", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156954,7 +157170,7 @@ "return": null }, { - "__docId__": 7907, + "__docId__": 7915, "kind": "set", "name": "curves", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -156979,7 +157195,7 @@ ] }, { - "__docId__": 7912, + "__docId__": 7920, "kind": "get", "name": "curves", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157011,7 +157227,7 @@ } }, { - "__docId__": 7913, + "__docId__": 7921, "kind": "set", "name": "t", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157036,7 +157252,7 @@ ] }, { - "__docId__": 7915, + "__docId__": 7923, "kind": "get", "name": "t", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157068,7 +157284,7 @@ } }, { - "__docId__": 7916, + "__docId__": 7924, "kind": "get", "name": "point", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157100,7 +157316,7 @@ } }, { - "__docId__": 7917, + "__docId__": 7925, "kind": "get", "name": "length", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157126,7 +157342,7 @@ } }, { - "__docId__": 7918, + "__docId__": 7926, "kind": "method", "name": "getPoint", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157165,7 +157381,7 @@ } }, { - "__docId__": 7919, + "__docId__": 7927, "kind": "method", "name": "_getCurveLengths", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157186,7 +157402,7 @@ } }, { - "__docId__": 7922, + "__docId__": 7930, "kind": "method", "name": "_getJSON", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157207,7 +157423,7 @@ } }, { - "__docId__": 7923, + "__docId__": 7931, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/paths/Path.js~Path", @@ -157222,18 +157438,18 @@ "return": null }, { - "__docId__": 7924, + "__docId__": 7932, "kind": "file", "name": "src/viewer/scene/paths/QuadraticBezierCurve.js", "content": "import {Curve} from \"./Curve.js\"\nimport {math} from \"../math/math.js\";\n\n/**\n * A **QuadraticBezierCurve** is a {@link Curve} along which a 3D position can be animated.\n *\n * * As shown in the diagram below, a QuadraticBezierCurve is defined by three control points\n * * You can sample a {@link QuadraticBezierCurve#point} and a {@link Curve#tangent} vector on a QuadraticBezierCurve for any given value of {@link QuadraticBezierCurve#t} in the range ````[0..1]````\n * * When you set {@link QuadraticBezierCurve#t} on a QuadraticBezierCurve, its {@link QuadraticBezierCurve#point} and {@link Curve#tangent} will update accordingly.\n * * To build a complex path, you can combine an unlimited combination of QuadraticBezierCurves, {@link CubicBezierCurve}s and {@link SplineCurve}s into a {@link Path}.
  • \n *
    \n * \n *
    \n * *[Quadratic Bezier Curve from WikiPedia](https://en.wikipedia.org/wiki/B%C3%A9zier_curve)*\n */\nclass QuadraticBezierCurve extends Curve {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this MetallicMaterial as well.\n * @param {*} [cfg] Configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {{#crossLink \"Scene\"}}Scene{{/crossLink}}, generated automatically when omitted.\n * @param {Number[]} [cfg.v0=[0,0,0]] The starting point.\n * @param {Number[]} [cfg.v1=[0,0,0]] The middle control point.\n * @param {Number[]} [cfg.v2=[0,0,0]] The end point.\n * @param {Number[]} [cfg.t=0] Current position on this QuadraticBezierCurve, in range between ````0..1````.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.v0 = cfg.v0;\n this.v1 = cfg.v1;\n this.v2 = cfg.v2;\n this.t = cfg.t;\n }\n\n /**\n * Sets the starting point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @param {Number[]} value New starting point.\n */\n set v0(value) {\n this._v0 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the starting point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @returns {Number[]} The starting point.\n */\n get v0() {\n return this._v0;\n }\n\n /**\n * Sets the middle control point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @param {Number[]} value New middle control point.\n */\n set v1(value) {\n this._v1 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the middle control point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @returns {Number[]} The middle control point.\n */\n get v1() {\n return this._v1;\n }\n\n /**\n * Sets the end point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @param {Number[]} value The new end point.\n */\n set v2(value) {\n this._v2 = value || math.vec3([0, 0, 0]);\n }\n\n /**\n * Gets the end point on this QuadraticBezierCurve.\n *\n * Default value is ````[0.0, 0.0, 0.0]````.\n *\n * @returns {Number[]} The end point.\n */\n get v2() {\n return this._v2;\n }\n\n /**\n * Sets the progress along this QuadraticBezierCurve.\n *\n * Automatically clamps to range [0..1].\n *\n * Default value is ````0````.\n *\n * @param {Number} value The new progress location.\n */\n set t(value) {\n value = value || 0;\n this._t = value < 0.0 ? 0.0 : (value > 1.0 ? 1.0 : value);\n }\n\n /**\n * Gets the progress along this QuadraticBezierCurve.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The current progress location.\n */\n get t() {\n return this._t;\n }\n\n /**\n Point on this QuadraticBezierCurve at position {@link QuadraticBezierCurve/t}.\n\n @property point\n @type {Number[]}\n */\n get point() {\n return this.getPoint(this._t);\n }\n\n /**\n * Returns the point on this QuadraticBezierCurve at the given position.\n *\n * @param {Number} t Position to get point at.\n * @returns {Number[]} The point.\n */\n getPoint(t) {\n var vector = math.vec3();\n vector[0] = math.b2(t, this._v0[0], this._v1[0], this._v2[0]);\n vector[1] = math.b2(t, this._v0[1], this._v1[1], this._v2[1]);\n vector[2] = math.b2(t, this._v0[2], this._v1[2], this._v2[2]);\n return vector;\n }\n\n getJSON() {\n return {\n v0: this._v0,\n v1: this._v1,\n v2: this._v2,\n t: this._t\n };\n }\n}\n\nexport {QuadraticBezierCurve}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/QuadraticBezierCurve.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/QuadraticBezierCurve.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7925, + "__docId__": 7933, "kind": "class", "name": "QuadraticBezierCurve", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js", @@ -157251,7 +157467,7 @@ ] }, { - "__docId__": 7926, + "__docId__": 7934, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157362,7 +157578,7 @@ ] }, { - "__docId__": 7931, + "__docId__": 7939, "kind": "set", "name": "v0", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157387,7 +157603,7 @@ ] }, { - "__docId__": 7932, + "__docId__": 7940, "kind": "member", "name": "_v0", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157405,7 +157621,7 @@ } }, { - "__docId__": 7933, + "__docId__": 7941, "kind": "get", "name": "v0", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157437,7 +157653,7 @@ } }, { - "__docId__": 7934, + "__docId__": 7942, "kind": "set", "name": "v1", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157462,7 +157678,7 @@ ] }, { - "__docId__": 7935, + "__docId__": 7943, "kind": "member", "name": "_v1", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157480,7 +157696,7 @@ } }, { - "__docId__": 7936, + "__docId__": 7944, "kind": "get", "name": "v1", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157512,7 +157728,7 @@ } }, { - "__docId__": 7937, + "__docId__": 7945, "kind": "set", "name": "v2", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157537,7 +157753,7 @@ ] }, { - "__docId__": 7938, + "__docId__": 7946, "kind": "member", "name": "_v2", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157555,7 +157771,7 @@ } }, { - "__docId__": 7939, + "__docId__": 7947, "kind": "get", "name": "v2", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157587,7 +157803,7 @@ } }, { - "__docId__": 7940, + "__docId__": 7948, "kind": "set", "name": "t", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157612,7 +157828,7 @@ ] }, { - "__docId__": 7941, + "__docId__": 7949, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157630,7 +157846,7 @@ } }, { - "__docId__": 7942, + "__docId__": 7950, "kind": "get", "name": "t", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157662,7 +157878,7 @@ } }, { - "__docId__": 7943, + "__docId__": 7951, "kind": "get", "name": "point", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157695,7 +157911,7 @@ } }, { - "__docId__": 7944, + "__docId__": 7952, "kind": "method", "name": "getPoint", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157734,7 +157950,7 @@ } }, { - "__docId__": 7945, + "__docId__": 7953, "kind": "method", "name": "getJSON", "memberof": "src/viewer/scene/paths/QuadraticBezierCurve.js~QuadraticBezierCurve", @@ -157754,18 +157970,18 @@ } }, { - "__docId__": 7946, + "__docId__": 7954, "kind": "file", "name": "src/viewer/scene/paths/SplineCurve.js", "content": "import {Curve} from \"./Curve.js\"\nimport {math} from \"../math/math.js\";\n\n/**\n * @desc A {@link Curve} along which a 3D position can be animated.\n *\n * * As shown in the diagram below, a SplineCurve is defined by three or more control points.\n * * You can sample a {@link SplineCurve#point} and a {@link Curve#tangent} vector on a SplineCurve for any given value of {@link SplineCurve#t} in the range ````[0..1]````.\n * * When you set {@link SplineCurve#t} on a SplineCurve, its {@link SplineCurve#point} and {@link Curve#tangent} will update accordingly.\n * * To build a complex path, you can combine an unlimited combination of SplineCurves, {@link CubicBezierCurve} and {@link QuadraticBezierCurve} into a {@link Path}.\n *
    \n *
    \n *\n * * Spline Curve from Wikipedia*\n */\nclass SplineCurve extends Curve {\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this SplineCurve as well.\n * @param {*} [cfg] Configs\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Array} [cfg.points=[]] Control points on this SplineCurve.\n * @param {Number} [cfg.t=0] Current position on this SplineCurve, in range between 0..1.\n * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.\n */\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n this.points = cfg.points;\n this.t = cfg.t;\n }\n\n /**\n * Sets the control points on this SplineCurve.\n *\n * Default value is ````[]````.\n *\n * @param {Number[]} value New control points.\n */\n set points(value) {\n this._points = value || [];\n }\n\n /**\n * Gets the control points on this SplineCurve.\n *\n * Default value is ````[]````.\n *\n * @returns {Number[]} The control points.\n */\n get points() {\n return this._points;\n }\n\n /**\n * Sets the progress along this SplineCurve.\n *\n * Automatically clamps to range ````[0..1]````.\n *\n * Default value is ````0````.\n *\n * @param {Number} value The new progress.\n */\n set t(value) {\n value = value || 0;\n this._t = value < 0.0 ? 0.0 : (value > 1.0 ? 1.0 : value);\n }\n\n /**\n * Gets the progress along this SplineCurve.\n *\n * Automatically clamps to range ````[0..1]````.\n *\n * Default value is ````0````.\n *\n * @returns {Number} The new progress.\n */\n get t() {\n return this._t;\n }\n\n /**\n * Gets the point on this SplineCurve at position {@link SplineCurve#t}.\n *\n * @returns {Number[]} The point at {@link SplineCurve#t}.\n */\n get point() {\n return this.getPoint(this._t);\n }\n\n /**\n * Returns point on this SplineCurve at the given position.\n *\n * @param {Number} t Position to get point at.\n * @returns {Number[]} Point at the given position.\n */\n getPoint(t) {\n\n var points = this.points;\n\n if (points.length < 3) {\n this.error(\"Can't sample point from SplineCurve - not enough points on curve - returning [0,0,0].\");\n return;\n }\n\n var point = (points.length - 1) * t;\n\n var intPoint = Math.floor(point);\n var weight = point - intPoint;\n\n var point0 = points[intPoint === 0 ? intPoint : intPoint - 1];\n var point1 = points[intPoint];\n var point2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];\n var point3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];\n\n var vector = math.vec3();\n\n vector[0] = math.catmullRomInterpolate(point0[0], point1[0], point2[0], point3[0], weight);\n vector[1] = math.catmullRomInterpolate(point0[1], point1[1], point2[1], point3[1], weight);\n vector[2] = math.catmullRomInterpolate(point0[2], point1[2], point2[2], point3[2], weight);\n\n return vector;\n }\n\n getJSON() {\n return {\n points: points,\n t: this._t\n };\n }\n}\n\nexport {SplineCurve}", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/SplineCurve.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/SplineCurve.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7947, + "__docId__": 7955, "kind": "class", "name": "SplineCurve", "memberof": "src/viewer/scene/paths/SplineCurve.js", @@ -157783,7 +157999,7 @@ ] }, { - "__docId__": 7948, + "__docId__": 7956, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157870,7 +158086,7 @@ ] }, { - "__docId__": 7951, + "__docId__": 7959, "kind": "set", "name": "points", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157895,7 +158111,7 @@ ] }, { - "__docId__": 7952, + "__docId__": 7960, "kind": "member", "name": "_points", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157913,7 +158129,7 @@ } }, { - "__docId__": 7953, + "__docId__": 7961, "kind": "get", "name": "points", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157945,7 +158161,7 @@ } }, { - "__docId__": 7954, + "__docId__": 7962, "kind": "set", "name": "t", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157970,7 +158186,7 @@ ] }, { - "__docId__": 7955, + "__docId__": 7963, "kind": "member", "name": "_t", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -157988,7 +158204,7 @@ } }, { - "__docId__": 7956, + "__docId__": 7964, "kind": "get", "name": "t", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -158020,7 +158236,7 @@ } }, { - "__docId__": 7957, + "__docId__": 7965, "kind": "get", "name": "point", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -158052,7 +158268,7 @@ } }, { - "__docId__": 7958, + "__docId__": 7966, "kind": "method", "name": "getPoint", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -158091,7 +158307,7 @@ } }, { - "__docId__": 7959, + "__docId__": 7967, "kind": "method", "name": "getJSON", "memberof": "src/viewer/scene/paths/SplineCurve.js~SplineCurve", @@ -158111,29 +158327,29 @@ } }, { - "__docId__": 7960, + "__docId__": 7968, "kind": "file", "name": "src/viewer/scene/paths/index.js", "content": "export * from \"./CubicBezierCurve.js\";\nexport * from \"./Curve.js\";\nexport * from \"./Path.js\";\nexport * from \"./QuadraticBezierCurve.js\";\nexport * from \"./SplineCurve.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/paths/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/paths/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7961, + "__docId__": 7969, "kind": "file", "name": "src/viewer/scene/postfx/CrossSections.js", "content": "import {Component} from '../Component.js';\n\n/**\n * @desc Configures cross-section slices for a {@link Scene}.\n *\n * ## Overview\n *\n * Cross-sections allow to create an additional colored slice for used clipping planes. It is only a visual effect\n * calculated by shaders. It makes it easier to see the intersection between the model and the clipping plane this way.\n *\n * ## Usage\n *\n * In the example below, we'll configure CrossSections to manipulate the slice representation.\n *\n * ````javascript\n * //------------------------------------------------------------------------------------------------------------------\n * // Import the modules we need for this example\n * //------------------------------------------------------------------------------------------------------------------\n *\n * import {PhongMaterial, Viewer, math, SectionPlanesPlugin, XKTLoaderPlugin, Mesh, ReadableGeometry, buildPolylineGeometryFromCurve, SplineCurve} from \"../../dist/xeokit-sdk.es.js\";\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a Viewer and arrange the camera\n * //------------------------------------------------------------------------------------------------------------------\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.341298674548419, 22.43987089731119, 7.236688436028655];\n * viewer.camera.look = [4.399999999999963, 3.7240000000000606, 8.899000000000006];\n * viewer.camera.up = [0.9102954845584759, 0.34781746407929504, 0.22446635042673466];\n *\n * const cameraControl = viewer.cameraControl;\n * cameraControl.navMode = \"orbit\";\n * cameraControl.followPointer = true;\n *\n * //----------------------------------------------------------------------------------------------------------------------\n * // Create a xeokit loader plugin, load a model, fit to view\n * //----------------------------------------------------------------------------------------------------------------------\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * var t0 = performance.now();\n *\n * document.getElementById(\"time\").innerHTML = \"Loading model...\";\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt\",\n * edges: true\n * });\n *\n * sceneModel.on(\"loaded\", () => {\n * var t1 = performance.now();\n * document.getElementById(\"time\").innerHTML = \"Model loaded in \" + Math.floor(t1 - t0) / 1000.0 + \" seconds
    Objects: \" + sceneModel.numEntities;\n *\n * let path = new SplineCurve(viewer.scene, {\n * points: [\n * [0, 0, -10],\n * [0, 0, -3],\n * [10, 0, 10],\n * [10, 0, 30],\n * ],\n * });\n *\n * new Mesh(viewer.scene, {\n * geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({\n * id: \"SplineCurve\",\n * curve: path,\n * divisions: 50,\n * })),\n * material: new PhongMaterial(viewer.scene, {\n * emissive: [1, 0, 0]\n * })\n * });\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Create a moving SectionPlane, that moves through the table models\n * //------------------------------------------------------------------------------------------------------------------\n *\n * const sectionPlanes = new SectionPlanesPlugin(viewer, {\n * overviewCanvasId: \"mySectionPlanesOverviewCanvas\",\n * overviewVisible: true\n * });\n *\n * let currentPoint = path.getPoint(0);\n * let currentDirection = path.getTangent(0);\n *\n * const sectionPlane = sectionPlanes.createSectionPlane({\n * id: \"mySectionPlane\",\n * pos: currentPoint,\n * dir: currentDirection\n * });\n *\n * sectionPlanes.showControl(sectionPlane.id);\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Controlling SectionPlane position and direction\n * //------------------------------------------------------------------------------------------------------------------\n *\n * let currentT = 0.0;\n * document.getElementById(\"section_path\").oninput = function() {\n * currentT = Number(document.getElementById(\"section_path\").value);\n * currentPoint = path.getPoint(currentT);\n * currentDirection = path.getTangent(currentT);\n * sectionPlane.pos = currentPoint;\n * sectionPlane.dir = currentDirection;\n * };\n *\n * window.viewer = viewer;\n *\n * //------------------------------------------------------------------------------------------------------------------\n * // Controlling CrossSections settings\n * //------------------------------------------------------------------------------------------------------------------\n *\n * viewer.scene.crossSections.sliceThickness = 0.05;\n * viewer.scene.crossSections.sliceColor = [0.0, 0.0, 0.0, 1.0];\n * });\n * ````\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/#SectionPlanesPlugin_Duplex_SectionPath_CrossSections)]\n *\n */\nclass CrossSections extends Component {\n\n /** @private */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this.sliceColor = cfg.sliceColor;\n this.sliceThickness = cfg.sliceThickness;\n }\n\n /**\n * Sets the thickness of a slice created by a section.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n set sliceThickness(value) {\n if (value === undefined || value === null) {\n value = 0.0;\n }\n if (this._sliceThickness === value) {\n return;\n }\n this._sliceThickness = value;\n this.glRedraw();\n }\n\n /**\n * Gets the thickness of a slice created by a section.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n get sliceThickness() {\n return this._sliceThickness;\n }\n\n /**\n * Sets the color of a slice created by a section.\n *\n * Default value is ````[0.0, 0.0, 0.0, 1.0]````.\n *\n * @type {Number}\n */\n set sliceColor(value) {\n if (value === undefined || value === null) {\n value = [0.0, 0.0, 0.0, 1.0];\n }\n if (this._sliceColor === value) {\n return;\n }\n this._sliceColor = value;\n this.glRedraw();\n }\n\n /**\n * Gets the color of a slice created by a section.\n *\n * Default value is ````[0.0, 0.0, 0.0, 1.0]````.\n *\n * @type {Number}\n */\n get sliceColor() {\n return this._sliceColor;\n }\n\n /**\n * Destroys this component.\n */\n destroy() {\n super.destroy();\n }\n}\n\nexport {CrossSections};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/postfx/CrossSections.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/postfx/CrossSections.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7962, + "__docId__": 7970, "kind": "class", "name": "CrossSections", "memberof": "src/viewer/scene/postfx/CrossSections.js", @@ -158151,7 +158367,7 @@ ] }, { - "__docId__": 7963, + "__docId__": 7971, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158165,7 +158381,7 @@ "ignore": true }, { - "__docId__": 7966, + "__docId__": 7974, "kind": "set", "name": "sliceThickness", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158186,7 +158402,7 @@ } }, { - "__docId__": 7967, + "__docId__": 7975, "kind": "member", "name": "_sliceThickness", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158204,7 +158420,7 @@ } }, { - "__docId__": 7968, + "__docId__": 7976, "kind": "get", "name": "sliceThickness", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158225,7 +158441,7 @@ } }, { - "__docId__": 7969, + "__docId__": 7977, "kind": "set", "name": "sliceColor", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158246,7 +158462,7 @@ } }, { - "__docId__": 7970, + "__docId__": 7978, "kind": "member", "name": "_sliceColor", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158264,7 +158480,7 @@ } }, { - "__docId__": 7971, + "__docId__": 7979, "kind": "get", "name": "sliceColor", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158285,7 +158501,7 @@ } }, { - "__docId__": 7972, + "__docId__": 7980, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/postfx/CrossSections.js~CrossSections", @@ -158300,18 +158516,18 @@ "return": null }, { - "__docId__": 7973, + "__docId__": 7981, "kind": "file", "name": "src/viewer/scene/postfx/SAO.js", "content": "import {Component} from '../Component.js';\nimport {WEBGL_INFO} from \"../webglInfo.js\";\n\n/**\n * @desc Configures Scalable Ambient Obscurance (SAO) for a {@link Scene}.\n *\n * \n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/viewer/#sao_ConferenceCenter)]\n *\n * ## Overview\n *\n * SAO approximates [Ambient Occlusion](https://en.wikipedia.org/wiki/Ambient_occlusion) in realtime. It darkens creases, cavities and surfaces\n * that are close to each other, which tend to be occluded from ambient light and appear darker.\n *\n * The animated GIF above shows the effect as we repeatedly enable and disable SAO. When SAO is enabled, we can see darkening\n * in regions such as the corners, and the crevices between stairs. This increases the amount of detail we can see when ambient\n * light is high, or when objects have uniform colors across their surfaces. Run the example to experiment with the various\n * SAO configurations.\n *\n * xeokit's implementation of SAO is based on the paper [Scalable Ambient Obscurance](https://research.nvidia.com/sites/default/files/pubs/2012-06_Scalable-Ambient-Obscurance/McGuire12SAO.pdf).\n *\n * ## Caveats\n *\n * Currently, SAO only works with perspective and orthographic projections. Therefore, to use SAO, make sure {@link Camera#projection} is\n * either \"perspective\" or \"ortho\".\n *\n * {@link SAO#scale} and {@link SAO#intensity} must be tuned to the distance\n * between {@link Perspective#near} and {@link Perspective#far}, or the distance\n * between {@link Ortho#near} and {@link Ortho#far}, depending on which of those two projections the {@link Camera} is currently\n * using. Use the [live example](https://xeokit.github.io/xeokit-sdk/examples/viewer/#sao_ConferenceCenter) to get a\n * feel for that.\n *\n * ## Usage\n *\n * In the example below, we'll start by logging a warning message to the console if SAO is not supported by the\n * system.\n *\n *Then we'll enable and configure SAO, position the camera, and configure the near and far perspective and orthographic\n * clipping planes. Finally, we'll use {@link XKTLoaderPlugin} to load the OTC Conference Center model.\n *\n * ````javascript\n * import {Viewer, XKTLoaderPlugin} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * const sao = viewer.scene.sao;\n *\n * if (!sao.supported) {\n * sao.warn(\"SAO is not supported on this system - ignoring SAO configs\")\n * }\n *\n * sao.enabled = true; // Enable SAO - only works if supported (see above)\n * sao.intensity = 0.15;\n * sao.bias = 0.5;\n * sao.scale = 1.0;\n * sao.minResolution = 0.0;\n * sao.numSamples = 10;\n * sao.kernelRadius = 100;\n * sao.blendCutoff = 0.1;\n *\n * const camera = viewer.scene.camera;\n *\n * camera.eye = [3.69, 5.83, -23.98];\n * camera.look = [84.31, -29.88, -116.21];\n * camera.up = [0.18, 0.96, -0.21];\n *\n * camera.perspective.near = 0.1;\n * camera.perspective.far = 2000.0;\n *\n * camera.ortho.near = 0.1;\n * camera.ortho.far = 2000.0;\n * camera.projection = \"perspective\";\n *\n * const xktLoader = new XKTLoaderPlugin(viewer);\n *\n * const model = xktLoader.load({\n * id: \"myModel\",\n * src: \"./models/xkt/OTCConferenceCenter.xkt\"\n * edges: true\n * });\n * ````\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/viewer/#sao_ConferenceCenter)]\n *\n * ## Efficiency\n *\n * SAO can incur some rendering overhead, especially on objects that are viewed close to the camera. For this reason,\n * it's recommended to use a low value for {@link SAO#kernelRadius}. A low radius will sample pixels that are close\n * to the source pixel, which will allow the GPU to efficiently cache those pixels. When {@link Camera#projection} is \"perspective\",\n * objects near to the viewpoint will use larger radii than farther pixels. Therefore, computing SAO for close objects\n * is more expensive than for objects far away, that occupy fewer pixels on the canvas.\n *\n * ## Selectively enabling SAO for models\n *\n * When loading multiple models into a Scene, we sometimes only want SAO on the models that are actually going to\n * show it, such as the architecture or structure, and not show SAO on models that won't show it well, such as the\n * electrical wiring, or plumbing.\n *\n * To illustrate, lets load some of the models for the West Riverside Hospital. We'll enable SAO on the structure model,\n * but disable it on the electrical and plumbing.\n *\n * This will only apply SAO to those models if {@link SAO#supported} and {@link SAO#enabled} are both true.\n *\n * Note, by the way, how we load the models in sequence. Since XKTLoaderPlugin uses scratch memory as part of its loading\n * process, this allows the plugin to reuse that same memory across multiple loads, instead of having to create multiple\n * pools of scratch memory.\n *\n * ````javascript\n * const structure = xktLoader.load({\n * id: \"structure\",\n * src: \"./models/xkt/WestRiverSideHospital/structure.xkt\"\n * edges: true,\n * saoEnabled: true\n * });\n *\n * structure.on(\"loaded\", () => {\n *\n * const electrical = xktLoader.load({\n * id: \"electrical\",\n * src: \"./models/xkt/WestRiverSideHospital/electrical.xkt\",\n * edges: true\n * });\n *\n * electrical.on(\"loaded\", () => {\n *\n * const plumbing = xktLoader.load({\n * id: \"plumbing\",\n * src: \"./models/xkt/WestRiverSideHospital/plumbing.xkt\",\n * edges: true\n * });\n * });\n * });\n * ````\n *\n * ## Disabling SAO while camera is moving\n *\n * For smoother interaction with large models on low-power hardware, we can disable SAO while the {@link Camera} is moving:\n *\n * ````javascript\n * const timeoutDuration = 150; // Milliseconds\n * var timer = timeoutDuration;\n * var saoDisabled = false;\n *\n * const onCameraMatrix = scene.camera.on(\"matrix\", () => {\n * timer = timeoutDuration;\n * if (!saoDisabled) {\n * scene.sao.enabled = false;\n * saoDisabled = true;\n * }\n * });\n *\n * const onSceneTick = scene.on(\"tick\", (tickEvent) => {\n * if (!saoDisabled) {\n * return;\n * }\n * timer -= tickEvent.deltaTime; // Milliseconds\n * if (timer <= 0) {\n * if (saoDisabled) {\n * scene.sao.enabled = true;\n * saoDisabled = false;\n * }\n * }\n * });\n * ````\n *\n * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/index.html#techniques_nonInteractiveQuality)]\n */\nclass SAO extends Component {\n\n /** @private */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._supported = WEBGL_INFO.SUPPORTED_EXTENSIONS[\"OES_standard_derivatives\"]; // For computing normals in SAO fragment shader\n\n this.enabled = cfg.enabled;\n this.kernelRadius = cfg.kernelRadius;\n this.intensity = cfg.intensity;\n this.bias = cfg.bias;\n this.scale = cfg.scale;\n this.minResolution = cfg.minResolution;\n this.numSamples = cfg.numSamples;\n this.blur = cfg.blur;\n this.blendCutoff = cfg.blendCutoff;\n this.blendFactor = cfg.blendFactor;\n }\n\n /**\n * Gets whether or not SAO is supported by this browser and GPU.\n *\n * Even when enabled, SAO will only work if supported.\n *\n * @type {Boolean}\n */\n get supported() {\n return this._supported;\n }\n\n /**\n * Sets whether SAO is enabled for the {@link Scene}.\n *\n * Even when enabled, SAO will only work if supported.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set enabled(value) {\n value = !!value;\n if (this._enabled === value) {\n return;\n }\n this._enabled = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether SAO is enabled for the {@link Scene}.\n *\n * Even when enabled, SAO will only apply if supported.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get enabled() {\n return this._enabled;\n }\n\n /**\n * Returns true if SAO is currently possible, where it is supported, enabled, and the current scene state is compatible.\n * Called internally by renderer logic.\n * @private\n * @returns {Boolean}\n */\n get possible() {\n if (!this._supported) {\n return false;\n }\n if (!this._enabled) {\n return false;\n }\n const projection = this.scene.camera.projection;\n if (projection === \"customProjection\") {\n return false;\n }\n if (projection === \"frustum\") {\n return false;\n }\n return true;\n }\n\n /**\n * @private\n * @returns {boolean|*}\n */\n get active() {\n return this._active;\n }\n\n /**\n * Sets the maximum area that SAO takes into account when checking for possible occlusion for each fragment.\n *\n * Default value is ````100.0````.\n *\n * @type {Number}\n */\n set kernelRadius(value) {\n if (value === undefined || value === null) {\n value = 100.0;\n }\n if (this._kernelRadius === value) {\n return;\n }\n this._kernelRadius = value;\n this.glRedraw();\n }\n\n /**\n * Gets the maximum area that SAO takes into account when checking for possible occlusion for each fragment.\n *\n * Default value is ````100.0````.\n *\n * @type {Number}\n */\n get kernelRadius() {\n return this._kernelRadius;\n }\n\n /**\n * Sets the degree of darkening (ambient obscurance) produced by the SAO effect.\n *\n * Default value is ````0.15````.\n *\n * @type {Number}\n */\n set intensity(value) {\n if (value === undefined || value === null) {\n value = 0.15;\n }\n if (this._intensity === value) {\n return;\n }\n this._intensity = value;\n this.glRedraw();\n }\n\n /**\n * Gets the degree of darkening (ambient obscurance) produced by the SAO effect.\n *\n * Default value is ````0.15````.\n *\n * @type {Number}\n */\n get intensity() {\n return this._intensity;\n }\n\n /**\n * Sets the SAO bias.\n *\n * Default value is ````0.5````.\n *\n * @type {Number}\n */\n set bias(value) {\n if (value === undefined || value === null) {\n value = 0.5;\n }\n if (this._bias === value) {\n return;\n }\n this._bias = value;\n this.glRedraw();\n }\n\n /**\n * Gets the SAO bias.\n *\n * Default value is ````0.5````.\n *\n * @type {Number}\n */\n get bias() {\n return this._bias;\n }\n\n /**\n * Sets the SAO occlusion scale.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n set scale(value) {\n if (value === undefined || value === null) {\n value = 1.0;\n }\n if (this._scale === value) {\n return;\n }\n this._scale = value;\n this.glRedraw();\n }\n\n /**\n * Gets the SAO occlusion scale.\n *\n * Default value is ````1.0````.\n *\n * @type {Number}\n */\n get scale() {\n return this._scale;\n }\n\n /**\n * Sets the SAO minimum resolution.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n set minResolution(value) {\n if (value === undefined || value === null) {\n value = 0.0;\n }\n if (this._minResolution === value) {\n return;\n }\n this._minResolution = value;\n this.glRedraw();\n }\n\n /**\n * Gets the SAO minimum resolution.\n *\n * Default value is ````0.0````.\n *\n * @type {Number}\n */\n get minResolution() {\n return this._minResolution;\n }\n\n /**\n * Sets the number of SAO samples.\n *\n * Default value is ````10````.\n *\n * Update this sparingly, since it causes a shader recompile.\n *\n * @type {Number}\n */\n set numSamples(value) {\n if (value === undefined || value === null) {\n value = 10;\n }\n if (this._numSamples === value) {\n return;\n }\n this._numSamples = value;\n this.glRedraw();\n }\n\n /**\n * Gets the number of SAO samples.\n *\n * Default value is ````10````.\n *\n * @type {Number}\n */\n get numSamples() {\n return this._numSamples;\n }\n\n /**\n * Sets whether Guassian blur is enabled.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n set blur(value) {\n value = (value !== false);\n if (this._blur === value) {\n return;\n }\n this._blur = value;\n this.glRedraw();\n }\n\n /**\n * Gets whether Guassian blur is enabled.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n get blur() {\n return this._blur;\n }\n\n /**\n * Sets the SAO blend cutoff.\n *\n * Default value is ````0.3````.\n *\n * Normally you don't need to alter this.\n *\n * @type {Number}\n */\n set blendCutoff(value) {\n if (value === undefined || value === null) {\n value = 0.3;\n }\n if (this._blendCutoff === value) {\n return;\n }\n this._blendCutoff = value;\n this.glRedraw();\n }\n\n /**\n * Gets the SAO blend cutoff.\n *\n * Default value is ````0.3````.\n *\n * Normally you don't need to alter this.\n *\n * @type {Number}\n */\n get blendCutoff() {\n return this._blendCutoff;\n }\n\n /**\n * Sets the SAO blend factor.\n *\n * Default value is ````1.0````.\n *\n * Normally you don't need to alter this.\n *\n * @type {Number}\n */\n set blendFactor(value) {\n if (value === undefined || value === null) {\n value = 1.0;\n }\n if (this._blendFactor === value) {\n return;\n }\n this._blendFactor = value;\n this.glRedraw();\n }\n\n /**\n * Gets the SAO blend scale.\n *\n * Default value is ````1.0````.\n *\n * Normally you don't need to alter this.\n *\n * @type {Number}\n */\n get blendFactor() {\n return this._blendFactor;\n }\n\n /**\n * Destroys this component.\n */\n destroy() {\n super.destroy();\n }\n}\n\nexport {SAO};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/postfx/SAO.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/postfx/SAO.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 7974, + "__docId__": 7982, "kind": "class", "name": "SAO", "memberof": "src/viewer/scene/postfx/SAO.js", @@ -158329,7 +158545,7 @@ ] }, { - "__docId__": 7975, + "__docId__": 7983, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158343,7 +158559,7 @@ "ignore": true }, { - "__docId__": 7976, + "__docId__": 7984, "kind": "member", "name": "_supported", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158361,7 +158577,7 @@ } }, { - "__docId__": 7987, + "__docId__": 7995, "kind": "get", "name": "supported", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158382,7 +158598,7 @@ } }, { - "__docId__": 7988, + "__docId__": 7996, "kind": "set", "name": "enabled", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158403,7 +158619,7 @@ } }, { - "__docId__": 7989, + "__docId__": 7997, "kind": "member", "name": "_enabled", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158421,7 +158637,7 @@ } }, { - "__docId__": 7990, + "__docId__": 7998, "kind": "get", "name": "enabled", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158442,7 +158658,7 @@ } }, { - "__docId__": 7991, + "__docId__": 7999, "kind": "get", "name": "possible", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158475,7 +158691,7 @@ } }, { - "__docId__": 7992, + "__docId__": 8000, "kind": "get", "name": "active", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158509,7 +158725,7 @@ } }, { - "__docId__": 7993, + "__docId__": 8001, "kind": "set", "name": "kernelRadius", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158530,7 +158746,7 @@ } }, { - "__docId__": 7994, + "__docId__": 8002, "kind": "member", "name": "_kernelRadius", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158548,7 +158764,7 @@ } }, { - "__docId__": 7995, + "__docId__": 8003, "kind": "get", "name": "kernelRadius", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158569,7 +158785,7 @@ } }, { - "__docId__": 7996, + "__docId__": 8004, "kind": "set", "name": "intensity", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158590,7 +158806,7 @@ } }, { - "__docId__": 7997, + "__docId__": 8005, "kind": "member", "name": "_intensity", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158608,7 +158824,7 @@ } }, { - "__docId__": 7998, + "__docId__": 8006, "kind": "get", "name": "intensity", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158629,7 +158845,7 @@ } }, { - "__docId__": 7999, + "__docId__": 8007, "kind": "set", "name": "bias", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158650,7 +158866,7 @@ } }, { - "__docId__": 8000, + "__docId__": 8008, "kind": "member", "name": "_bias", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158668,7 +158884,7 @@ } }, { - "__docId__": 8001, + "__docId__": 8009, "kind": "get", "name": "bias", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158689,7 +158905,7 @@ } }, { - "__docId__": 8002, + "__docId__": 8010, "kind": "set", "name": "scale", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158710,7 +158926,7 @@ } }, { - "__docId__": 8003, + "__docId__": 8011, "kind": "member", "name": "_scale", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158728,7 +158944,7 @@ } }, { - "__docId__": 8004, + "__docId__": 8012, "kind": "get", "name": "scale", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158749,7 +158965,7 @@ } }, { - "__docId__": 8005, + "__docId__": 8013, "kind": "set", "name": "minResolution", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158770,7 +158986,7 @@ } }, { - "__docId__": 8006, + "__docId__": 8014, "kind": "member", "name": "_minResolution", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158788,7 +159004,7 @@ } }, { - "__docId__": 8007, + "__docId__": 8015, "kind": "get", "name": "minResolution", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158809,7 +159025,7 @@ } }, { - "__docId__": 8008, + "__docId__": 8016, "kind": "set", "name": "numSamples", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158830,7 +159046,7 @@ } }, { - "__docId__": 8009, + "__docId__": 8017, "kind": "member", "name": "_numSamples", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158848,7 +159064,7 @@ } }, { - "__docId__": 8010, + "__docId__": 8018, "kind": "get", "name": "numSamples", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158869,7 +159085,7 @@ } }, { - "__docId__": 8011, + "__docId__": 8019, "kind": "set", "name": "blur", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158890,7 +159106,7 @@ } }, { - "__docId__": 8012, + "__docId__": 8020, "kind": "member", "name": "_blur", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158908,7 +159124,7 @@ } }, { - "__docId__": 8013, + "__docId__": 8021, "kind": "get", "name": "blur", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158929,7 +159145,7 @@ } }, { - "__docId__": 8014, + "__docId__": 8022, "kind": "set", "name": "blendCutoff", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158950,7 +159166,7 @@ } }, { - "__docId__": 8015, + "__docId__": 8023, "kind": "member", "name": "_blendCutoff", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158968,7 +159184,7 @@ } }, { - "__docId__": 8016, + "__docId__": 8024, "kind": "get", "name": "blendCutoff", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -158989,7 +159205,7 @@ } }, { - "__docId__": 8017, + "__docId__": 8025, "kind": "set", "name": "blendFactor", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -159010,7 +159226,7 @@ } }, { - "__docId__": 8018, + "__docId__": 8026, "kind": "member", "name": "_blendFactor", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -159028,7 +159244,7 @@ } }, { - "__docId__": 8019, + "__docId__": 8027, "kind": "get", "name": "blendFactor", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -159049,7 +159265,7 @@ } }, { - "__docId__": 8020, + "__docId__": 8028, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/postfx/SAO.js~SAO", @@ -159064,18 +159280,18 @@ "return": null }, { - "__docId__": 8021, + "__docId__": 8029, "kind": "file", "name": "src/viewer/scene/scene/Scene.js", "content": "import {core} from '../core.js';\nimport {utils} from '../utils.js';\nimport {math} from '../math/math.js';\nimport {Component} from '../Component.js';\nimport {Canvas} from '../canvas/Canvas.js';\nimport {Renderer} from '../webgl/Renderer.js';\nimport {Input} from '../input/Input.js';\nimport {Viewport} from '../viewport/Viewport.js';\nimport {Camera} from '../camera/Camera.js';\nimport {DirLight} from '../lights/DirLight.js';\nimport {AmbientLight} from '../lights/AmbientLight.js';\nimport {ReadableGeometry} from \"../geometry/ReadableGeometry.js\";\nimport {buildBoxGeometry} from '../geometry/builders/buildBoxGeometry.js';\nimport {PhongMaterial} from '../materials/PhongMaterial.js';\nimport {EmphasisMaterial} from '../materials/EmphasisMaterial.js';\nimport {EdgeMaterial} from '../materials/EdgeMaterial.js';\nimport {Metrics} from \"../metriqs/Metriqs.js\";\nimport {SAO} from \"../postfx/SAO.js\";\nimport {CrossSections} from \"../postfx/CrossSections.js\";\nimport {PointsMaterial} from \"../materials/PointsMaterial.js\";\nimport {LinesMaterial} from \"../materials/LinesMaterial.js\";\n\n// Enables runtime check for redundant calls to object state update methods, eg. Scene#_objectVisibilityUpdated\nconst ASSERT_OBJECT_STATE_UPDATE = false;\n\n// Cached vars to avoid garbage collection\n\nfunction getEntityIDMap(scene, entityIds) {\n const map = {};\n let entityId;\n let entity;\n for (let i = 0, len = entityIds.length; i < len; i++) {\n entityId = entityIds[i];\n entity = scene.components[entityId];\n if (!entity) {\n scene.warn(\"pick(): Component not found: \" + entityId);\n continue;\n }\n if (!entity.isEntity) {\n scene.warn(\"pick(): Component is not an Entity: \" + entityId);\n continue;\n }\n map[entityId] = true;\n }\n return map;\n}\n\n/**\n * Fired whenever a debug message is logged on a component within this Scene.\n * @event log\n * @param {String} value The debug message\n */\n\n/**\n * Fired whenever an error is logged on a component within this Scene.\n * @event error\n * @param {String} value The error message\n */\n\n/**\n * Fired whenever a warning is logged on a component within this Scene.\n * @event warn\n * @param {String} value The warning message\n */\n\n/**\n * @desc Contains the components that comprise a 3D scene.\n *\n * * A {@link Viewer} has a single Scene, which it provides in {@link Viewer#scene}.\n * * Plugins like {@link AxisGizmoPlugin} also have their own private Scenes.\n * * Each Scene has a corresponding {@link MetaScene}, which the Viewer provides in {@link Viewer#metaScene}.\n *\n * ## Getting a Viewer's Scene\n *\n * ````javascript\n * var scene = viewer.scene;\n * ````\n *\n * ## Creating and accessing Scene components\n *\n * As a brief introduction to creating Scene components, we'll create a {@link Mesh} that has a\n * {@link buildTorusGeometry} and a {@link PhongMaterial}:\n *\n * ````javascript\n * var teapotMesh = new Mesh(scene, {\n * id: \"myMesh\", // <<---------- ID automatically generated if not provided\n * geometry: new TorusGeometry(scene),\n * material: new PhongMaterial(scene, {\n * id: \"myMaterial\",\n * diffuse: [0.2, 0.2, 1.0]\n * })\n * });\n *\n * teapotMesh.scene.camera.eye = [45, 45, 45];\n * ````\n *\n * Find components by ID in their Scene's {@link Scene#components} map:\n *\n * ````javascript\n * var teapotMesh = scene.components[\"myMesh\"];\n * teapotMesh.visible = false;\n *\n * var teapotMaterial = scene.components[\"myMaterial\"];\n * teapotMaterial.diffuse = [1,0,0]; // Change to red\n * ````\n *\n * A Scene also has a map of component instances for each {@link Component} subtype:\n *\n * ````javascript\n * var meshes = scene.types[\"Mesh\"];\n * var teapotMesh = meshes[\"myMesh\"];\n * teapotMesh.xrayed = true;\n *\n * var phongMaterials = scene.types[\"PhongMaterial\"];\n * var teapotMaterial = phongMaterials[\"myMaterial\"];\n * teapotMaterial.diffuse = [0,1,0]; // Change to green\n * ````\n *\n * See {@link Node}, {@link Node} and {@link Model} for how to create and access more sophisticated content.\n *\n * ## Controlling the camera\n *\n * Use the Scene's {@link Camera} to control the current viewpoint and projection:\n *\n * ````javascript\n * var camera = myScene.camera;\n *\n * camera.eye = [-10,0,0];\n * camera.look = [-10,0,0];\n * camera.up = [0,1,0];\n *\n * camera.projection = \"perspective\";\n * camera.perspective.fov = 45;\n * //...\n * ````\n *\n * ## Managing the canvas\n *\n * The Scene's {@link Canvas} component provides various conveniences relevant to the WebGL canvas, such\n * as firing resize events etc:\n *\n * ````javascript\n * var canvas = scene.canvas;\n *\n * canvas.on(\"boundary\", function(boundary) {\n * //...\n * });\n * ````\n *\n * ## Picking\n *\n * Use {@link Scene#pick} to pick and raycast entites.\n *\n * For example, to pick a point on the surface of the closest entity at the given canvas coordinates:\n *\n * ````javascript\n * var pickResult = scene.pick({\n * pickSurface: true,\n * canvasPos: [23, 131]\n * });\n *\n * if (pickResult) { // Picked an entity\n *\n * var entity = pickResult.entity;\n *\n * var primitive = pickResult.primitive; // Type of primitive that was picked, usually \"triangles\"\n * var primIndex = pickResult.primIndex; // Position of triangle's first index in the picked Mesh's Geometry's indices array\n * var indices = pickResult.indices; // UInt32Array containing the triangle's vertex indices\n * var localPos = pickResult.localPos; // Float64Array containing the picked Local-space position on the triangle\n * var worldPos = pickResult.worldPos; // Float64Array containing the picked World-space position on the triangle\n * var viewPos = pickResult.viewPos; // Float64Array containing the picked View-space position on the triangle\n * var bary = pickResult.bary; // Float64Array containing the picked barycentric position within the triangle\n * var normal = pickResult.normal; // Float64Array containing the interpolated normal vector at the picked position on the triangle\n * var uv = pickResult.uv; // Float64Array containing the interpolated UV coordinates at the picked position on the triangle\n * }\n * ````\n *\n * ## Pick masking\n *\n * We can use {@link Scene#pick}'s ````includeEntities```` and ````excludeEntities```` options to mask which {@link Mesh}es we attempt to pick.\n *\n * This is useful for picking through things, to pick only the Entities of interest.\n *\n * To pick only Entities ````\"gearbox#77.0\"```` and ````\"gearbox#79.0\"````, picking through any other Entities that are\n * in the way, as if they weren't there:\n *\n * ````javascript\n * var pickResult = scene.pick({\n * canvasPos: [23, 131],\n * includeEntities: [\"gearbox#77.0\", \"gearbox#79.0\"]\n * });\n *\n * if (pickResult) {\n * // Entity will always be either \"gearbox#77.0\" or \"gearbox#79.0\"\n * var entity = pickResult.entity;\n * }\n * ````\n *\n * To pick any pickable Entity, except for ````\"gearbox#77.0\"```` and ````\"gearbox#79.0\"````, picking through those\n * Entities if they happen to be in the way:\n *\n * ````javascript\n * var pickResult = scene.pick({\n * canvasPos: [23, 131],\n * excludeEntities: [\"gearbox#77.0\", \"gearbox#79.0\"]\n * });\n *\n * if (pickResult) {\n * // Entity will never be \"gearbox#77.0\" or \"gearbox#79.0\"\n * var entity = pickResult.entity;\n * }\n * ````\n *\n * See {@link Scene#pick} for more info on picking.\n *\n * ## Querying and tracking boundaries\n *\n * Getting a Scene's World-space axis-aligned boundary (AABB):\n *\n * ````javascript\n * var aabb = scene.aabb; // [xmin, ymin, zmin, xmax, ymax, zmax]\n * ````\n *\n * Subscribing to updates to the AABB, which occur whenever {@link Entity}s are transformed, their\n * {@link ReadableGeometry}s have been updated, or the {@link Camera} has moved:\n *\n * ````javascript\n * scene.on(\"boundary\", function() {\n * var aabb = scene.aabb;\n * });\n * ````\n *\n * Getting the AABB of the {@link Entity}s with the given IDs:\n *\n * ````JavaScript\n * scene.getAABB(); // Gets collective boundary of all Entities in the scene\n * scene.getAABB(\"saw\"); // Gets boundary of an Object\n * scene.getAABB([\"saw\", \"gearbox\"]); // Gets collective boundary of two Objects\n * ````\n *\n * See {@link Scene#getAABB} and {@link Entity} for more info on querying and tracking boundaries.\n *\n * ## Managing the viewport\n *\n * The Scene's {@link Viewport} component manages the WebGL viewport:\n *\n * ````javascript\n * var viewport = scene.viewport\n * viewport.boundary = [0, 0, 500, 400];;\n * ````\n *\n * ## Controlling rendering\n *\n * You can configure a Scene to perform multiple \"passes\" (renders) per frame. This is useful when we want to render the\n * scene to multiple viewports, such as for stereo effects.\n *\n * In the example, below, we'll configure the Scene to render twice on each frame, each time to different viewport. We'll do this\n * with a callback that intercepts the Scene before each render and sets its {@link Viewport} to a\n * different portion of the canvas. By default, the Scene will clear the canvas only before the first render, allowing the\n * two views to be shown on the canvas at the same time.\n *\n * ````Javascript\n * var viewport = scene.viewport;\n *\n * // Configure Scene to render twice for each frame\n * scene.passes = 2; // Default is 1\n * scene.clearEachPass = false; // Default is false\n *\n * // Render to a separate viewport on each render\n *\n * var viewport = scene.viewport;\n * viewport.autoBoundary = false;\n *\n * scene.on(\"rendering\", function (e) {\n * switch (e.pass) {\n * case 0:\n * viewport.boundary = [0, 0, 200, 200]; // xmin, ymin, width, height\n * break;\n *\n * case 1:\n * viewport.boundary = [200, 0, 200, 200];\n * break;\n * }\n * });\n *\n * // We can also intercept the Scene after each render,\n * // (though we're not using this for anything here)\n * scene.on(\"rendered\", function (e) {\n * switch (e.pass) {\n * case 0:\n * break;\n *\n * case 1:\n * break;\n * }\n * });\n * ````\n *\n * ## Gamma correction\n *\n * Within its shaders, xeokit performs shading calculations in linear space.\n *\n * By default, the Scene expects color textures (eg. {@link PhongMaterial#diffuseMap},\n * {@link MetallicMaterial#baseColorMap} and {@link SpecularMaterial#diffuseMap}) to\n * be in pre-multipled gamma space, so will convert those to linear space before they are used in shaders. Other textures are\n * always expected to be in linear space.\n *\n * By default, the Scene will also gamma-correct its rendered output.\n *\n * You can configure the Scene to expect all those color textures to be linear space, so that it does not gamma-correct them:\n *\n * ````javascript\n * scene.gammaInput = false;\n * ````\n *\n * You would still need to gamma-correct the output, though, if it's going straight to the canvas, so normally we would\n * leave that enabled:\n *\n * ````javascript\n * scene.gammaOutput = true;\n * ````\n *\n * See {@link Texture} for more information on texture encoding and gamma.\n *\n * @class Scene\n */\nclass Scene extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Scene\";\n }\n\n /**\n * @private\n * @constructor\n * @param {Viewer} viewer The Viewer this Scene belongs to.\n * @param {Object} cfg Scene configuration.\n * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.\n * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.\n * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity\n * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally\n * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing\n * responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with\n * your expected usage.\n * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.\n */\n constructor(viewer, cfg = {}) {\n\n super(null, cfg);\n\n const canvas = cfg.canvasElement || document.getElementById(cfg.canvasId);\n\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw \"Mandatory config expected: valid canvasId or canvasElement\";\n }\n\n /**\n * @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}\n */\n this._tickifiedFunctions = {};\n\n const transparent = (!!cfg.transparent);\n const alphaDepthMask = (!!cfg.alphaDepthMask);\n\n this._aabbDirty = true;\n\n /**\n * The {@link Viewer} this Scene belongs to.\n * @type {Viewer}\n */\n this.viewer = viewer;\n\n /** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.\n * @private\n * @type {number}\n */\n this.occlusionTestCountdown = 0;\n\n /**\n The number of models currently loading.\n\n @property loading\n @final\n @type {Number}\n */\n this.loading = 0;\n\n /**\n The epoch time (in milliseconds since 1970) when this Scene was instantiated.\n\n @property timeCreated\n @final\n @type {Number}\n */\n this.startTime = (new Date()).getTime();\n\n /**\n * Map of {@link Entity}s that represent models.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isModel} is ````true````.\n *\n * @property models\n * @final\n * @type {{String:Entity}}\n */\n this.models = {};\n\n /**\n * Map of {@link Entity}s that represents objects.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isObject} is ````true````.\n *\n * @property objects\n * @final\n * @type {{String:Entity}}\n */\n this.objects = {};\n this._numObjects = 0;\n\n /**\n * Map of currently visible {@link Entity}s that represent objects.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true````, and is visible when {@link Entity#visible} is true.\n *\n * @property visibleObjects\n * @final\n * @type {{String:Object}}\n */\n this.visibleObjects = {};\n this._numVisibleObjects = 0;\n\n /**\n * Map of currently xrayed {@link Entity}s that represent objects.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true````, and is xrayed when {@link Entity#xrayed} is true.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property xrayedObjects\n * @final\n * @type {{String:Object}}\n */\n this.xrayedObjects = {};\n this._numXRayedObjects = 0;\n\n /**\n * Map of currently highlighted {@link Entity}s that represent objects.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true```` is true, and is highlighted when {@link Entity#highlighted} is true.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property highlightedObjects\n * @final\n * @type {{String:Object}}\n */\n this.highlightedObjects = {};\n this._numHighlightedObjects = 0;\n\n /**\n * Map of currently selected {@link Entity}s that represent objects.\n *\n * An Entity represents an object if {@link Entity#isObject} is true, and is selected while {@link Entity#selected} is true.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property selectedObjects\n * @final\n * @type {{String:Object}}\n */\n this.selectedObjects = {};\n this._numSelectedObjects = 0;\n\n /**\n * Map of currently colorized {@link Entity}s that represent objects.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property colorizedObjects\n * @final\n * @type {{String:Object}}\n */\n this.colorizedObjects = {};\n this._numColorizedObjects = 0;\n\n /**\n * Map of {@link Entity}s that represent objects whose opacity was updated.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property opacityObjects\n * @final\n * @type {{String:Object}}\n */\n this.opacityObjects = {};\n this._numOpacityObjects = 0;\n\n /**\n * Map of {@link Entity}s that represent objects whose {@link Entity#offset}s were updated.\n *\n * An Entity represents an object if {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} is mapped here by {@link Entity#id}.\n *\n * @property offsetObjects\n * @final\n * @type {{String:Object}}\n */\n this.offsetObjects = {};\n this._numOffsetObjects = 0;\n\n // Cached ID arrays, lazy-rebuilt as needed when stale after map updates\n\n /**\n Lazy-regenerated ID lists.\n */\n this._modelIds = null;\n this._objectIds = null;\n this._visibleObjectIds = null;\n this._xrayedObjectIds = null;\n this._highlightedObjectIds = null;\n this._selectedObjectIds = null;\n this._colorizedObjectIds = null;\n this._opacityObjectIds = null;\n this._offsetObjectIds = null;\n\n this._collidables = {}; // Components that contribute to the Scene AABB\n this._compilables = {}; // Components that require shader compilation\n\n this._needRecompile = false;\n\n /**\n * For each {@link Component} type, a map of IDs to {@link Component} instances of that type.\n *\n * @type {{String:{String:Component}}}\n */\n this.types = {};\n\n /**\n * The {@link Component}s within this Scene, each mapped to its {@link Component#id}.\n *\n * *@type {{String:Component}}\n */\n this.components = {};\n\n /**\n * The {@link SectionPlane}s in this Scene, each mapped to its {@link SectionPlane#id}.\n *\n * @type {{String:SectionPlane}}\n */\n this.sectionPlanes = {};\n\n /**\n * The {@link Light}s in this Scene, each mapped to its {@link Light#id}.\n *\n * @type {{String:Light}}\n */\n this.lights = {};\n\n /**\n * The {@link LightMap}s in this Scene, each mapped to its {@link LightMap#id}.\n *\n * @type {{String:LightMap}}\n */\n this.lightMaps = {};\n\n /**\n * The {@link ReflectionMap}s in this Scene, each mapped to its {@link ReflectionMap#id}.\n *\n * @type {{String:ReflectionMap}}\n */\n this.reflectionMaps = {};\n\n /**\n * The {@link Bitmap}s in this Scene, each mapped to its {@link Bitmap#id}.\n *\n * @type {{String:Bitmap}}\n */\n this.bitmaps = {};\n\n /**\n * The {@link LineSet}s in this Scene, each mapped to its {@link LineSet#id}.\n *\n * @type {{String:LineSet}}\n */\n this.lineSets = {};\n\n /**\n * The real world offset for this Scene\n *\n * @type {Number[]}\n */\n this.realWorldOffset = cfg.realWorldOffset || new Float64Array([0, 0, 0]);\n\n /**\n * Manages the HTML5 canvas for this Scene.\n *\n * @type {Canvas}\n */\n this.canvas = new Canvas(this, {\n dontClear: true, // Never destroy this component with Scene#clear();\n canvas: canvas,\n spinnerElementId: cfg.spinnerElementId,\n transparent: transparent,\n webgl2: cfg.webgl2 !== false,\n contextAttr: cfg.contextAttr || {},\n backgroundColor: cfg.backgroundColor,\n backgroundColorFromAmbientLight: cfg.backgroundColorFromAmbientLight,\n premultipliedAlpha: cfg.premultipliedAlpha\n });\n\n this.canvas.on(\"boundary\", () => {\n this.glRedraw();\n });\n\n this.canvas.on(\"webglContextFailed\", () => {\n alert(\"xeokit failed to find WebGL!\");\n });\n\n this._renderer = new Renderer(this, {\n transparent: transparent,\n alphaDepthMask: alphaDepthMask\n });\n\n this._sectionPlanesState = new (function () {\n\n this.sectionPlanes = [];\n\n this.clippingCaps = false;\n\n this._numCachedSectionPlanes = 0;\n\n let hash = null;\n\n this.getHash = function () {\n if (hash) {\n return hash;\n }\n const numAllocatedSectionPlanes = this.getNumAllocatedSectionPlanes();\n const sectionPlanes = this.sectionPlanes;\n if (numAllocatedSectionPlanes === 0) {\n return this.hash = \";\";\n }\n let sectionPlane;\n\n const hashParts = [];\n for (let i = 0, len = numAllocatedSectionPlanes; i < len; i++) {\n sectionPlane = sectionPlanes[i];\n hashParts.push(\"cp\");\n }\n hashParts.push(\";\");\n hash = hashParts.join(\"\");\n return hash;\n };\n\n this.addSectionPlane = function (sectionPlane) {\n this.sectionPlanes.push(sectionPlane);\n hash = null;\n };\n\n this.removeSectionPlane = function (sectionPlane) {\n for (let i = 0, len = this.sectionPlanes.length; i < len; i++) {\n if (this.sectionPlanes[i].id === sectionPlane.id) {\n this.sectionPlanes.splice(i, 1);\n hash = null;\n return;\n }\n }\n };\n\n this.setNumCachedSectionPlanes = function (numCachedSectionPlanes) {\n this._numCachedSectionPlanes = numCachedSectionPlanes;\n hash = null;\n }\n\n this.getNumCachedSectionPlanes = function () {\n return this._numCachedSectionPlanes;\n }\n\n this.getNumAllocatedSectionPlanes = function () {\n const num = this.sectionPlanes.length;\n return (num > this._numCachedSectionPlanes) ? num : this._numCachedSectionPlanes;\n };\n })();\n\n this._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes || 0);\n\n this._lightsState = new (function () {\n\n const DEFAULT_AMBIENT = math.vec4([0, 0, 0, 0]);\n const ambientColorIntensity = math.vec4();\n\n this.lights = [];\n this.reflectionMaps = [];\n this.lightMaps = [];\n\n let hash = null;\n let ambientLight = null;\n\n this.getHash = function () {\n if (hash) {\n return hash;\n }\n const hashParts = [];\n const lights = this.lights;\n let light;\n for (let i = 0, len = lights.length; i < len; i++) {\n light = lights[i];\n hashParts.push(\"/\");\n hashParts.push(light.type);\n hashParts.push((light.space === \"world\") ? \"w\" : \"v\");\n if (light.castsShadow) {\n hashParts.push(\"sh\");\n }\n }\n if (this.lightMaps.length > 0) {\n hashParts.push(\"/lm\");\n }\n if (this.reflectionMaps.length > 0) {\n hashParts.push(\"/rm\");\n }\n hashParts.push(\";\");\n hash = hashParts.join(\"\");\n return hash;\n };\n\n this.addLight = function (state) {\n this.lights.push(state);\n ambientLight = null;\n hash = null;\n };\n\n this.removeLight = function (state) {\n for (let i = 0, len = this.lights.length; i < len; i++) {\n const light = this.lights[i];\n if (light.id === state.id) {\n this.lights.splice(i, 1);\n if (ambientLight && ambientLight.id === state.id) {\n ambientLight = null;\n }\n hash = null;\n return;\n }\n }\n };\n\n this.addReflectionMap = function (state) {\n this.reflectionMaps.push(state);\n hash = null;\n };\n\n this.removeReflectionMap = function (state) {\n for (let i = 0, len = this.reflectionMaps.length; i < len; i++) {\n if (this.reflectionMaps[i].id === state.id) {\n this.reflectionMaps.splice(i, 1);\n hash = null;\n return;\n }\n }\n };\n\n this.addLightMap = function (state) {\n this.lightMaps.push(state);\n hash = null;\n };\n\n this.removeLightMap = function (state) {\n for (let i = 0, len = this.lightMaps.length; i < len; i++) {\n if (this.lightMaps[i].id === state.id) {\n this.lightMaps.splice(i, 1);\n hash = null;\n return;\n }\n }\n };\n\n this.getAmbientColorAndIntensity = function () {\n if (!ambientLight) {\n for (let i = 0, len = this.lights.length; i < len; i++) {\n const light = this.lights[i];\n if (light.type === \"ambient\") {\n ambientLight = light;\n break;\n }\n }\n }\n if (ambientLight) {\n const color = ambientLight.color;\n const intensity = ambientLight.intensity;\n ambientColorIntensity[0] = color[0];\n ambientColorIntensity[1] = color[1];\n ambientColorIntensity[2] = color[2];\n ambientColorIntensity[3] = intensity\n return ambientColorIntensity;\n } else {\n return DEFAULT_AMBIENT;\n }\n };\n\n })();\n\n /**\n * Publishes input events that occur on this Scene's canvas.\n *\n * @property input\n * @type {Input}\n * @final\n */\n this.input = new Input(this, {\n dontClear: true, // Never destroy this component with Scene#clear();\n element: this.canvas.canvas,\n keyboardEventsElement: cfg.keyboardEventsElement\n });\n\n /**\n * Configures this Scene's units of measurement and coordinate mapping between Real-space and World-space 3D coordinate systems.\n *\n * @property metrics\n * @type {Metrics}\n * @final\n */\n this.metrics = new Metrics(this, {\n units: cfg.units,\n scale: cfg.scale,\n origin: cfg.origin\n });\n\n /** Configures Scalable Ambient Obscurance (SAO) for this Scene.\n * @type {SAO}\n * @final\n */\n this.sao = new SAO(this, {\n enabled: cfg.saoEnabled\n });\n\n /** Configures Cross Sections for this Scene.\n * @type {CrossSections}\n * @final\n */\n this.crossSections = new CrossSections(this, {\n\n });\n\n this.ticksPerRender = cfg.ticksPerRender;\n this.ticksPerOcclusionTest = cfg.ticksPerOcclusionTest;\n this.passes = cfg.passes;\n this.clearEachPass = cfg.clearEachPass;\n this.gammaInput = cfg.gammaInput;\n this.gammaOutput = cfg.gammaOutput;\n this.gammaFactor = cfg.gammaFactor;\n\n this._entityOffsetsEnabled = !!cfg.entityOffsetsEnabled;\n this._logarithmicDepthBufferEnabled = !!cfg.logarithmicDepthBufferEnabled;\n\n this._dtxEnabled = (cfg.dtxEnabled !== false);\n this._pbrEnabled = !!cfg.pbrEnabled;\n this._colorTextureEnabled = (cfg.colorTextureEnabled !== false);\n this._dtxEnabled = !!cfg.dtxEnabled;\n\n // Register Scene on xeokit\n // Do this BEFORE we add components below\n core._addScene(this);\n\n this._initDefaults();\n\n // Global components\n\n this._viewport = new Viewport(this, {\n id: \"default.viewport\",\n autoBoundary: true,\n dontClear: true // Never destroy this component with Scene#clear();\n });\n\n this._camera = new Camera(this, {\n id: \"default.camera\",\n dontClear: true // Never destroy this component with Scene#clear();\n });\n\n // Default lights\n\n new AmbientLight(this, {\n color: [1.0, 1.0, 1.0],\n intensity: 0.7\n });\n\n new DirLight(this, {\n dir: [0.8, -.5, -0.5],\n color: [0.67, 0.67, 1.0],\n intensity: 0.7,\n space: \"world\"\n });\n\n new DirLight(this, {\n dir: [-0.8, -1.0, 0.5],\n color: [1, 1, .9],\n intensity: 0.9,\n space: \"world\"\n });\n\n this._camera.on(\"dirty\", () => {\n this._renderer.imageDirty();\n });\n }\n\n _initDefaults() {\n\n // Call this Scene's property accessors to lazy-init their properties\n\n let dummy; // Keeps Codacy happy\n\n dummy = this.geometry;\n dummy = this.material;\n dummy = this.xrayMaterial;\n dummy = this.edgeMaterial;\n dummy = this.selectedMaterial;\n dummy = this.highlightMaterial;\n }\n\n _addComponent(component) {\n if (component.id) { // Manual ID\n if (this.components[component.id]) {\n this.error(\"Component \" + utils.inQuotes(component.id) + \" already exists in Scene - ignoring ID, will randomly-generate instead\");\n component.id = null;\n }\n }\n if (!component.id) { // Auto ID\n if (window.nextID === undefined) {\n window.nextID = 0;\n }\n //component.id = math.createUUID();\n component.id = \"__\" + window.nextID++;\n while (this.components[component.id]) {\n component.id = math.createUUID();\n }\n }\n this.components[component.id] = component;\n\n // Register for class type\n const type = component.type;\n let types = this.types[component.type];\n if (!types) {\n types = this.types[type] = {};\n }\n types[component.id] = component;\n\n if (component.compile) {\n this._compilables[component.id] = component;\n }\n if (component.isDrawable) {\n this._renderer.addDrawable(component.id, component);\n this._collidables[component.id] = component;\n }\n }\n\n _removeComponent(component) {\n var id = component.id;\n var type = component.type;\n delete this.components[id];\n // Unregister for types\n const types = this.types[type];\n if (types) {\n delete types[id];\n if (utils.isEmptyObject(types)) {\n delete this.types[type];\n }\n }\n if (component.compile) {\n delete this._compilables[component.id];\n }\n if (component.isDrawable) {\n this._renderer.removeDrawable(component.id);\n delete this._collidables[component.id];\n }\n }\n\n // Methods below are called by various component types to register themselves on their\n // Scene. Violates Hollywood Principle, where we could just filter on type in _addComponent,\n // but this is faster than checking the type of each component in such a filter.\n\n _sectionPlaneCreated(sectionPlane) {\n this.sectionPlanes[sectionPlane.id] = sectionPlane;\n this.scene._sectionPlanesState.addSectionPlane(sectionPlane._state);\n this.scene.fire(\"sectionPlaneCreated\", sectionPlane, true /* Don't retain event */);\n this._needRecompile = true;\n }\n\n _bitmapCreated(bitmap) {\n this.bitmaps[bitmap.id] = bitmap;\n this.scene.fire(\"bitmapCreated\", bitmap, true /* Don't retain event */);\n }\n\n _lineSetCreated(lineSet) {\n this.lineSets[lineSet.id] = lineSet;\n this.scene.fire(\"lineSetCreated\", lineSet, true /* Don't retain event */);\n }\n\n _lightCreated(light) {\n this.lights[light.id] = light;\n this.scene._lightsState.addLight(light._state);\n this._needRecompile = true;\n }\n\n _lightMapCreated(lightMap) {\n this.lightMaps[lightMap.id] = lightMap;\n this.scene._lightsState.addLightMap(lightMap._state);\n this._needRecompile = true;\n }\n\n _reflectionMapCreated(reflectionMap) {\n this.reflectionMaps[reflectionMap.id] = reflectionMap;\n this.scene._lightsState.addReflectionMap(reflectionMap._state);\n this._needRecompile = true;\n }\n\n _sectionPlaneDestroyed(sectionPlane) {\n delete this.sectionPlanes[sectionPlane.id];\n this.scene._sectionPlanesState.removeSectionPlane(sectionPlane._state);\n this.scene.fire(\"sectionPlaneDestroyed\", sectionPlane, true /* Don't retain event */);\n this._needRecompile = true;\n }\n\n _bitmapDestroyed(bitmap) {\n delete this.bitmaps[bitmap.id];\n this.scene.fire(\"bitmapDestroyed\", bitmap, true /* Don't retain event */);\n }\n\n _lineSetDestroyed(lineSet) {\n delete this.lineSets[lineSet.id];\n this.scene.fire(\"lineSetDestroyed\", lineSet, true /* Don't retain event */);\n }\n\n _lightDestroyed(light) {\n delete this.lights[light.id];\n this.scene._lightsState.removeLight(light._state);\n this._needRecompile = true;\n }\n\n _lightMapDestroyed(lightMap) {\n delete this.lightMaps[lightMap.id];\n this.scene._lightsState.removeLightMap(lightMap._state);\n this._needRecompile = true;\n }\n\n _reflectionMapDestroyed(reflectionMap) {\n delete this.reflectionMaps[reflectionMap.id];\n this.scene._lightsState.removeReflectionMap(reflectionMap._state);\n this._needRecompile = true;\n }\n\n _registerModel(entity) {\n this.models[entity.id] = entity;\n this._modelIds = null; // Lazy regenerate\n }\n\n _deregisterModel(entity) {\n const modelId = entity.id;\n delete this.models[modelId];\n this._modelIds = null; // Lazy regenerate\n this.fire(\"modelUnloaded\", modelId);\n }\n\n _registerObject(entity) {\n this.objects[entity.id] = entity;\n this._numObjects++;\n this._objectIds = null; // Lazy regenerate\n }\n\n _deregisterObject(entity) {\n delete this.objects[entity.id];\n this._numObjects--;\n this._objectIds = null; // Lazy regenerate\n }\n\n _objectVisibilityUpdated(entity, notify = true) {\n if (entity.visible) {\n if (ASSERT_OBJECT_STATE_UPDATE && this.visibleObjects[entity.id]) {\n console.error(\"Redundant object visibility update (visible=true)\");\n return;\n }\n this.visibleObjects[entity.id] = entity;\n this._numVisibleObjects++;\n } else {\n if (ASSERT_OBJECT_STATE_UPDATE && (!this.visibleObjects[entity.id])) {\n console.error(\"Redundant object visibility update (visible=false)\");\n return;\n }\n delete this.visibleObjects[entity.id];\n this._numVisibleObjects--;\n }\n this._visibleObjectIds = null; // Lazy regenerate\n if (notify) {\n this.fire(\"objectVisibility\", entity, true);\n }\n }\n\n _deRegisterVisibleObject(entity) {\n delete this.visibleObjects[entity.id];\n this._numVisibleObjects--;\n this._visibleObjectIds = null; // Lazy regenerate\n }\n\n _objectXRayedUpdated(entity, notify = true) {\n if (entity.xrayed) {\n if (ASSERT_OBJECT_STATE_UPDATE && this.xrayedObjects[entity.id]) {\n console.error(\"Redundant object xray update (xrayed=true)\");\n return;\n }\n this.xrayedObjects[entity.id] = entity;\n this._numXRayedObjects++;\n } else {\n if (ASSERT_OBJECT_STATE_UPDATE && (!this.xrayedObjects[entity.id])) {\n console.error(\"Redundant object xray update (xrayed=false)\");\n return;\n }\n delete this.xrayedObjects[entity.id];\n this._numXRayedObjects--;\n }\n this._xrayedObjectIds = null; // Lazy regenerate\n if (notify) {\n this.fire(\"objectXRayed\", entity, true);\n }\n }\n\n _deRegisterXRayedObject(entity) {\n delete this.xrayedObjects[entity.id];\n this._numXRayedObjects--;\n this._xrayedObjectIds = null; // Lazy regenerate\n }\n\n _objectHighlightedUpdated(entity) {\n if (entity.highlighted) {\n if (ASSERT_OBJECT_STATE_UPDATE && this.highlightedObjects[entity.id]) {\n console.error(\"Redundant object highlight update (highlighted=true)\");\n return;\n }\n this.highlightedObjects[entity.id] = entity;\n this._numHighlightedObjects++;\n } else {\n if (ASSERT_OBJECT_STATE_UPDATE && (!this.highlightedObjects[entity.id])) {\n console.error(\"Redundant object highlight update (highlighted=false)\");\n return;\n }\n delete this.highlightedObjects[entity.id];\n this._numHighlightedObjects--;\n }\n this._highlightedObjectIds = null; // Lazy regenerate\n }\n\n _deRegisterHighlightedObject(entity) {\n delete this.highlightedObjects[entity.id];\n this._numHighlightedObjects--;\n this._highlightedObjectIds = null; // Lazy regenerate\n }\n\n _objectSelectedUpdated(entity, notify = true) {\n if (entity.selected) {\n if (ASSERT_OBJECT_STATE_UPDATE && this.selectedObjects[entity.id]) {\n console.error(\"Redundant object select update (selected=true)\");\n return;\n }\n this.selectedObjects[entity.id] = entity;\n this._numSelectedObjects++;\n } else {\n if (ASSERT_OBJECT_STATE_UPDATE && (!this.selectedObjects[entity.id])) {\n console.error(\"Redundant object select update (selected=false)\");\n return;\n }\n delete this.selectedObjects[entity.id];\n this._numSelectedObjects--;\n }\n this._selectedObjectIds = null; // Lazy regenerate\n if (notify) {\n this.fire(\"objectSelected\", entity, true);\n }\n }\n\n _deRegisterSelectedObject(entity) {\n delete this.selectedObjects[entity.id];\n this._numSelectedObjects--;\n this._selectedObjectIds = null; // Lazy regenerate\n }\n\n\n _objectColorizeUpdated(entity, colorized) {\n if (colorized) {\n this.colorizedObjects[entity.id] = entity;\n this._numColorizedObjects++;\n } else {\n delete this.colorizedObjects[entity.id];\n this._numColorizedObjects--;\n }\n this._colorizedObjectIds = null; // Lazy regenerate\n }\n\n _deRegisterColorizedObject(entity) {\n delete this.colorizedObjects[entity.id];\n this._numColorizedObjects--;\n this._colorizedObjectIds = null; // Lazy regenerate\n }\n\n _objectOpacityUpdated(entity, opacityUpdated) {\n if (opacityUpdated) {\n this.opacityObjects[entity.id] = entity;\n this._numOpacityObjects++;\n } else {\n delete this.opacityObjects[entity.id];\n this._numOpacityObjects--;\n }\n this._opacityObjectIds = null; // Lazy regenerate\n }\n\n _deRegisterOpacityObject(entity) {\n delete this.opacityObjects[entity.id];\n this._numOpacityObjects--;\n this._opacityObjectIds = null; // Lazy regenerate\n }\n\n _objectOffsetUpdated(entity, offset) {\n if (!offset || offset[0] === 0 && offset[1] === 0 && offset[2] === 0) {\n this.offsetObjects[entity.id] = entity;\n this._numOffsetObjects++;\n } else {\n delete this.offsetObjects[entity.id];\n this._numOffsetObjects--;\n }\n this._offsetObjectIds = null; // Lazy regenerate\n }\n\n _deRegisterOffsetObject(entity) {\n delete this.offsetObjects[entity.id];\n this._numOffsetObjects--;\n this._offsetObjectIds = null; // Lazy regenerate\n }\n\n _webglContextLost() {\n // this.loading++;\n this.canvas.spinner.processes++;\n for (const id in this.components) {\n if (this.components.hasOwnProperty(id)) {\n const component = this.components[id];\n if (component._webglContextLost) {\n component._webglContextLost();\n }\n }\n }\n this._renderer.webglContextLost();\n }\n\n _webglContextRestored() {\n const gl = this.canvas.gl;\n for (const id in this.components) {\n if (this.components.hasOwnProperty(id)) {\n const component = this.components[id];\n if (component._webglContextRestored) {\n component._webglContextRestored(gl);\n }\n }\n }\n this._renderer.webglContextRestored(gl);\n //this.loading--;\n this.canvas.spinner.processes--;\n }\n\n /**\n * Returns the capabilities of this Scene.\n *\n * @private\n * @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}\n */\n get capabilities() {\n return this._renderer.capabilities;\n }\n\n /**\n * Whether {@link Entity#offset} is enabled.\n *\n * This is set via the {@link Viewer} constructor and is ````false```` by default.\n *\n * @returns {Boolean} True if {@link Entity#offset} is enabled.\n */\n get entityOffsetsEnabled() {\n return this._entityOffsetsEnabled;\n }\n\n /**\n * Whether precision surface picking is enabled.\n *\n * This is set via the {@link Viewer} constructor and is ````false```` by default.\n *\n * The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.\n *\n * Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer.\n *\n * @returns {Boolean} True if precision picking is enabled.\n */\n get pickSurfacePrecisionEnabled() {\n return false; // Removed\n }\n\n /**\n * Whether logarithmic depth buffer is enabled.\n *\n * This is set via the {@link Viewer} constructor and is ````false```` by default.\n *\n * @returns {Boolean} True if logarithmic depth buffer is enabled.\n */\n get logarithmicDepthBufferEnabled() {\n return this._logarithmicDepthBufferEnabled;\n }\n\n /**\n * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.\n *\n * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity\n * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally\n * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing\n * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with\n * your expected usage.\n *\n * Default is ````0````.\n */\n set numCachedSectionPlanes(numCachedSectionPlanes) {\n numCachedSectionPlanes = numCachedSectionPlanes || 0;\n if (this._sectionPlanesState.getNumCachedSectionPlanes() !== numCachedSectionPlanes) {\n this._sectionPlanesState.setNumCachedSectionPlanes(numCachedSectionPlanes);\n this._needRecompile = true;\n this.glRedraw();\n }\n }\n\n /**\n * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.\n *\n * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity\n * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally\n * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing\n * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with\n * your expected usage.\n *\n * Default is ````0````.\n *\n * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.\n */\n get numCachedSectionPlanes() {\n return this._sectionPlanesState.getNumCachedSectionPlanes();\n }\n\n /**\n * Sets whether physically-based rendering is enabled.\n *\n * Default is ````false````.\n */\n set pbrEnabled(pbrEnabled) {\n this._pbrEnabled = !!pbrEnabled;\n this.glRedraw();\n }\n\n /**\n * Gets whether physically-based rendering is enabled.\n *\n * Default is ````false````.\n *\n * @returns {Boolean} True if quality rendering is enabled.\n */\n get pbrEnabled() {\n return this._pbrEnabled;\n }\n\n /**\n * Sets whether data texture scene representation (DTX) is enabled for the {@link Scene}.\n *\n * Even when enabled, DTX will only work if supported.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set dtxEnabled(value) {\n value = !!value;\n if (this._dtxEnabled === value) {\n return;\n }\n this._dtxEnabled = value;\n }\n\n /**\n * Gets whether data texture-based scene representation (DTX) is enabled for the {@link Scene}.\n *\n * Even when enabled, DTX will only apply if supported.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get dtxEnabled() {\n return this._dtxEnabled;\n }\n\n /**\n * Sets whether basic color texture rendering is enabled.\n *\n * Default is ````true````.\n *\n * @returns {Boolean} True if basic color texture rendering is enabled.\n */\n set colorTextureEnabled(colorTextureEnabled) {\n this._colorTextureEnabled = !!colorTextureEnabled;\n this.glRedraw();\n }\n\n /**\n * Gets whether basic color texture rendering is enabled.\n *\n * Default is ````true````.\n *\n * @returns {Boolean} True if basic color texture rendering is enabled.\n */\n get colorTextureEnabled() {\n return this._colorTextureEnabled;\n }\n\n /**\n * Performs an occlusion test on all {@link Marker}s in this {@link Scene}.\n *\n * Sets each {@link Marker#visible} ````true```` if the Marker is currently not occluded by any opaque {@link Entity}s\n * in the Scene, or ````false```` if an Entity is occluding it.\n */\n doOcclusionTest() {\n if (this._needRecompile) {\n this._recompile();\n this._needRecompile = false;\n }\n this._renderer.doOcclusionTest();\n }\n\n /**\n * Renders a single frame of this Scene.\n *\n * The Scene will periodically render itself after any updates, but you can call this method to force a render\n * if required.\n *\n * @param {Boolean} [forceRender=false] Forces a render when true, otherwise only renders if something has changed in this Scene\n * since the last render.\n */\n render(forceRender) {\n\n if (forceRender) {\n core.runTasks();\n }\n\n const renderEvent = {\n sceneId: null,\n pass: 0\n };\n\n if (this._needRecompile) {\n this._recompile();\n this._renderer.imageDirty();\n this._needRecompile = false;\n }\n\n if (!forceRender && !this._renderer.needsRender()) {\n return;\n }\n\n renderEvent.sceneId = this.id;\n\n const passes = this._passes;\n const clearEachPass = this._clearEachPass;\n let pass;\n let clear;\n\n for (pass = 0; pass < passes; pass++) {\n\n renderEvent.pass = pass;\n\n /**\n * Fired when about to render a frame for a Scene.\n *\n * @event rendering\n * @param {String} sceneID The ID of this Scene.\n * @param {Number} pass Index of the pass we are about to render (see {@link Scene#passes}).\n */\n this.fire(\"rendering\", renderEvent, true);\n\n clear = clearEachPass || (pass === 0);\n\n this._renderer.render({pass: pass, clear: clear, force: forceRender});\n\n /**\n * Fired when we have just rendered a frame for a Scene.\n *\n * @event rendering\n * @param {String} sceneID The ID of this Scene.\n * @param {Number} pass Index of the pass we rendered (see {@link Scene#passes}).\n */\n this.fire(\"rendered\", renderEvent, true);\n }\n\n this._saveAmbientColor();\n }\n\n\n /**\n * @private\n */\n compile() {\n if (this._needRecompile) {\n this._recompile();\n this._renderer.imageDirty();\n this._needRecompile = false;\n }\n }\n\n _recompile() {\n for (const id in this._compilables) {\n if (this._compilables.hasOwnProperty(id)) {\n this._compilables[id].compile();\n }\n }\n this._renderer.shadowsDirty();\n this.fire(\"compile\", this, true);\n }\n\n _saveAmbientColor() {\n const canvas = this.canvas;\n if (!canvas.transparent && !canvas.backgroundImage && !canvas.backgroundColor) {\n const ambientColorIntensity = this._lightsState.getAmbientColorAndIntensity();\n if (!this._lastAmbientColor ||\n this._lastAmbientColor[0] !== ambientColorIntensity[0] ||\n this._lastAmbientColor[1] !== ambientColorIntensity[1] ||\n this._lastAmbientColor[2] !== ambientColorIntensity[2] ||\n this._lastAmbientColor[3] !== ambientColorIntensity[3]) {\n canvas.backgroundColor = ambientColorIntensity;\n if (!this._lastAmbientColor) {\n this._lastAmbientColor = math.vec4([0, 0, 0, 1]);\n }\n this._lastAmbientColor.set(ambientColorIntensity);\n }\n } else {\n this._lastAmbientColor = null;\n }\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#models}.\n *\n * @type {String[]}\n */\n get modelIds() {\n if (!this._modelIds) {\n this._modelIds = Object.keys(this.models);\n }\n return this._modelIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#objects}.\n *\n * @type {Number}\n */\n get numObjects() {\n return this._numObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#objects}.\n *\n * @type {String[]}\n */\n get objectIds() {\n if (!this._objectIds) {\n this._objectIds = Object.keys(this.objects);\n }\n return this._objectIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#visibleObjects}.\n *\n * @type {Number}\n */\n get numVisibleObjects() {\n return this._numVisibleObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#visibleObjects}.\n *\n * @type {String[]}\n */\n get visibleObjectIds() {\n if (!this._visibleObjectIds) {\n this._visibleObjectIds = Object.keys(this.visibleObjects);\n }\n return this._visibleObjectIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#xrayedObjects}.\n *\n * @type {Number}\n */\n get numXRayedObjects() {\n return this._numXRayedObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#xrayedObjects}.\n *\n * @type {String[]}\n */\n get xrayedObjectIds() {\n if (!this._xrayedObjectIds) {\n this._xrayedObjectIds = Object.keys(this.xrayedObjects);\n }\n return this._xrayedObjectIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#highlightedObjects}.\n *\n * @type {Number}\n */\n get numHighlightedObjects() {\n return this._numHighlightedObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#highlightedObjects}.\n *\n * @type {String[]}\n */\n get highlightedObjectIds() {\n if (!this._highlightedObjectIds) {\n this._highlightedObjectIds = Object.keys(this.highlightedObjects);\n }\n return this._highlightedObjectIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#selectedObjects}.\n *\n * @type {Number}\n */\n get numSelectedObjects() {\n return this._numSelectedObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#selectedObjects}.\n *\n * @type {String[]}\n */\n get selectedObjectIds() {\n if (!this._selectedObjectIds) {\n this._selectedObjectIds = Object.keys(this.selectedObjects);\n }\n return this._selectedObjectIds;\n }\n\n /**\n * Gets the number of {@link Entity}s in {@link Scene#colorizedObjects}.\n *\n * @type {Number}\n */\n get numColorizedObjects() {\n return this._numColorizedObjects;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#colorizedObjects}.\n *\n * @type {String[]}\n */\n get colorizedObjectIds() {\n if (!this._colorizedObjectIds) {\n this._colorizedObjectIds = Object.keys(this.colorizedObjects);\n }\n return this._colorizedObjectIds;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#opacityObjects}.\n *\n * @type {String[]}\n */\n get opacityObjectIds() {\n if (!this._opacityObjectIds) {\n this._opacityObjectIds = Object.keys(this.opacityObjects);\n }\n return this._opacityObjectIds;\n }\n\n /**\n * Gets the IDs of the {@link Entity}s in {@link Scene#offsetObjects}.\n *\n * @type {String[]}\n */\n get offsetObjectIds() {\n if (!this._offsetObjectIds) {\n this._offsetObjectIds = Object.keys(this.offsetObjects);\n }\n return this._offsetObjectIds;\n }\n\n /**\n * Sets the number of \"ticks\" that happen between each render or this Scene.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n set ticksPerRender(value) {\n if (value === undefined || value === null) {\n value = 1;\n } else if (!utils.isNumeric(value) || value <= 0) {\n this.error(\"Unsupported value for 'ticksPerRender': '\" + value +\n \"' - should be an integer greater than zero.\");\n value = 1;\n }\n if (value === this._ticksPerRender) {\n return;\n }\n this._ticksPerRender = value;\n }\n\n /**\n * Gets the number of \"ticks\" that happen between each render or this Scene.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get ticksPerRender() {\n return this._ticksPerRender;\n }\n\n /**\n * Sets the number of \"ticks\" that happen between occlusion testing for {@link Marker}s.\n *\n * Default value is ````20````.\n *\n * @type {Number}\n */\n set ticksPerOcclusionTest(value) {\n if (value === undefined || value === null) {\n value = 20;\n } else if (!utils.isNumeric(value) || value <= 0) {\n this.error(\"Unsupported value for 'ticksPerOcclusionTest': '\" + value +\n \"' - should be an integer greater than zero.\");\n value = 20;\n }\n if (value === this._ticksPerOcclusionTest) {\n return;\n }\n this._ticksPerOcclusionTest = value;\n }\n\n /**\n * Gets the number of \"ticks\" that happen between each render of this Scene.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get ticksPerOcclusionTest() {\n return this._ticksPerOcclusionTest;\n }\n\n /**\n * Sets the number of times this Scene renders per frame.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n set passes(value) {\n if (value === undefined || value === null) {\n value = 1;\n } else if (!utils.isNumeric(value) || value <= 0) {\n this.error(\"Unsupported value for 'passes': '\" + value +\n \"' - should be an integer greater than zero.\");\n value = 1;\n }\n if (value === this._passes) {\n return;\n }\n this._passes = value;\n this.glRedraw();\n }\n\n /**\n * Gets the number of times this Scene renders per frame.\n *\n * Default value is ````1````.\n *\n * @type {Number}\n */\n get passes() {\n return this._passes;\n }\n\n /**\n * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set clearEachPass(value) {\n value = !!value;\n if (value === this._clearEachPass) {\n return;\n }\n this._clearEachPass = value;\n this.glRedraw();\n }\n\n /**\n * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get clearEachPass() {\n return this._clearEachPass;\n }\n\n /**\n * Sets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set gammaInput(value) {\n value = value !== false;\n if (value === this._renderer.gammaInput) {\n return;\n }\n this._renderer.gammaInput = value;\n this._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n get gammaInput() {\n return this._renderer.gammaInput;\n }\n\n /**\n * Sets whether or not to render pixels with pre-multiplied gama.\n *\n * Default value is ````false````.\n *\n * @type {Boolean}\n */\n set gammaOutput(value) {\n value = !!value;\n if (value === this._renderer.gammaOutput) {\n return;\n }\n this._renderer.gammaOutput = value;\n this._needRecompile = true;\n this.glRedraw();\n }\n\n /**\n * Gets whether or not to render pixels with pre-multiplied gama.\n *\n * Default value is ````true````.\n *\n * @type {Boolean}\n */\n get gammaOutput() {\n return this._renderer.gammaOutput;\n }\n\n /**\n * Sets the gamma factor to use when {@link Scene#gammaOutput} is set true.\n *\n * Default value is ````2.2````.\n *\n * @type {Number}\n */\n set gammaFactor(value) {\n value = (value === undefined || value === null) ? 2.2 : value;\n if (value === this._renderer.gammaFactor) {\n return;\n }\n this._renderer.gammaFactor = value;\n this.glRedraw();\n }\n\n /**\n * Gets the gamma factor to use when {@link Scene#gammaOutput} is set true.\n *\n * Default value is ````2.2````.\n *\n * @type {Number}\n */\n get gammaFactor() {\n return this._renderer.gammaFactor;\n }\n\n /**\n * Gets the default {@link Geometry} for this Scene, which is a {@link ReadableGeometry} with a unit-sized box shape.\n *\n * Has {@link ReadableGeometry#id} set to \"default.geometry\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#geometry} set to this {@link ReadableGeometry} by default.\n *\n * @type {ReadableGeometry}\n */\n get geometry() {\n return this.components[\"default.geometry\"] || buildBoxGeometry(ReadableGeometry, this, {\n id: \"default.geometry\",\n dontClear: true\n });\n }\n\n /**\n * Gets the default {@link Material} for this Scene, which is a {@link PhongMaterial}.\n *\n * Has {@link PhongMaterial#id} set to \"default.material\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#material} set to this {@link PhongMaterial} by default.\n *\n * @type {PhongMaterial}\n */\n get material() {\n return this.components[\"default.material\"] || new PhongMaterial(this, {\n id: \"default.material\",\n emissive: [0.4, 0.4, 0.4], // Visible by default on geometry without normals\n dontClear: true\n });\n }\n\n /**\n * Gets the default xraying {@link EmphasisMaterial} for this Scene.\n *\n * Has {@link EmphasisMaterial#id} set to \"default.xrayMaterial\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#xrayMaterial} set to this {@link EmphasisMaterial} by default.\n *\n * {@link Mesh}s are xrayed while {@link Mesh#xrayed} is ````true````.\n *\n * @type {EmphasisMaterial}\n */\n get xrayMaterial() {\n return this.components[\"default.xrayMaterial\"] || new EmphasisMaterial(this, {\n id: \"default.xrayMaterial\",\n preset: \"sepia\",\n dontClear: true\n });\n }\n\n /**\n * Gets the default highlight {@link EmphasisMaterial} for this Scene.\n *\n * Has {@link EmphasisMaterial#id} set to \"default.highlightMaterial\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.\n *\n * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.\n *\n * @type {EmphasisMaterial}\n */\n get highlightMaterial() {\n return this.components[\"default.highlightMaterial\"] || new EmphasisMaterial(this, {\n id: \"default.highlightMaterial\",\n preset: \"yellowHighlight\",\n dontClear: true\n });\n }\n\n /**\n * Gets the default selection {@link EmphasisMaterial} for this Scene.\n *\n * Has {@link EmphasisMaterial#id} set to \"default.selectedMaterial\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.\n *\n * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.\n *\n * @type {EmphasisMaterial}\n */\n get selectedMaterial() {\n return this.components[\"default.selectedMaterial\"] || new EmphasisMaterial(this, {\n id: \"default.selectedMaterial\",\n preset: \"greenSelected\",\n dontClear: true\n });\n }\n\n /**\n * Gets the default {@link EdgeMaterial} for this Scene.\n *\n * Has {@link EdgeMaterial#id} set to \"default.edgeMaterial\".\n *\n * {@link Mesh}s in this Scene have {@link Mesh#edgeMaterial} set to this {@link EdgeMaterial} by default.\n *\n * {@link Mesh}s have their edges emphasized while {@link Mesh#edges} is ````true````.\n *\n * @type {EdgeMaterial}\n */\n get edgeMaterial() {\n return this.components[\"default.edgeMaterial\"] || new EdgeMaterial(this, {\n id: \"default.edgeMaterial\",\n preset: \"default\",\n edgeColor: [0.0, 0.0, 0.0],\n edgeAlpha: 1.0,\n edgeWidth: 1,\n dontClear: true\n });\n }\n\n /**\n * Gets the {@link PointsMaterial} for this Scene.\n *\n * @type {PointsMaterial}\n */\n get pointsMaterial() {\n return this.components[\"default.pointsMaterial\"] || new PointsMaterial(this, {\n id: \"default.pointsMaterial\",\n preset: \"default\",\n dontClear: true\n });\n }\n\n /**\n * Gets the {@link LinesMaterial} for this Scene.\n *\n * @type {LinesMaterial}\n */\n get linesMaterial() {\n return this.components[\"default.linesMaterial\"] || new LinesMaterial(this, {\n id: \"default.linesMaterial\",\n preset: \"default\",\n dontClear: true\n });\n }\n\n /**\n * Gets the {@link Viewport} for this Scene.\n *\n * @type Viewport\n */\n get viewport() {\n return this._viewport;\n }\n\n /**\n * Gets the {@link Camera} for this Scene.\n *\n * @type {Camera}\n */\n get camera() {\n return this._camera;\n }\n\n /**\n * Gets the World-space 3D center of this Scene.\n *\n *@type {Number[]}\n */\n get center() {\n if (this._aabbDirty || !this._center) {\n if (!this._center || !this._center) {\n this._center = math.vec3();\n }\n const aabb = this.aabb;\n this._center[0] = (aabb[0] + aabb[3]) / 2;\n this._center[1] = (aabb[1] + aabb[4]) / 2;\n this._center[2] = (aabb[2] + aabb[5]) / 2;\n }\n return this._center;\n }\n\n /**\n * Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.\n *\n * The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.\n *\n * When the Scene has no content, will be ````[-100,-100,-100,100,100,100]````.\n *\n * @type {Number[]}\n */\n get aabb() {\n if (this._aabbDirty) {\n if (!this._aabb) {\n this._aabb = math.AABB3();\n }\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let zmin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n let zmax = math.MIN_DOUBLE;\n let aabb;\n const collidables = this._collidables;\n let collidable;\n let valid = false;\n for (const collidableId in collidables) {\n if (collidables.hasOwnProperty(collidableId)) {\n collidable = collidables[collidableId];\n if (collidable.collidable === false) {\n continue;\n }\n aabb = collidable.aabb;\n if (aabb[0] < xmin) {\n xmin = aabb[0];\n }\n if (aabb[1] < ymin) {\n ymin = aabb[1];\n }\n if (aabb[2] < zmin) {\n zmin = aabb[2];\n }\n if (aabb[3] > xmax) {\n xmax = aabb[3];\n }\n if (aabb[4] > ymax) {\n ymax = aabb[4];\n }\n if (aabb[5] > zmax) {\n zmax = aabb[5];\n }\n valid = true;\n }\n }\n if (!valid) {\n xmin = -100;\n ymin = -100;\n zmin = -100;\n xmax = 100;\n ymax = 100;\n zmax = 100;\n }\n this._aabb[0] = xmin;\n this._aabb[1] = ymin;\n this._aabb[2] = zmin;\n this._aabb[3] = xmax;\n this._aabb[4] = ymax;\n this._aabb[5] = zmax;\n this._aabbDirty = false;\n }\n return this._aabb;\n }\n\n _setAABBDirty() {\n //if (!this._aabbDirty) {\n this._aabbDirty = true;\n this.fire(\"boundary\");\n // }\n }\n\n /**\n * Attempts to pick an {@link Entity} in this Scene.\n *\n * Ignores {@link Entity}s with {@link Entity#pickable} set ````false````.\n *\n * When an {@link Entity} is picked, fires a \"pick\" event on the {@link Entity} with the pick result as parameters.\n *\n * Picking the {@link Entity} at the given canvas coordinates:\n\n * ````javascript\n * var pickResult = scene.pick({\n * canvasPos: [23, 131]\n * });\n *\n * if (pickResult) { // Picked an Entity\n * var entity = pickResult.entity;\n * }\n * ````\n *\n * Picking, with a ray cast through the canvas, hits an {@link Entity}:\n *\n * ````javascript\n * var pickResult = scene.pick({\n * pickSurface: true,\n * canvasPos: [23, 131]\n * });\n *\n * if (pickResult) { // Picked an Entity\n *\n * var entity = pickResult.entity;\n *\n * if (pickResult.primitive === \"triangle\") {\n *\n * // Picked a triangle on the entity surface\n *\n * var primIndex = pickResult.primIndex; // Position of triangle's first index in the picked Entity's Geometry's indices array\n * var indices = pickResult.indices; // UInt32Array containing the triangle's vertex indices\n * var localPos = pickResult.localPos; // Float64Array containing the picked Local-space position on the triangle\n * var worldPos = pickResult.worldPos; // Float64Array containing the picked World-space position on the triangle\n * var viewPos = pickResult.viewPos; // Float64Array containing the picked View-space position on the triangle\n * var bary = pickResult.bary; // Float64Array containing the picked barycentric position within the triangle\n * var worldNormal = pickResult.worldNormal; // Float64Array containing the interpolated World-space normal vector at the picked position on the triangle\n * var uv = pickResult.uv; // Float64Array containing the interpolated UV coordinates at the picked position on the triangle\n *\n * } else if (pickResult.worldPos && pickResult.worldNormal) {\n *\n * // Picked a point and normal on the entity surface\n *\n * var worldPos = pickResult.worldPos; // Float64Array containing the picked World-space position on the Entity surface\n * var worldNormal = pickResult.worldNormal; // Float64Array containing the picked World-space normal vector on the Entity Surface\n * }\n * }\n * ````\n *\n * Picking the {@link Entity} that intersects an arbitrarily-aligned World-space ray:\n *\n * ````javascript\n * var pickResult = scene.pick({\n * pickSurface: true, // Picking with arbitrarily-positioned ray\n * origin: [0,0,-5], // Ray origin\n * direction: [0,0,1] // Ray direction\n * });\n *\n * if (pickResult) { // Picked an Entity with the ray\n *\n * var entity = pickResult.entity;\n *\n * if (pickResult.primitive == \"triangle\") {\n *\n * // Picked a triangle on the entity surface\n *\n * var primitive = pickResult.primitive; // Type of primitive that was picked, usually \"triangles\"\n * var primIndex = pickResult.primIndex; // Position of triangle's first index in the picked Entity's Geometry's indices array\n * var indices = pickResult.indices; // UInt32Array containing the triangle's vertex indices\n * var localPos = pickResult.localPos; // Float64Array containing the picked Local-space position on the triangle\n * var worldPos = pickResult.worldPos; // Float64Array containing the picked World-space position on the triangle\n * var viewPos = pickResult.viewPos; // Float64Array containing the picked View-space position on the triangle\n * var bary = pickResult.bary; // Float64Array containing the picked barycentric position within the triangle\n * var worldNormal = pickResult.worldNormal; // Float64Array containing the interpolated World-space normal vector at the picked position on the triangle\n * var uv = pickResult.uv; // Float64Array containing the interpolated UV coordinates at the picked position on the triangle\n * var origin = pickResult.origin; // Float64Array containing the World-space ray origin\n * var direction = pickResult.direction; // Float64Array containing the World-space ray direction\n *\n * } else if (pickResult.worldPos && pickResult.worldNormal) {\n *\n * // Picked a point and normal on the entity surface\n *\n * var worldPos = pickResult.worldPos; // Float64Array containing the picked World-space position on the Entity surface\n * var worldNormal = pickResult.worldNormal; // Float64Array containing the picked World-space normal vector on the Entity Surface\n * }\n * }\n * ````\n *\n * @param {*} params Picking parameters.\n * @param {Boolean} [params.pickSurface=false] Whether to find the picked position on the surface of the Entity.\n * @param {Boolean} [params.pickSurfacePrecision=false] When picking an Entity surface position, indicates whether or not we want full-precision {@link PickResult#worldPos}. Only works when {@link Scene#pickSurfacePrecisionEnabled} is ````true````. If pick succeeds, the returned {@link PickResult} will have {@link PickResult#precision} set ````true````, to indicate that it contains full-precision surface pick results.\n * @param {Boolean} [params.pickSurfaceNormal=false] Whether to find the picked normal on the surface of the Entity. Only works if ````pickSurface```` is given.\n * @param {Number[]} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the **origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position, directly along the negative View-space Z-axis.\n * @param {Number[]} [params.origin] World-space ray origin when ray-picking. Ignored when canvasPos given.\n * @param {Number[]} [params.direction] World-space ray direction when ray-picking. Also indicates the length of the ray. Ignored when canvasPos given.\n * @param {Number[]} [params.matrix] 4x4 transformation matrix to define the World-space ray origin and direction, as an alternative to ````origin```` and ````direction````.\n * @param {String[]} [params.includeEntities] IDs of {@link Entity}s to restrict picking to. When given, ignores {@link Entity}s whose IDs are not in this list.\n * @param {String[]} [params.excludeEntities] IDs of {@link Entity}s to ignore. When given, will pick *through* these {@link Entity}s, as if they were not there.\n * @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels\n * @param {boolean} [params.snapToVertex=true] Whether to snap to vertex.\n * @param {boolean} [params.snapToEdge=true] Whether to snap to edge.\n * @param {PickResult} [pickResult] Holds the results of the pick attempt. Will use the Scene's singleton PickResult if you don't supply your own.\n * @returns {PickResult} Holds results of the pick attempt, returned when an {@link Entity} is picked, else null. See method comments for description.\n */\n pick(params, pickResult) {\n\n if (this.canvas.boundary[2] === 0 || this.canvas.boundary[3] === 0) {\n this.error(\"Picking not allowed while canvas has zero width or height\");\n return null;\n }\n\n params = params || {};\n\n params.pickSurface = params.pickSurface || params.rayPick; // Backwards compatibility\n\n if (!params.canvasPos && !params.matrix && (!params.origin || !params.direction)) {\n this.warn(\"picking without canvasPos, matrix, or ray origin and direction\");\n }\n\n const includeEntities = params.includeEntities || params.include; // Backwards compat\n if (includeEntities) {\n params.includeEntityIds = getEntityIDMap(this, includeEntities);\n }\n\n const excludeEntities = params.excludeEntities || params.exclude; // Backwards compat\n if (excludeEntities) {\n params.excludeEntityIds = getEntityIDMap(this, excludeEntities);\n }\n\n if (this._needRecompile) {\n this._recompile();\n this._renderer.imageDirty();\n this._needRecompile = false;\n }\n\n if (params.snapToEdge || params.snapToVertex) {\n pickResult = this._renderer.snapPick(\n params.canvasPos,\n params.snapRadius || 30,\n params.snapToVertex,\n params.snapToEdge,\n pickResult\n );\n } else {\n pickResult = this._renderer.pick(params, pickResult);\n }\n\n if (pickResult) {\n if (pickResult.entity && pickResult.entity.fire) {\n pickResult.entity.fire(\"picked\", pickResult); // TODO: SceneModelEntity doesn't fire events\n }\n }\n\n return pickResult;\n }\n\n /**\n * @param {Object} params Picking parameters.\n * @param {Number[]} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the **origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position, directly along the negative View-space Z-axis.\n * @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels\n * @param {boolean} [params.snapToVertex=true] Whether to snap to vertex.\n * @param {boolean} [params.snapToEdge=true] Whether to snap to edge.\n * @deprecated\n */\n snapPick(params) {\n if (undefined === this._warnSnapPickDeprecated) {\n this._warnSnapPickDeprecated = true;\n this.warn(\"Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead\")\n }\n return this._renderer.snapPick(\n params.canvasPos,\n params.snapRadius || 30,\n params.snapToVertex,\n params.snapToEdge,\n );\n }\n\n /**\n * Destroys all non-default {@link Component}s in this Scene.\n */\n clear() {\n var component;\n for (const id in this.components) {\n if (this.components.hasOwnProperty(id)) {\n component = this.components[id];\n if (!component._dontClear) { // Don't destroy components like Camera, Input, Viewport etc.\n component.destroy();\n }\n }\n }\n }\n\n /**\n * Destroys all {@link Light}s in this Scene..\n */\n clearLights() {\n const ids = Object.keys(this.lights);\n for (let i = 0, len = ids.length; i < len; i++) {\n this.lights[ids[i]].destroy();\n }\n }\n\n /**\n * Destroys all {@link SectionPlane}s in this Scene.\n */\n clearSectionPlanes() {\n const ids = Object.keys(this.sectionPlanes);\n for (let i = 0, len = ids.length; i < len; i++) {\n this.sectionPlanes[ids[i]].destroy();\n }\n }\n\n /**\n * Destroys all {@link Line}s in this Scene.\n */\n clearBitmaps() {\n const ids = Object.keys(this.bitmaps);\n for (let i = 0, len = ids.length; i < len; i++) {\n this.bitmaps[ids[i]].destroy();\n }\n }\n\n\n /**\n * Destroys all {@link Line}s in this Scene.\n */\n clearLines() {\n const ids = Object.keys(this.lineSets);\n for (let i = 0, len = ids.length; i < len; i++) {\n this.lineSets[ids[i]].destroy();\n }\n }\n\n /**\n * Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} on which {@link Entity#isObject} is registered by {@link Entity#id} in {@link Scene#visibleObjects}.\n *\n * Each {@link Entity} is only included in the AABB when {@link Entity#collidable} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @returns {[Number, Number, Number, Number, Number, Number]} An axis-aligned World-space bounding box, given as elements ````[xmin, ymin, zmin, xmax, ymax, zmax]````.\n */\n getAABB(ids) {\n if (ids === undefined) {\n return this.aabb;\n }\n if (utils.isString(ids)) {\n const entity = this.objects[ids];\n if (entity && entity.aabb) { // A Component subclass with an AABB\n return entity.aabb;\n }\n ids = [ids]; // Must be an entity type\n }\n if (ids.length === 0) {\n return this.aabb;\n }\n let xmin = math.MAX_DOUBLE;\n let ymin = math.MAX_DOUBLE;\n let zmin = math.MAX_DOUBLE;\n let xmax = math.MIN_DOUBLE;\n let ymax = math.MIN_DOUBLE;\n let zmax = math.MIN_DOUBLE;\n let valid;\n this.withObjects(ids, entity => {\n if (entity.collidable) {\n const aabb = entity.aabb;\n if (aabb[0] < xmin) {\n xmin = aabb[0];\n }\n if (aabb[1] < ymin) {\n ymin = aabb[1];\n }\n if (aabb[2] < zmin) {\n zmin = aabb[2];\n }\n if (aabb[3] > xmax) {\n xmax = aabb[3];\n }\n if (aabb[4] > ymax) {\n ymax = aabb[4];\n }\n if (aabb[5] > zmax) {\n zmax = aabb[5];\n }\n valid = true;\n }\n }\n );\n if (valid) {\n const aabb2 = math.AABB3();\n aabb2[0] = xmin;\n aabb2[1] = ymin;\n aabb2[2] = zmin;\n aabb2[3] = xmax;\n aabb2[4] = ymax;\n aabb2[5] = zmax;\n return aabb2;\n } else {\n return this.aabb; // Scene AABB\n }\n }\n\n /**\n * Batch-updates {@link Entity#visible} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#visible} are ````true```` is\n * registered by {@link Entity#id} in {@link Scene#visibleObjects}.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} visible Whether or not to set visible.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsVisible(ids, visible) {\n return this.withObjects(ids, entity => {\n const changed = (entity.visible !== visible);\n entity.visible = visible;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#collidable} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} collidable Whether or not to set collidable.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsCollidable(ids, collidable) {\n return this.withObjects(ids, entity => {\n const changed = (entity.collidable !== collidable);\n entity.collidable = collidable;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#culled} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} culled Whether or not to cull.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsCulled(ids, culled) {\n return this.withObjects(ids, entity => {\n const changed = (entity.culled !== culled);\n entity.culled = culled;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#selected} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#selected} are ````true```` is\n * registered by {@link Entity#id} in {@link Scene#selectedObjects}.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} selected Whether or not to select.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsSelected(ids, selected) {\n return this.withObjects(ids, entity => {\n const changed = (entity.selected !== selected);\n entity.selected = selected;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#highlighted} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#highlighted} are ````true```` is\n * registered by {@link Entity#id} in {@link Scene#highlightedObjects}.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} highlighted Whether or not to highlight.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsHighlighted(ids, highlighted) {\n return this.withObjects(ids, entity => {\n const changed = (entity.highlighted !== highlighted);\n entity.highlighted = highlighted;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#xrayed} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} xrayed Whether or not to xray.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsXRayed(ids, xrayed) {\n return this.withObjects(ids, entity => {\n const changed = (entity.xrayed !== xrayed);\n entity.xrayed = xrayed;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#edges} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} edges Whether or not to show edges.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsEdges(ids, edges) {\n return this.withObjects(ids, entity => {\n const changed = (entity.edges !== edges);\n entity.edges = edges;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#colorize} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Number[]} [colorize=(1,1,1)] RGB colorize factors, multiplied by the rendered pixel colors.\n * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.\n */\n setObjectsColorized(ids, colorize) {\n return this.withObjects(ids, entity => {\n entity.colorize = colorize;\n });\n }\n\n /**\n * Batch-updates {@link Entity#opacity} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Number} [opacity=1.0] Opacity factor, multiplied by the rendered pixel alphas.\n * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.\n */\n setObjectsOpacity(ids, opacity) {\n return this.withObjects(ids, entity => {\n const changed = (entity.opacity !== opacity);\n entity.opacity = opacity;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#pickable} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Boolean} pickable Whether or not to set pickable.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n setObjectsPickable(ids, pickable) {\n return this.withObjects(ids, entity => {\n const changed = (entity.pickable !== pickable);\n entity.pickable = pickable;\n return changed;\n });\n }\n\n /**\n * Batch-updates {@link Entity#offset} on {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Number[]} [offset] 3D offset vector.\n */\n setObjectsOffset(ids, offset) {\n this.withObjects(ids, entity => {\n entity.offset = offset;\n });\n }\n\n /**\n * Iterates with a callback over {@link Entity}s that represent objects.\n *\n * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.\n *\n * @param {String[]} ids Array of {@link Entity#id} values.\n * @param {Function} callback Callback to execute on eacn {@link Entity}.\n * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.\n */\n withObjects(ids, callback) {\n if (utils.isString(ids)) {\n ids = [ids];\n }\n let changed = false;\n for (let i = 0, len = ids.length; i < len; i++) {\n const id = ids[i];\n let entity = this.objects[id];\n if (entity) {\n changed = callback(entity) || changed;\n } else {\n const modelIds = this.modelIds;\n for (let i = 0, len = modelIds.length; i < len; i++) {\n const modelId = modelIds[i];\n const globalObjectId = math.globalizeObjectId(modelId, id);\n entity = this.objects[globalObjectId];\n if (entity) {\n changed = callback(entity) || changed;\n }\n }\n }\n }\n return changed;\n }\n\n /**\n * This method will \"tickify\" the provided `cb` function.\n *\n * This means, the function will be wrapped so:\n *\n * - it runs time-aligned to scene ticks\n * - it runs maximum once per scene-tick\n *\n * @param {Function} cb The function to tickify\n * @returns {Function}\n */\n tickify(cb) {\n const cbString = cb.toString();\n\n /**\n * Check if the function is already tickified, and if so return the cached one.\n */\n if (cbString in this._tickifiedFunctions) {\n return this._tickifiedFunctions[cbString].wrapperFunc;\n }\n\n let alreadyRun = 0;\n let needToRun = 0;\n\n let lastArgs;\n\n /**\n * The provided `cb` function is replaced with a \"set-dirty\" function\n *\n * @type {Function}\n */\n const wrapperFunc = function (...args) {\n lastArgs = args;\n needToRun++;\n };\n\n /**\n * An each scene tick, if the \"dirty-flag\" is set, run the `cb` function.\n *\n * This will make it run time-aligned to the scene tick.\n */\n const tickSubId = this.on(\"tick\", () => {\n const tmp = needToRun;\n if (tmp > alreadyRun) {\n alreadyRun = tmp;\n cb(...lastArgs);\n }\n });\n\n /**\n * And, store the list of subscribers.\n */\n this._tickifiedFunctions[cbString] = {tickSubId, wrapperFunc};\n\n return wrapperFunc;\n }\n\n /**\n * Destroys this Scene.\n */\n destroy() {\n\n super.destroy();\n\n for (const id in this.components) {\n if (this.components.hasOwnProperty(id)) {\n this.components[id].destroy();\n }\n }\n\n this.canvas.gl = null;\n\n // Memory leak prevention\n this.components = null;\n this.models = null;\n this.objects = null;\n this.visibleObjects = null;\n this.xrayedObjects = null;\n this.highlightedObjects = null;\n this.selectedObjects = null;\n this.colorizedObjects = null;\n this.opacityObjects = null;\n this.sectionPlanes = null;\n this.lights = null;\n this.lightMaps = null;\n this.reflectionMaps = null;\n this._objectIds = null;\n this._visibleObjectIds = null;\n this._xrayedObjectIds = null;\n this._highlightedObjectIds = null;\n this._selectedObjectIds = null;\n this._colorizedObjectIds = null;\n this.types = null;\n this.components = null;\n this.canvas = null;\n this._renderer = null;\n this.input = null;\n this._viewport = null;\n this._camera = null;\n }\n}\n\nexport {Scene};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/scene/Scene.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/scene/Scene.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8022, + "__docId__": 8030, "kind": "variable", "name": "ASSERT_OBJECT_STATE_UPDATE", "memberof": "src/viewer/scene/scene/Scene.js", @@ -159096,7 +159312,7 @@ "ignore": true }, { - "__docId__": 8023, + "__docId__": 8031, "kind": "function", "name": "getEntityIDMap", "memberof": "src/viewer/scene/scene/Scene.js", @@ -159133,7 +159349,7 @@ "ignore": true }, { - "__docId__": 8024, + "__docId__": 8032, "kind": "class", "name": "Scene", "memberof": "src/viewer/scene/scene/Scene.js", @@ -159157,7 +159373,7 @@ ] }, { - "__docId__": 8025, + "__docId__": 8033, "kind": "get", "name": "type", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159176,7 +159392,7 @@ } }, { - "__docId__": 8026, + "__docId__": 8034, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159268,7 +159484,7 @@ "ignore": true }, { - "__docId__": 8027, + "__docId__": 8035, "kind": "member", "name": "_tickifiedFunctions", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159288,7 +159504,7 @@ "ignore": true }, { - "__docId__": 8028, + "__docId__": 8036, "kind": "member", "name": "_aabbDirty", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159306,7 +159522,7 @@ } }, { - "__docId__": 8029, + "__docId__": 8037, "kind": "member", "name": "viewer", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159325,7 +159541,7 @@ } }, { - "__docId__": 8030, + "__docId__": 8038, "kind": "member", "name": "occlusionTestCountdown", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159345,7 +159561,7 @@ "ignore": true }, { - "__docId__": 8031, + "__docId__": 8039, "kind": "member", "name": "loading", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159382,7 +159598,7 @@ } }, { - "__docId__": 8032, + "__docId__": 8040, "kind": "member", "name": "startTime", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159419,7 +159635,7 @@ } }, { - "__docId__": 8033, + "__docId__": 8041, "kind": "member", "name": "models", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159456,7 +159672,7 @@ } }, { - "__docId__": 8034, + "__docId__": 8042, "kind": "member", "name": "objects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159493,7 +159709,7 @@ } }, { - "__docId__": 8035, + "__docId__": 8043, "kind": "member", "name": "_numObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159511,7 +159727,7 @@ } }, { - "__docId__": 8036, + "__docId__": 8044, "kind": "member", "name": "visibleObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159548,7 +159764,7 @@ } }, { - "__docId__": 8037, + "__docId__": 8045, "kind": "member", "name": "_numVisibleObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159566,7 +159782,7 @@ } }, { - "__docId__": 8038, + "__docId__": 8046, "kind": "member", "name": "xrayedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159603,7 +159819,7 @@ } }, { - "__docId__": 8039, + "__docId__": 8047, "kind": "member", "name": "_numXRayedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159621,7 +159837,7 @@ } }, { - "__docId__": 8040, + "__docId__": 8048, "kind": "member", "name": "highlightedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159658,7 +159874,7 @@ } }, { - "__docId__": 8041, + "__docId__": 8049, "kind": "member", "name": "_numHighlightedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159676,7 +159892,7 @@ } }, { - "__docId__": 8042, + "__docId__": 8050, "kind": "member", "name": "selectedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159713,7 +159929,7 @@ } }, { - "__docId__": 8043, + "__docId__": 8051, "kind": "member", "name": "_numSelectedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159731,7 +159947,7 @@ } }, { - "__docId__": 8044, + "__docId__": 8052, "kind": "member", "name": "colorizedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159768,7 +159984,7 @@ } }, { - "__docId__": 8045, + "__docId__": 8053, "kind": "member", "name": "_numColorizedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159786,7 +160002,7 @@ } }, { - "__docId__": 8046, + "__docId__": 8054, "kind": "member", "name": "opacityObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159823,7 +160039,7 @@ } }, { - "__docId__": 8047, + "__docId__": 8055, "kind": "member", "name": "_numOpacityObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159841,7 +160057,7 @@ } }, { - "__docId__": 8048, + "__docId__": 8056, "kind": "member", "name": "offsetObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159878,7 +160094,7 @@ } }, { - "__docId__": 8049, + "__docId__": 8057, "kind": "member", "name": "_numOffsetObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159896,7 +160112,7 @@ } }, { - "__docId__": 8050, + "__docId__": 8058, "kind": "member", "name": "_modelIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159913,7 +160129,7 @@ } }, { - "__docId__": 8051, + "__docId__": 8059, "kind": "member", "name": "_objectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159931,7 +160147,7 @@ } }, { - "__docId__": 8052, + "__docId__": 8060, "kind": "member", "name": "_visibleObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159949,7 +160165,7 @@ } }, { - "__docId__": 8053, + "__docId__": 8061, "kind": "member", "name": "_xrayedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159967,7 +160183,7 @@ } }, { - "__docId__": 8054, + "__docId__": 8062, "kind": "member", "name": "_highlightedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -159985,7 +160201,7 @@ } }, { - "__docId__": 8055, + "__docId__": 8063, "kind": "member", "name": "_selectedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160003,7 +160219,7 @@ } }, { - "__docId__": 8056, + "__docId__": 8064, "kind": "member", "name": "_colorizedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160021,7 +160237,7 @@ } }, { - "__docId__": 8057, + "__docId__": 8065, "kind": "member", "name": "_opacityObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160039,7 +160255,7 @@ } }, { - "__docId__": 8058, + "__docId__": 8066, "kind": "member", "name": "_offsetObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160057,7 +160273,7 @@ } }, { - "__docId__": 8059, + "__docId__": 8067, "kind": "member", "name": "_collidables", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160075,7 +160291,7 @@ } }, { - "__docId__": 8060, + "__docId__": 8068, "kind": "member", "name": "_compilables", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160093,7 +160309,7 @@ } }, { - "__docId__": 8061, + "__docId__": 8069, "kind": "member", "name": "_needRecompile", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160111,7 +160327,7 @@ } }, { - "__docId__": 8062, + "__docId__": 8070, "kind": "member", "name": "types", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160130,7 +160346,7 @@ } }, { - "__docId__": 8063, + "__docId__": 8071, "kind": "member", "name": "components", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160146,7 +160362,7 @@ } }, { - "__docId__": 8064, + "__docId__": 8072, "kind": "member", "name": "sectionPlanes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160165,7 +160381,7 @@ } }, { - "__docId__": 8065, + "__docId__": 8073, "kind": "member", "name": "lights", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160184,7 +160400,7 @@ } }, { - "__docId__": 8066, + "__docId__": 8074, "kind": "member", "name": "lightMaps", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160203,7 +160419,7 @@ } }, { - "__docId__": 8067, + "__docId__": 8075, "kind": "member", "name": "reflectionMaps", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160222,7 +160438,7 @@ } }, { - "__docId__": 8068, + "__docId__": 8076, "kind": "member", "name": "bitmaps", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160241,7 +160457,7 @@ } }, { - "__docId__": 8069, + "__docId__": 8077, "kind": "member", "name": "lineSets", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160260,7 +160476,7 @@ } }, { - "__docId__": 8070, + "__docId__": 8078, "kind": "member", "name": "realWorldOffset", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160279,7 +160495,7 @@ } }, { - "__docId__": 8071, + "__docId__": 8079, "kind": "member", "name": "canvas", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160298,7 +160514,7 @@ } }, { - "__docId__": 8072, + "__docId__": 8080, "kind": "member", "name": "_renderer", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160316,7 +160532,7 @@ } }, { - "__docId__": 8073, + "__docId__": 8081, "kind": "member", "name": "_sectionPlanesState", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160334,7 +160550,7 @@ } }, { - "__docId__": 8075, + "__docId__": 8083, "kind": "member", "name": "clippingCaps", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160351,7 +160567,7 @@ } }, { - "__docId__": 8076, + "__docId__": 8084, "kind": "member", "name": "_numCachedSectionPlanes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160369,7 +160585,7 @@ } }, { - "__docId__": 8078, + "__docId__": 8086, "kind": "member", "name": "_lightsState", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160387,7 +160603,7 @@ } }, { - "__docId__": 8082, + "__docId__": 8090, "kind": "member", "name": "input", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160424,7 +160640,7 @@ } }, { - "__docId__": 8083, + "__docId__": 8091, "kind": "member", "name": "metrics", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160461,7 +160677,7 @@ } }, { - "__docId__": 8084, + "__docId__": 8092, "kind": "member", "name": "sao", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160486,7 +160702,7 @@ } }, { - "__docId__": 8085, + "__docId__": 8093, "kind": "member", "name": "crossSections", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160511,7 +160727,7 @@ } }, { - "__docId__": 8093, + "__docId__": 8101, "kind": "member", "name": "_entityOffsetsEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160529,7 +160745,7 @@ } }, { - "__docId__": 8094, + "__docId__": 8102, "kind": "member", "name": "_logarithmicDepthBufferEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160547,7 +160763,7 @@ } }, { - "__docId__": 8095, + "__docId__": 8103, "kind": "member", "name": "_dtxEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160565,7 +160781,7 @@ } }, { - "__docId__": 8096, + "__docId__": 8104, "kind": "member", "name": "_pbrEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160583,7 +160799,7 @@ } }, { - "__docId__": 8097, + "__docId__": 8105, "kind": "member", "name": "_colorTextureEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160601,7 +160817,7 @@ } }, { - "__docId__": 8099, + "__docId__": 8107, "kind": "member", "name": "_viewport", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160619,7 +160835,7 @@ } }, { - "__docId__": 8100, + "__docId__": 8108, "kind": "member", "name": "_camera", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160637,7 +160853,7 @@ } }, { - "__docId__": 8101, + "__docId__": 8109, "kind": "method", "name": "_initDefaults", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160654,7 +160870,7 @@ "return": null }, { - "__docId__": 8102, + "__docId__": 8110, "kind": "method", "name": "_addComponent", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160678,7 +160894,7 @@ "return": null }, { - "__docId__": 8103, + "__docId__": 8111, "kind": "method", "name": "_removeComponent", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160702,7 +160918,7 @@ "return": null }, { - "__docId__": 8104, + "__docId__": 8112, "kind": "method", "name": "_sectionPlaneCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160726,7 +160942,7 @@ "return": null }, { - "__docId__": 8106, + "__docId__": 8114, "kind": "method", "name": "_bitmapCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160750,7 +160966,7 @@ "return": null }, { - "__docId__": 8107, + "__docId__": 8115, "kind": "method", "name": "_lineSetCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160774,7 +160990,7 @@ "return": null }, { - "__docId__": 8108, + "__docId__": 8116, "kind": "method", "name": "_lightCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160798,7 +161014,7 @@ "return": null }, { - "__docId__": 8110, + "__docId__": 8118, "kind": "method", "name": "_lightMapCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160822,7 +161038,7 @@ "return": null }, { - "__docId__": 8112, + "__docId__": 8120, "kind": "method", "name": "_reflectionMapCreated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160846,7 +161062,7 @@ "return": null }, { - "__docId__": 8114, + "__docId__": 8122, "kind": "method", "name": "_sectionPlaneDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160870,7 +161086,7 @@ "return": null }, { - "__docId__": 8116, + "__docId__": 8124, "kind": "method", "name": "_bitmapDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160894,7 +161110,7 @@ "return": null }, { - "__docId__": 8117, + "__docId__": 8125, "kind": "method", "name": "_lineSetDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160918,7 +161134,7 @@ "return": null }, { - "__docId__": 8118, + "__docId__": 8126, "kind": "method", "name": "_lightDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160942,7 +161158,7 @@ "return": null }, { - "__docId__": 8120, + "__docId__": 8128, "kind": "method", "name": "_lightMapDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160966,7 +161182,7 @@ "return": null }, { - "__docId__": 8122, + "__docId__": 8130, "kind": "method", "name": "_reflectionMapDestroyed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -160990,7 +161206,7 @@ "return": null }, { - "__docId__": 8124, + "__docId__": 8132, "kind": "method", "name": "_registerModel", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161014,7 +161230,7 @@ "return": null }, { - "__docId__": 8126, + "__docId__": 8134, "kind": "method", "name": "_deregisterModel", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161038,7 +161254,7 @@ "return": null }, { - "__docId__": 8128, + "__docId__": 8136, "kind": "method", "name": "_registerObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161062,7 +161278,7 @@ "return": null }, { - "__docId__": 8130, + "__docId__": 8138, "kind": "method", "name": "_deregisterObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161086,7 +161302,7 @@ "return": null }, { - "__docId__": 8132, + "__docId__": 8140, "kind": "method", "name": "_objectVisibilityUpdated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161119,7 +161335,7 @@ "return": null }, { - "__docId__": 8134, + "__docId__": 8142, "kind": "method", "name": "_deRegisterVisibleObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161143,7 +161359,7 @@ "return": null }, { - "__docId__": 8136, + "__docId__": 8144, "kind": "method", "name": "_objectXRayedUpdated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161175,114 +161391,114 @@ ], "return": null }, - { - "__docId__": 8138, - "kind": "method", - "name": "_deRegisterXRayedObject", - "memberof": "src/viewer/scene/scene/Scene.js~Scene", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/scene/Scene.js~Scene#_deRegisterXRayedObject", - "access": "private", - "description": null, - "lineNumber": 1132, - "undocument": true, - "ignore": true, - "params": [ - { - "name": "entity", - "types": [ - "*" - ] - } - ], - "return": null - }, - { - "__docId__": 8140, - "kind": "method", - "name": "_objectHighlightedUpdated", - "memberof": "src/viewer/scene/scene/Scene.js~Scene", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/scene/Scene.js~Scene#_objectHighlightedUpdated", - "access": "private", - "description": null, - "lineNumber": 1138, - "undocument": true, - "ignore": true, - "params": [ - { - "name": "entity", - "types": [ - "*" - ] - } - ], - "return": null - }, - { - "__docId__": 8142, - "kind": "method", - "name": "_deRegisterHighlightedObject", - "memberof": "src/viewer/scene/scene/Scene.js~Scene", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/scene/Scene.js~Scene#_deRegisterHighlightedObject", - "access": "private", - "description": null, - "lineNumber": 1157, - "undocument": true, - "ignore": true, - "params": [ - { - "name": "entity", - "types": [ - "*" - ] - } - ], - "return": null - }, - { - "__docId__": 8144, - "kind": "method", - "name": "_objectSelectedUpdated", - "memberof": "src/viewer/scene/scene/Scene.js~Scene", - "generator": false, - "async": false, - "static": false, - "longname": "src/viewer/scene/scene/Scene.js~Scene#_objectSelectedUpdated", - "access": "private", - "description": null, - "lineNumber": 1163, - "undocument": true, - "ignore": true, - "params": [ - { - "name": "entity", - "types": [ - "*" - ] - }, - { - "name": "notify", - "optional": true, - "types": [ - "boolean" - ], - "defaultRaw": true, - "defaultValue": "true" - } - ], - "return": null - }, { "__docId__": 8146, "kind": "method", + "name": "_deRegisterXRayedObject", + "memberof": "src/viewer/scene/scene/Scene.js~Scene", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/scene/Scene.js~Scene#_deRegisterXRayedObject", + "access": "private", + "description": null, + "lineNumber": 1132, + "undocument": true, + "ignore": true, + "params": [ + { + "name": "entity", + "types": [ + "*" + ] + } + ], + "return": null + }, + { + "__docId__": 8148, + "kind": "method", + "name": "_objectHighlightedUpdated", + "memberof": "src/viewer/scene/scene/Scene.js~Scene", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/scene/Scene.js~Scene#_objectHighlightedUpdated", + "access": "private", + "description": null, + "lineNumber": 1138, + "undocument": true, + "ignore": true, + "params": [ + { + "name": "entity", + "types": [ + "*" + ] + } + ], + "return": null + }, + { + "__docId__": 8150, + "kind": "method", + "name": "_deRegisterHighlightedObject", + "memberof": "src/viewer/scene/scene/Scene.js~Scene", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/scene/Scene.js~Scene#_deRegisterHighlightedObject", + "access": "private", + "description": null, + "lineNumber": 1157, + "undocument": true, + "ignore": true, + "params": [ + { + "name": "entity", + "types": [ + "*" + ] + } + ], + "return": null + }, + { + "__docId__": 8152, + "kind": "method", + "name": "_objectSelectedUpdated", + "memberof": "src/viewer/scene/scene/Scene.js~Scene", + "generator": false, + "async": false, + "static": false, + "longname": "src/viewer/scene/scene/Scene.js~Scene#_objectSelectedUpdated", + "access": "private", + "description": null, + "lineNumber": 1163, + "undocument": true, + "ignore": true, + "params": [ + { + "name": "entity", + "types": [ + "*" + ] + }, + { + "name": "notify", + "optional": true, + "types": [ + "boolean" + ], + "defaultRaw": true, + "defaultValue": "true" + } + ], + "return": null + }, + { + "__docId__": 8154, + "kind": "method", "name": "_deRegisterSelectedObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", "generator": false, @@ -161305,7 +161521,7 @@ "return": null }, { - "__docId__": 8148, + "__docId__": 8156, "kind": "method", "name": "_objectColorizeUpdated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161335,7 +161551,7 @@ "return": null }, { - "__docId__": 8150, + "__docId__": 8158, "kind": "method", "name": "_deRegisterColorizedObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161359,7 +161575,7 @@ "return": null }, { - "__docId__": 8152, + "__docId__": 8160, "kind": "method", "name": "_objectOpacityUpdated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161389,7 +161605,7 @@ "return": null }, { - "__docId__": 8154, + "__docId__": 8162, "kind": "method", "name": "_deRegisterOpacityObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161413,7 +161629,7 @@ "return": null }, { - "__docId__": 8156, + "__docId__": 8164, "kind": "method", "name": "_objectOffsetUpdated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161443,7 +161659,7 @@ "return": null }, { - "__docId__": 8158, + "__docId__": 8166, "kind": "method", "name": "_deRegisterOffsetObject", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161467,7 +161683,7 @@ "return": null }, { - "__docId__": 8160, + "__docId__": 8168, "kind": "method", "name": "_webglContextLost", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161484,7 +161700,7 @@ "return": null }, { - "__docId__": 8161, + "__docId__": 8169, "kind": "method", "name": "_webglContextRestored", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161501,7 +161717,7 @@ "return": null }, { - "__docId__": 8162, + "__docId__": 8170, "kind": "get", "name": "capabilities", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161534,7 +161750,7 @@ } }, { - "__docId__": 8163, + "__docId__": 8171, "kind": "get", "name": "entityOffsetsEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161566,7 +161782,7 @@ } }, { - "__docId__": 8164, + "__docId__": 8172, "kind": "get", "name": "pickSurfacePrecisionEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161598,7 +161814,7 @@ } }, { - "__docId__": 8165, + "__docId__": 8173, "kind": "get", "name": "logarithmicDepthBufferEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161630,7 +161846,7 @@ } }, { - "__docId__": 8166, + "__docId__": 8174, "kind": "set", "name": "numCachedSectionPlanes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161643,7 +161859,7 @@ "lineNumber": 1330 }, { - "__docId__": 8168, + "__docId__": 8176, "kind": "get", "name": "numCachedSectionPlanes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161675,7 +161891,7 @@ } }, { - "__docId__": 8169, + "__docId__": 8177, "kind": "set", "name": "pbrEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161688,7 +161904,7 @@ "lineNumber": 1361 }, { - "__docId__": 8171, + "__docId__": 8179, "kind": "get", "name": "pbrEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161720,7 +161936,7 @@ } }, { - "__docId__": 8172, + "__docId__": 8180, "kind": "set", "name": "dtxEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161741,7 +161957,7 @@ } }, { - "__docId__": 8174, + "__docId__": 8182, "kind": "get", "name": "dtxEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161762,7 +161978,7 @@ } }, { - "__docId__": 8175, + "__docId__": 8183, "kind": "set", "name": "colorTextureEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161789,7 +162005,7 @@ } }, { - "__docId__": 8177, + "__docId__": 8185, "kind": "get", "name": "colorTextureEnabled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161821,7 +162037,7 @@ } }, { - "__docId__": 8178, + "__docId__": 8186, "kind": "method", "name": "doOcclusionTest", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161836,7 +162052,7 @@ "return": null }, { - "__docId__": 8180, + "__docId__": 8188, "kind": "method", "name": "render", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161864,7 +162080,7 @@ "return": null }, { - "__docId__": 8182, + "__docId__": 8190, "kind": "method", "name": "compile", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161880,7 +162096,7 @@ "return": null }, { - "__docId__": 8184, + "__docId__": 8192, "kind": "method", "name": "_recompile", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161897,7 +162113,7 @@ "return": null }, { - "__docId__": 8185, + "__docId__": 8193, "kind": "method", "name": "_saveAmbientColor", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161914,7 +162130,7 @@ "return": null }, { - "__docId__": 8186, + "__docId__": 8194, "kind": "member", "name": "_lastAmbientColor", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161932,7 +162148,7 @@ } }, { - "__docId__": 8188, + "__docId__": 8196, "kind": "get", "name": "modelIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161953,7 +162169,7 @@ } }, { - "__docId__": 8190, + "__docId__": 8198, "kind": "get", "name": "numObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161974,7 +162190,7 @@ } }, { - "__docId__": 8191, + "__docId__": 8199, "kind": "get", "name": "objectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -161995,7 +162211,7 @@ } }, { - "__docId__": 8193, + "__docId__": 8201, "kind": "get", "name": "numVisibleObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162016,7 +162232,7 @@ } }, { - "__docId__": 8194, + "__docId__": 8202, "kind": "get", "name": "visibleObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162037,7 +162253,7 @@ } }, { - "__docId__": 8196, + "__docId__": 8204, "kind": "get", "name": "numXRayedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162058,7 +162274,7 @@ } }, { - "__docId__": 8197, + "__docId__": 8205, "kind": "get", "name": "xrayedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162079,7 +162295,7 @@ } }, { - "__docId__": 8199, + "__docId__": 8207, "kind": "get", "name": "numHighlightedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162100,7 +162316,7 @@ } }, { - "__docId__": 8200, + "__docId__": 8208, "kind": "get", "name": "highlightedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162121,7 +162337,7 @@ } }, { - "__docId__": 8202, + "__docId__": 8210, "kind": "get", "name": "numSelectedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162142,7 +162358,7 @@ } }, { - "__docId__": 8203, + "__docId__": 8211, "kind": "get", "name": "selectedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162163,7 +162379,7 @@ } }, { - "__docId__": 8205, + "__docId__": 8213, "kind": "get", "name": "numColorizedObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162184,7 +162400,7 @@ } }, { - "__docId__": 8206, + "__docId__": 8214, "kind": "get", "name": "colorizedObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162205,7 +162421,7 @@ } }, { - "__docId__": 8208, + "__docId__": 8216, "kind": "get", "name": "opacityObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162226,7 +162442,7 @@ } }, { - "__docId__": 8210, + "__docId__": 8218, "kind": "get", "name": "offsetObjectIds", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162247,7 +162463,7 @@ } }, { - "__docId__": 8212, + "__docId__": 8220, "kind": "set", "name": "ticksPerRender", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162268,7 +162484,7 @@ } }, { - "__docId__": 8213, + "__docId__": 8221, "kind": "member", "name": "_ticksPerRender", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162286,7 +162502,7 @@ } }, { - "__docId__": 8214, + "__docId__": 8222, "kind": "get", "name": "ticksPerRender", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162307,7 +162523,7 @@ } }, { - "__docId__": 8215, + "__docId__": 8223, "kind": "set", "name": "ticksPerOcclusionTest", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162328,7 +162544,7 @@ } }, { - "__docId__": 8216, + "__docId__": 8224, "kind": "member", "name": "_ticksPerOcclusionTest", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162346,7 +162562,7 @@ } }, { - "__docId__": 8217, + "__docId__": 8225, "kind": "get", "name": "ticksPerOcclusionTest", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162367,7 +162583,7 @@ } }, { - "__docId__": 8218, + "__docId__": 8226, "kind": "set", "name": "passes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162388,7 +162604,7 @@ } }, { - "__docId__": 8219, + "__docId__": 8227, "kind": "member", "name": "_passes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162406,7 +162622,7 @@ } }, { - "__docId__": 8220, + "__docId__": 8228, "kind": "get", "name": "passes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162427,7 +162643,7 @@ } }, { - "__docId__": 8221, + "__docId__": 8229, "kind": "set", "name": "clearEachPass", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162448,7 +162664,7 @@ } }, { - "__docId__": 8222, + "__docId__": 8230, "kind": "member", "name": "_clearEachPass", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162466,7 +162682,7 @@ } }, { - "__docId__": 8223, + "__docId__": 8231, "kind": "get", "name": "clearEachPass", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162487,7 +162703,7 @@ } }, { - "__docId__": 8224, + "__docId__": 8232, "kind": "set", "name": "gammaInput", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162508,7 +162724,7 @@ } }, { - "__docId__": 8226, + "__docId__": 8234, "kind": "get", "name": "gammaInput", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162529,7 +162745,7 @@ } }, { - "__docId__": 8227, + "__docId__": 8235, "kind": "set", "name": "gammaOutput", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162550,7 +162766,7 @@ } }, { - "__docId__": 8229, + "__docId__": 8237, "kind": "get", "name": "gammaOutput", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162571,7 +162787,7 @@ } }, { - "__docId__": 8230, + "__docId__": 8238, "kind": "set", "name": "gammaFactor", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162592,7 +162808,7 @@ } }, { - "__docId__": 8231, + "__docId__": 8239, "kind": "get", "name": "gammaFactor", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162613,7 +162829,7 @@ } }, { - "__docId__": 8232, + "__docId__": 8240, "kind": "get", "name": "geometry", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162634,7 +162850,7 @@ } }, { - "__docId__": 8233, + "__docId__": 8241, "kind": "get", "name": "material", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162655,7 +162871,7 @@ } }, { - "__docId__": 8234, + "__docId__": 8242, "kind": "get", "name": "xrayMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162676,7 +162892,7 @@ } }, { - "__docId__": 8235, + "__docId__": 8243, "kind": "get", "name": "highlightMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162697,7 +162913,7 @@ } }, { - "__docId__": 8236, + "__docId__": 8244, "kind": "get", "name": "selectedMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162718,7 +162934,7 @@ } }, { - "__docId__": 8237, + "__docId__": 8245, "kind": "get", "name": "edgeMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162739,7 +162955,7 @@ } }, { - "__docId__": 8238, + "__docId__": 8246, "kind": "get", "name": "pointsMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162760,7 +162976,7 @@ } }, { - "__docId__": 8239, + "__docId__": 8247, "kind": "get", "name": "linesMaterial", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162781,7 +162997,7 @@ } }, { - "__docId__": 8240, + "__docId__": 8248, "kind": "get", "name": "viewport", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162802,7 +163018,7 @@ } }, { - "__docId__": 8241, + "__docId__": 8249, "kind": "get", "name": "camera", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162823,7 +163039,7 @@ } }, { - "__docId__": 8242, + "__docId__": 8250, "kind": "get", "name": "center", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162844,7 +163060,7 @@ } }, { - "__docId__": 8243, + "__docId__": 8251, "kind": "member", "name": "_center", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162862,7 +163078,7 @@ } }, { - "__docId__": 8244, + "__docId__": 8252, "kind": "get", "name": "aabb", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162883,7 +163099,7 @@ } }, { - "__docId__": 8245, + "__docId__": 8253, "kind": "member", "name": "_aabb", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162901,7 +163117,7 @@ } }, { - "__docId__": 8247, + "__docId__": 8255, "kind": "method", "name": "_setAABBDirty", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -162918,7 +163134,7 @@ "return": null }, { - "__docId__": 8249, + "__docId__": 8257, "kind": "method", "name": "pick", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163099,7 +163315,7 @@ } }, { - "__docId__": 8251, + "__docId__": 8259, "kind": "method", "name": "snapPick", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163176,7 +163392,7 @@ } }, { - "__docId__": 8252, + "__docId__": 8260, "kind": "member", "name": "_warnSnapPickDeprecated", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163194,7 +163410,7 @@ } }, { - "__docId__": 8253, + "__docId__": 8261, "kind": "method", "name": "clear", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163209,7 +163425,7 @@ "return": null }, { - "__docId__": 8254, + "__docId__": 8262, "kind": "method", "name": "clearLights", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163224,7 +163440,7 @@ "return": null }, { - "__docId__": 8255, + "__docId__": 8263, "kind": "method", "name": "clearSectionPlanes", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163239,7 +163455,7 @@ "return": null }, { - "__docId__": 8256, + "__docId__": 8264, "kind": "method", "name": "clearBitmaps", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163254,7 +163470,7 @@ "return": null }, { - "__docId__": 8257, + "__docId__": 8265, "kind": "method", "name": "clearLines", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163269,7 +163485,7 @@ "return": null }, { - "__docId__": 8258, + "__docId__": 8266, "kind": "method", "name": "getAABB", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163308,7 +163524,7 @@ } }, { - "__docId__": 8259, + "__docId__": 8267, "kind": "method", "name": "setObjectsVisible", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163357,7 +163573,7 @@ } }, { - "__docId__": 8260, + "__docId__": 8268, "kind": "method", "name": "setObjectsCollidable", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163406,7 +163622,7 @@ } }, { - "__docId__": 8261, + "__docId__": 8269, "kind": "method", "name": "setObjectsCulled", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163455,7 +163671,7 @@ } }, { - "__docId__": 8262, + "__docId__": 8270, "kind": "method", "name": "setObjectsSelected", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163504,7 +163720,7 @@ } }, { - "__docId__": 8263, + "__docId__": 8271, "kind": "method", "name": "setObjectsHighlighted", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163553,7 +163769,7 @@ } }, { - "__docId__": 8264, + "__docId__": 8272, "kind": "method", "name": "setObjectsXRayed", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163602,7 +163818,7 @@ } }, { - "__docId__": 8265, + "__docId__": 8273, "kind": "method", "name": "setObjectsEdges", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163651,7 +163867,7 @@ } }, { - "__docId__": 8266, + "__docId__": 8274, "kind": "method", "name": "setObjectsColorized", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163702,7 +163918,7 @@ } }, { - "__docId__": 8267, + "__docId__": 8275, "kind": "method", "name": "setObjectsOpacity", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163753,7 +163969,7 @@ } }, { - "__docId__": 8268, + "__docId__": 8276, "kind": "method", "name": "setObjectsPickable", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163802,7 +164018,7 @@ } }, { - "__docId__": 8269, + "__docId__": 8277, "kind": "method", "name": "setObjectsOffset", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163838,7 +164054,7 @@ "return": null }, { - "__docId__": 8270, + "__docId__": 8278, "kind": "method", "name": "withObjects", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163887,7 +164103,7 @@ } }, { - "__docId__": 8271, + "__docId__": 8279, "kind": "method", "name": "tickify", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163926,7 +164142,7 @@ } }, { - "__docId__": 8272, + "__docId__": 8280, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/scene/Scene.js~Scene", @@ -163941,18 +164157,18 @@ "return": null }, { - "__docId__": 8299, + "__docId__": 8307, "kind": "file", "name": "src/viewer/scene/sectionPlane/SectionPlane.js", "content": "import {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\nimport {math} from \"../math/math.js\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @desc An arbitrarily-aligned World-space clipping plane.\n *\n * * Slices portions off objects to create cross-section views or reveal interiors.\n * * Registered by {@link SectionPlane#id} in {@link Scene#sectionPlanes}.\n * * Indicates World-space position in {@link SectionPlane#pos} and orientation in {@link SectionPlane#dir}.\n * * Discards elements from the half-space in the direction of {@link SectionPlane#dir}.\n * * Can be be enabled or disabled via {@link SectionPlane#active}.\n *\n * ## Usage\n *\n * In the example below, we'll create two SectionPlanes to slice a model loaded from glTF. Note that we could also create them\n * using a {@link SectionPlanesPlugin}.\n *\n * ````javascript\n * import {Viewer, GLTFLoaderPlugin, SectionPlane} from \"xeokit-sdk.es.js\";\n *\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\"\n * });\n *\n * const gltfLoaderPlugin = new GLTFModelsPlugin(viewer, {\n * id: \"GLTFModels\"\n * });\n *\n * const model = gltfLoaderPlugin.load({\n * id: \"myModel\",\n * src: \"./models/gltf/mygltfmodel.gltf\"\n * });\n *\n * // Create a SectionPlane on negative diagonal\n * const sectionPlane1 = new SectionPlane(viewer.scene, {\n * pos: [1.0, 1.0, 1.0],\n * dir: [-1.0, -1.0, -1.0],\n * active: true\n * }),\n *\n * // Create a SectionPlane on positive diagonal\n * const sectionPlane2 = new SectionPlane(viewer.scene, {\n * pos: [-1.0, -1.0, -1.0],\n * dir: [1.0, 1.0, 1.0],\n * active: true\n * });\n * ````\n */\nclass SectionPlane extends Component {\n\n /**\n @private\n */\n get type() {\n return \"SectionPlane\";\n }\n\n /**\n * @constructor\n * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this SectionPlane as well.\n * @param {*} [cfg] SectionPlane configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.\n * @param {Boolean} [cfg.active=true] Indicates whether or not this SectionPlane is active.\n * @param {Number[]} [cfg.pos=[0,0,0]] World-space position of the SectionPlane.\n * @param {Number[]} [cfg.dir=[0,0,-1]] Vector perpendicular to the plane surface, indicating the SectionPlane plane orientation.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n active: true,\n pos: math.vec3(),\n dir: math.vec3(),\n dist: 0\n });\n\n this.active = cfg.active;\n this.pos = cfg.pos;\n this.dir = cfg.dir;\n\n this.scene._sectionPlaneCreated(this);\n }\n\n /**\n * Sets if this SectionPlane is active or not.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} value Set ````true```` to activate else ````false```` to deactivate.\n */\n set active(value) {\n this._state.active = value !== false;\n this.glRedraw();\n this.fire(\"active\", this._state.active);\n }\n\n /**\n * Gets if this SectionPlane is active or not.\n *\n * Default value is ````true````.\n *\n * @returns {Boolean} Returns ````true```` if active.\n */\n get active() {\n return this._state.active;\n }\n\n /**\n * Sets the World-space position of this SectionPlane's plane.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @param {Number[]} value New position.\n */\n set pos(value) {\n this._state.pos.set(value || [0, 0, 0]);\n this._state.dist = (-math.dotVec3(this._state.pos, this._state.dir));\n this.fire(\"pos\", this._state.pos);\n this.scene.fire(\"sectionPlaneUpdated\", this);\n }\n\n /**\n * Gets the World-space position of this SectionPlane's plane.\n *\n * Default value is ````[0, 0, 0]````.\n *\n * @returns {Number[]} Current position.\n */\n get pos() {\n return this._state.pos;\n }\n\n /**\n * Sets the direction of this SectionPlane's plane.\n *\n * Default value is ````[0, 0, -1]````.\n *\n * @param {Number[]} value New direction.\n */\n set dir(value) {\n this._state.dir.set(value || [0, 0, -1]);\n this._state.dist = (-math.dotVec3(this._state.pos, this._state.dir));\n this.glRedraw();\n this.fire(\"dir\", this._state.dir);\n this.scene.fire(\"sectionPlaneUpdated\", this);\n }\n\n /**\n * Gets the direction of this SectionPlane's plane.\n *\n * Default value is ````[0, 0, -1]````.\n *\n * @returns {Number[]} value Current direction.\n */\n get dir() {\n return this._state.dir;\n }\n\n /**\n * Gets this SectionPlane's distance to the origin of the World-space coordinate system.\n *\n * This is the dot product of {@link SectionPlane#pos} and {@link SectionPlane#dir} and is automatically re-calculated\n * each time either of two properties are updated.\n *\n * @returns {Number}\n */\n get dist() {\n return this._state.dist;\n }\n\n /**\n * Inverts the direction of {@link SectionPlane#dir}.\n */\n flipDir() {\n const dir = this._state.dir;\n dir[0] *= -1.0;\n dir[1] *= -1.0;\n dir[2] *= -1.0;\n this._state.dist = (-math.dotVec3(this._state.pos, this._state.dir));\n this.fire(\"dir\", this._state.dir);\n this.glRedraw();\n }\n\n /**\n * @destroy\n */\n destroy() {\n this._state.destroy();\n this.scene._sectionPlaneDestroyed(this);\n super.destroy();\n }\n}\n\nexport {SectionPlane};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/sectionPlane/SectionPlane.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/sectionPlane/SectionPlane.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8300, + "__docId__": 8308, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js", @@ -163973,7 +164189,7 @@ "ignore": true }, { - "__docId__": 8301, + "__docId__": 8309, "kind": "class", "name": "SectionPlane", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js", @@ -163991,7 +164207,7 @@ ] }, { - "__docId__": 8302, + "__docId__": 8310, "kind": "get", "name": "type", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164010,7 +164226,7 @@ } }, { - "__docId__": 8303, + "__docId__": 8311, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164105,7 +164321,7 @@ ] }, { - "__docId__": 8304, + "__docId__": 8312, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164123,7 +164339,7 @@ } }, { - "__docId__": 8308, + "__docId__": 8316, "kind": "set", "name": "active", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164148,7 +164364,7 @@ ] }, { - "__docId__": 8309, + "__docId__": 8317, "kind": "get", "name": "active", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164180,7 +164396,7 @@ } }, { - "__docId__": 8310, + "__docId__": 8318, "kind": "set", "name": "pos", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164205,7 +164421,7 @@ ] }, { - "__docId__": 8311, + "__docId__": 8319, "kind": "get", "name": "pos", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164237,7 +164453,7 @@ } }, { - "__docId__": 8312, + "__docId__": 8320, "kind": "set", "name": "dir", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164262,7 +164478,7 @@ ] }, { - "__docId__": 8313, + "__docId__": 8321, "kind": "get", "name": "dir", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164294,7 +164510,7 @@ } }, { - "__docId__": 8314, + "__docId__": 8322, "kind": "get", "name": "dist", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164326,7 +164542,7 @@ } }, { - "__docId__": 8315, + "__docId__": 8323, "kind": "method", "name": "flipDir", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164341,7 +164557,7 @@ "return": null }, { - "__docId__": 8316, + "__docId__": 8324, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/sectionPlane/SectionPlane.js~SectionPlane", @@ -164362,18 +164578,18 @@ "return": null }, { - "__docId__": 8317, + "__docId__": 8325, "kind": "file", "name": "src/viewer/scene/sectionPlane/SectionPlaneCache.js", "content": "import {Component} from '../Component.js';\nimport {math} from \"../math/math.js\";\nimport {SectionPlane} from \"./SectionPlane\";\n\nconst tempVec3a = math.vec3();\n\n/**\n * @desc A set of arbitrarily-aligned World-space clipping planes.\n\n */\nexport class SectionPlaneCache extends Component {\n\n constructor(owner, cfg = {}) {\n super(owner, cfg);\n\n this._sectionPlanesMap = {};\n this._sectionPlanesState = {};\n\n if (cfg.size) {\n for (let i = 0, len = cfg.size; i < len; i++) {\n const sectionPlane = new SectionPlane(this.viewer.scene, {\n id: math.createUUID(),\n pos: [0, 0, 0],\n dir: [0, -1, 0],\n active: false\n });\n this._sectionPlanesMap[sectionPlane.id] = sectionPlane;\n this._sectionPlanesState[sectionPlane.id] = {\n sectionPlane: sectionPlane,\n used: false\n };\n }\n }\n }\n\n getSectionPlane(params = {}) {\n for (let id in this._sectionPlanesState) {\n const state = this._sectionPlanesState[id];\n if (!state.used) {\n state.used = true;\n const sectionPlane = state.sectionPlane;\n sectionPlane.active = true;\n sectionPlane.pos = params.pos;\n sectionPlane.dir = params.dir;\n return sectionPlane;\n }\n }\n const sectionPlane = new SectionPlane(this.viewer.scene, {\n id: params.id, // Optional\n pos: params.pos,\n dir: params.dir,\n active: true\n });\n this._sectionPlanesState[sectionPlane.id] = {\n sectionPlane: sectionPlane,\n used: true\n };\n return sectionPlane;\n }\n\n putSectionPlane(sectionPlane) {\n let state = this._sectionPlanesState[sectionPlane.id];\n sectionPlane.active = false;\n if (state) {\n state.used = false;\n return;\n }\n this._sectionPlanesState[sectionPlane.id] = {\n sectionPlane: sectionPlane,\n used: false\n };\n }\n\n putAllSectionPlanes() {\n for (let id in this._sectionPlanesState) {\n const state = this._sectionPlanesState[id];\n state.used = false;\n state.sectionPlane.active = false;\n }\n }\n\n getSectionPlanesInUse() {\n const sectionPlanes = [];\n for (let id in this._sectionPlanesState) {\n const state = this._sectionPlanesState[id];\n if (state.used) {\n sectionPlanes.push(state.sectionPlane);\n }\n }\n return sectionPlanes;\n }\n\n /**\n * @destroy\n */\n destroy() {\n this.scene._sectionPlaneDestroyed(this);\n super.destroy();\n }\n}\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/sectionPlane/SectionPlaneCache.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/sectionPlane/SectionPlaneCache.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8318, + "__docId__": 8326, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js", @@ -164394,7 +164610,7 @@ "ignore": true }, { - "__docId__": 8319, + "__docId__": 8327, "kind": "class", "name": "SectionPlaneCache", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js", @@ -164412,7 +164628,7 @@ ] }, { - "__docId__": 8320, + "__docId__": 8328, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164426,7 +164642,7 @@ "undocument": true }, { - "__docId__": 8321, + "__docId__": 8329, "kind": "member", "name": "_sectionPlanesMap", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164444,7 +164660,7 @@ } }, { - "__docId__": 8322, + "__docId__": 8330, "kind": "member", "name": "_sectionPlanesState", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164462,7 +164678,7 @@ } }, { - "__docId__": 8323, + "__docId__": 8331, "kind": "method", "name": "getSectionPlane", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164492,7 +164708,7 @@ } }, { - "__docId__": 8324, + "__docId__": 8332, "kind": "method", "name": "putSectionPlane", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164515,7 +164731,7 @@ "return": null }, { - "__docId__": 8325, + "__docId__": 8333, "kind": "method", "name": "putAllSectionPlanes", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164531,7 +164747,7 @@ "return": null }, { - "__docId__": 8326, + "__docId__": 8334, "kind": "method", "name": "getSectionPlanesInUse", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164551,7 +164767,7 @@ } }, { - "__docId__": 8327, + "__docId__": 8335, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/sectionPlane/SectionPlaneCache.js~SectionPlaneCache", @@ -164572,29 +164788,29 @@ "return": null }, { - "__docId__": 8328, + "__docId__": 8336, "kind": "file", "name": "src/viewer/scene/sectionPlane/index.js", "content": "export * from \"./SectionPlane.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/sectionPlane/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/sectionPlane/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8329, + "__docId__": 8337, "kind": "file", "name": "src/viewer/scene/skybox/Skybox.js", "content": "import {Component} from \"../Component.js\";\nimport {Mesh} from \"../mesh/Mesh.js\";\nimport {ReadableGeometry} from \"../geometry/ReadableGeometry.js\";\nimport {PhongMaterial} from \"../materials/PhongMaterial.js\";\nimport {Texture} from \"../materials/Texture.js\";\n\n/**\n * @desc A Skybox.\n */\nclass Skybox extends Component {\n\n /**\n * @constructor\n * @param {Component} owner Owner component. When destroyed, the owner will destroy this PointLight as well.\n * @param {*} [cfg] Skybox configuration\n * @param {String} [cfg.id] Optional ID, unique among all components in the parent {Scene}, generated automatically when omitted.\n * @param {String} [cfg.src=null] Path to skybox texture\n * @param {String} [cfg.encoding=\"linear\"] Texture encoding format. See the {@link Texture#encoding} property for more info.\n * @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.\n * @param {Boolean} [cfg.active=true] True when this Skybox is visible.\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._skyboxMesh = new Mesh(this, {\n\n geometry: new ReadableGeometry(this, { // Box-shaped geometry\n primitive: \"triangles\",\n positions: [\n 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // v0-v1-v2-v3 front\n 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // v0-v3-v4-v5 right\n 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // v0-v5-v6-v1 top\n -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // v1-v6-v7-v2 left\n -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, // v7-v4-v3-v2 bottom\n 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1 // v4-v7-v6-v5 back\n ],\n uv: [\n 0.5, 0.6666, 0.25, 0.6666, 0.25, 0.3333, 0.5, 0.3333, 0.5, 0.6666, 0.5, 0.3333, 0.75, 0.3333, 0.75, 0.6666,\n 0.5, 0.6666, 0.5, 1, 0.25, 1, 0.25, 0.6666, 0.25, 0.6666, 0.0, 0.6666, 0.0, 0.3333, 0.25, 0.3333,\n 0.25, 0, 0.50, 0, 0.50, 0.3333, 0.25, 0.3333, 0.75, 0.3333, 1.0, 0.3333, 1.0, 0.6666, 0.75, 0.6666\n ],\n indices: [\n 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11,\n 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23\n ]\n }),\n background: true,\n scale: [2000, 2000, 2000], // Overridden when we initialize the 'size' property, below\n rotation: [0, -90, 0],\n material: new PhongMaterial(this, {\n ambient: [0, 0, 0],\n diffuse: [0, 0, 0],\n specular: [0, 0, 0],\n emissive: [1, 1, 1],\n emissiveMap: new Texture(this, {\n src: cfg.src,\n flipY: true,\n wrapS: \"clampToEdge\",\n wrapT: \"clampToEdge\",\n encoding: cfg.encoding || \"sRGB\"\n }),\n backfaces: true // Show interior faces of our skybox geometry\n }),\n // stationary: true,\n visible: false,\n pickable: false,\n clippable: false,\n collidable: false\n });\n\n this.size = cfg.size; // Sets 'xyz' property on the Mesh's Scale transform\n this.active = cfg.active;\n }\n\n\n /**\n * Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.\n *\n * Default value is ````1000````.\n *\n * @param {Number} value The size.\n */\n set size(value) {\n this._size = value || 1000;\n this._skyboxMesh.scale = [this._size, this._size, this._size];\n }\n\n /**\n * Gets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.\n *\n * Default value is ````1000````.\n *\n * @returns {Number} The size.\n */\n get size() {\n return this._size;\n }\n\n /**\n * Sets whether this Skybox is visible or not.\n *\n * Default value is ````true````.\n *\n * @param {Boolean} active Whether to make active or not.\n */\n set active(active) {\n this._skyboxMesh.visible = active;\n }\n\n /**\n * Gets if this Skybox is visible or not.\n *\n * Default active is ````true````.\n *\n * @returns {Boolean} ````true```` if the Skybox is active.\n */\n get active() {\n return this._skyboxMesh.visible;\n }\n}\n\nexport {Skybox}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/skybox/Skybox.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/skybox/Skybox.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8330, + "__docId__": 8338, "kind": "class", "name": "Skybox", "memberof": "src/viewer/scene/skybox/Skybox.js", @@ -164612,7 +164828,7 @@ ] }, { - "__docId__": 8331, + "__docId__": 8339, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164711,7 +164927,7 @@ ] }, { - "__docId__": 8332, + "__docId__": 8340, "kind": "member", "name": "_skyboxMesh", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164729,7 +164945,7 @@ } }, { - "__docId__": 8335, + "__docId__": 8343, "kind": "set", "name": "size", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164754,7 +164970,7 @@ ] }, { - "__docId__": 8336, + "__docId__": 8344, "kind": "member", "name": "_size", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164772,7 +164988,7 @@ } }, { - "__docId__": 8337, + "__docId__": 8345, "kind": "get", "name": "size", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164804,7 +165020,7 @@ } }, { - "__docId__": 8338, + "__docId__": 8346, "kind": "set", "name": "active", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164829,7 +165045,7 @@ ] }, { - "__docId__": 8339, + "__docId__": 8347, "kind": "get", "name": "active", "memberof": "src/viewer/scene/skybox/Skybox.js~Skybox", @@ -164861,29 +165077,29 @@ } }, { - "__docId__": 8340, + "__docId__": 8348, "kind": "file", "name": "src/viewer/scene/skybox/index.js", "content": "export * from \"./Skybox.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/skybox/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/skybox/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8341, + "__docId__": 8349, "kind": "file", "name": "src/viewer/scene/stats.js", "content": "/**\n * xeokit runtime statistics.\n * @type {{components: {models: number, objects: number, scenes: number, meshes: number}, memory: {indices: number, uvs: number, textures: number, materials: number, transforms: number, positions: number, programs: number, normals: number, meshes: number, colors: number}, build: {version: string}, client: {browser: string}, frame: {frameCount: number, useProgram: number, bindTexture: number, drawElements: number, bindArray: number, tasksRun: number, fps: number, drawArrays: number, tasksScheduled: number}}}\n */\nconst stats = {\n build: {\n version: \"0.8\"\n },\n client: {\n browser: (navigator && navigator.userAgent) ? navigator.userAgent : \"n/a\"\n },\n\n components: {\n scenes: 0,\n models: 0,\n meshes: 0,\n objects: 0\n },\n memory: {\n meshes: 0,\n positions: 0,\n colors: 0,\n normals: 0,\n uvs: 0,\n indices: 0,\n textures: 0,\n transforms: 0,\n materials: 0,\n programs: 0\n },\n frame: {\n frameCount: 0,\n fps: 0,\n useProgram: 0,\n bindTexture: 0,\n bindArray: 0,\n drawElements: 0,\n drawArrays: 0,\n tasksRun: 0,\n tasksScheduled: 0\n }\n};\n\nexport {stats};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/stats.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/stats.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8342, + "__docId__": 8350, "kind": "variable", "name": "stats", "memberof": "src/viewer/scene/stats.js", @@ -164905,18 +165121,18 @@ } }, { - "__docId__": 8343, + "__docId__": 8351, "kind": "file", "name": "src/viewer/scene/utils/Cache.js", "content": "const Cache = {\n\n enabled: false,\n files: {},\n\n add: function (key, file) {\n if (this.enabled === false) {\n return;\n }\n this.files[key] = file;\n },\n\n get: function (key) {\n if (this.enabled === false) {\n return;\n }\n return this.files[key];\n },\n\n remove: function (key) {\n delete this.files[key];\n },\n\n clear: function () {\n this.files = {};\n }\n};\n\nexport {Cache};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/Cache.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/Cache.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8344, + "__docId__": 8352, "kind": "variable", "name": "Cache", "memberof": "src/viewer/scene/utils/Cache.js", @@ -164936,18 +165152,18 @@ } }, { - "__docId__": 8345, + "__docId__": 8353, "kind": "file", "name": "src/viewer/scene/utils/FileLoader.js", "content": "import {Cache} from './Cache.js';\nimport {Loader} from './Loader.js';\nimport {core} from \"../core.js\";\n\nconst loading = {};\n\nclass FileLoader extends Loader {\n\n constructor(manager) {\n super(manager);\n }\n\n load(url, onLoad, onProgress, onError) {\n if (url === undefined) {\n url = '';\n }\n if (this.path !== undefined) {\n url = this.path + url;\n }\n url = this.manager.resolveURL(url);\n const cached = Cache.get(url);\n if (cached !== undefined) {\n this.manager.itemStart(url);\n core.scheduleTask(() => {\n if (onLoad) {\n onLoad(cached);\n }\n this.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n if (loading[url] !== undefined) {\n loading[url].push({onLoad, onProgress, onError});\n return;\n }\n loading[url] = [];\n loading[url].push({onLoad, onProgress, onError});\n const req = new Request(url, {\n headers: new Headers(this.requestHeader),\n credentials: this.withCredentials ? 'include' : 'same-origin'\n });\n const mimeType = this.mimeType;\n const responseType = this.responseType;\n fetch(req).then(response => {\n if (response.status === 200 || response.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n if (response.status === 0) {\n console.warn('FileLoader: HTTP Status 0 received.');\n }\n if (typeof ReadableStream === 'undefined' || response.body.getReader === undefined) {\n return response;\n }\n const callbacks = loading[url];\n const reader = response.body.getReader();\n const contentLength = response.headers.get('Content-Length');\n const total = contentLength ? parseInt(contentLength) : 0;\n const lengthComputable = total !== 0;\n let loaded = 0;\n const stream = new ReadableStream({\n start(controller) {\n readData();\n\n function readData() {\n reader.read().then(({done, value}) => {\n if (done) {\n controller.close();\n } else {\n loaded += value.byteLength;\n const event = new ProgressEvent('progress', {lengthComputable, loaded, total});\n for (let i = 0, il = callbacks.length; i < il; i++) {\n const callback = callbacks[i];\n if (callback.onProgress) {\n callback.onProgress(event);\n }\n }\n controller.enqueue(value);\n readData();\n }\n });\n }\n }\n });\n return new Response(stream);\n } else {\n throw Error(`fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`);\n }\n }).then(response => {\n switch (responseType) {\n case 'arraybuffer':\n return response.arrayBuffer();\n case 'blob':\n return response.blob();\n case 'document':\n return response.text()\n .then(text => {\n const parser = new DOMParser();\n return parser.parseFromString(text, mimeType);\n });\n case 'json':\n return response.json();\n default:\n if (mimeType === undefined) {\n return response.text();\n } else {\n // sniff encoding\n const re = /charset=\"?([^;\"\\s]*)\"?/i;\n const exec = re.exec(mimeType);\n const label = exec && exec[1] ? exec[1].toLowerCase() : undefined;\n const decoder = new TextDecoder(label);\n return response.arrayBuffer().then(ab => decoder.decode(ab));\n }\n }\n }).then(data => {\n // Add to cache only on HTTP success, so that we do not cache\n // error response bodies as proper responses to requests.\n Cache.add(url, data);\n const callbacks = loading[url];\n delete loading[url];\n for (let i = 0, il = callbacks.length; i < il; i++) {\n const callback = callbacks[i];\n if (callback.onLoad) {\n callback.onLoad(data);\n }\n }\n }).catch(err => {\n // Abort errors and other errors are handled the same\n const callbacks = loading[url];\n if (callbacks === undefined) {\n // When onLoad was called and url was deleted in `loading`\n this.manager.itemError(url);\n throw err;\n\n }\n delete loading[url];\n for (let i = 0, il = callbacks.length; i < il; i++) {\n const callback = callbacks[i];\n if (callback.onError) {\n callback.onError(err);\n }\n }\n this.manager.itemError(url);\n }).finally(() => {\n this.manager.itemEnd(url);\n });\n this.manager.itemStart(url);\n }\n\n setResponseType(value) {\n this.responseType = value;\n return this;\n }\n\n setMimeType(value) {\n this.mimeType = value;\n return this;\n }\n}\n\n\nexport {FileLoader};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/FileLoader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/FileLoader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8346, + "__docId__": 8354, "kind": "variable", "name": "loading", "memberof": "src/viewer/scene/utils/FileLoader.js", @@ -164968,7 +165184,7 @@ "ignore": true }, { - "__docId__": 8347, + "__docId__": 8355, "kind": "class", "name": "FileLoader", "memberof": "src/viewer/scene/utils/FileLoader.js", @@ -164987,7 +165203,7 @@ ] }, { - "__docId__": 8348, + "__docId__": 8356, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165001,7 +165217,7 @@ "undocument": true }, { - "__docId__": 8349, + "__docId__": 8357, "kind": "method", "name": "load", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165046,7 +165262,7 @@ } }, { - "__docId__": 8350, + "__docId__": 8358, "kind": "method", "name": "setResponseType", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165073,7 +165289,7 @@ } }, { - "__docId__": 8351, + "__docId__": 8359, "kind": "member", "name": "responseType", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165090,7 +165306,7 @@ } }, { - "__docId__": 8352, + "__docId__": 8360, "kind": "method", "name": "setMimeType", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165117,7 +165333,7 @@ } }, { - "__docId__": 8353, + "__docId__": 8361, "kind": "member", "name": "mimeType", "memberof": "src/viewer/scene/utils/FileLoader.js~FileLoader", @@ -165134,18 +165350,18 @@ } }, { - "__docId__": 8354, + "__docId__": 8362, "kind": "file", "name": "src/viewer/scene/utils/Loader.js", "content": "import {DefaultLoadingManager} from './LoadingManager.js';\n\nclass Loader {\n\n constructor(manager) {\n\n this.manager = (manager !== undefined) ? manager : DefaultLoadingManager;\n\n this.crossOrigin = 'anonymous';\n this.withCredentials = false;\n this.path = '';\n this.resourcePath = '';\n this.requestHeader = {};\n }\n\n load( /* url, onLoad, onProgress, onError */) {\n }\n\n loadAsync(url, onProgress) {\n const scope = this;\n return new Promise(function (resolve, reject) {\n scope.load(url, resolve, onProgress, reject);\n });\n }\n\n parse( /* data */) {\n }\n\n setCrossOrigin(crossOrigin) {\n this.crossOrigin = crossOrigin;\n return this;\n }\n\n setWithCredentials(value) {\n this.withCredentials = value;\n return this;\n }\n\n setPath(path) {\n this.path = path;\n return this;\n }\n\n setResourcePath(resourcePath) {\n this.resourcePath = resourcePath;\n return this;\n }\n\n setRequestHeader(requestHeader) {\n this.requestHeader = requestHeader;\n return this;\n }\n}\n\nexport {Loader};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/Loader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/Loader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8355, + "__docId__": 8363, "kind": "class", "name": "Loader", "memberof": "src/viewer/scene/utils/Loader.js", @@ -165161,7 +165377,7 @@ "interface": false }, { - "__docId__": 8356, + "__docId__": 8364, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165175,7 +165391,7 @@ "undocument": true }, { - "__docId__": 8357, + "__docId__": 8365, "kind": "member", "name": "manager", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165192,7 +165408,7 @@ } }, { - "__docId__": 8358, + "__docId__": 8366, "kind": "member", "name": "crossOrigin", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165209,7 +165425,7 @@ } }, { - "__docId__": 8359, + "__docId__": 8367, "kind": "member", "name": "withCredentials", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165226,7 +165442,7 @@ } }, { - "__docId__": 8360, + "__docId__": 8368, "kind": "member", "name": "path", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165243,7 +165459,7 @@ } }, { - "__docId__": 8361, + "__docId__": 8369, "kind": "member", "name": "resourcePath", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165260,7 +165476,7 @@ } }, { - "__docId__": 8362, + "__docId__": 8370, "kind": "member", "name": "requestHeader", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165277,7 +165493,7 @@ } }, { - "__docId__": 8363, + "__docId__": 8371, "kind": "method", "name": "load", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165293,7 +165509,7 @@ "return": null }, { - "__docId__": 8364, + "__docId__": 8372, "kind": "method", "name": "loadAsync", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165326,7 +165542,7 @@ } }, { - "__docId__": 8365, + "__docId__": 8373, "kind": "method", "name": "parse", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165342,7 +165558,7 @@ "return": null }, { - "__docId__": 8366, + "__docId__": 8374, "kind": "method", "name": "setCrossOrigin", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165369,7 +165585,7 @@ } }, { - "__docId__": 8368, + "__docId__": 8376, "kind": "method", "name": "setWithCredentials", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165396,7 +165612,7 @@ } }, { - "__docId__": 8370, + "__docId__": 8378, "kind": "method", "name": "setPath", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165423,7 +165639,7 @@ } }, { - "__docId__": 8372, + "__docId__": 8380, "kind": "method", "name": "setResourcePath", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165450,7 +165666,7 @@ } }, { - "__docId__": 8374, + "__docId__": 8382, "kind": "method", "name": "setRequestHeader", "memberof": "src/viewer/scene/utils/Loader.js~Loader", @@ -165477,18 +165693,18 @@ } }, { - "__docId__": 8376, + "__docId__": 8384, "kind": "file", "name": "src/viewer/scene/utils/LoadingManager.js", "content": "class LoadingManager {\n\n constructor(onLoad, onProgress, onError) {\n\n this.isLoading = false;\n this.itemsLoaded = 0;\n this.itemsTotal = 0;\n this.urlModifier = undefined;\n this.handlers = [];\n\n this.onStart = undefined;\n this.onLoad = onLoad;\n this.onProgress = onProgress;\n this.onError = onError;\n }\n\n itemStart(url) {\n this.itemsTotal++;\n if (this.isLoading === false) {\n if (this.onStart !== undefined) {\n this.onStart(url, this.itemsLoaded, this.itemsTotal);\n }\n }\n this.isLoading = true;\n }\n\n itemEnd(url) {\n this.itemsLoaded++;\n if (this.onProgress !== undefined) {\n this.onProgress(url, this.itemsLoaded, this.itemsTotal);\n }\n if (this.itemsLoaded === this.itemsTotal) {\n this.isLoading = false;\n if (this.onLoad !== undefined) {\n this.onLoad();\n }\n }\n }\n\n itemError(url) {\n if (this.onError !== undefined) {\n this.onError(url);\n }\n }\n\n resolveURL(url) {\n if (this.urlModifier) {\n return this.urlModifier(url);\n }\n return url;\n }\n\n setURLModifier(transform) {\n this.urlModifier = transform;\n return this;\n }\n\n addHandler(regex, loader) {\n this.handlers.push(regex, loader);\n return this;\n }\n\n removeHandler(regex) {\n const index = this.handlers.indexOf(regex);\n if (index !== -1) {\n this.handlers.splice(index, 2);\n }\n return this;\n }\n\n getHandler(file) {\n for (let i = 0, l = this.handlers.length; i < l; i += 2) {\n const regex = this.handlers[i];\n const loader = this.handlers[i + 1];\n if (regex.global) regex.lastIndex = 0; // see #17920\n if (regex.test(file)) {\n return loader;\n }\n }\n return null;\n }\n}\n\nconst DefaultLoadingManager = new LoadingManager();\n\nexport {DefaultLoadingManager, LoadingManager};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/LoadingManager.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/LoadingManager.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8377, + "__docId__": 8385, "kind": "variable", "name": "DefaultLoadingManager", "memberof": "src/viewer/scene/utils/LoadingManager.js", @@ -165508,7 +165724,7 @@ } }, { - "__docId__": 8378, + "__docId__": 8386, "kind": "class", "name": "LoadingManager", "memberof": "src/viewer/scene/utils/LoadingManager.js", @@ -165525,7 +165741,7 @@ "interface": false }, { - "__docId__": 8379, + "__docId__": 8387, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165539,7 +165755,7 @@ "undocument": true }, { - "__docId__": 8380, + "__docId__": 8388, "kind": "member", "name": "isLoading", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165556,7 +165772,7 @@ } }, { - "__docId__": 8381, + "__docId__": 8389, "kind": "member", "name": "itemsLoaded", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165573,7 +165789,7 @@ } }, { - "__docId__": 8382, + "__docId__": 8390, "kind": "member", "name": "itemsTotal", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165590,7 +165806,7 @@ } }, { - "__docId__": 8383, + "__docId__": 8391, "kind": "member", "name": "urlModifier", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165607,7 +165823,7 @@ } }, { - "__docId__": 8384, + "__docId__": 8392, "kind": "member", "name": "handlers", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165624,7 +165840,7 @@ } }, { - "__docId__": 8385, + "__docId__": 8393, "kind": "member", "name": "onStart", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165641,7 +165857,7 @@ } }, { - "__docId__": 8386, + "__docId__": 8394, "kind": "member", "name": "onLoad", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165658,7 +165874,7 @@ } }, { - "__docId__": 8387, + "__docId__": 8395, "kind": "member", "name": "onProgress", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165675,7 +165891,7 @@ } }, { - "__docId__": 8388, + "__docId__": 8396, "kind": "member", "name": "onError", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165692,7 +165908,7 @@ } }, { - "__docId__": 8389, + "__docId__": 8397, "kind": "method", "name": "itemStart", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165715,7 +165931,7 @@ "return": null }, { - "__docId__": 8391, + "__docId__": 8399, "kind": "method", "name": "itemEnd", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165738,7 +165954,7 @@ "return": null }, { - "__docId__": 8393, + "__docId__": 8401, "kind": "method", "name": "itemError", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165761,7 +165977,7 @@ "return": null }, { - "__docId__": 8394, + "__docId__": 8402, "kind": "method", "name": "resolveURL", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165788,7 +166004,7 @@ } }, { - "__docId__": 8395, + "__docId__": 8403, "kind": "method", "name": "setURLModifier", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165815,7 +166031,7 @@ } }, { - "__docId__": 8397, + "__docId__": 8405, "kind": "method", "name": "addHandler", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165848,7 +166064,7 @@ } }, { - "__docId__": 8398, + "__docId__": 8406, "kind": "method", "name": "removeHandler", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165875,7 +166091,7 @@ } }, { - "__docId__": 8399, + "__docId__": 8407, "kind": "method", "name": "getHandler", "memberof": "src/viewer/scene/utils/LoadingManager.js~LoadingManager", @@ -165902,18 +166118,18 @@ } }, { - "__docId__": 8400, + "__docId__": 8408, "kind": "file", "name": "src/viewer/scene/utils/Map.js", "content": "/** @private */\nclass Map {\n\n constructor(items, baseId) {\n this.items = items || [];\n this._lastUniqueId = (baseId || 0) + 1;\n }\n\n /**\n * Usage:\n *\n * id = myMap.addItem(\"foo\") // ID internally generated\n * id = myMap.addItem(\"foo\", \"bar\") // ID is \"foo\"\n */\n addItem() {\n let item;\n if (arguments.length === 2) {\n const id = arguments[0];\n item = arguments[1];\n if (this.items[id]) { // Won't happen if given ID is string\n throw \"ID clash: '\" + id + \"'\";\n }\n this.items[id] = item;\n return id;\n\n } else {\n item = arguments[0] || {};\n while (true) {\n const findId = this._lastUniqueId++;\n if (!this.items[findId]) {\n this.items[findId] = item;\n return findId;\n }\n }\n }\n }\n\n removeItem(id) {\n const item = this.items[id];\n delete this.items[id];\n return item;\n }\n}\n\nexport {Map};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/Map.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/Map.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8401, + "__docId__": 8409, "kind": "class", "name": "Map", "memberof": "src/viewer/scene/utils/Map.js", @@ -165929,7 +166145,7 @@ "ignore": true }, { - "__docId__": 8402, + "__docId__": 8410, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/Map.js~Map", @@ -165943,7 +166159,7 @@ "undocument": true }, { - "__docId__": 8403, + "__docId__": 8411, "kind": "member", "name": "items", "memberof": "src/viewer/scene/utils/Map.js~Map", @@ -165960,7 +166176,7 @@ } }, { - "__docId__": 8404, + "__docId__": 8412, "kind": "member", "name": "_lastUniqueId", "memberof": "src/viewer/scene/utils/Map.js~Map", @@ -165978,7 +166194,7 @@ } }, { - "__docId__": 8405, + "__docId__": 8413, "kind": "method", "name": "addItem", "memberof": "src/viewer/scene/utils/Map.js~Map", @@ -165997,7 +166213,7 @@ } }, { - "__docId__": 8406, + "__docId__": 8414, "kind": "method", "name": "removeItem", "memberof": "src/viewer/scene/utils/Map.js~Map", @@ -166024,18 +166240,18 @@ } }, { - "__docId__": 8407, + "__docId__": 8415, "kind": "file", "name": "src/viewer/scene/utils/Queue.js", "content": "// Fast queue that avoids using potentially inefficient array .shift() calls\n// Based on https://github.com/creationix/fastqueue\n\n/** @private */\nclass Queue {\n\n constructor() {\n\n this._head = [];\n this._headLength = 0;\n this._tail = [];\n this._index = 0;\n this._length = 0;\n }\n\n get length() {\n return this._length;\n }\n\n shift() {\n if (this._index >= this._headLength) {\n const t = this._head;\n t.length = 0;\n this._head = this._tail;\n this._tail = t;\n this._index = 0;\n this._headLength = this._head.length;\n if (!this._headLength) {\n return;\n }\n }\n const value = this._head[this._index];\n if (this._index < 0) {\n delete this._head[this._index++];\n }\n else {\n this._head[this._index++] = undefined;\n }\n this._length--;\n return value;\n }\n\n push(item) {\n this._length++;\n this._tail.push(item);\n return this;\n };\n\n unshift(item) {\n this._head[--this._index] = item;\n this._length++;\n return this;\n }\n}\n\nexport {Queue};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/Queue.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/Queue.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8408, + "__docId__": 8416, "kind": "class", "name": "Queue", "memberof": "src/viewer/scene/utils/Queue.js", @@ -166051,7 +166267,7 @@ "ignore": true }, { - "__docId__": 8409, + "__docId__": 8417, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166065,7 +166281,7 @@ "undocument": true }, { - "__docId__": 8410, + "__docId__": 8418, "kind": "member", "name": "_head", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166083,7 +166299,7 @@ } }, { - "__docId__": 8411, + "__docId__": 8419, "kind": "member", "name": "_headLength", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166101,7 +166317,7 @@ } }, { - "__docId__": 8412, + "__docId__": 8420, "kind": "member", "name": "_tail", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166119,7 +166335,7 @@ } }, { - "__docId__": 8413, + "__docId__": 8421, "kind": "member", "name": "_index", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166137,7 +166353,7 @@ } }, { - "__docId__": 8414, + "__docId__": 8422, "kind": "member", "name": "_length", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166155,7 +166371,7 @@ } }, { - "__docId__": 8415, + "__docId__": 8423, "kind": "get", "name": "length", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166174,7 +166390,7 @@ } }, { - "__docId__": 8416, + "__docId__": 8424, "kind": "method", "name": "shift", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166194,7 +166410,7 @@ } }, { - "__docId__": 8421, + "__docId__": 8429, "kind": "method", "name": "push", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166221,7 +166437,7 @@ } }, { - "__docId__": 8422, + "__docId__": 8430, "kind": "method", "name": "unshift", "memberof": "src/viewer/scene/utils/Queue.js~Queue", @@ -166248,18 +166464,18 @@ } }, { - "__docId__": 8423, + "__docId__": 8431, "kind": "file", "name": "src/viewer/scene/utils/WorkerPool.js", "content": "/**\n * @author Deepkolos / https://github.com/deepkolos\n */\n\nexport class WorkerPool {\n\n constructor(pool = 4) {\n this.pool = pool;\n this.queue = [];\n this.workers = [];\n this.workersResolve = [];\n this.workerStatus = 0;\n }\n\n _initWorker(workerId) {\n if (!this.workers[workerId]) {\n const worker = this.workerCreator();\n worker.addEventListener('message', this._onMessage.bind(this, workerId));\n this.workers[workerId] = worker;\n }\n }\n\n _getIdleWorker() {\n for (let i = 0; i < this.pool; i++)\n if (!(this.workerStatus & (1 << i))) return i;\n return -1;\n }\n\n _onMessage(workerId, msg) {\n const resolve = this.workersResolve[workerId];\n resolve && resolve(msg);\n if (this.queue.length) {\n const {resolve, msg, transfer} = this.queue.shift();\n this.workersResolve[workerId] = resolve;\n this.workers[workerId].postMessage(msg, transfer);\n } else {\n this.workerStatus ^= 1 << workerId;\n }\n }\n\n setWorkerCreator(workerCreator) {\n this.workerCreator = workerCreator;\n }\n\n setWorkerLimit(pool) {\n this.pool = pool;\n }\n\n postMessage(msg, transfer) {\n return new Promise((resolve) => {\n const workerId = this._getIdleWorker();\n if (workerId !== -1) {\n this._initWorker(workerId);\n this.workerStatus |= 1 << workerId;\n this.workersResolve[workerId] = resolve;\n this.workers[workerId].postMessage(msg, transfer);\n } else {\n this.queue.push({resolve, msg, transfer});\n }\n });\n }\n\n destroy() {\n\n this.workers.forEach((worker) => worker.terminate());\n this.workersResolve.length = 0;\n this.workers.length = 0;\n this.queue.length = 0;\n this.workerStatus = 0;\n\n }\n\n}\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/WorkerPool.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/WorkerPool.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8424, + "__docId__": 8432, "kind": "class", "name": "WorkerPool", "memberof": "src/viewer/scene/utils/WorkerPool.js", @@ -166280,7 +166496,7 @@ "interface": false }, { - "__docId__": 8425, + "__docId__": 8433, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166294,7 +166510,7 @@ "undocument": true }, { - "__docId__": 8426, + "__docId__": 8434, "kind": "member", "name": "pool", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166311,7 +166527,7 @@ } }, { - "__docId__": 8427, + "__docId__": 8435, "kind": "member", "name": "queue", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166328,7 +166544,7 @@ } }, { - "__docId__": 8428, + "__docId__": 8436, "kind": "member", "name": "workers", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166345,7 +166561,7 @@ } }, { - "__docId__": 8429, + "__docId__": 8437, "kind": "member", "name": "workersResolve", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166362,7 +166578,7 @@ } }, { - "__docId__": 8430, + "__docId__": 8438, "kind": "member", "name": "workerStatus", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166379,7 +166595,7 @@ } }, { - "__docId__": 8431, + "__docId__": 8439, "kind": "method", "name": "_initWorker", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166403,7 +166619,7 @@ "return": null }, { - "__docId__": 8432, + "__docId__": 8440, "kind": "method", "name": "_getIdleWorker", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166424,7 +166640,7 @@ } }, { - "__docId__": 8433, + "__docId__": 8441, "kind": "method", "name": "_onMessage", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166454,7 +166670,7 @@ "return": null }, { - "__docId__": 8435, + "__docId__": 8443, "kind": "method", "name": "setWorkerCreator", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166477,7 +166693,7 @@ "return": null }, { - "__docId__": 8436, + "__docId__": 8444, "kind": "member", "name": "workerCreator", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166494,7 +166710,7 @@ } }, { - "__docId__": 8437, + "__docId__": 8445, "kind": "method", "name": "setWorkerLimit", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166517,7 +166733,7 @@ "return": null }, { - "__docId__": 8439, + "__docId__": 8447, "kind": "method", "name": "postMessage", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166550,7 +166766,7 @@ } }, { - "__docId__": 8441, + "__docId__": 8449, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/utils/WorkerPool.js~WorkerPool", @@ -166566,29 +166782,29 @@ "return": null }, { - "__docId__": 8443, + "__docId__": 8451, "kind": "file", "name": "src/viewer/scene/utils/index.js", "content": "export * from \"./Map.js\";\nexport * from \"./Queue.js\";\nexport * from \"./Loader.js\";\nexport * from \"./LoadingManager.js\";\nexport * from \"./WorkerPool.js\";\nexport * from \"./textureTranscoders/index.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8444, + "__docId__": 8452, "kind": "file", "name": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", "content": "import {FileLoader} from \"../../FileLoader.js\";\nimport {WorkerPool} from \"../../WorkerPool.js\";\nimport {\n LinearEncoding,\n LinearFilter,\n LinearMipmapLinearFilter,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format,\n RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGBAFormat,\n sRGBEncoding\n} from \"../../../constants/constants.js\";\n\nconst KTX2TransferSRGB = 2;\nconst KTX2_ALPHA_PREMULTIPLIED = 1;\n\nlet activeTranscoders = 0;\n\n/**\n * Transcodes texture data from KTX2.\n *\n * ## Overview\n *\n * * Uses the [Basis Universal GPU Texture Codec](https://github.com/BinomialLLC/basis_universal) to\n * transcode [KTX2](https://github.khronos.org/KTX-Specification/) textures.\n * * {@link XKTLoaderPlugin} uses a KTX2TextureTranscoder to load textures in XKT files.\n * * {@link VBOSceneModel} uses a KTX2TextureTranscoder to enable us to add KTX2-encoded textures.\n * * Loads the Basis Codec from [CDN](https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/) by default, but can\n * also be configured to load the Codec from local files.\n * * We also bundle the Basis Codec with the xeokit-sdk npm package, and in the [repository](https://github.com/xeokit/xeokit-sdk/tree/master/dist/basis).\n *\n * ## What is KTX2?\n *\n * A [KTX2](https://github.khronos.org/KTX-Specification/) file stores GPU texture data in the Khronos Texture 2.0 (KTX2) container format. It contains image data for\n * a texture asset compressed with Basis Universal (BasisU) supercompression that can be transcoded to different formats\n * depending on the support provided by the target devices. KTX2 provides a lightweight format for distributing texture\n * assets to GPUs. Due to BasisU compression, KTX2 files can store any image format supported by GPUs.\n *\n * ## Loading XKT files containing KTX2 textures\n *\n * {@link XKTLoaderPlugin} uses a KTX2TextureTranscoder to load textures in XKT files. An XKTLoaderPlugin has its own\n * default KTX2TextureTranscoder, configured to load the Basis Codec from the [CDN](https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/). If we wish, we can override that with our own\n * KTX2TextureTranscoder, configured to load the Codec locally.\n *\n * In the example below, we'll create a {@link Viewer} and add an {@link XKTLoaderPlugin}\n * configured with a KTX2TextureTranscoder. Then we'll use the XKTLoaderPlugin to load an\n * XKT file that contains KTX2 textures, which the plugin will transcode using\n * its KTX2TextureTranscoder.\n *\n * We'll configure our KTX2TextureTranscoder to load the Basis Codec from a local directory. If we were happy with loading the\n * Codec from our [CDN](https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/) (ie. our app will always have an Internet connection) then we could just leave out the\n * KTX2TextureTranscoder altogether, and let the XKTLoaderPlugin use its internal default KTX2TextureTranscoder, which is configured to\n * load the Codec from the CDN. We'll stick with loading our own Codec, in case we want to run our app without an Internet connection.\n *\n * \n *\n * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_vbo_textures_HousePlan)]\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.camera.eye = [-2.56, 8.38, 8.27];\n * viewer.camera.look = [13.44, 3.31, -14.83];\n * viewer.camera.up = [0.10, 0.98, -0.14];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to Basis Universal transcoder\n * });\n *\n * const xktLoader = new XKTLoaderPlugin(viewer, {\n * textureTranscoder // <<------------- Transcodes KTX2 textures in XKT files\n * });\n *\n * const sceneModel = xktLoader.load({\n * id: \"myModel\",\n * src: \"./HousePlan.xkt\" // <<------ XKT file with KTX2 textures\n * });\n * ````\n *\n * ## Loading KTX2 files into a VBOSceneModel\n *\n * A {@link SceneModel} that is configured with a KTX2TextureTranscoder will\n * allow us to load textures into it from KTX2-transcoded buffers or files.\n *\n * In the example below, we'll create a {@link Viewer}, containing a {@link VBOSceneModel} configured with a\n * KTX2TextureTranscoder.\n *\n * We'll then programmatically create a simple object within the VBOSceneModel, consisting of\n * a single box mesh with a texture loaded from a KTX2 file, which our VBOSceneModel internally transcodes, using\n * its KTX2TextureTranscoder.\n *\n * As in the previous example, we'll configure our KTX2TextureTranscoder to load the Basis Codec from a local directory.\n *\n * * [Run a similar example](https://xeokit.github.io/xeokit-sdk/examples/scenemodel/#vbo_batching_autocompressed_triangles_textures_ktx2)\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to BasisU transcoder module\n * });\n *\n * const vboSceneModel = new VBOSceneModel(viewer.scene, {\n * id: \"myModel\",\n * textureTranscoder // <<-------------------- Configure model with our transcoder\n * });\n *\n * vboSceneModel.createTexture({\n * id: \"myColorTexture\",\n * src: \"../assets/textures/compressed/sample_uastc_zstd.ktx2\" // <<----- KTX2 texture asset\n * });\n *\n * vboSceneModel.createTexture({\n * id: \"myMetallicRoughnessTexture\",\n * src: \"../assets/textures/alpha/crosshatchAlphaMap.jpg\" // <<----- JPEG texture asset\n * });\n *\n * vboSceneModel.createTextureSet({\n * id: \"myTextureSet\",\n * colorTextureId: \"myColorTexture\",\n * metallicRoughnessTextureId: \"myMetallicRoughnessTexture\"\n * });\n *\n * vboSceneModel.createMesh({\n * id: \"myMesh\",\n * textureSetId: \"myTextureSet\",\n * primitive: \"triangles\",\n * positions: [1, 1, 1, ...],\n * normals: [0, 0, 1, 0, ...],\n * uv: [1, 0, 0, ...],\n * indices: [0, 1, 2, ...],\n * });\n *\n * vboSceneModel.createEntity({\n * id: \"myEntity\",\n * meshIds: [\"myMesh\"]\n * });\n *\n * vboSceneModel.finalize();\n * ````\n *\n * ## Loading KTX2 ArrayBuffers into a VBOSceneModel\n *\n * A {@link SceneModel} that is configured with a KTX2TextureTranscoder will also allow us to load textures into\n * it from KTX2 ArrayBuffers.\n *\n * In the example below, we'll create a {@link Viewer}, containing a {@link VBOSceneModel} configured with a\n * KTX2TextureTranscoder.\n *\n * We'll then programmatically create a simple object within the VBOSceneModel, consisting of\n * a single mesh with a texture loaded from a KTX2 ArrayBuffer, which our VBOSceneModel internally transcodes, using\n * its KTX2TextureTranscoder.\n *\n * ````javascript\n * const viewer = new Viewer({\n * canvasId: \"myCanvas\",\n * transparent: true\n * });\n *\n * viewer.scene.camera.eye = [-21.80, 4.01, 6.56];\n * viewer.scene.camera.look = [0, -5.75, 0];\n * viewer.scene.camera.up = [0.37, 0.91, -0.11];\n *\n * const textureTranscoder = new KTX2TextureTranscoder({\n * viewer,\n * transcoderPath: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\" // <------ Path to BasisU transcoder module\n * });\n *\n * const vboSceneModel = new VBOSceneModel(viewer.scene, {\n * id: \"myModel\",\n * textureTranscoder // <<-------------------- Configure model with our transcoder\n * });\n *\n * utils.loadArraybuffer(\"../assets/textures/compressed/sample_uastc_zstd.ktx2\",(arrayBuffer) => {\n *\n * vboSceneModel.createTexture({\n * id: \"myColorTexture\",\n * buffers: [arrayBuffer] // <<----- KTX2 texture asset\n * });\n *\n * vboSceneModel.createTexture({\n * id: \"myMetallicRoughnessTexture\",\n * src: \"../assets/textures/alpha/crosshatchAlphaMap.jpg\" // <<----- JPEG texture asset\n * });\n *\n * vboSceneModel.createTextureSet({\n * id: \"myTextureSet\",\n * colorTextureId: \"myColorTexture\",\n * metallicRoughnessTextureId: \"myMetallicRoughnessTexture\"\n * });\n *\n * vboSceneModel.createMesh({\n * id: \"myMesh\",\n * textureSetId: \"myTextureSet\",\n * primitive: \"triangles\",\n * positions: [1, 1, 1, ...],\n * normals: [0, 0, 1, 0, ...],\n * uv: [1, 0, 0, ...],\n * indices: [0, 1, 2, ...],\n * });\n *\n * vboSceneModel.createEntity({\n * id: \"myEntity\",\n * meshIds: [\"myMesh\"]\n * });\n *\n * vboSceneModel.finalize();\n * });\n * ````\n *\n * @implements {TextureTranscoder}\n */\nclass KTX2TextureTranscoder {\n\n /**\n * Creates a new KTX2TextureTranscoder.\n *\n * @param {Viewer} viewer The Viewer that our KTX2TextureTranscoder will be used with. This KTX2TextureTranscoder\n * must only be used to transcode textures for this Viewer. This is because the Viewer's capabilities will decide\n * what target GPU formats this KTX2TextureTranscoder will transcode to.\n * @param {String} [transcoderPath=\"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\"] Path to the Basis\n * transcoder module that internally does the heavy lifting for our KTX2TextureTranscoder. If we omit this configuration,\n * then our KTX2TextureTranscoder will load it from ````https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/```` by\n * default. Therefore, make sure your application is connected to the internet if you wish to use the default transcoder path.\n * @param {Number} [workerLimit] The maximum number of Workers to use for transcoding.\n */\n constructor({viewer, transcoderPath, workerLimit}) {\n\n this._transcoderPath = transcoderPath || \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\";\n this._transcoderBinary = null;\n this._transcoderPending = null;\n this._workerPool = new WorkerPool();\n this._workerSourceURL = '';\n\n if (workerLimit) {\n this._workerPool.setWorkerLimit(workerLimit);\n }\n\n const viewerCapabilities = viewer.capabilities;\n\n this._workerConfig = {\n astcSupported: viewerCapabilities.astcSupported,\n etc1Supported: viewerCapabilities.etc1Supported,\n etc2Supported: viewerCapabilities.etc2Supported,\n dxtSupported: viewerCapabilities.dxtSupported,\n bptcSupported: viewerCapabilities.bptcSupported,\n pvrtcSupported: viewerCapabilities.pvrtcSupported\n };\n\n this._supportedFileTypes = [\"xkt2\"];\n }\n\n _init() {\n if (!this._transcoderPending) {\n const jsLoader = new FileLoader();\n jsLoader.setPath(this._transcoderPath);\n jsLoader.setWithCredentials(this.withCredentials);\n const jsContent = jsLoader.loadAsync('basis_transcoder.js');\n const binaryLoader = new FileLoader();\n binaryLoader.setPath(this._transcoderPath);\n binaryLoader.setResponseType('arraybuffer');\n binaryLoader.setWithCredentials(this.withCredentials);\n const binaryContent = binaryLoader.loadAsync('basis_transcoder.wasm');\n this._transcoderPending = Promise.all([jsContent, binaryContent])\n .then(([jsContent, binaryContent]) => {\n const fn = KTX2TextureTranscoder.BasisWorker.toString();\n const body = [\n '/* constants */',\n 'let _EngineFormat = ' + JSON.stringify(KTX2TextureTranscoder.EngineFormat),\n 'let _TranscoderFormat = ' + JSON.stringify(KTX2TextureTranscoder.TranscoderFormat),\n 'let _BasisFormat = ' + JSON.stringify(KTX2TextureTranscoder.BasisFormat),\n '/* basis_transcoder.js */',\n jsContent,\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))\n ].join('\\n');\n this._workerSourceURL = URL.createObjectURL(new Blob([body]));\n this._transcoderBinary = binaryContent;\n this._workerPool.setWorkerCreator(() => {\n const worker = new Worker(this._workerSourceURL);\n const transcoderBinary = this._transcoderBinary.slice(0);\n worker.postMessage({\n type: 'init',\n config: this._workerConfig,\n transcoderBinary\n }, [transcoderBinary]);\n return worker;\n });\n });\n if (activeTranscoders > 0) {\n console.warn('KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues.' + ' Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances.');\n }\n activeTranscoders++;\n }\n return this._transcoderPending;\n }\n\n /**\n * Transcodes texture data from transcoded buffers into a {@link Texture2D}.\n *\n * @param {ArrayBuffer[]} buffers Transcoded texture data. Given as an array of buffers so that we can support multi-image textures, such as cube maps.\n * @param {*} config Transcoding options.\n * @param {Texture2D} texture The texture to load.\n * @returns {Promise} Resolves when the texture has loaded.\n */\n transcode(buffers, texture, config = {}) {\n return new Promise((resolve, reject) => {\n const taskConfig = config;\n this._init().then(() => {\n return this._workerPool.postMessage({\n type: 'transcode',\n buffers,\n taskConfig: taskConfig\n }, buffers);\n }).then((e) => {\n const transcodeResult = e.data;\n const {mipmaps, width, height, format, type, error, dfdTransferFn, dfdFlags} = transcodeResult;\n if (type === 'error') {\n return reject(error);\n }\n texture.setCompressedData({\n mipmaps,\n props: {\n format: format,\n minFilter: mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter,\n magFilter: mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter,\n encoding: dfdTransferFn === KTX2TransferSRGB ? sRGBEncoding : LinearEncoding,\n premultiplyAlpha: !!(dfdFlags & KTX2_ALPHA_PREMULTIPLIED)\n }\n });\n resolve()\n });\n });\n }\n\n /**\n * Destroys this KTX2TextureTranscoder\n */\n destroy() {\n URL.revokeObjectURL(this._workerSourceURL);\n this._workerPool.destroy();\n activeTranscoders--;\n }\n}\n\n/**\n * @private\n */\nKTX2TextureTranscoder.BasisFormat = {\n ETC1S: 0,\n UASTC_4x4: 1\n};\n\n/**\n * @private\n */\nKTX2TextureTranscoder.TranscoderFormat = {\n ETC1: 0,\n ETC2: 1,\n BC1: 2,\n BC3: 3,\n BC4: 4,\n BC5: 5,\n BC7_M6_OPAQUE_ONLY: 6,\n BC7_M5: 7,\n PVRTC1_4_RGB: 8,\n PVRTC1_4_RGBA: 9,\n ASTC_4x4: 10,\n ATC_RGB: 11,\n ATC_RGBA_INTERPOLATED_ALPHA: 12,\n RGBA32: 13,\n RGB565: 14,\n BGR565: 15,\n RGBA4444: 16\n};\n\n/**\n * @private\n */\nKTX2TextureTranscoder.EngineFormat = {\n RGBAFormat: RGBAFormat,\n RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format: RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format: RGB_ETC1_Format,\n RGB_ETC2_Format: RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format\n};\n\n/* WEB WORKER */\n\n/**\n * @private\n * @constructor\n */\nKTX2TextureTranscoder.BasisWorker = function () {\n\n let config;\n let transcoderPending;\n let BasisModule;\n\n const EngineFormat = _EngineFormat; // eslint-disable-line no-undef\n const TranscoderFormat = _TranscoderFormat; // eslint-disable-line no-undef\n const BasisFormat = _BasisFormat; // eslint-disable-line no-undef\n\n self.addEventListener('message', function (e) {\n const message = e.data;\n switch (message.type) {\n case 'init':\n config = message.config;\n init(message.transcoderBinary);\n break;\n case 'transcode':\n transcoderPending.then(() => {\n try {\n const {\n width,\n height,\n hasAlpha,\n mipmaps,\n format,\n dfdTransferFn,\n dfdFlags\n } = transcode(message.buffers[0]);\n const buffers = [];\n for (let i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer);\n }\n self.postMessage({\n type: 'transcode',\n id: message.id,\n width,\n height,\n hasAlpha,\n mipmaps,\n format,\n dfdTransferFn,\n dfdFlags\n }, buffers);\n } catch (error) {\n console.error(`[KTX2TextureTranscoder.BasisWorker]: ${error}`);\n self.postMessage({type: 'error', id: message.id, error: error.message});\n }\n });\n break;\n }\n });\n\n function init(wasmBinary) {\n transcoderPending = new Promise(resolve => {\n BasisModule = {\n wasmBinary,\n onRuntimeInitialized: resolve\n };\n BASIS(BasisModule); // eslint-disable-line no-undef\n }).then(() => {\n BasisModule.initializeBasis();\n if (BasisModule.KTX2File === undefined) {\n console.warn('KTX2TextureTranscoder: Please update Basis Universal transcoder.');\n }\n });\n }\n\n function transcode(buffer) {\n const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer));\n\n function cleanup() {\n ktx2File.close();\n ktx2File.delete();\n }\n\n if (!ktx2File.isValid()) {\n cleanup();\n throw new Error('KTX2TextureTranscoder: Invalid or unsupported .ktx2 file');\n }\n const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;\n const width = ktx2File.getWidth();\n const height = ktx2File.getHeight();\n const levels = ktx2File.getLevels();\n const hasAlpha = ktx2File.getHasAlpha();\n const dfdTransferFn = ktx2File.getDFDTransferFunc();\n const dfdFlags = ktx2File.getDFDFlags();\n const {transcoderFormat, engineFormat} = getTranscoderFormat(basisFormat, width, height, hasAlpha);\n if (!width || !height || !levels) {\n cleanup();\n throw new Error('KTX2TextureTranscoder: Invalid texture');\n }\n if (!ktx2File.startTranscoding()) {\n cleanup();\n throw new Error('KTX2TextureTranscoder: .startTranscoding failed');\n }\n const mipmaps = [];\n for (let mip = 0; mip < levels; mip++) {\n const levelInfo = ktx2File.getImageLevelInfo(mip, 0, 0);\n const mipWidth = levelInfo.origWidth;\n const mipHeight = levelInfo.origHeight;\n const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, 0, 0, transcoderFormat));\n const status = ktx2File.transcodeImage(dst, mip, 0, 0, transcoderFormat, 0, -1, -1);\n if (!status) {\n cleanup();\n throw new Error('KTX2TextureTranscoder: .transcodeImage failed.');\n }\n mipmaps.push({data: dst, width: mipWidth, height: mipHeight});\n }\n cleanup();\n return {width, height, hasAlpha, mipmaps, format: engineFormat, dfdTransferFn, dfdFlags};\n }\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n\n const FORMAT_OPTIONS = [{\n if: 'astcSupported',\n basisFormat: [BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],\n engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false\n }, {\n if: 'bptcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],\n engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false\n }, {\n if: 'dxtSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],\n engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false\n }, {\n if: 'etc2Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],\n engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false\n }, {\n if: 'etc1Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1],\n engineFormat: [EngineFormat.RGB_ETC1_Format],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false\n }, {\n if: 'pvrtcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],\n engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true\n }];\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityETC1S - b.priorityETC1S;\n });\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityUASTC - b.priorityUASTC;\n });\n\n function getTranscoderFormat(basisFormat, width, height, hasAlpha) {\n let transcoderFormat;\n let engineFormat;\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;\n for (let i = 0; i < options.length; i++) {\n const opt = options[i];\n if (!config[opt.if]) continue;\n if (!opt.basisFormat.includes(basisFormat)) continue;\n if (hasAlpha && opt.transcoderFormat.length < 2) continue;\n if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height))) continue;\n transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];\n engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];\n return {\n transcoderFormat,\n engineFormat\n };\n }\n console.warn('KTX2TextureTranscoder: No suitable compressed texture format found. Decoding to RGBA32.');\n transcoderFormat = TranscoderFormat.RGBA32;\n engineFormat = EngineFormat.RGBAFormat;\n return {\n transcoderFormat,\n engineFormat\n };\n }\n\n function isPowerOfTwo(value) {\n if (value <= 2) return true;\n return (value & value - 1) === 0 && value !== 0;\n }\n};\n\nconst cachedTranscoders = {};\n\n/**\n * Returns a new {@link KTX2TextureTranscoder}.\n *\n * The ````transcoderPath```` config will be set to: \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/\"\n *\n * @private\n */\nfunction getKTX2TextureTranscoder(viewer) {\n const sceneId = viewer.scene.id;\n let transcoder = cachedTranscoders[sceneId];\n if (!transcoder) {\n transcoder = new KTX2TextureTranscoder({viewer});\n cachedTranscoders[sceneId] = transcoder;\n viewer.scene.on(\"destroyed\", () => {\n delete cachedTranscoders[sceneId];\n transcoder.destroy();\n });\n }\n return transcoder;\n}\n\nexport {getKTX2TextureTranscoder, KTX2TextureTranscoder};\n\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8445, + "__docId__": 8453, "kind": "variable", "name": "KTX2TransferSRGB", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166609,7 +166825,7 @@ "ignore": true }, { - "__docId__": 8446, + "__docId__": 8454, "kind": "variable", "name": "KTX2_ALPHA_PREMULTIPLIED", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166630,7 +166846,7 @@ "ignore": true }, { - "__docId__": 8447, + "__docId__": 8455, "kind": "variable", "name": "activeTranscoders", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166651,7 +166867,7 @@ "ignore": true }, { - "__docId__": 8448, + "__docId__": 8456, "kind": "function", "name": "BasisWorker", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166676,7 +166892,7 @@ "return": null }, { - "__docId__": 8449, + "__docId__": 8457, "kind": "variable", "name": "cachedTranscoders", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166697,7 +166913,7 @@ "ignore": true }, { - "__docId__": 8450, + "__docId__": 8458, "kind": "function", "name": "getKTX2TextureTranscoder", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166727,7 +166943,7 @@ } }, { - "__docId__": 8451, + "__docId__": 8459, "kind": "class", "name": "KTX2TextureTranscoder", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js", @@ -166745,7 +166961,7 @@ ] }, { - "__docId__": 8452, + "__docId__": 8460, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166792,7 +167008,7 @@ ] }, { - "__docId__": 8453, + "__docId__": 8461, "kind": "member", "name": "_transcoderPath", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166810,7 +167026,7 @@ } }, { - "__docId__": 8454, + "__docId__": 8462, "kind": "member", "name": "_transcoderBinary", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166828,7 +167044,7 @@ } }, { - "__docId__": 8455, + "__docId__": 8463, "kind": "member", "name": "_transcoderPending", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166846,7 +167062,7 @@ } }, { - "__docId__": 8456, + "__docId__": 8464, "kind": "member", "name": "_workerPool", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166864,7 +167080,7 @@ } }, { - "__docId__": 8457, + "__docId__": 8465, "kind": "member", "name": "_workerSourceURL", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166882,7 +167098,7 @@ } }, { - "__docId__": 8458, + "__docId__": 8466, "kind": "member", "name": "_workerConfig", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166900,7 +167116,7 @@ } }, { - "__docId__": 8459, + "__docId__": 8467, "kind": "member", "name": "_supportedFileTypes", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166918,7 +167134,7 @@ } }, { - "__docId__": 8460, + "__docId__": 8468, "kind": "method", "name": "_init", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166939,7 +167155,7 @@ } }, { - "__docId__": 8464, + "__docId__": 8472, "kind": "method", "name": "transcode", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -166998,7 +167214,7 @@ } }, { - "__docId__": 8465, + "__docId__": 8473, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js~KTX2TextureTranscoder", @@ -167013,29 +167229,29 @@ "return": null }, { - "__docId__": 8466, + "__docId__": 8474, "kind": "file", "name": "src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js", "content": "export * from \"./KTX2TextureTranscoder.js\";", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8467, + "__docId__": 8475, "kind": "file", "name": "src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js", "content": "/**\n * Transcodes texture data.\n *\n * A {@link SceneModel} configured with an appropriate TextureTranscoder will allow us to add textures from\n * transcoded buffers or files. For a concrete example, see {@link VBOSceneModel}, which can be configured with\n * a {@link KTX2TextureTranscoder}, which allows us to add textures from KTX2 buffers and files.\n *\n * @interface\n */\nclass TextureTranscoder {\n\n /**\n * Transcodes texture data from transcoded buffers into a {@link Texture2D}.\n *\n * @param {ArrayBuffer[]} buffers Transcoded texture data. Given as an array of buffers so that we can support\n * multi-image textures, such as cube maps.\n * @param {*} config Transcoding options.\n * @param {Texture2D} texture The texture to load.\n * @returns {Promise} Resolves when the texture has loaded.\n */\n transcode(buffers, texture, config = {}) {\n }\n\n /**\n * Destroys this transcoder.\n */\n destroy() {\n }\n}\n\nexport {TextureTranscoder};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8468, + "__docId__": 8476, "kind": "class", "name": "TextureTranscoder", "memberof": "src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js", @@ -167050,7 +167266,7 @@ "interface": true }, { - "__docId__": 8469, + "__docId__": 8477, "kind": "method", "name": "transcode", "memberof": "src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js~TextureTranscoder", @@ -167109,7 +167325,7 @@ } }, { - "__docId__": 8470, + "__docId__": 8478, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js~TextureTranscoder", @@ -167124,29 +167340,29 @@ "return": null }, { - "__docId__": 8471, + "__docId__": 8479, "kind": "file", "name": "src/viewer/scene/utils/textureTranscoders/index.js", "content": "export * from \"./TextureTranscoder.js\";\nexport * from \"./KTX2TextureTranscoder/index.js\";\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils/textureTranscoders/index.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils/textureTranscoders/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8472, + "__docId__": 8480, "kind": "file", "name": "src/viewer/scene/utils.js", "content": "/**\n * @private\n */\nimport {core} from \"./core.js\";\n\nfunction xmlToJson(node, attributeRenamer) {\n if (node.nodeType === node.TEXT_NODE) {\n var v = node.nodeValue;\n if (v.match(/^\\s+$/) === null) {\n return v;\n }\n } else if (node.nodeType === node.ELEMENT_NODE ||\n node.nodeType === node.DOCUMENT_NODE) {\n var json = {type: node.nodeName, children: []};\n\n if (node.nodeType === node.ELEMENT_NODE) {\n for (var j = 0; j < node.attributes.length; j++) {\n var attribute = node.attributes[j];\n var nm = attributeRenamer[attribute.nodeName] || attribute.nodeName;\n json[nm] = attribute.nodeValue;\n }\n }\n\n for (var i = 0; i < node.childNodes.length; i++) {\n var item = node.childNodes[i];\n var j = xmlToJson(item, attributeRenamer);\n if (j) json.children.push(j);\n }\n\n return json;\n }\n}\n\n/**\n * @private\n */\nfunction clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n}\n\n/**\n * @private\n */\nvar guidChars = [[\"0\", 10], [\"A\", 26], [\"a\", 26], [\"_\", 1], [\"$\", 1]].map(function (a) {\n var li = [];\n var st = a[0].charCodeAt(0);\n var en = st + a[1];\n for (var i = st; i < en; ++i) {\n li.push(i);\n }\n return String.fromCharCode.apply(null, li);\n}).join(\"\");\n\n/**\n * @private\n */\nfunction b64(v, len) {\n var r = (!len || len === 4) ? [0, 6, 12, 18] : [0, 6];\n return r.map(function (i) {\n return guidChars.substr(parseInt(v / (1 << i)) % 64, 1)\n }).reverse().join(\"\");\n}\n\n/**\n * @private\n */\nfunction compressGuid(g) {\n var bs = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30].map(function (i) {\n return parseInt(g.substr(i, 2), 16);\n });\n return b64(bs[0], 2) + [1, 4, 7, 10, 13].map(function (i) {\n return b64((bs[i] << 16) + (bs[i + 1] << 8) + bs[i + 2]);\n }).join(\"\");\n}\n\n/**\n * @private\n */\nfunction findNodeOfType(m, t) {\n var li = [];\n var _ = function (n) {\n if (n.type === t) li.push(n);\n (n.children || []).forEach(function (c) {\n _(c);\n });\n };\n _(m);\n return li;\n}\n\n/**\n * @private\n */\nfunction timeout(dt) {\n return new Promise(function (resolve, reject) {\n setTimeout(resolve, dt);\n });\n}\n\n/**\n * @private\n */\nfunction httpRequest(args) {\n return new Promise(function (resolve, reject) {\n var xhr = new XMLHttpRequest();\n xhr.open(args.method || \"GET\", args.url, true);\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n resolve(xhr.responseXML);\n } else {\n reject(xhr.statusText);\n }\n }\n };\n xhr.send(null);\n });\n}\n\n/**\n * @private\n */\nconst queryString = function () {\n // This function is anonymous, is executed immediately and\n // the return value is assigned to QueryString!\n var query_string = {};\n var query = window.location.search.substring(1);\n var vars = query.split(\"&\");\n for (var i = 0; i < vars.length; i++) {\n var pair = vars[i].split(\"=\");\n // If first entry with this name\n if (typeof query_string[pair[0]] === \"undefined\") {\n query_string[pair[0]] = decodeURIComponent(pair[1]);\n // If second entry with this name\n } else if (typeof query_string[pair[0]] === \"string\") {\n var arr = [query_string[pair[0]], decodeURIComponent(pair[1])];\n query_string[pair[0]] = arr;\n // If third or later entry with this name\n } else {\n query_string[pair[0]].push(decodeURIComponent(pair[1]));\n }\n }\n return query_string;\n}();\n\n/**\n * @private\n */\nfunction loadJSON(url, ok, err) {\n // Avoid checking ok and err on each use.\n var defaultCallback = (_value) => undefined;\n ok = ok || defaultCallback;\n err = err || defaultCallback;\n\n var request = new XMLHttpRequest();\n request.overrideMimeType(\"application/json\");\n request.open('GET', url, true);\n request.addEventListener('load', function (event) {\n var response = event.target.response;\n if (this.status === 200) {\n var json;\n try {\n json = JSON.parse(response);\n } catch (e) {\n err(`utils.loadJSON(): Failed to parse JSON response - ${e}`);\n }\n ok(json);\n } else if (this.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n console.warn('loadFile: HTTP Status 0 received.');\n try {\n ok(JSON.parse(response));\n } catch (e) {\n err(`utils.loadJSON(): Failed to parse JSON response - ${e}`);\n }\n } else {\n err(event);\n }\n }, false);\n\n request.addEventListener('error', function (event) {\n err(event);\n }, false);\n request.send(null);\n}\n\n/**\n * @private\n */\nfunction loadArraybuffer(url, ok, err) {\n // Check for data: URI\n var defaultCallback = (_value) => undefined;\n ok = ok || defaultCallback;\n err = err || defaultCallback;\n const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n const dataUriRegexResult = url.match(dataUriRegex);\n if (dataUriRegexResult) { // Safari can't handle data URIs through XMLHttpRequest\n const isBase64 = !!dataUriRegexResult[2];\n var data = dataUriRegexResult[3];\n data = window.decodeURIComponent(data);\n if (isBase64) {\n data = window.atob(data);\n }\n try {\n const buffer = new ArrayBuffer(data.length);\n const view = new Uint8Array(buffer);\n for (var i = 0; i < data.length; i++) {\n view[i] = data.charCodeAt(i);\n }\n core.scheduleTask(() => {\n ok(buffer);\n });\n } catch (error) {\n core.scheduleTask(() => {\n err(error);\n });\n }\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', url, true);\n request.responseType = 'arraybuffer';\n request.onreadystatechange = function () {\n if (request.readyState === 4) {\n if (request.status === 200) {\n ok(request.response);\n } else {\n err('loadArrayBuffer error : ' + request.response);\n }\n }\n };\n request.send(null);\n }\n}\n\n/**\n Tests if the given object is an array\n @private\n */\nfunction isArray(value) {\n return value && !(value.propertyIsEnumerable('length')) && typeof value === 'object' && typeof value.length === 'number';\n}\n\n/**\n Tests if the given value is a string\n @param value\n @returns {Boolean}\n @private\n */\nfunction isString(value) {\n return (typeof value === 'string' || value instanceof String);\n}\n\n/**\n Tests if the given value is a number\n @param value\n @returns {Boolean}\n @private\n */\nfunction isNumeric(value) {\n return !isNaN(parseFloat(value)) && isFinite(value);\n}\n\n/**\n Tests if the given value is an ID\n @param value\n @returns {Boolean}\n @private\n */\nfunction isID(value) {\n return utils.isString(value) || utils.isNumeric(value);\n}\n\n/**\n Tests if the given components are the same, where the components can be either IDs or instances.\n @param c1\n @param c2\n @returns {Boolean}\n @private\n */\nfunction isSameComponent(c1, c2) {\n if (!c1 || !c2) {\n return false;\n }\n const id1 = (utils.isNumeric(c1) || utils.isString(c1)) ? `${c1}` : c1.id;\n const id2 = (utils.isNumeric(c2) || utils.isString(c2)) ? `${c2}` : c2.id;\n return id1 === id2;\n}\n\n/**\n Tests if the given value is a function\n @param value\n @returns {Boolean}\n @private\n */\nfunction isFunction(value) {\n return (typeof value === \"function\");\n}\n\n/**\n Tests if the given value is a JavaScript JSON object, eg, ````{ foo: \"bar\" }````.\n @param value\n @returns {Boolean}\n @private\n */\nfunction isObject(value) {\n const objectConstructor = {}.constructor;\n return (!!value && value.constructor === objectConstructor);\n}\n\n/** Returns a shallow copy\n */\nfunction copy(o) {\n return utils.apply(o, {});\n}\n\n/** Add properties of o to o2, overwriting them on o2 if already there\n */\nfunction apply(o, o2) {\n for (const name in o) {\n if (o.hasOwnProperty(name)) {\n o2[name] = o[name];\n }\n }\n return o2;\n}\n\n/**\n Add non-null/defined properties of o to o2\n @private\n */\nfunction apply2(o, o2) {\n for (const name in o) {\n if (o.hasOwnProperty(name)) {\n if (o[name] !== undefined && o[name] !== null) {\n o2[name] = o[name];\n }\n }\n }\n return o2;\n}\n\n/**\n Add properties of o to o2 where undefined or null on o2\n @private\n */\nfunction applyIf(o, o2) {\n for (const name in o) {\n if (o.hasOwnProperty(name)) {\n if (o2[name] === undefined || o2[name] === null) {\n o2[name] = o[name];\n }\n }\n }\n return o2;\n}\n\n/**\n Returns true if the given map is empty.\n @param obj\n @returns {Boolean}\n @private\n */\nfunction isEmptyObject(obj) {\n for (const name in obj) {\n if (obj.hasOwnProperty(name)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n Returns the given ID as a string, in quotes if the ID was a string to begin with.\n\n This is useful for logging IDs.\n\n @param {Number| String} id The ID\n @returns {String}\n @private\n */\nfunction inQuotes(id) {\n return utils.isNumeric(id) ? (`${id}`) : (`'${id}'`);\n}\n\n/**\n Returns the concatenation of two typed arrays.\n @param a\n @param b\n @returns {*|a}\n @private\n */\nfunction concat(a, b) {\n const c = new a.constructor(a.length + b.length);\n c.set(a);\n c.set(b, a.length);\n return c;\n}\n\nfunction flattenParentChildHierarchy(root) {\n var list = [];\n\n function visit(node) {\n node.id = node.uuid;\n delete node.oid;\n list.push(node);\n var children = node.children;\n\n if (children) {\n for (var i = 0, len = children.length; i < len; i++) {\n const child = children[i];\n child.parent = node.id;\n visit(children[i]);\n }\n }\n node.children = [];\n }\n\n visit(root);\n return list;\n}\n\n/**\n * @private\n */\nconst utils = {\n xmlToJson: xmlToJson,\n clone: clone,\n compressGuid: compressGuid,\n findNodeOfType: findNodeOfType,\n timeout: timeout,\n httpRequest: httpRequest,\n loadJSON: loadJSON,\n loadArraybuffer: loadArraybuffer,\n queryString: queryString,\n isArray: isArray,\n isString: isString,\n isNumeric: isNumeric,\n isID: isID,\n isSameComponent: isSameComponent,\n isFunction: isFunction,\n isObject: isObject,\n copy: copy,\n apply: apply,\n apply2: apply2,\n applyIf: applyIf,\n isEmptyObject: isEmptyObject,\n inQuotes: inQuotes,\n concat: concat,\n flattenParentChildHierarchy: flattenParentChildHierarchy\n};\n\nexport {utils};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/utils.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/utils.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8473, + "__docId__": 8481, "kind": "function", "name": "xmlToJson", "memberof": "src/viewer/scene/utils.js", @@ -167183,7 +167399,7 @@ "ignore": true }, { - "__docId__": 8474, + "__docId__": 8482, "kind": "function", "name": "clone", "memberof": "src/viewer/scene/utils.js", @@ -167213,7 +167429,7 @@ } }, { - "__docId__": 8475, + "__docId__": 8483, "kind": "variable", "name": "guidChars", "memberof": "src/viewer/scene/utils.js", @@ -167233,7 +167449,7 @@ } }, { - "__docId__": 8476, + "__docId__": 8484, "kind": "function", "name": "b64", "memberof": "src/viewer/scene/utils.js", @@ -167269,7 +167485,7 @@ } }, { - "__docId__": 8477, + "__docId__": 8485, "kind": "function", "name": "compressGuid", "memberof": "src/viewer/scene/utils.js", @@ -167299,7 +167515,7 @@ } }, { - "__docId__": 8478, + "__docId__": 8486, "kind": "function", "name": "findNodeOfType", "memberof": "src/viewer/scene/utils.js", @@ -167335,7 +167551,7 @@ } }, { - "__docId__": 8479, + "__docId__": 8487, "kind": "function", "name": "timeout", "memberof": "src/viewer/scene/utils.js", @@ -167365,7 +167581,7 @@ } }, { - "__docId__": 8480, + "__docId__": 8488, "kind": "function", "name": "httpRequest", "memberof": "src/viewer/scene/utils.js", @@ -167395,7 +167611,7 @@ } }, { - "__docId__": 8481, + "__docId__": 8489, "kind": "variable", "name": "queryString", "memberof": "src/viewer/scene/utils.js", @@ -167415,7 +167631,7 @@ } }, { - "__docId__": 8482, + "__docId__": 8490, "kind": "function", "name": "loadJSON", "memberof": "src/viewer/scene/utils.js", @@ -167453,7 +167669,7 @@ "return": null }, { - "__docId__": 8483, + "__docId__": 8491, "kind": "function", "name": "loadArraybuffer", "memberof": "src/viewer/scene/utils.js", @@ -167491,7 +167707,7 @@ "return": null }, { - "__docId__": 8484, + "__docId__": 8492, "kind": "function", "name": "isArray", "memberof": "src/viewer/scene/utils.js", @@ -167521,7 +167737,7 @@ } }, { - "__docId__": 8485, + "__docId__": 8493, "kind": "function", "name": "isString", "memberof": "src/viewer/scene/utils.js", @@ -167564,7 +167780,7 @@ "ignore": true }, { - "__docId__": 8486, + "__docId__": 8494, "kind": "function", "name": "isNumeric", "memberof": "src/viewer/scene/utils.js", @@ -167607,7 +167823,7 @@ "ignore": true }, { - "__docId__": 8487, + "__docId__": 8495, "kind": "function", "name": "isID", "memberof": "src/viewer/scene/utils.js", @@ -167650,7 +167866,7 @@ "ignore": true }, { - "__docId__": 8488, + "__docId__": 8496, "kind": "function", "name": "isSameComponent", "memberof": "src/viewer/scene/utils.js", @@ -167703,7 +167919,7 @@ "ignore": true }, { - "__docId__": 8489, + "__docId__": 8497, "kind": "function", "name": "isFunction", "memberof": "src/viewer/scene/utils.js", @@ -167746,7 +167962,7 @@ "ignore": true }, { - "__docId__": 8490, + "__docId__": 8498, "kind": "function", "name": "isObject", "memberof": "src/viewer/scene/utils.js", @@ -167789,7 +168005,7 @@ "ignore": true }, { - "__docId__": 8491, + "__docId__": 8499, "kind": "function", "name": "copy", "memberof": "src/viewer/scene/utils.js", @@ -167819,7 +168035,7 @@ "ignore": true }, { - "__docId__": 8492, + "__docId__": 8500, "kind": "function", "name": "apply", "memberof": "src/viewer/scene/utils.js", @@ -167855,7 +168071,7 @@ "ignore": true }, { - "__docId__": 8493, + "__docId__": 8501, "kind": "function", "name": "apply2", "memberof": "src/viewer/scene/utils.js", @@ -167891,7 +168107,7 @@ } }, { - "__docId__": 8494, + "__docId__": 8502, "kind": "function", "name": "applyIf", "memberof": "src/viewer/scene/utils.js", @@ -167927,7 +168143,7 @@ } }, { - "__docId__": 8495, + "__docId__": 8503, "kind": "function", "name": "isEmptyObject", "memberof": "src/viewer/scene/utils.js", @@ -167970,7 +168186,7 @@ "ignore": true }, { - "__docId__": 8496, + "__docId__": 8504, "kind": "function", "name": "inQuotes", "memberof": "src/viewer/scene/utils.js", @@ -168014,7 +168230,7 @@ "ignore": true }, { - "__docId__": 8497, + "__docId__": 8505, "kind": "function", "name": "concat", "memberof": "src/viewer/scene/utils.js", @@ -168068,7 +168284,7 @@ "ignore": true }, { - "__docId__": 8498, + "__docId__": 8506, "kind": "function", "name": "flattenParentChildHierarchy", "memberof": "src/viewer/scene/utils.js", @@ -168099,7 +168315,7 @@ "ignore": true }, { - "__docId__": 8499, + "__docId__": 8507, "kind": "variable", "name": "utils", "memberof": "src/viewer/scene/utils.js", @@ -168119,18 +168335,18 @@ } }, { - "__docId__": 8500, + "__docId__": 8508, "kind": "file", "name": "src/viewer/scene/viewport/Viewport.js", "content": "/**\n * @desc controls the canvas viewport for a {@link Scene}.\n *\n * * One Viewport per scene.\n * * You can configure a Scene to render multiple times per frame, while setting the Viewport to different extents on each render.\n * * Make a Viewport automatically size to its {@link Scene} {@link Canvas} by setting its {@link Viewport#autoBoundary} ````true````.\n *\n *\n * Configuring the Scene to render twice on each frame, each time to a separate viewport:\n *\n * ````Javascript\n * // Load glTF model\n * var model = new xeokit.GLTFModel({\n src: \"models/gltf/GearboxAssy/glTF-MaterialsCommon/GearboxAssy.gltf\"\n });\n\n var scene = model.scene;\n var viewport = scene.viewport;\n\n // Configure Scene to render twice for each frame\n scene.passes = 2; // Default is 1\n scene.clearEachPass = false; // Default is false\n\n // Render to a separate viewport on each render\n\n var viewport = scene.viewport;\n viewport.autoBoundary = false;\n\n scene.on(\"rendering\", function (e) {\n switch (e.pass) {\n case 0:\n viewport.boundary = [0, 0, 200, 200]; // xmin, ymin, width, height\n break;\n\n case 1:\n viewport.boundary = [200, 0, 200, 200];\n break;\n }\n });\n ````\n\n @class Viewport\n @module xeokit\n @submodule rendering\n @constructor\n @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.\n @param {*} [cfg] Viewport configuration\n @param {String} [cfg.id] Optional ID, unique among all components in the parent\n {@link Scene}, generated automatically when omitted.\n @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this Viewport.\n @param [cfg.boundary] {Number[]} Canvas-space Viewport boundary, given as\n (min, max, width, height). Defaults to the size of the parent\n {@link Scene} {@link Canvas}.\n @param [cfg.autoBoundary=false] {Boolean} Indicates if this Viewport's {@link Viewport#boundary}\n automatically synchronizes with the size of the parent {@link Scene} {@link Canvas}.\n\n @extends Component\n */\nimport {Component} from '../Component.js';\nimport {RenderState} from '../webgl/RenderState.js';\n\nclass Viewport extends Component {\n\n /**\n @private\n */\n get type() {\n return \"Viewport\";\n }\n\n /**\n @private\n */\n constructor(owner, cfg = {}) {\n\n super(owner, cfg);\n\n this._state = new RenderState({\n boundary: [0, 0, 100, 100]\n });\n\n this.boundary = cfg.boundary;\n this.autoBoundary = cfg.autoBoundary;\n }\n\n\n /**\n * Sets the canvas-space boundary of this Viewport, indicated as ````[min, max, width, height]````.\n *\n * When {@link Viewport#autoBoundary} is ````true````, ignores calls to this method and automatically synchronizes with {@link Canvas#boundary}.\n *\n * Fires a \"boundary\"\" event on change.\n *\n * Defaults to the {@link Canvas} extents.\n *\n * @param {Number[]} value New Viewport extents.\n */\n set boundary(value) {\n\n if (this._autoBoundary) {\n return;\n }\n\n if (!value) {\n\n const canvasBoundary = this.scene.canvas.boundary;\n\n const width = canvasBoundary[2];\n const height = canvasBoundary[3];\n\n value = [0, 0, width, height];\n }\n\n this._state.boundary = value;\n\n this.glRedraw();\n\n /**\n Fired whenever this Viewport's {@link Viewport#boundary} property changes.\n\n @event boundary\n @param value {Boolean} The property's new value\n */\n this.fire(\"boundary\", this._state.boundary);\n }\n\n /**\n * Gets the canvas-space boundary of this Viewport, indicated as ````[min, max, width, height]````.\n *\n * @returns {Number[]} The Viewport extents.\n */\n get boundary() {\n return this._state.boundary;\n }\n\n /**\n * Sets if {@link Viewport#boundary} automatically synchronizes with {@link Canvas#boundary}.\n *\n * Default is ````false````.\n *\n * @param {Boolean} value Set true to automatically sycnhronize.\n */\n set autoBoundary(value) {\n\n value = !!value;\n\n if (value === this._autoBoundary) {\n return;\n }\n\n this._autoBoundary = value;\n\n if (this._autoBoundary) {\n this._onCanvasSize = this.scene.canvas.on(\"boundary\",\n function (boundary) {\n\n const width = boundary[2];\n const height = boundary[3];\n\n this._state.boundary = [0, 0, width, height];\n\n this.glRedraw();\n\n /**\n Fired whenever this Viewport's {@link Viewport#boundary} property changes.\n\n @event boundary\n @param value {Boolean} The property's new value\n */\n this.fire(\"boundary\", this._state.boundary);\n\n }, this);\n\n } else if (this._onCanvasSize) {\n this.scene.canvas.off(this._onCanvasSize);\n this._onCanvasSize = null;\n }\n\n /**\n Fired whenever this Viewport's {@link autoBoundary/autoBoundary} property changes.\n\n @event autoBoundary\n @param value The property's new value\n */\n this.fire(\"autoBoundary\", this._autoBoundary);\n }\n\n /**\n * Gets if {@link Viewport#boundary} automatically synchronizes with {@link Canvas#boundary}.\n *\n * Default is ````false````.\n *\n * @returns {Boolean} Returns ````true```` when automatically sycnhronizing.\n */\n get autoBoundary() {\n return this._autoBoundary;\n }\n\n _getState() {\n return this._state;\n }\n\n /**\n * @private\n */\n destroy() {\n super.destroy();\n this._state.destroy();\n }\n}\n\nexport {Viewport};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/viewport/Viewport.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/viewport/Viewport.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8501, + "__docId__": 8509, "kind": "class", "name": "Viewport", "memberof": "src/viewer/scene/viewport/Viewport.js", @@ -168149,7 +168365,7 @@ ] }, { - "__docId__": 8502, + "__docId__": 8510, "kind": "get", "name": "type", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168168,7 +168384,7 @@ } }, { - "__docId__": 8503, + "__docId__": 8511, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168182,7 +168398,7 @@ "ignore": true }, { - "__docId__": 8504, + "__docId__": 8512, "kind": "member", "name": "_state", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168200,7 +168416,7 @@ } }, { - "__docId__": 8507, + "__docId__": 8515, "kind": "set", "name": "boundary", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168225,7 +168441,7 @@ ] }, { - "__docId__": 8508, + "__docId__": 8516, "kind": "get", "name": "boundary", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168257,7 +168473,7 @@ } }, { - "__docId__": 8509, + "__docId__": 8517, "kind": "set", "name": "autoBoundary", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168282,7 +168498,7 @@ ] }, { - "__docId__": 8510, + "__docId__": 8518, "kind": "member", "name": "_autoBoundary", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168300,7 +168516,7 @@ } }, { - "__docId__": 8511, + "__docId__": 8519, "kind": "member", "name": "_onCanvasSize", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168318,7 +168534,7 @@ } }, { - "__docId__": 8513, + "__docId__": 8521, "kind": "get", "name": "autoBoundary", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168350,7 +168566,7 @@ } }, { - "__docId__": 8514, + "__docId__": 8522, "kind": "method", "name": "_getState", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168371,7 +168587,7 @@ } }, { - "__docId__": 8515, + "__docId__": 8523, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/viewport/Viewport.js~Viewport", @@ -168387,18 +168603,18 @@ "return": null }, { - "__docId__": 8516, + "__docId__": 8524, "kind": "file", "name": "src/viewer/scene/webgl/ArrayBuf.js", "content": "/**\n * @desc Represents a WebGL ArrayBuffer.\n *\n * @private\n */\nclass ArrayBuf {\n\n constructor(gl, type, data, numItems, itemSize, usage, normalized, stride, offset) {\n\n this._gl = gl;\n this.type = type;\n this.allocated = false;\n\n switch (data.constructor) {\n\n case Uint8Array:\n this.itemType = gl.UNSIGNED_BYTE;\n this.itemByteSize = 1;\n break;\n\n case Int8Array:\n this.itemType = gl.BYTE;\n this.itemByteSize = 1;\n break;\n\n case Uint16Array:\n this.itemType = gl.UNSIGNED_SHORT;\n this.itemByteSize = 2;\n break;\n\n case Int16Array:\n this.itemType = gl.SHORT;\n this.itemByteSize = 2;\n break;\n\n case Uint32Array:\n this.itemType = gl.UNSIGNED_INT;\n this.itemByteSize = 4;\n break;\n\n case Int32Array:\n this.itemType = gl.INT;\n this.itemByteSize = 4;\n break;\n\n default:\n this.itemType = gl.FLOAT;\n this.itemByteSize = 4;\n }\n\n this.usage = usage;\n this.length = 0;\n this.dataLength = numItems;\n this.numItems = 0;\n this.itemSize = itemSize;\n this.normalized = !!normalized;\n this.stride = stride || 0;\n this.offset = offset || 0;\n\n this._allocate(data);\n }\n\n _allocate(data) {\n this.allocated = false;\n this._handle = this._gl.createBuffer();\n if (!this._handle) {\n throw \"Failed to allocate WebGL ArrayBuffer\";\n }\n if (this._handle) {\n this._gl.bindBuffer(this.type, this._handle);\n this._gl.bufferData(this.type, data.length > this.dataLength ? data.slice(0, this.dataLength) : data, this.usage);\n this._gl.bindBuffer(this.type, null);\n this.length = data.length;\n this.numItems = this.length / this.itemSize;\n this.allocated = true;\n }\n }\n\n setData(data, offset) {\n if (!this.allocated) {\n return;\n }\n if (data.length + (offset || 0) > this.length) { // Needs reallocation\n this.destroy();\n this._allocate(data);\n } else { // No reallocation needed\n this._gl.bindBuffer(this.type, this._handle);\n if (offset || offset === 0) {\n this._gl.bufferSubData(this.type, offset * this.itemByteSize, data);\n } else {\n this._gl.bufferData(this.type, data, this.usage);\n }\n this._gl.bindBuffer(this.type, null);\n }\n }\n\n bind() {\n if (!this.allocated) {\n return;\n }\n this._gl.bindBuffer(this.type, this._handle);\n }\n\n unbind() {\n if (!this.allocated) {\n return;\n }\n this._gl.bindBuffer(this.type, null);\n }\n\n destroy() {\n if (!this.allocated) {\n return;\n }\n this._gl.deleteBuffer(this._handle);\n this._handle = null;\n this.allocated = false;\n }\n}\n\nexport {ArrayBuf};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/ArrayBuf.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/ArrayBuf.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8517, + "__docId__": 8525, "kind": "class", "name": "ArrayBuf", "memberof": "src/viewer/scene/webgl/ArrayBuf.js", @@ -168414,7 +168630,7 @@ "ignore": true }, { - "__docId__": 8518, + "__docId__": 8526, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168428,7 +168644,7 @@ "undocument": true }, { - "__docId__": 8519, + "__docId__": 8527, "kind": "member", "name": "_gl", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168446,7 +168662,7 @@ } }, { - "__docId__": 8520, + "__docId__": 8528, "kind": "member", "name": "type", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168463,7 +168679,7 @@ } }, { - "__docId__": 8521, + "__docId__": 8529, "kind": "member", "name": "allocated", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168480,7 +168696,7 @@ } }, { - "__docId__": 8522, + "__docId__": 8530, "kind": "member", "name": "itemType", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168497,7 +168713,7 @@ } }, { - "__docId__": 8523, + "__docId__": 8531, "kind": "member", "name": "itemByteSize", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168514,7 +168730,7 @@ } }, { - "__docId__": 8536, + "__docId__": 8544, "kind": "member", "name": "usage", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168531,7 +168747,7 @@ } }, { - "__docId__": 8537, + "__docId__": 8545, "kind": "member", "name": "length", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168548,7 +168764,7 @@ } }, { - "__docId__": 8538, + "__docId__": 8546, "kind": "member", "name": "dataLength", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168565,7 +168781,7 @@ } }, { - "__docId__": 8539, + "__docId__": 8547, "kind": "member", "name": "numItems", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168582,7 +168798,7 @@ } }, { - "__docId__": 8540, + "__docId__": 8548, "kind": "member", "name": "itemSize", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168599,7 +168815,7 @@ } }, { - "__docId__": 8541, + "__docId__": 8549, "kind": "member", "name": "normalized", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168616,7 +168832,7 @@ } }, { - "__docId__": 8542, + "__docId__": 8550, "kind": "member", "name": "stride", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168633,7 +168849,7 @@ } }, { - "__docId__": 8543, + "__docId__": 8551, "kind": "member", "name": "offset", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168650,7 +168866,7 @@ } }, { - "__docId__": 8544, + "__docId__": 8552, "kind": "method", "name": "_allocate", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168674,7 +168890,7 @@ "return": null }, { - "__docId__": 8546, + "__docId__": 8554, "kind": "member", "name": "_handle", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168692,7 +168908,7 @@ } }, { - "__docId__": 8550, + "__docId__": 8558, "kind": "method", "name": "setData", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168721,7 +168937,7 @@ "return": null }, { - "__docId__": 8551, + "__docId__": 8559, "kind": "method", "name": "bind", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168737,7 +168953,7 @@ "return": null }, { - "__docId__": 8552, + "__docId__": 8560, "kind": "method", "name": "unbind", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168753,7 +168969,7 @@ "return": null }, { - "__docId__": 8553, + "__docId__": 8561, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/ArrayBuf.js~ArrayBuf", @@ -168769,18 +168985,18 @@ "return": null }, { - "__docId__": 8556, + "__docId__": 8564, "kind": "file", "name": "src/viewer/scene/webgl/Attribute.js", "content": "/**\n * @desc Represents a WebGL vertex attribute buffer (VBO).\n * @private\n * @param gl {WebGLRenderingContext} The WebGL rendering context.\n */\nclass Attribute {\n\n constructor(gl, location) {\n this._gl = gl;\n this.location = location;\n }\n\n bindArrayBuffer(arrayBuf) {\n if (!arrayBuf) {\n return;\n }\n arrayBuf.bind();\n this._gl.enableVertexAttribArray(this.location);\n this._gl.vertexAttribPointer(this.location, arrayBuf.itemSize, arrayBuf.itemType, arrayBuf.normalized, arrayBuf.stride, arrayBuf.offset);\n }\n}\n\nexport {Attribute};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Attribute.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Attribute.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8557, + "__docId__": 8565, "kind": "class", "name": "Attribute", "memberof": "src/viewer/scene/webgl/Attribute.js", @@ -168808,7 +169024,7 @@ "ignore": true }, { - "__docId__": 8558, + "__docId__": 8566, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/Attribute.js~Attribute", @@ -168822,7 +169038,7 @@ "undocument": true }, { - "__docId__": 8559, + "__docId__": 8567, "kind": "member", "name": "_gl", "memberof": "src/viewer/scene/webgl/Attribute.js~Attribute", @@ -168840,7 +169056,7 @@ } }, { - "__docId__": 8560, + "__docId__": 8568, "kind": "member", "name": "location", "memberof": "src/viewer/scene/webgl/Attribute.js~Attribute", @@ -168857,7 +169073,7 @@ } }, { - "__docId__": 8561, + "__docId__": 8569, "kind": "method", "name": "bindArrayBuffer", "memberof": "src/viewer/scene/webgl/Attribute.js~Attribute", @@ -168880,18 +169096,18 @@ "return": null }, { - "__docId__": 8562, + "__docId__": 8570, "kind": "file", "name": "src/viewer/scene/webgl/Drawable.js", "content": "/**\n * @desc A drawable {@link Scene} element.\n *\n * @interface\n * @abstract\n * @private\n */\nclass Drawable {\n\n /**\n * Returns true to indicate that this is a Drawable.\n * @type {Boolean}\n * @abstract\n */\n get isDrawable() {\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Emphasis materials\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Configures the appearance of this Drawable when x-rayed.\n *\n * Set to {@link Scene#xrayMaterial} by default.\n *\n * @type {EmphasisMaterial}\n * @abstract\n */\n get xrayMaterial() {\n }\n\n /**\n * Configures the appearance of this Drawable when highlighted.\n *\n * Set to {@link Scene#highlightMaterial} by default.\n *\n * @type {EmphasisMaterial}\n * @abstract\n */\n get highlightMaterial() {\n }\n\n /**\n * Configures the appearance of this Drawable when selected.\n *\n * Set to {@link Scene#selectedMaterial} by default.\n *\n * @type {EmphasisMaterial}\n * @abstract\n */\n get selectedMaterial() {\n }\n\n /**\n * Configures the appearance of this Drawable when edges are enhanced.\n *\n * @type {EdgeMaterial}\n * @abstract\n */\n get edgeMaterial() {\n }\n\n //------------------------------------------------------------------------------------------------------------------\n // Rendering\n //------------------------------------------------------------------------------------------------------------------\n\n /**\n * Property with final value ````true```` to indicate that xeokit should render this Drawable in sorted order, relative to other Drawable of the same class.\n *\n * The sort order is determined by {@link Drawable#stateSortCompare}.\n *\n * Sorting is essential for rendering performance, so that xeokit is able to avoid applying runs of the same state changes to the GPU, ie. can collapse them.\n *\n * @type {boolean}\n * @abstract\n */\n get isStateSortable() {\n }\n\n /**\n * Comparison function used by the renderer to determine the order in which xeokit should render the Drawable, relative to to other Drawablees.\n *\n * Sorting is essential for rendering performance, so that xeokit is able to avoid needlessly applying runs of the same rendering state changes to the GPU, ie. can collapse them.\n *\n * @param {Drawable} drawable1\n * @param {Drawable} drawable2\n * @returns {number}\n * @abstract\n */\n stateSortCompare(drawable1, drawable2) {\n }\n\n /**\n * Called by xeokit when about to render this Drawable, to generate {@link Drawable#renderFlags}.\n *\n * @abstract\n */\n rebuildRenderFlags(renderFlags) {\n }\n\n /**\n * Called by xeokit when about to render this Drawable, to get flags indicating what rendering effects to apply for it.\n * @type {RenderFlags}\n * @abstract\n */\n get renderFlags() {\n\n }\n\n // ---------------------- NORMAL RENDERING -----------------------------------\n\n /**\n * Renders opaque edges using {@link Drawable#edgeMaterial}.\n *\n * See {@link RenderFlags#colorOpaque}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawColorOpaque(renderFlags, frameCtx) {\n }\n\n /**\n * Renders transparent filled surfaces using normal appearance attributes.\n *\n * See {@link RenderFlags#colorTransparent}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawColorTransparent(renderFlags, frameCtx) {\n }\n\n // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------\n\n /**\n * Renders pixel depths to an internally-managed depth target, for use in post-effects (eg. SAO).\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawDepth(renderFlags, frameCtx) {\n }\n\n /**\n * Renders pixel normals to an internally-managed target, for use in post-effects (eg. SAO).\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawNormals(renderFlags, frameCtx) {\n }\n\n // ---------------------- EMPHASIS RENDERING -----------------------------------\n\n /**\n * Renders x-ray fill using {@link Drawable#xrayMaterial}.\n *\n * See {@link RenderFlags#xrayedSilhouetteOpaque} and {@link RenderFlags#xrayedSilhouetteTransparent}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawSilhouetteXRayed(renderFlags, frameCtx) {\n }\n\n /**\n * Renders highlighted transparent fill using {@link Drawable#highlightMaterial}.\n *\n * See {@link RenderFlags#highlightedSilhouetteOpaque} and {@link RenderFlags#highlightedSilhouetteTransparent}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawSilhouetteHighlighted(renderFlags, frameCtx) {\n }\n\n /**\n * Renders selected fill using {@link Drawable#selectedMaterial}.\n *\n * See {@link RenderFlags#selectedSilhouetteOpaque} and {@link RenderFlags#selectedSilhouetteTransparent}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawSilhouetteSelected(renderFlags, frameCtx) {\n }\n\n // ---------------------- EDGES RENDERING -----------------------------------\n\n /**\n * Renders opaque normal edges using {@link Drawable#edgeMaterial}.\n *\n * See {@link RenderFlags#edgesOpaque}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawEdgesColorOpaque(renderFlags, frameCtx) {\n }\n\n /**\n * Renders transparent normal edges using {@link Drawable#edgeMaterial}.\n *\n * See {@link RenderFlags#edgesTransparent}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawEdgesColorTransparent(renderFlags, frameCtx) {\n }\n\n /**\n * Renders x-rayed edges using {@link Drawable#xrayMaterial}.\n *\n * See {@link RenderFlags#xrayedEdgesOpaque}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawEdgesXRayed(renderFlags, frameCtx) {\n }\n\n /**\n * Renders highlighted edges using {@link Drawable#highlightMaterial}.\n *\n * See {@link RenderFlags#highlightedEdgesOpaque}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawEdgesHighlighted(renderFlags, frameCtx) {\n }\n\n /**\n * Renders selected edges using {@link Drawable#selectedMaterial}.\n *\n * See {@link RenderFlags#selectedEdgesOpaque}.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawEdgesSelected(renderFlags, frameCtx) {\n }\n\n // ---------------------- OCCLUSION CULL RENDERING -----------------------------------\n\n /**\n * Renders occludable elements to a frame buffer where they will be tested to see if they occlude any occlusion probe markers.\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawOcclusion(renderFlags, frameCtx) {\n }\n\n // ---------------------- SHADOW BUFFER RENDERING -----------------------------------\n\n /**\n * Renders depths to a shadow map buffer..\n *\n * @param {FrameContext} frameCtx Renderer frame context.\n * @abstract\n */\n drawShadow(renderFlags, frameCtx) {\n }\n}\n\nexport {Drawable};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Drawable.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Drawable.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8563, + "__docId__": 8571, "kind": "class", "name": "Drawable", "memberof": "src/viewer/scene/webgl/Drawable.js", @@ -168908,7 +169124,7 @@ "ignore": true }, { - "__docId__": 8564, + "__docId__": 8572, "kind": "get", "name": "isDrawable", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -168930,7 +169146,7 @@ "abstract": true }, { - "__docId__": 8565, + "__docId__": 8573, "kind": "get", "name": "xrayMaterial", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -168952,7 +169168,7 @@ "abstract": true }, { - "__docId__": 8566, + "__docId__": 8574, "kind": "get", "name": "highlightMaterial", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -168974,7 +169190,7 @@ "abstract": true }, { - "__docId__": 8567, + "__docId__": 8575, "kind": "get", "name": "selectedMaterial", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -168996,7 +169212,7 @@ "abstract": true }, { - "__docId__": 8568, + "__docId__": 8576, "kind": "get", "name": "edgeMaterial", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169018,7 +169234,7 @@ "abstract": true }, { - "__docId__": 8569, + "__docId__": 8577, "kind": "get", "name": "isStateSortable", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169040,7 +169256,7 @@ "abstract": true }, { - "__docId__": 8570, + "__docId__": 8578, "kind": "method", "name": "stateSortCompare", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169090,7 +169306,7 @@ "abstract": true }, { - "__docId__": 8571, + "__docId__": 8579, "kind": "method", "name": "rebuildRenderFlags", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169113,7 +169329,7 @@ "return": null }, { - "__docId__": 8572, + "__docId__": 8580, "kind": "get", "name": "renderFlags", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169135,7 +169351,7 @@ "abstract": true }, { - "__docId__": 8573, + "__docId__": 8581, "kind": "method", "name": "drawColorOpaque", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169162,7 +169378,7 @@ "return": null }, { - "__docId__": 8574, + "__docId__": 8582, "kind": "method", "name": "drawColorTransparent", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169189,7 +169405,7 @@ "return": null }, { - "__docId__": 8575, + "__docId__": 8583, "kind": "method", "name": "drawDepth", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169216,7 +169432,7 @@ "return": null }, { - "__docId__": 8576, + "__docId__": 8584, "kind": "method", "name": "drawNormals", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169243,7 +169459,7 @@ "return": null }, { - "__docId__": 8577, + "__docId__": 8585, "kind": "method", "name": "drawSilhouetteXRayed", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169270,7 +169486,7 @@ "return": null }, { - "__docId__": 8578, + "__docId__": 8586, "kind": "method", "name": "drawSilhouetteHighlighted", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169297,7 +169513,7 @@ "return": null }, { - "__docId__": 8579, + "__docId__": 8587, "kind": "method", "name": "drawSilhouetteSelected", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169324,7 +169540,7 @@ "return": null }, { - "__docId__": 8580, + "__docId__": 8588, "kind": "method", "name": "drawEdgesColorOpaque", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169351,7 +169567,7 @@ "return": null }, { - "__docId__": 8581, + "__docId__": 8589, "kind": "method", "name": "drawEdgesColorTransparent", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169378,7 +169594,7 @@ "return": null }, { - "__docId__": 8582, + "__docId__": 8590, "kind": "method", "name": "drawEdgesXRayed", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169405,7 +169621,7 @@ "return": null }, { - "__docId__": 8583, + "__docId__": 8591, "kind": "method", "name": "drawEdgesHighlighted", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169432,7 +169648,7 @@ "return": null }, { - "__docId__": 8584, + "__docId__": 8592, "kind": "method", "name": "drawEdgesSelected", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169459,7 +169675,7 @@ "return": null }, { - "__docId__": 8585, + "__docId__": 8593, "kind": "method", "name": "drawOcclusion", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169486,7 +169702,7 @@ "return": null }, { - "__docId__": 8586, + "__docId__": 8594, "kind": "method", "name": "drawShadow", "memberof": "src/viewer/scene/webgl/Drawable.js~Drawable", @@ -169513,18 +169729,18 @@ "return": null }, { - "__docId__": 8587, + "__docId__": 8595, "kind": "file", "name": "src/viewer/scene/webgl/FrameContext.js", "content": "import {math} from \"../math/math.js\";\nimport {createRTCViewMat} from \"../math/rtcCoords.js\";\n\n/**\n * @desc Provides rendering context to {@link Drawable\"}s as xeokit renders them for a frame.\n *\n * Also creates RTC viewing and picking matrices, caching and reusing matrices within each frame.\n *\n * @private\n */\nclass FrameContext {\n\n constructor(scene) {\n\n this._scene = scene;\n\n this._matPool = [];\n this._matPoolNextFreeIndex = 0;\n\n this._rtcViewMats = {};\n this._rtcPickViewMats = {};\n\n this.reset();\n }\n\n /**\n * Called by the renderer before each frame.\n * @private\n */\n reset() {\n\n this._matPoolNextFreeIndex = 0;\n this._rtcViewMats = {};\n this._rtcPickViewMats = {};\n\n /**\n * The WebGL rendering context.\n * @type {WebGLRenderingContext}\n */\n this.gl = this._scene.canvas.gl;\n\n /**\n * ID of the last {@link WebGLProgram} that was bound during the current frame.\n * @property lastProgramId\n * @type {Number}\n */\n this.lastProgramId = null;\n\n /**\n * Whether to render a physically-based representation for triangle surfaces.\n *\n * When ````false````, we'll render them with a fast vertex-shaded Gouraud-shaded representation, which\n * is great for zillions of objects.\n *\n * When ````true````, we'll render them at a better visual quality, using smooth, per-fragment shading\n * and a more realistic lighting model.\n *\n * @property quality\n * @default false\n * @type {Boolean}\n */\n this.pbrEnabled = false;\n\n /**\n * Whether to render color textures for triangle surfaces.\n *\n * @property quality\n * @default false\n * @type {Boolean}\n */\n this.colorTextureEnabled = false;\n\n /**\n * Whether SAO is currently enabled during the current frame.\n * @property withSAO\n * @default false\n * @type {Boolean}\n */\n this.withSAO = false;\n\n /**\n * Whether backfaces are currently enabled during the current frame.\n * @property backfaces\n * @default false\n * @type {Boolean}\n */\n this.backfaces = false;\n\n /**\n * The vertex winding order for what we currently consider to be a backface during current\n * frame: true == \"cw\", false == \"ccw\".\n * @property frontFace\n * @default true\n * @type {Boolean}\n */\n this.frontface = true;\n\n /**\n * The next available texture unit to bind a {@link Texture} to.\n * @defauilt 0\n * @property textureUnit\n * @type {number}\n */\n this.textureUnit = 0;\n\n /**\n * Performance statistic that counts how many times the renderer has called ````gl.drawElements()```` has been\n * called so far within the current frame.\n * @default 0\n * @property drawElements\n * @type {number}\n */\n this.drawElements = 0;\n\n /**\n * Performance statistic that counts how many times ````gl.drawArrays()```` has been called so far within\n * the current frame.\n * @default 0\n * @property drawArrays\n * @type {number}\n */\n this.drawArrays = 0;\n\n /**\n * Performance statistic that counts how many times ````gl.useProgram()```` has been called so far within\n * the current frame.\n * @default 0\n * @property useProgram\n * @type {number}\n */\n this.useProgram = 0;\n\n /**\n * Statistic that counts how many times ````gl.bindTexture()```` has been called so far within the current frame.\n * @default 0\n * @property bindTexture\n * @type {number}\n */\n this.bindTexture = 0;\n\n /**\n * Counts how many times the renderer has called ````gl.bindArray()```` so far within the current frame.\n * @defaulr 0\n * @property bindArray\n * @type {number}\n */\n this.bindArray = 0;\n\n /**\n * Indicates which pass the renderer is currently rendering.\n *\n * See {@link Scene/passes:property\"}}Scene#passes{{/crossLink}}, which configures how many passes we render\n * per frame, which typically set to ````2```` when rendering a stereo view.\n *\n * @property pass\n * @type {number}\n */\n this.pass = 0;\n\n /**\n * The 4x4 viewing transform matrix the renderer is currently using when rendering castsShadows.\n *\n * This sets the viewpoint to look from the point of view of each {@link DirLight}\n * or {@link PointLight} that casts a shadow.\n *\n * @property shadowViewMatrix\n * @type {Number[]}\n */\n this.shadowViewMatrix = null;\n\n /**\n * The 4x4 viewing projection matrix the renderer is currently using when rendering shadows.\n *\n * @property shadowProjMatrix\n * @type {Number[]}\n */\n this.shadowProjMatrix = null;\n\n /**\n * The 4x4 viewing transform matrix the renderer is currently using when rendering a ray-pick.\n *\n * This sets the viewpoint to look along the ray given to {@link Scene/pick:method\"}}Scene#pick(){{/crossLink}}\n * when picking with a ray.\n *\n * @property pickViewMatrix\n * @type {Number[]}\n */\n this.pickViewMatrix = null;\n\n /**\n * The 4x4 orthographic projection transform matrix the renderer is currently using when rendering a ray-pick.\n *\n * @property pickProjMatrix\n * @type {Number[]}\n */\n this.pickProjMatrix = null;\n\n /**\n * Distance to the near clipping plane when rendering depth fragments for GPU-accelerated 3D picking.\n *\n * @property pickZNear\n * @type {Number|*}\n */\n this.pickZNear = 0.01;\n\n /**\n * Distance to the far clipping plane when rendering depth fragments for GPU-accelerated 3D picking.\n *\n * @property pickZFar\n * @type {Number|*}\n */\n this.pickZFar = 5000;\n\n /**\n * Whether or not the renderer is currently picking invisible objects.\n *\n * @property pickInvisible\n * @type {Number}\n */\n this.pickInvisible = false;\n\n /**\n * Used to draw only requested elements / indices.\n *\n * @property pickElementsCount\n * @type {Number}\n */\n this.pickElementsCount = null;\n\n /**\n * Used to draw only requested elements / indices.\n *\n * @property pickElementsOffset\n * @type {Number}\n */\n this.pickElementsOffset = null;\n\n /** The current line width.\n *\n * @property lineWidth\n * @type Number\n */\n this.lineWidth = 1;\n\n /**\n * Collects info from SceneModel.drawSnapInit and SceneModel.drawSnap,\n * which is then used in Renderer to determine snap-picking results.\n *\n * @type {{}}\n */\n this.snapPickLayerParams = {};\n\n /**\n * Collects info from SceneModel.drawSnapInit and SceneModel.drawSnap,\n * which is then used in Renderer to determine snap-picking results.\n * @type {number}\n */\n this.snapPickLayerNumber = 0;\n\n /**\n * Collects info from SceneModel.drawSnapInit and SceneModel.drawSnap,\n * which is then used in Renderer to determine snap-picking results.\n * @type {Number[]}\n */\n this.snapPickCoordinateScale = math.vec3();\n\n /**\n * Collects info from SceneModel.drawSnapInit and SceneModel.drawSnap,\n * which is then used in Renderer to determine snap-picking results.\n * @type {Number[]}\n */\n this.snapPickOrigin = math.vec3();\n }\n\n /**\n * Get View matrix for the given RTC center.\n */\n getRTCViewMatrix(originHash, origin) {\n let rtcViewMat = this._rtcViewMats[originHash];\n if (!rtcViewMat) {\n rtcViewMat = this._getNewMat();\n createRTCViewMat(this._scene.camera.viewMatrix, origin, rtcViewMat);\n this._rtcViewMats[originHash] = rtcViewMat;\n }\n return rtcViewMat;\n }\n\n /**\n * Get picking View RTC matrix for the given RTC center.\n */\n getRTCPickViewMatrix(originHash, origin) {\n let rtcPickViewMat = this._rtcPickViewMats[originHash];\n if (!rtcPickViewMat) {\n rtcPickViewMat = this._getNewMat();\n const pickViewMat = this.pickViewMatrix || this._scene.camera.viewMatrix;\n createRTCViewMat(pickViewMat, origin, rtcPickViewMat);\n this._rtcPickViewMats[originHash] = rtcPickViewMat;\n }\n return rtcPickViewMat;\n }\n\n _getNewMat() {\n let mat = this._matPool[this._matPoolNextFreeIndex];\n if (!mat) {\n mat = math.mat4();\n this._matPool[this._matPoolNextFreeIndex] = mat;\n }\n this._matPoolNextFreeIndex++;\n return mat;\n }\n}\n\nexport {FrameContext};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/FrameContext.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/FrameContext.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8588, + "__docId__": 8596, "kind": "class", "name": "FrameContext", "memberof": "src/viewer/scene/webgl/FrameContext.js", @@ -169540,7 +169756,7 @@ "ignore": true }, { - "__docId__": 8589, + "__docId__": 8597, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169554,7 +169770,7 @@ "undocument": true }, { - "__docId__": 8590, + "__docId__": 8598, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169572,7 +169788,7 @@ } }, { - "__docId__": 8591, + "__docId__": 8599, "kind": "member", "name": "_matPool", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169590,7 +169806,7 @@ } }, { - "__docId__": 8592, + "__docId__": 8600, "kind": "member", "name": "_matPoolNextFreeIndex", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169608,7 +169824,7 @@ } }, { - "__docId__": 8593, + "__docId__": 8601, "kind": "member", "name": "_rtcViewMats", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169626,7 +169842,7 @@ } }, { - "__docId__": 8594, + "__docId__": 8602, "kind": "member", "name": "_rtcPickViewMats", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169644,7 +169860,7 @@ } }, { - "__docId__": 8595, + "__docId__": 8603, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169660,7 +169876,7 @@ "return": null }, { - "__docId__": 8599, + "__docId__": 8607, "kind": "member", "name": "gl", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169679,7 +169895,7 @@ } }, { - "__docId__": 8600, + "__docId__": 8608, "kind": "member", "name": "lastProgramId", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169710,7 +169926,7 @@ } }, { - "__docId__": 8601, + "__docId__": 8609, "kind": "member", "name": "pbrEnabled", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169747,7 +169963,7 @@ } }, { - "__docId__": 8602, + "__docId__": 8610, "kind": "member", "name": "colorTextureEnabled", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169784,7 +170000,7 @@ } }, { - "__docId__": 8603, + "__docId__": 8611, "kind": "member", "name": "withSAO", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169821,7 +170037,7 @@ } }, { - "__docId__": 8604, + "__docId__": 8612, "kind": "member", "name": "backfaces", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169858,7 +170074,7 @@ } }, { - "__docId__": 8605, + "__docId__": 8613, "kind": "member", "name": "frontface", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169895,7 +170111,7 @@ } }, { - "__docId__": 8606, + "__docId__": 8614, "kind": "member", "name": "textureUnit", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169932,7 +170148,7 @@ } }, { - "__docId__": 8607, + "__docId__": 8615, "kind": "member", "name": "drawElements", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -169969,7 +170185,7 @@ } }, { - "__docId__": 8608, + "__docId__": 8616, "kind": "member", "name": "drawArrays", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170006,7 +170222,7 @@ } }, { - "__docId__": 8609, + "__docId__": 8617, "kind": "member", "name": "useProgram", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170043,7 +170259,7 @@ } }, { - "__docId__": 8610, + "__docId__": 8618, "kind": "member", "name": "bindTexture", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170080,7 +170296,7 @@ } }, { - "__docId__": 8611, + "__docId__": 8619, "kind": "member", "name": "bindArray", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170117,7 +170333,7 @@ } }, { - "__docId__": 8612, + "__docId__": 8620, "kind": "member", "name": "pass", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170148,7 +170364,7 @@ } }, { - "__docId__": 8613, + "__docId__": 8621, "kind": "member", "name": "shadowViewMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170179,7 +170395,7 @@ } }, { - "__docId__": 8614, + "__docId__": 8622, "kind": "member", "name": "shadowProjMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170210,7 +170426,7 @@ } }, { - "__docId__": 8615, + "__docId__": 8623, "kind": "member", "name": "pickViewMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170241,7 +170457,7 @@ } }, { - "__docId__": 8616, + "__docId__": 8624, "kind": "member", "name": "pickProjMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170272,7 +170488,7 @@ } }, { - "__docId__": 8617, + "__docId__": 8625, "kind": "member", "name": "pickZNear", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170304,7 +170520,7 @@ } }, { - "__docId__": 8618, + "__docId__": 8626, "kind": "member", "name": "pickZFar", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170336,7 +170552,7 @@ } }, { - "__docId__": 8619, + "__docId__": 8627, "kind": "member", "name": "pickInvisible", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170367,7 +170583,7 @@ } }, { - "__docId__": 8620, + "__docId__": 8628, "kind": "member", "name": "pickElementsCount", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170398,7 +170614,7 @@ } }, { - "__docId__": 8621, + "__docId__": 8629, "kind": "member", "name": "pickElementsOffset", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170429,7 +170645,7 @@ } }, { - "__docId__": 8622, + "__docId__": 8630, "kind": "member", "name": "lineWidth", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170460,7 +170676,7 @@ } }, { - "__docId__": 8623, + "__docId__": 8631, "kind": "member", "name": "snapPickLayerParams", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170479,7 +170695,7 @@ } }, { - "__docId__": 8624, + "__docId__": 8632, "kind": "member", "name": "snapPickLayerNumber", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170498,7 +170714,7 @@ } }, { - "__docId__": 8625, + "__docId__": 8633, "kind": "member", "name": "snapPickCoordinateScale", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170517,7 +170733,7 @@ } }, { - "__docId__": 8626, + "__docId__": 8634, "kind": "member", "name": "snapPickOrigin", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170536,7 +170752,7 @@ } }, { - "__docId__": 8627, + "__docId__": 8635, "kind": "method", "name": "getRTCViewMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170568,7 +170784,7 @@ } }, { - "__docId__": 8628, + "__docId__": 8636, "kind": "method", "name": "getRTCPickViewMatrix", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170600,7 +170816,7 @@ } }, { - "__docId__": 8629, + "__docId__": 8637, "kind": "method", "name": "_getNewMat", "memberof": "src/viewer/scene/webgl/FrameContext.js~FrameContext", @@ -170621,18 +170837,18 @@ } }, { - "__docId__": 8630, + "__docId__": 8638, "kind": "file", "name": "src/viewer/scene/webgl/PickResult.js", "content": "/**\n * @desc Pick result returned by {@link Scene#pick}.\n *\n */\nclass PickResult {\n\n /**\n * @private\n */\n constructor() {\n\n /**\n * Picked entity.\n * Null when no entity was picked.\n * @property entity\n * @type {Entity|*}\n */\n this.entity = null;\n\n /**\n * Type of primitive that was picked - usually \"triangle\".\n * Null when no primitive was picked.\n * @property primitive\n * @type {String}\n */\n this.primitive = null;\n\n /**\n * Index of primitive that was picked.\n * -1 when no entity was picked.\n * @property primIndex\n * @type {number}\n */\n this.primIndex = -1;\n\n /**\n * True when the picked surface position is full precision.\n * When false, the picked surface position should be regarded as approximate.\n * Full-precision surface picking is performed with the {@link Scene#pick} method's ````pickSurfacePrecision```` option.\n * @property pickSurfacePrecision\n * @type {Boolean}\n */\n this.pickSurfacePrecision = false;\n\n /**\n * True when picked from touch input, else false when from mouse input.\n * @type {boolean}\n */\n this.touchInput = false;\n\n /**\n * True when snapped to nearest edge.\n * @type {boolean}\n */\n this.snappedToEdge = false;\n\n /**\n * True when snapped to nearest vertex.\n * @type {boolean}\n */\n this.snappedToVertex = false;\n\n this._origin = new Float64Array([0, 0, 0]);\n this._direction = new Float64Array([0, 0, 0]);\n this._indices = new Int32Array(3);\n this._localPos = new Float64Array([0, 0, 0]);\n this._worldPos = new Float64Array([0, 0, 0]);\n this._viewPos = new Float64Array([0, 0, 0]);\n this._canvasPos = new Int16Array([0, 0]);\n this._snappedCanvasPos = new Int16Array([0, 0]);\n this._bary = new Float64Array([0, 0, 0]);\n this._worldNormal = new Float64Array([0, 0, 0]);\n this._uv = new Float64Array([0, 0]);\n\n this.reset();\n }\n\n /**\n * Canvas pick coordinates.\n * @property canvasPos\n * @type {Number[]}\n */\n get canvasPos() {\n return this._gotCanvasPos ? this._canvasPos : null;\n }\n\n /**\n * @private\n * @param value\n */\n set canvasPos(value) {\n if (value) {\n this._canvasPos[0] = value[0];\n this._canvasPos[1] = value[1];\n this._gotCanvasPos = true;\n } else {\n this._gotCanvasPos = false;\n }\n }\n\n /**\n * World-space 3D ray origin when raypicked.\n * @property origin\n * @type {Number[]}\n */\n get origin() {\n return this._gotOrigin ? this._origin : null;\n }\n\n /**\n * @private\n * @param value\n */\n set origin(value) {\n if (value) {\n this._origin[0] = value[0];\n this._origin[1] = value[1];\n this._origin[2] = value[2];\n this._gotOrigin = true;\n } else {\n this._gotOrigin = false;\n }\n }\n\n /**\n * World-space 3D ray direction when raypicked.\n * @property direction\n * @type {Number[]}\n */\n get direction() {\n return this._gotDirection ? this._direction : null;\n }\n\n /**\n * @private\n * @param value\n */\n set direction(value) {\n if (value) {\n this._direction[0] = value[0];\n this._direction[1] = value[1];\n this._direction[2] = value[2];\n this._gotDirection = true;\n } else {\n this._gotDirection = false;\n }\n }\n \n /**\n * Picked triangle's vertex indices.\n * @property indices\n * @type {Int32Array}\n */\n get indices() {\n return this.entity && this._gotIndices ? this._indices : null;\n }\n\n /**\n * @private\n * @param value\n */\n set indices(value) {\n if (value) {\n this._indices[0] = value[0];\n this._indices[1] = value[1];\n this._indices[2] = value[2];\n this._gotIndices = true;\n } else {\n this._gotIndices = false;\n }\n }\n\n /**\n * Picked Local-space point.\n * @property localPos\n * @type {Number[]}\n */\n get localPos() {\n return this.entity && this._gotLocalPos ? this._localPos : null;\n }\n\n /**\n * @private\n * @param value\n */\n set localPos(value) {\n if (value) {\n this._localPos[0] = value[0];\n this._localPos[1] = value[1];\n this._localPos[2] = value[2];\n this._gotLocalPos = true;\n } else {\n this._gotLocalPos = false;\n }\n }\n\n /**\n * Canvas cursor coordinates, snapped when snap picking, otherwise same as {@link PickResult#pointerPos}.\n * @property snappedCanvasPos\n * @type {Number[]}\n */\n get snappedCanvasPos() {\n return this._gotSnappedCanvasPos ? this._snappedCanvasPos : null;\n }\n\n /**\n * @private\n * @param value\n */\n set snappedCanvasPos(value) {\n if (value) {\n this._snappedCanvasPos[0] = value[0];\n this._snappedCanvasPos[1] = value[1];\n this._gotSnappedCanvasPos = true;\n } else {\n this._gotSnappedCanvasPos = false;\n }\n }\n\n /**\n * Picked World-space point.\n * @property worldPos\n * @type {Number[]}\n */\n get worldPos() {\n return this._gotWorldPos ? this._worldPos : null;\n }\n\n /**\n * @private\n * @param value\n */\n set worldPos(value) {\n if (value) {\n this._worldPos[0] = value[0];\n this._worldPos[1] = value[1];\n this._worldPos[2] = value[2];\n this._gotWorldPos = true;\n } else {\n this._gotWorldPos = false;\n }\n }\n\n /**\n * Picked View-space point.\n * @property viewPos\n * @type {Number[]}\n */\n get viewPos() {\n return this.entity && this._gotViewPos ? this._viewPos : null;\n }\n\n /**\n * @private\n * @param value\n */\n set viewPos(value) {\n if (value) {\n this._viewPos[0] = value[0];\n this._viewPos[1] = value[1];\n this._viewPos[2] = value[2];\n this._gotViewPos = true;\n } else {\n this._gotViewPos = false;\n }\n }\n\n /**\n * Barycentric coordinate within picked triangle.\n * @property bary\n * @type {Number[]}\n */\n get bary() {\n return this.entity && this._gotBary ? this._bary : null;\n }\n\n /**\n * @private\n * @param value\n */\n set bary(value) {\n if (value) {\n this._bary[0] = value[0];\n this._bary[1] = value[1];\n this._bary[2] = value[2];\n this._gotBary = true;\n } else {\n this._gotBary = false;\n }\n }\n\n /**\n * Normal vector at picked position on surface.\n * @property worldNormal\n * @type {Number[]}\n */\n get worldNormal() {\n return this.entity && this._gotWorldNormal ? this._worldNormal : null;\n }\n\n /**\n * @private\n * @param value\n */\n set worldNormal(value) {\n if (value) {\n this._worldNormal[0] = value[0];\n this._worldNormal[1] = value[1];\n this._worldNormal[2] = value[2];\n this._gotWorldNormal = true;\n } else {\n this._gotWorldNormal = false;\n }\n }\n\n /**\n * UV coordinates at picked position on surface.\n * @property uv\n * @type {Number[]}\n */\n get uv() {\n return this.entity && this._gotUV ? this._uv : null;\n }\n\n /**\n * @private\n * @param value\n */\n set uv(value) {\n if (value) {\n this._uv[0] = value[0];\n this._uv[1] = value[1];\n this._gotUV = true;\n } else {\n this._gotUV = false;\n }\n }\n\n /**\n * True if snapped to edge or vertex.\n * @returns {boolean}\n */\n get snapped() {\n return this.snappedToEdge || this.snappedToVertex;\n }\n\n /**\n * @private\n */\n reset() {\n this.entity = null;\n this.primIndex = -1;\n this.primitive = null;\n this.pickSurfacePrecision = false;\n this._gotCanvasPos = false;\n this._gotSnappedCanvasPos = false;\n this._gotOrigin = false;\n this._gotDirection = false;\n this._gotIndices = false;\n this._gotLocalPos = false;\n this._gotWorldPos = false;\n this._gotViewPos = false;\n this._gotBary = false;\n this._gotWorldNormal = false;\n this._gotUV = false;\n this.touchInput = false;\n this.snappedToEdge = false;\n this.snappedToVertex = false;\n }\n}\n\nexport {PickResult};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/PickResult.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/PickResult.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8631, + "__docId__": 8639, "kind": "class", "name": "PickResult", "memberof": "src/viewer/scene/webgl/PickResult.js", @@ -170647,7 +170863,7 @@ "interface": false }, { - "__docId__": 8632, + "__docId__": 8640, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170661,7 +170877,7 @@ "ignore": true }, { - "__docId__": 8633, + "__docId__": 8641, "kind": "member", "name": "entity", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170693,7 +170909,7 @@ } }, { - "__docId__": 8634, + "__docId__": 8642, "kind": "member", "name": "primitive", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170724,7 +170940,7 @@ } }, { - "__docId__": 8635, + "__docId__": 8643, "kind": "member", "name": "primIndex", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170755,7 +170971,7 @@ } }, { - "__docId__": 8636, + "__docId__": 8644, "kind": "member", "name": "pickSurfacePrecision", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170786,7 +171002,7 @@ } }, { - "__docId__": 8637, + "__docId__": 8645, "kind": "member", "name": "touchInput", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170805,7 +171021,7 @@ } }, { - "__docId__": 8638, + "__docId__": 8646, "kind": "member", "name": "snappedToEdge", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170824,7 +171040,7 @@ } }, { - "__docId__": 8639, + "__docId__": 8647, "kind": "member", "name": "snappedToVertex", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170843,7 +171059,7 @@ } }, { - "__docId__": 8640, + "__docId__": 8648, "kind": "member", "name": "_origin", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170861,7 +171077,7 @@ } }, { - "__docId__": 8641, + "__docId__": 8649, "kind": "member", "name": "_direction", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170879,7 +171095,7 @@ } }, { - "__docId__": 8642, + "__docId__": 8650, "kind": "member", "name": "_indices", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170897,7 +171113,7 @@ } }, { - "__docId__": 8643, + "__docId__": 8651, "kind": "member", "name": "_localPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170915,7 +171131,7 @@ } }, { - "__docId__": 8644, + "__docId__": 8652, "kind": "member", "name": "_worldPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170933,7 +171149,7 @@ } }, { - "__docId__": 8645, + "__docId__": 8653, "kind": "member", "name": "_viewPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170951,7 +171167,7 @@ } }, { - "__docId__": 8646, + "__docId__": 8654, "kind": "member", "name": "_canvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170969,7 +171185,7 @@ } }, { - "__docId__": 8647, + "__docId__": 8655, "kind": "member", "name": "_snappedCanvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -170987,7 +171203,7 @@ } }, { - "__docId__": 8648, + "__docId__": 8656, "kind": "member", "name": "_bary", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171005,7 +171221,7 @@ } }, { - "__docId__": 8649, + "__docId__": 8657, "kind": "member", "name": "_worldNormal", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171023,7 +171239,7 @@ } }, { - "__docId__": 8650, + "__docId__": 8658, "kind": "member", "name": "_uv", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171041,7 +171257,7 @@ } }, { - "__docId__": 8651, + "__docId__": 8659, "kind": "get", "name": "canvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171074,7 +171290,7 @@ } }, { - "__docId__": 8652, + "__docId__": 8660, "kind": "set", "name": "canvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171100,7 +171316,7 @@ "ignore": true }, { - "__docId__": 8653, + "__docId__": 8661, "kind": "member", "name": "_gotCanvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171118,7 +171334,7 @@ } }, { - "__docId__": 8655, + "__docId__": 8663, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171151,7 +171367,7 @@ } }, { - "__docId__": 8656, + "__docId__": 8664, "kind": "set", "name": "origin", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171177,7 +171393,7 @@ "ignore": true }, { - "__docId__": 8657, + "__docId__": 8665, "kind": "member", "name": "_gotOrigin", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171195,7 +171411,7 @@ } }, { - "__docId__": 8659, + "__docId__": 8667, "kind": "get", "name": "direction", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171228,7 +171444,7 @@ } }, { - "__docId__": 8660, + "__docId__": 8668, "kind": "set", "name": "direction", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171254,7 +171470,7 @@ "ignore": true }, { - "__docId__": 8661, + "__docId__": 8669, "kind": "member", "name": "_gotDirection", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171272,7 +171488,7 @@ } }, { - "__docId__": 8663, + "__docId__": 8671, "kind": "get", "name": "indices", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171305,7 +171521,7 @@ } }, { - "__docId__": 8664, + "__docId__": 8672, "kind": "set", "name": "indices", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171331,7 +171547,7 @@ "ignore": true }, { - "__docId__": 8665, + "__docId__": 8673, "kind": "member", "name": "_gotIndices", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171349,7 +171565,7 @@ } }, { - "__docId__": 8667, + "__docId__": 8675, "kind": "get", "name": "localPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171382,7 +171598,7 @@ } }, { - "__docId__": 8668, + "__docId__": 8676, "kind": "set", "name": "localPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171408,7 +171624,7 @@ "ignore": true }, { - "__docId__": 8669, + "__docId__": 8677, "kind": "member", "name": "_gotLocalPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171426,7 +171642,7 @@ } }, { - "__docId__": 8671, + "__docId__": 8679, "kind": "get", "name": "snappedCanvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171459,7 +171675,7 @@ } }, { - "__docId__": 8672, + "__docId__": 8680, "kind": "set", "name": "snappedCanvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171485,7 +171701,7 @@ "ignore": true }, { - "__docId__": 8673, + "__docId__": 8681, "kind": "member", "name": "_gotSnappedCanvasPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171503,7 +171719,7 @@ } }, { - "__docId__": 8675, + "__docId__": 8683, "kind": "get", "name": "worldPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171536,7 +171752,7 @@ } }, { - "__docId__": 8676, + "__docId__": 8684, "kind": "set", "name": "worldPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171562,7 +171778,7 @@ "ignore": true }, { - "__docId__": 8677, + "__docId__": 8685, "kind": "member", "name": "_gotWorldPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171580,7 +171796,7 @@ } }, { - "__docId__": 8679, + "__docId__": 8687, "kind": "get", "name": "viewPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171613,7 +171829,7 @@ } }, { - "__docId__": 8680, + "__docId__": 8688, "kind": "set", "name": "viewPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171639,7 +171855,7 @@ "ignore": true }, { - "__docId__": 8681, + "__docId__": 8689, "kind": "member", "name": "_gotViewPos", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171657,7 +171873,7 @@ } }, { - "__docId__": 8683, + "__docId__": 8691, "kind": "get", "name": "bary", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171690,7 +171906,7 @@ } }, { - "__docId__": 8684, + "__docId__": 8692, "kind": "set", "name": "bary", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171716,7 +171932,7 @@ "ignore": true }, { - "__docId__": 8685, + "__docId__": 8693, "kind": "member", "name": "_gotBary", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171734,7 +171950,7 @@ } }, { - "__docId__": 8687, + "__docId__": 8695, "kind": "get", "name": "worldNormal", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171767,7 +171983,7 @@ } }, { - "__docId__": 8688, + "__docId__": 8696, "kind": "set", "name": "worldNormal", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171793,7 +172009,7 @@ "ignore": true }, { - "__docId__": 8689, + "__docId__": 8697, "kind": "member", "name": "_gotWorldNormal", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171811,7 +172027,7 @@ } }, { - "__docId__": 8691, + "__docId__": 8699, "kind": "get", "name": "uv", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171844,7 +172060,7 @@ } }, { - "__docId__": 8692, + "__docId__": 8700, "kind": "set", "name": "uv", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171870,7 +172086,7 @@ "ignore": true }, { - "__docId__": 8693, + "__docId__": 8701, "kind": "member", "name": "_gotUV", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171888,7 +172104,7 @@ } }, { - "__docId__": 8695, + "__docId__": 8703, "kind": "get", "name": "snapped", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171920,7 +172136,7 @@ } }, { - "__docId__": 8696, + "__docId__": 8704, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/webgl/PickResult.js~PickResult", @@ -171936,18 +172152,18 @@ "return": null }, { - "__docId__": 8715, + "__docId__": 8723, "kind": "file", "name": "src/viewer/scene/webgl/Pickable.js", "content": "/**\n * @desc A pickable {@link Scene} element.\n *\n * @interface\n * @abstract\n * @private\n */\nclass Pickable {\n\n /**\n * Called by xeokit to get if it's possible to pick a triangle on the surface of this Drawable.\n */\n canPickTriangle() {\n }\n\n /**\n * Picks a triangle on this Pickable.\n */\n drawPickTriangles(renderFlags, frameCtx) {\n }\n\n /**\n * Given a {@link PickResult} that contains a {@link PickResult#primIndex}, which indicates that a primitive was picked on the Pickable, then add more information to the PickResult about the picked position on the surface of the Pickable.\n *\n * Architecturally, this delegates collection of that Pickable-specific info to the Pickable, allowing it to provide whatever info it's able to.\n *\n * @param {PickResult} pickResult The PickResult to augment with pick intersection information specific to this Mesh.\n * @param [pickResult.primIndex] Index of the primitive that was picked on this Mesh.\n * @param [pickResult.canvasPos] Canvas coordinates, provided when picking through the Canvas.\n * @param [pickResult.origin] World-space 3D ray origin, when ray picking.\n * @param [pickResult.direction] World-space 3D ray direction, provided when ray picking.\n */\n pickTriangleSurface(pickResult) {\n }\n\n /**\n * Called by xeokit to get if it's possible to pick a 3D point on the surface of this Pickable.\n * Returns false if canPickTriangle returns true, and vice-versa.\n */\n canPickWorldPos() {\n }\n\n /**\n * Renders color-encoded fragment depths of this Pickable.\n * @param frameCtx\n */\n drawPickDepths(renderFlags, frameCtx) {\n }\n\n /**\n * Delegates an {@link Entity} as representing what was actually picked in place of this Pickable.\n * @returns {PerformanceNode}\n */\n delegatePickedEntity() {\n return this.parent;\n }\n\n /**\n * 3D origin of the Pickable's vertex positions, if they are in relative-to-center (RTC) coordinates.\n *\n * When this is defined, then the positions are RTC, which means that they are relative to this position.\n *\n * @type {Float64Array}\n */\n get origin() {\n }\n}\n\nexport {Pickable};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Pickable.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Pickable.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8716, + "__docId__": 8724, "kind": "class", "name": "Pickable", "memberof": "src/viewer/scene/webgl/Pickable.js", @@ -171964,7 +172180,7 @@ "ignore": true }, { - "__docId__": 8717, + "__docId__": 8725, "kind": "method", "name": "canPickTriangle", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -171979,7 +172195,7 @@ "return": null }, { - "__docId__": 8718, + "__docId__": 8726, "kind": "method", "name": "drawPickTriangles", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172007,7 +172223,7 @@ "return": null }, { - "__docId__": 8719, + "__docId__": 8727, "kind": "method", "name": "pickTriangleSurface", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172073,7 +172289,7 @@ "return": null }, { - "__docId__": 8720, + "__docId__": 8728, "kind": "method", "name": "canPickWorldPos", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172088,7 +172304,7 @@ "return": null }, { - "__docId__": 8721, + "__docId__": 8729, "kind": "method", "name": "drawPickDepths", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172114,7 +172330,7 @@ "return": null }, { - "__docId__": 8722, + "__docId__": 8730, "kind": "method", "name": "delegatePickedEntity", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172142,7 +172358,7 @@ "params": [] }, { - "__docId__": 8723, + "__docId__": 8731, "kind": "get", "name": "origin", "memberof": "src/viewer/scene/webgl/Pickable.js~Pickable", @@ -172163,18 +172379,18 @@ } }, { - "__docId__": 8724, + "__docId__": 8732, "kind": "file", "name": "src/viewer/scene/webgl/Program.js", "content": "import {Map} from \"../utils/Map.js\";\nimport {Shader} from \"./Shader.js\";\nimport {Sampler} from \"./Sampler.js\";\nimport {Attribute} from \"./Attribute.js\";\n\nconst ids = new Map({});\n\nfunction joinSansComments(srcLines) {\n const src = [];\n let line;\n let n;\n for (let i = 0, len = srcLines.length; i < len; i++) {\n line = srcLines[i];\n n = line.indexOf(\"/\");\n if (n > 0) {\n if (line.charAt(n + 1) === \"/\") {\n line = line.substring(0, n);\n }\n }\n src.push(line);\n }\n return src.join(\"\\n\");\n}\n\nfunction logErrors(errors) {\n console.error(errors.join(\"\\n\"));\n}\n\n/**\n * @desc Represents a WebGL program.\n * @private\n */\nclass Program {\n\n constructor(gl, shaderSource) {\n this.id = ids.addItem({});\n this.source = shaderSource;\n this.init(gl);\n }\n\n init(gl) {\n this.gl = gl;\n this.allocated = false;\n this.compiled = false;\n this.linked = false;\n this.validated = false;\n this.errors = null;\n this.uniforms = {};\n this.samplers = {};\n this.attributes = {};\n this._vertexShader = new Shader(gl, gl.VERTEX_SHADER, joinSansComments(this.source.vertex));\n this._fragmentShader = new Shader(gl, gl.FRAGMENT_SHADER, joinSansComments(this.source.fragment));\n if (!this._vertexShader.allocated) {\n this.errors = [\"Vertex shader failed to allocate\"].concat(this._vertexShader.errors);\n logErrors(this.errors);\n return;\n }\n if (!this._fragmentShader.allocated) {\n this.errors = [\"Fragment shader failed to allocate\"].concat(this._fragmentShader.errors);\n logErrors(this.errors);\n return;\n }\n this.allocated = true;\n if (!this._vertexShader.compiled) {\n this.errors = [\"Vertex shader failed to compile\"].concat(this._vertexShader.errors);\n logErrors(this.errors);\n return;\n }\n if (!this._fragmentShader.compiled) {\n this.errors = [\"Fragment shader failed to compile\"].concat(this._fragmentShader.errors);\n logErrors(this.errors);\n return;\n }\n this.compiled = true;\n let a;\n let i;\n let u;\n let uName;\n let location;\n this.handle = gl.createProgram();\n if (!this.handle) {\n this.errors = [\"Failed to allocate program\"];\n return;\n }\n gl.attachShader(this.handle, this._vertexShader.handle);\n gl.attachShader(this.handle, this._fragmentShader.handle);\n gl.linkProgram(this.handle);\n this.linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);\n // HACK: Disable validation temporarily\n // Perhaps we should defer validation until render-time, when the program has values set for all inputs?\n this.validated = true;\n if (!this.linked || !this.validated) {\n this.errors = [];\n this.errors.push(\"\");\n this.errors.push(gl.getProgramInfoLog(this.handle));\n this.errors.push(\"\\nVertex shader:\\n\");\n this.errors = this.errors.concat(this.source.vertex);\n this.errors.push(\"\\nFragment shader:\\n\");\n this.errors = this.errors.concat(this.source.fragment);\n logErrors(this.errors);\n return;\n }\n const numUniforms = gl.getProgramParameter(this.handle, gl.ACTIVE_UNIFORMS);\n for (i = 0; i < numUniforms; ++i) {\n u = gl.getActiveUniform(this.handle, i);\n if (u) {\n uName = u.name;\n if (uName[uName.length - 1] === \"\\u0000\") {\n uName = uName.substr(0, uName.length - 1);\n }\n location = gl.getUniformLocation(this.handle, uName);\n if ((u.type === gl.SAMPLER_2D) || (u.type === gl.SAMPLER_CUBE) || (u.type === 35682)) {\n this.samplers[uName] = new Sampler(gl, location);\n } else if (gl instanceof WebGL2RenderingContext && (u.type === gl.UNSIGNED_INT_SAMPLER_2D || u.type === gl.INT_SAMPLER_2D)) {\n this.samplers[uName] = new Sampler(gl, location);\n } else {\n this.uniforms[uName] = location;\n }\n }\n }\n const numAttribs = gl.getProgramParameter(this.handle, gl.ACTIVE_ATTRIBUTES);\n for (i = 0; i < numAttribs; i++) {\n a = gl.getActiveAttrib(this.handle, i);\n if (a) {\n location = gl.getAttribLocation(this.handle, a.name);\n this.attributes[a.name] = new Attribute(gl, location);\n }\n }\n this.allocated = true;\n }\n\n bind() {\n if (!this.allocated) {\n return;\n }\n this.gl.useProgram(this.handle);\n }\n\n getLocation(name) {\n if (!this.allocated) {\n return;\n }\n return this.uniforms[name];\n }\n\n getAttribute(name) {\n if (!this.allocated) {\n return;\n }\n return this.attributes[name];\n }\n\n bindTexture(name, texture, unit) {\n if (!this.allocated) {\n return false;\n }\n const sampler = this.samplers[name];\n if (sampler) {\n return sampler.bindTexture(texture, unit);\n } else {\n return false;\n }\n }\n\n destroy() {\n if (!this.allocated) {\n return;\n }\n ids.removeItem(this.id);\n this.gl.deleteProgram(this.handle);\n this.gl.deleteShader(this._vertexShader.handle);\n this.gl.deleteShader(this._fragmentShader.handle);\n this.handle = null;\n this.attributes = null;\n this.uniforms = null;\n this.samplers = null;\n this.allocated = false;\n }\n}\n\nexport {Program};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Program.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Program.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8725, + "__docId__": 8733, "kind": "variable", "name": "ids", "memberof": "src/viewer/scene/webgl/Program.js", @@ -172195,7 +172411,7 @@ "ignore": true }, { - "__docId__": 8726, + "__docId__": 8734, "kind": "function", "name": "joinSansComments", "memberof": "src/viewer/scene/webgl/Program.js", @@ -172226,7 +172442,7 @@ "ignore": true }, { - "__docId__": 8727, + "__docId__": 8735, "kind": "function", "name": "logErrors", "memberof": "src/viewer/scene/webgl/Program.js", @@ -172253,7 +172469,7 @@ "ignore": true }, { - "__docId__": 8728, + "__docId__": 8736, "kind": "class", "name": "Program", "memberof": "src/viewer/scene/webgl/Program.js", @@ -172269,7 +172485,7 @@ "ignore": true }, { - "__docId__": 8729, + "__docId__": 8737, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172283,7 +172499,7 @@ "undocument": true }, { - "__docId__": 8730, + "__docId__": 8738, "kind": "member", "name": "id", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172300,7 +172516,7 @@ } }, { - "__docId__": 8731, + "__docId__": 8739, "kind": "member", "name": "source", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172317,7 +172533,7 @@ } }, { - "__docId__": 8732, + "__docId__": 8740, "kind": "method", "name": "init", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172340,7 +172556,7 @@ "return": null }, { - "__docId__": 8733, + "__docId__": 8741, "kind": "member", "name": "gl", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172357,7 +172573,7 @@ } }, { - "__docId__": 8734, + "__docId__": 8742, "kind": "member", "name": "allocated", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172374,7 +172590,7 @@ } }, { - "__docId__": 8735, + "__docId__": 8743, "kind": "member", "name": "compiled", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172391,7 +172607,7 @@ } }, { - "__docId__": 8736, + "__docId__": 8744, "kind": "member", "name": "linked", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172408,7 +172624,7 @@ } }, { - "__docId__": 8737, + "__docId__": 8745, "kind": "member", "name": "validated", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172425,7 +172641,7 @@ } }, { - "__docId__": 8738, + "__docId__": 8746, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172442,7 +172658,7 @@ } }, { - "__docId__": 8739, + "__docId__": 8747, "kind": "member", "name": "uniforms", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172459,7 +172675,7 @@ } }, { - "__docId__": 8740, + "__docId__": 8748, "kind": "member", "name": "samplers", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172476,7 +172692,7 @@ } }, { - "__docId__": 8741, + "__docId__": 8749, "kind": "member", "name": "attributes", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172493,7 +172709,7 @@ } }, { - "__docId__": 8742, + "__docId__": 8750, "kind": "member", "name": "_vertexShader", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172511,7 +172727,7 @@ } }, { - "__docId__": 8743, + "__docId__": 8751, "kind": "member", "name": "_fragmentShader", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172529,7 +172745,7 @@ } }, { - "__docId__": 8750, + "__docId__": 8758, "kind": "member", "name": "handle", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172546,7 +172762,7 @@ } }, { - "__docId__": 8758, + "__docId__": 8766, "kind": "method", "name": "bind", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172562,7 +172778,7 @@ "return": null }, { - "__docId__": 8759, + "__docId__": 8767, "kind": "method", "name": "getLocation", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172589,7 +172805,7 @@ } }, { - "__docId__": 8760, + "__docId__": 8768, "kind": "method", "name": "getAttribute", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172616,7 +172832,7 @@ } }, { - "__docId__": 8761, + "__docId__": 8769, "kind": "method", "name": "bindTexture", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172655,7 +172871,7 @@ } }, { - "__docId__": 8762, + "__docId__": 8770, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/Program.js~Program", @@ -172671,18 +172887,18 @@ "return": null }, { - "__docId__": 8768, + "__docId__": 8776, "kind": "file", "name": "src/viewer/scene/webgl/RenderBuffer.js", "content": "/**\n * @desc Represents a WebGL render buffer.\n * @private\n */\nclass RenderBuffer {\n\n constructor(canvas, gl, options) {\n options = options || {};\n /** @type {WebGL2RenderingContext} */\n this.gl = gl;\n this.allocated = false;\n this.canvas = canvas;\n this.buffer = null;\n this.bound = false;\n this.size = options.size;\n this._hasDepthTexture = !!options.depthTexture;\n }\n\n setSize(size) {\n this.size = size;\n }\n\n webglContextRestored(gl) {\n this.gl = gl;\n this.buffer = null;\n this.allocated = false;\n this.bound = false;\n }\n\n bind(...internalformats) {\n this._touch(...internalformats);\n if (this.bound) {\n return;\n }\n const gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.buffer.framebuf);\n this.bound = true;\n }\n\n /**\n * Create and specify a WebGL texture image.\n *\n * @param { number } width \n * @param { number } height \n * @param { GLenum } [internalformat=null] \n *\n * @returns { WebGLTexture }\n */\n createTexture(width, height, internalformat = null) {\n const gl = this.gl;\n\n const colorTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, colorTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n if (internalformat) {\n gl.texStorage2D(gl.TEXTURE_2D, 1, internalformat, width, height);\n } else {\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n return colorTexture;\n }\n\n /**\n *\n * @param {number[]} [internalformats=[]]\n * @returns\n */\n _touch(...internalformats) {\n\n let width;\n let height;\n const gl = this.gl;\n\n if (this.size) {\n width = this.size[0];\n height = this.size[1];\n\n } else {\n width = gl.drawingBufferWidth;\n height = gl.drawingBufferHeight;\n }\n\n if (this.buffer) {\n\n if (this.buffer.width === width && this.buffer.height === height) {\n return;\n\n } else {\n this.buffer.textures.forEach(texture => gl.deleteTexture(texture));\n gl.deleteFramebuffer(this.buffer.framebuf);\n gl.deleteRenderbuffer(this.buffer.renderbuf);\n }\n }\n\n const colorTextures = [];\n if (internalformats.length > 0) {\n colorTextures.push(...internalformats.map(internalformat => this.createTexture(width, height, internalformat)));\n } else {\n colorTextures.push(this.createTexture(width, height));\n }\n\n let depthTexture;\n\n if (this._hasDepthTexture) {\n depthTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, depthTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT32F, width, height, 0, gl.DEPTH_COMPONENT, gl.FLOAT, null);\n }\n\n const renderbuf = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuf);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT32F, width, height);\n\n const framebuf = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuf);\n for (let i = 0; i < colorTextures.length; i++) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.TEXTURE_2D, colorTextures[i], 0);\n }\n if (internalformats.length > 0) {\n gl.drawBuffers(colorTextures.map((_, i) => gl.COLOR_ATTACHMENT0 + i));\n }\n\n if (this._hasDepthTexture) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture, 0);\n } else {\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, renderbuf);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n // Verify framebuffer is OK\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuf);\n if (!gl.isFramebuffer(framebuf)) {\n throw \"Invalid framebuffer\";\n }\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n\n switch (status) {\n\n case gl.FRAMEBUFFER_COMPLETE:\n break;\n\n case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n throw \"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT\";\n\n case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n throw \"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\";\n\n case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n throw \"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS\";\n\n case gl.FRAMEBUFFER_UNSUPPORTED:\n throw \"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED\";\n\n default:\n throw \"Incomplete framebuffer: \" + status;\n }\n\n this.buffer = {\n framebuf: framebuf,\n renderbuf: renderbuf,\n texture: colorTextures[0],\n textures: colorTextures,\n depthTexture: depthTexture,\n width: width,\n height: height\n };\n\n this.bound = false;\n }\n\n clear() {\n if (!this.bound) {\n throw \"Render buffer not bound\";\n }\n const gl = this.gl;\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n }\n\n read(pickX, pickY, glFormat = null, glType = null, arrayType = Uint8Array, arrayMultiplier = 4, colorBufferIndex = 0) {\n const x = pickX;\n const y = this.buffer.height ? (this.buffer.height - pickY - 1) : (this.gl.drawingBufferHeight - pickY);\n const pix = new arrayType(arrayMultiplier);\n const gl = this.gl;\n gl.readBuffer(gl.COLOR_ATTACHMENT0 + colorBufferIndex);\n gl.readPixels(x, y, 1, 1, glFormat || gl.RGBA, glType || gl.UNSIGNED_BYTE, pix, 0);\n return pix;\n }\n\n readArray(glFormat = null, glType = null, arrayType = Uint8Array, arrayMultiplier = 4, colorBufferIndex = 0) {\n const pix = new arrayType(this.buffer.width*this.buffer.height * arrayMultiplier);\n const gl = this.gl;\n gl.readBuffer(gl.COLOR_ATTACHMENT0 + colorBufferIndex);\n gl.readPixels(0, 0, this.buffer.width, this.buffer.height, glFormat || gl.RGBA, glType || gl.UNSIGNED_BYTE, pix, 0);\n return pix;\n }\n\n /**\n * Returns an HTMLCanvas containing the contents of the RenderBuffer as an image.\n *\n * - The HTMLCanvas has a CanvasRenderingContext2D.\n * - Expects the caller to draw more things on the HTMLCanvas (annotations etc).\n *\n * @returns {HTMLCanvasElement}\n */\n readImageAsCanvas() {\n const gl = this.gl;\n const imageDataCache = this._getImageDataCache();\n const pixelData = imageDataCache.pixelData;\n const canvas = imageDataCache.canvas;\n const imageData = imageDataCache.imageData;\n const context = imageDataCache.context;\n gl.readPixels(0, 0, this.buffer.width, this.buffer.height, gl.RGBA, gl.UNSIGNED_BYTE, pixelData);\n const width = this.buffer.width;\n const height = this.buffer.height;\n const halfHeight = height / 2 | 0; // the | 0 keeps the result an int\n const bytesPerRow = width * 4;\n const temp = new Uint8Array(width * 4);\n for (let y = 0; y < halfHeight; ++y) {\n const topOffset = y * bytesPerRow;\n const bottomOffset = (height - y - 1) * bytesPerRow;\n temp.set(pixelData.subarray(topOffset, topOffset + bytesPerRow));\n pixelData.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);\n pixelData.set(temp, bottomOffset);\n }\n imageData.data.set(pixelData);\n context.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n readImage(params) {\n const gl = this.gl;\n const imageDataCache = this._getImageDataCache();\n const pixelData = imageDataCache.pixelData;\n const canvas = imageDataCache.canvas;\n const imageData = imageDataCache.imageData;\n const context = imageDataCache.context;\n const { width, height } = this.buffer;\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixelData);\n imageData.data.set(pixelData);\n context.putImageData(imageData, 0, 0);\n\n // flip Y\n context.save();\n context.globalCompositeOperation = 'copy';\n context.scale(1, -1);\n context.drawImage(canvas, 0, -height, width, height);\n context.restore();\n\n let format = params.format || \"png\";\n if (format !== \"jpeg\" && format !== \"png\" && format !== \"bmp\") {\n console.error(\"Unsupported image format: '\" + format + \"' - supported types are 'jpeg', 'bmp' and 'png' - defaulting to 'png'\");\n format = \"png\";\n }\n return canvas.toDataURL(`image/${format}`);\n }\n\n _getImageDataCache(type = Uint8Array, multiplier = 4) {\n\n const bufferWidth = this.buffer.width;\n const bufferHeight = this.buffer.height;\n\n let imageDataCache = this._imageDataCache;\n\n if (imageDataCache) {\n if (imageDataCache.width !== bufferWidth || imageDataCache.height !== bufferHeight) {\n this._imageDataCache = null;\n imageDataCache = null;\n }\n }\n\n if (!imageDataCache) {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = bufferWidth;\n canvas.height = bufferHeight;\n imageDataCache = {\n pixelData: new type(bufferWidth * bufferHeight * multiplier),\n canvas: canvas,\n context: context,\n imageData: context.createImageData(bufferWidth, bufferHeight),\n width: bufferWidth,\n height: bufferHeight\n };\n\n this._imageDataCache = imageDataCache;\n }\n imageDataCache.context.resetTransform(); // Prevents strange scale-accumulation effect with html2canvas\n return imageDataCache;\n }\n\n unbind() {\n const gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n this.bound = false;\n }\n\n getTexture(index = 0) {\n const self = this;\n return this._texture || (this._texture = {\n renderBuffer: this,\n bind: function (unit) {\n if (self.buffer && self.buffer.textures[index]) {\n self.gl.activeTexture(self.gl[\"TEXTURE\" + unit]);\n self.gl.bindTexture(self.gl.TEXTURE_2D, self.buffer.textures[index]);\n return true;\n }\n return false;\n },\n unbind: function (unit) {\n if (self.buffer && self.buffer.textures[index]) {\n self.gl.activeTexture(self.gl[\"TEXTURE\" + unit]);\n self.gl.bindTexture(self.gl.TEXTURE_2D, null);\n }\n }\n });\n }\n\n hasDepthTexture() {\n return this._hasDepthTexture;\n }\n\n getDepthTexture() {\n if (!this._hasDepthTexture) {\n return null;\n }\n const self = this;\n return this._depthTexture || (this._dethTexture = {\n renderBuffer: this,\n bind: function (unit) {\n if (self.buffer && self.buffer.depthTexture) {\n self.gl.activeTexture(self.gl[\"TEXTURE\" + unit]);\n self.gl.bindTexture(self.gl.TEXTURE_2D, self.buffer.depthTexture);\n return true;\n }\n return false;\n },\n unbind: function (unit) {\n if (self.buffer && self.buffer.depthTexture) {\n self.gl.activeTexture(self.gl[\"TEXTURE\" + unit]);\n self.gl.bindTexture(self.gl.TEXTURE_2D, null);\n }\n }\n });\n }\n\n destroy() {\n if (this.allocated) {\n const gl = this.gl;\n this.buffer.textures.forEach(texture => gl.deleteTexture(texture));\n gl.deleteTexture(this.buffer.depthTexture);\n gl.deleteFramebuffer(this.buffer.framebuf);\n gl.deleteRenderbuffer(this.buffer.renderbuf);\n this.allocated = false;\n this.buffer = null;\n this.bound = false;\n }\n this._imageDataCache = null;\n this._texture = null;\n this._depthTexture = null;\n }\n}\n\nexport {RenderBuffer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/RenderBuffer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/RenderBuffer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8769, + "__docId__": 8777, "kind": "class", "name": "RenderBuffer", "memberof": "src/viewer/scene/webgl/RenderBuffer.js", @@ -172698,7 +172914,7 @@ "ignore": true }, { - "__docId__": 8770, + "__docId__": 8778, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172712,7 +172928,7 @@ "undocument": true }, { - "__docId__": 8771, + "__docId__": 8779, "kind": "member", "name": "gl", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172731,7 +172947,7 @@ } }, { - "__docId__": 8772, + "__docId__": 8780, "kind": "member", "name": "allocated", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172748,7 +172964,7 @@ } }, { - "__docId__": 8773, + "__docId__": 8781, "kind": "member", "name": "canvas", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172765,7 +172981,7 @@ } }, { - "__docId__": 8774, + "__docId__": 8782, "kind": "member", "name": "buffer", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172782,7 +172998,7 @@ } }, { - "__docId__": 8775, + "__docId__": 8783, "kind": "member", "name": "bound", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172799,7 +173015,7 @@ } }, { - "__docId__": 8776, + "__docId__": 8784, "kind": "member", "name": "size", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172816,7 +173032,7 @@ } }, { - "__docId__": 8777, + "__docId__": 8785, "kind": "member", "name": "_hasDepthTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172834,7 +173050,7 @@ } }, { - "__docId__": 8778, + "__docId__": 8786, "kind": "method", "name": "setSize", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172857,7 +173073,7 @@ "return": null }, { - "__docId__": 8780, + "__docId__": 8788, "kind": "method", "name": "webglContextRestored", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172880,7 +173096,7 @@ "return": null }, { - "__docId__": 8785, + "__docId__": 8793, "kind": "method", "name": "bind", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172904,7 +173120,7 @@ "return": null }, { - "__docId__": 8787, + "__docId__": 8795, "kind": "method", "name": "createTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -172965,7 +173181,7 @@ } }, { - "__docId__": 8788, + "__docId__": 8796, "kind": "method", "name": "_touch", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173000,7 +173216,7 @@ "return": null }, { - "__docId__": 8791, + "__docId__": 8799, "kind": "method", "name": "clear", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173016,7 +173232,7 @@ "return": null }, { - "__docId__": 8792, + "__docId__": 8800, "kind": "method", "name": "read", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173092,7 +173308,7 @@ } }, { - "__docId__": 8793, + "__docId__": 8801, "kind": "method", "name": "readArray", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173156,7 +173372,7 @@ } }, { - "__docId__": 8794, + "__docId__": 8802, "kind": "method", "name": "readImageAsCanvas", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173184,7 +173400,7 @@ "params": [] }, { - "__docId__": 8795, + "__docId__": 8803, "kind": "method", "name": "readImage", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173211,7 +173427,7 @@ } }, { - "__docId__": 8796, + "__docId__": 8804, "kind": "method", "name": "_getImageDataCache", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173251,7 +173467,7 @@ } }, { - "__docId__": 8797, + "__docId__": 8805, "kind": "member", "name": "_imageDataCache", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173269,7 +173485,7 @@ } }, { - "__docId__": 8799, + "__docId__": 8807, "kind": "method", "name": "unbind", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173285,7 +173501,7 @@ "return": null }, { - "__docId__": 8801, + "__docId__": 8809, "kind": "method", "name": "getTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173315,7 +173531,7 @@ } }, { - "__docId__": 8802, + "__docId__": 8810, "kind": "method", "name": "hasDepthTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173335,7 +173551,7 @@ } }, { - "__docId__": 8803, + "__docId__": 8811, "kind": "method", "name": "getDepthTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173355,7 +173571,7 @@ } }, { - "__docId__": 8804, + "__docId__": 8812, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173371,7 +173587,7 @@ "return": null }, { - "__docId__": 8809, + "__docId__": 8817, "kind": "member", "name": "_texture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173389,7 +173605,7 @@ } }, { - "__docId__": 8810, + "__docId__": 8818, "kind": "member", "name": "_depthTexture", "memberof": "src/viewer/scene/webgl/RenderBuffer.js~RenderBuffer", @@ -173407,18 +173623,18 @@ } }, { - "__docId__": 8811, + "__docId__": 8819, "kind": "file", "name": "src/viewer/scene/webgl/RenderBufferManager.js", "content": "import {RenderBuffer} from \"./RenderBuffer.js\";\n\n/**\n * @private\n */\nclass RenderBufferManager {\n\n constructor(scene) {\n this.scene = scene;\n this._renderBuffersBasic = {};\n this._renderBuffersScaled = {};\n }\n\n getRenderBuffer(id, options) {\n const renderBuffers = (this.scene.canvas.resolutionScale === 1.0) ? this._renderBuffersBasic : this._renderBuffersScaled;\n let renderBuffer = renderBuffers[id];\n if (!renderBuffer) {\n renderBuffer = new RenderBuffer(this.scene.canvas.canvas, this.scene.canvas.gl, options);\n renderBuffers[id] = renderBuffer;\n }\n return renderBuffer;\n }\n\n destroy() {\n for (let id in this._renderBuffersBasic) {\n this._renderBuffersBasic[id].destroy();\n }\n for (let id in this._renderBuffersScaled) {\n this._renderBuffersScaled[id].destroy();\n }\n }\n}\n\nexport {RenderBufferManager};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/RenderBufferManager.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/RenderBufferManager.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8812, + "__docId__": 8820, "kind": "class", "name": "RenderBufferManager", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js", @@ -173434,7 +173650,7 @@ "ignore": true }, { - "__docId__": 8813, + "__docId__": 8821, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173448,7 +173664,7 @@ "undocument": true }, { - "__docId__": 8814, + "__docId__": 8822, "kind": "member", "name": "scene", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173465,7 +173681,7 @@ } }, { - "__docId__": 8815, + "__docId__": 8823, "kind": "member", "name": "_renderBuffersBasic", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173483,7 +173699,7 @@ } }, { - "__docId__": 8816, + "__docId__": 8824, "kind": "member", "name": "_renderBuffersScaled", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173501,7 +173717,7 @@ } }, { - "__docId__": 8817, + "__docId__": 8825, "kind": "method", "name": "getRenderBuffer", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173534,7 +173750,7 @@ } }, { - "__docId__": 8818, + "__docId__": 8826, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/RenderBufferManager.js~RenderBufferManager", @@ -173550,18 +173766,18 @@ "return": null }, { - "__docId__": 8819, + "__docId__": 8827, "kind": "file", "name": "src/viewer/scene/webgl/RenderFlags.js", "content": "/**\n * Indicates what rendering needs to be done for the layers within a {@link Drawable}.\n *\n * Each Drawable has a RenderFlags in {@link Drawable#renderFlags}.\n *\n * Before rendering each frame, {@link Renderer} will call {@link Drawable#rebuildRenderFlags} on each {@link Drawable}.\n *\n * Then, when rendering a frame, Renderer will apply rendering passes to each Drawable according on what flags are set in {@link Drawable#renderFlags}.\n *\n * @private\n */\nclass RenderFlags {\n\n /**\n * @private\n */\n constructor() {\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate which layers are visible within the {@link Drawable}.\n *\n * This is a list of IDs of visible layers within the {@link Drawable}. The IDs will be whatever the\n * {@link Drawable} uses to identify its layers, usually integers.\n *\n * @property visibleLayers\n * @type {Number[]}\n */\n this.visibleLayers = [];\n\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate which {@link SectionPlane}s are active within each layer of the {@link Drawable}.\n *\n * Layout is as follows:\n *\n * ````[\n * false, false, true, // Layer 0, SectionPlanes 0, 1, 2\n * false, true, true, // Layer 1, SectionPlanes 0, 1, 2\n * true, false, true // Layer 2, SectionPlanes 0, 1, 2\n * ]````\n *\n * @property sectionPlanesActivePerLayer\n * @type {Boolean[]}\n */\n this.sectionPlanesActivePerLayer = [];\n\n this.reset();\n }\n\n /**\n * @private\n */\n reset() {\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate whether the {@link Drawable} is culled.\n * \n * When this is ````false````, then all of the other properties on ````RenderFlags```` will remain at their default values.\n * \n * @property culled\n * @type {Boolean}\n */\n this.culled = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate whether the {@link Drawable} is sliced by any {@link SectionPlane}s.\n *\n * @property sectioned\n * @type {Boolean}\n */\n this.sectioned = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the number of layers within the {@link Drawable}.\n *\n * @property numLayers\n * @type {Number}\n */\n this.numLayers = 0;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the number of visible layers within the {@link Drawable}.\n *\n * @property numVisibleLayers\n * @type {Number}\n */\n this.numVisibleLayers = 0;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs {@link Drawable#drawColorOpaque}.\n * @property colorOpaque\n * @type {boolean}\n */\n this.colorOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs {@link Drawable#drawColorTransparent}.\n * @property colorTransparent\n * @type {boolean}\n */\n this.colorTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs {@link Drawable#drawEdgesColorOpaque}.\n * @property edgesOpaque\n * @type {boolean}\n */\n this.edgesOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs {@link Drawable#drawEdgesColorTransparent}.\n * @property edgesTransparent\n * @type {boolean}\n */\n this.edgesTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawSilhouetteXRayed}.\n * @property xrayedSilhouetteOpaque\n * @type {boolean}\n */\n this.xrayedSilhouetteOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawEdgesXRayed}.\n * @property xrayedEdgesOpaque\n * @type {boolean}\n */\n this.xrayedEdgesOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawSilhouetteXRayed}.\n * @property xrayedSilhouetteTransparent\n * @type {boolean}\n */\n this.xrayedSilhouetteTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawEdgesXRayed}.\n * @property xrayedEdgesTransparent\n * @type {boolean}\n */\n this.xrayedEdgesTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawSilhouetteHighlighted}.\n * @property highlightedSilhouetteOpaque\n * @type {boolean}\n */\n this.highlightedSilhouetteOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawEdgesHighlighted}.\n * @property highlightedEdgesOpaque\n * @type {boolean}\n */\n this.highlightedEdgesOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawSilhouetteHighlighted}.\n * @property highlightedSilhouetteTransparent\n * @type {boolean}\n */\n this.highlightedSilhouetteTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawEdgesHighlighted}.\n * @property highlightedEdgesTransparent\n * @type {boolean}\n */\n this.highlightedEdgesTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawSilhouetteSelected}.\n * @property selectedSilhouetteOpaque\n * @type {boolean}\n */\n this.selectedSilhouetteOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs an opaque {@link Drawable#drawEdgesSelected}.\n * @property selectedEdgesOpaque\n * @type {boolean}\n */\n this.selectedEdgesOpaque = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawSilhouetteSelected}.\n * @property selectedSilhouetteTransparent\n * @type {boolean}\n */\n this.selectedSilhouetteTransparent = false;\n\n /**\n * Set by {@link Drawable#rebuildRenderFlags} to indicate the {@link Drawable} needs a transparent {@link Drawable#drawEdgesSelected}.\n * @property selectedEdgesTransparent\n * @type {boolean}\n */\n this.selectedEdgesTransparent = false;\n }\n}\n\nexport {RenderFlags};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/RenderFlags.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/RenderFlags.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8820, + "__docId__": 8828, "kind": "class", "name": "RenderFlags", "memberof": "src/viewer/scene/webgl/RenderFlags.js", @@ -173577,7 +173793,7 @@ "ignore": true }, { - "__docId__": 8821, + "__docId__": 8829, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173591,7 +173807,7 @@ "ignore": true }, { - "__docId__": 8822, + "__docId__": 8830, "kind": "member", "name": "visibleLayers", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173622,7 +173838,7 @@ } }, { - "__docId__": 8823, + "__docId__": 8831, "kind": "member", "name": "sectionPlanesActivePerLayer", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173653,7 +173869,7 @@ } }, { - "__docId__": 8824, + "__docId__": 8832, "kind": "method", "name": "reset", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173669,7 +173885,7 @@ "return": null }, { - "__docId__": 8825, + "__docId__": 8833, "kind": "member", "name": "culled", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173700,7 +173916,7 @@ } }, { - "__docId__": 8826, + "__docId__": 8834, "kind": "member", "name": "sectioned", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173731,7 +173947,7 @@ } }, { - "__docId__": 8827, + "__docId__": 8835, "kind": "member", "name": "numLayers", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173762,7 +173978,7 @@ } }, { - "__docId__": 8828, + "__docId__": 8836, "kind": "member", "name": "numVisibleLayers", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173793,7 +174009,7 @@ } }, { - "__docId__": 8829, + "__docId__": 8837, "kind": "member", "name": "colorOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173824,7 +174040,7 @@ } }, { - "__docId__": 8830, + "__docId__": 8838, "kind": "member", "name": "colorTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173855,7 +174071,7 @@ } }, { - "__docId__": 8831, + "__docId__": 8839, "kind": "member", "name": "edgesOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173886,7 +174102,7 @@ } }, { - "__docId__": 8832, + "__docId__": 8840, "kind": "member", "name": "edgesTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173917,7 +174133,7 @@ } }, { - "__docId__": 8833, + "__docId__": 8841, "kind": "member", "name": "xrayedSilhouetteOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173948,7 +174164,7 @@ } }, { - "__docId__": 8834, + "__docId__": 8842, "kind": "member", "name": "xrayedEdgesOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -173979,7 +174195,7 @@ } }, { - "__docId__": 8835, + "__docId__": 8843, "kind": "member", "name": "xrayedSilhouetteTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174010,7 +174226,7 @@ } }, { - "__docId__": 8836, + "__docId__": 8844, "kind": "member", "name": "xrayedEdgesTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174041,7 +174257,7 @@ } }, { - "__docId__": 8837, + "__docId__": 8845, "kind": "member", "name": "highlightedSilhouetteOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174072,7 +174288,7 @@ } }, { - "__docId__": 8838, + "__docId__": 8846, "kind": "member", "name": "highlightedEdgesOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174103,7 +174319,7 @@ } }, { - "__docId__": 8839, + "__docId__": 8847, "kind": "member", "name": "highlightedSilhouetteTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174134,7 +174350,7 @@ } }, { - "__docId__": 8840, + "__docId__": 8848, "kind": "member", "name": "highlightedEdgesTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174165,7 +174381,7 @@ } }, { - "__docId__": 8841, + "__docId__": 8849, "kind": "member", "name": "selectedSilhouetteOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174196,7 +174412,7 @@ } }, { - "__docId__": 8842, + "__docId__": 8850, "kind": "member", "name": "selectedEdgesOpaque", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174227,7 +174443,7 @@ } }, { - "__docId__": 8843, + "__docId__": 8851, "kind": "member", "name": "selectedSilhouetteTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174258,7 +174474,7 @@ } }, { - "__docId__": 8844, + "__docId__": 8852, "kind": "member", "name": "selectedEdgesTransparent", "memberof": "src/viewer/scene/webgl/RenderFlags.js~RenderFlags", @@ -174289,18 +174505,18 @@ } }, { - "__docId__": 8845, + "__docId__": 8853, "kind": "file", "name": "src/viewer/scene/webgl/RenderState.js", "content": "import {Map} from \"../utils/Map.js\";\n\nconst ids = new Map({});\n\n/**\n * @desc Represents a chunk of state changes applied by the {@link Scene}'s renderer while it renders a frame.\n *\n * * Contains properties that represent the state changes.\n * * Has a unique automatically-generated numeric ID, which the renderer can use to sort these, in order to avoid applying redundant state changes for each frame.\n * * Initialize your own properties on a RenderState via its constructor.\n *\n * @private\n */\nclass RenderState {\n\n constructor(cfg) {\n\n /**\n The RenderState's ID, unique within the renderer.\n @property id\n @type {Number}\n @final\n */\n this.id = ids.addItem({});\n for (const key in cfg) {\n if (cfg.hasOwnProperty(key)) {\n this[key] = cfg[key];\n }\n }\n }\n\n /**\n Destroys this RenderState.\n */\n destroy() {\n ids.removeItem(this.id);\n }\n}\n\nexport {RenderState};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/RenderState.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/RenderState.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8846, + "__docId__": 8854, "kind": "variable", "name": "ids", "memberof": "src/viewer/scene/webgl/RenderState.js", @@ -174321,7 +174537,7 @@ "ignore": true }, { - "__docId__": 8847, + "__docId__": 8855, "kind": "class", "name": "RenderState", "memberof": "src/viewer/scene/webgl/RenderState.js", @@ -174337,7 +174553,7 @@ "ignore": true }, { - "__docId__": 8848, + "__docId__": 8856, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/RenderState.js~RenderState", @@ -174351,7 +174567,7 @@ "undocument": true }, { - "__docId__": 8849, + "__docId__": 8857, "kind": "member", "name": "id", "memberof": "src/viewer/scene/webgl/RenderState.js~RenderState", @@ -174388,7 +174604,7 @@ } }, { - "__docId__": 8850, + "__docId__": 8858, "kind": "member", "name": "[key]", "memberof": "src/viewer/scene/webgl/RenderState.js~RenderState", @@ -174405,7 +174621,7 @@ } }, { - "__docId__": 8851, + "__docId__": 8859, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/RenderState.js~RenderState", @@ -174420,18 +174636,18 @@ "return": null }, { - "__docId__": 8852, + "__docId__": 8860, "kind": "file", "name": "src/viewer/scene/webgl/Renderer.js", "content": "import {FrameContext} from './FrameContext.js';\nimport {math} from '../math/math.js';\nimport {stats} from '../stats.js';\nimport {WEBGL_INFO} from '../webglInfo.js';\nimport {Map} from \"../utils/Map.js\";\nimport {PickResult} from \"./PickResult.js\";\nimport {OcclusionTester} from \"./occlusion/OcclusionTester.js\";\nimport {SAOOcclusionRenderer} from \"./sao/SAOOcclusionRenderer.js\";\nimport {createRTCViewMat} from \"../math/rtcCoords.js\";\nimport {SAODepthLimitedBlurRenderer} from \"./sao/SAODepthLimitedBlurRenderer.js\";\nimport {RenderBufferManager} from \"./RenderBufferManager.js\";\nimport {getExtension} from \"./getExtension.js\";\n\n/**\n * @private\n */\nconst Renderer = function (scene, options) {\n\n options = options || {};\n\n const frameCtx = new FrameContext(scene);\n const canvas = scene.canvas.canvas;\n /**\n * @type {WebGL2RenderingContext}\n */\n const gl = scene.canvas.gl;\n const canvasTransparent = (!!options.transparent);\n const alphaDepthMask = options.alphaDepthMask;\n\n const pickIDs = new Map({});\n\n let drawableTypeInfo = {};\n let drawables = {};\n\n let drawableListDirty = true;\n let stateSortDirty = true;\n let imageDirty = true;\n let shadowsDirty = true;\n\n let transparentEnabled = true;\n let edgesEnabled = true;\n let saoEnabled = true;\n let pbrEnabled = true;\n let colorTextureEnabled = true;\n\n const renderBufferManager = new RenderBufferManager(scene);\n\n let snapshotBound = false;\n\n const bindOutputFrameBuffer = null;\n const unbindOutputFrameBuffer = null;\n\n const saoOcclusionRenderer = new SAOOcclusionRenderer(scene);\n const saoDepthLimitedBlurRenderer = new SAODepthLimitedBlurRenderer(scene);\n\n this.scene = scene;\n\n this._occlusionTester = null; // Lazy-created in #addMarker()\n\n this.capabilities = {\n astcSupported: !!getExtension(gl, 'WEBGL_compressed_texture_astc'),\n etc1Supported: true, // WebGL2\n etc2Supported: !!getExtension(gl, 'WEBGL_compressed_texture_etc'),\n dxtSupported: !!getExtension(gl, 'WEBGL_compressed_texture_s3tc'),\n bptcSupported: !!getExtension(gl, 'EXT_texture_compression_bptc'),\n pvrtcSupported: !!(getExtension(gl, 'WEBGL_compressed_texture_pvrtc') || getExtension(gl, 'WEBKIT_WEBGL_compressed_texture_pvrtc'))\n };\n\n this.setTransparentEnabled = function (enabled) {\n transparentEnabled = enabled;\n imageDirty = true;\n };\n\n this.setEdgesEnabled = function (enabled) {\n edgesEnabled = enabled;\n imageDirty = true;\n };\n\n this.setSAOEnabled = function (enabled) {\n saoEnabled = enabled;\n imageDirty = true;\n };\n\n this.setPBREnabled = function (enabled) {\n pbrEnabled = enabled;\n imageDirty = true;\n };\n\n this.setColorTextureEnabled = function (enabled) {\n colorTextureEnabled = enabled;\n imageDirty = true;\n };\n\n this.needStateSort = function () {\n stateSortDirty = true;\n };\n\n this.shadowsDirty = function () {\n shadowsDirty = true;\n };\n\n this.imageDirty = function () {\n imageDirty = true;\n };\n\n this.webglContextLost = function () {\n };\n\n this.webglContextRestored = function (gl) {\n\n // renderBufferManager.webglContextRestored(gl);\n\n saoOcclusionRenderer.init();\n saoDepthLimitedBlurRenderer.init();\n\n imageDirty = true;\n };\n\n /**\n * Inserts a drawable into this renderer.\n * @private\n */\n this.addDrawable = function (id, drawable) {\n const type = drawable.type;\n if (!type) {\n console.error(\"Renderer#addDrawable() : drawable with ID \" + id + \" has no 'type' - ignoring\");\n return;\n }\n let drawableInfo = drawableTypeInfo[type];\n if (!drawableInfo) {\n drawableInfo = {\n type: drawable.type,\n count: 0,\n isStateSortable: drawable.isStateSortable,\n stateSortCompare: drawable.stateSortCompare,\n drawableMap: {},\n drawableListPreCull: [],\n drawableList: []\n };\n drawableTypeInfo[type] = drawableInfo;\n }\n drawableInfo.count++;\n drawableInfo.drawableMap[id] = drawable;\n drawables[id] = drawable;\n drawableListDirty = true;\n };\n\n /**\n * Removes a drawable from this renderer.\n * @private\n */\n this.removeDrawable = function (id) {\n const drawable = drawables[id];\n if (!drawable) {\n console.error(\"Renderer#removeDrawable() : drawable not found with ID \" + id + \" - ignoring\");\n return;\n }\n const type = drawable.type;\n const drawableInfo = drawableTypeInfo[type];\n if (--drawableInfo.count <= 0) {\n delete drawableTypeInfo[type];\n } else {\n delete drawableInfo.drawableMap[id];\n }\n delete drawables[id];\n drawableListDirty = true;\n };\n\n /**\n * Gets a unique pick ID for the given Pickable. A Pickable can be a {@link Mesh} or a {@link PerformanceMesh}.\n * @returns {Number} New pick ID.\n */\n this.getPickID = function (entity) {\n return pickIDs.addItem(entity);\n };\n\n /**\n * Released a pick ID for reuse.\n * @param {Number} pickID Pick ID to release.\n */\n this.putPickID = function (pickID) {\n pickIDs.removeItem(pickID);\n };\n\n /**\n * Clears the canvas.\n * @private\n */\n this.clear = function (params) {\n params = params || {};\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n if (canvasTransparent) {\n gl.clearColor(1, 1, 1, 1);\n } else {\n const backgroundColor = scene.canvas.backgroundColorFromAmbientLight ? this.lights.getAmbientColorAndIntensity() : scene.canvas.backgroundColor;\n gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1.0);\n }\n if (bindOutputFrameBuffer) {\n bindOutputFrameBuffer(params.pass);\n }\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n if (unbindOutputFrameBuffer) {\n unbindOutputFrameBuffer(params.pass);\n }\n };\n\n /**\n * Returns true if the next call to render() will draw something\n * @returns {Boolean}\n */\n this.needsRender = function () {\n const needsRender = (imageDirty || drawableListDirty || stateSortDirty);\n return needsRender;\n }\n\n /**\n * Renders inserted drawables.\n * @private\n */\n this.render = function (params) {\n params = params || {};\n if (params.force) {\n imageDirty = true;\n }\n updateDrawlist();\n if (imageDirty) {\n draw(params);\n stats.frame.frameCount++;\n imageDirty = false;\n }\n };\n\n function updateDrawlist() { // Prepares state-sorted array of drawables from maps of inserted drawables\n if (drawableListDirty) {\n buildDrawableList();\n drawableListDirty = false;\n stateSortDirty = true;\n }\n if (stateSortDirty) {\n sortDrawableList();\n stateSortDirty = false;\n imageDirty = true;\n }\n if (imageDirty) { // Image is usually dirty because the camera moved\n cullDrawableList();\n }\n }\n\n function buildDrawableList() {\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableInfo = drawableTypeInfo[type];\n const drawableMap = drawableInfo.drawableMap;\n const drawableListPreCull = drawableInfo.drawableListPreCull;\n let lenDrawableList = 0;\n for (let id in drawableMap) {\n if (drawableMap.hasOwnProperty(id)) {\n drawableListPreCull[lenDrawableList++] = drawableMap[id];\n }\n }\n drawableListPreCull.length = lenDrawableList;\n }\n }\n }\n\n function sortDrawableList() {\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableInfo = drawableTypeInfo[type];\n if (drawableInfo.isStateSortable) {\n drawableInfo.drawableListPreCull.sort(drawableInfo.stateSortCompare);\n }\n }\n }\n }\n\n function cullDrawableList() {\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableInfo = drawableTypeInfo[type];\n const drawableListPreCull = drawableInfo.drawableListPreCull;\n const drawableList = drawableInfo.drawableList;\n let lenDrawableList = 0;\n for (let i = 0, len = drawableListPreCull.length; i < len; i++) {\n const drawable = drawableListPreCull[i];\n drawable.rebuildRenderFlags();\n if (!drawable.renderFlags.culled) {\n drawableList[lenDrawableList++] = drawable;\n }\n }\n drawableList.length = lenDrawableList;\n }\n }\n }\n\n function draw(params) {\n\n const sao = scene.sao;\n\n if (saoEnabled && sao.possible) {\n drawSAOBuffers(params);\n }\n\n drawShadowMaps();\n\n drawColor(params);\n }\n\n function drawSAOBuffers(params) {\n\n const sao = scene.sao;\n\n // Render depth buffer\n\n const saoDepthRenderBuffer = renderBufferManager.getRenderBuffer(\"saoDepth\", {\n depthTexture: true\n });\n\n saoDepthRenderBuffer.bind();\n saoDepthRenderBuffer.clear();\n drawDepth(params);\n saoDepthRenderBuffer.unbind();\n\n // Render occlusion buffer\n\n const occlusionRenderBuffer1 = renderBufferManager.getRenderBuffer(\"saoOcclusion\");\n\n occlusionRenderBuffer1.bind();\n occlusionRenderBuffer1.clear();\n saoOcclusionRenderer.render(saoDepthRenderBuffer);\n occlusionRenderBuffer1.unbind();\n\n if (sao.blur) {\n\n // Horizontally blur occlusion buffer 1 into occlusion buffer 2\n\n const occlusionRenderBuffer2 = renderBufferManager.getRenderBuffer(\"saoOcclusion2\");\n\n occlusionRenderBuffer2.bind();\n occlusionRenderBuffer2.clear();\n saoDepthLimitedBlurRenderer.render(saoDepthRenderBuffer, occlusionRenderBuffer1, 0);\n occlusionRenderBuffer2.unbind();\n\n // Vertically blur occlusion buffer 2 back into occlusion buffer 1\n\n occlusionRenderBuffer1.bind();\n occlusionRenderBuffer1.clear();\n saoDepthLimitedBlurRenderer.render(saoDepthRenderBuffer, occlusionRenderBuffer2, 1);\n occlusionRenderBuffer1.unbind();\n }\n }\n\n function drawDepth(params) {\n\n frameCtx.reset();\n frameCtx.pass = params.pass;\n\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n gl.clearColor(0, 0, 0, 0);\n gl.enable(gl.DEPTH_TEST);\n gl.frontFace(gl.CCW);\n gl.enable(gl.CULL_FACE);\n gl.depthMask(true);\n\n if (params.clear !== false) {\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n }\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n\n for (let i = 0, len = drawableList.length; i < len; i++) {\n\n const drawable = drawableList[i];\n\n if (drawable.culled === true || drawable.visible === false || !drawable.drawDepth || !drawable.saoEnabled) {\n continue;\n }\n\n if (drawable.renderFlags.colorOpaque) {\n drawable.drawDepth(frameCtx);\n }\n }\n }\n }\n\n // const numVertexAttribs = WEBGL_INFO.MAX_VERTEX_ATTRIBS; // Fixes https://github.com/xeokit/xeokit-sdk/issues/174\n // for (let ii = 0; ii < numVertexAttribs; ii++) {\n // gl.disableVertexAttribArray(ii);\n // }\n\n }\n\n function drawShadowMaps() {\n\n let lights = scene._lightsState.lights;\n\n for (let i = 0, len = lights.length; i < len; i++) {\n const light = lights[i];\n if (!light.castsShadow) {\n continue;\n }\n drawShadowMap(light);\n }\n\n // const numVertexAttribs = WEBGL_INFO.MAX_VERTEX_ATTRIBS; // Fixes https://github.com/xeokit/xeokit-sdk/issues/174\n // for (let ii = 0; ii < numVertexAttribs; ii++) {\n // gl.disableVertexAttribArray(ii);\n // }\n //\n shadowsDirty = false;\n }\n\n function drawShadowMap(light) {\n\n const castsShadow = light.castsShadow;\n\n if (!castsShadow) {\n return;\n }\n\n const shadowRenderBuf = light.getShadowRenderBuf();\n\n if (!shadowRenderBuf) {\n return;\n }\n\n shadowRenderBuf.bind();\n\n frameCtx.reset();\n\n frameCtx.backfaces = true;\n frameCtx.frontface = true;\n frameCtx.shadowViewMatrix = light.getShadowViewMatrix();\n frameCtx.shadowProjMatrix = light.getShadowProjMatrix();\n\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n gl.clearColor(0, 0, 0, 1);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.BLEND);\n\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n for (let type in drawableTypeInfo) {\n\n if (drawableTypeInfo.hasOwnProperty(type)) {\n\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n\n for (let i = 0, len = drawableList.length; i < len; i++) {\n\n const drawable = drawableList[i];\n\n if (drawable.visible === false || !drawable.castsShadow || !drawable.drawShadow) {\n continue;\n }\n\n if (drawable.renderFlags.colorOpaque) { // Transparent objects don't cast shadows (yet)\n drawable.drawShadow(frameCtx);\n }\n }\n }\n }\n\n shadowRenderBuf.unbind();\n }\n\n function drawColor(params) {\n\n const normalDrawSAOBin = [];\n const normalEdgesOpaqueBin = [];\n const normalFillTransparentBin = [];\n const normalEdgesTransparentBin = [];\n\n const xrayedFillOpaqueBin = [];\n const xrayEdgesOpaqueBin = [];\n const xrayedFillTransparentBin = [];\n const xrayEdgesTransparentBin = [];\n\n const highlightedFillOpaqueBin = [];\n const highlightedEdgesOpaqueBin = [];\n const highlightedFillTransparentBin = [];\n const highlightedEdgesTransparentBin = [];\n\n const selectedFillOpaqueBin = [];\n const selectedEdgesOpaqueBin = [];\n const selectedFillTransparentBin = [];\n const selectedEdgesTransparentBin = [];\n\n\n const ambientColorAndIntensity = scene._lightsState.getAmbientColorAndIntensity();\n\n frameCtx.reset();\n frameCtx.pass = params.pass;\n frameCtx.withSAO = false;\n frameCtx.pbrEnabled = pbrEnabled && !!scene.pbrEnabled;\n frameCtx.colorTextureEnabled = colorTextureEnabled && !!scene.colorTextureEnabled;\n\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n if (canvasTransparent) {\n gl.clearColor(0, 0, 0, 0);\n } else {\n const backgroundColor = scene.canvas.backgroundColorFromAmbientLight ? ambientColorAndIntensity : scene.canvas.backgroundColor;\n gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1.0);\n }\n\n gl.enable(gl.DEPTH_TEST);\n gl.frontFace(gl.CCW);\n gl.enable(gl.CULL_FACE);\n gl.depthMask(true);\n gl.lineWidth(1);\n\n frameCtx.lineWidth = 1;\n\n const saoPossible = scene.sao.possible;\n\n if (saoEnabled && saoPossible) {\n const occlusionRenderBuffer1 = renderBufferManager.getRenderBuffer(\"saoOcclusion\");\n frameCtx.occlusionTexture = occlusionRenderBuffer1 ? occlusionRenderBuffer1.getTexture() : null;\n } else {\n frameCtx.occlusionTexture = null;\n\n }\n\n let i;\n let len;\n let drawable;\n\n const startTime = Date.now();\n\n if (bindOutputFrameBuffer) {\n bindOutputFrameBuffer(params.pass);\n }\n\n if (params.clear !== false) {\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n }\n\n let normalDrawSAOBinLen = 0;\n let normalEdgesOpaqueBinLen = 0;\n let normalFillTransparentBinLen = 0;\n let normalEdgesTransparentBinLen = 0;\n\n let xrayedFillOpaqueBinLen = 0;\n let xrayEdgesOpaqueBinLen = 0;\n let xrayedFillTransparentBinLen = 0;\n let xrayEdgesTransparentBinLen = 0;\n\n let highlightedFillOpaqueBinLen = 0;\n let highlightedEdgesOpaqueBinLen = 0;\n let highlightedFillTransparentBinLen = 0;\n let highlightedEdgesTransparentBinLen = 0;\n\n let selectedFillOpaqueBinLen = 0;\n let selectedEdgesOpaqueBinLen = 0;\n let selectedFillTransparentBinLen = 0;\n let selectedEdgesTransparentBinLen = 0;\n\n //------------------------------------------------------------------------------------------------------\n // Render normal opaque solids, defer others to bins to render after\n //------------------------------------------------------------------------------------------------------\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n\n for (i = 0, len = drawableList.length; i < len; i++) {\n\n drawable = drawableList[i];\n\n if (drawable.culled === true || drawable.visible === false) {\n continue;\n }\n\n const renderFlags = drawable.renderFlags;\n\n if (renderFlags.colorOpaque) {\n if (saoEnabled && saoPossible && drawable.saoEnabled) {\n normalDrawSAOBin[normalDrawSAOBinLen++] = drawable;\n } else {\n drawable.drawColorOpaque(frameCtx);\n }\n }\n\n if (transparentEnabled) {\n if (renderFlags.colorTransparent) {\n normalFillTransparentBin[normalFillTransparentBinLen++] = drawable;\n }\n }\n\n if (renderFlags.xrayedSilhouetteTransparent) {\n xrayedFillTransparentBin[xrayedFillTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.xrayedSilhouetteOpaque) {\n xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++] = drawable;\n }\n\n if (renderFlags.highlightedSilhouetteTransparent) {\n highlightedFillTransparentBin[highlightedFillTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.highlightedSilhouetteOpaque) {\n highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++] = drawable;\n }\n\n if (renderFlags.selectedSilhouetteTransparent) {\n selectedFillTransparentBin[selectedFillTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.selectedSilhouetteOpaque) {\n selectedFillOpaqueBin[selectedFillOpaqueBinLen++] = drawable;\n }\n\n if (drawable.edges && edgesEnabled) {\n if (renderFlags.edgesOpaque) {\n normalEdgesOpaqueBin[normalEdgesOpaqueBinLen++] = drawable;\n }\n\n if (renderFlags.edgesTransparent) {\n normalEdgesTransparentBin[normalEdgesTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.selectedEdgesTransparent) {\n selectedEdgesTransparentBin[selectedEdgesTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.selectedEdgesOpaque) {\n selectedEdgesOpaqueBin[selectedEdgesOpaqueBinLen++] = drawable;\n }\n\n if (renderFlags.xrayedEdgesTransparent) {\n xrayEdgesTransparentBin[xrayEdgesTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.xrayedEdgesOpaque) {\n xrayEdgesOpaqueBin[xrayEdgesOpaqueBinLen++] = drawable;\n }\n\n if (renderFlags.highlightedEdgesTransparent) {\n highlightedEdgesTransparentBin[highlightedEdgesTransparentBinLen++] = drawable;\n }\n\n if (renderFlags.highlightedEdgesOpaque) {\n highlightedEdgesOpaqueBin[highlightedEdgesOpaqueBinLen++] = drawable;\n }\n }\n }\n }\n }\n\n //------------------------------------------------------------------------------------------------------\n // Render deferred bins\n //------------------------------------------------------------------------------------------------------\n\n // Opaque color with SAO\n\n if (normalDrawSAOBinLen > 0) {\n frameCtx.withSAO = true;\n for (i = 0; i < normalDrawSAOBinLen; i++) {\n normalDrawSAOBin[i].drawColorOpaque(frameCtx);\n }\n }\n\n // Opaque edges\n\n if (normalEdgesOpaqueBinLen > 0) {\n for (i = 0; i < normalEdgesOpaqueBinLen; i++) {\n normalEdgesOpaqueBin[i].drawEdgesColorOpaque(frameCtx);\n }\n }\n\n // Opaque X-ray fill\n\n if (xrayedFillOpaqueBinLen > 0) {\n for (i = 0; i < xrayedFillOpaqueBinLen; i++) {\n xrayedFillOpaqueBin[i].drawSilhouetteXRayed(frameCtx);\n }\n }\n\n // Opaque X-ray edges\n\n if (xrayEdgesOpaqueBinLen > 0) {\n for (i = 0; i < xrayEdgesOpaqueBinLen; i++) {\n xrayEdgesOpaqueBin[i].drawEdgesXRayed(frameCtx);\n }\n }\n\n // Transparent\n\n if (xrayedFillTransparentBinLen > 0 || xrayEdgesTransparentBinLen > 0 || normalFillTransparentBinLen > 0 || normalEdgesTransparentBinLen > 0) {\n gl.enable(gl.CULL_FACE);\n gl.enable(gl.BLEND);\n if (canvasTransparent) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n } else {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);\n }\n frameCtx.backfaces = false;\n if (!alphaDepthMask) {\n gl.depthMask(false);\n }\n\n // Transparent color edges\n\n if (normalFillTransparentBinLen > 0 || normalEdgesTransparentBinLen > 0) {\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);\n }\n if (normalEdgesTransparentBinLen > 0) {\n for (i = 0; i < normalEdgesTransparentBinLen; i++) {\n drawable = normalEdgesTransparentBin[i];\n drawable.drawEdgesColorTransparent(frameCtx);\n }\n }\n\n // Transparent color fill\n\n if (normalFillTransparentBinLen > 0) {\n for (i = 0; i < normalFillTransparentBinLen; i++) {\n drawable = normalFillTransparentBin[i];\n drawable.drawColorTransparent(frameCtx);\n }\n }\n\n // Transparent X-ray edges\n\n if (xrayEdgesTransparentBinLen > 0) {\n for (i = 0; i < xrayEdgesTransparentBinLen; i++) {\n xrayEdgesTransparentBin[i].drawEdgesXRayed(frameCtx);\n }\n }\n\n // Transparent X-ray fill\n\n if (xrayedFillTransparentBinLen > 0) {\n for (i = 0; i < xrayedFillTransparentBinLen; i++) {\n xrayedFillTransparentBin[i].drawSilhouetteXRayed(frameCtx);\n }\n }\n\n gl.disable(gl.BLEND);\n if (!alphaDepthMask) {\n gl.depthMask(true);\n }\n }\n\n // Opaque highlight\n\n if (highlightedFillOpaqueBinLen > 0 || highlightedEdgesOpaqueBinLen > 0) {\n frameCtx.lastProgramId = null;\n if (scene.highlightMaterial.glowThrough) {\n gl.clear(gl.DEPTH_BUFFER_BIT);\n }\n\n // Opaque highlighted edges\n\n if (highlightedEdgesOpaqueBinLen > 0) {\n for (i = 0; i < highlightedEdgesOpaqueBinLen; i++) {\n highlightedEdgesOpaqueBin[i].drawEdgesHighlighted(frameCtx);\n }\n }\n\n // Opaque highlighted fill\n\n if (highlightedFillOpaqueBinLen > 0) {\n for (i = 0; i < highlightedFillOpaqueBinLen; i++) {\n highlightedFillOpaqueBin[i].drawSilhouetteHighlighted(frameCtx);\n }\n }\n }\n\n // Highlighted transparent\n\n if (highlightedFillTransparentBinLen > 0 || highlightedEdgesTransparentBinLen > 0 || highlightedFillOpaqueBinLen > 0) {\n frameCtx.lastProgramId = null;\n if (scene.selectedMaterial.glowThrough) {\n gl.clear(gl.DEPTH_BUFFER_BIT);\n }\n gl.enable(gl.BLEND);\n if (canvasTransparent) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n } else {\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);\n }\n gl.enable(gl.CULL_FACE);\n\n // Highlighted transparent edges\n\n if (highlightedEdgesTransparentBinLen > 0) {\n for (i = 0; i < highlightedEdgesTransparentBinLen; i++) {\n highlightedEdgesTransparentBin[i].drawEdgesHighlighted(frameCtx);\n }\n }\n\n // Highlighted transparent fill\n\n if (highlightedFillTransparentBinLen > 0) {\n for (i = 0; i < highlightedFillTransparentBinLen; i++) {\n highlightedFillTransparentBin[i].drawSilhouetteHighlighted(frameCtx);\n }\n }\n gl.disable(gl.BLEND);\n }\n\n // Selected opaque\n\n if (selectedFillOpaqueBinLen > 0 || selectedEdgesOpaqueBinLen > 0) {\n frameCtx.lastProgramId = null;\n if (scene.selectedMaterial.glowThrough) {\n gl.clear(gl.DEPTH_BUFFER_BIT);\n }\n\n // Selected opaque fill\n\n if (selectedEdgesOpaqueBinLen > 0) {\n for (i = 0; i < selectedEdgesOpaqueBinLen; i++) {\n selectedEdgesOpaqueBin[i].drawEdgesSelected(frameCtx);\n }\n }\n\n // Selected opaque edges\n\n if (selectedFillOpaqueBinLen > 0) {\n for (i = 0; i < selectedFillOpaqueBinLen; i++) {\n selectedFillOpaqueBin[i].drawSilhouetteSelected(frameCtx);\n }\n }\n }\n\n // Selected transparent\n\n if (selectedFillTransparentBinLen > 0 || selectedEdgesTransparentBinLen > 0) {\n frameCtx.lastProgramId = null;\n if (scene.selectedMaterial.glowThrough) {\n gl.clear(gl.DEPTH_BUFFER_BIT);\n }\n gl.enable(gl.CULL_FACE);\n gl.enable(gl.BLEND);\n if (canvasTransparent) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n } else {\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);\n }\n\n // Selected transparent edges\n\n if (selectedEdgesTransparentBinLen > 0) {\n for (i = 0; i < selectedEdgesTransparentBinLen; i++) {\n selectedEdgesTransparentBin[i].drawEdgesSelected(frameCtx);\n }\n }\n\n // Selected transparent fill\n\n if (selectedFillTransparentBinLen > 0) {\n for (i = 0; i < selectedFillTransparentBinLen; i++) {\n selectedFillTransparentBin[i].drawSilhouetteSelected(frameCtx);\n }\n }\n gl.disable(gl.BLEND);\n }\n\n const endTime = Date.now();\n const frameStats = stats.frame;\n\n frameStats.renderTime = (endTime - startTime) / 1000.0;\n frameStats.drawElements = frameCtx.drawElements;\n frameStats.drawArrays = frameCtx.drawArrays;\n frameStats.useProgram = frameCtx.useProgram;\n frameStats.bindTexture = frameCtx.bindTexture;\n frameStats.bindArray = frameCtx.bindArray;\n\n const numTextureUnits = WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;\n for (let ii = 0; ii < numTextureUnits; ii++) {\n gl.activeTexture(gl.TEXTURE0 + ii);\n }\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);\n gl.bindTexture(gl.TEXTURE_2D, null);\n\n const numVertexAttribs = WEBGL_INFO.MAX_VERTEX_ATTRIBS; // Fixes https://github.com/xeokit/xeokit-sdk/issues/174\n for (let ii = 0; ii < numVertexAttribs; ii++) {\n gl.disableVertexAttribArray(ii);\n }\n\n if (unbindOutputFrameBuffer) {\n unbindOutputFrameBuffer(params.pass);\n }\n }\n\n /**\n * Picks an Entity.\n * @private\n */\n this.pick = (function () {\n\n const tempVec3a = math.vec3();\n const tempMat4a = math.mat4();\n const tempMat4b = math.mat4();\n\n const randomVec3 = math.vec3();\n const up = math.vec3([0, 1, 0]);\n const _pickResult = new PickResult();\n\n const nearAndFar = math.vec2();\n\n const canvasPos = math.vec3();\n\n const worldRayOrigin = math.vec3();\n const worldRayDir = math.vec3();\n const worldSurfacePos = math.vec3();\n const worldSurfaceNormal = math.vec3();\n\n return function (params, pickResult = _pickResult) {\n\n pickResult.reset();\n\n updateDrawlist();\n\n let look;\n let pickViewMatrix = null;\n let pickProjMatrix = null;\n\n pickResult.pickSurface = params.pickSurface;\n\n if (params.canvasPos) {\n\n canvasPos[0] = params.canvasPos[0];\n canvasPos[1] = params.canvasPos[1];\n\n pickViewMatrix = scene.camera.viewMatrix;\n pickProjMatrix = scene.camera.projMatrix;\n\n pickResult.canvasPos = params.canvasPos;\n\n } else {\n\n // Picking with arbitrary World-space ray\n // Align camera along ray and fire ray through center of canvas\n\n if (params.matrix) {\n\n pickViewMatrix = params.matrix;\n pickProjMatrix = scene.camera.projMatrix;\n\n } else {\n\n worldRayOrigin.set(params.origin || [0, 0, 0]);\n worldRayDir.set(params.direction || [0, 0, 1]);\n\n look = math.addVec3(worldRayOrigin, worldRayDir, tempVec3a);\n\n randomVec3[0] = Math.random();\n randomVec3[1] = Math.random();\n randomVec3[2] = Math.random();\n\n math.normalizeVec3(randomVec3);\n math.cross3Vec3(worldRayDir, randomVec3, up);\n\n pickViewMatrix = math.lookAtMat4v(worldRayOrigin, look, up, tempMat4b);\n // pickProjMatrix = scene.camera.projMatrix;\n pickProjMatrix = scene.camera.ortho.matrix;\n\n pickResult.origin = worldRayOrigin;\n pickResult.direction = worldRayDir;\n }\n\n canvasPos[0] = canvas.clientWidth * 0.5;\n canvasPos[1] = canvas.clientHeight * 0.5;\n }\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableList = drawableTypeInfo[type].drawableList;\n for (let i = 0, len = drawableList.length; i < len; i++) {\n const drawable = drawableList[i];\n if (drawable.setPickMatrices) { // Eg. SceneModel, which needs pre-loading into texture\n drawable.setPickMatrices(pickViewMatrix, pickProjMatrix);\n }\n }\n }\n }\n\n const pickBuffer = renderBufferManager.getRenderBuffer(\"pick\", {size: [1, 1]});\n\n pickBuffer.bind();\n\n const pickable = gpuPickPickable(pickBuffer, canvasPos, pickViewMatrix, pickProjMatrix, params, pickResult);\n\n if (!pickable) {\n pickBuffer.unbind();\n return null;\n }\n\n const pickedEntity = (pickable.delegatePickedEntity) ? pickable.delegatePickedEntity() : pickable;\n\n if (!pickedEntity) {\n pickBuffer.unbind();\n return null;\n }\n\n if (params.pickSurface) {\n\n // GPU-based ray-picking\n\n if (pickable.canPickTriangle && pickable.canPickTriangle()) {\n\n gpuPickTriangle(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, pickResult);\n\n pickable.pickTriangleSurface(pickViewMatrix, pickProjMatrix, pickResult);\n\n pickResult.pickSurfacePrecision = false;\n\n } else {\n\n if (pickable.canPickWorldPos && pickable.canPickWorldPos()) {\n\n nearAndFar[0] = scene.camera.project.near;\n nearAndFar[1] = scene.camera.project.far;\n\n gpuPickWorldPos(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);\n\n if (params.pickSurfaceNormal !== false) {\n gpuPickWorldNormal(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, pickResult);\n }\n\n pickResult.pickSurfacePrecision = false;\n }\n }\n }\n pickBuffer.unbind();\n pickResult.entity = pickedEntity;\n return pickResult;\n };\n })();\n\n function gpuPickPickable(pickBuffer, canvasPos, pickViewMatrix, pickProjMatrix, params, pickResult) {\n\n const resolutionScale = scene.canvas.resolutionScale;\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n frameCtx.pickOrigin = pickResult.origin;\n frameCtx.pickViewMatrix = pickViewMatrix;\n frameCtx.pickProjMatrix = pickProjMatrix;\n frameCtx.pickInvisible = !!params.pickInvisible;\n frameCtx.pickClipPos = [\n getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),\n getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),\n ];\n\n gl.viewport(0, 0, 1, 1);\n gl.depthMask(true);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.BLEND);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n const includeEntityIds = params.includeEntityIds;\n const excludeEntityIds = params.excludeEntityIds;\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n\n for (let i = 0, len = drawableList.length; i < len; i++) {\n\n const drawable = drawableList[i];\n\n if (!drawable.drawPickMesh || (params.pickInvisible !== true && drawable.visible === false) || drawable.pickable === false) {\n continue;\n }\n if (includeEntityIds && !includeEntityIds[drawable.id]) { // TODO: push this logic into drawable\n continue;\n }\n if (excludeEntityIds && excludeEntityIds[drawable.id]) {\n continue;\n }\n\n drawable.drawPickMesh(frameCtx);\n }\n }\n }\n const pix = pickBuffer.read(0, 0);\n const pickID = pix[0] + (pix[1] << 8) + (pix[2] << 16) + (pix[3] << 24);\n\n if (pickID < 0) {\n return;\n }\n\n const pickable = pickIDs.items[pickID];\n\n return pickable;\n }\n\n function gpuPickTriangle(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, pickResult) {\n\n if (!pickable.drawPickTriangles) {\n return;\n }\n\n const resolutionScale = scene.canvas.resolutionScale;\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n frameCtx.pickOrigin = pickResult.origin;\n frameCtx.pickViewMatrix = pickViewMatrix; // Can be null\n frameCtx.pickProjMatrix = pickProjMatrix; // Can be null\n // frameCtx.pickInvisible = !!params.pickInvisible;\n frameCtx.pickClipPos = [\n getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),\n getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),\n ];\n\n gl.viewport(0, 0, 1, 1);\n\n gl.clearColor(0, 0, 0, 0);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.BLEND);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n pickable.drawPickTriangles(frameCtx);\n\n const pix = pickBuffer.read(0, 0);\n\n let primIndex = pix[0] + (pix[1] * 256) + (pix[2] * 256 * 256) + (pix[3] * 256 * 256 * 256);\n\n primIndex *= 3; // Convert from triangle number to first vertex in indices\n\n pickResult.primIndex = primIndex;\n }\n\n const gpuPickWorldPos = (function () {\n\n const tempVec4a = math.vec4();\n const tempVec4b = math.vec4();\n const tempVec4c = math.vec4();\n const tempVec4d = math.vec4();\n const tempVec4e = math.vec4();\n const tempMat4a = math.mat4();\n const tempMat4b = math.mat4();\n const tempMat4c = math.mat4();\n\n return function (pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult) {\n\n const resolutionScale = scene.canvas.resolutionScale;\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n frameCtx.pickOrigin = pickResult.origin;\n frameCtx.pickViewMatrix = pickViewMatrix;\n frameCtx.pickProjMatrix = pickProjMatrix;\n frameCtx.pickZNear = nearAndFar[0];\n frameCtx.pickZFar = nearAndFar[1];\n frameCtx.pickElementsCount = pickable.pickElementsCount;\n frameCtx.pickElementsOffset = pickable.pickElementsOffset;\n frameCtx.pickClipPos = [\n getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),\n getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),\n ];\n\n gl.viewport(0, 0, 1, 1);\n\n gl.clearColor(0, 0, 0, 0);\n gl.depthMask(true);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.BLEND);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n pickable.drawPickDepths(frameCtx); // Draw color-encoded fragment screen-space depths\n\n const pix = pickBuffer.read(0, 0);\n\n const screenZ = unpackDepth(pix); // Get screen-space Z at the given canvas coords\n\n // Calculate clip space coordinates, which will be in range of x=[-1..1] and y=[-1..1], with y=(+1) at top\n const x = (canvasPos[0] - canvas.clientWidth / 2) / (canvas.clientWidth / 2);\n const y = -(canvasPos[1] - canvas.clientHeight / 2) / (canvas.clientHeight / 2);\n\n const origin = pickable.origin;\n let pvMat;\n\n if (origin) {\n const rtcPickViewMat = createRTCViewMat(pickViewMatrix, origin, tempMat4a);\n pvMat = math.mulMat4(pickProjMatrix, rtcPickViewMat, tempMat4b);\n\n } else {\n pvMat = math.mulMat4(pickProjMatrix, pickViewMatrix, tempMat4b);\n }\n\n const pvMatInverse = math.inverseMat4(pvMat, tempMat4c);\n\n tempVec4a[0] = x;\n tempVec4a[1] = y;\n tempVec4a[2] = -1;\n tempVec4a[3] = 1;\n\n let world1 = math.transformVec4(pvMatInverse, tempVec4a);\n world1 = math.mulVec4Scalar(world1, 1 / world1[3]);\n\n tempVec4b[0] = x;\n tempVec4b[1] = y;\n tempVec4b[2] = 1;\n tempVec4b[3] = 1;\n\n let world2 = math.transformVec4(pvMatInverse, tempVec4b);\n world2 = math.mulVec4Scalar(world2, 1 / world2[3]);\n\n const dir = math.subVec3(world2, world1, tempVec4c);\n const worldPos = math.addVec3(world1, math.mulVec4Scalar(dir, screenZ, tempVec4d), tempVec4e);\n\n if (origin) {\n math.addVec3(worldPos, origin);\n }\n\n pickResult.worldPos = worldPos;\n }\n })();\n\n function drawSnapInit(frameCtx) {\n frameCtx.snapPickLayerParams = [];\n frameCtx.snapPickLayerNumber = 0;\n for (let type in drawableTypeInfo) {\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n for (let i = 0, len = drawableList.length; i < len; i++) {\n const drawable = drawableList[i];\n if (drawable.drawSnapInit) {\n if (!drawable.culled && drawable.visible && drawable.pickable) {\n drawable.drawSnapInit(frameCtx);\n }\n }\n }\n }\n return frameCtx.snapPickLayerParams;\n }\n\n function drawSnap(frameCtx) {\n frameCtx.snapPickLayerParams = frameCtx.snapPickLayerParams || [];\n frameCtx.snapPickLayerNumber = frameCtx.snapPickLayerParams.length;\n for (let type in drawableTypeInfo) {\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n for (let i = 0, len = drawableList.length; i < len; i++) {\n const drawable = drawableList[i];\n if (drawable.drawSnap) {\n if (!drawable.culled && drawable.visible && drawable.pickable) {\n drawable.drawSnap(frameCtx);\n }\n }\n }\n }\n return frameCtx.snapPickLayerParams;\n }\n\n function getClipPosX(pos, size) {\n return 2 * (pos / size) - 1;\n }\n\n function getClipPosY(pos, size) {\n return 1 - 2 * (pos / size);\n }\n\n /**\n * @param {[number, number]} canvasPos\n * @param {number} [snapRadiusInPixels=30]\n * @param {boolean} [snapToVertex=true]\n * @param {boolean} [snapToEdge=true]\n * @param pickResult\n * @returns {PickResult}\n */\n this.snapPick = (function () {\n\n const _pickResult = new PickResult();\n\n return function (canvasPos, snapRadiusInPixels, snapToVertex, snapToEdge, pickResult = _pickResult) {\n\n if (!snapToVertex && !snapToEdge) {\n return this.pick({canvasPos, pickSurface: true});\n }\n\n const resolutionScale = scene.canvas.resolutionScale;\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n frameCtx.pickZNear = scene.camera.project.near;\n frameCtx.pickZFar = scene.camera.project.far;\n\n snapRadiusInPixels = snapRadiusInPixels || 30;\n\n const vertexPickBuffer = renderBufferManager.getRenderBuffer(\"uniquePickColors-aabs\", {\n depthTexture: true,\n size: [\n 2 * snapRadiusInPixels + 1,\n 2 * snapRadiusInPixels + 1,\n ]\n });\n\n frameCtx.snapVectorA = [\n getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),\n getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),\n ];\n\n frameCtx.snapInvVectorAB = [\n gl.drawingBufferWidth / (2 * snapRadiusInPixels),\n gl.drawingBufferHeight / (2 * snapRadiusInPixels),\n ];\n\n // Bind and clear the snap render target\n\n vertexPickBuffer.bind(gl.RGBA32I, gl.RGBA32I, gl.RGBA8UI);\n gl.viewport(0, 0, vertexPickBuffer.size[0], vertexPickBuffer.size[1]);\n gl.enable(gl.DEPTH_TEST);\n gl.frontFace(gl.CCW);\n gl.disable(gl.CULL_FACE);\n gl.depthMask(true);\n gl.disable(gl.BLEND);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.DEPTH_BUFFER_BIT);\n gl.clearBufferiv(gl.COLOR, 0, new Int32Array([0, 0, 0, 0]));\n gl.clearBufferiv(gl.COLOR, 1, new Int32Array([0, 0, 0, 0]));\n gl.clearBufferuiv(gl.COLOR, 2, new Uint32Array([0, 0, 0, 0]));\n\n //////////////////////////////////\n // Set view and proj mats for VBO renderers\n ///////////////////////////////////////\n\n const pickViewMatrix = scene.camera.viewMatrix;\n const pickProjMatrix = scene.camera.projMatrix;\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableList = drawableTypeInfo[type].drawableList;\n for (let i = 0, len = drawableList.length; i < len; i++) {\n const drawable = drawableList[i];\n if (drawable.setPickMatrices) { // Eg. SceneModel, which needs pre-loading into texture\n drawable.setPickMatrices(pickViewMatrix, pickProjMatrix);\n }\n }\n }\n }\n\n // a) init z-buffer\n gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1, gl.COLOR_ATTACHMENT2]);\n const layerParamsSurface = drawSnapInit(frameCtx);\n\n // b) snap-pick\n const layerParamsSnap = []\n frameCtx.snapPickLayerParams = layerParamsSnap;\n\n gl.depthMask(false);\n gl.drawBuffers([gl.COLOR_ATTACHMENT0]);\n\n if (snapToVertex && snapToEdge) {\n frameCtx.snapMode = \"edge\";\n drawSnap(frameCtx);\n\n frameCtx.snapMode = \"vertex\";\n frameCtx.snapPickLayerNumber++;\n\n drawSnap(frameCtx);\n } else {\n frameCtx.snapMode = snapToVertex ? \"vertex\" : \"edge\";\n\n drawSnap(frameCtx);\n }\n\n gl.depthMask(true);\n\n // Read and decode the snapped coordinates\n\n const snapPickResultArray = vertexPickBuffer.readArray(gl.RGBA_INTEGER, gl.INT, Int32Array, 4);\n const snapPickNormalResultArray = vertexPickBuffer.readArray(gl.RGBA_INTEGER, gl.INT, Int32Array, 4, 1);\n const snapPickIdResultArray = vertexPickBuffer.readArray(gl.RGBA_INTEGER, gl.UNSIGNED_INT, Uint32Array, 4, 2);\n\n vertexPickBuffer.unbind();\n\n // result 1) regular hi-precision world position\n\n let worldPos = null;\n let worldNormal = null;\n let pickable = null;\n\n const middleX = snapRadiusInPixels;\n const middleY = snapRadiusInPixels;\n const middleIndex = (middleX * 4) + (middleY * vertexPickBuffer.size[0] * 4);\n const pickResultMiddleXY = snapPickResultArray.slice(middleIndex, middleIndex + 4);\n const pickNormalResultMiddleXY = snapPickNormalResultArray.slice(middleIndex, middleIndex + 4);\n const pickPickableResultMiddleXY = snapPickIdResultArray.slice(middleIndex, middleIndex + 4);\n\n if (pickResultMiddleXY[3] !== 0) {\n const pickedLayerParmasSurface = layerParamsSurface[Math.abs(pickResultMiddleXY[3]) % layerParamsSurface.length];\n const origin = pickedLayerParmasSurface.origin;\n const scale = pickedLayerParmasSurface.coordinateScale;\n worldPos = [\n pickResultMiddleXY[0] * scale[0] + origin[0],\n pickResultMiddleXY[1] * scale[1] + origin[1],\n pickResultMiddleXY[2] * scale[2] + origin[2],\n ];\n worldNormal = math.normalizeVec3([\n pickNormalResultMiddleXY[0] / math.MAX_INT,\n pickNormalResultMiddleXY[1] / math.MAX_INT,\n pickNormalResultMiddleXY[2] / math.MAX_INT,\n ]);\n\n const pickID =\n pickPickableResultMiddleXY[0]\n + (pickPickableResultMiddleXY[1] << 8)\n + (pickPickableResultMiddleXY[2] << 16)\n + (pickPickableResultMiddleXY[3] << 24);\n\n pickable = pickIDs.items[pickID];\n }\n\n // result 2) hi-precision snapped (to vertex/edge) world position\n\n let snapPickResult = [];\n\n for (let i = 0; i < snapPickResultArray.length; i += 4) {\n if (snapPickResultArray[i + 3] > 0) {\n const pixelNumber = Math.floor(i / 4);\n const w = vertexPickBuffer.size[0];\n const x = pixelNumber % w - Math.floor(w / 2);\n const y = Math.floor(pixelNumber / w) - Math.floor(w / 2);\n const dist = (Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));\n snapPickResult.push({\n x,\n y,\n dist,\n isVertex: snapToVertex && snapToEdge ? snapPickResultArray[i + 3] > layerParamsSnap.length / 2 : snapToVertex,\n result: [\n snapPickResultArray[i + 0],\n snapPickResultArray[i + 1],\n snapPickResultArray[i + 2],\n snapPickResultArray[i + 3],\n ],\n normal: [\n snapPickNormalResultArray[i + 0],\n snapPickNormalResultArray[i + 1],\n snapPickNormalResultArray[i + 2],\n snapPickNormalResultArray[i + 3],\n ],\n id: [\n snapPickIdResultArray[i + 0],\n snapPickIdResultArray[i + 1],\n snapPickIdResultArray[i + 2],\n snapPickIdResultArray[i + 3],\n ]\n });\n }\n }\n\n let snappedWorldPos = null;\n let snappedWorldNormal = null;\n let snappedPickable = null;\n let snapType = null;\n\n if (snapPickResult.length > 0) {\n // vertex snap first, then edge snap\n snapPickResult.sort((a, b) => {\n if (a.isVertex !== b.isVertex) {\n return a.isVertex ? -1 : 1;\n } else {\n return a.dist - b.dist;\n }\n });\n\n snapType = snapPickResult[0].isVertex ? \"vertex\" : \"edge\";\n const snapPick = snapPickResult[0].result;\n const snapPickNormal = snapPickResult[0].normal;\n const snapPickId = snapPickResult[0].id;\n\n const pickedLayerParmas = layerParamsSnap[snapPick[3]];\n\n const origin = pickedLayerParmas.origin;\n const scale = pickedLayerParmas.coordinateScale;\n\n snappedWorldNormal = math.normalizeVec3([\n snapPickNormal[0] / math.MAX_INT,\n snapPickNormal[1] / math.MAX_INT,\n snapPickNormal[2] / math.MAX_INT,\n ]);\n\n snappedWorldPos = [\n snapPick[0] * scale[0] + origin[0],\n snapPick[1] * scale[1] + origin[1],\n snapPick[2] * scale[2] + origin[2],\n ];\n\n snappedPickable = pickIDs.items[\n snapPickId[0]\n + (snapPickId[1] << 8)\n + (snapPickId[2] << 16)\n + (snapPickId[3] << 24)\n ];\n }\n\n if (null === worldPos && null == snappedWorldPos) { // If neither regular pick or snap pick, return null\n return null;\n }\n\n let snappedCanvasPos = null;\n\n if (null !== snappedWorldPos) {\n snappedCanvasPos = scene.camera.projectWorldPos(snappedWorldPos);\n }\n\n const snappedEntity = (snappedPickable && snappedPickable.delegatePickedEntity) ? snappedPickable.delegatePickedEntity() : snappedPickable;\n\n pickResult.reset();\n pickResult.snappedToEdge = (snapType === \"edge\");\n pickResult.snappedToVertex = (snapType === \"vertex\");\n pickResult.worldPos = snappedWorldPos;\n pickResult.worldNormal = snappedWorldNormal;\n pickResult.entity = snappedEntity;\n pickResult.canvasPos = canvasPos;\n pickResult.snappedCanvasPos = snappedCanvasPos || canvasPos;\n\n return pickResult;\n };\n })();\n\n function unpackDepth(depthZ) {\n const vec = [depthZ[0] / 256.0, depthZ[1] / 256.0, depthZ[2] / 256.0, depthZ[3] / 256.0];\n const bitShift = [1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0];\n return math.dotVec4(vec, bitShift);\n }\n\n function gpuPickWorldNormal(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, pickResult) {\n\n const resolutionScale = scene.canvas.resolutionScale;\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n frameCtx.pickOrigin = pickResult.origin;\n frameCtx.pickViewMatrix = pickViewMatrix;\n frameCtx.pickProjMatrix = pickProjMatrix;\n frameCtx.pickClipPos = [\n getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),\n getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),\n ];\n\n const pickNormalBuffer = renderBufferManager.getRenderBuffer(\"pick-normal\", {size: [3, 3]});\n\n pickNormalBuffer.bind(gl.RGBA32I);\n\n gl.viewport(0, 0, pickNormalBuffer.size[0], pickNormalBuffer.size[1]);\n\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.BLEND);\n gl.clear(gl.DEPTH_BUFFER_BIT);\n gl.clearBufferiv(gl.COLOR, 0, new Int32Array([0, 0, 0, 0]));\n\n pickable.drawPickNormals(frameCtx); // Draw color-encoded fragment World-space normals\n\n const pix = pickNormalBuffer.read(1, 1, gl.RGBA_INTEGER, gl.INT, Int32Array, 4);\n\n pickNormalBuffer.unbind();\n\n const worldNormal = [\n pix[0] / math.MAX_INT,\n pix[1] / math.MAX_INT,\n pix[2] / math.MAX_INT,\n ];\n\n math.normalizeVec3(worldNormal);\n\n pickResult.worldNormal = worldNormal;\n }\n\n /**\n * Adds a {@link Marker} for occlusion testing.\n * @param marker\n */\n this.addMarker = function (marker) {\n this._occlusionTester = this._occlusionTester || new OcclusionTester(scene, renderBufferManager);\n this._occlusionTester.addMarker(marker);\n scene.occlusionTestCountdown = 0;\n };\n\n /**\n * Notifies that a {@link Marker#worldPos} has updated.\n * @param marker\n */\n this.markerWorldPosUpdated = function (marker) {\n this._occlusionTester.markerWorldPosUpdated(marker);\n };\n\n /**\n * Removes a {@link Marker} from occlusion testing.\n * @param marker\n */\n this.removeMarker = function (marker) {\n this._occlusionTester.removeMarker(marker);\n };\n\n /**\n * Performs an occlusion test for all added {@link Marker}s, updating\n * their {@link Marker#visible} properties accordingly.\n */\n this.doOcclusionTest = function () {\n\n if (this._occlusionTester && this._occlusionTester.needOcclusionTest) {\n\n updateDrawlist();\n\n this._occlusionTester.bindRenderBuf();\n\n frameCtx.reset();\n frameCtx.backfaces = true;\n frameCtx.frontface = true; // \"ccw\"\n\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.clearColor(0, 0, 0, 0);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.disable(gl.BLEND);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n for (let type in drawableTypeInfo) {\n if (drawableTypeInfo.hasOwnProperty(type)) {\n const drawableInfo = drawableTypeInfo[type];\n const drawableList = drawableInfo.drawableList;\n for (let i = 0, len = drawableList.length; i < len; i++) {\n const drawable = drawableList[i];\n if (!drawable.drawOcclusion || drawable.culled === true || drawable.visible === false || drawable.pickable === false) { // TODO: Option to exclude transparent?\n continue;\n }\n\n drawable.drawOcclusion(frameCtx);\n }\n }\n }\n\n this._occlusionTester.drawMarkers(frameCtx);\n this._occlusionTester.doOcclusionTest(); // Updates Marker \"visible\" properties\n this._occlusionTester.unbindRenderBuf();\n }\n };\n\n /**\n * Read pixels from the renderer's current output. Performs a force-render first.\n * @param pixels\n * @param colors\n * @param len\n * @param opaqueOnly\n * @private\n */\n this.readPixels = function (pixels, colors, len, opaqueOnly) {\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n snapshotBuffer.bind();\n snapshotBuffer.clear();\n this.render({force: true, opaqueOnly: opaqueOnly});\n let color;\n let i;\n let j;\n let k;\n for (i = 0; i < len; i++) {\n j = i * 2;\n k = i * 4;\n color = snapshotBuffer.read(pixels[j], pixels[j + 1]);\n colors[k] = color[0];\n colors[k + 1] = color[1];\n colors[k + 2] = color[2];\n colors[k + 3] = color[3];\n }\n snapshotBuffer.unbind();\n imageDirty = true;\n };\n\n /**\n * Enter snapshot mode.\n *\n * Switches rendering to a hidden snapshot canvas.\n *\n * Exit snapshot mode using endSnapshot().\n */\n this.beginSnapshot = function (params = {}) {\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n if (params.width && params.height) {\n snapshotBuffer.setSize([params.width, params.height]);\n }\n snapshotBuffer.bind();\n snapshotBuffer.clear();\n snapshotBound = true;\n };\n\n /**\n * When in snapshot mode, renders a frame of the current Scene state to the snapshot canvas.\n */\n this.renderSnapshot = function () {\n if (!snapshotBound) {\n return;\n }\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n snapshotBuffer.clear();\n this.render({force: true, opaqueOnly: false});\n imageDirty = true;\n };\n\n /**\n * When in snapshot mode, gets an image of the snapshot canvas.\n *\n * @private\n * @returns {String} The image data URI.\n */\n this.readSnapshot = function (params) {\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n return snapshotBuffer.readImage(params);\n };\n\n /**\n * Returns an HTMLCanvas containing an image of the snapshot canvas.\n *\n * - The HTMLCanvas has a CanvasRenderingContext2D.\n * - Expects the caller to draw more things on the HTMLCanvas (annotations etc).\n *\n * @returns {HTMLCanvasElement}\n */\n this.readSnapshotAsCanvas = function () {\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n return snapshotBuffer.readImageAsCanvas();\n };\n\n /**\n * Exists snapshot mode.\n *\n * Switches rendering back to the main canvas.\n */\n this.endSnapshot = function () {\n if (!snapshotBound) {\n return;\n }\n const snapshotBuffer = renderBufferManager.getRenderBuffer(\"snapshot\");\n snapshotBuffer.unbind();\n snapshotBound = false;\n };\n\n /**\n * Destroys this renderer.\n * @private\n */\n this.destroy = function () {\n\n drawableTypeInfo = {};\n drawables = {};\n\n renderBufferManager.destroy();\n\n saoOcclusionRenderer.destroy();\n saoDepthLimitedBlurRenderer.destroy();\n\n if (this._occlusionTester) {\n this._occlusionTester.destroy();\n }\n };\n};\n\nexport {Renderer};\n", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Renderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Renderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8853, + "__docId__": 8861, "kind": "function", "name": "Renderer", "memberof": "src/viewer/scene/webgl/Renderer.js", @@ -174463,18 +174679,18 @@ "return": null }, { - "__docId__": 8854, + "__docId__": 8862, "kind": "file", "name": "src/viewer/scene/webgl/Sampler.js", "content": "/**\n * @desc A low-level component that represents a WebGL Sampler.\n * @private\n */\nclass Sampler {\n\n constructor(gl, location) {\n this.bindTexture = function (texture, unit) {\n if (texture.bind(unit)) {\n gl.uniform1i(location, unit);\n return true;\n }\n return false;\n };\n }\n}\n\nexport {Sampler};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Sampler.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Sampler.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8855, + "__docId__": 8863, "kind": "class", "name": "Sampler", "memberof": "src/viewer/scene/webgl/Sampler.js", @@ -174490,7 +174706,7 @@ "ignore": true }, { - "__docId__": 8856, + "__docId__": 8864, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/Sampler.js~Sampler", @@ -174504,18 +174720,18 @@ "undocument": true }, { - "__docId__": 8857, + "__docId__": 8865, "kind": "file", "name": "src/viewer/scene/webgl/Shader.js", "content": "/**\n * @desc Represents a vertex or fragment stage within a {@link Program}.\n * @private\n */\nclass Shader {\n\n constructor(gl, type, source) {\n\n this.allocated = false;\n this.compiled = false;\n this.handle = gl.createShader(type);\n\n if (!this.handle) {\n this.errors = [\n \"Failed to allocate\"\n ];\n return;\n }\n\n this.allocated = true;\n\n gl.shaderSource(this.handle, source);\n gl.compileShader(this.handle);\n\n this.compiled = gl.getShaderParameter(this.handle, gl.COMPILE_STATUS);\n\n if (!this.compiled) {\n\n if (!gl.isContextLost()) { // Handled explicitly elsewhere, so won't re-handle here\n\n const lines = source.split(\"\\n\");\n const numberedLines = [];\n for (let i = 0; i < lines.length; i++) {\n numberedLines.push((i + 1) + \": \" + lines[i] + \"\\n\");\n }\n this.errors = [];\n this.errors.push(\"\");\n this.errors.push(gl.getShaderInfoLog(this.handle));\n this.errors = this.errors.concat(numberedLines.join(\"\"));\n }\n }\n }\n\n destroy() {\n\n }\n}\n\nexport {Shader};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Shader.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Shader.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8858, + "__docId__": 8866, "kind": "class", "name": "Shader", "memberof": "src/viewer/scene/webgl/Shader.js", @@ -174531,7 +174747,7 @@ "ignore": true }, { - "__docId__": 8859, + "__docId__": 8867, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174545,7 +174761,7 @@ "undocument": true }, { - "__docId__": 8860, + "__docId__": 8868, "kind": "member", "name": "allocated", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174562,7 +174778,7 @@ } }, { - "__docId__": 8861, + "__docId__": 8869, "kind": "member", "name": "compiled", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174579,7 +174795,7 @@ } }, { - "__docId__": 8862, + "__docId__": 8870, "kind": "member", "name": "handle", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174596,7 +174812,7 @@ } }, { - "__docId__": 8863, + "__docId__": 8871, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174613,7 +174829,7 @@ } }, { - "__docId__": 8868, + "__docId__": 8876, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/Shader.js~Shader", @@ -174629,18 +174845,18 @@ "return": null }, { - "__docId__": 8869, + "__docId__": 8877, "kind": "file", "name": "src/viewer/scene/webgl/Texture2D.js", "content": "import {utils} from '../utils.js';\nimport {convertConstant} from \"./convertConstant.js\";\nimport {\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipMapNearestFilter,\n RGBAFormat,\n sRGBEncoding,\n UnsignedByteType,\n RepeatWrapping,\n ClampToEdgeWrapping,\n LinearFilter,\n NearestMipmapNearestFilter\n} from \"../constants/constants.js\";\nimport {getExtension} from \"./getExtension.js\";\n\nconst color = new Uint8Array([0, 0, 0, 1]);\n\n/**\n * @desc A low-level component that represents a 2D WebGL texture.\n *\n * @private\n */\nclass Texture2D {\n\n constructor({gl, target, format, type, wrapS, wrapT, wrapR, encoding, preloadColor, premultiplyAlpha, flipY}) {\n\n this.gl = gl;\n\n this.target = target || gl.TEXTURE_2D;\n this.format = format || RGBAFormat;\n this.type = type || UnsignedByteType;\n this.internalFormat = null;\n this.premultiplyAlpha = !!premultiplyAlpha;\n this.flipY = !!flipY;\n this.unpackAlignment = 4;\n this.wrapS = wrapS || RepeatWrapping;\n this.wrapT = wrapT || RepeatWrapping;\n this.wrapR = wrapR || RepeatWrapping;\n this.encoding = encoding || sRGBEncoding;\n this.texture = gl.createTexture();\n\n if (preloadColor) {\n this.setPreloadColor(preloadColor); // Prevents \"there is no texture bound to the unit 0\" error\n }\n\n this.allocated = true;\n }\n\n setPreloadColor(value) {\n if (!value) {\n color[0] = 0;\n color[1] = 0;\n color[2] = 0;\n color[3] = 255;\n } else {\n color[0] = Math.floor(value[0] * 255);\n color[1] = Math.floor(value[1] * 255);\n color[2] = Math.floor(value[2] * 255);\n color[3] = Math.floor((value[3] !== undefined ? value[3] : 1) * 255);\n }\n const gl = this.gl;\n gl.bindTexture(this.target, this.texture);\n if (this.target === gl.TEXTURE_CUBE_MAP) {\n const faces = [\n gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\n ];\n for (let i = 0, len = faces.length; i < len; i++) {\n gl.texImage2D(faces[i], 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, color);\n }\n } else {\n gl.texImage2D(this.target, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, color);\n }\n gl.bindTexture(this.target, null);\n }\n\n setTarget(target) {\n this.target = target || this.gl.TEXTURE_2D;\n }\n\n setImage(image, props = {}) {\n\n const gl = this.gl;\n\n if (props.format !== undefined) {\n this.format = props.format;\n }\n if (props.internalFormat !== undefined) {\n this.internalFormat = props.internalFormat;\n }\n if (props.encoding !== undefined) {\n this.encoding = props.encoding;\n }\n if (props.type !== undefined) {\n this.type = props.type;\n }\n if (props.flipY !== undefined) {\n this.flipY = props.flipY;\n }\n if (props.premultiplyAlpha !== undefined) {\n this.premultiplyAlpha = props.premultiplyAlpha;\n }\n if (props.unpackAlignment !== undefined) {\n this.unpackAlignment = props.unpackAlignment;\n }\n if (props.minFilter !== undefined) {\n this.minFilter = props.minFilter;\n }\n if (props.magFilter !== undefined) {\n this.magFilter = props.magFilter;\n }\n if (props.wrapS !== undefined) {\n this.wrapS = props.wrapS;\n }\n if (props.wrapT !== undefined) {\n this.wrapT = props.wrapT;\n }\n if (props.wrapR !== undefined) {\n this.wrapR = props.wrapR;\n }\n\n let generateMipMap = false;\n\n gl.bindTexture(this.target, this.texture);\n\n const bak1 = gl.getParameter(gl.UNPACK_FLIP_Y_WEBGL);\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this.flipY);\n\n const bak2 = gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n\n const bak3 = gl.getParameter(gl.UNPACK_ALIGNMENT);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, this.unpackAlignment);\n\n const bak4 = gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);;\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);\n\n const minFilter = convertConstant(gl, this.minFilter);\n gl.texParameteri(this.target, gl.TEXTURE_MIN_FILTER, minFilter);\n\n if (minFilter === gl.NEAREST_MIPMAP_NEAREST\n || minFilter === gl.LINEAR_MIPMAP_NEAREST\n || minFilter === gl.NEAREST_MIPMAP_LINEAR\n || minFilter === gl.LINEAR_MIPMAP_LINEAR) {\n generateMipMap = true;\n }\n\n const magFilter = convertConstant(gl, this.magFilter);\n if (magFilter) {\n gl.texParameteri(this.target, gl.TEXTURE_MAG_FILTER, magFilter);\n }\n\n const wrapS = convertConstant(gl, this.wrapS);\n if (wrapS) {\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, wrapS);\n }\n\n const wrapT = convertConstant(gl, this.wrapT);\n if (wrapT) {\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_T, wrapT);\n }\n\n const glFormat = convertConstant(gl, this.format, this.encoding);\n const glType = convertConstant(gl, this.type);\n const glInternalFormat = getInternalFormat(gl, this.internalFormat, glFormat, glType, this.encoding, false);\n\n if (this.target === gl.TEXTURE_CUBE_MAP) {\n if (utils.isArray(image)) {\n const images = image;\n const faces = [\n gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\n ];\n for (let i = 0, len = faces.length; i < len; i++) {\n gl.texImage2D(faces[i], 0, glInternalFormat, glFormat, glType, images[i]);\n }\n }\n } else {\n gl.texImage2D(gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image);\n }\n\n if (generateMipMap) {\n gl.generateMipmap(this.target);\n }\n\n gl.bindTexture(this.target, null);\n\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, bak1);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, bak2);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, bak3);\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, bak4);\n }\n\n setCompressedData({mipmaps, props = {}}) {\n\n const gl = this.gl;\n const levels = mipmaps.length;\n\n // Cache props\n\n if (props.format !== undefined) {\n this.format = props.format;\n }\n if (props.internalFormat !== undefined) {\n this.internalFormat = props.internalFormat;\n }\n if (props.encoding !== undefined) {\n this.encoding = props.encoding;\n }\n if (props.type !== undefined) {\n this.type = props.type;\n }\n if (props.flipY !== undefined) {\n this.flipY = props.flipY;\n }\n if (props.premultiplyAlpha !== undefined) {\n this.premultiplyAlpha = props.premultiplyAlpha;\n }\n if (props.unpackAlignment !== undefined) {\n this.unpackAlignment = props.unpackAlignment;\n }\n if (props.minFilter !== undefined) {\n this.minFilter = props.minFilter;\n }\n if (props.magFilter !== undefined) {\n this.magFilter = props.magFilter;\n }\n if (props.wrapS !== undefined) {\n this.wrapS = props.wrapS;\n }\n if (props.wrapT !== undefined) {\n this.wrapT = props.wrapT;\n }\n if (props.wrapR !== undefined) {\n this.wrapR = props.wrapR;\n }\n\n gl.activeTexture(gl.TEXTURE0 + 0);\n gl.bindTexture(this.target, this.texture);\n\n let supportsMips = mipmaps.length > 1;\n\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this.flipY);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, this.unpackAlignment);\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);\n\n const wrapS = convertConstant(gl, this.wrapS);\n if (wrapS) {\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, wrapS);\n }\n\n const wrapT = convertConstant(gl, this.wrapT);\n if (wrapT) {\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_T, wrapT);\n }\n\n if (this.type === gl.TEXTURE_3D || this.type === gl.TEXTURE_2D_ARRAY) {\n const wrapR = convertConstant(gl, this.wrapR);\n if (wrapR) {\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_R, wrapR);\n }\n gl.texParameteri(this.type, gl.TEXTURE_WRAP_R, wrapR);\n }\n\n if (supportsMips) {\n gl.texParameteri(this.target, gl.TEXTURE_MIN_FILTER, filterFallback(gl, this.minFilter));\n gl.texParameteri(this.target, gl.TEXTURE_MAG_FILTER, filterFallback(gl, this.magFilter));\n\n } else {\n gl.texParameteri(this.target, gl.TEXTURE_MIN_FILTER, convertConstant(gl, this.minFilter));\n gl.texParameteri(this.target, gl.TEXTURE_MAG_FILTER, convertConstant(gl, this.magFilter));\n }\n\n const glFormat = convertConstant(gl, this.format, this.encoding);\n const glType = convertConstant(gl, this.type);\n const glInternalFormat = getInternalFormat(gl, this.internalFormat, glFormat, glType, this.encoding, false);\n\n gl.texStorage2D(gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n\n for (let i = 0, len = mipmaps.length; i < len; i++) {\n\n const mipmap = mipmaps[i];\n\n if (this.format !== RGBAFormat) {\n if (glFormat !== null) {\n gl.compressedTexSubImage2D(gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n } else {\n console.warn('Attempt to load unsupported compressed texture format in .setCompressedData()');\n }\n } else {\n gl.texSubImage2D(gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n }\n }\n\n // if (generateMipMap) {\n // // gl.generateMipmap(this.target); // Only for roughness textures?\n // }\n\n gl.bindTexture(this.target, null);\n }\n\n setProps(props) {\n const gl = this.gl;\n gl.bindTexture(this.target, this.texture);\n this._uploadProps(props);\n gl.bindTexture(this.target, null);\n }\n\n _uploadProps(props) {\n const gl = this.gl;\n if (props.format !== undefined) {\n this.format = props.format;\n }\n if (props.internalFormat !== undefined) {\n this.internalFormat = props.internalFormat;\n }\n if (props.encoding !== undefined) {\n this.encoding = props.encoding;\n }\n if (props.type !== undefined) {\n this.type = props.type;\n }\n if (props.minFilter !== undefined) {\n const minFilter = convertConstant(gl, props.minFilter);\n if (minFilter) {\n this.minFilter = props.minFilter;\n gl.texParameteri(this.target, gl.TEXTURE_MIN_FILTER, minFilter);\n if (minFilter === gl.NEAREST_MIPMAP_NEAREST || minFilter === gl.LINEAR_MIPMAP_NEAREST || minFilter === gl.NEAREST_MIPMAP_LINEAR || minFilter === gl.LINEAR_MIPMAP_LINEAR) {\n gl.generateMipmap(this.target);\n }\n }\n }\n if (props.magFilter !== undefined) {\n const magFilter = convertConstant(gl, props.magFilter);\n if (magFilter) {\n this.magFilter = props.magFilter;\n gl.texParameteri(this.target, gl.TEXTURE_MAG_FILTER, magFilter);\n }\n }\n if (props.wrapS !== undefined) {\n const wrapS = convertConstant(gl, props.wrapS);\n if (wrapS) {\n this.wrapS = props.wrapS;\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, wrapS);\n }\n }\n if (props.wrapT !== undefined) {\n const wrapT = convertConstant(gl, props.wrapT);\n if (wrapT) {\n this.wrapT = props.wrapT;\n gl.texParameteri(this.target, gl.TEXTURE_WRAP_T, wrapT);\n }\n }\n }\n\n bind(unit) {\n if (!this.allocated) {\n return;\n }\n if (this.texture) {\n const gl = this.gl;\n gl.activeTexture(gl[\"TEXTURE\" + unit]);\n gl.bindTexture(this.target, this.texture);\n return true;\n }\n return false;\n }\n\n unbind(unit) {\n if (!this.allocated) {\n return;\n }\n if (this.texture) {\n const gl = this.gl;\n gl.activeTexture(gl[\"TEXTURE\" + unit]);\n gl.bindTexture(this.target, null);\n }\n }\n\n destroy() {\n if (!this.allocated) {\n return;\n }\n if (this.texture) {\n this.gl.deleteTexture(this.texture);\n this.texture = null;\n }\n }\n}\n\nfunction getInternalFormat(gl, internalFormatName, glFormat, glType, encoding, isVideoTexture = false) {\n if (internalFormatName !== null) {\n if (gl[internalFormatName] !== undefined) {\n return gl[internalFormatName];\n }\n console.warn('Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'');\n }\n let internalFormat = glFormat;\n if (glFormat === gl.RED) {\n if (glType === gl.FLOAT) internalFormat = gl.R32F;\n if (glType === gl.HALF_FLOAT) internalFormat = gl.R16F;\n if (glType === gl.UNSIGNED_BYTE) internalFormat = gl.R8;\n }\n if (glFormat === gl.RG) {\n if (glType === gl.FLOAT) internalFormat = gl.RG32F;\n if (glType === gl.HALF_FLOAT) internalFormat = gl.RG16F;\n if (glType === gl.UNSIGNED_BYTE) internalFormat = gl.RG8;\n }\n if (glFormat === gl.RGBA) {\n if (glType === gl.FLOAT) internalFormat = gl.RGBA32F;\n if (glType === gl.HALF_FLOAT) internalFormat = gl.RGBA16F;\n if (glType === gl.UNSIGNED_BYTE) internalFormat = (encoding === sRGBEncoding && isVideoTexture === false) ? gl.SRGB8_ALPHA8 : gl.RGBA8;\n if (glType === gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = gl.RGBA4;\n if (glType === gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = gl.RGB5_A1;\n }\n if (internalFormat === gl.R16F || internalFormat === gl.R32F ||\n internalFormat === gl.RG16F || internalFormat === gl.RG32F ||\n internalFormat === gl.RGBA16F || internalFormat === gl.RGBA32F) {\n getExtension(gl, 'EXT_color_buffer_float');\n }\n return internalFormat;\n}\n\nfunction filterFallback(gl, f) {\n if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) {\n return gl.NEAREST;\n }\n return gl.LINEAR;\n\n}\n\nexport {Texture2D};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/Texture2D.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/Texture2D.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8870, + "__docId__": 8878, "kind": "variable", "name": "color", "memberof": "src/viewer/scene/webgl/Texture2D.js", @@ -174661,7 +174877,7 @@ "ignore": true }, { - "__docId__": 8871, + "__docId__": 8879, "kind": "function", "name": "getInternalFormat", "memberof": "src/viewer/scene/webgl/Texture2D.js", @@ -174725,7 +174941,7 @@ "ignore": true }, { - "__docId__": 8872, + "__docId__": 8880, "kind": "function", "name": "filterFallback", "memberof": "src/viewer/scene/webgl/Texture2D.js", @@ -174762,7 +174978,7 @@ "ignore": true }, { - "__docId__": 8873, + "__docId__": 8881, "kind": "class", "name": "Texture2D", "memberof": "src/viewer/scene/webgl/Texture2D.js", @@ -174778,7 +174994,7 @@ "ignore": true }, { - "__docId__": 8874, + "__docId__": 8882, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174792,7 +175008,7 @@ "undocument": true }, { - "__docId__": 8875, + "__docId__": 8883, "kind": "member", "name": "gl", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174809,7 +175025,7 @@ } }, { - "__docId__": 8876, + "__docId__": 8884, "kind": "member", "name": "target", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174826,7 +175042,7 @@ } }, { - "__docId__": 8877, + "__docId__": 8885, "kind": "member", "name": "format", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174843,7 +175059,7 @@ } }, { - "__docId__": 8878, + "__docId__": 8886, "kind": "member", "name": "type", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174860,7 +175076,7 @@ } }, { - "__docId__": 8879, + "__docId__": 8887, "kind": "member", "name": "internalFormat", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174877,7 +175093,7 @@ } }, { - "__docId__": 8880, + "__docId__": 8888, "kind": "member", "name": "premultiplyAlpha", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174894,7 +175110,7 @@ } }, { - "__docId__": 8881, + "__docId__": 8889, "kind": "member", "name": "flipY", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174911,7 +175127,7 @@ } }, { - "__docId__": 8882, + "__docId__": 8890, "kind": "member", "name": "unpackAlignment", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174928,7 +175144,7 @@ } }, { - "__docId__": 8883, + "__docId__": 8891, "kind": "member", "name": "wrapS", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174945,7 +175161,7 @@ } }, { - "__docId__": 8884, + "__docId__": 8892, "kind": "member", "name": "wrapT", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174962,7 +175178,7 @@ } }, { - "__docId__": 8885, + "__docId__": 8893, "kind": "member", "name": "wrapR", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174979,7 +175195,7 @@ } }, { - "__docId__": 8886, + "__docId__": 8894, "kind": "member", "name": "encoding", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -174996,7 +175212,7 @@ } }, { - "__docId__": 8887, + "__docId__": 8895, "kind": "member", "name": "texture", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175013,7 +175229,7 @@ } }, { - "__docId__": 8888, + "__docId__": 8896, "kind": "member", "name": "allocated", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175030,7 +175246,7 @@ } }, { - "__docId__": 8889, + "__docId__": 8897, "kind": "method", "name": "setPreloadColor", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175053,7 +175269,7 @@ "return": null }, { - "__docId__": 8890, + "__docId__": 8898, "kind": "method", "name": "setTarget", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175076,7 +175292,7 @@ "return": null }, { - "__docId__": 8892, + "__docId__": 8900, "kind": "method", "name": "setImage", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175108,7 +175324,7 @@ "return": null }, { - "__docId__": 8900, + "__docId__": 8908, "kind": "member", "name": "minFilter", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175125,7 +175341,7 @@ } }, { - "__docId__": 8901, + "__docId__": 8909, "kind": "member", "name": "magFilter", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175142,7 +175358,7 @@ } }, { - "__docId__": 8905, + "__docId__": 8913, "kind": "method", "name": "setCompressedData", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175170,7 +175386,7 @@ "return": null }, { - "__docId__": 8918, + "__docId__": 8926, "kind": "method", "name": "setProps", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175193,7 +175409,7 @@ "return": null }, { - "__docId__": 8919, + "__docId__": 8927, "kind": "method", "name": "_uploadProps", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175217,7 +175433,7 @@ "return": null }, { - "__docId__": 8928, + "__docId__": 8936, "kind": "method", "name": "bind", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175244,7 +175460,7 @@ } }, { - "__docId__": 8929, + "__docId__": 8937, "kind": "method", "name": "unbind", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175267,7 +175483,7 @@ "return": null }, { - "__docId__": 8930, + "__docId__": 8938, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/Texture2D.js~Texture2D", @@ -175283,18 +175499,18 @@ "return": null }, { - "__docId__": 8932, + "__docId__": 8940, "kind": "file", "name": "src/viewer/scene/webgl/convertConstant.js", "content": "import {\n RGBA_ASTC_4x4_Format,\n RGBA_ASTC_5x4_Format,\n RGBA_ASTC_5x5_Format,\n RGBA_ASTC_6x5_Format,\n RGBA_ASTC_6x6_Format,\n RGBA_ASTC_8x5_Format,\n RGBA_ASTC_8x6_Format,\n RGBA_ASTC_8x8_Format,\n RGBA_ASTC_10x5_Format,\n RGBA_ASTC_10x6_Format,\n RGBA_ASTC_10x8_Format,\n RGBA_ASTC_10x10_Format,\n RGBA_ASTC_12x10_Format,\n RGBA_ASTC_12x12_Format,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_2BPPV1_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGB_PVRTC_2BPPV1_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGBA_S3TC_DXT3_Format,\n RGBA_S3TC_DXT1_Format,\n RGB_S3TC_DXT1_Format,\n DepthFormat,\n DepthStencilFormat,\n LuminanceAlphaFormat,\n LuminanceFormat,\n RedFormat,\n RGBFormat,\n RGBAFormat,\n AlphaFormat,\n RedIntegerFormat,\n RGFormat,\n RGIntegerFormat,\n RGBAIntegerFormat,\n HalfFloatType,\n FloatType,\n UnsignedIntType,\n IntType,\n UnsignedShortType,\n ShortType,\n ByteType,\n UnsignedInt248Type,\n UnsignedShort5551Type,\n UnsignedShort4444Type,\n UnsignedByteType,\n RGBA_BPTC_Format,\n sRGBEncoding,\n // _SRGBAFormat,\n RepeatWrapping,\n ClampToEdgeWrapping,\n NearestFilter,\n LinearFilter,\n NearestMipMapNearestFilter,\n LinearMipMapNearestFilter,\n NearestMipMapLinearFilter, LinearMipMapLinearFilter\n} from '../constants/constants.js';\n\nimport {getExtension} from \"./getExtension.js\";\n\n/**\n * @private\n */\nfunction convertConstant(gl, constantVal, encoding = null) {\n\n let extension;\n const p = constantVal;\n\n if (p === UnsignedByteType) return gl.UNSIGNED_BYTE;\n if (p === UnsignedShort4444Type) return gl.UNSIGNED_SHORT_4_4_4_4;\n if (p === UnsignedShort5551Type) return gl.UNSIGNED_SHORT_5_5_5_1;\n\n if (p === ByteType) return gl.BYTE;\n if (p === ShortType) return gl.SHORT;\n if (p === UnsignedShortType) return gl.UNSIGNED_SHORT;\n if (p === IntType) return gl.INT;\n if (p === UnsignedIntType) return gl.UNSIGNED_INT;\n if (p === FloatType) return gl.FLOAT;\n\n if (p === HalfFloatType) {\n return gl.HALF_FLOAT;\n }\n\n if (p === AlphaFormat) return gl.ALPHA;\n if (p === RGBAFormat) return gl.RGBA;\n if (p === LuminanceFormat) return gl.LUMINANCE;\n if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;\n if (p === DepthFormat) return gl.DEPTH_COMPONENT;\n if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;\n if (p === RedFormat) return gl.RED;\n\n if (p === RGBFormat) {\n return gl.RGBA;\n }\n\n // WebGL2 formats.\n\n if (p === RedIntegerFormat) return gl.RED_INTEGER;\n if (p === RGFormat) return gl.RG;\n if (p === RGIntegerFormat) return gl.RG_INTEGER;\n if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER;\n\n // S3TC\n\n if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) {\n if (encoding === sRGBEncoding) {\n const extension = getExtension(gl, 'WEBGL_compressed_texture_s3tc_srgb');\n if (extension !== null) {\n if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n } else {\n return null;\n }\n } else {\n extension = getExtension(gl, 'WEBGL_compressed_texture_s3tc');\n if (extension !== null) {\n if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n } else {\n return null;\n }\n }\n }\n\n // PVRTC\n\n if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) {\n const extension = getExtension(gl, 'WEBGL_compressed_texture_pvrtc');\n if (extension !== null) {\n if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n if (p === RGBA_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n if (p === RGBA_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n } else {\n return null;\n }\n }\n\n // ETC1\n\n if (p === RGB_ETC1_Format) {\n const extension = getExtension(gl, 'WEBGL_compressed_texture_etc1');\n if (extension !== null) {\n return extension.COMPRESSED_RGB_ETC1_WEBGL;\n } else {\n return null;\n }\n }\n\n // ETC2\n\n if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) {\n const extension = getExtension(gl, 'WEBGL_compressed_texture_etc');\n if (extension !== null) {\n if (p === RGB_ETC2_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n if (p === RGBA_ETC2_EAC_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n } else {\n return null;\n }\n }\n\n // ASTC\n\n if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) {\n const extension = getExtension(gl, 'WEBGL_compressed_texture_astc');\n if (extension !== null) {\n if (p === RGBA_ASTC_4x4_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n if (p === RGBA_ASTC_5x4_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n if (p === RGBA_ASTC_5x5_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n if (p === RGBA_ASTC_6x5_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n if (p === RGBA_ASTC_6x6_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n if (p === RGBA_ASTC_8x5_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n if (p === RGBA_ASTC_8x6_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n if (p === RGBA_ASTC_8x8_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n if (p === RGBA_ASTC_10x5_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n if (p === RGBA_ASTC_10x6_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n if (p === RGBA_ASTC_10x8_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n if (p === RGBA_ASTC_10x10_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n if (p === RGBA_ASTC_12x10_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n if (p === RGBA_ASTC_12x12_Format) return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n } else {\n return null;\n }\n }\n\n // BPTC\n\n if (p === RGBA_BPTC_Format) {\n const extension = getExtension(gl, 'EXT_texture_compression_bptc');\n if (extension !== null) {\n if (p === RGBA_BPTC_Format) {\n return (encoding === sRGBEncoding) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n }\n } else {\n return null;\n }\n }\n\n //\n\n if (p === UnsignedInt248Type) {\n return gl.UNSIGNED_INT_24_8;\n }\n if (p === RepeatWrapping) {\n return gl.REPEAT;\n }\n if (p === ClampToEdgeWrapping) {\n return gl.CLAMP_TO_EDGE;\n }\n if (p === NearestMipMapNearestFilter) {\n return gl.NEAREST_MIPMAP_LINEAR;\n }\n if (p === NearestMipMapLinearFilter) {\n return gl.NEAREST_MIPMAP_LINEAR;\n }\n if (p === LinearMipMapNearestFilter) {\n return gl.LINEAR_MIPMAP_NEAREST;\n }\n if (p === LinearMipMapLinearFilter) {\n return gl.LINEAR_MIPMAP_LINEAR;\n }\n if (p === NearestFilter) {\n return gl.NEAREST;\n }\n if (p === LinearFilter) {\n return gl.LINEAR;\n }\n\n return null;\n}\n\n\nexport {convertConstant};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/convertConstant.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/convertConstant.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8933, + "__docId__": 8941, "kind": "function", "name": "convertConstant", "memberof": "src/viewer/scene/webgl/convertConstant.js", @@ -175338,18 +175554,18 @@ } }, { - "__docId__": 8934, + "__docId__": 8942, "kind": "file", "name": "src/viewer/scene/webgl/getExtension.js", "content": "/**\n * @private\n */\nfunction getExtension (gl, name) {\n if (gl._cachedExtensions === undefined) {\n gl._cachedExtensions = {};\n }\n if (gl._cachedExtensions[name] !== undefined) {\n return gl._cachedExtensions[name];\n }\n let extension;\n switch (name) {\n case 'WEBGL_depth_texture':\n extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture');\n break;\n case 'EXT_texture_filter_anisotropic':\n extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');\n break;\n case 'WEBGL_compressed_texture_s3tc':\n extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');\n break;\n case 'WEBGL_compressed_texture_pvrtc':\n extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');\n break;\n default:\n extension = gl.getExtension(name);\n }\n gl._cachedExtensions[name] = extension;\n return extension;\n}\n\nexport {getExtension};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/getExtension.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/getExtension.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8935, + "__docId__": 8943, "kind": "function", "name": "getExtension", "memberof": "src/viewer/scene/webgl/getExtension.js", @@ -175385,18 +175601,18 @@ } }, { - "__docId__": 8936, + "__docId__": 8944, "kind": "file", "name": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js", "content": "import {math} from \"../../math/math.js\";\nimport {ArrayBuf} from \"../ArrayBuf.js\";\n\n/**\n * @private\n */\nclass OcclusionLayer {\n\n constructor(scene, origin) {\n\n this.scene = scene;\n this.aabb = math.AABB3();\n this.origin = math.vec3(origin);\n this.originHash = this.origin.join();\n this.numMarkers = 0;\n this.markers = {};\n this.markerList = []; // Ordered array of Markers\n this.markerIndices = {}; // ID map of Marker indices in _markerList\n this.positions = []; // Packed array of World-space marker positions\n this.indices = []; // Indices corresponding to array above\n this.positionsBuf = null;\n this.lenPositionsBuf = 0;\n this.indicesBuf = null;\n this.sectionPlanesActive = [];\n this.culledBySectionPlanes = false;\n this.occlusionTestList = []; // List of\n this.lenOcclusionTestList = 0;\n this.pixels = [];\n this.aabbDirty = false;\n this.markerListDirty = false;\n this.positionsDirty = true;\n this.occlusionTestListDirty = false;\n }\n\n addMarker(marker) {\n this.markers[marker.id] = marker;\n this.markerListDirty = true;\n this.numMarkers++;\n }\n\n markerWorldPosUpdated(marker) {\n if (!this.markers[marker.id]) { // Not added\n return;\n }\n const i = this.markerIndices[marker.id];\n this.positions[i * 3 + 0] = marker.worldPos[0];\n this.positions[i * 3 + 1] = marker.worldPos[1];\n this.positions[i * 3 + 2] = marker.worldPos[2];\n this.positionsDirty = true; // TODO: avoid reallocating VBO each time\n }\n\n removeMarker(marker) {\n delete this.markers[marker.id];\n this.markerListDirty = true;\n this.numMarkers--;\n }\n\n update() {\n if (this.markerListDirty) {\n this._buildMarkerList();\n this.markerListDirty = false;\n this.positionsDirty = true;\n this.occlusionTestListDirty = true;\n }\n if (this.positionsDirty) { ////////////// TODO: Don't rebuild this when positions change, very wasteful\n this._buildPositions();\n this.positionsDirty = false;\n this.aabbDirty = true;\n this.vbosDirty = true;\n }\n if (this.aabbDirty) {\n this._buildAABB();\n this.aabbDirty = false;\n }\n if (this.vbosDirty) {\n this._buildVBOs();\n this.vbosDirty = false;\n }\n if (this.occlusionTestListDirty) {\n this._buildOcclusionTestList();\n }\n this._updateActiveSectionPlanes();\n }\n\n _buildMarkerList() {\n this.numMarkers = 0;\n for (var id in this.markers) {\n if (this.markers.hasOwnProperty(id)) {\n this.markerList[this.numMarkers] = this.markers[id];\n this.markerIndices[id] = this.numMarkers;\n this.numMarkers++;\n }\n }\n this.markerList.length = this.numMarkers;\n }\n\n _buildPositions() {\n let j = 0;\n for (let i = 0; i < this.numMarkers; i++) {\n if (this.markerList[i]) {\n const marker = this.markerList[i];\n const worldPos = marker.worldPos;\n this.positions[j++] = worldPos[0];\n this.positions[j++] = worldPos[1];\n this.positions[j++] = worldPos[2];\n this.indices[i] = i;\n }\n }\n this.positions.length = this.numMarkers * 3;\n this.indices.length = this.numMarkers;\n }\n\n _buildAABB() {\n const aabb = this.aabb;\n math.collapseAABB3(aabb);\n math.expandAABB3Points3(aabb, this.positions);\n const origin = this.origin;\n aabb[0] += origin[0];\n aabb[1] += origin[1];\n aabb[2] += origin[2];\n aabb[3] += origin[0];\n aabb[4] += origin[1];\n aabb[5] += origin[2];\n }\n\n _buildVBOs() {\n if (this.positionsBuf) {\n if (this.lenPositionsBuf === this.positions.length) { // Just updating buffer elements, don't need to reallocate\n this.positionsBuf.setData(this.positions); // Indices don't need updating\n return;\n }\n this.positionsBuf.destroy();\n this.positionsBuf = null;\n this.indicesBuf.destroy();\n this.indicesBuf = null;\n }\n const gl = this.scene.canvas.gl;\n const lenPositions = this.numMarkers * 3;\n const lenIndices = this.numMarkers;\n this.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this.positions), lenPositions, 3, gl.STATIC_DRAW);\n this.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), lenIndices, 1, gl.STATIC_DRAW);\n this.lenPositionsBuf = this.positions.length;\n }\n\n _buildOcclusionTestList() {\n const canvas = this.scene.canvas;\n const near = this.scene.camera.perspective.near; // Assume near enough to ortho near\n const boundary = canvas.boundary;\n const canvasWidth = boundary[2];\n const canvasHeight = boundary[3];\n let lenPixels = 0;\n this.lenOcclusionTestList = 0;\n for (let i = 0; i < this.numMarkers; i++) {\n const marker = this.markerList[i];\n const viewPos = marker.viewPos;\n if (viewPos[2] > -near) { // Clipped by near plane\n marker._setVisible(false);\n continue;\n }\n const canvasPos = marker.canvasPos;\n const canvasX = canvasPos[0];\n const canvasY = canvasPos[1];\n if ((canvasX + 10) < 0 || (canvasY + 10) < 0 || (canvasX - 10) > canvasWidth || (canvasY - 10) > canvasHeight) {\n marker._setVisible(false);\n continue;\n }\n if (marker.entity && !marker.entity.visible) {\n marker._setVisible(false);\n continue;\n }\n if (marker.occludable) {\n this.occlusionTestList[this.lenOcclusionTestList++] = marker;\n this.pixels[lenPixels++] = canvasX;\n this.pixels[lenPixels++] = canvasY;\n continue;\n }\n marker._setVisible(true);\n }\n }\n\n _updateActiveSectionPlanes() {\n const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;\n const numSectionPlanes = sectionPlanes.length;\n if (numSectionPlanes > 0) {\n for (let i = 0; i < numSectionPlanes; i++) {\n const sectionPlane = sectionPlanes[i];\n if (!sectionPlane.active) {\n this.sectionPlanesActive[i] = false;\n } else {\n const intersect = math.planeAABB3Intersect(sectionPlane.dir, sectionPlane.dist, this.aabb);\n const outside = (intersect === -1);\n if (outside) {\n this.culledBySectionPlanes = true;\n return;\n }\n const intersecting = (intersect === 0);\n this.sectionPlanesActive[i] = intersecting;\n }\n }\n }\n this.culledBySectionPlanes = false;\n }\n\n destroy() {\n this.markers = {};\n this.markerList.length = 0;\n if (this.positionsBuf) {\n this.positionsBuf.destroy();\n }\n if (this.indicesBuf) {\n this.indicesBuf.destroy();\n }\n }\n}\n\n\nexport {OcclusionLayer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/occlusion/OcclusionLayer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/occlusion/OcclusionLayer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8937, + "__docId__": 8945, "kind": "class", "name": "OcclusionLayer", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js", @@ -175412,7 +175628,7 @@ "ignore": true }, { - "__docId__": 8938, + "__docId__": 8946, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175426,7 +175642,7 @@ "undocument": true }, { - "__docId__": 8939, + "__docId__": 8947, "kind": "member", "name": "scene", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175443,7 +175659,7 @@ } }, { - "__docId__": 8940, + "__docId__": 8948, "kind": "member", "name": "aabb", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175460,7 +175676,7 @@ } }, { - "__docId__": 8941, + "__docId__": 8949, "kind": "member", "name": "origin", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175477,7 +175693,7 @@ } }, { - "__docId__": 8942, + "__docId__": 8950, "kind": "member", "name": "originHash", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175494,7 +175710,7 @@ } }, { - "__docId__": 8943, + "__docId__": 8951, "kind": "member", "name": "numMarkers", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175511,7 +175727,7 @@ } }, { - "__docId__": 8944, + "__docId__": 8952, "kind": "member", "name": "markers", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175528,7 +175744,7 @@ } }, { - "__docId__": 8945, + "__docId__": 8953, "kind": "member", "name": "markerList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175545,7 +175761,7 @@ } }, { - "__docId__": 8946, + "__docId__": 8954, "kind": "member", "name": "markerIndices", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175562,7 +175778,7 @@ } }, { - "__docId__": 8947, + "__docId__": 8955, "kind": "member", "name": "positions", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175579,7 +175795,7 @@ } }, { - "__docId__": 8948, + "__docId__": 8956, "kind": "member", "name": "indices", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175596,7 +175812,7 @@ } }, { - "__docId__": 8949, + "__docId__": 8957, "kind": "member", "name": "positionsBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175613,7 +175829,7 @@ } }, { - "__docId__": 8950, + "__docId__": 8958, "kind": "member", "name": "lenPositionsBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175630,7 +175846,7 @@ } }, { - "__docId__": 8951, + "__docId__": 8959, "kind": "member", "name": "indicesBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175647,7 +175863,7 @@ } }, { - "__docId__": 8952, + "__docId__": 8960, "kind": "member", "name": "sectionPlanesActive", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175664,7 +175880,7 @@ } }, { - "__docId__": 8953, + "__docId__": 8961, "kind": "member", "name": "culledBySectionPlanes", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175681,7 +175897,7 @@ } }, { - "__docId__": 8954, + "__docId__": 8962, "kind": "member", "name": "occlusionTestList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175698,7 +175914,7 @@ } }, { - "__docId__": 8955, + "__docId__": 8963, "kind": "member", "name": "lenOcclusionTestList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175715,7 +175931,7 @@ } }, { - "__docId__": 8956, + "__docId__": 8964, "kind": "member", "name": "pixels", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175732,7 +175948,7 @@ } }, { - "__docId__": 8957, + "__docId__": 8965, "kind": "member", "name": "aabbDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175749,7 +175965,7 @@ } }, { - "__docId__": 8958, + "__docId__": 8966, "kind": "member", "name": "markerListDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175766,7 +175982,7 @@ } }, { - "__docId__": 8959, + "__docId__": 8967, "kind": "member", "name": "positionsDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175783,7 +175999,7 @@ } }, { - "__docId__": 8960, + "__docId__": 8968, "kind": "member", "name": "occlusionTestListDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175800,7 +176016,7 @@ } }, { - "__docId__": 8961, + "__docId__": 8969, "kind": "method", "name": "addMarker", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175823,7 +176039,7 @@ "return": null }, { - "__docId__": 8963, + "__docId__": 8971, "kind": "method", "name": "markerWorldPosUpdated", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175846,7 +176062,7 @@ "return": null }, { - "__docId__": 8965, + "__docId__": 8973, "kind": "method", "name": "removeMarker", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175869,7 +176085,7 @@ "return": null }, { - "__docId__": 8967, + "__docId__": 8975, "kind": "method", "name": "update", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175885,7 +176101,7 @@ "return": null }, { - "__docId__": 8973, + "__docId__": 8981, "kind": "member", "name": "vbosDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175902,7 +176118,7 @@ } }, { - "__docId__": 8976, + "__docId__": 8984, "kind": "method", "name": "_buildMarkerList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175919,7 +176135,7 @@ "return": null }, { - "__docId__": 8978, + "__docId__": 8986, "kind": "method", "name": "_buildPositions", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175936,7 +176152,7 @@ "return": null }, { - "__docId__": 8979, + "__docId__": 8987, "kind": "method", "name": "_buildAABB", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175953,7 +176169,7 @@ "return": null }, { - "__docId__": 8980, + "__docId__": 8988, "kind": "method", "name": "_buildVBOs", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175970,7 +176186,7 @@ "return": null }, { - "__docId__": 8986, + "__docId__": 8994, "kind": "method", "name": "_buildOcclusionTestList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -175987,7 +176203,7 @@ "return": null }, { - "__docId__": 8988, + "__docId__": 8996, "kind": "method", "name": "_updateActiveSectionPlanes", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -176004,7 +176220,7 @@ "return": null }, { - "__docId__": 8991, + "__docId__": 8999, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionLayer.js~OcclusionLayer", @@ -176020,18 +176236,18 @@ "return": null }, { - "__docId__": 8993, + "__docId__": 9001, "kind": "file", "name": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", "content": "import {math} from '../../math/math.js';\nimport {Program} from \"./../Program.js\";\nimport {OcclusionLayer} from \"./OcclusionLayer.js\";\nimport {createRTCViewMat, getPlaneRTCPos} from \"../../math/rtcCoords.js\";\nimport {WEBGL_INFO} from \"../../webglInfo.js\";\n\nconst TEST_MODE = false;\nconst MARKER_COLOR = math.vec3([1.0, 0.0, 0.0]);\nconst POINT_SIZE = 20;\nconst MARKER_SPRITE_CLIPZ_OFFSET = -0.001; // Amount that we offset sprite clip Z coords to raise them from surfaces\n\nconst tempVec3a = math.vec3();\n\n/**\n * Manages occlusion testing. Private member of a Renderer.\n * @private\n */\nclass OcclusionTester {\n\n constructor(scene, renderBufferManager) {\n\n this._scene = scene;\n\n this._renderBufferManager = renderBufferManager;\n\n this._occlusionLayers = {};\n this._occlusionLayersList = [];\n this._occlusionLayersListDirty = false;\n\n this._shaderSource = null;\n this._program = null;\n\n this._shaderSourceHash = null;\n\n this._shaderSourceDirty = true; // Need to build shader source code ?\n this._programDirty = false; // Need to build shader program ?\n\n this._markersToOcclusionLayersMap = {};\n\n this._onCameraViewMatrix = scene.camera.on(\"viewMatrix\", () => {\n this._occlusionTestListDirty = true;\n });\n\n this._onCameraProjMatrix = scene.camera.on(\"projMatrix\", () => {\n this._occlusionTestListDirty = true;\n });\n\n this._onCanvasBoundary = scene.canvas.on(\"boundary\", () => {\n this._occlusionTestListDirty = true;\n });\n }\n\n /**\n * Adds a Marker for occlusion testing.\n * @param marker\n */\n addMarker(marker) {\n const originHash = marker.origin.join();\n let occlusionLayer = this._occlusionLayers[originHash];\n if (!occlusionLayer) {\n occlusionLayer = new OcclusionLayer(this._scene, marker.origin);\n this._occlusionLayers[occlusionLayer.originHash] = occlusionLayer;\n this._occlusionLayersListDirty = true;\n }\n occlusionLayer.addMarker(marker);\n this._markersToOcclusionLayersMap[marker.id] = occlusionLayer;\n this._occlusionTestListDirty = true;\n }\n\n /**\n * Notifies OcclusionTester that a Marker has updated its World-space position.\n * @param marker\n */\n markerWorldPosUpdated(marker) {\n const occlusionLayer = this._markersToOcclusionLayersMap[marker.id];\n if (!occlusionLayer) {\n marker.error(\"Marker has not been added to OcclusionTester\");\n return;\n }\n const originHash = marker.origin.join();\n if (originHash !== occlusionLayer.originHash) {\n if (occlusionLayer.numMarkers === 1) {\n occlusionLayer.destroy();\n delete this._occlusionLayers[occlusionLayer.originHash];\n this._occlusionLayersListDirty = true;\n } else {\n occlusionLayer.removeMarker(marker);\n }\n let newOcclusionLayer = this._occlusionLayers[originHash];\n if (!newOcclusionLayer) {\n newOcclusionLayer = new OcclusionLayer(this._scene, marker.origin);\n this._occlusionLayers[originHash] = occlusionLayer;\n this._occlusionLayersListDirty = true;\n }\n newOcclusionLayer.addMarker(marker);\n this._markersToOcclusionLayersMap[marker.id] = newOcclusionLayer;\n } else {\n occlusionLayer.markerWorldPosUpdated(marker);\n }\n }\n\n /**\n * Removes a Marker from occlusion testing.\n * @param marker\n */\n removeMarker(marker) {\n const originHash = marker.origin.join();\n let occlusionLayer = this._occlusionLayers[originHash];\n if (!occlusionLayer) {\n return;\n }\n if (occlusionLayer.numMarkers === 1) {\n occlusionLayer.destroy();\n delete this._occlusionLayers[occlusionLayer.originHash];\n this._occlusionLayersListDirty = true;\n } else {\n occlusionLayer.removeMarker(marker);\n }\n delete this._markersToOcclusionLayersMap[marker.id];\n }\n\n /**\n * Returns true if an occlusion test is needed.\n *\n * @returns {Boolean}\n */\n get needOcclusionTest() {\n return this._occlusionTestListDirty;\n }\n\n /**\n * Binds the render buffer. After calling this, the caller then renders object silhouettes to the render buffer,\n * then calls drawMarkers() and doOcclusionTest().\n */\n bindRenderBuf() {\n\n const shaderSourceHash = [this._scene.canvas.canvas.id, this._scene._sectionPlanesState.getHash()].join(\";\");\n\n if (shaderSourceHash !== this._shaderSourceHash) {\n this._shaderSourceHash = shaderSourceHash;\n this._shaderSourceDirty = true;\n }\n\n if (this._shaderSourceDirty) {\n this._buildShaderSource();\n this._shaderSourceDirty = false;\n this._programDirty = true;\n }\n\n if (this._programDirty) {\n this._buildProgram();\n this._programDirty = false;\n this._occlusionTestListDirty = true;\n }\n\n if (this._occlusionLayersListDirty) {\n this._buildOcclusionLayersList();\n this._occlusionLayersListDirty = false;\n }\n\n if (this._occlusionTestListDirty) {\n for (let i = 0, len = this._occlusionLayersList.length; i < len; i++) {\n const occlusionLayer = this._occlusionLayersList[i];\n occlusionLayer.occlusionTestListDirty = true;\n }\n this._occlusionTestListDirty = false;\n }\n\n if (!TEST_MODE) {\n this._readPixelBuf = this._renderBufferManager.getRenderBuffer(\"occlusionReadPix\");\n this._readPixelBuf.bind();\n this._readPixelBuf.clear();\n }\n }\n\n _buildOcclusionLayersList() {\n let numOcclusionLayers = 0;\n for (let originHash in this._occlusionLayers) {\n if (this._occlusionLayers.hasOwnProperty(originHash)) {\n this._occlusionLayersList[numOcclusionLayers++] = this._occlusionLayers[originHash];\n }\n }\n this._occlusionLayersList.length = numOcclusionLayers;\n }\n\n _buildShaderSource() {\n this._shaderSource = {\n vertex: this._buildVertexShaderSource(),\n fragment: this._buildFragmentShaderSource()\n };\n }\n\n _buildVertexShaderSource() {\n const scene = this._scene;\n const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// OcclusionTester vertex shader\");\n \n src.push(\"in vec3 position;\");\n src.push(\"uniform mat4 modelMatrix;\");\n src.push(\"uniform mat4 viewMatrix;\");\n src.push(\"uniform mat4 projMatrix;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"out float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"out vec4 vWorldPosition;\");\n }\n src.push(\"void main(void) {\");\n src.push(\"vec4 worldPosition = vec4(position, 1.0); \");\n src.push(\" vec4 viewPosition = viewMatrix * worldPosition;\");\n if (clipping) {\n src.push(\" vWorldPosition = worldPosition;\");\n }\n src.push(\" vec4 clipPos = projMatrix * viewPosition;\");\n src.push(\" gl_PointSize = \" + POINT_SIZE + \".0;\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"vFragDepth = 1.0 + clipPos.w;\");\n } else {\n src.push(\"clipPos.z += \" + MARKER_SPRITE_CLIPZ_OFFSET + \";\");\n }\n src.push(\" gl_Position = clipPos;\");\n src.push(\"}\");\n return src;\n }\n\n _buildFragmentShaderSource() {\n const scene = this._scene;\n const sectionPlanesState = scene._sectionPlanesState;\n const clipping = sectionPlanesState.sectionPlanes.length > 0;\n const src = [];\n src.push(\"#version 300 es\");\n src.push(\"// OcclusionTester fragment shader\");\n \n src.push(\"#ifdef GL_FRAGMENT_PRECISION_HIGH\");\n src.push(\"precision highp float;\");\n src.push(\"precision highp int;\");\n src.push(\"#else\");\n src.push(\"precision mediump float;\");\n src.push(\"precision mediump int;\");\n src.push(\"#endif\");\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"uniform float logDepthBufFC;\");\n src.push(\"in float vFragDepth;\");\n }\n if (clipping) {\n src.push(\"in vec4 vWorldPosition;\");\n for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {\n src.push(\"uniform bool sectionPlaneActive\" + i + \";\");\n src.push(\"uniform vec3 sectionPlanePos\" + i + \";\");\n src.push(\"uniform vec3 sectionPlaneDir\" + i + \";\");\n }\n }\n src.push(\"out vec4 outColor;\");\n src.push(\"void main(void) {\");\n if (clipping) {\n src.push(\" float dist = 0.0;\");\n for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {\n src.push(\"if (sectionPlaneActive\" + i + \") {\");\n src.push(\" dist += clamp(dot(-sectionPlaneDir\" + i + \".xyz, vWorldPosition.xyz - sectionPlanePos\" + i + \".xyz), 0.0, 1000.0);\");\n src.push(\"}\");\n }\n src.push(\" if (dist > 0.0) { discard; }\");\n }\n if (scene.logarithmicDepthBufferEnabled) {\n src.push(\"gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;\");\n }\n src.push(\" outColor = vec4(1.0, 0.0, 0.0, 1.0); \");\n src.push(\"}\");\n return src;\n }\n\n _buildProgram() {\n if (this._program) {\n this._program.destroy();\n }\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const sectionPlanesState = scene._sectionPlanesState;\n this._program = new Program(gl, this._shaderSource);\n if (this._program.errors) {\n this.errors = this._program.errors;\n return;\n }\n const program = this._program;\n this._uViewMatrix = program.getLocation(\"viewMatrix\");\n this._uProjMatrix = program.getLocation(\"projMatrix\");\n this._uSectionPlanes = [];\n const sectionPlanes = sectionPlanesState.sectionPlanes;\n for (let i = 0, len = sectionPlanes.length; i < len; i++) {\n this._uSectionPlanes.push({\n active: program.getLocation(\"sectionPlaneActive\" + i),\n pos: program.getLocation(\"sectionPlanePos\" + i),\n dir: program.getLocation(\"sectionPlaneDir\" + i)\n });\n }\n this._aPosition = program.getAttribute(\"position\");\n if (scene.logarithmicDepthBufferEnabled) {\n this._uLogDepthBufFC = program.getLocation(\"logDepthBufFC\");\n }\n }\n\n /**\n * Draws {@link Marker}s to the render buffer.\n */\n drawMarkers() {\n\n const scene = this._scene;\n const gl = scene.canvas.gl;\n const program = this._program;\n const sectionPlanesState = scene._sectionPlanesState;\n const camera = scene.camera;\n const project = scene.camera.project;\n\n program.bind();\n\n gl.uniformMatrix4fv(this._uProjMatrix, false, camera._project._state.matrix);\n\n if (scene.logarithmicDepthBufferEnabled) {\n const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);\n gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);\n }\n\n for (let i = 0, len = this._occlusionLayersList.length; i < len; i++) {\n\n const occlusionLayer = this._occlusionLayersList[i];\n\n occlusionLayer.update();\n\n if (occlusionLayer.culledBySectionPlanes) {\n continue;\n }\n\n const origin = occlusionLayer.origin;\n\n gl.uniformMatrix4fv(this._uViewMatrix, false, createRTCViewMat(camera.viewMatrix, origin));\n\n const numSectionPlanes = sectionPlanesState.sectionPlanes.length;\n if (numSectionPlanes > 0) {\n const sectionPlanes = sectionPlanesState.sectionPlanes;\n for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {\n const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];\n if (sectionPlaneUniforms) {\n const active = occlusionLayer.sectionPlanesActive[sectionPlaneIndex];\n gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);\n if (active) {\n const sectionPlane = sectionPlanes[sectionPlaneIndex];\n gl.uniform3fv(sectionPlaneUniforms.pos, getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a));\n gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);\n }\n }\n }\n }\n\n this._aPosition.bindArrayBuffer(occlusionLayer.positionsBuf);\n\n const indicesBuf = occlusionLayer.indicesBuf;\n indicesBuf.bind();\n gl.drawElements(gl.POINTS, indicesBuf.numItems, indicesBuf.itemType, 0);\n }\n }\n\n /**\n * Sets visibilities of {@link Marker}s according to whether or not they are obscured by anything in the render buffer.\n */\n doOcclusionTest() {\n\n if (!TEST_MODE) {\n\n const resolutionScale = this._scene.canvas.resolutionScale;\n\n const markerR = MARKER_COLOR[0] * 255;\n const markerG = MARKER_COLOR[1] * 255;\n const markerB = MARKER_COLOR[2] * 255;\n\n for (let i = 0, len = this._occlusionLayersList.length; i < len; i++) {\n\n const occlusionLayer = this._occlusionLayersList[i];\n\n for (let i = 0; i < occlusionLayer.lenOcclusionTestList; i++) {\n\n const marker = occlusionLayer.occlusionTestList[i];\n const j = i * 2;\n const color = this._readPixelBuf.read(Math.round(occlusionLayer.pixels[j] * resolutionScale), Math.round(occlusionLayer.pixels[j + 1] * resolutionScale));\n const visible = (color[0] === markerR) && (color[1] === markerG) && (color[2] === markerB);\n\n marker._setVisible(visible);\n }\n }\n }\n }\n\n /**\n * Unbinds render buffer.\n */\n unbindRenderBuf() {\n if (!TEST_MODE) {\n this._readPixelBuf.unbind();\n }\n }\n\n /**\n * Destroys this OcclusionTester.\n */\n destroy() {\n if (this.destroyed) {\n return;\n }\n for (let i = 0, len = this._occlusionLayersList.length; i < len; i++) {\n const occlusionLayer = this._occlusionLayersList[i];\n occlusionLayer.destroy();\n }\n\n if (this._program) {\n this._program.destroy();\n }\n\n this._scene.camera.off(this._onCameraViewMatrix);\n this._scene.camera.off(this._onCameraProjMatrix);\n this._scene.canvas.off(this._onCanvasBoundary);\n this.destroyed = true;\n }\n}\n\nexport {OcclusionTester};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/occlusion/OcclusionTester.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/occlusion/OcclusionTester.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 8994, + "__docId__": 9002, "kind": "variable", "name": "TEST_MODE", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176052,7 +176268,7 @@ "ignore": true }, { - "__docId__": 8995, + "__docId__": 9003, "kind": "variable", "name": "MARKER_COLOR", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176073,7 +176289,7 @@ "ignore": true }, { - "__docId__": 8996, + "__docId__": 9004, "kind": "variable", "name": "POINT_SIZE", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176094,7 +176310,7 @@ "ignore": true }, { - "__docId__": 8997, + "__docId__": 9005, "kind": "variable", "name": "MARKER_SPRITE_CLIPZ_OFFSET", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176115,7 +176331,7 @@ "ignore": true }, { - "__docId__": 8998, + "__docId__": 9006, "kind": "variable", "name": "tempVec3a", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176136,7 +176352,7 @@ "ignore": true }, { - "__docId__": 8999, + "__docId__": 9007, "kind": "class", "name": "OcclusionTester", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js", @@ -176152,7 +176368,7 @@ "ignore": true }, { - "__docId__": 9000, + "__docId__": 9008, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176166,7 +176382,7 @@ "undocument": true }, { - "__docId__": 9001, + "__docId__": 9009, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176184,7 +176400,7 @@ } }, { - "__docId__": 9002, + "__docId__": 9010, "kind": "member", "name": "_renderBufferManager", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176202,7 +176418,7 @@ } }, { - "__docId__": 9003, + "__docId__": 9011, "kind": "member", "name": "_occlusionLayers", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176220,7 +176436,7 @@ } }, { - "__docId__": 9004, + "__docId__": 9012, "kind": "member", "name": "_occlusionLayersList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176238,7 +176454,7 @@ } }, { - "__docId__": 9005, + "__docId__": 9013, "kind": "member", "name": "_occlusionLayersListDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176256,7 +176472,7 @@ } }, { - "__docId__": 9006, + "__docId__": 9014, "kind": "member", "name": "_shaderSource", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176274,7 +176490,7 @@ } }, { - "__docId__": 9007, + "__docId__": 9015, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176292,7 +176508,7 @@ } }, { - "__docId__": 9008, + "__docId__": 9016, "kind": "member", "name": "_shaderSourceHash", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176310,7 +176526,7 @@ } }, { - "__docId__": 9009, + "__docId__": 9017, "kind": "member", "name": "_shaderSourceDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176328,7 +176544,7 @@ } }, { - "__docId__": 9010, + "__docId__": 9018, "kind": "member", "name": "_programDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176346,7 +176562,7 @@ } }, { - "__docId__": 9011, + "__docId__": 9019, "kind": "member", "name": "_markersToOcclusionLayersMap", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176364,7 +176580,7 @@ } }, { - "__docId__": 9012, + "__docId__": 9020, "kind": "member", "name": "_onCameraViewMatrix", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176382,7 +176598,7 @@ } }, { - "__docId__": 9013, + "__docId__": 9021, "kind": "member", "name": "_occlusionTestListDirty", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176400,7 +176616,7 @@ } }, { - "__docId__": 9014, + "__docId__": 9022, "kind": "member", "name": "_onCameraProjMatrix", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176418,7 +176634,7 @@ } }, { - "__docId__": 9016, + "__docId__": 9024, "kind": "member", "name": "_onCanvasBoundary", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176436,7 +176652,7 @@ } }, { - "__docId__": 9018, + "__docId__": 9026, "kind": "method", "name": "addMarker", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176462,7 +176678,7 @@ "return": null }, { - "__docId__": 9021, + "__docId__": 9029, "kind": "method", "name": "markerWorldPosUpdated", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176488,7 +176704,7 @@ "return": null }, { - "__docId__": 9024, + "__docId__": 9032, "kind": "method", "name": "removeMarker", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176514,7 +176730,7 @@ "return": null }, { - "__docId__": 9026, + "__docId__": 9034, "kind": "get", "name": "needOcclusionTest", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176546,7 +176762,7 @@ } }, { - "__docId__": 9027, + "__docId__": 9035, "kind": "method", "name": "bindRenderBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176561,7 +176777,7 @@ "return": null }, { - "__docId__": 9036, + "__docId__": 9044, "kind": "member", "name": "_readPixelBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176579,7 +176795,7 @@ } }, { - "__docId__": 9037, + "__docId__": 9045, "kind": "method", "name": "_buildOcclusionLayersList", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176596,7 +176812,7 @@ "return": null }, { - "__docId__": 9038, + "__docId__": 9046, "kind": "method", "name": "_buildShaderSource", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176613,7 +176829,7 @@ "return": null }, { - "__docId__": 9040, + "__docId__": 9048, "kind": "method", "name": "_buildVertexShaderSource", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176634,7 +176850,7 @@ } }, { - "__docId__": 9041, + "__docId__": 9049, "kind": "method", "name": "_buildFragmentShaderSource", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176655,7 +176871,7 @@ } }, { - "__docId__": 9042, + "__docId__": 9050, "kind": "method", "name": "_buildProgram", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176672,7 +176888,7 @@ "return": null }, { - "__docId__": 9044, + "__docId__": 9052, "kind": "member", "name": "errors", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176689,7 +176905,7 @@ } }, { - "__docId__": 9045, + "__docId__": 9053, "kind": "member", "name": "_uViewMatrix", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176707,7 +176923,7 @@ } }, { - "__docId__": 9046, + "__docId__": 9054, "kind": "member", "name": "_uProjMatrix", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176725,7 +176941,7 @@ } }, { - "__docId__": 9047, + "__docId__": 9055, "kind": "member", "name": "_uSectionPlanes", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176743,7 +176959,7 @@ } }, { - "__docId__": 9048, + "__docId__": 9056, "kind": "member", "name": "_aPosition", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176761,7 +176977,7 @@ } }, { - "__docId__": 9049, + "__docId__": 9057, "kind": "member", "name": "_uLogDepthBufFC", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176779,7 +176995,7 @@ } }, { - "__docId__": 9050, + "__docId__": 9058, "kind": "method", "name": "drawMarkers", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176794,7 +177010,7 @@ "return": null }, { - "__docId__": 9051, + "__docId__": 9059, "kind": "method", "name": "doOcclusionTest", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176809,7 +177025,7 @@ "return": null }, { - "__docId__": 9052, + "__docId__": 9060, "kind": "method", "name": "unbindRenderBuf", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176824,7 +177040,7 @@ "return": null }, { - "__docId__": 9053, + "__docId__": 9061, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176839,7 +177055,7 @@ "return": null }, { - "__docId__": 9054, + "__docId__": 9062, "kind": "member", "name": "destroyed", "memberof": "src/viewer/scene/webgl/occlusion/OcclusionTester.js~OcclusionTester", @@ -176856,18 +177072,18 @@ } }, { - "__docId__": 9055, + "__docId__": 9063, "kind": "file", "name": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", "content": "import {Program} from \"./../Program.js\";\nimport {ArrayBuf} from \"./../ArrayBuf.js\";\nimport {math} from \"../../math/math.js\";\nimport {WEBGL_INFO} from \"../../webglInfo.js\";\n\nconst blurStdDev = 4;\nconst blurDepthCutoff = 0.01;\nconst KERNEL_RADIUS = 16;\n\nconst sampleOffsetsVert = new Float32Array(createSampleOffsets(KERNEL_RADIUS + 1, [0, 1]));\nconst sampleOffsetsHor = new Float32Array(createSampleOffsets(KERNEL_RADIUS + 1, [1, 0]));\nconst sampleWeights = new Float32Array(createSampleWeights(KERNEL_RADIUS + 1, blurStdDev));\n\nconst tempVec2a = new Float32Array(2);\n\n/**\n * SAO implementation inspired from previous SAO work in THREE.js by ludobaka / ludobaka.github.io and bhouston\n * @private\n */\nclass SAODepthLimitedBlurRenderer {\n\n constructor(scene) {\n\n this._scene = scene;\n\n // The program\n\n this._program = null;\n this._programError = false;\n\n // Variable locations\n\n this._aPosition = null;\n this._aUV = null;\n\n this._uDepthTexture = \"uDepthTexture\";\n this._uOcclusionTexture = \"uOcclusionTexture\";\n\n this._uViewport = null;\n this._uCameraNear = null;\n this._uCameraFar = null;\n this._uCameraProjectionMatrix = null;\n this._uCameraInverseProjectionMatrix = null;\n\n // VBOs\n\n this._uvBuf = null;\n this._positionsBuf = null;\n this._indicesBuf = null;\n\n this.init();\n }\n\n init() {\n\n // Create program & VBOs, locate attributes and uniforms\n\n const gl = this._scene.canvas.gl;\n\n this._program = new Program(gl, {\n\n vertex: [\n `#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV;\n uniform vec2 uViewport;\n out vec2 vUV;\n out vec2 vInvSize;\n void main () {\n vUV = aUV;\n vInvSize = 1.0 / uViewport;\n gl_Position = vec4(aPosition, 1.0);\n }`],\n\n fragment: [\n `#version 300 es\n precision highp float;\n precision highp int;\n \n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n\n #define KERNEL_RADIUS ${KERNEL_RADIUS}\n\n in vec2 vUV;\n in vec2 vInvSize;\n \n uniform sampler2D uDepthTexture;\n uniform sampler2D uOcclusionTexture; \n \n uniform float uCameraNear;\n uniform float uCameraFar; \n uniform float uDepthCutoff;\n\n uniform vec2 uSampleOffsets[ KERNEL_RADIUS + 1 ];\n uniform float uSampleWeights[ KERNEL_RADIUS + 1 ];\n\n const float unpackDownscale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. ); \n\n const float packUpscale = 256. / 255.;\n \n const float shiftRights = 1. / 256.;\n \n float unpackRGBAToFloat( const in vec4 v ) {\n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unpackFactors );\n } \n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float viewZToOrthographicDepth( const in float viewZ) {\n return ( viewZ + uCameraNear ) / ( uCameraNear - uCameraFar );\n }\n \n float orthographicDepthToViewZ( const in float linearClipZ) {\n return linearClipZ * ( uCameraNear - uCameraFar ) - uCameraNear;\n }\n\n float viewZToPerspectiveDepth( const in float viewZ) {\n return (( uCameraNear + viewZ ) * uCameraFar ) / (( uCameraFar - uCameraNear ) * viewZ );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ) {\n return ( uCameraNear * uCameraFar ) / ( ( uCameraFar - uCameraNear ) * invClipZ - uCameraFar );\n }\n\n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n return perspectiveDepthToViewZ( depth );\n }\n\n out vec4 outColor;\n \n void main() {\n \n float depth = getDepth( vUV );\n if( depth >= ( 1.0 - EPSILON ) ) {\n discard;\n }\n\n float centerViewZ = -getViewZ( depth );\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = uSampleWeights[0];\n float occlusionSum = unpackRGBAToFloat(texture( uOcclusionTexture, vUV )) * weightSum;\n\n for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\n\n float sampleWeight = uSampleWeights[i];\n vec2 sampleUVOffset = uSampleOffsets[i] * vInvSize;\n\n vec2 sampleUV = vUV + sampleUVOffset;\n float viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n rBreak = true;\n }\n\n if( ! rBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n\n sampleUV = vUV - sampleUVOffset;\n viewZ = -getViewZ( getDepth( sampleUV ) );\n\n if( abs( viewZ - centerViewZ ) > uDepthCutoff ) {\n lBreak = true;\n }\n\n if( ! lBreak ) {\n occlusionSum += unpackRGBAToFloat(texture( uOcclusionTexture, sampleUV )) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n outColor = packFloatToRGBA(occlusionSum / weightSum);\n }`\n ]\n });\n\n if (this._program.errors) {\n console.error(this._program.errors.join(\"\\n\"));\n this._programError = true;\n return;\n }\n\n const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);\n const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);\n\n // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures\n const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);\n\n this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);\n this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);\n this._indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, indices, indices.length, 1, gl.STATIC_DRAW);\n\n this._program.bind();\n\n this._uViewport = this._program.getLocation(\"uViewport\");\n\n this._uCameraNear = this._program.getLocation(\"uCameraNear\");\n this._uCameraFar = this._program.getLocation(\"uCameraFar\");\n\n this._uDepthCutoff = this._program.getLocation(\"uDepthCutoff\");\n\n this._uSampleOffsets = gl.getUniformLocation(this._program.handle, \"uSampleOffsets\");\n this._uSampleWeights = gl.getUniformLocation(this._program.handle, \"uSampleWeights\");\n\n this._aPosition = this._program.getAttribute(\"aPosition\");\n this._aUV = this._program.getAttribute(\"aUV\");\n }\n\n render(depthRenderBuffer, occlusionRenderBuffer, direction) {\n\n if (this._programError) {\n return;\n }\n\n if (!this._getInverseProjectMat) { // HACK: scene.camera not defined until render time\n this._getInverseProjectMat = (() => {\n let projMatDirty = true;\n this._scene.camera.on(\"projMatrix\", function () {\n projMatDirty = true;\n });\n const inverseProjectMat = math.mat4();\n return () => {\n if (projMatDirty) {\n math.inverseMat4(scene.camera.projMatrix, inverseProjectMat);\n }\n return inverseProjectMat;\n }\n })();\n }\n\n const gl = this._scene.canvas.gl;\n const program = this._program;\n const scene = this._scene;\n const viewportWidth = gl.drawingBufferWidth;\n const viewportHeight = gl.drawingBufferHeight;\n const projectState = scene.camera.project._state;\n const near = projectState.near;\n const far = projectState.far;\n\n gl.viewport(0, 0, viewportWidth, viewportHeight);\n gl.clearColor(0, 0, 0, 1);\n gl.enable(gl.DEPTH_TEST);\n gl.disable(gl.BLEND);\n gl.frontFace(gl.CCW);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n program.bind();\n\n tempVec2a[0] = viewportWidth;\n tempVec2a[1] = viewportHeight;\n\n gl.uniform2fv(this._uViewport, tempVec2a);\n gl.uniform1f(this._uCameraNear, near);\n gl.uniform1f(this._uCameraFar, far);\n\n gl.uniform1f(this._uDepthCutoff, blurDepthCutoff);\n\n if (direction === 0) {// Horizontal\n gl.uniform2fv(this._uSampleOffsets, sampleOffsetsHor);\n } else { // Vertical\n gl.uniform2fv(this._uSampleOffsets, sampleOffsetsVert);\n }\n\n gl.uniform1fv(this._uSampleWeights, sampleWeights);\n\n const depthTexture = depthRenderBuffer.getDepthTexture();\n const occlusionTexture = occlusionRenderBuffer.getTexture();\n\n program.bindTexture(this._uDepthTexture, depthTexture, 0); // TODO: use FrameCtx.textureUnit\n program.bindTexture(this._uOcclusionTexture, occlusionTexture, 1);\n\n this._aUV.bindArrayBuffer(this._uvBuf);\n this._aPosition.bindArrayBuffer(this._positionsBuf);\n this._indicesBuf.bind();\n\n gl.drawElements(gl.TRIANGLES, this._indicesBuf.numItems, this._indicesBuf.itemType, 0);\n }\n\n destroy() {\n this._program.destroy();\n }\n}\n\nfunction createSampleWeights(kernelRadius, stdDev) {\n const weights = [];\n for (let i = 0; i <= kernelRadius; i++) {\n weights.push(gaussian(i, stdDev));\n }\n return weights; // TODO: Optimize\n}\n\nfunction gaussian(x, stdDev) {\n return Math.exp(-(x * x) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev);\n}\n\nfunction createSampleOffsets(kernelRadius, uvIncrement) {\n const offsets = [];\n for (let i = 0; i <= kernelRadius; i++) {\n offsets.push(uvIncrement[0] * i);\n offsets.push(uvIncrement[1] * i);\n }\n return offsets;\n}\n\nexport {SAODepthLimitedBlurRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 9056, + "__docId__": 9064, "kind": "variable", "name": "blurStdDev", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176888,7 +177104,7 @@ "ignore": true }, { - "__docId__": 9057, + "__docId__": 9065, "kind": "variable", "name": "blurDepthCutoff", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176909,7 +177125,7 @@ "ignore": true }, { - "__docId__": 9058, + "__docId__": 9066, "kind": "variable", "name": "KERNEL_RADIUS", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176930,7 +177146,7 @@ "ignore": true }, { - "__docId__": 9059, + "__docId__": 9067, "kind": "variable", "name": "sampleOffsetsVert", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176951,7 +177167,7 @@ "ignore": true }, { - "__docId__": 9060, + "__docId__": 9068, "kind": "variable", "name": "sampleOffsetsHor", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176972,7 +177188,7 @@ "ignore": true }, { - "__docId__": 9061, + "__docId__": 9069, "kind": "variable", "name": "sampleWeights", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -176993,7 +177209,7 @@ "ignore": true }, { - "__docId__": 9062, + "__docId__": 9070, "kind": "variable", "name": "tempVec2a", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -177014,7 +177230,7 @@ "ignore": true }, { - "__docId__": 9063, + "__docId__": 9071, "kind": "function", "name": "createSampleWeights", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -177051,7 +177267,7 @@ "ignore": true }, { - "__docId__": 9064, + "__docId__": 9072, "kind": "function", "name": "gaussian", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -177088,7 +177304,7 @@ "ignore": true }, { - "__docId__": 9065, + "__docId__": 9073, "kind": "function", "name": "createSampleOffsets", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -177125,7 +177341,7 @@ "ignore": true }, { - "__docId__": 9066, + "__docId__": 9074, "kind": "class", "name": "SAODepthLimitedBlurRenderer", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js", @@ -177141,7 +177357,7 @@ "ignore": true }, { - "__docId__": 9067, + "__docId__": 9075, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177155,7 +177371,7 @@ "undocument": true }, { - "__docId__": 9068, + "__docId__": 9076, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177173,7 +177389,7 @@ } }, { - "__docId__": 9069, + "__docId__": 9077, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177191,7 +177407,7 @@ } }, { - "__docId__": 9070, + "__docId__": 9078, "kind": "member", "name": "_programError", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177209,7 +177425,7 @@ } }, { - "__docId__": 9071, + "__docId__": 9079, "kind": "member", "name": "_aPosition", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177227,7 +177443,7 @@ } }, { - "__docId__": 9072, + "__docId__": 9080, "kind": "member", "name": "_aUV", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177245,7 +177461,7 @@ } }, { - "__docId__": 9073, + "__docId__": 9081, "kind": "member", "name": "_uDepthTexture", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177263,7 +177479,7 @@ } }, { - "__docId__": 9074, + "__docId__": 9082, "kind": "member", "name": "_uOcclusionTexture", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177281,7 +177497,7 @@ } }, { - "__docId__": 9075, + "__docId__": 9083, "kind": "member", "name": "_uViewport", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177299,7 +177515,7 @@ } }, { - "__docId__": 9076, + "__docId__": 9084, "kind": "member", "name": "_uCameraNear", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177317,7 +177533,7 @@ } }, { - "__docId__": 9077, + "__docId__": 9085, "kind": "member", "name": "_uCameraFar", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177335,7 +177551,7 @@ } }, { - "__docId__": 9078, + "__docId__": 9086, "kind": "member", "name": "_uCameraProjectionMatrix", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177353,7 +177569,7 @@ } }, { - "__docId__": 9079, + "__docId__": 9087, "kind": "member", "name": "_uCameraInverseProjectionMatrix", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177371,7 +177587,7 @@ } }, { - "__docId__": 9080, + "__docId__": 9088, "kind": "member", "name": "_uvBuf", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177389,7 +177605,7 @@ } }, { - "__docId__": 9081, + "__docId__": 9089, "kind": "member", "name": "_positionsBuf", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177407,7 +177623,7 @@ } }, { - "__docId__": 9082, + "__docId__": 9090, "kind": "member", "name": "_indicesBuf", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177425,7 +177641,7 @@ } }, { - "__docId__": 9083, + "__docId__": 9091, "kind": "method", "name": "init", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177441,7 +177657,7 @@ "return": null }, { - "__docId__": 9092, + "__docId__": 9100, "kind": "member", "name": "_uDepthCutoff", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177459,7 +177675,7 @@ } }, { - "__docId__": 9093, + "__docId__": 9101, "kind": "member", "name": "_uSampleOffsets", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177477,7 +177693,7 @@ } }, { - "__docId__": 9094, + "__docId__": 9102, "kind": "member", "name": "_uSampleWeights", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177495,7 +177711,7 @@ } }, { - "__docId__": 9097, + "__docId__": 9105, "kind": "method", "name": "render", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177530,7 +177746,7 @@ "return": null }, { - "__docId__": 9098, + "__docId__": 9106, "kind": "member", "name": "_getInverseProjectMat", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177548,7 +177764,7 @@ } }, { - "__docId__": 9099, + "__docId__": 9107, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js~SAODepthLimitedBlurRenderer", @@ -177564,18 +177780,18 @@ "return": null }, { - "__docId__": 9100, + "__docId__": 9108, "kind": "file", "name": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js", "content": "import {Program} from \"./../Program.js\";\nimport {ArrayBuf} from \"./../ArrayBuf.js\";\nimport {math} from \"../../math/math.js\";\nimport {WEBGL_INFO} from \"../../webglInfo.js\";\n\nconst tempVec2 = math.vec2();\n\n/**\n * SAO implementation inspired from previous SAO work in THREE.js by ludobaka / ludobaka.github.io and bhouston\n * @private\n */\nclass SAOOcclusionRenderer {\n\n constructor(scene) {\n\n this._scene = scene;\n\n this._numSamples = null;\n\n // The program\n\n this._program = null;\n this._programError = false;\n\n // Variable locations\n\n this._aPosition = null;\n this._aUV = null;\n\n this._uDepthTexture = \"uDepthTexture\";\n\n this._uCameraNear = null;\n this._uCameraFar = null;\n this._uCameraProjectionMatrix = null;\n this._uCameraInverseProjectionMatrix = null;\n\n this._uScale = null;\n this._uIntensity = null;\n this._uBias = null;\n this._uKernelRadius = null;\n this._uMinResolution = null;\n this._uRandomSeed = null;\n\n // VBOs\n\n this._uvBuf = null;\n this._positionsBuf = null;\n this._indicesBuf = null;\n }\n\n render(depthRenderBuffer) {\n\n this._build();\n\n if (this._programError) {\n return;\n }\n\n if (!this._getInverseProjectMat) { // HACK: scene.camera not defined until render time\n this._getInverseProjectMat = (() => {\n let projMatDirty = true;\n this._scene.camera.on(\"projMatrix\", function () {\n projMatDirty = true;\n });\n const inverseProjectMat = math.mat4();\n return () => {\n if (projMatDirty) {\n math.inverseMat4(scene.camera.projMatrix, inverseProjectMat);\n }\n return inverseProjectMat;\n }\n })();\n }\n\n const gl = this._scene.canvas.gl;\n const program = this._program;\n const scene = this._scene;\n const sao = scene.sao;\n const viewportWidth = gl.drawingBufferWidth;\n const viewportHeight = gl.drawingBufferHeight;\n const projectState = scene.camera.project._state;\n const near = projectState.near;\n const far = projectState.far;\n const projectionMatrix = projectState.matrix;\n const inverseProjectionMatrix = this._getInverseProjectMat();\n const randomSeed = Math.random();\n const perspective = (scene.camera.projection === \"perspective\");\n\n tempVec2[0] = viewportWidth;\n tempVec2[1] = viewportHeight;\n\n gl.viewport(0, 0, viewportWidth, viewportHeight);\n gl.clearColor(0, 0, 0, 1);\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.BLEND);\n gl.frontFace(gl.CCW);\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n program.bind();\n\n gl.uniform1f(this._uCameraNear, near);\n gl.uniform1f(this._uCameraFar, far);\n\n gl.uniformMatrix4fv(this._uCameraProjectionMatrix, false, projectionMatrix);\n gl.uniformMatrix4fv(this._uCameraInverseProjectionMatrix, false, inverseProjectionMatrix);\n\n gl.uniform1i(this._uPerspective, perspective);\n\n gl.uniform1f(this._uScale, sao.scale * (far / 5));\n gl.uniform1f(this._uIntensity, sao.intensity);\n gl.uniform1f(this._uBias, sao.bias);\n gl.uniform1f(this._uKernelRadius, sao.kernelRadius);\n gl.uniform1f(this._uMinResolution, sao.minResolution);\n gl.uniform2fv(this._uViewport, tempVec2);\n gl.uniform1f(this._uRandomSeed, randomSeed);\n\n const depthTexture = depthRenderBuffer.getDepthTexture();\n\n program.bindTexture(this._uDepthTexture, depthTexture, 0);\n\n this._aUV.bindArrayBuffer(this._uvBuf);\n this._aPosition.bindArrayBuffer(this._positionsBuf);\n this._indicesBuf.bind();\n\n gl.drawElements(gl.TRIANGLES, this._indicesBuf.numItems, this._indicesBuf.itemType, 0);\n }\n\n _build() {\n\n let dirty = false;\n\n const sao = this._scene.sao;\n\n if (sao.numSamples !== this._numSamples) {\n this._numSamples = Math.floor(sao.numSamples);\n dirty = true;\n }\n\n if (!dirty) {\n return;\n }\n\n const gl = this._scene.canvas.gl;\n\n if (this._program) {\n this._program.destroy();\n this._program = null;\n }\n\n this._program = new Program(gl, {\n\n vertex: [`#version 300 es\n precision highp float;\n precision highp int;\n \n in vec3 aPosition;\n in vec2 aUV; \n \n out vec2 vUV;\n \n void main () {\n gl_Position = vec4(aPosition, 1.0);\n vUV = aUV;\n }`],\n\n fragment: [\n `#version 300 es \n precision highp float;\n precision highp int; \n \n #define NORMAL_TEXTURE 0\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define EPSILON 1e-6\n #define NUM_SAMPLES ${this._numSamples}\n #define NUM_RINGS 4 \n \n in vec2 vUV;\n \n uniform sampler2D uDepthTexture;\n \n uniform float uCameraNear;\n uniform float uCameraFar;\n uniform mat4 uProjectMatrix;\n uniform mat4 uInverseProjectMatrix;\n \n uniform bool uPerspective;\n\n uniform float uScale;\n uniform float uIntensity;\n uniform float uBias;\n uniform float uKernelRadius;\n uniform float uMinResolution;\n uniform vec2 uViewport;\n uniform float uRandomSeed;\n\n float pow2( const in float x ) { return x*x; }\n \n highp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n }\n\n vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n }\n\n vec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n }\n\n const float packUpscale = 256. / 255.;\n const float unpackDownScale = 255. / 256.; \n\n const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\n const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. ); \n\n const float shiftRights = 1. / 256.;\n\n vec4 packFloatToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * packFactors ), v );\n r.yzw -= r.xyz * shiftRights; \n return r * packUpscale;\n }\n\n float unpackRGBAToFloat( const in vec4 v ) { \n return dot( floor( v * 255.0 + 0.5 ) / 255.0, unPackFactors );\n }\n \n float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n }\n\n float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n }\n \n float getDepth( const in vec2 screenPosition ) {\n return vec4(texture(uDepthTexture, screenPosition)).r;\n }\n\n float getViewZ( const in float depth ) {\n if (uPerspective) {\n return perspectiveDepthToViewZ( depth, uCameraNear, uCameraFar );\n } else {\n return orthographicDepthToViewZ( depth, uCameraNear, uCameraFar );\n }\n }\n\n vec3 getViewPos( const in vec2 screenPos, const in float depth, const in float viewZ ) {\n \tfloat clipW = uProjectMatrix[2][3] * viewZ + uProjectMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPos, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; \n \treturn ( uInverseProjectMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPos ) { \n return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - uBias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \n \tscaleDividedByCameraFar = uScale / uCameraFar;\n \tminResolutionMultipliedByCameraFar = uMinResolution * uCameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUV );\n\n \tfloat angle = rand( vUV + uRandomSeed ) * PI2;\n \tvec2 radius = vec2( uKernelRadius * INV_NUM_SAMPLES ) / uViewport;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUV + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPos( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( uIntensity / weightSum );\n }\n\n out vec4 outColor;\n \n void main() {\n \n \tfloat centerDepth = getDepth( vUV );\n \t\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPos( vUV, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n \n \toutColor = packFloatToRGBA( 1.0- ambientOcclusion );\n }`]\n });\n\n if (this._program.errors) {\n console.error(this._program.errors.join(\"\\n\"));\n this._programError = true;\n return;\n }\n\n const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);\n const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);\n \n // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures\n const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);\n\n this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);\n this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);\n this._indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, indices, indices.length, 1, gl.STATIC_DRAW);\n\n this._program.bind();\n\n this._uCameraNear = this._program.getLocation(\"uCameraNear\");\n this._uCameraFar = this._program.getLocation(\"uCameraFar\");\n\n this._uCameraProjectionMatrix = this._program.getLocation(\"uProjectMatrix\");\n this._uCameraInverseProjectionMatrix = this._program.getLocation(\"uInverseProjectMatrix\");\n\n this._uPerspective = this._program.getLocation(\"uPerspective\");\n\n this._uScale = this._program.getLocation(\"uScale\");\n this._uIntensity = this._program.getLocation(\"uIntensity\");\n this._uBias = this._program.getLocation(\"uBias\");\n this._uKernelRadius = this._program.getLocation(\"uKernelRadius\");\n this._uMinResolution = this._program.getLocation(\"uMinResolution\");\n this._uViewport = this._program.getLocation(\"uViewport\");\n this._uRandomSeed = this._program.getLocation(\"uRandomSeed\");\n\n this._aPosition = this._program.getAttribute(\"aPosition\");\n this._aUV = this._program.getAttribute(\"aUV\");\n\n this._dirty = false;\n }\n\n destroy() {\n if (this._program) {\n this._program.destroy();\n this._program = null;\n }\n }\n}\n\nexport {SAOOcclusionRenderer};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 9101, + "__docId__": 9109, "kind": "variable", "name": "tempVec2", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js", @@ -177596,7 +177812,7 @@ "ignore": true }, { - "__docId__": 9102, + "__docId__": 9110, "kind": "class", "name": "SAOOcclusionRenderer", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js", @@ -177612,7 +177828,7 @@ "ignore": true }, { - "__docId__": 9103, + "__docId__": 9111, "kind": "constructor", "name": "constructor", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177626,7 +177842,7 @@ "undocument": true }, { - "__docId__": 9104, + "__docId__": 9112, "kind": "member", "name": "_scene", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177644,7 +177860,7 @@ } }, { - "__docId__": 9105, + "__docId__": 9113, "kind": "member", "name": "_numSamples", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177662,7 +177878,7 @@ } }, { - "__docId__": 9106, + "__docId__": 9114, "kind": "member", "name": "_program", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177680,7 +177896,7 @@ } }, { - "__docId__": 9107, + "__docId__": 9115, "kind": "member", "name": "_programError", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177698,7 +177914,7 @@ } }, { - "__docId__": 9108, + "__docId__": 9116, "kind": "member", "name": "_aPosition", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177716,7 +177932,7 @@ } }, { - "__docId__": 9109, + "__docId__": 9117, "kind": "member", "name": "_aUV", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177734,7 +177950,7 @@ } }, { - "__docId__": 9110, + "__docId__": 9118, "kind": "member", "name": "_uDepthTexture", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177752,7 +177968,7 @@ } }, { - "__docId__": 9111, + "__docId__": 9119, "kind": "member", "name": "_uCameraNear", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177770,7 +177986,7 @@ } }, { - "__docId__": 9112, + "__docId__": 9120, "kind": "member", "name": "_uCameraFar", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177788,7 +178004,7 @@ } }, { - "__docId__": 9113, + "__docId__": 9121, "kind": "member", "name": "_uCameraProjectionMatrix", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177806,7 +178022,7 @@ } }, { - "__docId__": 9114, + "__docId__": 9122, "kind": "member", "name": "_uCameraInverseProjectionMatrix", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177824,7 +178040,7 @@ } }, { - "__docId__": 9115, + "__docId__": 9123, "kind": "member", "name": "_uScale", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177842,7 +178058,7 @@ } }, { - "__docId__": 9116, + "__docId__": 9124, "kind": "member", "name": "_uIntensity", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177860,7 +178076,7 @@ } }, { - "__docId__": 9117, + "__docId__": 9125, "kind": "member", "name": "_uBias", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177878,7 +178094,7 @@ } }, { - "__docId__": 9118, + "__docId__": 9126, "kind": "member", "name": "_uKernelRadius", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177896,7 +178112,7 @@ } }, { - "__docId__": 9119, + "__docId__": 9127, "kind": "member", "name": "_uMinResolution", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177914,7 +178130,7 @@ } }, { - "__docId__": 9120, + "__docId__": 9128, "kind": "member", "name": "_uRandomSeed", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177932,7 +178148,7 @@ } }, { - "__docId__": 9121, + "__docId__": 9129, "kind": "member", "name": "_uvBuf", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177950,7 +178166,7 @@ } }, { - "__docId__": 9122, + "__docId__": 9130, "kind": "member", "name": "_positionsBuf", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177968,7 +178184,7 @@ } }, { - "__docId__": 9123, + "__docId__": 9131, "kind": "member", "name": "_indicesBuf", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -177986,7 +178202,7 @@ } }, { - "__docId__": 9124, + "__docId__": 9132, "kind": "method", "name": "render", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178009,7 +178225,7 @@ "return": null }, { - "__docId__": 9125, + "__docId__": 9133, "kind": "member", "name": "_getInverseProjectMat", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178027,7 +178243,7 @@ } }, { - "__docId__": 9126, + "__docId__": 9134, "kind": "method", "name": "_build", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178044,7 +178260,7 @@ "return": null }, { - "__docId__": 9138, + "__docId__": 9146, "kind": "member", "name": "_uPerspective", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178062,7 +178278,7 @@ } }, { - "__docId__": 9144, + "__docId__": 9152, "kind": "member", "name": "_uViewport", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178080,7 +178296,7 @@ } }, { - "__docId__": 9148, + "__docId__": 9156, "kind": "member", "name": "_dirty", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178098,7 +178314,7 @@ } }, { - "__docId__": 9149, + "__docId__": 9157, "kind": "method", "name": "destroy", "memberof": "src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js~SAOOcclusionRenderer", @@ -178114,18 +178330,18 @@ "return": null }, { - "__docId__": 9151, + "__docId__": 9159, "kind": "file", "name": "src/viewer/scene/webgl/webglEnums.js", "content": "/**\n * @author xeolabs / https://github.com/xeolabs\n */\n\n/**\n * @desc Human-readable WebGL enumeration mappings.\n * @private\n */\nconst webglEnums = {\n funcAdd: \"FUNC_ADD\",\n funcSubtract: \"FUNC_SUBTRACT\",\n funcReverseSubtract: \"FUNC_REVERSE_SUBTRACT\",\n zero: \"ZERO\",\n one: \"ONE\",\n srcColor: \"SRC_COLOR\",\n oneMinusSrcColor: \"ONE_MINUS_SRC_COLOR\",\n dstColor: \"DST_COLOR\",\n oneMinusDstColor: \"ONE_MINUS_DST_COLOR\",\n srcAlpha: \"SRC_ALPHA\",\n oneMinusSrcAlpha: \"ONE_MINUS_SRC_ALPHA\",\n dstAlpha: \"DST_ALPHA\",\n oneMinusDstAlpha: \"ONE_MINUS_DST_ALPHA\",\n contantColor: \"CONSTANT_COLOR\",\n oneMinusConstantColor: \"ONE_MINUS_CONSTANT_COLOR\",\n constantAlpha: \"CONSTANT_ALPHA\",\n oneMinusConstantAlpha: \"ONE_MINUS_CONSTANT_ALPHA\",\n srcAlphaSaturate: \"SRC_ALPHA_SATURATE\",\n front: \"FRONT\",\n back: \"BACK\",\n frontAndBack: \"FRONT_AND_BACK\",\n never: \"NEVER\",\n less: \"LESS\",\n equal: \"EQUAL\",\n lequal: \"LEQUAL\",\n greater: \"GREATER\",\n notequal: \"NOTEQUAL\",\n gequal: \"GEQUAL\",\n always: \"ALWAYS\",\n cw: \"CW\",\n ccw: \"CCW\",\n linear: \"LINEAR\",\n nearest: \"NEAREST\",\n linearMipmapNearest: \"LINEAR_MIPMAP_NEAREST\",\n nearestMipmapNearest: \"NEAREST_MIPMAP_NEAREST\",\n nearestMipmapLinear: \"NEAREST_MIPMAP_LINEAR\",\n linearMipmapLinear: \"LINEAR_MIPMAP_LINEAR\",\n repeat: \"REPEAT\",\n clampToEdge: \"CLAMP_TO_EDGE\",\n mirroredRepeat: \"MIRRORED_REPEAT\",\n alpha: \"ALPHA\",\n rgb: \"RGB\",\n rgba: \"RGBA\",\n luminance: \"LUMINANCE\",\n luminanceAlpha: \"LUMINANCE_ALPHA\",\n textureBinding2D: \"TEXTURE_BINDING_2D\",\n textureBindingCubeMap: \"TEXTURE_BINDING_CUBE_MAP\",\n compareRToTexture: \"COMPARE_R_TO_TEXTURE\", // Hardware Shadowing Z-depth,\n unsignedByte: \"UNSIGNED_BYTE\"\n};\n\nexport {webglEnums};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webgl/webglEnums.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webgl/webglEnums.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 9152, + "__docId__": 9160, "kind": "variable", "name": "webglEnums", "memberof": "src/viewer/scene/webgl/webglEnums.js", @@ -178145,18 +178361,18 @@ } }, { - "__docId__": 9153, + "__docId__": 9161, "kind": "file", "name": "src/viewer/scene/webglInfo.js", "content": "/**\n * @private\n * @type {{WEBGL: boolean, SUPPORTED_EXTENSIONS: {}}}\n */\nconst WEBGL_INFO = {\n WEBGL: false,\n SUPPORTED_EXTENSIONS: {}\n};\n\nconst canvas = document.createElement(\"canvas\");\n\nif (canvas) {\n\n const gl = canvas.getContext(\"webgl\", {antialias: true}) || canvas.getContext(\"experimental-webgl\", {antialias: true});\n\n WEBGL_INFO.WEBGL = !!gl;\n\n if (WEBGL_INFO.WEBGL) {\n WEBGL_INFO.ANTIALIAS = gl.getContextAttributes().antialias;\n if (gl.getShaderPrecisionFormat) {\n if (gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) {\n WEBGL_INFO.FS_MAX_FLOAT_PRECISION = \"highp\";\n } else if (gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) {\n WEBGL_INFO.FS_MAX_FLOAT_PRECISION = \"mediump\";\n } else {\n WEBGL_INFO.FS_MAX_FLOAT_PRECISION = \"lowp\";\n }\n } else {\n WEBGL_INFO.FS_MAX_FLOAT_PRECISION = \"mediump\";\n }\n WEBGL_INFO.DEPTH_BUFFER_BITS = gl.getParameter(gl.DEPTH_BITS);\n WEBGL_INFO.MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n WEBGL_INFO.MAX_CUBE_MAP_SIZE = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n WEBGL_INFO.MAX_RENDERBUFFER_SIZE = gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);\n WEBGL_INFO.MAX_TEXTURE_UNITS = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\n WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n WEBGL_INFO.MAX_VERTEX_ATTRIBS = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n WEBGL_INFO.MAX_VERTEX_UNIFORM_VECTORS = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n WEBGL_INFO.MAX_FRAGMENT_UNIFORM_VECTORS = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n WEBGL_INFO.MAX_VARYING_VECTORS = gl.getParameter(gl.MAX_VARYING_VECTORS);\n gl.getSupportedExtensions().forEach(function (ext) {\n WEBGL_INFO.SUPPORTED_EXTENSIONS[ext] = true;\n });\n }\n}\n\nexport {WEBGL_INFO};", "static": true, - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/src/viewer/scene/webglInfo.js", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/src/viewer/scene/webglInfo.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 9154, + "__docId__": 9162, "kind": "variable", "name": "canvas", "memberof": "src/viewer/scene/webglInfo.js", @@ -178177,7 +178393,7 @@ "ignore": true }, { - "__docId__": 9155, + "__docId__": 9163, "kind": "variable", "name": "WEBGL_INFO", "memberof": "src/viewer/scene/webglInfo.js", @@ -178202,15 +178418,15 @@ { "kind": "index", "content": "# xeokit-sdk\n\n[![npm version](https://badge.fury.io/js/%40xeokit%2Fxeokit-sdk.svg)](https://badge.fury.io/js/%40xeokit%2Fxeokit-sdk)\n[![](https://data.jsdelivr.com/v1/package/npm/@xeokit/xeokit-sdk/badge)](https://www.jsdelivr.com/package/npm/@xeokit/xeokit-sdk)\n[![CodeSee](https://github.com/xeokit/xeokit-sdk/actions/workflows/codesee-arch-diagram.yml/badge.svg)](https://github.com/xeokit/xeokit-sdk/actions/workflows/codesee-arch-diagram.yml)\n\n[xeokit](http://xeokit.io) is a JavaScript software development kit created by [xeolabs](http://xeolabs.com) for viewing\nhigh-detail, full-precision 3D engineering and BIM models in the browser.\n\n## Resources\n\n* [xeokit.io](https://xeokit.io/)\n* [Examples](http://xeokit.github.io/xeokit-sdk/examples/)\n* [Guides](https://www.notion.so/xeokit/xeokit-Documentation-4598591fcedb4889bf8896750651f74e)\n* [API Docs](https://xeokit.github.io/xeokit-sdk/docs/)\n* [Features](https://xeokit.io/index.html?foo=1#features)\n* [Changelog](https://github.com/xeokit/xeokit-sdk/blob/master/CHANGELOG.md)\n* [FAQ](https://xeokit.io/index.html?foo=1#faq)\n* [License](https://xeokit.io/index.html#pricing)\n\n## Installing\n\n````bash\nnpm i @xeokit/xeokit-sdk\n````\n\n## Usage\n\nThe xeokit SDK lets us develop our own browser-based BIM viewer, which we can fully customize and extend with\nplugins. Let's create a [Viewer](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html) with\na [WebIFCLoaderPlugin](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js~WebIFCLoaderPlugin.html)\nto view a IFC model in the browser, then view a sample IFC model from\nthe [Open IFC Model Database](http://openifcmodel.cs.auckland.ac.nz/Model/Details/274).\n\nThis is just one way to load our models into xeokit. We can also load multiple models from other formats, \nincluding [CityJSON](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js~CityJSONLoaderPlugin.html), \n[glTF](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js~GLTFLoaderPlugin.html), \n[LAZ](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js~LASLoaderPlugin.html) \nand [OBJ](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js~OBJLoaderPlugin.html), \nas well as xeokit's own native highly-compressed [XKT](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html) format, \nwhich we can pre-convert offline from other formats. \n\n * [Run this example](https://xeokit.github.io/xeokit-sdk/examples/#BIMOffline_WebIFCLoaderPlugin_Duplex)\n * [Read the full tutorial](https://www.notion.so/xeokit/Viewing-an-IFC-Model-with-WebIFCLoaderPlugin-9a572b801af949bf87a21c88968bd251)\n\n![](https://xeokit.io/img/docs/WebIFCLoaderPlugin/WebIFCLoaderPluginBig.png)\n\n````html\n\n\n\n \n \n \n xeokit Example\n \n\n\n\n\n\n\n````\n\n\n\n\n\n\n\n\n", - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/README.md", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/README.md", "name": "./README.md", "static": true, "access": "public" }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@xeokit/xeokit-sdk\",\n \"version\": \"2.6.6\",\n \"description\": \"Web Programming Toolkit for 3D/2D BIM and AEC Graphics\",\n \"module\": \"./dist/xeokit-sdk.es.js\",\n \"main\": \"./dist/xeokit-sdk.cjs.js\",\n \"types\": \"./types/index.d.ts\",\n \"scripts\": {\n \"build\": \"rollup --config rollup.config.js; rollup --config rollup.minified.config.js\",\n \"dev-build\": \"rollup --config rollup.dev.config.js\",\n \"docs\": \"rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"typedocs\": \"rm -Rf ./docs/*; typedoc --tsconfig tsconfig.json\",\n \"publish\": \"npm publish --access public\",\n \"changelog\": \"auto-changelog --commit-limit false --package --template changelog-template.hbs\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/xeokit/xeokit-sdk.git\"\n },\n \"auto-changelog\": {\n \"output\": \"CHANGELOG.md\",\n \"template\": \"keepachangelog\",\n \"unreleased\": true,\n \"commitLimit\": false\n },\n \"keywords\": [\n \"webgl\",\n \"webgl2\",\n \"javascript\",\n \"xeokit\",\n \"xeolabs\",\n \"creoox\",\n \"ifc\",\n \"bcf\",\n \"bim\",\n \"gis\",\n \"cad\",\n \"buildingsmart\",\n \"openbim\",\n \"opensource\",\n \"solidworks\",\n \"gltf\",\n \"3dxml\",\n \"obj\",\n \"stl\",\n \"laz\",\n \"las\",\n \"pointcloud\",\n \"3d-viewer\"\n ],\n \"author\": \"Lindsay Kay\",\n \"license\": \"See LICENSE.txt\",\n \"bugs\": {\n \"url\": \"https://github.com/xeokit/xeokit-sdk/issues\"\n },\n \"homepage\": \"https://xeokit.io\",\n \"dependencies\": {\n \"@loaders.gl/core\": \"^3.2.6\",\n \"@loaders.gl/gltf\": \"^3.2.6\",\n \"@loaders.gl/las\": \"^3.2.6\",\n \"html2canvas\": \"^1.4.1\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.18.6\",\n \"@babel/preset-env\": \"^7.18.6\",\n \"@rollup/plugin-babel\": \"^5.3.1\",\n \"@rollup/plugin-node-resolve\": \"^13.2.1\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-custom-theme\": \"^1.4.2\",\n \"esdoc-publish-html-plugin\": \"^1.1.2\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint\": \"^8.13.0\",\n \"parse5\": \"^7.0.0\",\n \"rollup\": \"^2.70.2\",\n \"rollup-plugin-terser\": \"^7.0.2\",\n \"typedoc\": \"^0.22.15\",\n \"auto-changelog\": \"^2.4.0\"\n },\n \"files\": [\n \"/src\",\n \"/dist\",\n \"/types\"\n ]\n}\n", - "longname": "/home/lindsay/xeolabs/xeokit-sdk-apr15/package.json", + "content": "{\n \"name\": \"@xeokit/xeokit-sdk\",\n \"version\": \"2.6.11\",\n \"description\": \"Web Programming Toolkit for 3D/2D BIM and AEC Graphics\",\n \"module\": \"./dist/xeokit-sdk.es.js\",\n \"main\": \"./dist/xeokit-sdk.cjs.js\",\n \"types\": \"./types/index.d.ts\",\n \"scripts\": {\n \"build\": \"rollup --config rollup.config.js; rollup --config rollup.minified.config.js\",\n \"dev-build\": \"rollup --config rollup.dev.config.js\",\n \"docs\": \"rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"typedocs\": \"rm -Rf ./docs/*; typedoc --tsconfig tsconfig.json\",\n \"publish\": \"npm publish --access public\",\n \"changelog\": \"auto-changelog --commit-limit false --package --template changelog-template.hbs\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/xeokit/xeokit-sdk.git\"\n },\n \"auto-changelog\": {\n \"output\": \"CHANGELOG.md\",\n \"template\": \"keepachangelog\",\n \"unreleased\": true,\n \"commitLimit\": false\n },\n \"keywords\": [\n \"webgl\",\n \"webgl2\",\n \"javascript\",\n \"xeokit\",\n \"xeolabs\",\n \"creoox\",\n \"ifc\",\n \"bcf\",\n \"bim\",\n \"gis\",\n \"cad\",\n \"buildingsmart\",\n \"openbim\",\n \"opensource\",\n \"solidworks\",\n \"gltf\",\n \"3dxml\",\n \"obj\",\n \"stl\",\n \"laz\",\n \"las\",\n \"pointcloud\",\n \"3d-viewer\"\n ],\n \"author\": \"Lindsay Kay\",\n \"license\": \"See LICENSE.txt\",\n \"bugs\": {\n \"url\": \"https://github.com/xeokit/xeokit-sdk/issues\"\n },\n \"homepage\": \"https://xeokit.io\",\n \"dependencies\": {\n \"@loaders.gl/core\": \"^3.2.6\",\n \"@loaders.gl/gltf\": \"^3.2.6\",\n \"@loaders.gl/las\": \"^3.2.6\",\n \"html2canvas\": \"^1.4.1\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.18.6\",\n \"@babel/preset-env\": \"^7.18.6\",\n \"@rollup/plugin-babel\": \"^5.3.1\",\n \"@rollup/plugin-node-resolve\": \"^13.2.1\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-custom-theme\": \"^1.4.2\",\n \"esdoc-publish-html-plugin\": \"^1.1.2\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint\": \"^8.13.0\",\n \"parse5\": \"^7.0.0\",\n \"rollup\": \"^2.70.2\",\n \"rollup-plugin-terser\": \"^7.0.2\",\n \"typedoc\": \"^0.22.15\",\n \"auto-changelog\": \"^2.4.0\"\n },\n \"files\": [\n \"/src\",\n \"/dist\",\n \"/types\"\n ]\n}\n", + "longname": "/home/lindsay/xeokit/xeokit-sdk-feb2/package.json", "name": "package.json", "static": true, "access": "public" diff --git a/docs/script/search_index.js b/docs/script/search_index.js index c50b59aa5d..7733e34140 100644 --- a/docs/script/search_index.js +++ b/docs/script/search_index.js @@ -2207,6 +2207,12 @@ window.esdocSearchIndex = [ "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl#active", "member" ], + [ + "src/plugins/anglemeasurementsplugin/anglemeasurementscontrol.js~anglemeasurementscontrol#currentmeasurement", + "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html#instance-get-currentMeasurement", + "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl#currentMeasurement", + "member" + ], [ "src/plugins/anglemeasurementsplugin/anglemeasurementscontrol.js~anglemeasurementscontrol#deactivate", "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js~AngleMeasurementsControl.html#instance-method-deactivate", @@ -2267,6 +2273,12 @@ window.esdocSearchIndex = [ "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl#constructor", "method" ], + [ + "src/plugins/anglemeasurementsplugin/anglemeasurementsmousecontrol.js~anglemeasurementsmousecontrol#currentmeasurement", + "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html#instance-get-currentMeasurement", + "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl#currentMeasurement", + "member" + ], [ "src/plugins/anglemeasurementsplugin/anglemeasurementsmousecontrol.js~anglemeasurementsmousecontrol#deactivate", "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js~AngleMeasurementsMouseControl.html#instance-method-deactivate", @@ -2423,6 +2435,12 @@ window.esdocSearchIndex = [ "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl#constructor", "method" ], + [ + "src/plugins/anglemeasurementsplugin/anglemeasurementstouchcontrol.js~anglemeasurementstouchcontrol#currentmeasurement", + "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html#instance-get-currentMeasurement", + "src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl#currentMeasurement", + "member" + ], [ "src/plugins/anglemeasurementsplugin/anglemeasurementstouchcontrol.js~anglemeasurementstouchcontrol#deactivate", "class/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js~AngleMeasurementsTouchControl.html#instance-method-deactivate", @@ -2993,6 +3011,12 @@ window.esdocSearchIndex = [ "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl#active", "member" ], + [ + "src/plugins/distancemeasurementsplugin/distancemeasurementscontrol.js~distancemeasurementscontrol#currentmeasurement", + "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html#instance-get-currentMeasurement", + "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl#currentMeasurement", + "member" + ], [ "src/plugins/distancemeasurementsplugin/distancemeasurementscontrol.js~distancemeasurementscontrol#deactivate", "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js~DistanceMeasurementsControl.html#instance-method-deactivate", @@ -3047,6 +3071,12 @@ window.esdocSearchIndex = [ "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl#constructor", "method" ], + [ + "src/plugins/distancemeasurementsplugin/distancemeasurementsmousecontrol.js~distancemeasurementsmousecontrol#currentmeasurement", + "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html#instance-get-currentMeasurement", + "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl#currentMeasurement", + "member" + ], [ "src/plugins/distancemeasurementsplugin/distancemeasurementsmousecontrol.js~distancemeasurementsmousecontrol#deactivate", "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js~DistanceMeasurementsMouseControl.html#instance-method-deactivate", @@ -3281,6 +3311,12 @@ window.esdocSearchIndex = [ "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl#constructor", "method" ], + [ + "src/plugins/distancemeasurementsplugin/distancemeasurementstouchcontrol.js~distancemeasurementstouchcontrol#currentmeasurement", + "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html#instance-get-currentMeasurement", + "src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl#currentMeasurement", + "member" + ], [ "src/plugins/distancemeasurementsplugin/distancemeasurementstouchcontrol.js~distancemeasurementstouchcontrol#deactivate", "class/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js~DistanceMeasurementsTouchControl.html#instance-method-deactivate", diff --git a/docs/source.html b/docs/source.html index 8bc7291541..3996fbe03b 100644 --- a/docs/source.html +++ b/docs/source.html @@ -276,7 +276,7 @@ - 31788 byte 927 - 2024-04-03 12:43:06 (UTC) + 2024-04-04 08:02:02 (UTC) src/extras/ContextMenu/index.js @@ -284,7 +284,7 @@ - 33 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/MarqueePicker/MarqueePicker.js @@ -292,7 +292,7 @@ - 13718 byte 352 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/MarqueePicker/MarqueePickerMouseControl.js @@ -300,7 +300,7 @@ - 5340 byte 174 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/MarqueePicker/index.js @@ -308,7 +308,7 @@ - 83 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/PointerCircle/PointerCircle.js @@ -316,7 +316,7 @@ - 4181 byte 134 - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/extras/PointerCircle/index.js @@ -324,7 +324,7 @@ - 35 byte - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/extras/PointerLens/PointerLens.js @@ -332,7 +332,7 @@ - 10160 byte 311 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/extras/PointerLens/index.js @@ -340,7 +340,7 @@ - 33 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/collision/ObjectsKdTree3.js @@ -348,7 +348,7 @@ - 4716 byte 149 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/collision/index.js @@ -356,7 +356,7 @@ - 36 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/extras/index.js @@ -364,7 +364,7 @@ - 201 byte 4 - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/index.js @@ -372,7 +372,7 @@ - 105 byte 2 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js @@ -380,23 +380,23 @@ - 21503 byte 731 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js AngleMeasurementsControl - - 2311 byte - 83 - 2024-04-02 15:23:24 (UTC) + 2535 byte + 92 + 2024-05-04 12:16:03 (UTC) src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js AngleMeasurementsMouseControl - - 18888 byte - 450 - 2024-04-07 16:26:26 (UTC) + 19228 byte + 459 + 2024-05-04 12:16:02 (UTC) src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js @@ -404,15 +404,15 @@ - 16724 byte 446 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js AngleMeasurementsTouchControl - - 45353 byte - 918 - 2024-05-04 23:30:22 (UTC) + 45607 byte + 927 + 2024-05-04 12:16:02 (UTC) src/plugins/AngleMeasurementsPlugin/index.js @@ -420,7 +420,7 @@ - 196 byte 3 - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/plugins/AnnotationsPlugin/Annotation.js @@ -428,7 +428,7 @@ - 12605 byte 367 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/AnnotationsPlugin/AnnotationsPlugin.js @@ -436,7 +436,7 @@ - 26091 byte 583 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/AnnotationsPlugin/index.js @@ -444,7 +444,7 @@ - 39 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js @@ -452,7 +452,7 @@ - 11424 byte 332 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/AxisGizmoPlugin/index.js @@ -460,7 +460,7 @@ - 37 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js @@ -468,7 +468,7 @@ - 40114 byte 977 - 2024-04-03 12:43:06 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/BCFViewpointsPlugin/index.js @@ -476,7 +476,7 @@ - 41 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js @@ -484,7 +484,7 @@ - 717 byte 29 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js @@ -492,7 +492,7 @@ - 26718 byte 751 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/CityJSONLoaderPlugin/index.js @@ -500,7 +500,7 @@ - 42 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js @@ -508,23 +508,23 @@ - 33699 byte 999 - 2024-04-02 23:53:54 (UTC) + 2024-04-04 11:17:28 (UTC) src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js DistanceMeasurementsControl - - 2365 byte - 83 - 2024-05-04 22:56:49 (UTC) + 2598 byte + 92 + 2024-05-04 12:16:02 (UTC) src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js DistanceMeasurementsMouseControl - - 17219 byte - 411 - 2024-05-04 23:30:22 (UTC) + 17627 byte + 422 + 2024-05-04 12:16:02 (UTC) src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js @@ -532,15 +532,15 @@ - 22963 byte 548 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js DistanceMeasurementsTouchControl - - 35844 byte - 760 - 2024-05-04 23:30:22 (UTC) + 36169 byte + 770 + 2024-05-04 12:16:03 (UTC) src/plugins/DistanceMeasurementsPlugin/index.js @@ -548,7 +548,7 @@ - 208 byte 3 - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js @@ -556,7 +556,7 @@ - 22762 byte 639 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js @@ -564,7 +564,7 @@ - 16162 byte 436 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js @@ -572,7 +572,7 @@ - 9153 byte 247 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js @@ -580,7 +580,7 @@ - 5099 byte 167 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/FaceAlignedSectionPlanesPlugin/index.js @@ -588,7 +588,7 @@ - 53 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/FastNavPlugin/FastNavPlugin.js @@ -596,7 +596,7 @@ - 18500 byte 460 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/FastNavPlugin/index.js @@ -604,7 +604,7 @@ - 35 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js @@ -612,7 +612,7 @@ - 4443 byte 139 - 2024-04-02 15:23:24 (UTC) + 2024-03-01 19:24:01 (UTC) src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js @@ -620,7 +620,7 @@ - 19511 byte 420 - 2024-04-07 14:42:13 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js @@ -628,7 +628,7 @@ - 23699 byte 675 - 2024-04-03 11:23:24 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/GLTFLoaderPlugin/index.js @@ -636,7 +636,7 @@ - 82 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/LASLoaderPlugin/LASDefaultDataSource.js @@ -644,7 +644,7 @@ - 1987 byte 57 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/LASLoaderPlugin/LASLoaderPlugin.js @@ -652,7 +652,7 @@ - 22408 byte 563 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/LASLoaderPlugin/index.js @@ -660,7 +660,7 @@ - 37 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/NavCubePlugin/CubeTextureCanvas.js @@ -668,7 +668,7 @@ - 13023 byte 290 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/NavCubePlugin/NavCubePlugin.js @@ -676,7 +676,7 @@ - 31839 byte 753 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/NavCubePlugin/index.js @@ -684,7 +684,7 @@ - 35 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js @@ -692,7 +692,7 @@ - 5892 byte 144 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js @@ -700,7 +700,7 @@ - 25150 byte 776 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/OBJLoaderPlugin/index.js @@ -708,7 +708,7 @@ - 37 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/STLLoaderPlugin/STLDefaultDataSource.js @@ -716,7 +716,7 @@ - 1001 byte 32 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/STLLoaderPlugin/STLLoaderPlugin.js @@ -724,7 +724,7 @@ - 11979 byte 273 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js @@ -732,7 +732,7 @@ - 10336 byte 312 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/STLLoaderPlugin/index.js @@ -740,7 +740,7 @@ - 80 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/SectionPlanesPlugin/Control.js @@ -748,7 +748,7 @@ - 54318 byte 1362 - 2024-04-06 21:50:13 (UTC) + 2024-04-05 06:51:34 (UTC) src/plugins/SectionPlanesPlugin/Overview.js @@ -756,7 +756,7 @@ - 9122 byte 249 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/SectionPlanesPlugin/Plane.js @@ -764,7 +764,7 @@ - 5109 byte 169 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js @@ -772,7 +772,7 @@ - 14096 byte 404 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/SectionPlanesPlugin/index.js @@ -780,7 +780,7 @@ - 41 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/SkyboxesPlugin/SkyboxesPlugin.js @@ -788,7 +788,7 @@ - 3142 byte 134 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/SkyboxesPlugin/index.js @@ -796,7 +796,7 @@ - 36 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/StoreyViewsPlugin/Storey.js @@ -804,7 +804,7 @@ - 2514 byte 83 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/StoreyViewsPlugin/StoreyMap.js @@ -812,7 +812,7 @@ - 1209 byte 56 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js @@ -820,7 +820,7 @@ - 28266 byte 773 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/StoreyViewsPlugin/index.js @@ -828,7 +828,7 @@ - 39 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/TreeViewPlugin/RenderService.js @@ -836,7 +836,7 @@ - 4457 byte 169 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/TreeViewPlugin/TreeViewNode.js @@ -844,7 +844,7 @@ - 1852 byte 101 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/TreeViewPlugin/TreeViewPlugin.js @@ -852,7 +852,7 @@ - 52470 byte 1370 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/TreeViewPlugin/index.js @@ -860,7 +860,7 @@ - 36 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/ViewCullPlugin/ViewCullPlugin.js @@ -868,7 +868,7 @@ - 9206 byte 295 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/ViewCullPlugin/index.js @@ -876,7 +876,7 @@ - 36 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js @@ -884,7 +884,7 @@ - 1996 byte 57 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js @@ -892,7 +892,7 @@ - 40879 byte 960 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/WebIFCLoaderPlugin/index.js @@ -900,7 +900,7 @@ - 40 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js @@ -908,7 +908,7 @@ - 3127 byte 94 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js @@ -916,7 +916,7 @@ - 52047 byte 1151 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/XKTLoaderPlugin/index.js @@ -924,7 +924,7 @@ - 80 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV1.js @@ -932,7 +932,7 @@ - 6391 byte 168 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV10.js @@ -940,7 +940,7 @@ - 36682 byte 659 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV2.js @@ -948,7 +948,7 @@ - 8525 byte 229 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV3.js @@ -956,7 +956,7 @@ - 8729 byte 222 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV4.js @@ -964,7 +964,7 @@ - 13133 byte 282 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV5.js @@ -972,7 +972,7 @@ - 10832 byte 245 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV6.js @@ -980,7 +980,7 @@ - 12910 byte 300 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV7.js @@ -988,7 +988,7 @@ - 20751 byte 438 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV8.js @@ -996,7 +996,7 @@ - 28898 byte 562 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/ParserV9.js @@ -1004,7 +1004,7 @@ - 26956 byte 517 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XKTLoaderPlugin/parsers/lib/pako.js @@ -1012,7 +1012,7 @@ - 46858 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js @@ -1020,7 +1020,7 @@ - 11517 byte 237 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js @@ -1028,7 +1028,7 @@ - 46748 byte 1279 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/XML3DLoaderPlugin/index.js @@ -1036,7 +1036,7 @@ - 39 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/index.js @@ -1044,7 +1044,7 @@ - 973 byte 20 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/lib/culling/ObjectCullStates.js @@ -1052,7 +1052,7 @@ - 6290 byte 207 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/lib/earcut.js @@ -1060,7 +1060,7 @@ - 20369 byte 676 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/plugins/lib/html/Dot.js @@ -1068,7 +1068,7 @@ - 5811 byte 179 - 2024-04-02 18:18:27 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/lib/html/Label.js @@ -1076,7 +1076,7 @@ - 5108 byte 178 - 2024-04-02 18:18:27 (UTC) + 2024-04-04 08:02:02 (UTC) src/plugins/lib/html/Wire.js @@ -1084,7 +1084,7 @@ - 7930 byte 221 - 2024-04-02 18:18:27 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/Configs.js @@ -1092,7 +1092,7 @@ - 3694 byte 127 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/Plugin.js @@ -1100,7 +1100,7 @@ - 7101 byte 232 - 2024-04-02 15:23:24 (UTC) + 2024-03-01 19:24:01 (UTC) src/viewer/Viewer.js @@ -1108,7 +1108,7 @@ - 22369 byte 542 - 2024-04-02 23:53:54 (UTC) + 2024-04-04 11:17:28 (UTC) src/viewer/index.js @@ -1116,7 +1116,7 @@ - 170 byte 4 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/localization/LocaleService.js @@ -1124,7 +1124,7 @@ - 14782 byte 474 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/metadata/IFCObjectDefaultColors.js @@ -1132,7 +1132,7 @@ - 3741 byte 162 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/metadata/IFCObjectDefaults.js @@ -1140,7 +1140,7 @@ - 557 byte 16 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/metadata/MetaModel.js @@ -1148,7 +1148,7 @@ - 15489 byte 431 - 2024-04-02 15:23:24 (UTC) + 2024-03-01 19:24:01 (UTC) src/viewer/metadata/MetaObject.js @@ -1156,7 +1156,7 @@ - 5873 byte 222 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/metadata/MetaScene.js @@ -1164,7 +1164,7 @@ - 11978 byte 341 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/metadata/Property.js @@ -1172,7 +1172,7 @@ - 1041 byte 54 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/metadata/PropertySet.js @@ -1180,7 +1180,7 @@ - 2043 byte 76 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/Bitmap/Bitmap.js @@ -1188,7 +1188,7 @@ - 15012 byte 473 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/Bitmap/index.js @@ -1196,7 +1196,7 @@ - 28 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/CameraControl.js @@ -1204,7 +1204,7 @@ - 59563 byte 1750 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/CameraControl/lib/CameraUpdater.js @@ -1212,7 +1212,7 @@ - 12655 byte 315 - 2024-04-02 23:53:54 (UTC) + 2024-04-04 11:17:19 (UTC) src/viewer/scene/CameraControl/lib/controllers/PanController.js @@ -1220,7 +1220,7 @@ - 4671 byte 111 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/controllers/PickController.js @@ -1228,7 +1228,7 @@ - 8769 byte 266 - 2024-05-04 22:57:39 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/CameraControl/lib/controllers/PivotController.js @@ -1236,7 +1236,7 @@ - 12936 byte 383 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js @@ -1244,7 +1244,7 @@ - 4708 byte 122 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js @@ -1252,15 +1252,15 @@ - 6692 byte 183 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js - - - 2046 byte + 2012 byte 68 - 2024-04-02 15:23:24 (UTC) + 2024-05-04 09:24:07 (UTC) src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js @@ -1268,7 +1268,7 @@ - 11433 byte 345 - 2024-04-02 22:09:29 (UTC) + 2024-04-05 09:46:59 (UTC) src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js @@ -1276,7 +1276,7 @@ - 13907 byte 375 - 2024-05-04 22:57:39 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js @@ -1284,7 +1284,7 @@ - 11023 byte 288 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js @@ -1292,7 +1292,7 @@ - 7746 byte 234 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/Component.js @@ -1300,7 +1300,7 @@ - 28735 byte 915 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/Entity.js @@ -1308,7 +1308,7 @@ - 11657 byte 501 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/ImagePlane/ImagePlane.js @@ -1316,7 +1316,7 @@ - 18417 byte 570 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/ImagePlane/index.js @@ -1324,7 +1324,7 @@ - 32 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/LineSet/LineSet.js @@ -1332,7 +1332,7 @@ - 5038 byte 163 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/LineSet/index.js @@ -1340,7 +1340,7 @@ - 29 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/camera/Camera.js @@ -1348,7 +1348,7 @@ - 28319 byte 912 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/camera/CameraFlightAnimation.js @@ -1356,7 +1356,7 @@ - 22766 byte 669 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/camera/CameraPath.js @@ -1364,7 +1364,7 @@ - 6253 byte 193 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/camera/CameraPathAnimation.js @@ -1372,7 +1372,7 @@ - 9809 byte 325 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/camera/CustomProjection.js @@ -1380,7 +1380,7 @@ - 4244 byte 148 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/camera/Frustum.js @@ -1388,7 +1388,7 @@ - 8978 byte 315 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/camera/Ortho.js @@ -1396,7 +1396,7 @@ - 7905 byte 285 - 2024-04-02 15:23:24 (UTC) + 2024-03-02 10:53:28 (UTC) src/viewer/scene/camera/Perspective.js @@ -1404,7 +1404,7 @@ - 8759 byte 307 - 2024-04-02 15:23:24 (UTC) + 2024-03-02 10:53:28 (UTC) src/viewer/scene/camera/index.js @@ -1412,7 +1412,7 @@ - 74 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/canvas/Canvas.js @@ -1420,7 +1420,7 @@ - 15030 byte 489 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/canvas/Spinner.js @@ -1428,7 +1428,7 @@ - 10514 byte 323 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/constants/constants.js @@ -1503,7 +1503,7 @@ - 12951 byte 370 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/core.js @@ -1511,7 +1511,7 @@ - 8905 byte 270 - 2024-04-02 15:23:24 (UTC) + 2024-03-02 10:53:28 (UTC) src/viewer/scene/geometry/Geometry.js @@ -1519,7 +1519,7 @@ - 901 byte 33 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/geometry/ReadableGeometry.js @@ -1527,7 +1527,7 @@ - 23620 byte 681 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/VBOGeometry.js @@ -1535,7 +1535,7 @@ - 11221 byte 318 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildBoxGeometry.js @@ -1543,7 +1543,7 @@ - 5979 byte 238 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js @@ -1552,7 +1552,7 @@ - 7865 byte 238 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildCylinderGeometry.js @@ -1560,7 +1560,7 @@ - 7672 byte 271 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildGridGeometry.js @@ -1568,7 +1568,7 @@ - 2650 byte 102 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildPlaneGeometry.js @@ -1576,7 +1576,7 @@ - 4592 byte 168 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildPolylineGeometry.js @@ -1585,7 +1585,7 @@ - 7999 byte 205 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildSphereGeometry.js @@ -1593,7 +1593,7 @@ - 4302 byte 161 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildTorusGeometry.js @@ -1601,7 +1601,7 @@ - 4810 byte 172 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/buildVectorTextGeometry.js @@ -1609,7 +1609,7 @@ - 34318 byte 1721 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/builders/index.js @@ -1617,7 +1617,7 @@ - 380 byte 8 - 2024-04-02 15:23:24 (UTC) + 2024-03-02 10:53:28 (UTC) src/viewer/scene/geometry/index.js @@ -1625,7 +1625,7 @@ - 145 byte 3 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/geometry/loaders/index.js @@ -1633,7 +1633,7 @@ - 75 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/geometry/loaders/load3DSGeometry.js @@ -1641,7 +1641,7 @@ - 2988 byte 101 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/geometry/loaders/loadOBJGeometry.js @@ -1649,7 +1649,7 @@ - 4256 byte 128 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/index.js @@ -1657,7 +1657,7 @@ - 773 byte 21 - 2024-04-07 20:43:31 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/input/Input.js @@ -1665,7 +1665,7 @@ - 32500 byte 1333 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/libs/k3d.js @@ -1673,7 +1673,7 @@ - 33057 byte 1031 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/lights/AmbientLight.js @@ -1681,7 +1681,7 @@ - 5023 byte 175 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/lights/CubeTexture.js @@ -1689,7 +1689,7 @@ - 5020 byte 155 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/lights/DirLight.js @@ -1697,7 +1697,7 @@ - 9958 byte 314 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/lights/Light.js @@ -1705,7 +1705,7 @@ - 458 byte 29 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/lights/LightMap.js @@ -1713,7 +1713,7 @@ - 2512 byte 77 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/lights/PointLight.js @@ -1721,7 +1721,7 @@ - 12440 byte 395 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/lights/ReflectionMap.js @@ -1729,7 +1729,7 @@ - 2523 byte 79 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/lights/Shadow.js @@ -1737,7 +1737,7 @@ - 3258 byte 139 - 2024-04-01 18:51:49 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/lights/index.js @@ -1745,15 +1745,15 @@ - 165 byte 4 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/marker/Marker.js Marker - - 13485 byte + 13493 byte 381 - 2024-04-07 23:46:47 (UTC) + 2024-05-04 07:57:02 (UTC) src/viewer/scene/marker/SpriteMarker.js @@ -1761,7 +1761,7 @@ - 10904 byte 355 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/marker/index.js @@ -1769,7 +1769,7 @@ - 63 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/materials/EdgeMaterial.js @@ -1777,7 +1777,7 @@ - 10184 byte 358 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/EmphasisMaterial.js @@ -1785,7 +1785,7 @@ - 17553 byte 613 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/materials/Fresnel.js @@ -1793,7 +1793,7 @@ - 5488 byte 221 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/LambertMaterial.js @@ -1801,7 +1801,7 @@ - 12230 byte 377 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/LinesMaterial.js @@ -1809,7 +1809,7 @@ - 4014 byte 168 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/Material.js @@ -1817,7 +1817,7 @@ - 1470 byte 39 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/materials/MetallicMaterial.js @@ -1825,7 +1825,7 @@ - 31895 byte 819 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/PhongMaterial.js @@ -1833,7 +1833,7 @@ - 30165 byte 859 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/PointsMaterial.js @@ -1841,7 +1841,7 @@ - 12177 byte 408 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/SpecularMaterial.js @@ -1849,7 +1849,7 @@ - 31026 byte 806 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/materials/Texture.js @@ -1857,7 +1857,7 @@ - 18213 byte 512 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/materials/index.js @@ -1865,7 +1865,7 @@ - 285 byte 7 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/Frustum.js @@ -1873,7 +1873,7 @@ - 2982 byte 118 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/buildEdgeIndices.js @@ -1881,7 +1881,7 @@ - 6156 byte 161 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/geometryCompressionUtils.js @@ -1889,7 +1889,7 @@ - 11617 byte 364 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/index.js @@ -1897,7 +1897,7 @@ - 89 byte 3 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/math.js @@ -1905,7 +1905,7 @@ - 144856 byte 5386 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/math/rtcCoords.js @@ -1913,7 +1913,7 @@ - 5183 byte 138 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mementos/CameraMemento.js @@ -1921,7 +1921,7 @@ - 6300 byte 199 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mementos/ModelMemento.js @@ -1929,7 +1929,7 @@ - 9363 byte 262 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mementos/ObjectsMemento.js @@ -1937,7 +1937,7 @@ - 9248 byte 258 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mementos/index.js @@ -1945,7 +1945,7 @@ - 107 byte 2 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/Mesh.js @@ -1953,7 +1953,7 @@ - 72822 byte 2202 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/mesh/draw/DrawRenderer.js @@ -1961,7 +1961,7 @@ - 48160 byte 995 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/draw/DrawShaderSource.js @@ -1969,7 +1969,7 @@ - 69127 byte 1569 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js @@ -1977,7 +1977,7 @@ - 8783 byte 259 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js @@ -1985,7 +1985,7 @@ - 6089 byte 158 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js @@ -1993,7 +1993,7 @@ - 11309 byte 286 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js @@ -2001,7 +2001,7 @@ - 10576 byte 261 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/index.js @@ -2009,7 +2009,7 @@ - 27 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/occlusion/OcclusionRenderer.js @@ -2017,7 +2017,7 @@ - 7932 byte 221 - 2024-04-03 11:23:43 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js @@ -2025,7 +2025,7 @@ - 5613 byte 156 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/pick/PickMeshRenderer.js @@ -2033,7 +2033,7 @@ - 8129 byte 223 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/pick/PickMeshShaderSource.js @@ -2041,7 +2041,7 @@ - 5611 byte 150 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/pick/PickTriangleRenderer.js @@ -2049,7 +2049,7 @@ - 7274 byte 200 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/pick/PickTriangleShaderSource.js @@ -2057,7 +2057,7 @@ - 4540 byte 123 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/shadow/ShadowRenderer.js @@ -2065,7 +2065,7 @@ - 7888 byte 214 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/mesh/shadow/ShadowShaderSource.js @@ -2073,7 +2073,7 @@ - 3492 byte 97 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/metriqs/Metriqs.js @@ -2081,7 +2081,7 @@ - 7723 byte 258 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/ENTITY_FLAGS.js @@ -2089,7 +2089,7 @@ - 618 byte 20 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/PerformanceModel.js @@ -2097,7 +2097,7 @@ - 743 byte 26 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/RENDER_PASSES.js @@ -2105,7 +2105,7 @@ - 593 byte 33 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/SceneModel.js @@ -2113,7 +2113,7 @@ - 162609 byte 4042 - 2024-04-02 12:49:43 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/model/SceneModelEntity.js @@ -2121,7 +2121,7 @@ - 21590 byte 715 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/SceneModelMesh.js @@ -2129,7 +2129,7 @@ - 9147 byte 341 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/SceneModelTexture.js @@ -2137,7 +2137,7 @@ - 778 byte 38 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/SceneModelTextureSet.js @@ -2145,15 +2145,15 @@ - 1412 byte 59 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/SceneModelTransform.js SceneModelTransform - - 11462 byte + 11474 byte 404 - 2024-05-05 16:13:27 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/VBOSceneModel.js @@ -2161,7 +2161,7 @@ - 731 byte 26 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/calculateUniquePositions.js @@ -2169,7 +2169,7 @@ - 4502 byte 125 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/compression.js @@ -2177,7 +2177,7 @@ - 7541 byte 226 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/BindableDataTexture.js @@ -2185,7 +2185,7 @@ - 935 byte 30 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js @@ -2193,7 +2193,7 @@ - 841 byte 27 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/DTXLinesState.js @@ -2201,7 +2201,7 @@ - 2053 byte 46 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js @@ -2209,7 +2209,7 @@ - 18690 byte 410 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/dataTextureRamStats.js @@ -2217,7 +2217,7 @@ - 1485 byte 49 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/rebucketPositions.js @@ -2225,7 +2225,7 @@ - 7386 byte 207 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js @@ -2233,7 +2233,7 @@ - 17476 byte 389 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js @@ -2241,7 +2241,7 @@ - 1714 byte 65 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js @@ -2249,7 +2249,7 @@ - 1320 byte 46 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js @@ -2257,7 +2257,7 @@ - 7840 byte 250 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js @@ -2265,7 +2265,7 @@ - 23249 byte 517 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js @@ -2273,7 +2273,7 @@ - 1628 byte 54 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js @@ -2281,7 +2281,7 @@ - 27214 byte 619 - 2024-04-01 16:20:52 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js @@ -2289,7 +2289,7 @@ - 19933 byte 464 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js @@ -2297,7 +2297,7 @@ - 17993 byte 414 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js @@ -2305,7 +2305,7 @@ - 19149 byte 422 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js @@ -2313,7 +2313,7 @@ - 14744 byte 345 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js @@ -2321,7 +2321,7 @@ - 19926 byte 436 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js @@ -2329,7 +2329,7 @@ - 21023 byte 462 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js @@ -2337,7 +2337,7 @@ - 20072 byte 431 - 2024-04-02 15:23:24 (UTC) + 2024-03-02 10:53:28 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js @@ -2345,7 +2345,7 @@ - 20866 byte 455 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js @@ -2353,7 +2353,7 @@ - 19294 byte 440 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js @@ -2361,7 +2361,7 @@ - 11122 byte 307 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js @@ -2369,7 +2369,7 @@ - 20359 byte 465 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js @@ -2377,7 +2377,7 @@ - 22404 byte 466 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js @@ -2385,7 +2385,7 @@ - 20048 byte 427 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/index.js @@ -2393,7 +2393,7 @@ - 151 byte 4 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/rebucketPositions.js @@ -2401,7 +2401,7 @@ - 12800 byte 353 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/ScratchMemory.js @@ -2409,7 +2409,7 @@ - 1335 byte 62 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/VBORenderer.js @@ -2417,7 +2417,7 @@ - 25466 byte 654 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js @@ -2425,7 +2425,7 @@ - 24046 byte 699 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js @@ -2433,7 +2433,7 @@ - 449 byte 19 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js @@ -2441,7 +2441,7 @@ - 13338 byte 316 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js @@ -2449,7 +2449,7 @@ - 4735 byte 114 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js @@ -2457,7 +2457,7 @@ - 3024 byte 99 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js @@ -2465,7 +2465,7 @@ - 4716 byte 124 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js @@ -2473,7 +2473,7 @@ - 13166 byte 311 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js @@ -2481,7 +2481,7 @@ - 12701 byte 309 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js @@ -2489,7 +2489,7 @@ - 499 byte 23 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js @@ -2497,7 +2497,7 @@ - 484 byte 20 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js @@ -2505,7 +2505,7 @@ - 24951 byte 718 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js @@ -2513,7 +2513,7 @@ - 462 byte 24 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js @@ -2521,7 +2521,7 @@ - 6330 byte 167 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js @@ -2529,7 +2529,7 @@ - 5537 byte 136 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js @@ -2537,7 +2537,7 @@ - 6329 byte 156 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js @@ -2545,7 +2545,7 @@ - 5809 byte 147 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js @@ -2553,7 +2553,7 @@ - 4722 byte 144 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js @@ -2561,7 +2561,7 @@ - 4472 byte 107 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js @@ -2569,7 +2569,7 @@ - 5800 byte 146 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js @@ -2577,7 +2577,7 @@ - 13054 byte 309 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js @@ -2585,7 +2585,7 @@ - 12452 byte 303 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js @@ -2593,7 +2593,7 @@ - 569 byte 24 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js @@ -2601,7 +2601,7 @@ - 48351 byte 1257 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js @@ -2609,7 +2609,7 @@ - 5342 byte 130 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js @@ -2617,7 +2617,7 @@ - 5237 byte 134 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js @@ -2625,7 +2625,7 @@ - 256 byte 12 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js @@ -2633,7 +2633,7 @@ - 13363 byte 375 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js @@ -2641,7 +2641,7 @@ - 984 byte 34 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js @@ -2649,7 +2649,7 @@ - 10382 byte 243 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js @@ -2657,7 +2657,7 @@ - 11949 byte 275 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js @@ -2665,7 +2665,7 @@ - 5404 byte 126 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js @@ -2673,7 +2673,7 @@ - 10105 byte 240 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js @@ -2681,7 +2681,7 @@ - 5675 byte 139 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js @@ -2689,7 +2689,7 @@ - 5180 byte 125 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js @@ -2697,7 +2697,7 @@ - 25788 byte 561 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js @@ -2705,7 +2705,7 @@ - 5598 byte 144 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js @@ -2713,7 +2713,7 @@ - 5064 byte 130 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js @@ -2721,7 +2721,7 @@ - 5114 byte 121 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js @@ -2729,7 +2729,7 @@ - 5563 byte 131 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js @@ -2737,7 +2737,7 @@ - 4485 byte 107 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js @@ -2745,7 +2745,7 @@ - 5679 byte 143 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js @@ -2753,7 +2753,7 @@ - 13163 byte 311 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js @@ -2761,7 +2761,7 @@ - 12709 byte 308 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/float16.js @@ -2769,7 +2769,7 @@ - 19412 byte 759 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js @@ -2777,7 +2777,7 @@ - 24299 byte 703 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js @@ -2785,7 +2785,7 @@ - 6067 byte 148 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js @@ -2793,7 +2793,7 @@ - 614 byte 25 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js @@ -2801,7 +2801,7 @@ - 4316 byte 139 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js @@ -2809,7 +2809,7 @@ - 5010 byte 127 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js @@ -2817,7 +2817,7 @@ - 13705 byte 331 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js @@ -2825,7 +2825,7 @@ - 13230 byte 316 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js @@ -2833,7 +2833,7 @@ - 25727 byte 728 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js @@ -2841,7 +2841,7 @@ - 6671 byte 173 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js @@ -2849,7 +2849,7 @@ - 6476 byte 155 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js @@ -2857,7 +2857,7 @@ - 5805 byte 149 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js @@ -2865,7 +2865,7 @@ - 6682 byte 170 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js @@ -2873,7 +2873,7 @@ - 6091 byte 152 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js @@ -2881,7 +2881,7 @@ - 588 byte 26 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js @@ -2889,7 +2889,7 @@ - 5951 byte 174 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js @@ -2897,7 +2897,7 @@ - 5065 byte 118 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js @@ -2905,7 +2905,7 @@ - 6332 byte 154 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js @@ -2913,7 +2913,7 @@ - 13794 byte 330 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js @@ -2921,7 +2921,7 @@ - 12945 byte 311 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js @@ -2929,7 +2929,7 @@ - 5799 byte 150 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js @@ -2937,7 +2937,7 @@ - 46277 byte 1190 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js @@ -2945,7 +2945,7 @@ - 5598 byte 134 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js @@ -2953,7 +2953,7 @@ - 5403 byte 136 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js @@ -2961,7 +2961,7 @@ - 272 byte 12 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js @@ -2969,7 +2969,7 @@ - 13388 byte 376 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js @@ -2977,7 +2977,7 @@ - 11114 byte 258 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js @@ -2985,7 +2985,7 @@ - 12348 byte 283 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js @@ -2993,7 +2993,7 @@ - 5127 byte 126 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js @@ -3001,7 +3001,7 @@ - 10486 byte 249 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js @@ -3009,7 +3009,7 @@ - 5564 byte 130 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js @@ -3017,7 +3017,7 @@ - 850 byte 28 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js @@ -3025,7 +3025,7 @@ - 6005 byte 138 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js @@ -3033,7 +3033,7 @@ - 5461 byte 128 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js @@ -3041,7 +3041,7 @@ - 25949 byte 561 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js @@ -3049,7 +3049,7 @@ - 5896 byte 149 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js @@ -3057,7 +3057,7 @@ - 5387 byte 136 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js @@ -3065,7 +3065,7 @@ - 5418 byte 130 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js @@ -3073,7 +3073,7 @@ - 6168 byte 145 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js @@ -3081,7 +3081,7 @@ - 4752 byte 113 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js @@ -3089,7 +3089,7 @@ - 6003 byte 147 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js @@ -3097,7 +3097,7 @@ - 14330 byte 342 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js @@ -3105,7 +3105,7 @@ - 13700 byte 325 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/nodes/Node.js @@ -3113,7 +3113,7 @@ - 43771 byte 1383 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/nodes/index.js @@ -3121,7 +3121,7 @@ - 27 byte 1 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/CubicBezierCurve.js @@ -3129,7 +3129,7 @@ - 5741 byte 194 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/Curve.js @@ -3137,7 +3137,7 @@ - 5289 byte 182 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/Path.js @@ -3145,7 +3145,7 @@ - 7337 byte 238 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/QuadraticBezierCurve.js @@ -3153,7 +3153,7 @@ - 4910 byte 160 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/SplineCurve.js @@ -3161,7 +3161,7 @@ - 4419 byte 132 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/paths/index.js @@ -3169,7 +3169,7 @@ - 170 byte 4 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/postfx/CrossSections.js @@ -3177,7 +3177,7 @@ - 6768 byte 202 - 2024-05-05 16:13:27 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/postfx/SAO.js @@ -3185,7 +3185,7 @@ - 14596 byte 543 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/scene/Scene.js @@ -3193,7 +3193,7 @@ - 96464 byte 2810 - 2024-05-05 11:18:57 (UTC) + 2024-05-07 11:42:50 (UTC) src/viewer/scene/sectionPlane/SectionPlane.js @@ -3201,7 +3201,7 @@ - 5678 byte 198 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/sectionPlane/SectionPlaneCache.js @@ -3209,7 +3209,7 @@ - 2885 byte 101 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/sectionPlane/index.js @@ -3217,7 +3217,7 @@ - 34 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/skybox/Skybox.js @@ -3225,7 +3225,7 @@ - 4576 byte 123 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/skybox/index.js @@ -3233,7 +3233,7 @@ - 28 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/stats.js @@ -3241,7 +3241,7 @@ - 1279 byte 43 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils.js @@ -3249,7 +3249,7 @@ - 11171 byte 453 - 2024-04-02 15:23:24 (UTC) + 2024-03-01 19:24:01 (UTC) src/viewer/scene/utils/Cache.js @@ -3257,7 +3257,7 @@ - 472 byte 29 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/FileLoader.js @@ -3265,7 +3265,7 @@ - 6200 byte 161 - 2024-04-02 15:23:24 (UTC) + 2024-03-01 19:24:01 (UTC) src/viewer/scene/utils/Loader.js @@ -3273,7 +3273,7 @@ - 1155 byte 55 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/LoadingManager.js @@ -3282,7 +3282,7 @@ - 2107 byte 86 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/Map.js @@ -3290,7 +3290,7 @@ - 1081 byte 45 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/Queue.js @@ -3298,7 +3298,7 @@ - 1220 byte 55 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/WorkerPool.js @@ -3306,7 +3306,7 @@ - 1966 byte 73 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/index.js @@ -3314,7 +3314,7 @@ - 199 byte 5 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js @@ -3322,7 +3322,7 @@ - 25698 byte 650 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js @@ -3330,7 +3330,7 @@ - 43 byte - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js @@ -3338,7 +3338,7 @@ - 987 byte 30 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/utils/textureTranscoders/index.js @@ -3346,7 +3346,7 @@ - 90 byte 2 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/viewport/Viewport.js @@ -3354,7 +3354,7 @@ - 5838 byte 211 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/ArrayBuf.js @@ -3362,7 +3362,7 @@ - 3263 byte 121 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Attribute.js @@ -3370,7 +3370,7 @@ - 604 byte 23 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Drawable.js @@ -3378,7 +3378,7 @@ - 7675 byte 269 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/FrameContext.js @@ -3386,7 +3386,7 @@ - 9384 byte 312 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/PickResult.js @@ -3394,7 +3394,7 @@ - 8930 byte 371 - 2024-04-02 23:54:00 (UTC) + 2024-04-04 11:17:28 (UTC) src/viewer/scene/webgl/Pickable.js @@ -3402,7 +3402,7 @@ - 2228 byte 68 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Program.js @@ -3410,7 +3410,7 @@ - 5883 byte 180 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/RenderBuffer.js @@ -3418,7 +3418,7 @@ - 13345 byte 378 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/RenderBufferManager.js @@ -3426,7 +3426,7 @@ - 953 byte 33 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/RenderFlags.js @@ -3434,7 +3434,7 @@ - 7322 byte 202 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/RenderState.js @@ -3442,7 +3442,7 @@ - 994 byte 39 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Renderer.js @@ -3450,7 +3450,7 @@ - 62434 byte 1781 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Sampler.js @@ -3458,7 +3458,7 @@ - 377 byte 17 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Shader.js @@ -3466,7 +3466,7 @@ - 1248 byte 48 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/Texture2D.js @@ -3474,7 +3474,7 @@ - 15594 byte 441 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/convertConstant.js @@ -3482,7 +3482,7 @@ - 9939 byte 243 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/getExtension.js @@ -3490,7 +3490,7 @@ - 1370 byte 31 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/occlusion/OcclusionLayer.js @@ -3498,7 +3498,7 @@ - 7656 byte 216 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/webgl/occlusion/OcclusionTester.js @@ -3506,7 +3506,7 @@ - 15415 byte 426 - 2024-04-07 23:46:47 (UTC) + 2024-04-04 08:02:02 (UTC) src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js @@ -3514,7 +3514,7 @@ - 11457 byte 323 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js @@ -3522,7 +3522,7 @@ - 14033 byte 375 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webgl/webglEnums.js @@ -3530,7 +3530,7 @@ - 1784 byte 60 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) src/viewer/scene/webglInfo.js @@ -3538,7 +3538,7 @@ - 2030 byte 46 - 2024-04-02 15:23:24 (UTC) + 2024-02-06 02:54:27 (UTC) diff --git a/examples/measurement/angle_createWithMouse_nosnapping.html b/examples/measurement/angle_createWithMouse_nosnapping.html index 0038a3a2f7..0c8de6ff57 100644 --- a/examples/measurement/angle_createWithMouse_nosnapping.html +++ b/examples/measurement/angle_createWithMouse_nosnapping.html @@ -163,6 +163,14 @@

    Assets

    doAction: function (context) { context.angleMeasurement.destroy(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] @@ -527,6 +535,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] @@ -722,6 +738,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] diff --git a/examples/measurement/angle_createWithMouse_snapping.html b/examples/measurement/angle_createWithMouse_snapping.html index 8d4be948ae..f34af37d7d 100644 --- a/examples/measurement/angle_createWithMouse_snapping.html +++ b/examples/measurement/angle_createWithMouse_snapping.html @@ -172,6 +172,16 @@

    Assets

    context.angleMeasurement.destroy(); } } + ], + [ + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } + } ] ] @@ -514,6 +524,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] @@ -709,6 +727,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] diff --git a/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html b/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html index 3cd48b1b17..0924c4fa25 100644 --- a/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html +++ b/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html @@ -172,7 +172,16 @@

    Assets

    context.angleMeasurement.destroy(); } } - ] + ], + [ + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } + }] ] }); @@ -500,6 +509,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] @@ -695,6 +712,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] diff --git a/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html b/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html index 348804a110..c9e993747c 100644 --- a/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html +++ b/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html @@ -494,6 +494,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] @@ -689,6 +697,14 @@

    Assets

    doAction: function (context) { angleMeasurementsPlugin.clear(); } + }, + { + getTitle: () => { + return "Cancel Measurement"; + }, + doAction: function () { + angleMeasurementsMouseControl.reset(); + } } ] ] diff --git a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html index 90f1424b7d..0baf1389b2 100644 --- a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html +++ b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html @@ -266,7 +266,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_nosnapping.html b/examples/measurement/distance_createWithMouse_nosnapping.html index 79fd40a958..6933e2e368 100644 --- a/examples/measurement/distance_createWithMouse_nosnapping.html +++ b/examples/measurement/distance_createWithMouse_nosnapping.html @@ -223,7 +223,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -262,7 +262,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping.html b/examples/measurement/distance_createWithMouse_snapping.html index 5a26b2cfb5..9ee1623cd0 100644 --- a/examples/measurement/distance_createWithMouse_snapping.html +++ b/examples/measurement/distance_createWithMouse_snapping.html @@ -252,7 +252,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -291,7 +291,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html index 8593d2dea9..5269b0ec73 100644 --- a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html +++ b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html @@ -234,7 +234,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -273,7 +273,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html index 8b330a9080..2c86aeef42 100644 --- a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html +++ b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html @@ -247,7 +247,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -286,7 +286,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html index 08749aed0c..1c8e8e7a42 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html @@ -424,7 +424,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -463,7 +463,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html index 004cb69db5..0cc605de46 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html @@ -461,7 +461,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -500,7 +500,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html index 5bca580999..a2594d7c3b 100644 --- a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html +++ b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html @@ -233,7 +233,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -272,7 +272,7 @@

    Assets

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html index 8ed1dfac0a..a06ea23660 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html @@ -451,7 +451,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html index c43213a221..7d503a8cb5 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html @@ -429,7 +429,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); @@ -468,7 +468,7 @@

    Tutorials

    }, { getTitle: () => { - return "Reset Control"; + return "Cancel Measurement"; }, doAction: function () { distanceMeasurementsMouseControl.reset(); diff --git a/package.json b/package.json index 0640070b41..61818abdea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xeokit/xeokit-sdk", - "version": "2.6.10", + "version": "2.6.11", "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics", "module": "./dist/xeokit-sdk.es.js", "main": "./dist/xeokit-sdk.cjs.js", diff --git a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js index e6de47ae0b..fb66e3d5c0 100644 --- a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +++ b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js @@ -72,6 +72,16 @@ export class AngleMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + * @abstract + */ + get currentMeasurement() { + return null; + } + /** * Destroys this AngleMeasurementsMouseControl. * diff --git a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js index 9b53f544ce..459367f02b 100644 --- a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +++ b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js @@ -440,6 +440,15 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl { this._mouseState = MOUSE_FINDING_ORIGIN; } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsMouseControl. */ diff --git a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js index 301cb65c0e..7932e40839 100644 --- a/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +++ b/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js @@ -908,6 +908,15 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl { } } + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() { + return this._currentAngleMeasurement; + } + /** * Destroys this AngleMeasurementsTouchControl. */ diff --git a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js index 2ef8823216..9ef94832eb 100644 --- a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +++ b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js @@ -72,6 +72,17 @@ export class DistanceMeasurementsControl extends Component { reset() { } + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + * + * @abstract + */ + get currentMeasurement() { + return null; + } + /** * Destroys this DistanceMeasurementsControl. * diff --git a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js index 42ff677c1e..68c2d4d7b6 100644 --- a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +++ b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js @@ -401,6 +401,15 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro this._mouseState = MOUSE_FIRST_CLICK_EXPECTED; } + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; + } + /** * Destroys this DistanceMeasurementsMouseControl. * diff --git a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js index f86216be3d..3b77ccaf9e 100644 --- a/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +++ b/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js @@ -748,6 +748,16 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro this._currentDistanceMeasurement.destroy(); this._currentDistanceMeasurement = null; } + this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START; + } + + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() { + return this._currentDistanceMeasurement; } /** diff --git a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts index 5a430c7e3b..2df7a8576d 100644 --- a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +++ b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts @@ -55,6 +55,13 @@ export declare class AngleMeasurementsControl extends Component { */ deactivate(): void; + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() : AngleMeasurement + /** * Resets this AngleMeasurementsControl. * diff --git a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts index 1bef718d02..759d5c056f 100644 --- a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +++ b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts @@ -1,6 +1,7 @@ import {AngleMeasurementsControl} from "./AngleMeasurementsControl.js"; import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin"; import {PointerLens} from "../../extras/"; +import {AngleMeasurement} from "./AngleMeasurement"; /** * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input. @@ -87,6 +88,13 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl { */ reset(): void; + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() : AngleMeasurement + /** * Destroys this AngleMeasurementsMouseControl. */ diff --git a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts index a438752e71..763e83ee0b 100644 --- a/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +++ b/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts @@ -1,6 +1,7 @@ import { AngleMeasurementsControl } from "./AngleMeasurementsControl"; import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin"; import {PointerLens} from "../../extras/"; +import {AngleMeasurement} from "./AngleMeasurement"; /** * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from touch input. @@ -87,6 +88,13 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl { */ reset(): void; + /** + * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any. + * + * @returns {null|AngleMeasurement} + */ + get currentMeasurement() : AngleMeasurement + /** * Destroys this AngleMeasurementsTouchControl. */ diff --git a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts index 62383538c3..398fa5c44c 100644 --- a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +++ b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts @@ -54,6 +54,13 @@ export declare class DistanceMeasurementsControl extends Component { */ deactivate(): void; + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() : DistanceMeasurement + /** * Resets this DistanceMeasurementsControl. * diff --git a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts index 3b3fc78dd5..3cbd3f5b8b 100644 --- a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts +++ b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts @@ -2,6 +2,7 @@ import {DistanceMeasurementsControl} from "./DistanceMeasurementsControl.js"; import {DistanceMeasurementsPlugin} from "./DistanceMeasurementsPlugin"; import {PointerLens} from "../../extras/PointerLens/PointerLens"; +import {DistanceMeasurement} from "./DistanceMeasurement"; /** * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from mouse input. @@ -66,6 +67,13 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro */ reset(): void; + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() : DistanceMeasurement + /** * Destroys this DistanceMeasurementsMouseControl. */ diff --git a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts index e3a03ad2d4..08c1323f03 100644 --- a/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +++ b/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts @@ -1,6 +1,7 @@ import {DistanceMeasurementsControl} from "./DistanceMeasurementsControl"; import {DistanceMeasurementsPlugin} from "./DistanceMeasurementsPlugin"; import {PointerLens} from "../../extras/"; +import {DistanceMeasurement} from "./DistanceMeasurement"; /** * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from touch input. @@ -65,6 +66,13 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro */ reset(): void; + /** + * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any. + * + * @returns {null|DistanceMeasurement} + */ + get currentMeasurement() : DistanceMeasurement + /** * Destroys this DistanceMeasurementsTouchControl. */ From f5931e21d3ca6ad7d29ac5a060fa8cfa382157fb Mon Sep 17 00:00:00 2001 From: xeolabs Date: Wed, 15 May 2024 14:59:14 +0200 Subject: [PATCH 3/3] Destroy measurement in progress when resetting measurement controls --- examples/measurement/angle_createWithMouse_nosnapping.html | 4 ++++ examples/measurement/angle_createWithMouse_snapping.html | 3 +++ .../angle_createWithMouse_snapping_canvasToPagePos.html | 3 +++ .../angle_createWithMouse_snapping_offsetCanvas.html | 3 +++ .../distance_createWithMouse_labelsNotOnWires.html | 3 +++ .../measurement/distance_createWithMouse_nosnapping.html | 3 +++ examples/measurement/distance_createWithMouse_snapping.html | 3 +++ ...tance_createWithMouse_snapping_OpenProject_Hospital.html | 6 ++++++ .../distance_createWithMouse_snapping_canvasToPagePos.html | 6 ++++++ .../distance_createWithMouse_snapping_dtx_batching.html | 6 ++++++ .../distance_createWithMouse_snapping_dtx_instancing.html | 6 ++++++ .../distance_createWithMouse_snapping_offsetCanvas.html | 6 ++++++ .../distance_createWithMouse_snapping_vbo_batching.html | 3 +++ .../distance_createWithMouse_snapping_vbo_instancing.html | 6 ++++++ 14 files changed, 61 insertions(+) diff --git a/examples/measurement/angle_createWithMouse_nosnapping.html b/examples/measurement/angle_createWithMouse_nosnapping.html index 0c8de6ff57..faf22e422f 100644 --- a/examples/measurement/angle_createWithMouse_nosnapping.html +++ b/examples/measurement/angle_createWithMouse_nosnapping.html @@ -532,6 +532,7 @@

    Assets

    getEnabled: function (context) { return (Object.keys(angleMeasurementsPlugin.measurements).length > 0); }, + doAction: function (context) { angleMeasurementsPlugin.clear(); } @@ -540,6 +541,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function (context) { + return (!!angleMeasurementsPlugin.currentMeasurement); + }, doAction: function () { angleMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/angle_createWithMouse_snapping.html b/examples/measurement/angle_createWithMouse_snapping.html index f34af37d7d..c80a24a3db 100644 --- a/examples/measurement/angle_createWithMouse_snapping.html +++ b/examples/measurement/angle_createWithMouse_snapping.html @@ -732,6 +732,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!angleMeasurementsPlugin.currentMeasurement); + }, doAction: function () { angleMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html b/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html index 0924c4fa25..8b0a39eecd 100644 --- a/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html +++ b/examples/measurement/angle_createWithMouse_snapping_canvasToPagePos.html @@ -717,6 +717,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!angleMeasurementsPlugin.currentMeasurement); + }, doAction: function () { angleMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html b/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html index c9e993747c..f135e73708 100644 --- a/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html +++ b/examples/measurement/angle_createWithMouse_snapping_offsetCanvas.html @@ -702,6 +702,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!angleMeasurementsPlugin.currentMeasurement); + }, doAction: function () { angleMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html index 0baf1389b2..3fb8153606 100644 --- a/examples/measurement/distance_createWithMouse_labelsNotOnWires.html +++ b/examples/measurement/distance_createWithMouse_labelsNotOnWires.html @@ -268,6 +268,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_nosnapping.html b/examples/measurement/distance_createWithMouse_nosnapping.html index 6933e2e368..6b2df5ed1a 100644 --- a/examples/measurement/distance_createWithMouse_nosnapping.html +++ b/examples/measurement/distance_createWithMouse_nosnapping.html @@ -264,6 +264,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping.html b/examples/measurement/distance_createWithMouse_snapping.html index 9ee1623cd0..213e44e652 100644 --- a/examples/measurement/distance_createWithMouse_snapping.html +++ b/examples/measurement/distance_createWithMouse_snapping.html @@ -293,6 +293,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html index 5269b0ec73..f14ab5b9fe 100644 --- a/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html +++ b/examples/measurement/distance_createWithMouse_snapping_OpenProject_Hospital.html @@ -236,6 +236,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -275,6 +278,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html index 2c86aeef42..6fd196c582 100644 --- a/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html +++ b/examples/measurement/distance_createWithMouse_snapping_canvasToPagePos.html @@ -249,6 +249,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -288,6 +291,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html index 1c8e8e7a42..37695e2a97 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_batching.html @@ -426,6 +426,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -465,6 +468,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html index 0cc605de46..08985e14ec 100644 --- a/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_dtx_instancing.html @@ -463,6 +463,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -502,6 +505,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html index a2594d7c3b..e11272acd3 100644 --- a/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html +++ b/examples/measurement/distance_createWithMouse_snapping_offsetCanvas.html @@ -235,6 +235,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -274,6 +277,9 @@

    Assets

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html index a06ea23660..b8177b39c6 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_batching.html @@ -453,6 +453,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } diff --git a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html index 7d503a8cb5..d03468d461 100644 --- a/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html +++ b/examples/measurement/distance_createWithMouse_snapping_vbo_instancing.html @@ -431,6 +431,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); } @@ -470,6 +473,9 @@

    Tutorials

    getTitle: () => { return "Cancel Measurement"; }, + getEnabled: function () { + return (!!distanceMeasurementsMouseControl.currentMeasurement); + }, doAction: function () { distanceMeasurementsMouseControl.reset(); }